@putout/engine-loader 7.2.0 → 8.1.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/index.js +10 -2
- package/lib/validate-plugin.js +1 -0
- package/package.json +3 -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/lib/validate-plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.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",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/engine-loader#readme",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
-
"commitType": "colon",
|
|
10
9
|
"release": false,
|
|
11
10
|
"tag": false,
|
|
12
11
|
"changelog": false,
|
|
@@ -48,12 +47,12 @@
|
|
|
48
47
|
"@putout/plugin-remove-unused-variables": "*",
|
|
49
48
|
"@putout/processor-javascript": "*",
|
|
50
49
|
"@putout/processor-markdown": "*",
|
|
50
|
+
"babel-plugin-angularjs-annotate": "https://github.com/putoutjs/babel-plugin-angularjs-annotate",
|
|
51
51
|
"c8": "^7.5.0",
|
|
52
52
|
"eslint": "^8.0.1",
|
|
53
53
|
"eslint-plugin-n": "^15.2.4",
|
|
54
|
-
"eslint-plugin-putout": "^
|
|
54
|
+
"eslint-plugin-putout": "^17.0.0",
|
|
55
55
|
"estrace": "*",
|
|
56
|
-
"babel-plugin-angularjs-annotate": "https://github.com/putoutjs/babel-plugin-angularjs-annotate",
|
|
57
56
|
"just-camel-case": "^4.0.2",
|
|
58
57
|
"lerna": "^6.0.1",
|
|
59
58
|
"madrun": "^9.0.0",
|