@putout/printer 17.0.6 → 17.0.8

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
+ 2026.01.28, v17.0.8
2
+
3
+ feature:
4
+ - d606ed8 @putout/printer: json: isJSON -> isJSONGroup
5
+
6
+ 2026.01.21, v17.0.7
7
+
8
+ feature:
9
+ - bc4913e @putout/printer: SpreadElement inside ObjectExpression: improve support
10
+
1
11
  2026.01.20, v17.0.6
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -21,7 +21,7 @@ You may also use [Babel 8](https://github.com/putoutjs/babel) with [`estree-to-b
21
21
 
22
22
  Supports:
23
23
 
24
- - ✅ **ES2023**;
24
+ - ✅ **ES2026**;
25
25
  - ✅ **JSX**;
26
26
  - ✅ [**TypeScript**](https://www.typescriptlang.org/);
27
27
  - ✅ [**JSON**](https://github.com/coderaiser/putout/tree/master/packages/processor-json#readme);
package/lib/json.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {types} from '@putout/babel';
2
- import {isJSON} from '@putout/operator-json';
2
+ import {isJSONGroup} from '@putout/operator-json';
3
3
 
4
4
  const {
5
5
  isCallExpression,
@@ -46,5 +46,5 @@ function isASTJSON(ast) {
46
46
  if (!isIdentifier(callee))
47
47
  return false;
48
48
 
49
- return isJSON(callee.name);
49
+ return isJSONGroup(callee.name);
50
50
  }
@@ -1,7 +1,7 @@
1
1
  import {types} from '@putout/babel';
2
2
  import {isNext, isNextParent} from '#is';
3
+ import {printParams} from '#print-params';
3
4
  import {markAfter} from '../../mark.js';
4
- import {printParams} from './params.js';
5
5
 
6
6
  const not = (fn) => (...a) => !fn(...a);
7
7
  const notInsideExportDefaultWithBody = not(isInsideExportDefaultWithBody);
@@ -1,6 +1,6 @@
1
1
  import {exists} from '#is';
2
2
  import {maybeParens} from '#maybe-parens';
3
- import {printParams} from './params.js';
3
+ import {printParams} from '#print-params';
4
4
 
5
5
  export const FunctionExpression = maybeParens((path, printer, semantics) => {
6
6
  const {
@@ -1,5 +1,5 @@
1
1
  import {isNewlineBetweenSiblings} from '#is';
2
- import {printParams} from './params.js';
2
+ import {printParams} from '#print-params';
3
3
  import {printKey} from '../object-expression/print-key.js';
4
4
  import {printKind} from './kind.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import {hasLeadingComment} from '#is';
2
- import {printParams} from './params.js';
2
+ import {printParams} from '#print-params';
3
3
 
4
4
  const isAllParamsHasLeadingComments = (path) => {
5
5
  const params = path.get('params');
@@ -12,7 +12,7 @@ export {ArrayExpression} from './array-expression/array-expression.js';
12
12
  export {ArrayPattern} from './array-pattern/array-pattern.js';
13
13
  export {AssignmentPattern} from './assignment-pattern.js';
14
14
  export {RestElement} from './rest-element.js';
15
- export {SpreadElement} from './spread-element.js';
15
+ export {SpreadElement} from './spread-element/spread-element.js';
16
16
  export {SequenceExpression} from './sequence-expression/sequence-expression.js';
17
17
  export {TaggedTemplateExpression} from './tagged-template-expression.js';
18
18
  export {BinaryExpression} from './binary-expression/binary-expression.js';
@@ -17,6 +17,7 @@ import {isThirdObjectInsideArray} from './is-third-object-inside-array.js';
17
17
  const {
18
18
  isStringLiteral,
19
19
  isArrayExpression,
20
+ isSpreadElement,
20
21
  } = types;
21
22
 
22
23
  const isBodyOfArrow = (path) => path.parentPath.node.body === path.node;
@@ -150,12 +151,24 @@ const notLastArgInsideCall = (path) => {
150
151
  const ONE_LINE = true;
151
152
  const MANY_LINES = false;
152
153
 
154
+ const isFirstSpread = (path) => {
155
+ const [first] = path.get('properties');
156
+
157
+ if (!isSpreadElement(first))
158
+ return false;
159
+
160
+ return !path.parentPath.isForOfStatement();
161
+ };
162
+
153
163
  export function isOneLine(path) {
154
164
  const {length} = path.get('properties');
155
165
 
156
166
  if (!length)
157
167
  return ONE_LINE;
158
168
 
169
+ if (isFirstSpread(path))
170
+ return MANY_LINES;
171
+
159
172
  if (notLastArgInsideCall(path))
160
173
  return ONE_LINE;
161
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "17.0.6",
3
+ "version": "17.0.8",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",