@putout/printer 1.130.1 → 1.131.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
+ 2023.06.03, v1.131.0
2
+
3
+ feature:
4
+ - 2647101 @putout/printer: ArrayExpression: new line when ObjectExpression
5
+ - 9af0bd8 @putout/printer: ImportAttributes: all cases
6
+
7
+ 2023.06.03, v1.130.2
8
+
9
+ feature:
10
+ - 7607ed8 @putout/printer: ExportDeclaration: newline
11
+
1
12
  2023.06.03, v1.130.1
2
13
 
3
14
  feature:
@@ -209,6 +209,9 @@ function isOneSimple(path) {
209
209
  }
210
210
 
211
211
  function isNewlineBetweenElements(path, {elements}) {
212
+ if (elements.length > 3)
213
+ return true;
214
+
212
215
  if (isOneSimple(path))
213
216
  return false;
214
217
 
@@ -4,6 +4,7 @@ const {
4
4
  isNewlineBetweenSiblings,
5
5
  exists,
6
6
  isNext,
7
+ isLast,
7
8
  } = require('../../is');
8
9
 
9
10
  const {
@@ -107,6 +108,9 @@ module.exports.ExportNamedDeclaration = {
107
108
  print('__declaration');
108
109
  },
109
110
  afterIf(path) {
111
+ if (isLast(path))
112
+ return false;
113
+
110
114
  if (isDeclarationNewline(path))
111
115
  return false;
112
116
 
@@ -24,7 +24,12 @@ module.exports.maybePrintAttributes = (path, {write, traverse}) => {
24
24
  });
25
25
  };
26
26
 
27
- const isAssertions = (path) => path.node.assertions.length;
27
+ const isAssertions = (path) => {
28
+ if (path.node.extra?.deprecatedAssertSyntax)
29
+ return true;
30
+
31
+ return path.node.assertions.length;
32
+ };
28
33
 
29
34
  function printAttributes(path, {write, traverse, type, keyword}) {
30
35
  const attributes = path.get(type);
@@ -70,6 +70,10 @@ module.exports.VariableDeclaration = {
70
70
  ],
71
71
  after(path, {maybe, store}) {
72
72
  const wasNewline = store();
73
+
74
+ if (isLast(path.parentPath))
75
+ return false;
76
+
73
77
  maybe.print.linebreak(wasNewline);
74
78
  maybe.print.newline(!wasNewline);
75
79
  maybe.markAfter(wasNewline, path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.130.1",
3
+ "version": "1.131.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",