-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es): Add an option to disable builtin transforms (#7873)
- Loading branch information
Showing
7 changed files
with
145 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import swc from "../../.."; | ||
|
||
describe("when jsc.experimentalDisableBuiltinTransforms is true", () => { | ||
it("should preserve TypeScript", async () => { | ||
const { code } = await swc.transform( | ||
` | ||
const hello: Type = () => { | ||
console.log('hello'); | ||
}; | ||
`, | ||
{ | ||
jsc: { | ||
parser: { | ||
syntax: "typescript", | ||
}, | ||
experimental: { | ||
disableBuiltinTransformsForInternalTesting: true, | ||
}, | ||
}, | ||
minify: false, | ||
} | ||
); | ||
|
||
expect(code).toMatchInlineSnapshot(` | ||
"const hello: Type = ()=>{ | ||
console.log(\\"hello\\"); | ||
}; | ||
" | ||
`); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -178,6 +178,6 @@ | |
], | ||
"packageManager": "yarn@3.5.0", | ||
"dependencies": { | ||
"@swc/types": "^0.1.3" | ||
"@swc/types": "^0.1.4" | ||
} | ||
} |
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
71d01ec
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
283100
ns/iter (± 4525
)295321
ns/iter (± 8865
)0.96
es/full/minify/libraries/antd
1283562950
ns/iter (± 12288118
)1360519744
ns/iter (± 15208658
)0.94
es/full/minify/libraries/d3
268323948
ns/iter (± 2570043
)285846415
ns/iter (± 2879623
)0.94
es/full/minify/libraries/echarts
1034660450
ns/iter (± 4672710
)1102565282
ns/iter (± 5918368
)0.94
es/full/minify/libraries/jquery
83090165
ns/iter (± 91600
)84363644
ns/iter (± 138322
)0.98
es/full/minify/libraries/lodash
96053201
ns/iter (± 164830
)98567448
ns/iter (± 217425
)0.97
es/full/minify/libraries/moment
49119368
ns/iter (± 72493
)49830745
ns/iter (± 104747
)0.99
es/full/minify/libraries/react
17849991
ns/iter (± 40505
)17952549
ns/iter (± 36069
)0.99
es/full/minify/libraries/terser
214690747
ns/iter (± 701299
)219419264
ns/iter (± 554434
)0.98
es/full/minify/libraries/three
379508320
ns/iter (± 2364906
)399118799
ns/iter (± 2138852
)0.95
es/full/minify/libraries/typescript
2609193261
ns/iter (± 11260015
)2669032033
ns/iter (± 27234515
)0.98
es/full/minify/libraries/victory
563236550
ns/iter (± 4755535
)592059157
ns/iter (± 6270564
)0.95
es/full/minify/libraries/vue
117570853
ns/iter (± 176046
)119881666
ns/iter (± 316934
)0.98
es/full/codegen/es3
33370
ns/iter (± 1353
)34222
ns/iter (± 130
)0.98
es/full/codegen/es5
33346
ns/iter (± 69
)34363
ns/iter (± 153
)0.97
es/full/codegen/es2015
33380
ns/iter (± 152
)34208
ns/iter (± 82
)0.98
es/full/codegen/es2016
33353
ns/iter (± 152
)34251
ns/iter (± 100
)0.97
es/full/codegen/es2017
33334
ns/iter (± 141
)34147
ns/iter (± 115
)0.98
es/full/codegen/es2018
33491
ns/iter (± 133
)34313
ns/iter (± 98
)0.98
es/full/codegen/es2019
33337
ns/iter (± 136
)34327
ns/iter (± 140
)0.97
es/full/codegen/es2020
33388
ns/iter (± 136
)34238
ns/iter (± 74
)0.98
es/full/all/es3
166705643
ns/iter (± 801961
)169984878
ns/iter (± 1891167
)0.98
es/full/all/es5
160599782
ns/iter (± 1543199
)162647190
ns/iter (± 1216699
)0.99
es/full/all/es2015
120064227
ns/iter (± 507215
)120814000
ns/iter (± 640600
)0.99
es/full/all/es2016
118739196
ns/iter (± 709543
)119872377
ns/iter (± 1436642
)0.99
es/full/all/es2017
117619501
ns/iter (± 875062
)119918960
ns/iter (± 627376
)0.98
es/full/all/es2018
115931856
ns/iter (± 628044
)117543074
ns/iter (± 456995
)0.99
es/full/all/es2019
115872863
ns/iter (± 847163
)116547454
ns/iter (± 795560
)0.99
es/full/all/es2020
110799969
ns/iter (± 541760
)112540144
ns/iter (± 797745
)0.98
es/full/parser
491396
ns/iter (± 5718
)496522
ns/iter (± 4813
)0.99
es/full/base/fixer
18982
ns/iter (± 471
)17505
ns/iter (± 47
)1.08
es/full/base/resolver_and_hygiene
81275
ns/iter (± 80
)80320
ns/iter (± 235
)1.01
serialization of serde
291
ns/iter (± 0
)289
ns/iter (± 0
)1.01
css/minify/libraries/bootstrap
28197523
ns/iter (± 45751
)29222966
ns/iter (± 73431
)0.96
css/visitor/compare/clone
1656817
ns/iter (± 7753
)1633928
ns/iter (± 4788
)1.01
css/visitor/compare/visit_mut_span
1774074
ns/iter (± 6736
)1769002
ns/iter (± 10190
)1.00
css/visitor/compare/visit_mut_span_panic
1862044
ns/iter (± 8409
)1844982
ns/iter (± 3216
)1.01
css/visitor/compare/fold_span
2591638
ns/iter (± 14388
)2574592
ns/iter (± 8824
)1.01
css/visitor/compare/fold_span_panic
2801597
ns/iter (± 9532
)2755176
ns/iter (± 6735
)1.02
css/lexer/bootstrap_5_1_3
4466184
ns/iter (± 6566
)4481098
ns/iter (± 11135
)1.00
css/lexer/foundation_6_7_4
3749716
ns/iter (± 3212
)3758165
ns/iter (± 12329
)1.00
css/lexer/tailwind_3_1_1
713820
ns/iter (± 652
)716271
ns/iter (± 2340
)1.00
css/parser/bootstrap_5_1_3
19806862
ns/iter (± 55234
)19831836
ns/iter (± 45628
)1.00
css/parser/foundation_6_7_4
15722952
ns/iter (± 38763
)15765342
ns/iter (± 37663
)1.00
css/parser/tailwind_3_1_1
3062950
ns/iter (± 5913
)2984017
ns/iter (± 3959
)1.03
es/codegen/colors
737594
ns/iter (± 401919
)737212
ns/iter (± 403323
)1.00
es/codegen/large
3136456
ns/iter (± 1665300
)2890458
ns/iter (± 1526000
)1.09
es/codegen/with-parser/colors
45395
ns/iter (± 595
)45314
ns/iter (± 537
)1.00
es/codegen/with-parser/large
487974
ns/iter (± 678
)489562
ns/iter (± 444
)1.00
es/minify/libraries/antd
1136813172
ns/iter (± 15440096
)1205082910
ns/iter (± 7349264
)0.94
es/minify/libraries/d3
237837095
ns/iter (± 339967
)244957030
ns/iter (± 524605
)0.97
es/minify/libraries/echarts
893802708
ns/iter (± 2136192
)954484414
ns/iter (± 6558686
)0.94
es/minify/libraries/jquery
73022430
ns/iter (± 118644
)73531811
ns/iter (± 138726
)0.99
es/minify/libraries/lodash
86620557
ns/iter (± 155519
)87268819
ns/iter (± 109301
)0.99
es/minify/libraries/moment
43325532
ns/iter (± 87923
)43634964
ns/iter (± 80571
)0.99
es/minify/libraries/react
15994751
ns/iter (± 43576
)16015534
ns/iter (± 117761
)1.00
es/minify/libraries/terser
184827492
ns/iter (± 493545
)189096566
ns/iter (± 721440
)0.98
es/minify/libraries/three
320231088
ns/iter (± 2602665
)333750069
ns/iter (± 792790
)0.96
es/minify/libraries/typescript
2226169424
ns/iter (± 13221958
)2311347643
ns/iter (± 11699013
)0.96
es/minify/libraries/victory
474162595
ns/iter (± 2391797
)500259393
ns/iter (± 3901015
)0.95
es/minify/libraries/vue
105801286
ns/iter (± 314041
)106994269
ns/iter (± 202468
)0.99
es/visitor/compare/clone
1963410
ns/iter (± 13417
)1948341
ns/iter (± 3278
)1.01
es/visitor/compare/visit_mut_span
2287786
ns/iter (± 8931
)2275399
ns/iter (± 6841
)1.01
es/visitor/compare/visit_mut_span_panic
2349976
ns/iter (± 3127
)2336557
ns/iter (± 8708
)1.01
es/visitor/compare/fold_span
3433495
ns/iter (± 9192
)3359006
ns/iter (± 9476
)1.02
es/visitor/compare/fold_span_panic
3512188
ns/iter (± 5354
)3456512
ns/iter (± 10340
)1.02
es/lexer/colors
13024
ns/iter (± 11
)13155
ns/iter (± 17
)0.99
es/lexer/angular
6132860
ns/iter (± 4846
)6034164
ns/iter (± 15975
)1.02
es/lexer/backbone
786632
ns/iter (± 333
)774267
ns/iter (± 469
)1.02
es/lexer/jquery
4488217
ns/iter (± 3223
)4386692
ns/iter (± 3039
)1.02
es/lexer/jquery mobile
6831644
ns/iter (± 11269
)6687754
ns/iter (± 7059
)1.02
es/lexer/mootools
3554986
ns/iter (± 4866
)3493285
ns/iter (± 6020
)1.02
es/lexer/underscore
664136
ns/iter (± 236
)649735
ns/iter (± 659
)1.02
es/lexer/three
21310777
ns/iter (± 28927
)20974652
ns/iter (± 22633
)1.02
es/lexer/yui
3820101
ns/iter (± 5703
)3770910
ns/iter (± 1938
)1.01
es/parser/colors
26863
ns/iter (± 47
)27334
ns/iter (± 206
)0.98
es/parser/angular
13466235
ns/iter (± 45866
)13509455
ns/iter (± 67327
)1.00
es/parser/backbone
1977493
ns/iter (± 9296
)1979932
ns/iter (± 8205
)1.00
es/parser/jquery
10799811
ns/iter (± 48406
)10787729
ns/iter (± 47771
)1.00
es/parser/jquery mobile
16452396
ns/iter (± 108642
)16620557
ns/iter (± 56015
)0.99
es/parser/mootools
8287636
ns/iter (± 14817
)8316830
ns/iter (± 19404
)1.00
es/parser/underscore
1704279
ns/iter (± 9019
)1697838
ns/iter (± 8567
)1.00
es/parser/three
46373118
ns/iter (± 229101
)47412347
ns/iter (± 284932
)0.98
es/parser/yui
8181685
ns/iter (± 28536
)8234036
ns/iter (± 34939
)0.99
es/preset-env/usage/builtin_type
134856
ns/iter (± 31193
)134555
ns/iter (± 31901
)1.00
es/preset-env/usage/property
16726
ns/iter (± 55
)16398
ns/iter (± 67
)1.02
es/resolver/typescript
88839795
ns/iter (± 1314759
)90980367
ns/iter (± 894286
)0.98
es/fixer/typescript
64538537
ns/iter (± 351320
)66511748
ns/iter (± 592201
)0.97
es/hygiene/typescript
128686211
ns/iter (± 1024308
)133759671
ns/iter (± 1171985
)0.96
es/resolver_with_hygiene/typescript
237227459
ns/iter (± 700631
)246259528
ns/iter (± 1206601
)0.96
es/visitor/base-perf/module_clone
59106
ns/iter (± 294
)59351
ns/iter (± 307
)1.00
es/visitor/base-perf/fold_empty
62804
ns/iter (± 308
)63307
ns/iter (± 146
)0.99
es/visitor/base-perf/fold_noop_impl_all
63434
ns/iter (± 184
)63171
ns/iter (± 269
)1.00
es/visitor/base-perf/fold_noop_impl_vec
63215
ns/iter (± 289
)63603
ns/iter (± 178
)0.99
es/visitor/base-perf/boxing_boxed_clone
58
ns/iter (± 0
)57
ns/iter (± 0
)1.02
es/visitor/base-perf/boxing_unboxed_clone
40
ns/iter (± 0
)41
ns/iter (± 0
)0.98
es/visitor/base-perf/boxing_boxed
110
ns/iter (± 0
)106
ns/iter (± 0
)1.04
es/visitor/base-perf/boxing_unboxed
78
ns/iter (± 0
)75
ns/iter (± 0
)1.04
es/visitor/base-perf/visit_empty
0
ns/iter (± 0
)0
ns/iter (± 0
)NaN
es/visitor/base-perf/visit_contains_this
2646
ns/iter (± 26
)2682
ns/iter (± 29
)0.99
es/base/parallel/resolver/typescript
3762158287
ns/iter (± 271735695
)3613029800
ns/iter (± 278579824
)1.04
es/base/parallel/hygiene/typescript
1419626358
ns/iter (± 16199542
)1470925436
ns/iter (± 19435336
)0.97
misc/visitors/time-complexity/time 5
132
ns/iter (± 1
)118
ns/iter (± 0
)1.12
misc/visitors/time-complexity/time 10
396
ns/iter (± 3
)392
ns/iter (± 2
)1.01
misc/visitors/time-complexity/time 15
671
ns/iter (± 4
)672
ns/iter (± 2
)1.00
misc/visitors/time-complexity/time 20
1053
ns/iter (± 5
)1201
ns/iter (± 39
)0.88
misc/visitors/time-complexity/time 40
3492
ns/iter (± 10
)3565
ns/iter (± 13
)0.98
misc/visitors/time-complexity/time 60
7287
ns/iter (± 20
)7271
ns/iter (± 30
)1.00
es/full-target/es2016
230282
ns/iter (± 707
)229418
ns/iter (± 889
)1.00
es/full-target/es2017
219165
ns/iter (± 1110
)218936
ns/iter (± 1137
)1.00
es/full-target/es2018
206621
ns/iter (± 206
)208314
ns/iter (± 797
)0.99
es2020_nullish_coalescing
71008
ns/iter (± 307
)70708
ns/iter (± 426
)1.00
es2020_optional_chaining
81566
ns/iter (± 257
)81269
ns/iter (± 383
)1.00
es2022_class_properties
116375
ns/iter (± 239
)115759
ns/iter (± 492
)1.01
es2018_object_rest_spread
75448
ns/iter (± 335
)75106
ns/iter (± 260
)1.00
es2019_optional_catch_binding
64207
ns/iter (± 232
)64109
ns/iter (± 295
)1.00
es2017_async_to_generator
64101
ns/iter (± 162
)63859
ns/iter (± 234
)1.00
es2016_exponentiation
68672
ns/iter (± 170
)68565
ns/iter (± 238
)1.00
es2015_arrow
71729
ns/iter (± 244
)71434
ns/iter (± 171
)1.00
es2015_block_scoped_fn
68479
ns/iter (± 131
)68038
ns/iter (± 177
)1.01
es2015_block_scoping
123535
ns/iter (± 590
)123083
ns/iter (± 499
)1.00
This comment was automatically generated by workflow using github-action-benchmark.