diff options
author | 2022-09-28 18:30:40 +0100 | |
---|---|---|
committer | 2022-09-28 18:30:40 +0100 | |
commit | a156188b3eb5cb3da44aa1b7452265f5fa38a607 (patch) | |
tree | 7097fa48d56fbabc7c2c8750b1f3bc9321d71c0f /vendor/github.com/tdewolff | |
parent | [bugfix] Fix emphasis being added to emoji shortcodes with markdown parsing (... (diff) | |
download | gotosocial-a156188b3eb5cb3da44aa1b7452265f5fa38a607.tar.xz |
[chore] update dependencies, bump to Go 1.19.1 (#826)
* update dependencies, bump Go version to 1.19
* bump test image Go version
* update golangci-lint
* update gotosocial-drone-build
* sign
* linting, go fmt
* update swagger docs
* update swagger docs
* whitespace
* update contributing.md
* fuckin whoopsie doopsie
* linterino, linteroni
* fix followrequest test not starting processor
* fix other api/client tests not starting processor
* fix remaining tests where processor not started
* bump go-runners version
* don't check last-webfingered-at, processor may have updated this
* update swagger command
* update bun to latest version
* fix embed to work the same as before with new bun
Signed-off-by: kim <grufwub@gmail.com>
Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'vendor/github.com/tdewolff')
-rw-r--r-- | vendor/github.com/tdewolff/minify/v2/.gitignore | 2 | ||||
-rw-r--r-- | vendor/github.com/tdewolff/minify/v2/README.md | 9 | ||||
-rw-r--r-- | vendor/github.com/tdewolff/minify/v2/minify.go | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/vendor/github.com/tdewolff/minify/v2/.gitignore b/vendor/github.com/tdewolff/minify/v2/.gitignore index 341023d5e..68ba5e0bb 100644 --- a/vendor/github.com/tdewolff/minify/v2/.gitignore +++ b/vendor/github.com/tdewolff/minify/v2/.gitignore @@ -21,6 +21,8 @@ bindings/js/node_modules bindings/js/example/package-lock.json bindings/js/example/node_modules bindings/js/example/test.min.html +bindings/py/go.mod +bindings/py/go.sum bindings/py/minify.h bindings/py/minify.so bindings/py/tdewolff_minify.egg-info diff --git a/vendor/github.com/tdewolff/minify/v2/README.md b/vendor/github.com/tdewolff/minify/v2/README.md index 51917f776..d2bfff407 100644 --- a/vendor/github.com/tdewolff/minify/v2/README.md +++ b/vendor/github.com/tdewolff/minify/v2/README.md @@ -59,6 +59,7 @@ Please see https://www.patreon.com/tdewolff for ways to contribute, otherwise pl - [Custom minifier](#custom-minifier-example) - [ResponseWriter](#responsewriter) - [Templates](#templates) + - [FAQ](#faq) - [License](#license) ### Roadmap @@ -717,6 +718,14 @@ Example usage: templates := template.Must(compileTemplates("view.html", "home.html")) ``` +## FAQ +### Newlines remain in minified output +While you might expect the minified output to be on a single line for it to be fully minified, this is not true. In many cases, using a literal newline doesn't affect the file size, and in some cases it may even reduce the file size. + +A typical example is HTML. Whitespace is significant in HTML, meaning that spaces and newlines between or around tags may affect how they are displayed. There is no distinction between a space or a newline and they may be interchanged without affecting the displayed HTML. Remember that a space (0x20) and a newline (0x0A) are both one byte long, so that there is no difference in file size when interchanging them. This minifier removes unnecessary whitespace by replacing stretches of spaces and newlines by a single whitespace character. Specifically, if the stretch of white space characters contains a newline, it will replace it by a newline and otherwise by a space. This doesn't affect the file size, but may help somewhat for debugging or file transmission objectives. + +Another example is JavaScript. Single or double quoted string literals may not contain newline characters but instead need to escape them as `\n`. These are two bytes instead of a single newline byte. Using template literals it is allowed to have literal newline characters and we can use that fact to shave-off one byte! The result is that the minified output contains newlines instead of escaped newline characters, which makes the final file size smaller. Of course, changing from single or double quotes to template literals depends on other factors as well, and this minifier makes a calculation whether the template literal results in a shorter file size or not before converting a string literal. + ## License Released under the [MIT license](LICENSE.md). diff --git a/vendor/github.com/tdewolff/minify/v2/minify.go b/vendor/github.com/tdewolff/minify/v2/minify.go index db747e397..8e2e3fdb0 100644 --- a/vendor/github.com/tdewolff/minify/v2/minify.go +++ b/vendor/github.com/tdewolff/minify/v2/minify.go @@ -284,7 +284,7 @@ func (w *writer) Close() error { // Writer wraps a Writer interface and minifies the stream. // Errors from the minifier are returned by Close on the writer. // The writer must be closed explicitly. -func (m *M) Writer(mediatype string, w io.Writer) *writer { +func (m *M) Writer(mediatype string, w io.Writer) io.WriteCloser { pr, pw := io.Pipe() mw := &writer{pw, sync.WaitGroup{}, nil, false} mw.wg.Add(1) @@ -324,7 +324,7 @@ func (w *responseWriter) Write(b []byte) (int, error) { if mediatype := w.ResponseWriter.Header().Get("Content-Type"); mediatype != "" { w.mediatype = mediatype } - w.writer = w.m.Writer(w.mediatype, w.ResponseWriter) + w.writer = w.m.Writer(w.mediatype, w.ResponseWriter).(*writer) } return w.writer.Write(b) } |