Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created by
brew bump
Created with
brew bump-formula-pr
.release notes
Allow automatic semicolon insertion after
get
/set
This change fixes a grammar bug in the parser that incorrectly treated the following code as a syntax error:
The above code will be considered valid starting with this release. This change to esbuild follows a similar change to TypeScript which will allow this syntax starting with TypeScript 5.7.
Allow quoted property names in
--define
and--pure
(#4008)The
define
andpure
API options now accept identifier expressions containing quoted property names. Previously all identifiers in the identifier expression had to be bare identifiers. This change now makes--define
and--pure
consistent with--global-name
, which already supported quoted property names. For example, the following is now possible:Note that if you're passing values like this on the command line using esbuild's
--define
flag, then you'll need to know how to escape quote characters for your shell. You may find esbuild's JavaScript API more ergonomic and portable than writing shell code.Minify empty
try
/catch
/finally
blocks (#4003)With this release, esbuild will now attempt to minify empty
try
blocks:This can sometimes expose additional minification opportunities.
Include
entryPoint
metadata for thecopy
loader (#3985)Almost all entry points already include a
entryPoint
field in theoutputs
map in esbuild's build metadata. However, this wasn't the case for thecopy
loader as that loader is a special-case that doesn't behave like other loaders. This release adds theentryPoint
field in this case.Source mappings may now contain
null
entries (#3310, #3878)With this change, sources that result in an empty source map may now emit a
null
source mapping (i.e. one with a generated position but without a source index or original position). This change improves source map accuracy by fixing a problem where minified code from a source without any source mappings could potentially still be associated with a mapping from another source file earlier in the generated output on the same minified line. It manifests as nonsensical files in source mapped stack traces. Now thenull
mapping "resets" the source map so that any lookups into the minified code without any mappings resolves tonull
(which appears as the output file in stack traces) instead of the incorrect source file.This change shouldn't affect anything in most situations. I'm only mentioning it in the release notes in case it introduces a bug with source mapping. It's part of a work-in-progress future feature that will let you omit certain unimportant files from the generated source map to reduce source map size.
Avoid using the parent directory name for determinism (#3998)
To make generated code more readable, esbuild includes the name of the source file when generating certain variable names within the file. Specifically bundling a CommonJS file generates a variable to store the lazily-evaluated module initializer. However, if a file is named
index.js
(or with a different extension), esbuild will use the name of the parent directory instead for a better name (since many packages have files all namedindex.js
but have unique directory names).This is problematic when the bundle entry point is named
index.js
and the parent directory name is non-deterministic (e.g. a temporary directory created by a build script). To avoid non-determinism in esbuild's output, esbuild will now useindex
instead of the parent directory in this case. Specifically this will happen if the parent directory is equal to esbuild'soutbase
API option, which defaults to the lowest common ancestor of all user-specified entry point paths.Experimental support for esbuild on NetBSD (#3974)
With this release, esbuild now has a published binary executable for NetBSD in the
@esbuild/netbsd-arm64
npm package, and esbuild's installer has been modified to attempt to use it when on NetBSD. Hopefully this makes installing esbuild via npm work on NetBSD. This change was contributed by @bsiegert.⚠️ Note: NetBSD is not one of Node's supported platforms, so installing esbuild may or may not work on NetBSD depending on how Node has been patched. This is not a problem with esbuild. ⚠️