fix: lockfile v6 on projects with patched deps (#5979)

close #5967
This commit is contained in:
Zoltan Kochan
2023-01-26 02:32:38 +02:00
committed by GitHub
parent 7625a428db
commit 5cfe9e77a5
3 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/resolve-dependencies": patch
"pnpm": patch
---
Fix lockfile v6 on projects that use patched dependencies [#5967](https://github.com/pnpm/pnpm/issues/5967).

View File

@@ -159,6 +159,7 @@ export interface ResolutionContext {
resolutionMode?: 'highest' | 'time-based'
virtualStoreDir: string
updateMatching?: (pkgName: string) => boolean
useLockfileV6?: boolean
workspacePackages?: WorkspacePackages
missingPeersOfChildrenByPkgId: Record<string, { parentImporterId: string, missingPeersOfChildren: MissingPeersOfChildren }>
}
@@ -1158,7 +1159,7 @@ async function resolveDependency (
const patchFile = ctx.patchedDependencies?.[nameAndVersion]
if (patchFile) {
ctx.appliedPatches.add(nameAndVersion)
depPath += `_${patchFile.hash}`
depPath += ctx.useLockfileV6 ? `(patch_hash=${patchFile.hash})` : `_${patchFile.hash}`
}
// We are building the dependency tree only until there are new packages

View File

@@ -129,6 +129,7 @@ export async function resolveDependencyTree<T> (
updatedSet: new Set<string>(),
workspacePackages: opts.workspacePackages,
missingPeersOfChildrenByPkgId: {},
useLockfileV6: opts.useLockfileV6,
}
const resolveArgs: ImporterToResolve[] = importers.map((importer) => {