putout 22.4.0 → 22.5.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 CHANGED
@@ -1,3 +1,76 @@
1
+ 2021.12.07, v22.5.3
2
+
3
+ fix:
4
+ - (eslint-plugin-putout) objects-braces-inside-array: whitespaces before open brace
5
+
6
+ feature:
7
+ - (package) @putout/formatter-memory v2.0.0
8
+ - (@putout/formatter-memory) convert to ESM (#91)
9
+ - (package) @putout/formatter-dump v3.0.0
10
+
11
+
12
+ 2021.12.07, v22.5.2
13
+
14
+ fix:
15
+ - (@putout/operator-declare) simplify
16
+
17
+ feature:
18
+ - (package) @putout/formatter-dump v3.0.0
19
+ - (package) @putout/formatter-dump v3.0.0
20
+ - (@putout/formatter-dump) convert to ESM (#91)
21
+ - (package) @putout/plugin-remove-useless-escape v2.0.0
22
+ - (eslint-plugin-putout) objects-braces-inside-array: add support of newlines in the middle
23
+ - (@putout/plugin-remove-useless-escape) drop support of node < 14
24
+ - (@putout/plugin-remove-useless-escape) add support of comma
25
+ - (@putout/plugin-putout) add convert-putout-test-to-create-test
26
+ - (@putout/operator-declare) add ability to handle missing case of dual package
27
+ - (@putout/plugin-putout) add apply-async-formatter (#91)
28
+ - (@putout/tape) add support of reRequire
29
+
30
+
31
+ 2021.12.05, v22.5.1
32
+
33
+ feature:
34
+ - (package) @putout/plugin-declare-undefined-variables v6.0.0
35
+ - (package) @putout/plugin-tape v7.0.0
36
+ - (package) @putout/operator-declare v2.0.0
37
+ - (@putout/operator-declare) drop support of putout < 22.5
38
+ - (@putout/plugin-tape) drop support of putout < 22.5
39
+ - (@putout/plugin-tape) declare: add mockImport
40
+ - (@putout/plugin-declare-undefined-variables) mv mock-import to @putout/plugin-tape
41
+ - (@putout/plugin-declare-undefined-variables) drop support of putout < 22.5
42
+ - (@putout/plugin-declare-undefined-variables) simport: add support of dual packages
43
+ - (@putout/operator-declare) add support of dual packages: esm and commonjs
44
+
45
+
46
+ 2021.12.04, v22.5.0
47
+
48
+ fix:
49
+ - (@putout/plugin-convert-mock-require-to-mock-import) handle no stopAll case
50
+
51
+ feature:
52
+ - (@putout/plugin-declare-undefined-variables) add support of simport
53
+ - (package) @putout/formatter-progress-bar v2.0.0
54
+ - (@putout/test) format: improve ability to test ESM
55
+ - (@putout/plugin-convert-commonjs-to-esm) require: call: exclude dot dot
56
+ - (@putout/plugin-declare-undefined-variables) add fresh-import
57
+ - (@putout/formatter-progress-bar) convert to ESM
58
+ - (package) @putout/plugin-convert-commonjs-to-esm v6.0.0
59
+ - (package) @putout/formatter-progress v3.0.0
60
+ - (@putout/formatter-progress) convert to ESM
61
+ - (@putout/plugin-convert-commonjs-to-esm) drop support of putout < 22
62
+ - (@putout/plugin-convert-commonjs-to-esm) require: improve support of namespaces: PascalCase -> kebabCase
63
+ - (@putout/test) v4.0.0
64
+ - (putout) add support of ESM formatters
65
+ - (@putout/formatter-eslint) convert to ESM
66
+ - (@putout/formatter-eslint) convert to async
67
+ - (@putout/test) format: convert to async
68
+ - (putout) add support of async formatters
69
+ - (@putout/plugin-declare-undefined-variables) add support of zlib
70
+ - (@putout/plugin-declare-undefined-variables) logical: add id
71
+ - (@putout/plugin-declare-undefined-variables) add logical
72
+
73
+
1
74
  2021.12.02, v22.4.0
2
75
 
3
76
  feature:
@@ -1,24 +1,27 @@
1
1
  'use strict';
2
2
 
3
- const tryCatch = require('try-catch');
3
+ const {createSimport} = require('simport');
4
+ const tryToCatch = require('try-to-catch');
5
+
4
6
  const {NO_FORMATTER} = require('./exit-codes');
5
7
 
8
+ const simport = createSimport(__filename);
6
9
  const stub = () => () => {};
7
10
 
8
11
  const {isArray} = Array;
9
12
  const maybeArray = (a) => isArray(a) ? a : [a, {}];
10
13
 
11
- module.exports.getFormatter = (formatter, exit) => {
14
+ module.exports.getFormatter = async (formatter, exit) => {
12
15
  const [name, formatterOptions] = maybeArray(formatter);
13
16
 
14
17
  return [
15
- getReporter(name, exit),
18
+ await getReporter(name, exit),
16
19
  formatterOptions,
17
20
  ];
18
21
  };
19
22
 
20
23
  module.exports.getReporter = getReporter;
21
- function getReporter(name, exit) {
24
+ async function getReporter(name, exit) {
22
25
  let e;
23
26
  let reporter;
24
27
 
@@ -26,16 +29,16 @@ function getReporter(name, exit) {
26
29
  return stub();
27
30
  }
28
31
 
29
- [e, reporter] = tryCatch(require, `@putout/formatter-${name}`);
32
+ [e, reporter] = await tryToCatch(simport, `@putout/formatter-${name}`);
30
33
 
31
34
  if (!e)
32
35
  return reporter;
33
36
 
34
- [e, reporter] = tryCatch(require, `putout-formatter-${name}`);
37
+ [e, reporter] = await tryToCatch(simport, `putout-formatter-${name}`);
35
38
 
36
- if (e)
37
- exit(NO_FORMATTER, e);
39
+ if (!e)
40
+ return reporter;
38
41
 
39
- return reporter;
42
+ exit(NO_FORMATTER, e);
40
43
  }
41
44
 
package/lib/cli/index.js CHANGED
@@ -235,7 +235,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
235
235
  processors = defaultProcessors,
236
236
  } = config;
237
237
 
238
- const [currentFormat, formatterOptions] = getFormatter(format || formatter, exit);
238
+ const [currentFormat, formatterOptions] = await getFormatter(format || formatter, exit);
239
239
  const [error, processorRunners] = tryCatch(getProcessorRunners, processors);
240
240
 
241
241
  if (error)
@@ -341,7 +341,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
341
341
  count: length,
342
342
  });
343
343
 
344
- const line = report(currentFormat, formatterProxy);
344
+ const line = await report(currentFormat, formatterProxy);
345
345
 
346
346
  write(line || '');
347
347
  rawPlaces.push(places);
@@ -382,7 +382,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
382
382
  }
383
383
  }
384
384
 
385
- const line = report(currentFormat, {
385
+ const line = await report(currentFormat, {
386
386
  report,
387
387
  formatterOptions,
388
388
  name: chooseName(name, resolvedName),
package/lib/cli/report.js CHANGED
@@ -4,7 +4,7 @@ module.exports = () => {
4
4
  let filesCount = 0;
5
5
  let errorsCount = 0;
6
6
 
7
- return (formatter, options) => {
7
+ return async (formatter, options) => {
8
8
  const {
9
9
  name,
10
10
  source,
@@ -19,7 +19,7 @@ module.exports = () => {
19
19
 
20
20
  errorsCount += places.length;
21
21
 
22
- return formatter({
22
+ return await formatter({
23
23
  name,
24
24
  options: formatterOptions,
25
25
  source,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "22.4.0",
3
+ "version": "22.5.3",
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",
@@ -56,17 +56,17 @@
56
56
  "@putout/engine-processor": "^4.0.0",
57
57
  "@putout/engine-runner": "^11.0.0",
58
58
  "@putout/formatter-codeframe": "^2.0.0",
59
- "@putout/formatter-dump": "^2.0.0",
59
+ "@putout/formatter-dump": "^3.0.0",
60
60
  "@putout/formatter-frame": "^1.0.0",
61
61
  "@putout/formatter-json": "^1.0.0",
62
62
  "@putout/formatter-json-lines": "^1.0.0",
63
- "@putout/formatter-memory": "^1.0.0",
64
- "@putout/formatter-progress": "^2.0.0",
65
- "@putout/formatter-progress-bar": "^1.1.0",
63
+ "@putout/formatter-memory": "^2.0.0",
64
+ "@putout/formatter-progress": "^3.0.0",
65
+ "@putout/formatter-progress-bar": "^2.0.0",
66
66
  "@putout/formatter-stream": "^2.0.0",
67
67
  "@putout/operate": "^6.0.0",
68
68
  "@putout/operator-add-args": "^1.0.0",
69
- "@putout/operator-declare": "^1.0.0",
69
+ "@putout/operator-declare": "^2.0.0",
70
70
  "@putout/operator-regexp": "^1.0.0",
71
71
  "@putout/plugin-apply-array-at": "^1.0.0",
72
72
  "@putout/plugin-apply-as-type-assertions": "^1.0.0",
@@ -83,7 +83,7 @@
83
83
  "@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",
84
84
  "@putout/plugin-convert-assignment-to-comparison": "^1.0.0",
85
85
  "@putout/plugin-convert-bitwise-to-logical": "^1.0.0",
86
- "@putout/plugin-convert-commonjs-to-esm": "^5.0.0",
86
+ "@putout/plugin-convert-commonjs-to-esm": "^6.0.0",
87
87
  "@putout/plugin-convert-comparison-to-boolean": "^1.0.0",
88
88
  "@putout/plugin-convert-concat-to-flat": "^1.0.0",
89
89
  "@putout/plugin-convert-equal-to-strict-equal": "^1.0.0",
@@ -102,7 +102,7 @@
102
102
  "@putout/plugin-convert-to-arrow-function": "^3.0.0",
103
103
  "@putout/plugin-convert-top-level-return": "^4.0.0",
104
104
  "@putout/plugin-convert-typeof-to-is-type": "^1.0.0",
105
- "@putout/plugin-declare-undefined-variables": "^5.0.0",
105
+ "@putout/plugin-declare-undefined-variables": "^6.0.0",
106
106
  "@putout/plugin-eslint": "^2.0.0",
107
107
  "@putout/plugin-extract-object-properties": "^6.0.0",
108
108
  "@putout/plugin-extract-sequence-expressions": "^2.0.0",
@@ -146,7 +146,7 @@
146
146
  "@putout/plugin-remove-useless-conditions": "^1.0.0",
147
147
  "@putout/plugin-remove-useless-constructor": "^1.0.0",
148
148
  "@putout/plugin-remove-useless-continue": "^1.0.0",
149
- "@putout/plugin-remove-useless-escape": "^1.0.0",
149
+ "@putout/plugin-remove-useless-escape": "^2.0.0",
150
150
  "@putout/plugin-remove-useless-for-of": "^2.0.0",
151
151
  "@putout/plugin-remove-useless-functions": "^2.0.0",
152
152
  "@putout/plugin-remove-useless-map": "^1.0.0",
@@ -169,7 +169,7 @@
169
169
  "@putout/plugin-split-nested-destructuring": "^1.0.0",
170
170
  "@putout/plugin-split-variable-declarations": "^2.0.0",
171
171
  "@putout/plugin-strict-mode": "^2.0.0",
172
- "@putout/plugin-tape": "^6.0.0",
172
+ "@putout/plugin-tape": "^7.0.0",
173
173
  "@putout/plugin-webpack": "^1.0.0",
174
174
  "@putout/processor-css": "^3.0.0",
175
175
  "@putout/processor-ignore": "^2.0.0",