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

Function getAllDependencies

test/fixtures/snapshot/typescript.js:119913–119940  ·  view source on GitHub ↗

* Get all the dependencies of the sourceFile

(state, programOfThisState, sourceFile)

Source from the content-addressed store, hash-verified

119911 * Get all the dependencies of the sourceFile
119912 */
119913 function getAllDependencies(state, programOfThisState, sourceFile) {
119914 var compilerOptions = programOfThisState.getCompilerOptions();
119915 // With --out or --outFile all outputs go into single file, all files depend on each other
119916 if (ts.outFile(compilerOptions)) {
119917 return getAllFileNames(state, programOfThisState);
119918 }
119919 // If this is non module emit, or its a global file, it depends on all the source files
119920 if (!state.referencedMap || isFileAffectingGlobalScope(sourceFile)) {
119921 return getAllFileNames(state, programOfThisState);
119922 }
119923 // Get the references, traversing deep from the referenceMap
119924 var seenMap = new ts.Set();
119925 var queue = [sourceFile.resolvedPath];
119926 while (queue.length) {
119927 var path = queue.pop();
119928 if (!seenMap.has(path)) {
119929 seenMap.add(path);
119930 var references = state.referencedMap.getValues(path);
119931 if (references) {
119932 var iterator = references.keys();
119933 for (var iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
119934 queue.push(iterResult.value);
119935 }
119936 }
119937 }
119938 }
119939 return ts.arrayFrom(ts.mapDefinedIterator(seenMap.keys(), function (path) { var _a, _b; return (_b = (_a = programOfThisState.getSourceFileByPath(path)) === null || _a === void 0 ? void 0 : _a.fileName) !== null && _b !== void 0 ? _b : path; }));
119940 }
119941 BuilderState.getAllDependencies = getAllDependencies;
119942 /**
119943 * Gets the names of all files from the program

Callers

nothing calls this directly

Calls 8

getAllFileNamesFunction · 0.85
popMethod · 0.80
hasMethod · 0.65
addMethod · 0.65
keysMethod · 0.65
nextMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected