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

Function isIgnoredFileFromWildCardWatching

test/fixtures/snapshot/typescript.js:115542–115594  ·  view source on GitHub ↗
(_a)

Source from the content-addressed store, hash-verified

115540 ts.updateWatchingWildcardDirectories = updateWatchingWildcardDirectories;
115541 /* @internal */
115542 function isIgnoredFileFromWildCardWatching(_a) {
115543 var watchedDirPath = _a.watchedDirPath, fileOrDirectory = _a.fileOrDirectory, fileOrDirectoryPath = _a.fileOrDirectoryPath, configFileName = _a.configFileName, options = _a.options, program = _a.program, extraFileExtensions = _a.extraFileExtensions, currentDirectory = _a.currentDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, writeLog = _a.writeLog, toPath = _a.toPath;
115544 var newPath = ts.removeIgnoredPath(fileOrDirectoryPath);
115545 if (!newPath) {
115546 writeLog("Project: ".concat(configFileName, " Detected ignored path: ").concat(fileOrDirectory));
115547 return true;
115548 }
115549 fileOrDirectoryPath = newPath;
115550 if (fileOrDirectoryPath === watchedDirPath)
115551 return false;
115552 // If the the added or created file or directory is not supported file name, ignore the file
115553 // But when watched directory is added/removed, we need to reload the file list
115554 if (ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, options, extraFileExtensions)) {
115555 writeLog("Project: ".concat(configFileName, " Detected file add/remove of non supported extension: ").concat(fileOrDirectory));
115556 return true;
115557 }
115558 if (ts.isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) {
115559 writeLog("Project: ".concat(configFileName, " Detected excluded file: ").concat(fileOrDirectory));
115560 return true;
115561 }
115562 if (!program)
115563 return false;
115564 // We want to ignore emit file check if file is not going to be emitted next to source file
115565 // In that case we follow config file inclusion rules
115566 if (ts.outFile(options) || options.outDir)
115567 return false;
115568 // File if emitted next to input needs to be ignored
115569 if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
115570 // If its declaration directory: its not ignored if not excluded by config
115571 if (options.declarationDir)
115572 return false;
115573 }
115574 else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensionsFlat)) {
115575 return false;
115576 }
115577 // just check if sourceFile with the name exists
115578 var filePathWithoutExtension = ts.removeFileExtension(fileOrDirectoryPath);
115579 var realProgram = ts.isArray(program) ? undefined : isBuilderProgram(program) ? program.getProgramOrUndefined() : program;
115580 var builderProgram = !realProgram && !ts.isArray(program) ? program : undefined;
115581 if (hasSourceFile((filePathWithoutExtension + ".ts" /* Extension.Ts */)) ||
115582 hasSourceFile((filePathWithoutExtension + ".tsx" /* Extension.Tsx */))) {
115583 writeLog("Project: ".concat(configFileName, " Detected output file: ").concat(fileOrDirectory));
115584 return true;
115585 }
115586 return false;
115587 function hasSourceFile(file) {
115588 return realProgram ?
115589 !!realProgram.getSourceFileByPath(file) :
115590 builderProgram ?
115591 builderProgram.getState().fileInfos.has(file) :
115592 !!ts.find(program, function (rootFile) { return toPath(rootFile) === file; });
115593 }
115594 }
115595 ts.isIgnoredFileFromWildCardWatching = isIgnoredFileFromWildCardWatching;
115596 function isBuilderProgram(program) {
115597 return !!program.getState;

Callers

nothing calls this directly

Calls 3

isBuilderProgramFunction · 0.85
hasSourceFileFunction · 0.85
concatMethod · 0.80

Tested by

no test coverage detected