import { PackageJsonFile } from './package-json-file'; import { Result } from './result'; export interface PackageOptions { /** * The name of the package. */ name: string; /** * An absolute path to the package directory. */ path: string; /** * Whether the package is a workspace. */ workspaces?: string[]; } export declare class Package { name: string; path: string; workspaces?: string[]; constructor({ name, path, workspaces }: PackageOptions); get packageJsonPath(): string; static loadFromPackageJsonFile(packageJson: PackageJsonFile): Promise; static loadFromDirPath(dirPath: string): Promise; } export type OptionalWorkspaceFile = Result; export interface WorkspaceOptions { root: Package; packages: Package[]; lockfile: OptionalWorkspaceFile; configFile: OptionalWorkspaceFile; } export declare class Workspace { #private; /** * The workspace root package. */ root: Package; /** * Packages that are a part of the workspace, excluding the root package. */ packages: Package[]; /** * The package manager specific lockfile of the workspace. */ lockfile: OptionalWorkspaceFile; /** * The package manager specific config file of the workspace. */ configFile: OptionalWorkspaceFile; constructor(options: WorkspaceOptions); memberByName(name: string): Package | undefined; memberByPath(path: string): Package | undefined; /** * @param root An absolute path to the workspace root. * @param patterns Relative workspace patterns. * @returns Absolute paths to every package in the workspace. */ static resolvePatterns(root: string, patterns: string[]): Promise; }