UNPKG

3.18 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.dev/license
7 */
8import ts from 'typescript';
9import * as api from '../transformers/api';
10import { NgCompiler } from './core';
11import { NgCompilerOptions } from './core/api';
12import { DocEntry } from './docs';
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<CbEmitRes extends ts.EmitResult>(opts?: api.EmitOptions<CbEmitRes> | undefined): ts.EmitResult;
49 getIndexedComponents(): Map<DeclarationNode, IndexedComponent>;
50 /**
51 * Gets information for the current program that may be used to generate API
52 * reference documentation. This includes Angular-specific information, such
53 * as component inputs and outputs.
54 *
55 * @param entryPoint Path to the entry point for the package for which API
56 * docs should be extracted.
57 */
58 getApiDocumentation(entryPoint: string, privateModules: Set<string>): {
59 entries: DocEntry[];
60 symbols: Map<string, string>;
61 };
62 getEmittedSourceFiles(): Map<string, ts.SourceFile>;
63}