-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dependency esbuild to v0.17.19 #18
Open
renovate
wants to merge
1
commit into
main
Choose a base branch
from
renovate/esbuild-0.x
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renovate
bot
changed the title
Update dependency esbuild to v0.14.24
Update dependency esbuild to v0.14.25
Mar 4, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 4, 2022 08:19
5cf6b93
to
33099c0
Compare
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 14, 2022 09:55
33099c0
to
0922810
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.25
Update dependency esbuild to v0.14.26
Mar 14, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 14, 2022 23:29
0922810
to
4f9bb09
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.26
Update dependency esbuild to v0.14.27
Mar 14, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 26, 2022 04:22
4f9bb09
to
7b8af49
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.27
Update dependency esbuild to v0.14.28
Mar 26, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 30, 2022 03:05
7b8af49
to
6cc38e8
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.28
Update dependency esbuild to v0.14.29
Mar 30, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 2, 2022 11:40
6cc38e8
to
77d09fa
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.29
Update dependency esbuild to v0.14.30
Apr 2, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 4, 2022 07:00
77d09fa
to
7d06401
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.30
Update dependency esbuild to v0.14.31
Apr 4, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 6, 2022 03:29
7d06401
to
754d2b6
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.31
Update dependency esbuild to v0.14.32
Apr 6, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 7, 2022 09:56
754d2b6
to
9578433
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.32
Update dependency esbuild to v0.14.34
Apr 7, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 12, 2022 02:34
9578433
to
8c0074e
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.34
Update dependency esbuild to v0.14.35
Apr 12, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 12, 2022 09:58
8c0074e
to
2ec1d4f
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.35
Update dependency esbuild to v0.14.36
Apr 12, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 21, 2022 06:56
2ec1d4f
to
7f3c2dc
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.36
Update dependency esbuild to v0.14.37
Apr 21, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 21, 2022 22:40
7f3c2dc
to
0ee2f75
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.37
Update dependency esbuild to v0.14.38
Apr 21, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
May 16, 2022 00:06
0ee2f75
to
84d2881
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.38
Update dependency esbuild to v0.14.39
May 16, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
June 18, 2022 15:06
84d2881
to
5ea728a
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.39
Update dependency esbuild to v0.14.45
Jun 18, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
June 23, 2022 19:31
5ea728a
to
cd2ae45
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.45
Update dependency esbuild to v0.14.47
Jun 23, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
September 25, 2022 20:44
cd2ae45
to
2bb9fb0
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.14.47
Update dependency esbuild to v0.15.9
Sep 25, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
November 20, 2022 20:05
2bb9fb0
to
fb1691f
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.15.9
Update dependency esbuild to v0.15.14
Nov 20, 2022
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 16, 2023 21:51
fb1691f
to
2a445d1
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.15.14
Update dependency esbuild to v0.17.11
Mar 16, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 22, 2023 17:29
2a445d1
to
5288fcc
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.11
Update dependency esbuild to v0.17.12
Mar 22, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 24, 2023 20:02
5288fcc
to
47a5fab
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.12
Update dependency esbuild to v0.17.13
Mar 24, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
March 27, 2023 21:35
47a5fab
to
b52c73e
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.13
Update dependency esbuild to v0.17.14
Mar 27, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 3, 2023 09:14
b52c73e
to
4543e6a
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.14
Update dependency esbuild to v0.17.15
Apr 3, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
April 17, 2023 10:39
4543e6a
to
2a7a701
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.15
Update dependency esbuild to v0.17.17
Apr 17, 2023
renovate
bot
force-pushed
the
renovate/esbuild-0.x
branch
from
May 28, 2023 11:17
2a7a701
to
5e5a6a4
Compare
renovate
bot
changed the title
Update dependency esbuild to v0.17.17
Update dependency esbuild to v0.17.19
May 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
None yet
0 participants
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.14.23
->0.17.19
Release Notes
evanw/esbuild
v0.17.19
Compare Source
Fix CSS transform bugs with nested selectors that start with a combinator (#3096)
This release fixes several bugs regarding transforming nested CSS into non-nested CSS for older browsers. The bugs were due to lack of test coverage for nested selectors with more than one compound selector where they all start with the same combinator. Here's what some problematic cases look like before and after these fixes:
Fix bug with TypeScript parsing of instantiation expressions followed by
=
(#3111)This release fixes esbuild's TypeScript-to-JavaScript conversion code in the case where a potential instantiation expression is followed immediately by a
=
token (such that the trailing>
becomes a>=
token). Previously esbuild considered that to still be an instantiation expression, but the official TypeScript compiler considered it to be a>=
operator instead. This release changes esbuild's interpretation to match TypeScript. This edge case currently appears to be problematic for other TypeScript-to-JavaScript converters as well:x<y>=a<b<c>>()
x<y>=a();
x=a();
x<y>=a();
x=a()
Avoid removing unrecognized directives from the directive prologue when minifying (#3115)
The directive prologue in JavaScript is a sequence of top-level string expressions that come before your code. The only directives that JavaScript engines currently recognize are
use strict
and sometimesuse asm
. However, the people behind React have made up their own directive for their own custom dialect of JavaScript. Previously esbuild only preserved theuse strict
directive when minifying, although you could still write React JavaScript with esbuild using something like--banner:js="'your directive here';"
. With this release, you can now put arbitrary directives in the entry point and esbuild will preserve them in its minified output:Note that this means esbuild will no longer remove certain stray top-level strings when minifying. This behavior is an intentional change because these stray top-level strings are actually part of the directive prologue, and could potentially have semantics assigned to them (as was the case with React).
Improved minification of binary shift operators
With this release, esbuild's minifier will now evaluate the
<<
and>>>
operators if the resulting code would be shorter:v0.17.18
Compare Source
Fix non-default JSON import error with
export {} from
(#3070)This release fixes a bug where esbuild incorrectly identified statements of the form
export { default as x } from "y" assert { type: "json" }
as a non-default import. The bug did not affect code of the formimport { default as x } from ...
(only code that used theexport
keyword).Fix a crash with an invalid subpath import (#3067)
Previously esbuild could crash when attempting to generate a friendly error message for an invalid subpath import (i.e. an import starting with
#
). This happened because esbuild originally only supported theexports
field and the code for that error message was not updated when esbuild later added support for theimports
field. This crash has been fixed.v0.17.17
Compare Source
Fix CSS nesting transform for top-level
&
(#3052)Previously esbuild could crash with a stack overflow when lowering CSS nesting rules with a top-level
&
, such as in the code below. This happened because esbuild's CSS nesting transform didn't handle top-level&
, causing esbuild to inline the top-level selector into itself. This release handles top-level&
by replacing it with the:scope
pseudo-class:Support
exports
inpackage.json
forextends
intsconfig.json
(#3058)TypeScript 5.0 added the ability to use
extends
intsconfig.json
to reference a path in a package whosepackage.json
file contains anexports
map that points to the correct location. This doesn't automatically work in esbuild becausetsconfig.json
affects esbuild's path resolution, so esbuild's normal path resolution logic doesn't apply.This release adds support for doing this by adding some additional code that attempts to resolve the
extends
path using theexports
field. The behavior should be similar enough to esbuild's main path resolution logic to work as expected.Note that esbuild always treats this
extends
import as arequire()
import since that's what TypeScript appears to do. Specifically therequire
condition will be active and theimport
condition will be inactive.Fix watch mode with
NODE_PATH
(#3062)Node has a rarely-used feature where you can extend the set of directories that node searches for packages using the
NODE_PATH
environment variable. While esbuild supports this too, previously a bug prevented esbuild's watch mode from picking up changes to imported files that were contained directly in aNODE_PATH
directory. You're supposed to useNODE_PATH
for packages, but some people abuse this feature by putting files in that directory instead (e.g.node_modules/some-file.js
instead ofnode_modules/some-pkg/some-file.js
). The watch mode bug happens when you do this because esbuild first tries to readsome-file.js
as a directory and then as a file. Watch mode was incorrectly waiting forsome-file.js
to become a valid directory. This release fixes this edge case bug by changing watch mode to watchsome-file.js
as a file when this happens.v0.17.16
Compare Source
Fix CSS nesting transform for triple-nested rules that start with a combinator (#3046)
This release fixes a bug with esbuild where triple-nested CSS rules that start with a combinator were not transformed correctly for older browsers. Here's an example of such a case before and after this bug fix:
Support
--inject
with a file loaded using thecopy
loader (#3041)This release now allows you to use
--inject
with a file that is loaded using thecopy
loader. Thecopy
loader copies the imported file to the output directory verbatim and rewrites the path in theimport
statement to point to the copied output file. When used with--inject
, this means the injected file will be copied to the output directory as-is and a bareimport
statement for that file will be inserted in any non-copy output files that esbuild generates.Note that since esbuild doesn't parse the contents of copied files, esbuild will not expose any of the export names as usable imports when you do this (in the way that esbuild's
--inject
feature is typically used). However, any side-effects that the injected file has will still occur.v0.17.15
Compare Source
Allow keywords as type parameter names in mapped types (#3033)
TypeScript allows type keywords to be used as parameter names in mapped types. Previously esbuild incorrectly treated this as an error. Code that does this is now supported:
Add annotations for re-exported modules in node (#2486, #3029)
Node lets you import named imports from a CommonJS module using ESM import syntax. However, the allowed names aren't derived from the properties of the CommonJS module. Instead they are derived from an arbitrary syntax-only analysis of the CommonJS module's JavaScript AST.
To accommodate node doing this, esbuild's ESM-to-CommonJS conversion adds a special non-executable "annotation" for node that describes the exports that node should expose in this scenario. It takes the form
0 && (module.exports = { ... })
and comes at the end of the file (0 && expr
meansexpr
is never evaluated).Previously esbuild didn't do this for modules re-exported using the
export * from
syntax. Annotations for these re-exports will now be added starting with this release:Note that you need to specify both
--format=cjs
and--platform=node
to get these node-specific annotations.Avoid printing an unnecessary space in between a number and a
.
(#3026)JavaScript typically requires a space in between a number token and a
.
token to avoid the.
being interpreted as a decimal point instead of a member expression. However, this space is not required if the number token itself contains a decimal point, an exponent, or uses a base other than 10. This release of esbuild now avoids printing the unnecessary space in these cases:Fix server-sent events with live reload when writing to the file system root (#3027)
This release fixes a bug where esbuild previously failed to emit server-sent events for live reload when
outdir
was the file system root, such as/
. This happened because/
is the only path on Unix that cannot have a trailing slash trimmed from it, which was fixed by improved path handling.v0.17.14
Compare Source
Allow the TypeScript 5.0
const
modifier in object type declarations (#3021)The new TypeScript 5.0
const
modifier was added to esbuild in version 0.17.5, and works with classes, functions, and arrow expressions. However, support for it wasn't added to object type declarations (e.g. interfaces) due to an oversight. This release adds support for these cases, so the following TypeScript 5.0 code can now be built with esbuild:Implement preliminary lowering for CSS nesting (#1945)
Chrome has implemented the new CSS nesting specification in version 112, which is currently in beta but will become stable very soon. So CSS nesting is now a part of the web platform!
This release of esbuild can now transform nested CSS syntax into non-nested CSS syntax for older browsers. The transformation relies on the
:is()
pseudo-class in many cases, so the transformation is only guaranteed to work when targeting browsers that support:is()
(e.g. Chrome 88+). You'll need to set esbuild'starget
to the browsers you intend to support to tell esbuild to do this transformation. You will get a warning if you use CSS nesting syntax with atarget
which includes older browsers that don't support:is()
.The lowering transformation looks like this:
More complex cases may generate the
:is()
pseudo-class:In addition, esbuild now has a special warning message for nested style rules that start with an identifier. This isn't allowed in CSS because the syntax would be ambiguous with the existing declaration syntax. The new warning message looks like this:
Keep in mind that the transformation in this release is a preliminary implementation. CSS has many features that interact in complex ways, and there may be some edge cases that don't work correctly yet.
Minification now removes unnecessary
&
CSS nesting selectorsThis release introduces the following CSS minification optimizations:
Minification now removes duplicates from CSS selector lists
This release introduces the following CSS minification optimization:
v0.17.13
Compare Source
Work around an issue with
NODE_PATH
and Go's WebAssembly internals (#3001)Go's WebAssembly implementation returns
EINVAL
instead ofENOTDIR
when using thereaddir
syscall on a file. This messes up esbuild's implementation of node's module resolution algorithm since encounteringENOTDIR
causes esbuild to continue its search (since it's a normal condition) while other encountering other errors causes esbuild to fail with an I/O error (since it's an unexpected condition). You can encounter this issue in practice if you use node's legacyNODE_PATH
feature to tell esbuild to resolve node modules in a custom directory that was not installed by npm. This release works around this problem by convertingEINVAL
intoENOTDIR
for thereaddir
syscall.Fix a minification bug with CSS
@layer
rules that have parsing errors (#3016)CSS at-rules require either a
{}
block or a semicolon at the end. Omitting both of these causes esbuild to treat the rule as an unknown at-rule. Previous releases of esbuild had a bug that incorrectly removed unknown at-rules without any children during minification if the at-rule token matched an at-rule that esbuild can handle. Specifically cssnano can generate@layer
rules with parsing errors, and empty@layer
rules cannot be removed because they have side effects (@layer
didn't exist when esbuild's CSS support was added, so esbuild wasn't written to handle this). This release changes esbuild to no longer discard@layer
rules with parsing errors when minifying (the rule@layer c
has a parsing error):Unterminated strings in CSS are no longer an error
The CSS specification provides rules for handling parsing errors. One of those rules is that user agents must close strings upon reaching the end of a line (i.e., before an unescaped line feed, carriage return or form feed character), but then drop the construct (declaration or rule) in which the string was found. For example:
...would be treated the same as:
...because the second declaration (from
font-family
to the semicolon aftercolor: red
) is invalid and is dropped.Previously using this CSS with esbuild failed to build due to a syntax error, even though the code can be interpreted by a browser. With this release, the code now produces a warning instead of an error, and esbuild prints the invalid CSS such that it stays invalid in the output:
v0.17.12
Compare Source
Fix a crash when parsing inline TypeScript decorators (#2991)
Previously esbuild's TypeScript parser crashed when parsing TypeScript decorators if the definition of the decorator was inlined into the decorator itself:
This crash was not noticed earlier because this edge case did not have test coverage. The crash is fixed in this release.
v0.17.11
Compare Source
Fix the
alias
feature to always prefer the longest match (#2963)It's possible to configure conflicting aliases such as
--alias:a=b
and--alias:a/c=d
, which is ambiguous for the import patha/c/x
(since it could map to eitherb/c/x
ord/x
). Previously esbuild would pick the first matchingalias
, which would non-deterministically pick between one of the possible matches. This release fixes esbuild to always deterministically pick the longest possible match.Minify calls to some global primitive constructors (#2962)
With this release, esbuild's minifier now replaces calls to
Boolean
/Number
/String
/BigInt
with equivalent shorter code when relevant:Adjust some feature compatibility tables for node (#2940)
This release makes the following adjustments to esbuild's internal feature compatibility tables for node, which tell esbuild which versions of node are known to support all aspects of that feature:
class-private-brand-checks
: node v16.9+ => node v16.4+ (a decrease)hashbang
: node v12.0+ => node v12.5+ (an increase)optional-chain
: node v16.9+ => node v16.1+ (a decrease)template-literal
: node v4+ => node v10+ (an increase)Each of these adjustments was identified by comparing against data from the
node-compat-table
package and was manually verified using old node executables downloaded from https://nodejs.org/download/release/.v0.17.10
Compare Source
Update esbuild's handling of CSS nesting to match the latest specification changes (#1945)
The syntax for the upcoming CSS nesting feature has recently changed. The
@nest
prefix that was previously required in some cases is now gone, and nested rules no longer have to start with&
(as long as they don't start with an identifier or function token).This release updates esbuild's pass-through handling of CSS nesting syntax to match the latest specification changes. So you can now use esbuild to bundle CSS containing nested rules and try them out in a browser that supports CSS nesting (which includes nightly builds of both Chrome and Safari).
However, I'm not implementing lowering of nested CSS to non-nested CSS for older browsers yet. While the syntax has been decided, the semantics are still in flux. In particular, there is still some debate about changing the fundamental way that CSS nesting works. For example, you might think that the following CSS is equivalent to a
.outer .inner button { ... }
rule:But instead it's actually equivalent to a
.outer :is(.inner button) { ... }
rule which unintuitively also matches the following DOM structure:The
:is()
behavior is preferred by browser implementers because it's more memory-efficient, but the straightforward translation into a.outer .inner button { ... }
rule is preferred by developers used to the existing CSS preprocessing ecosystem (e.g. SASS). It seems premature to commit esbuild to specific semantics for this syntax at this time given the ongoing debate.Fix cross-file CSS rule deduplication involving
url()
tokens (#2936)Previously cross-file CSS rule deduplication didn't handle
url()
tokens correctly. These tokens contain references to import paths which may be internal (i.e. in the bundle) or external (i.e. not in the bundle). When comparing twourl()
tokens for equality, the underlying import paths should be compared instead of their references. This release of esbuild fixesurl()
token comparisons. One side effect is that@font-face
rules should now be deduplicated correctly across files:v0.17.9
Compare Source
Parse rest bindings in TypeScript types (#2937)
Previously esbuild was unable to parse the following valid TypeScript code:
This release includes support for parsing code like this.
Fix TypeScript code translation for certain computed
declare
class fields (#2914)In TypeScript, the key of a computed
declare
class field should only be preserved if there are no decorators for that field. Previously esbuild always preserved the key, but esbuild will now remove the key to match the output of the TypeScript compiler:Fix a crash with path resolution error generation (#2913)
In certain situations, a module containing an invalid import path could previously cause esbuild to crash when it attempts to generate a more helpful error message. This crash has been fixed.
v0.17.8
Compare Source
Fix a minification bug with non-ASCII identifiers (#2910)
This release fixes a bug with esbuild where non-ASCII identifiers followed by a keyword were incorrectly not separated by a space. This bug affected both the
in
andinstanceof
keywords. Here's an example of the fix:Fix a regression with esbuild's WebAssembly API in version 0.17.6 (#2911)
Version 0.17.6 of esbuild updated the Go toolchain to version 1.20.0. This had the unfortunate side effect of increasing the amount of stack space that esbuild uses (presumably due to some changes to Go's WebAssembly implementation) which could cause esbuild's WebAssembly-based API to crash with a stack overflow in cases where it previously didn't crash. One such case is the package
grapheme-splitter
which contains code that looks like this:This edge case involves a chain of binary operators that results in an AST over 400 nodes deep. Normally this wouldn't be a problem because Go has growable call stacks, so the call stack would just grow to be as large as needed. However, WebAssembly byte code deliberately doesn't expose the ability to manipulate the stack pointer, so Go's WebAssembly translation is forced to use the fixed-size WebAssembly call stack. So esbuild's WebAssembly implementation is vulnerable to stack overflow in cases like these.
It's not unreasonable for this to cause a stack overflow, and for esbuild's answer to this problem to be "don't write code like this." That's how many other AST-manipulation tools handle this problem. However, it's possible to implement AST traversal using iteration instead of recursion to work around limited call stack space. This version of esbuild implements this code transformation for esbuild's JavaScript parser and printer, so esbuild's WebAssembly implementation is now able to process the
grapheme-splitter
package (at least when compiled with Go 1.20.0 and run with node's WebAssembly implementation).v0.17.7
Compare Source
Change esbuild's parsing of TypeScript instantiation expressions to match TypeScript 4.8+ (#2907)
This release updates esbuild's implementation of instantiation expression erasure to match microsoft/TypeScript#49353. The new rules are as follows (copied from TypeScript's PR description):
Ignore
sideEffects: false
for imported CSS files (#1370, #1458, #2905)This release ignores the
sideEffects
annotation inpackage.json
for CSS files that are imported into JS files using esbuild'scss
loader. This means that these CSS files are no longer be tree-shaken.Importing CSS into JS causes esbuild to automatically create a CSS entry point next to the JS entry point containing the bundled CSS. Previously packages that specified some form of
"sideEffects": false
could potentially cause esbuild to consider one or more of the JS files on the import path to the CSS file to be side-effect free, which would result in esbuild removing that CSS file from the bundle. This was problematic because the removal of that CSS is outwardly observable, since all CSS is global, so it was incorrect for previous versions of esbuild to tree-shake CSS files imported into JS files.Add constant folding for certain additional equality cases (#2394, #2895)
This release adds constant folding for expressions similar to the following:
v0.17.6
Compare Source
Fix a CSS parser crash on invalid CSS (#2892)
Previously the following invalid CSS caused esbuild's parser to crash:
The crash was caused by trying to construct a helpful error message assuming that there was an opening
{
token, which is not the case here. This release fixes the crash.Inline TypeScript enums that are referenced before their declaration
Previously esbuild inlined enums within a TypeScript file from top to bottom, which meant that references to TypeScript enum members were only inlined within the same file if they came after the enum declaration. With this release, esbuild will now inline enums even when they are referenced before they are declared:
This makes esbuild's TypeScript output smaller and faster when processing code that does this. I noticed this issue when I ran the TypeScript compiler's source code through esbuild's bundler. Now that the TypeScript compiler is going to be bundled with esbuild in the upcoming TypeScript 5.0 release, improvements like this will also improve the TypeScript compiler itself!
Fix esbuild installation on Arch Linux (#2785, #2812, #2865)
Someone made an unofficial
esbuild
package for Linux that adds theESBUILD_BINARY_PATH=/usr/bin/esbuild
environment variable to the user's default environment. This breaks all npm installations of esbuild for users with this unofficial Linux package installed, which has affected many people. Most (all?) people who encounter this problem haven't even installed this unofficial package themselves; instead it was installed for them as a dependency of another Linux package. The problematic change to add theESBUILD_BINARY_PATH
environment variable was reverted in the latest version of this unofficial package. However, old versions of this unofficial package are still there and will be around forever. With this release,ESBUILD_BINARY_PATH
is now ignored by esbuild's install script when it's set to the value/usr/bin/esbuild
. This should unbreak using npm to installesbuild
in these problematic Linux environments.Note: The
ESBUILD_BINARY_PATH
variable is an undocumented way to override the location of esbuild's binary when esbuild's npm package is installed, which is necessary to substitute your own locally-built esbuild binary when debugging esbuild's npm package. It's only meant for very custom situations and should absolutely not be forced on others by default, especially without their knowledge. I may remove the code in esbuild's installer that readsESBUILD_BINARY_PATH
in the future to prevent these kinds of issues. It will unfortunately make debugging esbuild harder. IfESBUILD_BINARY_PATH
is ever removed, it will be done in a "breaking change" release.v0.17.5
Compare Source
Parse
const
type parameters from TypeScript 5.0The TypeScript 5.0 beta announcement adds
const
type parameters to the language. You can now add theconst
modifier on a type parameter of a function, method, or class like this:The type of
names
in the above example isreadonly ["Alice", "Bob", "Eve"]
. Marking the type parameter asconst
behaves as if you had writtenas const
at every use instead. The above code is equivalent to the following TypeScript, which was the only option before TypeScript 5.0:You can read the announcement for more information.
Make parsing generic
async
arrow functions more strict in.tsx
filesPreviously esbuild's TypeScript parser incorrectly accepted the following code as valid:
The official TypeScript parser rejects this code because it thinks it's the identifier
async
followed by a JSX element starting with<T>
. So with this release, esbuild will now reject this syntax in.tsx
files too. You'll now have to add a comma after the type parameter to get generic arrow functions like this to parse in.tsx
files:Allow the
in
andout
type parameter modifiers on class expressionsTypeScript 4.7 added the
in
andout
modifiers on the type parameters of classes, interfaces, and type aliases. However, while TypeScript supported them on both class expressions and class statements, previously esbuild only supported them on class statements due to an oversight. This release now allows these modifiers on class expressions too:Update
enum
constant folding for TypeScript 5.0TypeScript 5.0 contains an updated definition of what it considers a constant expression:
This impacts esbuild's implementation of TypeScript's
const enum
feature. With this release, esbuild will now attempt to follow these new rules. For example, you can now initialize anenum
member with a template literal expression that contains a numeric constant:These rules are not followed exactly due to esbuild's limitations. The rule about dotted references to
const
variables is not followed both because esbuild's enum processing is done in an isolated module setting and because doing so would potentially require esbuild to use a type system, which it doesn't have. For example:Also, the rule that requires converting numbers to a string currently only followed for 32-bit signed integers and non-finite numbers. This is done to avoid accidentally introducing a bug if esbuild's number-to-string operation doesn't exactly match the behavior of a real JavaScript VM. Currently esbuild's number-to-string constant folding is conservative for safety.
Forbid definite assignment assertion operators on class methods
In TypeScript, class methods can use the
?
optional property operator but not the!
definite assignment assertion operator (while class fields can use both):Previously esbuild incorrectly allowed the definite assignment assertion operator with class methods. This will no longer be allowed starting with this release.
v0.17.4
Compare Source
Implement HTTP
HEAD
requests in serve mode (#2851)Previously esbuild's serve mode only responded to HTTP
GET
requests. With this release, esbuild's serve mode will also respond to HTTPHEAD
requests, which are just like HTTPGET
requests except that the body of the response is omitted.Permit top-level await in dead code branches (#2853)
Adding top-level await to a file has a few consequences with esbuild:
module
andexports
for exports and also enables strict mode, which disables certain syntax and changes how function hoisting works (among other things).require()
on this file or on any file that imports this file (even indirectly), since therequire()
function doesn't return a promise and so can't represent top-level await.This release relaxes these rules slightly: rules 2 and 3 will now no longer apply when esbuild has identified the code branch as dead code, such as when it's behind an
if (false)
check. This should make it possible to use esbuild to convert code into different output formats that only uses top-level await conditionally. This release does not relax rule 1. Top-level await will still cause esbuild to unconditionally consider the input module format to be ESM, even when the top-levelawait
is in a dead code branch. This is necessary because whether the input format is ESM or not affects the whole file, not just the dead code branch.Fix entry points where the entire file name is the extension (#2861)
Previously if you passed esbuild an entry point where the file extension is the entire file name, esbuild would use the parent directory name to derive the name of the output file. For example, if you passed esbuild a file
./src/.ts
then the output name would besrc.js
. This bug happened because esbuild first strips the file extension to get./src/
and then joins the path with the working directory to get the absolute path (e.g.join("/working/dir", "./src/")
gives/working/dir/src
). However, the join operation also canonicalizes the path which strips the trailing/
. Later esbuild uses the "base name" operation to extract the name of the output file. Since there is no trailing/
, esbuild returns"src"
as the base name instead of""
, which causes esbuild to incorrectly include the directory name in the output file name. This release fixes this bug by deferring the stripping of the file extension until after all path manipulations have been completed. So now the file./src/.ts
will generate an output file named.js
.Support replacing property access expressions with inject
At a high level, this change means the
inject
feature can now replace all of the same kinds of names as thedefine
feature. Soinject
is basically now a more powerful version ofdefine
, instead of previously only being able to do some of the things thatdefine
could do.Soem background is necessary to understand this change if you aren't already familiar with the
inject
feature. Theinject
feature lets you replace references to global variable with a shim. It works like this:inject
featureFor example, if you inject the following file using
--inject:./injected.js
:Then esbuild will replace all references to
process
with theprocessShim
variable, which will causeprocess.cwd()
to return'/'
. This feature is sort of abusing the ESM export alias syntax to specify the mapping of global variables to shims. But esbuild works this way because using this syntax for that purpose is convenient and terse.However, if you wanted to replace a property access expression, the process was more complicated and not as nice. You would have to:
inject
featuredefine
feature to map the property access expression to the random name you made in step 2For example, if you inject the following file using
--inject:./injected2.js --define:process.cwd=someRandomName
:Then esbuild will replace all references to
process.cwd
with thecwdShim
variable, which will also causeprocess.cwd()
to return'/'
(but which this time will not mess with other references toprocess
, which might be desirable).With this release, using the inject feature to replace a property access expression is now as simple as using it to replace an identifier. You can now use JavaScript's "arbitrary module namespace identifier names" feature to specify the property access expression directly using a string literal. For example, if you inject the following file using
--inject:./injected3.js
:Then esbuild will now replace all references to
process.cwd
with thecwdShim
variable, which will also causeprocess.cwd()
to return'/'
(but which will also not mess with other references toprocess
).In addition to inserting a shim for a global variable that doesn't exist, another use case is replacing references to static methods on global objects with cached versions to both minify them better and to make access to them potentially faster. For example:
v0.17.3
Compare Source
Fix incorrect CSS minification for certain rules (#2838)
Certain rules such as
@media
could previously be minified incorrectly. Due to a typo in the duplicate rule checker, two known@
-rules that share the same hash code were incorrectly considered to be equal. This problem was made worse by the rule hashing code considering two unknown declarations (such as CSS variables) to have the same hash code, which also isn't optimal from a performance perspective. Both of these issues have been fixed:v0.17.2
Compare Source
Add
onDispose
to the plugin API (#2140, #2205)If your plugin wants to perform some cleanup after it's no longer going to be used, you can now use the
onDispose
API to register a callback for cleanup-related tasks. For example, if a plugin starts a long-running child process then it may want to terminate that process when the plugin is discarded. Previously there was no way to do this. Here's an example:These
onDispose
callbacks will be called after everybuild()
call regardless of whether the build failed or not as well as after the firstdispose()
call on a given build context.v0.17.1
Compare Source
Fix CSS transform bugs with nested selectors that start with a combinator (#3096)
This release fixes several bugs regarding transforming nested CSS into non-nested CSS for older browsers. The bugs were due to lack of test coverage for nested selectors with more than one compound selector where they all start with the same combinator. Here's what some problematic cases look like before and after these fixes:
Fix bug with TypeScript parsing of instantiation expressions followed by
=
(#3111)This release fixes esbuild's TypeScript-to-JavaScript conversion code in the case where a potential instantiation expression is followed immediately by a
=
token (such that the trailing>
becomes a>=
token). Previously esbuild considered that to still be an instantiation expression, but the official TypeScript compiler considered it to be a>=
operator instead. This release changes esbuild's interpretation to match TypeScript. This edge case currently appears to be problematic for other TypeScript-to-JavaScript converters as well:x<y>=a<b<c>>()
x<y>=a();
x=a();
x<y>=a();
x=a()
Avoid removing unrecognized directives from the directive prologue when minifying (#3115)
The directive prologue in JavaScript is a sequence of top-level string expressions that come before your code. The only directives that JavaScript engines currently recognize are
use strict
and sometimesuse asm
. However, the people behind React have made up their own directive for their own custom dialect of JavaScript. Previously esbuild only preserved theuse strict
directive when minifying, although you could still write React JavaScript with esbuild using something like--banner:js="'your directive here';"
. With this release, you can now put arbitrary directives in the entry point and esbuild will preserve them in its minified output:Note that this means esbuild will no longer remove certain stray top-level strings when minifying. This behavior is an intentional change because these stray top-level strings are actually part of the directive prologue, and could potentially have semantics assigned to them (as was the case with React).
Improved minification of binary shift operators
With this release, esbuild's minifier will now evaluate the
<<
and>>>
operators if the resulting code would be shorter:[
v0.17.0
](https://togithub.com/evanw/esbuConfiguration
📅 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.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.