/** * Render one controller's metadata + resolved middleware chains into * `.routes.gen.ts` text — per-handler `Request` aliases over the * `InstanceType['routes']` navigation pattern. * * Pure rendering: the caller (the AST front-end in `astEmit.ts`) supplies the * resolved chains as binding NAMES plus the `binding → specifier` import map. * Framework type paths (`BaseRequestContext`, `StandardSchemaV1`) are computed * relative to the controller's location. */ import type { ControllerMeta, MiddlewareImport, MiddlewareRef } from './collectMetadata.ts'; /** * Inputs for the renderer — resolution (the middleware chains as binding names + * the `binding → specifier` import map) is already done by the caller. */ export interface RenderInput { controller: ControllerMeta; /** Absolute path to the controller's source `.ts` file. */ srcPath: string; /** Resolved+filtered chains (binding names), parallel to `controller.routes`. */ filteredChains: MiddlewareRef[][]; /** `binding → import` (specifier + kind) for every binding in `filteredChains`. */ importMap: Map; /** * Whether the gen file may `import type` the controller's own module to * navigate its `routes` type for precise inline-schema `InferOutput`. False * for a `.js` controller with no sibling `.d.ts`: importing it would be a * `TS7016` ("no declaration file") under `strict` with no `allowJs`. When * false, inline request/query schemas degrade to the base * `Record` (no self-import) so the consumer's typecheck gate * stays green during an incremental `.js` → `.ts` migration. `.ts` * controllers (and `.js` with a `.d.ts`) keep precise types. */ controllerTypeImportable: boolean; } /** * Render the gen.ts text from already-resolved chains + import map. The AST * front-end (`astEmit.ts`) resolves the chains (binding names) + the import map * from parsed source and feeds them here. */ export declare function renderGenFile(input: RenderInput): string; /** * Emit a single-quoted TS string literal for a type-navigation key, escaping the * only two characters a single-quoted string treats specially (`\` and `'`). * Route keys round-trip exactly (the literal denotes the author's original key), * and ordinary paths (no `\`/`'`) come out byte-identical to a plain `'${s}'`. */ export declare function sq(s: string): string;