UNPKG

2.79 kBTypeScriptView Raw
1import * as ASTv1 from '../v1/api';
2export declare const voidMap: {
3 [tagName: string]: boolean;
4};
5export interface PrinterOptions {
6 entityEncoding: 'transformed' | 'raw';
7 /**
8 * Used to override the mechanism of printing a given AST.Node.
9 *
10 * This will generally only be useful to source -> source codemods
11 * where you would like to specialize/override the way a given node is
12 * printed (e.g. you would like to preserve as much of the original
13 * formatting as possible).
14 *
15 * When the provided override returns undefined, the default built in printing
16 * will be done for the AST.Node.
17 *
18 * @param ast the ast node to be printed
19 * @param options the options specified during the print() invocation
20 */
21 override?(ast: ASTv1.Node, options: PrinterOptions): void | string;
22}
23export default class Printer {
24 private buffer;
25 private options;
26 constructor(options: PrinterOptions);
27 handledByOverride(node: ASTv1.Node, ensureLeadingWhitespace?: boolean): boolean;
28 Node(node: ASTv1.Node): void;
29 Expression(expression: ASTv1.Expression): void;
30 Literal(literal: ASTv1.Literal): void;
31 TopLevelStatement(statement: ASTv1.TopLevelStatement | ASTv1.Template | ASTv1.AttrNode): void;
32 Block(block: ASTv1.Block | ASTv1.Program | ASTv1.Template): void;
33 TopLevelStatements(statements: ASTv1.TopLevelStatement[]): void;
34 ElementNode(el: ASTv1.ElementNode): void;
35 OpenElementNode(el: ASTv1.ElementNode): void;
36 CloseElementNode(el: ASTv1.ElementNode): void;
37 AttrNode(attr: ASTv1.AttrNode): void;
38 AttrNodeValue(value: ASTv1.AttrNode['value']): void;
39 TextNode(text: ASTv1.TextNode, isAttr?: boolean): void;
40 MustacheStatement(mustache: ASTv1.MustacheStatement): void;
41 BlockStatement(block: ASTv1.BlockStatement): void;
42 BlockParams(blockParams: string[]): void;
43 PartialStatement(partial: ASTv1.PartialStatement): void;
44 ConcatStatement(concat: ASTv1.ConcatStatement): void;
45 MustacheCommentStatement(comment: ASTv1.MustacheCommentStatement): void;
46 ElementModifierStatement(mod: ASTv1.ElementModifierStatement): void;
47 CommentStatement(comment: ASTv1.CommentStatement): void;
48 PathExpression(path: ASTv1.PathExpression): void;
49 SubExpression(sexp: ASTv1.SubExpression): void;
50 Params(params: ASTv1.Expression[]): void;
51 Hash(hash: ASTv1.Hash): void;
52 HashPair(pair: ASTv1.HashPair): void;
53 StringLiteral(str: ASTv1.StringLiteral): void;
54 BooleanLiteral(bool: ASTv1.BooleanLiteral): void;
55 NumberLiteral(number: ASTv1.NumberLiteral): void;
56 UndefinedLiteral(node: ASTv1.UndefinedLiteral): void;
57 NullLiteral(node: ASTv1.NullLiteral): void;
58 print(node: ASTv1.Node): string;
59}
60//# sourceMappingURL=printer.d.ts.map
\No newline at end of file