@putout/engine-runner 23.3.0 → 23.4.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 -1
- package/lib/super-find.js +5 -4
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -62,6 +62,7 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
|
|
|
62
62
|
shebang,
|
|
63
63
|
template,
|
|
64
64
|
pluginsFind,
|
|
65
|
+
traverse,
|
|
65
66
|
}),
|
|
66
67
|
...runWithMerge({
|
|
67
68
|
ast,
|
|
@@ -100,7 +101,7 @@ function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge, trav
|
|
|
100
101
|
return places;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
function runWithoutMerge({ast, fix, shebang, template, pluginsFind}) {
|
|
104
|
+
function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
|
|
104
105
|
const places = [];
|
|
105
106
|
|
|
106
107
|
for (const {rule, plugin, msg, options} of pluginsFind) {
|
|
@@ -116,6 +117,7 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind}) {
|
|
|
116
117
|
fix,
|
|
117
118
|
shebang,
|
|
118
119
|
template,
|
|
120
|
+
traverse,
|
|
119
121
|
});
|
|
120
122
|
|
|
121
123
|
if (!items.length)
|
package/lib/super-find.js
CHANGED
|
@@ -5,7 +5,7 @@ const {traverse: babelTraverse, types} = require('@putout/babel');
|
|
|
5
5
|
const {generate} = require('@putout/engine-parser');
|
|
6
6
|
const {merge} = babelTraverse.visitors;
|
|
7
7
|
|
|
8
|
-
module.exports = function superFind({rule, find, ast, options, template}) {
|
|
8
|
+
module.exports = function superFind({rule, find, ast, options, template, traverse = babelTraverse}) {
|
|
9
9
|
const pushItems = [];
|
|
10
10
|
|
|
11
11
|
const push = (a) => {
|
|
@@ -13,10 +13,11 @@ module.exports = function superFind({rule, find, ast, options, template}) {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const returnItems = find(ast, {
|
|
16
|
-
traverse:
|
|
16
|
+
traverse: createTraverse({
|
|
17
17
|
rule,
|
|
18
18
|
options,
|
|
19
19
|
template,
|
|
20
|
+
traverse,
|
|
20
21
|
}),
|
|
21
22
|
generate,
|
|
22
23
|
types,
|
|
@@ -30,12 +31,12 @@ module.exports = function superFind({rule, find, ast, options, template}) {
|
|
|
30
31
|
];
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
+
const createTraverse = ({rule, options, template, traverse}) => (ast, visitor) => {
|
|
34
35
|
const templateVisitors = merge(template({
|
|
35
36
|
rule,
|
|
36
37
|
visitor,
|
|
37
38
|
options,
|
|
38
39
|
}));
|
|
39
40
|
|
|
40
|
-
return
|
|
41
|
+
return traverse(ast, templateVisitors);
|
|
41
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-runner",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.4.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Run 🐊Putout plugins",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@putout/plugin-filesystem": "^8.0.1",
|
|
39
39
|
"debug": "^4.1.1",
|
|
40
40
|
"fullstore": "^3.0.0",
|
|
41
|
-
"jessy": "^
|
|
41
|
+
"jessy": "^4.0.0",
|
|
42
42
|
"nessy": "^5.2.0",
|
|
43
43
|
"once": "^1.4.0",
|
|
44
44
|
"try-catch": "^3.0.0",
|