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

Function mapReferencesIntoArray

test/fixtures/snapshot/typescript.js:108364–108398  ·  view source on GitHub ↗
(references, outputFilePath)

Source from the content-addressed store, hash-verified

108362 return __assign({ fileName: typeName, pos: -1, end: -1 }, (mode ? { resolutionMode: mode } : undefined));
108363 }
108364 function mapReferencesIntoArray(references, outputFilePath) {
108365 return function (file) {
108366 var declFileName;
108367 if (file.isDeclarationFile) { // Neither decl files or js should have their refs changed
108368 declFileName = file.fileName;
108369 }
108370 else {
108371 if (isBundledEmit && ts.contains(node.sourceFiles, file))
108372 return; // Omit references to files which are being merged
108373 var paths = ts.getOutputPathsFor(file, host, /*forceDtsPaths*/ true);
108374 declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
108375 }
108376 if (declFileName) {
108377 var specifier = ts.moduleSpecifiers.getModuleSpecifier(options, currentSourceFile, ts.toPath(outputFilePath, host.getCurrentDirectory(), host.getCanonicalFileName), ts.toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName), host);
108378 if (!ts.pathIsRelative(specifier)) {
108379 // If some compiler option/symlink/whatever allows access to the file containing the ambient module declaration
108380 // via a non-relative name, emit a type reference directive to that non-relative name, rather than
108381 // a relative path to the declaration file
108382 recordTypeReferenceDirectivesIfNecessary([[specifier, /*mode*/ undefined]]);
108383 return;
108384 }
108385 var fileName = ts.getRelativePathToDirectoryOrUrl(outputFilePath, declFileName, host.getCurrentDirectory(), host.getCanonicalFileName,
108386 /*isAbsolutePathAnUrl*/ false);
108387 if (ts.startsWith(fileName, "./") && ts.hasExtension(fileName)) {
108388 fileName = fileName.substring(2);
108389 }
108390 // omit references to files from node_modules (npm may disambiguate module
108391 // references when installing this package, making the path is unreliable).
108392 if (ts.startsWith(fileName, "node_modules/") || ts.pathContainsNodeModules(fileName)) {
108393 return;
108394 }
108395 references.push({ pos: -1, end: -1, fileName: fileName });
108396 }
108397 };
108398 }
108399 }
108400 function collectReferences(sourceFile, ret) {
108401 if (noResolve || (!ts.isUnparsedSource(sourceFile) && ts.isSourceFileJS(sourceFile)))

Callers 1

transformRootFunction · 0.85

Calls 3

containsMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected