/** * @license * Copyright Google Inc. 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, CommentStmt, ConditionalExpr, DeclareFunctionStmt, DeclareVarStmt, ExpressionStatement, ExpressionVisitor, ExternalExpr, FunctionExpr, IfStmt, InstantiateExpr, InvokeFunctionExpr, InvokeMethodExpr, JSDocCommentStmt, LiteralArrayExpr, LiteralExpr, LiteralMapExpr, NotExpr, ParseSourceSpan, PartialModule, ReadKeyExpr, ReadPropExpr, ReadVarExpr, ReturnStatement, Statement, StatementVisitor, ThrowStmt, TryCatchStmt, TypeofExpr, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr } from '@angular/compiler'; import * as ts from 'typescript'; export interface Node { sourceSpan: ParseSourceSpan | null; } export declare class TypeScriptNodeEmitter { updateSourceFile(sourceFile: ts.SourceFile, stmts: Statement[], preamble?: string): [ts.SourceFile, Map]; /** Creates a not emitted statement containing the given comment. */ createCommentStatement(sourceFile: ts.SourceFile, comment: string): ts.Statement; } /** * 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, context: ts.TransformationContext): [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 _nodeMap; private _importsWithPrefixes; private _reexports; private _templateSources; private _exportedVariableIdentifiers; /** * 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 record; 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; visitCommentStmt(stmt: CommentStmt, sourceFile: ts.SourceFile): ts.NotEmittedStatement; visitJSDocCommentStmt(stmt: JSDocCommentStmt, sourceFile: ts.SourceFile): ts.NotEmittedStatement; private createCommentStmt; 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; visitInvokeMethodExpr(expr: InvokeMethodExpr): RecordedNode; visitInvokeFunctionExpr(expr: InvokeFunctionExpr): RecordedNode; visitInstantiateExpr(expr: InstantiateExpr): RecordedNode; visitLiteralExpr(expr: LiteralExpr): RecordedNode)>; visitExternalExpr(expr: ExternalExpr): RecordedNode; visitConditionalExpr(expr: ConditionalExpr): RecordedNode; visitNotExpr(expr: NotExpr): RecordedNode; visitAssertNotNullExpr(expr: AssertNotNull): RecordedNode; visitCastExpr(expr: CastExpr): RecordedNode; visitFunctionExpr(expr: FunctionExpr): 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; }