diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-09-27 12:35:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-27 12:35:37 -0700 |
commit | fbddd5a2ebfb11dd376a751e9fc4cf09a6286ada (patch) | |
tree | 75c13ee9f26f61fe8c1d6f80df2580a523177c1b /ext/node/lib.rs | |
parent | a8d1ab52761516b7f9b6069d6e433254794ed48c (diff) |
fix(node): Pass NPM_PROCESS_STATE to subprocesses via temp file instead of env var (#25896)
Fixes https://github.com/denoland/deno/issues/25401. Fixes
https://github.com/denoland/deno/issues/25841. Fixes
https://github.com/denoland/deno/issues/25891.
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r-- | ext/node/lib.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs index af14e3e85..0c821ecf8 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -16,7 +16,6 @@ use deno_core::url::Url; use deno_core::v8; use deno_core::v8::ExternalReference; use deno_core::JsRuntime; -use deno_core::OpState; use deno_fs::sync::MaybeSend; use deno_fs::sync::MaybeSync; use node_resolver::NpmResolverRc; @@ -121,24 +120,6 @@ impl NodePermissions for deno_permissions::PermissionsContainer { } #[allow(clippy::disallowed_types)] -pub type NpmProcessStateProviderRc = - deno_fs::sync::MaybeArc<dyn NpmProcessStateProvider>; - -pub trait NpmProcessStateProvider: - std::fmt::Debug + MaybeSend + MaybeSync -{ - /// Gets a string containing the serialized npm state of the process. - /// - /// This will be set on the `DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE` environment - /// variable when doing a `child_process.fork`. The implementor can then check this environment - /// variable on startup to repopulate the internal npm state. - fn get_npm_process_state(&self) -> String { - // This method is only used in the CLI. - String::new() - } -} - -#[allow(clippy::disallowed_types)] pub type NodeRequireResolverRc = deno_fs::sync::MaybeArc<dyn NodeRequireResolver>; @@ -165,17 +146,9 @@ fn op_node_build_os() -> String { env!("TARGET").split('-').nth(2).unwrap().to_string() } -#[op2] -#[string] -fn op_npm_process_state(state: &mut OpState) -> Result<String, AnyError> { - let npm_resolver = state.borrow_mut::<NpmProcessStateProviderRc>(); - Ok(npm_resolver.get_npm_process_state()) -} - pub struct NodeExtInitServices { pub node_require_resolver: NodeRequireResolverRc, pub node_resolver: NodeResolverRc, - pub npm_process_state_provider: NpmProcessStateProviderRc, pub npm_resolver: NpmResolverRc, } @@ -374,7 +347,6 @@ deno_core::extension!(deno_node, ops::os::op_cpus<P>, ops::os::op_homedir<P>, op_node_build_os, - op_npm_process_state, ops::require::op_require_can_parse_as_esm, ops::require::op_require_init_paths, ops::require::op_require_node_module_paths<P>, @@ -662,7 +634,6 @@ deno_core::extension!(deno_node, state.put(init.node_require_resolver.clone()); state.put(init.node_resolver.clone()); state.put(init.npm_resolver.clone()); - state.put(init.npm_process_state_provider.clone()); } }, global_template_middleware = global_template_middleware, |