import type { IncludedDependencies } from '@pnpm/installing.modules-yaml'; import type { LockfileObject, LockfileResolution } from '@pnpm/lockfile.fs'; import { type PatchGroupRecord } from '@pnpm/patching.config'; import type { PatchInfo } from '@pnpm/patching.types'; import type { PkgRequestFetchResult, StoreController } from '@pnpm/store.controller-types'; import type { AllowBuild, DepPath, PkgIdWithPatchHash, ProjectId, Registries, SupportedArchitectures } from '@pnpm/types'; export interface DependenciesGraphNode { alias?: string; hasBundledDependencies: boolean; modules: string; name: string; version: string; fetching?: () => Promise; forceImportPackage?: boolean; dir: string; children: Record; optionalDependencies: Set; optional: boolean; depPath: DepPath; pkgIdWithPatchHash: PkgIdWithPatchHash; isBuilt?: boolean; requiresBuild?: boolean; hasBin: boolean; filesIndexFile?: string; patch?: PatchInfo; resolution: LockfileResolution; } export interface DependenciesGraph { [depPath: string]: DependenciesGraphNode; } export interface LockfileToDepGraphOptions { allowBuild?: AllowBuild; autoInstallPeers: boolean; enableGlobalVirtualStore?: boolean; engineStrict: boolean; force: boolean; importerIds: ProjectId[]; include: IncludedDependencies; includeUnchangedDeps?: boolean; ignoreScripts: boolean; /** * When true, skip fetching local dependencies (file: protocol pointing to directories). * This is useful for `pnpm fetch` which only downloads packages from the registry * and doesn't need local packages that won't be available (e.g., in Docker builds). */ ignoreLocalPackages?: boolean; lockfileDir: string; nodeVersion: string; pnpmVersion: string; patchedDependencies?: PatchGroupRecord; registries: Registries; sideEffectsCacheRead: boolean; skipped: Set; storeController: StoreController; storeDir: string; globalVirtualStoreDir: string; virtualStoreDir: string; supportedArchitectures?: SupportedArchitectures; virtualStoreDirMaxLength: number; } export interface DirectDependenciesByImporterId { [importerId: string]: { [alias: string]: string; }; } export interface DepHierarchy { [depPath: string]: Record; } export interface LockfileToDepGraphResult { directDependenciesByImporterId: DirectDependenciesByImporterId; graph: DependenciesGraph; hierarchy?: DepHierarchy; hoistedLocations?: Record; symlinkedDirectDependenciesByImporterId?: DirectDependenciesByImporterId; prevGraph?: DependenciesGraph; injectionTargetsByDepPath: Map; } /** * Generate a dependency graph from lockfiles. * * If a current lockfile is provided, this function only includes new or changed * packages in the graph. In other words, the graph returned will be a set * subtraction of the packages in the wanted lockfile minus the current * lockfile. This behavior can be configured with the `includeUnchangedDeps` * option. */ export declare function lockfileToDepGraph(lockfile: LockfileObject, currentLockfile: LockfileObject | null, opts: LockfileToDepGraphOptions): Promise;