@putout/engine-runner 24.1.4 → 24.2.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.
@@ -50,7 +50,6 @@ const prePush = ({rule, filter, push, options}) => (path) => {
50
50
 
51
51
  const getTraverse = (include, filter, rule) => ({push, options}) => {
52
52
  const result = {};
53
-
54
53
  const visitor = prePush({
55
54
  rule,
56
55
  filter,
@@ -92,6 +92,13 @@ module.exports.clearWatermark = (ast) => {
92
92
 
93
93
  const isFn = (a) => typeof a === 'function';
94
94
 
95
+ const parseExpression = (nodeFrom, {node}) => {
96
+ if (nodeFrom.type !== node.type && isExpressionStatement(node))
97
+ return node.expression;
98
+
99
+ return node;
100
+ };
101
+
95
102
  const fix = (from, to, path) => {
96
103
  const nodeFrom = template.ast(from);
97
104
  const mark = watermark(from, to, path);
@@ -102,7 +109,7 @@ const fix = (from, to, path) => {
102
109
  return;
103
110
 
104
111
  const waysFrom = findVarsWays(nodeFrom);
105
- const {node} = path;
112
+ const node = parseExpression(nodeFrom, path);
106
113
 
107
114
  const values = getValues({
108
115
  waysFrom,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/engine-runner",
3
- "version": "24.1.4",
3
+ "version": "24.2.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Run 🐊Putout plugins",