Skip to content

Commit

Permalink
fix(strip): Transform static class fields to assignments (#1487)
Browse files Browse the repository at this point in the history
swc_ecam_transforms_compat:
 - Deprecate `typescript_class_properties`.

swc_ecma_tranforms_typescript:
 - Merge `typescript_class_properties` into `strip`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
  • Loading branch information
nayeemrmn and kdy1 committed Mar 26, 2021
1 parent 0351a47 commit fa3d65c
Show file tree
Hide file tree
Showing 25 changed files with 413 additions and 257 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Expand Up @@ -11,7 +11,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.0"
version = "0.12.1"

[lib]
name = "swc"
Expand All @@ -33,8 +33,8 @@ swc_ecma_ast = {version = "0.41.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.49.0", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.9.0", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.51.0", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.12.0", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.42.0", path = "./ecmascript/transforms", features = [
swc_ecma_preset_env = {version = "0.12.1", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.42.1", path = "./ecmascript/transforms", features = [
"compat",
"module",
"optimization",
Expand Down
6 changes: 3 additions & 3 deletions bundler/Cargo.toml
Expand Up @@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT"
name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git"
version = "0.29.0"
version = "0.29.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
Expand All @@ -35,7 +35,7 @@ swc_common = {version = "0.10.10", path = "../common"}
swc_ecma_ast = {version = "0.41.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.49.0", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.51.0", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.42.0", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_transforms = {version = "0.42.1", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.32.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.27.0", path = "../ecmascript/visit"}

Expand All @@ -44,7 +44,7 @@ hex = "0.4"
ntest = "0.7.2"
reqwest = {version = "0.10.8", features = ["blocking"]}
sha-1 = "0.9"
swc_ecma_transforms = {version = "0.42.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
swc_ecma_transforms = {version = "0.42.1", path = "../ecmascript/transforms", features = ["react", "typescript"]}
tempfile = "3.1.0"
testing = {version = "0.10.3", path = "../testing"}
url = "2.1.1"
Expand Down
4 changes: 3 additions & 1 deletion bundler/src/bundler/import/mod.rs
Expand Up @@ -548,7 +548,9 @@ where
Some(exported) => {
debug_assert_eq!(
exported.span.ctxt, self.module_ctxt,
"Exported names should have same (local) context as top-level module items"
"Exported names should have same (local) context as top-level module \
items\n{}\n{:?}",
self.path, s
);
}
None => {
Expand Down
4 changes: 2 additions & 2 deletions ecmascript/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git"
version = "0.28.0"
version = "0.28.1"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -31,7 +31,7 @@ swc_ecma_ast = {version = "0.41.0", path = "./ast"}
swc_ecma_codegen = {version = "0.49.0", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.19.0", path = "./dep-graph", optional = true}
swc_ecma_parser = {version = "0.51.0", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.42.0", path = "./transforms", optional = true}
swc_ecma_transforms = {version = "0.42.1", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.32.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.27.0", path = "./visit", optional = true}

Expand Down
4 changes: 2 additions & 2 deletions ecmascript/preset_env/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ documentation = "https://swc.rs/rustdoc/swc_ecma_preset_env/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_preset_env"
version = "0.12.0"
version = "0.12.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -21,7 +21,7 @@ string_enum = {version = "0.3.1", path = "../../macros/string_enum"}
swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.10", path = "../../common"}
swc_ecma_ast = {version = "0.41.0", path = "../ast"}
swc_ecma_transforms = {version = "0.42.0", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_transforms = {version = "0.42.1", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_utils = {version = "0.32.0", path = "../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../visit"}
walkdir = "2"
Expand Down
14 changes: 7 additions & 7 deletions ecmascript/transforms/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms"
repository = "https://github.com/swc-project/swc.git"
version = "0.42.0"
version = "0.42.1"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -26,12 +26,12 @@ swc_common = {version = "0.10.10", path = "../../common"}
swc_ecma_ast = {version = "0.41.0", path = "../ast"}
swc_ecma_parser = {version = "0.51.0", path = "../parser"}
swc_ecma_transforms_base = {version = "0.9.0", path = "./base"}
swc_ecma_transforms_compat = {version = "0.10.0", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.10.0", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.12.0", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.10.0", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.11.0", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.11.0", path = "./typescript", optional = true}
swc_ecma_transforms_compat = {version = "0.10.1", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.10.1", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.12.1", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.10.1", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.11.1", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.11.1", path = "./typescript", optional = true}
swc_ecma_utils = {version = "0.32.0", path = "../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../visit"}
unicode-xid = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion ecmascript/transforms/compat/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_compat"
repository = "https://github.com/swc-project/swc.git"
version = "0.10.0"
version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ecmascript/transforms/compat/src/es2020.rs
@@ -1,3 +1,4 @@
#[allow(deprecated)]
pub use self::{
class_properties::{class_properties, typescript_class_properties},
export_namespace_from::export_namespace_from,
Expand Down
Expand Up @@ -41,6 +41,7 @@ pub fn class_properties() -> impl Fold {
}

/// Class properties pass for the typescript.
#[deprecated = "The logic is merged into typescript::strip"]
pub fn typescript_class_properties() -> impl Fold {
ClassProperties {
typescript: true,
Expand Down
2 changes: 2 additions & 0 deletions ecmascript/transforms/compat/tests/es2020_class_properties.rs
@@ -1,4 +1,6 @@
#![feature(test)]
#![allow(deprecated)]

use swc_common::chain;
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
use swc_ecma_transforms_base::resolver::resolver;
Expand Down
4 changes: 2 additions & 2 deletions ecmascript/transforms/module/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_module"
repository = "https://github.com/swc-project/swc.git"
version = "0.10.0"
version = "0.10.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -23,6 +23,6 @@ swc_ecma_utils = {version = "0.32.0", path = "../../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../../visit"}

[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.10.0", path = "../compat"}
swc_ecma_transforms_compat = {version = "0.10.1", path = "../compat"}
swc_ecma_transforms_testing = {version = "0.9.0", path = "../testing/"}
testing = {version = "0.10.3", path = "../../../testing/"}
12 changes: 6 additions & 6 deletions ecmascript/transforms/optimization/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_optimization"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.0"
version = "0.12.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -26,10 +26,10 @@ swc_ecma_utils = {version = "0.32.0", path = "../../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../../visit"}

[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.10.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.10.0", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.10.0", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.11.0", path = "../react"}
swc_ecma_transforms_compat = {version = "0.10.1", path = "../compat"}
swc_ecma_transforms_module = {version = "0.10.1", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.10.1", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.11.1", path = "../react"}
swc_ecma_transforms_testing = {version = "0.9.0", path = "../testing"}
swc_ecma_transforms_typescript = {version = "0.11.0", path = "../typescript"}
swc_ecma_transforms_typescript = {version = "0.11.1", path = "../typescript"}
testing = {version = "0.10.0", path = "../../../testing"}
6 changes: 3 additions & 3 deletions ecmascript/transforms/proposal/Cargo.toml
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_proposal"
repository = "https://github.com/swc-project/swc.git"
version = "0.10.0"
version = "0.10.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -29,6 +29,6 @@ swc_ecma_utils = {version = "0.32.0", path = "../../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../../visit"}

[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.10.0", path = "../compat"}
swc_ecma_transforms_module = {version = "0.10.0", path = "../module"}
swc_ecma_transforms_compat = {version = "0.10.1", path = "../compat"}
swc_ecma_transforms_module = {version = "0.10.1", path = "../module"}
swc_ecma_transforms_testing = {version = "0.9.0", path = "../testing"}
6 changes: 3 additions & 3 deletions ecmascript/transforms/react/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_react"
repository = "https://github.com/swc-project/swc.git"
version = "0.11.0"
version = "0.11.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -25,7 +25,7 @@ swc_ecma_utils = {version = "0.32.0", path = "../../utils"}
swc_ecma_visit = {version = "0.27.0", path = "../../visit"}

[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.10.0", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.10.0", path = "../module"}
swc_ecma_transforms_compat = {version = "0.10.1", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.10.1", path = "../module"}
swc_ecma_transforms_testing = {version = "0.9.0", path = "../testing/"}
testing = {version = "0.10.3", path = "../../../testing"}

0 comments on commit fa3d65c

Please sign in to comment.