diff --git a/go.mod b/go.mod index cf4cddc..d6037ae 100644 --- a/go.mod +++ b/go.mod @@ -9,10 +9,10 @@ require ( github.com/amikos-tech/chroma-go v0.4.1 github.com/charmbracelet/x/ansi v0.11.7 github.com/charmbracelet/x/term v0.2.2 - github.com/klippa-app/go-pdfium v1.19.4 + github.com/klippa-app/go-pdfium v1.19.6 github.com/pelletier/go-toml/v2 v2.4.3 github.com/soypat/goldmark-latex v0.1.4 - github.com/yuin/goldmark v1.8.4 + github.com/yuin/goldmark v1.8.5 github.com/yuin/goldmark-meta v1.1.0 go.abhg.dev/goldmark/hashtag v0.4.0 go.abhg.dev/goldmark/mermaid v0.6.0 @@ -55,7 +55,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 // indirect golang.org/x/crypto v0.54.0 // indirect - golang.org/x/net v0.56.0 // indirect + golang.org/x/net v0.57.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/text v0.40.0 // indirect google.golang.org/genai v1.65.0 // indirect diff --git a/go.sum b/go.sum index 0fb7016..3762bcb 100644 --- a/go.sum +++ b/go.sum @@ -175,8 +175,8 @@ github.com/jolestar/go-commons-pool/v2 v2.1.2 h1:E+XGo58F23t7HtZiC/W6jzO2Ux2IccS github.com/jolestar/go-commons-pool/v2 v2.1.2/go.mod h1:r4NYccrkS5UqP1YQI1COyTZ9UjPJAAGTUxzcsK1kqhY= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= -github.com/klippa-app/go-pdfium v1.19.4 h1:xksr2JG55NqA2MmNAHYKeiJVBGbY7Jfv6VvI8uBT88s= -github.com/klippa-app/go-pdfium v1.19.4/go.mod h1:AdzQH9LWYF5Hfcd4VNxg8a30ZZjQ7hHqIki7nHYkgkI= +github.com/klippa-app/go-pdfium v1.19.6 h1:MocMc/6ie+9eBFu+9tFMX66i3EDqnsMDoBtOy9Mx2/g= +github.com/klippa-app/go-pdfium v1.19.6/go.mod h1:poSiUJYFicnfT8dazUfVnxcqPlKQxO3aHdGbOa1lG1w= github.com/kljensen/snowball v0.10.0 h1:8qgaBLraSuUVHtGH5tJ+VdGpqgfcaE2WkswL/C3nVhY= github.com/kljensen/snowball v0.10.0/go.mod h1:bJcxtur1W5Qw4fVj9tk5W88zyRcGQQjqahFErdcDTHk= github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= @@ -211,10 +211,10 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo/v2 v2.29.0 h1:rfh+ZFjgJhYWRoIqVf3Uwx/W20yLrcrE2h2GmYVRaag= -github.com/onsi/ginkgo/v2 v2.29.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= -github.com/onsi/gomega v1.41.0 h1:OwKp4pXNgVxf6sCplzYo794OFNuoL2q2SBMU5NSWOjA= -github.com/onsi/gomega v1.41.0/go.mod h1:M/Uqpu/8qTjtzCLUA2zJHX9Iilrau25x1PdoSRbWh5A= +github.com/onsi/ginkgo/v2 v2.32.0 h1:Hw7s2pVrQo/8Yz5N77qdnpHaoc+c6cC9WIV1Jce+J6E= +github.com/onsi/ginkgo/v2 v2.32.0/go.mod h1:+aXOY+vzZ5mu2iI2HpTZUPmM//oQfsNFX6gU9kNcA44= +github.com/onsi/gomega v1.42.1 h1:iN1rCUX+44NZ1Dc97MPoeFYbFR0vh8zxoxMFwKdyZ6I= +github.com/onsi/gomega v1.42.1/go.mod h1:REff/hsDsodHoKlWsP2mAPhu1+5/6hVYNf9rIEBpeSg= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -256,8 +256,8 @@ github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= -github.com/yuin/goldmark v1.8.4 h1:oat/nd3U6NeQqFEL3xpEJq7d7c86NI+DbSNGAs4xnjA= -github.com/yuin/goldmark v1.8.4/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +github.com/yuin/goldmark v1.8.5 h1:r6N5afV5qj/5S4UTch8agZHJ8UxNCMwX7WjkkJam2NA= +github.com/yuin/goldmark v1.8.5/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= @@ -294,8 +294,8 @@ golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= -golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= -golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= @@ -306,12 +306,12 @@ golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= google.golang.org/genai v1.65.0 h1:6QK3Rjsx0iuJjbDCE1vf1VUr1IEjRDpvexGGnhxoAIk= google.golang.org/genai v1.65.0/go.mod h1:mDdPDFXo1Ats7f1WXVyZgWb/CkMzFWTWJruIMy7hGIU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= -google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= +google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go index bd5d9a9..679729a 100644 --- a/vendor/github.com/go-playground/validator/v10/baked_in.go +++ b/vendor/github.com/go-playground/validator/v10/baked_in.go @@ -25,10 +25,11 @@ import ( "time" "unicode/utf8" - "github.com/gabriel-vasile/mimetype" - urn "github.com/leodido/go-urn" "golang.org/x/crypto/sha3" "golang.org/x/text/language" + + "github.com/gabriel-vasile/mimetype" + urn "github.com/leodido/go-urn" ) // Func accepts a FieldLevel interface for all validation needs. The return @@ -3509,3 +3510,4 @@ var ( errMethodReturnNoValues = errors.New(`method return o values (void)`) errMethodReturnInvalidType = errors.New(`method should return invalid type`) ) + diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go index 813cede..7b1fd07 100644 --- a/vendor/github.com/go-playground/validator/v10/doc.go +++ b/vendor/github.com/go-playground/validator/v10/doc.go @@ -563,6 +563,7 @@ Kind of like an 'enum'. noneof='red green' 'blue yellow' noneof=5 7 9 + # None Of Case Insensitive Works the same as noneof but is case insensitive and therefore only accepts strings. diff --git a/vendor/github.com/jolestar/go-commons-pool/v2/collections/queue.go b/vendor/github.com/jolestar/go-commons-pool/v2/collections/queue.go index 14aed3e..666c9f5 100644 --- a/vendor/github.com/jolestar/go-commons-pool/v2/collections/queue.go +++ b/vendor/github.com/jolestar/go-commons-pool/v2/collections/queue.go @@ -82,8 +82,8 @@ func NewDeque(capacity int) *LinkedBlockingDeque { return &LinkedBlockingDeque{capacity: capacity, lock: lock, notEmpty: concurrent.NewTimeoutCond(lock), notFull: concurrent.NewTimeoutCond(lock)} } -// Links provided element as first element, or returns false if full. -// return true if successful, otherwise false +//Links provided element as first element, or returns false if full. +//return true if successful, otherwise false func (q *LinkedBlockingDeque) linkFirst(e interface{}) bool { if q.count >= q.capacity { return false @@ -101,8 +101,8 @@ func (q *LinkedBlockingDeque) linkFirst(e interface{}) bool { return true } -// Links provided element as last element, or returns false if full. -// return true} if successful, otherwise false +//Links provided element as last element, or returns false if full. +//return true} if successful, otherwise false func (q *LinkedBlockingDeque) linkLast(e interface{}) bool { // assert lock.isHeldByCurrentThread(); if q.count >= q.capacity { @@ -121,7 +121,7 @@ func (q *LinkedBlockingDeque) linkLast(e interface{}) bool { return true } -// Removes and returns the first element, or nil if empty. +//Removes and returns the first element, or nil if empty. func (q *LinkedBlockingDeque) unlinkFirst() interface{} { // assert lock.isHeldByCurrentThread(); f := q.first @@ -143,7 +143,7 @@ func (q *LinkedBlockingDeque) unlinkFirst() interface{} { return item } -// Removes and returns the last element, or nil if empty. +//Removes and returns the last element, or nil if empty. func (q *LinkedBlockingDeque) unlinkLast() interface{} { l := q.last if l == nil { @@ -164,7 +164,7 @@ func (q *LinkedBlockingDeque) unlinkLast() interface{} { return item } -// Unlink the provided node. +//Unlink the provided node. func (q *LinkedBlockingDeque) unlink(x *Node) { // assert lock.isHeldByCurrentThread(); p := x.prev @@ -387,9 +387,7 @@ func (q *LinkedBlockingDeque) PeekLast() interface{} { // RemoveFirstOccurrence removes the first occurrence of the specified element from this deque. // If the deque does not contain the element, it is unchanged. // More formally, removes the first element item such that -// -// o == item -// +// o == item // (if such an element exists). // Returns true if this deque contained the specified element // (or equivalently, if this deque changed as a result of the call). @@ -411,9 +409,7 @@ func (q *LinkedBlockingDeque) RemoveFirstOccurrence(item interface{}) bool { // RemoveLastOccurrence removes the last occurrence of the specified element from this deque. // If the deque does not contain the element, it is unchanged. // More formally, removes the last element item such that -// -// o == item -// +// o == item // (if such an element exists). // Returns true if this deque contained the specified element // (or equivalently, if this deque changed as a result of the call). diff --git a/vendor/github.com/klippa-app/go-pdfium/README.md b/vendor/github.com/klippa-app/go-pdfium/README.md index 3c572bc..3b36875 100644 --- a/vendor/github.com/klippa-app/go-pdfium/README.md +++ b/vendor/github.com/klippa-app/go-pdfium/README.md @@ -138,7 +138,7 @@ includedir={path}/include Name: PDFium Description: PDFium -Version: 7881 +Version: 7961 Requires: Libs: -L${libdir} -lpdfium diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/image/image_jpeg/image_jpeg_turbojpeg.go b/vendor/github.com/klippa-app/go-pdfium/internal/image/image_jpeg/image_jpeg_turbojpeg.go index 0da370d..62d5653 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/image/image_jpeg/image_jpeg_turbojpeg.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/image/image_jpeg/image_jpeg_turbojpeg.go @@ -2,21 +2,21 @@ package image_jpeg -/* -#cgo pkg-config: libturbojpeg -#include -*/ -import "C" - import ( "bufio" - "fmt" "image" "image/jpeg" "io" "unsafe" ) +/* +#cgo pkg-config: libturbojpeg +#include +*/ +import "C" +import "fmt" + type Sampling C.int const ( diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/action.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/action.go index c008d8a..01ccc2a 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/action.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/action.go @@ -4,11 +4,12 @@ import ( "errors" "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/enums" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerAction(action *uint64) *ActionHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/annotation.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/annotation.go index 641091d..0a253f7 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/annotation.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/annotation.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerAnnotation(annotation *uint64) *AnnotationHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/attachment.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/attachment.go index 7761af3..48ada7e 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/attachment.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/attachment.go @@ -4,11 +4,12 @@ import ( "errors" "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/enums" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerAttachment(attachment *uint64, documentHandle *DocumentHandle) *AttachmentHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bitmap.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bitmap.go index 730ced9..7fd58d2 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bitmap.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bitmap.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerBitmap(bitmap *uint64) *BitmapHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bookmark.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bookmark.go index a18d84b..e454e23 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bookmark.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/bookmark.go @@ -4,10 +4,11 @@ import ( "errors" "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerBookmark(bookmark *uint64, documentHandle *DocumentHandle) *BookmarkHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/clip_path.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/clip_path.go index 1d2922d..a806e48 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/clip_path.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/clip_path.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerClipPath(clipPath *uint64) *ClipPathHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data.go index b7366b1..8f435e9 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data.go @@ -11,6 +11,7 @@ import ( "github.com/klippa-app/go-pdfium/enums" "github.com/klippa-app/go-pdfium/structs" + "github.com/tetratelabs/wazero/api" "golang.org/x/text/encoding/unicode" "golang.org/x/text/transform" diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data_avail.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data_avail.go index 371eed8..8b8c74e 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data_avail.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/data_avail.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) type DataAvailHandle struct { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/dest.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/dest.go index 5098142..55155b9 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/dest.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/dest.go @@ -3,10 +3,11 @@ package implementation_webassembly import ( "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerDest(dest *uint64, documentHandle *DocumentHandle) *DestHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_attachment.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_attachment.go index df7bf33..7280256 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_attachment.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_attachment.go @@ -331,6 +331,88 @@ func (p *PdfiumImplementation) FPDFAttachment_GetStringValue(request *requests.F }, nil } +// FPDFAttachment_SetDescription sets the string value corresponding to "/Desc" in the file specification +// dictionary of the embedded file attachment, overwriting the existing value if any. +// Experimental API. +func (p *PdfiumImplementation) FPDFAttachment_SetDescription(request *requests.FPDFAttachment_SetDescription) (*responses.FPDFAttachment_SetDescription, error) { + p.Lock() + defer p.Unlock() + + attachmentHandle, err := p.getAttachmentHandle(request.Attachment) + if err != nil { + return nil, err + } + + valuePointer, err := p.CFPDF_WIDESTRING(request.Value) + if err != nil { + return nil, err + } + defer valuePointer.Free() + + res, err := p.Module.ExportedFunction("FPDFAttachment_SetDescription").Call(p.Context, *attachmentHandle.handle, valuePointer.Pointer) + if err != nil { + return nil, err + } + + success := *(*int32)(unsafe.Pointer(&res[0])) + if int(success) == 0 { + return nil, errors.New("could not set attachment description") + } + + return &responses.FPDFAttachment_SetDescription{ + Value: request.Value, + }, nil +} + +// FPDFAttachment_GetDescription gets the string value corresponding to "/Desc" in the file specification +// dictionary of the embedded file attachment. +// Experimental API. +func (p *PdfiumImplementation) FPDFAttachment_GetDescription(request *requests.FPDFAttachment_GetDescription) (*responses.FPDFAttachment_GetDescription, error) { + p.Lock() + defer p.Unlock() + + attachmentHandle, err := p.getAttachmentHandle(request.Attachment) + if err != nil { + return nil, err + } + + // First get the description length. + res, err := p.Module.ExportedFunction("FPDFAttachment_GetDescription").Call(p.Context, *attachmentHandle.handle, 0, 0) + if err != nil { + return nil, err + } + + descriptionSize := uint64(*(*int32)(unsafe.Pointer(&res[0]))) + if descriptionSize == 0 { + return nil, errors.New("could not get description") + } + + charDataPointer, err := p.ByteArrayPointer(descriptionSize, nil) + if err != nil { + return nil, err + } + defer charDataPointer.Free() + + _, err = p.Module.ExportedFunction("FPDFAttachment_GetDescription").Call(p.Context, *attachmentHandle.handle, charDataPointer.Pointer, descriptionSize) + if err != nil { + return nil, err + } + + charData, err := charDataPointer.Value(false) + if err != nil { + return nil, err + } + + transformedText, err := p.transformUTF16LEToUTF8(charData) + if err != nil { + return nil, err + } + + return &responses.FPDFAttachment_GetDescription{ + Value: transformedText, + }, nil +} + // FPDFAttachment_SetFile set the file data of the given attachment, overwriting the existing file data if any. // The creation date and checksum will be updated, while all other dictionary // entries will be deleted. Note that only contents with a length smaller than diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_doc.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_doc.go index 901e98f..af3a718 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_doc.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_doc.go @@ -1053,7 +1053,7 @@ func (p *PdfiumImplementation) FPDFBookmark_GetCount(request *requests.FPDFBookm return nil, err } - res, err := p.Module.ExportedFunction("FPDFLink_CountQuadPoints").Call(p.Context, *bookmarkHandle.handle) + res, err := p.Module.ExportedFunction("FPDFBookmark_GetCount").Call(p.Context, *bookmarkHandle.handle) if err != nil { return nil, err } @@ -1064,3 +1064,64 @@ func (p *PdfiumImplementation) FPDFBookmark_GetCount(request *requests.FPDFBookm Count: int(count), }, nil } + +// FPDFBookmark_GetColor returns the color of a bookmark. +// Experimental API. +func (p *PdfiumImplementation) FPDFBookmark_GetColor(request *requests.FPDFBookmark_GetColor) (*responses.FPDFBookmark_GetColor, error) { + p.Lock() + defer p.Unlock() + + bookmarkHandle, err := p.getBookmarkHandle(request.Bookmark) + if err != nil { + return nil, err + } + + rPointer, err := p.FloatPointer(nil) + if err != nil { + return nil, err + } + defer rPointer.Free() + + gPointer, err := p.FloatPointer(nil) + if err != nil { + return nil, err + } + defer gPointer.Free() + + bPointer, err := p.FloatPointer(nil) + if err != nil { + return nil, err + } + defer bPointer.Free() + + res, err := p.Module.ExportedFunction("FPDFBookmark_GetColor").Call(p.Context, *bookmarkHandle.handle, rPointer.Pointer, gPointer.Pointer, bPointer.Pointer) + if err != nil { + return nil, err + } + + success := *(*int32)(unsafe.Pointer(&res[0])) + if int(success) == 0 { + return nil, errors.New("could not get bookmark color") + } + + r, err := rPointer.Value() + if err != nil { + return nil, err + } + + g, err := gPointer.Value() + if err != nil { + return nil, err + } + + b, err := bPointer.Value() + if err != nil { + return nil, err + } + + return &responses.FPDFBookmark_GetColor{ + R: r, + G: g, + B: b, + }, nil +} diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_edit.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_edit.go index d92fc3d..cc549ce 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_edit.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_edit.go @@ -11,6 +11,7 @@ import ( "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" "github.com/klippa-app/go-pdfium/structs" + "github.com/tetratelabs/wazero/api" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_flatten.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_flatten.go index e174eb2..cdd9911 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_flatten.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_flatten.go @@ -1,10 +1,9 @@ package implementation_webassembly import ( - "unsafe" - "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + "unsafe" ) // FPDFPage_Flatten makes annotations and form fields become part of the page contents itself. diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_formfill.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_formfill.go index 0b98e62..6deed85 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_formfill.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_formfill.go @@ -10,6 +10,7 @@ import ( "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" "github.com/klippa-app/go-pdfium/structs" + "github.com/tetratelabs/wazero/api" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_ppo.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_ppo.go index a1f6b87..8ae433e 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_ppo.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_ppo.go @@ -2,10 +2,10 @@ package implementation_webassembly import ( "errors" - "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + "unsafe" + "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_progressive.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_progressive.go index f66194d..2a655bc 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_progressive.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/fpdf_progressive.go @@ -9,6 +9,7 @@ import ( "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + "github.com/tetratelabs/wazero/api" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/glyph_path.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/glyph_path.go index eb8d486..f281924 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/glyph_path.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/glyph_path.go @@ -2,6 +2,7 @@ package implementation_webassembly import ( "github.com/google/uuid" + "github.com/klippa-app/go-pdfium/references" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/handles.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/handles.go index 2ad51af..ce6e229 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/handles.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/handles.go @@ -2,7 +2,6 @@ package implementation_webassembly import ( "errors" - "github.com/klippa-app/go-pdfium/references" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/implementation.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/implementation.go index 1de2a32..9eccbee 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/implementation.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/implementation.go @@ -8,11 +8,12 @@ import ( "strings" "sync" - "github.com/google/uuid" pdfium_errors "github.com/klippa-app/go-pdfium/errors" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" "github.com/tetratelabs/wazero/api" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/javascript_action.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/javascript_action.go index 4851d55..5e4a60d 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/javascript_action.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/javascript_action.go @@ -4,10 +4,11 @@ import ( "errors" "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerJavaScriptAction(javaScriptAction *uint64, documentHandle *DocumentHandle) *JavaScriptActionHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/link.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/link.go index 814142c..bdd7bcf 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/link.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/link.go @@ -2,6 +2,7 @@ package implementation_webassembly import ( "github.com/google/uuid" + "github.com/klippa-app/go-pdfium/references" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page.go index cf561a0..e18620a 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page.go @@ -3,10 +3,11 @@ package implementation_webassembly import ( "errors" - "github.com/google/uuid" pdfium_errors "github.com/klippa-app/go-pdfium/errors" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" + + "github.com/google/uuid" ) // loadPage changes the active page if it's different from what's currently diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object.go index e5c2cd3..f076190 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object.go @@ -2,6 +2,7 @@ package implementation_webassembly import ( "github.com/google/uuid" + "github.com/klippa-app/go-pdfium/references" ) diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object_mark.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object_mark.go index 465b5b9..d9a7b0a 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object_mark.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/page_object_mark.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerPageObjectMark(pageObjectMark *uint64) *PageObjectMarkHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/pagerange.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/pagerange.go index 38c7ed1..582e245 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/pagerange.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/pagerange.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerPageRange(pageRange *uint64, documentHandle *DocumentHandle) *PageRangeHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/path_segment.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/path_segment.go index 9777356..6f0036a 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/path_segment.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/path_segment.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerPathSegment(pathSegment *uint64) *PathSegmentHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/struct_tree.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/struct_tree.go index 5d2fbf7..c433c8a 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/struct_tree.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/struct_tree.go @@ -1,8 +1,9 @@ package implementation_webassembly import ( - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerStructTree(structTree *uint64, documentHandle *DocumentHandle) *StructTreeHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/text.go b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/text.go index f47e07a..7b0c232 100644 --- a/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/text.go +++ b/vendor/github.com/klippa-app/go-pdfium/internal/implementation_webassembly/text.go @@ -6,10 +6,11 @@ import ( "math" "unsafe" - "github.com/google/uuid" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/requests" "github.com/klippa-app/go-pdfium/responses" + + "github.com/google/uuid" ) func (p *PdfiumImplementation) registerTextPage(attachment *uint64, documentHandle *DocumentHandle) *TextPageHandle { diff --git a/vendor/github.com/klippa-app/go-pdfium/pdfium.go b/vendor/github.com/klippa-app/go-pdfium/pdfium.go index d88a730..9554f51 100644 --- a/vendor/github.com/klippa-app/go-pdfium/pdfium.go +++ b/vendor/github.com/klippa-app/go-pdfium/pdfium.go @@ -1007,6 +1007,11 @@ type Pdfium interface { // Experimental API. FPDFBookmark_GetCount(request *requests.FPDFBookmark_GetCount) (*responses.FPDFBookmark_GetCount, error) + // FPDFBookmark_GetColor returns the color of a bookmark. + // Returns an error when the bookmark does not specify a color. + // Experimental API. + FPDFBookmark_GetColor(request *requests.FPDFBookmark_GetColor) (*responses.FPDFBookmark_GetColor, error) + // FPDFBookmark_Find finds a bookmark in the document, using the bookmark title. FPDFBookmark_Find(request *requests.FPDFBookmark_Find) (*responses.FPDFBookmark_Find, error) @@ -1233,6 +1238,17 @@ type Pdfium interface { // Experimental API. FPDFAttachment_GetStringValue(request *requests.FPDFAttachment_GetStringValue) (*responses.FPDFAttachment_GetStringValue, error) + // FPDFAttachment_SetDescription sets the string value corresponding to "/Desc" in the file specification + // dictionary of the embedded file attachment, overwriting the existing value if any. + // Experimental API. + FPDFAttachment_SetDescription(request *requests.FPDFAttachment_SetDescription) (*responses.FPDFAttachment_SetDescription, error) + + // FPDFAttachment_GetDescription gets the string value corresponding to "/Desc" in the file specification + // dictionary of the embedded file attachment. Returns an empty value when the + // attachment has no description. + // Experimental API. + FPDFAttachment_GetDescription(request *requests.FPDFAttachment_GetDescription) (*responses.FPDFAttachment_GetDescription, error) + // FPDFAttachment_SetFile set the file data of the given attachment, overwriting the existing file data if any. // The creation date and checksum will be updated, while all other dictionary // entries will be deleted. Note that only contents with a length smaller than diff --git a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_attachment.go b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_attachment.go index 1cc7131..005e78e 100644 --- a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_attachment.go +++ b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_attachment.go @@ -46,6 +46,15 @@ type FPDFAttachment_GetStringValue struct { Key string } +type FPDFAttachment_SetDescription struct { + Attachment references.FPDF_ATTACHMENT + Value string +} + +type FPDFAttachment_GetDescription struct { + Attachment references.FPDF_ATTACHMENT +} + type FPDFAttachment_SetFile struct { Attachment references.FPDF_ATTACHMENT Contents []byte diff --git a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_dataavail.go b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_dataavail.go index f95ea71..d09f0d1 100644 --- a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_dataavail.go +++ b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_dataavail.go @@ -1,9 +1,8 @@ package requests import ( - "io" - "github.com/klippa-app/go-pdfium/references" + "io" ) type FPDFAvail_Create struct { diff --git a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_doc.go b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_doc.go index 84711cd..194d9d5 100644 --- a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_doc.go +++ b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_doc.go @@ -23,6 +23,10 @@ type FPDFBookmark_GetCount struct { Bookmark references.FPDF_BOOKMARK // Reference to the current bookmark. } +type FPDFBookmark_GetColor struct { + Bookmark references.FPDF_BOOKMARK // Reference to the current bookmark. +} + type FPDFBookmark_Find struct { Document references.FPDF_DOCUMENT Title string // The string for the bookmark title to be searched diff --git a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_save.go b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_save.go index eafc7cc..9fd488f 100644 --- a/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_save.go +++ b/vendor/github.com/klippa-app/go-pdfium/requests/fpdf_save.go @@ -1,9 +1,8 @@ package requests import ( - "io" - "github.com/klippa-app/go-pdfium/references" + "io" ) type SaveFlags uint32 diff --git a/vendor/github.com/klippa-app/go-pdfium/requests/fpdfview.go b/vendor/github.com/klippa-app/go-pdfium/requests/fpdfview.go index 81ec901..389126c 100644 --- a/vendor/github.com/klippa-app/go-pdfium/requests/fpdfview.go +++ b/vendor/github.com/klippa-app/go-pdfium/requests/fpdfview.go @@ -1,11 +1,10 @@ package requests import ( - "io" - "github.com/klippa-app/go-pdfium/enums" "github.com/klippa-app/go-pdfium/references" "github.com/klippa-app/go-pdfium/structs" + "io" ) type FPDF_LoadDocument struct { diff --git a/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_attachment.go b/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_attachment.go index 2dd1686..8a0c54b 100644 --- a/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_attachment.go +++ b/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_attachment.go @@ -46,6 +46,14 @@ type FPDFAttachment_GetStringValue struct { Value string } +type FPDFAttachment_SetDescription struct { + Value string +} + +type FPDFAttachment_GetDescription struct { + Value string // The description of the attachment. Empty when the attachment has no description. +} + type FPDFAttachment_SetFile struct{} type FPDFAttachment_GetFile struct { diff --git a/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_doc.go b/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_doc.go index 45e1e6e..c94693b 100644 --- a/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_doc.go +++ b/vendor/github.com/klippa-app/go-pdfium/responses/fpdf_doc.go @@ -27,6 +27,12 @@ type FPDFBookmark_GetCount struct { Count int } +type FPDFBookmark_GetColor struct { + R float32 // The red component of the bookmark color [0.0 - 1.0]. + G float32 // The green component of the bookmark color [0.0 - 1.0]. + B float32 // The blue component of the bookmark color [0.0 - 1.0]. +} + type FPDFBookmark_Find struct { Bookmark *references.FPDF_BOOKMARK // Reference to the found bookmark. nil if the title can't be found. } diff --git a/vendor/github.com/klippa-app/go-pdfium/responses/text.go b/vendor/github.com/klippa-app/go-pdfium/responses/text.go index 80e5b9d..feddd3b 100644 --- a/vendor/github.com/klippa-app/go-pdfium/responses/text.go +++ b/vendor/github.com/klippa-app/go-pdfium/responses/text.go @@ -13,12 +13,12 @@ type CharPosition struct { } type FontInformation struct { - Size float64 // Font size in points (also known as em). - RenderedSize float64 // The effective rendered size: fontSize * sqrt(C² + D²) where C,D come from the text transformation matrix (FPDFText_GetMatrix). Falls back to Size when experimental support is not available. - SizeInPixels *int // Font size in pixels, only available when PixelPositions is used. - Weight int // The weight of the font, can be negative for spaces and newlines. Will only be filled when compiled with experimental support. - Name string // The name of the font, can be empty for spaces and newlines. Will only be filled when compiled with experimental support. - Flags int // Font flags, should be interpreted per PDF spec 1.7, Section 5.7.1 Font Descriptor Flags. Will only be filled when compiled with experimental support. + Size float64 // Font size in points (also known as em). + RenderedSize float64 // The effective rendered size: fontSize * sqrt(C² + D²) where C,D come from the text transformation matrix (FPDFText_GetMatrix). Falls back to Size when experimental support is not available. + SizeInPixels *int // Font size in pixels, only available when PixelPositions is used. + Weight int // The weight of the font, can be negative for spaces and newlines. Will only be filled when compiled with experimental support. + Name string // The name of the font, can be empty for spaces and newlines. Will only be filled when compiled with experimental support. + Flags int // Font flags, should be interpreted per PDF spec 1.7, Section 5.7.1 Font Descriptor Flags. Will only be filled when compiled with experimental support. } type GetPageTextStructuredChar struct { diff --git a/vendor/github.com/klippa-app/go-pdfium/structs/structs.go b/vendor/github.com/klippa-app/go-pdfium/structs/structs.go index 715406f..ae2862b 100644 --- a/vendor/github.com/klippa-app/go-pdfium/structs/structs.go +++ b/vendor/github.com/klippa-app/go-pdfium/structs/structs.go @@ -24,10 +24,8 @@ type FPDF_FS_QUADPOINTSF struct { } // FPDF_FS_MATRIX is a matrix that is composed as: -// -// | A C E | -// | B D F | -// +// | A C E | +// | B D F | // and can be used to scale, rotate, shear and translate. type FPDF_FS_MATRIX struct { A float32 diff --git a/vendor/github.com/klippa-app/go-pdfium/webassembly/generated.go b/vendor/github.com/klippa-app/go-pdfium/webassembly/generated.go index abb88e3..24b3751 100644 --- a/vendor/github.com/klippa-app/go-pdfium/webassembly/generated.go +++ b/vendor/github.com/klippa-app/go-pdfium/webassembly/generated.go @@ -1341,6 +1341,20 @@ func (i *pdfiumInstance) FPDFAnnot_UpdateObject(request *requests.FPDFAnnot_Upda return i.worker.Instance.FPDFAnnot_UpdateObject(request) } +func (i *pdfiumInstance) FPDFAttachment_GetDescription(request *requests.FPDFAttachment_GetDescription) (resp *responses.FPDFAttachment_GetDescription, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAttachment_GetDescription", panicError) + } + }() + + return i.worker.Instance.FPDFAttachment_GetDescription(request) +} + func (i *pdfiumInstance) FPDFAttachment_GetFile(request *requests.FPDFAttachment_GetFile) (resp *responses.FPDFAttachment_GetFile, err error) { if i.closed { return nil, errors.New("instance is closed") @@ -1425,6 +1439,20 @@ func (i *pdfiumInstance) FPDFAttachment_HasKey(request *requests.FPDFAttachment_ return i.worker.Instance.FPDFAttachment_HasKey(request) } +func (i *pdfiumInstance) FPDFAttachment_SetDescription(request *requests.FPDFAttachment_SetDescription) (resp *responses.FPDFAttachment_SetDescription, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFAttachment_SetDescription", panicError) + } + }() + + return i.worker.Instance.FPDFAttachment_SetDescription(request) +} + func (i *pdfiumInstance) FPDFAttachment_SetFile(request *requests.FPDFAttachment_SetFile) (resp *responses.FPDFAttachment_SetFile, err error) { if i.closed { return nil, errors.New("instance is closed") @@ -1719,6 +1747,20 @@ func (i *pdfiumInstance) FPDFBookmark_GetAction(request *requests.FPDFBookmark_G return i.worker.Instance.FPDFBookmark_GetAction(request) } +func (i *pdfiumInstance) FPDFBookmark_GetColor(request *requests.FPDFBookmark_GetColor) (resp *responses.FPDFBookmark_GetColor, err error) { + if i.closed { + return nil, errors.New("instance is closed") + } + + defer func() { + if panicError := recover(); panicError != nil { + err = fmt.Errorf("panic occurred in %s: %v", "FPDFBookmark_GetColor", panicError) + } + }() + + return i.worker.Instance.FPDFBookmark_GetColor(request) +} + func (i *pdfiumInstance) FPDFBookmark_GetCount(request *requests.FPDFBookmark_GetCount) (resp *responses.FPDFBookmark_GetCount, err error) { if i.closed { return nil, errors.New("instance is closed") diff --git a/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/callbacks.go b/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/callbacks.go index a6ffa49..ad33f8e 100644 --- a/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/callbacks.go +++ b/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/callbacks.go @@ -2,13 +2,13 @@ package imports import ( "context" - "errors" "io" "log" "github.com/klippa-app/go-pdfium/enums" "github.com/klippa-app/go-pdfium/internal/implementation_webassembly" "github.com/klippa-app/go-pdfium/references" + "github.com/tetratelabs/wazero/api" ) @@ -45,24 +45,17 @@ func (cb FPDF_FILEACCESS_CB) Call(ctx context.Context, mod api.Module, stack []u return } - // Read the requested data into a buffer. - readBuffer := make([]byte, size) - n, err := openFile.Reader.Read(readBuffer) - - // Clear out the error if we have EOF but read the requested size. - // This is to handle some edge case clients that return EOF as err when - // reading the exact amount of bytes requested until the end of the file. - if err != nil && errors.Is(err, io.EOF) && n == int(size) { - err = nil - } - - if n == 0 || err != nil { + // Memory.Read returns a write-through view of guest memory. + guestBuffer, ok := mem.Read(pBufPointer, size) + if !ok { stack[0] = uint64(0) return } - ok = mem.Write(pBufPointer, readBuffer) - if !ok { + // m_GetBlock must fill the entire requested range. ReadFull also treats an + // EOF returned together with the final bytes as a successful read. + n, err := io.ReadFull(openFile.Reader, guestBuffer) + if err != nil { stack[0] = uint64(0) return } diff --git a/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/imports.go b/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/imports.go index f54293e..c7bcc35 100644 --- a/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/imports.go +++ b/vendor/github.com/klippa-app/go-pdfium/webassembly/imports/imports.go @@ -2,7 +2,6 @@ package imports import ( "context" - "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" "github.com/tetratelabs/wazero/imports/emscripten" diff --git a/vendor/github.com/klippa-app/go-pdfium/webassembly/pdfium.wasm b/vendor/github.com/klippa-app/go-pdfium/webassembly/pdfium.wasm index 77da44a..eff97bd 100644 Binary files a/vendor/github.com/klippa-app/go-pdfium/webassembly/pdfium.wasm and b/vendor/github.com/klippa-app/go-pdfium/webassembly/pdfium.wasm differ diff --git a/vendor/github.com/klippa-app/go-pdfium/webassembly/webassembly.go b/vendor/github.com/klippa-app/go-pdfium/webassembly/webassembly.go index 46235c0..239bfe4 100644 --- a/vendor/github.com/klippa-app/go-pdfium/webassembly/webassembly.go +++ b/vendor/github.com/klippa-app/go-pdfium/webassembly/webassembly.go @@ -13,15 +13,14 @@ import ( "sync" "time" - "github.com/google/uuid" - pool "github.com/jolestar/go-commons-pool/v2" "github.com/klippa-app/go-pdfium" "github.com/klippa-app/go-pdfium/internal/implementation_webassembly" "github.com/klippa-app/go-pdfium/webassembly/imports" + + "github.com/google/uuid" + pool "github.com/jolestar/go-commons-pool/v2" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" - "github.com/tetratelabs/wazero/experimental" - "github.com/tetratelabs/wazero/experimental/logging" "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" "golang.org/x/net/context" ) @@ -38,6 +37,10 @@ type worker struct { } type Config struct { + // Context is used to initialize the wazero runtime and as the parent + // context for its workers. It must remain valid for the lifetime of the + // pool. If nil, context.Background is used. + Context goctx.Context MinIdle int MaxIdle int MaxTotal int @@ -69,11 +72,25 @@ var multiThreadedMutex = &sync.Mutex{} // allow it. If the pool has been exhausted. It will wait until a worker becomes // available. So it's important that you close instances when you're done with them. func Init(config Config) (pdfium.Pool, error) { - // Set config defaults. if config.WASM == nil { config.WASM = pdfiumWasm } + return initWithConfig(config) +} + +// InitWithWASM will return a multithreaded webassembly pool using the module in +// Config.WASM. Unlike Init, it does not reference the embedded default module, +// allowing applications that provide their own module to omit it at link time. +// This causes Go not to embed the default WASM file, saving about ~5MB in the +// resulting binary file. +func InitWithWASM(config Config) (pdfium.Pool, error) { + if config.WASM == nil { + return nil, errors.New("webassembly module must be provided") + } + return initWithConfig(config) +} +func initWithConfig(config Config) (pdfium.Pool, error) { // Mount the full root by default. if config.FSConfig == nil { config.FSConfig = wazero.NewFSConfig() @@ -111,11 +128,10 @@ func Init(config Config) (pdfium.Pool, error) { config.RuntimeConfig = wazero.NewRuntimeConfig() } - poolContext := experimental.WithFunctionListenerFactory(context.Background(), logging.NewLoggingListenerFactory(os.Stdout)) - - // Uncomment the line below if you want function call logging, - // useful for debugging. - poolContext = context.Background() + poolContext := config.Context + if poolContext == nil { + poolContext = context.Background() + } runtime := wazero.NewRuntimeWithConfig(poolContext, config.RuntimeConfig) diff --git a/vendor/github.com/tetratelabs/wazero/experimental/logging/log_listener.go b/vendor/github.com/tetratelabs/wazero/experimental/logging/log_listener.go deleted file mode 100644 index 4b92054..0000000 --- a/vendor/github.com/tetratelabs/wazero/experimental/logging/log_listener.go +++ /dev/null @@ -1,275 +0,0 @@ -package logging - -import ( - "bufio" - "context" - "io" - - "github.com/tetratelabs/wazero/api" - "github.com/tetratelabs/wazero/experimental" - aslogging "github.com/tetratelabs/wazero/internal/assemblyscript/logging" - "github.com/tetratelabs/wazero/internal/logging" - "github.com/tetratelabs/wazero/internal/wasip1" - wasilogging "github.com/tetratelabs/wazero/internal/wasip1/logging" -) - -type Writer interface { - io.Writer - io.StringWriter -} - -// LogScopes is a bit flag of host function groups to log. e.g. LogScopeRandom. -// -// To specify all scopes, use LogScopeAll. For multiple scopes, OR them -// together like this: -// -// scope = logging.LogScopeRandom | logging.LogScopeFilesystem -// -// Note: Numeric values are not intended to be interpreted except as bit flags. -type LogScopes = logging.LogScopes - -const ( - // LogScopeNone means nothing should be logged - LogScopeNone = logging.LogScopeNone - // LogScopeClock enables logging for functions such as `clock_time_get`. - LogScopeClock = logging.LogScopeClock - // LogScopeProc enables logging for functions such as `proc_exit`. - // - // Note: This includes functions that both log and exit. e.g. `abort`. - LogScopeProc = logging.LogScopeProc - // LogScopeFilesystem enables logging for functions such as `path_open`. - // - // Note: This doesn't log writes to the console. - LogScopeFilesystem = logging.LogScopeFilesystem - // LogScopeMemory enables logging for functions such as - // `emscripten_notify_memory_growth`. - LogScopeMemory = logging.LogScopeMemory - // LogScopePoll enables logging for functions such as `poll_oneoff`. - LogScopePoll = logging.LogScopePoll - // LogScopeRandom enables logging for functions such as `random_get`. - LogScopeRandom = logging.LogScopeRandom - // LogScopeSock enables logging for functions such as `sock_accept`. - LogScopeSock = logging.LogScopeSock - // LogScopeAll means all functions should be logged. - LogScopeAll = logging.LogScopeAll -) - -// NewLoggingListenerFactory is an experimental.FunctionListenerFactory that -// logs all functions that have a name to the writer. -// -// Use NewHostLoggingListenerFactory if only interested in host interactions. -func NewLoggingListenerFactory(w Writer) experimental.FunctionListenerFactory { - return &loggingListenerFactory{w: toInternalWriter(w), scopes: LogScopeAll} -} - -// NewHostLoggingListenerFactory is an experimental.FunctionListenerFactory -// that logs exported and host functions to the writer. -// -// This is an alternative to NewLoggingListenerFactory, and would weed out -// guest defined functions such as those implementing garbage collection. -// -// For example, "_start" is defined by the guest, but exported, so would be -// written to the w in order to provide minimal context needed to -// understand host calls such as "args_get". -// -// The scopes parameter can be set to LogScopeAll or constrained. -func NewHostLoggingListenerFactory(w Writer, scopes logging.LogScopes) experimental.FunctionListenerFactory { - return &loggingListenerFactory{w: toInternalWriter(w), hostOnly: true, scopes: scopes} -} - -func toInternalWriter(w Writer) logging.Writer { - if w, ok := w.(logging.Writer); ok { - return w - } - return bufio.NewWriter(w) -} - -type loggingListenerFactory struct { - w logging.Writer - hostOnly bool - scopes logging.LogScopes - stack logStack -} - -type flusher interface { - Flush() error -} - -// NewFunctionListener implements the same method as documented on -// experimental.FunctionListener. -func (f *loggingListenerFactory) NewFunctionListener(fnd api.FunctionDefinition) experimental.FunctionListener { - exported := len(fnd.ExportNames()) > 0 - if f.hostOnly && // choose functions defined or callable by the host - fnd.GoFunction() == nil && // not defined by the host - !exported { // not callable by the host - return nil - } - - var pLoggers []logging.ParamLogger - var pSampler logging.ParamSampler - var rLoggers []logging.ResultLogger - switch fnd.ModuleName() { - case wasip1.InternalModuleName: - if !wasilogging.IsInLogScope(fnd, f.scopes) { - return nil - } - pSampler, pLoggers, rLoggers = wasilogging.Config(fnd) - case "env": - // env is difficult because the same module name is used for different - // ABI. - pLoggers, rLoggers = logging.Config(fnd) - switch fnd.Name() { - case "emscripten_notify_memory_growth": - if !logging.LogScopeMemory.IsEnabled(f.scopes) { - return nil - } - default: - if !aslogging.IsInLogScope(fnd, f.scopes) { - return nil - } - } - default: - // We don't know the scope of the function, so compare against all. - if f.scopes != logging.LogScopeAll { - return nil - } - pLoggers, rLoggers = logging.Config(fnd) - } - - var before, after string - if fnd.GoFunction() != nil { - before = "==> " + fnd.DebugName() - after = "<==" - } else { - before = "--> " + fnd.DebugName() - after = "<--" - } - return &loggingListener{ - w: f.w, - beforePrefix: before, - afterPrefix: after, - pLoggers: pLoggers, - pSampler: pSampler, - rLoggers: rLoggers, - stack: &f.stack, - } -} - -type logStack struct { - params [][]uint64 -} - -func (s *logStack) push(params []uint64) { - s.params = append(s.params, params) -} - -func (s *logStack) pop() []uint64 { - i := len(s.params) - 1 - params := s.params[i] - s.params[i] = nil - s.params = s.params[:i] - return params -} - -func (s *logStack) count() (n int) { - for _, p := range s.params { - if p != nil { - n++ - } - } - return n -} - -// loggingListener implements experimental.FunctionListener to log entrance and after -// of each function call. -type loggingListener struct { - w logging.Writer - beforePrefix, afterPrefix string - pLoggers []logging.ParamLogger - pSampler logging.ParamSampler - rLoggers []logging.ResultLogger - stack *logStack -} - -// Before logs to stdout the module and function name, prefixed with '-->' and -// indented based on the call nesting level. -func (l *loggingListener) Before(ctx context.Context, mod api.Module, def api.FunctionDefinition, params []uint64, _ experimental.StackIterator) { - // First, see if this invocation is sampled. - sampled := true - if s := l.pSampler; s != nil { - sampled = s(ctx, mod, params) - } - - if sampled { - l.logIndented(l.stack.count(), l.beforePrefix, func() { - l.logParams(ctx, mod, params) - }) - params = append([]uint64{}, params...) - } else { - params = nil - } - - l.stack.push(params) -} - -// After logs to stdout the module and function name, prefixed with '<--' and -// indented based on the call nesting level. -func (l *loggingListener) After(ctx context.Context, mod api.Module, def api.FunctionDefinition, results []uint64) { - if params := l.stack.pop(); params != nil { - l.logIndented(l.stack.count(), l.afterPrefix, func() { - l.logResults(ctx, mod, params, results) - }) - } -} - -func (l *loggingListener) Abort(ctx context.Context, mod api.Module, def api.FunctionDefinition, _ error) { - l.stack.pop() -} - -// logIndented writes an indentation level and prefix prior to calling log to -// output the log line. -func (l *loggingListener) logIndented(nestLevel int, prefix string, log func()) { - for i := 0; i < nestLevel; i++ { - l.w.WriteByte('\t') //nolint - } - l.w.WriteString(prefix) //nolint - log() - l.w.WriteByte('\n') //nolint - - if f, ok := l.w.(flusher); ok { - f.Flush() //nolint - } -} - -func (l *loggingListener) logParams(ctx context.Context, mod api.Module, params []uint64) { - paramLen := len(l.pLoggers) - l.w.WriteByte('(') //nolint - if paramLen > 0 { - l.pLoggers[0](ctx, mod, l.w, params) - for i := 1; i < paramLen; i++ { - l.w.WriteByte(',') //nolint - l.pLoggers[i](ctx, mod, l.w, params) - } - } - l.w.WriteByte(')') //nolint -} - -func (l *loggingListener) logResults(ctx context.Context, mod api.Module, params, results []uint64) { - resultLen := len(l.rLoggers) - if resultLen == 0 { - return - } - l.w.WriteByte(' ') //nolint - switch resultLen { - case 1: - l.rLoggers[0](ctx, mod, l.w, params, results) - default: - l.w.WriteByte('(') //nolint - l.rLoggers[0](ctx, mod, l.w, params, results) - for i := 1; i < resultLen; i++ { - l.w.WriteByte(',') //nolint - l.rLoggers[i](ctx, mod, l.w, params, results) - } - l.w.WriteByte(')') //nolint - } -} diff --git a/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/logging/logging.go b/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/logging/logging.go deleted file mode 100644 index ca59e7a..0000000 --- a/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/logging/logging.go +++ /dev/null @@ -1,32 +0,0 @@ -package logging - -import ( - "github.com/tetratelabs/wazero/api" - . "github.com/tetratelabs/wazero/internal/assemblyscript" - "github.com/tetratelabs/wazero/internal/logging" -) - -func isProcFunction(fnd api.FunctionDefinition) bool { - return fnd.ExportNames()[0] == AbortName -} - -func isRandomFunction(fnd api.FunctionDefinition) bool { - return fnd.ExportNames()[0] == SeedName -} - -// IsInLogScope returns true if the current function is in any of the scopes. -func IsInLogScope(fnd api.FunctionDefinition, scopes logging.LogScopes) bool { - if scopes.IsEnabled(logging.LogScopeProc) { - if isProcFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopeRandom) { - if isRandomFunction(fnd) { - return true - } - } - - return scopes == logging.LogScopeAll -} diff --git a/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/names.go b/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/names.go deleted file mode 100644 index 549da3c..0000000 --- a/vendor/github.com/tetratelabs/wazero/internal/assemblyscript/names.go +++ /dev/null @@ -1,7 +0,0 @@ -package assemblyscript - -const ( - AbortName = "abort" - TraceName = "trace" - SeedName = "seed" -) diff --git a/vendor/github.com/tetratelabs/wazero/internal/logging/logging.go b/vendor/github.com/tetratelabs/wazero/internal/logging/logging.go deleted file mode 100644 index c66aa92..0000000 --- a/vendor/github.com/tetratelabs/wazero/internal/logging/logging.go +++ /dev/null @@ -1,301 +0,0 @@ -// Package logging includes utilities used to log function calls. This is in -// an independent package to avoid dependency cycles. -package logging - -import ( - "context" - "encoding/hex" - "fmt" - "io" - "strconv" - "strings" - - "github.com/tetratelabs/wazero/api" -) - -// ValueType is an extended form of api.ValueType, used to control logging in -// cases such as bitmasks or strings. -type ValueType = api.ValueType - -const ( - ValueTypeI32 = api.ValueTypeI32 - ValueTypeI64 = api.ValueTypeI64 - ValueTypeF32 = api.ValueTypeF32 - ValueTypeF64 = api.ValueTypeF64 - ValueTypeV128 ValueType = 0x7b // same as wasm.ValueTypeV128 - ValueTypeFuncref ValueType = 0x70 // same as wasm.ValueTypeFuncref - ValueTypeExternref = api.ValueTypeExternref - ValueTypeExnref ValueType = 0x69 // same as wasm.ValueTypeExnref - - // ValueTypeMemI32 is a non-standard type which writes ValueTypeI32 from the memory offset. - ValueTypeMemI32 = 0xfd - // ValueTypeMemH64 is a non-standard type which writes 64-bits fixed-width hex from the memory offset. - ValueTypeMemH64 = 0xfe - // ValueTypeString is a non-standard type describing an offset/len pair of a string. - ValueTypeString = 0xff -) - -type LogScopes uint64 - -const ( - LogScopeNone = LogScopes(0) - LogScopeClock LogScopes = 1 << iota - LogScopeProc - LogScopeFilesystem - LogScopeMemory - LogScopePoll - LogScopeRandom - LogScopeSock - LogScopeAll = LogScopes(0xffffffffffffffff) -) - -func scopeName(s LogScopes) string { - switch s { - case LogScopeClock: - return "clock" - case LogScopeProc: - return "proc" - case LogScopeFilesystem: - return "filesystem" - case LogScopeMemory: - return "memory" - case LogScopePoll: - return "poll" - case LogScopeRandom: - return "random" - case LogScopeSock: - return "sock" - default: - return fmt.Sprintf("", s) - } -} - -// IsEnabled returns true if the scope (or group of scopes) is enabled. -func (f LogScopes) IsEnabled(scope LogScopes) bool { - return f&scope != 0 -} - -// String implements fmt.Stringer by returning each enabled log scope. -func (f LogScopes) String() string { - if f == LogScopeAll { - return "all" - } - var builder strings.Builder - for i := 0; i <= 63; i++ { // cycle through all bits to reduce code and maintenance - target := LogScopes(1 << i) - if f.IsEnabled(target) { - if name := scopeName(target); name != "" { - if builder.Len() > 0 { - builder.WriteByte('|') - } - builder.WriteString(name) - } - } - } - return builder.String() -} - -type ParamLogger func(ctx context.Context, mod api.Module, w Writer, params []uint64) - -type ParamSampler func(ctx context.Context, mod api.Module, params []uint64) bool - -type ResultLogger func(ctx context.Context, mod api.Module, w Writer, params, results []uint64) - -type Writer interface { - io.Writer - io.StringWriter - io.ByteWriter -} - -// ValWriter formats an indexed value. For example, if `vals[i]` is a -// ValueTypeI32, this would format it by default as signed. If a -// ValueTypeString, it would read `vals[i+1]` and write the string from memory. -type ValWriter func(ctx context.Context, mod api.Module, w Writer, i uint32, vals []uint64) - -func Config(fnd api.FunctionDefinition) (paramLoggers []ParamLogger, resultLoggers []ResultLogger) { - types := fnd.ParamTypes() - names := fnd.ParamNames() - if paramLen := uint32(len(types)); paramLen > 0 { - paramLoggers = make([]ParamLogger, paramLen) - hasParamNames := len(names) > 0 - var offset int64 - for i, t := range types { - if hasParamNames { - paramLoggers[i] = NewParamLogger(uint32(offset), names[i], t) - } else { - paramLoggers[i] = (¶mLogger{offsetInStack: uint32(offset), valWriter: ValWriterForType(t)}).Log - } - offset++ - if t == ValueTypeV128 { - offset++ - } - } - } - if resultLen := uint32(len(fnd.ResultTypes())); resultLen > 0 { - resultLoggers = make([]ResultLogger, resultLen) - hasResultNames := len(fnd.ResultNames()) > 0 - var offset int64 - for i, t := range fnd.ResultTypes() { - if hasResultNames { - resultLoggers[i] = NewResultLogger(uint32(offset), fnd.ResultNames()[i], t) - } else { - resultLoggers[i] = (&resultLogger{offsetInStack: uint32(offset), valWriter: ValWriterForType(t)}).Log - } - offset++ - if t == ValueTypeV128 { - offset++ - } - } - } - return -} - -type paramLogger struct { - offsetInStack uint32 - valWriter ValWriter -} - -func (n *paramLogger) Log(ctx context.Context, mod api.Module, w Writer, params []uint64) { - n.valWriter(ctx, mod, w, n.offsetInStack, params) -} - -func NewParamLogger(offsetInStack uint32, name string, t ValueType) ParamLogger { - return (&namedParamLogger{offsetInStack: offsetInStack, name: name, valWriter: ValWriterForType(t)}).Log -} - -type namedParamLogger struct { - offsetInStack uint32 - name string - valWriter ValWriter -} - -func (n *namedParamLogger) Log(ctx context.Context, mod api.Module, w Writer, params []uint64) { - w.WriteString(n.name) //nolint - w.WriteByte('=') //nolint - n.valWriter(ctx, mod, w, n.offsetInStack, params) -} - -type resultLogger struct { - offsetInStack uint32 - valWriter ValWriter -} - -func (n *resultLogger) Log(ctx context.Context, mod api.Module, w Writer, _, results []uint64) { - n.valWriter(ctx, mod, w, n.offsetInStack, results) -} - -func NewResultLogger(idx uint32, name string, t ValueType) ResultLogger { - return (&namedResultLogger{idx, name, ValWriterForType(t)}).Log -} - -type namedResultLogger struct { - offsetInStack uint32 - name string - valWriter ValWriter -} - -func (n *namedResultLogger) Log(ctx context.Context, mod api.Module, w Writer, _, results []uint64) { - w.WriteString(n.name) //nolint - w.WriteByte('=') //nolint - n.valWriter(ctx, mod, w, n.offsetInStack, results) -} - -func ValWriterForType(vt ValueType) ValWriter { - switch vt { - case ValueTypeI32: - return writeI32 - case ValueTypeI64: - return writeI64 - case ValueTypeF32: - return writeF32 - case ValueTypeF64: - return writeF64 - case ValueTypeV128: - return writeV128 - case ValueTypeExternref, ValueTypeFuncref, ValueTypeExnref: - return writeRef - case ValueTypeMemI32: - return writeMemI32 - case ValueTypeMemH64: - return writeMemH64 - case ValueTypeString: - return writeString - default: - panic(fmt.Errorf("BUG: unsupported type %d", vt)) - } -} - -func writeI32(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v := vals[i] - w.WriteString(strconv.FormatInt(int64(int32(v)), 10)) //nolint -} - -func writeI64(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v := vals[i] - w.WriteString(strconv.FormatInt(int64(v), 10)) //nolint -} - -func writeF32(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v := vals[i] - s := strconv.FormatFloat(float64(api.DecodeF32(v)), 'g', -1, 32) - w.WriteString(s) //nolint -} - -func writeF64(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v := vals[i] - s := strconv.FormatFloat(api.DecodeF64(v), 'g', -1, 64) - w.WriteString(s) //nolint -} - -// logV128 logs in fixed-width hex -func writeV128(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v1, v2 := vals[i], vals[i+1] - w.WriteString(fmt.Sprintf("%016x%016x", v1, v2)) //nolint -} - -// logRef logs in fixed-width hex -func writeRef(_ context.Context, _ api.Module, w Writer, i uint32, vals []uint64) { - v := vals[i] - w.WriteString(fmt.Sprintf("%016x", v)) //nolint -} - -func writeMemI32(_ context.Context, mod api.Module, w Writer, i uint32, vals []uint64) { - offset := uint32(vals[i]) - byteCount := uint32(4) - if v, ok := mod.Memory().ReadUint32Le(offset); ok { - w.WriteString(strconv.FormatInt(int64(int32(v)), 10)) //nolint - } else { // log the positions that were out of memory - WriteOOM(w, offset, byteCount) - } -} - -func writeMemH64(_ context.Context, mod api.Module, w Writer, i uint32, vals []uint64) { - offset := uint32(vals[i]) - byteCount := uint32(8) - if s, ok := mod.Memory().Read(offset, byteCount); ok { - hex.NewEncoder(w).Write(s) //nolint - } else { // log the positions that were out of memory - WriteOOM(w, offset, byteCount) - } -} - -func writeString(_ context.Context, mod api.Module, w Writer, i uint32, vals []uint64) { - offset, byteCount := uint32(vals[i]), uint32(vals[i+1]) - WriteStringOrOOM(mod.Memory(), w, offset, byteCount) -} - -func WriteStringOrOOM(mem api.Memory, w Writer, offset, byteCount uint32) { - if s, ok := mem.Read(offset, byteCount); ok { - w.Write(s) //nolint - } else { // log the positions that were out of memory - WriteOOM(w, offset, byteCount) - } -} - -func WriteOOM(w Writer, offset uint32, byteCount uint32) { - w.WriteString("OOM(") //nolint - w.WriteString(strconv.Itoa(int(offset))) //nolint - w.WriteByte(',') //nolint - w.WriteString(strconv.Itoa(int(byteCount))) //nolint - w.WriteByte(')') //nolint -} diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go index 73b0c9a..2048d0d 100644 --- a/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/file_windows.go @@ -5,8 +5,9 @@ import ( "syscall" "unsafe" - "github.com/tetratelabs/wazero/experimental/sys" "golang.org/x/sys/windows" + + "github.com/tetratelabs/wazero/experimental/sys" ) const ( diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go index 7d288ca..a53af60 100644 --- a/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/futimens_linux.go @@ -4,8 +4,9 @@ import ( "syscall" "unsafe" - experimentalsys "github.com/tetratelabs/wazero/experimental/sys" "golang.org/x/sys/unix" + + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" ) const _UTIME_OMIT = unix.UTIME_OMIT diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go index 59ceaba..d712134 100644 --- a/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go +++ b/vendor/github.com/tetratelabs/wazero/internal/sysfs/sock_windows.go @@ -7,9 +7,10 @@ import ( "syscall" "unsafe" + "golang.org/x/sys/windows" + "github.com/tetratelabs/wazero/experimental/sys" socketapi "github.com/tetratelabs/wazero/internal/sock" - "golang.org/x/sys/windows" ) const ( diff --git a/vendor/github.com/tetratelabs/wazero/internal/wasip1/logging/logging.go b/vendor/github.com/tetratelabs/wazero/internal/wasip1/logging/logging.go deleted file mode 100644 index d7341a0..0000000 --- a/vendor/github.com/tetratelabs/wazero/internal/wasip1/logging/logging.go +++ /dev/null @@ -1,430 +0,0 @@ -package logging - -import ( - "context" - "encoding/binary" - "strconv" - "strings" - - "github.com/tetratelabs/wazero/api" - "github.com/tetratelabs/wazero/internal/logging" - "github.com/tetratelabs/wazero/internal/sys" - . "github.com/tetratelabs/wazero/internal/wasip1" -) - -var le = binary.LittleEndian - -func isClockFunction(fnd api.FunctionDefinition) bool { - return strings.HasPrefix(fnd.Name(), "clock_") -} - -func isProcFunction(fnd api.FunctionDefinition) bool { - return fnd.Name() == ProcExitName -} - -func isFilesystemFunction(fnd api.FunctionDefinition) bool { - switch { - case strings.HasPrefix(fnd.Name(), "path_"): - return true - case strings.HasPrefix(fnd.Name(), "fd_"): - return true - } - return false -} - -func isPollFunction(fnd api.FunctionDefinition) bool { - return fnd.Name() == PollOneoffName -} - -func isRandomFunction(fnd api.FunctionDefinition) bool { - return fnd.Name() == RandomGetName -} - -func isSockFunction(fnd api.FunctionDefinition) bool { - return strings.HasPrefix(fnd.Name(), "sock_") -} - -// IsInLogScope returns true if the current function is in any of the scopes. -func IsInLogScope(fnd api.FunctionDefinition, scopes logging.LogScopes) bool { - if scopes.IsEnabled(logging.LogScopeClock) { - if isClockFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopeProc) { - if isProcFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopeFilesystem) { - if isFilesystemFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopePoll) { - if isPollFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopeRandom) { - if isRandomFunction(fnd) { - return true - } - } - - if scopes.IsEnabled(logging.LogScopeSock) { - if isSockFunction(fnd) { - return true - } - } - - return scopes == logging.LogScopeAll -} - -func Config(fnd api.FunctionDefinition) (pSampler logging.ParamSampler, pLoggers []logging.ParamLogger, rLoggers []logging.ResultLogger) { - types := fnd.ParamTypes() - names := fnd.ParamNames() - - switch fnd.Name() { - case FdPrestatGetName: - pLoggers = []logging.ParamLogger{logging.NewParamLogger(0, "fd", logging.ValueTypeI32)} - rLoggers = []logging.ResultLogger{resultParamLogger("prestat", logPrestat(1).Log), logErrno} - return - case ProcExitName: - pLoggers, rLoggers = logging.Config(fnd) - return - case FdReadName, FdWriteName: - pSampler = fdReadWriteSampler - } - - for idx := uint32(0); idx < uint32(len(types)); idx++ { - name := names[idx] - var logger logging.ParamLogger - - if isLookupFlags(fnd, name) { - lf := &logLookupflags{name, idx} - logger = lf.Log - pLoggers = append(pLoggers, logger) - continue - } - - isResult := strings.HasPrefix(name, "result.") - - if strings.Contains(name, "path") { - if isResult { - name = resultParamName(name) - logger = logString(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - } else { - logger = logging.NewParamLogger(idx, name, logging.ValueTypeString) - pLoggers = append(pLoggers, logger) - } - idx++ - continue - } - - if strings.HasPrefix(fnd.Name(), "clock_") { - switch name { - case "id": - logger = logClockId(idx).Log - case "result.resolution": - name = resultParamName(name) - logger = logMemI32(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - case "result.timestamp": - name = resultParamName(name) - logger = logMemI64(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - default: - logger = logging.NewParamLogger(idx, name, types[idx]) - } - pLoggers = append(pLoggers, logger) - continue - } - - if strings.HasPrefix(fnd.Name(), "sock_") { - switch name { - case "flags": - logger = logFlags(idx).Log - case "ri_flags": - logger = logRiFlags(idx).Log - case "si_flags": - logger = logSiFlags(idx).Log - case "how": - logger = logSdFlags(idx).Log - case "result.fd", "result.ro_datalen", "result.so_datalen": - name = resultParamName(name) - logger = logMemI32(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - case "result.ro_flags": - logger = logRoFlags(idx).Log - rLoggers = append(rLoggers, resultParamLogger("ro_flags", logger)) - continue - default: - logger = logging.NewParamLogger(idx, name, types[idx]) - } - pLoggers = append(pLoggers, logger) - continue - } - - switch name { - case "fdflags": - logger = logFdflags(idx).Log - case "flags": - logger = logFlags(idx).Log - case "fst_flags": - logger = logFstflags(idx).Log - case "oflags": - logger = logOflags(idx).Log - case "fs_rights_base": - logger = logFsRightsBase(idx).Log - case "fs_rights_inheriting": - logger = logFsRightsInheriting(idx).Log - case "result.nread", "result.nwritten", "result.opened_fd", "result.nevents", "result.bufused": - name = resultParamName(name) - logger = logMemI32(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - case "result.newoffset": - name = resultParamName(name) - logger = logMemI64(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - case "result.filestat": - name = resultParamName(name) - logger = logFilestat(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - case "result.stat": - name = resultParamName(name) - logger = logFdstat(idx).Log - rLoggers = append(rLoggers, resultParamLogger(name, logger)) - continue - default: - logger = logging.NewParamLogger(idx, name, types[idx]) - } - pLoggers = append(pLoggers, logger) - } - // All WASI functions except proc_after return only an logErrno result. - rLoggers = append(rLoggers, logErrno) - return -} - -// Ensure we don't clutter log with reads and writes to stdio. -func fdReadWriteSampler(_ context.Context, _ api.Module, params []uint64) bool { - fd := int32(params[0]) - return fd > sys.FdStderr -} - -func isLookupFlags(fnd api.FunctionDefinition, name string) bool { - switch fnd.Name() { - case PathFilestatGetName, PathFilestatSetTimesName: - return name == "flags" - case PathLinkName: - return name == "old_flags" - case PathOpenName: - return name == "dirflags" - } - return false -} - -func logErrno(_ context.Context, _ api.Module, w logging.Writer, _, results []uint64) { - errno := ErrnoName(uint32(results[0])) - w.WriteString("errno=") //nolint - w.WriteString(errno) //nolint -} - -type logMemI32 uint32 - -func (i logMemI32) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - if v, ok := mod.Memory().ReadUint32Le(uint32(params[i])); ok { - writeI32(w, v) - } -} - -type logMemI64 uint32 - -func (i logMemI64) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - if v, ok := mod.Memory().ReadUint64Le(uint32(params[i])); ok { - writeI64(w, v) - } -} - -type logFilestat uint32 - -func (i logFilestat) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - offset, byteCount := uint32(params[i]), uint32(64) - if buf, ok := mod.Memory().Read(offset, byteCount); ok { - w.WriteString("{filetype=") //nolint - w.WriteString(FiletypeName(buf[16])) //nolint - w.WriteString(",size=") //nolint - writeI64(w, le.Uint64(buf[32:])) - w.WriteString(",mtim=") //nolint - writeI64(w, le.Uint64(buf[48:])) - w.WriteString("}") //nolint - } -} - -type logFdstat uint32 - -func (i logFdstat) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - offset, byteCount := uint32(params[i]), uint32(24) - if buf, ok := mod.Memory().Read(offset, byteCount); ok { - w.WriteString("{filetype=") //nolint - w.WriteString(FiletypeName(buf[0])) //nolint - w.WriteString(",fdflags=") //nolint - w.WriteString(FdFlagsString(int(le.Uint16(buf[2:])))) //nolint - w.WriteString(",fs_rights_base=") //nolint - w.WriteString(RightsString(int(le.Uint16(buf[8:])))) //nolint - w.WriteString(",fs_rights_inheriting=") //nolint - w.WriteString(RightsString(int(le.Uint16(buf[16:])))) //nolint - w.WriteString("}") //nolint - } -} - -type logString uint32 - -func (i logString) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - offset, byteCount := uint32(params[i]), uint32(params[i+1]) - if s, ok := mod.Memory().Read(offset, byteCount); ok { - w.Write(s) //nolint - } -} - -type logPrestat uint32 - -// Log writes the only valid field: pr_name_len -// See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#prestat_dir -func (i logPrestat) Log(_ context.Context, mod api.Module, w logging.Writer, params []uint64) { - offset := uint32(params[i]) + 4 // skip to pre_name_len field - if nameLen, ok := mod.Memory().ReadUint32Le(offset); ok { - w.WriteString("{pr_name_len=") //nolint - writeI32(w, nameLen) - w.WriteString("}") //nolint - } -} - -// resultParamLogger logs the value of the parameter on ESUCCESS. -func resultParamLogger(name string, pLogger logging.ParamLogger) logging.ResultLogger { - prefix := name + "=" - return func(ctx context.Context, mod api.Module, w logging.Writer, params, results []uint64) { - w.WriteString(prefix) //nolint - if Errno(results[0]) == ErrnoSuccess { - pLogger(ctx, mod, w, params) - } - } -} - -type logClockId int - -func (i logClockId) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - id := uint32(params[i]) - w.WriteString("id=") //nolint - switch id { - case ClockIDRealtime: - w.WriteString("realtime") //nolint - case ClockIDMonotonic: - w.WriteString("monotonic") //nolint - default: - writeI32(w, id) - } -} - -type logFdflags int - -func (i logFdflags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("fdflags=") //nolint - w.WriteString(FdFlagsString(int(params[i]))) //nolint -} - -type logLookupflags struct { - name string - i uint32 -} - -func (l *logLookupflags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString(l.name) //nolint - w.WriteByte('=') //nolint - w.WriteString(LookupflagsString(int(params[l.i]))) //nolint -} - -type logFsRightsBase uint32 - -func (i logFsRightsBase) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("fs_rights_base=") //nolint - w.WriteString(RightsString(int(params[i]))) //nolint -} - -type logFsRightsInheriting uint32 - -func (i logFsRightsInheriting) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("fs_rights_inheriting=") //nolint - w.WriteString(RightsString(int(params[i]))) //nolint -} - -type logOflags int - -func (i logOflags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("oflags=") //nolint - w.WriteString(OflagsString(int(params[i]))) //nolint -} - -type logFstflags int - -func (i logFstflags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("fst_flags=") //nolint - w.WriteString(FstflagsString(int(params[i]))) //nolint -} - -type logFlags int - -func (i logFlags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("flags=") //nolint - w.WriteString(FdFlagsString(int(params[i]))) //nolint -} - -type logSdFlags int - -func (i logSdFlags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("how=") //nolint - w.WriteString(SdFlagsString(int(params[i]))) //nolint -} - -type logSiFlags int - -func (i logSiFlags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("si_flags=") //nolint - w.WriteString(SiFlagsString(int(params[i]))) //nolint -} - -type logRiFlags int - -func (i logRiFlags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString("ri_flags=") //nolint - w.WriteString(RiFlagsString(int(params[i]))) //nolint -} - -type logRoFlags int - -func (i logRoFlags) Log(_ context.Context, _ api.Module, w logging.Writer, params []uint64) { - w.WriteString(RoFlagsString(int(params[i]))) //nolint -} - -func resultParamName(name string) string { - return name[7:] // without "result." -} - -func writeI32(w logging.Writer, v uint32) { - w.WriteString(strconv.FormatInt(int64(int32(v)), 10)) //nolint -} - -func writeI64(w logging.Writer, v uint64) { - w.WriteString(strconv.FormatInt(int64(v), 10)) //nolint -} diff --git a/vendor/github.com/yuin/goldmark/parser/fcode_block.go b/vendor/github.com/yuin/goldmark/parser/fcode_block.go index 307474d..74d782a 100644 --- a/vendor/github.com/yuin/goldmark/parser/fcode_block.go +++ b/vendor/github.com/yuin/goldmark/parser/fcode_block.go @@ -35,6 +35,9 @@ func (b *fencedCodeBlockParser) Trigger() []byte { func (b *fencedCodeBlockParser) Open(parent ast.Node, reader text.Reader, pc Context) (ast.Node, State) { line, segment := reader.PeekLine() pos := pc.BlockOffset() + if pos < 0 || (line[pos] != '`' && line[pos] != '~') { + return nil, NoChildren + } findent := pos fenceChar := line[pos] i := pos diff --git a/vendor/golang.org/x/text/encoding/unicode/unicode.go b/vendor/golang.org/x/text/encoding/unicode/unicode.go index f8e7cdc..ce28c90 100644 --- a/vendor/golang.org/x/text/encoding/unicode/unicode.go +++ b/vendor/golang.org/x/text/encoding/unicode/unicode.go @@ -239,12 +239,12 @@ func UTF16(e Endianness, b BOMPolicy) encoding.Encoding { // and recommendations. Some of the "configurations" are merely recommendations, // so multiple configurations could match. var mibValue = map[Endianness][numBOMValues]identifier.MIB{ - BigEndian: { + BigEndian: [numBOMValues]identifier.MIB{ IgnoreBOM: identifier.UTF16BE, UseBOM: identifier.UTF16, // BigEnding default is preferred by RFC 2781. // TODO: acceptBOM | strictBOM would map to UTF16BE as well. }, - LittleEndian: { + LittleEndian: [numBOMValues]identifier.MIB{ IgnoreBOM: identifier.UTF16LE, UseBOM: identifier.UTF16, // LittleEndian default is allowed and preferred on Windows. // TODO: acceptBOM | strictBOM would map to UTF16LE as well. diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go index fb2821e..acf7140 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v2/apic.go @@ -143,7 +143,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -// // Set the indentation increment. +//// Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go index 03756f6..3081388 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v2/yaml.go @@ -2,7 +2,8 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml +// https://github.com/go-yaml/yaml +// package yaml import ( @@ -66,15 +67,16 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. +// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -164,35 +166,36 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +// func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/vendor/modules.txt b/vendor/modules.txt index c2e31bb..0c1c5fe 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -107,7 +107,7 @@ github.com/google/uuid github.com/jolestar/go-commons-pool/v2 github.com/jolestar/go-commons-pool/v2/collections github.com/jolestar/go-commons-pool/v2/concurrent -# github.com/klippa-app/go-pdfium v1.19.4 +# github.com/klippa-app/go-pdfium v1.19.6 ## explicit; go 1.25.0 github.com/klippa-app/go-pdfium github.com/klippa-app/go-pdfium/enums @@ -159,12 +159,9 @@ github.com/soypat/goldmark-latex github.com/tetratelabs/wazero github.com/tetratelabs/wazero/api github.com/tetratelabs/wazero/experimental -github.com/tetratelabs/wazero/experimental/logging github.com/tetratelabs/wazero/experimental/sys github.com/tetratelabs/wazero/imports/emscripten github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1 -github.com/tetratelabs/wazero/internal/assemblyscript -github.com/tetratelabs/wazero/internal/assemblyscript/logging github.com/tetratelabs/wazero/internal/descriptor github.com/tetratelabs/wazero/internal/emscripten github.com/tetratelabs/wazero/internal/engine/interpreter @@ -181,7 +178,6 @@ github.com/tetratelabs/wazero/internal/filecache github.com/tetratelabs/wazero/internal/ieee754 github.com/tetratelabs/wazero/internal/internalapi github.com/tetratelabs/wazero/internal/leb128 -github.com/tetratelabs/wazero/internal/logging github.com/tetratelabs/wazero/internal/moremath github.com/tetratelabs/wazero/internal/platform github.com/tetratelabs/wazero/internal/sock @@ -191,7 +187,6 @@ github.com/tetratelabs/wazero/internal/u32 github.com/tetratelabs/wazero/internal/u64 github.com/tetratelabs/wazero/internal/version github.com/tetratelabs/wazero/internal/wasip1 -github.com/tetratelabs/wazero/internal/wasip1/logging github.com/tetratelabs/wazero/internal/wasm github.com/tetratelabs/wazero/internal/wasm/binary github.com/tetratelabs/wazero/internal/wasmdebug @@ -200,7 +195,7 @@ github.com/tetratelabs/wazero/sys # github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e ## explicit; go 1.19 github.com/xo/terminfo -# github.com/yuin/goldmark v1.8.4 +# github.com/yuin/goldmark v1.8.5 ## explicit; go 1.22 github.com/yuin/goldmark github.com/yuin/goldmark/ast @@ -240,7 +235,7 @@ go.uber.org/zap/zapcore # golang.org/x/crypto v0.54.0 ## explicit; go 1.25.0 golang.org/x/crypto/sha3 -# golang.org/x/net v0.56.0 +# golang.org/x/net v0.57.0 ## explicit; go 1.25.0 golang.org/x/net/context # golang.org/x/sync v0.22.0