@putout/printer 2.80.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,13 @@
1
+ 2023.07.21, v2.82.0
2
+
3
+ feature:
4
+ - 9332934 @putout/printer: TSDeclaredMethod
5
+
6
+ 2023.07.21, v2.81.0
7
+
8
+ feature:
9
+ - dddf2b5 @putout/printer: TSExternalModuleReference
10
+
1
11
  2023.07.20, v2.80.0
2
12
 
3
13
  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
+ };
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const {exists} = require('../is');
3
+ const {exists, isNext} = require('../is');
4
4
  const {TSTypeLiteral} = require('./ts-type-literal');
5
5
  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,
@@ -243,7 +244,7 @@ module.exports = {
243
244
  },
244
245
  TSEnumDeclaration,
245
246
  TSEnumMember,
246
- TSImportEqualsDeclaration(path, {print}) {
247
+ TSImportEqualsDeclaration(path, {print, maybe}) {
247
248
  print('import ');
248
249
  print('__id');
249
250
  print.space();
@@ -251,6 +252,12 @@ module.exports = {
251
252
  print.space();
252
253
  print('__moduleReference');
253
254
  print(';');
254
- print.newline();
255
+ maybe.print.newline(isNext(path));
255
256
  },
257
+ TSExternalModuleReference(path, {print}) {
258
+ print('require(');
259
+ print('__expression');
260
+ print(')');
261
+ },
262
+ TSDeclareMethod,
256
263
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.80.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",