diff --git a/pkg-manager/resolve-dependencies/src/updateLockfile.ts b/pkg-manager/resolve-dependencies/src/updateLockfile.ts index 2691d47562..c452f800fa 100644 --- a/pkg-manager/resolve-dependencies/src/updateLockfile.ts +++ b/pkg-manager/resolve-dependencies/src/updateLockfile.ts @@ -4,14 +4,12 @@ import { type LockfileResolution, type PackageSnapshot, pruneSharedLockfile, - type ResolvedDependencies, } from '@pnpm/prune-lockfile' import { type DirectoryResolution, type Resolution } from '@pnpm/resolver-base' import { type Registries } from '@pnpm/types' import * as dp from '@pnpm/dependency-path' import getNpmTarballUrl from 'get-npm-tarball-url' import { type KeyValuePair } from 'ramda' -import mergeRight from 'ramda/src/mergeRight' import partition from 'ramda/src/partition' import { type SafePromiseDefer } from 'safe-promise-defer' import { depPathToRef } from './depPathToRef' @@ -79,12 +77,10 @@ function toLockfileDependency ( opts.lockfileIncludeTarballUrl ) const newResolvedDeps = updateResolvedDeps( - {}, opts.updatedDeps, opts.depGraph ) const newResolvedOptionalDeps = updateResolvedDeps( - {}, opts.updatedOptionalDeps, opts.depGraph ) @@ -196,15 +192,11 @@ function toLockfileDependency ( return result } -// previous resolutions should not be removed from lockfile -// as installation might not reanalyze the whole dependency graph -// the `depth` property defines how deep should dependencies be checked function updateResolvedDeps ( - prevResolvedDeps: ResolvedDependencies, updatedDeps: Array<{ alias: string, depPath: string }>, depGraph: DependenciesGraph ) { - const newResolvedDeps = Object.fromEntries( + return Object.fromEntries( updatedDeps .map(({ alias, depPath }): KeyValuePair => { if (depPath.startsWith('link:')) { @@ -221,10 +213,6 @@ function updateResolvedDeps ( ] }) ) - return mergeRight( - prevResolvedDeps, - newResolvedDeps - ) } function toLockfileResolution (