diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-01-16 09:53:17 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-01-16 14:41:13 +0100 |
commit | 6e9fa9e0fd15f2e373873e9ddfc888879c15e28b (patch) | |
tree | bb692a7e5011d5bff9644b82929e728e2da2ccd2 /resources/resource_transformers/js/integration_test.go | |
parent | c4f3a46ce6a4ce1890a26be31267838c6a065516 (diff) |
deps: Upgrade github.com/evanw/esbuild v0.15.18 => v0.17.0
Also add a test to make sure legal comments are preserved in JS bundles.
Closes #10536
Diffstat (limited to 'resources/resource_transformers/js/integration_test.go')
-rw-r--r-- | resources/resource_transformers/js/integration_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/resource_transformers/js/integration_test.go b/resources/resource_transformers/js/integration_test.go index ef371248c..023569b8d 100644 --- a/resources/resource_transformers/js/integration_test.go +++ b/resources/resource_transformers/js/integration_test.go @@ -303,3 +303,44 @@ IMPORT_SRC_DIR:imp3/foo.ts } } + +// See https://github.com/evanw/esbuild/issues/2745 +func TestPreserveLegalComments(t *testing.T) { + t.Parallel() + + files := ` +-- assets/js/main.js -- +/* @license + * Main license. + */ +import * as foo from 'js/utils'; +console.log("Hello Main"); +-- assets/js/utils/index.js -- +export * from './util1'; +export * from './util2'; +-- assets/js/utils/util1.js -- +/*! License util1 */ +console.log("Hello 1"); +-- assets/js/utils/util2.js -- +//! License util2 */ +console.log("Hello 2"); +-- layouts/index.html -- +{{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false) }} +{{ $js.RelPermalink }} +` + + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + NeedsOsFS: true, + TxtarString: files, + }).Build() + + b.AssertFileContent("public/js/main.js", ` +License util1 +License util2 +Main license + + `) + +} |