@putout/printer 10.7.0 → 10.8.1

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
+ 2024.12.01, v10.8.1
2
+
3
+ fix:
4
+ - c05da0e @putout/printer: declare first
5
+
6
+ 2024.11.29, v10.8.0
7
+
8
+ feature:
9
+ - c10faee @putout/printer: TSTypeParameterProperty: add support of decorators
10
+
1
11
  2024.11.28, v10.7.0
2
12
 
3
13
  feature:
@@ -20,10 +20,10 @@ const processClassProperty = maybeDecorators((path, printer, semantics, {accesso
20
20
 
21
21
  const value = path.get('value');
22
22
 
23
+ maybe.print(declare, 'declare ');
23
24
  maybe.print(accessibility, `${accessibility} `);
24
25
  maybe.print(node.static, 'static ');
25
26
  maybe.print(node.readonly, 'readonly ');
26
- maybe.print(declare, 'declare ');
27
27
 
28
28
  printKind(path, printer);
29
29
  printKey(path, printer);
@@ -39,7 +39,8 @@ const {maybePrintTypeAnnotation} = require('../maybe/maybe-type-annotation');
39
39
  const {TSImportType} = require('./ts-import-type');
40
40
  const {TSExportAssignment} = require('./ts-export-assignment/ts-export-assignment');
41
41
  const {TSTypeReference} = require('./ts-type-reference/ts-type-reference');
42
- const {TSInferType} = require('./ts-infer-type/ts-infert-type');
42
+ const {TSInferType} = require('./ts-infer-type/ts-infer-type');
43
+ const {TSParameterProperty} = require('./ts-parameter-property/ts-parameter-property');
43
44
 
44
45
  module.exports = {
45
46
  TSAsExpression,
@@ -173,14 +174,10 @@ module.exports = {
173
174
  print('.');
174
175
  print('__right');
175
176
  },
176
- TSParameterProperty(path, {write, print}) {
177
- write(path.node.accessibility);
178
- write.space();
179
- print('__parameter');
180
- },
181
177
  TSTypeAnnotation(path, {print}) {
182
178
  print('__typeAnnotation');
183
179
  },
180
+ TSParameterProperty,
184
181
  TSConstructSignatureDeclaration,
185
182
  TSIndexSignature(path, printer) {
186
183
  const {print} = printer;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ module.exports.TSParameterProperty = (path, {print, maybe}) => {
4
+ const {
5
+ decorators,
6
+ readonly,
7
+ accessibility,
8
+ } = path.node;
9
+
10
+ const decoratorsLength = decorators?.length;
11
+
12
+ maybe.print.breakline(decoratorsLength);
13
+
14
+ if (decorators)
15
+ for (const decorator of path.get('decorators')) {
16
+ print.indent();
17
+ print(decorator);
18
+ }
19
+
20
+ maybe.print.breakline(decoratorsLength);
21
+ maybe.indent(decoratorsLength);
22
+
23
+ if (accessibility) {
24
+ print(accessibility);
25
+ print.space();
26
+ }
27
+
28
+ if (readonly) {
29
+ print('readonly');
30
+ print.space();
31
+ }
32
+
33
+ print('__parameter');
34
+ maybe.print(decoratorsLength, ',');
35
+ maybe.print.breakline(decoratorsLength);
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "10.7.0",
3
+ "version": "10.8.1",
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",