@putout/printer 18.3.1 → 18.3.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,9 @@
1
+ 2026.03.09, v18.3.2
2
+
3
+ feature:
4
+ - 0273534 @putout/printer: type-checker: validateResults: add
5
+ - e32d868 @putout/printer: @putout/plugin-minify v12.0.0
6
+
1
7
  2026.03.08, v18.3.1
2
8
 
3
9
  feature:
@@ -13,7 +13,6 @@ export const instrument = (typeNames, fn, overrides = {}) => {
13
13
  instrumentName = 'TYPE_CHECK',
14
14
  } = overrides;
15
15
 
16
- const {length} = typeNames;
17
16
  const error = Error();
18
17
  const location = parseCallLocation(error);
19
18
  const on = env[instrumentName];
@@ -21,7 +20,6 @@ export const instrument = (typeNames, fn, overrides = {}) => {
21
20
 
22
21
  if (on && !location.includes('type-checker.spec.js'))
23
22
  coverage.set(location, {
24
- length,
25
23
  covered,
26
24
  typeNames,
27
25
  });
@@ -1,7 +1,6 @@
1
1
  import {styleText} from 'node:util';
2
2
  import {codeFrameColumns} from '@putout/babel';
3
3
 
4
- /* c8 ignore start */
5
4
  const isString = (a) => typeof a === 'string';
6
5
  const isFn = (a) => typeof a === 'function';
7
6
  const difference = (a, b) => new Set(a).difference(new Set(b));
@@ -15,7 +14,9 @@ export const report = (coverage) => {
15
14
  const log = (a) => lines.push(a);
16
15
  let exitCode = SUCCESS;
17
16
 
18
- for (const [name, {length, covered, typeNames}] of coverage) {
17
+ for (const [name, {covered, typeNames}] of coverage) {
18
+ const {length} = typeNames;
19
+
19
20
  if (length === covered.size)
20
21
  continue;
21
22
 
@@ -77,5 +78,4 @@ function createRawCode(currentType) {
77
78
  }
78
79
 
79
80
  return operator;
80
- } /* c8 ignore end */
81
-
81
+ }
@@ -16,9 +16,24 @@ export const createTypeChecker = (typeNames, overrides = {}) => {
16
16
  } = overrides;
17
17
 
18
18
  const tuples = parseTypeNames(typeNames);
19
+ const checkers = [];
20
+ const results = [];
21
+
22
+ for (const [operation, typeName] of tuples) {
23
+ const [result, selector, not] = parseOperation(operation);
24
+ results.push(result);
25
+ checkers.push({
26
+ result,
27
+ selector,
28
+ not,
29
+ typeName,
30
+ });
31
+ }
32
+
33
+ validateResults(results);
34
+
19
35
  const typeChecker = (path, options) => {
20
- for (const [index, [operation, typeName]] of tuples.entries()) {
21
- const [result, selector, not] = parseOperation(operation);
36
+ for (const [index, {result, selector, typeName, not}] of checkers.entries()) {
22
37
  let currentPath = path;
23
38
 
24
39
  if (selector)
@@ -39,3 +54,8 @@ export const createTypeChecker = (typeNames, overrides = {}) => {
39
54
 
40
55
  return instrumentCoverage(typeNames, typeChecker, overrides);
41
56
  };
57
+
58
+ function validateResults(results) {
59
+ if (!results.includes(true))
60
+ throw Error(`☝️Looks like type checker missing successful route ('+'), it will always fail`);
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.3.1",
3
+ "version": "18.3.2",
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",
@@ -74,10 +74,12 @@
74
74
  "@babel/parser": "^7.28.5",
75
75
  "@putout/eslint": "^6.0.0",
76
76
  "@putout/eslint-flat": "^4.0.0",
77
+ "@putout/plugin-minify": "^12.0.0",
77
78
  "@putout/plugin-printer": "^8.0.0",
78
79
  "@putout/plugin-promises": "^19.0.0",
79
80
  "@putout/plugin-react-hook-form": "^6.0.0",
80
81
  "@putout/plugin-react-hooks": "^9.0.0",
82
+ "@supertape/operator-strip": "^1.0.0",
81
83
  "acorn": "^8.8.2",
82
84
  "chalk": "^5.6.2",
83
85
  "check-dts": "^0.9.0",