/** * Safe Emitters — prompt-injection immunity for KERN codegen. * * Every prop value interpolated into generated code MUST go through one of these. * Raw string splicing is the root cause of codegen injection (audit 2026-03-25). * * Extracted from codegen-core.ts for independent reuse by React/Vue/Python codegens. */ import type { IRNode } from '../types.js'; /** Validate and emit a safe identifier for generated code. Throws on invalid. */ export declare function emitIdentifier(value: string | undefined, fallback: string, node?: IRNode): string; /** Escape a string for safe interpolation into a single-quoted JS string literal. */ export declare function emitStringLiteral(value: string): string; /** Validate and emit a safe filesystem path for generated code. */ export declare function emitPath(value: string, node?: IRNode): string; /** Escape a value for interpolation into a template literal in generated code. */ export declare function emitTemplateSafe(value: string): string; /** * Emit a `fmt` template body into a generated JS template literal. The * `template=` attribute body is **raw TS template-literal source** — exactly * the characters that would appear between the backticks in hand-written TS. * The migrator (and importer) preserve source verbatim via * `SourceFile.getText()`, so backslash escape sequences (`\n`, `\t`, `\xNN`, * `\uNNNN`, `\\`, `` \` ``, `\${`) are already encoded as the TS tokenizer * expects. Re-escaping backslashes would turn `\n` (escape) into `\\n` * (literal) and break byte-equivalence under `--verify`. * * The only defensive transform here is escaping **bare** backticks (those * preceded by an even number of backslashes — so 0, 2, 4 …). A backtick * preceded by an odd number of backslashes is already TS-escaped and must be * left alone, otherwise `` \` `` would be double-escaped into `` \\\` ``, * terminating the generated literal early. (Codex/Gemini plan review fix.) */ export declare function emitFmtTemplate(value: string): string; /** * Validate and emit a safe TypeScript type annotation for generated code. * Handles generics, arrays, unions, intersections, tuples, function types. * Rejects semicolons, backticks, template literals, dynamic imports, comments. */ export declare function emitTypeAnnotation(value: string | undefined, fallback: string, node?: IRNode): string; /** Validate and emit a safe import specifier for generated code. */ export declare function emitImportSpecifier(value: string, node?: IRNode): string;