-
Notifications
You must be signed in to change notification settings - Fork 0
chore(deps): update dependency esbuild to ^0.18.0 #665
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
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 hidden or 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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
fd6dbdc to
1cb8d5c
Compare
1cb8d5c to
adacc6b
Compare
adacc6b to
3a5f507
Compare
3a5f507 to
e59ca7f
Compare
e59ca7f to
6edb482
Compare
6edb482 to
21943f8
Compare
21943f8 to
29b4549
Compare
29b4549 to
f4d10b3
Compare
f4d10b3 to
37055c2
Compare
37055c2 to
a2964ad
Compare
a2964ad to
a0f8424
Compare
a0f8424 to
66645a8
Compare
66645a8 to
90c9378
Compare
90c9378 to
c164664
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.40->^0.18.0Release Notes
evanw/esbuild
v0.18.2Compare Source
Lower static blocks when static fields are lowered (#2800, #2950, #3025)
This release fixes a bug where esbuild incorrectly did not lower static class blocks when static class fields needed to be lowered. For example, the following code should print
1 2 3but previously printed2 1 3instead due to this bug:Use static blocks to implement
--keep-nameson classes (#2389)This change fixes a bug where the
nameproperty could previously be incorrect within a class static context when using--keep-names. The problem was that thenameproperty was being initialized after static blocks were run instead of before. This has been fixed by moving thenameproperty initializer into a static block at the top of the class body:This change was somewhat involved, especially regarding what esbuild considers to be side-effect free. Some unused classes that weren't removed by tree shaking in previous versions of esbuild may now be tree-shaken. One example is classes with static private fields that are transformed by esbuild into code that doesn't use JavaScript's private field syntax. Previously esbuild's tree shaking analysis ran on the class after syntax lowering, but with this release it will run on the class before syntax lowering, meaning it should no longer be confused by class mutations resulting from automatically-generated syntax lowering code.
v0.18.1Compare Source
Fill in
nullentries in input source maps (#3144)If esbuild bundles input files with source maps and those source maps contain a
sourcesContentarray withnullentries, esbuild previously copied thosenullentries over to the output source map. With this release, esbuild will now attempt to fill in thosenullentries by looking for a file on the file system with the corresponding name from thesourcesarray. This matches esbuild's existing behavior that automatically generates thesourcesContentarray from the file system if the entiresourcesContentarray is missing.Support
/* @​__KEY__ */comments for mangling property names (#2574)Property mangling is an advanced feature that enables esbuild to minify certain property names, even though it's not possible to automatically determine that it's safe to do so. The safe property names are configured via regular expression such as
--mangle-props=_$(mangle all properties ending in_).Sometimes it's desirable to also minify strings containing property names, even though it's not possible to automatically determine which strings are property names. This release makes it possible to do this by annotating those strings with
/* @​__KEY__ */. This is a convention that Terser added earlier this year, and which esbuild is now following too: https://github.com/terser/terser/pull/1365. Using it looks like this:Support
/* @​__NO_SIDE_EFFECTS__ */comments for functions (#3149)Rollup has recently added support for
/* @​__NO_SIDE_EFFECTS__ */annotations before functions to indicate that calls to these functions can be removed if the result is unused (i.e. the calls can be assumed to have no side effects). This release adds basic support for these to esbuild as well, which means esbuild will now parse these comments in input files and preserve them in output files. This should help people that use esbuild in combination with Rollup.Note that this doesn't necessarily mean esbuild will treat these calls as having no side effects, as esbuild's parallel architecture currently isn't set up to enable this type of cross-file tree-shaking information (tree-shaking decisions regarding a function call are currently local to the file they appear in). If you want esbuild to consider a function call to have no side effects, make sure you continue to annotate the function call with
/* @​__PURE__ */(which is the previously-established convention for communicating this).v0.18.0Compare 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
esbuildin yourpackage.jsonfile (recommended) or be using a version range syntax that only accepts patch upgrades such as^0.17.0or~0.17.0. See npm's documentation about semver for more information.The breaking changes in this release mainly focus on fixing some long-standing issues with esbuild's handling of
tsconfig.jsonfiles. Here are all the changes in this release, in detail:Add a way to try esbuild online (#797)
There is now a way to try esbuild live on esbuild's website without installing it: https://esbuild.github.io/try/. In addition to being able to more easily evaluate esbuild, this should also make it more efficient to generate esbuild bug reports. For example, you can use it to compare the behavior of different versions of esbuild on the same input. The state of the page is stored in the URL for easy sharing. Many thanks to @hyrious for creating https://hyrious.me/esbuild-repl/, which was the main inspiration for this addition to esbuild's website.
Two forms of build options are supported: either CLI-style (example) or JS-style (example). Both are converted into a JS object that's passed to esbuild's WebAssembly API. The CLI-style argument parser is a custom one that simulates shell quoting rules, and the JS-style argument parser is also custom and parses a superset of JSON (basically JSON5 + regular expressions). So argument parsing is an approximate simulation of what happens for real but hopefully it should be close enough.
Changes to esbuild's
tsconfig.jsonsupport (#3019):This release makes the following changes to esbuild's
tsconfig.jsonsupport:Using experimental decorators now requires
"experimentalDecorators": true(#104)Previously esbuild would always compile decorators in TypeScript code using TypeScript's experimental decorator transform. Now that standard JavaScript decorators are close to being finalized, esbuild will now require you to use
"experimentalDecorators": trueto do this. This new requirement makes it possible for esbuild to introduce a transform for standard JavaScript decorators in TypeScript code in the future. Such a transform has not been implemented yet, however.TypeScript's
targetno longer affects esbuild'starget(#2628)Some people requested that esbuild support TypeScript's
targetsetting, so support for it was added (in version 0.12.4). However, esbuild supports reading from multipletsconfig.jsonfiles within a single build, which opens up the possibility that different files in the build have different language targets configured. There isn't really any reason to do this and it can lead to unexpected results. So with this release, thetargetsetting intsconfig.jsonwill no longer affect esbuild's owntargetsetting. You will have to use esbuild's own target setting instead (which is a single, global value).TypeScript's
jsxsetting no longer causes esbuild to preserve JSX syntax (#2634)TypeScript has a setting called
jsxthat controls how to transform JSX into JS. The tool-agnostic transform is calledreact, and the React-specific transform is calledreact-jsx(orreact-jsxdev). There is also a setting calledpreservewhich indicates JSX should be passed through untransformed. Previously people would run esbuild with"jsx": "preserve"in theirtsconfig.jsonfiles and then be surprised when esbuild preserved their JSX. So with this release, esbuild will now ignore"jsx": "preserve"intsconfig.jsonfiles. If you want to preserve JSX syntax with esbuild, you now have to use--jsx=preserve.Note: Some people have suggested that esbuild's equivalent
jsxsetting override the one intsconfig.json. However, some projects need to legitimately have different files within the same build use different transforms (i.e.reactvs.react-jsx) and having esbuild's globaljsxsetting overridetsconfig.jsonwould prevent this from working. This release ignores"jsx": "preserve"but still allows otherjsxvalues intsconfig.jsonfiles to override esbuild's globaljsxsetting to keep the ability for multiple files within the same build to use different transforms.useDefineForClassFieldsbehavior has changed (#2584, #2993)Class fields in TypeScript look like this (
xis a class field):TypeScript has legacy behavior that uses assignment semantics instead of define semantics for class fields when
useDefineForClassFieldsis enabled (in which case class fields in TypeScript behave differently than they do in JavaScript, which is arguably "wrong").This legacy behavior exists because TypeScript added class fields to TypeScript before they were added to JavaScript. The TypeScript team decided to go with assignment semantics and shipped their implementation. Much later on TC39 decided to go with define semantics for class fields in JavaScript instead. This behaves differently if the base class has a setter with the same name:
When you run
tsc, the value ofuseDefineForClassFieldsdefaults tofalsewhen it's not specified and thetargetintsconfig.jsonis present but earlier thanES2022. This sort of makes sense because the class field language feature was added in ES2022, so before ES2022 class fields didn't exist (and thus TypeScript's legacy behavior is active). However, TypeScript'stargetsetting currently defaults toES3which unfortunately means that theuseDefineForClassFieldssetting currently defaults to false (i.e. to "wrong"). In other words if you runtscwith all default settings, class fields will behave incorrectly.Previously esbuild tried to do what
tscdid. That meant esbuild's version ofuseDefineForClassFieldswasfalseby default, and was alsofalseif esbuild's--target=was present but earlier thanes2022. However, TypeScript's legacy class field behavior is becoming increasingly irrelevant and people who expect class fields in TypeScript to work like they do in JavaScript are confused when they use esbuild with default settings. It's also confusing that the behavior of class fields would change if you changed the language target (even though that's exactly how TypeScript works).So with this release, esbuild will now only use the information in
tsconfig.jsonto determine whetheruseDefineForClassFieldsis true or not. SpecificallyuseDefineForClassFieldswill be respected if present, otherwise it will befalseiftargetis present intsconfig.jsonand isES2021or earlier, otherwise it will betrue. Targets passed to esbuild's--target=setting will no longer affectuseDefineForClassFields.Note that this means different directories in your build can have different values for this setting since esbuild allows different directories to have different
tsconfig.jsonfiles within the same build. This should let you migrate your code one directory at a time without esbuild's--target=setting affecting the semantics of your code.Add support for
verbatimModuleSyntaxfrom TypeScript 5.0TypeScript 5.0 added a new option called
verbatimModuleSyntaxthat deprecates and replaces two older options,preserveValueImportsandimportsNotUsedAsValues. SettingverbatimModuleSyntaxto true intsconfig.jsontells esbuild to not drop unused import statements. Specifically esbuild now treats"verbatimModuleSyntax": trueas if you had specified both"preserveValueImports": trueand"importsNotUsedAsValues": "preserve".Add multiple inheritance for
tsconfig.jsonfrom TypeScript 5.0TypeScript 5.0 now allows multiple inheritance for
tsconfig.jsonfiles. You can now pass an array of filenames via theextendsparameter and yourtsconfig.jsonwill start off containing properties from all of those configuration files, in order. This release of esbuild adds support for this new TypeScript feature.Remove support for
moduleSuffixes(#2395)The community has requested that esbuild remove support for TypeScript's
moduleSuffixesfeature, so it has been removed in this release. Instead you can use esbuild's--resolve-extensions=feature to select which module suffix you want to build with.Apply
--tsconfig=overrides tostdinand virtual files (#385, #2543)When you override esbuild's automatic
tsconfig.jsonfile detection with--tsconfig=to pass a specifictsconfig.jsonfile, esbuild previously didn't apply these settings to source code passed via thestdinAPI option or to TypeScript files from plugins that weren't in thefilenamespace. This release changes esbuild's behavior so that settings fromtsconfig.jsonalso apply to these source code files as well.Support
--tsconfig-raw=in build API calls (#943, #2440)Previously if you wanted to override esbuild's automatic
tsconfig.jsonfile detection, you had to create a newtsconfig.jsonfile and pass the file name to esbuild via the--tsconfig=flag. With this release, you can now optionally use--tsconfig-raw=instead to pass the contents oftsconfig.jsonto esbuild directly instead of passing the file name. For example, you can now use--tsconfig-raw={"compilerOptions":{"experimentalDecorators":true}}to enable TypeScript experimental decorators directly using a command-line flag (assuming you escape the quotes correctly using your current shell's quoting rules). The--tsconfig-raw=flag previously only worked with transform API calls but with this release, it now works with build API calls too.Ignore all
tsconfig.jsonfiles innode_modules(#276, #2386)This changes esbuild's behavior that applies
tsconfig.jsonto all files in the subtree of the directory containingtsconfig.json. In version 0.12.7, esbuild started ignoringtsconfig.jsonfiles insidenode_modulesfolders. The rationale is that people typically do this by mistake and that doing this intentionally is a rare use case that doesn't need to be supported. However, this change only applied to certain syntax-specific settings (e.g.jsxFactory) but did not apply to path resolution settings (e.g.paths). With this release, esbuild will now ignore alltsconfig.jsonfiles innode_modulesinstead of only ignoring certain settings.Ignore
tsconfig.jsonwhen resolving paths withinnode_modules(#2481)Previously fields in
tsconfig.jsonrelated to path resolution (e.g.paths) were respected for all files in the subtree containing thattsconfig.jsonfile, even within a nestednode_modulessubdirectory. This meant that a project'spathssettings could potentially affect any bundled packages. With this release, esbuild will no longer usetsconfig.jsonsettings during path resolution inside nestednode_modulessubdirectories.Prefer
.jsover.tswithinnode_modules(#3019)The default list of implicit extensions that esbuild will try appending to import paths contains
.tsbefore.js. This makes it possible to bundle TypeScript projects that reference other files in the project using extension-less imports (e.g../some-fileto load./some-file.tsinstead of./some-file.js). However, this behavior is undesirable withinnode_modulesdirectories. Some package authors publish both their original TypeScript code and their compiled JavaScript code side-by-side. In these cases, esbuild should arguably be using the compiled JavaScript files instead of the original TypeScript files because the TypeScript compilation settings for files within the package should be determined by the package author, not the user of esbuild. So with this release, esbuild will now prefer implicit.jsextensions over.tswhen searching for import paths withinnode_modules.These changes are intended to improve esbuild's compatibility with
tscand reduce the number of unfortunate behaviors regardingtsconfig.jsonand esbuild.Add a workaround for bugs in Safari 16.2 and earlier (#3072)
Safari's JavaScript parser had a bug (which has now been fixed) where at least something about unary/binary operators nested inside default arguments nested inside either a function or class expression was incorrectly considered a syntax error if that expression was the target of a property assignment. Here are some examples that trigger this Safari bug:
It's not clear what the exact conditions are that trigger this bug. However, a workaround for this bug appears to be to post-process your JavaScript to wrap any in function and class declarations that are the direct target of a property access expression in parentheses. That's the workaround that UglifyJS applies for this issue: mishoo/UglifyJS#2056. So that's what esbuild now does starting with this release:
This fix is not enabled by default. It's only enabled when
--target=contains Safari 16.2 or earlier, such as with--target=safari16.2. You can also explicitly enable or disable this specific transform (calledfunction-or-class-property-access) with--supported:function-or-class-property-access=false.Fix esbuild's TypeScript type declarations to forbid unknown properties (#3089)
Version 0.17.0 of esbuild introduced a specific form of function overloads in the TypeScript type definitions for esbuild's API calls that looks like this:
This more accurately reflects how esbuild's JavaScript API behaves. The result object returned by
transformSynconly has thelegalCommentsproperty if you passlegalComments: 'external':However, this form of function overloads unfortunately allows typos (e.g.
egalComments) to pass the type checker without generating an error as TypeScript allows all objects with unknown properties to extendTransformOptions. These typos result in esbuild's API throwing an error at run-time.To prevent typos during type checking, esbuild's TypeScript type definitions will now use a different form that looks like this:
This change should hopefully not affect correct code. It should hopefully introduce type errors only for incorrect code.
Fix CSS nesting transform for pseudo-elements (#3119)
This release fixes esbuild's CSS nesting transform for pseudo-elements (e.g.
::beforeand::after). The CSS nesting specification says that the nesting selector does not work with pseudo-elements. This can be seen in the example below: esbuild does not carry the parent pseudo-element::beforethrough the nesting selector&. However, that doesn't apply to pseudo-elements that are within the same selector. Previously esbuild had a bug where it considered pseudo-elements in both locations as invalid. This release changes esbuild to only consider those from the parent selector invalid, which should align with the specification:Forbid
&before a type selector in nested CSSThe people behind the work-in-progress CSS nesting specification have very recently decided to forbid nested CSS that looks like
&div. You will have to use eitherdiv&or&:is(div)instead. This release of esbuild has been updated to take this new change into consideration. Doing this now generates a warning. The suggested fix is slightly different depending on where in the overall selector it happened:v0.17.19Compare 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 strictand 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 strictdirective 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.18Compare 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 theexportkeyword).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 theexportsfield and the code for that error message was not updated when esbuild later added support for theimportsfield. This crash has been fixed.v0.17.17Compare 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:scopepseudo-class:Support
exportsinpackage.jsonforextendsintsconfig.json(#3058)TypeScript 5.0 added the ability to use
extendsintsconfig.jsonto reference a path in a package whosepackage.jsonfile contains anexportsmap that points to the correct location. This doesn't automatically work in esbuild becausetsconfig.jsonaffects 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
extendspath using theexportsfield. The behavior should be similar enough to esbuild's main path resolution logic to work as expected.Note that esbuild always treats this
extendsimport as arequire()import since that's what TypeScript appears to do. Specifically therequirecondition will be active and theimportcondition 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_PATHenvironment 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_PATHdirectory. You're supposed to useNODE_PATHfor packages, but some people abuse this feature by putting files in that directory instead (e.g.node_modules/some-file.jsinstead ofnode_modules/some-pkg/some-file.js). The watch mode bug happens when you do this because esbuild first tries to readsome-file.jsas a directory and then as a file. Watch mode was incorrectly waiting forsome-file.jsto become a valid directory. This release fixes this edge case bug by changing watch mode to watchsome-file.jsas a file when this happens.v0.17.16Compare 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
--injectwith a file loaded using thecopyloader (#3041)This release now allows you to use
--injectwith a file that is loaded using thecopyloader. Thecopyloader copies the imported file to the output directory verbatim and rewrites the path in theimportstatement 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 bareimportstatement 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
--injectfeature is typically used). However, any side-effects that the injected file has will still occur.v0.17.15Compare 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 && exprmeansexpris never evaluated).Previously esbuild didn't do this for modules re-exported using the
export * fromsyntax. Annotations for these re-exports will now be added starting with this release:Note that you need to specify both
--format=cjsand--platform=nodeto 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
outdirwas 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.14Compare Source
Allow the TypeScript 5.0
constmodifier in object type declarations (#3021)The new TypeScript 5.0
constmodifier 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'stargetto 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 atargetwhich 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.13Compare Source
Work around an issue with
NODE_PATHand Go's WebAssembly internals (#3001)Go's WebAssembly implementation returns
EINVALinstead ofENOTDIRwhen using thereaddirsyscall on a file. This messes up esbuild's implementation of node's module resolution algorithm since encounteringENOTDIRcauses 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_PATHfeature to tell esbuild to resolve node modules in a custom directory that was not installed by npm. This release works around this problem by convertingEINVALintoENOTDIRfor thereaddirsyscall.Fix a minification bug with CSS
@layerrules 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@layerrules with parsing errors, and empty@layerrules cannot be removed because they have side effects (@layerdidn'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@layerrules with parsing errors when minifying (the rule@layer chas 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-familyto 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.12Compare 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.11Compare Source
Fix the
aliasfeature to always prefer the longest match (#2963)It's possible to configure conflicting aliases such as
--alias:a=band--alias:a/c=d, which is ambiguous for the import patha/c/x(since it could map to eitherb/c/xord/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/BigIntwith 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-tablepackage and was manually verified using old node executables downloaded from https://nodejs.org/download/release/.v0.17.10Compare 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
@nestprefix 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-facerules should now be deduplicated correctly across files:v0.17.9Compare 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
declareclass fields (#2914)In TypeScript, the key of a computed
declareclass 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.8Compare Source
Configuration
📅 Schedule: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), 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.