Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
maybeOpts: LinkOptions & {
linkToBin?: string,
dir: string,
},
) {
const reporter = maybeOpts?.reporter
if (reporter) {
streamParser.on('data', reporter)
}
const opts = await extendOptions(maybeOpts)
const ctx = await getContextForSingleImporter(opts.manifest, {
...opts,
extraBinPaths: [], // ctx.extraBinPaths is not needed, so this is fine
})
const importerId = getLockfileImporterId(ctx.lockfileDir, opts.dir)
const currentLockfile = R.clone(ctx.currentLockfile)
const linkedPkgs: Array<{path: string, manifest: DependencyManifest, alias: string}> = []
const specsToUpsert = [] as PackageSpecObject[]
for (const linkFrom of linkFromPkgs) {
let linkFromPath: string
let linkFromAlias: string | undefined
if (typeof linkFrom === 'string') {
linkFromPath = linkFrom
} else {
linkFromPath = linkFrom.path
linkFromAlias = linkFrom.alias
}
const { manifest } = await readImporterManifest(linkFromPath) as { manifest: DependencyManifest }
specsToUpsert.push({
alias: manifest.name,
return Promise.all(pkgs.map(async ({ dir, manifest }) => {
let match = args.length && matcher(args) || undefined
return {
manifest,
outdatedPackages: await outdated({
currentLockfile,
getLatestManifest,
lockfileDir,
manifest,
match,
prefix: dir,
wantedLockfile,
}),
prefix: getLockfileImporterId(lockfileDir, dir),
}
}))
}
outdatedPackages.forEach((outdatedPkg) => {
const key = JSON.stringify([outdatedPkg.packageName, outdatedPkg.belongsTo])
if (!outdatedByNameAndType[key]) {
outdatedByNameAndType[key] = { ...outdatedPkg, dependentPkgs: [] }
}
outdatedByNameAndType[key].dependentPkgs.push({ location: getLockfileImporterId(opts.dir, dir), manifest })
})
}))
importers.map(async (importer) => {
const modulesDir = await realNodeModulesDir(importer.rootDir)
const importerId = getLockfileImporterId(lockfileDir, importer.rootDir)
return {
...importer,
binsDir: importer.binsDir || path.join(importer.rootDir, 'node_modules', '.bin'),
id: importerId,
modulesDir,
}
})),
include: modules?.included || { dependencies: true, devDependencies: true, optionalDependencies: true },