@putout/printer 11.13.0 → 11.14.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,8 @@
1
+ 2025.01.05, v11.14.0
2
+
3
+ feature:
4
+ - ad933f7 @putout/printer: MemberExpression: chain: path.get
5
+
1
6
  2024.12.31, v11.13.0
2
7
 
3
8
  feature:
@@ -10,8 +10,8 @@ const {maybeParens} = require('../../maybe/maybe-parens');
10
10
 
11
11
  const {
12
12
  isUnaryExpression,
13
- isArrowFunctionExpression,
14
13
  isIfStatement,
14
+ isCallExpression,
15
15
  } = types;
16
16
 
17
17
  const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
@@ -68,11 +68,13 @@ module.exports.OptionalMemberExpression = maybeParens((path, {print, maybe}) =>
68
68
 
69
69
  const isCall = (a) => a.type === 'CallExpression';
70
70
 
71
- const isExcludedFromChain = satisfy([
72
- isUnaryExpression,
73
- isArrowFunctionExpression,
74
- isIfStatement,
75
- ]);
71
+ const isPathGet = (property) => {
72
+ return isCallExpression(property, {
73
+ name: 'get',
74
+ });
75
+ };
76
+
77
+ const isExcludedFromChain = satisfy([isUnaryExpression, isIfStatement]);
76
78
 
77
79
  const isIfUp = (path) => {
78
80
  const ifPath = path.find(isIfStatement);
@@ -102,6 +104,9 @@ function likeChain(path) {
102
104
  if (isExcludedFromChain(root))
103
105
  return false;
104
106
 
107
+ if (properties.find(isPathGet))
108
+ return false;
109
+
105
110
  if (path.find(isIfUp))
106
111
  return false;
107
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "11.13.0",
3
+ "version": "11.14.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",