@putout/printer 1.90.0 → 1.91.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.05.10, v1.91.0
2
+
3
+ feature:
4
+ - 01a13b9 @putout/printer: add support of LabeledStatement
5
+
6
+ 2023.05.10, v1.90.1
7
+
8
+ feature:
9
+ - 9a90b34 @putout/printer: add support of innerComments
10
+
1
11
  2023.05.10, v1.90.0
2
12
 
3
13
  feature:
@@ -81,12 +81,12 @@ module.exports.parseTrailingComments = (path, {write, maybe}, format) => {
81
81
  };
82
82
 
83
83
  module.exports.parseComments = (path, {write}) => {
84
- const {comments} = path.node;
84
+ const comments = path.node.comments || path.node.innerComments;
85
85
 
86
86
  if (!comments)
87
87
  return;
88
88
 
89
- for (const {type, value} of path.node.comments) {
89
+ for (const {type, value} of comments) {
90
90
  if (type === 'CommentLine') {
91
91
  write.breakline();
92
92
  write('//');
@@ -35,7 +35,9 @@ module.exports.BlockStatement = {
35
35
  print(element);
36
36
  }
37
37
 
38
- parseComments(path, {write});
38
+ parseComments(path, {
39
+ write,
40
+ });
39
41
 
40
42
  indent.dec();
41
43
  maybe.indent(body.length);
@@ -101,4 +103,3 @@ function isTry({parentPath}) {
101
103
 
102
104
  return false;
103
105
  }
104
-
@@ -40,6 +40,12 @@ module.exports = {
40
40
  ForOfStatement,
41
41
  ReturnStatement,
42
42
  DebuggerStatement,
43
+ LabeledStatement(path, {print}) {
44
+ print('__label');
45
+ print(':');
46
+ print.space();
47
+ print('__body');
48
+ },
43
49
  Program(path, {print}) {
44
50
  print('__interpreter');
45
51
 
@@ -67,3 +73,4 @@ module.exports = {
67
73
  },
68
74
  WhileStatement,
69
75
  };
76
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.90.0",
3
+ "version": "1.91.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",