diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-11-28 21:59:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-28 21:59:36 +0100 |
commit | fd51b2e506f3ea3cc49bfb2bcb19bc684f563f60 (patch) | |
tree | 7b8deca6a97e53048293d92cb471d1726e0e3a0f /cli/node/mod.rs | |
parent | 9202611e3695c7091f257b261af809697df959ab (diff) |
fix(npm): allow to inspect npm modules with --inspect-brk (#16841)
Diffstat (limited to 'cli/node/mod.rs')
-rw-r--r-- | cli/node/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs index fc4db33ee..fa6f0bdda 100644 --- a/cli/node/mod.rs +++ b/cli/node/mod.rs @@ -636,17 +636,22 @@ pub fn load_cjs_module_from_ext_node( js_runtime: &mut JsRuntime, module: &str, main: bool, + inspect_brk: bool, ) -> Result<(), AnyError> { fn escape_for_single_quote_string(text: &str) -> String { text.replace('\\', r"\\").replace('\'', r"\'") } let source_code = &format!( - r#"(function loadCjsModule(module) {{ + r#"(function loadCjsModule(module, inspectBrk) {{ + if (inspectBrk) {{ + Deno[Deno.internal].require.setInspectBrk(); + }} Deno[Deno.internal].require.Module._load(module, null, {main}); - }})('{module}');"#, + }})('{module}', {inspect_brk});"#, main = main, module = escape_for_single_quote_string(module), + inspect_brk = inspect_brk, ); js_runtime.execute_script(&located_script_name!(), source_code)?; |