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

Function parseOwnConfigOfJsonSourceFile

test/fixtures/snapshot/typescript.js:41711–41776  ·  view source on GitHub ↗
(sourceFile, host, basePath, configFileName, errors)

Source from the content-addressed store, hash-verified

41709 return { raw: json, options: options, watchOptions: watchOptions, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath };
41710 }
41711 function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) {
41712 var options = getDefaultCompilerOptions(configFileName);
41713 var typeAcquisition, typingOptionstypeAcquisition;
41714 var watchOptions;
41715 var extendedConfigPath;
41716 var rootCompilerOptions;
41717 var optionsIterator = {
41718 onSetValidOptionKeyValueInParent: function (parentOption, option, value) {
41719 var currentOption;
41720 switch (parentOption) {
41721 case "compilerOptions":
41722 currentOption = options;
41723 break;
41724 case "watchOptions":
41725 currentOption = (watchOptions || (watchOptions = {}));
41726 break;
41727 case "typeAcquisition":
41728 currentOption = (typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)));
41729 break;
41730 case "typingOptions":
41731 currentOption = (typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName)));
41732 break;
41733 default:
41734 ts.Debug.fail("Unknown option");
41735 }
41736 currentOption[option.name] = normalizeOptionValue(option, basePath, value);
41737 },
41738 onSetValidOptionKeyValueInRoot: function (key, _keyNode, value, valueNode) {
41739 switch (key) {
41740 case "extends":
41741 var newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath;
41742 extendedConfigPath = getExtendsConfigPath(value, host, newBase, errors, function (message, arg0) {
41743 return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0);
41744 });
41745 return;
41746 }
41747 },
41748 onSetUnknownOptionKeyValueInRoot: function (key, keyNode, _value, _valueNode) {
41749 if (key === "excludes") {
41750 errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, keyNode, ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude));
41751 }
41752 if (ts.find(commandOptionsWithoutBuild, function (opt) { return opt.name === key; })) {
41753 rootCompilerOptions = ts.append(rootCompilerOptions, keyNode);
41754 }
41755 }
41756 };
41757 var json = convertConfigFileToObject(sourceFile, errors, /*reportOptionsErrors*/ true, optionsIterator);
41758 if (!typeAcquisition) {
41759 if (typingOptionstypeAcquisition) {
41760 typeAcquisition = (typingOptionstypeAcquisition.enableAutoDiscovery !== undefined) ?
41761 {
41762 enable: typingOptionstypeAcquisition.enableAutoDiscovery,
41763 include: typingOptionstypeAcquisition.include,
41764 exclude: typingOptionstypeAcquisition.exclude
41765 } :
41766 typingOptionstypeAcquisition;
41767 }
41768 else {

Callers 1

parseConfigFunction · 0.85

Calls 10

normalizeOptionValueFunction · 0.85
directoryOfCombinedPathFunction · 0.85
getExtendsConfigPathFunction · 0.85
findMethod · 0.65
failMethod · 0.45
pushMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected