@putout/plugin-putout 20.0.0 → 20.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/README.md
CHANGED
|
@@ -838,7 +838,7 @@ module.exports.traverse = ({push}) => ({
|
|
|
838
838
|
});
|
|
839
839
|
```
|
|
840
840
|
|
|
841
|
-
- `store`
|
|
841
|
+
- [`store`](https://github.com/coderaiser/putout/blob/master/packages/engine-runner/README.md#store)
|
|
842
842
|
|
|
843
843
|
### ❌ Example of incorrect code
|
|
844
844
|
|
|
@@ -866,7 +866,7 @@ module.exports.traverse = ({store}) => ({
|
|
|
866
866
|
});
|
|
867
867
|
```
|
|
868
868
|
|
|
869
|
-
- `pathStore
|
|
869
|
+
- [`pathStore`](https://github.com/coderaiser/putout/blob/master/packages/engine-runner/README.md#pathstore)
|
|
870
870
|
|
|
871
871
|
### ❌ Example of incorrect code
|
|
872
872
|
|
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
replaceWith,
|
|
12
12
|
insertBefore,
|
|
13
13
|
compare,
|
|
14
|
+
getPathAfterRequires,
|
|
14
15
|
} = operator;
|
|
15
16
|
|
|
16
17
|
const {
|
|
@@ -65,16 +66,6 @@ module.exports.replace = () => ({
|
|
|
65
66
|
},
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
function getLatest(body) {
|
|
69
|
-
let path;
|
|
70
|
-
|
|
71
|
-
for (path of body)
|
|
72
|
-
if (!compare(path, REQUIRE))
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
return path;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
69
|
function addRequire({__a, id, path}) {
|
|
79
70
|
const programPath = path.scope.getProgramParent().path;
|
|
80
71
|
const body = programPath.get('body');
|
|
@@ -86,7 +77,7 @@ function addRequire({__a, id, path}) {
|
|
|
86
77
|
});
|
|
87
78
|
|
|
88
79
|
if (compare(first, REQUIRE)) {
|
|
89
|
-
const latest =
|
|
80
|
+
const latest = getPathAfterRequires(body.slice(1));
|
|
90
81
|
insertBefore(latest, nodeRequire);
|
|
91
82
|
|
|
92
83
|
return path;
|
|
@@ -17,6 +17,7 @@ module.exports = {
|
|
|
17
17
|
renameProperty: 'const {renameProperty} = operator',
|
|
18
18
|
extract: 'const {extract} = operator',
|
|
19
19
|
getPathAfterImports: 'const {getPathAfterImports} = operator',
|
|
20
|
+
getPathAfterRequires: 'const {getPathAfterRequires} = operator',
|
|
20
21
|
getBinding: 'const {getBinding} = operator',
|
|
21
22
|
getBindingPath: 'const {getBindingPath} = operator',
|
|
22
23
|
traverse: 'const {traverse} = operator',
|
package/package.json
CHANGED