import { PackageJsonFile } from './package-json-file'; import { Workspace } from './workspace'; export declare class Runnable { executable: string; args: string[]; constructor(executable: string, args: string[]); get unsafeDisplayCommand(): string; } export interface AddCommandOptions { packages: string[]; saveDev?: boolean; } export interface PackageManager { get name(): string; get representativeLockfiles(): string[]; get representativeConfigFile(): string | undefined; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; detector(): PackageManagerDetector; } export declare abstract class PackageManagerDetector { abstract get name(): string; abstract detectUserAgent(userAgent: string): boolean; abstract detectRuntime(): boolean; abstract get representativeLockfiles(): string[]; abstract get representativeConfigFile(): string | undefined; detectLockfile(dir: string): Promise; abstract detectConfigFile(dir: string): Promise; abstract detectExecutable(lookup: PathLookup): Promise; abstract installCommand(): Runnable; abstract addCommand(options: AddCommandOptions): Runnable; abstract execCommand(args: string[]): Runnable; abstract lookupWorkspace(dir: string): Promise; detector(): PackageManagerDetector; } export declare class NpmDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): undefined; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } export declare class CNpmDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): undefined; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } export declare class PNpmDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): string; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } export declare class YarnDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): undefined; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } export declare class DenoDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): string; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } export declare class BunDetector extends PackageManagerDetector implements PackageManager { get name(): string; detectUserAgent(userAgent: string): boolean; detectRuntime(): boolean; get representativeLockfiles(): string[]; get representativeConfigFile(): undefined; detectConfigFile(dir: string): Promise; detectExecutable(lookup: PathLookup): Promise; installCommand(): Runnable; addCommand(options: AddCommandOptions): Runnable; execCommand(args: string[]): Runnable; lookupWorkspace(dir: string): Promise; } /** * Inspiration taken from https://github.com/otiai10/lookpath. */ export declare class PathLookup { static win: boolean; paths: string[]; pathext: string[]; pathextSet: Set; constructor(); detectPresence(executable: string): Promise; lookupPath(executable: string): Promise; } export declare const npmPackageManager: NpmDetector; export declare const knownPackageManagers: PackageManagerDetector[]; export interface DetectOptions { detectors?: PackageManagerDetector[]; root?: string; /** Skip npm_config_user_agent detection. Use when the invoking command (e.g. npx) sets a user agent that doesn't match the project's actual package manager. */ skipUserAgent?: boolean; } export declare function detectPackageManager(dir: string, options?: DetectOptions): Promise; export interface NearestLockFile { packageManager: PackageManager; lockfile: string; } export declare class NoLockfileFoundError extends Error { searchPaths: string[]; lockfiles: string[]; constructor(searchPaths: string[], lockfiles: string[], options?: ErrorOptions); } export declare function detectNearestLockfile(dir: string, options?: DetectOptions): Promise; export interface NearestConfigFile { packageManager: PackageManager; configFile: string; } export declare class NoConfigFileFoundError extends Error { searchPaths: string[]; configFiles: string[]; constructor(searchPaths: string[], configFiles: string[], options?: ErrorOptions); } export declare function detectNearestConfigFile(dir: string, options?: DetectOptions): Promise; export declare class NoPackageJsonFoundError extends Error { searchPaths: string[]; constructor(searchPaths: string[], options?: ErrorOptions); } export interface DetectNearestPackageJsonOptions { root?: string; } export declare function detectNearestPackageJson(dir: string, options?: DetectNearestPackageJsonOptions): Promise; export declare function fauxWorkspaceFromPackageJson(packageManager: PackageManager, packageJsonFile: PackageJsonFile): Promise;