@fimbul/wotan
Advanced tools
Comparing version 0.21.0-dev.20190507 to 0.21.0-dev.20190512
{ | ||
"name": "@fimbul/wotan", | ||
"version": "0.21.0-dev.20190507", | ||
"version": "0.21.0-dev.20190512", | ||
"description": "Pluggable TypeScript and JavaScript linter", | ||
@@ -5,0 +5,0 @@ "bin": "bin/main.js", |
@@ -24,2 +24,10 @@ "use strict"; | ||
this.fileContent = new Map(); | ||
this.tsconfigCache = new Map(); | ||
this.commandLineCache = new Map(); | ||
this.parseConfigHost = { | ||
useCaseSensitiveFileNames: this.useCaseSensitiveFileNames(), | ||
readDirectory: (rootDir, extensions, excludes, includes, depth) => this.readDirectory(rootDir, extensions, excludes, includes, depth), | ||
fileExists: (f) => this.fileExists(f), | ||
readFile: (f) => this.readFile(f), | ||
}; | ||
this.getCanonicalFileName = ts.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase(); | ||
@@ -183,2 +191,3 @@ this.moduleResolutionCache = ts.createModuleResolutionCache(this.cwd, this.getCanonicalFileName); | ||
createProgram(rootNames, options, oldProgram, projectReferences) { | ||
options = Object.assign({}, options, { suppressOutputPathCheck: true }); | ||
this.compilerOptions = options; | ||
@@ -209,2 +218,13 @@ this.moduleResolutionCache = ts.createModuleResolutionCache(this.cwd, this.getCanonicalFileName, options); | ||
} | ||
getParsedCommandLine(fileName) { | ||
return utils_1.resolveCachedResult(this.commandLineCache, fileName, this.parseConfigFile); | ||
} | ||
parseConfigFile(fileName) { | ||
// Note to future self: it's highly unlikely that a tsconfig of a project reference is used as base config for another tsconfig. | ||
// Therefore it doesn't make such sense to read or write the tsconfigCache here. | ||
const sourceFile = this.getSourceFile(fileName, ts.ScriptTarget.JSON); | ||
if (sourceFile === undefined) | ||
return; | ||
return ts.parseJsonSourceFileConfigFileContent(sourceFile, this.parseConfigHost, path.dirname(fileName), undefined, fileName, undefined, undefined, this.tsconfigCache); | ||
} | ||
resolveModuleNames(names, file, _, reference) { | ||
@@ -222,3 +242,9 @@ const seen = new Map(); | ||
], ProjectHost.prototype, "processDirectory", null); | ||
tslib_1.__decorate([ | ||
bind_decorator_1.bind, | ||
tslib_1.__metadata("design:type", Function), | ||
tslib_1.__metadata("design:paramtypes", [String]), | ||
tslib_1.__metadata("design:returntype", void 0) | ||
], ProjectHost.prototype, "parseConfigFile", null); | ||
exports.ProjectHost = ProjectHost; | ||
//# sourceMappingURL=project-host.js.map |
@@ -247,6 +247,5 @@ "use strict"; | ||
else { | ||
const sourceFile = host.getSourceFile(configFile, ts.ScriptTarget.JSON); | ||
if (sourceFile === undefined) | ||
commandLine = host.getParsedCommandLine(configFile); | ||
if (commandLine === undefined) | ||
continue; | ||
commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, utils_1.createParseConfigHost(host), path.dirname(configFile), { noEmit: true }, configFile); | ||
} | ||
@@ -253,0 +252,0 @@ if (commandLine.errors.length !== 0) |
@@ -140,17 +140,2 @@ "use strict"; | ||
exports.addUnique = addUnique; | ||
function createParseConfigHost(host) { | ||
return { | ||
useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(), | ||
readDirectory(rootDir, extensions, excludes, includes, depth) { | ||
return host.readDirectory(rootDir, extensions, excludes, includes, depth); | ||
}, | ||
fileExists(f) { | ||
return host.fileExists(f); | ||
}, | ||
readFile(f) { | ||
return host.readFile(f); | ||
}, | ||
}; | ||
} | ||
exports.createParseConfigHost = createParseConfigHost; | ||
function hasParseErrors(sourceFile) { | ||
@@ -157,0 +142,0 @@ return sourceFile.parseDiagnostics.length !== 0; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
332891
4125