From 4d7072ab44688f6b348eed26441abccd112e2249 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:04:53 +0200 Subject: [PATCH] WIP disable debug logging --- .../turbopack-core/src/resolve/alias_map.rs | 40 +++++----- crates/turbopack-core/src/resolve/mod.rs | 74 +++++++++---------- crates/turbopack-core/src/resolve/options.rs | 16 ++-- crates/turbopack-core/src/resolve/remap.rs | 12 +-- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/crates/turbopack-core/src/resolve/alias_map.rs b/crates/turbopack-core/src/resolve/alias_map.rs index 32af8aeb78c8bc..af03d597519820 100644 --- a/crates/turbopack-core/src/resolve/alias_map.rs +++ b/crates/turbopack-core/src/resolve/alias_map.rs @@ -483,26 +483,26 @@ where let mut remaining = self.request.clone(); remaining.strip_prefix(prefix.len()); let remaining_suffix = remaining.constant_suffix(); - println!( - "AliasKey::Wildcard request {:?}, prefix: {:?}, suffix: {:?}, wo \ - prefix: {:?}, remaining_suffix {:?}, wo presuffix {:?}, skipped {:?}", - self.request, - std::str::from_utf8(prefix), - suffix, - { - let mut x = self.request.clone(); - x.strip_prefix(prefix.len()); - x - }, - remaining_suffix, - { - let mut x = self.request.clone(); - x.strip_prefix(prefix.len()); - x.strip_suffix(suffix.len()); - x - }, - !remaining_suffix.ends_with(&**suffix) - ); + // println!( + // "AliasKey::Wildcard request {:?}, prefix: {:?}, suffix: {:?}, wo \ + // prefix: {:?}, remaining_suffix {:?}, wo presuffix {:?}, skipped + // {:?}", self.request, + // std::str::from_utf8(prefix), + // suffix, + // { + // let mut x = self.request.clone(); + // x.strip_prefix(prefix.len()); + // x + // }, + // remaining_suffix, + // { + // let mut x = self.request.clone(); + // x.strip_prefix(prefix.len()); + // x.strip_suffix(suffix.len()); + // x + // }, + // !remaining_suffix.ends_with(&**suffix) + // ); if !remaining_suffix.ends_with(&**suffix) { continue; } diff --git a/crates/turbopack-core/src/resolve/mod.rs b/crates/turbopack-core/src/resolve/mod.rs index f1bc8cd103b2ba..9accbb8badbd1b 100644 --- a/crates/turbopack-core/src/resolve/mod.rs +++ b/crates/turbopack-core/src/resolve/mod.rs @@ -1514,12 +1514,12 @@ async fn resolve_internal( let x = resolve_internal_inline(lookup_path, request, options).await?; // match &*request.await? { // Request::Module { module, .. } if module == "@" => { - println!( - "resolve_internal {:?} {:?} {:?}", - lookup_path.await?.path, - request.dbg().await?, - x.dbg().await? - ); + // println!( + // "resolve_internal {:?} {:?} {:?}", + // lookup_path.await?.path, + // request.dbg().await?, + // x.dbg().await? + // ); // } // _ => {} // } @@ -1560,12 +1560,12 @@ async fn resolve_internal_inline( let result = import_map.await?.lookup(lookup_path, request).await?; // match &*request.await? { // Request::Module { module, .. } if module == "@" => { - println!( - "resolve_internal_inline import_map {:?} {:?} {:?}", - lookup_path.await?.path, - request.dbg().await?, - result.clone().cell().dbg().await? - ); + // println!( + // "resolve_internal_inline import_map {:?} {:?} {:?}", + // lookup_path.await?.path, + // request.dbg().await?, + // result.clone().cell().dbg().await? + // ); // } // _ => {} // } @@ -2265,12 +2265,12 @@ async fn resolve_module_request( fragment: Vc, ) -> Result> { if module == "@" { - println!( - "resolve_module_request {:?} {:?} {:?}", - lookup_path.await?.path, - module, - path - ); + // println!( + // "resolve_module_request {:?} {:?} {:?}", + // lookup_path.await?.path, + // module, + // path + // ); } // Check alias field for module aliases first @@ -2606,19 +2606,19 @@ async fn handle_exports_imports_field( let query_str = query.await?; let req = Pattern::Constant(format!("{}{}", path, query_str).into()); - println!( - "handle_exports_imports_field req {:?} {:?} {:?}", - req, - req.constant_prefix(), - exports_imports_field - ); + // println!( + // "handle_exports_imports_field req {:?} {:?} {:?}", + // req, + // req.constant_prefix(), + // exports_imports_field + // ); let values = exports_imports_field .lookup(&req) .map(|m| m.try_into_self()) .collect::>>()?; - println!("handle_exports_imports_field values {:?}", values); + // println!("handle_exports_imports_field values {:?}", values); for value in values.iter() { // println!("handle_exports_imports_field {:?}", value); @@ -2634,10 +2634,10 @@ async fn handle_exports_imports_field( } } - println!( - "handle_exports_imports_field list {:?} {:?}", - results, conditions_state - ); + // println!( + // "handle_exports_imports_field list {:?} {:?}", + // results, conditions_state + // ); let mut resolved_results = Vec::new(); for (result_path, conditions) in results { @@ -2646,11 +2646,11 @@ async fn handle_exports_imports_field( Pattern::Constant("./".into()), result_path, ]))); - println!( - "handle_exports_imports_field reresolve {:?} {:?}", - package_path.await?.path, - request.dbg().await? - ); + // println!( + // "handle_exports_imports_field reresolve {:?} {:?}", + // package_path.await?.path, + // request.dbg().await? + // ); let resolve_result = resolve_internal_boxed(package_path, request, options).await?; if conditions.is_empty() { @@ -2663,9 +2663,9 @@ async fn handle_exports_imports_field( } } - for r in &resolved_results { - println!("handle_exports_imports_field result {:?}", r.dbg().await?); - } + // for r in &resolved_results { + // println!("handle_exports_imports_field result {:?}", r.dbg().await?); + // } // other options do not apply anymore when an exports field exist Ok(merge_results_with_affecting_sources( diff --git a/crates/turbopack-core/src/resolve/options.rs b/crates/turbopack-core/src/resolve/options.rs index 4fa9f3baaa403c..55f46dcc2f0dbd 100644 --- a/crates/turbopack-core/src/resolve/options.rs +++ b/crates/turbopack-core/src/resolve/options.rs @@ -412,13 +412,13 @@ impl ImportMap { // relative requests must not match global wildcard aliases. use turbo_tasks::debug::ValueDebug; - println!("lookup 1 {:?} {:?}", request.dbg().await?, self.map); + // println!("lookup 1 {:?} {:?}", request.dbg().await?, self.map); if let Some(request_pattern) = request.await?.request_pattern() { - println!( - "lookup 2 {:?} {:?}", - request_pattern, - request_pattern.constant_prefix() - ); + // println!( + // "lookup 2 {:?} {:?}", + // request_pattern, + // request_pattern.constant_prefix() + // ); let mut lookup = if request_pattern.must_match("./") { self.map .lookup_with_prefix_predicate(&request_pattern, |prefix| { @@ -434,10 +434,10 @@ impl ImportMap { }; if let Some(result) = lookup.next() { let x: Vc = result.try_join_into_self().await?; - println!("lookup 3 {:?} : {:?}", request_pattern, x.dbg().await?); + // println!("lookup 3 {:?} : {:?}", request_pattern, x.dbg().await?); return import_mapping_to_result(x, lookup_path, request).await; } else { - println!("lookup 3 {:?} : {:?}", request_pattern, "None"); + // println!("lookup 3 {:?} : {:?}", request_pattern, "None"); } } Ok(ImportMapResult::NoEntry) diff --git a/crates/turbopack-core/src/resolve/remap.rs b/crates/turbopack-core/src/resolve/remap.rs index aec3a65f1625a7..b5b94861ad69f0 100644 --- a/crates/turbopack-core/src/resolve/remap.rs +++ b/crates/turbopack-core/src/resolve/remap.rs @@ -121,12 +121,12 @@ impl AliasTemplate for SubpathValue { .collect::>>()?, ), SubpathValue::Result(value) => { - println!( - "AliasTemplate::replace {:?} {:?} {:?}", - capture, - value, - capture.spread_into_star(value) - ); + // println!( + // "AliasTemplate::replace {:?} {:?} {:?}", + // capture, + // value, + // capture.spread_into_star(value) + // ); SubpathValueResult::Result(capture.spread_into_star(value)) } SubpathValue::Excluded => SubpathValueResult::Excluded,