diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs index 6d9da153bac29..e71704a2b9cff 100644 --- a/crates/next-api/src/project.rs +++ b/crates/next-api/src/project.rs @@ -989,7 +989,7 @@ impl Project { let FindContextFileResult::Found(fs_path, _) = *middleware.await? else { return Ok(Vc::upcast(EmptyEndpoint::new())); }; - let source = Vc::upcast(FileSource::new(fs_path)); + let source = Vc::upcast(FileSource::new(*fs_path)); let app_dir = *find_app_dir(self.project_path()).await?; let ecmascript_client_reference_transition_name = (*self.app_project().await?) .as_ref() @@ -1123,7 +1123,7 @@ impl Project { let FindContextFileResult::Found(fs_path, _) = *instrumentation.await? else { return Ok(Vc::upcast(EmptyEndpoint::new())); }; - let source = Vc::upcast(FileSource::new(fs_path)); + let source = Vc::upcast(FileSource::new(*fs_path)); let app_dir = *find_app_dir(self.project_path()).await?; let ecmascript_client_reference_transition_name = (*self.app_project().await?) .as_ref() diff --git a/crates/next-api/src/versioned_content_map.rs b/crates/next-api/src/versioned_content_map.rs index 7c2d30dc0c3dc..710285831b48a 100644 --- a/crates/next-api/src/versioned_content_map.rs +++ b/crates/next-api/src/versioned_content_map.rs @@ -172,7 +172,8 @@ impl VersionedContentMap { }; if let Some(generate_source_map) = - Vc::try_resolve_sidecast::>(*asset).await? + Vc::try_resolve_sidecast::>(*asset.to_resolved().await?) + .await? { Ok(if let Some(section) = section { generate_source_map.by_section(section) @@ -200,7 +201,7 @@ impl VersionedContentMap { side_effects.await?; if let Some(asset) = path_to_asset.get(&path) { - return Ok(Vc::cell(Some(*asset))); + return Ok(Vc::cell(Some(asset.to_resolved().await?))); } else { let path = path.to_string().await?; bail!( diff --git a/crates/next-core/src/transform_options.rs b/crates/next-core/src/transform_options.rs index 5e912862c1346..71b845b9f3007 100644 --- a/crates/next-core/src/transform_options.rs +++ b/crates/next-core/src/transform_options.rs @@ -25,7 +25,7 @@ async fn get_typescript_options( FindContextFileResult::Found(path, _) => Some( read_tsconfigs( path.read(), - Vc::upcast(FileSource::new(path)), + Vc::upcast(FileSource::new(*path)), node_cjs_resolve_options(path.root()), ) .await diff --git a/turbopack/crates/turbo-tasks-testing/tests/all_in_one.rs b/turbopack/crates/turbo-tasks-testing/tests/all_in_one.rs index a5c50d36b669b..9e905fb247cae 100644 --- a/turbopack/crates/turbo-tasks-testing/tests/all_in_one.rs +++ b/turbopack/crates/turbo-tasks-testing/tests/all_in_one.rs @@ -17,7 +17,7 @@ async fn all_in_one() { let a: Vc = Vc::cell(4242); assert_eq!(*a.await?, 4242); - let b = MyEnumValue::cell(MyEnumValue::More(MyEnumValue::Yeah(42).into())); + let b = MyEnumValue::cell(MyEnumValue::More(MyEnumValue::Yeah(42).resolved_cell())); assert_eq!(*b.to_string().await?, "42"); let c = MyStructValue { @@ -71,7 +71,7 @@ struct MyTransparentValue(u32); enum MyEnumValue { Yeah(u32), Nah, - More(Vc), + More(ResolvedVc), } #[turbo_tasks::value_impl] @@ -80,7 +80,7 @@ impl MyEnumValue { pub async fn get_last(self: Vc) -> Result> { let mut current = self; while let MyEnumValue::More(more) = &*current.await? { - current = *more; + current = **more; } Ok(current) } diff --git a/turbopack/crates/turbo-tasks-testing/tests/debug.rs b/turbopack/crates/turbo-tasks-testing/tests/debug.rs index fc44f7c56e8c3..f8a931fbaf17c 100644 --- a/turbopack/crates/turbo-tasks-testing/tests/debug.rs +++ b/turbopack/crates/turbo-tasks-testing/tests/debug.rs @@ -47,7 +47,7 @@ async fn enum_none_debug() { #[tokio::test] async fn enum_transparent_debug() { run(®ISTRATION, || async { - let a: Vc = Enum::Transparent(Transparent(42).cell()).cell(); + let a: Vc = Enum::Transparent(Transparent(42).resolved_cell()).cell(); assert_eq!( format!("{:?}", a.dbg().await?), r#"Enum :: Transparent( @@ -63,7 +63,7 @@ async fn enum_transparent_debug() { #[tokio::test] async fn enum_inner_vc_debug() { run(®ISTRATION, || async { - let a: Vc = Enum::Enum(Enum::None.cell()).cell(); + let a: Vc = Enum::Enum(Enum::None.resolved_cell()).cell(); assert_eq!( format!("{:?}", a.dbg().await?), r#"Enum :: Enum( @@ -118,7 +118,7 @@ async fn struct_vec_debug() { ); let b: Vc = StructWithVec { - vec: vec![Transparent(42).cell()], + vec: vec![Transparent(42).resolved_cell()], } .cell(); assert_eq!( @@ -163,8 +163,8 @@ struct Transparent(u32); #[turbo_tasks::value(shared)] enum Enum { None, - Transparent(Vc), - Enum(Vc), + Transparent(ResolvedVc), + Enum(ResolvedVc), } #[turbo_tasks::value(shared)] @@ -182,7 +182,7 @@ struct StructWithOption { #[turbo_tasks::value(shared)] struct StructWithVec { - vec: Vec>, + vec: Vec>, } #[turbo_tasks::value(shared, eq = "manual")] diff --git a/turbopack/crates/turbopack-browser/src/ecmascript/chunk.rs b/turbopack/crates/turbopack-browser/src/ecmascript/chunk.rs index c391f3a97fe8d..3a31e1744164e 100644 --- a/turbopack/crates/turbopack-browser/src/ecmascript/chunk.rs +++ b/turbopack/crates/turbopack-browser/src/ecmascript/chunk.rs @@ -47,12 +47,12 @@ impl ValueToString for EcmascriptDevChunk { #[turbo_tasks::value_impl] impl OutputChunk for EcmascriptDevChunk { #[turbo_tasks::function] - fn runtime_info(&self) -> Vc { - OutputChunkRuntimeInfo { - included_ids: Some(self.chunk.entry_ids()), + async fn runtime_info(&self) -> Result> { + Ok(OutputChunkRuntimeInfo { + included_ids: Some(self.chunk.entry_ids().to_resolved().await?), ..Default::default() } - .cell() + .cell()) } } diff --git a/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs b/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs index ae243b5d4aeaa..6bee158c7413f 100644 --- a/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs +++ b/turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs @@ -14,7 +14,7 @@ use turbopack_resolve::ecmascript::cjs_resolve; pub enum RuntimeEntry { Request(ResolvedVc, ResolvedVc), Evaluatable(ResolvedVc>), - Source(Vc>), + Source(ResolvedVc>), } #[turbo_tasks::value_impl] diff --git a/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs b/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs index d0f0c401b80db..3abb722c8c950 100644 --- a/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs +++ b/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs @@ -76,9 +76,11 @@ pub async fn get_client_runtime_entries( }; runtime_entries.push( - RuntimeEntry::Source(Vc::upcast(FileSource::new(embed_file_path( - "entry/bootstrap.ts".into(), - )))) + RuntimeEntry::Source(ResolvedVc::upcast( + FileSource::new(embed_file_path("entry/bootstrap.ts".into())) + .to_resolved() + .await?, + )) .cell(), ); diff --git a/turbopack/crates/turbopack-core/src/chunk/mod.rs b/turbopack/crates/turbopack-core/src/chunk/mod.rs index 93f444cde3adc..1daf8422e0e06 100644 --- a/turbopack/crates/turbopack-core/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-core/src/chunk/mod.rs @@ -136,12 +136,12 @@ pub trait Chunk: Asset { #[turbo_tasks::value(shared)] #[derive(Default)] pub struct OutputChunkRuntimeInfo { - pub included_ids: Option>, + pub included_ids: Option>, pub excluded_ids: Option>, /// List of paths of chunks containing individual modules that are part of /// this chunk. This is useful for selectively loading modules from a chunk /// without loading the whole chunk. - pub module_chunks: Option>, + pub module_chunks: Option>, pub placeholder_for_future_extensions: (), } @@ -251,8 +251,8 @@ enum ChunkContentGraphNode { #[derive(Debug, Clone, Copy, TaskInput, PartialEq, Eq, Hash, Serialize, Deserialize)] enum ChunkGraphNodeToReferences { - PassthroughChunkItem(Vc>), - ChunkItem(Vc>), + PassthroughChunkItem(ResolvedVc>), + ChunkItem(ResolvedVc>), } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TraceRawVcs)] @@ -483,7 +483,7 @@ async fn graph_node_to_referenced_nodes( graph_nodes.push(ChunkGraphEdge { key: None, node: ChunkContentGraphNode::InheritAsyncInfo { - item: parent, + item: *parent, references: inherit_async_references, }, }) @@ -540,10 +540,10 @@ impl Visit for ChunkContentVisit { async move { let node = match node { ChunkContentGraphNode::PassthroughChunkItem { item } => { - ChunkGraphNodeToReferences::PassthroughChunkItem(item) + ChunkGraphNodeToReferences::PassthroughChunkItem(item.to_resolved().await?) } ChunkContentGraphNode::ChunkItem { item, .. } => { - ChunkGraphNodeToReferences::ChunkItem(item) + ChunkGraphNodeToReferences::ChunkItem(item.to_resolved().await?) } _ => { return Ok(None.into_iter().flatten()); diff --git a/turbopack/crates/turbopack-core/src/compile_time_info.rs b/turbopack/crates/turbopack-core/src/compile_time_info.rs index 90f4305983ea5..f6d7a605aeb88 100644 --- a/turbopack/crates/turbopack-core/src/compile_time_info.rs +++ b/turbopack/crates/turbopack-core/src/compile_time_info.rs @@ -168,7 +168,7 @@ pub struct CompileTimeDefines(pub FxIndexMap, Compile #[turbo_tasks::value(transparent)] #[derive(Debug, Clone)] pub struct CompileTimeDefinesIndividual( - pub FxIndexMap, Vc>, + pub FxIndexMap, ResolvedVc>, ); impl IntoIterator for CompileTimeDefines { @@ -192,7 +192,7 @@ impl CompileTimeDefines { Vc::cell( self.0 .iter() - .map(|(key, value)| (key.clone(), value.clone().cell())) + .map(|(key, value)| (key.clone(), value.clone().resolved_cell())) .collect(), ) } @@ -241,7 +241,7 @@ pub struct FreeVarReferences(pub FxIndexMap, FreeVarR #[turbo_tasks::value(transparent)] #[derive(Debug, Clone)] pub struct FreeVarReferencesIndividual( - pub FxIndexMap, Vc>, + pub FxIndexMap, ResolvedVc>, ); #[turbo_tasks::value_impl] @@ -256,7 +256,7 @@ impl FreeVarReferences { Vc::cell( self.0 .iter() - .map(|(key, value)| (key.clone(), value.clone().cell())) + .map(|(key, value)| (key.clone(), value.clone().resolved_cell())) .collect(), ) } diff --git a/turbopack/crates/turbopack-core/src/output.rs b/turbopack/crates/turbopack-core/src/output.rs index 237e8fd5da995..cdca37bb523eb 100644 --- a/turbopack/crates/turbopack-core/src/output.rs +++ b/turbopack/crates/turbopack-core/src/output.rs @@ -1,10 +1,10 @@ use anyhow::Result; -use turbo_tasks::{FxIndexSet, Vc}; +use turbo_tasks::{FxIndexSet, ResolvedVc, Vc}; use crate::{asset::Asset, ident::AssetIdent}; #[turbo_tasks::value(transparent)] -pub struct OptionOutputAsset(Option>>); +pub struct OptionOutputAsset(Option>>); /// An asset that should be outputted, e. g. written to disk or served from a /// server. diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index c6d855105c4ad..48cd30d40cc0b 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -1084,7 +1084,7 @@ async fn imports_field(lookup_path: Vc) -> Result json, None => return Ok(ImportsFieldResult::None.cell()), @@ -1094,10 +1094,10 @@ async fn imports_field(lookup_path: Vc) -> Result Ok(ImportsFieldResult::Some(imports, *package_json_path).cell()), + Ok(imports) => Ok(ImportsFieldResult::Some(imports, **package_json_path).cell()), Err(err) => { PackageJsonIssue { - path: *package_json_path, + path: **package_json_path, error_message: err.to_string().into(), } .cell() @@ -1114,7 +1114,7 @@ pub fn package_json() -> Vc> { #[turbo_tasks::value(shared)] pub enum FindContextFileResult { - Found(Vc, Vec>>), + Found(ResolvedVc, Vec>>), NotFound(Vec>>), } @@ -1127,7 +1127,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, refs).into()); + return Ok(FindContextFileResult::Found(fs_path.to_resolved().await?, refs).into()); } } if lookup_path.await?.is_root() { @@ -1167,14 +1167,18 @@ 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, refs).into()); + return Ok(FindContextFileResult::Found( + package_json_path.to_resolved().await?, + 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, refs).into()); + return Ok(FindContextFileResult::Found(fs_path.to_resolved().await?, refs).into()); } } if lookup_path.await?.is_root() { @@ -2188,7 +2192,7 @@ async fn apply_in_package( continue; }; - let read = read_package_json(*package_json_path).await?; + let read = read_package_json(**package_json_path).await?; let Some(package_json) = &*read else { continue; }; @@ -2248,7 +2252,7 @@ async fn apply_in_package( ResolvingIssue { severity: error_severity(options).await?, - file_path: *package_json_path, + file_path: **package_json_path, request_type: format!("alias field ({field})"), request: Request::parse(Value::new(Pattern::Constant(request))), resolve_options: options, @@ -2282,7 +2286,7 @@ async fn find_self_reference( ) -> Result> { let package_json_context = find_context_file(lookup_path, package_json()).await?; if let FindContextFileResult::Found(package_json_path, _refs) = &*package_json_context { - let read = read_package_json(*package_json_path).await?; + let read = read_package_json(**package_json_path).await?; if let Some(json) = &*read { if json.get("exports").is_some() { if let Some(name) = json["name"].as_str() { diff --git a/turbopack/crates/turbopack-css/src/chunk/mod.rs b/turbopack/crates/turbopack-css/src/chunk/mod.rs index 5087e77d5f56e..99ae02b729856 100644 --- a/turbopack/crates/turbopack-css/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-css/src/chunk/mod.rs @@ -214,8 +214,8 @@ impl OutputChunk for CssChunk { .map(|item| Vc::upcast(SingleItemCssChunk::new(self.chunking_context, *item))) .collect(); Ok(OutputChunkRuntimeInfo { - included_ids: Some(Vc::cell(included_ids)), - module_chunks: Some(Vc::cell(module_chunks)), + included_ids: Some(ResolvedVc::cell(included_ids)), + module_chunks: Some(ResolvedVc::cell(module_chunks)), ..Default::default() } .cell()) diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs index 8d33649349e30..281866a3c0672 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs @@ -170,7 +170,7 @@ pub async fn is_marked_as_side_effect_free( let find_package_json = find_context_file(path.parent(), package_json()).await?; if let FindContextFileResult::Found(package_json, _) = *find_package_json { - match *side_effects_from_package_json(package_json).await? { + match *side_effects_from_package_json(*package_json).await? { SideEffectsValue::None => {} SideEffectsValue::Constant(side_effects) => return Ok(Vc::cell(!side_effects)), SideEffectsValue::Glob(glob) => { diff --git a/turbopack/crates/turbopack-ecmascript/src/lib.rs b/turbopack/crates/turbopack-ecmascript/src/lib.rs index 5889ad665643e..d17a376706aa2 100644 --- a/turbopack/crates/turbopack-ecmascript/src/lib.rs +++ b/turbopack/crates/turbopack-ecmascript/src/lib.rs @@ -504,14 +504,14 @@ impl EcmascriptModuleAsset { Some("commonjs") => SpecifiedModuleType::CommonJs, _ => SpecifiedModuleType::Automatic, }, - package_json, + *package_json, )); } } Ok(ModuleTypeResult::new_with_package_json( SpecifiedModuleType::Automatic, - package_json, + *package_json, )) } } diff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs index 7c8ceeae06176..9dd4100eb6f17 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs @@ -466,7 +466,7 @@ pub(crate) async fn analyse_ecmascript_module_internal( if analyze_types { match &*find_context_file(path.parent(), tsconfig()).await? { FindContextFileResult::Found(tsconfig, _) => { - analysis.add_reference(TsConfigReference::new(origin, *tsconfig)); + analysis.add_reference(TsConfigReference::new(origin, **tsconfig)); } FindContextFileResult::NotFound(_) => {} }; diff --git a/turbopack/crates/turbopack-node/src/transforms/postcss.rs b/turbopack/crates/turbopack-node/src/transforms/postcss.rs index 113bcc934f3cb..ada73e4fa6bd2 100644 --- a/turbopack/crates/turbopack-node/src/transforms/postcss.rs +++ b/turbopack/crates/turbopack-node/src/transforms/postcss.rs @@ -391,7 +391,7 @@ async fn find_config_in_location( ) .await? { - return Ok(Some(config_path)); + return Ok(Some(*config_path)); } if matches!(location, PostCssConfigLocation::ProjectPathOrLocalPath) { @@ -402,7 +402,7 @@ async fn find_config_in_location( ) .await? { - return Ok(Some(config_path)); + return Ok(Some(*config_path)); } } diff --git a/turbopack/crates/turbopack-resolve/src/resolve.rs b/turbopack/crates/turbopack-resolve/src/resolve.rs index bc80594cab50d..767ce02167f67 100644 --- a/turbopack/crates/turbopack-resolve/src/resolve.rs +++ b/turbopack/crates/turbopack-resolve/src/resolve.rs @@ -292,7 +292,7 @@ pub async fn resolve_options( let tsconfig = find_context_file(resolve_path, tsconfig()).await?; match *tsconfig { FindContextFileResult::Found(path, _) => { - apply_tsconfig_resolve_options(resolve_options, tsconfig_resolve_options(path)) + apply_tsconfig_resolve_options(resolve_options, tsconfig_resolve_options(*path)) } FindContextFileResult::NotFound(_) => resolve_options, }