[Snyk] Upgrade esbuild from 0.18.13 to 0.19.11 #6
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 was automatically created by Snyk using the credentials of a real user.
Snyk has created this PR to upgrade esbuild from 0.18.13 to 0.19.11.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Release notes
Package name: esbuild
Fix TypeScript-specific class transform edge case (#3559)
The previous release introduced an optimization that avoided transforming
super()
in the class constructor for TypeScript code compiled withuseDefineForClassFields
set tofalse
if all class instance fields have no initializers. The rationale was that in this case, all class instance fields are omitted in the output so no changes to the constructor are needed. However, if all of this is the case and there are#private
instance fields with initializers, those private instance field initializers were still being moved into the constructor. This was problematic because they were being inserted before the call tosuper()
(sincesuper()
is now no longer transformed in that case). This release introduces an additional optimization that avoids moving the private instance field initializers into the constructor in this edge case, which generates smaller code, matches the TypeScript compiler's output more closely, and avoids this bug:class Foo extends Bar {
#private = 1;
public: any;
constructor() {
super();
}
}
// Old output (with esbuild v0.19.9)
class Foo extends Bar {
constructor() {
super();
this.#private = 1;
}
#private;
}
// Old output (with esbuild v0.19.10)
class Foo extends Bar {
constructor() {
this.#private = 1;
super();
}
#private;
}
// New output
class Foo extends Bar {
#private = 1;
constructor() {
super();
}
}
Minifier: allow reording a primitive past a side-effect (#3568)
The minifier previously allowed reordering a side-effect past a primitive, but didn't handle the case of reordering a primitive past a side-effect. This additional case is now handled:
function f() {
let x = false;
let y = x;
const boolean = y;
let frag = $.template(
<p contenteditable="<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">boolean</span><span class="pl-kos">}</span></span>">hello world</p>
);return frag;
}
// Old output (with --minify)
function f(){const e=!1;return $.template(
<p contenteditable="<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">e</span><span class="pl-kos">}</span></span>">hello world</p>
)}// New output (with --minify)
function f(){return $.template('<p contenteditable="false">hello world</p>')}
Minifier: consider properties named using known
Symbol
instances to be side-effect free (#3561)Many things in JavaScript can have side effects including property accesses and ToString operations, so using a symbol such as
Symbol.iterator
as a computed property name is not obviously side-effect free. This release adds a special case for knownSymbol
instances so that they are considered side-effect free when used as property names. For example, this class declaration will now be considered side-effect free:Provide the
stop()
API in node to exit esbuild's child process (#3558)You can now call
stop()
in esbuild's node API to exit esbuild's child process to reclaim the resources used. It only makes sense to do this for a long-lived node process when you know you will no longer be making any more esbuild API calls. It is not necessary to call this to allow node to exit, and it's advantageous to not call this in between calls to esbuild's API as sharing a single long-lived esbuild child process is more efficient than re-creating a new esbuild child process for every API call. This API call used to exist but was removed in version 0.9.0. This release adds it back due to a user request.Read more
Read more
Add a treemap chart to esbuild's bundle analyzer (#2848)
The bundler analyzer on esbuild's website (https://esbuild.github.io/analyze/) now has a treemap chart type in addition to the two existing chart types (sunburst and flame). This should be more familiar for people coming from other similar tools, as well as make better use of large screens.
Allow decorators after the
export
keyword (#104)Previously esbuild's decorator parser followed the original behavior of TypeScript's experimental decorators feature, which only allowed decorators to come before the
export
keyword. However, the upcoming JavaScript decorators feature also allows decorators to come after theexport
keyword. And with TypeScript 5.0, TypeScript now also allows experimental decorators to come after theexport
keyword too. So esbuild now allows this as well:@decorator export class Foo {}
@decorator export default class Foo {}
// This new syntax is now permitted too:
export @decorator class Foo {}
export default @decorator class Foo {}
In addition, esbuild's decorator parser has been rewritten to fix several subtle and likely unimportant edge cases with esbuild's parsing of exports and decorators in TypeScript (e.g. TypeScript apparently does automatic semicolon insertion after
interface
andexport interface
but not afterexport default interface
).Pretty-print decorators using the same whitespace as the original
When printing code containing decorators, esbuild will now try to respect whether the original code contained newlines after the decorator or not. This can make generated code containing many decorators much more compact to read:
class Foo {
@a @b @c abc
@x @y @z xyz
}
// Old output
class Foo {
@a
@b
@c
abc;
@x
@y
@z
xyz;
}
// New output
class Foo {
@a @b @c abc;
@x @y @z xyz;
}
Read more
Read more
Fix a regression in 0.19.0 regarding
paths
intsconfig.json
(#3354)The fix in esbuild version 0.19.0 to process
tsconfig.json
aliases before the--packages=external
setting unintentionally broke an edge case in esbuild's handling of certaintsconfig.json
aliases where there are multiple files with the same name in different directories. This release adjusts esbuild's behavior for this edge case so that it passes while still processing aliases before--packages=external
. Please read the linked issue for more details.Fix a CSS
font
property minification bug (#3452)This release fixes a bug where esbuild's CSS minifier didn't insert a space between the font size and the font family in the
font
CSS shorthand property in the edge case where the original source code didn't already have a space and the leading string token was shortened to an identifier:.foo { font: 16px"Menlo"; }
/* Old output (with --minify) */
.foo{font:16pxMenlo}
/* New output (with --minify) */
.foo{font:16px Menlo}
Fix bundling CSS with asset names containing spaces (#3410)
Assets referenced via CSS
url()
tokens may cause esbuild to generate invalid output when bundling if the file name contains spaces (e.g.url(image 2.png)
). With this release, esbuild will now quote all bundled asset references inurl()
tokens to avoid this problem. This only affects assets loaded using thefile
andcopy
loaders.Fix invalid CSS
url()
tokens in@ import
rules (#3426)In the future, CSS
url()
tokens may contain additional stuff after the URL. This is irrelevant today as no CSS specification does this. But esbuild previously had a bug where using these tokens in an@ import
rule resulted in malformed output. This bug has been fixed.Fix
browser
+false
+type: module
inpackage.json
(#3367)The
browser
field inpackage.json
allows you to map a file tofalse
to have it be treated as an empty file when bundling for the browser. However, ifpackage.json
contains"type": "module"
then all.js
files will be considered ESM, not CommonJS. Importing a named import from an empty CommonJS file gives you undefined, but importing a named export from an empty ESM file is a build error. This release changes esbuild's interpretation of these files mapped tofalse
in this situation from ESM to CommonJS to avoid generating build errors for named imports.Fix a bug in top-level await error reporting (#3400)
Using
require()
on a file that contains top-level await is not allowed becauserequire()
must return synchronously and top-level await makes that impossible. You will get a build error if you try to bundle code that does this with esbuild. This release fixes a bug in esbuild's error reporting code for complex cases of this situation involving multiple levels of imports to get to the module containing the top-level await.Update to Unicode 15.1.0
The character tables that determine which characters form valid JavaScript identifiers have been updated from Unicode version 15.0.0 to the newly-released Unicode version 15.1.0. I'm not putting an example in the release notes because all of the new characters will likely just show up as little squares since fonts haven't been updated yet. But you can read https://www.unicode.org/versions/Unicode15.1.0/#Summary for more information about the changes.
This upgrade was contributed by @ JLHwung.
Read more
Read more
Read more
Commit messages
Package name: esbuild
Compare
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs