-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/transform): Add experimental
.d.ts
generation (#9093)
- Loading branch information
Showing
67 changed files
with
825 additions
and
72 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
11 changes: 11 additions & 0 deletions
11
crates/swc/tests/fixture/issues-2xxx/2020/case1/input/index.swc-stderr
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,11 @@ | ||
|
||
x cannot reassign to a variable declared with `const` | ||
,-[$DIR/tests/fixture/issues-2xxx/2020/case1/input/index.js:1:1] | ||
1 | const createRegisterItems = (registerType) => async (a, b) => { | ||
: | | ||
: `-- cannot reassign | ||
2 | const a = root?.test; | ||
: | | ||
: `-- const variable was declared here | ||
3 | }; | ||
`---- |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/fixture/issues-8xxx/8935/input/src/button.swc-stderr
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,12 @@ | ||
|
||
x the name `Button` is defined multiple times | ||
,-[$DIR/tests/fixture/issues-8xxx/8935/input/src/button.jsx:1:1] | ||
1 | export function Button(props) { | ||
: ^^^|^^ | ||
: `-- previous definition of `Button` here | ||
2 | return <button {...props} />; | ||
3 | }export function Button(props) { | ||
: ^^^|^^ | ||
: `-- `Button` redefined here | ||
4 | return <button {...props} />; | ||
`---- |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/fixture/module/ignore-dynamic/1/input/index.swc-stderr
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,12 @@ | ||
|
||
x the name `foo` is defined multiple times | ||
,-[$DIR/tests/fixture/module/ignore-dynamic/1/input/index.js:1:1] | ||
1 | import foo from "foo"; | ||
: ^|^ | ||
: `-- previous definition of `foo` here | ||
2 | | ||
3 | async function foo() { | ||
: ^|^ | ||
: `-- `foo` redefined here | ||
4 | await import("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
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,10 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript" | ||
}, | ||
"experimental": { | ||
"emitIsolatedDts": true | ||
} | ||
} | ||
} |
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 @@ | ||
### TypeScript Isolated Declaration test cases | ||
|
||
These tests are copied from [oxc](https://github.com/oxc-project/oxc/tree/58e54f4aea89c5d548c7976caba80a484260a979/crates/oxc_isolated_declarations/tests/fixtures) |
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,11 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript" | ||
}, | ||
"experimental": { | ||
"emitIsolatedDts": true | ||
} | ||
}, | ||
"isModule": true | ||
} |
9 changes: 9 additions & 0 deletions
9
crates/swc/tests/ts-isolated-declaration/oxc/input/arrow-function-return-type.ts
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,9 @@ | ||
function A() { | ||
return () => { | ||
return C; | ||
} | ||
} | ||
|
||
const B = () => { return B }; | ||
|
||
const C = function () {} |
Oops, something went wrong.
51a2702
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
276275
ns/iter (± 4694
)275137
ns/iter (± 12496
)1.00
es/full/minify/libraries/antd
1878560215
ns/iter (± 37707991
)1788361702
ns/iter (± 43097383
)1.05
es/full/minify/libraries/d3
355110737
ns/iter (± 5616769
)342407938
ns/iter (± 1332477
)1.04
es/full/minify/libraries/echarts
1664808888
ns/iter (± 39313845
)1467396343
ns/iter (± 17764275
)1.13
es/full/minify/libraries/jquery
105016115
ns/iter (± 561034
)102494026
ns/iter (± 387743
)1.02
es/full/minify/libraries/lodash
115875457
ns/iter (± 809445
)113400128
ns/iter (± 178628
)1.02
es/full/minify/libraries/moment
60128345
ns/iter (± 204996
)59382019
ns/iter (± 1698822
)1.01
es/full/minify/libraries/react
18441993
ns/iter (± 82292
)18302951
ns/iter (± 19535
)1.01
es/full/minify/libraries/terser
285704283
ns/iter (± 4367328
)273991635
ns/iter (± 5863190
)1.04
es/full/minify/libraries/three
515987609
ns/iter (± 17664949
)464956994
ns/iter (± 1768558
)1.11
es/full/minify/libraries/typescript
3353416706
ns/iter (± 38727253
)3226920857
ns/iter (± 23769464
)1.04
es/full/minify/libraries/victory
841258193
ns/iter (± 22948816
)714670228
ns/iter (± 5938056
)1.18
es/full/minify/libraries/vue
149521355
ns/iter (± 1501984
)144317770
ns/iter (± 361907
)1.04
es/full/codegen/es3
59915
ns/iter (± 164
)59707
ns/iter (± 181
)1.00
es/full/codegen/es5
59471
ns/iter (± 273
)59725
ns/iter (± 97
)1.00
es/full/codegen/es2015
59890
ns/iter (± 280
)59478
ns/iter (± 137
)1.01
es/full/codegen/es2016
59250
ns/iter (± 135
)59503
ns/iter (± 423
)1.00
es/full/codegen/es2017
59395
ns/iter (± 242
)59492
ns/iter (± 152
)1.00
es/full/codegen/es2018
59463
ns/iter (± 650
)59708
ns/iter (± 3181
)1.00
es/full/codegen/es2019
59404
ns/iter (± 332
)59261
ns/iter (± 106
)1.00
es/full/codegen/es2020
59114
ns/iter (± 168
)59435
ns/iter (± 168
)0.99
es/full/all/es3
162324163
ns/iter (± 2105707
)160724023
ns/iter (± 899639
)1.01
es/full/all/es5
156565382
ns/iter (± 1069271
)155661706
ns/iter (± 1700472
)1.01
es/full/all/es2015
116600883
ns/iter (± 846966
)114319160
ns/iter (± 681772
)1.02
es/full/all/es2016
115567638
ns/iter (± 890101
)113601833
ns/iter (± 960108
)1.02
es/full/all/es2017
114738425
ns/iter (± 820953
)113493187
ns/iter (± 772427
)1.01
es/full/all/es2018
112779370
ns/iter (± 716094
)112200831
ns/iter (± 632173
)1.01
es/full/all/es2019
112449363
ns/iter (± 755949
)110693473
ns/iter (± 1025928
)1.02
es/full/all/es2020
107767387
ns/iter (± 1028603
)107493804
ns/iter (± 996239
)1.00
es/full/parser
461233
ns/iter (± 1288
)454685
ns/iter (± 2202
)1.01
es/full/base/fixer
15784
ns/iter (± 73
)15417
ns/iter (± 91
)1.02
es/full/base/resolver_and_hygiene
80923
ns/iter (± 185
)79517
ns/iter (± 375
)1.02
serialization of serde
271
ns/iter (± 1
)261
ns/iter (± 6
)1.04
css/minify/libraries/bootstrap
22203162
ns/iter (± 140296
)22312637
ns/iter (± 117882
)1.00
css/visitor/compare/clone
1382524
ns/iter (± 4861
)1389499
ns/iter (± 8994
)0.99
css/visitor/compare/visit_mut_span
1514242
ns/iter (± 8332
)1499300
ns/iter (± 9027
)1.01
css/visitor/compare/visit_mut_span_panic
1528993
ns/iter (± 31776
)1532715
ns/iter (± 8670
)1.00
css/visitor/compare/fold_span
2014020
ns/iter (± 4512
)2008153
ns/iter (± 7105
)1.00
css/visitor/compare/fold_span_panic
2153922
ns/iter (± 4538
)2140669
ns/iter (± 5361
)1.01
css/lexer/bootstrap_5_1_3
3425883
ns/iter (± 5886
)3431607
ns/iter (± 1429
)1.00
css/lexer/foundation_6_7_4
2790593
ns/iter (± 2255
)2791900
ns/iter (± 721
)1.00
css/lexer/tailwind_3_1_1
534516
ns/iter (± 4655
)535164
ns/iter (± 766
)1.00
css/parser/bootstrap_5_1_3
16256498
ns/iter (± 29125
)15918319
ns/iter (± 37958
)1.02
css/parser/foundation_6_7_4
13002598
ns/iter (± 15516
)12738002
ns/iter (± 22426
)1.02
css/parser/tailwind_3_1_1
2590278
ns/iter (± 9477
)2506520
ns/iter (± 3263
)1.03
es/codegen/colors
730887
ns/iter (± 405157
)724730
ns/iter (± 397891
)1.01
es/codegen/large
2993707
ns/iter (± 1606867
)3020033
ns/iter (± 1598955
)0.99
es/codegen/with-parser/colors
41330
ns/iter (± 227
)41802
ns/iter (± 895
)0.99
es/codegen/with-parser/large
447949
ns/iter (± 3115
)449834
ns/iter (± 1925
)1.00
es/minify/libraries/antd
1462991622
ns/iter (± 25635645
)1644084542
ns/iter (± 32224670
)0.89
es/minify/libraries/d3
283275075
ns/iter (± 2033915
)342266943
ns/iter (± 10215054
)0.83
es/minify/libraries/echarts
1186631117
ns/iter (± 33817043
)1376292290
ns/iter (± 19522855
)0.86
es/minify/libraries/jquery
83339600
ns/iter (± 145420
)90081666
ns/iter (± 2247335
)0.93
es/minify/libraries/lodash
104767076
ns/iter (± 213013
)112638942
ns/iter (± 1322956
)0.93
es/minify/libraries/moment
48587462
ns/iter (± 141234
)50916042
ns/iter (± 842885
)0.95
es/minify/libraries/react
16385421
ns/iter (± 38400
)16817598
ns/iter (± 156654
)0.97
es/minify/libraries/terser
219175052
ns/iter (± 599858
)258104244
ns/iter (± 6220613
)0.85
es/minify/libraries/three
367463949
ns/iter (± 10302320
)445896692
ns/iter (± 9278615
)0.82
es/minify/libraries/typescript
2810813090
ns/iter (± 39583545
)2980067534
ns/iter (± 23644645
)0.94
es/minify/libraries/victory
571444675
ns/iter (± 8251950
)760472303
ns/iter (± 27339371
)0.75
es/minify/libraries/vue
121906703
ns/iter (± 179389
)136477618
ns/iter (± 3866225
)0.89
es/visitor/compare/clone
1741618
ns/iter (± 5329
)1742909
ns/iter (± 7975
)1.00
es/visitor/compare/visit_mut_span
2095847
ns/iter (± 13012
)2074909
ns/iter (± 8065
)1.01
es/visitor/compare/visit_mut_span_panic
2088723
ns/iter (± 35194
)2086623
ns/iter (± 35182
)1.00
es/visitor/compare/fold_span
2793819
ns/iter (± 7738
)2782568
ns/iter (± 28845
)1.00
es/visitor/compare/fold_span_panic
2890592
ns/iter (± 23124
)2819741
ns/iter (± 22159
)1.03
es/lexer/colors
9014
ns/iter (± 21
)9292
ns/iter (± 64
)0.97
es/lexer/angular
4794067
ns/iter (± 23713
)4807038
ns/iter (± 25111
)1.00
es/lexer/backbone
620558
ns/iter (± 1124
)624476
ns/iter (± 2031
)0.99
es/lexer/jquery
3498801
ns/iter (± 6860
)3527799
ns/iter (± 10884
)0.99
es/lexer/jquery mobile
5175893
ns/iter (± 18030
)5200410
ns/iter (± 4230
)1.00
es/lexer/mootools
2731825
ns/iter (± 3217
)2755688
ns/iter (± 9633
)0.99
es/lexer/underscore
515221
ns/iter (± 891
)514861
ns/iter (± 465
)1.00
es/lexer/three
15627421
ns/iter (± 43173
)15795442
ns/iter (± 24329
)0.99
es/lexer/yui
2835979
ns/iter (± 9917
)2859807
ns/iter (± 3628
)0.99
es/lexer/cal-com
12845477
ns/iter (± 197377
)12917773
ns/iter (± 41724
)0.99
es/lexer/typescript
89888808
ns/iter (± 824945
)88760060
ns/iter (± 205953
)1.01
es/parser/colors
24457
ns/iter (± 163
)24818
ns/iter (± 101
)0.99
es/parser/angular
12594701
ns/iter (± 139328
)12673830
ns/iter (± 76796
)0.99
es/parser/backbone
1820266
ns/iter (± 5723
)1851200
ns/iter (± 7289
)0.98
es/parser/jquery
10053687
ns/iter (± 63071
)10213214
ns/iter (± 77889
)0.98
es/parser/jquery mobile
15288021
ns/iter (± 304664
)15402415
ns/iter (± 129838
)0.99
es/parser/mootools
7811135
ns/iter (± 20678
)7946749
ns/iter (± 232681
)0.98
es/parser/underscore
1595661
ns/iter (± 8005
)1612129
ns/iter (± 8881
)0.99
es/parser/three
44955600
ns/iter (± 462593
)44306728
ns/iter (± 665941
)1.01
es/parser/yui
7485315
ns/iter (± 48110
)7542092
ns/iter (± 49108
)0.99
es/parser/cal-com
41817608
ns/iter (± 613936
)40198427
ns/iter (± 428526
)1.04
es/parser/typescript
273663248
ns/iter (± 1212034
)273059705
ns/iter (± 2707962
)1.00
es/preset-env/usage/builtin_type
141480
ns/iter (± 33542
)136197
ns/iter (± 34306
)1.04
es/preset-env/usage/property
17434
ns/iter (± 128
)16705
ns/iter (± 90
)1.04
es/resolver/typescript
96192939
ns/iter (± 2006189
)104305055
ns/iter (± 2404450
)0.92
es/fixer/typescript
79191389
ns/iter (± 2380087
)85292565
ns/iter (± 3811390
)0.93
es/hygiene/typescript
169446711
ns/iter (± 1651781
)187820298
ns/iter (± 8234376
)0.90
es/resolver_with_hygiene/typescript
297557947
ns/iter (± 4861431
)308903390
ns/iter (± 7101788
)0.96
es/visitor/base-perf/module_clone
57128
ns/iter (± 758
)57475
ns/iter (± 1204
)0.99
es/visitor/base-perf/fold_empty
60160
ns/iter (± 1113
)60899
ns/iter (± 785
)0.99
es/visitor/base-perf/fold_noop_impl_all
60997
ns/iter (± 1888
)60166
ns/iter (± 315
)1.01
es/visitor/base-perf/fold_noop_impl_vec
60074
ns/iter (± 1133
)60445
ns/iter (± 805
)0.99
es/visitor/base-perf/boxing_boxed_clone
60
ns/iter (± 0
)60
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed_clone
47
ns/iter (± 0
)47
ns/iter (± 0
)1
es/visitor/base-perf/boxing_boxed
106
ns/iter (± 0
)106
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed
80
ns/iter (± 0
)81
ns/iter (± 0
)0.99
es/visitor/base-perf/visit_contains_this
2640
ns/iter (± 16
)2631
ns/iter (± 15
)1.00
es/base/parallel/resolver/typescript
2342885886
ns/iter (± 106143516
)2481384713
ns/iter (± 140007512
)0.94
es/base/parallel/hygiene/typescript
3119897002
ns/iter (± 41619945
)3221111501
ns/iter (± 96834711
)0.97
babelify-only
490346
ns/iter (± 9291
)494334
ns/iter (± 8063
)0.99
parse_and_babelify_angular
45326021
ns/iter (± 2098478
)38491720
ns/iter (± 484369
)1.18
parse_and_babelify_backbone
4561697
ns/iter (± 149849
)4345562
ns/iter (± 137491
)1.05
parse_and_babelify_jquery
30479680
ns/iter (± 278502
)29185202
ns/iter (± 265528
)1.04
parse_and_babelify_jquery_mobile
53698854
ns/iter (± 1049052
)49099440
ns/iter (± 908058
)1.09
parse_and_babelify_mootools
27681142
ns/iter (± 160910
)26223602
ns/iter (± 178468
)1.06
parse_and_babelify_underscore
3714557
ns/iter (± 25059
)3672218
ns/iter (± 23012
)1.01
parse_and_babelify_yui
25894731
ns/iter (± 204849
)25060863
ns/iter (± 1568993
)1.03
html/minify/document/css_spec
45793361
ns/iter (± 294584
)45898776
ns/iter (± 261477
)1.00
html/minify/document/github
18186043
ns/iter (± 40206
)18197568
ns/iter (± 54852
)1.00
html/minify/document/stackoverflow
16641889
ns/iter (± 708866
)16575801
ns/iter (± 437346
)1.00
html/minify/document_fragment/css_spec
45833234
ns/iter (± 336098
)44865794
ns/iter (± 248879
)1.02
html/minify/document_fragment/github
18096997
ns/iter (± 104124
)17934543
ns/iter (± 24880
)1.01
html/minify/document_fragment/stackoverflow
16556514
ns/iter (± 80629
)16290168
ns/iter (± 82993
)1.02
html/document/visitor/compare/clone
165226
ns/iter (± 1806
)165896
ns/iter (± 1077
)1.00
html/document/visitor/compare/visit_mut_span
181410
ns/iter (± 2469
)182235
ns/iter (± 1259
)1.00
html/document/visitor/compare/visit_mut_span_panic
187651
ns/iter (± 7278
)186562
ns/iter (± 724
)1.01
html/document/visitor/compare/fold_span
226090
ns/iter (± 712
)227729
ns/iter (± 1433
)0.99
html/document/visitor/compare/fold_span_panic
281098
ns/iter (± 1044
)278832
ns/iter (± 1715
)1.01
html/document_fragment/visitor/compare/clone
168260
ns/iter (± 1537
)166219
ns/iter (± 819
)1.01
html/document_fragment/visitor/compare/visit_mut_span
182245
ns/iter (± 1166
)181303
ns/iter (± 920
)1.01
html/document_fragment/visitor/compare/visit_mut_span_panic
187079
ns/iter (± 1083
)186310
ns/iter (± 758
)1.00
html/document_fragment/visitor/compare/fold_span
228467
ns/iter (± 1298
)231063
ns/iter (± 1178
)0.99
html/document_fragment/visitor/compare/fold_span_panic
279301
ns/iter (± 675
)279025
ns/iter (± 734
)1.00
html/lexer/css_2021_spec
12971035
ns/iter (± 15087
)13014879
ns/iter (± 90336
)1.00
html/lexer/github_com_17_05_2022
4977989
ns/iter (± 9997
)4995179
ns/iter (± 6588
)1.00
html/lexer/stackoverflow_com_17_05_2022
4742002
ns/iter (± 25102
)4744564
ns/iter (± 19612
)1.00
html/parser/parser_document/css_2021_spec
25940034
ns/iter (± 67706
)26043138
ns/iter (± 120447
)1.00
html/parser/parser_document/github_com_17_05_2022
8625199
ns/iter (± 40443
)8588393
ns/iter (± 12878
)1.00
html/parser/parser_document/stackoverflow_com_17_05_2022
7540315
ns/iter (± 26473
)7554263
ns/iter (± 13226
)1.00
html/parser/parser_document_fragment/css_2021_spec
25735709
ns/iter (± 201776
)25723596
ns/iter (± 101320
)1.00
html/parser/parser_document_fragment/github_com_17_05_2022
8693111
ns/iter (± 39959
)8563349
ns/iter (± 23380
)1.02
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7511781
ns/iter (± 15499
)7502298
ns/iter (± 42602
)1.00
This comment was automatically generated by workflow using github-action-benchmark.