Turbopack: Decode module component when tracing stack frames (#63070)

In addition to the file path, also url-decode the module name
(represented by the `id` query parameter).

Test Plan: Together with vercel/turbo#7682, this fixes `pnpm
testonly-dev test/development/basic/hmr.test.ts "should recover from
errors in the render function"`


Closes PACK-2700
This commit is contained in:
Will Binns-Smith 2024-03-08 16:43:19 -08:00 committed by GitHub
parent a2457c979b
commit 274c4b71db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -845,7 +845,13 @@ pub async fn project_trace_source(
"file" => {
let path = urlencoding::decode(url.path())?.to_string();
let module = url.query_pairs().find(|(k, _)| k == "id");
(path, module.map(|(_, m)| m.into_owned()))
(
path,
match module {
Some(module) => Some(urlencoding::decode(&module.1)?.into_owned()),
None => None,
},
)
}
_ => bail!("Unknown url scheme"),
},