diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-05-17 17:38:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 17:38:50 -0400 |
commit | 41f618a1df6bb8c66d7968ac64456139b9f4c197 (patch) | |
tree | dbcc67e009cf70099be82ea3774669e8aefc6023 /cli/npm/resolvers/local.rs | |
parent | ad223362451688c13a4441563210f58bdb046a78 (diff) |
fix(npm): improved optional dependency support (#19135)
Note: If the package information has already been cached, then this
requires running with `--reload` or for the registry information to be
fetched some other way (ex. the cache busting).
Closes #15544
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/npm/resolvers/local.rs')
-rw-r--r-- | cli/npm/resolvers/local.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs index b2ad08357..e14d7e0c5 100644 --- a/cli/npm/resolvers/local.rs +++ b/cli/npm/resolvers/local.rs @@ -24,6 +24,7 @@ use deno_core::url::Url; use deno_npm::resolution::NpmResolutionSnapshot; use deno_npm::NpmPackageCacheFolderId; use deno_npm::NpmPackageId; +use deno_npm::NpmSystemInfo; use deno_runtime::deno_core::futures; use deno_runtime::deno_fs; use deno_runtime::deno_node::NodePermissions; @@ -52,6 +53,7 @@ pub struct LocalNpmPackageResolver { registry_url: Url, root_node_modules_path: PathBuf, root_node_modules_url: Url, + system_info: NpmSystemInfo, } impl LocalNpmPackageResolver { @@ -62,6 +64,7 @@ impl LocalNpmPackageResolver { registry_url: Url, node_modules_folder: PathBuf, resolution: Arc<NpmResolution>, + system_info: NpmSystemInfo, ) -> Self { Self { fs, @@ -72,6 +75,7 @@ impl LocalNpmPackageResolver { root_node_modules_url: Url::from_directory_path(&node_modules_folder) .unwrap(), root_node_modules_path: node_modules_folder, + system_info, } } @@ -205,6 +209,7 @@ impl NpmPackageFsResolver for LocalNpmPackageResolver { &self.progress_bar, &self.registry_url, &self.root_node_modules_path, + &self.system_info, ) .await } @@ -230,6 +235,7 @@ async fn sync_resolution_with_fs( progress_bar: &ProgressBar, registry_url: &Url, root_node_modules_dir_path: &Path, + system_info: &NpmSystemInfo, ) -> Result<(), AnyError> { if snapshot.is_empty() { return Ok(()); // don't create the directory @@ -254,7 +260,8 @@ async fn sync_resolution_with_fs( // Copy (hardlink in future) <global_registry_cache>/<package_id>/ to // node_modules/.deno/<package_folder_id_folder_name>/node_modules/<package_name> let sync_download = should_sync_download(); - let mut package_partitions = snapshot.all_packages_partitioned(); + let mut package_partitions = + snapshot.all_system_packages_partitioned(system_info); if sync_download { // we're running the tests not with --quiet // and we want the output to be deterministic |