@putout/printer 18.0.7 → 18.0.8

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.05, v18.0.8
2
+
3
+ feature:
4
+ - 08b7207 @putout/printer: VariableDeclaration: inside ForStatement
5
+ - dda61cc @putout/printer: type-check-coverage: check for only
6
+
1
7
  2026.03.05, v18.0.7
2
8
 
3
9
  feature:
@@ -19,30 +19,20 @@ import {isConcatenation} from '../../expressions/binary-expression/concatenate.j
19
19
  import {parseLeadingComments} from '../../comment/comment.js';
20
20
  import {maybeDeclare} from '../../maybe/maybe-declare.js';
21
21
 
22
- export const isInsideForOfBody = (path) => {
23
- const {parentPath} = path;
24
-
25
- if (!isForOfStatement(parentPath))
26
- return false;
27
-
28
- return path.parentPath.node.body === path.node;
29
- };
22
+ const {isExportDeclaration} = types;
23
+
24
+ const isInsideBody = (path) => path.node === path.parentPath.node.body;
30
25
 
31
26
  const isInsideBlockLike = createTypeChecker([
32
27
  isInsideProgram,
33
28
  isInsideBlock,
34
29
  isInsideTSModuleBlock,
35
30
  isInsideSwitchCase,
36
- isInsideForOfBody,
31
+ isInsideBody,
37
32
  ]);
38
33
 
39
34
  const isLast = (path) => path.parentPath?.isProgram() && !isNext(path);
40
35
 
41
- const {
42
- isExportDeclaration,
43
- isForOfStatement,
44
- } = types;
45
-
46
36
  const isParentTSModuleBlock = (path) => path.parentPath.isTSModuleBlock();
47
37
  const isParentSwitchCase = (path) => path.parentPath.isSwitchCase();
48
38
  const isFirstInSwitch = (path) => path.parentPath.get('consequent.0') === path;
@@ -59,7 +49,7 @@ const isNeedSemicolon = createTypeChecker([
59
49
  isParentSwitchCase,
60
50
  isParentTSModuleBlock,
61
51
  isInsideIf,
62
- isInsideForOfBody,
52
+ isInsideBody,
63
53
  ]);
64
54
 
65
55
  const isNeedNewline = createTypeChecker([
@@ -1,4 +1,4 @@
1
- import {env} from 'node:process';
1
+ import {env as _env} from 'node:process';
2
2
 
3
3
  const STACK_INDEX = 3;
4
4
 
@@ -6,7 +6,12 @@ const parseCallLocation = ({stack}) => stack.split('\n')[STACK_INDEX];
6
6
 
7
7
  const Coverage = new Map();
8
8
 
9
- export const instrument = (typeNames, fn) => {
9
+ export const instrument = (typeNames, fn, overrides = {}) => {
10
+ const {
11
+ env = _env,
12
+ coverage = Coverage,
13
+ } = overrides;
14
+
10
15
  const {length} = typeNames;
11
16
  const error = Error();
12
17
  const location = parseCallLocation(error);
@@ -14,7 +19,7 @@ export const instrument = (typeNames, fn) => {
14
19
  const covered = new Set();
15
20
 
16
21
  if (on && !location.includes('type-checker.spec.js'))
17
- Coverage.set(location, {
22
+ coverage.set(location, {
18
23
  length,
19
24
  covered,
20
25
  typeNames,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.0.7",
3
+ "version": "18.0.8",
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",