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): Fix smart mode (#5058)
- Loading branch information
1 parent
93cd38d
commit e9bad20
Showing
58 changed files
with
604 additions
and
204 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
5 changes: 1 addition & 4 deletions
5
crates/swc_html_minifier/tests/fixture/comment/html/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,4 +1 @@ | ||
<!doctype html><html lang=en><title>Document</title><body> | ||
|
||
<div>test</div> | ||
|
||
<!doctype html><html lang=en><title>Document</title><div>test</div> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/comment/spaces/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" | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/swc_html_minifier/tests/fixture/comment/spaces/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,8 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Document</title> | ||
<!-- a --> <!-- b --> <!-- c --><link> | ||
</head> | ||
<body><div>foo<div> baz </div> bar</div></body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/comment/spaces/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><title>Document</title><link><div>foo<div>baz</div>bar</div> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/text/angular/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" | ||
} |
22 changes: 22 additions & 0 deletions
22
crates/swc_html_minifier/tests/fixture/text/angular/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,22 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<template ngFor #hero [ngForOf]="heroes"> | ||
<hero-detail *ngIf="hero" [hero]="hero"></hero-detail> | ||
</template> | ||
<form (ngSubmit)="onSubmit(theForm)" #theForm="ngForm"> | ||
<div class="form-group"> | ||
<label for="name">Name</label> | ||
<input class="form-control" | ||
required | ||
ngControl="firstName" | ||
[(ngModel)]="currentHero.firstName"> | ||
</div> | ||
<button type="submit" [disabled]="!theForm.form.valid">Submit</button> | ||
</form> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
crates/swc_html_minifier/tests/fixture/text/angular/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><meta charset=UTF-8><title>Document</title><body><template ngfor #hero [ngforof]=heroes><hero-detail *ngif=hero [hero]=hero></hero-detail></template><form (ngsubmit)=onSubmit(theForm) #theform=ngForm><div class=form-group><label for=name>Name</label> <input class=form-control required ngcontrol=firstName [(ngmodel)]=currentHero.firstName></div><button [disabled]=!theForm.form.valid>Submit</button></form> |
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
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
Oops, something went wrong.
e9bad20
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
1680813186
ns/iter (± 10332486
)1634839099
ns/iter (± 13825717
)1.03
es/full/minify/libraries/d3
422622792
ns/iter (± 8936562
)410032650
ns/iter (± 9858489
)1.03
es/full/minify/libraries/echarts
1671741022
ns/iter (± 24112995
)1630337733
ns/iter (± 22177730
)1.03
es/full/minify/libraries/jquery
95636253
ns/iter (± 2518036
)89618791
ns/iter (± 3513134
)1.07
es/full/minify/libraries/lodash
123188307
ns/iter (± 4672633
)114601428
ns/iter (± 3679547
)1.07
es/full/minify/libraries/moment
53871720
ns/iter (± 702555
)52618122
ns/iter (± 632644
)1.02
es/full/minify/libraries/react
17727787
ns/iter (± 199977
)17468065
ns/iter (± 566219
)1.01
es/full/minify/libraries/terser
607997268
ns/iter (± 13278647
)601639250
ns/iter (± 10519125
)1.01
es/full/minify/libraries/three
560432933
ns/iter (± 12574192
)544878990
ns/iter (± 8595826
)1.03
es/full/minify/libraries/typescript
3545819998
ns/iter (± 48360796
)3459217408
ns/iter (± 86547083
)1.03
es/full/minify/libraries/victory
739994182
ns/iter (± 3833991
)741212870
ns/iter (± 9652920
)1.00
es/full/minify/libraries/vue
143291821
ns/iter (± 1983765
)137228231
ns/iter (± 2996484
)1.04
es/full/codegen/es3
32689
ns/iter (± 792
)31222
ns/iter (± 942
)1.05
es/full/codegen/es5
32666
ns/iter (± 1416
)30723
ns/iter (± 522
)1.06
es/full/codegen/es2015
32717
ns/iter (± 268
)30928
ns/iter (± 389
)1.06
es/full/codegen/es2016
32686
ns/iter (± 254
)31062
ns/iter (± 589
)1.05
es/full/codegen/es2017
32631
ns/iter (± 340
)31060
ns/iter (± 863
)1.05
es/full/codegen/es2018
32661
ns/iter (± 620
)31131
ns/iter (± 609
)1.05
es/full/codegen/es2019
32644
ns/iter (± 737
)31214
ns/iter (± 975
)1.05
es/full/codegen/es2020
32655
ns/iter (± 1025
)31229
ns/iter (± 1059
)1.05
es/full/all/es3
184634285
ns/iter (± 2965726
)188853554
ns/iter (± 6409142
)0.98
es/full/all/es5
172925744
ns/iter (± 3163746
)177650306
ns/iter (± 6671212
)0.97
es/full/all/es2015
140194435
ns/iter (± 2195994
)145049179
ns/iter (± 6301082
)0.97
es/full/all/es2016
139389793
ns/iter (± 1987027
)152992408
ns/iter (± 13944303
)0.91
es/full/all/es2017
138910548
ns/iter (± 2396173
)141013765
ns/iter (± 4578003
)0.99
es/full/all/es2018
137290854
ns/iter (± 2407335
)136860893
ns/iter (± 4709045
)1.00
es/full/all/es2019
137173045
ns/iter (± 3675016
)139119840
ns/iter (± 5360326
)0.99
es/full/all/es2020
131973204
ns/iter (± 3112624
)131736386
ns/iter (± 3957720
)1.00
es/full/parser
710051
ns/iter (± 18475
)714194
ns/iter (± 28558
)0.99
es/full/base/fixer
29213
ns/iter (± 303
)29721
ns/iter (± 787
)0.98
es/full/base/resolver_and_hygiene
86639
ns/iter (± 2309
)87002
ns/iter (± 4052
)1.00
serialization of ast node
214
ns/iter (± 4
)207
ns/iter (± 5
)1.03
serialization of serde
224
ns/iter (± 7
)220
ns/iter (± 3
)1.02
This comment was automatically generated by workflow using github-action-benchmark.