Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/modules): Preserve extensions (#6339)
**Related issue:** - Closes #6209.
- Loading branch information
Showing
22 changed files
with
57 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import styles from "./foo.ts/index"; | ||
import styles from "./foo.ts/index.js"; | ||
console.log(styles); |
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
2 changes: 1 addition & 1 deletion
2
crates/swc/tests/fixture/deno/paths/issue-3447/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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { sum } from "./modules/01-moduleA/utils"; | ||
import { sum } from "./modules/01-moduleA/utils.ts"; | ||
export { multiply } from "./modules/03-moduleB/utils"; | ||
console.log(sum(1, 2)); |
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,2 @@ | ||
import styles from "./src/foo.bar.baz"; | ||
import styles from "./src/foo.bar.baz.js"; | ||
console.log(styles); |
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,17 @@ | ||
{ | ||
"jsc": { | ||
"baseUrl": "./src", | ||
"paths": { | ||
"@modules/*": [ | ||
"./modules/*" | ||
] | ||
}, | ||
"target": "es2020", | ||
"parser": { | ||
"syntax": "typescript" | ||
} | ||
}, | ||
"module": { | ||
"type": "es6" | ||
} | ||
} |
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,5 @@ | ||
import { modulo } from '@modules/style.module.less' | ||
import { sum } from './sum.js' | ||
|
||
console.log(modulo) | ||
console.log(sum) |
Empty file.
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,5 @@ | ||
|
||
|
||
export function sum(a: number, b: number) { | ||
return a + b; | ||
} |
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,4 @@ | ||
import { modulo } from "./src/modules/style.module.less"; | ||
import { sum } from "./sum.js"; | ||
console.log(modulo); | ||
console.log(sum); |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-6xxx/6209/1/output/src/sum.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 sum(a, b) { | ||
return a + b; | ||
} |
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_transforms_module/tests/fixture-manual/issue-4730/output/index.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
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4532/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./rel.js"; | ||
import "./rel.ts"; |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4585/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./src/feat.js"; | ||
import "./src/feat.ts"; |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4605/1/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./src/rel.decorator.js"; | ||
import "./src/rel.decorator.ts"; |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4605/2/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./src/rel.decorator"; | ||
import "./src/rel.decorator.ts"; |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4619/1/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./src/rel.decorator.js"; | ||
import "./src/rel.decorator.ts"; |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/paths/issue-4619/2/output/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 |
---|---|---|
@@ -1 +1 @@ | ||
import "./src/rel.decorator"; | ||
import "./src/rel.decorator.ts"; |
91e863c
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
331718
ns/iter (± 25706
)338527
ns/iter (± 24360
)0.98
es/full/minify/libraries/antd
1797724119
ns/iter (± 29929586
)1833379374
ns/iter (± 21082279
)0.98
es/full/minify/libraries/d3
399097051
ns/iter (± 18322773
)398937604
ns/iter (± 12891610
)1.00
es/full/minify/libraries/echarts
1546475600
ns/iter (± 140472343
)1578242949
ns/iter (± 52008559
)0.98
es/full/minify/libraries/jquery
101777121
ns/iter (± 7311339
)106063482
ns/iter (± 4437550
)0.96
es/full/minify/libraries/lodash
125573295
ns/iter (± 6061870
)124068263
ns/iter (± 5828124
)1.01
es/full/minify/libraries/moment
60778087
ns/iter (± 7937619
)64736929
ns/iter (± 2590095
)0.94
es/full/minify/libraries/react
22417839
ns/iter (± 1431694
)22038563
ns/iter (± 4121609
)1.02
es/full/minify/libraries/terser
320516010
ns/iter (± 10258579
)333585064
ns/iter (± 34300381
)0.96
es/full/minify/libraries/three
953904644
ns/iter (± 268307073
)581825185
ns/iter (± 72716746
)1.64
es/full/minify/libraries/typescript
3537087713
ns/iter (± 103404925
)3645247424
ns/iter (± 324550789
)0.97
es/full/minify/libraries/victory
865248442
ns/iter (± 32840423
)873732272
ns/iter (± 25670948
)0.99
es/full/minify/libraries/vue
156936916
ns/iter (± 5571299
)172703773
ns/iter (± 35590215
)0.91
es/full/codegen/es3
36596
ns/iter (± 4930
)34601
ns/iter (± 2101
)1.06
es/full/codegen/es5
37307
ns/iter (± 3577
)35332
ns/iter (± 2179
)1.06
es/full/codegen/es2015
35756
ns/iter (± 2719
)35445
ns/iter (± 2615
)1.01
es/full/codegen/es2016
35527
ns/iter (± 3693
)35474
ns/iter (± 2604
)1.00
es/full/codegen/es2017
35893
ns/iter (± 3095
)35534
ns/iter (± 3290
)1.01
es/full/codegen/es2018
36236
ns/iter (± 4123
)34364
ns/iter (± 1932
)1.05
es/full/codegen/es2019
36527
ns/iter (± 7382
)34865
ns/iter (± 2110
)1.05
es/full/codegen/es2020
36463
ns/iter (± 3583
)35151
ns/iter (± 2926
)1.04
es/full/all/es3
198386225
ns/iter (± 23539440
)237190192
ns/iter (± 27753241
)0.84
es/full/all/es5
190593913
ns/iter (± 14371935
)207843771
ns/iter (± 21580109
)0.92
es/full/all/es2015
150663018
ns/iter (± 10158280
)161634105
ns/iter (± 22635752
)0.93
es/full/all/es2016
147370427
ns/iter (± 13320523
)155208364
ns/iter (± 29529765
)0.95
es/full/all/es2017
148639673
ns/iter (± 12020115
)164248786
ns/iter (± 21341861
)0.90
es/full/all/es2018
144693007
ns/iter (± 10288206
)161512573
ns/iter (± 14838808
)0.90
es/full/all/es2019
145812194
ns/iter (± 11858368
)162666550
ns/iter (± 13698305
)0.90
es/full/all/es2020
142579621
ns/iter (± 14618600
)148743953
ns/iter (± 18428633
)0.96
es/full/parser
738612
ns/iter (± 87332
)733115
ns/iter (± 46407
)1.01
es/full/base/fixer
29274
ns/iter (± 3921
)26756
ns/iter (± 868
)1.09
es/full/base/resolver_and_hygiene
96502
ns/iter (± 15391
)95018
ns/iter (± 2854
)1.02
serialization of ast node
235
ns/iter (± 32
)215
ns/iter (± 7
)1.09
serialization of serde
218
ns/iter (± 30
)219
ns/iter (± 12
)1.00
This comment was automatically generated by workflow using github-action-benchmark.