fix(es/ast): Revert #5798 (#5798) (#5855)

This reverts commit 37f42df877.
This commit is contained in:
Donny/강동윤 2022-09-14 16:52:46 +09:00 committed by GitHub
parent 8432c0a1ad
commit 4cde553811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 69 additions and 135 deletions

View File

@ -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

1
Cargo.lock generated
View File

@ -3314,7 +3314,6 @@ dependencies = [
"is-macro",
"num-bigint",
"rkyv",
"rkyv-test",
"scoped-tls",
"serde",
"serde_json",

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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" }

View File

@ -1,4 +0,0 @@
#[cfg(all(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))]
compile_error!("Cannot enable bytechcked, non-bytechecked rkyv both");
fn main() {}

View File

@ -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 {

View File

@ -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 {

View File

@ -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<Class> 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<Span>,
#[serde(rename = "expression")]
#[cfg_attr(feature = "__rkyv", omit_bounds)]
#[cfg_attr(feature = "rkyv", omit_bounds)]
pub expr: Box<Expr>,
}

View File

@ -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<TsTypeAnn>,
}
@ -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.

View File

@ -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<BigIntValue> for EncodeBigInt {
type Archived = rkyv::Archived<String>;
type Resolver = rkyv::Resolver<String>;
@ -107,7 +102,7 @@ impl rkyv::with::ArchiveWith<BigIntValue> for EncodeBigInt {
}
}
#[cfg(any(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))]
#[cfg(feature = "rkyv")]
impl<S> rkyv::with::SerializeWith<BigIntValue, S> 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<D> rkyv::with::DeserializeWith<rkyv::Archived<String>, BigIntValue, D> for EncodeBigInt
where
D: ?Sized + rkyv::Fallible,
@ -164,10 +159,7 @@ impl From<BigIntValue> 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

View File

@ -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 {

View File

@ -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 {

View File

@ -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 }

View File

@ -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<swc_common::comments::SingleThreadedComments>,
}
#[cfg(feature = "__plugin_rt")]
#[cfg(feature = "plugin-rt")]
better_scoped_tls::scoped_tls!(
pub static COMMENTS: HostCommentsStorage
);

View File

@ -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;

View File

@ -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 {

View File

@ -1,4 +1,4 @@
mod transform_plugin_metadata;
#[cfg(feature = "__plugin_mode")]
#[cfg(feature = "plugin-mode")]
pub use transform_plugin_metadata::TransformPluginProgramMetadata;

View File

@ -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.

View File

@ -1,3 +1,3 @@
mod plugin_source_map_proxy;
#[cfg(feature = "__plugin_mode")]
#[cfg(feature = "plugin-mode")]
pub use plugin_source_map_proxy::PluginSourceMapProxy;