import { type OutputStyle } from '@williamthorsen/nmr-core'; import { type BuildOptions } from './build-output.js'; /** * The toolchain a build's emit comes from: the resolved compiler and the nmr running it. Both join the build * hash, because the same sources can emit differently across either. */ export interface BuildToolchain { compilerVersion: string; fingerprint: string; } /** What a build needs beyond its sources: the options shaping the emit, and the style it reports in. */ export interface BuildPackageOptions extends BuildOptions { style: OutputStyle; } /** * Compiles a package's `src` tree to `dist/esm` with the TypeScript compiler API, emitting `.js` and * `.d.ts` from two programs and rewriting relative `.ts` specifiers and tsconfig `paths` aliases to * runnable relative `.js` specifiers in both outputs. Skips the build only when no input has changed * and the previous output is still on disk. * * The build owns its output directory: every emit replaces it wholesale, so `dist` is a function of the * current inputs rather than an accumulation of every build that ever ran. Assets belong outside it, or in a * `build:post` hook, which runs after the output is published. */ export declare function buildPackage(packageDir: string, options: BuildPackageOptions): Promise; /** * Produces a digest of the given files (paths and contents), the emit config, and the toolchain. * The file list is sorted so the digest is order-invariant, and each path is folded in so renames are detected. * The toolchain joins it because the same sources emit differently across TypeScript versions, and across the * nmr versions whose emit logic drives them. */ export declare function computeBuildHash(packageDir: string, files: string[], emitConfig: object, toolchain: BuildToolchain): Promise; /** * Resolves a package's full tsconfig `extends` chain, returning every config file in it (the leaf `tsconfig.json` and * each base it transitively extends, up to the repo root) as paths relative to `packageDir`. * Emit is driven by the fully-resolved compiler options, so the base configs (where `target`, `module`, `paths`, * `lib`, and `strict` are actually defined) must be in the cache's hashed input set; otherwise a change to a base * config would not bust the cache and stale output could ship. Paths are returned relative to `packageDir`, so * `computeBuildHash` reads them and folds a stable, location-independent path string into the digest. */ export declare function resolveTsconfigChain(packageDir: string, configFileName?: string): string[];