@pnpm/core
Version:
Fast, disk space efficient installation engine
99 lines (98 loc) • 3.83 kB
TypeScript
import { type InstallationResultStats } from '@pnpm/headless';
import { type PinnedVersion, type UpdateMatchingFunction, type WantedDependency } from '@pnpm/resolve-dependencies';
import { type PreferredVersions } from '@pnpm/resolver-base';
import { type DepPath, type DependenciesField, type PeerDependencyIssues, type ProjectId, type ProjectManifest, type ReadPackageHook, type ProjectRootDir } from '@pnpm/types';
import { type InstallOptions } from './extendInstallOptions';
interface InstallMutationOptions {
update?: boolean;
updateToLatest?: boolean;
updateMatching?: UpdateMatchingFunction;
updatePackageManifest?: boolean;
}
export interface InstallDepsMutation extends InstallMutationOptions {
mutation: 'install';
pruneDirectDependencies?: boolean;
}
export interface InstallSomeDepsMutation extends InstallMutationOptions {
allowNew?: boolean;
dependencySelectors: string[];
mutation: 'installSome';
peer?: boolean;
pruneDirectDependencies?: boolean;
pinnedVersion?: PinnedVersion;
targetDependenciesField?: DependenciesField;
}
export interface UninstallSomeDepsMutation {
mutation: 'uninstallSome';
dependencyNames: string[];
targetDependenciesField?: DependenciesField;
}
export type DependenciesMutation = InstallDepsMutation | InstallSomeDepsMutation | UninstallSomeDepsMutation;
type Opts = Omit<InstallOptions, 'allProjects'> & {
preferredVersions?: PreferredVersions;
pruneDirectDependencies?: boolean;
binsDir?: string;
} & InstallMutationOptions;
export declare function install(manifest: ProjectManifest, opts: Opts): Promise<{
updatedManifest: ProjectManifest;
ignoredBuilds: string[] | undefined;
}>;
export type MutatedProject = DependenciesMutation & {
rootDir: ProjectRootDir;
};
export type MutateModulesOptions = InstallOptions & {
preferredVersions?: PreferredVersions;
hooks?: {
readPackage?: ReadPackageHook[] | ReadPackageHook;
} | InstallOptions['hooks'];
};
export declare function mutateModulesInSingleProject(project: MutatedProject & {
binsDir?: string;
manifest: ProjectManifest;
rootDir: ProjectRootDir;
modulesDir?: string;
}, maybeOpts: Omit<MutateModulesOptions, 'allProjects'> & InstallMutationOptions): Promise<{
updatedProject: UpdatedProject;
ignoredBuilds: string[] | undefined;
}>;
export interface MutateModulesResult {
updatedProjects: UpdatedProject[];
stats: InstallationResultStats;
depsRequiringBuild?: DepPath[];
ignoredBuilds: string[] | undefined;
}
export declare function mutateModules(projects: MutatedProject[], maybeOpts: MutateModulesOptions): Promise<MutateModulesResult>;
export declare function addDependenciesToPackage(manifest: ProjectManifest, dependencySelectors: string[], opts: Omit<InstallOptions, 'allProjects'> & {
bin?: string;
allowNew?: boolean;
peer?: boolean;
pinnedVersion?: 'major' | 'minor' | 'patch';
targetDependenciesField?: DependenciesField;
} & InstallMutationOptions): Promise<{
updatedManifest: ProjectManifest;
ignoredBuilds: string[] | undefined;
}>;
export type ImporterToUpdate = {
buildIndex: number;
binsDir: string;
id: ProjectId;
manifest: ProjectManifest;
originalManifest?: ProjectManifest;
modulesDir: string;
rootDir: ProjectRootDir;
pruneDirectDependencies: boolean;
removePackages?: string[];
updatePackageManifest: boolean;
wantedDependencies: Array<WantedDependency & {
isNew?: boolean;
updateSpec?: boolean;
preserveNonSemverVersionSpec?: boolean;
}>;
} & DependenciesMutation;
export interface UpdatedProject {
originalManifest?: ProjectManifest;
manifest: ProjectManifest;
peerDependencyIssues?: PeerDependencyIssues;
rootDir: ProjectRootDir;
}
export {};