diff --git a/Cargo.lock b/Cargo.lock index 08e119931fa..44c81a877ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,7 +939,7 @@ dependencies = [ [[package]] name = "jsdoc" -version = "0.37.0" +version = "0.37.1" dependencies = [ "anyhow", "dashmap", @@ -2429,7 +2429,7 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.11.8" +version = "0.11.9" dependencies = [ "ahash", "arbitrary", @@ -2458,7 +2458,7 @@ dependencies = [ [[package]] name = "swc_css" -version = "0.4.0" +version = "0.4.1" dependencies = [ "swc_css_ast", "swc_css_codegen", @@ -2469,7 +2469,7 @@ dependencies = [ [[package]] name = "swc_css_ast" -version = "0.4.0" +version = "0.4.1" dependencies = [ "is-macro", "serde", @@ -2480,7 +2480,7 @@ dependencies = [ [[package]] name = "swc_css_codegen" -version = "0.2.0" +version = "0.2.1" dependencies = [ "auto_impl", "bitflags", @@ -2506,7 +2506,7 @@ dependencies = [ [[package]] name = "swc_css_parser" -version = "0.4.1" +version = "0.4.2" dependencies = [ "bitflags", "lexical", @@ -2522,7 +2522,7 @@ dependencies = [ [[package]] name = "swc_css_utils" -version = "0.1.0" +version = "0.1.1" dependencies = [ "swc_atoms 0.2.7", "swc_common", @@ -2532,7 +2532,7 @@ dependencies = [ [[package]] name = "swc_css_visit" -version = "0.3.0" +version = "0.3.1" dependencies = [ "swc_atoms 0.2.7", "swc_common", @@ -2542,7 +2542,7 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.51.0" +version = "0.51.1" dependencies = [ "arbitrary", "is-macro", @@ -2556,7 +2556,7 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.69.0" +version = "0.69.1" dependencies = [ "bitflags", "num-bigint", @@ -2582,7 +2582,7 @@ dependencies = [ [[package]] name = "swc_ecma_dep_graph" -version = "0.38.0" +version = "0.38.1" dependencies = [ "swc_atoms 0.2.7", "swc_common", @@ -2594,7 +2594,7 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.27.0" +version = "0.27.1" dependencies = [ "phf", "swc_atoms 0.2.7", @@ -2607,7 +2607,7 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.17.0" +version = "0.17.1" dependencies = [ "anyhow", "dashmap", @@ -2660,7 +2660,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.69.0" +version = "0.69.1" dependencies = [ "either", "enum_kind", @@ -2737,7 +2737,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.29.0" +version = "0.30.0" dependencies = [ "fxhash", "once_cell", @@ -2756,7 +2756,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.15.0" +version = "0.16.0" dependencies = [ "swc_atoms 0.2.7", "swc_common", @@ -2902,7 +2902,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.29.0" +version = "0.30.0" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -2943,7 +2943,7 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.43.0" +version = "0.43.1" dependencies = [ "once_cell", "scoped-tls", @@ -2957,7 +2957,7 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.37.0" +version = "0.37.1" dependencies = [ "num-bigint", "swc_atoms 0.2.7", @@ -3003,7 +3003,7 @@ dependencies = [ [[package]] name = "swc_node_base" -version = "0.2.2" +version = "0.2.3" dependencies = [ "dashmap", "mimalloc-rust", @@ -3045,7 +3045,7 @@ dependencies = [ [[package]] name = "swc_plugin" -version = "0.3.0" +version = "0.3.1" dependencies = [ "abi_stable", "anyhow", @@ -3060,7 +3060,7 @@ dependencies = [ [[package]] name = "swc_plugin_runner" -version = "0.3.0" +version = "0.3.1" dependencies = [ "abi_stable", "anyhow", @@ -3078,7 +3078,7 @@ dependencies = [ [[package]] name = "swc_plugin_testing" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "swc_atoms 0.2.7", @@ -3092,7 +3092,7 @@ dependencies = [ [[package]] name = "swc_stylis" -version = "0.1.0" +version = "0.1.1" dependencies = [ "swc_atoms 0.2.7", "swc_common", @@ -3160,7 +3160,7 @@ dependencies = [ [[package]] name = "testing" -version = "0.12.2" +version = "0.12.3" dependencies = [ "ansi_term 0.12.1", "difference", diff --git a/Cargo.toml b/Cargo.toml index bf76895efe4..280cf392e94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,13 +47,13 @@ serde_json = "1" sourcemap = "6" swc_atoms = {version = "0.2", path = "./atoms"} swc_bundler = {version = "0.56.0", path = "./bundler"} -swc_common = {version = "0.11.6", path = "./common", features = ["sourcemap", "concurrent"]} -swc_ecma_ast = {version = "0.51.0", path = "./ecmascript/ast"} -swc_ecma_codegen = {version = "0.69.0", path = "./ecmascript/codegen"} -swc_ecma_ext_transforms = {version = "0.27.0", path = "./ecmascript/ext-transforms"} -swc_ecma_loader = {version = "0.17.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]} +swc_common = {version = "0.11.9", path = "./common", features = ["sourcemap", "concurrent"]} +swc_ecma_ast = {version = "0.51.1", path = "./ecmascript/ast"} +swc_ecma_codegen = {version = "0.69.1", path = "./ecmascript/codegen"} +swc_ecma_ext_transforms = {version = "0.27.1", path = "./ecmascript/ext-transforms"} +swc_ecma_loader = {version = "0.17.1", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]} swc_ecma_minifier = {version = "0.24.0", path = "./ecmascript/minifier"} -swc_ecma_parser = {version = "0.69.0", path = "./ecmascript/parser"} +swc_ecma_parser = {version = "0.69.1", path = "./ecmascript/parser"} swc_ecma_preset_env = {version = "0.40.0", path = "./ecmascript/preset-env"} swc_ecma_transforms = {version = "0.69.0", path = "./ecmascript/transforms", features = [ "compat", @@ -63,16 +63,16 @@ swc_ecma_transforms = {version = "0.69.0", path = "./ecmascript/transforms", fea "react", "typescript", ]} -swc_ecma_transforms_base = {version = "0.29.0", path = "./ecmascript/transforms/base"} -swc_ecma_utils = {version = "0.43.0", path = "./ecmascript/utils"} -swc_ecma_visit = {version = "0.37.0", path = "./ecmascript/visit"} +swc_ecma_transforms_base = {version = "0.30.0", path = "./ecmascript/transforms/base"} +swc_ecma_utils = {version = "0.43.1", path = "./ecmascript/utils"} +swc_ecma_visit = {version = "0.37.1", path = "./ecmascript/visit"} swc_ecmascript = {version = "0.60.0", path = "./ecmascript"} -swc_node_base = {version = "0.2.2", path = "./node/base"} +swc_node_base = {version = "0.2.3", path = "./node/base"} swc_visit = {version = "0.2.3", path = "./visit"} [dev-dependencies] rayon = "1" -testing = {version = "0.12.2", path = "./testing"} +testing = {version = "0.12.3", path = "./testing"} walkdir = "2" [[example]] diff --git a/bundler/Cargo.toml b/bundler/Cargo.toml index bbd38f558ac..f1d74f44db0 100644 --- a/bundler/Cargo.toml +++ b/bundler/Cargo.toml @@ -32,14 +32,14 @@ rayon = {version = "1", optional = true} relative-path = "1.2" retain_mut = "0.1.2" swc_atoms = {version = "0.2.4", path = "../atoms"} -swc_common = {version = "0.11.6", path = "../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ecmascript/ast"} -swc_ecma_codegen = {version = "0.69.0", path = "../ecmascript/codegen"} -swc_ecma_loader = {version = "0.17.0", path = "../ecmascript/loader"} -swc_ecma_parser = {version = "0.69.0", path = "../ecmascript/parser"} +swc_common = {version = "0.11.9", path = "../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ecmascript/ast"} +swc_ecma_codegen = {version = "0.69.1", path = "../ecmascript/codegen"} +swc_ecma_loader = {version = "0.17.1", path = "../ecmascript/loader"} +swc_ecma_parser = {version = "0.69.1", path = "../ecmascript/parser"} swc_ecma_transforms = {version = "0.69.0", path = "../ecmascript/transforms", features = ["optimization"]} -swc_ecma_utils = {version = "0.43.0", path = "../ecmascript/utils"} -swc_ecma_visit = {version = "0.37.0", path = "../ecmascript/visit"} +swc_ecma_utils = {version = "0.43.1", path = "../ecmascript/utils"} +swc_ecma_visit = {version = "0.37.1", path = "../ecmascript/visit"} [dev-dependencies] hex = "0.4" @@ -48,6 +48,6 @@ reqwest = {version = "0.11.4", features = ["blocking"]} sha-1 = "0.9" swc_ecma_transforms = {version = "0.69.0", path = "../ecmascript/transforms", features = ["react", "typescript"]} tempfile = "3.1.0" -testing = {version = "0.12.2", path = "../testing"} +testing = {version = "0.12.3", path = "../testing"} url = "2.1.1" walkdir = "2" diff --git a/bundler/src/bundler/keywords.rs b/bundler/src/bundler/keywords.rs index 68dc4e7e589..900dde0cbc6 100644 --- a/bundler/src/bundler/keywords.rs +++ b/bundler/src/bundler/keywords.rs @@ -1,6 +1,7 @@ -use crate::{id::Id, util::MapWithMut}; +use crate::id::Id; use fxhash::FxHashMap; use swc_atoms::js_word; +use swc_common::util::take::Take; use swc_ecma_ast::*; use swc_ecma_utils::private_ident; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; diff --git a/bundler/src/modules/sort/stmt.rs b/bundler/src/modules/sort/stmt.rs index 83bdfaa9656..ef62a673a28 100644 --- a/bundler/src/modules/sort/stmt.rs +++ b/bundler/src/modules/sort/stmt.rs @@ -1,11 +1,11 @@ use super::graph::Required; -use crate::{id::Id, modules::sort::graph::StmtDepGraph, util::MapWithMut}; +use crate::{id::Id, modules::sort::graph::StmtDepGraph}; use fxhash::{FxHashMap, FxHashSet}; use indexmap::IndexSet; use petgraph::EdgeDirection::{Incoming as Dependants, Outgoing as Dependancies}; use std::{collections::VecDeque, iter::from_fn, ops::Range}; use swc_atoms::js_word; -use swc_common::{sync::Lrc, SourceMap, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{sync::Lrc, util::take::Take, SourceMap, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::find_ids; use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith}; diff --git a/bundler/src/util.rs b/bundler/src/util.rs index c93d0786289..35f07db6a2c 100644 --- a/bundler/src/util.rs +++ b/bundler/src/util.rs @@ -1,5 +1,4 @@ -use std::{clone::Clone, cmp::Eq, hash::Hash, mem::replace}; -use swc_atoms::js_word; +use std::{clone::Clone, cmp::Eq, hash::Hash}; use swc_common::{Span, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::ident::IdentLike; @@ -64,148 +63,6 @@ pub(crate) trait ExprExt: Into { impl ExprExt for T where T: Into {} -/// Helper for migration from [Fold] to [VisitMut] -pub(crate) trait MapWithMut: Sized { - fn dummy() -> Self; - - fn take(&mut self) -> Self { - replace(self, Self::dummy()) - } - - #[inline] - fn map_with_mut(&mut self, op: F) - where - F: FnOnce(Self) -> Self, - { - let dummy = Self::dummy(); - let v = replace(self, dummy); - let v = op(v); - let _dummy = replace(self, v); - } -} - -impl MapWithMut for ModuleItem { - #[inline(always)] - fn dummy() -> Self { - ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) - } -} - -impl MapWithMut for Stmt { - #[inline(always)] - fn dummy() -> Self { - Stmt::Empty(EmptyStmt { span: DUMMY_SP }) - } -} - -impl MapWithMut for Expr { - #[inline(always)] - fn dummy() -> Self { - Expr::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Pat { - #[inline(always)] - fn dummy() -> Self { - Pat::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Option { - #[inline(always)] - fn dummy() -> Self { - None - } -} - -impl MapWithMut for Vec { - #[inline(always)] - fn dummy() -> Self { - Vec::new() - } -} - -impl MapWithMut for Box -where - T: MapWithMut, -{ - #[inline(always)] - fn dummy() -> Self { - Box::new(T::dummy()) - } -} - -impl MapWithMut for Ident { - fn dummy() -> Self { - Ident::new(js_word!(""), DUMMY_SP) - } -} - -impl MapWithMut for ObjectPatProp { - fn dummy() -> Self { - ObjectPatProp::Assign(AssignPatProp { - span: DUMMY_SP, - key: Ident::dummy(), - value: None, - }) - } -} - -impl MapWithMut for PatOrExpr { - fn dummy() -> Self { - PatOrExpr::Pat(Box::new(Pat::Ident(Ident::dummy().into()))) - } -} - -impl MapWithMut for ClassExpr { - fn dummy() -> Self { - ClassExpr { - ident: None, - class: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for FnExpr { - fn dummy() -> Self { - FnExpr { - ident: None, - function: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for Class { - fn dummy() -> Self { - Class { - span: Default::default(), - decorators: Default::default(), - body: Default::default(), - super_class: Default::default(), - is_abstract: Default::default(), - type_params: Default::default(), - super_type_params: Default::default(), - implements: Default::default(), - } - } -} - -impl MapWithMut for Function { - fn dummy() -> Self { - Function { - params: Default::default(), - decorators: Default::default(), - span: Default::default(), - body: Default::default(), - is_generator: Default::default(), - is_async: Default::default(), - type_params: Default::default(), - return_type: Default::default(), - } - } -} - #[derive(Debug)] pub(crate) struct CHashSet where diff --git a/common/Cargo.toml b/common/Cargo.toml index 48ec95e4ec4..93703198875 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_common" repository = "https://github.com/swc-project/swc.git" -version = "0.11.8" +version = "0.11.9" [features] concurrent = ["parking_lot"] diff --git a/common/src/util.rs b/common/src/util/mod.rs similarity index 76% rename from common/src/util.rs rename to common/src/util/mod.rs index 87f3a1d5911..b40479c1955 100644 --- a/common/src/util.rs +++ b/common/src/util/mod.rs @@ -1,3 +1,4 @@ pub mod iter; pub mod map; pub mod move_map; +pub mod take; diff --git a/common/src/util/take.rs b/common/src/util/take.rs new file mode 100644 index 00000000000..ec539481d4e --- /dev/null +++ b/common/src/util/take.rs @@ -0,0 +1,55 @@ +use crate::{Span, DUMMY_SP}; +use std::mem::replace; + +/// Helper for people who are working on `VisitMut`. +/// +/// +/// This trait is implemented for ast nodes. If not and you need it, please file +/// an issue. +pub trait Take: Sized { + fn take(&mut self) -> Self { + replace(self, Self::dummy()) + } + + /// Create a dummy value of this type. + fn dummy() -> Self; + + /// Mutate `self` using `op`, which accepts owned data. + #[inline] + fn map_with_mut(&mut self, op: F) + where + F: FnOnce(Self) -> Self, + { + let dummy = Self::dummy(); + let cur_val = replace(self, dummy); + let new_val = op(cur_val); + let _dummy = replace(self, new_val); + } +} + +impl Take for Option { + fn dummy() -> Self { + None + } +} + +impl Take for Box +where + T: Take, +{ + fn dummy() -> Self { + Box::new(T::dummy()) + } +} + +impl Take for Vec { + fn dummy() -> Self { + vec![] + } +} + +impl Take for Span { + fn dummy() -> Self { + DUMMY_SP + } +} diff --git a/css/Cargo.toml b/css/Cargo.toml index c1e9efbee39..4684db050ee 100644 --- a/css/Cargo.toml +++ b/css/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css" repository = "https://github.com/swc-project/swc.git" -version = "0.4.0" +version = "0.4.1" [dependencies] -swc_css_ast = {version = "0.4.0", path = "./ast"} -swc_css_codegen = {version = "0.2.0", path = "./codegen"} -swc_css_parser = {version = "0.4.0", path = "./parser"} -swc_css_utils = {version = "0.1.0", path = "./utils/"} -swc_css_visit = {version = "0.3.0", path = "./visit"} +swc_css_ast = {version = "0.4.1", path = "./ast"} +swc_css_codegen = {version = "0.2.1", path = "./codegen"} +swc_css_parser = {version = "0.4.2", path = "./parser"} +swc_css_utils = {version = "0.1.1", path = "./utils/"} +swc_css_visit = {version = "0.3.1", path = "./visit"} diff --git a/css/ast/Cargo.toml b/css/ast/Cargo.toml index 8888212343d..2617a893ba8 100644 --- a/css/ast/Cargo.toml +++ b/css/ast/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css_ast" repository = "https://github.com/swc-project/swc.git" -version = "0.4.0" +version = "0.4.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,4 +15,4 @@ is-macro = "0.1.9" serde = {version = "1.0.127", features = ["derive"]} string_enum = {version = "0.3.1", path = "../../macros/string_enum/"} swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} +swc_common = {version = "0.11.9", path = "../../common"} diff --git a/css/codegen/Cargo.toml b/css/codegen/Cargo.toml index 65e798d2dec..de4f15d0267 100644 --- a/css/codegen/Cargo.toml +++ b/css/codegen/Cargo.toml @@ -6,17 +6,17 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css_codegen" repository = "https://github.com/swc-project/swc.git" -version = "0.2.0" +version = "0.2.1" [dependencies] auto_impl = "0.4.1" bitflags = "1.3.2" swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_css_ast = {version = "0.4.0", path = "../ast/"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_css_ast = {version = "0.4.1", path = "../ast/"} swc_css_codegen_macros = {version = "0.2.0", path = "macros/"} [dev-dependencies] -swc_css_parser = {version = "0.4.0", path = "../parser"} -swc_css_visit = {version = "0.3.0", path = "../visit"} -testing = {version = "0.12.2", path = "../../testing"} +swc_css_parser = {version = "0.4.2", path = "../parser"} +swc_css_visit = {version = "0.3.1", path = "../visit"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/css/parser/Cargo.toml b/css/parser/Cargo.toml index 5de68eb31c2..9af87efc913 100644 --- a/css/parser/Cargo.toml +++ b/css/parser/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css_parser" repository = "https://github.com/swc-project/swc.git" -version = "0.4.1" +version = "0.4.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] @@ -16,12 +16,12 @@ debug = [] bitflags = "1.2.1" lexical = "5.2.2" swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_css_ast = {version = "0.4.0", path = "../ast"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_css_ast = {version = "0.4.1", path = "../ast"} unicode-xid = "0.2.2" [dev-dependencies] serde = "1.0.127" serde_json = "1.0.66" -swc_css_visit = {version = "0.3.0", path = "../visit"} -testing = {version = "0.12.2", path = "../../testing"} +swc_css_visit = {version = "0.3.1", path = "../visit"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/css/stylis/Cargo.toml b/css/stylis/Cargo.toml index 39fe3cad1df..855762ba857 100644 --- a/css/stylis/Cargo.toml +++ b/css/stylis/Cargo.toml @@ -6,18 +6,18 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_stylis" repository = "https://github.com/swc-project/swc.git" -version = "0.1.0" +version = "0.1.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_css_ast = {version = "0.4.0", path = "../ast"} -swc_css_utils = {version = "0.1.0", path = "../utils/"} -swc_css_visit = {version = "0.3.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_css_ast = {version = "0.4.1", path = "../ast"} +swc_css_utils = {version = "0.1.1", path = "../utils/"} +swc_css_visit = {version = "0.3.1", path = "../visit"} [dev-dependencies] -swc_css_codegen = {version = "0.2.0", path = "../codegen"} -swc_css_parser = {version = "0.4.0", path = "../parser"} -testing = {version = "0.12.2", path = "../../testing"} +swc_css_codegen = {version = "0.2.1", path = "../codegen"} +swc_css_parser = {version = "0.4.2", path = "../parser"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/css/utils/Cargo.toml b/css/utils/Cargo.toml index 474de8d7432..a96e869e64c 100644 --- a/css/utils/Cargo.toml +++ b/css/utils/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css_utils" repository = "https://github.com/swc-project/swc.git" -version = "0.1.0" +version = "0.1.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_css_ast = {version = "0.4.0", path = "../ast"} -swc_css_visit = {version = "0.3.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_css_ast = {version = "0.4.1", path = "../ast"} +swc_css_visit = {version = "0.3.1", path = "../visit"} diff --git a/css/visit/Cargo.toml b/css/visit/Cargo.toml index de60e1f07ad..78ec44fe0ab 100644 --- a/css/visit/Cargo.toml +++ b/css/visit/Cargo.toml @@ -6,12 +6,12 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_css_visit" repository = "https://github.com/swc-project/swc.git" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_css_ast = {version = "0.4.0", path = "../ast/"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_css_ast = {version = "0.4.1", path = "../ast/"} swc_visit = {version = "0.2.6", path = "../../visit"} diff --git a/ecmascript/Cargo.toml b/ecmascript/Cargo.toml index 13d9c198509..498a8241132 100644 --- a/ecmascript/Cargo.toml +++ b/ecmascript/Cargo.toml @@ -32,14 +32,14 @@ react = ["swc_ecma_transforms/react"] typescript = ["typescript-parser", "swc_ecma_transforms/typescript"] [dependencies] -swc_ecma_ast = {version = "0.51.0", path = "./ast"} -swc_ecma_codegen = {version = "0.69.0", path = "./codegen", optional = true} -swc_ecma_dep_graph = {version = "0.38.0", path = "./dep-graph", optional = true} +swc_ecma_ast = {version = "0.51.1", path = "./ast"} +swc_ecma_codegen = {version = "0.69.1", path = "./codegen", optional = true} +swc_ecma_dep_graph = {version = "0.38.1", path = "./dep-graph", optional = true} swc_ecma_minifier = {version = "0.24.0", path = "./minifier", optional = true} -swc_ecma_parser = {version = "0.69.0", path = "./parser", optional = true, default-features = false} +swc_ecma_parser = {version = "0.69.1", path = "./parser", optional = true, default-features = false} swc_ecma_preset_env = {version = "0.40.0", path = "./preset-env", optional = true} swc_ecma_transforms = {version = "0.69.0", path = "./transforms", optional = true} -swc_ecma_utils = {version = "0.43.0", path = "./utils", optional = true} -swc_ecma_visit = {version = "0.37.0", path = "./visit", optional = true} +swc_ecma_utils = {version = "0.43.1", path = "./utils", optional = true} +swc_ecma_visit = {version = "0.37.1", path = "./visit", optional = true} [dev-dependencies] diff --git a/ecmascript/ast/Cargo.toml b/ecmascript/ast/Cargo.toml index ee655fd2f8d..8f2e5dfd0cb 100644 --- a/ecmascript/ast/Cargo.toml +++ b/ecmascript/ast/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_ast" repository = "https://github.com/swc-project/swc.git" -version = "0.51.0" +version = "0.51.1" [features] default = [] @@ -19,7 +19,7 @@ num-bigint = {version = "0.2", features = ["serde"]} serde = {version = "1.0.88", features = ["derive"]} string_enum = {version = "0.3.1", path = "../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} +swc_common = {version = "0.11.9", path = "../../common"} [dev-dependencies] serde_json = "1" diff --git a/ecmascript/ast/src/class.rs b/ecmascript/ast/src/class.rs index 14d6cb9ae70..dd1f16cbf59 100644 --- a/ecmascript/ast/src/class.rs +++ b/ecmascript/ast/src/class.rs @@ -12,7 +12,7 @@ use crate::{ }; use is_macro::Is; use serde::{Deserialize, Serialize}; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, EqIgnoreSpan)] @@ -43,6 +43,21 @@ pub struct Class { pub implements: Vec, } +impl Take for Class { + fn dummy() -> Self { + Class { + span: DUMMY_SP, + decorators: Default::default(), + body: Default::default(), + super_class: Default::default(), + is_abstract: Default::default(), + type_params: Default::default(), + super_type_params: Default::default(), + implements: Default::default(), + } + } +} + #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -69,6 +84,12 @@ pub enum ClassMember { StaticBlock(StaticBlock), } +impl Take for ClassMember { + fn dummy() -> Self { + ClassMember::Empty(EmptyStmt { span: DUMMY_SP }) + } +} + #[ast_node("ClassProperty")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] diff --git a/ecmascript/ast/src/decl.rs b/ecmascript/ast/src/decl.rs index 70366d86de8..fc2defc6ad7 100644 --- a/ecmascript/ast/src/decl.rs +++ b/ecmascript/ast/src/decl.rs @@ -8,7 +8,7 @@ use crate::{ }; use is_macro::Is; use string_enum::StringEnum; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] @@ -31,6 +31,12 @@ pub enum Decl { TsModule(TsModuleDecl), } +impl Take for Decl { + fn dummy() -> Self { + Decl::Var(Take::dummy()) + } +} + #[ast_node("FunctionDeclaration")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -76,6 +82,17 @@ pub struct VarDecl { pub decls: Vec, } +impl Take for VarDecl { + fn dummy() -> Self { + VarDecl { + span: DUMMY_SP, + kind: VarDeclKind::Var, + declare: Default::default(), + decls: Take::dummy(), + } + } +} + #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub enum VarDeclKind { @@ -103,3 +120,14 @@ pub struct VarDeclarator { #[serde(default)] pub definite: bool, } + +impl Take for VarDeclarator { + fn dummy() -> Self { + VarDeclarator { + span: DUMMY_SP, + name: Take::dummy(), + init: Take::dummy(), + definite: Default::default(), + } + } +} diff --git a/ecmascript/ast/src/expr.rs b/ecmascript/ast/src/expr.rs index 4b0ca2e3754..595ece9ce72 100644 --- a/ecmascript/ast/src/expr.rs +++ b/ecmascript/ast/src/expr.rs @@ -17,7 +17,7 @@ use crate::{ }; use is_macro::Is; use serde::{self, Deserialize, Serialize}; -use swc_common::{ast_node, EqIgnoreSpan, Span, Spanned, DUMMY_SP}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] @@ -152,6 +152,12 @@ pub enum Expr { Invalid(Invalid), } +impl Take for Expr { + fn dummy() -> Self { + Expr::Invalid(Invalid { span: DUMMY_SP }) + } +} + #[ast_node("ThisExpression")] #[derive(Eq, Hash, Copy, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -334,6 +340,17 @@ pub struct CallExpr { // pub type_params: Option, } +impl Take for CallExpr { + fn dummy() -> Self { + CallExpr { + span: DUMMY_SP, + callee: Take::dummy(), + args: Take::dummy(), + type_args: Take::dummy(), + } + } +} + #[ast_node("NewExpression")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -455,6 +472,17 @@ pub struct TplElement { pub raw: Str, } +impl Take for TplElement { + fn dummy() -> Self { + TplElement { + span: DUMMY_SP, + tail: Default::default(), + cooked: Take::dummy(), + raw: Take::dummy(), + } + } +} + #[ast_node("ParenthesisExpression")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -478,6 +506,12 @@ pub enum ExprOrSuper { Expr(Box), } +impl Take for ExprOrSuper { + fn dummy() -> Self { + ExprOrSuper::Super(Take::dummy()) + } +} + #[ast_node("Super")] #[derive(Eq, Hash, Copy, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -485,6 +519,12 @@ pub struct Super { pub span: Span, } +impl Take for Super { + fn dummy() -> Self { + Super { span: DUMMY_SP } + } +} + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct ExprOrSpread { @@ -516,6 +556,12 @@ pub enum BlockStmtOrExpr { Expr(Box), } +impl Take for BlockStmtOrExpr { + fn dummy() -> Self { + BlockStmtOrExpr::Expr(Take::dummy()) + } +} + #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -562,6 +608,12 @@ pub enum PatOrExpr { Pat(Box), } +impl Take for PatOrExpr { + fn dummy() -> Self { + PatOrExpr::Pat(Take::dummy()) + } +} + impl From for Expr { fn from(value: bool) -> Self { Expr::Lit(Lit::Bool(Bool { diff --git a/ecmascript/ast/src/ident.rs b/ecmascript/ast/src/ident.rs index 8ce5a45819a..a5a8fe840f8 100644 --- a/ecmascript/ast/src/ident.rs +++ b/ecmascript/ast/src/ident.rs @@ -1,9 +1,8 @@ -use std::fmt::Display; - use crate::typescript::TsTypeAnn; use serde::{Deserialize, Serialize}; -use swc_atoms::JsWord; -use swc_common::{ast_node, EqIgnoreSpan, Span, Spanned}; +use std::fmt::Display; +use swc_atoms::{js_word, JsWord}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP}; /// Identifer used as a pattern. #[derive(Spanned, Clone, Debug, PartialEq, Eq, Hash, EqIgnoreSpan, Serialize, Deserialize)] @@ -35,6 +34,12 @@ pub struct Ident { pub optional: bool, } +impl Take for Ident { + fn dummy() -> Self { + Ident::new(js_word!(""), DUMMY_SP) + } +} + impl Display for Ident { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}{:?}", self.sym, self.span.ctxt) diff --git a/ecmascript/ast/src/jsx.rs b/ecmascript/ast/src/jsx.rs index 291bb43545e..fae9682cba3 100644 --- a/ecmascript/ast/src/jsx.rs +++ b/ecmascript/ast/src/jsx.rs @@ -6,7 +6,7 @@ use crate::{ }; use is_macro::Is; use swc_atoms::JsWord; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; /// Used for `obj` property of `JSXMemberExpr`. #[ast_node] @@ -93,6 +93,12 @@ pub enum JSXElementName { JSXNamespacedName(JSXNamespacedName), } +impl Take for JSXElementName { + fn dummy() -> Self { + JSXElementName::Ident(Take::dummy()) + } +} + #[ast_node("JSXOpeningElement")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -113,6 +119,18 @@ pub struct JSXOpeningElement { pub type_args: Option, } +impl Take for JSXOpeningElement { + fn dummy() -> Self { + JSXOpeningElement { + name: Take::dummy(), + span: DUMMY_SP, + attrs: Take::dummy(), + self_closing: Default::default(), + type_args: Take::dummy(), + } + } +} + #[ast_node] #[derive(Eq, Hash, EqIgnoreSpan)] #[allow(variant_size_differences)] @@ -203,6 +221,17 @@ pub struct JSXElement { pub closing: Option, } +impl Take for JSXElement { + fn dummy() -> Self { + JSXElement { + span: DUMMY_SP, + opening: Take::dummy(), + children: Take::dummy(), + closing: Take::dummy(), + } + } +} + #[ast_node] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -237,6 +266,17 @@ pub struct JSXFragment { pub closing: JSXClosingFragment, } +impl Take for JSXFragment { + fn dummy() -> Self { + JSXFragment { + span: DUMMY_SP, + opening: Take::dummy(), + children: Take::dummy(), + closing: Take::dummy(), + } + } +} + #[ast_node("JSXOpeningFragment")] #[derive(Eq, Hash, Copy, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -244,9 +284,21 @@ pub struct JSXOpeningFragment { pub span: Span, } +impl Take for JSXOpeningFragment { + fn dummy() -> Self { + JSXOpeningFragment { span: DUMMY_SP } + } +} + #[ast_node("JSXClosingFragment")] #[derive(Eq, Hash, Copy, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct JSXClosingFragment { pub span: Span, } + +impl Take for JSXClosingFragment { + fn dummy() -> Self { + JSXClosingFragment { span: DUMMY_SP } + } +} diff --git a/ecmascript/ast/src/lit.rs b/ecmascript/ast/src/lit.rs index e3ffb7dfd4b..37a4b1fd4ba 100644 --- a/ecmascript/ast/src/lit.rs +++ b/ecmascript/ast/src/lit.rs @@ -6,8 +6,8 @@ use std::{ hash::{Hash, Hasher}, mem, }; -use swc_atoms::JsWord; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_atoms::{js_word, JsWord}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, EqIgnoreSpan)] @@ -67,6 +67,17 @@ pub struct Str { pub kind: StrKind, } +impl Take for Str { + fn dummy() -> Self { + Str { + span: DUMMY_SP, + value: js_word!(""), + has_escape: Default::default(), + kind: Default::default(), + } + } +} + /// THis enum determines how string literal should be printed. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(tag = "type")] diff --git a/ecmascript/ast/src/module.rs b/ecmascript/ast/src/module.rs index 54bebd68d82..6a72c838698 100644 --- a/ecmascript/ast/src/module.rs +++ b/ecmascript/ast/src/module.rs @@ -1,7 +1,7 @@ use crate::{module_decl::ModuleDecl, stmt::Stmt}; use is_macro::Is; use swc_atoms::JsWord; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] @@ -37,6 +37,16 @@ impl<'a> arbitrary::Arbitrary<'a> for Module { } } +impl Take for Module { + fn dummy() -> Self { + Module { + span: DUMMY_SP, + body: Take::dummy(), + shebang: Take::dummy(), + } + } +} + #[ast_node("Script")] #[derive(Eq, Hash, EqIgnoreSpan)] pub struct Script { @@ -61,6 +71,16 @@ impl<'a> arbitrary::Arbitrary<'a> for Script { } } +impl Take for Script { + fn dummy() -> Self { + Script { + span: DUMMY_SP, + body: Take::dummy(), + shebang: Take::dummy(), + } + } +} + #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -78,3 +98,9 @@ pub enum ModuleItem { #[tag("*")] Stmt(Stmt), } + +impl Take for ModuleItem { + fn dummy() -> Self { + ModuleItem::Stmt(Take::dummy()) + } +} diff --git a/ecmascript/ast/src/module_decl.rs b/ecmascript/ast/src/module_decl.rs index e5ca0cc152c..9d67959fb3f 100644 --- a/ecmascript/ast/src/module_decl.rs +++ b/ecmascript/ast/src/module_decl.rs @@ -7,7 +7,7 @@ use crate::{ ObjectLit, }; use is_macro::Is; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] @@ -41,6 +41,12 @@ pub enum ModuleDecl { TsNamespaceExport(TsNamespaceExportDecl), } +impl Take for ModuleDecl { + fn dummy() -> Self { + ModuleDecl::Import(ImportDecl::dummy()) + } +} + #[ast_node("ExportDefaultExpression")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -80,6 +86,18 @@ pub struct ImportDecl { pub asserts: Option, } +impl Take for ImportDecl { + fn dummy() -> Self { + ImportDecl { + span: DUMMY_SP, + specifiers: Take::dummy(), + src: Take::dummy(), + type_only: Default::default(), + asserts: Take::dummy(), + } + } +} + /// `export * from 'mod'` #[ast_node("ExportAllDeclaration")] #[derive(Eq, Hash, EqIgnoreSpan)] diff --git a/ecmascript/ast/src/pat.rs b/ecmascript/ast/src/pat.rs index fca3cd8a850..2df19998383 100644 --- a/ecmascript/ast/src/pat.rs +++ b/ecmascript/ast/src/pat.rs @@ -6,7 +6,7 @@ use crate::{ Invalid, }; use is_macro::Is; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; impl From for Pat { fn from(i: Ident) -> Self { @@ -41,6 +41,12 @@ pub enum Pat { Expr(Box), } +impl Take for Pat { + fn dummy() -> Self { + Pat::Invalid(Invalid { span: DUMMY_SP }) + } +} + #[ast_node("ArrayPattern")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] diff --git a/ecmascript/ast/src/prop.rs b/ecmascript/ast/src/prop.rs index 309420db90f..a4a03d8ef3b 100644 --- a/ecmascript/ast/src/prop.rs +++ b/ecmascript/ast/src/prop.rs @@ -8,7 +8,7 @@ use crate::{ typescript::TsTypeAnn, }; use is_macro::Is; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span}; #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] @@ -107,6 +107,12 @@ pub enum PropName { BigInt(BigInt), } +impl Take for PropName { + fn dummy() -> Self { + PropName::Ident(Take::dummy()) + } +} + #[ast_node("Computed")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] diff --git a/ecmascript/ast/src/stmt.rs b/ecmascript/ast/src/stmt.rs index e36a74baf2a..80624815b6b 100644 --- a/ecmascript/ast/src/stmt.rs +++ b/ecmascript/ast/src/stmt.rs @@ -5,7 +5,7 @@ use crate::{ pat::Pat, }; use is_macro::Is; -use swc_common::{ast_node, EqIgnoreSpan, Span}; +use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; /// Use when only block statements are allowed. #[ast_node("BlockStatement")] @@ -18,6 +18,15 @@ pub struct BlockStmt { pub stmts: Vec, } +impl Take for BlockStmt { + fn dummy() -> Self { + BlockStmt { + span: DUMMY_SP, + stmts: vec![], + } + } +} + #[ast_node] #[derive(Eq, Hash, Is, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] @@ -94,6 +103,12 @@ pub enum Stmt { Expr(ExprStmt), } +impl Take for Stmt { + fn dummy() -> Self { + Self::Empty(EmptyStmt { span: DUMMY_SP }) + } +} + #[ast_node("ExpressionStatement")] #[derive(Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] diff --git a/ecmascript/codegen/Cargo.toml b/ecmascript/codegen/Cargo.toml index 034592c736a..34953b70ada 100644 --- a/ecmascript/codegen/Cargo.toml +++ b/ecmascript/codegen/Cargo.toml @@ -7,18 +7,18 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_codegen" repository = "https://github.com/swc-project/swc.git" -version = "0.69.0" +version = "0.69.1" [dependencies] bitflags = "1" num-bigint = {version = "0.2", features = ["serde"]} sourcemap = "6" swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} [dev-dependencies] -swc_common = {version = "0.11.6", path = "../../common", features = ["sourcemap"]} -testing = {version = "0.12.2", path = "../../testing"} +swc_common = {version = "0.11.9", path = "../../common", features = ["sourcemap"]} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/ecmascript/dep-graph/Cargo.toml b/ecmascript/dep-graph/Cargo.toml index d227fc5864f..2d9e31af4e2 100644 --- a/ecmascript/dep-graph/Cargo.toml +++ b/ecmascript/dep-graph/Cargo.toml @@ -6,14 +6,14 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_dep_graph" repository = "https://github.com/swc-project/swc.git" -version = "0.38.0" +version = "0.38.1" [dependencies] swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} [dev-dependencies] -swc_ecma_parser = {version = "0.69.0", path = "../parser"} -testing = {version = "0.12.2", path = "../../testing"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/ecmascript/ext-transforms/Cargo.toml b/ecmascript/ext-transforms/Cargo.toml index d368c7a1526..e59a8828d2a 100644 --- a/ecmascript/ext-transforms/Cargo.toml +++ b/ecmascript/ext-transforms/Cargo.toml @@ -5,15 +5,15 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/" edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_ext_transforms" -version = "0.27.0" +version = "0.27.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] phf = {version = "0.8.0", features = ["macros"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} -swc_ecma_utils = {version = "0.43.0", path = "../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} +swc_ecma_utils = {version = "0.43.1", path = "../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} diff --git a/ecmascript/ext-transforms/src/jest.rs b/ecmascript/ext-transforms/src/jest.rs index 48347ddecac..127d344c4d4 100644 --- a/ecmascript/ext-transforms/src/jest.rs +++ b/ecmascript/ext-transforms/src/jest.rs @@ -1,5 +1,5 @@ -use crate::util::MapWithMut; use phf::phf_set; +use swc_common::util::take::Take; use swc_ecma_ast::*; use swc_ecma_utils::{prepend_stmts, StmtLike}; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; diff --git a/ecmascript/ext-transforms/src/lib.rs b/ecmascript/ext-transforms/src/lib.rs index 2a006222a9b..1d8c60424b8 100644 --- a/ecmascript/ext-transforms/src/lib.rs +++ b/ecmascript/ext-transforms/src/lib.rs @@ -1,2 +1 @@ pub mod jest; -mod util; diff --git a/ecmascript/ext-transforms/src/util.rs b/ecmascript/ext-transforms/src/util.rs deleted file mode 100644 index 62dc6a7bdf9..00000000000 --- a/ecmascript/ext-transforms/src/util.rs +++ /dev/null @@ -1,91 +0,0 @@ -use std::mem::replace; -use swc_atoms::js_word; -use swc_common::DUMMY_SP; -use swc_ecma_ast::*; -/// Helper for migration from [Fold] to [VisitMut] -pub(crate) trait MapWithMut: Sized { - fn dummy() -> Self; - - fn take(&mut self) -> Self { - replace(self, Self::dummy()) - } - - #[inline] - fn map_with_mut(&mut self, op: F) - where - F: FnOnce(Self) -> Self, - { - let dummy = Self::dummy(); - let v = replace(self, dummy); - let v = op(v); - let _dummy = replace(self, v); - } -} - -impl MapWithMut for ModuleItem { - #[inline(always)] - fn dummy() -> Self { - ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) - } -} - -impl MapWithMut for Stmt { - #[inline(always)] - fn dummy() -> Self { - Stmt::Empty(EmptyStmt { span: DUMMY_SP }) - } -} - -impl MapWithMut for Expr { - #[inline(always)] - fn dummy() -> Self { - Expr::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Pat { - #[inline(always)] - fn dummy() -> Self { - Pat::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Option { - #[inline(always)] - fn dummy() -> Self { - None - } -} - -impl MapWithMut for Vec { - #[inline(always)] - fn dummy() -> Self { - Vec::new() - } -} - -impl MapWithMut for Box -where - T: MapWithMut, -{ - #[inline(always)] - fn dummy() -> Self { - Box::new(T::dummy()) - } -} - -impl MapWithMut for Ident { - fn dummy() -> Self { - Ident::new(js_word!(""), DUMMY_SP) - } -} - -impl MapWithMut for ObjectPatProp { - fn dummy() -> Self { - ObjectPatProp::Assign(AssignPatProp { - span: DUMMY_SP, - key: Ident::dummy(), - value: None, - }) - } -} diff --git a/ecmascript/jsdoc/Cargo.toml b/ecmascript/jsdoc/Cargo.toml index a96aa6f1377..95ab0206642 100644 --- a/ecmascript/jsdoc/Cargo.toml +++ b/ecmascript/jsdoc/Cargo.toml @@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/" edition = "2018" license = "Apache-2.0/MIT" name = "jsdoc" -version = "0.37.0" +version = "0.37.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -13,12 +13,12 @@ version = "0.37.0" nom = "5.1.2" serde = {version = "1", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} +swc_common = {version = "0.11.9", path = "../../common"} [dev-dependencies] anyhow = "1" dashmap = "4.0.2" -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} -testing = {version = "0.12.2", path = "../../testing"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} +testing = {version = "0.12.3", path = "../../testing"} walkdir = "2" diff --git a/ecmascript/loader/Cargo.toml b/ecmascript/loader/Cargo.toml index 5155ced78ae..0db1cdf70f5 100644 --- a/ecmascript/loader/Cargo.toml +++ b/ecmascript/loader/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_loader" repository = "https://github.com/swc-project/swc.git" -version = "0.17.0" +version = "0.17.1" [package.metadata.docs.rs] all-features = true @@ -30,12 +30,12 @@ regex = {version = "1", optional = true} serde = {version = "1.0.126", optional = true} serde_json = {version = "1.0.64", optional = true} swc_atoms = {version = "0.2.3", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} [dev-dependencies] -testing = {version = "0.12.2", path = "../../testing"} +testing = {version = "0.12.3", path = "../../testing"} [target.'cfg(windows)'.dependencies] normpath = {version = "0.2", optional = true} diff --git a/ecmascript/minifier/Cargo.toml b/ecmascript/minifier/Cargo.toml index 0c3d0948eb7..beca5b87ae4 100644 --- a/ecmascript/minifier/Cargo.toml +++ b/ecmascript/minifier/Cargo.toml @@ -25,20 +25,20 @@ serde = {version = "1.0.118", features = ["derive"]} serde_json = "1.0.61" serde_regex = "1.1.0" swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_codegen = {version = "0.69.0", path = "../codegen"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_codegen = {version = "0.69.1", path = "../codegen"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} swc_ecma_transforms = {version = "0.69.0", path = "../transforms/", features = ["optimization"]} -swc_ecma_transforms_base = {version = "0.29.0", path = "../transforms/base"} -swc_ecma_utils = {version = "0.43.0", path = "../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../transforms/base"} +swc_ecma_utils = {version = "0.43.1", path = "../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} unicode-xid = "0.2.2" [dev-dependencies] ansi_term = "0.12.1" anyhow = "1" pretty_assertions = "0.6.1" -swc_node_base = {version = "0.2.2", path = "../../node/base"} -testing = {version = "0.12.2", path = "../../testing"} +swc_node_base = {version = "0.2.3", path = "../../node/base"} +testing = {version = "0.12.3", path = "../../testing"} walkdir = "2.3.1" diff --git a/ecmascript/minifier/src/compress/hoist_decls.rs b/ecmascript/minifier/src/compress/hoist_decls.rs index a216ac78af6..b6d8faf497f 100644 --- a/ecmascript/minifier/src/compress/hoist_decls.rs +++ b/ecmascript/minifier/src/compress/hoist_decls.rs @@ -3,9 +3,8 @@ use crate::{ util::{is_hoisted_var_decl_without_init, sort::is_sorted_by_key, IsModuleItem}, }; use fxhash::FxHashSet; -use swc_common::{pass::Repeated, DUMMY_SP}; +use swc_common::{pass::Repeated, util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{find_ids, ident::IdentLike, Id, StmtLike}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith}; diff --git a/ecmascript/minifier/src/compress/optimize/bools.rs b/ecmascript/minifier/src/compress/optimize/bools.rs index 04778266388..f2cb7bd0043 100644 --- a/ecmascript/minifier/src/compress/optimize/bools.rs +++ b/ecmascript/minifier/src/compress/optimize/bools.rs @@ -5,9 +5,8 @@ use crate::{ mode::Mode, }; use swc_atoms::js_word; -use swc_common::Spanned; +use swc_common::{util::take::Take, Spanned}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, Type, Value::Known}; /// Methods related to the options `bools` and `bool_as_ints`. diff --git a/ecmascript/minifier/src/compress/optimize/conditionals.rs b/ecmascript/minifier/src/compress/optimize/conditionals.rs index 3390a37e52a..10e2ad34a60 100644 --- a/ecmascript/minifier/src/compress/optimize/conditionals.rs +++ b/ecmascript/minifier/src/compress/optimize/conditionals.rs @@ -9,9 +9,9 @@ use crate::{ DISABLE_BUGGY_PASSES, }; use std::mem::swap; -use swc_common::{EqIgnoreSpan, Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, EqIgnoreSpan, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::{AsOptExpr, ExprRefExt, MapWithMut}; +use swc_ecma_transforms_base::ext::{AsOptExpr, ExprRefExt}; use swc_ecma_utils::{ident::IdentLike, ExprExt, ExprFactory, StmtLike}; /// Methods related to the option `conditionals`. All methods are noop if diff --git a/ecmascript/minifier/src/compress/optimize/dead_code.rs b/ecmascript/minifier/src/compress/optimize/dead_code.rs index 89152276d8a..a7e7f27b465 100644 --- a/ecmascript/minifier/src/compress/optimize/dead_code.rs +++ b/ecmascript/minifier/src/compress/optimize/dead_code.rs @@ -1,7 +1,7 @@ use super::Optimizer; use crate::mode::Mode; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::ident::IdentLike; /// Methods related to option `dead_code`. diff --git a/ecmascript/minifier/src/compress/optimize/evaluate.rs b/ecmascript/minifier/src/compress/optimize/evaluate.rs index 4c905cc7602..bc4ace6179f 100644 --- a/ecmascript/minifier/src/compress/optimize/evaluate.rs +++ b/ecmascript/minifier/src/compress/optimize/evaluate.rs @@ -2,9 +2,8 @@ use super::Optimizer; use crate::{compress::util::eval_as_number, mode::Mode, DISABLE_BUGGY_PASSES}; use std::num::FpCategory; use swc_atoms::js_word; -use swc_common::{Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{util::take::Take, Spanned, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, Value::Known}; /// Methods related to the option `evaludate`. diff --git a/ecmascript/minifier/src/compress/optimize/fns.rs b/ecmascript/minifier/src/compress/optimize/fns.rs index 5d6a1813439..1637f83acb2 100644 --- a/ecmascript/minifier/src/compress/optimize/fns.rs +++ b/ecmascript/minifier/src/compress/optimize/fns.rs @@ -6,8 +6,8 @@ use crate::{ DISABLE_BUGGY_PASSES, }; use std::cmp::Ordering; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; impl Optimizer<'_, M> where diff --git a/ecmascript/minifier/src/compress/optimize/if_return.rs b/ecmascript/minifier/src/compress/optimize/if_return.rs index c8f74f4778a..e107893c2c4 100644 --- a/ecmascript/minifier/src/compress/optimize/if_return.rs +++ b/ecmascript/minifier/src/compress/optimize/if_return.rs @@ -5,9 +5,8 @@ use crate::{ mode::Mode, util::ExprOptExt, }; -use swc_common::{Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{prepend, undefined, StmtLike}; use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith}; diff --git a/ecmascript/minifier/src/compress/optimize/iife.rs b/ecmascript/minifier/src/compress/optimize/iife.rs index eef2102171d..b84b5b36a51 100644 --- a/ecmascript/minifier/src/compress/optimize/iife.rs +++ b/ecmascript/minifier/src/compress/optimize/iife.rs @@ -10,9 +10,8 @@ use std::{ mem::{replace, swap}, }; use swc_atoms::js_word; -use swc_common::{pass::Either, Spanned, DUMMY_SP}; +use swc_common::{pass::Either, util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, undefined, ExprFactory, Id}; use swc_ecma_visit::VisitMutWith; diff --git a/ecmascript/minifier/src/compress/optimize/inline.rs b/ecmascript/minifier/src/compress/optimize/inline.rs index 5a12cd594ff..619de0fe188 100644 --- a/ecmascript/minifier/src/compress/optimize/inline.rs +++ b/ecmascript/minifier/src/compress/optimize/inline.rs @@ -6,9 +6,8 @@ use crate::{ util::idents_used_by, }; use swc_atoms::js_word; -use swc_common::{Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, ExprExt, UsageFinder}; /// Methods related to option `inline`. diff --git a/ecmascript/minifier/src/compress/optimize/join_vars.rs b/ecmascript/minifier/src/compress/optimize/join_vars.rs index e3205e74c00..0a0258937f0 100644 --- a/ecmascript/minifier/src/compress/optimize/join_vars.rs +++ b/ecmascript/minifier/src/compress/optimize/join_vars.rs @@ -1,7 +1,7 @@ use super::Optimizer; use crate::{compress::util::is_directive, mode::Mode}; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::StmtLike; /// Methods related to option `join_vars`. diff --git a/ecmascript/minifier/src/compress/optimize/loops.rs b/ecmascript/minifier/src/compress/optimize/loops.rs index 2e6de47c033..74ff75c09fc 100644 --- a/ecmascript/minifier/src/compress/optimize/loops.rs +++ b/ecmascript/minifier/src/compress/optimize/loops.rs @@ -2,9 +2,8 @@ use crate::{ compress::optimize::{unused::UnreachableHandler, Optimizer}, mode::Mode, }; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Value::Known}; /// Methods related to the option `loops`. diff --git a/ecmascript/minifier/src/compress/optimize/mod.rs b/ecmascript/minifier/src/compress/optimize/mod.rs index 4578108859f..052576443ff 100644 --- a/ecmascript/minifier/src/compress/optimize/mod.rs +++ b/ecmascript/minifier/src/compress/optimize/mod.rs @@ -12,9 +12,10 @@ use fxhash::FxHashMap; use retain_mut::RetainMut; use std::{fmt::Write, mem::take}; use swc_atoms::{js_word, JsWord}; -use swc_common::{iter::IdentifyLast, pass::Repeated, Mark, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{ + iter::IdentifyLast, pass::Repeated, util::take::Take, Mark, Spanned, SyntaxContext, DUMMY_SP, +}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ ident::IdentLike, undefined, ExprExt, ExprFactory, Id, IsEmpty, ModuleItemLike, StmtLike, Type, Value, diff --git a/ecmascript/minifier/src/compress/optimize/ops.rs b/ecmascript/minifier/src/compress/optimize/ops.rs index bc516d7d187..88257a97d08 100644 --- a/ecmascript/minifier/src/compress/optimize/ops.rs +++ b/ecmascript/minifier/src/compress/optimize/ops.rs @@ -5,9 +5,8 @@ use crate::{ util::{make_bool, ValueExt}, }; use swc_atoms::js_word; -use swc_common::EqIgnoreSpan; +use swc_common::{util::take::Take, EqIgnoreSpan}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, ExprExt, Type, Value}; use Value::Known; diff --git a/ecmascript/minifier/src/compress/optimize/sequences.rs b/ecmascript/minifier/src/compress/optimize/sequences.rs index bbb5f232d63..f426715f0dc 100644 --- a/ecmascript/minifier/src/compress/optimize/sequences.rs +++ b/ecmascript/minifier/src/compress/optimize/sequences.rs @@ -12,9 +12,8 @@ use crate::{ use retain_mut::RetainMut; use std::mem::take; use swc_atoms::js_word; -use swc_common::{Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{contains_this_expr, ident::IdentLike, undefined, ExprExt, Id, StmtLike}; use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith}; diff --git a/ecmascript/minifier/src/compress/optimize/strings.rs b/ecmascript/minifier/src/compress/optimize/strings.rs index 24e65efda77..20313301888 100644 --- a/ecmascript/minifier/src/compress/optimize/strings.rs +++ b/ecmascript/minifier/src/compress/optimize/strings.rs @@ -1,9 +1,8 @@ use super::Optimizer; use crate::mode::Mode; use swc_atoms::js_word; -use swc_common::Spanned; +use swc_common::{util::take::Take, Spanned}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, ExprExt, Value::Known}; impl Optimizer<'_, M> diff --git a/ecmascript/minifier/src/compress/optimize/switches.rs b/ecmascript/minifier/src/compress/optimize/switches.rs index b7398bca20e..567afb0d793 100644 --- a/ecmascript/minifier/src/compress/optimize/switches.rs +++ b/ecmascript/minifier/src/compress/optimize/switches.rs @@ -1,9 +1,8 @@ use super::Optimizer; use crate::{mode::Mode, util::ExprOptExt}; use std::mem::take; -use swc_common::{EqIgnoreSpan, DUMMY_SP}; +use swc_common::{util::take::Take, EqIgnoreSpan, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, prepend, ExprExt, StmtExt, Type, Value::Known}; use swc_ecma_visit::{noop_visit_type, Node, Visit, VisitWith}; diff --git a/ecmascript/minifier/src/compress/optimize/unused.rs b/ecmascript/minifier/src/compress/optimize/unused.rs index 96b9fbe08d0..5f0f073487d 100644 --- a/ecmascript/minifier/src/compress/optimize/unused.rs +++ b/ecmascript/minifier/src/compress/optimize/unused.rs @@ -4,9 +4,8 @@ use crate::{ option::PureGetterOption, }; use swc_atoms::js_word; -use swc_common::{Span, DUMMY_SP}; +use swc_common::{util::take::Take, Span, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{contains_ident_ref, ident::IdentLike}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; diff --git a/ecmascript/minifier/src/compress/pure/arrows.rs b/ecmascript/minifier/src/compress/pure/arrows.rs index fbfddf7acb3..eb728a2d9f4 100644 --- a/ecmascript/minifier/src/compress/pure/arrows.rs +++ b/ecmascript/minifier/src/compress/pure/arrows.rs @@ -1,8 +1,7 @@ use super::Pure; use crate::mode::Mode; -use swc_common::Spanned; +use swc_common::{util::take::Take, Spanned}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::contains_this_expr; /// Methods related to the option `arrows`. diff --git a/ecmascript/minifier/src/compress/pure/bools.rs b/ecmascript/minifier/src/compress/pure/bools.rs index ffda6048af9..282f38b6815 100644 --- a/ecmascript/minifier/src/compress/pure/bools.rs +++ b/ecmascript/minifier/src/compress/pure/bools.rs @@ -6,9 +6,8 @@ use crate::{ }; use std::mem::swap; use swc_atoms::js_word; -use swc_common::{EqIgnoreSpan, Span, Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, EqIgnoreSpan, Span, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Type, Value}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/conds.rs b/ecmascript/minifier/src/compress/pure/conds.rs index f2386e3c404..54e2f309d49 100644 --- a/ecmascript/minifier/src/compress/pure/conds.rs +++ b/ecmascript/minifier/src/compress/pure/conds.rs @@ -1,9 +1,8 @@ use super::Pure; use crate::{compress::util::negate_cost, debug::dump, mode::Mode, util::make_bool}; use std::mem::swap; -use swc_common::{EqIgnoreSpan, Spanned}; +use swc_common::{util::take::Take, EqIgnoreSpan, Spanned}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Type, Value}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/dead_code.rs b/ecmascript/minifier/src/compress/pure/dead_code.rs index 795284c8517..60288d952e8 100644 --- a/ecmascript/minifier/src/compress/pure/dead_code.rs +++ b/ecmascript/minifier/src/compress/pure/dead_code.rs @@ -1,9 +1,8 @@ use super::Pure; use crate::{compress::util::always_terminates, mode::Mode}; use swc_atoms::js_word; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, StmtLike, Value}; /// Methods related to option `dead_code`. diff --git a/ecmascript/minifier/src/compress/pure/evaluate.rs b/ecmascript/minifier/src/compress/pure/evaluate.rs index bf1ccdcd6b1..d90d585fc45 100644 --- a/ecmascript/minifier/src/compress/pure/evaluate.rs +++ b/ecmascript/minifier/src/compress/pure/evaluate.rs @@ -4,9 +4,8 @@ use crate::{ mode::Mode, }; use swc_atoms::js_word; -use swc_common::{Spanned, SyntaxContext}; +use swc_common::{util::take::Take, Spanned, SyntaxContext}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{undefined, ExprExt, Value}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/loops.rs b/ecmascript/minifier/src/compress/pure/loops.rs index 508da6e0d1a..e76a076425f 100644 --- a/ecmascript/minifier/src/compress/pure/loops.rs +++ b/ecmascript/minifier/src/compress/pure/loops.rs @@ -1,8 +1,7 @@ use super::Pure; use crate::mode::Mode; -use swc_common::Spanned; +use swc_common::{util::take::Take, Spanned}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Value}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/numbers.rs b/ecmascript/minifier/src/compress/pure/numbers.rs index e6d8b32fdad..8d759b66692 100644 --- a/ecmascript/minifier/src/compress/pure/numbers.rs +++ b/ecmascript/minifier/src/compress/pure/numbers.rs @@ -1,7 +1,7 @@ use super::Pure; use crate::mode::Mode; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; impl Pure<'_, M> where diff --git a/ecmascript/minifier/src/compress/pure/sequences.rs b/ecmascript/minifier/src/compress/pure/sequences.rs index 97bbf926c38..9ca2b97ba28 100644 --- a/ecmascript/minifier/src/compress/pure/sequences.rs +++ b/ecmascript/minifier/src/compress/pure/sequences.rs @@ -1,8 +1,7 @@ use super::Pure; use crate::{compress::util::get_lhs_ident, mode::Mode}; -use swc_common::{SyntaxContext, DUMMY_SP}; +use swc_common::{util::take::Take, SyntaxContext, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, ExprFactory}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/strings.rs b/ecmascript/minifier/src/compress/pure/strings.rs index 6ecdc4012e6..0029d14ce7d 100644 --- a/ecmascript/minifier/src/compress/pure/strings.rs +++ b/ecmascript/minifier/src/compress/pure/strings.rs @@ -2,9 +2,8 @@ use super::Pure; use crate::mode::Mode; use std::mem::take; use swc_atoms::{js_word, JsWord}; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Type, Value}; impl Pure<'_, M> diff --git a/ecmascript/minifier/src/compress/pure/vars.rs b/ecmascript/minifier/src/compress/pure/vars.rs index 4a715bce499..a450aad80d7 100644 --- a/ecmascript/minifier/src/compress/pure/vars.rs +++ b/ecmascript/minifier/src/compress/pure/vars.rs @@ -1,8 +1,7 @@ use super::Pure; use crate::mode::Mode; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{prepend, StmtLike}; use swc_ecma_visit::{ noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith, diff --git a/ecmascript/minifier/src/compress/util.rs b/ecmascript/minifier/src/compress/util.rs index 16fa21bda2d..197e870489b 100644 --- a/ecmascript/minifier/src/compress/util.rs +++ b/ecmascript/minifier/src/compress/util.rs @@ -1,9 +1,8 @@ use crate::debug::dump; use std::f64; use swc_atoms::js_word; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ExprExt, Id, UsageFinder, Value}; use swc_ecma_visit::VisitWith; use unicode_xid::UnicodeXID; diff --git a/ecmascript/minifier/src/eval.rs b/ecmascript/minifier/src/eval.rs index 0ce80eb6c07..f3345c86937 100644 --- a/ecmascript/minifier/src/eval.rs +++ b/ecmascript/minifier/src/eval.rs @@ -6,10 +6,9 @@ use crate::{ use fxhash::FxHashMap; use std::sync::{Arc, Mutex}; use swc_atoms::js_word; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms::optimization::simplify::expr_simplifier; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, undefined, ExprExt, ExprFactory, Id}; use swc_ecma_visit::{FoldWith, VisitMutWith}; diff --git a/ecmascript/minifier/src/pass/postcompress.rs b/ecmascript/minifier/src/pass/postcompress.rs index 01b98f6536e..6ef25dc2f2b 100644 --- a/ecmascript/minifier/src/pass/postcompress.rs +++ b/ecmascript/minifier/src/pass/postcompress.rs @@ -1,6 +1,6 @@ use crate::{option::CompressOptions, DISABLE_BUGGY_PASSES}; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; pub fn postcompress_optimizer<'a>(options: &'a CompressOptions) -> impl 'a + VisitMut { diff --git a/ecmascript/minifier/src/pass/precompress.rs b/ecmascript/minifier/src/pass/precompress.rs index 1f0968d11be..4aaa68eb201 100644 --- a/ecmascript/minifier/src/pass/precompress.rs +++ b/ecmascript/minifier/src/pass/precompress.rs @@ -6,8 +6,8 @@ use crate::{ }; use fxhash::FxHashMap; use swc_atoms::js_word; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, Id}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith, VisitWith}; diff --git a/ecmascript/minifier/src/util/mod.rs b/ecmascript/minifier/src/util/mod.rs index 97ea1874d60..2201aec5569 100644 --- a/ecmascript/minifier/src/util/mod.rs +++ b/ecmascript/minifier/src/util/mod.rs @@ -2,10 +2,10 @@ use fxhash::FxHashSet; use std::time::Instant; use swc_common::{ pass::{CompilerPass, Repeated}, + util::take::Take, Mark, Span, DUMMY_SP, }; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, Id, ModuleItemLike, StmtLike, Value}; use swc_ecma_visit::{noop_visit_type, Fold, FoldWith, Node, Visit, VisitWith}; diff --git a/ecmascript/parser/Cargo.toml b/ecmascript/parser/Cargo.toml index 582c1c94192..9122e1648df 100644 --- a/ecmascript/parser/Cargo.toml +++ b/ecmascript/parser/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = "Apache-2.0/MIT" name = "swc_ecma_parser" repository = "https://github.com/swc-project/swc.git" -version = "0.69.0" +version = "0.69.1" [package.metadata.docs.rs] all-features = true @@ -26,16 +26,16 @@ num-bigint = "0.2" serde = {version = "1", features = ["derive"]} smallvec = "1" swc_atoms = {version = "0.2.3", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] env_logger = "0.7" pretty_assertions = "0.6" serde_json = "1" -testing = {version = "0.12.2", path = "../../testing"} +testing = {version = "0.12.3", path = "../../testing"} walkdir = "2" [[example]] diff --git a/ecmascript/preset-env/Cargo.toml b/ecmascript/preset-env/Cargo.toml index 056d1a63539..c0deb4aff24 100644 --- a/ecmascript/preset-env/Cargo.toml +++ b/ecmascript/preset-env/Cargo.toml @@ -20,15 +20,15 @@ serde_json = "1" st-map = "0.1.2" string_enum = {version = "0.3.1", path = "../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} swc_ecma_transforms = {version = "0.69.0", path = "../transforms", features = ["compat", "proposal"]} -swc_ecma_utils = {version = "0.43.0", path = "../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_ecma_utils = {version = "0.43.1", path = "../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} walkdir = "2" [dev-dependencies] pretty_assertions = "0.6" -swc_ecma_codegen = {version = "0.69.0", path = "../codegen"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} -testing = {version = "0.12.2", path = "../../testing"} +swc_ecma_codegen = {version = "0.69.1", path = "../codegen"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/ecmascript/transforms/Cargo.toml b/ecmascript/transforms/Cargo.toml index 15e87782fbf..d19f4e14a41 100644 --- a/ecmascript/transforms/Cargo.toml +++ b/ecmascript/transforms/Cargo.toml @@ -22,25 +22,25 @@ typescript = ["swc_ecma_transforms_typescript"] [dependencies] swc_atoms = {version = "0.2.0", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "./base"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "./base"} swc_ecma_transforms_compat = {version = "0.32.0", path = "./compat", optional = true} swc_ecma_transforms_module = {version = "0.36.0", path = "./module", optional = true} swc_ecma_transforms_optimization = {version = "0.39.0", path = "./optimization", optional = true} swc_ecma_transforms_proposal = {version = "0.36.0", path = "./proposal", optional = true} swc_ecma_transforms_react = {version = "0.37.0", path = "./react", optional = true} swc_ecma_transforms_typescript = {version = "0.38.0", path = "./typescript", optional = true} -swc_ecma_utils = {version = "0.43.0", path = "../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_ecma_utils = {version = "0.43.1", path = "../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] pretty_assertions = "0.6" sourcemap = "6" -swc_ecma_codegen = {version = "0.69.0", path = "../codegen"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "./testing"} +swc_ecma_codegen = {version = "0.69.1", path = "../codegen"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "./testing"} tempfile = "3" -testing = {version = "0.12.2", path = "../../testing"} +testing = {version = "0.12.3", path = "../../testing"} walkdir = "2" diff --git a/ecmascript/transforms/base/Cargo.toml b/ecmascript/transforms/base/Cargo.toml index 49cec0759a7..b34e87f5b74 100644 --- a/ecmascript/transforms/base/Cargo.toml +++ b/ecmascript/transforms/base/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_base" repository = "https://github.com/swc-project/swc.git" -version = "0.29.0" +version = "0.30.0" [dependencies] fxhash = "0.2.1" @@ -15,12 +15,12 @@ phf = {version = "0.8.0", features = ["macros"]} scoped-tls = "1.0.0" smallvec = "1.6.0" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"} -testing = {version = "0.12.2", path = "../../../testing"} +swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"} +testing = {version = "0.12.3", path = "../../../testing"} diff --git a/ecmascript/transforms/base/src/ext.rs b/ecmascript/transforms/base/src/ext.rs index af087c3f365..3ece4f8c60e 100644 --- a/ecmascript/transforms/base/src/ext.rs +++ b/ecmascript/transforms/base/src/ext.rs @@ -1,293 +1,10 @@ //! Do not use: This is not a public api and it can be changed without a version //! bump. -use std::{mem::replace, ops::DerefMut}; -use swc_atoms::js_word; -use swc_common::DUMMY_SP; +use std::ops::DerefMut; use swc_ecma_ast::*; use swc_ecma_utils::ExprExt; -/// Do not use: This is not a public api and it can be changed without a version -/// bump. -/// -/// Helper for migration from [Fold] to [VisitMut] -#[doc(hidden)] -pub trait MapWithMut: Sized { - fn dummy() -> Self; - - fn take(&mut self) -> Self { - replace(self, Self::dummy()) - } - - #[inline] - fn map_with_mut(&mut self, op: F) - where - F: FnOnce(Self) -> Self, - { - let dummy = Self::dummy(); - let v = replace(self, dummy); - let v = op(v); - let _dummy = replace(self, v); - } -} - -impl MapWithMut for Program { - #[inline] - fn dummy() -> Self { - Program::Module(Module::dummy()) - } -} - -impl MapWithMut for ModuleItem { - #[inline] - fn dummy() -> Self { - ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })) - } -} - -impl MapWithMut for Stmt { - #[inline] - fn dummy() -> Self { - Stmt::Empty(EmptyStmt { span: DUMMY_SP }) - } -} - -impl MapWithMut for Expr { - #[inline] - fn dummy() -> Self { - Expr::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Pat { - #[inline] - fn dummy() -> Self { - Pat::Invalid(Invalid { span: DUMMY_SP }) - } -} - -impl MapWithMut for Option { - #[inline] - fn dummy() -> Self { - None - } -} - -impl MapWithMut for Vec { - #[inline] - fn dummy() -> Self { - Vec::new() - } -} - -impl MapWithMut for Box -where - T: MapWithMut, -{ - #[inline] - fn dummy() -> Self { - Box::new(T::dummy()) - } -} - -impl MapWithMut for Ident { - fn dummy() -> Self { - Ident::new(js_word!(""), DUMMY_SP) - } -} - -impl MapWithMut for BindingIdent { - fn dummy() -> Self { - Ident::dummy().into() - } -} - -impl MapWithMut for ObjectPatProp { - fn dummy() -> Self { - ObjectPatProp::Assign(AssignPatProp { - span: DUMMY_SP, - key: Ident::dummy(), - value: None, - }) - } -} - -impl MapWithMut for PatOrExpr { - fn dummy() -> Self { - PatOrExpr::Pat(Box::new(Pat::Ident(BindingIdent::dummy()))) - } -} - -impl MapWithMut for Module { - fn dummy() -> Self { - Module { - span: DUMMY_SP, - body: vec![], - shebang: None, - } - } -} - -impl MapWithMut for JSXElement { - fn dummy() -> Self { - JSXElement { - span: DUMMY_SP, - opening: MapWithMut::dummy(), - children: MapWithMut::dummy(), - closing: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for ExprOrSuper { - fn dummy() -> Self { - ExprOrSuper::Super(Super { span: DUMMY_SP }) - } -} - -impl MapWithMut for CallExpr { - fn dummy() -> Self { - CallExpr { - span: DUMMY_SP, - callee: MapWithMut::dummy(), - args: MapWithMut::dummy(), - type_args: Default::default(), - } - } -} -impl MapWithMut for JSXOpeningElement { - fn dummy() -> Self { - JSXOpeningElement { - span: DUMMY_SP, - name: MapWithMut::dummy(), - attrs: MapWithMut::dummy(), - self_closing: false, - type_args: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for NewExpr { - fn dummy() -> Self { - NewExpr { - span: DUMMY_SP, - callee: MapWithMut::dummy(), - args: MapWithMut::dummy(), - type_args: Default::default(), - } - } -} -impl MapWithMut for JSXClosingElement { - fn dummy() -> Self { - JSXClosingElement { - span: DUMMY_SP, - name: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for Decl { - fn dummy() -> Self { - Decl::Var(MapWithMut::dummy()) - } -} - -impl MapWithMut for VarDecl { - fn dummy() -> Self { - VarDecl { - span: DUMMY_SP, - kind: VarDeclKind::Var, - declare: false, - decls: vec![], - } - } -} -impl MapWithMut for JSXElementName { - fn dummy() -> Self { - JSXElementName::Ident(Ident::dummy()) - } -} - -impl MapWithMut for JSXFragment { - fn dummy() -> Self { - JSXFragment { - span: DUMMY_SP, - opening: MapWithMut::dummy(), - children: MapWithMut::dummy(), - closing: MapWithMut::dummy(), - } - } -} - -impl MapWithMut for PropName { - #[inline] - fn dummy() -> Self { - PropName::Ident(Ident::dummy()) - } -} - -impl MapWithMut for BlockStmtOrExpr { - #[inline] - fn dummy() -> Self { - BlockStmtOrExpr::Expr(MapWithMut::dummy()) - } -} - -impl MapWithMut for VarDeclarator { - #[inline] - fn dummy() -> Self { - VarDeclarator { - span: DUMMY_SP, - name: Pat::dummy(), - init: None, - definite: Default::default(), - } - } -} - -impl MapWithMut for TplElement { - #[inline] - fn dummy() -> Self { - TplElement { - span: DUMMY_SP, - tail: false, - cooked: None, - raw: Str { - span: DUMMY_SP, - value: "".into(), - has_escape: false, - kind: Default::default(), - }, - } - } -} -impl MapWithMut for JSXOpeningFragment { - fn dummy() -> Self { - JSXOpeningFragment { span: DUMMY_SP } - } -} - -impl MapWithMut for JSXClosingFragment { - fn dummy() -> Self { - JSXClosingFragment { span: DUMMY_SP } - } -} - -impl MapWithMut for Class { - fn dummy() -> Self { - Class { - span: DUMMY_SP, - decorators: Default::default(), - body: Default::default(), - super_class: Default::default(), - is_abstract: Default::default(), - type_params: Default::default(), - super_type_params: Default::default(), - implements: Default::default(), - } - } -} - /// Do not use: This is not a public api and it can be changed without a version /// bump. pub trait PatOrExprExt: AsOptExpr { diff --git a/ecmascript/transforms/base/src/fixer.rs b/ecmascript/transforms/base/src/fixer.rs index f86893384b3..4115a32a0ba 100644 --- a/ecmascript/transforms/base/src/fixer.rs +++ b/ecmascript/transforms/base/src/fixer.rs @@ -1,6 +1,6 @@ -use crate::ext::{AsOptExpr, MapWithMut, PatOrExprExt}; +use crate::ext::{AsOptExpr, PatOrExprExt}; use fxhash::FxHashMap; -use swc_common::{comments::Comments, Span, Spanned}; +use swc_common::{comments::Comments, util::take::Take, Span, Spanned}; use swc_ecma_ast::*; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; diff --git a/ecmascript/transforms/base/src/hygiene/mod.rs b/ecmascript/transforms/base/src/hygiene/mod.rs index 92f72e13d25..39aeeeca6a5 100644 --- a/ecmascript/transforms/base/src/hygiene/mod.rs +++ b/ecmascript/transforms/base/src/hygiene/mod.rs @@ -1,6 +1,5 @@ use self::ops::{Operations, Operator}; use crate::{ - ext::MapWithMut, native::{is_native, is_native_word}, scope::{IdentType, ScopeKind}, }; @@ -8,7 +7,7 @@ use fxhash::{FxHashMap, FxHashSet}; use smallvec::{smallvec, SmallVec}; use std::{cell::RefCell, collections::HashMap}; use swc_atoms::{js_word, JsWord}; -use swc_common::{chain, SyntaxContext}; +use swc_common::{chain, util::take::Take, SyntaxContext}; use swc_ecma_ast::*; use swc_ecma_utils::ident::IdentLike; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; diff --git a/ecmascript/transforms/base/src/hygiene/ops.rs b/ecmascript/transforms/base/src/hygiene/ops.rs index 25ce5aeb46d..bc7b5e3be13 100644 --- a/ecmascript/transforms/base/src/hygiene/ops.rs +++ b/ecmascript/transforms/base/src/hygiene/ops.rs @@ -1,7 +1,9 @@ -use crate::ext::MapWithMut; use fxhash::FxHashMap; use swc_atoms::JsWord; -use swc_common::{util::move_map::MoveMap, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{ + util::{move_map::MoveMap, take::Take}, + Spanned, SyntaxContext, DUMMY_SP, +}; use swc_ecma_ast::*; use swc_ecma_utils::{ident::IdentLike, Id}; use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith}; diff --git a/ecmascript/transforms/classes/Cargo.toml b/ecmascript/transforms/classes/Cargo.toml index 95673b99754..c92b10f4f50 100644 --- a/ecmascript/transforms/classes/Cargo.toml +++ b/ecmascript/transforms/classes/Cargo.toml @@ -6,12 +6,12 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_classes" repository = "https://github.com/swc-project/swc.git" -version = "0.15.0" +version = "0.16.0" [dependencies] swc_atoms = {version = "0.2.6", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} diff --git a/ecmascript/transforms/compat/Cargo.toml b/ecmascript/transforms/compat/Cargo.toml index 54a426b24c1..853f7cc39fc 100644 --- a/ecmascript/transforms/compat/Cargo.toml +++ b/ecmascript/transforms/compat/Cargo.toml @@ -19,15 +19,15 @@ ordered-float = "2.0.1" serde = {version = "1.0.118", features = ["derive"]} smallvec = "1.6.0" swc_atoms = {version = "0.2.5", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_transforms_classes = {version = "0.15.0", path = "../classes"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_transforms_classes = {version = "0.16.0", path = "../classes"} swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"} -testing = {version = "0.12.2", path = "../../../testing"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"} +testing = {version = "0.12.3", path = "../../../testing"} diff --git a/ecmascript/transforms/compat/src/es2015/parameters.rs b/ecmascript/transforms/compat/src/es2015/parameters.rs index adb1bcd4838..7802a54db38 100644 --- a/ecmascript/transforms/compat/src/es2015/parameters.rs +++ b/ecmascript/transforms/compat/src/es2015/parameters.rs @@ -1,7 +1,6 @@ use arrayvec::ArrayVec; -use swc_common::{Mark, Spanned, DUMMY_SP}; +use swc_common::{util::take::Take, Mark, Spanned, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ contains_this_expr, member_expr, prepend, prepend_stmts, private_ident, quote_ident, ExprFactory, diff --git a/ecmascript/transforms/compat/src/es2015/typeof_symbol.rs b/ecmascript/transforms/compat/src/es2015/typeof_symbol.rs index 3c58db4cb2a..17f70fa1226 100644 --- a/ecmascript/transforms/compat/src/es2015/typeof_symbol.rs +++ b/ecmascript/transforms/compat/src/es2015/typeof_symbol.rs @@ -1,7 +1,7 @@ use swc_atoms::js_word; -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ext::MapWithMut, helper, perf::Check}; +use swc_ecma_transforms_base::{helper, perf::Check}; use swc_ecma_transforms_macros::fast_path; use swc_ecma_utils::{quote_str, ExprFactory}; use swc_ecma_visit::{ diff --git a/ecmascript/transforms/compat/src/es2020/nullish_coalescing/mod.rs b/ecmascript/transforms/compat/src/es2020/nullish_coalescing/mod.rs index ac21d8edf98..c31ff90ec72 100644 --- a/ecmascript/transforms/compat/src/es2020/nullish_coalescing/mod.rs +++ b/ecmascript/transforms/compat/src/es2020/nullish_coalescing/mod.rs @@ -1,7 +1,7 @@ use std::mem::replace; -use swc_common::{Span, DUMMY_SP}; +use swc_common::{util::take::Take, Span, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ext::MapWithMut, perf::Check}; +use swc_ecma_transforms_base::perf::Check; use swc_ecma_transforms_macros::fast_path; use swc_ecma_utils::{alias_if_required, undefined, StmtLike}; use swc_ecma_visit::{noop_fold_type, noop_visit_type, Fold, FoldWith, Node, Visit, VisitWith}; diff --git a/ecmascript/transforms/compat/src/es2021/logical_assignments.rs b/ecmascript/transforms/compat/src/es2021/logical_assignments.rs index cdd69d3c39c..f06bd1b395e 100644 --- a/ecmascript/transforms/compat/src/es2021/logical_assignments.rs +++ b/ecmascript/transforms/compat/src/es2021/logical_assignments.rs @@ -1,6 +1,6 @@ -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ext::MapWithMut, perf::Check}; +use swc_ecma_transforms_base::perf::Check; use swc_ecma_transforms_macros::fast_path; use swc_ecma_utils::{alias_ident_for, prepend, ExprFactory}; use swc_ecma_visit::{ diff --git a/ecmascript/transforms/module/Cargo.toml b/ecmascript/transforms/module/Cargo.toml index 8e4ff023733..3c49ebeffdb 100644 --- a/ecmascript/transforms/module/Cargo.toml +++ b/ecmascript/transforms/module/Cargo.toml @@ -17,15 +17,15 @@ indexmap = "1.6.1" pathdiff = "0.2.0" serde = {version = "1.0.118", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_loader = {version = "0.17.0", path = "../../loader", features = ["node"]} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_loader = {version = "0.17.1", path = "../../loader", features = ["node"]} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing/"} -testing = {version = "0.12.2", path = "../../../testing/"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing/"} +testing = {version = "0.12.3", path = "../../../testing/"} diff --git a/ecmascript/transforms/module/src/util.rs b/ecmascript/transforms/module/src/util.rs index fb747bf81a1..99d02eba281 100644 --- a/ecmascript/transforms/module/src/util.rs +++ b/ecmascript/transforms/module/src/util.rs @@ -12,10 +12,10 @@ use std::{ use swc_atoms::{js_word, JsWord}; use swc_common::{ collections::{AHashMap, AHashSet}, + util::take::Take, FileName, Mark, Span, SyntaxContext, DUMMY_SP, }; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ ident::IdentLike, member_expr, private_ident, quote_ident, quote_str, undefined, DestructuringFinder, ExprFactory, diff --git a/ecmascript/transforms/optimization/Cargo.toml b/ecmascript/transforms/optimization/Cargo.toml index b97afc78901..613e9537c8b 100644 --- a/ecmascript/transforms/optimization/Cargo.toml +++ b/ecmascript/transforms/optimization/Cargo.toml @@ -18,18 +18,18 @@ once_cell = "1.5.2" retain_mut = "0.1.2" serde_json = "1.0.61" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"} swc_ecma_transforms_module = {version = "0.36.0", path = "../module"} swc_ecma_transforms_proposal = {version = "0.36.0", path = "../proposal"} swc_ecma_transforms_react = {version = "0.37.0", path = "../react"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"} swc_ecma_transforms_typescript = {version = "0.38.0", path = "../typescript"} -testing = {version = "0.12.2", path = "../../../testing"} +testing = {version = "0.12.3", path = "../../../testing"} diff --git a/ecmascript/transforms/optimization/src/simplify/branch/mod.rs b/ecmascript/transforms/optimization/src/simplify/branch/mod.rs index f31e7b57f7a..d0d1611af08 100644 --- a/ecmascript/transforms/optimization/src/simplify/branch/mod.rs +++ b/ecmascript/transforms/optimization/src/simplify/branch/mod.rs @@ -2,11 +2,11 @@ use std::{borrow::Cow, cmp::min, iter::once, mem::take}; use swc_atoms::js_word; use swc_common::{ pass::{CompilerPass, Repeated}, - util::move_map::MoveMap, + util::{move_map::MoveMap, take::Take}, Spanned, DUMMY_SP, }; use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ext::MapWithMut, pass::RepeatedJsPass}; +use swc_ecma_transforms_base::pass::RepeatedJsPass; use swc_ecma_utils::{ extract_var_ids, is_literal, prepend, preserve_effects, undefined, ExprExt, ExprFactory, Hoister, IsEmpty, StmtExt, StmtLike, Value::Known, diff --git a/ecmascript/transforms/optimization/src/simplify/const_propgation.rs b/ecmascript/transforms/optimization/src/simplify/const_propgation.rs index 0f4e55f8a4c..cb107e0f60e 100644 --- a/ecmascript/transforms/optimization/src/simplify/const_propgation.rs +++ b/ecmascript/transforms/optimization/src/simplify/const_propgation.rs @@ -1,6 +1,6 @@ use fxhash::FxHashMap; +use swc_common::util::take::Take; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ident::IdentLike, Id}; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; diff --git a/ecmascript/transforms/optimization/src/simplify/expr/mod.rs b/ecmascript/transforms/optimization/src/simplify/expr/mod.rs index a30692dee64..33bec087f80 100644 --- a/ecmascript/transforms/optimization/src/simplify/expr/mod.rs +++ b/ecmascript/transforms/optimization/src/simplify/expr/mod.rs @@ -2,13 +2,11 @@ use std::{borrow::Cow, iter, iter::once}; use swc_atoms::{js_word, JsWord}; use swc_common::{ pass::{CompilerPass, Repeated}, + util::take::Take, Span, Spanned, DUMMY_SP, }; use swc_ecma_ast::{Ident, Lit, *}; -use swc_ecma_transforms_base::{ - ext::{ExprRefExt, MapWithMut}, - pass::RepeatedJsPass, -}; +use swc_ecma_transforms_base::{ext::ExprRefExt, pass::RepeatedJsPass}; use swc_ecma_utils::{ alias_ident_for, extract_side_effects_to, ident::IdentLike, is_literal, prepend, preserve_effects, prop_name_eq, to_int32, undefined, BoolType, ExprExt, NullType, NumberType, diff --git a/ecmascript/transforms/optimization/src/simplify/inlining/mod.rs b/ecmascript/transforms/optimization/src/simplify/inlining/mod.rs index bd46ddf3e38..47878327d38 100644 --- a/ecmascript/transforms/optimization/src/simplify/inlining/mod.rs +++ b/ecmascript/transforms/optimization/src/simplify/inlining/mod.rs @@ -2,14 +2,11 @@ use self::scope::{Scope, ScopeKind, VarType}; use std::borrow::Cow; use swc_common::{ pass::{CompilerPass, Repeated}, + util::take::Take, DUMMY_SP, }; use swc_ecma_ast::*; -use swc_ecma_transforms_base::{ - ext::{MapWithMut, PatOrExprExt}, - pass::RepeatedJsPass, - scope::IdentType, -}; +use swc_ecma_transforms_base::{ext::PatOrExprExt, pass::RepeatedJsPass, scope::IdentType}; use swc_ecma_utils::{contains_this_expr, find_ids, ident::IdentLike, undefined, Id}; use swc_ecma_visit::{ as_folder, noop_visit_mut_type, noop_visit_type, Node, Visit, VisitMut, VisitMutWith, VisitWith, diff --git a/ecmascript/transforms/proposal/Cargo.toml b/ecmascript/transforms/proposal/Cargo.toml index 355020438b0..fb23c50cd3d 100644 --- a/ecmascript/transforms/proposal/Cargo.toml +++ b/ecmascript/transforms/proposal/Cargo.toml @@ -20,16 +20,16 @@ fxhash = "0.2.1" serde = {version = "1.0.118", features = ["derive"]} smallvec = "1.6.0" swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_loader = {version = "0.17.0", path = "../../loader", optional = true} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_transforms_classes = {version = "0.15.0", path = "../classes"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_loader = {version = "0.17.1", path = "../../loader", optional = true} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_transforms_classes = {version = "0.16.0", path = "../classes"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"} swc_ecma_transforms_module = {version = "0.36.0", path = "../module"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"} diff --git a/ecmascript/transforms/react/Cargo.toml b/ecmascript/transforms/react/Cargo.toml index 7bded79c54e..9c643b9b9ec 100644 --- a/ecmascript/transforms/react/Cargo.toml +++ b/ecmascript/transforms/react/Cargo.toml @@ -20,16 +20,16 @@ serde = {version = "1.0.118", features = ["derive"]} sha-1 = "0.9.4" string_enum = {version = "0.3.1", path = "../../../macros/string_enum"} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.69.0", path = "../../codegen/"} +swc_ecma_codegen = {version = "0.69.1", path = "../../codegen/"} swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat/"} swc_ecma_transforms_module = {version = "0.36.0", path = "../module"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing/"} -testing = {version = "0.12.2", path = "../../../testing"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing/"} +testing = {version = "0.12.3", path = "../../../testing"} diff --git a/ecmascript/transforms/react/src/jsx/mod.rs b/ecmascript/transforms/react/src/jsx/mod.rs index 0a008869e99..fd5c5db8355 100644 --- a/ecmascript/transforms/react/src/jsx/mod.rs +++ b/ecmascript/transforms/react/src/jsx/mod.rs @@ -10,11 +10,12 @@ use swc_common::{ comments::{CommentKind, Comments}, iter::IdentifyLast, sync::Lrc, + util::take::Take, FileName, SourceMap, Spanned, DUMMY_SP, }; use swc_ecma_ast::*; use swc_ecma_parser::{Parser, StringInput, Syntax}; -use swc_ecma_transforms_base::{ext::MapWithMut, helper}; +use swc_ecma_transforms_base::helper; use swc_ecma_utils::{ drop_span, member_expr, prepend, private_ident, quote_ident, ExprFactory, HANDLER, }; diff --git a/ecmascript/transforms/react/src/refresh/mod.rs b/ecmascript/transforms/react/src/refresh/mod.rs index 6efc885ea1f..0ca88eda9d6 100644 --- a/ecmascript/transforms/react/src/refresh/mod.rs +++ b/ecmascript/transforms/react/src/refresh/mod.rs @@ -14,10 +14,10 @@ use swc_common::{ collections::{AHashMap, AHashSet}, comments::{Comments, CommentsExt}, sync::Lrc, + util::take::Take, BytePos, SourceMap, Span, Spanned, DUMMY_SP, }; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{private_ident, quote_ident, quote_str}; use swc_ecma_visit::{Fold, FoldWith, Node, Visit}; use util::{ diff --git a/ecmascript/transforms/testing/Cargo.toml b/ecmascript/transforms/testing/Cargo.toml index 4f8145aaca6..08836665709 100644 --- a/ecmascript/transforms/testing/Cargo.toml +++ b/ecmascript/transforms/testing/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_testing" repository = "https://github.com/swc-project/swc.git" -version = "0.29.0" +version = "0.30.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,12 +15,12 @@ ansi_term = "0.12.1" anyhow = "1" serde = "1" serde_json = "1" -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} tempfile = "3.1.0" -testing = {version = "0.12.2", path = "../../../testing"} +testing = {version = "0.12.3", path = "../../../testing"} diff --git a/ecmascript/transforms/typescript/Cargo.toml b/ecmascript/transforms/typescript/Cargo.toml index 2416d07ad47..5b15555cdb2 100644 --- a/ecmascript/transforms/typescript/Cargo.toml +++ b/ecmascript/transforms/typescript/Cargo.toml @@ -13,18 +13,18 @@ version = "0.38.0" fxhash = "0.2.1" serde = {version = "1.0.118", features = ["derive"]} swc_atoms = {version = "0.2", path = "../../../atoms"} -swc_common = {version = "0.11.6", path = "../../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ast"} -swc_ecma_parser = {version = "0.69.0", path = "../../parser"} -swc_ecma_transforms_base = {version = "0.29.0", path = "../base"} -swc_ecma_utils = {version = "0.43.0", path = "../../utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../visit"} +swc_common = {version = "0.11.9", path = "../../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ast"} +swc_ecma_parser = {version = "0.69.1", path = "../../parser"} +swc_ecma_transforms_base = {version = "0.30.0", path = "../base"} +swc_ecma_utils = {version = "0.43.1", path = "../../utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../visit"} [dev-dependencies] -swc_ecma_codegen = {version = "0.69.0", path = "../../codegen"} +swc_ecma_codegen = {version = "0.69.1", path = "../../codegen"} swc_ecma_transforms_compat = {version = "0.32.0", path = "../compat"} swc_ecma_transforms_module = {version = "0.36.0", path = "../module"} swc_ecma_transforms_proposal = {version = "0.36.0", path = "../proposal/"} -swc_ecma_transforms_testing = {version = "0.29.0", path = "../testing"} -testing = {version = "0.12.2", path = "../../../testing"} +swc_ecma_transforms_testing = {version = "0.30.0", path = "../testing"} +testing = {version = "0.12.3", path = "../../../testing"} walkdir = "2.3.1" diff --git a/ecmascript/transforms/typescript/src/strip.rs b/ecmascript/transforms/typescript/src/strip.rs index 15b6785c405..91807c6978b 100644 --- a/ecmascript/transforms/typescript/src/strip.rs +++ b/ecmascript/transforms/typescript/src/strip.rs @@ -2,9 +2,11 @@ use fxhash::{FxHashMap, FxHashSet}; use serde::{Deserialize, Serialize}; use std::{borrow::Borrow, mem::take}; use swc_atoms::{js_word, JsWord}; -use swc_common::{util::move_map::MoveMap, Span, Spanned, SyntaxContext, DUMMY_SP}; +use swc_common::{ + util::{move_map::MoveMap, take::Take}, + Span, Spanned, SyntaxContext, DUMMY_SP, +}; use swc_ecma_ast::*; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_utils::{ constructor::inject_after_super, default_constructor, ident::IdentLike, member_expr, prepend, private_ident, quote_ident, replace_ident, var::VarCollector, ExprFactory, Id, ModuleItemLike, diff --git a/ecmascript/utils/Cargo.toml b/ecmascript/utils/Cargo.toml index 3e4c7ed646f..3fedb50c85e 100644 --- a/ecmascript/utils/Cargo.toml +++ b/ecmascript/utils/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_utils" repository = "https://github.com/swc-project/swc.git" -version = "0.43.0" +version = "0.43.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,10 +14,10 @@ version = "0.43.0" once_cell = "1" scoped-tls = "1" swc_atoms = {version = "0.2.0", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} -swc_ecma_visit = {version = "0.37.0", path = "../visit"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} +swc_ecma_visit = {version = "0.37.1", path = "../visit"} unicode-xid = "0.2" [dev-dependencies] -testing = {version = "0.12.2", path = "../../testing"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/ecmascript/visit/Cargo.toml b/ecmascript/visit/Cargo.toml index 20284a0ee88..4c58377b3c0 100644 --- a/ecmascript/visit/Cargo.toml +++ b/ecmascript/visit/Cargo.toml @@ -6,11 +6,11 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_visit" repository = "https://github.com/swc-project/swc.git" -version = "0.37.0" +version = "0.37.1" [dependencies] num-bigint = {version = "0.2", features = ["serde"]} swc_atoms = {version = "0.2", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ast"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ast"} swc_visit = {version = "0.2.3", path = "../../visit"} diff --git a/node/base/Cargo.toml b/node/base/Cargo.toml index 76df17f9825..293c05ae170 100644 --- a/node/base/Cargo.toml +++ b/node/base/Cargo.toml @@ -6,13 +6,13 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_node_base" repository = "https://github.com/swc-project/swc.git" -version = "0.2.2" +version = "0.2.3" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] dashmap = "4.0.2" -swc_common = {version = "0.11.6", path = "../../common"} +swc_common = {version = "0.11.9", path = "../../common"} [target.'cfg(all(target_arch = "x86_64", not(target_env = "musl")))'.dependencies] mimalloc-rust = "=0.1.1" diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml index 572367e4ed3..1636d3e7376 100644 --- a/plugin/Cargo.toml +++ b/plugin/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_plugin" repository = "https://github.com/swc-project/swc.git" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -16,7 +16,7 @@ anyhow = "1.0.41" serde = "1.0.126" serde_json = "1.0.64" swc_atoms = {version = "0.2.7", path = "../atoms"} -swc_common = {version = "0.11.6", path = "../common"} -swc_ecma_ast = {version = "0.51.0", path = "../ecmascript/ast"} -swc_ecma_utils = {version = "0.43.0", path = "../ecmascript/utils"} -swc_ecma_visit = {version = "0.37.0", path = "../ecmascript/visit"} +swc_common = {version = "0.11.9", path = "../common"} +swc_ecma_ast = {version = "0.51.1", path = "../ecmascript/ast"} +swc_ecma_utils = {version = "0.43.1", path = "../ecmascript/utils"} +swc_ecma_visit = {version = "0.37.1", path = "../ecmascript/visit"} diff --git a/plugin/runner/Cargo.toml b/plugin/runner/Cargo.toml index 8fc98cda20e..897930fb911 100644 --- a/plugin/runner/Cargo.toml +++ b/plugin/runner/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_plugin_runner" repository = "https://github.com/swc-project/swc.git" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -16,11 +16,11 @@ libloading = "0.7.0" serde = {version = "1.0.126", features = ["derive"]} serde_json = "1.0.64" swc_atoms = "0.2.7" -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ecmascript/ast"} -swc_ecma_parser = {version = "0.69.0", path = "../../ecmascript/parser"} -swc_plugin = {version = "0.3.0", path = "../"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ecmascript/ast"} +swc_ecma_parser = {version = "0.69.1", path = "../../ecmascript/parser"} +swc_plugin = {version = "0.3.1", path = "../"} [dev-dependencies] -swc_ecma_codegen = {version = "0.69.0", path = "../../ecmascript/codegen"} -testing = {version = "0.12.2", path = "../../testing"} +swc_ecma_codegen = {version = "0.69.1", path = "../../ecmascript/codegen"} +testing = {version = "0.12.3", path = "../../testing"} diff --git a/plugin/testing/Cargo.toml b/plugin/testing/Cargo.toml index 728db8d7e4b..1c7f53cd33b 100644 --- a/plugin/testing/Cargo.toml +++ b/plugin/testing/Cargo.toml @@ -6,16 +6,16 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_plugin_testing" repository = "https://github.com/swc-project/swc.git" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1.0.41" swc_atoms = {version = "0.2.7", path = "../../atoms"} -swc_common = {version = "0.11.6", path = "../../common"} -swc_ecma_ast = {version = "0.51.0", path = "../../ecmascript/ast"} -swc_ecma_codegen = {version = "0.69.0", path = "../../ecmascript/codegen"} -swc_ecma_utils = {version = "0.43.0", path = "../../ecmascript/utils"} -swc_ecma_visit = {version = "0.37.0", path = "../../ecmascript/visit"} -swc_plugin = {version = "0.3.0", path = "../"} +swc_common = {version = "0.11.9", path = "../../common"} +swc_ecma_ast = {version = "0.51.1", path = "../../ecmascript/ast"} +swc_ecma_codegen = {version = "0.69.1", path = "../../ecmascript/codegen"} +swc_ecma_utils = {version = "0.43.1", path = "../../ecmascript/utils"} +swc_ecma_visit = {version = "0.37.1", path = "../../ecmascript/visit"} +swc_plugin = {version = "0.3.1", path = "../"} diff --git a/src/builder.rs b/src/builder.rs index 8a861d19d75..509e84e2266 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -7,7 +7,8 @@ use either::Either; use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc}; use swc_atoms::JsWord; use swc_common::{ - chain, comments::Comments, errors::Handler, sync::Lrc, FileName, Mark, SourceMap, + chain, comments::Comments, errors::Handler, sync::Lrc, util::take::Take, FileName, Mark, + SourceMap, }; use swc_ecma_ast::Module; use swc_ecma_minifier::{hygiene_optimizer, option::MinifyOptions, unique_scope}; @@ -16,7 +17,6 @@ use swc_ecma_transforms::{ compat, fixer, helpers, hygiene, hygiene::hygiene_with_config, modules, modules::util::Scope, optimization::const_modules, pass::Optional, proposals::import_assertions, typescript, }; -use swc_ecma_transforms_base::ext::MapWithMut; use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut}; /// Builder is used to create a high performance `Compiler`. diff --git a/testing/Cargo.toml b/testing/Cargo.toml index e7990b53a65..3e3da850972 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "testing" repository = "https://github.com/swc-project/swc.git" -version = "0.12.2" +version = "0.12.3" [dependencies] ansi_term = "0.12.1" @@ -16,5 +16,5 @@ log = "0.4" once_cell = "1" pretty_assertions = "0.7.2" regex = "1" -swc_common = {version = "0.11.6", path = "../common", features = ["tty-emitter"]} +swc_common = {version = "0.11.9", path = "../common", features = ["tty-emitter"]} testing_macros = {version = "0.2.0", path = "./macros"}