@putout/engine-loader 4.6.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/lib/is-enabled.js +3 -1
- package/lib/load.js +3 -0
- package/lib/parse-rules.js +7 -3
- package/lib/validate-plugin.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
# @putout/engine-loader [![NPM version][NPMIMGURL]][NPMURL]
|
|
1
|
+
# @putout/engine-loader [![NPM version][NPMIMGURL]][NPMURL]
|
|
2
2
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/engine-loader.svg?style=flat&longCache=true
|
|
4
4
|
[NPMURL]: https://npmjs.org/package/@putout/engine-loader"npm"
|
|
5
|
-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/engine-loader
|
|
6
|
-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/engine-loader
|
|
7
5
|
|
|
8
6
|
Load putout `plugins`, `processors`.
|
|
9
7
|
|
package/lib/is-enabled.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const {isArray} = Array;
|
|
4
4
|
|
|
5
|
+
const isBool = (a) => typeof a === 'boolean';
|
|
6
|
+
|
|
5
7
|
module.exports = (name, rules) => {
|
|
6
8
|
if (isArray(name))
|
|
7
9
|
[name] = name;
|
|
8
10
|
|
|
9
|
-
if (
|
|
11
|
+
if (isBool(rules[name]))
|
|
10
12
|
return rules[name];
|
|
11
13
|
|
|
12
14
|
let resultState = true;
|
package/lib/load.js
CHANGED
package/lib/parse-rules.js
CHANGED
|
@@ -7,8 +7,9 @@ const isObj = (a) => typeof a === 'object';
|
|
|
7
7
|
const {entries} = Object;
|
|
8
8
|
const {stringify} = JSON;
|
|
9
9
|
|
|
10
|
-
const notSupportedError = (a) => Error(
|
|
11
|
-
const rulesUsedInsteadOfMatchError = (a) => Error(
|
|
10
|
+
const notSupportedError = (a) => Error(`☝️ Rule format not supported ${a}: ${typeof a}`);
|
|
11
|
+
const rulesUsedInsteadOfMatchError = (a) => Error(`☝️ Looks like you need to change "rules" to "match" for ${stringify(a)}`);
|
|
12
|
+
const stateOptionError = ({rule, value}) => Error(`☝️ ${rule}: state option can be "on" or "off" only, when used as string, received: "${value}"`);
|
|
12
13
|
const defaultOptions = () => Object.create(null);
|
|
13
14
|
const parseState = (rule, value) => validateState(rule, value) && value === 'on' || value !== 'off';
|
|
14
15
|
|
|
@@ -122,7 +123,10 @@ function validateState(rule, value) {
|
|
|
122
123
|
if (isObj(value))
|
|
123
124
|
return true;
|
|
124
125
|
|
|
125
|
-
throw
|
|
126
|
+
throw stateOptionError({
|
|
127
|
+
rule,
|
|
128
|
+
value,
|
|
129
|
+
});
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
const cut = (a) => a.split('/')[0];
|
package/lib/validate-plugin.js
CHANGED
|
@@ -17,6 +17,6 @@ module.exports = ({plugin, rule}) => {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
throw Error(
|
|
20
|
+
throw Error(`☝️ Plugin "${rule}" type cannot be determined. Supported plugin types: https://git.io/JqcMn`);
|
|
21
21
|
};
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-loader",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "load plugins and prepare them to run",
|
|
6
|
-
"homepage": "
|
|
6
|
+
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/engine-loader",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"release": false,
|
|
9
9
|
"tag": false,
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"@putout/plugin-remove-unused-variables": "*",
|
|
44
44
|
"@putout/processor-markdown": "*",
|
|
45
45
|
"c8": "^7.5.0",
|
|
46
|
-
"eslint": "^8.0.
|
|
46
|
+
"eslint": "^8.0.1",
|
|
47
47
|
"eslint-plugin-node": "^11.0.0",
|
|
48
|
-
"eslint-plugin-putout": "^
|
|
49
|
-
"estrace": "^
|
|
48
|
+
"eslint-plugin-putout": "^12.0.0",
|
|
49
|
+
"estrace": "^3.0.2",
|
|
50
50
|
"js-codemod": "^7.0.0",
|
|
51
51
|
"just-camel-case": "^4.0.2",
|
|
52
52
|
"lerna": "^4.0.0",
|