Add new option "libReplacement" (#60829)

This commit is contained in:
Jake Bailey
2025-01-23 17:34:52 -08:00
committed by GitHub
parent c5058f0066
commit 220706eb03
49 changed files with 1230 additions and 71 deletions
+11
View File
@@ -3937,6 +3937,17 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
const existing = resolvedLibProcessing?.get(libFileName);
if (existing) return existing;
if (options.libReplacement === false) {
const result: LibResolution = {
resolution: {
resolvedModule: undefined,
},
actual: combinePaths(defaultLibraryPath, libFileName),
};
(resolvedLibProcessing ??= new Map()).set(libFileName, result);
return result;
}
if (structureIsReused !== StructureIsReused.Not && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
const oldResolution = oldProgram.resolvedLibReferences?.get(libFileName);
if (oldResolution) {