/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /// import { AssertNotNull, BinaryOperatorExpr, CastExpr, ClassStmt, CommaExpr, ConditionalExpr, DeclareFunctionStmt, DeclareVarStmt, ExpressionStatement, ExpressionVisitor, ExternalExpr, FunctionExpr, IfStmt, InstantiateExpr, InvokeFunctionExpr, LiteralArrayExpr, LiteralExpr, LiteralMapExpr, LocalizedString, NotExpr, ParseSourceSpan, PartialModule, ReadKeyExpr, ReadPropExpr, ReadVarExpr, ReturnStatement, Statement, StatementVisitor, TaggedTemplateExpr, ThrowStmt, TryCatchStmt, TypeofExpr, UnaryOperatorExpr, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr } from '@angular/compiler'; import ts from 'typescript'; export interface Node { sourceSpan: ParseSourceSpan | null; } export declare class TypeScriptNodeEmitter { private annotateForClosureCompiler; constructor(annotateForClosureCompiler: boolean); updateSourceFile(sourceFile: ts.SourceFile, stmts: Statement[], preamble?: string): [ ts.SourceFile, Map ]; } /** * Update the given source file to include the changes specified in module. * * The module parameter is treated as a partial module meaning that the statements are added to * the module instead of replacing the module. Also, any classes are treated as partial classes * and the included members are added to the class with the same name instead of a new class * being created. */ export declare function updateSourceFile(sourceFile: ts.SourceFile, module: PartialModule, annotateForClosureCompiler: boolean): [ts.SourceFile, Map]; export declare type RecordedNode = (T & { __recorded: any; }) | null; /** * Visits an output ast and produces the corresponding TypeScript synthetic nodes. */ export declare class NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor { private annotateForClosureCompiler; private _nodeMap; private _importsWithPrefixes; private _reexports; private _templateSources; private _exportedVariableIdentifiers; constructor(annotateForClosureCompiler: boolean); /** * Process the source file and collect exported identifiers that refer to variables. * * Only variables are collected because exported classes still exist in the module scope in * CommonJS, whereas variables have their declarations moved onto the `exports` object, and all * references are updated accordingly. */ loadExportedVariableIdentifiers(sourceFile: ts.SourceFile): void; getReexports(): ts.Statement[]; getImports(): ts.Statement[]; getNodeMap(): Map; updateSourceMap(statements: ts.Statement[]): void; private postProcess; private sourceRangeOf; private getModifiers; visitDeclareVarStmt(stmt: DeclareVarStmt): (ts.VariableStatement & { __recorded: any; }) | ((ts.VariableStatement & { __recorded: any; }) | (ts.ExportDeclaration & { __recorded: any; }) | null)[] | null; visitDeclareFunctionStmt(stmt: DeclareFunctionStmt): RecordedNode; visitExpressionStmt(stmt: ExpressionStatement): RecordedNode; visitReturnStmt(stmt: ReturnStatement): RecordedNode; visitDeclareClassStmt(stmt: ClassStmt): RecordedNode; visitIfStmt(stmt: IfStmt): RecordedNode; visitTryCatchStmt(stmt: TryCatchStmt): RecordedNode; visitThrowStmt(stmt: ThrowStmt): RecordedNode; visitWrappedNodeExpr(expr: WrappedNodeExpr): any; visitTypeofExpr(expr: TypeofExpr): RecordedNode; visitReadVarExpr(expr: ReadVarExpr): (ts.Identifier & { __recorded: any; }) | (ts.SuperExpression & { __recorded: any; }) | null; visitWriteVarExpr(expr: WriteVarExpr): RecordedNode; visitWriteKeyExpr(expr: WriteKeyExpr): RecordedNode; visitWritePropExpr(expr: WritePropExpr): RecordedNode; visitInvokeFunctionExpr(expr: InvokeFunctionExpr): RecordedNode; visitTaggedTemplateExpr(expr: TaggedTemplateExpr): RecordedNode; visitInstantiateExpr(expr: InstantiateExpr): RecordedNode; visitLiteralExpr(expr: LiteralExpr): RecordedNode; visitLocalizedString(expr: LocalizedString, context: any): void; visitExternalExpr(expr: ExternalExpr): RecordedNode; visitConditionalExpr(expr: ConditionalExpr): RecordedNode; visitNotExpr(expr: NotExpr): RecordedNode; visitAssertNotNullExpr(expr: AssertNotNull): RecordedNode; visitCastExpr(expr: CastExpr): RecordedNode; visitFunctionExpr(expr: FunctionExpr): RecordedNode; visitUnaryOperatorExpr(expr: UnaryOperatorExpr): RecordedNode; visitBinaryOperatorExpr(expr: BinaryOperatorExpr): RecordedNode; visitReadPropExpr(expr: ReadPropExpr): RecordedNode; visitReadKeyExpr(expr: ReadKeyExpr): RecordedNode; visitLiteralArrayExpr(expr: LiteralArrayExpr): RecordedNode; visitLiteralMapExpr(expr: LiteralMapExpr): RecordedNode; visitCommaExpr(expr: CommaExpr): RecordedNode; private _visitStatements; private _visitStatementsPrefix; private _visitIdentifier; }