UNPKG

1.6 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/perform_watch" />
9import * as ts from 'typescript';
10import { Diagnostics, ParsedConfiguration } from './perform_compile';
11import * as api from './transformers/api';
12export declare enum FileChangeEvent {
13 Change = 0,
14 CreateDelete = 1,
15 CreateDeleteDir = 2
16}
17export interface PerformWatchHost {
18 reportDiagnostics(diagnostics: Diagnostics): void;
19 readConfiguration(): ParsedConfiguration;
20 createCompilerHost(options: api.CompilerOptions): api.CompilerHost;
21 createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback | undefined;
22 onFileChange(options: api.CompilerOptions, listener: (event: FileChangeEvent, fileName: string) => void, ready: () => void): {
23 close: () => void;
24 };
25 setTimeout(callback: () => void, ms: number): any;
26 clearTimeout(timeoutId: any): void;
27}
28export declare function createPerformWatchHost(configFileName: string, reportDiagnostics: (diagnostics: Diagnostics) => void, existingOptions?: ts.CompilerOptions, createEmitCallback?: (options: api.CompilerOptions) => api.TsEmitCallback | undefined): PerformWatchHost;
29/**
30 * The logic in this function is adapted from `tsc.ts` from TypeScript.
31 */
32export declare function performWatchCompilation(host: PerformWatchHost): {
33 close: () => void;
34 ready: (cb: () => void) => void;
35 firstCompileResult: Diagnostics;
36};