diff --git a/turbopack/crates/turbopack-core/src/context.rs b/turbopack/crates/turbopack-core/src/context.rs index 4cd02648a0e13a..861d6df06196c6 100644 --- a/turbopack/crates/turbopack-core/src/context.rs +++ b/turbopack/crates/turbopack-core/src/context.rs @@ -12,13 +12,13 @@ use crate::{ source::Source, }; -#[turbo_tasks::value(shared, local)] +#[turbo_tasks::value(shared)] pub enum ProcessResult { /// A module was created. Module(ResolvedVc>), /// A module could not be created (according to the rules, e.g. no module type was assigned) - Unknown(Vc>), + Unknown(ResolvedVc>), /// Reference is ignored. This should lead to no module being included by /// the reference. @@ -46,7 +46,7 @@ impl ProcessResult { Ok(Vc::cell(match self { ProcessResult::Module(module) => Some(*module), ProcessResult::Unknown(source) => { - emit_unknown_module_type_error(*source).await?; + emit_unknown_module_type_error(**source).await?; None } ProcessResult::Ignore => None, diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 5feadc94212d50..535a6aa566390d 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -64,7 +64,7 @@ pub use remap::{ResolveAliasMap, SubpathValue}; use crate::{error::PrettyPrintError, issue::IssueSeverity}; -#[turbo_tasks::value(shared, local)] +#[turbo_tasks::value(shared)] #[derive(Clone, Debug)] pub enum ModuleResolveResultItem { Module(ResolvedVc>), @@ -76,7 +76,7 @@ pub enum ModuleResolveResultItem { traced: Option>, }, /// A module could not be created (according to the rules, e.g. no module type as assigned) - Unknown(Vc>), + Unknown(ResolvedVc>), Ignore, Error(ResolvedVc), Empty, @@ -88,7 +88,7 @@ impl ModuleResolveResultItem { Ok(match *self { ModuleResolveResultItem::Module(module) => Some(module), ModuleResolveResultItem::Unknown(source) => { - emit_unknown_module_type_error(source).await?; + emit_unknown_module_type_error(*source).await?; None } ModuleResolveResultItem::Error(_err) => { diff --git a/turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs b/turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs index 30b63a52df2008..1cb990c7f28827 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs @@ -310,7 +310,7 @@ async fn to_single_pattern_mapping( } ModuleResolveResultItem::Ignore => return Ok(SinglePatternMapping::Ignored), ModuleResolveResultItem::Unknown(source) => { - emit_unknown_module_type_error(*source).await?; + emit_unknown_module_type_error(**source).await?; return Ok(SinglePatternMapping::Unresolvable( "unknown module type".to_string(), )); diff --git a/turbopack/crates/turbopack/src/lib.rs b/turbopack/crates/turbopack/src/lib.rs index 92ba35f39c3a9b..e90046a7d56051 100644 --- a/turbopack/crates/turbopack/src/lib.rs +++ b/turbopack/crates/turbopack/src/lib.rs @@ -469,7 +469,7 @@ impl ModuleAssetContext { #[turbo_tasks::function] async fn process_default( module_asset_context: Vc, - source: Vc>, + source: ResolvedVc>, reference_type: Value, processed_rules: Vec, ) -> Result> { @@ -490,7 +490,7 @@ async fn process_default( async fn process_default_internal( module_asset_context: Vc, - source: Vc>, + source: ResolvedVc>, reference_type: Value, processed_rules: Vec, ) -> Result> { @@ -535,22 +535,23 @@ async fn process_default_internal( if processed_rules.contains(&i) { continue; } - if rule.matches(source, &path_ref, &reference_type).await? { + if rule.matches(*source, &path_ref, &reference_type).await? { for effect in rule.effects() { match effect { ModuleRuleEffect::SourceTransforms(transforms) => { - current_source = transforms.transform(current_source); + current_source = + transforms.transform(*current_source).to_resolved().await?; if current_source.ident().resolve().await? != ident { // The ident has been changed, so we need to apply new rules. if let Some(transition) = module_asset_context .await? .transitions .await? - .get_by_rules(current_source, &reference_type) + .get_by_rules(*current_source, &reference_type) .await? { return Ok(transition.process( - current_source, + *current_source, module_asset_context, Value::new(reference_type), )); @@ -559,7 +560,7 @@ async fn process_default_internal( processed_rules.push(i); return Ok(process_default( module_asset_context, - current_source, + *current_source, Value::new(reference_type), processed_rules, )); @@ -641,7 +642,7 @@ async fn process_default_internal( }; Ok(apply_module_type( - current_source, + *current_source, module_asset_context, module_type.cell(), Value::new(reference_type.clone()),