import type { CommandHandlerMap } from '@pnpm/cli.command'; import { type GlobalAddOptions } from './globalAdd.js'; export type MigrateLegacyGlobalPackagesOptions = GlobalAddOptions & { pnpmHomeDir?: string; }; /** The global project of the previous layout, next to the current one. */ export interface LegacyGlobalLayout { dir: string; /** * The direct dependencies its manifest records, the pnpm CLI included: * its bins are cleaned up like any other, while installing it into the * current layout is `pnpm setup`'s job. */ dependencies: Record; } /** The project next to `globalDir`, if its manifest is still there. */ export declare function readLegacyGlobalLayout(globalDir: string): Promise; /** * One package to migrate. Messages name the alias: the selector can carry * the credentials of a tarball or git URL. */ export interface MigrationSelector { alias: string; selector: string; } /** * The dependencies no current group installs, each with its `add -g` * selector. A local path is anchored at the previous project, which is * where pnpm 10 recorded it relative to. */ export declare function legacyMigrationSelectors(legacy: LegacyGlobalLayout, installedAliases: ReadonlySet): MigrationSelector[]; /** * Reinstall the packages of the previous global layout as groups of the * current one, then delete the previous project together with the bins it * linked into the pnpm home. A package a current group already declares * is left alone: reinstalling it would replace that group, the packages * installed together with it included. The previous project stays for * the next `update -g` while a package failed to install or while such a * declared package is still missing its files. */ export declare function migrateLegacyGlobalPackages(opts: MigrateLegacyGlobalPackagesOptions, commands: CommandHandlerMap): Promise; /** * Delete the bins pnpm 10 linked into the pnpm home for the packages of * the previous project, then the project. A bin that cannot be removed * keeps the project, so the next `update -g` can retry. */ export declare function removeLegacyGlobalLayout(legacy: LegacyGlobalLayout, pnpmHomeDir: string | undefined): Promise; /** * The files pnpm 10 wrote for the bin at `binPath` that are still a link * or shim into `legacyDir`, or a hard link to `target`. Each file is judged * on its own. Hard links are recognized only when the target resolves inside * `legacyDir`; other files at these paths are kept. */ export declare function legacyBinFiles(binPath: string, legacyDir: string, target?: string): Promise; export declare function isLegacyBin(binPath: string, legacyDir: string, target?: string): Promise;