putout 26.0.2 → 26.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/ChangeLog +23 -7
- package/lib/cli/formatter.js +8 -52
- package/lib/cli/index.js +4 -1
- package/package.json +3 -3
package/ChangeLog
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
2022.05.13, v26.1.0
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- (@putout/processor-css) rm once
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
feature:
|
|
8
|
+
- (package) @putout/engine-processor v6.0.0
|
|
9
|
+
- (package) @putout/engine-loader v7.0.0
|
|
10
|
+
- (package) @putout/engine-loader v7.0.0
|
|
11
|
+
- (@putout/engine-processor) getProcessorRunners: sync -> async
|
|
12
|
+
- (putout) getProcessors: sync -> async
|
|
13
|
+
- (@putout/engine-loader) loadProcessors -> loadProcessorsAsync
|
|
14
|
+
- (@putout/plugin-remove-useless-variables) exclude mirrored renames (used in tests)
|
|
15
|
+
|
|
16
|
+
|
|
1
17
|
2022.05.12, v26.0.2
|
|
2
18
|
|
|
3
19
|
fix:
|
|
@@ -246,7 +262,7 @@ feature:
|
|
|
246
262
|
- (package) @putout/plugin-typescript v2.0.0
|
|
247
263
|
- (@putout/plugin-typescript) drop support of 🐊 < 16
|
|
248
264
|
- (@putout/plugin-typescript) remove-duplicates-from-union: avoid duplicates reporting
|
|
249
|
-
- (@putout/plugin-extract-object-properties) not-equal-deep: link to listStore() results -> call linkStore() when
|
|
265
|
+
- (@putout/plugin-extract-object-properties) not-equal-deep: link to listStore() results -> call linkStore() when needed
|
|
250
266
|
- (@putout/engine-runner) store: listStore: use Set() inside to prevent duplicates and return array
|
|
251
267
|
|
|
252
268
|
|
|
@@ -2216,7 +2232,7 @@ feature:
|
|
|
2216
2232
|
|
|
2217
2233
|
fix:
|
|
2218
2234
|
- (@putout/compare) exclude: range, parent (#67)
|
|
2219
|
-
- (@putout/plugin-regexp) remove-useless-group:
|
|
2235
|
+
- (@putout/plugin-regexp) remove-useless-group: exclude named capturing groups (#67)
|
|
2220
2236
|
|
|
2221
2237
|
feature:
|
|
2222
2238
|
- (ruler) exclude rules not related to putout
|
|
@@ -5204,7 +5220,7 @@ feature:
|
|
|
5204
5220
|
2020.01.17, v7.6.1
|
|
5205
5221
|
|
|
5206
5222
|
fix:
|
|
5207
|
-
- feature(@putout/eslint-config) disable no-empty-pattern: no
|
|
5223
|
+
- feature(@putout/eslint-config) disable no-empty-pattern: no
|
|
5208
5224
|
- (putout) parseOptions: custom optionsmore important then merged options, custom match more important then custom options
|
|
5209
5225
|
|
|
5210
5226
|
feature:
|
|
@@ -7270,7 +7286,7 @@ fix:
|
|
|
7270
7286
|
|
|
7271
7287
|
fix:
|
|
7272
7288
|
- (run-plugins) add early return when no need to apply changes
|
|
7273
|
-
- docs(changelog) rm
|
|
7289
|
+
- docs(changelog) rm
|
|
7274
7290
|
|
|
7275
7291
|
|
|
7276
7292
|
2019.02.22, v4.3.0
|
|
@@ -7393,7 +7409,7 @@ feature:
|
|
|
7393
7409
|
|
|
7394
7410
|
fix:
|
|
7395
7411
|
- (@putout/plugin-madrun) add .spec.js to ignore
|
|
7396
|
-
- (@putout/test) report/reportCode: disable
|
|
7412
|
+
- (@putout/test) report/reportCode: disable
|
|
7397
7413
|
|
|
7398
7414
|
feature:
|
|
7399
7415
|
- (@putout/plugin-madrun) add
|
|
@@ -7785,7 +7801,7 @@ feature:
|
|
|
7785
7801
|
|
|
7786
7802
|
fix:
|
|
7787
7803
|
- (plugin-remove-only) description
|
|
7788
|
-
- feature(putout) change plugin structure: find,
|
|
7804
|
+
- feature(putout) change plugin structure: find,
|
|
7789
7805
|
|
|
7790
7806
|
feature:
|
|
7791
7807
|
- (parse-match) move out from bin/putout.js
|
|
@@ -8105,7 +8121,7 @@ feature:
|
|
|
8105
8121
|
2018.12.21, v2.1.0
|
|
8106
8122
|
|
|
8107
8123
|
fix:
|
|
8108
|
-
- test(putout) fn vars
|
|
8124
|
+
- test(putout) fn vars
|
|
8109
8125
|
- test(putout) arrow-vars-
|
|
8110
8126
|
|
|
8111
8127
|
feature:
|
package/lib/cli/formatter.js
CHANGED
|
@@ -1,72 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const tryToCatch = require('try-to-catch');
|
|
4
|
+
const {createAsyncLoader} = require('@putout/engine-loader');
|
|
4
5
|
|
|
5
6
|
const {
|
|
6
7
|
NO_FORMATTER,
|
|
7
8
|
CANNOT_LOAD_FORMATTER,
|
|
8
9
|
} = require('./exit-codes');
|
|
9
10
|
|
|
10
|
-
const {simpleImportDefault} = require('./simple-import');
|
|
11
|
-
|
|
12
|
-
const stub = () => () => {};
|
|
13
|
-
|
|
14
11
|
const {isArray} = Array;
|
|
15
|
-
const {assign} = Object;
|
|
16
12
|
const maybeArray = (a) => isArray(a) ? a : [a, {}];
|
|
17
13
|
|
|
18
|
-
module.exports.getFormatter = async (
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
return [
|
|
22
|
-
await getReporter(name, exit),
|
|
23
|
-
formatterOptions,
|
|
24
|
-
];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports.getReporter = getReporter;
|
|
28
|
-
async function getReporter(name, exit) {
|
|
29
|
-
if (name === 'none')
|
|
30
|
-
return stub();
|
|
14
|
+
module.exports.getFormatter = async (formatterOptional, exit) => {
|
|
15
|
+
const [formatterName, formatterOptions] = maybeArray(formatterOptional);
|
|
16
|
+
const loadFormatter = createAsyncLoader('formatter');
|
|
31
17
|
|
|
32
|
-
const [error,
|
|
33
|
-
`@putout/formatter-${name}`,
|
|
34
|
-
`putout-formatter-${name}`,
|
|
35
|
-
]);
|
|
18
|
+
const [error, formatter] = await tryToCatch(loadFormatter, formatterName, exit);
|
|
36
19
|
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
20
|
+
if (formatter)
|
|
21
|
+
return [formatter, formatterOptions];
|
|
39
22
|
|
|
40
23
|
if (error.code === 'ERR_MODULE_NOT_FOUND')
|
|
41
24
|
return exit(NO_FORMATTER, error);
|
|
42
25
|
|
|
43
26
|
exit(CANNOT_LOAD_FORMATTER, error);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function loadFormatter(names) {
|
|
47
|
-
let e;
|
|
48
|
-
let reporter;
|
|
49
|
-
|
|
50
|
-
for (const name of names) {
|
|
51
|
-
[e, reporter] = await tryToCatch(simpleImportDefault, name);
|
|
52
|
-
|
|
53
|
-
if (!e)
|
|
54
|
-
return [null, reporter];
|
|
55
|
-
|
|
56
|
-
if (e.code === 'ERR_MODULE_NOT_FOUND')
|
|
57
|
-
continue;
|
|
58
|
-
|
|
59
|
-
assign(e, {
|
|
60
|
-
message: `${name}: ${e.message}`,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return [e];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
assign(e, {
|
|
67
|
-
message: e.message.replace(/\simported.*/, ''),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return [e];
|
|
71
|
-
}
|
|
27
|
+
};
|
|
72
28
|
|
package/lib/cli/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const tryToCatch = require('try-to-catch');
|
|
4
|
+
|
|
3
5
|
const yargsParser = require('yargs-parser');
|
|
4
6
|
const {isCI} = require('ci-info');
|
|
5
7
|
const memo = require('nano-memoize');
|
|
@@ -213,7 +215,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
213
215
|
} = config;
|
|
214
216
|
|
|
215
217
|
const [currentFormat, formatterOptions] = await getFormatter(format || formatter, exit);
|
|
216
|
-
const [error, processorRunners] =
|
|
218
|
+
const [error, processorRunners] = await tryToCatch(getProcessorRunners, processors);
|
|
217
219
|
|
|
218
220
|
if (error)
|
|
219
221
|
return exit(CANNOT_LOAD_PROCESSOR, error);
|
|
@@ -350,3 +352,4 @@ function addOnce(emitter, name, fn) {
|
|
|
350
352
|
if (!emitter.listenerCount(name))
|
|
351
353
|
emitter.on(name, fn);
|
|
352
354
|
}
|
|
355
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "26.0
|
|
3
|
+
"version": "26.1.0",
|
|
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",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@putout/cli-ruler": "^2.0.0",
|
|
54
54
|
"@putout/cli-validate-args": "^1.0.0",
|
|
55
55
|
"@putout/compare": "^9.0.0",
|
|
56
|
-
"@putout/engine-loader": "^
|
|
56
|
+
"@putout/engine-loader": "^7.0.0",
|
|
57
57
|
"@putout/engine-parser": "^5.0.0",
|
|
58
|
-
"@putout/engine-processor": "^
|
|
58
|
+
"@putout/engine-processor": "^6.0.0",
|
|
59
59
|
"@putout/engine-runner": "^13.0.0",
|
|
60
60
|
"@putout/formatter-codeframe": "^4.0.0",
|
|
61
61
|
"@putout/formatter-dump": "^4.0.0",
|