@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 CHANGED
@@ -1,9 +1,7 @@
1
- # @putout/engine-loader [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
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 (typeof rules[name] === 'boolean')
11
+ if (isBool(rules[name]))
10
12
  return rules[name];
11
13
 
12
14
  let resultState = true;
package/lib/load.js CHANGED
@@ -11,6 +11,9 @@ function getPath(namespace, type, name) {
11
11
  if (!path)
12
12
  path = getModulePath(`${namespace}-${type}-${name}`);
13
13
 
14
+ if (!path)
15
+ path = getModulePath(name);
16
+
14
17
  return path;
15
18
  }
16
19
 
@@ -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(`Rule format not supported ${a}: ${typeof a}`);
11
- const rulesUsedInsteadOfMatchError = (a) => Error(`Looks like you need to change "rules" to "match" for ${stringify(a)}`);
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 Error(`${rule}: state option can be "on" or "off" only, when used as string, received: "${value}"`);
126
+ throw stateOptionError({
127
+ rule,
128
+ value,
129
+ });
126
130
  }
127
131
 
128
132
  const cut = (a) => a.split('/')[0];
@@ -17,6 +17,6 @@ module.exports = ({plugin, rule}) => {
17
17
  return;
18
18
  }
19
19
 
20
- throw Error(`Plugin "${rule}" type cannot be determined. Supported plugin types: https://git.io/JqcMn`);
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.6.0",
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": "http://github.com/coderaiser/putout",
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.0-beta.0",
46
+ "eslint": "^8.0.1",
47
47
  "eslint-plugin-node": "^11.0.0",
48
- "eslint-plugin-putout": "^9.0.0",
49
- "estrace": "^2.1.0",
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",