Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hoistedAliases: { [depPath: string]: string[] },
importers: Array<{
id: string,
modulesDir: string,
} & T & Required>,
include: Record,
independentLeaves: boolean | undefined,
modules: Modules | null,
pendingBuilds: string[],
registries: Registries | null | undefined,
rootModulesDir: string,
shamefullyHoist?: boolean,
skipped: Set,
}> {
const rootModulesDir = await realNodeModulesDir(lockfileDir)
const modules = await readModulesYaml(rootModulesDir)
return {
currentHoistPattern: modules?.hoistPattern || undefined,
hoist: !modules ? undefined : Boolean(modules.hoistPattern),
hoistedAliases: modules?.hoistedAliases || {},
importers: await Promise.all(
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,
}
})),
async function getVirtualStoreDir () {
const modulesYaml = await readModules(modules)
if (!modulesYaml) {
return path.join(modules, '.pnpm')
}
return modulesYaml.virtualStoreDir
}
export async function outdatedDependenciesOfWorkspacePackages (
pkgs: Array<{dir: string, manifest: ImporterManifest}>,
args: string[],
opts: OutdatedOptions,
) {
const lockfileDir = opts.lockfileDir || opts.dir
const modules = await readModulesManifest(path.join(lockfileDir, 'node_modules'))
const virtualStoreDir = modules?.virtualStoreDir || path.join(lockfileDir, 'node_modules/.pnpm')
const currentLockfile = await readCurrentLockfile(virtualStoreDir, { ignoreIncompatible: false })
const wantedLockfile = await readWantedLockfile(lockfileDir, { ignoreIncompatible: false }) || currentLockfile
if (!wantedLockfile) {
throw new PnpmError('OUTDATED_NO_LOCKFILE', 'No lockfile in this directory. Run `pnpm install` to generate one.')
}
const storeDir = await storePath(opts.dir, opts.store)
const getLatestManifest = createLatestManifestGetter({
...opts,
lockfileDir,
storeDir,
})
return Promise.all(pkgs.map(async ({ dir, manifest }) => {
let match = args.length && matcher(args) || undefined
return {
manifest,