MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / updateParsedConfigFile

Function updateParsedConfigFile

src/cli/parse.ts:109–139  ·  view source on GitHub ↗
(parsedConfigFile: ts.ParsedCommandLine)

Source from the content-addressed store, hash-verified

107];
108
109export function updateParsedConfigFile(parsedConfigFile: ts.ParsedCommandLine): ParsedCommandLine {
110 let hasRootLevelOptions = false;
111 for (const [name, rawValue] of Object.entries(parsedConfigFile.raw)) {
112 const option = optionDeclarations.find(option => option.name === name);
113 if (!option) continue;
114
115 if (parsedConfigFile.raw.tstl === undefined) parsedConfigFile.raw.tstl = {};
116 parsedConfigFile.raw.tstl[name] = rawValue;
117 hasRootLevelOptions = true;
118 }
119
120 if (parsedConfigFile.raw.tstl) {
121 if (hasRootLevelOptions) {
122 parsedConfigFile.errors.push(cliDiagnostics.tstlOptionsAreMovingToTheTstlObject(parsedConfigFile.raw.tstl));
123 }
124
125 for (const [name, rawValue] of Object.entries(parsedConfigFile.raw.tstl)) {
126 const option = optionDeclarations.find(option => option.name === name);
127 if (!option) {
128 parsedConfigFile.errors.push(cliDiagnostics.unknownCompilerOption(name));
129 continue;
130 }
131
132 const { error, value } = readValue(option, rawValue, OptionSource.TsConfig);
133 if (error) parsedConfigFile.errors.push(error);
134 if (parsedConfigFile.options[name] === undefined) parsedConfigFile.options[name] = value;
135 }
136 }
137
138 return parsedConfigFile;
139}
140
141export function parseCommandLine(args: string[]): ParsedCommandLine {
142 return updateParsedCommandLine(ts.parseCommandLine(args), args);

Callers 1

Calls 2

readValueFunction · 0.85
entriesMethod · 0.65

Tested by

no test coverage detected