Commit 229cc4ca authored by Benjamin Woodruff's avatar Benjamin Woodruff

Turbopack: Remove dead `resolved_map` option for resolver

parent dae80fb7
...@@ -41,10 +41,7 @@ use crate::{ ...@@ -41,10 +41,7 @@ use crate::{
next_client::runtime_entry::{RuntimeEntries, RuntimeEntry}, next_client::runtime_entry::{RuntimeEntries, RuntimeEntry},
next_config::NextConfig, next_config::NextConfig,
next_font::local::NextFontLocalResolvePlugin, next_font::local::NextFontLocalResolvePlugin,
next_import_map::{ next_import_map::{get_next_client_fallback_import_map, get_next_client_import_map},
get_next_client_fallback_import_map, get_next_client_import_map,
get_next_client_resolved_map,
},
next_shared::{ next_shared::{
resolve::{ resolve::{
ModuleFeatureReportResolvePlugin, NextSharedRuntimeResolvePlugin, ModuleFeatureReportResolvePlugin, NextSharedRuntimeResolvePlugin,
...@@ -146,10 +143,6 @@ pub async fn get_client_resolve_options_context( ...@@ -146,10 +143,6 @@ pub async fn get_client_resolve_options_context(
let next_client_fallback_import_map = get_next_client_fallback_import_map(ty.clone()) let next_client_fallback_import_map = get_next_client_fallback_import_map(ty.clone())
.to_resolved() .to_resolved()
.await?; .await?;
let next_client_resolved_map =
get_next_client_resolved_map(project_path.clone(), project_path.clone(), *mode.await?)
.to_resolved()
.await?;
let mut custom_conditions: Vec<_> = mode.await?.custom_resolve_conditions().collect(); let mut custom_conditions: Vec<_> = mode.await?.custom_resolve_conditions().collect();
if *next_config.enable_cache_components().await? { if *next_config.enable_cache_components().await? {
...@@ -161,7 +154,6 @@ pub async fn get_client_resolve_options_context( ...@@ -161,7 +154,6 @@ pub async fn get_client_resolve_options_context(
custom_conditions, custom_conditions,
import_map: Some(next_client_import_map), import_map: Some(next_client_import_map),
fallback_import_map: Some(next_client_fallback_import_map), fallback_import_map: Some(next_client_fallback_import_map),
resolved_map: Some(next_client_resolved_map),
browser: true, browser: true,
module: true, module: true,
before_resolve_plugins: vec![ before_resolve_plugins: vec![
......
...@@ -12,7 +12,7 @@ use turbopack_core::{ ...@@ -12,7 +12,7 @@ use turbopack_core::{
resolve::{ resolve::{
AliasPattern, ExternalTraced, ExternalType, ResolveAliasMap, SubpathValue, AliasPattern, ExternalTraced, ExternalType, ResolveAliasMap, SubpathValue,
node::node_cjs_resolve_options, node::node_cjs_resolve_options,
options::{ConditionValue, ImportMap, ImportMapping, ResolvedMap}, options::{ConditionValue, ImportMap, ImportMapping},
parse::Request, parse::Request,
pattern::Pattern, pattern::Pattern,
resolve, resolve,
...@@ -596,18 +596,6 @@ async fn insert_unsupported_node_internal_aliases(import_map: &mut ImportMap) -> ...@@ -596,18 +596,6 @@ async fn insert_unsupported_node_internal_aliases(import_map: &mut ImportMap) ->
Ok(()) Ok(())
} }
pub fn get_next_client_resolved_map(
_context: FileSystemPath,
_root: FileSystemPath,
_mode: NextMode,
) -> Vc<ResolvedMap> {
let glob_mappings = vec![];
ResolvedMap {
by_glob: glob_mappings,
}
.cell()
}
static NEXT_ALIASES: LazyLock<[(RcStr, RcStr); 23]> = LazyLock::new(|| { static NEXT_ALIASES: LazyLock<[(RcStr, RcStr); 23]> = LazyLock::new(|| {
[ [
(rcstr!("assert"), rcstr!("next/dist/compiled/assert")), (rcstr!("assert"), rcstr!("next/dist/compiled/assert")),
......
...@@ -1873,8 +1873,6 @@ async fn resolve_internal_inline( ...@@ -1873,8 +1873,6 @@ async fn resolve_internal_inline(
resolved( resolved(
RequestKey::new(matched_pattern.clone()), RequestKey::new(matched_pattern.clone()),
path.clone(), path.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -1902,7 +1900,6 @@ async fn resolve_internal_inline( ...@@ -1902,7 +1900,6 @@ async fn resolve_internal_inline(
} => { } => {
resolve_relative_request( resolve_relative_request(
lookup_path.clone(), lookup_path.clone(),
request,
options, options,
options_value, options_value,
path, path,
...@@ -1920,7 +1917,6 @@ async fn resolve_internal_inline( ...@@ -1920,7 +1917,6 @@ async fn resolve_internal_inline(
} => { } => {
resolve_module_request( resolve_module_request(
lookup_path.clone(), lookup_path.clone(),
request,
options, options,
options_value, options_value,
module, module,
...@@ -2214,7 +2210,6 @@ async fn resolve_into_folder( ...@@ -2214,7 +2210,6 @@ async fn resolve_into_folder(
#[tracing::instrument(level = Level::TRACE, skip_all)] #[tracing::instrument(level = Level::TRACE, skip_all)]
async fn resolve_relative_request( async fn resolve_relative_request(
lookup_path: FileSystemPath, lookup_path: FileSystemPath,
request: Vc<Request>,
options: Vc<ResolveOptions>, options: Vc<ResolveOptions>,
options_value: &ResolveOptions, options_value: &ResolveOptions,
path_pattern: &Pattern, path_pattern: &Pattern,
...@@ -2337,8 +2332,6 @@ async fn resolve_relative_request( ...@@ -2337,8 +2332,6 @@ async fn resolve_relative_request(
resolved( resolved(
RequestKey::new(matched_pattern.into()), RequestKey::new(matched_pattern.into()),
path.clone(), path.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -2354,8 +2347,6 @@ async fn resolve_relative_request( ...@@ -2354,8 +2347,6 @@ async fn resolve_relative_request(
resolved( resolved(
RequestKey::new(matched_pattern.into()), RequestKey::new(matched_pattern.into()),
path.clone(), path.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -2374,8 +2365,6 @@ async fn resolve_relative_request( ...@@ -2374,8 +2365,6 @@ async fn resolve_relative_request(
resolved( resolved(
RequestKey::new(matched_pattern.into()), RequestKey::new(matched_pattern.into()),
path.clone(), path.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -2392,8 +2381,6 @@ async fn resolve_relative_request( ...@@ -2392,8 +2381,6 @@ async fn resolve_relative_request(
resolved( resolved(
RequestKey::new(matched_pattern.clone()), RequestKey::new(matched_pattern.clone()),
path.clone(), path.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -2558,7 +2545,6 @@ async fn find_self_reference( ...@@ -2558,7 +2545,6 @@ async fn find_self_reference(
#[tracing::instrument(level = Level::TRACE, skip_all)] #[tracing::instrument(level = Level::TRACE, skip_all)]
async fn resolve_module_request( async fn resolve_module_request(
lookup_path: FileSystemPath, lookup_path: FileSystemPath,
request: Vc<Request>,
options: Vc<ResolveOptions>, options: Vc<ResolveOptions>,
options_value: &ResolveOptions, options_value: &ResolveOptions,
module: &Pattern, module: &Pattern,
...@@ -2642,8 +2628,6 @@ async fn resolve_module_request( ...@@ -2642,8 +2628,6 @@ async fn resolve_module_request(
let resolved = resolved( let resolved = resolved(
RequestKey::new(rcstr!(".")), RequestKey::new(rcstr!(".")),
file.clone(), file.clone(),
lookup_path.clone(),
request,
options_value, options_value,
options, options,
query.clone(), query.clone(),
...@@ -2861,8 +2845,6 @@ async fn resolve_import_map_result( ...@@ -2861,8 +2845,6 @@ async fn resolve_import_map_result(
async fn resolved( async fn resolved(
request_key: RequestKey, request_key: RequestKey,
fs_path: FileSystemPath, fs_path: FileSystemPath,
original_context: FileSystemPath,
original_request: Vc<Request>,
options_value: &ResolveOptions, options_value: &ResolveOptions,
options: Vc<ResolveOptions>, options: Vc<ResolveOptions>,
query: RcStr, query: RcStr,
...@@ -2889,25 +2871,6 @@ async fn resolved( ...@@ -2889,25 +2871,6 @@ async fn resolved(
return Ok(result); return Ok(result);
} }
if let Some(resolved_map) = options_value.resolved_map {
let result = resolved_map
.lookup(path.clone(), original_context.clone(), original_request)
.await?;
let resolved_result = resolve_import_map_result(
&result,
path.parent(),
original_context.clone(),
original_request,
options,
query.clone(),
)
.await?;
if let Some(result) = resolved_result {
return Ok(result);
}
}
let source = ResolvedVc::upcast( let source = ResolvedVc::upcast(
FileSource::new_with_query_and_fragment(path.clone(), query, fragment) FileSource::new_with_query_and_fragment(path.clone(), query, fragment)
.to_resolved() .to_resolved()
......
...@@ -7,7 +7,7 @@ use turbo_tasks::{ ...@@ -7,7 +7,7 @@ use turbo_tasks::{
FxIndexSet, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueToString, Vc, FxIndexSet, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueToString, Vc,
debug::ValueDebugFormat, trace::TraceRawVcs, debug::ValueDebugFormat, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::{FileSystemPath, glob::Glob}; use turbo_tasks_fs::FileSystemPath;
use super::{ use super::{
AliasPattern, ExternalType, ResolveResult, ResolveResultItem, AliasPattern, ExternalType, ResolveResult, ResolveResultItem,
...@@ -401,12 +401,6 @@ impl ImportMap { ...@@ -401,12 +401,6 @@ impl ImportMap {
} }
} }
#[turbo_tasks::value(shared)]
#[derive(Clone, Default)]
pub struct ResolvedMap {
pub by_glob: Vec<(FileSystemPath, ResolvedVc<Glob>, ResolvedVc<ImportMapping>)>,
}
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Clone)] #[derive(Clone)]
pub enum ImportMapResult { pub enum ImportMapResult {
...@@ -594,32 +588,6 @@ impl ImportMap { ...@@ -594,32 +588,6 @@ impl ImportMap {
} }
} }
#[turbo_tasks::value_impl]
impl ResolvedMap {
#[turbo_tasks::function]
pub async fn lookup(
&self,
resolved: FileSystemPath,
lookup_path: FileSystemPath,
request: Vc<Request>,
) -> Result<Vc<ImportMapResult>> {
for (root, glob, mapping) in self.by_glob.iter() {
if let Some(path) = root.get_path_to(&resolved)
&& glob.await?.matches(path)
{
return Ok(import_mapping_to_result(
*mapping.convert().await?,
lookup_path,
request,
)
.await?
.cell());
}
}
Ok(ImportMapResult::NoEntry.cell())
}
}
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
pub struct ResolveOptions { pub struct ResolveOptions {
...@@ -643,7 +611,6 @@ pub struct ResolveOptions { ...@@ -643,7 +611,6 @@ pub struct ResolveOptions {
pub import_map: Option<ResolvedVc<ImportMap>>, pub import_map: Option<ResolvedVc<ImportMap>>,
/// An import map to use when a request is otherwise unresolvable. /// An import map to use when a request is otherwise unresolvable.
pub fallback_import_map: Option<ResolvedVc<ImportMap>>, pub fallback_import_map: Option<ResolvedVc<ImportMap>>,
pub resolved_map: Option<ResolvedVc<ResolvedMap>>,
pub before_resolve_plugins: Vec<ResolvedVc<Box<dyn BeforeResolvePlugin>>>, pub before_resolve_plugins: Vec<ResolvedVc<Box<dyn BeforeResolvePlugin>>>,
pub after_resolve_plugins: Vec<ResolvedVc<Box<dyn AfterResolvePlugin>>>, pub after_resolve_plugins: Vec<ResolvedVc<Box<dyn AfterResolvePlugin>>>,
/// Support resolving *.js requests to *.ts files /// Support resolving *.js requests to *.ts files
......
...@@ -200,7 +200,6 @@ async fn base_resolve_options( ...@@ -200,7 +200,6 @@ async fn base_resolve_options(
}, },
default_files: vec![rcstr!("index")], default_files: vec![rcstr!("index")],
import_map: Some(import_map), import_map: Some(import_map),
resolved_map: opt.resolved_map,
after_resolve_plugins: opt.after_resolve_plugins.clone(), after_resolve_plugins: opt.after_resolve_plugins.clone(),
before_resolve_plugins: opt.before_resolve_plugins.clone(), before_resolve_plugins: opt.before_resolve_plugins.clone(),
loose_errors: opt.loose_errors, loose_errors: opt.loose_errors,
......
...@@ -6,7 +6,7 @@ use turbopack_core::{ ...@@ -6,7 +6,7 @@ use turbopack_core::{
condition::ContextCondition, condition::ContextCondition,
environment::Environment, environment::Environment,
resolve::{ resolve::{
options::{ImportMap, ResolvedMap}, options::ImportMap,
plugin::{AfterResolvePlugin, BeforeResolvePlugin}, plugin::{AfterResolvePlugin, BeforeResolvePlugin},
}, },
}; };
...@@ -67,9 +67,6 @@ pub struct ResolveOptionsContext { ...@@ -67,9 +67,6 @@ pub struct ResolveOptionsContext {
/// any mapping defined within will take precedence over any other. /// any mapping defined within will take precedence over any other.
pub fallback_import_map: Option<ResolvedVc<ImportMap>>, pub fallback_import_map: Option<ResolvedVc<ImportMap>>,
#[serde(default)] #[serde(default)]
/// An additional resolved map to use after modules have been resolved.
pub resolved_map: Option<ResolvedVc<ResolvedMap>>,
#[serde(default)]
/// A list of rules to use a different resolve option context for certain /// A list of rules to use a different resolve option context for certain
/// context paths. The first matching is used. /// context paths. The first matching is used.
pub rules: Vec<(ContextCondition, ResolvedVc<ResolveOptionsContext>)>, pub rules: Vec<(ContextCondition, ResolvedVc<ResolveOptionsContext>)>,
......
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