@putout/printer 1.8.8 → 1.8.10

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.10
2
+
3
+ feature:
4
+ - 8302ebb @putout/printer: isProgram optional
5
+
6
+ 2023.03.27, v1.8.9
7
+
8
+ feature:
9
+ - 6481c27 @putout/printer: improve support of empty ObjectExpression inside CallExpression
10
+
1
11
  2023.03.27, v1.8.8
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
 
@@ -3,7 +3,7 @@
3
3
  module.exports.isFirst = (path) => path.node === path.parentPath.node.body[0];
4
4
  module.exports.isPrevBody = (path) => path.getPrevSibling().isBlockStatement();
5
5
  module.exports.isNext = (path) => path.getNextSibling().node;
6
- module.exports.isProgramParent = (path) => path.parentPath.isProgram();
6
+ module.exports.isProgramParent = (path) => path.parentPath?.isProgram();
7
7
  module.exports.isNextParent = (path) => path.parentPath.getNextSibling().node;
8
8
 
9
9
  module.exports.isCoupleLines = (path) => {
@@ -27,8 +27,8 @@ module.exports = {
27
27
  ForOfStatement,
28
28
  ReturnStatement,
29
29
  DebuggerStatement,
30
- Program(path, {traverse}) {
31
- path.get('body').forEach(traverse);
30
+ Program(path, {print}) {
31
+ path.get('body').forEach(print);
32
32
  },
33
33
  SwitchStatement,
34
34
  ...TryStatements,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
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",