import { Cursor } from '../..'; import { J } from '../../java'; import { Any, Capture, JS } from '..'; import { RawCode } from './capture'; import { JavaCoordinates } from './template'; import ts from "typescript"; import { Parameter } from "./types"; /** * Configure the sourceFileCache used for template parsing. * * @param cache The sourceFileCache to use, or undefined to disable caching */ export declare function setTemplateSourceFileCache(cache?: Map): void; /** * Clears the template cache. Only exported for testing and benchmarking purposes. * Normal application code should not need to call this. */ export declare function clearTemplateCache(): void; /** * Internal template engine - handles the core templating logic. * Not exported from index, so only visible within the templating module. */ export declare class TemplateEngine { /** * Gets the parsed and extracted template tree (before value substitution). * This is the cacheable part of template processing. * * @param templateParts The string parts of the template * @param parameters The parameters between the string parts * @param contextStatements Context declarations (imports, types, etc.) to prepend for type attribution * @param dependencies NPM dependencies for type attribution * @returns A Promise resolving to the extracted template AST */ static getTemplateTree(templateParts: TemplateStringsArray, parameters: Parameter[], contextStatements?: string[], dependencies?: Record): Promise; /** * Applies a template from a pre-parsed AST and returns the resulting AST. * This method is used by Template.apply() after getting the cached template tree. * * @param ast The pre-parsed template AST * @param parameters The parameters between the string parts * @param cursor The cursor pointing to the current location in the AST * @param coordinates The coordinates specifying where and how to insert the generated AST * @param values Map of capture names to values to replace the parameters with * @param wrappersMap Map of capture names to J.RightPadded wrappers (for preserving markers) * @returns A Promise resolving to the generated AST node */ static applyTemplateFromAst(ast: JS.CompilationUnit, parameters: Parameter[], cursor: Cursor, coordinates: JavaCoordinates, values?: Pick, 'get'>, wrappersMap?: Pick | J.RightPadded[]>, 'get'>): Promise; /** * Generates type preamble declarations for captures/parameters with type annotations. * * @param parameters The parameters * @returns Array of preamble statements */ private static generateTypePreamble; /** * Builds a template string with parameter placeholders. * RawCode parameters are spliced directly into the template at construction time. * Other parameters use placeholders that are replaced during application. * * @param templateParts The string parts of the template * @param parameters The parameters between the string parts * @returns The template string */ private static buildTemplateString; /** * Converts a Type instance to a TypeScript type string. * * @param type The Type instance * @returns A TypeScript type string */ private static typeToString; /** * Gets the parsed and extracted pattern tree with capture markers attached. * This is the entry point for pattern processing, providing pattern-specific * functionality on top of the shared template tree generation. * * @param templateParts The string parts of the template * @param captures The captures between the string parts (can include RawCode) * @param contextStatements Context declarations (imports, types, etc.) to prepend for type attribution * @param dependencies NPM dependencies for type attribution * @returns A Promise resolving to the extracted pattern AST with capture markers */ static getPatternTree(templateParts: TemplateStringsArray, captures: (Capture | Any | RawCode)[], contextStatements?: string[], dependencies?: Record): Promise; } /** * Helper class for applying a template to an AST. */ export declare class TemplateApplier { private readonly cursor; private readonly coordinates; private readonly ast; constructor(cursor: Cursor, coordinates: JavaCoordinates, ast: J); /** * Applies the template to the current AST. * * @returns A Promise resolving to the modified AST */ apply(): Promise; /** * Applies the template to an expression. * * @returns A Promise resolving to the modified AST */ private applyInternal; /** The node holding the tree being replaced and the id it holds it under, per the cursor. */ private replacedSlot; private format; private wrapTree; } //# sourceMappingURL=engine.d.ts.map