mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
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>
This commit is contained in:
parent
ad22336245
commit
41f618a1df
25 changed files with 300 additions and 61 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue