@putout/bundle 1.2.0 → 1.4.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/bundle/plugin-putout.js +26 -8
- package/bundle/putout.js +5931 -13976
- package/package.json +7 -8
package/bundle/plugin-putout.js
CHANGED
|
@@ -268,7 +268,12 @@ function requireGenerateCode () {
|
|
|
268
268
|
} = node;
|
|
269
269
|
|
|
270
270
|
if (path.isStringLiteral() && /^__[a-z]$/.test(value)) {
|
|
271
|
-
path.node.value = getVar(
|
|
271
|
+
path.node.value = getVar(name);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (/^__identifier__[a-z]$/.test(name)) {
|
|
276
|
+
path.node.name = getVar(name);
|
|
272
277
|
return;
|
|
273
278
|
}
|
|
274
279
|
|
|
@@ -1360,7 +1365,7 @@ function requireConvertTraverseToReplace () {
|
|
|
1360
1365
|
if (withFix)
|
|
1361
1366
|
return false;
|
|
1362
1367
|
|
|
1363
|
-
if (
|
|
1368
|
+
if (check(path))
|
|
1364
1369
|
return false;
|
|
1365
1370
|
|
|
1366
1371
|
if (!__args.length)
|
|
@@ -1381,17 +1386,30 @@ function requireConvertTraverseToReplace () {
|
|
|
1381
1386
|
'module.exports.traverse = (__args) => __a': 'module.exports.replace = (__args) => __a',
|
|
1382
1387
|
});
|
|
1383
1388
|
|
|
1384
|
-
function
|
|
1385
|
-
let
|
|
1389
|
+
function check(path) {
|
|
1390
|
+
let hasPushCall = false;
|
|
1391
|
+
let hasTraverseMethod = false;
|
|
1386
1392
|
|
|
1387
1393
|
traverse(path, {
|
|
1394
|
+
'ObjectMethod|ObjectProperty': (path) => {
|
|
1395
|
+
const keyPath = path.get('key');
|
|
1396
|
+
|
|
1397
|
+
if (!path.parentPath.isObjectExpression())
|
|
1398
|
+
return;
|
|
1399
|
+
|
|
1400
|
+
if (!keyPath.isIdentifier())
|
|
1401
|
+
return;
|
|
1402
|
+
|
|
1403
|
+
hasTraverseMethod = true;
|
|
1404
|
+
path.stop();
|
|
1405
|
+
},
|
|
1388
1406
|
'push(__a)': (path) => {
|
|
1389
|
-
|
|
1407
|
+
hasPushCall = true;
|
|
1390
1408
|
path.stop();
|
|
1391
1409
|
},
|
|
1392
1410
|
});
|
|
1393
1411
|
|
|
1394
|
-
return
|
|
1412
|
+
return hasPushCall || hasTraverseMethod;
|
|
1395
1413
|
}
|
|
1396
1414
|
return convertTraverseToReplace;
|
|
1397
1415
|
}
|
|
@@ -3257,8 +3275,8 @@ var rules = lib.rules = {
|
|
|
3257
3275
|
|
|
3258
3276
|
var pluginPutout = /*#__PURE__*/_mergeNamespaces({
|
|
3259
3277
|
__proto__: null,
|
|
3260
|
-
|
|
3261
|
-
|
|
3278
|
+
default: lib,
|
|
3279
|
+
rules: rules
|
|
3262
3280
|
}, [lib]);
|
|
3263
3281
|
|
|
3264
3282
|
export { pluginPutout as default };
|