diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-12-01 23:33:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 23:33:44 +0100 |
commit | f49d9556015a7d4c04e9db3f0c85d4399f6125ff (patch) | |
tree | 7719c7b14d559928b5177301e1e83522c2222c97 /cli/ops/runtime.rs | |
parent | 6e03917b51217524a894e5094933d551dc5ac0d9 (diff) |
fix(compile): disable source mapping of errors (#8581)
This commit disables source mapping of errors
for standalone binaries. Since applying source
maps relies on using file fetcher infrastructure
it's not feasible to use it for standalone binaries
that are not supposed to use that infrastructure.
Diffstat (limited to 'cli/ops/runtime.rs')
-rw-r--r-- | cli/ops/runtime.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs index 3fd73a67e..38b23f3b3 100644 --- a/cli/ops/runtime.rs +++ b/cli/ops/runtime.rs @@ -13,11 +13,18 @@ use deno_core::OpState; use deno_core::ZeroCopyBuf; use std::env; -pub fn init(rt: &mut deno_core::JsRuntime, main_module: ModuleSpecifier) { +type ApplySourceMaps = bool; + +pub fn init( + rt: &mut deno_core::JsRuntime, + main_module: ModuleSpecifier, + apply_source_maps: bool, +) { { let op_state = rt.op_state(); let mut state = op_state.borrow_mut(); state.put::<ModuleSpecifier>(main_module); + state.put::<ApplySourceMaps>(apply_source_maps); } super::reg_json_sync(rt, "op_start", op_start); super::reg_json_sync(rt, "op_main_module", op_main_module); @@ -29,10 +36,12 @@ fn op_start( _args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<Value, AnyError> { + let apply_source_maps = *state.borrow::<ApplySourceMaps>(); let gs = &super::program_state(state); Ok(json!({ "args": gs.flags.argv.clone(), + "applySourceMaps": apply_source_maps, "debugFlag": gs.flags.log_level.map_or(false, |l| l == log::Level::Debug), "denoVersion": version::deno(), "noColor": !colors::use_color(), |