Skip to content

Commit

Permalink
Lock lib replacement behind option
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Jan 22, 2025
1 parent ded0933 commit c792dba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1,016 deletions.
11 changes: 11 additions & 0 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3933,6 +3933,17 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
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) {
Expand Down
Loading

0 comments on commit c792dba

Please sign in to comment.