mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
refactor(swc_core): Use namespace ecma
(#5713)
This commit is contained in:
parent
d242605aa1
commit
975cbfe0d9
2
.github/workflows/cargo.yml
vendored
2
.github/workflows/cargo.yml
vendored
@ -410,7 +410,7 @@ jobs:
|
|||||||
- name: Run cargo test (core)
|
- name: Run cargo test (core)
|
||||||
if: matrix.settings.crate == 'swc_core'
|
if: matrix.settings.crate == 'swc_core'
|
||||||
run: |
|
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)
|
- name: Run cargo test (binding_core_wasm)
|
||||||
if: matrix.settings.crate == 'binding_core_wasm'
|
if: matrix.settings.crate == 'binding_core_wasm'
|
||||||
|
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
profile: minimal
|
profile: minimal
|
||||||
|
|
||||||
- name: Create rustdoc
|
- 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
|
- name: Create CNAME
|
||||||
run: |
|
run: |
|
||||||
|
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -3083,7 +3083,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_core"
|
name = "swc_core"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"binding_macros",
|
"binding_macros",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -3106,7 +3106,12 @@ dependencies = [
|
|||||||
"swc_ecma_parser",
|
"swc_ecma_parser",
|
||||||
"swc_ecma_quote_macros",
|
"swc_ecma_quote_macros",
|
||||||
"swc_ecma_transforms",
|
"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_testing",
|
||||||
|
"swc_ecma_transforms_typescript",
|
||||||
"swc_ecma_utils",
|
"swc_ecma_utils",
|
||||||
"swc_ecma_visit",
|
"swc_ecma_visit",
|
||||||
"swc_node_base",
|
"swc_node_base",
|
||||||
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
name = "swc_core"
|
name = "swc_core"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = [
|
features = [
|
||||||
"common_perf",
|
"common_perf",
|
||||||
@ -14,13 +14,13 @@ version = "0.19.0"
|
|||||||
"base",
|
"base",
|
||||||
"base_node",
|
"base_node",
|
||||||
"common",
|
"common",
|
||||||
"visit",
|
"ecma_visit",
|
||||||
"quote",
|
"quote",
|
||||||
"utils",
|
"utils",
|
||||||
"transforms",
|
"ecma_transforms",
|
||||||
"bundler",
|
"bundler",
|
||||||
"loader",
|
"loader",
|
||||||
"ast",
|
"ecma_ast",
|
||||||
"trace_macro",
|
"trace_macro",
|
||||||
"plugin_transform",
|
"plugin_transform",
|
||||||
]
|
]
|
||||||
@ -41,11 +41,11 @@ doctest = false
|
|||||||
common_perf = ["swc_common/perf"]
|
common_perf = ["swc_common/perf"]
|
||||||
|
|
||||||
# swc_ecma_loader/cache*
|
# swc_ecma_loader/cache*
|
||||||
loader_lru = ["swc_ecma_loader/lru"]
|
ecma_loader_lru = ["swc_ecma_loader/lru"]
|
||||||
loader_parking_lot = ["swc_ecma_loader/parking_lot"]
|
ecna_loader_parking_lot = ["swc_ecma_loader/parking_lot"]
|
||||||
|
|
||||||
# swc_ecma_minifier/concurrent
|
# swc_ecma_minifier/concurrent
|
||||||
minifier_concurrent = ["swc_ecma_minifier/concurrent"]
|
ecma_minifier_concurrent = ["swc_ecma_minifier/concurrent"]
|
||||||
|
|
||||||
# swc_bundler/concurrent
|
# swc_bundler/concurrent
|
||||||
bundler_concurrent = ["swc_bundler/concurrent"]
|
bundler_concurrent = ["swc_bundler/concurrent"]
|
||||||
@ -82,24 +82,32 @@ common = ["__common"]
|
|||||||
common_concurrent = ["__common", "swc_common/concurrent"]
|
common_concurrent = ["__common", "swc_common/concurrent"]
|
||||||
|
|
||||||
# Enable swc_ecma_visit
|
# Enable swc_ecma_visit
|
||||||
visit = ["swc_ecma_visit"]
|
ecma_visit = ["__visit"]
|
||||||
|
ecma_visit_path = ["__visit", "swc_ecma_visit/path"]
|
||||||
|
|
||||||
# Enable `quote!` macro support.
|
# Enable `quote!` macro support.
|
||||||
quote = [
|
ecma_quote = [
|
||||||
# Dependent features
|
# Dependent features
|
||||||
"__common",
|
"__common",
|
||||||
"ast", # Enable optional package
|
"ecma_ast", # Enable optional package
|
||||||
"swc_ecma_quote_macros",
|
"swc_ecma_quote_macros",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Enable swc_ecma_utils
|
# Enable swc_ecma_utils
|
||||||
utils = ["__utils", "__common"]
|
ecma_utils = ["__utils", "__common"]
|
||||||
|
|
||||||
# Enable swc_ecma_transforms base features
|
# Enable swc_ecma_transforms base features
|
||||||
transforms = ["__transforms"]
|
ecma_transforms = ["__ecma_transforms"]
|
||||||
transforms_optimization = ["__transforms", "swc_ecma_transforms/optimization"]
|
ecma_transforms_module = ["__ecma_transforms", "swc_ecma_transforms_module"]
|
||||||
transforms_react = ["__transforms", "swc_ecma_transforms/react"]
|
ecma_transforms_optimization = [
|
||||||
transforms_typescript = ["__transforms", "swc_ecma_transforms/typescript"]
|
"__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
|
# Enable swc_bundler
|
||||||
bundler = ["__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"]
|
bundler_node_v2 = ["__bundler", "swc_node_bundler/swc_v2"]
|
||||||
|
|
||||||
# Enable swc_ecma_loader
|
# Enable swc_ecma_loader
|
||||||
loader = ["__loader"]
|
ecma_loader = ["__ecma_loader"]
|
||||||
loader_node = ["__loader", "swc_ecma_loader/node"]
|
ecma_loader_node = ["__ecma_loader", "swc_ecma_loader/node"]
|
||||||
loader_tsc = ["__loader", "swc_ecma_loader/tsc"]
|
ecma_loader_tsc = ["__ecma_loader", "swc_ecma_loader/tsc"]
|
||||||
|
|
||||||
# Enable swc_ecma_transforms_testing
|
# Enable swc_ecma_transforms_testing
|
||||||
testing_transform = ["__testing_transform"]
|
testing_transform = ["__ecma", "__testing_transform"]
|
||||||
|
|
||||||
# Enable swc_ecma_ast / swc_atoms support.
|
# Enable swc_ecma_ast / swc_atoms support.
|
||||||
# TODO: currently both are enabled at once, we may want to separate them.
|
# 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.
|
# Enable swc_ecma_parser support.
|
||||||
parser = ["__parser"]
|
ecma_parser = ["__parser"]
|
||||||
parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
|
ecma_parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
|
||||||
|
|
||||||
# Enable swc_cached support
|
# Enable swc_cached support
|
||||||
cached = ["__cached"]
|
cached = ["__cached"]
|
||||||
|
|
||||||
# Enable swc_ecma_codegen
|
# Enable swc_ecma_codegen
|
||||||
codegen = ["swc_ecma_codegen"]
|
ecma_codegen = ["__ecma", "swc_ecma_codegen"]
|
||||||
|
|
||||||
# Enable swc_ecma_minifier
|
# Enable swc_ecma_minifier
|
||||||
minifier = ["swc_ecma_minifier"]
|
ecma_minifier = ["__ecma", "swc_ecma_minifier"]
|
||||||
|
|
||||||
# Enable swc_css
|
# Enable swc_css
|
||||||
css_ast = ["__css", "swc_css_ast"]
|
css_ast = ["__css", "swc_css_ast"]
|
||||||
css_codegen = ["__css", "swc_css_codegen"]
|
css_codegen = ["__css", "swc_css_codegen"]
|
||||||
css_minifier = ["__css", "swc_css_minifier"]
|
css_minifier = ["__css", "swc_css_minifier"]
|
||||||
css_parser = ["__css", "swc_css_parser"]
|
css_parser = ["__css", "swc_css_parser"]
|
||||||
css_utils = ["__css", "swc_css_utils"]
|
css_prefixer = ["__css", "swc_css_prefixer"]
|
||||||
css_visit = ["__css", "swc_css_visit"]
|
css_utils = ["__css", "swc_css_utils"]
|
||||||
css_prefixer = ["__css", "swc_css_prefixer"]
|
css_visit = ["__css", "swc_css_visit"]
|
||||||
|
css_visit_path = ["__css", "swc_css_visit/path"]
|
||||||
|
|
||||||
# Enable trace macro support.
|
# Enable trace macro support.
|
||||||
# TODO: Once all top-level package (node, wasm, cli..) imports swc_core,
|
# 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 = [
|
__plugin_transform = [
|
||||||
# Dependent features
|
# Dependent features
|
||||||
"visit",
|
"ecma_visit",
|
||||||
"__common",
|
"__common",
|
||||||
"ast", # Enable optional packages
|
"ecma_ast", # Enable optional packages
|
||||||
"swc_ecma_ast/rkyv-impl",
|
"swc_ecma_ast/rkyv-impl",
|
||||||
"swc_atoms/rkyv-impl",
|
"swc_atoms/rkyv-impl",
|
||||||
"swc_common/plugin-mode",
|
"swc_common/plugin-mode",
|
||||||
@ -246,17 +255,26 @@ __plugin_transform_schema_test = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
## Common
|
## Common
|
||||||
__base = ["swc"]
|
__base = ["swc"]
|
||||||
__binding_macros = ["common", "__base", "__transforms", "ast", "binding_macros"]
|
__binding_macros = [
|
||||||
__bundler = ["swc_bundler"]
|
"__ecma",
|
||||||
__cached = ["swc_cached"]
|
"common",
|
||||||
__common = ["swc_common"]
|
"__base",
|
||||||
__css = []
|
"__ecma_transforms",
|
||||||
__loader = ["swc_ecma_loader"]
|
"ecma_ast",
|
||||||
__parser = ["swc_ecma_parser"]
|
"binding_macros",
|
||||||
__testing_transform = ["swc_ecma_transforms_testing"]
|
]
|
||||||
__transforms = ["swc_ecma_transforms"]
|
__bundler = ["swc_bundler"]
|
||||||
__utils = ["swc_ecma_utils"]
|
__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]
|
[dependencies]
|
||||||
# 3rd party 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 }
|
wasmer-wasi = { optional = true, version = "2.3.0", default-features = false }
|
||||||
|
|
||||||
# swc_* dependencies
|
# swc_* dependencies
|
||||||
binding_macros = { optional = true, version = "0.12.0", path = "../binding_macros" }
|
binding_macros = { optional = true, version = "0.12.0", path = "../binding_macros" }
|
||||||
swc = { optional = true, version = "0.224.0", path = "../swc" }
|
swc = { optional = true, version = "0.224.0", path = "../swc" }
|
||||||
swc_atoms = { optional = true, version = "0.4.8", path = "../swc_atoms" }
|
swc_atoms = { optional = true, version = "0.4.8", path = "../swc_atoms" }
|
||||||
swc_bundler = { optional = true, version = "0.185.0", path = "../swc_bundler" }
|
swc_bundler = { optional = true, version = "0.185.0", path = "../swc_bundler" }
|
||||||
swc_cached = { optional = true, version = "0.3.5", path = "../swc_cached" }
|
swc_cached = { optional = true, version = "0.3.5", path = "../swc_cached" }
|
||||||
swc_common = { optional = true, version = "0.27.12", path = "../swc_common" }
|
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_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_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_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_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_prefixer = { optional = true, version = "0.121.0", path = "../swc_css_prefixer" }
|
||||||
swc_css_visit = { optional = true, version = "0.109.0", path = "../swc_css_visit"}
|
swc_css_utils = { optional = true, version = "0.107.0", path = "../swc_css_utils/" }
|
||||||
swc_css_prefixer = { optional = true, version = "0.121.0", path = "../swc_css_prefixer" }
|
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_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_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_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_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_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_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 = { 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_transforms_module = { optional = true, version = "0.146.0", path = "../swc_ecma_transforms_module" }
|
||||||
swc_ecma_utils = { optional = true, version = "0.101.0", path = "../swc_ecma_utils" }
|
swc_ecma_transforms_optimization = { optional = true, version = "0.160.0", path = "../swc_ecma_transforms_optimization" }
|
||||||
swc_ecma_visit = { optional = true, version = "0.76.6", path = "../swc_ecma_visit" }
|
swc_ecma_transforms_proposal = { optional = true, version = "0.137.0", path = "../swc_ecma_transforms_proposal" }
|
||||||
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
|
swc_ecma_transforms_react = { optional = true, version = "0.148.0", path = "../swc_ecma_transforms_react" }
|
||||||
swc_node_bundler = { optional = true, version = "0.10.0", path = "../swc_node_bundler" }
|
swc_ecma_transforms_testing = { optional = true, version = "0.108.0", path = "../swc_ecma_transforms_testing" }
|
||||||
swc_nodejs_common = { optional = true, version = "0.0.1", path = "../swc_nodejs_common" }
|
swc_ecma_transforms_typescript = { optional = true, version = "0.152.0", path = "../swc_ecma_transforms_typescript" }
|
||||||
swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" }
|
swc_ecma_utils = { optional = true, version = "0.101.0", path = "../swc_ecma_utils" }
|
||||||
swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" }
|
swc_ecma_visit = { optional = true, version = "0.76.6", path = "../swc_ecma_visit" }
|
||||||
swc_plugin_proxy = { optional = true, version = "0.18.13", path = "../swc_plugin_proxy" }
|
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
|
||||||
swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" }
|
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
|
# 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 }
|
swc_plugin_runner = { optional = true, version = "0.73.1", path = "../swc_plugin_runner", default-features = false }
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||||
|
|
||||||
// Quote
|
// Quote
|
||||||
#[cfg(feature = "quote")]
|
#[cfg(feature = "ecma_quote")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "quote")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_quote")))]
|
||||||
pub mod quote;
|
pub mod quote;
|
||||||
|
|
||||||
/// Not a public interface.
|
/// Not a public interface.
|
||||||
#[cfg(feature = "quote")]
|
#[cfg(feature = "ecma_quote")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "quote")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "ecma_quote")))]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub extern crate swc_ecma_quote_macros;
|
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")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__plugin_transform")))]
|
||||||
pub mod plugin;
|
pub mod plugin;
|
||||||
|
|
||||||
// ast exposed via swc_ecma_ast
|
#[cfg(feature = "__ecma")]
|
||||||
#[cfg(feature = "ast")]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__ecma")))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "ast")))]
|
pub mod ecma {
|
||||||
pub mod ast {
|
#[cfg(feature = "ecma_ast")]
|
||||||
pub use swc_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
|
// swc_ecma_loader
|
||||||
// by swc_ecma_ast reexports swc_atoms?
|
#[cfg(feature = "__ecma_loader")]
|
||||||
#[cfg(feature = "ast")]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__ecma_loader")))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "ast")))]
|
pub mod loader {
|
||||||
pub mod atoms {
|
pub use swc_ecma_loader::*;
|
||||||
pub use swc_atoms::*;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// visit* interfaces
|
#[cfg(feature = "__parser")]
|
||||||
#[cfg(feature = "visit")]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__parser")))]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "visit")))]
|
pub mod parser {
|
||||||
pub mod visit {
|
pub use swc_ecma_parser::*;
|
||||||
pub use swc_ecma_visit::*;
|
}
|
||||||
|
|
||||||
|
#[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
|
// swc features
|
||||||
@ -52,12 +117,6 @@ pub mod common {
|
|||||||
pub use swc_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
|
// swc_plugin_runner
|
||||||
#[cfg(feature = "__plugin_transform_host")]
|
#[cfg(feature = "__plugin_transform_host")]
|
||||||
#[cfg_attr(docsrs, doc(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::*;
|
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
|
// swc_bundler
|
||||||
#[cfg(feature = "__bundler")]
|
#[cfg(feature = "__bundler")]
|
||||||
#[cfg_attr(docsrs, doc(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(feature = "__binding_macros")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "__binding_macros")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__binding_macros")))]
|
||||||
pub mod binding_macros {
|
pub mod binding_macros {
|
||||||
@ -126,18 +159,6 @@ pub mod node {
|
|||||||
pub use swc_nodejs_common::*;
|
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(feature = "__css")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "__css")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "__css")))]
|
||||||
pub mod css {
|
pub mod css {
|
||||||
|
@ -9,7 +9,7 @@ macro_rules! impl_simple_enum {
|
|||||||
$(
|
$(
|
||||||
$E::$v => q!(
|
$E::$v => q!(
|
||||||
Vars {},
|
Vars {},
|
||||||
{ swc_core::ast::$E::$v }
|
{ swc_core::ecma::ast::$E::$v }
|
||||||
)
|
)
|
||||||
.parse(),
|
.parse(),
|
||||||
)*
|
)*
|
||||||
|
@ -16,7 +16,7 @@ impl ToCode for swc_ecma_ast::Ident {
|
|||||||
Vars {
|
Vars {
|
||||||
sym_value: self.sym.to_code(cx),
|
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()
|
.parse()
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ macro_rules! impl_enum_body {
|
|||||||
Vars {
|
Vars {
|
||||||
val: crate::ast::ToCode::to_code(inner, $cx),
|
val: crate::ast::ToCode::to_code(inner, $cx),
|
||||||
},
|
},
|
||||||
{ swc_core::ast::$E::$v(val) }
|
{ swc_core::ecma::ast::$E::$v(val) }
|
||||||
)
|
)
|
||||||
.parse(),
|
.parse(),
|
||||||
)*
|
)*
|
||||||
|
@ -29,7 +29,7 @@ impl Builder {
|
|||||||
ExprStruct {
|
ExprStruct {
|
||||||
attrs: Default::default(),
|
attrs: Default::default(),
|
||||||
brace_token: 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,
|
fields: self.fields,
|
||||||
dot2_token: Default::default(),
|
dot2_token: Default::default(),
|
||||||
rest: Default::default(),
|
rest: Default::default(),
|
||||||
|
@ -141,7 +141,7 @@ pub(super) fn prepare_vars(
|
|||||||
call_site(),
|
call_site(),
|
||||||
);
|
);
|
||||||
stmts.push(parse_quote! {
|
stmts.push(parse_quote! {
|
||||||
let #var_ident: swc_core::ast::#type_name = #value;
|
let #var_ident: swc_core::ecma::ast::#type_name = #value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
pub use swc_ecma_transforms_base::{
|
pub use swc_ecma_transforms_base::{
|
||||||
assumptions::Assumptions, feature, fixer, helpers, hygiene, pass, perf, resolver,
|
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(feature = "swc_ecma_transforms_compat")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "compat")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "compat")))]
|
||||||
pub use swc_ecma_transforms_compat as compat;
|
pub use swc_ecma_transforms_compat as compat;
|
||||||
|
@ -64,7 +64,7 @@ checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ast_node"
|
name = "ast_node"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"pmutil",
|
"pmutil",
|
||||||
@ -325,7 +325,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "from_variant"
|
name = "from_variant"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pmutil",
|
"pmutil",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@ -1246,7 +1246,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_atoms"
|
name = "swc_atoms"
|
||||||
version = "0.4.8"
|
version = "0.4.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytecheck",
|
"bytecheck",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -1259,7 +1259,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_common"
|
name = "swc_common"
|
||||||
version = "0.27.12"
|
version = "0.27.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -1290,13 +1290,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_core"
|
name = "swc_core"
|
||||||
version = "0.10.0"
|
version = "0.20.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"swc_atoms",
|
"swc_atoms",
|
||||||
"swc_common",
|
"swc_common",
|
||||||
"swc_ecma_ast",
|
"swc_ecma_ast",
|
||||||
"swc_ecma_quote_macros",
|
"swc_ecma_quote_macros",
|
||||||
|
"swc_ecma_transforms",
|
||||||
"swc_ecma_transforms_testing",
|
"swc_ecma_transforms_testing",
|
||||||
"swc_ecma_visit",
|
"swc_ecma_visit",
|
||||||
"swc_plugin",
|
"swc_plugin",
|
||||||
@ -1307,7 +1308,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_ast"
|
name = "swc_ecma_ast"
|
||||||
version = "0.90.11"
|
version = "0.90.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytecheck",
|
"bytecheck",
|
||||||
@ -1324,7 +1325,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_codegen"
|
name = "swc_ecma_codegen"
|
||||||
version = "0.122.0"
|
version = "0.123.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
@ -1352,7 +1353,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_parser"
|
name = "swc_ecma_parser"
|
||||||
version = "0.118.0"
|
version = "0.118.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"enum_kind",
|
"enum_kind",
|
||||||
@ -1385,7 +1386,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_testing"
|
name = "swc_ecma_testing"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hex",
|
"hex",
|
||||||
@ -1397,9 +1398,21 @@ dependencies = [
|
|||||||
"testing",
|
"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]]
|
[[package]]
|
||||||
name = "swc_ecma_transforms_base"
|
name = "swc_ecma_transforms_base"
|
||||||
version = "0.104.0"
|
version = "0.106.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"better_scoped_tls",
|
"better_scoped_tls",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@ -1420,7 +1433,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_transforms_testing"
|
name = "swc_ecma_transforms_testing"
|
||||||
version = "0.106.0"
|
version = "0.108.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -1442,7 +1455,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_ecma_utils"
|
name = "swc_ecma_utils"
|
||||||
version = "0.100.1"
|
version = "0.101.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@ -1507,14 +1520,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_plugin"
|
name = "swc_plugin"
|
||||||
version = "0.89.1"
|
version = "0.90.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swc_plugin_macro"
|
name = "swc_plugin_macro"
|
||||||
version = "0.9.7"
|
version = "0.9.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -13,5 +13,5 @@ crate-type = ["cdylib"]
|
|||||||
serde = "1"
|
serde = "1"
|
||||||
swc_core = { path = "../../../../swc_core", features = [
|
swc_core = { path = "../../../../swc_core", features = [
|
||||||
"plugin_transform",
|
"plugin_transform",
|
||||||
"quote",
|
"ecma_quote",
|
||||||
] }
|
] }
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
use swc_core::{
|
use swc_core::{
|
||||||
ast::*,
|
|
||||||
atoms::*,
|
|
||||||
common::DUMMY_SP,
|
common::DUMMY_SP,
|
||||||
|
ecma::{ast::*, atoms::*, visit::*},
|
||||||
plugin::{
|
plugin::{
|
||||||
errors::HANDLER,
|
errors::HANDLER,
|
||||||
metadata::{TransformPluginMetadataContextKind, TransformPluginProgramMetadata},
|
metadata::{TransformPluginMetadataContextKind, TransformPluginProgramMetadata},
|
||||||
plugin_transform,
|
plugin_transform,
|
||||||
},
|
},
|
||||||
quote,
|
quote,
|
||||||
visit::*,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConsoleOutputReplacer;
|
struct ConsoleOutputReplacer;
|
||||||
|
Loading…
Reference in New Issue
Block a user