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

Function isEmittedFile

test/fixtures/snapshot/typescript.js:119204–119233  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

119202 programDiagnostics.add(diag);
119203 }
119204 function isEmittedFile(file) {
119205 if (options.noEmit) {
119206 return false;
119207 }
119208 // If this is source file, its not emitted file
119209 var filePath = toPath(file);
119210 if (getSourceFileByPath(filePath)) {
119211 return false;
119212 }
119213 // If options have --outFile or --out just check that
119214 var out = ts.outFile(options);
119215 if (out) {
119216 return isSameFile(filePath, out) || isSameFile(filePath, ts.removeFileExtension(out) + ".d.ts" /* Extension.Dts */);
119217 }
119218 // If declarationDir is specified, return if its a file in that directory
119219 if (options.declarationDir && ts.containsPath(options.declarationDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames())) {
119220 return true;
119221 }
119222 // If --outDir, check if file is in that directory
119223 if (options.outDir) {
119224 return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
119225 }
119226 if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
119227 // Otherwise just check if sourceFile with the name exists
119228 var filePathWithoutExtension = ts.removeFileExtension(filePath);
119229 return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Extension.Ts */)) ||
119230 !!getSourceFileByPath((filePathWithoutExtension + ".tsx" /* Extension.Tsx */));
119231 }
119232 return false;
119233 }
119234 function isSameFile(file1, file2) {
119235 return ts.comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === 0 /* Comparison.EqualTo */;
119236 }

Callers

nothing calls this directly

Calls 3

toPathFunction · 0.85
getSourceFileByPathFunction · 0.85
isSameFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…