fix(package-requester): update resolution when package is updated

ref #3188
This commit is contained in:
Zoltan Kochan
2021-03-05 04:17:08 +02:00
parent 1756f72e8c
commit ef1588413e
2 changed files with 12 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/resolve-dependencies": patch
---
`requestPackage()` should always return the resolution of the updated package.

View File

@@ -162,16 +162,14 @@ async function resolveAndFetch (
options.currentResolution['integrity'] !== resolveResult.resolution['integrity'] // eslint-disable-line @typescript-eslint/dot-notation
)
if (!skipResolution || forceFetch) {
updated = pkgId !== resolveResult.id || !resolution || forceFetch
// Keep the lockfile resolution when possible
// to keep the original shasum.
if (updated) {
resolution = resolveResult.resolution
}
pkgId = resolveResult.id
normalizedPref = resolveResult.normalizedPref
updated = pkgId !== resolveResult.id || !resolution || forceFetch
// Keep the lockfile resolution when possible
// to keep the original shasum.
if (updated) {
resolution = resolveResult.resolution
}
pkgId = resolveResult.id
normalizedPref = resolveResult.normalizedPref
}
const id = pkgId as string