/** * The `package.json` fields that carry a dependency's version specifier. * * pnpm accepts the `catalog:` protocol in all four, so a reader looking for catalogued dependencies has to * sweep the whole set rather than the two that carry most of them. */ export declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]; export type DependencyField = (typeof DEPENDENCY_FIELDS)[number]; export type PackageJson = { name?: string; private?: boolean; version?: string; packageManager?: string; scripts?: Record; pnpm?: { overrides?: Record; }; } & { [K in DependencyField]?: Record; }; /** * Reads and parses the package.json at the given directory, keeping only the fields nmr reads. */ export declare function readPackageJson(dir: string): PackageJson; /** * Returns the `pnpm.overrides` block a package.json declares, every key it holds and each value as written. */ export declare function getPnpmOverrides(pkg: PackageJson): Record | undefined; /** * Parses a `package.json`'s text, rejecting what does not parse. * * A file the user wrote by hand is theirs to fix, so the failure names it rather than reporting the parser's * own stack. */ export declare function parsePackageJson(raw: string, file: string): unknown; /** * Narrows a `scripts` record to strings, rejecting any value that is not one. * * npm and pnpm read a script as a string too, so a value of any other type is malformed however it got there. * Dropping one silently would let a caller run something else in its place and report nothing. */ export declare function readScriptRecord(dir: string, scripts: Record): Record; /** Resolves the `package.json` path for a directory: the file tier-3 scripts are read from. */ export declare function resolvePackageJsonPath(dir: string): string;