@putout/printer 10.8.0 → 10.9.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
+ 2024.12.01, v10.9.0
2
+
3
+ feature:
4
+ - a5a0d34 @putout/printer: comments: decorator: improve support
5
+
6
+ 2024.12.01, v10.8.1
7
+
8
+ fix:
9
+ - c05da0e @putout/printer: declare first
10
+
1
11
  2024.11.29, v10.8.0
2
12
 
3
13
  feature:
@@ -26,7 +26,14 @@ const isProperty = satisfy([
26
26
  isSpreadElement,
27
27
  ]);
28
28
 
29
- const hasDecorators = ({parentPath}) => parentPath.node.decorators?.length;
29
+ const hasDecorators = (path) => {
30
+ const {parentPath} = path;
31
+
32
+ if (path.node.decorators?.length)
33
+ return true;
34
+
35
+ return parentPath.node.decorators?.length;
36
+ };
30
37
 
31
38
  function isCommentOfPrevious(path) {
32
39
  const [comment] = path.node.leadingComments;
@@ -105,7 +105,7 @@ module.exports.parseTrailingComments = (path, {write, maybe}, semantics) => {
105
105
  if (type === 'CommentLine') {
106
106
  maybe.write.breakline(commentOnNextLine);
107
107
  maybe.write.space(sameLine);
108
- maybe.indent(!sameLine && !commentOnNextLine);
108
+ maybe.indent(!sameLine && (!commentOnNextLine || path.isDecorator()));
109
109
 
110
110
  if (hasBody(path)) {
111
111
  maybe.write.breakline(!isNext(path));
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "10.8.0",
3
+ "version": "10.9.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",