mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
fix: Provide source map for internal extension code (#22716)
This commit adds support for source maps for `ext/` crates that are authored in TypeScript. As a result any exceptions thrown from eg. `ext/node` will now have correct stack traces. This is only enabled in debug mode as it adds about 2Mb to the binary.
This commit is contained in:
parent
6ba0b7952d
commit
8b1f160bb5
1 changed files with 6 additions and 1 deletions
|
@ -97,8 +97,13 @@ pub fn maybe_transpile_source(
|
|||
let transpiled_source = parsed.transpile(&deno_ast::EmitOptions {
|
||||
imports_not_used_as_values: deno_ast::ImportsNotUsedAsValues::Remove,
|
||||
inline_source_map: false,
|
||||
source_map: cfg!(debug_assertions),
|
||||
..Default::default()
|
||||
})?;
|
||||
|
||||
Ok((transpiled_source.text.into(), None))
|
||||
let maybe_source_map: Option<SourceMapData> = transpiled_source
|
||||
.source_map
|
||||
.map(|sm| sm.into_bytes().into());
|
||||
|
||||
Ok((transpiled_source.text.into(), maybe_source_map))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue