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

Function getCommonSourceDirectory

test/fixtures/snapshot/typescript.js:110141–110163  ·  view source on GitHub ↗
(options, emittedFiles, currentDirectory, getCanonicalFileName, checkSourceFilesBelongToPath)

Source from the content-addressed store, hash-verified

110139 }
110140 /*@internal*/
110141 function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCanonicalFileName, checkSourceFilesBelongToPath) {
110142 var commonSourceDirectory;
110143 if (options.rootDir) {
110144 // If a rootDir is specified use it as the commonSourceDirectory
110145 commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory);
110146 checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(options.rootDir);
110147 }
110148 else if (options.composite && options.configFilePath) {
110149 // Project compilations never infer their root from the input source paths
110150 commonSourceDirectory = ts.getDirectoryPath(ts.normalizeSlashes(options.configFilePath));
110151 checkSourceFilesBelongToPath === null || checkSourceFilesBelongToPath === void 0 ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory);
110152 }
110153 else {
110154 commonSourceDirectory = ts.computeCommonSourceDirectoryOfFilenames(emittedFiles(), currentDirectory, getCanonicalFileName);
110155 }
110156 if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) {
110157 // Make sure directory path ends with directory separator so this string can directly
110158 // used to replace with "" to get the relative path of the source file and the relative path doesn't
110159 // start with / making it rooted path
110160 commonSourceDirectory += ts.directorySeparator;
110161 }
110162 return commonSourceDirectory;
110163 }
110164 ts.getCommonSourceDirectory = getCommonSourceDirectory;
110165 /*@internal*/
110166 function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {

Callers 3

verifyCompilerOptionsFunction · 0.85

Calls 2

filterMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…