Make global names more compact when ||= is available (#2331)
With this release, the code esbuild generates for the --global-name= setting is now slightly shorter when you don't configure esbuild such that the ||= operator is unsupported (e.g. with --target=chrome80 or --supported:logical-assignment=false):
// Original code
exports.foo = 123
// Old output (with --format=iife --global-name=foo.bar.baz --minify)
var foo=foo||{};foo.bar=foo.bar||{};foo.bar.baz=(()=>{var b=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var c=b(f=>{f.foo=123});return c();})();
// New output (with --format=iife --global-name=foo.bar.baz --minify)
var foo;((foo||={}).bar||={}).baz=(()=>{var b=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var c=b(f=>{f.foo=123});return c();})();
Fix --mangle-quoted=false with --minify-syntax=true
If property mangling is active and --mangle-quoted is disabled, quoted properties are supposed to be preserved. However, there was a case when this didn't happen if --minify-syntax was enabled, since that internally transforms x['y'] into x.y to reduce code size. This issue has been fixed:
// Original code
x.foo = x['bar'] = { foo: y, 'bar': z }
// Old output (with --mangle-props=. --mangle-quoted=false --minify-syntax=true)
x.a = x.b = { a: y, bar: z };
// New output (with --mangle-props=. --mangle-quoted=false --minify-syntax=true)
x.a = x.bar = { a: y, bar: z };
Notice how the property foo is always used unquoted but the property bar is always used quoted, so foo should be consistently mangled while bar should be consistently not mangled.
Fix a minification bug regarding this and property initializers
When minification is enabled, esbuild attempts to inline the initializers of variables that have only been used once into the start of the following expression to reduce code size. However, there was a bug where this transformation could change the value of this when the initializer is a property access and the start of the following expression is a call expression. This release fixes the bug:
// Original code
function foo(obj) {
let fn = obj.prop;
fn();
}
// Old output (with --minify)
function foo(f){f.prop()}
// New output (with --minify)
function foo(o){let f=o.prop;f()}
Make global names more compact when ||= is available (#2331)
With this release, the code esbuild generates for the --global-name= setting is now slightly shorter when you don't configure esbuild such that the ||= operator is unsupported (e.g. with --target=chrome80 or --supported:logical-assignment=false):
// Original code
exports.foo = 123
// Old output (with --format=iife --global-name=foo.bar.baz --minify)
var foo=foo||{};foo.bar=foo.bar||{};foo.bar.baz=(()=>{var b=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var c=b(f=>{f.foo=123});return c();})();
// New output (with --format=iife --global-name=foo.bar.baz --minify)
var foo;((foo||={}).bar||={}).baz=(()=>{var b=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var c=b(f=>{f.foo=123});return c();})();
Fix --mangle-quoted=false with --minify-syntax=true
If property mangling is active and --mangle-quoted is disabled, quoted properties are supposed to be preserved. However, there was a case when this didn't happen if --minify-syntax was enabled, since that internally transforms x['y'] into x.y to reduce code size. This issue has been fixed:
// Original code
x.foo = x['bar'] = { foo: y, 'bar': z }
// Old output (with --mangle-props=. --mangle-quoted=false --minify-syntax=true)
x.a = x.b = { a: y, bar: z };
// New output (with --mangle-props=. --mangle-quoted=false --minify-syntax=true)
x.a = x.bar = { a: y, bar: z };
Notice how the property foo is always used unquoted but the property bar is always used quoted, so foo should be consistently mangled while bar should be consistently not mangled.
Fix a minification bug regarding this and property initializers
When minification is enabled, esbuild attempts to inline the initializers of variables that have only been used once into the start of the following expression to reduce code size. However, there was a bug where this transformation could change the value of this when the initializer is a property access and the start of the following expression is a call expression. This release fixes the bug:
// Original code
function foo(obj) {
let fn = obj.prop;
fn();
}
// Old output (with --minify)
function foo(f){f.prop()}
// New output (with --minify)
function foo(o){let f=o.prop;f()}
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps esbuild from 0.14.8 to 0.14.47.
Release notes
Sourced from esbuild's releases.
... (truncated)
Changelog
Sourced from esbuild's changelog.
... (truncated)
Commits
20f4b45
publish 0.14.47 to npmf3c6248
fix minify bug with variable inlining andthis
1dd274d
fix--mangle-quoted=false
with--minify-syntax
f808dab
fix #2331: use||=
to make global names shorterde70834
publish 0.14.46 to npm7034fca
fix #2330: implementextends
afterinfer
in ts465ae2a
convert an if to a switchd981064
make to go formatter happy0d4fae1
fix #2060: undo the V8 object spread special case8ff05e1
rename more featuresDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)