(
configFile: string,
parentOptions: NgCompilerOptions = {},
)
| 83 | const readConfigFile = (configFile: string) => |
| 84 | ts.readConfigFile(configFile, (file) => host.readFile(host.resolve(file))); |
| 85 | const readAngularCompilerOptions = ( |
| 86 | configFile: string, |
| 87 | parentOptions: NgCompilerOptions = {}, |
| 88 | ): NgCompilerOptions => { |
| 89 | const {config, error} = readConfigFile(configFile); |
| 90 | |
| 91 | if (error) { |
| 92 | // Errors are handled later on by 'parseJsonConfigFileContent' |
| 93 | return parentOptions; |
| 94 | } |
| 95 | |
| 96 | // Note: In Google, `angularCompilerOptions` are stored in `bazelOptions`. |
| 97 | // This function typically doesn't run for actual Angular compilations, but |
| 98 | // tooling like Tsurge, or schematics may leverage this helper, so we account |
| 99 | // for this here. |
| 100 | const angularCompilerOptions = |
| 101 | config.angularCompilerOptions ?? config.bazelOptions?.angularCompilerOptions; |
| 102 | |
| 103 | // we are only interested into merging 'angularCompilerOptions' as |
| 104 | // other options like 'compilerOptions' are merged by TS |
| 105 | let existingNgCompilerOptions = {...angularCompilerOptions, ...parentOptions}; |
| 106 | if (!config.extends) { |
| 107 | return existingNgCompilerOptions; |
| 108 | } |
| 109 | |
| 110 | const extendsPaths: string[] = |
| 111 | typeof config.extends === 'string' ? [config.extends] : config.extends; |
| 112 | |
| 113 | // Call readAngularCompilerOptions recursively to merge NG Compiler options |
| 114 | // Reverse the array so the overrides happen from right to left. |
| 115 | return [...extendsPaths].reverse().reduce((prevOptions, extendsPath) => { |
| 116 | const extendedConfigPath = getExtendedConfigPath(configFile, extendsPath, host, fs); |
| 117 | |
| 118 | return extendedConfigPath === null |
| 119 | ? prevOptions |
| 120 | : readAngularCompilerOptions(extendedConfigPath, prevOptions); |
| 121 | }, existingNgCompilerOptions); |
| 122 | }; |
| 123 | |
| 124 | const {projectFile, basePath} = calcProjectFileAndBasePath(project, host); |
| 125 | const configFileName = host.resolve(host.pwd(), projectFile); |
no test coverage detected
searching dependent graphs…