Skip to content

Commit

Permalink
discard legal comments by default
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 6, 2022
1 parent c3b0890 commit 0228284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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.
Expand Down
8 changes: 1 addition & 7 deletions pkg/api/api_impl.go
Expand Up @@ -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
Expand Down

0 comments on commit 0228284

Please sign in to comment.