@putout/printer 18.4.7 → 18.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 CHANGED
@@ -1,3 +1,14 @@
1
+ 2026.03.13, v18.6.0
2
+
3
+ feature:
4
+ - 43bb843 @putout/printer: type-checker: whenTestsEnds: add
5
+
6
+ 2026.03.13, v18.5.0
7
+
8
+ feature:
9
+ - c797ef4 @putout/printer: type-checker: rm include/exclude
10
+ - 5147c03 @putout/printer: merge-tuples-of-type-checkers
11
+
1
12
  2026.03.12, v18.4.7
2
13
 
3
14
  feature:
@@ -9,12 +9,7 @@ import {
9
9
  isTrailingCommaOption,
10
10
  } from './is.js';
11
11
 
12
- const {
13
- isSpreadElement,
14
- isCallExpression,
15
- isObjectExpression,
16
- isIdentifier,
17
- } = types;
12
+ const {isObjectExpression} = types;
18
13
 
19
14
  const isCommaAfterElementByOption = createTypeChecker([
20
15
  ['+: -> !', isLastOption],
@@ -35,9 +30,9 @@ export const isNewlineAfterComma = createTypeChecker([
35
30
 
36
31
  const isSimpleBetweenObjects = createTypeChecker([
37
32
  ['+', callWithNext(isObjectExpression)],
38
- ['-', isSpreadElement],
39
- ['-', isIdentifier],
40
- ['+: -> !', isCallExpression],
33
+ ['-: SpreadElement'],
34
+ ['-: Identifier'],
35
+ ['+: -> !CallExpression'],
41
36
  ]);
42
37
 
43
38
  export const isSpaceAfterComa = createTypeChecker([
@@ -1,13 +1,11 @@
1
- import {types} from '@putout/babel';
2
1
  import {createTypeChecker} from '#type-checker';
3
2
 
4
- const {isBinaryExpression} = types;
5
3
  const isPlus = (a) => a === '+';
6
4
 
7
5
  export const isConcatenation = createTypeChecker([
8
6
  ['-: node.operator -> !', isPlus],
9
7
  ['-: node.loc', isSameLine],
10
- ['+', isBinaryExpression],
8
+ ['+: BinaryExpression'],
11
9
  ]);
12
10
 
13
11
  function isSameLine(loc) {
@@ -20,40 +20,28 @@ const parseResult = (a) => a === '+';
20
20
  export function parseTypeNames(typeNames) {
21
21
  const tuples = [];
22
22
 
23
- if (isArray(typeNames)) {
24
- for (const typeName of typeNames) {
25
- if (isArray(typeName) && typeName.length === 1) {
26
- const [first] = typeName;
27
- const tuple = createTuple(first);
28
-
29
- tuples.push(tuple);
30
- continue;
31
- }
23
+ for (const typeName of typeNames) {
24
+ if (isArray(typeName) && typeName.length === 1) {
25
+ const [first] = typeName;
26
+ const tuple = createTuple(first);
32
27
 
33
- if (isArray(typeName)) {
34
- tuples.push(typeName);
35
- continue;
36
- }
37
-
38
- if (isString(typeName) && typeName.includes(' -> ')) {
39
- const tuple = createTuple(typeName);
40
- tuples.push(tuple);
41
- continue;
42
- }
43
-
44
- tuples.push(['+', typeName]);
28
+ tuples.push(tuple);
29
+ continue;
30
+ }
31
+
32
+ if (isArray(typeName)) {
33
+ tuples.push(typeName);
34
+ continue;
35
+ }
36
+
37
+ if (isString(typeName) && typeName.includes(' -> ')) {
38
+ const tuple = createTuple(typeName);
39
+ tuples.push(tuple);
40
+ continue;
45
41
  }
46
42
 
47
- return tuples;
48
- }
49
-
50
- for (const typeName of typeNames.include) {
51
43
  tuples.push(['+', typeName]);
52
44
  }
53
45
 
54
- for (const typeName of typeNames.exclude) {
55
- tuples.push(['-', typeName]);
56
- }
57
-
58
46
  return tuples;
59
47
  }
@@ -0,0 +1,17 @@
1
+ import {getCoverage as _getCoverage} from '#type-checker/instrument';
2
+ import {report as _report} from '#type-checker/report';
3
+
4
+ export const whenTestsEnds = (overrides = {}) => {
5
+ const {
6
+ log = console.log,
7
+ getCoverage = _getCoverage,
8
+ report = _report,
9
+ } = overrides;
10
+
11
+ const coverage = getCoverage();
12
+ const [code, message] = report(coverage);
13
+
14
+ log(message);
15
+
16
+ return code;
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.4.7",
3
+ "version": "18.6.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
@@ -12,7 +12,8 @@
12
12
  "./params": "./lib/tokenize/expressions/function/params.js",
13
13
  "./type-checker": "./lib/tokenize/type-checker/type-checker.js",
14
14
  "./type-checker/instrument": "./lib/tokenize/type-checker/instrument.js",
15
- "./type-checker/report": "./lib/tokenize/type-checker/report.js"
15
+ "./type-checker/report": "./lib/tokenize/type-checker/report.js",
16
+ "./type-checker/when-tests-ends": "./lib/tokenize/type-checker/when-tests-ends.js"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -70,6 +71,7 @@
70
71
  "#type-checker": "./lib/tokenize/type-checker/type-checker.js",
71
72
  "#type-checker/instrument": "./lib/tokenize/type-checker/instrument.js",
72
73
  "#type-checker/report": "./lib/tokenize/type-checker/report.js",
74
+ "#type-checker/when-tests-ends": "./lib/tokenize/type-checker/when-tests-ends.js",
73
75
  "#is-concatenation": "./lib/tokenize/expressions/binary-expression/is-concatenation.js",
74
76
  "#comments": "./lib/tokenize/comments/comments.js"
75
77
  },