Skip to content

Commit

Permalink
More debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jul 29, 2024
1 parent dbc139c commit cdf9cf7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
19 changes: 19 additions & 0 deletions crates/turbopack-core/src/resolve/alias_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,25 @@ where
}
remaining.strip_suffix(suffix.len());

println!(
"request {:?}, prefix: {:?}, suffix: {:?}, wo prefix: {:?}, wo \
presuffix {:?}",
self.request,
std::str::from_utf8(prefix),
suffix,
{
let mut x = self.request.clone();
x.strip_prefix(prefix.len());
x
},
{
let mut x = self.request.clone();
x.strip_prefix(prefix.len());
x.strip_suffix(suffix.len());
x
}
);

let output = template.replace(&remaining);
return Some(AliasMatch::Replaced(output));
}
Expand Down
11 changes: 10 additions & 1 deletion crates/turbopack-core/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2565,13 +2565,18 @@ async fn handle_exports_imports_field(
let mut conditions_state = HashMap::new();

let query_str = query.await?;

let req = Pattern::Constant(format!("{}{}", path, query_str).into());

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

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

for value in values.iter() {
if value.add_results(
conditions,
Expand Down Expand Up @@ -2601,6 +2606,10 @@ 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
2 changes: 1 addition & 1 deletion crates/turbopack-core/src/resolve/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl ImportMap {
// relative requests must not match global wildcard aliases.

use turbo_tasks::debug::ValueDebug;
println!("lookup 1 {:?}", request.dbg().await?);
println!("lookup 1 {:?} {:?}", request.dbg().await?, self.map);
if let Some(request_pattern) = request.await?.request_pattern() {
println!(
"lookup 2 {:?} {:?}",
Expand Down

0 comments on commit cdf9cf7

Please sign in to comment.