@putout/printer 1.15.1 → 1.15.3

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.03.31, v1.15.3
2
+
3
+ feature:
4
+ - d80165e @putout/printer: newline inside ArrayExpression inside ForOfStatement
5
+ - 8b7737b @putout/printer: ImportDeclaration: add support of no specifiers
6
+
7
+ 2023.03.31, v1.15.2
8
+
9
+ feature:
10
+ - 7df608f @putout/printer: add ability to indent tryStatement
11
+
1
12
  2023.03.31, v1.15.1
2
13
 
3
14
  feature:
@@ -115,10 +115,13 @@ function tooLong(path) {
115
115
  }
116
116
 
117
117
  function isNewlineBetweenElements(path, {elements}) {
118
+ if (isIncreaseIndent(path))
119
+ return false;
120
+
118
121
  if (isInsideCallLoop(path))
119
122
  return false;
120
123
 
121
- if (isIncreaseIndent(path))
124
+ if (isInsideLoop(path))
122
125
  return false;
123
126
 
124
127
  if (isTwoStringsDifferentLength(elements))
@@ -152,3 +155,11 @@ function isInsideCallLoop(path) {
152
155
 
153
156
  return true;
154
157
  }
158
+
159
+ function isInsideLoop(path) {
160
+ if (!path.parentPath.isForOfStatement())
161
+ return false;
162
+
163
+ return true;
164
+ }
165
+
@@ -22,9 +22,12 @@ module.exports.ImportDeclaration = (path, {print, maybe}) => {
22
22
  }
23
23
  }
24
24
 
25
- print(' ');
26
- print('from');
27
- print(' ');
25
+ if (specifiers.length) {
26
+ print.space();
27
+ print('from');
28
+ print.space();
29
+ }
30
+
28
31
  print('__source');
29
32
  print(';');
30
33
  print.newline();
@@ -4,6 +4,7 @@ const {isNext} = require('../is');
4
4
 
5
5
  module.exports.TryStatement = (path, {print, maybe}) => {
6
6
  const finalizer = path.get('finalizer');
7
+ print.indent();
7
8
  print('try ');
8
9
  print('__block');
9
10
  print('__handler');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",