@putout/engine-loader 17.1.2 → 17.1.3
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 +1 -1
- package/lib/plugins/load-plugins-async.js +9 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
[NPMURL]: https://npmjs.org/package/@putout/engine-loader"npm"
|
|
4
|
+
[NPMURL]: https://npmjs.org/package/@putout/engine-loader "npm"
|
|
5
5
|
|
|
6
6
|
🐊[**Putout**](https://github.com/coderaiser/putout) loader for `plugins` and `processors`.
|
|
7
7
|
|
|
@@ -34,9 +34,15 @@ export const loadPluginsAsync = async (options) => {
|
|
|
34
34
|
|
|
35
35
|
const splitRule = (rule) => [rule, 'putout'];
|
|
36
36
|
|
|
37
|
+
// The reason we don't use 'Promise.all' here:
|
|
38
|
+
//
|
|
39
|
+
// Error [ERR_INTERNAL_ASSERTION]: @putout/plugin-apply-at: Unexpected module status 0. Cannot require() ES Module /Users/coderaiser/putout/packages/engine-parser/lib/parser.js because it is not yet fully loaded.
|
|
40
|
+
// This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
|
|
41
|
+
// Try await-ing the import() sequentially in a loop instead.
|
|
42
|
+
// (From /Users/coderaiser/putout/packages/putout/lib/index.cjs in non-loader-hook thread)
|
|
37
43
|
async function loadPlugins({items, loadedRules}) {
|
|
38
|
-
const promises = [];
|
|
39
44
|
const enabledRules = [];
|
|
45
|
+
const resolvedPlugins = [];
|
|
40
46
|
|
|
41
47
|
for (const [rule, itemPlugin] of items) {
|
|
42
48
|
if (!isEnabled(rule, loadedRules))
|
|
@@ -45,13 +51,12 @@ async function loadPlugins({items, loadedRules}) {
|
|
|
45
51
|
checkRule(rule);
|
|
46
52
|
|
|
47
53
|
const [name] = splitRule(rule);
|
|
48
|
-
const plugin = itemPlugin || loadPluginAsync(name);
|
|
54
|
+
const plugin = itemPlugin || await loadPluginAsync(name);
|
|
49
55
|
|
|
50
56
|
enabledRules.push(parseRuleName(rule));
|
|
51
|
-
|
|
57
|
+
resolvedPlugins.push(plugin);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
const resolvedPlugins = await Promise.all(promises);
|
|
55
60
|
const plugins = [];
|
|
56
61
|
|
|
57
62
|
for (const [i, rule] of enabledRules.entries()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-loader",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "load plugins and prepare them to run",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"putout": "*"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@putout/eslint-flat": "^
|
|
40
|
+
"@putout/eslint-flat": "^4.0.0",
|
|
41
41
|
"@putout/formatter-progress": "*",
|
|
42
42
|
"@putout/plugin-apply-nullish-coalescing": "*",
|
|
43
43
|
"@putout/plugin-nodejs": "*",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"c8": "^10.0.0",
|
|
49
49
|
"eslint": "^10.0.0-alpha.0",
|
|
50
50
|
"eslint-plugin-n": "^17.0.0",
|
|
51
|
-
"eslint-plugin-putout": "^
|
|
51
|
+
"eslint-plugin-putout": "^30.0.0",
|
|
52
52
|
"estrace": "^6.0.0",
|
|
53
53
|
"just-camel-case": "^6.2.0",
|
|
54
54
|
"madrun": "^12.0.0",
|