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

Function updateOptionsForWatchFile

test/fixtures/snapshot/typescript.js:6804–6830  ·  view source on GitHub ↗
(options, useNonPollingWatchers)

Source from the content-addressed store, hash-verified

6802 return fixedChunkSizePollingWatchFile || (fixedChunkSizePollingWatchFile = createFixedChunkSizePollingWatchFile({ getModifiedTime: getModifiedTime, setTimeout: setTimeout }));
6803 }
6804 function updateOptionsForWatchFile(options, useNonPollingWatchers) {
6805 if (options && options.watchFile !== undefined)
6806 return options;
6807 switch (tscWatchFile) {
6808 case "PriorityPollingInterval":
6809 // Use polling interval based on priority when create watch using host.watchFile
6810 return { watchFile: ts.WatchFileKind.PriorityPollingInterval };
6811 case "DynamicPriorityPolling":
6812 // Use polling interval but change the interval depending on file changes and their default polling interval
6813 return { watchFile: ts.WatchFileKind.DynamicPriorityPolling };
6814 case "UseFsEvents":
6815 // Use notifications from FS to watch with falling back to fs.watchFile
6816 return generateWatchFileOptions(ts.WatchFileKind.UseFsEvents, ts.PollingWatchKind.PriorityInterval, options);
6817 case "UseFsEventsWithFallbackDynamicPolling":
6818 // Use notifications from FS to watch with falling back to dynamic watch file
6819 return generateWatchFileOptions(ts.WatchFileKind.UseFsEvents, ts.PollingWatchKind.DynamicPriority, options);
6820 case "UseFsEventsOnParentDirectory":
6821 useNonPollingWatchers = true;
6822 // fall through
6823 default:
6824 return useNonPollingWatchers ?
6825 // Use notifications from FS to watch with falling back to fs.watchFile
6826 generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6827 // Default to do not use fixed polling interval
6828 { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6829 }
6830 }
6831 function generateWatchFileOptions(watchFile, fallbackPolling, options) {
6832 var defaultFallbackPolling = options === null || options === void 0 ? void 0 : options.fallbackPolling;
6833 return {

Callers 1

watchFileFunction · 0.85

Calls 1

generateWatchFileOptionsFunction · 0.85

Tested by

no test coverage detected