MCPcopy Create free account
hub / github.com/nodejs/node / updateChildWatches

Function updateChildWatches

test/fixtures/snapshot/typescript.js:6682–6709  ·  view source on GitHub ↗
(parentDir, parentDirPath, options)

Source from the content-addressed store, hash-verified

6680 }
6681 }
6682 function updateChildWatches(parentDir, parentDirPath, options) {
6683 // Iterate through existing children and update the watches if needed
6684 var parentWatcher = cache.get(parentDirPath);
6685 if (!parentWatcher)
6686 return false;
6687 var newChildWatches;
6688 var hasChanges = ts.enumerateInsertsAndDeletes(directoryExists(parentDir) ? ts.mapDefined(getAccessibleSortedChildDirectories(parentDir), function (child) {
6689 var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
6690 // Filter our the symbolic link directories since those arent included in recursive watch
6691 // which is same behaviour when recursive: true is passed to fs.watch
6692 return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, ts.normalizePath(realpath(childFullName))) === 0 /* Comparison.EqualTo */ ? childFullName : undefined;
6693 }) : ts.emptyArray, parentWatcher.childWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
6694 parentWatcher.childWatches = newChildWatches || ts.emptyArray;
6695 return hasChanges;
6696 /**
6697 * Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list
6698 */
6699 function createAndAddChildDirectoryWatcher(childName) {
6700 var result = createDirectoryWatcher(childName, options);
6701 addChildDirectoryWatcher(result);
6702 }
6703 /**
6704 * Add child directory watcher to the new ChildDirectoryWatcher list
6705 */
6706 function addChildDirectoryWatcher(childWatcher) {
6707 (newChildWatches || (newChildWatches = [])).push(childWatcher);
6708 }
6709 }
6710 function isIgnoredPath(path, options) {
6711 return ts.some(ts.ignoredPaths, function (searchPath) { return isInPath(path, searchPath); }) ||
6712 isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames, getCurrentDirectory);

Callers 2

createDirectoryWatcherFunction · 0.85

Calls 4

directoryExistsFunction · 0.85
isIgnoredPathFunction · 0.85
realpathFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected