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

Function main

packages/compiler-cli/src/main.ts:22–65  ·  view source on GitHub ↗
(
  args: string[],
  consoleError: (s: string) => void = console.error,
  config?: NgcParsedConfiguration,
  customTransformers?: api.CustomTransformers,
  programReuse?: {
    program: api.Program | undefined;
  },
  modifiedResourceFiles?: Set<string> | null,
)

Source from the content-addressed store, hash-verified

20import * as api from './transformers/api';
21
22export function main(
23 args: string[],
24 consoleError: (s: string) => void = console.error,
25 config?: NgcParsedConfiguration,
26 customTransformers?: api.CustomTransformers,
27 programReuse?: {
28 program: api.Program | undefined;
29 },
30 modifiedResourceFiles?: Set<string> | null,
31): number {
32 let {
33 project,
34 rootNames,
35 options,
36 errors: configErrors,
37 watch,
38 emitFlags,
39 } = config || readNgcCommandLineAndConfiguration(args);
40 if (configErrors.length) {
41 return reportErrorsAndExit(configErrors, /*options*/ undefined, consoleError);
42 }
43 if (watch) {
44 const result = watchMode(project, options, consoleError);
45 return reportErrorsAndExit(result.firstCompileResult, options, consoleError);
46 }
47
48 let oldProgram: api.Program | undefined;
49 if (programReuse !== undefined) {
50 oldProgram = programReuse.program;
51 }
52
53 const {diagnostics: compileDiags, program} = performCompilation({
54 rootNames,
55 options,
56 emitFlags,
57 oldProgram,
58 customTransformers,
59 modifiedResourceFiles,
60 });
61 if (programReuse !== undefined) {
62 programReuse.program = program;
63 }
64 return reportErrorsAndExit(compileDiags, options, consoleError);
65}
66
67export function mainDiagnosticsForTest(
68 args: string[],

Callers 3

driveMainMethod · 0.90
mainXi18nFunction · 0.90
runNgcComamndFunction · 0.90

Calls 4

performCompilationFunction · 0.90
reportErrorsAndExitFunction · 0.85
watchModeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…