@putout/engine-runner 27.1.0 → 27.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.
- package/README.md +6 -6
- package/lib/get-position.js +2 -2
- package/lib/scanner/index.js +4 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ export const report = () => 'debugger should not be used';
|
|
|
78
78
|
|
|
79
79
|
export const replace = () => ({
|
|
80
80
|
debugger: '',
|
|
81
|
-
})
|
|
81
|
+
}); // debugger; alert(); -> alert();
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
Templates:
|
|
@@ -88,7 +88,7 @@ export const report = () => 'any message here';
|
|
|
88
88
|
|
|
89
89
|
export const replace = () => ({
|
|
90
90
|
'var __a = 1': 'const __a = 1',
|
|
91
|
-
})
|
|
91
|
+
}); // var x = 1; -> const x = 1;
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
A couple variables example:
|
|
@@ -98,7 +98,7 @@ export const report = () => 'any message here';
|
|
|
98
98
|
|
|
99
99
|
export const replace = () => ({
|
|
100
100
|
'const __a = __b': 'const __b = __a',
|
|
101
|
-
})
|
|
101
|
+
}); // const hello = world; -> const world = hello;
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
#### Processing of node using functions
|
|
@@ -115,7 +115,7 @@ export const replace = () => ({
|
|
|
115
115
|
// remove node
|
|
116
116
|
return '';
|
|
117
117
|
},
|
|
118
|
-
})
|
|
118
|
+
}); // for (a of b) {}; alert(); -> alert();
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
Update node:
|
|
@@ -129,7 +129,7 @@ export const replace = () => ({
|
|
|
129
129
|
path.node.right.elements = [];
|
|
130
130
|
return path;
|
|
131
131
|
},
|
|
132
|
-
})
|
|
132
|
+
}); // for (const a of [1, 2, 3]) {}; -> for (const a of []) {};
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
Update node using template variables:
|
|
@@ -142,7 +142,7 @@ export const replace = () => ({
|
|
|
142
142
|
// update the whole node using template string
|
|
143
143
|
return 'for (const x of y) z';
|
|
144
144
|
},
|
|
145
|
-
})
|
|
145
|
+
}); // for (const item of array) {}; -> for (const x of y) z;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
### Includer
|
package/lib/get-position.js
CHANGED
|
@@ -11,14 +11,14 @@ export const getPosition = (path, shebang) => {
|
|
|
11
11
|
if (!loc)
|
|
12
12
|
return {
|
|
13
13
|
line: 0,
|
|
14
|
-
column:
|
|
14
|
+
column: 1,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const {line, column} = node.loc.start;
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
20
|
line: shebang ? line + 1 : line,
|
|
21
|
-
column,
|
|
21
|
+
column: column + 1,
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
package/lib/scanner/index.js
CHANGED
|
@@ -6,9 +6,11 @@ import * as toSimple from '@putout/plugin-filesystem/to-simple';
|
|
|
6
6
|
import {
|
|
7
7
|
findFile,
|
|
8
8
|
crawlDirectory,
|
|
9
|
+
} from '@putout/operator-filesystem';
|
|
10
|
+
import {
|
|
9
11
|
pause,
|
|
10
12
|
start,
|
|
11
|
-
} from '@putout/operator-filesystem';
|
|
13
|
+
} from '@putout/operator-filesystem/maybe';
|
|
12
14
|
import {createDebug} from '../debug.js';
|
|
13
15
|
|
|
14
16
|
const log = createDebug('putout:runner:scanner');
|
|
@@ -105,6 +107,7 @@ const createTraverse = ({scan, rule, progress}) => ({push, options}) => ({
|
|
|
105
107
|
fileProgress,
|
|
106
108
|
crawled,
|
|
107
109
|
});
|
|
110
|
+
|
|
108
111
|
const crawlFile = createCrawlFile(crawled);
|
|
109
112
|
|
|
110
113
|
scan(rootPath, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-runner",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Run 🐊Putout plugins",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@putout/engine-parser": "^15.0.1",
|
|
34
34
|
"@putout/operate": "^15.0.0",
|
|
35
35
|
"@putout/operator-declare": "^16.0.0",
|
|
36
|
-
"@putout/operator-filesystem": "^10.
|
|
36
|
+
"@putout/operator-filesystem": "^10.6.0",
|
|
37
37
|
"@putout/operator-json": "^3.0.0",
|
|
38
38
|
"@putout/plugin-filesystem": "^12.0.0",
|
|
39
39
|
"fullstore": "^4.0.0",
|