@pnpm/core
Version:
Fast, disk space efficient installation engine
146 lines (145 loc) • 5.72 kB
TypeScript
import { type Catalogs } from '@pnpm/catalogs.types';
import { type ProjectOptions } from '@pnpm/get-context';
import { type HoistingLimits } from '@pnpm/headless';
import { type LockfileObject } from '@pnpm/lockfile.fs';
import { type IncludedDependencies } from '@pnpm/modules-yaml';
import { type WorkspacePackages } from '@pnpm/resolver-base';
import { type StoreController } from '@pnpm/store-controller-types';
import { type SupportedArchitectures, type AllowedDeprecatedVersions, type PackageExtension, type ReadPackageHook, type Registries, type PrepareExecutionEnv } from '@pnpm/types';
import { type VersionOverride } from '@pnpm/parse-overrides';
import { type ReporterFunction } from '../types';
import { type PreResolutionHookContext } from '@pnpm/hooks.types';
export interface StrictInstallOptions {
autoInstallPeers: boolean;
autoInstallPeersFromHighestMatch: boolean;
catalogs: Catalogs;
frozenLockfile: boolean;
frozenLockfileIfExists: boolean;
enablePnp: boolean;
extraBinPaths: string[];
extraEnv: Record<string, string>;
hoistingLimits?: HoistingLimits;
externalDependencies?: Set<string>;
useLockfile: boolean;
saveLockfile: boolean;
useGitBranchLockfile: boolean;
mergeGitBranchLockfiles: boolean;
linkWorkspacePackagesDepth: number;
lockfileOnly: boolean;
forceFullResolution: boolean;
fixLockfile: boolean;
dedupe: boolean;
ignoreCompatibilityDb: boolean;
ignoreDepScripts: boolean;
ignorePackageManifest: boolean;
preferFrozenLockfile: boolean;
saveWorkspaceProtocol: boolean | 'rolling';
lockfileCheck?: (prev: LockfileObject, next: LockfileObject) => void;
lockfileIncludeTarballUrl: boolean;
preferWorkspacePackages: boolean;
preserveWorkspaceProtocol: boolean;
scriptsPrependNodePath: boolean | 'warn-only';
scriptShell?: string;
shellEmulator: boolean;
storeController: StoreController;
storeDir: string;
reporter: ReporterFunction;
force: boolean;
forcePublicHoistPattern: boolean;
depth: number;
lockfileDir: string;
modulesDir: string;
rawConfig: Record<string, any>;
verifyStoreIntegrity: boolean;
engineStrict: boolean;
ignoredBuiltDependencies?: string[];
neverBuiltDependencies?: string[];
onlyBuiltDependencies?: string[];
onlyBuiltDependenciesFile?: string;
nodeExecPath?: string;
nodeLinker: 'isolated' | 'hoisted' | 'pnp';
nodeVersion?: string;
packageExtensions: Record<string, PackageExtension>;
ignoredOptionalDependencies: string[];
pnpmfile: string;
ignorePnpmfile: boolean;
packageManager: {
name: string;
version: string;
};
pruneLockfileImporters: boolean;
hooks: {
readPackage?: ReadPackageHook[];
preResolution?: (ctx: PreResolutionHookContext) => Promise<void>;
afterAllResolved?: Array<(lockfile: LockfileObject) => LockfileObject | Promise<LockfileObject>>;
calculatePnpmfileChecksum?: () => Promise<string | undefined>;
};
sideEffectsCacheRead: boolean;
sideEffectsCacheWrite: boolean;
strictPeerDependencies: boolean;
include: IncludedDependencies;
includeDirect: IncludedDependencies;
ignoreCurrentPrefs: boolean;
ignoreScripts: boolean;
childConcurrency: number;
userAgent: string;
unsafePerm: boolean;
registries: Registries;
tag: string;
overrides: Record<string, string>;
ownLifecycleHooksStdio: 'inherit' | 'pipe';
workspacePackages?: WorkspacePackages;
pruneStore: boolean;
virtualStoreDir?: string;
dir: string;
symlink: boolean;
enableModulesDir: boolean;
modulesCacheMaxAge: number;
allowedDeprecatedVersions: AllowedDeprecatedVersions;
ignorePatchFailures?: boolean;
allowUnusedPatches: boolean;
preferSymlinkedExecutables: boolean;
resolutionMode: 'highest' | 'time-based' | 'lowest-direct';
resolvePeersFromWorkspaceRoot: boolean;
ignoreWorkspaceCycles: boolean;
disallowWorkspaceCycles: boolean;
publicHoistPattern: string[] | undefined;
hoistPattern: string[] | undefined;
forceHoistPattern: boolean;
shamefullyHoist: boolean;
forceShamefullyHoist: boolean;
global: boolean;
globalBin?: string;
patchedDependencies?: Record<string, string>;
allProjects: ProjectOptions[];
resolveSymlinksInInjectedDirs: boolean;
dedupeDirectDeps: boolean;
dedupeInjectedDeps: boolean;
dedupePeerDependents: boolean;
extendNodePath: boolean;
excludeLinksFromLockfile: boolean;
confirmModulesPurge: boolean;
/**
* Don't relink local directory dependencies if they are not hard linked from the local directory.
*
* This option was added to fix an issue with Bit CLI.
* Bit compile adds dist directories to the injected dependencies, so if pnpm were to relink them,
* the dist directories would be deleted.
*
* The option might be used in the future to improve performance.
*/
disableRelinkLocalDirDeps: boolean;
supportedArchitectures?: SupportedArchitectures;
hoistWorkspacePackages?: boolean;
virtualStoreDirMaxLength: number;
peersSuffixMaxLength: number;
prepareExecutionEnv?: PrepareExecutionEnv;
returnListOfDepsRequiringBuild?: boolean;
injectWorkspacePackages?: boolean;
}
export type InstallOptions = Partial<StrictInstallOptions> & Pick<StrictInstallOptions, 'storeDir' | 'storeController'>;
export type ProcessedInstallOptions = StrictInstallOptions & {
readPackageHook?: ReadPackageHook;
parsedOverrides: VersionOverride[];
};
export declare function extendOptions(opts: InstallOptions): ProcessedInstallOptions;