mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-10 11:18:18 -04:00
refactor: remove zipWith when resolving dependencies of importers (#7927)
* refactor: avoid zipWith when resolving dependencies of importers Instead of creating two separate arrays and zipping them together, the initial map here can create the pairs array directly. I'm not expecting any behavior changes in this commit other than slightly improved readability and performance. * refactor: resolve dependencies --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
@@ -403,16 +403,16 @@ async function resolveDependenciesOfImporters (
|
||||
ctx: ResolutionContext,
|
||||
importers: ImporterToResolve[]
|
||||
): Promise<ResolveDependenciesOfImportersResult> {
|
||||
const extendedWantedDepsByImporters = importers.map(({ wantedDependencies, options }) => getDepsToResolve(wantedDependencies, ctx.wantedLockfile, {
|
||||
preferredDependencies: options.preferredDependencies,
|
||||
prefix: options.prefix,
|
||||
proceed: options.proceed || ctx.forceFullResolution,
|
||||
registries: ctx.registries,
|
||||
resolvedDependencies: options.resolvedDependencies,
|
||||
}))
|
||||
const pickLowestVersion = ctx.resolutionMode === 'time-based' || ctx.resolutionMode === 'lowest-direct'
|
||||
const resolveResults = await Promise.all(
|
||||
zipWith(async (extendedWantedDeps, importer) => {
|
||||
importers.map(async (importer) => {
|
||||
const extendedWantedDeps = getDepsToResolve(importer.wantedDependencies, ctx.wantedLockfile, {
|
||||
preferredDependencies: importer.options.preferredDependencies,
|
||||
prefix: importer.options.prefix,
|
||||
proceed: importer.options.proceed || ctx.forceFullResolution,
|
||||
registries: ctx.registries,
|
||||
resolvedDependencies: importer.options.resolvedDependencies,
|
||||
})
|
||||
const postponedResolutionsQueue: PostponedResolutionFunction[] = []
|
||||
const postponedPeersResolutionQueue: PostponedPeersResolutionFunction[] = []
|
||||
const pkgAddresses: PkgAddress[] = []
|
||||
@@ -443,7 +443,7 @@ async function resolveDependenciesOfImporters (
|
||||
}
|
||||
|
||||
return { pkgAddresses, postponedResolutionsQueue, postponedPeersResolutionQueue }
|
||||
}, extendedWantedDepsByImporters, importers)
|
||||
})
|
||||
)
|
||||
let publishedBy: Date | undefined
|
||||
let time: Record<string, string> | undefined
|
||||
|
||||
Reference in New Issue
Block a user