Try the ParsedCommandLine from cache instead of re-reading contents of tsconfig file

This commit is contained in:
Sheetal Nandi 2018-09-07 12:59:38 -07:00
parent 59060a1b90
commit 50bcfb6328

View File

@ -356,10 +356,19 @@ namespace ts {
}
function createConfigFileCache(host: CompilerHost) {
const cache = createFileMap<ParsedCommandLine>();
const cache = createFileMap<ParsedCommandLine | "error">();
const configParseHost = parseConfigHostFromCompilerHost(host);
function isParsedCommandLine(value: ParsedCommandLine | "error"): value is ParsedCommandLine {
return !(value as "error").length;
}
function parseConfigFile(configFilePath: ResolvedConfigFileName) {
const value = cache.getValueOrUndefined(configFilePath);
if (value) {
return isParsedCommandLine(value) ? value : undefined;
}
const sourceFile = host.getSourceFile(configFilePath, ScriptTarget.JSON) as JsonSourceFile;
if (sourceFile === undefined) {
return undefined;