import "web-streams-polyfill/polyfill"; import { NodeMaintainer } from "@vscode/ts-package-manager/node-maintainer/node_maintainer.js"; export interface OrogeneFileSystem { readDirectory(path: string): Promise; removeDirectory(path: string, options?: { recursive?: boolean; }): Promise; deleteFile?(path: string): Promise; createDirectory(path: string): Promise; writeFile(path: string, content: string | Uint8Array, options?: { encoding?: "utf8"; mode?: number; }): Promise; directoryExists(path: string): Promise; readFile(path: string, encoding?: string): Promise; } export interface InstallProjectOpts { addPackages?: string[]; removePackages?: string[]; packageType?: PackageType; pkgJson?: string; npmLock?: string; kdlLock?: string; } export declare enum PackageType { Dependency = "dependencies", DevDependency = "devDependencies", OptionalDependency = "optionalDependencies", PeerDependency = "peerDependencies" } export interface FileSystem { readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): Promise; deleteFile?(path: string): Promise; createDirectory(path: string): Promise; writeFile(path: string, data: string, writeByteOrderMark?: boolean): Promise; directoryExists(path: string): Promise; readFile(path: string, encoding?: "utf8"): Promise; } export declare class PackageManager { private readonly fs; private readonly nassun; constructor(fs: OrogeneFileSystem); resolveProject(root: string, opts?: InstallProjectOpts): Promise; private updateJson; private resolveMaintainer; /** * What it says on the tin. Reads a JSON file from the given path. Throws * if the file doesn't exist (as opposed to returning `undefined`, like * fs.readFile does). */ private readJson; } export declare class ResolvedProject { private readonly fs; private readonly maintainer; private readonly root; private readonly logger; private readonly prefix; private readonly metaPath; constructor(fs: OrogeneFileSystem, maintainer: NodeMaintainer, root: string, logger?: Console); /** * Synchronizes the project's node_modules directory with the current resolved dependencies, pruning any extraneous ones. */ restore(): Promise; /** * Extracts a package at the given path. If a package has already been * extracted to that location, it will be replaced. * * @param path to a package */ restorePackageAt(path: string): Promise; /** * Deletes/prunes files and directories that aren't expected to be there * by the currently-calculated tree. Extraneous calculation happens based on the contents of `.meta.json` * @returns */ pruneExtraneous(): Promise; private packageAtPath; private getProjectRoot; private checkPath; private extractPackageTo; private extractMissing; private writeLockfile; } /** * Given a full path to a particular file, presumably inside a package, * this returns the path of the package containing that file. * @param path the full file path to the file. * @returns the subpath of the package itself */ export declare function packagePath(path: string): string;