Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Don't skip unresolved identifiers (#6050)
**Related issue:** - Closes #6049
- Loading branch information
Showing
18 changed files
with
54 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
3 changes: 3 additions & 0 deletions
3
crates/swc_ecma_minifier/tests/fixture/issues/6049/1/input.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var a = z() | ||
|
||
g(a) |
2 changes: 2 additions & 0 deletions
2
crates/swc_ecma_minifier/tests/fixture/issues/6049/1/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var a = z(); | ||
g(a); |
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
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
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
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_minifier/tests/fixture/projects/react/11/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
function setCurrentlyValidatingElement$1(element) { | ||
if (element) { | ||
var owner = element._owner; | ||
setExtraStackFrame(describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null)); | ||
var owner = element._owner, stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); | ||
setExtraStackFrame(stack); | ||
} else setExtraStackFrame(null); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
var element = jqLite(element); | ||
if (element.injector()) throw ngMinErr("btstrpd", "App Already Bootstrapped with this Element '{0}'", element[0] === document ? "document" : startingTag(element)); | ||
if (element.injector()) { | ||
var tag = element[0] === document ? "document" : startingTag(element); | ||
throw ngMinErr("btstrpd", "App Already Bootstrapped with this Element '{0}'", tag); | ||
} |
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
9 changes: 4 additions & 5 deletions
9
...cma_minifier/tests/terser/compress/collapse_vars/recursive_function_replacement/output.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
console.log( | ||
(function n(o) { | ||
return x(y(n(o))); | ||
})(c) | ||
); | ||
console.log(function n(o) { | ||
var r; | ||
return x((r = o, y(n(r)))); | ||
}(c)); |
c5fb774
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/minify/libraries/antd
2094328030
ns/iter (± 129335348
)1997747508
ns/iter (± 33051380
)1.05
es/full/minify/libraries/d3
376506083
ns/iter (± 26660409
)394111173
ns/iter (± 14322295
)0.96
es/full/minify/libraries/echarts
1571798858
ns/iter (± 136902642
)1515866725
ns/iter (± 26755333
)1.04
es/full/minify/libraries/jquery
102795240
ns/iter (± 17538307
)94471586
ns/iter (± 3537167
)1.09
es/full/minify/libraries/lodash
114068275
ns/iter (± 2827714
)124284697
ns/iter (± 3246706
)0.92
es/full/minify/libraries/moment
52251785
ns/iter (± 1250420
)55206043
ns/iter (± 2454398
)0.95
es/full/minify/libraries/react
22656378
ns/iter (± 2283777
)20124855
ns/iter (± 478926
)1.13
es/full/minify/libraries/terser
319431133
ns/iter (± 42625519
)304196856
ns/iter (± 8324871
)1.05
es/full/minify/libraries/three
596442752
ns/iter (± 132817412
)517714404
ns/iter (± 16127325
)1.15
es/full/minify/libraries/typescript
3419017243
ns/iter (± 157753282
)3397829595
ns/iter (± 137925066
)1.01
es/full/minify/libraries/victory
780752659
ns/iter (± 11018167
)786785904
ns/iter (± 47403482
)0.99
es/full/minify/libraries/vue
143968224
ns/iter (± 10070664
)185897872
ns/iter (± 63095804
)0.77
es/full/codegen/es3
35061
ns/iter (± 2855
)34230
ns/iter (± 1900
)1.02
es/full/codegen/es5
34533
ns/iter (± 2480
)34597
ns/iter (± 3899
)1.00
es/full/codegen/es2015
34595
ns/iter (± 3024
)33862
ns/iter (± 760
)1.02
es/full/codegen/es2016
35409
ns/iter (± 4733
)33732
ns/iter (± 791
)1.05
es/full/codegen/es2017
34915
ns/iter (± 1999
)34100
ns/iter (± 1170
)1.02
es/full/codegen/es2018
35486
ns/iter (± 2781
)34041
ns/iter (± 1288
)1.04
es/full/codegen/es2019
35080
ns/iter (± 6583
)33930
ns/iter (± 1213
)1.03
es/full/codegen/es2020
34763
ns/iter (± 8534
)34161
ns/iter (± 1949
)1.02
es/full/all/es3
226992374
ns/iter (± 24107119
)210590664
ns/iter (± 12246497
)1.08
es/full/all/es5
187755036
ns/iter (± 18028554
)180812011
ns/iter (± 10085557
)1.04
es/full/all/es2015
149688452
ns/iter (± 13151111
)147516001
ns/iter (± 7182205
)1.01
es/full/all/es2016
154771277
ns/iter (± 28261866
)148839453
ns/iter (± 12373104
)1.04
es/full/all/es2017
165910761
ns/iter (± 20555440
)161912009
ns/iter (± 12536180
)1.02
es/full/all/es2018
146397418
ns/iter (± 27927707
)143113620
ns/iter (± 9285824
)1.02
es/full/all/es2019
157410143
ns/iter (± 17267880
)144692920
ns/iter (± 12466087
)1.09
es/full/all/es2020
141048301
ns/iter (± 12532030
)140915806
ns/iter (± 8079051
)1.00
es/full/parser
746663
ns/iter (± 58993
)738163
ns/iter (± 26148
)1.01
es/full/base/fixer
27181
ns/iter (± 1992
)26430
ns/iter (± 857
)1.03
es/full/base/resolver_and_hygiene
97142
ns/iter (± 4050
)93923
ns/iter (± 3597
)1.03
serialization of ast node
219
ns/iter (± 11
)224
ns/iter (± 8
)0.98
serialization of serde
221
ns/iter (± 3
)220
ns/iter (± 6
)1.00
This comment was automatically generated by workflow using github-action-benchmark.