summaryrefslogtreecommitdiff
path: root/cli/args/mod.rs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-07-15 12:11:09 -0700
committerGitHub <noreply@github.com>2024-07-15 12:11:09 -0700
commit04f9db5b2217fe06f88e76146aac6362ff0b0b86 (patch)
treeaa4becb2529141de3e6bb8d3ba430f3c7e036902 /cli/args/mod.rs
parent29186d7e5963f2398b28ee2c043b27e4881075ef (diff)
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
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r--cli/args/mod.rs6
1 files changed, 3 insertions, 3 deletions
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<Option<NpmProcessState>> = 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)
});