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

Function tryFileLookup

test/fixtures/snapshot/typescript.js:43629–43645  ·  view source on GitHub ↗
(fileName, onlyRecordFailures, state)

Source from the content-addressed store, hash-verified

43627 return ts.forEach(state.compilerOptions.moduleSuffixes, function (suffix) { return tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state); });
43628 }
43629 function tryFileLookup(fileName, onlyRecordFailures, state) {
43630 if (!onlyRecordFailures) {
43631 if (state.host.fileExists(fileName)) {
43632 if (state.traceEnabled) {
43633 trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName);
43634 }
43635 return fileName;
43636 }
43637 else {
43638 if (state.traceEnabled) {
43639 trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName);
43640 }
43641 }
43642 }
43643 state.failedLookupLocations.push(fileName);
43644 return undefined;
43645 }
43646 function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
43647 if (considerPackageJson === void 0) { considerPackageJson = true; }
43648 var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;

Callers 1

tryFileFunction · 0.85

Calls 2

traceFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…