From 5c7f76c570bc099c4e60b38443194c1890808a7f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 6 Apr 2023 21:41:19 -0400 Subject: 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 --- cli/args/lockfile.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cli/args') 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); } } }, -- cgit v1.2.3