UNPKG

2.98 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 */
8/// <amd-module name="@angular/compiler-cli/src/ngtsc/program" />
9import ts from 'typescript';
10import * as api from '../transformers/api';
11import { NgCompiler } from './core';
12import { NgCompilerOptions } from './core/api';
13import { IndexedComponent } from './indexer';
14import { DeclarationNode } from './reflection';
15/**
16 * Entrypoint to the Angular Compiler (Ivy+) which sits behind the `api.Program` interface, allowing
17 * it to be a drop-in replacement for the legacy View Engine compiler to tooling such as the
18 * command-line main() function or the Angular CLI.
19 */
20export declare class NgtscProgram implements api.Program {
21 private options;
22 readonly compiler: NgCompiler;
23 /**
24 * The primary TypeScript program, which is used for analysis and emit.
25 */
26 private tsProgram;
27 private host;
28 private incrementalStrategy;
29 constructor(rootNames: ReadonlyArray<string>, options: NgCompilerOptions, delegateHost: api.CompilerHost, oldProgram?: NgtscProgram);
30 getTsProgram(): ts.Program;
31 getReuseTsProgram(): ts.Program;
32 getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
33 getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
34 getTsSemanticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
35 getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
36 getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
37 getNgSemanticDiagnostics(fileName?: string | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
38 /**
39 * Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
40 * loading of any resources during the process.
41 *
42 * This is used by the Angular CLI to allow for spawning (async) child compilations for things
43 * like SASS files used in `styleUrls`.
44 */
45 loadNgStructureAsync(): Promise<void>;
46 listLazyRoutes(entryRoute?: string | undefined): api.LazyRoute[];
47 private emitXi18n;
48 emit(opts?: {
49 emitFlags?: api.EmitFlags | undefined;
50 cancellationToken?: ts.CancellationToken | undefined;
51 customTransformers?: api.CustomTransformers | undefined;
52 emitCallback?: api.TsEmitCallback | undefined;
53 mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback | undefined;
54 } | undefined): ts.EmitResult;
55 getIndexedComponents(): Map<DeclarationNode, IndexedComponent>;
56 getEmittedSourceFiles(): Map<string, ts.SourceFile>;
57}