diff --git a/go.mod b/go.mod index a2f9bbcf1..33b43dab4 100644 --- a/go.mod +++ b/go.mod @@ -60,7 +60,7 @@ require ( github.com/spf13/cobra v1.9.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 - github.com/tdewolff/minify/v2 v2.21.3 + github.com/tdewolff/minify/v2 v2.22.3 github.com/technologize/otel-go-contrib v1.1.1 github.com/temoto/robotstxt v1.1.2 github.com/tetratelabs/wazero v1.9.0 @@ -199,7 +199,7 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tdewolff/parse/v2 v2.7.19 // indirect + github.com/tdewolff/parse/v2 v2.7.21 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect github.com/toqueteos/webbrowser v1.2.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect diff --git a/go.sum b/go.sum index eb9766815..7b2422117 100644 --- a/go.sum +++ b/go.sum @@ -409,13 +409,12 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tdewolff/minify/v2 v2.21.3 h1:KmhKNGrN/dGcvb2WDdB5yA49bo37s+hcD8RiF+lioV8= -github.com/tdewolff/minify/v2 v2.21.3/go.mod h1:iGxHaGiONAnsYuo8CRyf8iPUcqRJVB/RhtEcTpqS7xw= -github.com/tdewolff/parse/v2 v2.7.19 h1:7Ljh26yj+gdLFEq/7q9LT4SYyKtwQX4ocNrj45UCePg= -github.com/tdewolff/parse/v2 v2.7.19/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= -github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= -github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739 h1:IkjBCtQOOjIn03u/dMQK9g+Iw9ewps4mCl1nB8Sscbo= -github.com/tdewolff/test v1.0.11-0.20240106005702-7de5f7df4739/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= +github.com/tdewolff/minify/v2 v2.22.3 h1:iWXbYdEwvyMXq+KoZlM7Aybp2ASq1VTibUIUxtiyfWo= +github.com/tdewolff/minify/v2 v2.22.3/go.mod h1:K/R8TT7aivpcU8QCNUU1UdR6etfnFPr7L11TO/X7shk= +github.com/tdewolff/parse/v2 v2.7.21 h1:OCuPFtGr4mXdnfKikQlUb0n654ROJANhBqCk+wioJ/A= +github.com/tdewolff/parse/v2 v2.7.21/go.mod h1:I7TXO37t3aSG9SlPUBefAhgIF8nt7yYUwVGgETIoBcA= +github.com/tdewolff/test v1.0.11 h1:FdLbwQVHxqG16SlkGveC0JVyrJN62COWTRyUFzfbtBE= +github.com/tdewolff/test v1.0.11/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= github.com/technologize/otel-go-contrib v1.1.1 h1:wZH9aSPNWZWIkEh3vfaKfMb15AJ80jJ1aVj/4GZdqIw= github.com/technologize/otel-go-contrib v1.1.1/go.mod h1:dCN/wj2WyUO8aFZFdIN+6tfJHImjTML/8r2YVYAy3So= github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg= diff --git a/vendor/github.com/tdewolff/minify/v2/.gitattributes b/vendor/github.com/tdewolff/minify/v2/.gitattributes index 16a3a8b06..00e227735 100644 --- a/vendor/github.com/tdewolff/minify/v2/.gitattributes +++ b/vendor/github.com/tdewolff/minify/v2/.gitattributes @@ -1,2 +1,2 @@ -benchmarks/sample_* linguist-generated +_benchmarks/sample_* linguist-generated tests/*/corpus/* linguist-generated diff --git a/vendor/github.com/tdewolff/minify/v2/Dockerfile b/vendor/github.com/tdewolff/minify/v2/Dockerfile index 0f7fde443..af9fdd754 100644 --- a/vendor/github.com/tdewolff/minify/v2/Dockerfile +++ b/vendor/github.com/tdewolff/minify/v2/Dockerfile @@ -1,5 +1,5 @@ # Use this image to build the executable -FROM golang:1.18-alpine AS build +FROM golang:1.24-alpine AS build WORKDIR /go/src/github.com/tdewolff/minify COPY . /go/src/github.com/tdewolff/minify/ diff --git a/vendor/github.com/tdewolff/parse/v2/binary.go b/vendor/github.com/tdewolff/parse/v2/binary.go index 0b2dd8d19..c412bd997 100644 --- a/vendor/github.com/tdewolff/parse/v2/binary.go +++ b/vendor/github.com/tdewolff/parse/v2/binary.go @@ -55,6 +55,11 @@ func (r *BinaryReader) Len() uint32 { return uint32(len(r.buf)) - r.pos } +// SetLen sets the remaining length of the underlying buffer. +func (r *BinaryReader) SetLen(n uint32) { + r.buf = r.buf[: r.pos+n : r.pos+n] +} + // EOF returns true if we reached the end-of-file. func (r *BinaryReader) EOF() bool { return r.eof @@ -110,6 +115,18 @@ func (r *BinaryReader) ReadUint16() uint16 { return r.Endianness.Uint16(b) } +// ReadUint24 reads a uint24 into a uint32. +func (r *BinaryReader) ReadUint24() uint32 { + b := r.ReadBytes(3) + if b == nil { + return 0 + } else if r.Endianness == binary.LittleEndian { + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 + } else { + return uint32(b[2]) | uint32(b[1])<<8 | uint32(b[0])<<16 + } +} + // ReadUint32 reads a uint32. func (r *BinaryReader) ReadUint32() uint32 { b := r.ReadBytes(4) @@ -128,22 +145,27 @@ func (r *BinaryReader) ReadUint64() uint64 { return r.Endianness.Uint64(b) } -// ReadInt8 reads a int8. +// ReadInt8 reads an int8. func (r *BinaryReader) ReadInt8() int8 { return int8(r.ReadByte()) } -// ReadInt16 reads a int16. +// ReadInt16 reads an int16. func (r *BinaryReader) ReadInt16() int16 { return int16(r.ReadUint16()) } -// ReadInt32 reads a int32. +// ReadInt24 reads a int24 into an int32. +func (r *BinaryReader) ReadInt24() int32 { + return int32(r.ReadUint24()) +} + +// ReadInt32 reads an int32. func (r *BinaryReader) ReadInt32() int32 { return int32(r.ReadUint32()) } -// ReadInt64 reads a int64. +// ReadInt64 reads an int64. func (r *BinaryReader) ReadInt64() int64 { return int64(r.ReadUint64()) } @@ -386,8 +408,8 @@ type binaryReaderBytes struct { data []byte } -func newBinaryReaderBytes(data []byte) (*binaryReaderBytes, error) { - return &binaryReaderBytes{data}, nil +func newBinaryReaderBytes(data []byte) *binaryReaderBytes { + return &binaryReaderBytes{data} } // Close closes the reader. @@ -414,10 +436,10 @@ type binaryReaderReader struct { seeker bool } -func newBinaryReaderReader(r io.Reader, n int64) (*binaryReaderReader, error) { +func newBinaryReaderReader(r io.Reader, n int64) *binaryReaderReader { _, readerAt := r.(io.ReaderAt) _, seeker := r.(io.Seeker) - return &binaryReaderReader{r, n, readerAt, seeker}, nil + return &binaryReaderReader{r, n, readerAt, seeker} } // Close closes the reader. @@ -482,24 +504,20 @@ func NewBinaryReader2Reader(r io.Reader, n int64) (*BinaryReader2, error) { var f IBinaryReader if isReaderAt || isSeeker { - var err error - f, err = newBinaryReaderReader(r, n) - if err != nil { - return nil, err - } + f = newBinaryReaderReader(r, n) } else { b := make([]byte, n) if _, err := io.ReadFull(r, b); err != nil { return nil, err } - f, _ = newBinaryReaderBytes(b) + f = newBinaryReaderBytes(b) } return NewBinaryReader2(f), nil } -func NewBinaryReader2Bytes(data []byte) (*BinaryReader2, error) { - f, _ := newBinaryReaderBytes(data) - return NewBinaryReader2(f), nil +func NewBinaryReader2Bytes(data []byte) *BinaryReader2 { + f := newBinaryReaderBytes(data) + return NewBinaryReader2(f) } func NewBinaryReader2File(filename string) (*BinaryReader2, error) { @@ -641,12 +659,16 @@ func (r *BinaryReader2) ReadInt64() int64 { // BinaryWriter is a big endian binary file format writer. type BinaryWriter struct { - buf []byte + buf []byte + Endian binary.ByteOrder } // NewBinaryWriter returns a big endian binary file format writer. func NewBinaryWriter(buf []byte) *BinaryWriter { - return &BinaryWriter{buf} + return &BinaryWriter{ + buf: buf, + Endian: binary.BigEndian, + } } // Len returns the buffer's length in bytes. @@ -689,21 +711,21 @@ func (w *BinaryWriter) WriteUint8(v uint8) { func (w *BinaryWriter) WriteUint16(v uint16) { pos := len(w.buf) w.buf = append(w.buf, make([]byte, 2)...) - binary.BigEndian.PutUint16(w.buf[pos:], v) + w.Endian.PutUint16(w.buf[pos:], v) } // WriteUint32 writes the given uint32 to the buffer. func (w *BinaryWriter) WriteUint32(v uint32) { pos := len(w.buf) w.buf = append(w.buf, make([]byte, 4)...) - binary.BigEndian.PutUint32(w.buf[pos:], v) + w.Endian.PutUint32(w.buf[pos:], v) } // WriteUint64 writes the given uint64 to the buffer. func (w *BinaryWriter) WriteUint64(v uint64) { pos := len(w.buf) w.buf = append(w.buf, make([]byte, 8)...) - binary.BigEndian.PutUint64(w.buf[pos:], v) + w.Endian.PutUint64(w.buf[pos:], v) } // WriteInt8 writes the given int8 to the buffer. diff --git a/vendor/github.com/tdewolff/parse/v2/common.go b/vendor/github.com/tdewolff/parse/v2/common.go index 1883d1bd4..05f881739 100644 --- a/vendor/github.com/tdewolff/parse/v2/common.go +++ b/vendor/github.com/tdewolff/parse/v2/common.go @@ -534,7 +534,7 @@ func DecodeURL(b []byte) []byte { c = c<<4 + int(b[j]-'a') + 10 } } - if j == i+3 && c < 128 { + if j == i+3 { b[i] = byte(c) b = append(b[:i+1], b[i+3:]...) } diff --git a/vendor/github.com/tdewolff/parse/v2/strconv/decimal.go b/vendor/github.com/tdewolff/parse/v2/strconv/decimal.go index 8427cb4ac..788bb9622 100644 --- a/vendor/github.com/tdewolff/parse/v2/strconv/decimal.go +++ b/vendor/github.com/tdewolff/parse/v2/strconv/decimal.go @@ -8,11 +8,11 @@ import ( func ParseDecimal(b []byte) (float64, int) { // float64 has up to 17 significant decimal digits and an exponent in [-1022,1023] i := 0 - //sign := 1.0 - //if 0 < len(b) && b[0] == '-' { - // sign = -1.0 - // i++ - //} + sign := 1.0 + if 0 < len(b) && b[0] == '-' { + sign = -1.0 + i++ + } start := -1 dot := -1 @@ -52,17 +52,16 @@ func ParseDecimal(b []byte) (float64, int) { exp++ } if 1023 < exp { - return math.Inf(1), i - //if sign == 1.0 { - // return math.Inf(1), i - //} else { - // return math.Inf(-1), i - //} + if sign == 1.0 { + return math.Inf(1), i + } else { + return math.Inf(-1), i + } } else if exp < -1022 { return 0.0, i } - f := float64(n) // sign * float64(n) + f := sign * float64(n) if 0 <= exp && exp < 23 { return f * float64pow10[exp], i } else if 23 < exp && exp < 0 { diff --git a/vendor/modules.txt b/vendor/modules.txt index 963695293..5380d38dc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -822,11 +822,11 @@ github.com/stretchr/testify/suite # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 github.com/subosito/gotenv -# github.com/tdewolff/minify/v2 v2.21.3 -## explicit; go 1.18 +# github.com/tdewolff/minify/v2 v2.22.3 +## explicit; go 1.23.0 github.com/tdewolff/minify/v2 github.com/tdewolff/minify/v2/html -# github.com/tdewolff/parse/v2 v2.7.19 +# github.com/tdewolff/parse/v2 v2.7.21 ## explicit; go 1.13 github.com/tdewolff/parse/v2 github.com/tdewolff/parse/v2/buffer