UNPKG

1.76 kBTypeScriptView Raw
1import { PrecompileOptions } from '../parser/tokenizer-event-handlers';
2import { SourceLocation } from '../source/location';
3import { Source } from '../source/source';
4import { SourceSpan } from '../source/span';
5import { BlockSymbolTable, SymbolTable } from '../symbol-table';
6import * as ASTv1 from '../v1/api';
7import * as ASTv2 from './api';
8import { Builder } from './builders';
9import { Resolution } from './loose-resolution';
10export declare function normalize(source: Source, options?: PrecompileOptions): [ast: ASTv2.Template, locals: string[]];
11/**
12 * A `BlockContext` represents the block that a particular AST node is contained inside of.
13 *
14 * `BlockContext` is aware of template-wide options (such as strict mode), as well as the bindings
15 * that are in-scope within that block.
16 *
17 * Concretely, it has the `PrecompileOptions` and current `SymbolTable`, and provides
18 * facilities for working with those options.
19 *
20 * `BlockContext` is stateless.
21 */
22export declare class BlockContext<Table extends SymbolTable = SymbolTable> {
23 readonly source: Source;
24 private readonly options;
25 readonly table: Table;
26 readonly builder: Builder;
27 constructor(source: Source, options: PrecompileOptions, table: Table);
28 get strict(): boolean;
29 loc(loc: SourceLocation): SourceSpan;
30 resolutionFor<N extends ASTv1.CallNode | ASTv1.PathExpression>(node: N, resolution: Resolution<N>): {
31 resolution: ASTv2.FreeVarResolution;
32 } | {
33 resolution: 'error';
34 path: string;
35 head: string;
36 };
37 private isFreeVar;
38 hasBinding(name: string): boolean;
39 child(blockParams: string[]): BlockContext<BlockSymbolTable>;
40 customizeComponentName(input: string): string;
41}
42//# sourceMappingURL=normalize.d.ts.map
\No newline at end of file