mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
feat(html/minifier): Use the latest EsVersion
(#6453)
This commit is contained in:
parent
e055d2c4f8
commit
7f6bf59a98
@ -1988,8 +1988,8 @@ impl Minifier<'_> {
|
||||
let mut left_errors: Vec<_> = vec![];
|
||||
let left_fm = cm.new_source_file(FileName::Anon, left);
|
||||
let syntax = swc_ecma_parser::Syntax::default();
|
||||
// TODO improve me using options
|
||||
let target = swc_ecma_ast::EsVersion::default();
|
||||
// Use the latest target for merging
|
||||
let target = swc_ecma_ast::EsVersion::latest();
|
||||
|
||||
let mut left_program = if is_modules {
|
||||
match swc_ecma_parser::parse_file_as_module(
|
||||
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"minifyJs": {
|
||||
"parser": {
|
||||
"comments": true,
|
||||
"syntax": "ecmascript",
|
||||
"target": "es2022"
|
||||
},
|
||||
"codegen": {
|
||||
"asciiOnly": false
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"minifyJs": false
|
||||
}
|
@ -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>
|
@ -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>
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"minifyJs": {
|
||||
"codegen": {
|
||||
"asciiOnly": true
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
Loading…
Reference in New Issue
Block a user