Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
opts: {
dryRun?: boolean,
include: { [dependenciesField in DependenciesField]: boolean },
hoistedAliases: {[depPath: string]: string[]},
hoistedModulesDir?: string,
wantedLockfile: Lockfile,
currentLockfile: Lockfile,
pruneStore?: boolean,
registries: Registries,
skipped: Set,
virtualStoreDir: string,
lockfileDir: string,
storeController: StoreController,
},
): Promise> {
const wantedLockfile = filterLockfile(opts.wantedLockfile, {
include: opts.include,
registries: opts.registries,
skipped: opts.skipped,
})
await Promise.all(importers.map(async ({ binsDir, id, modulesDir, pruneDirectDependencies, removePackages, rootDir }) => {
const currentImporter = opts.currentLockfile.importers[id] || {} as LockfileImporter
const currentPkgs = R.toPairs(mergeDependencies(currentImporter))
const wantedPkgs = R.toPairs(mergeDependencies(wantedLockfile.importers[id]))
const allCurrentPackages = new Set(
(pruneDirectDependencies || removePackages?.length)
? (await readModulesDir(modulesDir) || [])
: [],
)
const depsToRemove = new Set([
...(removePackages || []).filter((removePackage) => allCurrentPackages.has(removePackage)),