@putout/printer 16.2.0 → 16.3.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,9 @@
1
+ 2025.12.09, v16.3.0
2
+
3
+ feature:
4
+ - 5c8c2ff @putout/printer: TSTypeLiteral: indent
5
+ - 6419576 @putout/printer: TSImportType: trailing comma
6
+
1
7
  2025.12.09, v16.2.0
2
8
 
3
9
  feature:
@@ -1,11 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const {types} = require('@putout/babel');
4
3
  const {isConcatenation} = require('../binary-expression/concatenate');
5
4
  const {isOneLine} = require('./object-expression');
6
5
  const {printKey} = require('./print-key');
7
- const {isTSImportType} = types;
8
- const isInsideTSImportType = ({parentPath}) => isTSImportType(parentPath.parentPath);
9
6
 
10
7
  module.exports.ObjectProperty = (path, printer, semantics) => {
11
8
  const {trailingComma} = semantics;
@@ -29,7 +26,7 @@ module.exports.ObjectProperty = (path, printer, semantics) => {
29
26
  traverse(value);
30
27
  }
31
28
 
32
- if (manyLines && !isInsideTSImportType(path))
29
+ if (manyLines)
33
30
  maybe.write(!isLast || trailingComma, ',');
34
31
  else if (!isLast && properties.length)
35
32
  write(', ');
@@ -32,7 +32,7 @@ const {TSMethodSignature} = require('./function/ts-method-signature');
32
32
  const {TSUnionType} = require('./ts-union-type/ts-union-type');
33
33
 
34
34
  const {maybePrintTypeAnnotation} = require('../maybe/maybe-type-annotation');
35
- const {TSImportType} = require('./ts-import-type');
35
+ const {TSImportType} = require('./ts-import-type/ts-import-type');
36
36
  const {TSExportAssignment} = require('./ts-export-assignment/ts-export-assignment');
37
37
  const {TSTypeReference} = require('./ts-type-reference/ts-type-reference');
38
38
  const {TSInferType} = require('./ts-infer-type/ts-infer-type');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {createImportExpression} = require('../expressions/import-expression');
3
+ const {createImportExpression} = require('../../expressions/import-expression');
4
4
 
5
5
  module.exports.TSImportType = (path, printer) => {
6
6
  createImportExpression(path, printer);
@@ -25,10 +25,15 @@ module.exports.TSTypeLiteral = (path, {indent, traverse, write}) => {
25
25
  };
26
26
 
27
27
  function isNewline(path) {
28
- const members = path.get('members');
28
+ const {parentPath} = path;
29
+
30
+ const {length} = path.get('members');
29
31
 
30
- if (members.length === 1 && path.parentPath.isTSTypeParameterInstantiation())
32
+ if (!length)
31
33
  return false;
32
34
 
33
- return members.length && members[0].node.typeAnnotation;
35
+ if (length > 1)
36
+ return true;
37
+
38
+ return !parentPath.isTSTypeParameterInstantiation();
34
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "16.2.0",
3
+ "version": "16.3.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",