Unverified Commit 60b5fa28 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

codemod(turbopack): Rewrite Vc fields in structs as ResolvedVc (part 3) (#71665)

Generated using a version of https://github.com/vercel/turbopack-resolved-vc-codemod using Anthropic Claude Sonnet 3.5 (`claude-3-5-sonnet-20241022`) for more complicated errors we don't have hardcoded logic for.

- Part 1: #70927
- Part 2: #71172

I kept running the script until I ran out of tokens (the tier 1 rate limit is 1M input tokens). I'll keep improving how I'm calling the LLM (there's still a lot of room for improvement from my side), and try running it again tomorrow to fix more things.

This fixes 13 struct field types. There are still 271 struct fields remaining that need to be codemodded.
parent 85b809ca
...@@ -989,7 +989,7 @@ impl Project { ...@@ -989,7 +989,7 @@ impl Project {
let FindContextFileResult::Found(fs_path, _) = *middleware.await? else { let FindContextFileResult::Found(fs_path, _) = *middleware.await? else {
return Ok(Vc::upcast(EmptyEndpoint::new())); 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 app_dir = *find_app_dir(self.project_path()).await?;
let ecmascript_client_reference_transition_name = (*self.app_project().await?) let ecmascript_client_reference_transition_name = (*self.app_project().await?)
.as_ref() .as_ref()
...@@ -1123,7 +1123,7 @@ impl Project { ...@@ -1123,7 +1123,7 @@ impl Project {
let FindContextFileResult::Found(fs_path, _) = *instrumentation.await? else { let FindContextFileResult::Found(fs_path, _) = *instrumentation.await? else {
return Ok(Vc::upcast(EmptyEndpoint::new())); 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 app_dir = *find_app_dir(self.project_path()).await?;
let ecmascript_client_reference_transition_name = (*self.app_project().await?) let ecmascript_client_reference_transition_name = (*self.app_project().await?)
.as_ref() .as_ref()
......
...@@ -172,7 +172,8 @@ impl VersionedContentMap { ...@@ -172,7 +172,8 @@ impl VersionedContentMap {
}; };
if let Some(generate_source_map) = if let Some(generate_source_map) =
Vc::try_resolve_sidecast::<Box<dyn GenerateSourceMap>>(*asset).await? Vc::try_resolve_sidecast::<Box<dyn GenerateSourceMap>>(*asset.to_resolved().await?)
.await?
{ {
Ok(if let Some(section) = section { Ok(if let Some(section) = section {
generate_source_map.by_section(section) generate_source_map.by_section(section)
...@@ -200,7 +201,7 @@ impl VersionedContentMap { ...@@ -200,7 +201,7 @@ impl VersionedContentMap {
side_effects.await?; side_effects.await?;
if let Some(asset) = path_to_asset.get(&path) { 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 { } else {
let path = path.to_string().await?; let path = path.to_string().await?;
bail!( bail!(
......
...@@ -25,7 +25,7 @@ async fn get_typescript_options( ...@@ -25,7 +25,7 @@ async fn get_typescript_options(
FindContextFileResult::Found(path, _) => Some( FindContextFileResult::Found(path, _) => Some(
read_tsconfigs( read_tsconfigs(
path.read(), path.read(),
Vc::upcast(FileSource::new(path)), Vc::upcast(FileSource::new(*path)),
node_cjs_resolve_options(path.root()), node_cjs_resolve_options(path.root()),
) )
.await .await
......
...@@ -17,7 +17,7 @@ async fn all_in_one() { ...@@ -17,7 +17,7 @@ async fn all_in_one() {
let a: Vc<MyTransparentValue> = Vc::cell(4242); let a: Vc<MyTransparentValue> = Vc::cell(4242);
assert_eq!(*a.await?, 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"); assert_eq!(*b.to_string().await?, "42");
let c = MyStructValue { let c = MyStructValue {
...@@ -71,7 +71,7 @@ struct MyTransparentValue(u32); ...@@ -71,7 +71,7 @@ struct MyTransparentValue(u32);
enum MyEnumValue { enum MyEnumValue {
Yeah(u32), Yeah(u32),
Nah, Nah,
More(Vc<MyEnumValue>), More(ResolvedVc<MyEnumValue>),
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
...@@ -80,7 +80,7 @@ impl MyEnumValue { ...@@ -80,7 +80,7 @@ impl MyEnumValue {
pub async fn get_last(self: Vc<Self>) -> Result<Vc<Self>> { pub async fn get_last(self: Vc<Self>) -> Result<Vc<Self>> {
let mut current = self; let mut current = self;
while let MyEnumValue::More(more) = &*current.await? { while let MyEnumValue::More(more) = &*current.await? {
current = *more; current = **more;
} }
Ok(current) Ok(current)
} }
......
...@@ -47,7 +47,7 @@ async fn enum_none_debug() { ...@@ -47,7 +47,7 @@ async fn enum_none_debug() {
#[tokio::test] #[tokio::test]
async fn enum_transparent_debug() { async fn enum_transparent_debug() {
run(&REGISTRATION, || async { run(&REGISTRATION, || async {
let a: Vc<Enum> = Enum::Transparent(Transparent(42).cell()).cell(); let a: Vc<Enum> = Enum::Transparent(Transparent(42).resolved_cell()).cell();
assert_eq!( assert_eq!(
format!("{:?}", a.dbg().await?), format!("{:?}", a.dbg().await?),
r#"Enum :: Transparent( r#"Enum :: Transparent(
...@@ -63,7 +63,7 @@ async fn enum_transparent_debug() { ...@@ -63,7 +63,7 @@ async fn enum_transparent_debug() {
#[tokio::test] #[tokio::test]
async fn enum_inner_vc_debug() { async fn enum_inner_vc_debug() {
run(&REGISTRATION, || async { run(&REGISTRATION, || async {
let a: Vc<Enum> = Enum::Enum(Enum::None.cell()).cell(); let a: Vc<Enum> = Enum::Enum(Enum::None.resolved_cell()).cell();
assert_eq!( assert_eq!(
format!("{:?}", a.dbg().await?), format!("{:?}", a.dbg().await?),
r#"Enum :: Enum( r#"Enum :: Enum(
...@@ -118,7 +118,7 @@ async fn struct_vec_debug() { ...@@ -118,7 +118,7 @@ async fn struct_vec_debug() {
); );
let b: Vc<StructWithVec> = StructWithVec { let b: Vc<StructWithVec> = StructWithVec {
vec: vec![Transparent(42).cell()], vec: vec![Transparent(42).resolved_cell()],
} }
.cell(); .cell();
assert_eq!( assert_eq!(
...@@ -163,8 +163,8 @@ struct Transparent(u32); ...@@ -163,8 +163,8 @@ struct Transparent(u32);
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
enum Enum { enum Enum {
None, None,
Transparent(Vc<Transparent>), Transparent(ResolvedVc<Transparent>),
Enum(Vc<Enum>), Enum(ResolvedVc<Enum>),
} }
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
...@@ -182,7 +182,7 @@ struct StructWithOption { ...@@ -182,7 +182,7 @@ struct StructWithOption {
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
struct StructWithVec { struct StructWithVec {
vec: Vec<Vc<Transparent>>, vec: Vec<ResolvedVc<Transparent>>,
} }
#[turbo_tasks::value(shared, eq = "manual")] #[turbo_tasks::value(shared, eq = "manual")]
......
...@@ -47,12 +47,12 @@ impl ValueToString for EcmascriptDevChunk { ...@@ -47,12 +47,12 @@ impl ValueToString for EcmascriptDevChunk {
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
impl OutputChunk for EcmascriptDevChunk { impl OutputChunk for EcmascriptDevChunk {
#[turbo_tasks::function] #[turbo_tasks::function]
fn runtime_info(&self) -> Vc<OutputChunkRuntimeInfo> { async fn runtime_info(&self) -> Result<Vc<OutputChunkRuntimeInfo>> {
OutputChunkRuntimeInfo { Ok(OutputChunkRuntimeInfo {
included_ids: Some(self.chunk.entry_ids()), included_ids: Some(self.chunk.entry_ids().to_resolved().await?),
..Default::default() ..Default::default()
} }
.cell() .cell())
} }
} }
......
...@@ -14,7 +14,7 @@ use turbopack_resolve::ecmascript::cjs_resolve; ...@@ -14,7 +14,7 @@ use turbopack_resolve::ecmascript::cjs_resolve;
pub enum RuntimeEntry { pub enum RuntimeEntry {
Request(ResolvedVc<Request>, ResolvedVc<FileSystemPath>), Request(ResolvedVc<Request>, ResolvedVc<FileSystemPath>),
Evaluatable(ResolvedVc<Box<dyn EvaluatableAsset>>), Evaluatable(ResolvedVc<Box<dyn EvaluatableAsset>>),
Source(Vc<Box<dyn Source>>), Source(ResolvedVc<Box<dyn Source>>),
} }
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
......
...@@ -77,9 +77,11 @@ pub async fn get_client_runtime_entries( ...@@ -77,9 +77,11 @@ pub async fn get_client_runtime_entries(
}; };
runtime_entries.push( runtime_entries.push(
RuntimeEntry::Source(Vc::upcast(FileSource::new(embed_file_path( RuntimeEntry::Source(ResolvedVc::upcast(
"entry/bootstrap.ts".into(), FileSource::new(embed_file_path("entry/bootstrap.ts".into()))
)))) .to_resolved()
.await?,
))
.cell(), .cell(),
); );
......
...@@ -136,12 +136,12 @@ pub trait Chunk: Asset { ...@@ -136,12 +136,12 @@ pub trait Chunk: Asset {
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Default)] #[derive(Default)]
pub struct OutputChunkRuntimeInfo { pub struct OutputChunkRuntimeInfo {
pub included_ids: Option<Vc<ModuleIds>>, pub included_ids: Option<ResolvedVc<ModuleIds>>,
pub excluded_ids: Option<ResolvedVc<ModuleIds>>, pub excluded_ids: Option<ResolvedVc<ModuleIds>>,
/// List of paths of chunks containing individual modules that are part of /// List of paths of chunks containing individual modules that are part of
/// this chunk. This is useful for selectively loading modules from a chunk /// this chunk. This is useful for selectively loading modules from a chunk
/// without loading the whole chunk. /// without loading the whole chunk.
pub module_chunks: Option<Vc<OutputAssets>>, pub module_chunks: Option<ResolvedVc<OutputAssets>>,
pub placeholder_for_future_extensions: (), pub placeholder_for_future_extensions: (),
} }
...@@ -251,8 +251,8 @@ enum ChunkContentGraphNode { ...@@ -251,8 +251,8 @@ enum ChunkContentGraphNode {
#[derive(Debug, Clone, Copy, TaskInput, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, TaskInput, PartialEq, Eq, Hash, Serialize, Deserialize)]
enum ChunkGraphNodeToReferences { enum ChunkGraphNodeToReferences {
PassthroughChunkItem(Vc<Box<dyn ChunkItem>>), PassthroughChunkItem(ResolvedVc<Box<dyn ChunkItem>>),
ChunkItem(Vc<Box<dyn ChunkItem>>), ChunkItem(ResolvedVc<Box<dyn ChunkItem>>),
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TraceRawVcs)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, TraceRawVcs)]
...@@ -483,7 +483,7 @@ async fn graph_node_to_referenced_nodes( ...@@ -483,7 +483,7 @@ async fn graph_node_to_referenced_nodes(
graph_nodes.push(ChunkGraphEdge { graph_nodes.push(ChunkGraphEdge {
key: None, key: None,
node: ChunkContentGraphNode::InheritAsyncInfo { node: ChunkContentGraphNode::InheritAsyncInfo {
item: parent, item: *parent,
references: inherit_async_references, references: inherit_async_references,
}, },
}) })
...@@ -540,10 +540,10 @@ impl Visit<ChunkContentGraphNode, ()> for ChunkContentVisit { ...@@ -540,10 +540,10 @@ impl Visit<ChunkContentGraphNode, ()> for ChunkContentVisit {
async move { async move {
let node = match node { let node = match node {
ChunkContentGraphNode::PassthroughChunkItem { item } => { ChunkContentGraphNode::PassthroughChunkItem { item } => {
ChunkGraphNodeToReferences::PassthroughChunkItem(item) ChunkGraphNodeToReferences::PassthroughChunkItem(item.to_resolved().await?)
} }
ChunkContentGraphNode::ChunkItem { item, .. } => { ChunkContentGraphNode::ChunkItem { item, .. } => {
ChunkGraphNodeToReferences::ChunkItem(item) ChunkGraphNodeToReferences::ChunkItem(item.to_resolved().await?)
} }
_ => { _ => {
return Ok(None.into_iter().flatten()); return Ok(None.into_iter().flatten());
......
...@@ -168,7 +168,7 @@ pub struct CompileTimeDefines(pub FxIndexMap<Vec<DefineableNameSegment>, Compile ...@@ -168,7 +168,7 @@ pub struct CompileTimeDefines(pub FxIndexMap<Vec<DefineableNameSegment>, Compile
#[turbo_tasks::value(transparent)] #[turbo_tasks::value(transparent)]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct CompileTimeDefinesIndividual( pub struct CompileTimeDefinesIndividual(
pub FxIndexMap<Vec<DefineableNameSegment>, Vc<CompileTimeDefineValue>>, pub FxIndexMap<Vec<DefineableNameSegment>, ResolvedVc<CompileTimeDefineValue>>,
); );
impl IntoIterator for CompileTimeDefines { impl IntoIterator for CompileTimeDefines {
...@@ -192,7 +192,7 @@ impl CompileTimeDefines { ...@@ -192,7 +192,7 @@ impl CompileTimeDefines {
Vc::cell( Vc::cell(
self.0 self.0
.iter() .iter()
.map(|(key, value)| (key.clone(), value.clone().cell())) .map(|(key, value)| (key.clone(), value.clone().resolved_cell()))
.collect(), .collect(),
) )
} }
...@@ -241,7 +241,7 @@ pub struct FreeVarReferences(pub FxIndexMap<Vec<DefineableNameSegment>, FreeVarR ...@@ -241,7 +241,7 @@ pub struct FreeVarReferences(pub FxIndexMap<Vec<DefineableNameSegment>, FreeVarR
#[turbo_tasks::value(transparent)] #[turbo_tasks::value(transparent)]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct FreeVarReferencesIndividual( pub struct FreeVarReferencesIndividual(
pub FxIndexMap<Vec<DefineableNameSegment>, Vc<FreeVarReference>>, pub FxIndexMap<Vec<DefineableNameSegment>, ResolvedVc<FreeVarReference>>,
); );
#[turbo_tasks::value_impl] #[turbo_tasks::value_impl]
...@@ -256,7 +256,7 @@ impl FreeVarReferences { ...@@ -256,7 +256,7 @@ impl FreeVarReferences {
Vc::cell( Vc::cell(
self.0 self.0
.iter() .iter()
.map(|(key, value)| (key.clone(), value.clone().cell())) .map(|(key, value)| (key.clone(), value.clone().resolved_cell()))
.collect(), .collect(),
) )
} }
......
use anyhow::Result; use anyhow::Result;
use turbo_tasks::{FxIndexSet, Vc}; use turbo_tasks::{FxIndexSet, ResolvedVc, Vc};
use crate::{asset::Asset, ident::AssetIdent}; use crate::{asset::Asset, ident::AssetIdent};
#[turbo_tasks::value(transparent)] #[turbo_tasks::value(transparent)]
pub struct OptionOutputAsset(Option<Vc<Box<dyn OutputAsset>>>); pub struct OptionOutputAsset(Option<ResolvedVc<Box<dyn OutputAsset>>>);
/// An asset that should be outputted, e. g. written to disk or served from a /// An asset that should be outputted, e. g. written to disk or served from a
/// server. /// server.
......
...@@ -1084,7 +1084,7 @@ async fn imports_field(lookup_path: Vc<FileSystemPath>) -> Result<Vc<ImportsFiel ...@@ -1084,7 +1084,7 @@ async fn imports_field(lookup_path: Vc<FileSystemPath>) -> Result<Vc<ImportsFiel
return Ok(ImportsFieldResult::None.cell()); return Ok(ImportsFieldResult::None.cell());
}; };
let read = read_package_json(*package_json_path).await?; let read = read_package_json(**package_json_path).await?;
let package_json = match &*read { let package_json = match &*read {
Some(json) => json, Some(json) => json,
None => return Ok(ImportsFieldResult::None.cell()), None => return Ok(ImportsFieldResult::None.cell()),
...@@ -1094,10 +1094,10 @@ async fn imports_field(lookup_path: Vc<FileSystemPath>) -> Result<Vc<ImportsFiel ...@@ -1094,10 +1094,10 @@ async fn imports_field(lookup_path: Vc<FileSystemPath>) -> Result<Vc<ImportsFiel
return Ok(ImportsFieldResult::None.cell()); return Ok(ImportsFieldResult::None.cell());
}; };
match imports.try_into() { match imports.try_into() {
Ok(imports) => Ok(ImportsFieldResult::Some(imports, *package_json_path).cell()), Ok(imports) => Ok(ImportsFieldResult::Some(imports, **package_json_path).cell()),
Err(err) => { Err(err) => {
PackageJsonIssue { PackageJsonIssue {
path: *package_json_path, path: **package_json_path,
error_message: err.to_string().into(), error_message: err.to_string().into(),
} }
.cell() .cell()
...@@ -1114,7 +1114,7 @@ pub fn package_json() -> Vc<Vec<RcStr>> { ...@@ -1114,7 +1114,7 @@ pub fn package_json() -> Vc<Vec<RcStr>> {
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
pub enum FindContextFileResult { pub enum FindContextFileResult {
Found(Vc<FileSystemPath>, Vec<Vc<Box<dyn Source>>>), Found(ResolvedVc<FileSystemPath>, Vec<Vc<Box<dyn Source>>>),
NotFound(Vec<Vc<Box<dyn Source>>>), NotFound(Vec<Vc<Box<dyn Source>>>),
} }
...@@ -1127,7 +1127,7 @@ pub async fn find_context_file( ...@@ -1127,7 +1127,7 @@ pub async fn find_context_file(
for name in &*names.await? { for name in &*names.await? {
let fs_path = lookup_path.join(name.clone()); let fs_path = lookup_path.join(name.clone());
if let Some(fs_path) = exists(fs_path, &mut refs).await? { 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() { if lookup_path.await?.is_root() {
...@@ -1167,14 +1167,18 @@ pub async fn find_context_file_or_package_key( ...@@ -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(package_json_path) = exists(package_json_path, &mut refs).await? {
if let Some(json) = &*read_package_json(package_json_path).await? { if let Some(json) = &*read_package_json(package_json_path).await? {
if json.get(&**package_key).is_some() { 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? { for name in &*names.await? {
let fs_path = lookup_path.join(name.clone()); let fs_path = lookup_path.join(name.clone());
if let Some(fs_path) = exists(fs_path, &mut refs).await? { 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() { if lookup_path.await?.is_root() {
...@@ -2188,7 +2192,7 @@ async fn apply_in_package( ...@@ -2188,7 +2192,7 @@ async fn apply_in_package(
continue; 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 { let Some(package_json) = &*read else {
continue; continue;
}; };
...@@ -2248,7 +2252,7 @@ async fn apply_in_package( ...@@ -2248,7 +2252,7 @@ async fn apply_in_package(
ResolvingIssue { ResolvingIssue {
severity: error_severity(options).await?, severity: error_severity(options).await?,
file_path: *package_json_path, file_path: **package_json_path,
request_type: format!("alias field ({field})"), request_type: format!("alias field ({field})"),
request: Request::parse(Value::new(Pattern::Constant(request))), request: Request::parse(Value::new(Pattern::Constant(request))),
resolve_options: options, resolve_options: options,
...@@ -2282,7 +2286,7 @@ async fn find_self_reference( ...@@ -2282,7 +2286,7 @@ async fn find_self_reference(
) -> Result<Vc<FindSelfReferencePackageResult>> { ) -> Result<Vc<FindSelfReferencePackageResult>> {
let package_json_context = find_context_file(lookup_path, package_json()).await?; let package_json_context = find_context_file(lookup_path, package_json()).await?;
if let FindContextFileResult::Found(package_json_path, _refs) = &*package_json_context { 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 let Some(json) = &*read {
if json.get("exports").is_some() { if json.get("exports").is_some() {
if let Some(name) = json["name"].as_str() { if let Some(name) = json["name"].as_str() {
......
...@@ -231,8 +231,8 @@ impl OutputChunk for CssChunk { ...@@ -231,8 +231,8 @@ impl OutputChunk for CssChunk {
.map(|item| Vc::upcast(SingleItemCssChunk::new(self.chunking_context, *item))) .map(|item| Vc::upcast(SingleItemCssChunk::new(self.chunking_context, *item)))
.collect(); .collect();
Ok(OutputChunkRuntimeInfo { Ok(OutputChunkRuntimeInfo {
included_ids: Some(Vc::cell(included_ids)), included_ids: Some(ResolvedVc::cell(included_ids)),
module_chunks: Some(Vc::cell(module_chunks)), module_chunks: Some(ResolvedVc::cell(module_chunks)),
..Default::default() ..Default::default()
} }
.cell()) .cell())
......
...@@ -170,7 +170,7 @@ pub async fn is_marked_as_side_effect_free( ...@@ -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?; let find_package_json = find_context_file(path.parent(), package_json()).await?;
if let FindContextFileResult::Found(package_json, _) = *find_package_json { 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::None => {}
SideEffectsValue::Constant(side_effects) => return Ok(Vc::cell(!side_effects)), SideEffectsValue::Constant(side_effects) => return Ok(Vc::cell(!side_effects)),
SideEffectsValue::Glob(glob) => { SideEffectsValue::Glob(glob) => {
......
...@@ -504,14 +504,14 @@ impl EcmascriptModuleAsset { ...@@ -504,14 +504,14 @@ impl EcmascriptModuleAsset {
Some("commonjs") => SpecifiedModuleType::CommonJs, Some("commonjs") => SpecifiedModuleType::CommonJs,
_ => SpecifiedModuleType::Automatic, _ => SpecifiedModuleType::Automatic,
}, },
package_json, *package_json,
)); ));
} }
} }
Ok(ModuleTypeResult::new_with_package_json( Ok(ModuleTypeResult::new_with_package_json(
SpecifiedModuleType::Automatic, SpecifiedModuleType::Automatic,
package_json, *package_json,
)) ))
} }
} }
......
...@@ -466,7 +466,7 @@ pub(crate) async fn analyse_ecmascript_module_internal( ...@@ -466,7 +466,7 @@ pub(crate) async fn analyse_ecmascript_module_internal(
if analyze_types { if analyze_types {
match &*find_context_file(path.parent(), tsconfig()).await? { match &*find_context_file(path.parent(), tsconfig()).await? {
FindContextFileResult::Found(tsconfig, _) => { FindContextFileResult::Found(tsconfig, _) => {
analysis.add_reference(TsConfigReference::new(origin, *tsconfig)); analysis.add_reference(TsConfigReference::new(origin, **tsconfig));
} }
FindContextFileResult::NotFound(_) => {} FindContextFileResult::NotFound(_) => {}
}; };
......
...@@ -391,7 +391,7 @@ async fn find_config_in_location( ...@@ -391,7 +391,7 @@ async fn find_config_in_location(
) )
.await? .await?
{ {
return Ok(Some(config_path)); return Ok(Some(*config_path));
} }
if matches!(location, PostCssConfigLocation::ProjectPathOrLocalPath) { if matches!(location, PostCssConfigLocation::ProjectPathOrLocalPath) {
...@@ -402,7 +402,7 @@ async fn find_config_in_location( ...@@ -402,7 +402,7 @@ async fn find_config_in_location(
) )
.await? .await?
{ {
return Ok(Some(config_path)); return Ok(Some(*config_path));
} }
} }
......
...@@ -292,7 +292,7 @@ pub async fn resolve_options( ...@@ -292,7 +292,7 @@ pub async fn resolve_options(
let tsconfig = find_context_file(resolve_path, tsconfig()).await?; let tsconfig = find_context_file(resolve_path, tsconfig()).await?;
match *tsconfig { match *tsconfig {
FindContextFileResult::Found(path, _) => { 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, FindContextFileResult::NotFound(_) => resolve_options,
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment