Skip to content

Commit 8479d6c

Browse files
committed
build(cargo): features for the schema version
1 parent 3a1f573 commit 8479d6c

File tree

9 files changed

+27
-2
lines changed

9 files changed

+27
-2
lines changed

.github/workflows/cargo.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
- crate: swc_common
137137
os: ubuntu-latest
138138
check: |
139-
cargo hack check --feature-powerset --no-dev-deps
139+
cargo hack check --feature-powerset --no-dev-deps --exclude-features plugin-transform-schema-vtest
140140
- crate: swc_common
141141
os: windows-latest
142142
- crate: swc_config
@@ -401,6 +401,11 @@ jobs:
401401
run: |
402402
cargo test --color always -p ${{ matrix.settings.crate }}
403403
404+
- name: Run cargo test (plugin)
405+
if: matrix.settings.crate == 'swc_plugin_runner'
406+
run: |
407+
cargo test --color always -p swc_plugin_runner --features plugin-transform-schema-v1
408+
404409
- name: Run cargo test (all features)
405410
if: matrix.settings.crate == 'swc_ecma_parser' || matrix.settings.crate == 'swc_ecma_loader' || matrix.settings.crate == 'swc_ecma_transforms'
406411
run: |

crates/binding_core_node/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ crate-type = ["cdylib"]
1616
default = ["swc_v1", "plugin"]
1717
plugin = [
1818
"swc/plugin",
19+
"swc/plugin-transform-schema-v1",
20+
"swc_common/plugin-transform-schema-v1",
1921
"swc_plugin_runner/default",
22+
"swc_plugin_runner/plugin-transform-schema-v1",
2023
"wasmer/default",
2124
"wasmer-wasi/default",
2225
]

crates/binding_core_wasm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ swc_v2 = []
2020
plugin = [
2121
"swc/plugin",
2222
"swc_plugin_runner/memory_cache",
23+
"swc_plugin_runner/plugin-transform-schema-v1",
2324
"wasmer",
2425
"wasmer-wasi",
2526
"wasmer/js-default",

crates/swc/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ default = ["es3"]
2222
es3 = []
2323
node = ["napi", "napi-derive"]
2424
plugin = ["swc_plugin_runner", "swc_plugin_proxy/plugin-rt"]
25+
plugin-transform-schema-v1 = [
26+
"swc_common/plugin-transform-schema-v1",
27+
"swc_plugin_runner/plugin-transform-schema-v1"
28+
]
2529

2630
[dependencies]
2731
ahash = "0.7.4"

crates/swc_cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ default = []
1818
plugin = [
1919
"swc/plugin",
2020
"swc_plugin_runner/filesystem_cache",
21+
"swc_plugin_runner/plugin-transform-schema-v1",
2122
"wasmer/default",
2223
"wasmer-wasi/default",
2324
]

crates/swc_common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ plugin-mode = ["plugin-base"]
2626
plugin-rt = ["plugin-base"]
2727
rkyv-impl = ["rkyv", "bytecheck"]
2828
tty-emitter = ["atty", "termcolor"]
29+
plugin-transform-schema-v1 = []
30+
plugin-transform-schema-vtest = []
2931

3032
[dependencies]
3133
ahash = "0.7.4"

crates/swc_common/src/plugin.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ use crate::{syntax_pos::Mark, SyntaxContext};
2727
*
2828
* - When removing, or changing existing properties in the AST struct: TBD
2929
*/
30+
#[cfg(feature = "plugin-transform-schema-v1")]
3031
pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = 1;
3132

33+
// Reserved for the testing purpose.
34+
#[cfg(feature = "plugin-transform-schema-vtest")]
35+
pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = u32::MAX - 1;
36+
3237
#[derive(Debug, Clone, PartialEq, Eq)]
3338
#[non_exhaustive]
3439
#[cfg_attr(

crates/swc_plugin/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ quote = ["swc_ecma_quote"]
2222
swc_atoms = { version = "0.2.0", path = "../swc_atoms" }
2323
swc_common = { version = "0.23.0", path = "../swc_common", features = [
2424
"plugin-mode",
25+
"plugin-transform-schema-v1"
2526
] }
2627
swc_ecma_quote = { version = "0.25.0", path = "../swc_ecma_quote", optional = true }
2728
swc_ecmascript = { version = "0.179.0", path = "../swc_ecmascript", features = ["utils", "visit", "rkyv-impl"] }

crates/swc_plugin_runner/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ filesystem_cache = ["wasmer-cache"]
1919
# Supports a cache allow to store wasm module in-memory. This avoids recompilation
2020
# to the same module in a single procress lifecycle.
2121
memory_cache = []
22+
plugin-transform-schema-v1 = [
23+
"swc_common/plugin-transform-schema-v1"
24+
]
2225

2326
[dependencies]
2427
anyhow = "1.0.42"
@@ -28,7 +31,7 @@ serde = { version = "1.0.126", features = ["derive"] }
2831
serde_json = "1.0.64"
2932
swc_common = { version = "0.23.0", path = "../swc_common", features = [
3033
"plugin-rt",
31-
"concurrent",
34+
"concurrent"
3235
] }
3336
swc_ecma_ast = { version = "0.84.0", path = "../swc_ecma_ast", features = [
3437
"rkyv-impl",

0 commit comments

Comments
 (0)