-
-
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.
fix(html/minifier): Small fix (#5079)
- Loading branch information
1 parent
279d4a3
commit 5ac5ae2
Showing
27 changed files
with
65 additions
and
7 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
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-19/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-19/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,3 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<div> <a href="#"> <span> <b> foo </b> z <i> bar </i> </span> </a> </div> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-19/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 @@ | ||
<!doctype html><html lang=en><div><a href=#><span><b>foo</b>z <i>bar</i></span></a></div> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-20/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-20/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,3 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<span> <!-- test --> text <!-- test --></span> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-20/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 @@ | ||
<!doctype html><html lang=en><span>text</span> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-21/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-21/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,3 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<div><span> <!-- test --> text <!-- test --></span></div> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-21/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 @@ | ||
<!doctype html><html lang=en><div><span>text</span></div> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-22/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-22/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,3 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<span> <!-- test --> text <!-- test --></span> <span> <!-- test --> text <!-- test --></span> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-22/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 @@ | ||
<!doctype html><html lang=en><span>text</span> <span>text</span> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-23/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/swc_html_minifier/tests/fixture/text/inline-23/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,2 @@ | ||
<!doctype html> | ||
<svg> <linearGradient id=gradient /> </svg> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-23/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 @@ | ||
<!doctype html><svg><linearGradient id=gradient /></svg> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-24/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/swc_html_minifier/tests/fixture/text/inline-24/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,2 @@ | ||
<!doctype html> | ||
<span>a</span> <svg> <linearGradient id=gradient /> </svg> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-24/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 @@ | ||
<!doctype html><span>a</span> <svg><linearGradient id=gradient /></svg> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-25/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/swc_html_minifier/tests/fixture/text/inline-25/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,2 @@ | ||
<!doctype html> | ||
<svg> <linearGradient id=gradient /> </svg> <span>a</span> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-25/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 @@ | ||
<!doctype html><svg><linearGradient id=gradient /></svg><span>a</span> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/inline-26/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 @@ | ||
{ | ||
"collapseWhitespaces": "smart" | ||
} |
2 changes: 2 additions & 0 deletions
2
crates/swc_html_minifier/tests/fixture/text/inline-26/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,2 @@ | ||
<!doctype html> | ||
<span>a</span> <svg> <linearGradient id=gradient /> </svg> <span>a</span> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/inline-26/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 @@ | ||
<!doctype html><span>a</span> <svg><linearGradient id=gradient /> </svg><span>a</span> |
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/text/noscript-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 |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><div><span>test</span><noscript><a href=#>External Link</a></noscript></div><div><span>test</span><noscript> <a href=#>External Link</a></noscript></div> | ||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><div><span>test</span><noscript><a href=#>External Link</a></noscript></div><div><span>test</span><noscript><a href=#>External Link</a></noscript></div> |
5ac5ae2
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/minify/libraries/antd
1769038572
ns/iter (± 154365477
)1596493295
ns/iter (± 20183245
)1.11
es/full/minify/libraries/d3
451734827
ns/iter (± 78228681
)388741766
ns/iter (± 4922363
)1.16
es/full/minify/libraries/echarts
1712791871
ns/iter (± 40805657
)1582451201
ns/iter (± 21494229
)1.08
es/full/minify/libraries/jquery
102132990
ns/iter (± 3887183
)84495686
ns/iter (± 1237417
)1.21
es/full/minify/libraries/lodash
136368920
ns/iter (± 2583670
)111786470
ns/iter (± 1821325
)1.22
es/full/minify/libraries/moment
56868943
ns/iter (± 3929842
)49728739
ns/iter (± 997595
)1.14
es/full/minify/libraries/react
17689803
ns/iter (± 325544
)17163497
ns/iter (± 676713
)1.03
es/full/minify/libraries/terser
619596760
ns/iter (± 16669718
)574415604
ns/iter (± 8079556
)1.08
es/full/minify/libraries/three
551641565
ns/iter (± 3661553
)528615615
ns/iter (± 3963862
)1.04
es/full/minify/libraries/typescript
3574033978
ns/iter (± 77681008
)3370250648
ns/iter (± 41105178
)1.06
es/full/minify/libraries/victory
753237471
ns/iter (± 16067347
)708786419
ns/iter (± 4416866
)1.06
es/full/minify/libraries/vue
139166993
ns/iter (± 4074559
)127487716
ns/iter (± 1950422
)1.09
es/full/codegen/es3
32938
ns/iter (± 745
)31927
ns/iter (± 973
)1.03
es/full/codegen/es5
32863
ns/iter (± 645
)31923
ns/iter (± 737
)1.03
es/full/codegen/es2015
32849
ns/iter (± 1784
)32031
ns/iter (± 623
)1.03
es/full/codegen/es2016
32991
ns/iter (± 1431
)31881
ns/iter (± 1201
)1.03
es/full/codegen/es2017
32845
ns/iter (± 429
)31974
ns/iter (± 607
)1.03
es/full/codegen/es2018
32917
ns/iter (± 575
)31886
ns/iter (± 799
)1.03
es/full/codegen/es2019
32952
ns/iter (± 848
)31909
ns/iter (± 760
)1.03
es/full/codegen/es2020
32915
ns/iter (± 1155
)31958
ns/iter (± 904
)1.03
es/full/all/es3
186835607
ns/iter (± 12908837
)179292118
ns/iter (± 2182919
)1.04
es/full/all/es5
171483888
ns/iter (± 6768086
)167118917
ns/iter (± 3267526
)1.03
es/full/all/es2015
138435531
ns/iter (± 3712654
)136186840
ns/iter (± 2313729
)1.02
es/full/all/es2016
142686853
ns/iter (± 5360513
)135109568
ns/iter (± 2714290
)1.06
es/full/all/es2017
140380803
ns/iter (± 5097830
)134834033
ns/iter (± 2788975
)1.04
es/full/all/es2018
139172698
ns/iter (± 5430193
)133287256
ns/iter (± 2197643
)1.04
es/full/all/es2019
137487564
ns/iter (± 3575824
)132731681
ns/iter (± 1841805
)1.04
es/full/all/es2020
133735339
ns/iter (± 4995920
)128057929
ns/iter (± 2266822
)1.04
es/full/parser
703426
ns/iter (± 22657
)679565
ns/iter (± 19092
)1.04
es/full/base/fixer
29068
ns/iter (± 723
)27929
ns/iter (± 844
)1.04
es/full/base/resolver_and_hygiene
88468
ns/iter (± 4495
)84437
ns/iter (± 4819
)1.05
serialization of ast node
214
ns/iter (± 1
)211
ns/iter (± 5
)1.01
serialization of serde
227
ns/iter (± 3
)223
ns/iter (± 5
)1.02
This comment was automatically generated by workflow using github-action-benchmark.