[chore]: Bump github.com/tdewolff/minify/v2 from 2.22.4 to 2.23.0 (#3974)

Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.22.4 to 2.23.0.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.22.4...v2.23.0)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-version: 2.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2025-04-07 11:05:22 +01:00
committed by GitHub
parent 920e20c2d2
commit e0ea77b730
7 changed files with 56 additions and 19 deletions

View File

@@ -49,6 +49,7 @@ release:
fi; \
rm -rf dist/$$t; \
done
./publish.sh
clean:
echo "Cleaning dist/"

View File

@@ -145,11 +145,11 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
w.Write(t.Data)
}
omitSpace = false
case html.TemplateToken:
w.Write(t.Data)
omitSpace = false
case html.TextToken:
if t.HasTemplate {
w.Write(t.Data)
omitSpace = parse.IsWhitespace(t.Data[len(t.Data)-1])
} else if rawTagHash != 0 {
if rawTagHash != 0 && !t.HasTemplate {
if rawTagHash == Style || rawTagHash == Script || rawTagHash == Iframe {
var mimetype []byte
var params map[string]string
@@ -196,7 +196,7 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
t.Data = t.Data[:len(t.Data)-1]
omitSpace = false
break
} else if next.TokenType == html.TextToken && !parse.IsAllWhitespace(next.Data) {
} else if next.TokenType == html.TextToken && !parse.IsAllWhitespace(next.Data) || next.TokenType == html.TemplateToken {
// stop looking when text encountered
break
} else if next.TokenType == html.StartTagToken || next.TokenType == html.EndTagToken || next.TokenType == html.SvgToken || next.TokenType == html.MathToken {
@@ -215,7 +215,6 @@ func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]st
i++
}
}
w.Write(t.Data)
}
case html.StartTagToken, html.EndTagToken:

35
vendor/github.com/tdewolff/minify/v2/publish.sh generated vendored Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
VERSION=`git describe --tags --abbrev=0 | cut -c 2-`
cd dist
echo ""
echo "Downloading v$VERSION.tar.gz..."
wget -q --show-progress https://github.com/tdewolff/minify/archive/v$VERSION.tar.gz
SHA256=`sha256sum v$VERSION.tar.gz`
SHA256=( $SHA256 )
echo ""
echo "Releasing for AUR..."
cd /home/taco/dev/aur/minify
sed -i "s/^pkgver=.*$/pkgver=$VERSION/" PKGBUILD
sed -i "s/^sha256sums=.*$/sha256sums=('$SHA256')/" PKGBUILD
./build.sh
git commit -am "Update to v$VERSION"
git push
cd -
echo ""
echo "Releasing for Homebrew..."
cd /home/taco/dev/brew/homebrew-tap/Formula
sed -i "s,^ url \".*\"$, url \"https://github.com/tdewolff/minify/archive/v$VERSION.tar.gz\"," minify.rb
sed -i "s/^ sha256 \".*\"$/ sha256 \"$SHA256\"/" minify.rb
git commit -am "Update to v$VERSION"
git push
cd -
#echo ""
#echo "Releasing Python bindings..."
#cd ../bindings/py
#make publish
#cd -

View File

@@ -23,6 +23,7 @@ const (
TextToken
SvgToken
MathToken
TemplateToken
)
// String returns the string representation of a TokenType.
@@ -185,18 +186,19 @@ func (l *Lexer) Next() (TokenType, []byte) {
} else if c == '!' {
l.r.Move(2)
return l.readMarkup()
} else if 0 < len(l.tmplBegin) && l.at(l.tmplBegin...) {
l.r.Move(len(l.tmplBegin))
l.moveTemplate()
l.hasTmpl = true
} else if c == '?' {
l.r.Move(1)
return CommentToken, l.shiftBogusComment()
}
} else if 0 < len(l.tmplBegin) && l.at(l.tmplBegin...) {
if 0 < l.r.Pos() {
l.text = l.r.Shift()
return TextToken, l.text
}
l.r.Move(len(l.tmplBegin))
l.moveTemplate()
l.hasTmpl = true
return TemplateToken, l.r.Shift()
} else if c == 0 && l.r.Err() != nil {
if 0 < l.r.Pos() {
l.text = l.r.Shift()