UNPKG

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