保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 26a09f08cf1ed43c640879f23fdad56c5c9282f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions = []) {
    const baseWatchCompilerHost = typescript.createWatchCompilerHost(parsedCommandLine.fileNames, parsedCommandLine.options, system, createProgram, reportDiagnostic, reportWatchStatus, parsedCommandLine.projectReferences);
    let controlledWatchCompilerHost = Object.assign(Object.assign({}, baseWatchCompilerHost), { createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences) {
            hostExtensions.forEach((hostExtension) => {
                if (compilerHost && hostExtension.extendCompilerHost) {
                    compilerHost = hostExtension.extendCompilerHost(compilerHost, parsedCommandLine);
                }
            });
            return baseWatchCompilerHost.createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences);
        },
        afterProgramCreate(program) {
            if (afterProgramCreate) {
                afterProgramCreate(program);
            }
        },
        onWatchStatusChange() {
            // do nothing
        }, watchFile: system.watchFile, watchDirectory: system.watchDirectory, setTimeout: system.setTimeout, clearTimeout: system.clearTimeout, fileExists: system.fileExists, readFile: system.readFile, directoryExists: system.directoryExists, getDirectories: system.getDirectories, realpath: system.realpath });
    hostExtensions.forEach((hostExtension) => {
        if (hostExtension.extendWatchCompilerHost) {
            controlledWatchCompilerHost = hostExtension.extendWatchCompilerHost(controlledWatchCompilerHost, parsedCommandLine);
        }
    });
    return controlledWatchCompilerHost;
}
exports.createControlledWatchCompilerHost = createControlledWatchCompilerHost;