/** * Ahead-of-time expression compiler. * * Rewrites a `bq-*` directive expression into a `with`-free arrow function that * reads free identifiers from a context parameter — e.g. `count + 1` becomes * `($c) => ($c.count + 1)`. Because the output contains no `with` and no * `new Function()`, the emitted module is safe under a strict CSP that omits * `'unsafe-eval'`, and it skips the runtime parse on the hot path. * * The transform is intentionally conservative: any construct it cannot prove * safe to rewrite (assignments other than `++`/`--`, arrow/function bodies, * `new`, spread, regex/template literals, comments, …) makes it bail, and the * caller falls back to the runtime evaluator for that expression. This keeps * the compiled and runtime paths behaviourally identical. * * @module bquery/view/compiler */ import type { CompiledExpression } from './types'; /** Default context parameter name — unlikely to collide with author vars. */ export declare const DEFAULT_PARAM = "__bq_ctx"; /** * Globals left un-prefixed so they resolve from the JS global scope (mirroring * the runtime `with(ctx)` behaviour, where a name absent from the context falls * through to the global). A context value shadowing one of these is the rare * case the author can resolve with the `globals` option. */ export declare const DEFAULT_GLOBALS: ReadonlySet; /** * Compiles a single directive expression to a `with`-free arrow function. * * @example * ```ts * compileExpression('count + 1'); * // → { ok: true, expression: 'count + 1', code: '($c) => ($c.count + 1)' } * ``` */ export declare const compileExpression: (expression: string, options?: { param?: string; globals?: Iterable; }) => CompiledExpression; //# sourceMappingURL=expression.d.ts.map