Update npm non-major dependencies #50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "renovate/npm-minor-patch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
^0.5.0
->^0.6.0
^0.22.0
->^0.25.0
0.18.4
->0.18.12
Release Notes
mozilla/readability (@mozilla/readability)
v0.6.0
Compare Source
#892, #893,
#915,
evanw/esbuild (esbuild)
v0.25.10
Compare Source
Fix a panic in a minification edge case (#4287)
This release fixes a panic due to a null pointer that could happen when esbuild inlines a doubly-nested identity function and the final result is empty. It was fixed by emitting the value
undefined
in this case, which avoids the panic. This case must be rare since it hasn't come up until now. Here is an example of code that previously triggered the panic (which only happened when minifying):Fix
@supports
nested inside pseudo-element (#4265)When transforming nested CSS to non-nested CSS, esbuild is supposed to filter out pseudo-elements such as
::placeholder
for correctness. The CSS nesting specification says the following:However, it seems like this behavior is different for nested at-rules such as
@supports
, which do work with pseudo-elements. So this release modifies esbuild's behavior to now take that into account:v0.25.9
Compare Source
Better support building projects that use Yarn on Windows (#3131, #3663)
With this release, you can now use esbuild to bundle projects that use Yarn Plug'n'Play on Windows on drives other than the
C:
drive. The problem was as follows:C:
driveD:
drive../..
to get from the project directory to the cache directory..
(soD:\..
is justD:
)Yarn works around this edge case by pretending Windows-style paths beginning with
C:\
are actually Unix-style paths beginning with/C:/
, so the../..
path segments are able to navigate across drives inside Yarn's implementation. This was broken for a long time in esbuild but I finally got access to a Windows machine and was able to debug and fix this edge case. So you should now be able to bundle these projects with esbuild.Preserve parentheses around function expressions (#4252)
The V8 JavaScript VM uses parentheses around function expressions as an optimization hint to immediately compile the function. Otherwise the function would be lazily-compiled, which has additional overhead if that function is always called immediately as lazy compilation involves parsing the function twice. You can read V8's blog post about this for more details.
Previously esbuild did not represent parentheses around functions in the AST so they were lost during compilation. With this change, esbuild will now preserve parentheses around function expressions when they are present in the original source code. This means these optimization hints will not be lost when bundling with esbuild. In addition, esbuild will now automatically add this optimization hint to immediately-invoked function expressions. Here's an example:
Note that you do not want to wrap all function expressions in parentheses. This optimization hint should only be used for functions that are called on initial load. Using this hint for functions that are not called on initial load will unnecessarily delay the initial load. Again, see V8's blog post linked above for details.
Update Go from 1.23.10 to 1.23.12 (#4257, #4258)
This should have no effect on existing code as this version change does not change Go's operating system support. It may remove certain false positive reports (specifically CVE-2025-4674 and CVE-2025-47907) from vulnerability scanners that only detect which version of the Go compiler esbuild uses.
v0.25.8
Compare Source
Fix another TypeScript parsing edge case (#4248)
This fixes a regression with a change in the previous release that tries to more accurately parse TypeScript arrow functions inside the
?:
operator. The regression specifically involves parsing an arrow function containing a#private
identifier inside the middle of a?:
ternary operator inside a class body. This was fixed by propagating private identifier state into the parser clone used to speculatively parse the arrow function body. Here is an example of some affected code:Fix a regression with the parsing of source phase imports
The change in the previous release to parse source phase imports failed to properly handle the following cases:
Parsing for these cases should now be fixed. The first case was incorrectly treated as a syntax error because esbuild was expecting the second case. And the last case was previously allowed but is now forbidden. TypeScript hasn't added this feature yet so it remains to be seen whether the last case will be allowed, but it's safer to disallow it for now. At least Babel doesn't allow the last case when parsing TypeScript, and Babel was involved with the source phase import specification.
v0.25.7
Compare Source
Parse and print JavaScript imports with an explicit phase (#4238)
This release adds basic syntax support for the
defer
andsource
import phases in JavaScript:defer
This is a stage 3 proposal for an upcoming JavaScript feature that will provide one way to eagerly load but lazily initialize imported modules. The imported module is automatically initialized on first use. Support for this syntax will also be part of the upcoming release of TypeScript 5.9. The syntax looks like this:
Note that this feature deliberately cannot be used with the syntax
import defer foo from "<specifier>"
orimport defer { foo } from "<specifier>"
.source
This is a stage 3 proposal for an upcoming JavaScript feature that will provide another way to eagerly load but lazily initialize imported modules. The imported module is returned in an uninitialized state. Support for this syntax may or may not be a part of TypeScript 5.9 (see this issue for details). The syntax looks like this:
Note that this feature deliberately cannot be used with the syntax
import defer * as foo from "<specifier>"
orimport defer { foo } from "<specifier>"
.This change only adds support for this syntax. These imports cannot currently be bundled by esbuild. To use these new features with esbuild's bundler, the imported paths must be external to the bundle and the output format must be set to
esm
.Support optionally emitting absolute paths instead of relative paths (#338, #2082, #3023)
This release introduces the
--abs-paths=
feature which takes a comma-separated list of situations where esbuild should use absolute paths instead of relative paths. There are currently three supported situations:code
(comments and string literals),log
(log message text and location info), andmetafile
(the JSON build metadata).Using absolute paths instead of relative paths is not the default behavior because it means that the build results are no longer machine-independent (which means builds are no longer reproducible). Absolute paths can be useful when used with certain terminal emulators that allow you to click on absolute paths in the terminal text and/or when esbuild is being automatically invoked from several different directories within the same script.
Fix a TypeScript parsing edge case (#4241)
This release fixes an edge case with parsing an arrow function in TypeScript with a return type that's in the middle of a
?:
ternary operator. For example:The
:
token in the value assigned tox
pairs with the?
token, so it's not the start of a return type annotation. However, the first:
token in the value assigned toy
is the start of a return type annotation because after parsing the arrow function body, it turns out there's another:
token that can be used to pair with the?
token. This case is notable as it's the first TypeScript edge case that esbuild has needed a backtracking parser to parse. It has been addressed by a quick hack (cloning the whole parser) as it's a rare edge case and esbuild doesn't otherwise need a backtracking parser. Hopefully this is sufficient and doesn't cause any issues.Inline small constant strings when minifying
Previously esbuild's minifier didn't inline string constants because strings can be arbitrarily long, and this isn't necessarily a size win if the string is used more than once. Starting with this release, esbuild will now inline string constants when the length of the string is three code units or less. For example:
Note that esbuild's constant inlining only happens in very restrictive scenarios to avoid issues with TDZ handling. This change doesn't change when esbuild's constant inlining happens. It only expands the scope of it to include certain string literals in addition to numeric and boolean literals.
v0.25.6
Compare Source
Fix a memory leak when
cancel()
is used on a build context (#4231)Calling
rebuild()
followed bycancel()
in rapid succession could previously leak memory. The bundler uses a producer/consumer model internally, and the resource leak was caused by the consumer being termianted while there were still remaining unreceived results from a producer. To avoid the leak, the consumer now waits for all producers to finish before terminating.Support empty
:is()
and:where()
syntax in CSS (#4232)Previously using these selectors with esbuild would generate a warning. That warning has been removed in this release for these cases.
Improve tree-shaking of
try
statements in dead code (#4224)With this release, esbuild will now remove certain
try
statements if esbuild considers them to be within dead code (i.e. code that is known to not ever be evaluated). For example:Consider negated bigints to have no side effects
While esbuild currently considers
1
,-1
, and1n
to all have no side effects, it didn't previously consider-1n
to have no side effects. This is because esbuild does constant folding with numbers but not bigints. However, it meant that unused negative bigint constants were not tree-shaken. With this release, esbuild will now consider these expressions to also be side-effect free:Support a configurable delay in watch mode before rebuilding (#3476, #4178)
The
watch()
API now takes adelay
option that lets you add a delay (in milliseconds) before rebuilding when a change is detected in watch mode. If you use a tool that regenerates multiple source files very slowly, this should make it more likely that esbuild's watch mode won't generate a broken intermediate build before the successful final build. This option is also available via the CLI using the--watch-delay=
flag.This should also help avoid confusion about the
watch()
API's options argument. It was previously empty to allow for future API expansion, which caused some people to think that the documentation was missing. It's no longer empty now that thewatch()
API has an option.Allow mixed array for
entryPoints
API option (#4223)The TypeScript type definitions now allow you to pass a mixed array of both string literals and object literals to the
entryPoints
API option, such as['foo.js', { out: 'lib', in: 'bar.js' }]
. This was always possible to do in JavaScript but the TypeScript type definitions were previously too restrictive.Update Go from 1.23.8 to 1.23.10 (#4204, #4207)
This should have no effect on existing code as this version change does not change Go's operating system support. It may remove certain false positive reports (specifically CVE-2025-4673 and CVE-2025-22874) from vulnerability scanners that only detect which version of the Go compiler esbuild uses.
Experimental support for esbuild on OpenHarmony (#4212)
With this release, esbuild now publishes the
@esbuild/openharmony-arm64
npm package for OpenHarmony. It contains a WebAssembly binary instead of a native binary because Go doesn't currently support OpenHarmony. Node does support it, however, so in theory esbuild should now work on OpenHarmony through WebAssembly.This change was contributed by @hqzing.
v0.25.5
Compare Source
Fix a regression with
browser
inpackage.json
(#4187)The fix to #4144 in version 0.25.3 introduced a regression that caused
browser
overrides specified inpackage.json
to fail to override relative path names that end in a trailing slash. That behavior change affected theaxios@0.30.0
package. This regression has been fixed, and now has test coverage.Add support for certain keywords as TypeScript tuple labels (#4192)
Previously esbuild could incorrectly fail to parse certain keywords as TypeScript tuple labels that are parsed by the official TypeScript compiler if they were followed by a
?
modifier. These labels includedfunction
,import
,infer
,new
,readonly
, andtypeof
. With this release, these keywords will now be parsed correctly. Here's an example of some affected code:Add CSS prefixes for the
stretch
sizing value (#4184)This release adds support for prefixing CSS declarations such as
div { width: stretch }
. That CSS is now transformed into this depending on what the--target=
setting includes:v0.25.4
Compare Source
Add simple support for CORS to esbuild's development server (#4125)
Starting with version 0.25.0, esbuild's development server is no longer configured to serve cross-origin requests. This was a deliberate change to prevent any website you visit from accessing your running esbuild development server. However, this change prevented (by design) certain use cases such as "debugging in production" by having your production website load code from
localhost
where the esbuild development server is running.To enable this use case, esbuild is adding a feature to allow Cross-Origin Resource Sharing (a.k.a. CORS) for simple requests. Specifically, passing your origin to the new
cors
option will now set theAccess-Control-Allow-Origin
response header when the request has a matchingOrigin
header. Note that this currently only works for requests that don't send a preflightOPTIONS
request, as esbuild's development server doesn't currently supportOPTIONS
requests.Some examples:
CLI:
JS:
Go:
The special origin
*
can be used to allow any origin to access esbuild's development server. Note that this means any website you visit will be able to read everything served by esbuild.Pass through invalid URLs in source maps unmodified (#4169)
This fixes a regression in version 0.25.0 where
sources
in source maps that form invalid URLs were not being passed through to the output. Version 0.25.0 changed the interpretation ofsources
from file paths to URLs, which means that URL parsing can now fail. Previously URLs that couldn't be parsed were replaced with the empty string. With this release, invalid URLs insources
should now be passed through unmodified.Handle exports named
__proto__
in ES modules (#4162, #4163)In JavaScript, the special property name
__proto__
sets the prototype when used inside an object literal. Previously esbuild's ESM-to-CommonJS conversion didn't special-case the property name of exports named__proto__
so the exported getter accidentally became the prototype of the object literal. It's unclear what this affects, if anything, but it's better practice to avoid this by using a computed property name in this case.This fix was contributed by @magic-akari.
v0.25.3
Compare Source
Fix lowered
async
arrow functions beforesuper()
(#4141, #4142)This change makes it possible to call an
async
arrow function in a constructor before callingsuper()
when targeting environments withoutasync
support, as long as the function body doesn't referencethis
. Here's an example (notice the change fromthis
tonull
):Some background: Arrow functions with the
async
keyword are transformed into generator functions for older language targets such as--target=es2016
. Since arrow functions capturethis
, the generated code forwardsthis
into the body of the generator function. However, JavaScript class syntax forbids usingthis
in a constructor before callingsuper()
, and this forwarding was problematic since previously happened even when the function body doesn't usethis
. Starting with this release, esbuild will now only forwardthis
if it's used within the function body.This fix was contributed by @magic-akari.
Fix memory leak with
--watch=true
(#4131, #4132)This release fixes a memory leak with esbuild when
--watch=true
is used instead of--watch
. Previously using--watch=true
caused esbuild to continue to use more and more memory for every rebuild, but--watch=true
should now behave like--watch
and not leak memory.This bug happened because esbuild disables the garbage collector when it's not run as a long-lived process for extra speed, but esbuild's checks for which arguments cause esbuild to be a long-lived process weren't updated for the new
--watch=true
style of boolean command-line flags. This has been an issue since this boolean flag syntax was added in version 0.14.24 in 2022. These checks are unfortunately separate from the regular argument parser because of how esbuild's internals are organized (the command-line interface is exposed as a separate Go API so you can build your own custom esbuild CLI).This fix was contributed by @mxschmitt.
More concise output for repeated legal comments (#4139)
Some libraries have many files and also use the same legal comment text in all files. Previously esbuild would copy each legal comment to the output file. Starting with this release, legal comments duplicated across separate files will now be grouped in the output file by unique comment content.
Allow a custom host with the development server (#4110)
With this release, you can now use a custom non-IP
host
with esbuild's local development server (either with--serve=
for the CLI or with theserve()
call for the API). This was previously possible, but was intentionally broken in version 0.25.0 to fix a security issue. This change adds the functionality back except that it's now opt-in and only for a single domain name that you provide.For example, if you add a mapping in your
/etc/hosts
file fromlocal.example.com
to127.0.0.1
and then useesbuild --serve=local.example.com:8000
, you will now be able to visit http://local.example.com:8000/ in your browser and successfully connect to esbuild's development server (doing that would previously have been blocked by the browser). This should also work with HTTPS if it's enabled (see esbuild's documentation for how to do that).Add a limit to CSS nesting expansion (#4114)
With this release, esbuild will now fail with an error if there is too much CSS nesting expansion. This can happen when nested CSS is converted to CSS without nesting for older browsers as expanding CSS nesting is inherently exponential due to the resulting combinatorial explosion. The expansion limit is currently hard-coded and cannot be changed, but is extremely unlikely to trigger for real code. It exists to prevent esbuild from using too much time and/or memory. Here's an example:
Previously, transforming this file with
--target=safari1
took 5 seconds and generated 40mb of CSS. Trying to do that will now generate the following error instead:Fix path resolution edge case (#4144)
This fixes an edge case where esbuild's path resolution algorithm could deviate from node's path resolution algorithm. It involves a confusing situation where a directory shares the same file name as a file (but without the file extension). See the linked issue for specific details. This appears to be a case where esbuild is correctly following node's published resolution algorithm but where node itself is doing something different. Specifically the step
LOAD_AS_FILE
appears to be skipped when the input ends with..
. This release changes esbuild's behavior for this edge case to match node's behavior.Update Go from 1.23.7 to 1.23.8 (#4133, #4134)
This should have no effect on existing code as this version change does not change Go's operating system support. It may remove certain reports from vulnerability scanners that detect which version of the Go compiler esbuild uses, such as for CVE-2025-22871.
As a reminder, esbuild's development server is intended for development, not for production, so I do not consider most networking-related vulnerabilities in Go to be vulnerabilities in esbuild. Please do not use esbuild's development server in production.
v0.25.2
Compare Source
Support flags in regular expressions for the API (#4121)
The JavaScript plugin API for esbuild takes JavaScript regular expression objects for the
filter
option. Internally these are translated into Go regular expressions. However, this translation previously ignored theflags
property of the regular expression. With this release, esbuild will now translate JavaScript regular expression flags into Go regular expression flags. Specifically the JavaScript regular expression/\.[jt]sx?$/i
is turned into the Go regular expression`(?i)\.[jt]sx?$`
internally inside of esbuild's API. This should make it possible to use JavaScript regular expressions with thei
flag. Note that JavaScript and Go don't support all of the same regular expression features, so this mapping is only approximate.Fix node-specific annotations for string literal export names (#4100)
When node instantiates a CommonJS module, it scans the AST to look for names to expose via ESM named exports. This is a heuristic that looks for certain patterns such as
exports.NAME = ...
ormodule.exports = { ... }
. This behavior is used by esbuild to "annotate" CommonJS code that was converted from ESM with the original ESM export names. For example, when converting the fileexport let foo, bar
from ESM to CommonJS, esbuild appends this to the end of the file:However, this feature previously didn't work correctly for export names that are not valid identifiers, which can be constructed using string literal export names. The generated code contained a syntax error. That problem is fixed in this release:
Basic support for index source maps (#3439, #4109)
The source map specification has an optional mode called index source maps that makes it easier for tools to create an aggregate JavaScript file by concatenating many smaller JavaScript files with source maps, and then generate an aggregate source map by simply providing the original source maps along with some offset information. My understanding is that this is rarely used in practice. I'm only aware of two uses of it in the wild: ClojureScript and Turbopack.
This release provides basic support for indexed source maps. However, the implementation has not been tested on a real app (just on very simple test input). If you are using index source maps in a real app, please try this out and report back if anything isn't working for you.
Note that this is also not a complete implementation. For example, index source maps technically allows nesting source maps to an arbitrary depth, while esbuild's implementation in this release only supports a single level of nesting. It's unclear whether supporting more than one level of nesting is important or not given the lack of available test cases.
This feature was contributed by @clyfish.
v0.25.1
Compare Source
Fix a panic in a minification edge case (#4287)
This release fixes a panic due to a null pointer that could happen when esbuild inlines a doubly-nested identity function and the final result is empty. It was fixed by emitting the value
undefined
in this case, which avoids the panic. This case must be rare since it hasn't come up until now. Here is an example of code that previously triggered the panic (which only happened when minifying):Fix
@supports
nested inside pseudo-element (#4265)When transforming nested CSS to non-nested CSS, esbuild is supposed to filter out pseudo-elements such as
::placeholder
for correctness. The CSS nesting specification says the following:However, it seems like this behavior is different for nested at-rules such as
@supports
, which do work with pseudo-elements. So this release modifies esbuild's behavior to now take that into account:v0.25.0
Compare Source
This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of
esbuild
in yourpackage.json
file (recommended) or be using a version range syntax that only accepts patch upgrades such as^0.24.0
or~0.24.0
. See npm's documentation about semver for more information.Restrict access to esbuild's development server (GHSA-67mh-4wv8-2f99)
This change addresses esbuild's first security vulnerability report. Previously esbuild set the
Access-Control-Allow-Origin
header to*
to allow esbuild's development server to be flexible in how it's used for development. However, this allows the websites you visit to make HTTP requests to esbuild's local development server, which gives read-only access to your source code if the website were to fetch your source code's specific URL. You can read more information in the report.Starting with this release, CORS will now be disabled, and requests will now be denied if the host does not match the one provided to
--serve=
. The default host is0.0.0.0
, which refers to all of the IP addresses that represent the local machine (e.g. both127.0.0.1
and192.168.0.1
). If you want to customize anything about esbuild's development server, you can put a proxy in front of esbuild and modify the incoming and/or outgoing requests.In addition, the
serve()
API call has been changed to return an array ofhosts
instead of a singlehost
string. This makes it possible to determine all of the hosts that esbuild's development server will accept.Thanks to @sapphi-red for reporting this issue.
Delete output files when a build fails in watch mode (#3643)
It has been requested for esbuild to delete files when a build fails in watch mode. Previously esbuild left the old files in place, which could cause people to not immediately realize that the most recent build failed. With this release, esbuild will now delete all output files if a rebuild fails. Fixing the build error and triggering another rebuild will restore all output files again.
Fix correctness issues with the CSS nesting transform (#3620, #3877, #3933, #3997, #4005, #4037, #4038)
This release fixes the following problems:
Naive expansion of CSS nesting can result in an exponential blow-up of generated CSS if each nesting level has multiple selectors. Previously esbuild sometimes collapsed individual nesting levels using
:is()
to limit expansion. However, this collapsing wasn't correct in some cases, so it has been removed to fix correctness issues.Thanks to @tim-we for working on a fix.
The
&
CSS nesting selector can be repeated multiple times to increase CSS specificity. Previously esbuild ignored this possibility and incorrectly considered&&
to have the same specificity as&
. With this release, this should now work correctly:Thanks to @CPunisher for working on a fix.
Previously transforming nested CSS incorrectly removed leading combinators from within pseudoclass selectors such as
:where()
. This edge case has been fixed and how has test coverage.This fix was contributed by @NoremacNergfol.
The CSS minifier contains logic to remove the
&
selector when it can be implied, which happens when there is only one and it's the leading token. However, this logic was incorrectly also applied to selector lists inside of pseudo-class selectors such as:where()
. With this release, the minifier will now avoid applying this logic in this edge case:Fix some correctness issues with source maps (#1745, #3183, #3613, #3982)
Previously esbuild incorrectly treated source map path references as file paths instead of as URLs. With this release, esbuild will now treat source map path references as URLs. This fixes the following problems with source maps:
File names in
sourceMappingURL
that contained a space previously did not encode the space as%20
, which resulted in JavaScript tools (including esbuild) failing to read that path back in when consuming the generated output file. This should now be fixed.Absolute URLs in
sourceMappingURL
that use thefile://
scheme previously attempted to read from a folder calledfile:
. These URLs should now be recognized and parsed correctly.Entries in the
sources
array in the source map are now treated as URLs instead of file paths. The correct behavior for this is much more clear now that source maps has a formal specification. Many thanks to those who worked on the specification.Fix incorrect package for
@esbuild/netbsd-arm64
(#4018)Due to a copy+paste typo, the binary published to
@esbuild/netbsd-arm64
was not actually forarm64
, and didn't run in that environment. This release should fix running esbuild in that environment (NetBSD on 64-bit ARM). Sorry about the mistake.Fix a minification bug with bitwise operators and bigints (#4065)
This change removes an incorrect assumption in esbuild that all bitwise operators result in a numeric integer. That assumption was correct up until the introduction of bigints in ES2020, but is no longer correct because almost all bitwise operators now operate on both numbers and bigints. Here's an example of the incorrect minification:
Fix esbuild incorrectly rejecting valid TypeScript edge case (#4027)
The following TypeScript code is valid:
Before this version, esbuild would fail to parse this with a syntax error as it expected the token sequence
async as ...
to be the start of an async arrow function expressionasync as => ...
. This edge case should be parsed correctly by esbuild starting with this release.Transform BigInt values into constructor calls when unsupported (#4049)
Previously esbuild would refuse to compile the BigInt literals (such as
123n
) if they are unsupported in the configured target environment (such as with--target=es6
). The rationale was that they cannot be polyfilled effectively because they change the behavior of JavaScript's arithmetic operators and JavaScript doesn't have operator overloading.However, this prevents using esbuild with certain libraries that would otherwise work if BigInt literals were ignored, such as with old versions of the
buffer
library before the library fixed support for running in environments without BigInt support. So with this release, esbuild will now turn BigInt literals into BigInt constructor calls (so123n
becomesBigInt(123)
) and generate a warning in this case. You can turn off the warning with--log-override:bigint=silent
or restore the warning to an error with--log-override:bigint=error
if needed.Change how
console
API dropping works (#4020)Previously the
--drop:console
feature replaced all method calls off of theconsole
global withundefined
regardless of how long the property access chain was (so it applied toconsole.log()
andconsole.log.call(console)
andconsole.log.not.a.method()
). However, it was pointed out that this breaks uses ofconsole.log.bind(console)
. That's also incompatible with Terser's implementation of the feature, which is where this feature originally came from (it does supportbind
). So with this release, using this feature with esbuild will now only replace one level of method call (unless extended bycall
orapply
) and will replace the method being called with an empty function in complex cases:This should more closely match Terser's existing behavior.
Allow BigInt literals as
define
valuesWith this release, you can now use BigInt literals as define values, such as with
--define:FOO=123n
. Previously trying to do this resulted in a syntax error.Fix a bug with resolve extensions in
node_modules
(#4053)The
--resolve-extensions=
option lets you specify the order in which to try resolving implicit file extensions. For complicated reasons, esbuild reorders TypeScript file extensions after JavaScript ones inside ofnode_modules
so that JavaScript source code is always preferred to TypeScript source code inside of dependencies. However, this reordering had a bug that could accidentally change the relative order of TypeScript file extensions if one of them was a prefix of the other. That bug has been fixed in this release. You can see the issue for details.Better minification of statically-determined
switch
cases (#4028)With this release, esbuild will now try to trim unused code within
switch
statements when the test expression andcase
expressions are primitive literals. This can arise when the test expression is an identifier that is substituted for a primitive literal at compile time. For example:Emit
/* @​__KEY__ */
for string literals derived from property names (#4034)Property name mangling is an advanced feature that shortens certain property names for better minification (I say "advanced feature" because it's very easy to break your code with it). Sometimes you need to store a property name in a string, such as
obj.get('foo')
instead ofobj.foo
. JavaScript minifiers such as esbuild and Terser have a convention where a/* @​__KEY__ */
comment before the string makes it behave like a property name. Soobj.get(/* @​__KEY__ */ 'foo')
allows the contents of the string'foo'
to be shortened.However, esbuild sometimes itself generates string literals containing property names when transforming code, such as when lowering class fields to ES6 or when transforming TypeScript decorators. Previously esbuild didn't generate its own
/* @​__KEY__ */
comments in this case, which means that minifying your code by running esbuild again on its own output wouldn't work correctly (this does not affect people that both minify and transform their code in a single step).With this release, esbuild will now generate
/* @​__KEY__ */
comments for property names in generated string literals. To avoid lots of unnecessary output for people that don't use this advanced feature, the generated comments will only be present when the feature is active. If you want to generate the comments but not actually mangle any property names, you can use a flag that has no effect such as--reserve-props=.
, which tells esbuild to not mangle any property names (but still activates this feature).The
text
loader now strips the UTF-8 BOM if present (#3935)Some software (such as Notepad on Windows) can create text files that start with the three bytes
0xEF 0xBB 0xBF
, which is referred to as the "byte order mark". This prefix is intended to be removed before using the text. Previously esbuild'stext
loader included this byte sequence in the string, which turns into a prefix of\uFEFF
in a JavaScript string when decoded from UTF-8. With this release, esbuild'stext
loader will now remove these bytes when they occur at the start of the file.Omit legal comment output files when empty (#3670)
Previously configuring esbuild with
--legal-comment=external
or--legal-comment=linked
would always generate a.LEGAL.txt
output file even if it was empty. Starting with this release, esbuild will now only do this if the file will be non-empty. This should result in a more organized output directory in some cases.Update Go from 1.23.1 to 1.23.5 (#4056, #4057)
This should have no effect on existing code as this version change does not change Go's operating system support. It may remove certain reports from vulnerability scanners that detect which version of the Go compiler esbuild uses.
This PR was contributed by @MikeWillCook.
Allow passing a port of 0 to the development server (#3692)
Unix sockets interpret a port of 0 to mean "pick a random unused port in the ephemeral port range". However, esbuild's default behavior when the port is not specified is to pick the first unused port starting from 8000 and upward. This is more convenient because port 8000 is typically free, so you can for example restart the development server and reload your app in the browser without needing to change the port in the URL. Since esbuild is written in Go (which does not have optional fields like JavaScript), not specifying the port in Go means it defaults to 0, so previously passing a port of 0 to esbuild caused port 8000 to be picked.
Starting with this release, passing a port of 0 to esbuild when using the CLI or the JS API will now pass port 0 to the OS, which will pick a random ephemeral port. To make this possible, the
Port
option in the Go API has been changed fromuint16
toint
(to allow for additional sentinel values) and passing a port of -1 in Go now picks a random port. Both the CLI and JS APIs now remap an explicitly-provided port of 0 into -1 for the internal Go API.Another option would have been to change
Port
in Go fromuint16
to*uint16
(Go's closest equivalent ofnumber | undefined
). However, that would make the common case of providing an explicit port in Go very awkward as Go doesn't support taking the address of integer constants. This tradeoff isn't worth it as picking a random ephemeral port is a rare use case. So the CLI and JS APIs should now match standard Unix behavior when the port is 0, but you need to use -1 instead with Go API.Minification now avoids inlining constants with direct
eval
(#4055)Direct
eval
can be used to introduce a new variable like this:Previously esbuild inlined
variable
here (which becamefalse
), which changed the behavior of the code. This inlining is now avoided, but please keep in mind that directeval
breaks many assumptions that JavaScript tools hold about normal code (especially when bundling) and I do not recommend using it. There are usually better alternatives that have a more localized impact on your code. You can read more about this here: https://esbuild.github.io/link/direct-eval/v0.24.2
Compare Source
Fix regression with
--define
andimport.meta
(#4010, #4012, #4013)The previous change in version 0.24.1 to use a more expression-like parser for
define
values to allow quoted property names introduced a regression that removed the ability to use--define:import.meta=...
. Even thoughimport
is normally a keyword that can't be used as an identifier, ES modules special-case theimport.meta
expression to behave like an identifier anyway. This change fixes the regression.This fix was contributed by @sapphi-red.
v0.24.1
Compare Source
Allow
es2024
as a target intsconfig.json
(#4004)TypeScript recently added
es2024
as a compilation target, so esbuild now supports this in thetarget
field oftsconfig.json
files, such as in the following configuration file:As a reminder, the only thing that esbuild uses this field for is determining whether or not to use legacy TypeScript behavior for class fields. You can read more in the documentation.
This fix was contributed by @billyjanitsch.
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. ⚠️
v0.24.0
Compare Source
This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of
esbuild
in yourpackage.json
file (recommended) or be using a version range syntax that only accepts patch upgrades such as^0.23.0
or~0.23.0
. See npm's documentation about semver for more information.Drop support for older platforms (#3902)
This release drops support for the following operating system:
This is because the Go programming language dropped support for this operating system version in Go 1.23, and this release updates esbuild from Go 1.22 to Go 1.23. Go 1.23 now requires macOS 11 Big Sur or later.
Note that this only affects the binary esbuild executables that are published to the esbuild npm package. It's still possible to compile esbuild's source code for these older operating systems. If you need to, you can compile esbuild for yourself using an older version of the Go compiler (before Go version 1.23). That might look something like this:
Fix class field decorators in TypeScript if
useDefineForClassFields
isfalse
(#3913)Setting the
useDefineForClassFields
flag tofalse
intsconfig.json
means class fields use the legacy TypeScript behavior instead of the standard JavaScript behavior. Specifically they use assign semantics instead of define semantics (e.g. setters are triggered) and fields without an initializer are not initialized at all. However, when this legacy behavior is combined with standard JavaScript decorators, TypeScript switches to always initializing all fields, even those without initializers. Previously esbuild incorrectly continued to omit field initializers for this edge case. These field initializers in this case should now be emitted starting with this release.Avoid incorrect cycle warning with
tsconfig.json
multiple inheritance (#3898)TypeScript 5.0 introduced multiple inheritance for
tsconfig.json
files whereextends
can be an array of file paths. Previously esbuild would incorrectly treat files encountered more than once when processing separate subtrees of the multiple inheritance hierarchy as an inheritance cycle. With this release,tsconfig.json
files containing this edge case should work correctly without generating a warning.Handle Yarn Plug'n'Play stack overflow with
tsconfig.json
(#3915)Previously a
tsconfig.json
file thatextends
another file in a package with anexports
map could cause a stack overflow when Yarn's Plug'n'Play resolution was active. This edge case should work now starting with this release.Work around more issues with Deno 1.31+ (#3917)
This version of Deno broke the
stdin
andstdout
properties on command objects for inherited streams, which matters when you run esbuild's Deno module as the entry point (i.e. whenimport.meta.main
istrue
). Previously esbuild would crash in Deno 1.31+ if you ran esbuild like that. This should be fixed starting with this release.This fix was contributed by @Joshix-1.
v0.23.1
Compare Source
Allow using the
node:
import prefix withes*
targets (#3821)The
node:
prefix on imports is an alternate way to import built-in node modules. For example,import fs from "fs"
can also be writtenimport fs from "node:fs"
. This only works with certain newer versions of node, so esbuild removes it when you target older versions of node such as with--target=node14
so that your code still works. With the way esbuild's platform-specific feature compatibility table works, this was added by saying that only newer versions of node support this feature. However, that means that a target such as--target=node18,es2022
removes thenode:
prefix because none of thees*
targets are known to support this feature. This release adds the support for thenode:
flag to esbuild's internal compatibility table fores*
to allow you to use compound targets like this:Fix a panic when using the CLI with invalid build flags if
--analyze
is present (#3834)Previously esbuild's CLI could crash if it was invoked with flags that aren't valid for a "build" API call and the
--analyze
flag is present. This was caused by esbuild's internals attempting to add a Go plugin (which is how--analyze
is implemented) to a null build object. The panic has been fixed in this release.Fix incorrect location of certain error messages (#3845)
This release fixes a regression that caused certain errors relating to variable declarations to be reported at an incorrect location. The regression was introduced in version 0.18.7 of esbuild.
Print comments before case clauses in switch statements (#3838)
With this release, esbuild will attempt to print comments that come before case clauses in switch statements. This is similar to what esbuild already does for comments inside of certain types of expressions. Note that these types of comments are not printed if minification is enabled (specifically whitespace minification).
Fix a memory leak with
pluginData
(#3825)With this release, the build context's internal
pluginData
cache will now be cleared when starting a new build. This should fix a leak of memory from plugins that returnpluginData
objects fromonResolve
and/oronLoad
callbacks.v0.23.0
Compare Source
This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of
esbuild
in yourpackage.json
file (recommended) or be using a version range syntax that only accepts patch upgrades such as^0.22.0
or~0.22.0
. See npm's documentation about semver for more information.Revert the recent change to avoid bundling dependencies for node (#3819)
This release reverts the recent change in version 0.22.0 that made
--packages=external
the default behavior with--platform=node
. The default is now back to--packages=bundle
.I've just been made aware that Amazon doesn't pin their dependencies in their "AWS CDK" product, which means that whenever esbuild publishes a new release, many people (potentially everyone?) using their SDK around the world instantly starts using it without Amazon checking that it works first. This change in version 0.22.0 happened to break their SDK. I'm amazed that things haven't broken before this point. This revert attempts to avoid these problems for Amazon's customers. Hopefully Amazon will pin their dependencies in the future.
In addition, this is probably a sign that esbuild is used widely enough that it now needs to switch to a more complicated release model. I may have esbuild use a beta channel model for further development.
Fix preserving collapsed JSX whitespace (#3818)
When transformed, certain whitespace inside JSX elements is ignored completely if it collapses to an empty string. However, the whitespace should only be ignored if the JSX is being transformed, not if it's being preserved. This release fixes a bug where esbuild was previously incorrectly ignoring collapsed whitespace with
--jsx=preserve
. Here is an example:WebReflection/linkedom (linkedom)
v0.18.12
Compare Source
v0.18.11
Compare Source
v0.18.10
Compare Source
v0.18.9
Compare Source
v0.18.8
Compare Source
v0.18.7
Compare Source
v0.18.6
Compare Source
v0.18.5
Compare Source
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR has been generated by Renovate Bot.
879ac1cd74
to36070a29eb
Update dependency esbuild to ^0.23.0to Update npm non-major dependencies36070a29eb
to26f1d9d9c3
26f1d9d9c3
to45667a2850
45667a2850
toae86ed796d
ae86ed796d
tobf0e3dc29c
bf0e3dc29c
to3e663d5c40
3e663d5c40
to38fc517358
38fc517358
to7fc41b12a7
7fc41b12a7
toa5787dcb7d
a5787dcb7d
toe69eabd78b
e69eabd78b
to922c631057
922c631057
to8e6fe473df
8e6fe473df
to0b9ac1b27e
0b9ac1b27e
to96f64d2031
96f64d2031
toffd5d6d152
ffd5d6d152
to91f5a9b4b6
91f5a9b4b6
toaebfe8331a
aebfe8331a
toded2f3cfc8
ded2f3cfc8
to20497d2a4d
20497d2a4d
to5a22d5989b
5a22d5989b
to2f910fee46
2f910fee46
to16ec43a876
16ec43a876
tob6a8bd03bc
b6a8bd03bc
to7128f28a21
7128f28a21
to515dbff2bd
515dbff2bd
to74935e4b51
74935e4b51
tobb0f4026ea
bb0f4026ea
tof6b00461af
f6b00461af
to2f5816dba4
2f5816dba4
tofd22e7fd26
fd22e7fd26
toe837e6d160
e837e6d160
to212bcd4069
212bcd4069
to13e080c452
13e080c452
to21a486bedb
21a486bedb
tof09981638e
f09981638e
toc8a823151b
c8a823151b
to0d2f18b782
0d2f18b782
to98862276b3
98862276b3
to47017f2115
47017f2115
toe73b625806
e73b625806
toe9b2827e9f
e9b2827e9f
toa4df8db7f0
a4df8db7f0
to778129f47f
778129f47f
to970c708397
970c708397
toe1544730cf
e1544730cf
toe7fff5902c
e7fff5902c
to628c8827f6
628c8827f6
to50f8bf73fc
50f8bf73fc
tof1d1450510
f1d1450510
to966c6a69ee
966c6a69ee
toaa77cd4d2e
aa77cd4d2e
tob80607eb42
b80607eb42
toe7aade28d3
e7aade28d3
to86f6543964
86f6543964
toa8b548e2f4
a8b548e2f4
toa110427067
a110427067
to62ee20bfbc
62ee20bfbc
toa549ad6f55
a549ad6f55
to4ab4276456
4ab4276456
tof3683fc4d5
f3683fc4d5
to801bf13745
801bf13745
to2e08339187
2e08339187
to069d4a53c8
069d4a53c8
toa303ed01ed
a303ed01ed
to75848707c3
75848707c3
toc546085415
c546085415
tod9e2b9cfe3
d9e2b9cfe3
toc6a0762983
c6a0762983
todc55a8f189
dc55a8f189
to3e4c58f96f
3e4c58f96f
to4dd4a8761c
4dd4a8761c
to41afbbd136
41afbbd136
tof7d3f3a45f
f7d3f3a45f
tod42181debd
d42181debd
to22d6146397
22d6146397
toa028e8decf
a028e8decf
to6f4402f148
6f4402f148
toc52d37ca7a
c52d37ca7a
tod0afb847c7
d0afb847c7
to1458acc842
1458acc842
toc32d008b15
c32d008b15
to6167bc3495
6167bc3495
to331ad48520
331ad48520
to85d8ba67ab
85d8ba67ab
to25c9d0fb0c
25c9d0fb0c
to8d82fb692e
8d82fb692e
to057199e41f
057199e41f
to32e1d93bf2
32e1d93bf2
to0e83531537
0e83531537
toa71b1b4014
a71b1b4014
to75b6c615bf
75b6c615bf
to7b629a9adc
7b629a9adc
to93d676f2a8
93d676f2a8
toe109b938c0
e109b938c0
tob950270c71
b950270c71
toa7503e34f1
a7503e34f1
tof05cf8132b
f05cf8132b
toa79f3779be
a79f3779be
tob1f907a952
b1f907a952
to328aa47d2a
328aa47d2a
to5ce0694cb5
5ce0694cb5
to3f019ae872
3f019ae872
to4d4ccb0344
4d4ccb0344
tob750979659
b750979659
toec27bbf0d7
ec27bbf0d7
to0c6a6b2ccd
0c6a6b2ccd
to2119ce5184
2119ce5184
to8035b53bc9
8035b53bc9
to39b3accc7c
39b3accc7c
to9c5405c321
9c5405c321
to58c02b87bc
58c02b87bc
to560bfa4330
560bfa4330
to2450daaf56
2450daaf56
toc53922c02e
c53922c02e
to17bc8b5097
17bc8b5097
toc22809dcc6
c22809dcc6
to3fe23787e7
3fe23787e7
to9d1037625c
9d1037625c
to7c400b0cac
7c400b0cac
to897ba29973
897ba29973
toa959a14e64
a959a14e64
to819005d152
819005d152
toa02e9d0c7b
a02e9d0c7b
to96e394611b
96e394611b
to3542d48c5a
3542d48c5a
to0384ce9cae
0384ce9cae
to65a40ab769
65a40ab769
tobae8e95f18
bae8e95f18
to90545bb1db
90545bb1db
to52baedc53d
52baedc53d
to7e68aacabb
7e68aacabb
to0782f1b4e8
0782f1b4e8
tofadb39375d
fadb39375d
toac7ce7a681
ac7ce7a681
tobd82d0094f
bd82d0094f
tob76288e6d6
b76288e6d6
to59fc913942
59fc913942
to26bca07dcb
26bca07dcb
toa77de4014a
a77de4014a
toa51226a85b
a51226a85b
toc26650ff56
c26650ff56
to7675b78418
7675b78418
to38d8dbdc4a
38d8dbdc4a
toda08baf6b4
da08baf6b4
to8d8592a6f7
8d8592a6f7
toa2a1093189
a2a1093189
to17c13f25ef
17c13f25ef
tof109142c25
f109142c25
to5a94ede0b6
5a94ede0b6
toe920b1528b
e920b1528b
to0d16b28f16
0d16b28f16
to34f0c8c7a7
34f0c8c7a7
toca45c10462
ca45c10462
to91f334d506
91f334d506
to440b9b26ab
440b9b26ab
to8c47476473
8c47476473
to614e3707a6
614e3707a6
to6a35679a3f
6a35679a3f
to9003730cc0
9003730cc0
tofee33b214b
fee33b214b
to0d370d8481
0d370d8481
to61ee0eb347
61ee0eb347
to2e59b205a3
2e59b205a3
to4b46f099d9
4b46f099d9
to052b13cb84
052b13cb84
to4baf984203
4baf984203
toc29be682cd
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.