From d19d26ff05ad8f4a9bd6185cdf9c67dc1faa077b Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Wed, 4 Dec 2024 06:59:21 +0100 Subject: [PATCH] Prevent accidentally re-creating ResolvedVc via deref by using a deprecated fn (#73428) --- crates/next-api/src/app.rs | 4 ++-- crates/next-api/src/dynamic_imports.rs | 4 ++-- crates/next-api/src/nft_json.rs | 4 ++-- crates/next-api/src/versioned_content_map.rs | 3 +-- crates/next-core/src/app_structure.rs | 13 ++++------ .../next_app/app_client_references_chunks.rs | 4 +--- .../visit_client_reference.rs | 12 +++++----- .../src/next_dynamic/visit_dynamic.rs | 10 +++----- .../crates/turbo-tasks/src/vc/resolved.rs | 11 +++++++++ .../src/ecmascript/update.rs | 8 ++----- .../turbopack-core/src/chunk/chunk_group.rs | 8 +------ .../crates/turbopack-core/src/chunk/mod.rs | 6 ++--- .../turbopack-core/src/reference/mod.rs | 7 +++--- .../crates/turbopack-core/src/resolve/mod.rs | 20 +++++----------- .../turbopack-core/src/resolve/options.rs | 4 +--- .../crates/turbopack-css/src/chunk/mod.rs | 6 ++--- .../src/source/asset_graph.rs | 1 - .../crates/turbopack-ecmascript/src/lib.rs | 10 ++------ .../src/references/esm/export.rs | 2 +- .../src/references/mod.rs | 24 +++++++------------ turbopack/crates/turbopack-node/src/lib.rs | 4 ++-- .../src/render/rendered_source.rs | 4 +--- .../turbopack-node/src/transforms/webpack.rs | 7 +----- .../crates/turbopack-resolve/src/resolve.rs | 5 +--- .../turbopack/src/module_options/mod.rs | 4 +--- 25 files changed, 67 insertions(+), 118 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index 9431fdd3df448..b69160be11e43 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -1155,7 +1155,7 @@ impl AppEndpoint { ) .await?; server_assets.insert(server_action_manifest.manifest); - Some(server_action_manifest.loader.to_resolved().await?) + Some(server_action_manifest.loader) } else { None }; @@ -1340,7 +1340,7 @@ impl AppEndpoint { } AppEndpointOutput::Edge { - files: app_entry_chunks.to_resolved().await?, + files: *app_entry_chunks, server_assets: ResolvedVc::cell( server_assets.iter().cloned().collect::>(), ), diff --git a/crates/next-api/src/dynamic_imports.rs b/crates/next-api/src/dynamic_imports.rs index 6ab818b18b895..286896702b3de 100644 --- a/crates/next-api/src/dynamic_imports.rs +++ b/crates/next-api/src/dynamic_imports.rs @@ -236,7 +236,7 @@ async fn get_next_dynamic_edges( .iter() .map(|&referenced_module| async move { Ok(NextDynamicVisitEntry::Module( - referenced_module.to_resolved().await?, + referenced_module, referenced_module.ident().to_string().await?, )) }) @@ -247,7 +247,7 @@ async fn get_next_dynamic_edges( if let Some(dynamic_imports_map) = *dynamic_imports_map.await? { edges.reserve_exact(1); edges.push(NextDynamicVisitEntry::DynamicImportsMap( - dynamic_imports_map.to_resolved().await?, + dynamic_imports_map, )); } Ok(Vc::cell(edges)) diff --git a/crates/next-api/src/nft_json.rs b/crates/next-api/src/nft_json.rs index 980a23743119c..ef0066fdef0cc 100644 --- a/crates/next-api/src/nft_json.rs +++ b/crates/next-api/src/nft_json.rs @@ -168,7 +168,7 @@ impl Asset for NftJsonAsset { let this = &*self.await?; let mut result = BTreeSet::new(); - let chunk = this.chunk.to_resolved().await?; + let chunk = this.chunk; let entries = this .additional_assets .iter() @@ -180,7 +180,7 @@ impl Asset for NftJsonAsset { continue; } - if chunk == referenced_chunk.to_resolved().await? { + if chunk.eq(referenced_chunk) { continue; } diff --git a/crates/next-api/src/versioned_content_map.rs b/crates/next-api/src/versioned_content_map.rs index 8c84260e17e46..c0734c413457c 100644 --- a/crates/next-api/src/versioned_content_map.rs +++ b/crates/next-api/src/versioned_content_map.rs @@ -171,8 +171,7 @@ impl VersionedContentMap { }; if let Some(generate_source_map) = - Vc::try_resolve_sidecast::>(*asset.to_resolved().await?) - .await? + ResolvedVc::try_sidecast::>(*asset).await? { Ok(if let Some(section) = section { generate_source_map.by_section(section) diff --git a/crates/next-core/src/app_structure.rs b/crates/next-core/src/app_structure.rs index a51b4864eb751..5a575480f02b3 100644 --- a/crates/next-core/src/app_structure.rs +++ b/crates/next-core/src/app_structure.rs @@ -1145,7 +1145,7 @@ async fn directory_tree_to_entrypoints_internal_untraced( // Pass down layouts from each tree to apply segment config when adding route. let root_layouts = if let Some(layout) = modules.layout { let mut layouts = root_layouts.await?.clone_value(); - layouts.push(layout.to_resolved().await?); + layouts.push(layout); ResolvedVc::cell(layouts) } else { root_layouts @@ -1168,10 +1168,7 @@ async fn directory_tree_to_entrypoints_internal_untraced( app_dir, &mut result, app_page.complete(PageType::Page)?, - loader_tree - .context("loader tree should be created for a page/default")? - .to_resolved() - .await?, + loader_tree.context("loader tree should be created for a page/default")?, ); } @@ -1180,7 +1177,7 @@ async fn directory_tree_to_entrypoints_internal_untraced( app_dir, &mut result, app_page.complete(PageType::Route)?, - route.to_resolved().await?, + route, root_layouts, ); } @@ -1352,9 +1349,7 @@ async fn directory_tree_to_entrypoints_internal_untraced( &mut result, page.clone(), loader_tree - .context("loader tree should be created for a page/default")? - .to_resolved() - .await?, + .context("loader tree should be created for a page/default")?, ); } } diff --git a/crates/next-core/src/next_app/app_client_references_chunks.rs b/crates/next-core/src/next_app/app_client_references_chunks.rs index fe59cd980f0b0..c360a7d7d9644 100644 --- a/crates/next-core/src/next_app/app_client_references_chunks.rs +++ b/crates/next-core/src/next_app/app_client_references_chunks.rs @@ -142,7 +142,6 @@ pub async fn get_app_client_references_chunks( } for client_reference in app_client_references.client_references.iter() { if let Some(server_component) = client_reference.server_component() { - let server_component = server_component.to_resolved().await?; client_references_by_server_component .entry(server_component) .or_default() @@ -268,8 +267,7 @@ pub async fn get_app_client_references_chunks( current_client_chunks = client_chunks; } - layout_segment_client_chunks - .insert(server_component.to_resolved().await?, client_chunks); + layout_segment_client_chunks.insert(server_component, client_chunks); for &client_reference_ty in client_reference_types.iter() { if let ClientReferenceType::EcmascriptClientReference { .. } = diff --git a/crates/next-core/src/next_client_reference/visit_client_reference.rs b/crates/next-core/src/next_client_reference/visit_client_reference.rs index 437ee30db1780..611d51fe2606b 100644 --- a/crates/next-core/src/next_client_reference/visit_client_reference.rs +++ b/crates/next-core/src/next_client_reference/visit_client_reference.rs @@ -354,9 +354,9 @@ impl Visit for VisitClientReference { let referenced_modules = primary_referenced_modules(*parent_module).await?; let referenced_modules = referenced_modules.iter().map(|module| async move { - let module = module.to_resolved().await?; if let Some(client_reference_module) = - ResolvedVc::try_downcast_type::(module).await? + ResolvedVc::try_downcast_type::(*module) + .await? { return Ok(VisitClientReferenceNode { state: node.state, @@ -385,7 +385,7 @@ impl Visit for VisitClientReference { } if let Some(css_client_reference_asset) = - ResolvedVc::try_downcast_type::(module).await? + ResolvedVc::try_downcast_type::(*module).await? { return Ok(VisitClientReferenceNode { state: node.state, @@ -407,7 +407,7 @@ impl Visit for VisitClientReference { } if let Some(server_component_asset) = - ResolvedVc::try_downcast_type::(module).await? + ResolvedVc::try_downcast_type::(*module).await? { return Ok(VisitClientReferenceNode { state: VisitClientReferenceNodeState::InServerComponent { @@ -425,7 +425,7 @@ impl Visit for VisitClientReference { return Ok(VisitClientReferenceNode { state: VisitClientReferenceNodeState::InServerUtil, ty: VisitClientReferenceNodeType::ServerUtilEntry( - module, + *module, module.ident().to_string().await?, ), }); @@ -435,7 +435,7 @@ impl Visit for VisitClientReference { Ok(VisitClientReferenceNode { state: node.state, ty: VisitClientReferenceNodeType::Internal( - module, + *module, module.ident().to_string().await?, ), }) diff --git a/crates/next-core/src/next_dynamic/visit_dynamic.rs b/crates/next-core/src/next_dynamic/visit_dynamic.rs index 58def41168518..0187a102bb5d9 100644 --- a/crates/next-core/src/next_dynamic/visit_dynamic.rs +++ b/crates/next-core/src/next_dynamic/visit_dynamic.rs @@ -30,10 +30,7 @@ impl NextDynamicEntries { .iter() .copied() .map(|m| async move { - Ok(VisitDynamicNode::Internal( - m.to_resolved().await?, - m.ident().to_string().await?, - )) + Ok(VisitDynamicNode::Internal(m, m.ident().to_string().await?)) }) .try_join() .await?, @@ -96,9 +93,8 @@ impl Visit for VisitDynamic { let referenced_modules = primary_referenced_modules(*module).await?; let referenced_modules = referenced_modules.iter().map(|module| async move { - let module = module.to_resolved().await?; if let Some(next_dynamic_module) = - ResolvedVc::try_downcast_type::(module).await? + ResolvedVc::try_downcast_type::(*module).await? { return Ok(VisitDynamicNode::Dynamic( next_dynamic_module, @@ -107,7 +103,7 @@ impl Visit for VisitDynamic { } Ok(VisitDynamicNode::Internal( - module, + *module, module.ident().to_string().await?, )) }); diff --git a/turbopack/crates/turbo-tasks/src/vc/resolved.rs b/turbopack/crates/turbo-tasks/src/vc/resolved.rs index 3bfb2bd2e8e32..169717c4b0b77 100644 --- a/turbopack/crates/turbo-tasks/src/vc/resolved.rs +++ b/turbopack/crates/turbo-tasks/src/vc/resolved.rs @@ -18,6 +18,7 @@ use std::{ time::Duration, }; +use anyhow::Result; use auto_hash_map::{AutoMap, AutoSet}; use indexmap::{IndexMap, IndexSet}; use serde::{Deserialize, Serialize}; @@ -40,6 +41,16 @@ where pub(crate) node: Vc, } +impl ResolvedVc { + /// This function exists to intercept calls to Vc::to_resolved through dereferencing + /// a ResolvedVc. Converting to Vc and re-resolving it puts unnecessary stress on + /// the turbo tasks engine. + #[deprecated(note = "No point in resolving a vc that is already resolved")] + pub async fn to_resolved(self) -> Result { + Ok(self) + } +} + impl Copy for ResolvedVc where T: ?Sized {} impl Clone for ResolvedVc diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/update.rs b/turbopack/crates/turbopack-browser/src/ecmascript/update.rs index fb92948275f64..b7350ca706631 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/update.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/update.rs @@ -40,8 +40,7 @@ pub(super) async fn update_ecmascript_chunk( for (id, from_hash) in &from.entries_hashes { if let Some(entry) = entries.get(id) { if *entry.hash.await? != *from_hash { - let resolved_code = entry.code.to_resolved().await?; - modified.insert(id.clone(), resolved_code); + modified.insert(id.clone(), entry.code); } } else { deleted.insert(id.clone(), *from_hash); @@ -51,10 +50,7 @@ pub(super) async fn update_ecmascript_chunk( // Remaining entries are added for (id, entry) in entries.iter() { if !from.entries_hashes.contains_key(id) { - added.insert( - id.clone(), - (*entry.hash.await?, entry.code.to_resolved().await?), - ); + added.insert(id.clone(), (*entry.hash.await?, entry.code)); } } diff --git a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs index 1ee2f5bfd24c3..4ccfb8c517e81 100644 --- a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs +++ b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs @@ -192,14 +192,8 @@ pub async fn make_chunk_group( chunks.extend(async_loader_chunks.iter().copied()); } - let resolved_chunks = chunks - .into_iter() - .map(|chunk| chunk.to_resolved()) - .try_join() - .await?; - Ok(MakeChunkGroupResult { - chunks: resolved_chunks, + chunks, availability_info, }) } diff --git a/turbopack/crates/turbopack-core/src/chunk/mod.rs b/turbopack/crates/turbopack-core/src/chunk/mod.rs index f52d9e8d463f2..a2b9ffb6c71c1 100644 --- a/turbopack/crates/turbopack-core/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-core/src/chunk/mod.rs @@ -424,7 +424,7 @@ async fn graph_node_to_referenced_nodes( .await?; Ok(( Some(ChunkGraphEdge { - key: Some(module.to_resolved().await?), + key: Some(module), node: ChunkContentGraphNode::ChunkItem { item: chunk_item, ident: module.ident().to_string().await?, @@ -440,7 +440,7 @@ async fn graph_node_to_referenced_nodes( .await?; Ok(( Some(ChunkGraphEdge { - key: Some(module.to_resolved().await?), + key: Some(module), node: ChunkContentGraphNode::ChunkItem { item: chunk_item, ident: module.ident().to_string().await?, @@ -478,7 +478,7 @@ async fn graph_node_to_referenced_nodes( .await?; Ok(( Some(ChunkGraphEdge { - key: Some(module.to_resolved().await?), + key: Some(module), node: ChunkContentGraphNode::ChunkItem { item: chunk_item, ident: module.ident().to_string().await?, diff --git a/turbopack/crates/turbopack-core/src/reference/mod.rs b/turbopack/crates/turbopack-core/src/reference/mod.rs index d703e1f9fdec7..3b5a8af54e07e 100644 --- a/turbopack/crates/turbopack-core/src/reference/mod.rs +++ b/turbopack/crates/turbopack-core/src/reference/mod.rs @@ -191,10 +191,9 @@ pub async fn referenced_modules_and_affecting_sources( .await?, ); } - let mut resolved_modules = FxIndexSet::default(); - for module in modules { - resolved_modules.insert(module.to_resolved().await?); - } + + let resolved_modules: FxIndexSet<_> = modules.into_iter().collect(); + Ok(Vc::cell(resolved_modules.into_iter().collect())) } diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 91988cd08364a..867b0bb7dae77 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -1190,7 +1190,7 @@ pub async fn find_context_file( for name in &*names.await? { let fs_path = lookup_path.join(name.clone()); if let Some(fs_path) = exists(fs_path, &mut refs).await? { - return Ok(FindContextFileResult::Found(fs_path.to_resolved().await?, refs).cell()); + return Ok(FindContextFileResult::Found(fs_path, refs).cell()); } } if lookup_path.await?.is_root() { @@ -1232,18 +1232,14 @@ pub async fn find_context_file_or_package_key( if let Some(package_json_path) = exists(package_json_path, &mut refs).await? { if let Some(json) = &*read_package_json(*package_json_path).await? { if json.get(&**package_key).is_some() { - return Ok(FindContextFileResult::Found( - package_json_path.to_resolved().await?, - refs, - ) - .into()); + return Ok(FindContextFileResult::Found(package_json_path, refs).into()); } } } for name in &*names.await? { let fs_path = lookup_path.join(name.clone()); if let Some(fs_path) = exists(fs_path, &mut refs).await? { - return Ok(FindContextFileResult::Found(fs_path.to_resolved().await?, refs).into()); + return Ok(FindContextFileResult::Found(fs_path, refs).into()); } } if lookup_path.await?.is_root() { @@ -1307,9 +1303,7 @@ async fn find_package( if let Some(fs_path) = dir_exists(fs_path, &mut affecting_sources).await? { - packages.push(FindPackageItem::PackageDirectory( - fs_path.to_resolved().await?, - )); + packages.push(FindPackageItem::PackageDirectory(fs_path)); } } } @@ -1351,9 +1345,7 @@ async fn find_package( let package_file = package_dir.append(extension.clone()); if let Some(package_file) = exists(package_file, &mut affecting_sources).await? { - packages.push(FindPackageItem::PackageFile( - package_file.to_resolved().await?, - )); + packages.push(FindPackageItem::PackageFile(package_file)); } } } @@ -2637,7 +2629,7 @@ async fn resolve_import_map_result( // We must avoid cycles during resolving if request.resolve().await? == original_request - && *alias_lookup_path.to_resolved().await? == original_lookup_path + && **alias_lookup_path == original_lookup_path { None } else { diff --git a/turbopack/crates/turbopack-core/src/resolve/options.rs b/turbopack/crates/turbopack-core/src/resolve/options.rs index 46294039790c6..95e29d6be9fac 100644 --- a/turbopack/crates/turbopack-core/src/resolve/options.rs +++ b/turbopack/crates/turbopack-core/src/resolve/options.rs @@ -204,9 +204,7 @@ impl AliasTemplate for Vc { .try_join() .await?, ), - ImportMapping::Dynamic(replacement) => { - ReplacedImportMapping::Dynamic(replacement.to_resolved().await?) - } + ImportMapping::Dynamic(replacement) => ReplacedImportMapping::Dynamic(*replacement), } .resolved_cell()) }) diff --git a/turbopack/crates/turbopack-css/src/chunk/mod.rs b/turbopack/crates/turbopack-css/src/chunk/mod.rs index ad10c4f6d77e7..62239429daea1 100644 --- a/turbopack/crates/turbopack-css/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-css/src/chunk/mod.rs @@ -204,7 +204,7 @@ impl OutputChunk for CssChunk { else { return Ok(vec![]); }; - css_item + Ok(css_item .content() .await? .imports @@ -216,9 +216,7 @@ impl OutputChunk for CssChunk { None } }) - .map(|v| async move { v.to_resolved().await }) - .try_join() - .await + .collect()) }) .try_join() .await? diff --git a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs index a032862795d0e..ba33f47bf2c0e 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs @@ -178,7 +178,6 @@ async fn expand( } } for (sub_path, asset) in assets { - let asset = asset.to_resolved().await?; if &*sub_path == "index.html" { map.insert("".into(), asset); } else if let Some(p) = sub_path.strip_suffix("/index.html") { diff --git a/turbopack/crates/turbopack-ecmascript/src/lib.rs b/turbopack/crates/turbopack-ecmascript/src/lib.rs index f74b1246e07f1..31685bb1b863c 100644 --- a/turbopack/crates/turbopack-ecmascript/src/lib.rs +++ b/turbopack/crates/turbopack-ecmascript/src/lib.rs @@ -763,14 +763,8 @@ impl EcmascriptModuleContent { let code_gens = code_gens.into_iter().try_join().await?; let code_gens = code_gens.iter().map(|cg| &**cg).collect::>(); - gen_content_with_code_gens( - parsed, - ident, - specified_module_type, - &code_gens, - source_map.to_resolved().await?, - ) - .await + gen_content_with_code_gens(parsed, ident, specified_module_type, &code_gens, source_map) + .await } /// Creates a new [`Vc`] without an analysis pass. diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs index 3d16389ab5508..a25dc38ca5b7e 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs @@ -174,7 +174,7 @@ pub async fn follow_reexports( if !exports_ref.star_exports.is_empty() && &*export_name != "default" { let result = get_all_export_names(*module).await?; if let Some(m) = result.esm_exports.get(&export_name) { - module = m.to_resolved().await?; + module = *m; continue; } return match &result.dynamic_exporting_modules[..] { diff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs index 083ac382e5e88..acdb759006e1d 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs @@ -285,34 +285,26 @@ impl AnalyzeEcmascriptModuleResultBuilder { self.add_code_gen(bindings); } - let mut references: Vec<_> = self.references.into_iter().collect(); - for r in references.iter_mut() { - *r = r.to_resolved().await?; - } - let mut local_references: Vec<_> = track_reexport_references + let references: Vec<_> = self.references.into_iter().collect(); + + let local_references: Vec<_> = track_reexport_references .then(|| self.local_references.into_iter()) .into_iter() .flatten() .collect(); - for r in local_references.iter_mut() { - *r = r.to_resolved().await?; - } - let mut reexport_references: Vec<_> = track_reexport_references + + let reexport_references: Vec<_> = track_reexport_references .then(|| self.reexport_references.into_iter()) .into_iter() .flatten() .collect(); - for r in reexport_references.iter_mut() { - *r = r.to_resolved().await?; - } - let mut evaluation_references: Vec<_> = track_reexport_references + + let evaluation_references: Vec<_> = track_reexport_references .then(|| self.evaluation_references.into_iter()) .into_iter() .flatten() .collect(); - for r in evaluation_references.iter_mut() { - *r = r.to_resolved().await?; - } + for c in self.code_gens.iter_mut() { match c { CodeGen::CodeGenerateable(c) => { diff --git a/turbopack/crates/turbopack-node/src/lib.rs b/turbopack/crates/turbopack-node/src/lib.rs index ece0e8e7d0242..693c726e6a9b4 100644 --- a/turbopack/crates/turbopack-node/src/lib.rs +++ b/turbopack/crates/turbopack-node/src/lib.rs @@ -156,9 +156,9 @@ async fn separate_assets( .await? .is_inside_ref(intermediate_output_path) { - Ok(Type::Internal(asset.to_resolved().await?)) + Ok(Type::Internal(*asset)) } else { - Ok(Type::External(asset.to_resolved().await?)) + Ok(Type::External(*asset)) } }) .try_join() diff --git a/turbopack/crates/turbopack-node/src/render/rendered_source.rs b/turbopack/crates/turbopack-node/src/render/rendered_source.rs index 8aaad3a3617dc..c61441fc27820 100644 --- a/turbopack/crates/turbopack-node/src/render/rendered_source.rs +++ b/turbopack/crates/turbopack-node/src/render/rendered_source.rs @@ -238,9 +238,7 @@ impl GetContentSourceContent for NodeRenderContentSource { .resolved_cell(), ) .cell(), - StaticResult::Rewrite(rewrite) => { - ContentSourceContent::Rewrite(rewrite.to_resolved().await?).cell() - } + StaticResult::Rewrite(rewrite) => ContentSourceContent::Rewrite(rewrite).cell(), }) } } diff --git a/turbopack/crates/turbopack-node/src/transforms/webpack.rs b/turbopack/crates/turbopack-node/src/transforms/webpack.rs index af9cfd965963e..5542e0d3a79b3 100644 --- a/turbopack/crates/turbopack-node/src/transforms/webpack.rs +++ b/turbopack/crates/turbopack-node/src/transforms/webpack.rs @@ -278,12 +278,7 @@ impl WebpackLoadersProcessedAsset { Either::Left(str) => File::from(str), Either::Right(bytes) => File::from(bytes.binary), }; - let assets = emitted_assets_to_virtual_sources(processed.assets) - .await? - .into_iter() - .map(|v| v.to_resolved()) - .try_join() - .await?; + let assets = emitted_assets_to_virtual_sources(processed.assets).await?; let content = AssetContent::File(FileContent::Content(file).resolved_cell()).resolved_cell(); diff --git a/turbopack/crates/turbopack-resolve/src/resolve.rs b/turbopack/crates/turbopack-resolve/src/resolve.rs index 4031bc18ff1f0..18e8d74f0eecd 100644 --- a/turbopack/crates/turbopack-resolve/src/resolve.rs +++ b/turbopack/crates/turbopack-resolve/src/resolve.rs @@ -230,10 +230,7 @@ async fn base_resolve_options( } else { let mut mods = Vec::new(); if let Some(dir) = opt.enable_node_modules { - mods.push(ResolveModules::Nested( - dir.to_resolved().await?, - vec!["node_modules".into()], - )); + mods.push(ResolveModules::Nested(dir, vec!["node_modules".into()])); } mods }, diff --git a/turbopack/crates/turbopack/src/module_options/mod.rs b/turbopack/crates/turbopack/src/module_options/mod.rs index 1a93ab113be40..f2296af03983b 100644 --- a/turbopack/crates/turbopack/src/module_options/mod.rs +++ b/turbopack/crates/turbopack/src/module_options/mod.rs @@ -138,9 +138,7 @@ impl ModuleOptions { let ecmascript_options_vc = ecmascript_options.resolved_cell(); if let Some(env) = preset_env_versions { - transforms.push(EcmascriptInputTransform::PresetEnv( - env.to_resolved().await?, - )); + transforms.push(EcmascriptInputTransform::PresetEnv(env)); } if let Some(enable_typeof_window_inlining) = enable_typeof_window_inlining {