diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-10 20:06:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 20:06:59 -0400 |
commit | 28aa489de9cd4f995ec2fc02e2c9d224e89f4c01 (patch) | |
tree | b316937a47fe9c8f9f6768bc13b9a686c07cf42f /cli/npm/resolvers/common.rs | |
parent | 5fd74bfa1c5ed514c3e19fdb2e8590fe251d3ee6 (diff) |
feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno
compile`. The npm packages are included in the binary and read from it via
a virtual file system. This also supports the `--node-modules-dir` flag,
dependencies specified in a package.json, and npm binary commands (ex.
`deno compile --unstable npm:cowsay`)
Closes #16632
Diffstat (limited to 'cli/npm/resolvers/common.rs')
-rw-r--r-- | cli/npm/resolvers/common.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/npm/resolvers/common.rs b/cli/npm/resolvers/common.rs index ccba00d43..fc040a7cc 100644 --- a/cli/npm/resolvers/common.rs +++ b/cli/npm/resolvers/common.rs @@ -12,6 +12,7 @@ use deno_core::futures; use deno_core::url::Url; use deno_npm::NpmPackageId; use deno_npm::NpmResolutionPackage; +use deno_runtime::deno_fs::FileSystem; use deno_runtime::deno_node::NodePermissions; use deno_runtime::deno_node::NodeResolutionMode; @@ -90,6 +91,7 @@ pub async fn cache_packages( } pub fn ensure_registry_read_permission( + fs: &Arc<dyn FileSystem>, permissions: &dyn NodePermissions, registry_path: &Path, path: &Path, @@ -101,8 +103,8 @@ pub fn ensure_registry_read_permission( .all(|c| !matches!(c, std::path::Component::ParentDir)) { // todo(dsherret): cache this? - if let Ok(registry_path) = std::fs::canonicalize(registry_path) { - match std::fs::canonicalize(path) { + if let Ok(registry_path) = fs.realpath_sync(registry_path) { + match fs.realpath_sync(path) { Ok(path) if path.starts_with(registry_path) => { return Ok(()); } |