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/tsc_plugin" />
|
---|
9 | import * as ts from 'typescript';
|
---|
10 | import { NgCompiler } from './core';
|
---|
11 | import { UnifiedModulesHost } from './core/api';
|
---|
12 | /**
|
---|
13 | * A `ts.CompilerHost` which also returns a list of input files, out of which the `ts.Program`
|
---|
14 | * should be created.
|
---|
15 | *
|
---|
16 | * Currently mirrored from @bazel/typescript/internal/tsc_wrapped/plugin_api (with the naming of
|
---|
17 | * `fileNameToModuleName` corrected).
|
---|
18 | */
|
---|
19 | interface PluginCompilerHost extends ts.CompilerHost, Partial<UnifiedModulesHost> {
|
---|
20 | readonly inputFiles: ReadonlyArray<string>;
|
---|
21 | }
|
---|
22 | /**
|
---|
23 | * Mirrors the plugin interface from tsc_wrapped which is currently under active development. To
|
---|
24 | * enable progress to be made in parallel, the upstream interface isn't implemented directly.
|
---|
25 | * Instead, `TscPlugin` here is structurally assignable to what tsc_wrapped expects.
|
---|
26 | */
|
---|
27 | interface TscPlugin {
|
---|
28 | readonly name: string;
|
---|
29 | wrapHost(host: ts.CompilerHost & Partial<UnifiedModulesHost>, inputFiles: ReadonlyArray<string>, options: ts.CompilerOptions): PluginCompilerHost;
|
---|
30 | setupCompilation(program: ts.Program, oldProgram?: ts.Program): {
|
---|
31 | ignoreForDiagnostics: Set<ts.SourceFile>;
|
---|
32 | ignoreForEmit: Set<ts.SourceFile>;
|
---|
33 | };
|
---|
34 | getDiagnostics(file?: ts.SourceFile): ts.Diagnostic[];
|
---|
35 | getOptionDiagnostics(): ts.Diagnostic[];
|
---|
36 | getNextProgram(): ts.Program;
|
---|
37 | createTransformers(): ts.CustomTransformers;
|
---|
38 | }
|
---|
39 | /**
|
---|
40 | * A plugin for `tsc_wrapped` which allows Angular compilation from a plain `ts_library`.
|
---|
41 | */
|
---|
42 | export declare class NgTscPlugin implements TscPlugin {
|
---|
43 | private ngOptions;
|
---|
44 | name: string;
|
---|
45 | private options;
|
---|
46 | private host;
|
---|
47 | private _compiler;
|
---|
48 | get compiler(): NgCompiler;
|
---|
49 | constructor(ngOptions: {});
|
---|
50 | wrapHost(host: ts.CompilerHost & Partial<UnifiedModulesHost>, inputFiles: readonly string[], options: ts.CompilerOptions): PluginCompilerHost;
|
---|
51 | setupCompilation(program: ts.Program, oldProgram?: ts.Program): {
|
---|
52 | ignoreForDiagnostics: Set<ts.SourceFile>;
|
---|
53 | ignoreForEmit: Set<ts.SourceFile>;
|
---|
54 | };
|
---|
55 | getDiagnostics(file?: ts.SourceFile): ts.Diagnostic[];
|
---|
56 | getOptionDiagnostics(): ts.Diagnostic[];
|
---|
57 | getNextProgram(): ts.Program;
|
---|
58 | createTransformers(): ts.CustomTransformers;
|
---|
59 | }
|
---|
60 | export {};
|
---|