Skip to content

Commit

Permalink
Remove debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jul 30, 2024
1 parent 4c2dbed commit fdf029f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 93 deletions.
20 changes: 0 additions & 20 deletions crates/turbopack-core/src/resolve/alias_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,26 +483,6 @@ 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)
);
if !remaining_suffix.ends_with(&**suffix) {
continue;
}
Expand Down
58 changes: 1 addition & 57 deletions crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,26 +1504,13 @@ async fn handle_after_resolve_plugins(
.cell())
}

use turbo_tasks::debug::ValueDebug;
#[turbo_tasks::function]
async fn resolve_internal(
lookup_path: Vc<FileSystemPath>,
request: Vc<Request>,
options: Vc<ResolveOptions>,
) -> Result<Vc<ResolveResult>> {
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?
);
// }
// _ => {}
// }
Ok(x)
resolve_internal_inline(lookup_path, request, options).await
}

fn resolve_internal_boxed(
Expand Down Expand Up @@ -1558,17 +1545,6 @@ async fn resolve_internal_inline(
// Apply import mappings if provided
if let Some(import_map) = &options_value.import_map {
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?
);
// }
// _ => {}
// }
if !matches!(result, ImportMapResult::NoEntry) {
has_alias = true;
let resolved_result = resolve_import_map_result(
Expand Down Expand Up @@ -2264,15 +2240,6 @@ async fn resolve_module_request(
query: Vc<RcStr>,
fragment: Vc<RcStr>,
) -> Result<Vc<ResolveResult>> {
if module == "@" {
println!(
"resolve_module_request {:?} {:?} {:?}",
lookup_path.await?.path,
module,
path
);
}

// Check alias field for module aliases first
if let Some(result) = apply_in_package(
lookup_path,
Expand Down Expand Up @@ -2606,20 +2573,11 @@ 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
);

let values = exports_imports_field
.lookup(&req)
.map(|m| m.try_into_self())
.collect::<Result<Vec<_>>>()?;

println!("handle_exports_imports_field values {:?}", values);

for value in values.iter() {
// println!("handle_exports_imports_field {:?}", value);

Expand All @@ -2634,23 +2592,13 @@ async fn handle_exports_imports_field(
}
}

println!(
"handle_exports_imports_field list {:?} {:?}",
results, conditions_state
);

let mut resolved_results = Vec::new();
for (result_path, conditions) in results {
if let Some(result_path) = result_path.with_normalized_path() {
let request = Request::parse(Value::new(Pattern::Concatenation(vec![
Pattern::Constant("./".into()),
result_path,
])));
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() {
Expand All @@ -2663,10 +2611,6 @@ async fn handle_exports_imports_field(
}
}

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(
resolved_results,
Expand Down
10 changes: 0 additions & 10 deletions crates/turbopack-core/src/resolve/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,9 @@ impl ImportMap {
lookup_path: Vc<FileSystemPath>,
request: Vc<Request>,
) -> Result<ImportMapResult> {
// TODO lookup pattern
// relative requests must not match global wildcard aliases.

use turbo_tasks::debug::ValueDebug;
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()
);
let mut lookup = if request_pattern.must_match("./") {
self.map
.lookup_with_prefix_predicate(&request_pattern, |prefix| {
Expand All @@ -434,10 +426,8 @@ impl ImportMap {
};
if let Some(result) = lookup.next() {
let x: Vc<ReplacedImportMapping> = result.try_join_into_self().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");
}
}
Ok(ImportMapResult::NoEntry)
Expand Down
6 changes: 0 additions & 6 deletions crates/turbopack-core/src/resolve/remap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ impl AliasTemplate for SubpathValue {
.collect::<Result<Vec<_>>>()?,
),
SubpathValue::Result(value) => {
println!(
"AliasTemplate::replace {:?} {:?} {:?}",
capture,
value,
capture.spread_into_star(value)
);
SubpathValueResult::Result(capture.spread_into_star(value))
}
SubpathValue::Excluded => SubpathValueResult::Excluded,
Expand Down

0 comments on commit fdf029f

Please sign in to comment.