@fimbul/wotan
Advanced tools
Comparing version 0.21.0-dev.20190328 to 0.21.0-dev.20190329
{ | ||
"name": "@fimbul/wotan", | ||
"version": "0.21.0-dev.20190328", | ||
"version": "0.21.0-dev.20190329", | ||
"description": "Pluggable TypeScript and JavaScript linter", | ||
@@ -43,4 +43,4 @@ "bin": "bin/main.js", | ||
"dependencies": { | ||
"@fimbul/mimir": "0.21.0-dev.20190322", | ||
"@fimbul/ymir": "0.21.0-dev.20190322", | ||
"@fimbul/mimir": "0.21.0-dev.20190329", | ||
"@fimbul/ymir": "0.21.0-dev.20190329", | ||
"bind-decorator": "^1.0.11", | ||
@@ -47,0 +47,0 @@ "chalk": "^2.3.0", |
@@ -237,4 +237,7 @@ "use strict"; | ||
for (const configFile of projects) { | ||
if (configFile === undefined || !utils_1.addUnique(seen, typeof configFile === 'string' ? configFile : configFile.sourceFile.fileName)) | ||
if (configFile === undefined) | ||
continue; | ||
const configFilePath = typeof configFile === 'string' ? configFile : configFile.sourceFile.fileName; | ||
if (!utils_1.addUnique(seen, configFilePath)) | ||
continue; | ||
let commandLine; | ||
@@ -254,3 +257,3 @@ if (typeof configFile !== 'string') { | ||
if (!commandLine.options.composite || commandLine.fileNames.some((file) => isFileIncluded(host.getFileSystemFile(file)))) { | ||
log("Using project '%s'", configFile); | ||
log("Using project '%s'", configFilePath); | ||
let program = host.createProgram(commandLine.fileNames, commandLine.options, undefined, commandLine.projectReferences); | ||
@@ -267,3 +270,3 @@ yield program; | ||
} | ||
log("Project '%s' contains no file to lint", configFile); | ||
log("Project '%s' contains no file to lint", configFilePath); | ||
} | ||
@@ -270,0 +273,0 @@ if (references) { |
@@ -53,7 +53,7 @@ "use strict"; | ||
if (this.outputsOfReferencedProjects === undefined) | ||
this.outputsOfReferencedProjects = getOutputsOfProjectReferences(this.program, this.host); | ||
this.outputsOfReferencedProjects = getOutputsOfProjectReferences(this.program); | ||
return this.outputsOfReferencedProjects.includes(fileName); | ||
} | ||
} | ||
function getOutputsOfProjectReferences(program, host) { | ||
function getOutputsOfProjectReferences(program) { | ||
const references = program.getResolvedProjectReferences(); | ||
@@ -64,3 +64,2 @@ if (references === undefined) | ||
const result = []; | ||
const moreReferences = []; | ||
for (const ref of references) { | ||
@@ -70,12 +69,4 @@ if (ref === undefined || !utils_1.addUnique(seen, ref.sourceFile.fileName)) | ||
result.push(...getOutputFileNamesOfProjectReference(path.dirname(ref.sourceFile.fileName), ref.commandLine)); | ||
if ('references' in ref) { | ||
result.push(...getOutputFileNamesOfResolvedProjectReferencesRecursive(ref.references, seen)); | ||
} | ||
else if (ref.commandLine.projectReferences !== undefined) { | ||
// for compatibility with typescript@<3.2.0 | ||
moreReferences.push(...ref.commandLine.projectReferences); | ||
} | ||
result.push(...getOutputFileNamesOfResolvedProjectReferencesRecursive(ref.references, seen)); | ||
} | ||
for (const ref of moreReferences) | ||
result.push(...getOutputFileNamesOfProjectReferenceRecursive(ref, seen, host)); | ||
return result; | ||
@@ -96,18 +87,2 @@ } | ||
} | ||
/** recurse into every transitive project reference to exclude all of their outputs from linting */ | ||
function getOutputFileNamesOfProjectReferenceRecursive(reference, seen, host) { | ||
const referencePath = ts.resolveProjectReferencePath(reference); | ||
if (!utils_1.addUnique(seen, referencePath)) | ||
return []; | ||
const raw = ts.readConfigFile(referencePath, (file) => host.readFile(file)); | ||
if (raw.config === undefined) | ||
return []; | ||
const projectDirectory = path.dirname(referencePath); | ||
const commandLine = ts.parseJsonConfigFileContent(raw.config, utils_1.createParseConfigHost(host), projectDirectory, undefined, referencePath); | ||
const result = getOutputFileNamesOfProjectReference(projectDirectory, commandLine); | ||
if (commandLine.projectReferences !== undefined) | ||
for (const ref of commandLine.projectReferences) | ||
result.push(...getOutputFileNamesOfProjectReferenceRecursive(ref, seen, host)); | ||
return result; | ||
} | ||
function getOutputFileNamesOfProjectReference(projectDirectory, commandLine) { | ||
@@ -114,0 +89,0 @@ const options = commandLine.options; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
331284
4114
+ Added@fimbul/mimir@0.21.0-dev.20190329(transitive)
+ Added@fimbul/ymir@0.21.0-dev.20190329(transitive)
- Removed@fimbul/mimir@0.21.0-dev.20190322(transitive)
- Removed@fimbul/ymir@0.21.0-dev.20190322(transitive)