Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html/minifier): Use the latest
EsVersion
(#6453)
- Loading branch information
1 parent
e055d2c
commit 7f6bf59
Showing
10 changed files
with
89 additions
and
2 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
12 changes: 12 additions & 0 deletions
12
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-1/config.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,12 @@ | ||
{ | ||
"minifyJs": { | ||
"parser": { | ||
"comments": true, | ||
"syntax": "ecmascript", | ||
"target": "es2022" | ||
}, | ||
"codegen": { | ||
"asciiOnly": false | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-1/input.html
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,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script>var test1 = "😋";</script> | ||
<div>test</div> | ||
<script>var test2 = "😋";</script> | ||
<script>var test3 = "😋";</script> | ||
<div>number</div> | ||
<script>var test4 = 123_456_789;</script> | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
...es/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-1/output.min.html
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 @@ | ||
<!doctype html><html lang=en><title>Document</title><body><script>var test1="😋"</script> | ||
<div>test</div> | ||
<script>var test2="😋",test3="😋"</script> | ||
<div>number</div> | ||
<script>var test4=123456789</script> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-2/config.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 @@ | ||
{ | ||
"minifyJs": false | ||
} |
16 changes: 16 additions & 0 deletions
16
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-2/input.html
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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script>var test1 = "😋";</script> | ||
<div>test</div> | ||
<script>var test2 = "😋";</script> | ||
<script>var test3 = "😋";</script> | ||
<div>number</div> | ||
<script>var test4 = 123_456_789;</script> | ||
<div>emoji</div> | ||
<script>var test5="\uD83D\uDE0B";</script><script>var test6="\uD83D\uDE0B"</script> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
...es/swc_html_minifier/tests/fixture/element/script-group-respect-codegen-2/output.min.html
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 @@ | ||
<!doctype html><html lang=en><title>Document</title><body><script>var test1 = "😋";</script> | ||
<div>test</div> | ||
<script>var test2 = "😋"; | ||
var test3 = "😋"; | ||
</script> | ||
<div>number</div> | ||
<script>var test4 = 123_456_789;</script> | ||
<div>emoji</div> | ||
<script>var test5 = "\uD83D\uDE0B"; | ||
var test6 = "\uD83D\uDE0B"; | ||
</script> |
7 changes: 7 additions & 0 deletions
7
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen/config.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,7 @@ | ||
{ | ||
"minifyJs": { | ||
"codegen": { | ||
"asciiOnly": true | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen/input.html
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,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<script>var test1 = "😋";</script> | ||
<div>test</div> | ||
<script>var test2 = "😋";</script> | ||
<script>var test3 = "😋";</script> | ||
<div>number</div> | ||
<script>var test4 = 123_456_789;</script> | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
crates/swc_html_minifier/tests/fixture/element/script-group-respect-codegen/output.min.html
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 @@ | ||
<!doctype html><html lang=en><title>Document</title><body><script>var test1="\uD83D\uDE0B"</script> | ||
<div>test</div> | ||
<script>var test2="\uD83D\uDE0B",test3="\uD83D\uDE0B"</script> | ||
<div>number</div> | ||
<script>var test4=123456789</script> |
7f6bf59
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
348397
ns/iter (± 15399
)333261
ns/iter (± 24615
)1.05
es/full/minify/libraries/antd
1863807999
ns/iter (± 162149761
)1807198979
ns/iter (± 32721704
)1.03
es/full/minify/libraries/d3
413098744
ns/iter (± 16603723
)419103916
ns/iter (± 12419303
)0.99
es/full/minify/libraries/echarts
1565493732
ns/iter (± 14645178
)1566847566
ns/iter (± 49474633
)1.00
es/full/minify/libraries/jquery
102335223
ns/iter (± 6117583
)99481084
ns/iter (± 2778702
)1.03
es/full/minify/libraries/lodash
121707896
ns/iter (± 4575117
)127093735
ns/iter (± 10497244
)0.96
es/full/minify/libraries/moment
61469172
ns/iter (± 1971469
)66319902
ns/iter (± 6021505
)0.93
es/full/minify/libraries/react
20343176
ns/iter (± 643850
)22117838
ns/iter (± 1405033
)0.92
es/full/minify/libraries/terser
315187300
ns/iter (± 15549644
)325721497
ns/iter (± 6132262
)0.97
es/full/minify/libraries/three
561959490
ns/iter (± 13042263
)585693790
ns/iter (± 5794116
)0.96
es/full/minify/libraries/typescript
3355215596
ns/iter (± 23508635
)3471689839
ns/iter (± 78001210
)0.97
es/full/minify/libraries/victory
839499341
ns/iter (± 15145850
)860902587
ns/iter (± 21743934
)0.98
es/full/minify/libraries/vue
151729042
ns/iter (± 10764046
)168050579
ns/iter (± 11482018
)0.90
es/full/codegen/es3
33263
ns/iter (± 402
)33755
ns/iter (± 937
)0.99
es/full/codegen/es5
33369
ns/iter (± 299
)33929
ns/iter (± 604
)0.98
es/full/codegen/es2015
33415
ns/iter (± 277
)34413
ns/iter (± 6277
)0.97
es/full/codegen/es2016
33426
ns/iter (± 919
)33957
ns/iter (± 979
)0.98
es/full/codegen/es2017
33668
ns/iter (± 998
)34391
ns/iter (± 1993
)0.98
es/full/codegen/es2018
33349
ns/iter (± 802
)34562
ns/iter (± 13329
)0.96
es/full/codegen/es2019
33560
ns/iter (± 2483
)35699
ns/iter (± 5306
)0.94
es/full/codegen/es2020
33540
ns/iter (± 273
)34602
ns/iter (± 4503
)0.97
es/full/all/es3
194342651
ns/iter (± 6657917
)219672312
ns/iter (± 33052956
)0.88
es/full/all/es5
180355266
ns/iter (± 5650393
)183535112
ns/iter (± 14564518
)0.98
es/full/all/es2015
145237646
ns/iter (± 4606421
)146592478
ns/iter (± 12870827
)0.99
es/full/all/es2016
144008478
ns/iter (± 5280613
)146346454
ns/iter (± 12561533
)0.98
es/full/all/es2017
143484000
ns/iter (± 5366385
)147970126
ns/iter (± 15861961
)0.97
es/full/all/es2018
142492911
ns/iter (± 3674110
)146178569
ns/iter (± 11174568
)0.97
es/full/all/es2019
141674187
ns/iter (± 4524276
)144069288
ns/iter (± 12461896
)0.98
es/full/all/es2020
135341954
ns/iter (± 3317944
)139428674
ns/iter (± 8948386
)0.97
es/full/parser
712237
ns/iter (± 20203
)725785
ns/iter (± 32380
)0.98
es/full/base/fixer
26786
ns/iter (± 979
)26742
ns/iter (± 897
)1.00
es/full/base/resolver_and_hygiene
91038
ns/iter (± 1991
)92772
ns/iter (± 2698
)0.98
serialization of ast node
216
ns/iter (± 2
)219
ns/iter (± 4
)0.99
serialization of serde
217
ns/iter (± 3
)222
ns/iter (± 7
)0.98
This comment was automatically generated by workflow using github-action-benchmark.