@putout/printer 15.9.1 → 15.11.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,14 @@
1
+ 2025.07.15, v15.11.0
2
+
3
+ feature:
4
+ - 26c8d24 @putout/printer: WhileStatement/DoWhileStatement: minify
5
+ - 64809ba @putout/printer: eslint-plugin-putout v28.0.0
6
+
7
+ 2025.07.04, v15.10.0
8
+
9
+ feature:
10
+ - 38782c7 @putout/printer: MemberExpresison: both identifiers inside nested MemberExpression call
11
+
1
12
  2025.07.03, v15.9.1
2
13
 
3
14
  feature:
@@ -88,4 +88,3 @@ module.exports.printTrailingComments = (path, printer, semantics, {currentTraver
88
88
  });
89
89
  }
90
90
  };
91
-
@@ -8,6 +8,7 @@ const {
8
8
  isUnaryExpression,
9
9
  isIfStatement,
10
10
  isCallExpression,
11
+ isIdentifier,
11
12
  } = types;
12
13
 
13
14
  const isArgOfCall = (path) => path.parentPath?.isCallExpression() && path.parentPath.get('arguments.0') === path;
@@ -16,9 +17,22 @@ const isCall = (a) => a.type === 'CallExpression';
16
17
  const isExcludedFromChain = satisfy([isUnaryExpression, isIfStatement]);
17
18
  const hasComment = ({type}) => type === 'CommentLine';
18
19
 
20
+ const isInsideMemberCall = (path) => {
21
+ if (!isIdentifier(path.node.object))
22
+ return false;
23
+
24
+ if (!isIdentifier(path.node.property))
25
+ return false;
26
+
27
+ return isCallExpression(path.parentPath.parentPath);
28
+ };
29
+
19
30
  module.exports.isLooksLikeChain = (path) => {
20
31
  const [root, properties] = chain(path);
21
32
 
33
+ if (isInsideMemberCall(path))
34
+ return false;
35
+
22
36
  if (isExcludedFromChain(root))
23
37
  return false;
24
38
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {isLast} = require('../is');
3
+ const {isLast} = require('#is');
4
4
  const notLast = (path) => !isLast(path);
5
5
 
6
6
  module.exports.DoWhileStatement = {
@@ -10,7 +10,8 @@ module.exports.DoWhileStatement = {
10
10
  print.space();
11
11
  print('__body');
12
12
  print.space();
13
- print('while ');
13
+ print('while');
14
+ print.space();
14
15
  print('(');
15
16
  print('__test');
16
17
  print(')');
@@ -13,12 +13,12 @@ const importDeclarations = require('./import-declaration/import-declaration');
13
13
  const exportDeclarations = require('./export-declaration/export-declaration');
14
14
  const {ExportAllDeclaration} = require('./export-declaration/export-all-declaration');
15
15
 
16
- const {WhileStatement} = require('./while-statement');
16
+ const {WhileStatement} = require('./while-statement/while-statement');
17
17
  const {SwitchStatement} = require('./switch-statement');
18
18
  const {ForInStatement} = require('./for-in-statement');
19
19
  const {ExportDefaultDeclaration} = require('./export-declaration/export-default-declaration');
20
20
  const {BreakStatement} = require('./break-statement/break-statement');
21
- const {DoWhileStatement} = require('./do-while-statement');
21
+ const {DoWhileStatement} = require('./do-while-statement/do-while-statement');
22
22
  const {Program} = require('./program/program');
23
23
  const {ContinueStatement} = require('./continue-statement/continue-statement');
24
24
  const {LabeledStatement} = require('./labeled-statement/labeled-statement');
@@ -1,17 +1,19 @@
1
1
  'use strict';
2
2
 
3
- const {isNext} = require('../is');
4
- const {markAfter} = require('../mark');
3
+ const {isNext} = require('#is');
4
+ const {markAfter} = require('../../mark');
5
5
 
6
6
  module.exports.WhileStatement = {
7
7
  print(path, {print, indent}) {
8
8
  indent();
9
- print('while (');
9
+ print('while');
10
+ print.space();
11
+ print('(');
10
12
  print('__test');
11
13
  print(')');
12
14
 
13
15
  if (path.node.body.body) {
14
- print(' ');
16
+ print.space();
15
17
  print('__body');
16
18
  } else {
17
19
  indent.inc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "15.9.1",
3
+ "version": "15.11.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",
@@ -80,7 +80,7 @@
80
80
  "check-dts": "^0.9.0",
81
81
  "escover": "^4.0.1",
82
82
  "eslint": "^9.0.0",
83
- "eslint-plugin-putout": "^27.0.0",
83
+ "eslint-plugin-putout": "^28.0.0",
84
84
  "estree-to-babel": "^11.0.2",
85
85
  "goldstein": "^6.0.1",
86
86
  "just-kebab-case": "^4.2.0",