Skip to main content

swc_common/plugin/
mod.rs

1pub mod diagnostics;
2pub mod emit;
3pub mod metadata;
4#[cfg(feature = "__plugin")]
5#[cfg_attr(docsrs, doc(cfg(feature = "__plugin")))]
6pub mod serialized;
7
8/**
9 * Compile-time version constant for the AST struct schema's version.
10 *
11 * NOTE: this is for PARTIAL compatibility only, supporting if AST struct
12 * adds new properties without changing / removing existing properties.
13 *
14 * - When adding a new properties to the AST struct:
15 *  1. Create a new feature flag in cargo.toml
16 *  2. Create a new schema version with new feature flag.
17 *  3. Create a new AST struct with compile time feature flag with newly
18 *     added properties. Previous struct should remain with existing feature
19 *     flag, or add previous latest feature flag.
20 *
21 * - When removing, or changing existing properties in the AST struct: TBD
22 */
23#[cfg(feature = "plugin_transform_schema_v1")]
24pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = 1;
25
26// Reserved for the testing purpose.
27#[cfg(all(
28    feature = "plugin_transform_schema_vtest",
29    not(feature = "plugin_transform_schema_v1")
30))]
31pub const PLUGIN_TRANSFORM_AST_SCHEMA_VERSION: u32 = u32::MAX - 1;