@putout/plugin-putout 9.0.1 → 10.0.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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const fullstore = require('fullstore');
|
|
4
|
-
|
|
5
3
|
const {
|
|
6
4
|
operator,
|
|
7
5
|
template,
|
|
@@ -26,7 +24,7 @@ const replaceWithAST = template.ast(`
|
|
|
26
24
|
const {replaceWithMultiple} = require('putout').operate;
|
|
27
25
|
`);
|
|
28
26
|
|
|
29
|
-
module.exports.fix = ({path, calleePath, property, object, program
|
|
27
|
+
module.exports.fix = ({path, calleePath, property, object, program}) => {
|
|
30
28
|
const strictModePath = program.get('body.0');
|
|
31
29
|
const {bindings} = strictModePath.scope;
|
|
32
30
|
|
|
@@ -36,11 +34,6 @@ module.exports.fix = ({path, calleePath, property, object, program, isInserted})
|
|
|
36
34
|
if (bindings.replaceWithMultiple)
|
|
37
35
|
return;
|
|
38
36
|
|
|
39
|
-
if (isInserted())
|
|
40
|
-
return;
|
|
41
|
-
|
|
42
|
-
isInserted(true);
|
|
43
|
-
|
|
44
37
|
if (!bindings.replaceWith && !bindings.insertAfter)
|
|
45
38
|
return insertAfter(strictModePath, replaceWithAST);
|
|
46
39
|
|
|
@@ -63,32 +56,27 @@ function getVarPath(bindings) {
|
|
|
63
56
|
return insertAfter.path;
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
module.exports.traverse = ({push}) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
property,
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
};
|
|
59
|
+
module.exports.traverse = ({push}) => ({
|
|
60
|
+
CallExpression(path) {
|
|
61
|
+
const calleePath = path.get('callee');
|
|
62
|
+
|
|
63
|
+
if (!calleePath.isMemberExpression())
|
|
64
|
+
return;
|
|
65
|
+
|
|
66
|
+
const {object, property} = calleePath.node;
|
|
67
|
+
|
|
68
|
+
if (property.name !== 'replaceWithMultiple')
|
|
69
|
+
return;
|
|
70
|
+
|
|
71
|
+
const program = path.findParent((path) => path.isProgram());
|
|
72
|
+
|
|
73
|
+
push({
|
|
74
|
+
path,
|
|
75
|
+
object,
|
|
76
|
+
program,
|
|
77
|
+
calleePath,
|
|
78
|
+
property,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
});
|
|
94
82
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "putout plugin helps with plugins development",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"nodemon": "^2.0.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"putout": ">=24"
|
|
50
|
+
"putout": ">=24.2"
|
|
51
51
|
},
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"engines": {
|