@putout/engine-runner 21.1.0 → 21.2.0

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/lib/include.js CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  const log = require('debug')('putout:runner:include');
4
4
  const maybeArray = require('./maybe-array');
5
+ const {validate} = require('./validate');
5
6
 
6
- const {stringify} = JSON;
7
7
  const stub = () => [];
8
8
  const good = () => true;
9
- const isFn = (a) => typeof a === 'function';
10
9
 
11
10
  module.exports = ({rule, plugin, msg, options}) => {
12
11
  const {
@@ -64,8 +63,3 @@ const getTraverse = (include, filter, rule) => ({push, options}) => {
64
63
 
65
64
  return result;
66
65
  };
67
-
68
- function validate(name, fn) {
69
- if (!isFn(fn))
70
- throw Error(`☝️ Looks like '${name}' is not a 'function' but '${typeof fn}' with value: '${stringify(fn)}'. More on using Includer: https://git.io/JqcMn`);
71
- }
@@ -6,6 +6,7 @@ const {generate} = require('@putout/engine-parser');
6
6
  const runFix = require('./run-fix');
7
7
  const {getPosition} = require('./get-position');
8
8
  const maybeArray = require('./maybe-array');
9
+ const {validate} = require('./validate');
9
10
 
10
11
  const {
11
12
  listStore,
@@ -23,8 +24,10 @@ const {assign} = Object;
23
24
  const parse = (name, plugin, options) => {
24
25
  const list = [];
25
26
 
26
- if (plugin[name])
27
+ if (plugin[name]) {
28
+ validate(name, plugin[name]);
27
29
  list.push(...maybeArray(plugin[name]()));
30
+ }
28
31
 
29
32
  if (options[name])
30
33
  list.push(...maybeArray(options[name]));
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const isFn = (a) => typeof a === 'function';
4
+ const {stringify} = JSON;
5
+
6
+ module.exports.validate = (name, fn) => {
7
+ if (!isFn(fn))
8
+ throw Error(`☝️ Looks like '${name}' is not a 'function' but '${typeof fn}' with value: '${stringify(fn)}'. More on using Includer: https://git.io/JqcMn`);
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Run 🐊Putout plugins",
@@ -50,11 +50,11 @@
50
50
  ],
51
51
  "devDependencies": {
52
52
  "@putout/plugin-minify": "*",
53
- "c8": "^9.0.0",
53
+ "c8": "^10.0.0",
54
54
  "eslint": "^9.0.0",
55
55
  "eslint-plugin-n": "^17.0.0",
56
- "eslint-plugin-putout": "^22.0.0",
57
- "just-camel-case": "^4.0.2",
56
+ "eslint-plugin-putout": "^23.0.0",
57
+ "just-camel-case": "^6.2.0",
58
58
  "lerna": "^6.0.1",
59
59
  "madrun": "^10.0.0",
60
60
  "mock-require": "^3.0.3",