Skip to content

Commit

Permalink
build(cargo): features for the schema version
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jul 9, 2022
1 parent 3a1f573 commit 8479d6c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
- crate: swc_common
os: ubuntu-latest
check: |
cargo hack check --feature-powerset --no-dev-deps
cargo hack check --feature-powerset --no-dev-deps --exclude-features plugin-transform-schema-vtest
- crate: swc_common
os: windows-latest
- crate: swc_config
Expand Down Expand Up @@ -401,6 +401,11 @@ jobs:
run: |
cargo test --color always -p ${{ matrix.settings.crate }}
- name: Run cargo test (plugin)
if: matrix.settings.crate == 'swc_plugin_runner'
run: |
cargo test --color always -p swc_plugin_runner --features plugin-transform-schema-v1
- name: Run cargo test (all features)
if: matrix.settings.crate == 'swc_ecma_parser' || matrix.settings.crate == 'swc_ecma_loader' || matrix.settings.crate == 'swc_ecma_transforms'
run: |
Expand Down
3 changes: 3 additions & 0 deletions crates/binding_core_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ crate-type = ["cdylib"]
default = ["swc_v1", "plugin"]
plugin = [
"swc/plugin",
"swc/plugin-transform-schema-v1",
"swc_common/plugin-transform-schema-v1",
"swc_plugin_runner/default",
"swc_plugin_runner/plugin-transform-schema-v1",
"wasmer/default",
"wasmer-wasi/default",
]
Expand Down
1 change: 1 addition & 0 deletions crates/binding_core_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ swc_v2 = []
plugin = [
"swc/plugin",
"swc_plugin_runner/memory_cache",
"swc_plugin_runner/plugin-transform-schema-v1",
"wasmer",
"wasmer-wasi",
"wasmer/js-default",
Expand Down
4 changes: 4 additions & 0 deletions crates/swc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ default = ["es3"]
es3 = []
node = ["napi", "napi-derive"]
plugin = ["swc_plugin_runner", "swc_plugin_proxy/plugin-rt"]
plugin-transform-schema-v1 = [
"swc_common/plugin-transform-schema-v1",
"swc_plugin_runner/plugin-transform-schema-v1"
]

[dependencies]
ahash = "0.7.4"
Expand Down
1 change: 1 addition & 0 deletions crates/swc_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ default = []
plugin = [
"swc/plugin",
"swc_plugin_runner/filesystem_cache",
"swc_plugin_runner/plugin-transform-schema-v1",
"wasmer/default",
"wasmer-wasi/default",
]
Expand Down
2 changes: 2 additions & 0 deletions crates/swc_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ plugin-mode = ["plugin-base"]
plugin-rt = ["plugin-base"]
rkyv-impl = ["rkyv", "bytecheck"]
tty-emitter = ["atty", "termcolor"]
plugin-transform-schema-v1 = []
plugin-transform-schema-vtest = []

[dependencies]
ahash = "0.7.4"
Expand Down
5 changes: 5 additions & 0 deletions crates/swc_common/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ use crate::{syntax_pos::Mark, SyntaxContext};
*
* - When removing, or changing existing properties in the AST struct: TBD
*/
#[cfg(feature = "plugin-transform-schema-v1")]
pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = 1;

// Reserved for the testing purpose.
#[cfg(feature = "plugin-transform-schema-vtest")]
pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = u32::MAX - 1;

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
#[cfg_attr(
Expand Down
1 change: 1 addition & 0 deletions crates/swc_plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ quote = ["swc_ecma_quote"]
swc_atoms = { version = "0.2.0", path = "../swc_atoms" }
swc_common = { version = "0.23.0", path = "../swc_common", features = [
"plugin-mode",
"plugin-transform-schema-v1"
] }
swc_ecma_quote = { version = "0.25.0", path = "../swc_ecma_quote", optional = true }
swc_ecmascript = { version = "0.179.0", path = "../swc_ecmascript", features = ["utils", "visit", "rkyv-impl"] }
Expand Down
5 changes: 4 additions & 1 deletion crates/swc_plugin_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ filesystem_cache = ["wasmer-cache"]
# Supports a cache allow to store wasm module in-memory. This avoids recompilation
# to the same module in a single procress lifecycle.
memory_cache = []
plugin-transform-schema-v1 = [
"swc_common/plugin-transform-schema-v1"
]

[dependencies]
anyhow = "1.0.42"
Expand All @@ -28,7 +31,7 @@ serde = { version = "1.0.126", features = ["derive"] }
serde_json = "1.0.64"
swc_common = { version = "0.23.0", path = "../swc_common", features = [
"plugin-rt",
"concurrent",
"concurrent"
] }
swc_ecma_ast = { version = "0.84.0", path = "../swc_ecma_ast", features = [
"rkyv-impl",
Expand Down

0 comments on commit 8479d6c

Please sign in to comment.