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
This commit is contained in:
Bjørn Erik Pedersen 2023-01-16 09:53:17 +01:00
parent c4f3a46ce6
commit 6e9fa9e0fd
3 changed files with 44 additions and 1 deletions

View file

@ -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
`)
}