Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
virtualStoreDir: string,
rootModulesDir: string,
currentLockfile: Lockfile,
importers: Array<{ id: string, rootDir: string }>,
independentLeaves: boolean,
extraBinPaths: string[],
},
opts: StrictRebuildOptions,
) {
const pkgsThatWereRebuilt = new Set()
const graph = new Map()
const pkgSnapshots: PackageSnapshots = ctx.currentLockfile.packages || {}
const nodesToBuildAndTransitive = new Set()
getSubgraphToBuild(
lockfileWalker(
ctx.currentLockfile,
ctx.importers.map(({ id }) => id),
{
include: {
dependencies: opts.production,
devDependencies: opts.development,
optionalDependencies: opts.optional,
}
}
),
nodesToBuildAndTransitive,
{ pkgsToRebuild: ctx.pkgsToRebuild }
)
const nodesToBuildAndTransitiveArray = Array.from(nodesToBuildAndTransitive)
for (const relDepPath of nodesToBuildAndTransitiveArray) {
export default async function hoistByLockfile (
match: (dependencyName: string) => boolean,
opts: {
getIndependentPackageLocation?: (packageId: string, packageName: string) => Promise,
lockfile: Lockfile,
lockfileDir: string,
modulesDir: string,
registries: Registries,
virtualStoreDir: string,
},
) {
if (!opts.lockfile.packages) return {}
const deps = await getDependencies(
lockfileWalker(
opts.lockfile,
Object.keys(opts.lockfile.importers)
),
0,
{
getIndependentPackageLocation: opts.getIndependentPackageLocation,
lockfileDir: opts.lockfileDir,
registries: opts.registries,
virtualStoreDir: opts.virtualStoreDir,
},
)
const aliasesByDependencyPath = await hoistGraph(deps, opts.lockfile.importers['.'].specifiers, {
dryRun: false,
match,
modulesDir: opts.modulesDir,
lockfile: Lockfile,
importerIds: string[],
opts: {
include: { [dependenciesField in DependenciesField]: boolean },
registries: Registries,
skipped: Set,
failOnMissingDependencies: boolean,
},
): Lockfile {
if (R.equals(importerIds.sort(), R.keys(lockfile.importers).sort())) {
return filterLockfile(lockfile, opts)
}
const packages = {} as PackageSnapshots
if (lockfile.packages) {
pkgAllDeps(
lockfileWalker(
lockfile,
importerIds,
{ include: opts.include, skipped: opts.skipped }
),
packages,
{
failOnMissingDependencies: opts.failOnMissingDependencies,
},
)
}
const importers = importerIds.reduce((acc, importerId) => {
acc[importerId] = filterImporter(lockfile.importers[importerId], opts.include)
return acc
}, { ...lockfile.importers })