( tsConfigDir: TsConfigDir, baseTsConfigFilePath: string | undefined, baseTsFiles: readonly string[], )
| 304 | } |
| 305 | |
| 306 | async function processTsConfigDir( |
| 307 | tsConfigDir: TsConfigDir, |
| 308 | baseTsConfigFilePath: string | undefined, |
| 309 | baseTsFiles: readonly string[], |
| 310 | ): Promise<void> { |
| 311 | const tsConfigPath = path.join(tsConfigDir.dir, 'tsconfig.json'); |
| 312 | |
| 313 | let tsConfigFile: JSONCFile<any>; |
| 314 | if (fsSync.existsSync(tsConfigPath)) { |
| 315 | const fileContent = await fs.readFile(tsConfigPath); |
| 316 | tsConfigFile = JSONCFile.parse(fileContent.toString('utf8')); |
| 317 | } else { |
| 318 | tsConfigFile = JSONCFile.fromObject({}); |
| 319 | } |
| 320 | |
| 321 | const tsCompilerOptions = computeTsCompilerOptions( |
| 322 | tsConfigFile?.value?.compilerOptions, |
| 323 | tsConfigDir.dir, |
| 324 | tsConfigDir.matchedTargets, |
| 325 | baseTsFiles, |
| 326 | ); |
| 327 | |
| 328 | if (baseTsConfigFilePath) { |
| 329 | const resolvedBaseTsConfigFilePath = relativePathTo(tsConfigDir.dir, baseTsConfigFilePath); |
| 330 | if (tsConfigFile?.value?.extends !== resolvedBaseTsConfigFilePath) { |
| 331 | tsConfigFile = updateTsConfigFile(tsConfigFile, ['extends'], resolvedBaseTsConfigFilePath); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | tsConfigFile = updateTsConfigFile(tsConfigFile, ['compilerOptions'], tsCompilerOptions); |
| 336 | |
| 337 | await fs.writeFile(tsConfigPath, tsConfigFile.toJSONString()); |
| 338 | } |
| 339 | |
| 340 | function computeSourceMapPathOverrides( |
| 341 | bazelWorkspaceRoot: string, |
no test coverage detected