From 04f9db5b2217fe06f88e76146aac6362ff0b0b86 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:11:09 -0700 Subject: fix(node): Fix `--allow-scripts` with no `deno.json` (#24533) We would resolve the wrong package.json, resulting in an inability to run CJS (or other node-mode) scripts --- cli/args/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cli/args') diff --git a/cli/args/mod.rs b/cli/args/mod.rs index aaa8185af..8b1b8e0c3 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -722,15 +722,15 @@ pub enum NpmProcessStateKind { Byonm, } -const RESOLUTION_STATE_ENV_VAR_NAME: &str = +pub(crate) const NPM_RESOLUTION_STATE_ENV_VAR_NAME: &str = "DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE"; static NPM_PROCESS_STATE: Lazy> = Lazy::new(|| { - let state = std::env::var(RESOLUTION_STATE_ENV_VAR_NAME).ok()?; + let state = std::env::var(NPM_RESOLUTION_STATE_ENV_VAR_NAME).ok()?; let state: NpmProcessState = serde_json::from_str(&state).ok()?; // remove the environment variable so that sub processes // that are spawned do not also use this. - std::env::remove_var(RESOLUTION_STATE_ENV_VAR_NAME); + std::env::remove_var(NPM_RESOLUTION_STATE_ENV_VAR_NAME); Some(state) }); -- cgit v1.2.3