/** * package-install-check, static verification of a package as it would install. * * Inspects the `npm pack --json --dry-run` tarball for required and forbidden * paths and a size cap, and verifies each bin shim exists, is executable, and * carries the expected shebang. Static, the actual install-into-temp smoke is * a separate tool/CI job. */ import type { Exec, FsReader, Logger } from './effects.js'; import type { PublishPackageConfig } from '../config.js'; export interface PathPolicyResult { readonly ok: boolean; readonly missing: readonly string[]; readonly forbidden: readonly string[]; readonly oversize: boolean; } /** Check a packed file list + unpacked size against the tarball policy. Pure. */ export declare function evaluateTarballPaths(files: readonly string[], unpackedBytes: number, config: Pick): PathPolicyResult; export interface BinCheckResult { readonly name: string; readonly ok: boolean; readonly issues: readonly string[]; } /** Verify one bin shim: present, executable, and has the expected shebang. */ export declare function evaluateBinShim(fs: FsReader, path: string, name: string, shebang: string): BinCheckResult; /** * npm has emitted `npm pack --json` in more than one shape: * - npm 10/11 emit an ARRAY: `[{ files, unpackedSize, ... }]` * - npm 12 emits an OBJECT keyed by package name: `{ "": { files, ... } }` * * Reading `[0]` off the object form yields undefined, which then presents as an * EMPTY file list, so every required tarball path is reported missing and the * package looks catastrophically broken when nothing is wrong with it. Accept * both shapes, and throw on a shape that carries no pack result at all rather * than silently returning nothing. */ export declare function parseNpmPack(output: string): { files: string[]; unpackedBytes: number; }; export interface InstallCheckOptions { readonly cwd: string; readonly config: PublishPackageConfig; readonly bins?: readonly { readonly name: string; readonly path: string; readonly shebang: string; }[]; readonly exec?: Exec; readonly fs?: FsReader; readonly logger?: Logger; } export interface InstallCheckResult { readonly ok: boolean; readonly issues: readonly string[]; } /** Run the full static install check. */ export declare function runPackageInstallCheck(options: InstallCheckOptions): InstallCheckResult; //# sourceMappingURL=package-install-check.d.ts.map