import type TS from "typescript"; /** * Shared static TypeScript-source machinery for the compiler-API extractors * (tRPC, server actions): host-resolved compiler loading, module parsing, * identifier/export resolution across files, and the fail-closed static * zod → JSON Schema interpreter (04 §1). No host code is ever executed. */ export type Ts = typeof TS; export declare const MAX_RESOLVE_DEPTH = 16; /** Resolve the TypeScript compiler from the host package (fail-closed). */ export declare function loadTypescript(root: string): Ts | null; export declare function readPackageJson(root: string): Promise | null>; /** True when any dependency field of the host package declares `name`. */ export declare function hasDependency(root: string, name: string): Promise; /** True when `relativePath` can host a Next.js API route: an app-router * route file or a pages/api source file. */ export declare function isApiRouteFileCandidate(relativePath: string): boolean; /** The static mount path a route file serves (app or pages router); null when * no path can be derived. */ export declare function apiPathFromRouteFile(relativePath: string): string | null; export interface FileModule { file: string; source: string; sf: TS.SourceFile; } /** The shared state a static extraction threads through resolution. Extractors * may extend it with their own fields (structural typing keeps them compatible). */ export interface StaticExtraction { ts: Ts; root: string; modules: Map; } export declare function parseModule(extraction: StaticExtraction, file: string, source: string): FileModule; /** import local name → specifier, for one module. */ export declare function importMap(extraction: StaticExtraction, module: FileModule): Map; /** Find a top-level declaration's initializer by name within a module. */ export declare function localInitializer(extraction: StaticExtraction, module: FileModule, name: string): TS.Expression | null; /** Follow `export { x } from "./y"` and `export * from "./y"` chains. */ export declare function resolveExport(extraction: StaticExtraction, module: FileModule, name: string, depth: number): Promise<{ module: FileModule; expr: TS.Expression; } | null>; /** Resolve an identifier to its defining expression, following local * declarations and one-hop-per-level imports. */ export declare function resolveIdentifier(extraction: StaticExtraction, module: FileModule, name: string, depth: number): Promise<{ module: FileModule; expr: TS.Expression; } | null>; export declare function calleeName(extraction: StaticExtraction, expr: TS.CallExpression): string | null; export declare function propertyKeyName(extraction: StaticExtraction, name: TS.PropertyName): string | null; export declare function literalValue(extraction: StaticExtraction, expr: TS.Expression): string | number | boolean | null | undefined; export interface ZodSchemaResult { schema: Record; optional: boolean; recognized: boolean; reason?: string; } export declare const PERMISSIVE_INPUT: Record; export declare function unrecognized(reason: string): ZodSchemaResult; export declare function zodFromExpression(extraction: StaticExtraction, module: FileModule, expr: TS.Expression, depth: number): Promise;