@putout/printer 1.72.3 → 1.72.5

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.04.26, v1.72.5
2
+
3
+ feature:
4
+ - a8fa20b @putout/printer: chaining newline
5
+
6
+ 2023.04.26, v1.72.4
7
+
8
+ feature:
9
+ - 8fabd6e @putout/printer: avoid adding newline in MemberExpression when no args
10
+
1
11
  2023.04.26, v1.72.3
2
12
 
3
13
  feature:
@@ -67,6 +67,12 @@ function isLooksLikeChain(path) {
67
67
  if (path.find(isIfStatement))
68
68
  return false;
69
69
 
70
+ if (compare(parentPath.parentPath.parentPath, '__a.__b(__x).__c(__y)'))
71
+ return true;
72
+
73
+ if (compare(parentPath, '__a.__b(__x).__c(__y)'))
74
+ return true;
75
+
70
76
  if (path.find(isUnaryExpression))
71
77
  return false;
72
78
 
@@ -74,6 +80,7 @@ function isLooksLikeChain(path) {
74
80
  const isExpression = ({parentPath}) => parentPath.parentPath.isExpressionStatement();
75
81
  const itMember = isMember(path);
76
82
  const itExpression = isExpression(path);
83
+ const callee = parentPath.get('callee');
77
84
 
78
85
  if (parentPath.isLiteral())
79
86
  return false;
@@ -84,16 +91,16 @@ function isLooksLikeChain(path) {
84
91
  if (!parentPath.isCallExpression())
85
92
  return false;
86
93
 
87
- if (parentPath.get('callee') !== path)
94
+ if (callee !== path)
88
95
  return false;
89
96
 
90
97
  if (compare(path.parentPath, '__a.__b(__args)[__c]'))
91
98
  return false;
92
99
 
93
- if (compare(path.parentPath.parentPath, '(__args) => __b.__c(__args).__d()'))
100
+ if (compare(path.parentPath.parentPath, '__a.__b().__c()'))
94
101
  return false;
95
102
 
96
- if (compare(parentPath, '__a.__b(__args);') && !itExpression && !itMember)
103
+ if (compare(path.parentPath.parentPath, '(__args) => __b.__c(__args).__d()'))
97
104
  return false;
98
105
 
99
106
  if (compare(parentPath, '__a.__b.__c(__args)') && !itMember)
@@ -115,5 +122,5 @@ function isLooksLikeChain(path) {
115
122
  if (isThisExpression(__a) && isIdentifier(__b) && itExpression)
116
123
  return false;
117
124
 
118
- return !compare(parentPath, '__a.__b(__args)') || itMember || itExpression;
125
+ return itExpression;
119
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.72.3",
3
+ "version": "1.72.5",
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 fro 🐊Putout",