From 89b8c322008f5285b81d4b357887292e3b61f708 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 11 Jul 2026 11:03:57 -0700 Subject: [PATCH] common/hugo: Include non-go dependencies in go env output Closes #15116 Co-authored-by: Claude Sonnet 4.6 --- common/hugo/hugo.go | 9 +++++++-- internal/warpc/avif.go | 7 +++++++ internal/warpc/katex.go | 3 +++ internal/warpc/warpc.go | 20 +++++++++++++++++--- internal/warpc/webp.go | 3 +++ testscripts/commands/env.txt | 9 ++++++++- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 28f8b9393..ac490a84b 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -33,6 +33,7 @@ import ( "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/version" "github.com/gohugoio/hugo/hugofs/files" + "github.com/gohugoio/hugo/internal/warpc" "github.com/spf13/afero" @@ -211,7 +212,10 @@ func GetDependencyList() []string { // GetDependencyListNonGo returns a list of non-Go dependencies. func GetDependencyListNonGo() []string { - deps := []string{formatDep("github.com/webmproject/libwebp", "v1.6.0")} // via WASM. TODO(bep) get versions from the plugin setup. + var deps []string + for _, dep := range warpc.GetWASMDeps() { + deps = append(deps, formatDep(dep[0], dep[1])) + } if IsExtended { deps = append( @@ -225,7 +229,8 @@ func GetDependencyListNonGo() []string { if IsDartSassGeV2() { dartSassPath = "github.com/sass/dart-sass" } - deps = append(deps, + deps = append( + deps, formatDep(dartSassPath+"/protocol", dartSass.ProtocolVersion), formatDep(dartSassPath+"/compiler", dartSass.CompilerVersion), formatDep(dartSassPath+"/implementation", dartSass.ImplementationVersion), diff --git a/internal/warpc/avif.go b/internal/warpc/avif.go index baadaadd7..f080b87b1 100644 --- a/internal/warpc/avif.go +++ b/internal/warpc/avif.go @@ -25,6 +25,13 @@ import ( "github.com/gohugoio/hugo/common/hugio" ) +// Keep in sync with genavif/Makefile. +const ( + libavifVersion = "v1.4.1" + aomVersion = "v3.14.1" + dav1dVersion = "1.5.3" +) + var ( _ SourceProvider = AvifInput{} _ DestinationProvider = AvifInput{} diff --git a/internal/warpc/katex.go b/internal/warpc/katex.go index 75c20117f..627f18e3a 100644 --- a/internal/warpc/katex.go +++ b/internal/warpc/katex.go @@ -17,6 +17,9 @@ import ( _ "embed" ) +// Keep in sync with js/package.json. +const katexVersion = "0.16.21" + //go:embed wasm/renderkatex.wasm var katexWasm []byte diff --git a/internal/warpc/warpc.go b/internal/warpc/warpc.go index b7763e782..be8e48bb5 100644 --- a/internal/warpc/warpc.go +++ b/internal/warpc/warpc.go @@ -48,6 +48,17 @@ const ( const currentVersion = 1 +// GetWASMDeps returns version information for the C libraries bundled as WASM. +func GetWASMDeps() [][2]string { + return [][2]string{ + {"aomedia.googlesource.com/aom", aomVersion}, + {"code.videolan.org/videolan/dav1d", dav1dVersion}, + {"github.com/AOMediaCodec/libavif", libavifVersion}, + {"github.com/KaTeX/KaTeX", katexVersion}, + {"github.com/webmproject/libwebp", libwebpVersion}, + } +} + //go:embed wasm/quickjs.wasm var quickjsWasm []byte @@ -348,7 +359,8 @@ func (d *dispatcher[Q, R]) inputBlobs() error { call.done() } return nil - }); err != nil { + }, + ); err != nil { inputErr = err break } @@ -384,7 +396,8 @@ func (d *dispatcher[Q, R]) inputJSON() error { call.done() } return nil - }); err != nil { + }, + ); err != nil { inputErr = err break } @@ -679,7 +692,8 @@ func newDispatcher[Q, R any](opts Options) (*dispatcherPool[Q, R], error) { if err != nil { return toErr("quickjs", errBuff, err) } - ctx = experimental.WithImportResolver(ctx, + ctx = experimental.WithImportResolver( + ctx, func(name string) api.Module { if name == opts.Runtime.Name { return runtimeInstance diff --git a/internal/warpc/webp.go b/internal/warpc/webp.go index 35ee98899..2c2be0bd4 100644 --- a/internal/warpc/webp.go +++ b/internal/warpc/webp.go @@ -28,6 +28,9 @@ import ( "github.com/gohugoio/hugo/common/hugio" ) +// Keep in sync with genwebp/Makefile. +const libwebpVersion = "v1.6.0" + var ( _ SourceProvider = WebpInput{} _ DestinationProvider = WebpInput{} diff --git a/testscripts/commands/env.txt b/testscripts/commands/env.txt index 742e05ffc..1ae628c6c 100644 --- a/testscripts/commands/env.txt +++ b/testscripts/commands/env.txt @@ -1,5 +1,12 @@ # Test the hugo env command. hugo env +stdout 'GOOS' stdout 'GOARCH' -! stderr . \ No newline at end of file +stdout 'GOVERSION' +stdout 'aomedia\.googlesource\.com/aom' +stdout 'code\.videolan\.org/videolan/dav1d' +stdout 'github\.com/AOMediaCodec/libavif' +stdout 'github\.com/KaTeX/KaTeX' +stdout 'github\.com/webmproject/libwebp' +! stderr .