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

Function isFixPossiblyReExportingImportingFile

test/fixtures/snapshot/typescript.js:153472–153482  ·  view source on GitHub ↗
(fix, importingFile, compilerOptions, toPath)

Source from the content-addressed store, hash-verified

153470 // (e.g. `export * from "../whatever"`) or are not named "index" (we don't even try to consider
153471 // this if we're in a resolution mode where you can't drop trailing "/index" from paths).
153472 function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath) {
153473 var _a;
153474 if (fix.isReExport &&
153475 ((_a = fix.exportInfo) === null || _a === void 0 ? void 0 : _a.moduleFileName) &&
153476 ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs &&
153477 isIndexFileName(fix.exportInfo.moduleFileName)) {
153478 var reExportDir = toPath(ts.getDirectoryPath(fix.exportInfo.moduleFileName));
153479 return ts.startsWith((importingFile.path), reExportDir);
153480 }
153481 return false;
153482 }
153483 function isIndexFileName(fileName) {
153484 return ts.getBaseFileName(fileName, [".js", ".jsx", ".d.ts", ".ts", ".tsx"], /*ignoreCase*/ true) === "index";
153485 }

Callers 1

compareModuleSpecifiersFunction · 0.85

Calls 2

isIndexFileNameFunction · 0.85
toPathFunction · 0.85

Tested by

no test coverage detected