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/args/lockfile.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/args/lockfile.rs')
-rw-r--r-- | cli/args/lockfile.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index 8cb21781a..aa7e51fa1 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -107,8 +107,12 @@ pub async fn snapshot_from_lockfile( packages.push(SerializedNpmResolutionSnapshotPackage { pkg_id, - dist: Default::default(), // temporarily empty dependencies, + // temporarily empty + os: Default::default(), + cpu: Default::default(), + dist: Default::default(), + optional_dependencies: Default::default(), }); } (root_packages, packages) @@ -131,11 +135,17 @@ pub async fn snapshot_from_lockfile( })) }; let mut version_infos = get_version_infos(); - let mut i = 0; while let Some(result) = version_infos.next().await { - packages[i].dist = match result { - Ok(version_info) => version_info.dist, + match result { + Ok(version_info) => { + let mut package = &mut packages[i]; + package.dist = version_info.dist; + package.cpu = version_info.cpu; + package.os = version_info.os; + package.optional_dependencies = + version_info.optional_dependencies.into_keys().collect(); + } Err(err) => { if api.mark_force_reload() { // reset and try again @@ -146,7 +156,7 @@ pub async fn snapshot_from_lockfile( return Err(err); } } - }; + } i += 1; } |