diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-04-06 21:41:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-06 21:41:19 -0400 |
commit | 5c7f76c570bc099c4e60b38443194c1890808a7f (patch) | |
tree | 99d5ebed160929d6812346f60ec902284e8f83af /cli/args/lockfile.rs | |
parent | 0dca0c5196249c5f947de9ced572967872c0ad6e (diff) |
fix(npm): reload an npm package's dependency's information when version not found (#18622)
This reloads an npm package's dependency's information when a
version/version req/tag is not found.
This PR applies only to dependencies of npm packages. It does NOT yet
cause npm specifiers to have their dependency information cache busted.
That requires a different solution, but this should help cache bust in
more scenarios.
Part of #16901, but doesn't close it yet
Diffstat (limited to 'cli/args/lockfile.rs')
-rw-r--r-- | cli/args/lockfile.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index 31519aee3..29c01b252 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -117,10 +117,11 @@ pub async fn snapshot_from_lockfile( let mut version_infos = FuturesOrdered::from_iter(packages.iter().map(|p| p.pkg_id.nv.clone()).map( |nv| async move { - match api.package_version_info(&nv).await? { - Some(version_info) => Ok(version_info), - None => { - bail!("could not find '{}' specified in the lockfile. Maybe try again with --reload", nv); + let package_info = api.package_info(&nv.name).await?; + match package_info.version_info(&nv) { + Ok(version_info) => Ok(version_info), + Err(err) => { + bail!("Could not find '{}' specified in the lockfile. Maybe try again with --reload", err.0); } } }, |