@putout/printer 2.81.0 → 2.82.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,8 @@
1
+ 2023.07.21, v2.82.0
2
+
3
+ feature:
4
+ - 9332934 @putout/printer: TSDeclaredMethod
5
+
1
6
  2023.07.21, v2.81.0
2
7
 
3
8
  feature:
@@ -36,11 +36,14 @@ module.exports.ClassDeclaration = {
36
36
  };
37
37
 
38
38
  function classVisitor(path, {print, indent, maybe, traverse}) {
39
+ const {abstract} = path.node;
40
+
39
41
  for (const decorator of maybeDecorators(path)) {
40
42
  traverse(decorator);
41
43
  print.breakline();
42
44
  }
43
45
 
46
+ maybe.print(abstract, 'abstract ');
44
47
  print('class ');
45
48
  print('__id');
46
49
  print('__typeParameters');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const {printParams} = require('../expressions/functions/params');
4
- const {isNext} = require('../is');
3
+ const {printParams} = require('../../expressions/functions/params');
4
+ const {isNext} = require('../../is');
5
5
 
6
6
  const isInsideExport = (path) => {
7
7
  return path.parentPath.isExportDefaultDeclaration();
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const {printParams} = require('../../expressions/functions/params');
4
+
5
+ module.exports.TSDeclareMethod = (path, printer, semantics) => {
6
+ const {print} = printer;
7
+ const {accessibility, abstract} = path.node;
8
+
9
+ if (accessibility) {
10
+ print(accessibility);
11
+ print(' ');
12
+ }
13
+
14
+ if (abstract) {
15
+ print('abstract');
16
+ print(' ');
17
+ }
18
+
19
+ print('__key');
20
+
21
+ printParams(path, printer, semantics);
22
+
23
+ print(':');
24
+ print.space();
25
+ print('__returnType');
26
+ print(';');
27
+ print.newline();
28
+ };
@@ -6,7 +6,8 @@ const {TSTypeAliasDeclaration} = require('./ts-type-alias-declaration');
6
6
  const {TSMappedType} = require('./ts-mapped-type');
7
7
  const {TSConditionalType} = require('./ts-conditional-type');
8
8
  const {TSTypeParameter} = require('./ts-type-parameter');
9
- const {TSDeclareFunction} = require('./ts-declare-function');
9
+ const {TSDeclareFunction} = require('./function/ts-declare-function');
10
+ const {TSDeclareMethod} = require('./function/ts-declare-method');
10
11
 
11
12
  const {
12
13
  TSModuleDeclaration,
@@ -258,5 +259,5 @@ module.exports = {
258
259
  print('__expression');
259
260
  print(')');
260
261
  },
262
+ TSDeclareMethod,
261
263
  };
262
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.81.0",
3
+ "version": "2.82.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",