@putout/bundle 1.2.0 → 1.3.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.
@@ -1360,7 +1360,7 @@ function requireConvertTraverseToReplace () {
1360
1360
  if (withFix)
1361
1361
  return false;
1362
1362
 
1363
- if (hasPushCall(path))
1363
+ if (check(path))
1364
1364
  return false;
1365
1365
 
1366
1366
  if (!__args.length)
@@ -1381,17 +1381,30 @@ function requireConvertTraverseToReplace () {
1381
1381
  'module.exports.traverse = (__args) => __a': 'module.exports.replace = (__args) => __a',
1382
1382
  });
1383
1383
 
1384
- function hasPushCall(path) {
1385
- let is = false;
1384
+ function check(path) {
1385
+ let hasPushCall = false;
1386
+ let hasTraverseMethod = false;
1386
1387
 
1387
1388
  traverse(path, {
1389
+ 'ObjectMethod|ObjectProperty': (path) => {
1390
+ const keyPath = path.get('key');
1391
+
1392
+ if (!path.parentPath.isObjectExpression())
1393
+ return;
1394
+
1395
+ if (!keyPath.isIdentifier())
1396
+ return;
1397
+
1398
+ hasTraverseMethod = true;
1399
+ path.stop();
1400
+ },
1388
1401
  'push(__a)': (path) => {
1389
- is = true;
1402
+ hasPushCall = true;
1390
1403
  path.stop();
1391
1404
  },
1392
1405
  });
1393
1406
 
1394
- return is;
1407
+ return hasPushCall || hasTraverseMethod;
1395
1408
  }
1396
1409
  return convertTraverseToReplace;
1397
1410
  }