Skip to content

Commit 50bcfb6

Browse files
committed
Try the ParsedCommandLine from cache instead of re-reading contents of tsconfig file
1 parent 59060a1 commit 50bcfb6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/compiler/tsbuild.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,19 @@ namespace ts {
356356
}
357357

358358
function createConfigFileCache(host: CompilerHost) {
359-
const cache = createFileMap<ParsedCommandLine>();
359+
const cache = createFileMap<ParsedCommandLine | "error">();
360360
const configParseHost = parseConfigHostFromCompilerHost(host);
361361

362+
function isParsedCommandLine(value: ParsedCommandLine | "error"): value is ParsedCommandLine {
363+
return !(value as "error").length;
364+
}
365+
362366
function parseConfigFile(configFilePath: ResolvedConfigFileName) {
367+
const value = cache.getValueOrUndefined(configFilePath);
368+
if (value) {
369+
return isParsedCommandLine(value) ? value : undefined;
370+
}
371+
363372
const sourceFile = host.getSourceFile(configFilePath, ScriptTarget.JSON) as JsonSourceFile;
364373
if (sourceFile === undefined) {
365374
return undefined;

0 commit comments

Comments
 (0)