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

Function tryGetModuleNameFromRootDirs

test/fixtures/snapshot/typescript.js:122476–122486  ·  view source on GitHub ↗
(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions)

Source from the content-addressed store, hash-verified

122474 return undefined;
122475 }
122476 function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
122477 var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
122478 if (normalizedTargetPath === undefined) {
122479 return undefined;
122480 }
122481 var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName);
122482 var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath;
122483 return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs
122484 ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
122485 : ts.removeFileExtension(relativePath);
122486 }
122487 function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
122488 var path = _a.path, isRedirect = _a.isRedirect;
122489 var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;

Callers 1

getLocalModuleSpecifierFunction · 0.85

Calls 2

Tested by

no test coverage detected