@fimbul/wotan
Advanced tools
Comparing version 0.21.0-dev.20190412 to 0.21.0-dev.20190424
{ | ||
"name": "@fimbul/wotan", | ||
"version": "0.21.0-dev.20190412", | ||
"version": "0.21.0-dev.20190424", | ||
"description": "Pluggable TypeScript and JavaScript linter", | ||
@@ -39,3 +39,3 @@ "bin": "bin/main.js", | ||
"@types/semver": "^6.0.0", | ||
"escape-string-regexp": "^1.0.5", | ||
"escape-string-regexp": "^2.0.0", | ||
"rimraf": "^2.6.2" | ||
@@ -42,0 +42,0 @@ }, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const ymir_1 = require("@fimbul/ymir"); | ||
@@ -9,17 +8,15 @@ const fs = require("fs"); | ||
const log = debug('wotan:cli'); | ||
function run(argv) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (argv.length === 1 && /^(')?-(?:v|-version)\1$/.test(argv[0])) | ||
return console.log(require('../package.json').version); | ||
try { | ||
const config = yield loadConfig('.'); | ||
const args = (yield Promise.resolve().then(() => require('./argparse'))).parseArguments(argv, config); | ||
if (!(yield (yield Promise.resolve().then(() => require('./commands'))).runCommand(args, undefined, config))) | ||
process.exitCode = 2; | ||
} | ||
catch (e) { | ||
console.error(e instanceof ymir_1.ConfigurationError ? e.message : e); | ||
process.exitCode = 1; | ||
} | ||
}); | ||
async function run(argv) { | ||
if (argv.length === 1 && /^(')?-(?:v|-version)\1$/.test(argv[0])) | ||
return console.log(require('../package.json').version); | ||
try { | ||
const config = await loadConfig('.'); | ||
const args = (await Promise.resolve().then(() => require('./argparse'))).parseArguments(argv, config); | ||
if (!await (await Promise.resolve().then(() => require('./commands'))).runCommand(args, undefined, config)) | ||
process.exitCode = 2; | ||
} | ||
catch (e) { | ||
console.error(e instanceof ymir_1.ConfigurationError ? e.message : e); | ||
process.exitCode = 1; | ||
} | ||
} | ||
@@ -26,0 +23,0 @@ exports.run = run; |
@@ -15,14 +15,12 @@ "use strict"; | ||
const log = debug('wotan:commands'); | ||
function runCommand(command, diContainer, globalOptions = {}) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const container = new inversify_1.Container({ defaultScope: inversify_1.BindingScopeEnum.Singleton }); | ||
if (diContainer !== undefined) | ||
container.parent = diContainer; | ||
for (const moduleName of command.modules) | ||
container.load(loadModule(moduleName, globalOptions)); | ||
container.load(require(`./${command.command}`).module); | ||
container.load(core_module_1.createCoreModule(globalOptions), default_module_1.createDefaultModule()); | ||
const commandRunner = container.get(base_1.AbstractCommandRunner); | ||
return commandRunner.run(command); | ||
}); | ||
async function runCommand(command, diContainer, globalOptions = {}) { | ||
const container = new inversify_1.Container({ defaultScope: inversify_1.BindingScopeEnum.Singleton }); | ||
if (diContainer !== undefined) | ||
container.parent = diContainer; | ||
for (const moduleName of command.modules) | ||
container.load(loadModule(moduleName, globalOptions)); | ||
container.load(require(`./${command.command}`).module); | ||
container.load(core_module_1.createCoreModule(globalOptions), default_module_1.createDefaultModule()); | ||
const commandRunner = container.get(base_1.AbstractCommandRunner); | ||
return commandRunner.run(command); | ||
} | ||
@@ -29,0 +27,0 @@ exports.runCommand = runCommand; |
@@ -257,11 +257,12 @@ "use strict"; | ||
log("Using project '%s'", configFilePath); | ||
let program = host.createProgram(commandLine.fileNames, commandLine.options, undefined, commandLine.projectReferences); | ||
yield program; | ||
if (references) { | ||
const resolvedReferences = program.getResolvedProjectReferences(); | ||
if (resolvedReferences !== undefined) { | ||
program = undefined; // allow garbage collection | ||
yield* this.createPrograms(resolvedReferences, host, seen, true, isFileIncluded); | ||
} | ||
let resolvedReferences; | ||
{ | ||
// this is in a nested block to allow garbage collection while recursing | ||
const program = host.createProgram(commandLine.fileNames, commandLine.options, undefined, commandLine.projectReferences); | ||
yield program; | ||
if (references) | ||
resolvedReferences = program.getResolvedProjectReferences(); | ||
} | ||
if (resolvedReferences !== undefined) | ||
yield* this.createPrograms(resolvedReferences, host, seen, true, isFileIncluded); | ||
continue; | ||
@@ -268,0 +269,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330073
4100