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

Function secondaryLookup

test/fixtures/snapshot/typescript.js:42659–42682  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42657 }
42658 }
42659 function secondaryLookup() {
42660 var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile);
42661 if (initialLocationForSecondaryLookup !== undefined) {
42662 // check secondary locations
42663 if (traceEnabled) {
42664 trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
42665 }
42666 var result_4;
42667 if (!ts.isExternalModuleNameRelative(typeReferenceDirectiveName)) {
42668 var searchResult = loadModuleFromNearestNodeModulesDirectory(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, moduleResolutionState, /*cache*/ undefined, /*redirectedReference*/ undefined);
42669 result_4 = searchResult && searchResult.value;
42670 }
42671 else {
42672 var candidate = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName).path;
42673 result_4 = nodeLoadModuleByRelativeName(Extensions.DtsOnly, candidate, /*onlyRecordFailures*/ false, moduleResolutionState, /*considerPackageJson*/ true);
42674 }
42675 return resolvedTypeScriptOnly(result_4);
42676 }
42677 else {
42678 if (traceEnabled) {
42679 trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder);
42680 }
42681 }
42682 }
42683 }
42684 ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
42685 function getDefaultNodeResolutionFeatures(options) {

Callers 1

Calls 5

traceFunction · 0.85
resolvedTypeScriptOnlyFunction · 0.85

Tested by

no test coverage detected