MCPcopy Index your code
hub / github.com/nodejs/node / watchReferencedProject

Function watchReferencedProject

test/fixtures/snapshot/typescript.js:123960–124013  ·  view source on GitHub ↗
(configFileName, configPath, commandLine)

Source from the content-addressed store, hash-verified

123958 }, ts.PollingInterval.High, watchOptions, watchType); }, toPath);
123959 }
123960 function watchReferencedProject(configFileName, configPath, commandLine) {
123961 var _a, _b, _c, _d, _e;
123962 // Watch file
123963 commandLine.watcher || (commandLine.watcher = watchFile(configFileName, function (_fileName, eventKind) {
123964 updateCachedSystemWithFile(configFileName, configPath, eventKind);
123965 var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
123966 if (config)
123967 config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
123968 resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
123969 scheduleProgramUpdate();
123970 }, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
123971 // Watch Wild card
123972 if ((_b = commandLine.parsedCommandLine) === null || _b === void 0 ? void 0 : _b.wildcardDirectories) {
123973 ts.updateWatchingWildcardDirectories(commandLine.watchedDirectories || (commandLine.watchedDirectories = new ts.Map()), new ts.Map(ts.getEntries((_c = commandLine.parsedCommandLine) === null || _c === void 0 ? void 0 : _c.wildcardDirectories)), function (directory, flags) {
123974 var _a;
123975 return watchDirectory(directory, function (fileOrDirectory) {
123976 var fileOrDirectoryPath = toPath(fileOrDirectory);
123977 // Since the file existence changed, update the sourceFiles cache
123978 if (cachedDirectoryStructureHost) {
123979 cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
123980 }
123981 nextSourceFileVersion(fileOrDirectoryPath);
123982 var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
123983 if (!(config === null || config === void 0 ? void 0 : config.parsedCommandLine))
123984 return;
123985 if (ts.isIgnoredFileFromWildCardWatching({
123986 watchedDirPath: toPath(directory),
123987 fileOrDirectory: fileOrDirectory,
123988 fileOrDirectoryPath: fileOrDirectoryPath,
123989 configFileName: configFileName,
123990 options: config.parsedCommandLine.options,
123991 program: config.parsedCommandLine.fileNames,
123992 currentDirectory: currentDirectory,
123993 useCaseSensitiveFileNames: useCaseSensitiveFileNames,
123994 writeLog: writeLog,
123995 toPath: toPath,
123996 }))
123997 return;
123998 // Reload is pending, do the reload
123999 if (config.reloadLevel !== ts.ConfigFileProgramReloadLevel.Full) {
124000 config.reloadLevel = ts.ConfigFileProgramReloadLevel.Partial;
124001 // Schedule Update the program
124002 scheduleProgramUpdate();
124003 }
124004 }, flags, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.WildcardDirectoryOfReferencedProject);
124005 });
124006 }
124007 else if (commandLine.watchedDirectories) {
124008 ts.clearMap(commandLine.watchedDirectories, ts.closeFileWatcherOf);
124009 commandLine.watchedDirectories = undefined;
124010 }
124011 // Watch extended config files
124012 updateExtendedConfigFilesWatches(configPath, (_d = commandLine.parsedCommandLine) === null || _d === void 0 ? void 0 : _d.options, ((_e = commandLine.parsedCommandLine) === null || _e === void 0 ? void 0 : _e.watchOptions) || watchOptions, ts.WatchType.ExtendedConfigOfReferencedProject);
124013 }
124014 }
124015 ts.createWatchProgram = createWatchProgram;
124016})(ts || (ts = {}));

Callers 1

getParsedCommandLineFunction · 0.85

Calls 9

scheduleProgramUpdateFunction · 0.85
watchDirectoryFunction · 0.85
toPathFunction · 0.85
nextSourceFileVersionFunction · 0.85
watchFileFunction · 0.70
getMethod · 0.65
getEntriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…