From 2cd7db0045a32f3670c92e1b394d63582949ec6c Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:36:32 -0700 Subject: [PATCH 1/8] feat(turbopack-ecmascript): accept transform plugin in moduleoptioncontext --- .../turbopack-ecmascript-plugins/Cargo.toml | 1 + .../src/transform/emotion.rs | 8 ++++- crates/turbopack-ecmascript/src/lib.rs | 5 ++-- .../turbopack-ecmascript/src/transform/mod.rs | 25 +++++++++++++--- crates/turbopack/src/module_options/mod.rs | 29 ++++++++++++++++++- .../module_options/module_options_context.rs | 18 +++++++++++- 6 files changed, 77 insertions(+), 9 deletions(-) diff --git a/crates/turbopack-ecmascript-plugins/Cargo.toml b/crates/turbopack-ecmascript-plugins/Cargo.toml index 399d9bae5d4cb..1b364cf214cd3 100644 --- a/crates/turbopack-ecmascript-plugins/Cargo.toml +++ b/crates/turbopack-ecmascript-plugins/Cargo.toml @@ -14,6 +14,7 @@ transform_emotion = [] [dependencies] anyhow = { workspace = true } +async-trait = { workspace = true } serde = { workspace = true } turbo-tasks = { workspace = true } diff --git a/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs b/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs index 63c1eb184759a..39ad705413780 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs @@ -5,6 +5,7 @@ use std::{ }; use anyhow::Result; +use async_trait::async_trait; use serde::{Deserialize, Serialize}; use swc_core::{ common::util::take::Take, @@ -91,8 +92,13 @@ impl EmotionTransformer { } } +#[async_trait] impl CustomTransformer for EmotionTransformer { - fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) -> Option { + async fn transform( + &self, + program: &mut Program, + ctx: &TransformContext<'_>, + ) -> Option { #[cfg(feature = "transform_emotion")] { let p = std::mem::replace(program, Program::Module(Module::dummy())); diff --git a/crates/turbopack-ecmascript/src/lib.rs b/crates/turbopack-ecmascript/src/lib.rs index ad92d35af8d4b..a83f07615efb3 100644 --- a/crates/turbopack-ecmascript/src/lib.rs +++ b/crates/turbopack-ecmascript/src/lib.rs @@ -42,8 +42,9 @@ use swc_core::{ }, }; pub use transform::{ - CustomTransformer, EcmascriptInputTransform, EcmascriptInputTransformsVc, TransformContext, - TransformPlugin, TransformPluginVc, + CustomTransformer, EcmascriptInputTransform, EcmascriptInputTransformsVc, + OptionTransformPlugin, OptionTransformPluginVc, TransformContext, TransformPlugin, + TransformPluginVc, }; use turbo_tasks::{ primitives::StringVc, trace::TraceRawVcs, RawVc, ReadRef, TryJoinIterExt, Value, ValueToString, diff --git a/crates/turbopack-ecmascript/src/transform/mod.rs b/crates/turbopack-ecmascript/src/transform/mod.rs index f58f51c9500bf..01ec583144c4e 100644 --- a/crates/turbopack-ecmascript/src/transform/mod.rs +++ b/crates/turbopack-ecmascript/src/transform/mod.rs @@ -4,6 +4,7 @@ mod util; use std::{fmt::Debug, hash::Hash, path::PathBuf, sync::Arc}; use anyhow::Result; +use async_trait::async_trait; use swc_core::{ base::SwcComments, common::{chain, util::take::Take, FileName, Mark, SourceMap}, @@ -77,8 +78,10 @@ pub enum EcmascriptInputTransform { /// The CustomTransformer trait allows you to implement your own custom SWC /// transformer to run over all ECMAScript files imported in the graph. +#[async_trait] pub trait CustomTransformer: Debug { - fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) -> Option; + async fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) + -> Option; } /// A wrapper around a TransformPlugin instance, allowing it to operate with @@ -93,9 +96,23 @@ pub trait CustomTransformer: Debug { #[derive(Debug)] pub struct TransformPlugin(#[turbo_tasks(trace_ignore)] Box); +#[turbo_tasks::value(transparent)] +pub struct OptionTransformPlugin(Option); + +impl Default for OptionTransformPluginVc { + fn default() -> Self { + OptionTransformPluginVc::cell(None) + } +} + +#[async_trait] impl CustomTransformer for TransformPlugin { - fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) -> Option { - self.0.transform(program, ctx) + async fn transform( + &self, + program: &mut Program, + ctx: &TransformContext<'_>, + ) -> Option { + self.0.transform(program, ctx).await } } @@ -323,7 +340,7 @@ impl EcmascriptInputTransform { } } EcmascriptInputTransform::Plugin(transform) => { - if let Some(output) = transform.await?.transform(program, ctx) { + if let Some(output) = transform.await?.transform(program, ctx).await { *program = output; } } diff --git a/crates/turbopack/src/module_options/mod.rs b/crates/turbopack/src/module_options/mod.rs index f5e6a0afd2289..1efe5f5d99ad9 100644 --- a/crates/turbopack/src/module_options/mod.rs +++ b/crates/turbopack/src/module_options/mod.rs @@ -79,6 +79,7 @@ impl ModuleOptionsVc { preset_env_versions, ref custom_ecmascript_app_transforms, ref custom_ecmascript_transforms, + ref custom_ecma_transform_plugins, ref custom_rules, execution_context, ref rules, @@ -93,7 +94,30 @@ impl ModuleOptionsVc { } } } - let mut transforms = custom_ecmascript_app_transforms.clone(); + + let (before_transform_plugins, after_transform_plugins) = + if let Some(transform_plugins) = custom_ecma_transform_plugins { + let transform_plugins = transform_plugins.await?; + ( + transform_plugins + .before + .iter() + .cloned() + .map(|plugin| EcmascriptInputTransform::Plugin(plugin)) + .collect(), + transform_plugins + .after + .iter() + .cloned() + .map(|plugin| EcmascriptInputTransform::Plugin(plugin)) + .collect(), + ) + } else { + (vec![], vec![]) + }; + + let mut transforms = before_transform_plugins; + transforms.extend(custom_ecmascript_app_transforms.iter().cloned()); transforms.extend(custom_ecmascript_transforms.iter().cloned()); // Order of transforms is important. e.g. if the React transform occurs before @@ -182,6 +206,7 @@ impl ModuleOptionsVc { .iter() .cloned() .chain(transforms.iter().cloned()) + .chain(after_transform_plugins.iter().cloned()) .collect(), ) } else { @@ -202,6 +227,7 @@ impl ModuleOptionsVc { .iter() .cloned() .chain(transforms.iter().cloned()) + .chain(after_transform_plugins.iter().cloned()) .collect(), ); @@ -222,6 +248,7 @@ impl ModuleOptionsVc { .iter() .cloned() .chain(transforms.iter().cloned()) + .chain(after_transform_plugins.iter().cloned()) .collect(), ); diff --git a/crates/turbopack/src/module_options/module_options_context.rs b/crates/turbopack/src/module_options/module_options_context.rs index a3451616007d1..4a08039825dd1 100644 --- a/crates/turbopack/src/module_options/module_options_context.rs +++ b/crates/turbopack/src/module_options/module_options_context.rs @@ -2,7 +2,7 @@ use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use turbo_tasks::trace::TraceRawVcs; use turbopack_core::{environment::EnvironmentVc, resolve::options::ImportMappingVc}; -use turbopack_ecmascript::EcmascriptInputTransform; +use turbopack_ecmascript::{EcmascriptInputTransform, TransformPluginVc}; use turbopack_ecmascript_plugins::transform::emotion::EmotionTransformConfigVc; use turbopack_node::{ execution_context::ExecutionContextVc, transforms::webpack::WebpackLoaderConfigItemsVc, @@ -156,6 +156,18 @@ impl Default for StyledComponentsTransformConfigVc { } } +/// Configuration options for the custom ecma transform to be applied. +#[turbo_tasks::value(shared)] +#[derive(Default, Clone)] +pub struct CustomEcmaTransformPlugins { + /// List of plugins to be applied before the main transform. + /// Transform will be applied in the order of the list. + pub before: Vec, + /// List of plugins to be applied after the main transform. + /// Transform will be applied in the order of the list. + pub after: Vec, +} + #[turbo_tasks::value(shared)] #[derive(Default, Clone)] pub struct ModuleOptionsContext { @@ -187,11 +199,15 @@ pub struct ModuleOptionsContext { pub enable_mdx_rs: bool, #[serde(default)] pub preset_env_versions: Option, + #[deprecated(note = "use custom_ecma_transform_plugins instead")] #[serde(default)] pub custom_ecmascript_app_transforms: Vec, + #[deprecated(note = "use custom_ecma_transform_plugins instead")] #[serde(default)] pub custom_ecmascript_transforms: Vec, #[serde(default)] + pub custom_ecma_transform_plugins: Option, + #[serde(default)] /// Custom rules to be applied after all default rules. pub custom_rules: Vec, #[serde(default)] From 5572c5ea8553b32d3e8b7d6814f6035f5dc93f30 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:36:58 -0700 Subject: [PATCH 2/8] build(cargo): update lockfile --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 6aca81d44ae1d..d63c8872a01c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8869,6 +8869,7 @@ name = "turbopack-ecmascript-plugins" version = "0.1.0" dependencies = [ "anyhow", + "async-trait", "serde", "swc_core", "swc_emotion", From 0f1a774fd3fd3e3ae807dfb98542af9266cf8375 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Thu, 27 Apr 2023 19:07:21 -0700 Subject: [PATCH 3/8] feat(ecma-plugins): support relay custom transformer --- .../turbopack-ecmascript-plugins/Cargo.toml | 2 + .../src/transform/mod.rs | 1 + .../src/transform/relay.rs | 72 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 crates/turbopack-ecmascript-plugins/src/transform/relay.rs diff --git a/crates/turbopack-ecmascript-plugins/Cargo.toml b/crates/turbopack-ecmascript-plugins/Cargo.toml index 1b364cf214cd3..b9552a5796813 100644 --- a/crates/turbopack-ecmascript-plugins/Cargo.toml +++ b/crates/turbopack-ecmascript-plugins/Cargo.toml @@ -18,10 +18,12 @@ async-trait = { workspace = true } serde = { workspace = true } turbo-tasks = { workspace = true } +turbo-tasks-fs = { workspace = true } turbopack-ecmascript = { workspace = true } swc_core = { workspace = true, features = ["ecma_ast", "ecma_visit", "common"] } swc_emotion = { workspace = true } +swc_relay = { workspace = true } [build-dependencies] turbo-tasks-build = { workspace = true } diff --git a/crates/turbopack-ecmascript-plugins/src/transform/mod.rs b/crates/turbopack-ecmascript-plugins/src/transform/mod.rs index 3697907f45254..ba33ce94d8bd6 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/mod.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/mod.rs @@ -1 +1,2 @@ pub mod emotion; +pub mod relay; diff --git a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs new file mode 100644 index 0000000000000..cf955b58fcff5 --- /dev/null +++ b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs @@ -0,0 +1,72 @@ +use std::path::PathBuf; + +use async_trait::async_trait; +use swc_core::{ + common::{util::take::Take, FileName}, + ecma::{ + ast::{Module, Program}, + visit::FoldWith, + }, +}; +use turbo_tasks_fs::FileSystem; +use turbopack_ecmascript::{CustomTransformer, TransformContext}; + +#[derive(Debug)] +pub struct RelayTransformer { + config: swc_relay::Config, +} + +impl RelayTransformer { + pub fn new(config: swc_relay::Config) -> Self { + Self { config } + } +} + +#[async_trait] +impl CustomTransformer for RelayTransformer { + async fn transform( + &self, + program: &mut Program, + ctx: &TransformContext<'_>, + ) -> Option { + let root = if let Ok(file_path) = ctx.file_path.await { + file_path + .fs + .root() + .await + .map_or(PathBuf::new(), |v| PathBuf::from(v.path.to_string())) + } else { + PathBuf::new() + }; + + let (root, config) = if self.config.artifact_directory.is_some() { + (root, None) + } else { + let config = swc_relay::Config { + artifact_directory: Some(PathBuf::from("__generated__")), + ..self.config + }; + ( + if root.as_os_str().is_empty() { + PathBuf::from(".") + } else { + root + }, + Some(config), + ) + }; + + let p = std::mem::replace(program, Program::Module(Module::dummy())); + *program = p.fold_with(&mut swc_relay::relay( + config.as_ref().unwrap_or_else(|| &self.config), + FileName::Real(PathBuf::from(ctx.file_name_str)), + root, + // [TODO]: pages_dir comes through next-swc-loader + // https://github.com/vercel/next.js/blob/ea472e8058faea8ebdab2ef6d3aab257a1f0d11c/packages/next/src/build/webpack-config.ts#L792 + None, + Some(ctx.unresolved_mark), + )); + + None + } +} From 868595ce086f635470e31e44009a0c3619869f68 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Tue, 2 May 2023 11:05:27 -0700 Subject: [PATCH 4/8] refactor(module_options): rename properties --- crates/turbopack/src/module_options/mod.rs | 4 ++-- .../src/module_options/module_options_context.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/turbopack/src/module_options/mod.rs b/crates/turbopack/src/module_options/mod.rs index 1efe5f5d99ad9..fa6dfc9c592e0 100644 --- a/crates/turbopack/src/module_options/mod.rs +++ b/crates/turbopack/src/module_options/mod.rs @@ -100,13 +100,13 @@ impl ModuleOptionsVc { let transform_plugins = transform_plugins.await?; ( transform_plugins - .before + .source_transforms .iter() .cloned() .map(|plugin| EcmascriptInputTransform::Plugin(plugin)) .collect(), transform_plugins - .after + .output_transforms .iter() .cloned() .map(|plugin| EcmascriptInputTransform::Plugin(plugin)) diff --git a/crates/turbopack/src/module_options/module_options_context.rs b/crates/turbopack/src/module_options/module_options_context.rs index 4a08039825dd1..b361f5ebace46 100644 --- a/crates/turbopack/src/module_options/module_options_context.rs +++ b/crates/turbopack/src/module_options/module_options_context.rs @@ -159,13 +159,13 @@ impl Default for StyledComponentsTransformConfigVc { /// Configuration options for the custom ecma transform to be applied. #[turbo_tasks::value(shared)] #[derive(Default, Clone)] -pub struct CustomEcmaTransformPlugins { +pub struct CustomEcmascriptTransformPlugins { /// List of plugins to be applied before the main transform. /// Transform will be applied in the order of the list. - pub before: Vec, + pub source_transforms: Vec, /// List of plugins to be applied after the main transform. /// Transform will be applied in the order of the list. - pub after: Vec, + pub output_transforms: Vec, } #[turbo_tasks::value(shared)] @@ -206,7 +206,7 @@ pub struct ModuleOptionsContext { #[serde(default)] pub custom_ecmascript_transforms: Vec, #[serde(default)] - pub custom_ecma_transform_plugins: Option, + pub custom_ecma_transform_plugins: Option, #[serde(default)] /// Custom rules to be applied after all default rules. pub custom_rules: Vec, From 4a6b4032aa1f552c67574486aef3d187ba557415 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Tue, 2 May 2023 11:13:03 -0700 Subject: [PATCH 5/8] refactor(ecmaplugins): returns result --- .../src/transform/emotion.rs | 4 ++-- .../src/transform/relay.rs | 21 +++++++++---------- .../turbopack-ecmascript/src/transform/mod.rs | 11 ++++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs b/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs index 39ad705413780..be0e0b8038f22 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/emotion.rs @@ -98,7 +98,7 @@ impl CustomTransformer for EmotionTransformer { &self, program: &mut Program, ctx: &TransformContext<'_>, - ) -> Option { + ) -> Result> { #[cfg(feature = "transform_emotion")] { let p = std::mem::replace(program, Program::Module(Module::dummy())); @@ -117,7 +117,7 @@ impl CustomTransformer for EmotionTransformer { )); } - None + Ok(None) } } diff --git a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs index cf955b58fcff5..bb8211359452a 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs @@ -1,5 +1,6 @@ use std::path::PathBuf; +use anyhow::Result; use async_trait::async_trait; use swc_core::{ common::{util::take::Take, FileName}, @@ -28,16 +29,14 @@ impl CustomTransformer for RelayTransformer { &self, program: &mut Program, ctx: &TransformContext<'_>, - ) -> Option { - let root = if let Ok(file_path) = ctx.file_path.await { - file_path - .fs - .root() - .await - .map_or(PathBuf::new(), |v| PathBuf::from(v.path.to_string())) - } else { - PathBuf::new() - }; + ) -> Result> { + let root = ctx + .file_path + .await? + .fs + .root() + .await + .map_or(PathBuf::new(), |v| PathBuf::from(v.path.to_string())); let (root, config) = if self.config.artifact_directory.is_some() { (root, None) @@ -67,6 +66,6 @@ impl CustomTransformer for RelayTransformer { Some(ctx.unresolved_mark), )); - None + Ok(None) } } diff --git a/crates/turbopack-ecmascript/src/transform/mod.rs b/crates/turbopack-ecmascript/src/transform/mod.rs index 01ec583144c4e..aca096b2e0675 100644 --- a/crates/turbopack-ecmascript/src/transform/mod.rs +++ b/crates/turbopack-ecmascript/src/transform/mod.rs @@ -80,8 +80,11 @@ pub enum EcmascriptInputTransform { /// transformer to run over all ECMAScript files imported in the graph. #[async_trait] pub trait CustomTransformer: Debug { - async fn transform(&self, program: &mut Program, ctx: &TransformContext<'_>) - -> Option; + async fn transform( + &self, + program: &mut Program, + ctx: &TransformContext<'_>, + ) -> Result>; } /// A wrapper around a TransformPlugin instance, allowing it to operate with @@ -111,7 +114,7 @@ impl CustomTransformer for TransformPlugin { &self, program: &mut Program, ctx: &TransformContext<'_>, - ) -> Option { + ) -> Result> { self.0.transform(program, ctx).await } } @@ -340,7 +343,7 @@ impl EcmascriptInputTransform { } } EcmascriptInputTransform::Plugin(transform) => { - if let Some(output) = transform.await?.transform(program, ctx).await { + if let Some(output) = transform.await?.transform(program, ctx).await? { *program = output; } } From 829eb8caeb25bf33bc1ef9ee86d0c5345adefb22 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Mon, 1 May 2023 08:53:59 -0700 Subject: [PATCH 6/8] build(cargo): update lockfile --- Cargo.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d63c8872a01c3..0e947af7852da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8873,8 +8873,10 @@ dependencies = [ "serde", "swc_core", "swc_emotion", + "swc_relay", "turbo-tasks", "turbo-tasks-build", + "turbo-tasks-fs", "turbopack-ecmascript", ] From 2d430e9bc8eeed0f18f3f3f08557dcb09c159980 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Wed, 3 May 2023 09:57:56 -0700 Subject: [PATCH 7/8] refactor(relay): simplify artifactory_directory --- .../src/transform/relay.rs | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs index bb8211359452a..0d108503f4e8f 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs @@ -9,7 +9,6 @@ use swc_core::{ visit::FoldWith, }, }; -use turbo_tasks_fs::FileSystem; use turbopack_ecmascript::{CustomTransformer, TransformContext}; #[derive(Debug)] @@ -30,29 +29,16 @@ impl CustomTransformer for RelayTransformer { program: &mut Program, ctx: &TransformContext<'_>, ) -> Result> { - let root = ctx - .file_path - .await? - .fs - .root() - .await - .map_or(PathBuf::new(), |v| PathBuf::from(v.path.to_string())); - + // If user supplied artifactory_directory, it should be resolvable already. + // Otherwise, supply default relative path (./__generated__) let (root, config) = if self.config.artifact_directory.is_some() { - (root, None) + (PathBuf::new(), None) } else { let config = swc_relay::Config { artifact_directory: Some(PathBuf::from("__generated__")), ..self.config }; - ( - if root.as_os_str().is_empty() { - PathBuf::from(".") - } else { - root - }, - Some(config), - ) + (PathBuf::from("."), Some(config)) }; let p = std::mem::replace(program, Program::Module(Module::dummy())); From 8694ac8f16be424d86ced94162745958a0ebe790 Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Mon, 8 May 2023 21:20:48 -0700 Subject: [PATCH 8/8] refactor(module_options): minor style --- crates/turbopack-ecmascript-plugins/src/transform/relay.rs | 2 +- crates/turbopack/src/module_options/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs index 0d108503f4e8f..4e13c7537f0c2 100644 --- a/crates/turbopack-ecmascript-plugins/src/transform/relay.rs +++ b/crates/turbopack-ecmascript-plugins/src/transform/relay.rs @@ -29,7 +29,7 @@ impl CustomTransformer for RelayTransformer { program: &mut Program, ctx: &TransformContext<'_>, ) -> Result> { - // If user supplied artifactory_directory, it should be resolvable already. + // If user supplied artifact_directory, it should be resolvable already. // Otherwise, supply default relative path (./__generated__) let (root, config) = if self.config.artifact_directory.is_some() { (PathBuf::new(), None) diff --git a/crates/turbopack/src/module_options/mod.rs b/crates/turbopack/src/module_options/mod.rs index fa6dfc9c592e0..9876d5659ba6e 100644 --- a/crates/turbopack/src/module_options/mod.rs +++ b/crates/turbopack/src/module_options/mod.rs @@ -103,7 +103,7 @@ impl ModuleOptionsVc { .source_transforms .iter() .cloned() - .map(|plugin| EcmascriptInputTransform::Plugin(plugin)) + .map(EcmascriptInputTransform::Plugin) .collect(), transform_plugins .output_transforms