-
-
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/module): Add an option to make resolver fully resolve `index.…
…js` (#7945) **Description:** - `jsc.module.resolveFully` is added to support resolving as `.js`. **Related issue:** - Closes #7861 - Closes #7898
- Loading branch information
Showing
32 changed files
with
266 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,6 @@ | |
}, | ||
"module": { | ||
"type": "es6", | ||
"strict": false, | ||
"strictMode": false | ||
}, | ||
"minify": false | ||
} | ||
} |
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
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,18 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript" | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/a": [ | ||
"./packages/a/src/index.ts" | ||
] | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs", | ||
"resolveFully": 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 @@ | ||
import { displayA } from "@print/a"; | ||
|
||
console.log(`${displayA()}`); |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-7xxx/7898/1/input/src/index.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,3 @@ | ||
export function displayA() { | ||
return "Display 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
const _a = require("./packages/a/src/index.js"); | ||
console.log(`${(0, _a.displayA)()}`); |
13 changes: 13 additions & 0 deletions
13
crates/swc/tests/fixture/issues-7xxx/7898/1/output/src/index.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,13 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayA", { | ||
enumerable: true, | ||
get: function() { | ||
return displayA; | ||
} | ||
}); | ||
function displayA() { | ||
return "Display 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript" | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/a": ["./packages/a/src/index.ts"] | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-7xxx/7898/2/input/packages/a/src/index.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,3 @@ | ||
export function displayA() { | ||
return "Display A"; | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-7xxx/7898/2/input/src/index.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,3 @@ | ||
import { displayA } from "@print/a"; | ||
|
||
console.log(`${displayA()}`); |
Oops, something went wrong.
7e8d72d
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
285293
ns/iter (± 9546
)284271
ns/iter (± 9470
)1.00
es/full/minify/libraries/antd
1307296262
ns/iter (± 15210962
)1311410939
ns/iter (± 11917629
)1.00
es/full/minify/libraries/d3
275492908
ns/iter (± 5889773
)271836234
ns/iter (± 4913074
)1.01
es/full/minify/libraries/echarts
1053814591
ns/iter (± 6269158
)1038578275
ns/iter (± 9535148
)1.01
es/full/minify/libraries/jquery
83982419
ns/iter (± 173497
)83637176
ns/iter (± 164179
)1.00
es/full/minify/libraries/lodash
96651087
ns/iter (± 266382
)97236760
ns/iter (± 400228
)0.99
es/full/minify/libraries/moment
49592144
ns/iter (± 46179
)49998393
ns/iter (± 167760
)0.99
es/full/minify/libraries/react
17925904
ns/iter (± 23651
)17984402
ns/iter (± 55740
)1.00
es/full/minify/libraries/terser
216787436
ns/iter (± 572698
)216192023
ns/iter (± 683243
)1.00
es/full/minify/libraries/three
381039701
ns/iter (± 1791402
)381695700
ns/iter (± 975099
)1.00
es/full/minify/libraries/typescript
2623359961
ns/iter (± 6521591
)2640079138
ns/iter (± 20884423
)0.99
es/full/minify/libraries/victory
563447232
ns/iter (± 2734796
)559822482
ns/iter (± 7464891
)1.01
es/full/minify/libraries/vue
118782752
ns/iter (± 355270
)118599385
ns/iter (± 310238
)1.00
es/full/codegen/es3
34151
ns/iter (± 125
)34597
ns/iter (± 94
)0.99
es/full/codegen/es5
34160
ns/iter (± 119
)34546
ns/iter (± 71
)0.99
es/full/codegen/es2015
34168
ns/iter (± 95
)34630
ns/iter (± 53
)0.99
es/full/codegen/es2016
34118
ns/iter (± 128
)34548
ns/iter (± 99
)0.99
es/full/codegen/es2017
34083
ns/iter (± 126
)34580
ns/iter (± 134
)0.99
es/full/codegen/es2018
34106
ns/iter (± 117
)34654
ns/iter (± 229
)0.98
es/full/codegen/es2019
34123
ns/iter (± 73
)34624
ns/iter (± 115
)0.99
es/full/codegen/es2020
34144
ns/iter (± 104
)34635
ns/iter (± 80
)0.99
es/full/all/es3
169748439
ns/iter (± 1038063
)170501516
ns/iter (± 1458958
)1.00
es/full/all/es5
161616997
ns/iter (± 1471914
)161344709
ns/iter (± 911095
)1.00
es/full/all/es2015
121368227
ns/iter (± 657757
)120686963
ns/iter (± 423598
)1.01
es/full/all/es2016
119576258
ns/iter (± 1000317
)119810408
ns/iter (± 661741
)1.00
es/full/all/es2017
119269054
ns/iter (± 799090
)119751063
ns/iter (± 702624
)1.00
es/full/all/es2018
116798943
ns/iter (± 553823
)116764353
ns/iter (± 1075834
)1.00
es/full/all/es2019
116843917
ns/iter (± 805350
)116416187
ns/iter (± 624481
)1.00
es/full/all/es2020
112916601
ns/iter (± 528551
)112478501
ns/iter (± 708523
)1.00
es/full/parser
492575
ns/iter (± 7449
)492697
ns/iter (± 5386
)1.00
es/full/base/fixer
17997
ns/iter (± 51
)17494
ns/iter (± 80
)1.03
es/full/base/resolver_and_hygiene
79114
ns/iter (± 145
)81252
ns/iter (± 187
)0.97
serialization of serde
285
ns/iter (± 5
)292
ns/iter (± 0
)0.98
css/minify/libraries/bootstrap
29489790
ns/iter (± 153856
)29482659
ns/iter (± 96334
)1.00
css/visitor/compare/clone
1668600
ns/iter (± 2239
)1669060
ns/iter (± 4543
)1.00
css/visitor/compare/visit_mut_span
1780836
ns/iter (± 4231
)1788613
ns/iter (± 9409
)1.00
css/visitor/compare/visit_mut_span_panic
1840406
ns/iter (± 4921
)1862995
ns/iter (± 8287
)0.99
css/visitor/compare/fold_span
2563500
ns/iter (± 5194
)2580479
ns/iter (± 11280
)0.99
css/visitor/compare/fold_span_panic
2750061
ns/iter (± 10883
)2775565
ns/iter (± 8577
)0.99
css/lexer/bootstrap_5_1_3
4386985
ns/iter (± 5295
)4477557
ns/iter (± 17451
)0.98
css/lexer/foundation_6_7_4
3689126
ns/iter (± 1567
)3770274
ns/iter (± 7280
)0.98
css/lexer/tailwind_3_1_1
701842
ns/iter (± 282
)719856
ns/iter (± 1399
)0.97
css/parser/bootstrap_5_1_3
19206662
ns/iter (± 29258
)19767349
ns/iter (± 31762
)0.97
css/parser/foundation_6_7_4
15141551
ns/iter (± 32688
)15490660
ns/iter (± 25436
)0.98
css/parser/tailwind_3_1_1
2916344
ns/iter (± 2883
)3028942
ns/iter (± 2427
)0.96
es/codegen/colors
727221
ns/iter (± 395891
)727698
ns/iter (± 396549
)1.00
es/codegen/large
3132555
ns/iter (± 1664527
)3144628
ns/iter (± 1667572
)1.00
es/codegen/with-parser/colors
44419
ns/iter (± 489
)45757
ns/iter (± 216
)0.97
es/codegen/with-parser/large
485913
ns/iter (± 522
)491938
ns/iter (± 1571
)0.99
es/minify/libraries/antd
1128608039
ns/iter (± 9760872
)1124576494
ns/iter (± 8294225
)1.00
es/minify/libraries/d3
236909459
ns/iter (± 416706
)237349071
ns/iter (± 476614
)1.00
es/minify/libraries/echarts
880956752
ns/iter (± 1209574
)889034145
ns/iter (± 7709722
)0.99
es/minify/libraries/jquery
72889534
ns/iter (± 128730
)73724500
ns/iter (± 262288
)0.99
es/minify/libraries/lodash
87177546
ns/iter (± 312187
)86387324
ns/iter (± 291927
)1.01
es/minify/libraries/moment
43337801
ns/iter (± 78203
)43531499
ns/iter (± 91611
)1.00
es/minify/libraries/react
15949007
ns/iter (± 32598
)15972194
ns/iter (± 49533
)1.00
es/minify/libraries/terser
182824510
ns/iter (± 263581
)184984941
ns/iter (± 1028381
)0.99
es/minify/libraries/three
315528255
ns/iter (± 1010794
)319369161
ns/iter (± 1555146
)0.99
es/minify/libraries/typescript
2184459454
ns/iter (± 8738171
)2225240826
ns/iter (± 9019324
)0.98
es/minify/libraries/victory
467913740
ns/iter (± 1126304
)468551206
ns/iter (± 10829534
)1.00
es/minify/libraries/vue
105333693
ns/iter (± 263659
)106668535
ns/iter (± 352153
)0.99
es/visitor/compare/clone
1950087
ns/iter (± 8466
)1951922
ns/iter (± 12371
)1.00
es/visitor/compare/visit_mut_span
2260405
ns/iter (± 3484
)2283128
ns/iter (± 31791
)0.99
es/visitor/compare/visit_mut_span_panic
2311991
ns/iter (± 1986
)2328793
ns/iter (± 3145
)0.99
es/visitor/compare/fold_span
3329759
ns/iter (± 5482
)3392756
ns/iter (± 8169
)0.98
es/visitor/compare/fold_span_panic
3496985
ns/iter (± 6867
)3524562
ns/iter (± 5312
)0.99
es/lexer/colors
13039
ns/iter (± 9
)13025
ns/iter (± 32
)1.00
es/lexer/angular
6079440
ns/iter (± 3935
)6034211
ns/iter (± 1722
)1.01
es/lexer/backbone
787542
ns/iter (± 1609
)785455
ns/iter (± 1865
)1.00
es/lexer/jquery
4480607
ns/iter (± 3942
)4449954
ns/iter (± 6708
)1.01
es/lexer/jquery mobile
6852983
ns/iter (± 14544
)6831372
ns/iter (± 4718
)1.00
es/lexer/mootools
3556743
ns/iter (± 2937
)3555412
ns/iter (± 2882
)1.00
es/lexer/underscore
663742
ns/iter (± 1943
)657245
ns/iter (± 276
)1.01
es/lexer/three
21488264
ns/iter (± 9321
)21253163
ns/iter (± 16819
)1.01
es/lexer/yui
3850876
ns/iter (± 3933
)3825512
ns/iter (± 2512
)1.01
es/parser/colors
27127
ns/iter (± 52
)28025
ns/iter (± 63
)0.97
es/parser/angular
13422093
ns/iter (± 48910
)13599637
ns/iter (± 70818
)0.99
es/parser/backbone
1960763
ns/iter (± 14235
)1996560
ns/iter (± 8473
)0.98
es/parser/jquery
10717540
ns/iter (± 48012
)10890970
ns/iter (± 41498
)0.98
es/parser/jquery mobile
16493680
ns/iter (± 65033
)16703974
ns/iter (± 87391
)0.99
es/parser/mootools
8257864
ns/iter (± 17409
)8389579
ns/iter (± 14416
)0.98
es/parser/underscore
1696468
ns/iter (± 9071
)1719562
ns/iter (± 8824
)0.99
es/parser/three
46103985
ns/iter (± 104683
)46748590
ns/iter (± 93375
)0.99
es/parser/yui
8234280
ns/iter (± 40936
)8292622
ns/iter (± 29405
)0.99
es/preset-env/usage/builtin_type
137466
ns/iter (± 32637
)137942
ns/iter (± 32867
)1.00
es/preset-env/usage/property
16914
ns/iter (± 29
)16595
ns/iter (± 64
)1.02
es/resolver/typescript
88794346
ns/iter (± 1046854
)90878950
ns/iter (± 761530
)0.98
es/fixer/typescript
63467963
ns/iter (± 540378
)63874927
ns/iter (± 657112
)0.99
es/hygiene/typescript
130006671
ns/iter (± 1025850
)130552054
ns/iter (± 555814
)1.00
es/resolver_with_hygiene/typescript
242761061
ns/iter (± 2385110
)240644468
ns/iter (± 1030574
)1.01
es/visitor/base-perf/module_clone
58491
ns/iter (± 361
)58793
ns/iter (± 1248
)0.99
es/visitor/base-perf/fold_empty
62857
ns/iter (± 320
)62573
ns/iter (± 495
)1.00
es/visitor/base-perf/fold_noop_impl_all
63024
ns/iter (± 280
)63838
ns/iter (± 219
)0.99
es/visitor/base-perf/fold_noop_impl_vec
62988
ns/iter (± 384
)63880
ns/iter (± 160
)0.99
es/visitor/base-perf/boxing_boxed_clone
56
ns/iter (± 0
)56
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed_clone
42
ns/iter (± 0
)40
ns/iter (± 0
)1.05
es/visitor/base-perf/boxing_boxed
107
ns/iter (± 0
)106
ns/iter (± 0
)1.01
es/visitor/base-perf/boxing_unboxed
77
ns/iter (± 0
)76
ns/iter (± 0
)1.01
es/visitor/base-perf/visit_empty
0
ns/iter (± 0
)0
ns/iter (± 0
)NaN
es/visitor/base-perf/visit_contains_this
2523
ns/iter (± 45
)2509
ns/iter (± 15
)1.01
es/base/parallel/resolver/typescript
3895339782
ns/iter (± 301217749
)3762004552
ns/iter (± 229125836
)1.04
es/base/parallel/hygiene/typescript
1464736766
ns/iter (± 31208135
)1461261398
ns/iter (± 28268064
)1.00
misc/visitors/time-complexity/time 5
153
ns/iter (± 3
)150
ns/iter (± 2
)1.02
misc/visitors/time-complexity/time 10
421
ns/iter (± 1
)421
ns/iter (± 31
)1
misc/visitors/time-complexity/time 15
772
ns/iter (± 54
)798
ns/iter (± 100
)0.97
misc/visitors/time-complexity/time 20
1283
ns/iter (± 1
)1438
ns/iter (± 4
)0.89
misc/visitors/time-complexity/time 40
4329
ns/iter (± 6
)4348
ns/iter (± 249
)1.00
misc/visitors/time-complexity/time 60
9041
ns/iter (± 9
)9007
ns/iter (± 311
)1.00
es/full-target/es2016
235957
ns/iter (± 4063
)234651
ns/iter (± 1032
)1.01
es/full-target/es2017
223260
ns/iter (± 603
)223578
ns/iter (± 1045
)1.00
es/full-target/es2018
212141
ns/iter (± 537
)211793
ns/iter (± 496
)1.00
es2020_nullish_coalescing
70941
ns/iter (± 474
)72506
ns/iter (± 532
)0.98
es2020_optional_chaining
78927
ns/iter (± 348
)80812
ns/iter (± 231
)0.98
es2022_class_properties
115915
ns/iter (± 637
)118033
ns/iter (± 349
)0.98
es2018_object_rest_spread
74484
ns/iter (± 346
)77315
ns/iter (± 310
)0.96
es2019_optional_catch_binding
64899
ns/iter (± 246
)65820
ns/iter (± 428
)0.99
es2017_async_to_generator
64201
ns/iter (± 229
)65821
ns/iter (± 227
)0.98
es2016_exponentiation
68017
ns/iter (± 216
)69712
ns/iter (± 223
)0.98
es2015_arrow
71897
ns/iter (± 174
)72921
ns/iter (± 816
)0.99
es2015_block_scoped_fn
68167
ns/iter (± 777
)69639
ns/iter (± 200
)0.98
es2015_block_scoping
123398
ns/iter (± 639
)124870
ns/iter (± 4168
)0.99
This comment was automatically generated by workflow using github-action-benchmark.