@putout/engine-loader 13.0.0 → 13.1.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/lib/index.js +3 -4
- package/lib/load/load.js +9 -3
- package/lib/plugins/load-plugins-async.js +2 -3
- package/lib/rules/is-enabled.js +1 -1
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {nanomemoize} = require('nano-memoize');
|
|
4
|
-
|
|
5
3
|
const {loadPlugin} = require('./load/load');
|
|
6
4
|
const {createAsyncLoader} = require('./load/async-loader');
|
|
7
5
|
const {parsePluginNames} = require('./plugins/parse-plugin-names');
|
|
@@ -21,7 +19,7 @@ const {check, checkRule} = require('./check');
|
|
|
21
19
|
const {isArray} = Array;
|
|
22
20
|
|
|
23
21
|
module.exports.loadPluginsAsync = loadPluginsAsync;
|
|
24
|
-
module.exports.loadProcessorsAsync =
|
|
22
|
+
module.exports.loadProcessorsAsync = async (options, load) => {
|
|
25
23
|
check(options);
|
|
26
24
|
|
|
27
25
|
const {processors = []} = options;
|
|
@@ -40,7 +38,7 @@ module.exports.loadProcessorsAsync = nanomemoize(async (options, load) => {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
return await Promise.all(list);
|
|
43
|
-
}
|
|
41
|
+
};
|
|
44
42
|
|
|
45
43
|
module.exports.createAsyncLoader = createAsyncLoader;
|
|
46
44
|
|
|
@@ -126,3 +124,4 @@ function extendRules(rule, plugin) {
|
|
|
126
124
|
|
|
127
125
|
return result;
|
|
128
126
|
}
|
|
127
|
+
|
package/lib/load/load.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const process = require('process');
|
|
4
|
-
const {createRequire} = require('module');
|
|
3
|
+
const process = require('node:process');
|
|
4
|
+
const {createRequire} = require('node:module');
|
|
5
5
|
|
|
6
6
|
const tryCatch = require('try-catch');
|
|
7
7
|
const once = require('once');
|
|
@@ -52,7 +52,13 @@ const {PUTOUT_YARN_PNP = 'putout'} = process.env;
|
|
|
52
52
|
const createCustomRequire = once(() => createRequire(require.resolve(PUTOUT_YARN_PNP)));
|
|
53
53
|
const createPutoutRequire = once(() => createRequire(require.resolve('putout')));
|
|
54
54
|
|
|
55
|
-
// That's all for Yarn P'n'P
|
|
55
|
+
// That's all for Yarn P'n'P
|
|
56
|
+
//
|
|
57
|
+
// We need to create a couple version of require for plugins, formatters and processors:
|
|
58
|
+
// - declared in 🐊Putout package.json;
|
|
59
|
+
// - declared in module that want to extend 🐊Putout;
|
|
60
|
+
//
|
|
61
|
+
// https://yarnpkg.com/advanced/rulebook#modules-shouldnt-hardcode-node_modules-paths-to-access-other-modules
|
|
56
62
|
function getModulePath(name) {
|
|
57
63
|
let path;
|
|
58
64
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {basename} = require('path');
|
|
3
|
+
const {basename} = require('node:path');
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
parseRules,
|
|
@@ -9,11 +9,11 @@ const {
|
|
|
9
9
|
getLoadedRules,
|
|
10
10
|
} = require('../rules');
|
|
11
11
|
|
|
12
|
-
const {createAsyncLoader} = require('../load/async-loader');
|
|
13
12
|
const {parsePluginNames} = require('./parse-plugin-names');
|
|
14
13
|
const validatePlugin = require('./validate-plugin');
|
|
15
14
|
const {filterEnabledPlugins} = require('./filter-enabled-plugins');
|
|
16
15
|
|
|
16
|
+
const {createAsyncLoader} = require('../load/async-loader');
|
|
17
17
|
const {check, checkRule} = require('../check');
|
|
18
18
|
|
|
19
19
|
const loadPluginAsync = createAsyncLoader('plugin');
|
|
@@ -25,7 +25,6 @@ module.exports.loadPluginsAsync = async (options) => {
|
|
|
25
25
|
|
|
26
26
|
const cookedRules = parseRules(rules);
|
|
27
27
|
const loadedRules = getLoadedRules(cookedRules);
|
|
28
|
-
|
|
29
28
|
const items = parsePluginNames(pluginNames);
|
|
30
29
|
|
|
31
30
|
const plugins = await loadPlugins({
|
package/lib/rules/is-enabled.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-loader",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.1",
|
|
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",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@putout/plugin-remove-unused-variables": "*",
|
|
48
48
|
"@putout/processor-javascript": "*",
|
|
49
49
|
"@putout/processor-markdown": "*",
|
|
50
|
-
"c8": "^
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-n": "^
|
|
53
|
-
"eslint-plugin-putout": "^
|
|
50
|
+
"c8": "^10.0.0",
|
|
51
|
+
"eslint": "^9.0.0",
|
|
52
|
+
"eslint-plugin-n": "^17.0.0",
|
|
53
|
+
"eslint-plugin-putout": "^22.0.0",
|
|
54
54
|
"estrace": "*",
|
|
55
55
|
"just-camel-case": "^4.0.2",
|
|
56
56
|
"lerna": "^6.0.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"montag": "^1.0.0",
|
|
60
60
|
"nodemon": "^3.0.1",
|
|
61
61
|
"putout": "*",
|
|
62
|
-
"supertape": "^
|
|
62
|
+
"supertape": "^10.0.0"
|
|
63
63
|
},
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"engines": {
|