@putout/printer 18.0.1 → 18.0.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,8 @@
1
+ 2026.03.04, v18.0.2
2
+
3
+ feature:
4
+ - 854491c @putout/printer: VariableDeclaration: simplify
5
+
1
6
  2026.03.04, v18.0.1
2
7
 
3
8
  feature:
@@ -1,17 +1,17 @@
1
1
  import {types} from '@putout/babel';
2
+ import {markAfter} from '#mark';
2
3
  import {
3
4
  hasBody,
5
+ isInsideExport,
4
6
  isInsideTSModuleBlock,
5
7
  isNext,
6
8
  } from '#is';
7
- import {markAfter} from '#mark';
8
9
  import {maybeDeclare} from '../../maybe/maybe-declare.js';
9
10
  import {parseComments} from '../../comment/comment.js';
10
11
  import {maybeDecorators} from '../../maybe/maybe-decorators.js';
11
12
 
12
13
  const {isFunction} = types;
13
14
 
14
- const isInsideExport = ({parentPath}) => parentPath.isExportDeclaration();
15
15
  const isFunctionLike = (path) => isFunction(path.parentPath.parentPath);
16
16
 
17
17
  const classVisitor = maybeDecorators((path, printer, semantics) => {
@@ -107,3 +107,4 @@ export const ClassDeclaration = {
107
107
  }
108
108
  },
109
109
  };
110
+
@@ -161,6 +161,7 @@ export const isForOf = (path) => {
161
161
  };
162
162
 
163
163
  export const isInsideIf = (path) => path.parentPath?.isIfStatement();
164
+ export const isInsideExport = ({parentPath}) => parentPath.isExportDeclaration();
164
165
 
165
166
  export const isNewlineBetweenSiblings = (path) => {
166
167
  const endCurrent = path.node?.loc?.end?.line;
@@ -10,6 +10,7 @@ import {
10
10
  isParentBlockLike,
11
11
  isInsideIf,
12
12
  isInsideBlock,
13
+ isInsideExport,
13
14
  } from '#is';
14
15
  import {maybeSpaceAfterKeyword} from './maybe-space-after-keyword.js';
15
16
  import {isConcatenation} from '../../expressions/binary-expression/concatenate.js';
@@ -122,7 +123,7 @@ export const VariableDeclaration = {
122
123
  isNextCoupleLines,
123
124
  notLastPrevVarNotNextVar,
124
125
  isNewlineBetweenSiblings,
125
- notLastParentExport,
126
+ isInsideExport,
126
127
  isParentTSModuleBlock,
127
128
  ],
128
129
  after(path, {maybe, store, print}) {
@@ -142,26 +143,15 @@ const skipAfter = createTypeChecker([
142
143
  ['+: -> !', isInsideBlock],
143
144
  ]);
144
145
 
145
- function noNextParentBlock(path) {
146
- if (isNext(path))
147
- return false;
148
-
149
- return path.parentPath.isBlockStatement();
150
- }
151
-
152
- function notLastParentExport(path) {
153
- if (isLast(path.parentPath))
154
- return false;
155
-
156
- return path.parentPath.isExportDeclaration();
157
- }
146
+ const noNextParentBlock = createTypeChecker([
147
+ ['-', isNext],
148
+ ['+', isInsideBlock],
149
+ ]);
158
150
 
159
- function notLastCoupleLines(path) {
160
- if (isLast(path))
161
- return false;
162
-
163
- return isCoupleLines(path);
164
- }
151
+ const notLastCoupleLines = createTypeChecker([
152
+ ['-', isLast],
153
+ ['+', isCoupleLines],
154
+ ]);
165
155
 
166
156
  function notLastPrevVarNotNextVar(path) {
167
157
  const prev = path.getPrevSibling();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.0.1",
3
+ "version": "18.0.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",