ngast
Version:
Parsing tools for Angular. The project is an abstraction over the Angular compiler which provides friendly interface.
35 lines (34 loc) • 1.67 kB
TypeScript
import { TmplAstNode, TmplAstText, TmplAstElement, TmplAstIcu, TmplAstBoundText, TmplAstBoundEvent, TmplAstTemplate, TmplAstBoundAttribute, TmplAstTextAttribute, TmplAstContent, TmplAstVariable, TmplAstReference, TmplAstRecursiveVisitor } from '@angular/compiler';
import { LocalModuleScope } from '@angular/compiler-cli/src/ngtsc/scope';
import { ComponentSymbol } from './component.symbol';
import { DirectiveSymbol } from './directive.symbol';
import { WorkspaceSymbols } from './workspace.symbols';
export interface TemplateNode {
component: ComponentSymbol | null;
directives: DirectiveSymbol[];
name: string;
children: TemplateNode[];
attributes: string[];
variables: string[];
references: string[];
}
export declare class TransformTemplateVisitor implements TmplAstRecursiveVisitor {
private _componentScope;
private _workspace;
private _matcher;
constructor(_componentScope: LocalModuleScope, _workspace: WorkspaceSymbols);
visit(node: TmplAstNode): any;
visitElement(element: TmplAstElement): TemplateNode;
visitTemplate(template: TmplAstTemplate): TemplateNode;
visitContent(content: TmplAstContent): TemplateNode;
visitVariable(variable: TmplAstVariable): string;
visitReference(reference: TmplAstReference): string;
visitTextAttribute(attribute: TmplAstTextAttribute): string;
visitBoundAttribute(attribute: TmplAstBoundAttribute): string;
visitBoundEvent(attribute: TmplAstBoundEvent): string;
visitText(_: TmplAstText): void;
visitBoundText(_: TmplAstBoundText): void;
visitIcu(_: TmplAstIcu): void;
private _visitElementOrTemplate;
private _getDirectives;
}