import * as ts from 'typescript'; /** * Shared, per-tsconfig `ts.Program` cache. * * Five extractor classes derive from TypeScriptBaseExtractor and each used to * build its own (always empty) program. With a real tsconfig wired in, a * per-extractor program would parse the whole package five times — so the * bundles live here, keyed by resolved configPath, and every extractor for * the same package shares one program + checker. The cache also survives the * per-target extractor recreation in ExtractorFactory (`--target all` runs * four packages in one process). * * Fail-loud contract (read tolerant / write strict): a *set* configPath that * is missing or unparsable throws — never a silent fall-back to the isolated * single-file mode, which would quietly drop cross-file types from the * generated artifacts. An *unset* configPath is the documented single-file * fallback (tests, ad-hoc extractor usage). */ export interface ProgramBundle { program: ts.Program; checker: ts.TypeChecker; compilerOptions: ts.CompilerOptions; /** Directory of the tsconfig — treated as the package root for source guards. */ packageRoot: string; /** * Every name reachable from one of the package's public entry points — * what a consumer can actually `import type { … } from '@urbicon-ui/x'`. * `null` when the package declares no entry this program can see (test * fixtures, ad-hoc roots); consumers must then report "unknown" rather * than "not exported". See `resolvePublicExportNames`. */ publicExportNames: ReadonlySet | null; /** * Why the surface above is `null` even though the manifest *declared* typed * entries — a broken `dist/*.d.ts` → `src/lib/*` mapping, or an unreadable * manifest. `null` when nothing was declared (the documented unknown case). * * Carried rather than thrown so the bundle still lands in the cache; it is * `assertResolvablePublicExports` at phase start that turns it into a run * failure, where the error can actually escape. */ publicExportFailure: string | null; } /** * Parse the tsconfig at `configPath`, throwing a descriptive error when the * file is missing or has config-level diagnostics. Cheap (~5–15ms) — used * both for eager validation at pipeline start and for program construction. */ export declare function parseTsConfig(configPath: string): ts.ParsedCommandLine; /** * Eager validation hook for the pipeline: parses the tsconfig (throwing on * miss/errors) *before* extraction starts, so a broken configPath fails the * run at phase start instead of degrading into 80 per-component warnings. * * Deliberately cheap (~5–15ms, no program build) — see * `assertResolvablePublicExports` for the second, program-backed half of the * same eager check. */ export declare function assertUsableTsConfig(configPath: string): void; /** * Second eager validation hook, run next to `assertUsableTsConfig` at phase * start: a package whose manifest *declares* typed entry points none of which * resolve must abort the run. * * This has to live at the pipeline level, not in `getProgramBundle`. The * extractors are constructed per component inside `ExtractionCoordinator`'s * per-extractor `try/catch`, which turns any constructor throw into * `{ success: false, data: [] }` plus a `console.warn` and never propagates * the error — so a throw from the bundle builder produced a *green* run over * 0 props, 0 variants and 0 types (measured: 5/5 components "successfully * extracted", exit 0). Building the program here is not extra work: it is the * same program every extractor is about to share, one phase earlier. * * An *unknown* surface is a warning rather than an error: a package with no * `exports` manifest at all is the documented ad-hoc case, and `exported` * is then absent (never `false`) on every type. It is still worth one line at * phase start, because every downstream gate loses its input. */ export declare function assertResolvablePublicExports(configPath: string): void; /** * Get (or build) the shared program bundle for a tsconfig. Throws when the * tsconfig is missing or unparsable — see the fail-loud contract above. * * The public-export surface is resolved *after* the bundle is cached, and its * failure is carried on the bundle instead of thrown. Throwing here left the * cache empty, so every extractor of every component rebuilt the program: * measured 160ms → 3667ms for the same five components (23×). A cache that * only fills on the happy path is not a cache. */ export declare function getProgramBundle(configPath: string): ProgramBundle; /** Test hook: drop all cached programs. */ export declare function clearProgramCache(): void; //# sourceMappingURL=ProgramCache.d.ts.map