@putout/printer 1.8.7 → 1.8.9

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,13 @@
1
+ 2023.03.27, v1.8.9
2
+
3
+ feature:
4
+ - 6481c27 @putout/printer: improve support of empty ObjectExpression inside CallExpression
5
+
6
+ 2023.03.27, v1.8.8
7
+
8
+ feature:
9
+ - 31536d3 @putout/printer: drop newline after BlockStatement
10
+
1
11
  2023.03.27, v1.8.7
2
12
 
3
13
  feature:
@@ -68,12 +68,12 @@ function isOneLine(path) {
68
68
  const isCall = path.parentPath.isCallExpression();
69
69
  const {length} = path.get('properties');
70
70
 
71
- if (isCoupleLines(path))
72
- return false;
73
-
74
71
  if (!length)
75
72
  return true;
76
73
 
74
+ if (isCoupleLines(path))
75
+ return false;
76
+
77
77
  if (isCall && length < 2)
78
78
  return true;
79
79
 
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const {isNext} = require('../is');
3
+ const {
4
+ isNext,
5
+ isProgramParent,
6
+ } = require('../is');
4
7
  const isFirstStatement = (path) => path.get('body.0')?.isStatement();
5
8
 
6
9
  module.exports.BlockStatement = (path, {indent, maybe, print}) => {
@@ -35,13 +38,13 @@ module.exports.BlockStatement = (path, {indent, maybe, print}) => {
35
38
  function shouldAddNewlineAfter(path) {
36
39
  const {parentPath} = path;
37
40
 
38
- if (parentPath.isStatement() && !path.node.body.length && !isNext(parentPath))
41
+ if (!isNext(path) && !isNext(path.parentPath) && isProgramParent(path.parentPath))
39
42
  return false;
40
43
 
41
- if (isTry(path) || /FunctionExpression/.test(path.parentPath.type))
44
+ if (parentPath.isStatement() && !path.node.body.length && !isNext(parentPath))
42
45
  return false;
43
46
 
44
- if (parentPath.isIfStatement() && parentPath.get('consequent').node === path.node && parentPath.node.alternate)
47
+ if (isTry(path) || /FunctionExpression/.test(path.parentPath.type))
45
48
  return false;
46
49
 
47
50
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.8.7",
3
+ "version": "1.8.9",
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",