fix(swc): Fix bugs (#1811)

swc_ecma_ast:
 - Add `es2021`. 

swc_ecma_transforms_compat:
 - Handle `||=`. (#1788)
This commit is contained in:
강동윤 2021-06-11 16:55:34 +09:00 committed by GitHub
parent c6ce8c60b7
commit 97ef7c0553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 459 additions and 162 deletions

View File

@ -11,7 +11,7 @@ edition = "2018"
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.20.1" version = "0.21.0"
[lib] [lib]
name = "swc" name = "swc"
@ -30,12 +30,12 @@ serde_json = "1"
sourcemap = "6" sourcemap = "6"
swc_atoms = {version = "0.2", path = "./atoms"} swc_atoms = {version = "0.2", path = "./atoms"}
swc_common = {version = "0.10.16", path = "./common", features = ["sourcemap", "concurrent"]} swc_common = {version = "0.10.16", path = "./common", features = ["sourcemap", "concurrent"]}
swc_ecma_ast = {version = "0.45.0", path = "./ecmascript/ast"} swc_ecma_ast = {version = "0.46.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.55.0", path = "./ecmascript/codegen"} swc_ecma_codegen = {version = "0.56.0", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.15.0", path = "./ecmascript/ext-transforms"} swc_ecma_ext_transforms = {version = "0.16.0", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.57.0", path = "./ecmascript/parser"} swc_ecma_parser = {version = "0.58.0", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.20.4", path = "./ecmascript/preset_env"} swc_ecma_preset_env = {version = "0.21.0", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.50.1", path = "./ecmascript/transforms", features = [ swc_ecma_transforms = {version = "0.51.0", path = "./ecmascript/transforms", features = [
"compat", "compat",
"module", "module",
"optimization", "optimization",
@ -43,8 +43,8 @@ swc_ecma_transforms = {version = "0.50.1", path = "./ecmascript/transforms", fea
"react", "react",
"typescript", "typescript",
]} ]}
swc_ecma_utils = {version = "0.36.0", path = "./ecmascript/utils"} swc_ecma_utils = {version = "0.37.0", path = "./ecmascript/utils"}
swc_ecma_visit = {version = "0.31.0", path = "./ecmascript/visit"} swc_ecma_visit = {version = "0.32.0", path = "./ecmascript/visit"}
swc_node_base = {version = "0.1.0", path = "./node/base"} swc_node_base = {version = "0.1.0", path = "./node/base"}
swc_visit = {version = "0.2.3", path = "./visit"} swc_visit = {version = "0.2.3", path = "./visit"}

View File

@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_bundler" name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.37.4" version = "0.38.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]
@ -33,19 +33,19 @@ relative-path = "1.2"
retain_mut = "0.1.2" retain_mut = "0.1.2"
swc_atoms = {version = "0.2.4", path = "../atoms"} swc_atoms = {version = "0.2.4", path = "../atoms"}
swc_common = {version = "0.10.16", path = "../common"} swc_common = {version = "0.10.16", path = "../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ecmascript/ast"} swc_ecma_ast = {version = "0.46.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.55.0", path = "../ecmascript/codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.57.0", path = "../ecmascript/parser"} swc_ecma_parser = {version = "0.58.0", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.50.1", path = "../ecmascript/transforms", features = ["optimization"]} swc_ecma_transforms = {version = "0.51.0", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.36.0", path = "../ecmascript/utils"} swc_ecma_utils = {version = "0.37.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.31.0", path = "../ecmascript/visit"} swc_ecma_visit = {version = "0.32.0", path = "../ecmascript/visit"}
[dev-dependencies] [dev-dependencies]
hex = "0.4" hex = "0.4"
ntest = "0.7.2" ntest = "0.7.2"
reqwest = {version = "0.10.8", features = ["blocking"]} reqwest = {version = "0.10.8", features = ["blocking"]}
sha-1 = "0.9" sha-1 = "0.9"
swc_ecma_transforms = {version = "0.50.1", path = "../ecmascript/transforms", features = ["react", "typescript"]} swc_ecma_transforms = {version = "0.51.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
tempfile = "3.1.0" tempfile = "3.1.0"
testing = {version = "0.10.5", path = "../testing"} testing = {version = "0.10.5", path = "../testing"}
url = "2.1.1" url = "2.1.1"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecmascript" name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.36.3" version = "0.37.0"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -28,13 +28,13 @@ react = ["swc_ecma_transforms/react"]
typescript = ["swc_ecma_transforms/typescript"] typescript = ["swc_ecma_transforms/typescript"]
[dependencies] [dependencies]
swc_ecma_ast = {version = "0.45.0", path = "./ast"} swc_ecma_ast = {version = "0.46.0", path = "./ast"}
swc_ecma_codegen = {version = "0.55.0", path = "./codegen", optional = true} swc_ecma_codegen = {version = "0.56.0", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.25.0", path = "./dep-graph", optional = true} swc_ecma_dep_graph = {version = "0.26.0", path = "./dep-graph", optional = true}
swc_ecma_minifier = {version = "0.2.3", path = "./minifier", optional = true} swc_ecma_minifier = {version = "0.3.0", path = "./minifier", optional = true}
swc_ecma_parser = {version = "0.57.1", path = "./parser", optional = true} swc_ecma_parser = {version = "0.58.0", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.50.2", path = "./transforms", optional = true} swc_ecma_transforms = {version = "0.51.0", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.36.0", path = "./utils", optional = true} swc_ecma_utils = {version = "0.37.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.31.0", path = "./visit", optional = true} swc_ecma_visit = {version = "0.32.0", path = "./visit", optional = true}
[dev-dependencies] [dev-dependencies]

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_ast" name = "swc_ecma_ast"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.45.0" version = "0.46.0"
[features] [features]
default = [] default = []

View File

@ -112,13 +112,15 @@ pub enum EsVersion {
Es2019, Es2019,
#[serde(rename = "es2020")] #[serde(rename = "es2020")]
Es2020, Es2020,
#[serde(rename = "es2021")]
Es2021,
} }
impl EsVersion { impl EsVersion {
/// Get the latest version. This is `es2020` for now, but it will be changed /// Get the latest version. This is `es2021` for now, but it will be changed
/// if a new version of specification is released. /// if a new version of specification is released.
pub const fn latest() -> Self { pub const fn latest() -> Self {
EsVersion::Es2020 EsVersion::Es2021
} }
} }

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_codegen" name = "swc_ecma_codegen"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.55.4" version = "0.56.0"
[dependencies] [dependencies]
bitflags = "1" bitflags = "1"
@ -15,9 +15,9 @@ num-bigint = {version = "0.2", features = ["serde"]}
sourcemap = "6" sourcemap = "6"
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"} swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
[dev-dependencies] [dev-dependencies]
swc_common = {version = "0.10.16", path = "../../common", features = ["sourcemap"]} swc_common = {version = "0.10.16", path = "../../common", features = ["sourcemap"]}

View File

@ -6,14 +6,14 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_dep_graph" name = "swc_ecma_dep_graph"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.25.0" version = "0.26.0"
[dependencies] [dependencies]
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
testing = {version = "0.10.5", path = "../../testing"} testing = {version = "0.10.5", path = "../../testing"}

View File

@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/"
edition = "2018" edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_ext_transforms" name = "swc_ecma_ext_transforms"
version = "0.15.0" version = "0.16.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -13,7 +13,7 @@ version = "0.15.0"
phf = {version = "0.8.0", features = ["macros"]} phf = {version = "0.8.0", features = ["macros"]}
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
swc_ecma_utils = {version = "0.36.0", path = "../utils"} swc_ecma_utils = {version = "0.37.0", path = "../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}

View File

@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/"
edition = "2018" edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "jsdoc" name = "jsdoc"
version = "0.25.0" version = "0.26.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -18,7 +18,7 @@ swc_common = {version = "0.10.16", path = "../../common"}
[dev-dependencies] [dev-dependencies]
anyhow = "1" anyhow = "1"
dashmap = "4.0.2" dashmap = "4.0.2"
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
testing = {version = "0.10.5", path = "../../testing"} testing = {version = "0.10.5", path = "../../testing"}
walkdir = "2" walkdir = "2"

View File

@ -6,15 +6,15 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_loader" name = "swc_ecma_loader"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.6.0" version = "0.7.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
swc_atoms = {version = "0.2.3", path = "../../atoms"} swc_atoms = {version = "0.2.3", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
[dev-dependencies] [dev-dependencies]
testing = {version = "0.10.5", path = "../../testing"} testing = {version = "0.10.5", path = "../../testing"}

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_minifier" name = "swc_ecma_minifier"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.2.3" version = "0.3.0"
[features] [features]
debug = [] debug = []
@ -24,13 +24,13 @@ serde_json = "1.0.61"
serde_regex = "1.1.0" serde_regex = "1.1.0"
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.8", path = "../../common"} swc_common = {version = "0.10.8", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_codegen = {version = "0.55.0", path = "../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../codegen"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
swc_ecma_transforms = {version = "0.50.1", path = "../transforms/", features = ["optimization"]} swc_ecma_transforms = {version = "0.51.0", path = "../transforms/", features = ["optimization"]}
swc_ecma_transforms_base = {version = "0.15.6", path = "../transforms/base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../transforms/base"}
swc_ecma_utils = {version = "0.36.0", path = "../utils"} swc_ecma_utils = {version = "0.37.0", path = "../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
[dev-dependencies] [dev-dependencies]
ansi_term = "0.12.1" ansi_term = "0.12.1"

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_parser" name = "swc_ecma_parser"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.57.4" version = "0.58.0"
[features] [features]
default = [] default = []
@ -23,8 +23,8 @@ serde = {version = "1", features = ["derive"]}
smallvec = "1" smallvec = "1"
swc_atoms = {version = "0.2.3", path = "../../atoms"} swc_atoms = {version = "0.2.3", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
unicode-xid = "0.2" unicode-xid = "0.2"
[dev-dependencies] [dev-dependencies]

View File

@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_preset_env/"
edition = "2018" edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_preset_env" name = "swc_ecma_preset_env"
version = "0.20.4" version = "0.21.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -21,14 +21,14 @@ st-map = "0.1.2"
string_enum = {version = "0.3.1", path = "../../macros/string_enum"} string_enum = {version = "0.3.1", path = "../../macros/string_enum"}
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_transforms = {version = "0.50.1", path = "../transforms", features = ["compat", "proposal"]} swc_ecma_transforms = {version = "0.51.0", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_utils = {version = "0.36.0", path = "../utils"} swc_ecma_utils = {version = "0.37.0", path = "../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
walkdir = "2" walkdir = "2"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6" pretty_assertions = "0.6"
swc_ecma_codegen = {version = "0.55.0", path = "../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../codegen"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
testing = {version = "0.10.5", path = "../../testing"} testing = {version = "0.10.5", path = "../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms" name = "swc_ecma_transforms"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.50.2" version = "0.51.0"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -23,24 +23,24 @@ typescript = ["swc_ecma_transforms_typescript"]
[dependencies] [dependencies]
swc_atoms = {version = "0.2.0", path = "../../atoms"} swc_atoms = {version = "0.2.0", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../parser"} swc_ecma_parser = {version = "0.58.0", path = "../parser"}
swc_ecma_transforms_base = {version = "0.15.7", path = "./base"} swc_ecma_transforms_base = {version = "0.16.0", path = "./base"}
swc_ecma_transforms_compat = {version = "0.17.9", path = "./compat", optional = true} swc_ecma_transforms_compat = {version = "0.18.0", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.17.1", path = "./module", optional = true} swc_ecma_transforms_module = {version = "0.18.0", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.20.3", path = "./optimization", optional = true} swc_ecma_transforms_optimization = {version = "0.21.0", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.17.1", path = "./proposal", optional = true} swc_ecma_transforms_proposal = {version = "0.18.0", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.18.2", path = "./react", optional = true} swc_ecma_transforms_react = {version = "0.19.0", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.19.4", path = "./typescript", optional = true} swc_ecma_transforms_typescript = {version = "0.20.0", path = "./typescript", optional = true}
swc_ecma_utils = {version = "0.36.0", path = "../utils"} swc_ecma_utils = {version = "0.37.0", path = "../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
unicode-xid = "0.2" unicode-xid = "0.2"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6" pretty_assertions = "0.6"
sourcemap = "6" sourcemap = "6"
swc_ecma_codegen = {version = "0.55.0", path = "../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../codegen"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "./testing"} swc_ecma_transforms_testing = {version = "0.16.0", path = "./testing"}
tempfile = "3" tempfile = "3"
testing = {version = "0.10.5", path = "../../testing"} testing = {version = "0.10.5", path = "../../testing"}
walkdir = "2" walkdir = "2"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_base" name = "swc_ecma_transforms_base"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.15.7" version = "0.16.0"
[dependencies] [dependencies]
fxhash = "0.2.1" fxhash = "0.2.1"
@ -16,11 +16,11 @@ scoped-tls = "1.0.0"
smallvec = "1.6.0" smallvec = "1.6.0"
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_codegen = {version = "0.55.0", path = "../../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../../codegen"}
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -6,12 +6,12 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_classes" name = "swc_ecma_transforms_classes"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.1.1" version = "0.2.0"
[dependencies] [dependencies]
swc_atoms = {version = "0.2.6", path = "../../../atoms"} swc_atoms = {version = "0.2.6", path = "../../../atoms"}
swc_common = {version = "0.10.20", path = "../../../common"} swc_common = {version = "0.10.20", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_compat" name = "swc_ecma_transforms_compat"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.17.10" version = "0.18.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -20,14 +20,14 @@ serde = {version = "1.0.118", features = ["derive"]}
smallvec = "1.6.0" smallvec = "1.6.0"
swc_atoms = {version = "0.2.5", path = "../../../atoms"} swc_atoms = {version = "0.2.5", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_transforms_classes = {version = "0.1.1", path = "../classes"} swc_ecma_transforms_classes = {version = "0.2.0", path = "../classes"}
swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"} swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing"}
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -3,6 +3,7 @@ pub use self::{
class_properties::{class_properties, typescript_class_properties}, class_properties::{class_properties, typescript_class_properties},
export_namespace_from::export_namespace_from, export_namespace_from::export_namespace_from,
nullish_coalescing::nullish_coalescing, nullish_coalescing::nullish_coalescing,
operators::operators,
opt_chaining::optional_chaining, opt_chaining::optional_chaining,
}; };
use swc_common::chain; use swc_common::chain;
@ -11,6 +12,7 @@ use swc_ecma_visit::Fold;
mod class_properties; mod class_properties;
mod export_namespace_from; mod export_namespace_from;
mod nullish_coalescing; mod nullish_coalescing;
mod operators;
mod opt_chaining; mod opt_chaining;
pub fn es2020() -> impl Fold { pub fn es2020() -> impl Fold {
@ -19,5 +21,6 @@ pub fn es2020() -> impl Fold {
optional_chaining(), optional_chaining(),
class_properties(), class_properties(),
export_namespace_from(), export_namespace_from(),
operators(),
) )
} }

View File

@ -0,0 +1,171 @@
use swc_common::DUMMY_SP;
use swc_ecma_ast::*;
use swc_ecma_transforms_base::{ext::MapWithMut, perf::Check};
use swc_ecma_transforms_macros::fast_path;
use swc_ecma_utils::prepend;
use swc_ecma_utils::{alias_ident_for, ExprFactory};
use swc_ecma_visit::{
as_folder, noop_visit_mut_type, noop_visit_type, Fold, Node, Visit, VisitMut, VisitMutWith,
};
pub fn operators() -> impl Fold {
as_folder(Operators::default())
}
#[derive(Debug, Default)]
struct Operators {
vars: Vec<VarDeclarator>,
}
#[fast_path(OperatorFinder)]
impl VisitMut for Operators {
noop_visit_mut_type!();
fn visit_mut_expr(&mut self, e: &mut Expr) {
e.visit_mut_children_with(self);
match e {
Expr::Assign(AssignExpr {
span,
op: op!("||="),
left: PatOrExpr::Expr(left),
right,
}) if left.is_ident() || left.is_member() => {
let (alias, obj_init) = match &mut **left {
Expr::Member(MemberExpr {
obj: ExprOrSuper::Expr(obj),
..
}) => {
let alias = alias_ident_for(&obj, "_ref");
self.vars.push(VarDeclarator {
span: DUMMY_SP,
name: Pat::Ident(alias.clone().into()),
init: None,
definite: false,
});
(
ExprOrSuper::Expr(Box::new(Expr::Ident(alias))),
Some(obj.take()),
)
}
Expr::Member(MemberExpr {
obj: ExprOrSuper::Super(s),
..
}) => (ExprOrSuper::Super(*s), None),
_ => (ExprOrSuper::Expr(left.take()), None),
};
let aliased = obj_init.is_some();
let (left_expr, r_assign_target) = match alias {
ExprOrSuper::Expr(alias) if aliased => {
let left: MemberExpr = left.clone().member().unwrap();
let obj = Box::new(Expr::Assign(AssignExpr {
span: DUMMY_SP,
op: op!("="),
left: PatOrExpr::Pat(Box::new(Pat::Ident(
alias.clone().ident().unwrap().into(),
))),
right: obj_init.unwrap(),
}));
(
Box::new(Expr::Member(MemberExpr {
span: DUMMY_SP,
obj: obj.as_obj(),
..left.clone()
})),
Box::new(Expr::Member(MemberExpr {
span: DUMMY_SP,
obj: alias.clone().as_obj(),
..left
})),
)
}
obj => match obj {
ExprOrSuper::Super(..) => {
let left: MemberExpr = left.clone().member().unwrap();
let e = Box::new(Expr::Member(MemberExpr {
span: DUMMY_SP,
obj,
..left
}));
(e.clone(), e)
}
ExprOrSuper::Expr(e) => (e.clone(), e),
},
};
let right = Box::new(Expr::Assign(AssignExpr {
span: DUMMY_SP,
op: op!("="),
left: PatOrExpr::Expr(r_assign_target),
right: right.take(),
}));
*e = Expr::Bin(BinExpr {
span: *span,
op: op!("||"),
left: left_expr,
right,
});
}
_ => {}
}
}
fn visit_mut_module(&mut self, n: &mut Module) {
n.visit_mut_children_with(self);
if !self.vars.is_empty() {
prepend(
&mut n.body,
ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl {
span: DUMMY_SP,
kind: VarDeclKind::Var,
declare: false,
decls: self.vars.take(),
}))),
)
}
}
fn visit_mut_script(&mut self, n: &mut Script) {
n.visit_mut_children_with(self);
if !self.vars.is_empty() {
prepend(
&mut n.body,
Stmt::Decl(Decl::Var(VarDecl {
span: DUMMY_SP,
kind: VarDeclKind::Var,
declare: false,
decls: self.vars.take(),
})),
)
}
}
}
#[derive(Default)]
struct OperatorFinder {
found: bool,
}
impl Visit for OperatorFinder {
noop_visit_type!();
fn visit_assign_op(&mut self, n: &AssignOp, _: &dyn Node) {
self.found |= *n == op!("||=");
}
}
impl Check for OperatorFinder {
fn should_handle(&self) -> bool {
self.found
}
}

View File

@ -0,0 +1,47 @@
use swc_ecma_parser::{Syntax, TsConfig};
use swc_ecma_transforms_compat::es2020;
use swc_ecma_transforms_testing::test;
use swc_ecma_visit::Fold;
fn tr() -> impl Fold {
es2020::operators()
}
fn syntax() -> Syntax {
Syntax::Typescript(TsConfig {
..Default::default()
})
}
test!(syntax(), |_| tr(), logical_ident, "a ||= b", "a || (a = b)");
test!(
syntax(),
|_| tr(),
logical_member,
"a.b ||= b",
"
var _a;
(_a = a).b || (_a.b = b);
"
);
test!(
syntax(),
|_| tr(),
logical_super,
"
class Foo {
method() {
return super.f ||= b
}
}
",
"
class Foo {
method() {
return super.f || (super.f = b);
}
}
"
);

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_module" name = "swc_ecma_transforms_module"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.17.2" version = "0.18.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -16,13 +16,13 @@ indexmap = "1.6.1"
serde = {version = "1.0.118", features = ["derive"]} serde = {version = "1.0.118", features = ["derive"]}
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_transforms_compat = {version = "0.17.9", path = "../compat"} swc_ecma_transforms_compat = {version = "0.18.0", path = "../compat"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing/"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing/"}
testing = {version = "0.10.5", path = "../../../testing/"} testing = {version = "0.10.5", path = "../../../testing/"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_optimization" name = "swc_ecma_transforms_optimization"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.20.3" version = "0.21.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -19,17 +19,17 @@ retain_mut = "0.1.2"
serde_json = "1.0.61" serde_json = "1.0.61"
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_transforms_compat = {version = "0.17.9", path = "../compat"} swc_ecma_transforms_compat = {version = "0.18.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.17.1", path = "../module"} swc_ecma_transforms_module = {version = "0.18.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.17.1", path = "../proposal"} swc_ecma_transforms_proposal = {version = "0.18.0", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.18.2", path = "../react"} swc_ecma_transforms_react = {version = "0.19.0", path = "../react"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing"}
swc_ecma_transforms_typescript = {version = "0.19.4", path = "../typescript"} swc_ecma_transforms_typescript = {version = "0.20.0", path = "../typescript"}
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_proposal" name = "swc_ecma_transforms_proposal"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.17.1" version = "0.18.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -21,15 +21,15 @@ serde = {version = "1.0.118", features = ["derive"]}
smallvec = "1.6.0" smallvec = "1.6.0"
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_loader = {version = "0.6.0", path = "../../loader", optional = true} swc_ecma_loader = {version = "0.7.0", path = "../../loader", optional = true}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_transforms_classes = {version = "0.1.1", path = "../classes"} swc_ecma_transforms_classes = {version = "0.2.0", path = "../classes"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_transforms_compat = {version = "0.17.9", path = "../compat"} swc_ecma_transforms_compat = {version = "0.18.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.17.1", path = "../module"} swc_ecma_transforms_module = {version = "0.18.0", path = "../module"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing"}

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_react" name = "swc_ecma_transforms_react"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.18.2" version = "0.19.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -21,15 +21,15 @@ sha-1 = "0.9.4"
string_enum = {version = "0.3.1", path = "../../../macros/string_enum"} string_enum = {version = "0.3.1", path = "../../../macros/string_enum"}
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_codegen = {version = "0.55.0", path = "../../codegen/"} swc_ecma_codegen = {version = "0.56.0", path = "../../codegen/"}
swc_ecma_transforms_compat = {version = "0.17.9", path = "../compat/"} swc_ecma_transforms_compat = {version = "0.18.0", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.17.1", path = "../module"} swc_ecma_transforms_module = {version = "0.18.0", path = "../module"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing/"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing/"}
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_testing" name = "swc_ecma_transforms_testing"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.15.1" version = "0.16.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -15,11 +15,11 @@ ansi_term = "0.12.1"
serde = "1" serde = "1"
serde_json = "1" serde_json = "1"
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_codegen = {version = "0.55.0", path = "../../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../../codegen"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
tempfile = "3.1.0" tempfile = "3.1.0"
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_typescript" name = "swc_ecma_transforms_typescript"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.19.4" version = "0.20.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
@ -14,17 +14,17 @@ fxhash = "0.2.1"
serde = {version = "1.0.118", features = ["derive"]} serde = {version = "1.0.118", features = ["derive"]}
swc_atoms = {version = "0.2", path = "../../../atoms"} swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.16", path = "../../../common"} swc_common = {version = "0.10.16", path = "../../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../../ast"} swc_ecma_ast = {version = "0.46.0", path = "../../ast"}
swc_ecma_parser = {version = "0.57.0", path = "../../parser"} swc_ecma_parser = {version = "0.58.0", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.15.6", path = "../base"} swc_ecma_transforms_base = {version = "0.16.0", path = "../base"}
swc_ecma_utils = {version = "0.36.0", path = "../../utils"} swc_ecma_utils = {version = "0.37.0", path = "../../utils"}
swc_ecma_visit = {version = "0.31.0", path = "../../visit"} swc_ecma_visit = {version = "0.32.0", path = "../../visit"}
[dev-dependencies] [dev-dependencies]
swc_ecma_codegen = {version = "0.55.0", path = "../../codegen"} swc_ecma_codegen = {version = "0.56.0", path = "../../codegen"}
swc_ecma_transforms_compat = {version = "0.17.9", path = "../compat"} swc_ecma_transforms_compat = {version = "0.18.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.17.1", path = "../module"} swc_ecma_transforms_module = {version = "0.18.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.17.1", path = "../proposal/"} swc_ecma_transforms_proposal = {version = "0.18.0", path = "../proposal/"}
swc_ecma_transforms_testing = {version = "0.15.1", path = "../testing"} swc_ecma_transforms_testing = {version = "0.16.0", path = "../testing"}
testing = {version = "0.10.5", path = "../../../testing"} testing = {version = "0.10.5", path = "../../../testing"}
walkdir = "2.3.1" walkdir = "2.3.1"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_utils" name = "swc_ecma_utils"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.36.0" version = "0.37.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -15,8 +15,8 @@ once_cell = "1"
scoped-tls = "1" scoped-tls = "1"
swc_atoms = {version = "0.2.0", path = "../../atoms"} swc_atoms = {version = "0.2.0", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_ecma_visit = {version = "0.31.0", path = "../visit"} swc_ecma_visit = {version = "0.32.0", path = "../visit"}
unicode-xid = "0.2" unicode-xid = "0.2"
[dev-dependencies] [dev-dependencies]

View File

@ -6,11 +6,11 @@ edition = "2018"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
name = "swc_ecma_visit" name = "swc_ecma_visit"
repository = "https://github.com/swc-project/swc.git" repository = "https://github.com/swc-project/swc.git"
version = "0.31.0" version = "0.32.0"
[dependencies] [dependencies]
num-bigint = {version = "0.2", features = ["serde"]} num-bigint = {version = "0.2", features = ["serde"]}
swc_atoms = {version = "0.2", path = "../../atoms"} swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.16", path = "../../common"} swc_common = {version = "0.10.16", path = "../../common"}
swc_ecma_ast = {version = "0.45.0", path = "../ast"} swc_ecma_ast = {version = "0.46.0", path = "../ast"}
swc_visit = {version = "0.2.3", path = "../../visit"} swc_visit = {version = "0.2.3", path = "../../visit"}

View File

@ -0,0 +1,26 @@
class Test {
test() {
a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
.a(1)
}
}

View File

@ -0,0 +1,34 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var Test = /*#__PURE__*/ function() {
"use strict";
function Test() {
_classCallCheck(this, Test);
}
_createClass(Test, [
{
key: "test",
value: function test() {
a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1).a(1);
}
}
]);
return Test;
}();

View File

@ -0,0 +1,8 @@
{
"env": {
"targets": {
"firefox": "72"
},
"shippedProposals": true
}
}

View File

@ -0,0 +1,3 @@
let x = 1;
x ??= 2;
console.log(x);

View File

@ -0,0 +1,3 @@
let x = 1;
x ??= 2;
console.log(x);