-
-
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.
fix(es/modules): Hint nodejs for multiple
export *
(#7184)
- Loading branch information
1 parent
b94fbed
commit 98f1493
Showing
6 changed files
with
65 additions
and
29 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
2 changes: 2 additions & 0 deletions
2
crates/swc_ecma_transforms_module/tests/fixture/common/issue-7180/input.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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./fn.js"; | ||
export * from "./fn2.js"; |
3 changes: 3 additions & 0 deletions
3
crates/swc_ecma_transforms_module/tests/fixture/common/issue-7180/module.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,3 @@ | ||
{ | ||
"importInterop": "node" | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/swc_ecma_transforms_module/tests/fixture/common/issue-7180/output.amd.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
define([ | ||
"require", | ||
"exports", | ||
"./fn.js", | ||
"./fn2.js" | ||
], function(require, exports, _fn, _fn2) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
_export_star(_fn, exports); | ||
_export_star(_fn2, exports); | ||
}); |
7 changes: 7 additions & 0 deletions
7
crates/swc_ecma_transforms_module/tests/fixture/common/issue-7180/output.cjs
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,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
0 && __export(require("./fn.js")) && __export(require("./fn2.js")); | ||
_export_star(require("./fn.js"), exports); | ||
_export_star(require("./fn2.js"), exports); |
16 changes: 16 additions & 0 deletions
16
crates/swc_ecma_transforms_module/tests/fixture/common/issue-7180/output.umd.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(function(global, factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") factory(exports, require("./fn.js"), require("./fn2.js")); | ||
else if (typeof define === "function" && define.amd) define([ | ||
"exports", | ||
"./fn.js", | ||
"./fn2.js" | ||
], factory); | ||
else if (global = typeof globalThis !== "undefined" ? globalThis : global || self) factory(global.input = {}, global.fnJs, global.fn2Js); | ||
})(this, function(exports, _fn, _fn2) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
_export_star(_fn, exports); | ||
_export_star(_fn2, exports); | ||
}); |
98f1493
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
319640
ns/iter (± 7150
)305783
ns/iter (± 5371
)1.05
es/full/minify/libraries/antd
1726344554
ns/iter (± 10561559
)2051241811
ns/iter (± 7018537
)0.84
es/full/minify/libraries/d3
323931996
ns/iter (± 4661319
)366574943
ns/iter (± 6254900
)0.88
es/full/minify/libraries/echarts
1325201138
ns/iter (± 8392097
)1520970095
ns/iter (± 12436955
)0.87
es/full/minify/libraries/jquery
100419271
ns/iter (± 2201704
)99548807
ns/iter (± 2076264
)1.01
es/full/minify/libraries/lodash
114339196
ns/iter (± 2217249
)117125698
ns/iter (± 1691830
)0.98
es/full/minify/libraries/moment
57279717
ns/iter (± 1159558
)57126412
ns/iter (± 2178415
)1.00
es/full/minify/libraries/react
20530480
ns/iter (± 388203
)20518424
ns/iter (± 387997
)1.00
es/full/minify/libraries/terser
281659173
ns/iter (± 3220533
)301623969
ns/iter (± 5918952
)0.93
es/full/minify/libraries/three
514723601
ns/iter (± 8546985
)548199843
ns/iter (± 7709929
)0.94
es/full/minify/libraries/typescript
3214993155
ns/iter (± 39668692
)3722604726
ns/iter (± 31764741
)0.86
es/full/minify/libraries/victory
744374271
ns/iter (± 12072637
)853062363
ns/iter (± 14169649
)0.87
es/full/minify/libraries/vue
146259233
ns/iter (± 1401424
)154752832
ns/iter (± 6119920
)0.95
es/full/codegen/es3
28788
ns/iter (± 94
)28418
ns/iter (± 86
)1.01
es/full/codegen/es5
28822
ns/iter (± 55
)28599
ns/iter (± 59
)1.01
es/full/codegen/es2015
28817
ns/iter (± 61
)28556
ns/iter (± 41
)1.01
es/full/codegen/es2016
28841
ns/iter (± 63
)28639
ns/iter (± 68
)1.01
es/full/codegen/es2017
28863
ns/iter (± 48
)28543
ns/iter (± 52
)1.01
es/full/codegen/es2018
28796
ns/iter (± 55
)28525
ns/iter (± 66
)1.01
es/full/codegen/es2019
28863
ns/iter (± 51
)28562
ns/iter (± 64
)1.01
es/full/codegen/es2020
28838
ns/iter (± 49
)28509
ns/iter (± 80
)1.01
es/full/all/es3
181173783
ns/iter (± 4573435
)189007155
ns/iter (± 5676687
)0.96
es/full/all/es5
173563835
ns/iter (± 3461751
)178907575
ns/iter (± 4038147
)0.97
es/full/all/es2015
133250644
ns/iter (± 2618505
)140336427
ns/iter (± 3165896
)0.95
es/full/all/es2016
134658935
ns/iter (± 3663162
)138515491
ns/iter (± 2263637
)0.97
es/full/all/es2017
131076265
ns/iter (± 2336010
)136238988
ns/iter (± 1729545
)0.96
es/full/all/es2018
126530134
ns/iter (± 1018461
)128316690
ns/iter (± 3477344
)0.99
es/full/all/es2019
125942342
ns/iter (± 982743
)124174161
ns/iter (± 1846689
)1.01
es/full/all/es2020
118520078
ns/iter (± 1078796
)117458709
ns/iter (± 302657
)1.01
es/full/parser
518430
ns/iter (± 9278
)524368
ns/iter (± 10230
)0.99
es/full/base/fixer
22659
ns/iter (± 31
)22641
ns/iter (± 58
)1.00
es/full/base/resolver_and_hygiene
85357
ns/iter (± 84
)84026
ns/iter (± 94
)1.02
serialization of serde
126
ns/iter (± 0
)122
ns/iter (± 0
)1.03
css/minify/libraries/bootstrap
28550237
ns/iter (± 206194
)29041274
ns/iter (± 307777
)0.98
css/visitor/compare/clone
2135819
ns/iter (± 17211
)2103695
ns/iter (± 21466
)1.02
css/visitor/compare/visit_mut_span
2363945
ns/iter (± 10295
)2329832
ns/iter (± 17666
)1.01
css/visitor/compare/visit_mut_span_panic
2381459
ns/iter (± 4263
)2365803
ns/iter (± 8940
)1.01
css/visitor/compare/fold_span
3097252
ns/iter (± 24038
)3091239
ns/iter (± 25737
)1.00
css/visitor/compare/fold_span_panic
3288468
ns/iter (± 14268
)3234510
ns/iter (± 14731
)1.02
css/lexer/bootstrap_5_1_3
5127739
ns/iter (± 17179
)5176421
ns/iter (± 12097
)0.99
css/lexer/foundation_6_7_4
4315051
ns/iter (± 2953
)4340825
ns/iter (± 4561
)0.99
css/lexer/tailwind_3_1_1
820416
ns/iter (± 467
)824749
ns/iter (± 461
)0.99
css/parser/bootstrap_5_1_3
21912567
ns/iter (± 106670
)21745236
ns/iter (± 338099
)1.01
css/parser/foundation_6_7_4
17243412
ns/iter (± 78088
)17039303
ns/iter (± 77605
)1.01
css/parser/tailwind_3_1_1
3208342
ns/iter (± 5229
)3242858
ns/iter (± 4459
)0.99
es/codegen/colors
319195
ns/iter (± 179658
)325550
ns/iter (± 184812
)0.98
es/codegen/large
1108834
ns/iter (± 553706
)1086381
ns/iter (± 551739
)1.02
es/codegen/with-parser/colors
47391
ns/iter (± 104
)47548
ns/iter (± 364
)1.00
es/codegen/with-parser/large
510664
ns/iter (± 1650
)506991
ns/iter (± 1190
)1.01
es/minify/libraries/antd
1554411977
ns/iter (± 21720740
)1655837205
ns/iter (± 21191317
)0.94
es/minify/libraries/d3
283503715
ns/iter (± 3056566
)268396120
ns/iter (± 5119948
)1.06
es/minify/libraries/echarts
1147105523
ns/iter (± 7195882
)1225017787
ns/iter (± 24007826
)0.94
es/minify/libraries/jquery
85285603
ns/iter (± 887372
)81002677
ns/iter (± 648584
)1.05
es/minify/libraries/lodash
101769111
ns/iter (± 1910453
)96328468
ns/iter (± 1325968
)1.06
es/minify/libraries/moment
47037527
ns/iter (± 496431
)46373797
ns/iter (± 494555
)1.01
es/minify/libraries/react
17721400
ns/iter (± 217209
)17164054
ns/iter (± 123603
)1.03
es/minify/libraries/terser
227810590
ns/iter (± 2176494
)215609841
ns/iter (± 4406676
)1.06
es/minify/libraries/three
409644998
ns/iter (± 6446489
)389611636
ns/iter (± 13066900
)1.05
es/minify/libraries/typescript
2710772256
ns/iter (± 16365195
)3015076672
ns/iter (± 18971370
)0.90
es/minify/libraries/victory
643034972
ns/iter (± 7629931
)644739874
ns/iter (± 18289504
)1.00
es/minify/libraries/vue
120150639
ns/iter (± 1564301
)118512921
ns/iter (± 2064469
)1.01
es/visitor/compare/clone
2361211
ns/iter (± 16070
)2323899
ns/iter (± 11130
)1.02
es/visitor/compare/visit_mut_span
2723003
ns/iter (± 8174
)2694036
ns/iter (± 14588
)1.01
es/visitor/compare/visit_mut_span_panic
2782484
ns/iter (± 12330
)2734087
ns/iter (± 9131
)1.02
es/visitor/compare/fold_span
3850667
ns/iter (± 21907
)3816304
ns/iter (± 10282
)1.01
es/visitor/compare/fold_span_panic
4016819
ns/iter (± 58524
)3942742
ns/iter (± 13311
)1.02
es/lexer/colors
13100
ns/iter (± 15
)12983
ns/iter (± 7
)1.01
es/lexer/angular
6407649
ns/iter (± 3214
)6319167
ns/iter (± 4542
)1.01
es/lexer/backbone
767754
ns/iter (± 600
)778485
ns/iter (± 624
)0.99
es/lexer/jquery
4326775
ns/iter (± 6123
)4376068
ns/iter (± 4345
)0.99
es/lexer/jquery mobile
6768438
ns/iter (± 5453
)6822463
ns/iter (± 5144
)0.99
es/lexer/mootools
3411408
ns/iter (± 24834
)3421304
ns/iter (± 1383
)1.00
es/lexer/underscore
633554
ns/iter (± 383
)643676
ns/iter (± 434
)0.98
es/lexer/three
20588356
ns/iter (± 12252
)20619824
ns/iter (± 18783
)1.00
es/lexer/yui
3835597
ns/iter (± 5982
)3824935
ns/iter (± 1447
)1.00
es/parser/colors
28620
ns/iter (± 148
)29193
ns/iter (± 56
)0.98
es/parser/angular
15831337
ns/iter (± 292628
)15427769
ns/iter (± 173525
)1.03
es/parser/backbone
2154059
ns/iter (± 10522
)2150035
ns/iter (± 14153
)1.00
es/parser/jquery
11994324
ns/iter (± 384937
)11790076
ns/iter (± 157749
)1.02
es/parser/jquery mobile
19689832
ns/iter (± 208056
)19093192
ns/iter (± 633575
)1.03
es/parser/mootools
8950141
ns/iter (± 64218
)8925181
ns/iter (± 47505
)1.00
es/parser/underscore
1810161
ns/iter (± 8761
)1814090
ns/iter (± 11673
)1.00
es/parser/three
56262059
ns/iter (± 688752
)57421313
ns/iter (± 1138762
)0.98
es/parser/yui
9119986
ns/iter (± 68342
)9089119
ns/iter (± 91199
)1.00
es/preset-env/usage/builtin_type
143545
ns/iter (± 33774
)144818
ns/iter (± 34607
)0.99
es/preset-env/usage/property
20390
ns/iter (± 90
)20869
ns/iter (± 129
)0.98
es/resolver/typescript
127056930
ns/iter (± 4015100
)138556546
ns/iter (± 2895172
)0.92
es/fixer/typescript
86912428
ns/iter (± 470601
)99084867
ns/iter (± 3204541
)0.88
es/hygiene/typescript
200724923
ns/iter (± 2274196
)209211572
ns/iter (± 3302341
)0.96
es/resolver_with_hygiene/typescript
338863316
ns/iter (± 776061
)368463699
ns/iter (± 4166006
)0.92
es/visitor/base-perf/module_clone
80751
ns/iter (± 369
)81174
ns/iter (± 1623
)0.99
es/visitor/base-perf/fold_empty
90949
ns/iter (± 395
)91007
ns/iter (± 359
)1.00
es/visitor/base-perf/fold_noop_impl_all
90880
ns/iter (± 484
)91037
ns/iter (± 374
)1.00
es/visitor/base-perf/fold_noop_impl_vec
91747
ns/iter (± 349
)91404
ns/iter (± 315
)1.00
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
)41
ns/iter (± 0
)1.02
es/visitor/base-perf/boxing_boxed
105
ns/iter (± 0
)102
ns/iter (± 0
)1.03
es/visitor/base-perf/boxing_unboxed
80
ns/iter (± 0
)78
ns/iter (± 0
)1.03
es/visitor/base-perf/visit_contains_this
3356
ns/iter (± 81
)3629
ns/iter (± 47
)0.92
es/base/parallel/resolver/typescript
5758831979
ns/iter (± 543405085
)6976906749
ns/iter (± 722281651
)0.83
es/base/parallel/hygiene/typescript
2253374882
ns/iter (± 25398573
)2578773160
ns/iter (± 24096584
)0.87
misc/visitors/time-complexity/time 5
105
ns/iter (± 10
)103
ns/iter (± 0
)1.02
misc/visitors/time-complexity/time 10
326
ns/iter (± 0
)349
ns/iter (± 5
)0.93
misc/visitors/time-complexity/time 15
661
ns/iter (± 8
)659
ns/iter (± 1
)1.00
misc/visitors/time-complexity/time 20
1221
ns/iter (± 2
)1230
ns/iter (± 10
)0.99
misc/visitors/time-complexity/time 40
6200
ns/iter (± 14
)6720
ns/iter (± 44
)0.92
misc/visitors/time-complexity/time 60
15577
ns/iter (± 11
)17205
ns/iter (± 116
)0.91
es/full-target/es2016
253256
ns/iter (± 378
)252713
ns/iter (± 454
)1.00
es/full-target/es2017
246019
ns/iter (± 329
)245969
ns/iter (± 533
)1.00
es/full-target/es2018
234988
ns/iter (± 240
)235368
ns/iter (± 414
)1.00
es2020_nullish_coalescing
92697
ns/iter (± 267
)92631
ns/iter (± 377
)1.00
es2020_optional_chaining
124239
ns/iter (± 215
)124659
ns/iter (± 356
)1.00
es2022_class_properties
147928
ns/iter (± 251
)149055
ns/iter (± 235
)0.99
es2018_object_rest_spread
96590
ns/iter (± 251
)96126
ns/iter (± 230
)1.00
es2019_optional_catch_binding
85373
ns/iter (± 140
)85255
ns/iter (± 191
)1.00
es2017_async_to_generator
85953
ns/iter (± 176
)85931
ns/iter (± 306
)1.00
es2016_exponentiation
90452
ns/iter (± 100
)90395
ns/iter (± 232
)1.00
es2015_arrow
94191
ns/iter (± 255
)93683
ns/iter (± 204
)1.01
es2015_block_scoped_fn
92120
ns/iter (± 307
)92080
ns/iter (± 241
)1.00
es2015_block_scoping
169871
ns/iter (± 430
)170221
ns/iter (± 271
)1.00
This comment was automatically generated by workflow using github-action-benchmark.