refactor(swc_core): Use namespace ecma (#5713)

This commit is contained in:
OJ Kwon 2022-09-01 18:24:27 -07:00 committed by GitHub
parent d242605aa1
commit 975cbfe0d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 227 additions and 166 deletions

View File

@ -410,7 +410,7 @@ jobs:
- name: Run cargo test (core)
if: matrix.settings.crate == 'swc_core'
run: |
cargo test --color always -p swc_core --features quote --features common --features utils
cargo test --color always -p swc_core --features ecma_quote --features common --features ecma_utils
- name: Run cargo test (binding_core_wasm)
if: matrix.settings.crate == 'binding_core_wasm'

View File

@ -22,7 +22,7 @@ jobs:
profile: minimal
- name: Create rustdoc
run: cargo doc --all --features plugin_transform --features loader --features utils --features quote --features visit --features transforms --features __testing_transform
run: cargo doc --all --features plugin_transform --features ecma_loader --features ecma_utils --features ecma_quote --features ecma_visit --features ecma_transforms --features __testing_transform
- name: Create CNAME
run: |

7
Cargo.lock generated
View File

@ -3083,7 +3083,7 @@ dependencies = [
[[package]]
name = "swc_core"
version = "0.19.0"
version = "0.20.0"
dependencies = [
"binding_macros",
"once_cell",
@ -3106,7 +3106,12 @@ dependencies = [
"swc_ecma_parser",
"swc_ecma_quote_macros",
"swc_ecma_transforms",
"swc_ecma_transforms_module",
"swc_ecma_transforms_optimization",
"swc_ecma_transforms_proposal",
"swc_ecma_transforms_react",
"swc_ecma_transforms_testing",
"swc_ecma_transforms_typescript",
"swc_ecma_utils",
"swc_ecma_visit",
"swc_node_base",

View File

@ -6,7 +6,7 @@ edition = "2021"
license = "Apache-2.0"
name = "swc_core"
repository = "https://github.com/swc-project/swc.git"
version = "0.19.0"
version = "0.20.0"
[package.metadata.docs.rs]
features = [
"common_perf",
@ -14,13 +14,13 @@ version = "0.19.0"
"base",
"base_node",
"common",
"visit",
"ecma_visit",
"quote",
"utils",
"transforms",
"ecma_transforms",
"bundler",
"loader",
"ast",
"ecma_ast",
"trace_macro",
"plugin_transform",
]
@ -41,11 +41,11 @@ doctest = false
common_perf = ["swc_common/perf"]
# swc_ecma_loader/cache*
loader_lru = ["swc_ecma_loader/lru"]
loader_parking_lot = ["swc_ecma_loader/parking_lot"]
ecma_loader_lru = ["swc_ecma_loader/lru"]
ecna_loader_parking_lot = ["swc_ecma_loader/parking_lot"]
# swc_ecma_minifier/concurrent
minifier_concurrent = ["swc_ecma_minifier/concurrent"]
ecma_minifier_concurrent = ["swc_ecma_minifier/concurrent"]
# swc_bundler/concurrent
bundler_concurrent = ["swc_bundler/concurrent"]
@ -82,24 +82,32 @@ common = ["__common"]
common_concurrent = ["__common", "swc_common/concurrent"]
# Enable swc_ecma_visit
visit = ["swc_ecma_visit"]
ecma_visit = ["__visit"]
ecma_visit_path = ["__visit", "swc_ecma_visit/path"]
# Enable `quote!` macro support.
quote = [
ecma_quote = [
# Dependent features
"__common",
"ast", # Enable optional package
"ecma_ast", # Enable optional package
"swc_ecma_quote_macros",
]
# Enable swc_ecma_utils
utils = ["__utils", "__common"]
ecma_utils = ["__utils", "__common"]
# Enable swc_ecma_transforms base features
transforms = ["__transforms"]
transforms_optimization = ["__transforms", "swc_ecma_transforms/optimization"]
transforms_react = ["__transforms", "swc_ecma_transforms/react"]
transforms_typescript = ["__transforms", "swc_ecma_transforms/typescript"]
ecma_transforms = ["__ecma_transforms"]
ecma_transforms_module = ["__ecma_transforms", "swc_ecma_transforms_module"]
ecma_transforms_optimization = [
"__ecma_transforms",
"swc_ecma_transforms_optimization",
]
ecma_transforms_react = ["__ecma_transforms", "swc_ecma_transforms_react"]
ecma_transforms_typescript = [
"__ecma_transforms",
"swc_ecma_transforms_typescript",
]
# Enable swc_bundler
bundler = ["__bundler"]
@ -107,38 +115,39 @@ bundler_node_v1 = ["__bundler", "swc_node_bundler/swc_v1"]
bundler_node_v2 = ["__bundler", "swc_node_bundler/swc_v2"]
# Enable swc_ecma_loader
loader = ["__loader"]
loader_node = ["__loader", "swc_ecma_loader/node"]
loader_tsc = ["__loader", "swc_ecma_loader/tsc"]
ecma_loader = ["__ecma_loader"]
ecma_loader_node = ["__ecma_loader", "swc_ecma_loader/node"]
ecma_loader_tsc = ["__ecma_loader", "swc_ecma_loader/tsc"]
# Enable swc_ecma_transforms_testing
testing_transform = ["__testing_transform"]
testing_transform = ["__ecma", "__testing_transform"]
# Enable swc_ecma_ast / swc_atoms support.
# TODO: currently both are enabled at once, we may want to separate them.
ast = ["swc_ecma_ast", "swc_atoms"]
ecma_ast = ["__ecma", "swc_ecma_ast", "swc_atoms"]
# Enable swc_ecma_parser support.
parser = ["__parser"]
parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
ecma_parser = ["__parser"]
ecma_parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
# Enable swc_cached support
cached = ["__cached"]
# Enable swc_ecma_codegen
codegen = ["swc_ecma_codegen"]
ecma_codegen = ["__ecma", "swc_ecma_codegen"]
# Enable swc_ecma_minifier
minifier = ["swc_ecma_minifier"]
ecma_minifier = ["__ecma", "swc_ecma_minifier"]
# Enable swc_css
css_ast = ["__css", "swc_css_ast"]
css_codegen = ["__css", "swc_css_codegen"]
css_minifier = ["__css", "swc_css_minifier"]
css_parser = ["__css", "swc_css_parser"]
css_utils = ["__css", "swc_css_utils"]
css_visit = ["__css", "swc_css_visit"]
css_prefixer = ["__css", "swc_css_prefixer"]
css_ast = ["__css", "swc_css_ast"]
css_codegen = ["__css", "swc_css_codegen"]
css_minifier = ["__css", "swc_css_minifier"]
css_parser = ["__css", "swc_css_parser"]
css_prefixer = ["__css", "swc_css_prefixer"]
css_utils = ["__css", "swc_css_utils"]
css_visit = ["__css", "swc_css_visit"]
css_visit_path = ["__css", "swc_css_visit/path"]
# Enable trace macro support.
# TODO: Once all top-level package (node, wasm, cli..) imports swc_core,
@ -202,9 +211,9 @@ __plugin_transform_schema_vtest = ["swc_common/plugin_transform_schema_vtest"]
__plugin_transform = [
# Dependent features
"visit",
"ecma_visit",
"__common",
"ast", # Enable optional packages
"ecma_ast", # Enable optional packages
"swc_ecma_ast/rkyv-impl",
"swc_atoms/rkyv-impl",
"swc_common/plugin-mode",
@ -246,17 +255,26 @@ __plugin_transform_schema_test = [
]
## Common
__base = ["swc"]
__binding_macros = ["common", "__base", "__transforms", "ast", "binding_macros"]
__bundler = ["swc_bundler"]
__cached = ["swc_cached"]
__common = ["swc_common"]
__css = []
__loader = ["swc_ecma_loader"]
__parser = ["swc_ecma_parser"]
__testing_transform = ["swc_ecma_transforms_testing"]
__transforms = ["swc_ecma_transforms"]
__utils = ["swc_ecma_utils"]
__base = ["swc"]
__binding_macros = [
"__ecma",
"common",
"__base",
"__ecma_transforms",
"ecma_ast",
"binding_macros",
]
__bundler = ["swc_bundler"]
__cached = ["swc_cached"]
__common = ["swc_common"]
__css = []
__ecma = ["swc_ecma_transforms"]
__ecma_loader = ["__ecma", "swc_ecma_loader"]
__ecma_transforms = ["__ecma"]
__parser = ["__ecma", "swc_ecma_parser"]
__testing_transform = ["__ecma", "swc_ecma_transforms_testing"]
__utils = ["__ecma", "swc_ecma_utils"]
__visit = ["__ecma", "swc_ecma_visit"]
[dependencies]
# 3rd party dependencies
@ -265,36 +283,41 @@ wasmer = { optional = true, version = "2.3.0", default-features = false }
wasmer-wasi = { optional = true, version = "2.3.0", default-features = false }
# swc_* dependencies
binding_macros = { optional = true, version = "0.12.0", path = "../binding_macros" }
swc = { optional = true, version = "0.224.0", path = "../swc" }
swc_atoms = { optional = true, version = "0.4.8", path = "../swc_atoms" }
swc_bundler = { optional = true, version = "0.185.0", path = "../swc_bundler" }
swc_cached = { optional = true, version = "0.3.5", path = "../swc_cached" }
swc_common = { optional = true, version = "0.27.12", path = "../swc_common" }
swc_css_ast = { optional = true, version = "0.110.0", path = "../swc_css_ast"}
swc_css_codegen = { optional = true, version = "0.120.0", path = "../swc_css_codegen"}
swc_css_minifier = { optional = true, version = "0.85.0", path = "../swc_css_minifier"}
swc_css_parser = { optional = true, version = "0.119.0", path = "../swc_css_parser"}
swc_css_utils = { optional = true, version = "0.107.0", path = "../swc_css_utils/"}
swc_css_visit = { optional = true, version = "0.109.0", path = "../swc_css_visit"}
swc_css_prefixer = { optional = true, version = "0.121.0", path = "../swc_css_prefixer" }
swc_ecma_ast = { optional = true, version = "0.90.10", path = "../swc_ecma_ast" }
swc_ecma_codegen = { optional = true, version = "0.123.0", path = "../swc_ecma_codegen" }
swc_ecma_loader = { optional = true, version = "0.39.4", path = "../swc_ecma_loader" }
swc_ecma_minifier = { optional = true, version = "0.152.0", path = "../swc_ecma_minifier" }
swc_ecma_parser = { optional = true, version = "0.118.0", path = "../swc_ecma_parser" }
swc_ecma_quote_macros = { optional = true, version = "0.29.0", path = "../swc_ecma_quote_macros" }
swc_ecma_transforms = { optional = true, version = "0.191.0", path = "../swc_ecma_transforms" }
swc_ecma_transforms_testing = { optional = true, version = "0.108.0", path = "../swc_ecma_transforms_testing" }
swc_ecma_utils = { optional = true, version = "0.101.0", path = "../swc_ecma_utils" }
swc_ecma_visit = { optional = true, version = "0.76.6", path = "../swc_ecma_visit" }
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
swc_node_bundler = { optional = true, version = "0.10.0", path = "../swc_node_bundler" }
swc_nodejs_common = { optional = true, version = "0.0.1", path = "../swc_nodejs_common" }
swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" }
swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" }
swc_plugin_proxy = { optional = true, version = "0.18.13", path = "../swc_plugin_proxy" }
swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" }
binding_macros = { optional = true, version = "0.12.0", path = "../binding_macros" }
swc = { optional = true, version = "0.224.0", path = "../swc" }
swc_atoms = { optional = true, version = "0.4.8", path = "../swc_atoms" }
swc_bundler = { optional = true, version = "0.185.0", path = "../swc_bundler" }
swc_cached = { optional = true, version = "0.3.5", path = "../swc_cached" }
swc_common = { optional = true, version = "0.27.12", path = "../swc_common" }
swc_css_ast = { optional = true, version = "0.110.0", path = "../swc_css_ast" }
swc_css_codegen = { optional = true, version = "0.120.0", path = "../swc_css_codegen" }
swc_css_minifier = { optional = true, version = "0.85.0", path = "../swc_css_minifier" }
swc_css_parser = { optional = true, version = "0.119.0", path = "../swc_css_parser" }
swc_css_prefixer = { optional = true, version = "0.121.0", path = "../swc_css_prefixer" }
swc_css_utils = { optional = true, version = "0.107.0", path = "../swc_css_utils/" }
swc_css_visit = { optional = true, version = "0.109.0", path = "../swc_css_visit" }
swc_ecma_ast = { optional = true, version = "0.90.10", path = "../swc_ecma_ast" }
swc_ecma_codegen = { optional = true, version = "0.123.0", path = "../swc_ecma_codegen" }
swc_ecma_loader = { optional = true, version = "0.39.4", path = "../swc_ecma_loader" }
swc_ecma_minifier = { optional = true, version = "0.152.0", path = "../swc_ecma_minifier" }
swc_ecma_parser = { optional = true, version = "0.118.0", path = "../swc_ecma_parser" }
swc_ecma_quote_macros = { optional = true, version = "0.29.0", path = "../swc_ecma_quote_macros" }
swc_ecma_transforms = { optional = true, version = "0.191.0", path = "../swc_ecma_transforms" }
swc_ecma_transforms_module = { optional = true, version = "0.146.0", path = "../swc_ecma_transforms_module" }
swc_ecma_transforms_optimization = { optional = true, version = "0.160.0", path = "../swc_ecma_transforms_optimization" }
swc_ecma_transforms_proposal = { optional = true, version = "0.137.0", path = "../swc_ecma_transforms_proposal" }
swc_ecma_transforms_react = { optional = true, version = "0.148.0", path = "../swc_ecma_transforms_react" }
swc_ecma_transforms_testing = { optional = true, version = "0.108.0", path = "../swc_ecma_transforms_testing" }
swc_ecma_transforms_typescript = { optional = true, version = "0.152.0", path = "../swc_ecma_transforms_typescript" }
swc_ecma_utils = { optional = true, version = "0.101.0", path = "../swc_ecma_utils" }
swc_ecma_visit = { optional = true, version = "0.76.6", path = "../swc_ecma_visit" }
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
swc_node_bundler = { optional = true, version = "0.10.0", path = "../swc_node_bundler" }
swc_nodejs_common = { optional = true, version = "0.0.1", path = "../swc_nodejs_common" }
swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" }
swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" }
swc_plugin_proxy = { optional = true, version = "0.18.13", path = "../swc_plugin_proxy" }
swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" }
# TODO: eventually swc_plugin_runner needs to remove default features
swc_plugin_runner = { optional = true, version = "0.73.1", path = "../swc_plugin_runner", default-features = false }

View File

@ -1,13 +1,13 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
// Quote
#[cfg(feature = "quote")]
#[cfg_attr(docsrs, doc(cfg(feature = "quote")))]
#[cfg(feature = "ecma_quote")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_quote")))]
pub mod quote;
/// Not a public interface.
#[cfg(feature = "quote")]
#[cfg_attr(docsrs, doc(cfg(feature = "quote")))]
#[cfg(feature = "ecma_quote")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_quote")))]
#[doc(hidden)]
pub extern crate swc_ecma_quote_macros;
@ -16,26 +16,91 @@ pub extern crate swc_ecma_quote_macros;
#[cfg_attr(docsrs, doc(cfg(feature = "__plugin_transform")))]
pub mod plugin;
// ast exposed via swc_ecma_ast
#[cfg(feature = "ast")]
#[cfg_attr(docsrs, doc(cfg(feature = "ast")))]
pub mod ast {
pub use swc_ecma_ast::*;
}
#[cfg(feature = "__ecma")]
#[cfg_attr(docsrs, doc(cfg(feature = "__ecma")))]
pub mod ecma {
#[cfg(feature = "ecma_ast")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_ast")))]
pub mod ast {
pub use swc_ecma_ast::*;
}
#[cfg(feature = "ecma_ast")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_ast")))]
pub mod atoms {
pub use swc_atoms::*;
}
// swc_ecma_transforms
#[cfg(any(feature = "__ecma_transforms", feature = "__testing_transform"))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "__ecma_transforms", feature = "__testing_transform")))
)]
pub mod transforms {
pub use swc_ecma_transforms::*;
#[cfg(feature = "transforms_optimization")]
#[cfg_attr(docsrs, doc(cfg(feature = "transforms_optimization")))]
pub mod optimization {
pub use swc_ecma_transforms_optimization::*;
}
#[cfg(feature = "transforms_react")]
#[cfg_attr(docsrs, doc(cfg(feature = "transforms_react")))]
pub mod react {
pub use swc_ecma_transforms_react::*;
}
#[cfg(feature = "transforms_typescript")]
#[cfg_attr(docsrs, doc(cfg(feature = "transforms_typescript")))]
pub mod typescript {
pub use swc_ecma_transforms_typescript::*;
}
#[cfg(feature = "transforms_module")]
#[cfg_attr(docsrs, doc(cfg(feature = "transforms_module")))]
pub mod module {
pub use swc_ecma_transforms_module::*;
}
#[cfg(feature = "__testing_transform")]
#[cfg_attr(docsrs, doc(cfg(feature = "__testing_transform")))]
pub mod testing {
pub use swc_ecma_transforms_testing::*;
}
}
// TODO: Can dependency tree simplified
// by swc_ecma_ast reexports swc_atoms?
#[cfg(feature = "ast")]
#[cfg_attr(docsrs, doc(cfg(feature = "ast")))]
pub mod atoms {
pub use swc_atoms::*;
}
// swc_ecma_loader
#[cfg(feature = "__ecma_loader")]
#[cfg_attr(docsrs, doc(cfg(feature = "__ecma_loader")))]
pub mod loader {
pub use swc_ecma_loader::*;
}
// visit* interfaces
#[cfg(feature = "visit")]
#[cfg_attr(docsrs, doc(cfg(feature = "visit")))]
pub mod visit {
pub use swc_ecma_visit::*;
#[cfg(feature = "__parser")]
#[cfg_attr(docsrs, doc(cfg(feature = "__parser")))]
pub mod parser {
pub use swc_ecma_parser::*;
}
#[cfg(feature = "ecma_codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_codegen")))]
pub mod codegen {
pub use swc_ecma_codegen::*;
}
#[cfg(feature = "ecma_minifier")]
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_minifier")))]
pub mod minifier {
pub use swc_ecma_minifier::*;
}
// visit* interfaces
#[cfg(feature = "__visit")]
#[cfg_attr(docsrs, doc(cfg(feature = "__visit")))]
pub mod visit {
pub use swc_ecma_visit::*;
}
#[cfg(feature = "__utils")]
#[cfg_attr(docsrs, doc(cfg(feature = "__utils")))]
pub mod utils {
pub use swc_ecma_utils::*;
}
}
// swc features
@ -52,12 +117,6 @@ pub mod common {
pub use swc_common::*;
}
#[cfg(feature = "__parser")]
#[cfg_attr(docsrs, doc(cfg(feature = "__parser")))]
pub mod parser {
pub use swc_ecma_parser::*;
}
// swc_plugin_runner
#[cfg(feature = "__plugin_transform_host")]
#[cfg_attr(docsrs, doc(cfg(feature = "__plugin_transform_host")))]
@ -72,13 +131,6 @@ pub mod trace_macro {
pub use swc_trace_macro::*;
}
// swc_ecma_transforms
#[cfg(feature = "__transforms")]
#[cfg_attr(docsrs, doc(cfg(feature = "__transforms")))]
pub mod transforms {
pub use swc_ecma_transforms::*;
}
// swc_bundler
#[cfg(feature = "__bundler")]
#[cfg_attr(docsrs, doc(cfg(feature = "__bundler")))]
@ -95,25 +147,6 @@ pub mod bundler {
}
}
// swc_ecma_loader
#[cfg(feature = "__loader")]
#[cfg_attr(docsrs, doc(cfg(feature = "__loader")))]
pub mod loader {
pub use swc_ecma_loader::*;
}
#[cfg(feature = "__utils")]
#[cfg_attr(docsrs, doc(cfg(feature = "__utils")))]
pub mod utils {
pub use swc_ecma_utils::*;
}
#[cfg(feature = "__testing_transform")]
#[cfg_attr(docsrs, doc(cfg(feature = "__testing_transform")))]
pub mod testing_transform {
pub use swc_ecma_transforms_testing::*;
}
#[cfg(feature = "__binding_macros")]
#[cfg_attr(docsrs, doc(cfg(feature = "__binding_macros")))]
pub mod binding_macros {
@ -126,18 +159,6 @@ pub mod node {
pub use swc_nodejs_common::*;
}
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub mod codegen {
pub use swc_ecma_codegen::*;
}
#[cfg(feature = "minifier")]
#[cfg_attr(docsrs, doc(cfg(feature = "minifier")))]
pub mod minifier {
pub use swc_ecma_minifier::*;
}
#[cfg(feature = "__css")]
#[cfg_attr(docsrs, doc(cfg(feature = "__css")))]
pub mod css {

View File

@ -9,7 +9,7 @@ macro_rules! impl_simple_enum {
$(
$E::$v => q!(
Vars {},
{ swc_core::ast::$E::$v }
{ swc_core::ecma::ast::$E::$v }
)
.parse(),
)*

View File

@ -16,7 +16,7 @@ impl ToCode for swc_ecma_ast::Ident {
Vars {
sym_value: self.sym.to_code(cx),
},
{ swc_core::ast::Ident::new(sym_value, swc_core::common::DUMMY_SP,) }
{ swc_core::ecma::ast::Ident::new(sym_value, swc_core::common::DUMMY_SP,) }
)
.parse()
}

View File

@ -23,7 +23,7 @@ macro_rules! impl_enum_body {
Vars {
val: crate::ast::ToCode::to_code(inner, $cx),
},
{ swc_core::ast::$E::$v(val) }
{ swc_core::ecma::ast::$E::$v(val) }
)
.parse(),
)*

View File

@ -29,7 +29,7 @@ impl Builder {
ExprStruct {
attrs: Default::default(),
brace_token: Default::default(),
path: syn::parse_quote!(swc_core::ast::#type_name),
path: syn::parse_quote!(swc_core::ecma::ast::#type_name),
fields: self.fields,
dot2_token: Default::default(),
rest: Default::default(),

View File

@ -141,7 +141,7 @@ pub(super) fn prepare_vars(
call_site(),
);
stmts.push(parse_quote! {
let #var_ident: swc_core::ast::#type_name = #value;
let #var_ident: swc_core::ecma::ast::#type_name = #value;
});
}

View File

@ -5,6 +5,7 @@
pub use swc_ecma_transforms_base::{
assumptions::Assumptions, feature, fixer, helpers, hygiene, pass, perf, resolver,
};
// TODO: May remove these reexports once swc_core directly reexports all
#[cfg(feature = "swc_ecma_transforms_compat")]
#[cfg_attr(docsrs, doc(cfg(feature = "compat")))]
pub use swc_ecma_transforms_compat as compat;

View File

@ -64,7 +64,7 @@ checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305"
[[package]]
name = "ast_node"
version = "0.8.2"
version = "0.8.3"
dependencies = [
"darling",
"pmutil",
@ -325,7 +325,7 @@ dependencies = [
[[package]]
name = "from_variant"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"pmutil",
"proc-macro2",
@ -1246,7 +1246,7 @@ dependencies = [
[[package]]
name = "swc_atoms"
version = "0.4.8"
version = "0.4.9"
dependencies = [
"bytecheck",
"once_cell",
@ -1259,7 +1259,7 @@ dependencies = [
[[package]]
name = "swc_common"
version = "0.27.12"
version = "0.27.13"
dependencies = [
"ahash",
"anyhow",
@ -1290,13 +1290,14 @@ dependencies = [
[[package]]
name = "swc_core"
version = "0.10.0"
version = "0.20.0"
dependencies = [
"once_cell",
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_quote_macros",
"swc_ecma_transforms",
"swc_ecma_transforms_testing",
"swc_ecma_visit",
"swc_plugin",
@ -1307,7 +1308,7 @@ dependencies = [
[[package]]
name = "swc_ecma_ast"
version = "0.90.11"
version = "0.90.15"
dependencies = [
"bitflags",
"bytecheck",
@ -1324,7 +1325,7 @@ dependencies = [
[[package]]
name = "swc_ecma_codegen"
version = "0.122.0"
version = "0.123.0"
dependencies = [
"memchr",
"num-bigint",
@ -1352,7 +1353,7 @@ dependencies = [
[[package]]
name = "swc_ecma_parser"
version = "0.118.0"
version = "0.118.3"
dependencies = [
"either",
"enum_kind",
@ -1385,7 +1386,7 @@ dependencies = [
[[package]]
name = "swc_ecma_testing"
version = "0.15.0"
version = "0.16.0"
dependencies = [
"anyhow",
"hex",
@ -1397,9 +1398,21 @@ dependencies = [
"testing",
]
[[package]]
name = "swc_ecma_transforms"
version = "0.191.0"
dependencies = [
"swc_atoms",
"swc_common",
"swc_ecma_ast",
"swc_ecma_transforms_base",
"swc_ecma_utils",
"swc_ecma_visit",
]
[[package]]
name = "swc_ecma_transforms_base"
version = "0.104.0"
version = "0.106.0"
dependencies = [
"better_scoped_tls",
"bitflags",
@ -1420,7 +1433,7 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_testing"
version = "0.106.0"
version = "0.108.0"
dependencies = [
"ansi_term",
"anyhow",
@ -1442,7 +1455,7 @@ dependencies = [
[[package]]
name = "swc_ecma_utils"
version = "0.100.1"
version = "0.101.0"
dependencies = [
"indexmap",
"once_cell",
@ -1507,14 +1520,14 @@ dependencies = [
[[package]]
name = "swc_plugin"
version = "0.89.1"
version = "0.90.0"
dependencies = [
"once_cell",
]
[[package]]
name = "swc_plugin_macro"
version = "0.9.7"
version = "0.9.8"
dependencies = [
"proc-macro2",
"quote",

View File

@ -13,5 +13,5 @@ crate-type = ["cdylib"]
serde = "1"
swc_core = { path = "../../../../swc_core", features = [
"plugin_transform",
"quote",
"ecma_quote",
] }

View File

@ -1,14 +1,12 @@
use swc_core::{
ast::*,
atoms::*,
common::DUMMY_SP,
ecma::{ast::*, atoms::*, visit::*},
plugin::{
errors::HANDLER,
metadata::{TransformPluginMetadataContextKind, TransformPluginProgramMetadata},
plugin_transform,
},
quote,
visit::*,
};
struct ConsoleOutputReplacer;