@putout/printer 12.4.0 → 12.6.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,13 @@
1
+ 2025.01.15, v12.6.0
2
+
3
+ feature:
4
+ - b8e8648 ArrayExpression: Tuple with CallExpression inside
5
+
6
+ 2025.01.15, v12.5.0
7
+
8
+ feature:
9
+ - 8173406 @putout/printer: ObjectExpression: BigIntLiteral
10
+
1
11
  2025.01.15, v12.4.0
2
12
 
3
13
  feature:
@@ -8,6 +8,7 @@ const SIMPLE_TYPES = [
8
8
  'SpreadElement',
9
9
  'CallExpression',
10
10
  'Identifier',
11
+ 'NewExpression',
11
12
  ];
12
13
 
13
14
  module.exports.isObjectAfterSimple = (a) => {
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  const {types} = require('@putout/babel');
4
- const {
5
- isNumericLiteral,
6
- isNullLiteral,
7
- isArrayExpression,
8
- } = types;
4
+ const {isArrayExpression} = types;
5
+
6
+ const TYPES = [
7
+ 'NullLiteral',
8
+ 'NumericLiteral',
9
+ 'BigIntLiteral',
10
+ ];
9
11
 
10
12
  module.exports.isInsideTuple = (path) => {
11
13
  const {parentPath} = path;
@@ -18,5 +20,5 @@ module.exports.isInsideTuple = (path) => {
18
20
  if (second !== path.node)
19
21
  return false;
20
22
 
21
- return isNullLiteral(first) || isNumericLiteral(first);
23
+ return TYPES.includes(first.type);
22
24
  };
@@ -3,7 +3,6 @@
3
3
  const {types} = require('@putout/babel');
4
4
  const {
5
5
  isStringLiteral,
6
- isSpreadElement,
7
6
  isIdentifier,
8
7
  isIfStatement,
9
8
  isStatement,
@@ -79,7 +78,15 @@ function isStringAndIdentifier([a, b]) {
79
78
  }
80
79
 
81
80
  module.exports.isSimpleAndNotEmptyObject = ([a, b]) => {
82
- if (!isIdentifier(a) && !isSpreadElement(a) && !isArrayExpression(a))
81
+ const simpleTypes = [
82
+ 'Identifier',
83
+ 'SpreadElement',
84
+ 'ArrayExpression',
85
+ 'CallExpression',
86
+ 'NewExpression',
87
+ ];
88
+
89
+ if (a && !simpleTypes.includes(a.type))
83
90
  return false;
84
91
 
85
92
  if (!isObjectExpression(b))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "12.4.0",
3
+ "version": "12.6.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",