import { PackageJsonFile } from './package-json-file.js'; import { PnpmfileInfo } from './pnpmfile.js'; import { Result } from './result.js'; export interface PackageOptions { /** * The name of the package. */ name: string; /** * An absolute path to the package directory. */ path: string; /** * The version of the package, if one is declared. Values that are not * non-empty strings are normalized to undefined by the constructor. */ version?: string; /** * Whether the package is a workspace. */ workspaces?: string[]; } export declare class Package { name: string; path: string; version?: string; workspaces?: string[]; constructor({ name, path, version, 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; pnpmfiles?: PnpmfileInfo[]; } 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; /** * The pnpmfiles found at the workspace root, when the workspace uses pnpm. * Entries without a `skipReason` are safe to bundle; see * {@link PnpmfileInfo}. Empty for workspaces that use another package * manager. */ pnpmfiles: PnpmfileInfo[]; 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; }