(
args: string[],
consoleError: (s: string) => void = console.error,
config?: NgcParsedConfiguration,
customTransformers?: api.CustomTransformers,
programReuse?: {
program: api.Program | undefined;
},
modifiedResourceFiles?: Set<string> | null,
)
| 20 | import * as api from './transformers/api'; |
| 21 | |
| 22 | export 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 | |
| 67 | export function mainDiagnosticsForTest( |
| 68 | args: string[], |
no test coverage detected
searching dependent graphs…