putout 26.0.2 β†’ 26.1.2

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 CHANGED
@@ -1,3 +1,49 @@
1
+ 2022.05.14, v26.1.2
2
+
3
+ fix:
4
+ - (@putout/processor-markdown) minimum 🐊Putout version
5
+
6
+
7
+ feature:
8
+ - (package) @putout/processor-yaml v4.0.0
9
+ - (@putout/processor-yaml) convert to ESM
10
+ - (package) @putout/processor-json v5.0.0
11
+ - (package) @putout/processor-json v5.0.0
12
+ - (@putout/processor-json) convert to ESM
13
+ - (package) @putout/processor-ignore v3.0.0
14
+ - (@putout/processor-ignore) convert to ESM
15
+ - (package) @putout/processor-javascript v4.0.0
16
+ - (@putout/processor-javascript) convert to ESM
17
+
18
+
19
+ 2022.05.13, v26.1.1
20
+
21
+ fix:
22
+ - (@putout/engine-loader) loadProcessors: when no default, return the module
23
+
24
+
25
+ feature:
26
+ - (package) @putout/processor-markdown v7.0.0
27
+ - (@putout/test) processor: export ESM
28
+ - (@putout/processor-markdown) convert to ESM
29
+
30
+
31
+ 2022.05.13, v26.1.0
32
+
33
+ fix:
34
+ - (@putout/processor-css) rm once
35
+
36
+
37
+ feature:
38
+ - (package) @putout/engine-processor v6.0.0
39
+ - (package) @putout/engine-loader v7.0.0
40
+ - (package) @putout/engine-loader v7.0.0
41
+ - (@putout/engine-processor) getProcessorRunners: sync -> async
42
+ - (putout) getProcessors: sync -> async
43
+ - (@putout/engine-loader) loadProcessors -> loadProcessorsAsync
44
+ - (@putout/plugin-remove-useless-variables) exclude mirrored renames (used in tests)
45
+
46
+
1
47
  2022.05.12, v26.0.2
2
48
 
3
49
  fix:
@@ -246,7 +292,7 @@ feature:
246
292
  - (package) @putout/plugin-typescript v2.0.0
247
293
  - (@putout/plugin-typescript) drop support of 🐊 < 16
248
294
  - (@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 neaded
295
+ - (@putout/plugin-extract-object-properties) not-equal-deep: link to listStore() results -> call linkStore() when needed
250
296
  - (@putout/engine-runner) store: listStore: use Set() inside to prevent duplicates and return array
251
297
 
252
298
 
@@ -2216,7 +2262,7 @@ feature:
2216
2262
 
2217
2263
  fix:
2218
2264
  - (@putout/compare) exclude: range, parent (#67)
2219
- - (@putout/plugin-regexp) remove-useless-group: exlude named capturing groups (#67)
2265
+ - (@putout/plugin-regexp) remove-useless-group: exclude named capturing groups (#67)
2220
2266
 
2221
2267
  feature:
2222
2268
  - (ruler) exclude rules not related to putout
@@ -5204,7 +5250,7 @@ feature:
5204
5250
  2020.01.17, v7.6.1
5205
5251
 
5206
5252
  fix:
5207
- - feature(@putout/eslint-config) disable no-empty-pattern: no
5253
+ - feature(@putout/eslint-config) disable no-empty-pattern: no
5208
5254
  - (putout) parseOptions: custom optionsmore important then merged options, custom match more important then custom options
5209
5255
 
5210
5256
  feature:
@@ -7270,7 +7316,7 @@ fix:
7270
7316
 
7271
7317
  fix:
7272
7318
  - (run-plugins) add early return when no need to apply changes
7273
- - docs(changelog) rm
7319
+ - docs(changelog) rm
7274
7320
 
7275
7321
 
7276
7322
  2019.02.22, v4.3.0
@@ -7393,7 +7439,7 @@ feature:
7393
7439
 
7394
7440
  fix:
7395
7441
  - (@putout/plugin-madrun) add .spec.js to ignore
7396
- - (@putout/test) report/reportCode: disable
7442
+ - (@putout/test) report/reportCode: disable
7397
7443
 
7398
7444
  feature:
7399
7445
  - (@putout/plugin-madrun) add
@@ -7785,7 +7831,7 @@ feature:
7785
7831
 
7786
7832
  fix:
7787
7833
  - (plugin-remove-only) description
7788
- - feature(putout) change plugin structure: find,
7834
+ - feature(putout) change plugin structure: find,
7789
7835
 
7790
7836
  feature:
7791
7837
  - (parse-match) move out from bin/putout.js
@@ -8105,7 +8151,7 @@ feature:
8105
8151
  2018.12.21, v2.1.0
8106
8152
 
8107
8153
  fix:
8108
- - test(putout) fn vars
8154
+ - test(putout) fn vars
8109
8155
  - test(putout) arrow-vars-
8110
8156
 
8111
8157
  feature:
@@ -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 (formatter, exit) => {
19
- const [name, formatterOptions] = maybeArray(formatter);
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, reporter] = await loadFormatter([
33
- `@putout/formatter-${name}`,
34
- `putout-formatter-${name}`,
35
- ]);
18
+ const [error, formatter] = await tryToCatch(loadFormatter, formatterName, exit);
36
19
 
37
- if (reporter)
38
- return reporter;
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] = tryCatch(getProcessorRunners, processors);
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.2",
3
+ "version": "26.1.2",
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": "^6.0.0",
56
+ "@putout/engine-loader": "^7.0.0",
57
57
  "@putout/engine-parser": "^5.0.0",
58
- "@putout/engine-processor": "^5.0.0",
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",
@@ -170,11 +170,11 @@
170
170
  "@putout/plugin-typescript": "^2.0.0",
171
171
  "@putout/plugin-webpack": "^1.0.0",
172
172
  "@putout/processor-css": "^4.0.0",
173
- "@putout/processor-ignore": "^2.0.0",
174
- "@putout/processor-javascript": "^3.0.0",
175
- "@putout/processor-json": "^3.0.0",
176
- "@putout/processor-markdown": "^6.0.0",
177
- "@putout/processor-yaml": "^3.0.0",
173
+ "@putout/processor-ignore": "^3.0.0",
174
+ "@putout/processor-javascript": "^4.0.0",
175
+ "@putout/processor-json": "^5.0.0",
176
+ "@putout/processor-markdown": "^7.0.0",
177
+ "@putout/processor-yaml": "^4.0.0",
178
178
  "@putout/traverse": "^5.0.0",
179
179
  "ajv": "^8.8.2",
180
180
  "chalk": "^4.0.0",