MCPcopy Index your code
hub / github.com/angular/angular / readCommandLineAndConfiguration

Function readCommandLineAndConfiguration

packages/compiler-cli/src/main.ts:145–180  ·  view source on GitHub ↗
(
  args: string[],
  existingOptions: api.CompilerOptions = {},
  ngCmdLineOptions: string[] = [],
)

Source from the content-addressed store, hash-verified

143}
144
145export function readCommandLineAndConfiguration(
146 args: string[],
147 existingOptions: api.CompilerOptions = {},
148 ngCmdLineOptions: string[] = [],
149): ParsedConfiguration {
150 let cmdConfig = ts.parseCommandLine(args);
151 const project = cmdConfig.options.project || '.';
152 const cmdErrors = cmdConfig.errors.filter((e) => {
153 if (typeof e.messageText === 'string') {
154 const msg = e.messageText;
155 return !ngCmdLineOptions.some((o) => msg.indexOf(o) >= 0);
156 }
157 return true;
158 });
159 if (cmdErrors.length) {
160 return {
161 project,
162 rootNames: [],
163 options: cmdConfig.options,
164 errors: cmdErrors,
165 emitFlags: api.EmitFlags.Default,
166 };
167 }
168 const config = readConfiguration(project, cmdConfig.options);
169 const options = {...config.options, ...existingOptions};
170 if (options.locale) {
171 options.i18nInLocale = options.locale;
172 }
173 return {
174 project,
175 rootNames: config.rootNames,
176 options,
177 errors: config.errors,
178 emitFlags: config.emitFlags,
179 };
180}
181
182function getFormatDiagnosticsHost(options?: api.CompilerOptions): ts.FormatDiagnosticsHost {
183 const basePath = options ? options.basePath : undefined;

Calls 4

readConfigurationFunction · 0.90
someMethod · 0.80
indexOfMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…