@beemo/driver-flow
Advanced tools
Comparing version 0.16.0 to 0.17.0
@@ -1,121 +0,122 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _core = require('@beemo/core'); | ||
class FlowDriver extends _core.Driver { | ||
bootstrap() { | ||
this.setMetadata({ | ||
bin: 'flow', | ||
configName: '.flowconfig', | ||
description: 'Type check files with Flow.', | ||
filterOptions: true, | ||
title: 'Flow' | ||
}); | ||
} | ||
formatConfig(data) { | ||
const output = []; | ||
Object.keys(data).forEach(key => { | ||
const value = data[key]; | ||
if (!value) { | ||
return; | ||
} | ||
output.push(`[${key}]`); | ||
switch (key) { | ||
default: | ||
output.push(...value.map(v => String(v))); | ||
break; | ||
case 'lints': | ||
output.push(...this.formatLintsSection(value)); | ||
break; | ||
case 'options': | ||
output.push(...this.formatOptionsSection(value)); | ||
break; | ||
case 'version': | ||
if (value) { | ||
output.push(String(value)); | ||
} | ||
break; | ||
} | ||
output.push(''); | ||
}); | ||
return output.join('\n'); | ||
} | ||
formatLintsSection(lints) { | ||
const output = []; | ||
Object.keys(lints).forEach(key => { | ||
let value = lints[key]; | ||
if (value === 0) { | ||
value = 'off'; | ||
} else if (value === 1) { | ||
value = 'warn'; | ||
} else if (value === 2) { | ||
value = 'error'; | ||
} | ||
output.push(`${key.replace(/_/g, '-')}=${String(value)}`); | ||
}); | ||
return output; | ||
} | ||
formatOption(value, quote = false) { | ||
let option = value; | ||
if (value instanceof RegExp) { | ||
option = value.source.replace(/\|/g, '\\|').replace(/\(/g, '\\(').replace(/\)/g, '\\)'); | ||
} else { | ||
option = String(value); | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@beemo/core"); | ||
var FlowDriver = (function (_super) { | ||
__extends(FlowDriver, _super); | ||
function FlowDriver() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return quote ? `'${option}'` : option; | ||
} | ||
formatOptionsSection(options) { | ||
const output = []; | ||
Object.keys(options).forEach(key => { | ||
const value = options[key]; | ||
if (Array.isArray(value)) { | ||
value.forEach(val => { | ||
output.push(`${key}=${this.formatOption(val)}`); | ||
FlowDriver.prototype.bootstrap = function () { | ||
this.setMetadata({ | ||
bin: 'flow', | ||
configName: '.flowconfig', | ||
description: 'Type check files with Flow', | ||
filterOptions: true, | ||
title: 'Flow', | ||
}); | ||
} else if (typeof value === 'object' && value.constructor === Object) { | ||
Object.keys(value).forEach(pattern => { | ||
output.push(`${key}=${this.formatOption(pattern, true)} -> ${this.formatOption(value[pattern], true)}`); | ||
}; | ||
FlowDriver.prototype.formatConfig = function (data) { | ||
var _this = this; | ||
var output = []; | ||
Object.keys(data).forEach(function (key) { | ||
var value = data[key]; | ||
if (!value) { | ||
return; | ||
} | ||
output.push("[" + key + "]"); | ||
switch (key) { | ||
default: | ||
if (Array.isArray(value)) { | ||
output.push.apply(output, value.map(function (v) { return String(v); })); | ||
} | ||
else if (value) { | ||
output.push(String(value)); | ||
} | ||
break; | ||
case 'lints': | ||
output.push.apply(output, _this.formatLintsSection(value)); | ||
break; | ||
case 'options': | ||
output.push.apply(output, _this.formatOptionsSection(value)); | ||
break; | ||
} | ||
output.push(''); | ||
}); | ||
} else { | ||
output.push(`${key}=${this.formatOption(value)}`); | ||
} | ||
}); | ||
return output; | ||
} | ||
handleFailure(error) { | ||
if (error.code === 2) { | ||
this.tool.logError(error.stdout); | ||
} else { | ||
super.handleFailure(error); | ||
} | ||
} | ||
} | ||
exports.default = FlowDriver; /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
return output.join('\n'); | ||
}; | ||
FlowDriver.prototype.formatLintsSection = function (lints) { | ||
var output = []; | ||
Object.keys(lints).forEach(function (key) { | ||
var value = lints[key]; | ||
if (value === 0) { | ||
value = 'off'; | ||
} | ||
else if (value === 1) { | ||
value = 'warn'; | ||
} | ||
else if (value === 2) { | ||
value = 'error'; | ||
} | ||
output.push(key.replace(/_/g, '-') + "=" + String(value)); | ||
}); | ||
return output; | ||
}; | ||
FlowDriver.prototype.formatOption = function (value, quote) { | ||
if (quote === void 0) { quote = false; } | ||
var option = value; | ||
if (value instanceof RegExp) { | ||
option = value.source | ||
.replace(/\|/g, '\\|') | ||
.replace(/\(/g, '\\(') | ||
.replace(/\)/g, '\\)'); | ||
} | ||
else { | ||
option = String(value); | ||
} | ||
return quote ? "'" + option + "'" : option; | ||
}; | ||
FlowDriver.prototype.formatOptionsSection = function (options) { | ||
var _this = this; | ||
var output = []; | ||
Object.keys(options).forEach(function (key) { | ||
var value = options[key]; | ||
if (!value) { | ||
return; | ||
} | ||
else if (Array.isArray(value)) { | ||
value.forEach(function (val) { | ||
output.push(key + "=" + _this.formatOption(val)); | ||
}); | ||
} | ||
else if (typeof value === 'object' && !(value instanceof RegExp)) { | ||
Object.keys(value).forEach(function (pattern) { | ||
output.push(key + "=" + _this.formatOption(pattern, true) + " -> " + _this.formatOption(value[pattern], true)); | ||
}); | ||
} | ||
else { | ||
output.push(key + "=" + _this.formatOption(value)); | ||
} | ||
}); | ||
return output; | ||
}; | ||
FlowDriver.prototype.handleFailure = function (error) { | ||
if (error.code === 2) { | ||
this.tool.logError(error.stdout); | ||
} | ||
else { | ||
_super.prototype.handleFailure.call(this, error); | ||
} | ||
}; | ||
return FlowDriver; | ||
}(core_1.Driver)); | ||
exports.default = FlowDriver; |
@@ -1,17 +0,4 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _FlowDriver = require('./FlowDriver'); | ||
var _FlowDriver2 = _interopRequireDefault(_FlowDriver); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _FlowDriver2.default; /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var FlowDriver_1 = require("./FlowDriver"); | ||
exports.default = FlowDriver_1.default; |
{ | ||
"name": "@beemo/driver-flow", | ||
"version": "0.16.0", | ||
"version": "0.17.0", | ||
"description": "Flow driver for Beemo.", | ||
@@ -14,4 +14,5 @@ "keywords": [ | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"engines": { | ||
"node": ">=6.5.0" | ||
"node": ">=8.0.0" | ||
}, | ||
@@ -24,9 +25,9 @@ "repository": "https://github.com/milesj/beemo/tree/master/packages/driver-flow", | ||
"devDependencies": { | ||
"flow-bin": "^0.68.0" | ||
"flow-bin": "^0.72.0" | ||
}, | ||
"peerDependencies": { | ||
"@beemo/core": "^0.16.0", | ||
"@beemo/core": "^0.17.0", | ||
"flow-bin": "*" | ||
}, | ||
"gitHead": "3789cbac21df0699ed61cb08865a887c850ac344" | ||
"gitHead": "5bec8d3672024e56ef8a936f7387ab94af4676a2" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8250
10
218
1