mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
fix(es): Fix bugs (#2469)
swc: - Fix handling of `envs`. - Check for already fixed issues. (#2319)
This commit is contained in:
parent
01e171a4b4
commit
c9437d3226
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -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",
|
||||||
|
@ -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"
|
||||||
|
@ -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;
|
@ -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;
|
@ -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>),
|
||||||
|
18
tests/fixture/issue-2319/1/input/index.js
Normal file
18
tests/fixture/issue-2319/1/input/index.js
Normal 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;
|
13
tests/fixture/issue-2319/1/output/index.js
Normal file
13
tests/fixture/issue-2319/1/output/index.js
Normal 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;
|
13
tests/fixture/options/globals/1/input/.swcrc
Normal file
13
tests/fixture/options/globals/1/input/.swcrc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"jsc": {
|
||||||
|
"transform": {
|
||||||
|
"optimizer": {
|
||||||
|
"globals": {
|
||||||
|
"envs": {
|
||||||
|
"NODE_ENV_ALT": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
tests/fixture/options/globals/1/input/index.js
Normal file
1
tests/fixture/options/globals/1/input/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
console.log(process.env.NODE_ENV_ALT)
|
1
tests/fixture/options/globals/1/output/index.js
Normal file
1
tests/fixture/options/globals/1/output/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
console.log(true);
|
Loading…
Reference in New Issue
Block a user