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

Function parseJsonConfigFileContentWorker

test/fixtures/snapshot/typescript.js:41466–41608  ·  view source on GitHub ↗

* Parse the contents of a config file from json or json source file (tsconfig.json). * @param json The contents of the config file to parse * @param sourceFile sourceFile corresponding to the Json * @param host Instance of ParseConfigHost used to enumerate files in folder. * @par

(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache)

Source from the content-addressed store, hash-verified

41464 * @param resolutionStack Only present for backwards-compatibility. Should be empty.
41465 */
41466 function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
41467 if (existingOptions === void 0) { existingOptions = {}; }
41468 if (resolutionStack === void 0) { resolutionStack = []; }
41469 if (extraFileExtensions === void 0) { extraFileExtensions = []; }
41470 ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
41471 var errors = [];
41472 var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
41473 var raw = parsedConfig.raw;
41474 var options = ts.extend(existingOptions, parsedConfig.options || {});
41475 var watchOptions = existingWatchOptions && parsedConfig.watchOptions ?
41476 ts.extend(existingWatchOptions, parsedConfig.watchOptions) :
41477 parsedConfig.watchOptions || existingWatchOptions;
41478 options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
41479 var configFileSpecs = getConfigFileSpecs();
41480 if (sourceFile)
41481 sourceFile.configFileSpecs = configFileSpecs;
41482 setConfigFileInOptions(options, sourceFile);
41483 var basePathForFileNames = ts.normalizePath(configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath);
41484 return {
41485 options: options,
41486 watchOptions: watchOptions,
41487 fileNames: getFileNames(basePathForFileNames),
41488 projectReferences: getProjectReferences(basePathForFileNames),
41489 typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(),
41490 raw: raw,
41491 errors: errors,
41492 // Wildcard directories (provided as part of a wildcard path) are stored in a
41493 // file map that marks whether it was a regular wildcard match (with a `*` or `?` token),
41494 // or a recursive directory. This information is used by filesystem watchers to monitor for
41495 // new entries in these paths.
41496 wildcardDirectories: getWildcardDirectories(configFileSpecs, basePathForFileNames, host.useCaseSensitiveFileNames),
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) {

Calls 10

parseConfigFunction · 0.85
getConfigFileSpecsFunction · 0.85
setConfigFileInOptionsFunction · 0.85
directoryOfCombinedPathFunction · 0.85
getFileNamesFunction · 0.85
getProjectReferencesFunction · 0.85
getWildcardDirectoriesFunction · 0.85
assertMethod · 0.80
extendMethod · 0.45

Tested by

no test coverage detected