From 386d5c8310891c5dc9627abbf2374e60bb4e50d2 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 6 Jun 2024 23:37:53 -0400 Subject: refactor: remove `PermissionsContainer` in deno_runtime (#24119) Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work. --- ext/node/ops/worker_threads.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ext/node/ops/worker_threads.rs') diff --git a/ext/node/ops/worker_threads.rs b/ext/node/ops/worker_threads.rs index 18a4157d4..182ba0118 100644 --- a/ext/node/ops/worker_threads.rs +++ b/ext/node/ops/worker_threads.rs @@ -8,11 +8,10 @@ use deno_core::OpState; use deno_fs::FileSystemRc; use std::path::Path; use std::path::PathBuf; -use std::rc::Rc; use crate::resolution; +use crate::resolution::NodeResolverRc; use crate::NodePermissions; -use crate::NodeResolver; use crate::NpmResolverRc; fn ensure_read_permission

( @@ -22,8 +21,8 @@ fn ensure_read_permission

( where P: NodePermissions + 'static, { - let resolver = state.borrow::(); - let permissions = state.borrow::

(); + let resolver = state.borrow::().clone(); + let permissions = state.borrow_mut::

(); resolver.ensure_read_permission(permissions, file_path) } @@ -63,7 +62,7 @@ where if !fs.exists_sync(&url_path) { return Err(generic_error(format!("File not found [{:?}]", url_path))); } - let node_resolver = state.borrow::>(); + let node_resolver = state.borrow::(); match node_resolver.url_to_node_resolution(url)? { resolution::NodeResolution::Esm(u) => Ok(u.to_string()), resolution::NodeResolution::CommonJs(u) => wrap_cjs(u), -- cgit v1.2.3