putout 22.5.2 → 22.6.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 +43 -0
- package/lib/cli/exit-codes.js +1 -0
- package/lib/cli/exit-codes.mjs +1 -0
- package/lib/cli/formatter.js +40 -13
- package/package.json +7 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
2021.12.07, v22.6.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- (putout) add exit code: CANNOT_LOAD_FORMATTER
|
|
5
|
+
- (package) @putout/formatter-json-lines v2.0.0
|
|
6
|
+
- (@putout/formatter-json-lines) convert to ESM (#91)
|
|
7
|
+
- (package) @putout/formatter-stream v3.0.0
|
|
8
|
+
- (package) @putout/formatter-json v2.0.0
|
|
9
|
+
- (package) @putout/formatter-json v2.0.0
|
|
10
|
+
- (package) @putout/formatter-json v2.0.0
|
|
11
|
+
- (package) @putout/formatter-json v2.0.0
|
|
12
|
+
- (@putout/formatter-json) convert to ESM (#91)
|
|
13
|
+
- (@putout/formatter-stream) convert to ESM (#91)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
2021.12.07, v22.5.5
|
|
17
|
+
|
|
18
|
+
feature:
|
|
19
|
+
- (package) @putout/formatter-frame v2.0.0
|
|
20
|
+
- (@putout/formatter-frame) convert to ESM (#91)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
2021.12.07, v22.5.4
|
|
24
|
+
|
|
25
|
+
fix:
|
|
26
|
+
- (@putout/plugin-putout) convert-putout-test-to-create-test: declared createTest
|
|
27
|
+
|
|
28
|
+
feature:
|
|
29
|
+
- (package) @putout/formatter-codeframe v3.0.0
|
|
30
|
+
- (@putout/formatter-codeframe) convert to ESM (#91)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
2021.12.07, v22.5.3
|
|
34
|
+
|
|
35
|
+
fix:
|
|
36
|
+
- (eslint-plugin-putout) objects-braces-inside-array: whitespaces before open brace
|
|
37
|
+
|
|
38
|
+
feature:
|
|
39
|
+
- (package) @putout/formatter-memory v2.0.0
|
|
40
|
+
- (@putout/formatter-memory) convert to ESM (#91)
|
|
41
|
+
- (package) @putout/formatter-dump v3.0.0
|
|
42
|
+
|
|
43
|
+
|
|
1
44
|
2021.12.07, v22.5.2
|
|
2
45
|
|
|
3
46
|
fix:
|
package/lib/cli/exit-codes.js
CHANGED
package/lib/cli/exit-codes.mjs
CHANGED
package/lib/cli/formatter.js
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
const {createSimport} = require('simport');
|
|
4
4
|
const tryToCatch = require('try-to-catch');
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
NO_FORMATTER,
|
|
8
|
+
CANNOT_LOAD_FORMATTER,
|
|
9
|
+
} = require('./exit-codes');
|
|
7
10
|
|
|
8
11
|
const simport = createSimport(__filename);
|
|
9
12
|
const stub = () => () => {};
|
|
10
13
|
|
|
11
14
|
const {isArray} = Array;
|
|
15
|
+
const {assign} = Object;
|
|
12
16
|
const maybeArray = (a) => isArray(a) ? a : [a, {}];
|
|
13
17
|
|
|
14
18
|
module.exports.getFormatter = async (formatter, exit) => {
|
|
@@ -22,23 +26,46 @@ module.exports.getFormatter = async (formatter, exit) => {
|
|
|
22
26
|
|
|
23
27
|
module.exports.getReporter = getReporter;
|
|
24
28
|
async function getReporter(name, exit) {
|
|
25
|
-
|
|
26
|
-
let reporter;
|
|
27
|
-
|
|
28
|
-
if (name === 'none') {
|
|
29
|
+
if (name === 'none')
|
|
29
30
|
return stub();
|
|
30
|
-
}
|
|
31
31
|
|
|
32
|
-
[
|
|
32
|
+
const [error, reporter] = await loadFormatter([
|
|
33
|
+
`@putout/formatter-${name}`,
|
|
34
|
+
`putout-formatter-${name}`,
|
|
35
|
+
]);
|
|
33
36
|
|
|
34
|
-
if (
|
|
37
|
+
if (reporter)
|
|
35
38
|
return reporter;
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
if (error.code === 'ERR_MODULE_NOT_FOUND')
|
|
41
|
+
return exit(NO_FORMATTER, error);
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
return reporter;
|
|
41
|
-
|
|
42
|
-
exit(NO_FORMATTER, e);
|
|
43
|
+
exit(CANNOT_LOAD_FORMATTER, error);
|
|
43
44
|
}
|
|
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(simport, 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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.6.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "🐊 Pluggable and configurable code transformer with built-in eslint, babel plugins and jscodeshift codemods support of js, jsx typescript, flow files, markdown, yaml and json",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/putout",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"@putout/engine-parser": "^4.0.0",
|
|
56
56
|
"@putout/engine-processor": "^4.0.0",
|
|
57
57
|
"@putout/engine-runner": "^11.0.0",
|
|
58
|
-
"@putout/formatter-codeframe": "^
|
|
58
|
+
"@putout/formatter-codeframe": "^3.0.0",
|
|
59
59
|
"@putout/formatter-dump": "^3.0.0",
|
|
60
|
-
"@putout/formatter-frame": "^
|
|
61
|
-
"@putout/formatter-json": "^
|
|
62
|
-
"@putout/formatter-json-lines": "^
|
|
63
|
-
"@putout/formatter-memory": "^
|
|
60
|
+
"@putout/formatter-frame": "^2.0.0",
|
|
61
|
+
"@putout/formatter-json": "^2.0.0",
|
|
62
|
+
"@putout/formatter-json-lines": "^2.0.0",
|
|
63
|
+
"@putout/formatter-memory": "^2.0.0",
|
|
64
64
|
"@putout/formatter-progress": "^3.0.0",
|
|
65
65
|
"@putout/formatter-progress-bar": "^2.0.0",
|
|
66
|
-
"@putout/formatter-stream": "^
|
|
66
|
+
"@putout/formatter-stream": "^3.0.0",
|
|
67
67
|
"@putout/operate": "^6.0.0",
|
|
68
68
|
"@putout/operator-add-args": "^1.0.0",
|
|
69
69
|
"@putout/operator-declare": "^2.0.0",
|