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

Function getConfigFileSpecs

test/fixtures/snapshot/typescript.js:41499–41552  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41497 compileOnSave: !!raw.compileOnSave,
41498 };
41499 function getConfigFileSpecs() {
41500 var referencesOfRaw = getPropFromRaw("references", function (element) { return typeof element === "object"; }, "object");
41501 var filesSpecs = toPropValue(getSpecsFromRaw("files"));
41502 if (filesSpecs) {
41503 var hasZeroOrNoReferences = referencesOfRaw === "no-prop" || ts.isArray(referencesOfRaw) && referencesOfRaw.length === 0;
41504 var hasExtends = ts.hasProperty(raw, "extends");
41505 if (filesSpecs.length === 0 && hasZeroOrNoReferences && !hasExtends) {
41506 if (sourceFile) {
41507 var fileName = configFileName || "tsconfig.json";
41508 var diagnosticMessage = ts.Diagnostics.The_files_list_in_config_file_0_is_empty;
41509 var nodeValue = ts.firstDefined(ts.getTsConfigPropArray(sourceFile, "files"), function (property) { return property.initializer; });
41510 var error = nodeValue
41511 ? ts.createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName)
41512 : ts.createCompilerDiagnostic(diagnosticMessage, fileName);
41513 errors.push(error);
41514 }
41515 else {
41516 createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json");
41517 }
41518 }
41519 }
41520 var includeSpecs = toPropValue(getSpecsFromRaw("include"));
41521 var excludeOfRaw = getSpecsFromRaw("exclude");
41522 var excludeSpecs = toPropValue(excludeOfRaw);
41523 if (excludeOfRaw === "no-prop" && raw.compilerOptions) {
41524 var outDir = raw.compilerOptions.outDir;
41525 var declarationDir = raw.compilerOptions.declarationDir;
41526 if (outDir || declarationDir) {
41527 excludeSpecs = [outDir, declarationDir].filter(function (d) { return !!d; });
41528 }
41529 }
41530 if (filesSpecs === undefined && includeSpecs === undefined) {
41531 includeSpecs = ["**/*"];
41532 }
41533 var validatedIncludeSpecs, validatedExcludeSpecs;
41534 // The exclude spec list is converted into a regular expression, which allows us to quickly
41535 // test whether a file or directory should be excluded before recursively traversing the
41536 // file system.
41537 if (includeSpecs) {
41538 validatedIncludeSpecs = validateSpecs(includeSpecs, errors, /*disallowTrailingRecursion*/ true, sourceFile, "include");
41539 }
41540 if (excludeSpecs) {
41541 validatedExcludeSpecs = validateSpecs(excludeSpecs, errors, /*disallowTrailingRecursion*/ false, sourceFile, "exclude");
41542 }
41543 return {
41544 filesSpecs: filesSpecs,
41545 includeSpecs: includeSpecs,
41546 excludeSpecs: excludeSpecs,
41547 validatedFilesSpec: ts.filter(filesSpecs, ts.isString),
41548 validatedIncludeSpecs: validatedIncludeSpecs,
41549 validatedExcludeSpecs: validatedExcludeSpecs,
41550 pathPatterns: undefined, // Initialized on first use
41551 };
41552 }
41553 function getFileNames(basePath) {
41554 var fileNames = getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions);
41555 if (shouldReportNoInputFiles(fileNames, canJsonReportNoInputFiles(raw), resolutionStack)) {

Callers 1

Calls 7

getPropFromRawFunction · 0.85
toPropValueFunction · 0.85
getSpecsFromRawFunction · 0.85
validateSpecsFunction · 0.85
filterMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected