Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updatedWantedLockfile.importers[importerId].specifiers[alias] = getSpecFromPackageManifest(newPkg, alias)
}
} else {
newPkg = opts.manifest
}
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.useLockfile) {
await writeLockfiles({
currentLockfile: updatedCurrentLockfile,
currentLockfileDir: ctx.virtualStoreDir,
wantedLockfile: updatedWantedLockfile,
wantedLockfileDir: ctx.lockfileDir,
...lockfileOpts,
})
} else {
await writeCurrentLockfile(ctx.virtualStoreDir, updatedCurrentLockfile, lockfileOpts)
}
summaryLogger.debug({ prefix: opts.dir })
if (reporter) {
streamParser.removeListener('data', reporter)
}
return newPkg
}
newLockfile,
oldLockfile: ctx.currentLockfile,
registries: ctx.registries,
storeController: opts.storeController,
virtualStoreDir: ctx.virtualStoreDir,
})
ctx.pendingBuilds = ctx.pendingBuilds.filter((pkgId) => !removedPkgIds.has(dp.resolve(ctx.registries, pkgId)))
await opts.storeController.close()
const currentLockfile = makePartialCurrentLockfile
? pruneLockfile(ctx.currentLockfile, pkg, ctx.importerId, { defaultRegistry: ctx.registries.default })
: newLockfile
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.useLockfile) {
await writeLockfiles(ctx.lockfileDirectory, newLockfile, currentLockfile, lockfileOpts)
} else {
await writeCurrentLockfile(ctx.lockfileDirectory, currentLockfile, lockfileOpts)
}
if (opts.shamefullyFlatten) {
ctx.hoistedAliases = await shamefullyFlattenByLockfile(currentLockfile, ctx.importerId, {
getIndependentPackageLocation: opts.independentLeaves
? async (packageId: string, packageName: string) => {
const { directory } = await opts.storeController.getPackageLocation(packageId, packageName, {
lockfileDirectory: ctx.lockfileDirectory,
targetEngine: opts.sideEffectsCacheRead && ENGINE_NAME || undefined,
})
return directory
}
: undefined,
lockfileDirectory: opts.lockfileDirectory,
modulesDir: ctx.modulesDir,
registries: ctx.registries,
await Promise.all(R.values(resolvedPackagesByPackageId).map(({ finishing }) => finishing()))
const lockfileOpts = { forceSharedFormat: opts.forceSharedLockfile }
if (opts.lockfileOnly) {
await writeWantedLockfile(ctx.lockfileDir, result.wantedLockfile, lockfileOpts)
} else {
await Promise.all([
opts.useLockfile
? writeLockfiles({
currentLockfile: result.currentLockfile,
currentLockfileDir: ctx.virtualStoreDir,
wantedLockfile: result.wantedLockfile,
wantedLockfileDir: ctx.lockfileDir,
...lockfileOpts,
})
: writeCurrentLockfile(ctx.virtualStoreDir, result.currentLockfile, lockfileOpts),
(() => {
if (result.currentLockfile.packages === undefined && result.removedDepPaths.size === 0) {
return Promise.resolve()
}
return writeModulesYaml(ctx.rootModulesDir, {
...ctx.modulesFile,
hoistedAliases: result.newHoistedAliases,
hoistPattern: ctx.hoistPattern,
included: ctx.include,
independentLeaves: ctx.independentLeaves,
layoutVersion: LAYOUT_VERSION,
packageManager: `${opts.packageManager.name}@${opts.packageManager.version}`,
pendingBuilds: ctx.pendingBuilds,
registries: ctx.registries,
shamefullyHoist: ctx.shamefullyHoist,
skipped: Array.from(ctx.skipped),