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

Function pullDiagnosticsFromCache

test/fixtures/snapshot/typescript.js:116926–116951  ·  view source on GitHub ↗
(names, containingFile)

Source from the content-addressed store, hash-verified

116924 }
116925 }
116926 function pullDiagnosticsFromCache(names, containingFile) {
116927 var _a;
116928 if (!moduleResolutionCache)
116929 return;
116930 var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
116931 var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
116932 var containingDir = ts.getDirectoryPath(containingFileName);
116933 var redirectedReference = getRedirectReferenceForResolution(containingFile);
116934 var i = 0;
116935 for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
116936 var n = names_4[_i];
116937 // mimics logic done in the resolution cache, should be resilient to upgrading it to use `FileReference`s for non-type-reference modal lookups to make it rely on the index in the list less
116938 var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
116939 var name = typeof n === "string" ? n : n.fileName;
116940 i++;
116941 // only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
116942 // (Since diagnostics are only issued via import or export map lookup)
116943 // This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
116944 // When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
116945 // APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
116946 if (ts.isExternalModuleNameRelative(name))
116947 continue;
116948 var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
116949 addResolutionDiagnostics(diags);
116950 }
116951 }
116952 function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
116953 if (!moduleNames.length)
116954 return ts.emptyArray;

Callers 1

resolveModuleNamesWorkerFunction · 0.85

Calls 5

getModeForFileReferenceFunction · 0.85
addResolutionDiagnosticsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…