putout 26.9.2 → 26.9.3
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/ChangeLog +6 -0
- package/lib/cli/index.js +3 -7
- package/lib/cli/runner/runner.js +6 -5
- package/lib/cli/runner/worker.js +7 -10
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -20,8 +20,6 @@ const {
|
|
|
20
20
|
defaultProcessors,
|
|
21
21
|
} = require('@putout/engine-processor');
|
|
22
22
|
|
|
23
|
-
const merge = require('../merge');
|
|
24
|
-
|
|
25
23
|
const getFiles = require('./get-files');
|
|
26
24
|
const {createCache} = require('@putout/cli-cache');
|
|
27
25
|
const supportedFiles = require('./supported-files');
|
|
@@ -277,7 +275,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
277
275
|
plugins,
|
|
278
276
|
};
|
|
279
277
|
|
|
280
|
-
const {
|
|
278
|
+
const {places, exited} = await run({
|
|
281
279
|
fix,
|
|
282
280
|
exit,
|
|
283
281
|
readFile,
|
|
@@ -301,13 +299,11 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
301
299
|
if (exited)
|
|
302
300
|
return;
|
|
303
301
|
|
|
304
|
-
const mergedPlaces = merge(...rawPlaces);
|
|
305
|
-
|
|
306
302
|
fileCache.reconcile();
|
|
307
303
|
|
|
308
304
|
if (enableAll || disableAll) {
|
|
309
305
|
const {ruler} = await simpleImport('@putout/cli-ruler');
|
|
310
|
-
await ruler({enableAll, disableAll, readFile, writeFile},
|
|
306
|
+
await ruler({enableAll, disableAll, readFile, writeFile}, places);
|
|
311
307
|
}
|
|
312
308
|
|
|
313
309
|
if (fix && staged) {
|
|
@@ -319,7 +315,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
319
315
|
return exit(STAGE);
|
|
320
316
|
}
|
|
321
317
|
|
|
322
|
-
if (
|
|
318
|
+
if (places.length)
|
|
323
319
|
return exit(PLACE);
|
|
324
320
|
|
|
325
321
|
const exitCode = getExitCode(wasStop);
|
package/lib/cli/runner/runner.js
CHANGED
|
@@ -9,7 +9,7 @@ const report = Report();
|
|
|
9
9
|
module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile, exit, isStop, wasStop, names, write, log, rulesdir, fix, processorRunners, fileCache, currentFormat, formatterOptions, options, raw}) => {
|
|
10
10
|
const processFile = initProcessFile(options);
|
|
11
11
|
const {length} = names;
|
|
12
|
-
const
|
|
12
|
+
const places = [];
|
|
13
13
|
|
|
14
14
|
for (let index = 0; index < length; index++) {
|
|
15
15
|
if (wasStop())
|
|
@@ -19,7 +19,7 @@ module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile,
|
|
|
19
19
|
const currentIndex = isStop() ? length - 1 : index;
|
|
20
20
|
const name = names[index];
|
|
21
21
|
|
|
22
|
-
const {exited} = await runWorker({
|
|
22
|
+
const {exited, places: currentPlaces = []} = await runWorker({
|
|
23
23
|
readFile,
|
|
24
24
|
writeFile,
|
|
25
25
|
exit,
|
|
@@ -31,7 +31,6 @@ module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile,
|
|
|
31
31
|
index: currentIndex,
|
|
32
32
|
name,
|
|
33
33
|
count: length,
|
|
34
|
-
rawPlaces,
|
|
35
34
|
processFile,
|
|
36
35
|
fileCache,
|
|
37
36
|
raw,
|
|
@@ -43,9 +42,11 @@ module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile,
|
|
|
43
42
|
transform,
|
|
44
43
|
});
|
|
45
44
|
|
|
45
|
+
places.push(...currentPlaces);
|
|
46
|
+
|
|
46
47
|
if (exited)
|
|
47
|
-
return {exited,
|
|
48
|
+
return {exited, places};
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
return {
|
|
51
|
+
return {places};
|
|
51
52
|
};
|
package/lib/cli/runner/worker.js
CHANGED
|
@@ -32,7 +32,7 @@ const createFormatterProxy = (options) => {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
module.exports = async ({readFile, report, writeFile, exit, raw, write, log, currentFormat, rulesdir, formatterOptions, noConfig, transform, plugins, index, fix, processFile, processorRunners, fileCache,
|
|
35
|
+
module.exports = async ({readFile, report, writeFile, exit, raw, write, log, currentFormat, rulesdir, formatterOptions, noConfig, transform, plugins, index, fix, processFile, processorRunners, fileCache, name, count}) => {
|
|
36
36
|
const resolvedName = resolve(name)
|
|
37
37
|
.replace(/^\./, cwd);
|
|
38
38
|
|
|
@@ -48,7 +48,7 @@ module.exports = async ({readFile, report, writeFile, exit, raw, write, log, cur
|
|
|
48
48
|
return exit(INVALID_CONFIG, configError);
|
|
49
49
|
|
|
50
50
|
const {dir} = options;
|
|
51
|
-
const success = await runCache({
|
|
51
|
+
const [success, currentPlaces] = await runCache({
|
|
52
52
|
options,
|
|
53
53
|
fileCache,
|
|
54
54
|
report,
|
|
@@ -59,11 +59,11 @@ module.exports = async ({readFile, report, writeFile, exit, raw, write, log, cur
|
|
|
59
59
|
resolvedName,
|
|
60
60
|
index,
|
|
61
61
|
count,
|
|
62
|
-
rawPlaces,
|
|
63
62
|
});
|
|
64
63
|
|
|
65
64
|
if (success)
|
|
66
65
|
return {
|
|
66
|
+
places: currentPlaces,
|
|
67
67
|
success,
|
|
68
68
|
};
|
|
69
69
|
|
|
@@ -109,17 +109,15 @@ module.exports = async ({readFile, report, writeFile, exit, raw, write, log, cur
|
|
|
109
109
|
if (fixable)
|
|
110
110
|
fileCache.setInfo(name, places, options);
|
|
111
111
|
|
|
112
|
-
rawPlaces.push(places);
|
|
113
|
-
|
|
114
112
|
return {
|
|
115
|
-
|
|
113
|
+
places,
|
|
116
114
|
success: true,
|
|
117
115
|
};
|
|
118
116
|
};
|
|
119
117
|
|
|
120
|
-
async function runCache({fileCache, report, write, formatterOptions, currentFormat, name, resolvedName, index, count,
|
|
118
|
+
async function runCache({fileCache, report, write, formatterOptions, currentFormat, name, resolvedName, index, count, options}) {
|
|
121
119
|
if (!fileCache.canUseCache(name, options))
|
|
122
|
-
return false;
|
|
120
|
+
return [false, []];
|
|
123
121
|
|
|
124
122
|
const places = fileCache.getPlaces(name);
|
|
125
123
|
const formatterProxy = createFormatterProxy({
|
|
@@ -134,8 +132,7 @@ async function runCache({fileCache, report, write, formatterOptions, currentForm
|
|
|
134
132
|
const line = await report(currentFormat, formatterProxy);
|
|
135
133
|
|
|
136
134
|
write(line || '');
|
|
137
|
-
rawPlaces.push(places);
|
|
138
135
|
|
|
139
|
-
return true;
|
|
136
|
+
return [true, places];
|
|
140
137
|
}
|
|
141
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "26.9.
|
|
3
|
+
"version": "26.9.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊 Pluggable and configurable code transformer with built-in eslint and babel plugins support of js, jsx typescript, flow files, markdown, yaml and json",
|