@putout/engine-loader 8.0.0 → 9.0.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.
Files changed (2) hide show
  1. package/lib/index.js +10 -2
  2. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -11,6 +11,8 @@ const parseRules = require('./parse-rules');
11
11
  const validateRules = require('./validate-rules');
12
12
  const validatePlugin = require('./validate-plugin');
13
13
 
14
+ const isString = (a) => typeof a === 'string';
15
+
14
16
  const defaultOptions = () => Object.create(null);
15
17
  const mergeRules = ([rule, plugin], rules) => {
16
18
  for (const currentRule of rules) {
@@ -119,8 +121,7 @@ function getLoadedRules(rules) {
119
121
  }
120
122
 
121
123
  function splitRule(rule) {
122
- const name = rule
123
- .replace('babel/', '');
124
+ const name = rule.replace('babel/', '');
124
125
 
125
126
  if (rule.startsWith('babel'))
126
127
  return [
@@ -141,6 +142,8 @@ function loadPlugins({items, loadedRules}) {
141
142
  if (!isEnabled(rule, loadedRules))
142
143
  continue;
143
144
 
145
+ checkRule(rule);
146
+
144
147
  const [name, namespace] = splitRule(rule);
145
148
 
146
149
  const plugin = itemPlugin || loadPlugin({
@@ -185,3 +188,8 @@ function check(options) {
185
188
  throw Error('options should be an object!');
186
189
  }
187
190
 
191
+ function checkRule(rule) {
192
+ if (!isString(rule))
193
+ throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`);
194
+ }
195
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-loader",
3
- "version": "8.0.0",
3
+ "version": "9.0.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "load plugins and prepare them to run",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@babel/core": "^7.12.3",
28
- "@putout/engine-parser": "^5.0.0",
28
+ "@putout/engine-parser": "^6.1.0",
29
29
  "diff-match-patch": "^1.0.4",
30
30
  "nano-memoize": "^2.0.0",
31
31
  "once": "^1.4.0",
@@ -47,12 +47,12 @@
47
47
  "@putout/plugin-remove-unused-variables": "*",
48
48
  "@putout/processor-javascript": "*",
49
49
  "@putout/processor-markdown": "*",
50
+ "babel-plugin-angularjs-annotate": "https://github.com/putoutjs/babel-plugin-angularjs-annotate",
50
51
  "c8": "^7.5.0",
51
52
  "eslint": "^8.0.1",
52
53
  "eslint-plugin-n": "^15.2.4",
53
- "eslint-plugin-putout": "^16.0.0",
54
+ "eslint-plugin-putout": "^17.0.0",
54
55
  "estrace": "*",
55
- "babel-plugin-angularjs-annotate": "https://github.com/putoutjs/babel-plugin-angularjs-annotate",
56
56
  "just-camel-case": "^4.0.2",
57
57
  "lerna": "^6.0.1",
58
58
  "madrun": "^9.0.0",