diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 5f0c775faa6..1755b2500bf 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -195,7 +195,7 @@ jobs: os: ubuntu-latest runner: ubuntu-latest check: | - cargo hack check --feature-powerset --no-dev-deps --exclude-features __rkyv --exclude-features rkyv-bytecheck-impl + cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_codegen os: ubuntu-latest runner: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 34f6a49134c..c8ad4096185 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3314,7 +3314,6 @@ dependencies = [ "is-macro", "num-bigint", "rkyv", - "rkyv-test", "scoped-tls", "serde", "serde_json", diff --git a/crates/ast_node/src/lib.rs b/crates/ast_node/src/lib.rs index 4c2c45b50be..96ce23211ab 100644 --- a/crates/ast_node/src/lib.rs +++ b/crates/ast_node/src/lib.rs @@ -151,7 +151,7 @@ struct AddAttr; impl VisitMut for AddAttr { fn visit_field_mut(&mut self, f: &mut Field) { f.attrs - .push(parse_quote!(#[cfg_attr(feature = "__rkyv", omit_bounds)])); + .push(parse_quote!(#[cfg_attr(feature = "rkyv", omit_bounds)])); } } @@ -210,27 +210,16 @@ pub fn ast_node( )] clone #[cfg_attr( - feature = "rkyv-impl", + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - feature = "rkyv-bytecheck-impl", - derive(rkyv_latest::Archive, rkyv_latest::Serialize, rkyv_latest::Deserialize) - )] - #[cfg_attr( - feature = "rkyv-impl", + feature = "rkyv", archive(bound( serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace + rkyv::ser::SharedSerializeRegistry", deserialize = "__D: rkyv::de::SharedDeserializeRegistry" )) )] - #[cfg_attr( - feature = "rkyv-bytecheck-impl", - archive(bound( - serialize = "__S: rkyv_latest::ser::Serializer + rkyv_latest::ser::ScratchSpace + rkyv_latest::ser::SharedSerializeRegistry", - deserialize = "__D: rkyv_latest::de::SharedDeserializeRegistry" - )) - )] #[serde(untagged)] input })) @@ -274,15 +263,11 @@ pub fn ast_node( #[derive(::swc_common::Spanned, Clone, Debug, PartialEq)] #[derive(::serde::Serialize, ::serde::Deserialize)] #[cfg_attr( - feature = "rkyv-impl", + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - feature = "rkyv-bytecheck-impl", - derive(rkyv_latest::Archive, rkyv_latest::Serialize, rkyv_latest::Deserialize) - )] - #[cfg_attr( - feature = "rkyv-impl", + feature = "rkyv", archive( bound( serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace + rkyv::ser::SharedSerializeRegistry", @@ -290,15 +275,6 @@ pub fn ast_node( ) ) )] - #[cfg_attr( - feature = "rkyv-bytecheck-impl", - archive( - bound( - serialize = "__S: rkyv_latest::ser::Serializer + rkyv_latest::ser::ScratchSpace + rkyv_latest::ser::SharedSerializeRegistry", - deserialize = "__D: rkyv_latest::de::SharedDeserializeRegistry" - ) - ) - )] serde_tag #[serde(rename_all = "camelCase")] serde_rename diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 24ff3993783..da65778e6ea 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -245,10 +245,11 @@ __plugin_transform_host = [ __plugin_transform_host_bytecheck = [ "__common", "swc_atoms/rkyv-bytecheck-impl", - "swc_common/plugin-bytecheck-rt", - "swc_ecma_ast/rkyv-bytecheck-impl", - "swc_plugin_proxy/plugin-bytecheck-rt", - "swc/plugin-bytecheck", + + # "swc_ecma_ast/rkyv-impl", + # "swc_common/plugin-rt", + # "swc_plugin_proxy/plugin-rt", + # "swc/plugin", ] # Internal flags to control plugin environment diff --git a/crates/swc_css_ast/Cargo.toml b/crates/swc_css_ast/Cargo.toml index f97b6b7fc26..c9be8613239 100644 --- a/crates/swc_css_ast/Cargo.toml +++ b/crates/swc_css_ast/Cargo.toml @@ -12,10 +12,8 @@ version = "0.112.3" bench = false [features] -__rkyv = [] -default = [] -rkyv-bytecheck-impl = [] -rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] +default = [] +rkyv-impl = ["rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] [dependencies] diff --git a/crates/swc_ecma_ast/Cargo.toml b/crates/swc_ecma_ast/Cargo.toml index 4e22e126502..80ba8d40ba5 100644 --- a/crates/swc_ecma_ast/Cargo.toml +++ b/crates/swc_ecma_ast/Cargo.toml @@ -16,29 +16,18 @@ version = "0.91.4" bench = false [features] -__rkyv = [] -default = [] -fuzzing = ["arbitrary", "swc_common/arbitrary"] -# Enably rkyv serialization with stable version of rkyv. -rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] -# Enable rkyv serialization with updated version of rkyv, along with bytecheck. -rkyv-bytecheck-impl = [ - "__rkyv", - "rkyv-latest", - "swc_atoms/rkyv-bytecheck-impl", - "swc_common/rkyv-bytecheck-impl", -] +default = [] +fuzzing = ["arbitrary", "swc_common/arbitrary"] +rkyv-impl = ["rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] +rkyv-bytecheck-impl = [] [dependencies] -arbitrary = { version = "1", optional = true, features = ["derive"] } -bitflags = "1" -bytecheck = { version = "0.6.9", optional = true } -is-macro = "0.2.0" -num-bigint = { version = "0.4", features = ["serde"] } -rkyv = { package = "rkyv", version = "=0.7.37", optional = true } -# This is to avoid cargo version selection conflict between rkyv=0.7.37 and other versions, as it is strictly pinned -# cannot be merged. -rkyv-latest = { package = "rkyv-test", version = "=0.7.38-test.2", optional = true } +arbitrary = { version = "1", optional = true, features = ["derive"] } +bitflags = "1" +bytecheck = { version = "0.6.9", optional = true } +is-macro = "0.2.0" +num-bigint = { version = "0.4", features = ["serde"] } +rkyv = { version = "=0.7.37", optional = true } scoped-tls = "1.0.0" serde = { version = "1.0.133", features = ["derive"] } string_enum = { version = "0.3.1", path = "../string_enum" } diff --git a/crates/swc_ecma_ast/build.rs b/crates/swc_ecma_ast/build.rs deleted file mode 100644 index 17fe53a27de..00000000000 --- a/crates/swc_ecma_ast/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[cfg(all(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))] -compile_error!("Cannot enable bytechcked, non-bytechecked rkyv both"); - -fn main() {} diff --git a/crates/swc_ecma_ast/src/class.rs b/crates/swc_ecma_ast/src/class.rs index 914bb2a00cd..ef62f6eb091 100644 --- a/crates/swc_ecma_ast/src/class.rs +++ b/crates/swc_ecma_ast/src/class.rs @@ -1,6 +1,4 @@ use is_macro::Is; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use serde::{Deserialize, Serialize}; use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; @@ -247,7 +245,7 @@ pub struct Decorator { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum MethodKind { diff --git a/crates/swc_ecma_ast/src/decl.rs b/crates/swc_ecma_ast/src/decl.rs index 4a2937a68c7..c6fd2ba7bec 100644 --- a/crates/swc_ecma_ast/src/decl.rs +++ b/crates/swc_ecma_ast/src/decl.rs @@ -1,6 +1,4 @@ use is_macro::Is; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use string_enum::StringEnum; use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; @@ -109,7 +107,7 @@ impl Take for VarDecl { #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum VarDeclKind { diff --git a/crates/swc_ecma_ast/src/expr.rs b/crates/swc_ecma_ast/src/expr.rs index 00a837799cd..c085f795f63 100644 --- a/crates/swc_ecma_ast/src/expr.rs +++ b/crates/swc_ecma_ast/src/expr.rs @@ -1,7 +1,5 @@ #![allow(clippy::vec_box)] use is_macro::Is; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use serde::{ self, de::{self, MapAccess, Visitor}, @@ -546,11 +544,11 @@ impl From for ClassExpr { #[derive(Spanned, Clone, Debug, PartialEq, Serialize)] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", archive(bound( serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace + \ rkyv::ser::SharedSerializeRegistry", @@ -908,7 +906,7 @@ pub struct MetaPropExpr { #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum MetaPropKind { @@ -1088,11 +1086,11 @@ impl Take for Import { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", archive(bound( serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace + \ rkyv::ser::SharedSerializeRegistry", @@ -1101,11 +1099,11 @@ impl Take for Import { )] pub struct ExprOrSpread { #[serde(default)] - #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "rkyv", omit_bounds)] pub spread: Option, #[serde(rename = "expression")] - #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "rkyv", omit_bounds)] pub expr: Box, } diff --git a/crates/swc_ecma_ast/src/ident.rs b/crates/swc_ecma_ast/src/ident.rs index fb2f7f6ccb5..3400e1c5714 100644 --- a/crates/swc_ecma_ast/src/ident.rs +++ b/crates/swc_ecma_ast/src/ident.rs @@ -1,7 +1,5 @@ use std::fmt::Display; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use scoped_tls::scoped_thread_local; use serde::{Deserialize, Serialize}; use swc_atoms::{js_word, JsWord}; @@ -16,11 +14,11 @@ use crate::typescript::TsTypeAnn; #[derive(Spanned, Clone, Debug, PartialEq, Eq, Hash, EqIgnoreSpan, Serialize, Deserialize)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", archive(bound( serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace + \ rkyv::ser::SharedSerializeRegistry", @@ -30,10 +28,10 @@ use crate::typescript::TsTypeAnn; pub struct BindingIdent { #[span] #[serde(flatten)] - #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "rkyv", omit_bounds)] pub id: Ident, #[serde(default, rename = "typeAnnotation")] - #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "rkyv", omit_bounds)] pub type_ann: Option, } @@ -115,10 +113,7 @@ bridge_from!(BindingIdent, Ident, Id); pub struct Ident { pub span: Span, #[serde(rename = "value")] - #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), - with(swc_atoms::EncodeJsWord) - )] + #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] pub sym: JsWord, /// TypeScript only. Used in case of an optional parameter. diff --git a/crates/swc_ecma_ast/src/lit.rs b/crates/swc_ecma_ast/src/lit.rs index 91287faedea..66ba2bed3af 100644 --- a/crates/swc_ecma_ast/src/lit.rs +++ b/crates/swc_ecma_ast/src/lit.rs @@ -6,8 +6,6 @@ use std::{ }; use num_bigint::BigInt as BigIntValue; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use swc_atoms::{js_word, Atom, JsWord}; use swc_common::{ast_node, util::take::Take, EqIgnoreSpan, Span, DUMMY_SP}; @@ -68,10 +66,7 @@ bridge_lit_from!(BigInt, BigIntValue); #[derive(Eq, Hash)] pub struct BigInt { pub span: Span, - #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), - with(EncodeBigInt) - )] + #[cfg_attr(feature = "rkyv", with(EncodeBigInt))] pub value: BigIntValue, /// Use `None` value only for transformations to avoid recalculate @@ -85,11 +80,11 @@ impl EqIgnoreSpan for BigInt { } } -#[cfg(feature = "__rkyv")] +#[cfg(feature = "rkyv")] #[derive(Debug, Clone, Copy)] pub struct EncodeBigInt; -#[cfg(any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))] +#[cfg(feature = "rkyv")] impl rkyv::with::ArchiveWith for EncodeBigInt { type Archived = rkyv::Archived; type Resolver = rkyv::Resolver; @@ -107,7 +102,7 @@ impl rkyv::with::ArchiveWith for EncodeBigInt { } } -#[cfg(any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))] +#[cfg(feature = "rkyv")] impl rkyv::with::SerializeWith for EncodeBigInt where S: ?Sized + rkyv::ser::Serializer, @@ -118,7 +113,7 @@ where } } -#[cfg(any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))] +#[cfg(feature = "rkyv")] impl rkyv::with::DeserializeWith, BigIntValue, D> for EncodeBigInt where D: ?Sized + rkyv::Fallible, @@ -164,10 +159,7 @@ impl From for BigInt { pub struct Str { pub span: Span, - #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), - with(swc_atoms::EncodeJsWord) - )] + #[cfg_attr(feature = "rkyv", with(swc_atoms::EncodeJsWord))] pub value: JsWord, /// Use `None` value only for transformations to avoid recalculate escaped diff --git a/crates/swc_ecma_ast/src/operators.rs b/crates/swc_ecma_ast/src/operators.rs index 7b77d5a3d93..8d17a1ec587 100644 --- a/crates/swc_ecma_ast/src/operators.rs +++ b/crates/swc_ecma_ast/src/operators.rs @@ -1,12 +1,10 @@ -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use string_enum::StringEnum; use swc_common::EqIgnoreSpan; #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum BinaryOp { @@ -115,7 +113,7 @@ impl BinaryOp { #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum AssignOp { @@ -188,7 +186,7 @@ impl AssignOp { #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum UpdateOp { @@ -201,7 +199,7 @@ pub enum UpdateOp { #[derive(StringEnum, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum UnaryOp { diff --git a/crates/swc_ecma_ast/src/typescript.rs b/crates/swc_ecma_ast/src/typescript.rs index 8165955449c..a5693f95b6f 100644 --- a/crates/swc_ecma_ast/src/typescript.rs +++ b/crates/swc_ecma_ast/src/typescript.rs @@ -3,8 +3,6 @@ use std::fmt; use is_macro::Is; -#[cfg(feature = "rkyv-bytecheck-impl")] -use rkyv_latest as rkyv; use serde::{ de::{self, Unexpected, Visitor}, Deserialize, Deserializer, Serialize, @@ -391,7 +389,7 @@ pub struct TsKeywordType { #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum TsKeywordTypeKind { @@ -672,7 +670,7 @@ pub struct TsTypeOperator { #[derive(StringEnum, Clone, Copy, PartialEq, Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum TsTypeOperatorOp { @@ -698,7 +696,7 @@ pub struct TsIndexedAccessType { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum TruePlusMinus { @@ -1058,7 +1056,7 @@ pub struct TsNonNullExpr { #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Eq, Hash, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[cfg_attr( - any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"), + feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] pub enum Accessibility { diff --git a/crates/swc_html_ast/Cargo.toml b/crates/swc_html_ast/Cargo.toml index 88fe1a7b886..704d576e80d 100644 --- a/crates/swc_html_ast/Cargo.toml +++ b/crates/swc_html_ast/Cargo.toml @@ -15,9 +15,7 @@ version = "0.25.4" bench = false [features] -__rkyv = [] -rkyv-bytecheck-impl = [] -rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] +rkyv-impl = ["rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] [dependencies] bytecheck = { version = "0.6.9", optional = true } diff --git a/crates/swc_plugin_proxy/src/comments/host_comments_storage.rs b/crates/swc_plugin_proxy/src/comments/host_comments_storage.rs index f580a34d296..52f5706c517 100644 --- a/crates/swc_plugin_proxy/src/comments/host_comments_storage.rs +++ b/crates/swc_plugin_proxy/src/comments/host_comments_storage.rs @@ -10,12 +10,12 @@ /// /// Should never attempt to use this other than plugin_runner. // TODO: This storage does not support mutable yet -#[cfg(feature = "__plugin_rt")] +#[cfg(feature = "plugin-rt")] pub struct HostCommentsStorage { pub inner: Option, } -#[cfg(feature = "__plugin_rt")] +#[cfg(feature = "plugin-rt")] better_scoped_tls::scoped_tls!( pub static COMMENTS: HostCommentsStorage ); diff --git a/crates/swc_plugin_proxy/src/comments/mod.rs b/crates/swc_plugin_proxy/src/comments/mod.rs index bbfb5b74f11..db74873241c 100644 --- a/crates/swc_plugin_proxy/src/comments/mod.rs +++ b/crates/swc_plugin_proxy/src/comments/mod.rs @@ -1,7 +1,7 @@ mod host_comments_storage; mod plugin_comments_proxy; -#[cfg(feature = "__plugin_rt")] +#[cfg(feature = "plugin-rt")] pub use host_comments_storage::{HostCommentsStorage, COMMENTS}; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] pub use plugin_comments_proxy::PluginCommentsProxy; diff --git a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs index a3baea7e8f4..80e56dad6fd 100644 --- a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs +++ b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs @@ -1,12 +1,12 @@ -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] use swc_common::{ comments::{Comment, Comments}, BytePos, }; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] use swc_trace_macro::swc_trace; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] use crate::memory_interop::read_returned_result_from_host; @@ -36,11 +36,11 @@ extern "C" { /// This _does not_ derives serialization / deserialization for the /// Serialized::de/serialize interface. Instead, swc_plugin_macro injects an /// instance in plugin's runtime directly. -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[derive(Debug, Copy, Clone)] pub struct PluginCommentsProxy; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[swc_trace] impl PluginCommentsProxy { /// Copy guest memory's struct into host via CommentHostEnvironment's @@ -73,7 +73,7 @@ impl PluginCommentsProxy { } } -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] #[swc_trace] impl Comments for PluginCommentsProxy { diff --git a/crates/swc_plugin_proxy/src/metadata/mod.rs b/crates/swc_plugin_proxy/src/metadata/mod.rs index 3ebbc74a4e9..fe3460ecc55 100644 --- a/crates/swc_plugin_proxy/src/metadata/mod.rs +++ b/crates/swc_plugin_proxy/src/metadata/mod.rs @@ -1,4 +1,4 @@ mod transform_plugin_metadata; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] pub use transform_plugin_metadata::TransformPluginProgramMetadata; diff --git a/crates/swc_plugin_proxy/src/metadata/transform_plugin_metadata.rs b/crates/swc_plugin_proxy/src/metadata/transform_plugin_metadata.rs index fb31399c2a5..3e39c1a8420 100644 --- a/crates/swc_plugin_proxy/src/metadata/transform_plugin_metadata.rs +++ b/crates/swc_plugin_proxy/src/metadata/transform_plugin_metadata.rs @@ -1,9 +1,9 @@ -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] use swc_common::Mark; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] use swc_trace_macro::swc_trace; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] use crate::{ memory_interop::read_returned_result_from_host, PluginCommentsProxy, PluginSourceMapProxy, @@ -15,7 +15,7 @@ use crate::{ /// An arbitary metadata for given Program to run transform in plugin. /// These are not directly attached to Program's AST structures /// but required for certain transforms. -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[derive(Debug)] pub struct TransformPluginProgramMetadata { /// Proxy to the comments for the Program passed into plugin. @@ -38,7 +38,7 @@ extern "C" { fn __get_raw_experiemtal_transform_context(allocated_ret_ptr: i32) -> i32; } -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] #[swc_trace] impl TransformPluginProgramMetadata { /// Returns current plugin's configuration as a JSON string. diff --git a/crates/swc_plugin_proxy/src/source_map/mod.rs b/crates/swc_plugin_proxy/src/source_map/mod.rs index 6c66ea4f64d..82de2339674 100644 --- a/crates/swc_plugin_proxy/src/source_map/mod.rs +++ b/crates/swc_plugin_proxy/src/source_map/mod.rs @@ -1,3 +1,3 @@ mod plugin_source_map_proxy; -#[cfg(feature = "__plugin_mode")] +#[cfg(feature = "plugin-mode")] pub use plugin_source_map_proxy::PluginSourceMapProxy;