UNPKG

2.65 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import ts from 'typescript';
9import * as api from '../transformers/api';
10import { NgCompiler } from './core';
11import { NgCompilerOptions } from './core/api';
12import { IndexedComponent } from './indexer';
13import { DeclarationNode } from './reflection';
14/**
15 * Entrypoint to the Angular Compiler (Ivy+) which sits behind the `api.Program` interface, allowing
16 * it to be a drop-in replacement for the legacy View Engine compiler to tooling such as the
17 * command-line main() function or the Angular CLI.
18 */
19export declare class NgtscProgram implements api.Program {
20 private options;
21 readonly compiler: NgCompiler;
22 /**
23 * The primary TypeScript program, which is used for analysis and emit.
24 */
25 private tsProgram;
26 private host;
27 private incrementalStrategy;
28 constructor(rootNames: ReadonlyArray<string>, options: NgCompilerOptions, delegateHost: api.CompilerHost, oldProgram?: NgtscProgram);
29 getTsProgram(): ts.Program;
30 getReuseTsProgram(): ts.Program;
31 getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
32 getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
33 getTsSemanticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
34 getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
35 getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
36 getNgSemanticDiagnostics(fileName?: string | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
37 /**
38 * Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
39 * loading of any resources during the process.
40 *
41 * This is used by the Angular CLI to allow for spawning (async) child compilations for things
42 * like SASS files used in `styleUrls`.
43 */
44 loadNgStructureAsync(): Promise<void>;
45 listLazyRoutes(entryRoute?: string | undefined): api.LazyRoute[];
46 private emitXi18n;
47 emit<CbEmitRes extends ts.EmitResult>(opts?: api.EmitOptions<CbEmitRes> | undefined): ts.EmitResult;
48 getIndexedComponents(): Map<DeclarationNode, IndexedComponent>;
49 getEmittedSourceFiles(): Map<string, ts.SourceFile>;
50}