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): Fix detection of direct
eval
(#6215)
- Loading branch information
Showing
15 changed files
with
3,483 additions
and
1,024 deletions.
There are no files selected for viewing
File renamed without changes.
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
31 changes: 31 additions & 0 deletions
31
crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/input.js
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/mangle.json
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,415 changes: 2,415 additions & 0 deletions
2,415
crates/swc_ecma_minifier/tests/fixture/next/feedback-3/579-dcac359116b2707c/output.js
Large diffs are not rendered by default.
Oops, something went wrong.
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
1,972 changes: 986 additions & 986 deletions
1,972
crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
..._minifier/tests/terser/compress/issue_973/this_binding_collapse_vars/output.mangleOnly.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 @@ | ||
var c = a; | ||
c(); | ||
var d = a.b; | ||
d(); | ||
var e = eval; | ||
e(); | ||
var v = a; | ||
v(); | ||
var r = a.b; | ||
r(); | ||
var b = eval; | ||
b(); |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_minifier/tests/terser/compress/issue_973/this_binding_side_effects/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
12 changes: 6 additions & 6 deletions
12
...a_minifier/tests/terser/compress/issue_973/this_binding_side_effects/output.mangleOnly.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,11 +1,11 @@ | ||
(function(foo) { | ||
(0, foo)(); | ||
(0, foo.bar)(); | ||
(function(o) { | ||
(0, o)(); | ||
(0, o.bar)(); | ||
(0, eval)("console.log(foo);"); | ||
})(); | ||
(function(foo) { | ||
(function(o) { | ||
var eval = console; | ||
(0, foo)(); | ||
(0, foo.bar)(); | ||
(0, o)(); | ||
(0, o.bar)(); | ||
(0, eval)("console.log(foo);"); | ||
})(); |
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/terser/compress/issue_976/eval_mangle/output.mangleOnly.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
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_minifier/tests/terser/compress/issue_976/eval_unused/output.mangleOnly.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
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
780b5de
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/bugs-1
362156
ns/iter (± 56792
)331388
ns/iter (± 18290
)1.09
es/full/minify/libraries/antd
1905278662
ns/iter (± 45290223
)1757086065
ns/iter (± 33848513
)1.08
es/full/minify/libraries/d3
431306742
ns/iter (± 27361648
)383448670
ns/iter (± 13722779
)1.12
es/full/minify/libraries/echarts
1646595475
ns/iter (± 40406738
)1509419592
ns/iter (± 20301409
)1.09
es/full/minify/libraries/jquery
113632814
ns/iter (± 3929219
)96148711
ns/iter (± 3055092
)1.18
es/full/minify/libraries/lodash
132863189
ns/iter (± 5172453
)113435565
ns/iter (± 2669397
)1.17
es/full/minify/libraries/moment
64289220
ns/iter (± 1760647
)56748501
ns/iter (± 1288480
)1.13
es/full/minify/libraries/react
21836183
ns/iter (± 1078776
)19299921
ns/iter (± 235824
)1.13
es/full/minify/libraries/terser
338215637
ns/iter (± 5250413
)291880484
ns/iter (± 10210176
)1.16
es/full/minify/libraries/three
590452716
ns/iter (± 8472894
)536764954
ns/iter (± 30908826
)1.10
es/full/minify/libraries/typescript
3598037442
ns/iter (± 100117870
)3284782543
ns/iter (± 17877936
)1.10
es/full/minify/libraries/victory
849814878
ns/iter (± 21110988
)786072433
ns/iter (± 16538391
)1.08
es/full/minify/libraries/vue
170845023
ns/iter (± 5337223
)145574692
ns/iter (± 3116369
)1.17
es/full/codegen/es3
33130
ns/iter (± 1244
)32422
ns/iter (± 855
)1.02
es/full/codegen/es5
34552
ns/iter (± 8896
)32416
ns/iter (± 726
)1.07
es/full/codegen/es2015
33290
ns/iter (± 694
)32399
ns/iter (± 907
)1.03
es/full/codegen/es2016
33271
ns/iter (± 684
)32408
ns/iter (± 839
)1.03
es/full/codegen/es2017
33251
ns/iter (± 933
)32398
ns/iter (± 1095
)1.03
es/full/codegen/es2018
33219
ns/iter (± 2801
)32545
ns/iter (± 790
)1.02
es/full/codegen/es2019
33554
ns/iter (± 3449
)32449
ns/iter (± 867
)1.03
es/full/codegen/es2020
33112
ns/iter (± 469
)32456
ns/iter (± 901
)1.02
es/full/all/es3
197220625
ns/iter (± 9392496
)184123511
ns/iter (± 4985787
)1.07
es/full/all/es5
186152444
ns/iter (± 9740796
)174949875
ns/iter (± 4302546
)1.06
es/full/all/es2015
145834505
ns/iter (± 6294959
)139885585
ns/iter (± 5485638
)1.04
es/full/all/es2016
145550651
ns/iter (± 6081475
)139403394
ns/iter (± 3804846
)1.04
es/full/all/es2017
146951872
ns/iter (± 10047126
)139107902
ns/iter (± 4751990
)1.06
es/full/all/es2018
142365476
ns/iter (± 9353307
)137613286
ns/iter (± 4111949
)1.03
es/full/all/es2019
142297320
ns/iter (± 6528360
)136916444
ns/iter (± 3078756
)1.04
es/full/all/es2020
137525955
ns/iter (± 9942661
)131477295
ns/iter (± 4437850
)1.05
es/full/parser
707316
ns/iter (± 41920
)681184
ns/iter (± 24786
)1.04
es/full/base/fixer
26533
ns/iter (± 1815
)25390
ns/iter (± 1829
)1.05
es/full/base/resolver_and_hygiene
92376
ns/iter (± 5287
)89863
ns/iter (± 3205
)1.03
serialization of ast node
213
ns/iter (± 5
)211
ns/iter (± 8
)1.01
serialization of serde
233
ns/iter (± 6
)216
ns/iter (± 7
)1.08
This comment was automatically generated by workflow using github-action-benchmark.