Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(es/transforms): Add tests about preserving top-level directives (#…
- Loading branch information
Showing
9 changed files
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"jsc": { | ||
"target": "es5" | ||
} | ||
} |
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 @@ | ||
'use client'; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use client"; | ||
foo(function() {}); |
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 @@ | ||
{ | ||
"jsc": { | ||
"target": "es5" | ||
} | ||
} |
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 client'; | ||
|
||
|
||
export class Foo { | ||
foo() { } | ||
} |
16 changes: 16 additions & 0 deletions
16
crates/swc/tests/fixture/issues-6xxx/6508/2/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; | ||
import _create_class from "@swc/helpers/src/_create_class.mjs"; | ||
export var Foo = /*#__PURE__*/ function() { | ||
"use strict"; | ||
function Foo() { | ||
_class_call_check(this, Foo); | ||
} | ||
_create_class(Foo, [ | ||
{ | ||
key: "foo", | ||
value: function foo() {} | ||
} | ||
]); | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"jsc": { | ||
"target": "es5" | ||
} | ||
} |
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 client'; | ||
|
||
|
||
export var Foo = { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"use client"; | ||
export var Foo = { | ||
foo: function foo() {} | ||
}; |
5ff87af
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
350392
ns/iter (± 19448
)337018
ns/iter (± 23821
)1.04
es/full/minify/libraries/antd
1898511211
ns/iter (± 581464156
)1824084094
ns/iter (± 28162162
)1.04
es/full/minify/libraries/d3
450979526
ns/iter (± 31006042
)396307461
ns/iter (± 12007412
)1.14
es/full/minify/libraries/echarts
1601978219
ns/iter (± 28667172
)1536350144
ns/iter (± 13331888
)1.04
es/full/minify/libraries/jquery
109828185
ns/iter (± 8901921
)100956948
ns/iter (± 1977683
)1.09
es/full/minify/libraries/lodash
132062228
ns/iter (± 11987289
)117639679
ns/iter (± 19394211
)1.12
es/full/minify/libraries/moment
63197456
ns/iter (± 2657598
)58583824
ns/iter (± 2582839
)1.08
es/full/minify/libraries/react
21380738
ns/iter (± 527387
)20068648
ns/iter (± 867257
)1.07
es/full/minify/libraries/terser
319114361
ns/iter (± 7801194
)305282895
ns/iter (± 3544236
)1.05
es/full/minify/libraries/three
572366211
ns/iter (± 12902778
)556559468
ns/iter (± 6128636
)1.03
es/full/minify/libraries/typescript
3441050260
ns/iter (± 56977796
)3325218072
ns/iter (± 20010761
)1.03
es/full/minify/libraries/victory
835860228
ns/iter (± 18617795
)816887277
ns/iter (± 14351326
)1.02
es/full/minify/libraries/vue
163406160
ns/iter (± 5170809
)152821610
ns/iter (± 5630053
)1.07
es/full/codegen/es3
33511
ns/iter (± 1034
)33263
ns/iter (± 610
)1.01
es/full/codegen/es5
33534
ns/iter (± 1548
)33158
ns/iter (± 1004
)1.01
es/full/codegen/es2015
33559
ns/iter (± 472
)33154
ns/iter (± 890
)1.01
es/full/codegen/es2016
33518
ns/iter (± 454
)33118
ns/iter (± 955
)1.01
es/full/codegen/es2017
33557
ns/iter (± 1231
)32854
ns/iter (± 600
)1.02
es/full/codegen/es2018
33591
ns/iter (± 1481
)32939
ns/iter (± 712
)1.02
es/full/codegen/es2019
33485
ns/iter (± 1177
)33316
ns/iter (± 528
)1.01
es/full/codegen/es2020
33625
ns/iter (± 1815
)33335
ns/iter (± 766
)1.01
es/full/all/es3
206664286
ns/iter (± 12498926
)190439322
ns/iter (± 8107839
)1.09
es/full/all/es5
191500411
ns/iter (± 8490814
)177925453
ns/iter (± 9629130
)1.08
es/full/all/es2015
149312992
ns/iter (± 8069408
)144536380
ns/iter (± 4351403
)1.03
es/full/all/es2016
146712111
ns/iter (± 8617454
)141626691
ns/iter (± 6975781
)1.04
es/full/all/es2017
144623997
ns/iter (± 6551101
)140556031
ns/iter (± 3754263
)1.03
es/full/all/es2018
161296009
ns/iter (± 12676782
)139442423
ns/iter (± 4505917
)1.16
es/full/all/es2019
162354383
ns/iter (± 14501329
)134672321
ns/iter (± 4159596
)1.21
es/full/all/es2020
143815449
ns/iter (± 8530965
)129296340
ns/iter (± 3534621
)1.11
es/full/parser
710623
ns/iter (± 36070
)678055
ns/iter (± 46982
)1.05
es/full/base/fixer
26710
ns/iter (± 690
)25372
ns/iter (± 332
)1.05
es/full/base/resolver_and_hygiene
92088
ns/iter (± 3149
)88556
ns/iter (± 1928
)1.04
serialization of ast node
205
ns/iter (± 4
)217
ns/iter (± 5
)0.94
serialization of serde
213
ns/iter (± 5
)222
ns/iter (± 7
)0.96
This comment was automatically generated by workflow using github-action-benchmark.