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

Function visitDirectory

test/fixtures/snapshot/typescript.js:20665–20707  ·  view source on GitHub ↗
(path, absolutePath, depth)

Source from the content-addressed store, hash-verified

20663 }
20664 return ts.flatten(results);
20665 function visitDirectory(path, absolutePath, depth) {
20666 var canonicalPath = toCanonical(realpath(absolutePath));
20667 if (visited.has(canonicalPath))
20668 return;
20669 visited.set(canonicalPath, true);
20670 var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories;
20671 var _loop_1 = function (current) {
20672 var name = ts.combinePaths(path, current);
20673 var absoluteName = ts.combinePaths(absolutePath, current);
20674 if (extensions && !ts.fileExtensionIsOneOf(name, extensions))
20675 return "continue";
20676 if (excludeRegex && excludeRegex.test(absoluteName))
20677 return "continue";
20678 if (!includeFileRegexes) {
20679 results[0].push(name);
20680 }
20681 else {
20682 var includeIndex = ts.findIndex(includeFileRegexes, function (re) { return re.test(absoluteName); });
20683 if (includeIndex !== -1) {
20684 results[includeIndex].push(name);
20685 }
20686 }
20687 };
20688 for (var _i = 0, _b = ts.sort(files, ts.compareStringsCaseSensitive); _i < _b.length; _i++) {
20689 var current = _b[_i];
20690 _loop_1(current);
20691 }
20692 if (depth !== undefined) {
20693 depth--;
20694 if (depth === 0) {
20695 return;
20696 }
20697 }
20698 for (var _c = 0, _d = ts.sort(directories, ts.compareStringsCaseSensitive); _c < _d.length; _c++) {
20699 var current = _d[_c];
20700 var name = ts.combinePaths(path, current);
20701 var absoluteName = ts.combinePaths(absolutePath, current);
20702 if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
20703 (!excludeRegex || !excludeRegex.test(absoluteName))) {
20704 visitDirectory(name, absoluteName, depth);
20705 }
20706 }
20707 }
20708 }
20709 ts.matchFiles = matchFiles;
20710 /**

Callers 1

matchFilesFunction · 0.85

Calls 7

getFileSystemEntriesFunction · 0.85
_loop_1Function · 0.85
sortMethod · 0.80
realpathFunction · 0.70
hasMethod · 0.65
setMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…