@putout/engine-runner 22.0.3 → 22.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 +17 -19
- package/lib/replace/watermark.js +3 -1
- package/lib/super-find.js +9 -11
- package/lib/template/index.js +19 -21
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -53,25 +53,23 @@ module.exports.runPlugins = ({ast, shebang, fix, fixCount, plugins, progress = c
|
|
|
53
53
|
|
|
54
54
|
module.exports.getPosition = getPosition;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
];
|
|
74
|
-
}
|
|
56
|
+
const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge}) => [
|
|
57
|
+
...runWithoutMerge({
|
|
58
|
+
ast,
|
|
59
|
+
fix,
|
|
60
|
+
shebang,
|
|
61
|
+
template,
|
|
62
|
+
pluginsFind,
|
|
63
|
+
}),
|
|
64
|
+
...runWithMerge({
|
|
65
|
+
ast,
|
|
66
|
+
fix,
|
|
67
|
+
shebang,
|
|
68
|
+
template,
|
|
69
|
+
pluginsTraverse,
|
|
70
|
+
merge,
|
|
71
|
+
}),
|
|
72
|
+
];
|
|
75
73
|
|
|
76
74
|
function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge}) {
|
|
77
75
|
const {entries, visitor} = merge(pluginsTraverse, {
|
package/lib/replace/watermark.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const wraptile = require('wraptile');
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
const {types} = require('@putout/babel');
|
|
6
|
+
const findPath = require('./find-path');
|
|
7
|
+
|
|
6
8
|
const {isProgram} = types;
|
|
7
9
|
const name = '__putout_runner_replace';
|
|
8
10
|
const hasWatermark = (watermark) => (path) => path.node?.[name]?.has(watermark);
|
package/lib/super-find.js
CHANGED
|
@@ -30,14 +30,12 @@ module.exports = function superFind({rule, find, ast, options, template}) {
|
|
|
30
30
|
];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
}
|
|
33
|
+
const traverse = ({rule, options, template}) => (ast, visitor) => {
|
|
34
|
+
const templateVisitors = merge(template({
|
|
35
|
+
rule,
|
|
36
|
+
visitor,
|
|
37
|
+
options,
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
return babelTraverse(ast, templateVisitors);
|
|
41
|
+
};
|
package/lib/template/index.js
CHANGED
|
@@ -82,24 +82,22 @@ module.exports = ({rule, visitor, options}) => {
|
|
|
82
82
|
|
|
83
83
|
module.exports._log = log;
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
}
|
|
85
|
+
const wrapWithCheck = ({rule, nodesInclude, nodesExclude, fn}) => (path) => {
|
|
86
|
+
log(rule, path);
|
|
87
|
+
|
|
88
|
+
if (nodesExclude.length && compareAny(path, nodesExclude))
|
|
89
|
+
return;
|
|
90
|
+
|
|
91
|
+
if (nodesInclude.length && !compareAll(path, nodesInclude))
|
|
92
|
+
return;
|
|
93
|
+
|
|
94
|
+
if (!isFn(fn))
|
|
95
|
+
throw Error(`☝️ Looks like provided visitor is not a function: ${stringify(fn)}. More on using Traverser: https://git.io/JqcMn`);
|
|
96
|
+
|
|
97
|
+
const [e] = tryCatch(fn, path);
|
|
98
|
+
|
|
99
|
+
if (e) {
|
|
100
|
+
e.rule = rule;
|
|
101
|
+
throw e;
|
|
102
|
+
}
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-runner",
|
|
3
|
-
"version": "22.0
|
|
3
|
+
"version": "22.1.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Run 🐊Putout plugins",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"report": "madrun report"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@putout/babel": "^
|
|
31
|
+
"@putout/babel": "^3.0.0",
|
|
32
32
|
"@putout/compare": "^15.0.0",
|
|
33
33
|
"@putout/engine-parser": "^11.0.0",
|
|
34
34
|
"@putout/operate": "^12.0.0",
|
|
35
35
|
"@putout/operator-declare": "^10.0.1",
|
|
36
36
|
"@putout/operator-filesystem": "^5.0.0",
|
|
37
37
|
"@putout/operator-json": "^2.0.0",
|
|
38
|
-
"@putout/plugin-filesystem": "^
|
|
38
|
+
"@putout/plugin-filesystem": "^6.0.0",
|
|
39
39
|
"debug": "^4.1.1",
|
|
40
40
|
"fullstore": "^3.0.0",
|
|
41
41
|
"jessy": "^3.0.0",
|