Skip to content

Commit

Permalink
🤖 Pick PR #58931 (Defer creation of barebonesLibSourc...) into releas…
Browse files Browse the repository at this point in the history
…e-5.5 (#58933)

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
  • Loading branch information
typescript-bot and jakebailey committed Jun 19, 2024
1 parent 7b1620b commit f3b21a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/services/transpile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
optionDeclarations,
parseCustomTypeOption,
ScriptTarget,
SourceFile,
toPath,
transpileOptionValueCompilerOptions,
} from "./_namespaces/ts.js";
Expand Down Expand Up @@ -109,9 +110,11 @@ interface Symbol {
readonly [Symbol.toStringTag]: string;
}`;
const barebonesLibName = "lib.d.ts";
const barebonesLibSourceFile = createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: ScriptTarget.Latest });
let barebonesLibSourceFile: SourceFile | undefined;

function transpileWorker(input: string, transpileOptions: TranspileOptions, declaration?: boolean): TranspileOutput {
barebonesLibSourceFile ??= createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: ScriptTarget.Latest });

const diagnostics: Diagnostic[] = [];

const options: CompilerOptions = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
Expand Down

0 comments on commit f3b21a2

Please sign in to comment.