(host)
| 123342 | } |
| 123343 | ts.createWatchCompilerHost = createWatchCompilerHost; |
| 123344 | function createWatchProgram(host) { |
| 123345 | var builderProgram; |
| 123346 | var reloadLevel; // level to indicate if the program needs to be reloaded from config file/just filenames etc |
| 123347 | var missingFilesMap; // Map of file watchers for the missing files |
| 123348 | var packageJsonMap; // map of watchers for package json files used in module resolution |
| 123349 | var watchedWildcardDirectories; // map of watchers for the wild card directories in the config file |
| 123350 | var timerToUpdateProgram; // timer callback to recompile the program |
| 123351 | var timerToInvalidateFailedLookupResolutions; // timer callback to invalidate resolutions for changes in failed lookup locations |
| 123352 | var parsedConfigs; // Parsed commandline and watching cached for referenced projects |
| 123353 | var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects |
| 123354 | var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation |
| 123355 | var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution |
| 123356 | var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created |
| 123357 | var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info |
| 123358 | var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files |
| 123359 | var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations |
| 123360 | var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); |
| 123361 | var currentDirectory = host.getCurrentDirectory(); |
| 123362 | var configFileName = host.configFileName, _a = host.optionsToExtend, optionsToExtendForConfigFile = _a === void 0 ? {} : _a, watchOptionsToExtend = host.watchOptionsToExtend, extraFileExtensions = host.extraFileExtensions, createProgram = host.createProgram; |
| 123363 | var rootFileNames = host.rootFiles, compilerOptions = host.options, watchOptions = host.watchOptions, projectReferences = host.projectReferences; |
| 123364 | var wildcardDirectories; |
| 123365 | var configFileParsingDiagnostics; |
| 123366 | var canConfigFileJsonReportNoInputFiles = false; |
| 123367 | var hasChangedConfigFileParsingErrors = false; |
| 123368 | var cachedDirectoryStructureHost = configFileName === undefined ? undefined : ts.createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames); |
| 123369 | var directoryStructureHost = cachedDirectoryStructureHost || host; |
| 123370 | var parseConfigFileHost = ts.parseConfigHostFromCompilerHostLike(host, directoryStructureHost); |
| 123371 | // From tsc we want to get already parsed result and hence check for rootFileNames |
| 123372 | var newLine = updateNewLine(); |
| 123373 | if (configFileName && host.configFileParsingResult) { |
| 123374 | setConfigFileParsingResult(host.configFileParsingResult); |
| 123375 | newLine = updateNewLine(); |
| 123376 | } |
| 123377 | reportWatchDiagnostic(ts.Diagnostics.Starting_compilation_in_watch_mode); |
| 123378 | if (configFileName && !host.configFileParsingResult) { |
| 123379 | newLine = ts.getNewLineCharacter(optionsToExtendForConfigFile, function () { return host.getNewLine(); }); |
| 123380 | ts.Debug.assert(!rootFileNames); |
| 123381 | parseConfigFile(); |
| 123382 | newLine = updateNewLine(); |
| 123383 | } |
| 123384 | var _b = ts.createWatchFactory(host, compilerOptions), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory, writeLog = _b.writeLog; |
| 123385 | var getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); |
| 123386 | writeLog("Current directory: ".concat(currentDirectory, " CaseSensitiveFileNames: ").concat(useCaseSensitiveFileNames)); |
| 123387 | var configFileWatcher; |
| 123388 | if (configFileName) { |
| 123389 | configFileWatcher = watchFile(configFileName, scheduleProgramReload, ts.PollingInterval.High, watchOptions, ts.WatchType.ConfigFile); |
| 123390 | } |
| 123391 | var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return compilerOptions; }, directoryStructureHost); |
| 123392 | ts.setGetSourceFileAsHashVersioned(compilerHost, host); |
| 123393 | // Members for CompilerHost |
| 123394 | var getNewSourceFile = compilerHost.getSourceFile; |
| 123395 | compilerHost.getSourceFile = function (fileName) { |
| 123396 | var args = []; |
| 123397 | for (var _i = 1; _i < arguments.length; _i++) { |
| 123398 | args[_i - 1] = arguments[_i]; |
| 123399 | } |
| 123400 | return getVersionedSourceFileByPath.apply(void 0, __spreadArray([fileName, toPath(fileName)], args, false)); |
| 123401 | }; |
nothing calls this directly
no test coverage detected
searching dependent graphs…