UNPKG

2.22 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. 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/synthetic_files_compiler_host" />
9import { PluginCompilerHost } from '@bazel/typescript/internal/tsc_wrapped/plugin_api';
10import * as ts from 'typescript';
11/**
12 * Extension of the TypeScript compiler host that supports files added to the Program which
13 * were never on disk.
14 *
15 * This is used for backwards-compatibility with the ViewEngine compiler, which used ngsummary
16 * and ngfactory files as inputs to the program. We call these inputs "synthetic".
17 *
18 * They need to be program inputs because user code may import from these generated files.
19 *
20 * TODO(alxhub): remove this after all ng_module users have migrated to Ivy
21 */
22export declare class SyntheticFilesCompilerHost implements PluginCompilerHost {
23 private rootFiles;
24 private delegate;
25 /**
26 * SourceFiles which are added to the program but which never existed on disk.
27 */
28 syntheticFiles: Map<string, ts.SourceFile>;
29 constructor(rootFiles: string[], delegate: ts.CompilerHost, generatedFiles: (rootFiles: string[]) => {
30 [fileName: string]: (host: ts.CompilerHost) => ts.SourceFile | undefined;
31 });
32 fileExists(filePath: string): boolean;
33 /** Loads a source file from in-memory map, or delegates. */
34 getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void): ts.SourceFile | undefined;
35 readonly inputFiles: string[];
36 fileNameToModuleId(fileName: string): string;
37 getDefaultLibFileName(options: ts.CompilerOptions): string;
38 writeFile(fileName: string, content: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<ts.SourceFile> | undefined): void;
39 getCanonicalFileName(path: string): string;
40 getCurrentDirectory(): string;
41 useCaseSensitiveFileNames(): boolean;
42 getNewLine(): string;
43 getDirectories?: (path: string) => string[];
44 readFile(fileName: string): string | undefined;
45 trace(s: string): void;
46}