@putout/printer 9.18.0 → 10.0.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
+ 2024.10.26, v10.0.0
2
+
3
+ feature:
4
+ - 24d872a @putout/printer: align with Babel v8
5
+
6
+ 2024.10.23, v9.19.0
7
+
8
+ feature:
9
+ - 8b5626e @putout/printer: TSInterfaceBody: comments
10
+ - ebc416f @putout/printer: TSTypeParameter: default
11
+
1
12
  2024.09.29, v9.18.0
2
13
 
3
14
  feature:
@@ -193,7 +193,11 @@ module.exports = {
193
193
  print(';');
194
194
  print.newline();
195
195
  },
196
- TSExpressionWithTypeArguments(path, {print}) {
196
+ TSClassImplements(path, {print}) {
197
+ print('__expression');
198
+ print('__typeParameters');
199
+ },
200
+ TSInterfaceHeritage(path, {print}) {
197
201
  print('__expression');
198
202
  print('__typeParameters');
199
203
  },
@@ -1,12 +1,23 @@
1
1
  'use strict';
2
2
 
3
- module.exports.TSInterfaceBody = (path, {traverse, write, indent, maybe}) => {
3
+ const {parseComments} = require('../../comment/comment');
4
+
5
+ module.exports.TSInterfaceBody = (path, printer, semantics) => {
4
6
  const body = path.get('body');
7
+ const {
8
+ traverse,
9
+ write,
10
+ indent,
11
+ maybe,
12
+ } = printer;
13
+
5
14
  write.space();
6
15
  write('{');
7
16
  maybe.write.newline(body.length);
8
17
  indent.inc();
9
18
 
19
+ parseComments(path, printer, semantics);
20
+
10
21
  for (const item of body) {
11
22
  indent();
12
23
  traverse(item);
@@ -22,7 +22,11 @@ module.exports.TSMappedType = (path, {print, indent, maybe}) => {
22
22
  }
23
23
 
24
24
  print('[');
25
- print('__typeParameter');
25
+ print('__key');
26
+ print(' ');
27
+ print('in');
28
+ print(' ');
29
+ print('__constraint');
26
30
 
27
31
  if (nameType) {
28
32
  print(' as');
@@ -17,10 +17,16 @@ module.exports.TSTypeParameter = (path, {write, traverse}) => {
17
17
  if (!exists(constraint))
18
18
  return;
19
19
 
20
- if (constraint.isTSTypeOperator() || path.parentPath.isTSMappedType())
21
- write(' in ');
22
- else
23
- write(' extends ');
20
+ write(' extends ');
24
21
 
25
22
  traverse(constraint);
23
+
24
+ const defaultPath = path.get('default');
25
+
26
+ if (exists(defaultPath)) {
27
+ write.space();
28
+ write('=');
29
+ write.space();
30
+ traverse(defaultPath);
31
+ }
26
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "9.18.0",
3
+ "version": "10.0.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",