From 4cdb45ff2e6372af940f9398e179f5fae09ceabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Sat, 7 Aug 2021 02:41:50 +0900 Subject: [PATCH] feat(swc): Improve swc as a crate (#2026) ]swc_ecmascript: - Expose `swc_ecma_preset_env`. swc: - Expose `swc_atoms`. - Expose `swc_common`. - Expose `swc_ecmascript`. --- Cargo.lock | 8 +++++--- Cargo.toml | 3 ++- ecmascript/Cargo.toml | 4 +++- ecmascript/src/lib.rs | 2 ++ ecmascript/transforms/classes/Cargo.toml | 2 +- src/lib.rs | 4 ++++ 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28c0d593d70..eeaadd64fbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2255,7 +2255,7 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "swc" -version = "0.35.0" +version = "0.35.1" dependencies = [ "ahash 0.7.4", "anyhow", @@ -2285,6 +2285,7 @@ dependencies = [ "swc_ecma_transforms_base", "swc_ecma_utils", "swc_ecma_visit", + "swc_ecmascript", "swc_node_base", "swc_visit", "testing", @@ -2624,7 +2625,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.12.0" +version = "0.12.1" dependencies = [ "swc_atoms", "swc_common", @@ -2835,13 +2836,14 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.52.0" +version = "0.52.1" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_dep_graph", "swc_ecma_minifier", "swc_ecma_parser", + "swc_ecma_preset_env", "swc_ecma_transforms", "swc_ecma_utils", "swc_ecma_visit", diff --git a/Cargo.toml b/Cargo.toml index 9d28906ec1c..325532484f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc" repository = "https://github.com/swc-project/swc.git" -version = "0.35.0" +version = "0.35.1" [lib] name = "swc" @@ -49,6 +49,7 @@ swc_ecma_transforms = {version = "0.63.0", path = "./ecmascript/transforms", fea swc_ecma_transforms_base = {version = "0.26.0", path = "./ecmascript/transforms/base"} swc_ecma_utils = {version = "0.41.0", path = "./ecmascript/utils"} swc_ecma_visit = {version = "0.35.0", path = "./ecmascript/visit"} +swc_ecmascript = {version = "0.52.0", path = "./ecmascript"} swc_node_base = {version = "0.2.0", path = "./node/base"} swc_visit = {version = "0.2.3", path = "./visit"} diff --git a/ecmascript/Cargo.toml b/ecmascript/Cargo.toml index fed50329f7e..0bb187b9c32 100644 --- a/ecmascript/Cargo.toml +++ b/ecmascript/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecmascript" repository = "https://github.com/swc-project/swc.git" -version = "0.52.0" +version = "0.52.1" [package.metadata.docs.rs] all-features = true @@ -17,6 +17,7 @@ default = ["typescript-parser"] dep_graph = ["swc_ecma_dep_graph"] minifier = ["swc_ecma_minifier"] parser = ["swc_ecma_parser"] +preset_env = ["swc_ecma_preset_env"] transforms = ["swc_ecma_transforms"] utils = ["swc_ecma_utils"] visit = ["swc_ecma_visit"] @@ -36,6 +37,7 @@ swc_ecma_codegen = {version = "0.66.0", path = "./codegen", optional = true} swc_ecma_dep_graph = {version = "0.34.0", path = "./dep-graph", optional = true} swc_ecma_minifier = {version = "0.18.0", path = "./minifier", optional = true} swc_ecma_parser = {version = "0.66.0", path = "./parser", optional = true, default-features = false} +swc_ecma_preset_env = {version = "0.33.0", path = "./preset-env", optional = true} swc_ecma_transforms = {version = "0.63.0", path = "./transforms", optional = true} swc_ecma_utils = {version = "0.41.0", path = "./utils", optional = true} swc_ecma_visit = {version = "0.35.0", path = "./visit", optional = true} diff --git a/ecmascript/src/lib.rs b/ecmascript/src/lib.rs index f16cf3753df..a9b9f9c3a21 100644 --- a/ecmascript/src/lib.rs +++ b/ecmascript/src/lib.rs @@ -5,6 +5,8 @@ pub use swc_ecma_codegen as codegen; pub use swc_ecma_dep_graph as dep_graph; #[cfg(feature = "parser")] pub use swc_ecma_parser as parser; +#[cfg(feature = "preset_env")] +pub use swc_ecma_preset_env as preset_env; #[cfg(feature = "transforms")] pub use swc_ecma_transforms as transforms; #[cfg(feature = "utils")] diff --git a/ecmascript/transforms/classes/Cargo.toml b/ecmascript/transforms/classes/Cargo.toml index 800cfaf0b2c..7f47167660d 100644 --- a/ecmascript/transforms/classes/Cargo.toml +++ b/ecmascript/transforms/classes/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_ecma_transforms_classes" repository = "https://github.com/swc-project/swc.git" -version = "0.12.0" +version = "0.12.1" [dependencies] swc_atoms = {version = "0.2.6", path = "../../../atoms"} diff --git a/src/lib.rs b/src/lib.rs index 63c5f55c61c..0ffe2f5617a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,9 @@ #![deny(unused)] +pub extern crate swc_atoms as atoms; +pub extern crate swc_common as common; +pub extern crate swc_ecmascript as ecmascript; + pub use crate::builder::PassBuilder; use crate::config::{ BuiltConfig, Config, ConfigFile, InputSourceMap, JscTarget, Merge, Options, Rc, RootMode,