import type { Provider } from "./provider.js";
/** A `{{var}}` references a field the (contextual) payload does not declare. */
export declare const ERR_VAR_NOT_ON_PAYLOAD = "ERR_VAR_NOT_ON_PAYLOAD";
/** A `{{> ref}}` partial does not resolve in the provider. */
export declare const ERR_PARTIAL_UNRESOLVED = "ERR_PARTIAL_UNRESOLVED";
/** A declared @requiredSlots slot is never referenced by the template (warning). */
export declare const ERR_REQUIRED_SLOT_UNUSED = "ERR_REQUIRED_SLOT_UNUSED";
/** A declared @requiredTags output tag is absent from the template text. */
export declare const ERR_OUTPUT_TAG_MISSING = "ERR_OUTPUT_TAG_MISSING";
/**
* A plain field-tree node mirroring an `object.value` view-object's field walk.
* `fields` present → a context-pushing field (object / array-of-object); absent
* → a scalar (string/number/boolean/scalar-array).
*/
export interface PayloadField {
name: string;
fields?: PayloadField[];
}
export interface VerifyError {
code: string;
/** The offending variable path, partial ref, or slot name. */
path: string;
}
export interface VerifyOptions {
/** When given, `{{> ref}}` partials are resolved + their bodies recursed. */
provider?: Provider;
/** Slots that MUST be referenced; an unused one is reported as a warning. */
requiredSlots?: string[];
/**
* Output tags the rendered text is contracted to contain. Each must appear as
* both an opening form (`` or whitespace, so attributes are
* allowed) and a closing `` — across the body AND resolved partials.
*/
requiredTags?: string[];
}
/**
* The context stack — innermost context last, mirroring Mustache lookup order.
* Generic over the field node so consumers (e.g. the docs annotator) can resolve
* an ENRICHED field tree (carrying owner/type metadata) through the EXACT same
* walk verify uses, guaranteeing the two surfaces agree.
*/
export type ResolveStack = readonly F[][];
/**
* Resolve a (possibly dotted) variable path the way Mustache does: the FIRST
* segment is looked up through the context stack (innermost → outermost); each
* remaining segment is a direct descent into the resolved field's `fields`.
* Returns the resolved field, or undefined if any segment is missing.
*
* EXPORTED so the docs annotator can share this ONE resolution (annotator ⇆
* verify must agree). Generic over the node type: an enriched tree resolves the
* same way, since only `name`/`fields` drive the walk.
*/
export declare function resolveTemplateVariable(stack: ResolveStack, path: string): F | undefined;
/**
* Parse a template into Mustache tokens (`[type, value, start, end, subTokens?]`),
* the SAME parse verify walks. Exported so the docs annotator tokenizes through
* one parser (no divergent re-tokenization). Returns a readonly token list.
*/
export declare function parseTemplate(text: string): readonly (readonly unknown[])[];
/**
* Walk a Mustache template's tokens against a payload field tree, returning a
* list of drift errors. Context-sensitive: a section `{{#posts}}…{{/posts}}`
* over a container field checks its body against that field's element type.
*/
export declare function verify(templateText: string, fields: PayloadField[], opts?: VerifyOptions): VerifyError[];
//# sourceMappingURL=verify.d.ts.map