From 2dcfb56d0d1d4ece4a7671adb76203a18469c828 Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Fri, 25 Oct 2024 16:53:20 -0700 Subject: [PATCH] Manual cleanup of LLM-generated changes --- turbopack/crates/node-file-trace/src/lib.rs | 10 +- .../crates/turbopack-cli/src/build/mod.rs | 2 +- .../src/chunk/available_chunk_items.rs | 7 +- .../turbopack-core/src/chunk/chunk_group.rs | 1 - .../crates/turbopack-core/src/chunk/mod.rs | 16 +- .../src/introspect/output_asset.rs | 17 +-- .../crates/turbopack-core/src/resolve/mod.rs | 144 +++++++++--------- .../turbopack-core/src/resolve/options.rs | 8 +- .../turbopack-core/src/resolve/pattern.rs | 14 +- .../src/references/esm/base.rs | 2 +- 10 files changed, 108 insertions(+), 113 deletions(-) diff --git a/turbopack/crates/node-file-trace/src/lib.rs b/turbopack/crates/node-file-trace/src/lib.rs index f827c0fc0acbbd..993cbf5e681c63 100644 --- a/turbopack/crates/node-file-trace/src/lib.rs +++ b/turbopack/crates/node-file-trace/src/lib.rs @@ -23,8 +23,8 @@ use serde::Deserialize; use serde::Serialize; use tokio::sync::mpsc::channel; use turbo_tasks::{ - backend::Backend, util::FormatDuration, RcStr, ReadConsistency, TaskId, TransientInstance, - TransientValue, TurboTasks, UpdateInfo, Value, Vc, + backend::Backend, util::FormatDuration, RcStr, ReadConsistency, ResolvedVc, TaskId, + TransientInstance, TransientValue, TurboTasks, UpdateInfo, Value, Vc, }; use turbo_tasks_fs::{ glob::Glob, DirectoryEntry, DiskFileSystem, FileSystem, FileSystemPath, ReadGlobResult, @@ -565,7 +565,7 @@ async fn main_operation( #[turbo_tasks::function] async fn create_module_asset( - root: Vc, + root: ResolvedVc, process_cwd: Option, module_options: TransientInstance, resolve_options: TransientInstance, @@ -580,14 +580,14 @@ async fn create_module_asset( let compile_time_info = CompileTimeInfo::builder(env).cell(); let glob_mappings = vec![ ( - root.to_resolved().await?, + root, Glob::new("**/*/next/dist/server/next.js".into()) .to_resolved() .await?, ImportMapping::Ignore.resolved_cell(), ), ( - root.to_resolved().await?, + root, Glob::new("**/*/next/dist/bin/next".into()) .to_resolved() .await?, diff --git a/turbopack/crates/turbopack-cli/src/build/mod.rs b/turbopack/crates/turbopack-cli/src/build/mod.rs index ec08685b3a6ea1..bc794d3f1bdd64 100644 --- a/turbopack/crates/turbopack-cli/src/build/mod.rs +++ b/turbopack/crates/turbopack-cli/src/build/mod.rs @@ -118,7 +118,7 @@ impl TurbopackBuildBuilder { self.entry_requests .iter() .cloned() - .map(EntryRequest::resolved_cell) // Changed from cell() to resolved_cell() + .map(EntryRequest::resolved_cell) .collect(), ) .cell(), diff --git a/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs b/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs index f5d12bf9dd1014..03f9496e4580fc 100644 --- a/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs +++ b/turbopack/crates/turbopack-core/src/chunk/available_chunk_items.rs @@ -89,14 +89,13 @@ impl AvailableChunkItems { #[turbo_tasks::function] pub async fn get( &self, - chunk_item: Vc>, + chunk_item: ResolvedVc>, ) -> Result> { - let resolved_chunk_item = chunk_item.to_resolved().await?; - if let Some(&info) = self.chunk_items.await?.get(&resolved_chunk_item) { + if let Some(&info) = self.chunk_items.await?.get(&chunk_item) { return Ok(Vc::cell(Some(info))); }; if let Some(parent) = self.parent { - return Ok(parent.get(chunk_item)); + return Ok(parent.get(*chunk_item)); } Ok(Vc::cell(None)) } diff --git a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs index b84ebdba7902a7..b6e8c3035e37b6 100644 --- a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs +++ b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs @@ -169,7 +169,6 @@ pub async fn make_chunk_group( chunks.extend(async_loader_chunks.iter().copied()); } - // Convert chunks to ResolvedVc let resolved_chunks = chunks .into_iter() .map(|chunk| chunk.to_resolved()) diff --git a/turbopack/crates/turbopack-core/src/chunk/mod.rs b/turbopack/crates/turbopack-core/src/chunk/mod.rs index a0d731fcd74898..ebb8e19394cddf 100644 --- a/turbopack/crates/turbopack-core/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-core/src/chunk/mod.rs @@ -593,10 +593,7 @@ async fn chunk_content_internal_parallel( Ok(Some(ChunkGraphEdge { key: Some(entry.to_resolved().await?), node: ChunkContentGraphNode::ChunkItem { - item: *chunkable_module - .as_chunk_item(chunking_context) - .to_resolved() - .await?, + item: chunkable_module.as_chunk_item(chunking_context), ident: chunkable_module.ident().to_string().await?, }, })) @@ -743,12 +740,11 @@ pub struct AsyncModuleInfo { impl AsyncModuleInfo { #[turbo_tasks::function] pub async fn new(referenced_async_modules: Vec>>) -> Result> { - let resolved_modules = futures::future::try_join_all( - referenced_async_modules - .into_iter() - .map(|m| m.to_resolved()), - ) - .await?; + let resolved_modules = referenced_async_modules + .into_iter() + .map(|m| m.to_resolved()) + .try_join() + .await?; Ok(Self { referenced_async_modules: resolved_modules.into_iter().collect(), diff --git a/turbopack/crates/turbopack-core/src/introspect/output_asset.rs b/turbopack/crates/turbopack-core/src/introspect/output_asset.rs index 7bc76640063a9f..f681e72689aa9e 100644 --- a/turbopack/crates/turbopack-core/src/introspect/output_asset.rs +++ b/turbopack/crates/turbopack-core/src/introspect/output_asset.rs @@ -13,15 +13,14 @@ pub struct IntrospectableOutputAsset(ResolvedVc>); #[turbo_tasks::value_impl] impl IntrospectableOutputAsset { #[turbo_tasks::function] - pub async fn new(asset: Vc>) -> Result>> { - let resolved_asset = asset.to_resolved().await?; - Ok( - *ResolvedVc::try_sidecast::>(resolved_asset) - .await? - .unwrap_or_else(|| { - ResolvedVc::upcast(IntrospectableOutputAsset(resolved_asset).resolved_cell()) - }), - ) + pub async fn new( + asset: ResolvedVc>, + ) -> Result>> { + Ok(*ResolvedVc::try_sidecast::>(asset) + .await? + .unwrap_or_else(|| { + ResolvedVc::upcast(IntrospectableOutputAsset(asset).resolved_cell()) + })) } } diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 279b48aa16cad8..2b8b0440015698 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -1094,9 +1094,7 @@ async fn imports_field(lookup_path: Vc) -> Result { - Ok(ImportsFieldResult::Some(imports, package_json_path.to_resolved().await?).cell()) - } + Ok(imports) => Ok(ImportsFieldResult::Some(imports, *package_json_path).cell()), Err(err) => { PackageJsonIssue { path: **package_json_path, @@ -1138,6 +1136,8 @@ pub async fn find_context_file( if refs.is_empty() { // Tailcall Ok(find_context_file( + // Hot codepath optimization: resolve all arguments to avoid an automatically-created + // intermediate task lookup_path.parent().resolve().await?, names, )) @@ -1153,7 +1153,7 @@ pub async fn find_context_file( FindContextFileResult::NotFound(refs) } } - .into()) + .cell()) } } @@ -1586,16 +1586,16 @@ async fn handle_after_resolve_plugins( #[turbo_tasks::function] async fn resolve_internal( - lookup_path: Vc, - request: Vc, + lookup_path: ResolvedVc, + request: ResolvedVc, options: Vc, ) -> Result> { resolve_internal_inline(lookup_path, request, options).await } async fn resolve_internal_inline( - lookup_path: Vc, - request: Vc, + lookup_path: ResolvedVc, + request: ResolvedVc, options: Vc, ) -> Result> { let span = { @@ -1616,17 +1616,17 @@ async fn resolve_internal_inline( if let Some(import_map) = &options_value.import_map { let request_parts = match &*request_value { Request::Alternatives { requests } => requests.as_slice(), - _ => &[request], + _ => &[*request], }; for request in request_parts { - let result = import_map.await?.lookup(lookup_path, *request).await?; + let result = import_map.await?.lookup(*lookup_path, *request).await?; if !matches!(result, ImportMapResult::NoEntry) { has_alias = true; let resolved_result = resolve_import_map_result( &result, lookup_path, lookup_path, - *request, + request.to_resolved().await?, options, request.query(), ) @@ -1651,7 +1651,10 @@ async fn resolve_internal_inline( Request::Alternatives { requests } => { let results = requests .iter() - .map(|req| Box::pin(resolve_internal_inline(lookup_path, *req, options))) + .map(|req| async { + resolve_internal_inline(lookup_path, req.to_resolved().await?, options) + .await + }) .try_join() .await?; @@ -1665,7 +1668,7 @@ async fn resolve_internal_inline( } => { let mut results = Vec::new(); let matches = read_matches( - lookup_path, + *lookup_path, "".into(), *force_in_lookup_dir, Pattern::new(path.clone()).resolve().await?, @@ -1766,8 +1769,8 @@ async fn resolve_internal_inline( ResolvingIssue { severity: error_severity(options).await?, request_type: "server relative import: not implemented yet".to_string(), - request, - file_path: lookup_path, + request: *request, + file_path: *lookup_path, resolve_options: options, error_message: Some( "server relative imports are not implemented yet. Please try an \ @@ -1781,8 +1784,8 @@ async fn resolve_internal_inline( } Box::pin(resolve_internal_inline( - lookup_path.root().resolve().await?, - relative.resolve().await?, + lookup_path.root().to_resolved().await?, + relative.to_resolved().await?, options, )) .await? @@ -1796,8 +1799,8 @@ async fn resolve_internal_inline( ResolvingIssue { severity: error_severity(options).await?, request_type: "windows import: not implemented yet".to_string(), - request, - file_path: lookup_path, + request: *request, + file_path: *lookup_path, resolve_options: options, error_message: Some("windows imports are not implemented yet".to_string()), source: None, @@ -1850,8 +1853,8 @@ async fn resolve_internal_inline( ResolvingIssue { severity: error_severity(options).await?, request_type: format!("unknown import: `{}`", path), - request, - file_path: lookup_path, + request: *request, + file_path: *lookup_path, resolve_options: options, error_message: None, source: None, @@ -1866,7 +1869,7 @@ async fn resolve_internal_inline( // Apply fallback import mappings if provided if let Some(import_map) = &options_value.fallback_import_map { if *result.is_unresolvable().await? { - let result = import_map.await?.lookup(lookup_path, request).await?; + let result = import_map.await?.lookup(*lookup_path, *request).await?; let resolved_result = resolve_import_map_result( &result, lookup_path, @@ -1892,7 +1895,7 @@ async fn resolve_internal_inline( #[turbo_tasks::function] async fn resolve_into_folder( - package_path: Vc, + package_path: ResolvedVc, options: Vc, ) -> Result> { let package_json_path = package_path.join("package.json".into()); @@ -1910,7 +1913,9 @@ async fn resolve_into_folder( { continue; } - let request = Request::parse(Value::new(normalized_request.into())); + let request = Request::parse(Value::new(normalized_request.into())) + .to_resolved() + .await?; // main field will always resolve not fully specified let options = if options_value.fully_specified { @@ -1956,7 +1961,7 @@ async fn resolve_into_folder( let request = Request::parse(Value::new(pattern)); Ok( - resolve_internal_inline(package_path, request.resolve().await?, options) + resolve_internal_inline(package_path, request.to_resolved().await?, options) .await? .with_request(".".into()), ) @@ -1964,8 +1969,8 @@ async fn resolve_into_folder( #[tracing::instrument(level = Level::TRACE, skip_all)] async fn resolve_relative_request( - lookup_path: Vc, - request: Vc, + lookup_path: ResolvedVc, + request: ResolvedVc, options: Vc, options_value: &ResolveOptions, path_pattern: &Pattern, @@ -1976,7 +1981,7 @@ async fn resolve_relative_request( // Check alias field for aliases first let lookup_path_ref = &*lookup_path.await?; if let Some(result) = apply_in_package( - lookup_path, + *lookup_path, options, options_value, |package_path| { @@ -2063,7 +2068,7 @@ async fn resolve_relative_request( let mut results = Vec::new(); let matches = read_matches( - lookup_path, + *lookup_path, "".into(), force_in_lookup_dir, Pattern::new(new_path).resolve().await?, @@ -2306,8 +2311,8 @@ async fn find_self_reference( #[tracing::instrument(level = Level::TRACE, skip_all)] async fn resolve_module_request( - lookup_path: Vc, - request: Vc, + lookup_path: ResolvedVc, + request: ResolvedVc, options: Vc, options_value: &ResolveOptions, module: &str, @@ -2317,7 +2322,7 @@ async fn resolve_module_request( ) -> Result> { // Check alias field for module aliases first if let Some(result) = apply_in_package( - lookup_path, + *lookup_path, options, options_value, |_| { @@ -2336,7 +2341,7 @@ async fn resolve_module_request( // module. This should match only using the exports field and no other // fields/fallbacks. if let FindSelfReferencePackageResult::Found { name, package_path } = - &*find_self_reference(lookup_path).await? + &*find_self_reference(*lookup_path).await? { if name == module { let result = resolve_into_package( @@ -2353,7 +2358,7 @@ async fn resolve_module_request( } let result = find_package( - lookup_path, + *lookup_path, module.into(), resolve_modules_options(options).resolve().await?, ) @@ -2414,13 +2419,11 @@ async fn resolve_module_request( RcStr::from("/").into(), path.clone(), ]); - let relative = Request::relative(Value::new(pattern), query, fragment, true); - let relative_result = Box::pin(resolve_internal_inline( - lookup_path, - relative.resolve().await?, - options, - )) - .await?; + let relative = Request::relative(Value::new(pattern), query, fragment, true) + .to_resolved() + .await?; + let relative_result = + Box::pin(resolve_internal_inline(lookup_path, relative, options)).await?; let relative_result = relative_result .with_replaced_request_key(module_prefix, Value::new(RequestKey::new(module.into()))); @@ -2433,7 +2436,7 @@ async fn resolve_module_request( #[turbo_tasks::function] async fn resolve_into_package( path: Value, - package_path: Vc, + package_path: ResolvedVc, query: Vc, fragment: Vc, options: Vc, @@ -2494,7 +2497,7 @@ async fn resolve_into_package( // apply main field(s) or fallback to index.js if there's no subpath if is_root_match { results.push(resolve_into_folder( - package_path, + *package_path, options.with_fully_specified(false), )); } @@ -2503,9 +2506,10 @@ async fn resolve_into_package( let mut new_pat = path.clone(); new_pat.push_front(RcStr::from(".").into()); - let relative = Request::relative(Value::new(new_pat), query, fragment, true); - results - .push(resolve_internal_inline(package_path, relative.resolve().await?, options).await?); + let relative = Request::relative(Value::new(new_pat), query, fragment, true) + .to_resolved() + .await?; + results.push(resolve_internal_inline(package_path, relative, options).await?); } Ok(merge_results(results)) @@ -2514,9 +2518,9 @@ async fn resolve_into_package( #[tracing::instrument(level = Level::TRACE, skip_all)] async fn resolve_import_map_result( result: &ImportMapResult, - lookup_path: Vc, - original_lookup_path: Vc, - original_request: Vc, + lookup_path: ResolvedVc, + original_lookup_path: ResolvedVc, + original_request: ResolvedVc, options: Vc, query: Vc, ) -> Result>> { @@ -2525,16 +2529,14 @@ async fn resolve_import_map_result( ImportMapResult::Alias(request, alias_lookup_path) => { let request = *request; let lookup_path = match alias_lookup_path { - Some(path) => path, - None => &lookup_path.to_resolved().await?, + Some(path) => *path, + None => lookup_path, }; // We must avoid cycles during resolving - if request.resolve().await? == original_request.to_resolved().await? - && *lookup_path == original_lookup_path.to_resolved().await? - { + if request == original_request && lookup_path == original_lookup_path { None } else { - let result = resolve_internal(**lookup_path, *request, options); + let result = resolve_internal(*lookup_path, *request, options); Some(result.with_replaced_request_key_pattern( request.request_pattern(), original_request.request_pattern(), @@ -2567,8 +2569,8 @@ async fn resolve_import_map_result( async fn resolved( request_key: RequestKey, fs_path: Vc, - original_context: Vc, - original_request: Vc, + original_context: ResolvedVc, + original_request: ResolvedVc, options_value: &ResolveOptions, options: Vc, query: Vc, @@ -2593,12 +2595,12 @@ async fn resolved( if let Some(resolved_map) = options_value.resolved_map { let result = resolved_map - .lookup(**path, original_context, original_request) + .lookup(**path, *original_context, *original_request) .await?; let resolved_result = resolve_import_map_result( &result, - path.parent(), + path.parent().to_resolved().await?, original_context, original_request, options, @@ -2625,7 +2627,7 @@ async fn resolved( } async fn handle_exports_imports_field( - package_path: Vc, + package_path: ResolvedVc, package_json_path: Vc, options: Vc, exports_imports_field: &AliasMap, @@ -2662,7 +2664,9 @@ async fn handle_exports_imports_field( let request = Request::parse(Value::new(Pattern::Concatenation(vec![ Pattern::Constant("./".into()), result_path, - ]))); + ]))) + .to_resolved() + .await?; let resolve_result = Box::pin(resolve_internal_inline(package_path, request, options)).await?; @@ -2688,8 +2692,8 @@ async fn handle_exports_imports_field( /// static strings or conditions like `import` or `require` to handle ESM/CJS /// with differently compiled files. async fn resolve_package_internal_with_imports_field( - file_path: Vc, - request: Vc, + file_path: ResolvedVc, + request: ResolvedVc, resolve_options: Vc, pattern: &Pattern, conditions: &BTreeMap, @@ -2702,9 +2706,9 @@ async fn resolve_package_internal_with_imports_field( if specifier == "#" || specifier.starts_with("#/") || specifier.ends_with('/') { ResolvingIssue { severity: error_severity(resolve_options).await?, - file_path, + file_path: *file_path, request_type: format!("package imports request: `{specifier}`"), - request, + request: *request, resolve_options, error_message: None, source: None, @@ -2714,15 +2718,15 @@ async fn resolve_package_internal_with_imports_field( return Ok(ResolveResult::unresolvable().into()); } - let imports_result = imports_field(file_path).await?; + let imports_result = imports_field(*file_path).await?; let (imports, package_json_path) = match &*imports_result { - ImportsFieldResult::Some(i, p) => (i, p), - ImportsFieldResult::None => return Ok(ResolveResult::unresolvable().into()), + ImportsFieldResult::Some(i, p) => (i, *p), + ImportsFieldResult::None => return Ok(ResolveResult::unresolvable().cell()), }; handle_exports_imports_field( - package_json_path.parent(), - **package_json_path, + package_json_path.parent().to_resolved().await?, + *package_json_path, resolve_options, imports, specifier, diff --git a/turbopack/crates/turbopack-core/src/resolve/options.rs b/turbopack/crates/turbopack-core/src/resolve/options.rs index 796e6a72ff5ce0..9297d235e3f51f 100644 --- a/turbopack/crates/turbopack-core/src/resolve/options.rs +++ b/turbopack/crates/turbopack-core/src/resolve/options.rs @@ -324,9 +324,7 @@ async fn import_mapping_to_result( request: Vc, ) -> Result { Ok(match &*mapping.await? { - ReplacedImportMapping::Direct(result) => { - ImportMapResult::Result(*result.to_resolved().await?) - } + ReplacedImportMapping::Direct(result) => ImportMapResult::Result(*result), ReplacedImportMapping::External(name, ty) => ImportMapResult::Result( *ResolveResult::primary(if let Some(name) = name { ResolveResultItem::External(name.clone(), *ty) @@ -345,11 +343,11 @@ async fn import_mapping_to_result( ), ReplacedImportMapping::PrimaryAlternative(name, context) => { let request = Request::parse(Value::new(name.clone())); - let context = match context { + let context_resolved = match context { Some(c) => Some((*c).to_resolved().await?), None => None, }; - ImportMapResult::Alias(request.to_resolved().await?, context) + ImportMapResult::Alias(request.to_resolved().await?, context_resolved) } ReplacedImportMapping::Alternatives(list) => ImportMapResult::Alternatives( list.iter() diff --git a/turbopack/crates/turbopack-core/src/resolve/pattern.rs b/turbopack/crates/turbopack-core/src/resolve/pattern.rs index 14297dcff49714..1f5b34013dac7f 100644 --- a/turbopack/crates/turbopack-core/src/resolve/pattern.rs +++ b/turbopack/crates/turbopack-core/src/resolve/pattern.rs @@ -9,7 +9,7 @@ use lazy_static::lazy_static; use regex::Regex; use serde::{Deserialize, Serialize}; use tracing::Instrument; -use turbo_tasks::{trace::TraceRawVcs, RcStr, Value, ValueToString, Vc}; +use turbo_tasks::{trace::TraceRawVcs, RcStr, ResolvedVc, Value, ValueToString, Vc}; use turbo_tasks_fs::{ util::normalize_path, DirectoryContent, DirectoryEntry, FileSystemEntryType, FileSystemPath, LinkContent, LinkType, @@ -1322,7 +1322,7 @@ pub struct PatternMatches(Vec); /// symlinks when they are interested in that. #[turbo_tasks::function] pub async fn read_matches( - lookup_dir: Vc, + lookup_dir: ResolvedVc, prefix: RcStr, force_in_lookup_dir: bool, pattern: Vc, @@ -1468,17 +1468,17 @@ pub async fn read_matches( if let Some(pos) = pat.match_position(&prefix) { results.push(( pos, - PatternMatch::Directory(prefix.clone().into(), lookup_dir), + PatternMatch::Directory(prefix.clone().into(), *lookup_dir), )); } prefix.pop(); } if prefix.is_empty() { if let Some(pos) = pat.match_position("./") { - results.push((pos, PatternMatch::Directory("./".into(), lookup_dir))); + results.push((pos, PatternMatch::Directory("./".into(), *lookup_dir))); } if let Some(pos) = pat.could_match_position("./") { - nested.push((pos, read_matches(lookup_dir, "./".into(), false, pattern))); + nested.push((pos, read_matches(*lookup_dir, "./".into(), false, pattern))); } } else { prefix.push('/'); @@ -1486,7 +1486,7 @@ pub async fn read_matches( if let Some(pos) = pat.could_match_position(&prefix) { nested.push(( pos, - read_matches(lookup_dir, prefix.to_string().into(), false, pattern), + read_matches(*lookup_dir, prefix.to_string().into(), false, pattern), )); } prefix.pop(); @@ -1495,7 +1495,7 @@ pub async fn read_matches( if let Some(pos) = pat.could_match_position(&prefix) { nested.push(( pos, - read_matches(lookup_dir, prefix.to_string().into(), false, pattern), + read_matches(*lookup_dir, prefix.to_string().into(), false, pattern), )); } prefix.pop(); diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs index 3bdd572fd0eaef..190e745d0115f7 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs @@ -153,7 +153,7 @@ impl ModuleReference for EsmAssetReference { let ty = if matches!(self.annotations.module_type(), Some("json")) { EcmaScriptModulesReferenceSubType::ImportWithType(ImportWithType::Json) } else if let Some(part) = &self.export_name { - EcmaScriptModulesReferenceSubType::ImportPart(part.to_resolved().await?) + EcmaScriptModulesReferenceSubType::ImportPart(*part) } else { EcmaScriptModulesReferenceSubType::Import };