(
optionsToExtend: CompilerOptions
)
| 129 | } |
| 130 | |
| 131 | export function createConfigFileUpdater( |
| 132 | optionsToExtend: CompilerOptions |
| 133 | ): (options: ts.CompilerOptions) => ts.Diagnostic[] { |
| 134 | const configFileMap = new WeakMap<ts.TsConfigSourceFile, ts.ParsedCommandLine>(); |
| 135 | return options => { |
| 136 | const { configFile, configFilePath } = options; |
| 137 | if (!configFile || !configFilePath) return []; |
| 138 | |
| 139 | if (!configFileMap.has(configFile)) { |
| 140 | const parsedConfigFile = parseConfigFileWithSystem(configFilePath, optionsToExtend, ts.sys); |
| 141 | configFileMap.set(configFile, parsedConfigFile); |
| 142 | } |
| 143 | |
| 144 | const parsedConfigFile = configFileMap.get(configFile)!; |
| 145 | Object.assign(options, parsedConfigFile.options); |
| 146 | return parsedConfigFile.errors; |
| 147 | }; |
| 148 | } |
no test coverage detected