Skip to content

Commit

Permalink
WIP disable 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 4d7072a
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 71 deletions.
40 changes: 20 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,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;
}
Expand Down
74 changes: 37 additions & 37 deletions crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?
// );
// }
// _ => {}
// }
Expand Down Expand Up @@ -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?
// );
// }
// _ => {}
// }
Expand Down Expand Up @@ -2265,12 +2265,12 @@ async fn resolve_module_request(
fragment: Vc<RcStr>,
) -> Result<Vc<ResolveResult>> {
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
Expand Down Expand Up @@ -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::<Result<Vec<_>>>()?;

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);
Expand All @@ -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 {
Expand All @@ -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() {
Expand All @@ -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(
Expand Down
16 changes: 8 additions & 8 deletions crates/turbopack-core/src/resolve/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ impl ImportMap {
// relative requests must not match global wildcard aliases.

use turbo_tasks::debug::ValueDebug;

Check failure on line 414 in crates/turbopack-core/src/resolve/options.rs

View workflow job for this annotation

GitHub Actions / Turbopack rust check

unused import: `turbo_tasks::debug::ValueDebug`

Check failure on line 414 in crates/turbopack-core/src/resolve/options.rs

View workflow job for this annotation

GitHub Actions / Turbopack rust check

unused import: `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| {
Expand All @@ -434,10 +434,10 @@ 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?);
// 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)
Expand Down
12 changes: 6 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,12 @@ impl AliasTemplate for SubpathValue {
.collect::<Result<Vec<_>>>()?,
),
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,
Expand Down

0 comments on commit 4d7072a

Please sign in to comment.