@putout/engine-runner 12.3.0 → 12.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/README.md +5 -6
- package/lib/replace/index.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -322,12 +322,11 @@ const places = runPlugins({
|
|
|
322
322
|
|
|
323
323
|
To see logs, use:
|
|
324
324
|
|
|
325
|
-
|
|
326
|
-
DEBUG=putout:runner
|
|
327
|
-
DEBUG=putout:runner:
|
|
328
|
-
DEBUG=putout:runner:
|
|
329
|
-
DEBUG=putout:runner:
|
|
330
|
-
```
|
|
325
|
+
- ✅ `DEBUG=putout:runner:*`
|
|
326
|
+
- ✅ `DEBUG=putout:runner:fix`
|
|
327
|
+
- ✅ `DEBUG=putout:runner:find`
|
|
328
|
+
- ✅ `DEBUG=putout:runner:template`
|
|
329
|
+
- ✅ `DEBUG=putout:runner:replace`
|
|
331
330
|
|
|
332
331
|
## License
|
|
333
332
|
|
package/lib/replace/index.js
CHANGED
|
@@ -11,10 +11,15 @@ const {
|
|
|
11
11
|
getValues,
|
|
12
12
|
setValues,
|
|
13
13
|
} = require('@putout/compare');
|
|
14
|
+
const debug = require('debug')('putout:runner:replace');
|
|
14
15
|
|
|
15
16
|
const maybeArray = require('../maybe-array');
|
|
16
17
|
const watermark = require('./watermark');
|
|
17
18
|
|
|
19
|
+
const log = (from, path) => {
|
|
20
|
+
debug.enabled && debug(`${from} -> ${path}\n`);
|
|
21
|
+
};
|
|
22
|
+
|
|
18
23
|
const {keys, entries} = Object;
|
|
19
24
|
const {stringify} = JSON;
|
|
20
25
|
|
|
@@ -89,8 +94,10 @@ const fix = (from, to, path) => {
|
|
|
89
94
|
|
|
90
95
|
const nodeTo = parseTo(to, values, path);
|
|
91
96
|
|
|
92
|
-
if (!nodeTo)
|
|
97
|
+
if (!nodeTo) {
|
|
98
|
+
log(from, `''`);
|
|
93
99
|
return remove(path);
|
|
100
|
+
}
|
|
94
101
|
|
|
95
102
|
const waysTo = findVarsWays(nodeTo);
|
|
96
103
|
const newPath = replaceWith(path, nodeTo);
|
|
@@ -105,7 +112,9 @@ const fix = (from, to, path) => {
|
|
|
105
112
|
|
|
106
113
|
mark.add();
|
|
107
114
|
path.scope.getBlockParent().crawl();
|
|
108
|
-
path.scope.getProgramParent().crawl();
|
|
115
|
+
//path.scope.getProgramParent().crawl();
|
|
116
|
+
|
|
117
|
+
log(from, newPath);
|
|
109
118
|
};
|
|
110
119
|
|
|
111
120
|
const getFix = (items) => (path) => {
|