import type { Helper } from './helpers/type.js'; import type { BigodinOptions } from './options.js'; import type { LiteralValue } from './index.js'; /** * Template execution, holds contexts, extra helpers, data. */ export declare class Execution { readonly contexts: object[]; readonly extraHelpers: Map; readonly data: object; readonly maxExecutionMillis: number; readonly allowDefaultHelpers: boolean; /** * Indicates whether the execution has been halted by a flow control helper. */ isHalted: boolean; /** * Timestamp of the template execution start */ private startMillis; /** * Bigodin variables */ readonly variables: Record; /** * Per-iteration data frames populated by block iteration. Consumed by * path expressions resolving `@index`, `@key`, `@first`, `@last`. * Inner frames shadow outer frames (Handlebars uses `@../index` for * outer access, which bigodin does not support). */ private readonly dataFrames; /** * Template execution, holds contexts, extra helpers, data. * * @param {object[]} contexts Contexts from which bigodin path expressions will evaluate * @param {Map} extraHelpers Extra helpers that can be called other than default bigodin helpers * @param {object?} data Data that cannot be accessed from the template but can be accessed and modified from helpers * @param {number} maxExecutionMillis Maximum milliseconds allowed for the template execution * @param {boolean} allowDefaultHelpers Indicates whether the execution allows default helpers. Default helpers are provided by bigodin. */ private constructor(); /** * Current context to be used by path expressions. * * @return {object} Current context to be used by path expressions. */ get context(): object; /** * Push a new context on the stack. * Used to change context allowing for $parent and $root access of previous contexts. */ pushContext(context: object): void; /** * Pop the current context from the stack. */ popContext(): void; /** * Pop the top `count` contexts from the stack. */ popContexts(count: number): void; /** * Block-param scopes (`as |a b|`). Each frame maps the declared names to the * values the block yields. Consumed by path expressions resolving a bare * leading identifier; inner frames shadow outer ones. */ private readonly paramFrames; /** * Push a block-param frame mapping `names` to `values` positionally. */ pushParamFrame(names: string[], values: unknown[]): void; /** * Pop the most recent block-param frame. */ popParamFrame(): void; /** * Resolve a block-param by name, innermost frame first. Returns whether a * param with that name exists (so a param bound to `undefined` still shadows * the surrounding context) along with its value. */ getParam(name: string): { found: boolean; value: unknown; }; /** * Push a data frame for the current iteration. */ pushDataFrame(frame: Record): void; /** * Pop the current iteration's data frame. */ popDataFrame(): void; /** * Resolve `@` data variables (e.g., `index`, `key`, `first`, `last`). * Returns `undefined` outside of an iteration. */ getDataVar(name: string): unknown; /** * Halt the execution. */ halt(): void; /** * Milliseconds since the template execution started. * * @return {number} Milliseconds since the template execution started. */ get elapsedMillis(): number; /** * Creates an execution from context, helpers and options. * * @param {object} context Context from which bigodin path expressions will evaluate * @param {Map?} extraHelpers Extra helpers that can be called other than default bigodin helpers * @param {BigodinOptions} options Options for the current execution only * @return {Execution} */ static of(context: object | undefined, extraHelpers?: Map, options?: BigodinOptions): Execution; }