fix(es): Fix bugs (#2469)

swc:
 - Fix handling of `envs`.
 - Check for already fixed issues. (#2319)
This commit is contained in:
Donny/강동윤 2021-10-19 15:02:46 +09:00 committed by GitHub
parent 01e171a4b4
commit c9437d3226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 74 additions and 2 deletions

2
Cargo.lock generated
View File

@ -2324,7 +2324,7 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
[[package]] [[package]]
name = "swc" name = "swc"
version = "0.73.0" version = "0.73.1"
dependencies = [ dependencies = [
"ahash", "ahash",
"anyhow", "anyhow",

View File

@ -21,7 +21,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc" name = "swc"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.73.0" version = "0.73.1"
[lib] [lib]
name = "swc" name = "swc"

View File

@ -0,0 +1,18 @@
function foo(l, r) {
var lightGreeting
if (l > 0) {
var greeting = "hello";
} else {
var greeting = "howdy";
}
if (r > 0) {
lightGreeting = greeting.substr(0, 2)
}
return lightGreeting
}
module.exports = foo;

View File

@ -0,0 +1,7 @@
function foo(l, r) {
var lightGreeting;
if (l > 0) var greeting = "hello";
else var greeting = "howdy";
return r > 0 && (lightGreeting = greeting.substr(0, 2)), lightGreeting;
}
module.exports = foo;

View File

@ -993,6 +993,7 @@ pub struct GlobalPassOption {
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GlobalInliningPassEnvs { pub enum GlobalInliningPassEnvs {
List(AHashSet<String>), List(AHashSet<String>),
Map(AHashMap<String, String>), Map(AHashMap<String, String>),

View File

@ -0,0 +1,18 @@
function foo(l, r) {
var lightGreeting
if (l > 0) {
var greeting = "hello";
} else {
var greeting = "howdy";
}
if (r > 0) {
lightGreeting = greeting.substr(0, 2)
}
return lightGreeting
}
module.exports = foo;

View File

@ -0,0 +1,13 @@
function foo(l, r) {
var lightGreeting;
if (l > 0) {
var greeting = "hello";
} else {
var greeting = "howdy";
}
if (r > 0) {
lightGreeting = greeting.substr(0, 2);
}
return lightGreeting;
}
module.exports = foo;

View File

@ -0,0 +1,13 @@
{
"jsc": {
"transform": {
"optimizer": {
"globals": {
"envs": {
"NODE_ENV_ALT": "true"
}
}
}
}
}
}

View File

@ -0,0 +1 @@
console.log(process.env.NODE_ENV_ALT)

View File

@ -0,0 +1 @@
console.log(true);