@putout/printer 18.2.10 → 18.2.11

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.08, v18.2.11
2
+
3
+ feature:
4
+ - b16bb59 @putout/printer: ArrayExpression: newline: isNewlineAfterComma
5
+ - 5f0e329 @putout/printer: @putout/plugin-minify v12.0.0
6
+
1
7
  2026.03.08, v18.2.10
2
8
 
3
9
  feature:
@@ -5,13 +5,13 @@ import {
5
5
  isStringAndIdentifier,
6
6
  isIdentifierAndIdentifier,
7
7
  isSimpleAndNotEmptyObject,
8
- isNextObject,
9
8
  callWithNext,
10
9
  callWithPrev,
11
10
  } from '#is';
12
11
  import {
13
12
  isCurrentNewLine,
14
13
  isMultiLine,
14
+ isNewlineAfterComma,
15
15
  } from './newline.js';
16
16
  import {isObjectAfterSimple} from './is-object-after-simple.js';
17
17
  import {
@@ -27,35 +27,9 @@ const {
27
27
  isObjectExpression,
28
28
  isSpreadElement,
29
29
  isIdentifier,
30
- isFunction,
31
30
  isCallExpression,
32
- isObjectProperty,
33
31
  } = types;
34
32
 
35
- const isSpreadBeforeObject = (a) => {
36
- if (!a.isObjectExpression())
37
- return false;
38
-
39
- const prev = a.getPrevSibling();
40
-
41
- if (!prev.isSpreadElement())
42
- return false;
43
-
44
- const argCall = prev.get('argument');
45
-
46
- if (argCall.isCallExpression()) {
47
- const [first] = argCall.get('arguments');
48
-
49
- if (isFunction(first))
50
- return false;
51
- }
52
-
53
- if (prev.getPrevSibling().isObjectExpression())
54
- return false;
55
-
56
- return prev.get('argument').isCallExpression();
57
- };
58
-
59
33
  const isSimpleBetweenObjects = createTypeChecker([
60
34
  ['+', callWithNext(isObjectExpression)],
61
35
  ['-', isSpreadElement],
@@ -112,8 +86,8 @@ export const ArrayExpression = {
112
86
  if (index < n || trailingComma)
113
87
  maybe.print(is, ',');
114
88
 
115
- if (!(isObjectExpression(element) && isObjectProperty(path.parentPath)))
116
- maybe.print.newline((is || isSpreadBeforeObject(element)) && !isNextObject(element) && !isObjectExpression(element));
89
+ if (is && isNewlineAfterComma(element))
90
+ print.newline();
117
91
 
118
92
  maybe.print.space(is && isObjectAfterSimple(element));
119
93
 
@@ -11,6 +11,7 @@ import {
11
11
  isSimpleAndNotEmptyObject,
12
12
  isInsideCall,
13
13
  isInsideArray,
14
+ isNextObject,
14
15
  } from '#is';
15
16
  import {isIncreaseIndent} from './indent.js';
16
17
 
@@ -309,3 +310,8 @@ export const isCurrentNewLine = createTypeChecker([
309
310
  '+: -> SpreadElement',
310
311
  '+: -> !ObjectExpression',
311
312
  ]);
313
+
314
+ export const isNewlineAfterComma = createTypeChecker([
315
+ ['-', isNextObject],
316
+ ['+: -> !', isObjectExpression],
317
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.2.10",
3
+ "version": "18.2.11",
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,7 +74,6 @@
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": "^11.2.1",
78
77
  "@putout/plugin-printer": "^8.0.0",
79
78
  "@putout/plugin-promises": "^19.0.0",
80
79
  "@putout/plugin-react-hook-form": "^6.0.0",