Update dependency esbuild to v0.25.5 #431
Closed
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.
This PR contains the following updates:
0.25.0->0.25.5Release Notes
evanw/esbuild (esbuild)
v0.25.5Compare Source
Fix a regression with
browserinpackage.json(#4187)The fix to #4144 in version 0.25.3 introduced a regression that caused
browseroverrides specified inpackage.jsonto fail to override relative path names that end in a trailing slash. That behavior change affected the[email protected]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
stretchsizing 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.4Compare 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
localhostwhere 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
corsoption will now set theAccess-Control-Allow-Originresponse header when the request has a matchingOriginheader. Note that this currently only works for requests that don't send a preflightOPTIONSrequest, as esbuild's development server doesn't currently supportOPTIONSrequests.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
sourcesin source maps that form invalid URLs were not being passed through to the output. Version 0.25.0 changed the interpretation ofsourcesfrom 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 insourcesshould 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.3Compare Source
Fix lowered
asyncarrow functions beforesuper()(#4141, #4142)This change makes it possible to call an
asyncarrow function in a constructor before callingsuper()when targeting environments withoutasyncsupport, as long as the function body doesn't referencethis. Here's an example (notice the change fromthistonull):Some background: Arrow functions with the
asynckeyword are transformed into generator functions for older language targets such as--target=es2016. Since arrow functions capturethis, the generated code forwardsthisinto the body of the generator function. However, JavaScript class syntax forbids usingthisin 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 forwardthisif 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=trueis used instead of--watch. Previously using--watch=truecaused esbuild to continue to use more and more memory for every rebuild, but--watch=trueshould now behave like--watchand 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=truestyle 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
hostwith 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/hostsfile fromlocal.example.comto127.0.0.1and 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=safari1took 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_FILEappears 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.2Compare Source
Support flags in regular expressions for the API (#4121)
The JavaScript plugin API for esbuild takes JavaScript regular expression objects for the
filteroption. Internally these are translated into Go regular expressions. However, this translation previously ignored theflagsproperty 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?$/iis 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 theiflag. 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, barfrom 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.1Compare Source
Fix incorrect paths in inline source maps (#4070, #4075, #4105)
This fixes a regression from version 0.25.0 where esbuild didn't correctly resolve relative paths contained within source maps in inline
sourceMappingURLdata URLs. The paths were incorrectly being passed through as-is instead of being resolved relative to the source file containing thesourceMappingURLcomment, which was due to the data URL not being a file URL. This regression has been fixed, and this case now has test coverage.Fix invalid generated source maps (#4080, #4082, #4104, #4107)
This release fixes a regression from version 0.24.1 that could cause esbuild to generate invalid source maps. Specifically under certain conditions, esbuild could generate a mapping with an out-of-bounds source index. It was introduced by code that attempted to improve esbuild's handling of "null" entries in source maps (i.e. mappings with a generated position but no original position). This regression has been fixed.
This fix was contributed by @jridgewell.
Fix a regression with non-file source map paths (#4078)
The format of paths in source maps that aren't in the
filenamespace was unintentionally changed in version 0.25.0. Path namespaces is an esbuild-specific concept that is optionally available for plugins to use to distinguish paths fromfilepaths and from paths meant for other plugins. Previously the namespace was prepended to the path joined with a:character, but version 0.25.0 unintentionally failed to prepend the namespace. The previous behavior has been restored.Fix a crash with
switchoptimization (#4088)The new code in the previous release to optimize dead code in switch statements accidentally introduced a crash in the edge case where one or more switch case values include a function expression. This is because esbuild now visits the case values first to determine whether any cases are dead code, and then visits the case bodies once the dead code status is known. That triggered some internal asserts that guard against traversing the AST in an unexpected order. This crash has been fixed by changing esbuild to expect the new traversal ordering. Here's an example of affected code:
Update Go from 1.23.5 to 1.23.7 (#4076, #4077)
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.
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 is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.