-
-
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(es): Fix codegen & minifier (#2006)
swc_ecma_codegen: - Emit a semicolon before `!`. - Emit a semicolon before `[`. (#2007) swc_ecma_minifier: - Disable buggy passes. - `iife`: Don't inline async functions. (#2007)
- Loading branch information
Showing
39 changed files
with
5,773 additions
and
5,578 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 @@ | ||
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,2 @@ | ||
var foo; | ||
!foo; |
1 change: 1 addition & 0 deletions
1
ecmascript/codegen/tests/fixture/semi/pending/004/output.min.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 @@ | ||
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,2 @@ | ||
foo() | ||
!unary |
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 @@ | ||
foo(); | ||
!unary; |
1 change: 1 addition & 0 deletions
1
ecmascript/codegen/tests/fixture/semi/pending/005/output.min.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 @@ | ||
foo();!unary |
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 @@ | ||
"use strict"; | ||
const a = {}; | ||
|
||
for (let b in a) | ||
a[b] = a[b].trim(); | ||
|
||
["foo",].forEach(() => { }) |
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 @@ | ||
"use strict"; | ||
const a = { | ||
}; | ||
for(let b in a)a[b] = a[b].trim(); | ||
[ | ||
"foo", | ||
].forEach(()=>{ | ||
}); |
1 change: 1 addition & 0 deletions
1
ecmascript/codegen/tests/fixture/semi/pending/006/output.min.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 @@ | ||
"use strict";const a={};for(let b in a)a[b]=a[b].trim();["foo",].forEach(()=>{}) |
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
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
2 changes: 1 addition & 1 deletion
2
...ier/tests/compress/fixture/projects/wmr/archive-1/chunks/alias-outside.6e8773c7/output.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { m } from "../index.f66dda46.js"; | ||
const value$1 = "it works", value = "it works"; | ||
function AliasOutside() { | ||
return m`<div><p>Inside: ${value}</p><p>Outside: ${value$1}</p></div>`; | ||
} | ||
const value$1 = "it works", value = "it works"; | ||
export default AliasOutside; |
2 changes: 1 addition & 1 deletion
2
...pt/minifier/tests/compress/fixture/projects/wmr/archive-1/chunks/index.5a544c41/output.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { m } from "../index.f66dda46.js"; | ||
const jpg = "/assets/img.2dae108d.jpg"; | ||
function Files() { | ||
return m`<div style="padding: 2rem;"><h1>Files</h1><p> jpg: ${jpg}<br/><img src=${jpg} alt="" height="320"/></p></div>`; | ||
} | ||
const jpg = "/assets/img.2dae108d.jpg"; | ||
export default Files; |
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
6 changes: 3 additions & 3 deletions
6
...pt/minifier/tests/compress/fixture/projects/wmr/archive-1/chunks/index.ddc4110d/output.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { s as style, y, m } from "../index.f66dda46.js"; | ||
const styles = { | ||
about: "about_migxty" | ||
}; | ||
function About({ query , title , }) { | ||
return y(()=>(console.log("Mounted About: ", title), ()=>{ | ||
console.log("Unmounting About: ", title); | ||
}) | ||
, []), m`<section class=${styles.about}><h1>${title || "About"}</h1><p>My name is Jason.</p><pre>${JSON.stringify(query)}</pre></section>`; | ||
} | ||
const styles = { | ||
about: "about_migxty" | ||
}; | ||
export default About; |
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
7 changes: 7 additions & 0 deletions
7
ecmascript/minifier/tests/compress/fixture/simple/issues/2007/1/input.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,7 @@ | ||
const obj = {} | ||
for (let key in obj) { | ||
obj[key] = obj[key].trim(); | ||
} | ||
|
||
let arr = ["foo",] | ||
arr.forEach(() => { }) |
8 changes: 8 additions & 0 deletions
8
ecmascript/minifier/tests/compress/fixture/simple/issues/2007/1/output.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,8 @@ | ||
const obj = { | ||
}; | ||
for(let key in obj)obj[key] = obj[key].trim(); | ||
let arr = [ | ||
"foo", | ||
]; | ||
arr.forEach(()=>{ | ||
}); |
8 changes: 8 additions & 0 deletions
8
ecmascript/minifier/tests/compress/fixture/simple/issues/2007/2/input.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,8 @@ | ||
function func() { | ||
(async () => { | ||
await this.foo(); | ||
this.bar(); | ||
})() | ||
} | ||
|
||
func() |
6 changes: 6 additions & 0 deletions
6
ecmascript/minifier/tests/compress/fixture/simple/issues/2007/2/output.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,6 @@ | ||
function func() { | ||
(async ()=>{ | ||
await this.foo(), this.bar(); | ||
})(); | ||
} | ||
func(); |
Oops, something went wrong.