From 0228284c091c76e5aa04602dfcd47e8fee872dc5 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Tue, 6 Dec 2022 14:01:19 -0500 Subject: [PATCH] discard legal comments by default --- CHANGELOG.md | 4 ++++ pkg/api/api_impl.go | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd5105a87a..f74c20627af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,10 @@ If you run esbuild's JavaScript API in a broken JavaScript environment where `new TextEncoder().encode("") instanceof Uint8Array` is false, then esbuild's API will fail with a confusing serialization error message that makes it seem like esbuild has a bug even though the real problem is that the JavaScript environment itself is broken. This can happen when using the test framework called [Jest](https://jestjs.io/). With this release, esbuild's API will now throw earlier when it detects that the environment is unable to encode UTF-8 text correctly with an error message that makes it more clear that this is not a problem with esbuild. +* Change the default "legal comment" behavior + + The legal comments feature automatically gathers comments containing `@license` or `@preserve` and puts the comments somewhere (either in the generated code or in a separate file). People sometimes want this to happen so that the their dependencies' software licenses are retained in the generated output code. By default esbuild puts these comments at the end of the file when bundling. However, people sometimes find this confusing because these comments can be very generic and may not mention which library they come from. So with this release, esbuild will now discard legal comments by default. You now have to opt-in to preserving them if you want this behavior. + * Rename the `master` branch to `main` The primary branch for this repository was previously called `master` but is now called `main`. This change mirrors a similar change in many other projects. diff --git a/pkg/api/api_impl.go b/pkg/api/api_impl.go index 9edfa5fa4ba..f309e90f474 100644 --- a/pkg/api/api_impl.go +++ b/pkg/api/api_impl.go @@ -146,13 +146,7 @@ func validateSourceMap(value SourceMap) config.SourceMap { func validateLegalComments(value LegalComments, bundle bool) config.LegalComments { switch value { - case LegalCommentsDefault: - if bundle { - return config.LegalCommentsEndOfFile - } else { - return config.LegalCommentsInline - } - case LegalCommentsNone: + case LegalCommentsDefault, LegalCommentsNone: return config.LegalCommentsNone case LegalCommentsInline: return config.LegalCommentsInline