@putout/printer 2.57.0 → 2.58.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.08, v2.58.0
2
+
3
+ feature:
4
+ - 3af1546 @putout/printer: Function: innerComments
5
+
1
6
  2023.07.08, v2.57.0
2
7
 
3
8
  feature:
@@ -7,4 +7,3 @@ const {parseComments} = require('./parse-comments');
7
7
  module.exports.parseLeadingComments = parseLeadingComments;
8
8
  module.exports.parseTrailingComments = parseTrailingComments;
9
9
  module.exports.parseComments = parseComments;
10
-
@@ -10,4 +10,3 @@ module.exports.maybeInsideFn = (insideFn, {print, indent}) => {
10
10
  indent.dec();
11
11
  indent.dec();
12
12
  };
13
-
@@ -25,4 +25,3 @@ module.exports.parseComments = (path, {write}, semantics) => {
25
25
  }
26
26
  }
27
27
  };
28
-
@@ -58,4 +58,3 @@ module.exports.parseLeadingComments = (path, {print, maybe, indent}, semantics)
58
58
  }
59
59
  }
60
60
  };
61
-
@@ -37,4 +37,3 @@ module.exports.parseTrailingComments = (path, {write, maybe}, semantics) => {
37
37
  }
38
38
  }
39
39
  };
40
-
@@ -10,15 +10,19 @@ module.exports.ArrowFunctionExpression = {
10
10
  before(path, {write}) {
11
11
  write('(');
12
12
  },
13
- print(path, {print, maybe, write, traverse}) {
13
+ print(path, printer, semantics) {
14
+ const {
15
+ print,
16
+ maybe,
17
+ write,
18
+ traverse,
19
+ } = printer;
20
+
14
21
  const {async} = path.node;
15
22
 
16
23
  maybe.print(async, 'async ');
17
24
 
18
- printParams(path, {
19
- print,
20
- traverse,
21
- });
25
+ printParams(path, printer, semantics);
22
26
 
23
27
  const returnType = path.get('returnType');
24
28
 
@@ -4,7 +4,9 @@ const {isNext} = require('../../is');
4
4
  const {printParams} = require('./params');
5
5
 
6
6
  const ClassMethod = {
7
- print(path, {print, maybe, traverse}) {
7
+ print(path, printer, semantics) {
8
+ const {print, maybe} = printer;
9
+
8
10
  const {kind, computed} = path.node;
9
11
  const isConstructor = kind === 'constructor';
10
12
  const isMethod = kind === 'method';
@@ -24,10 +26,7 @@ const ClassMethod = {
24
26
  print('__key');
25
27
  }
26
28
 
27
- printParams(path, {
28
- print,
29
- traverse,
30
- });
29
+ printParams(path, printer, semantics);
31
30
 
32
31
  print.space();
33
32
  print('__body');
@@ -7,7 +7,9 @@ const {isNext, isNextParent} = require('../../is');
7
7
  const {printParams} = require('./params');
8
8
 
9
9
  module.exports.FunctionDeclaration = {
10
- print(path, {print, maybe, traverse}) {
10
+ print(path, printer, semantics) {
11
+ const {print, maybe} = printer;
12
+
11
13
  const {async, generator} = path.node;
12
14
 
13
15
  maybe.print(async, 'async ');
@@ -18,10 +20,7 @@ module.exports.FunctionDeclaration = {
18
20
  print('__id');
19
21
  print('__typeParameters');
20
22
 
21
- printParams(path, {
22
- print,
23
- traverse,
24
- });
23
+ printParams(path, printer, semantics);
25
24
 
26
25
  print.space();
27
26
 
@@ -3,9 +3,15 @@
3
3
  const {exists} = require('../../is');
4
4
  const {printParams} = require('./params');
5
5
 
6
- module.exports.FunctionExpression = (path, {print, maybe, write, traverse}) => {
7
- const {node} = path;
6
+ module.exports.FunctionExpression = (path, printer, semantics) => {
7
+ const {
8
+ print,
9
+ maybe,
10
+ write,
11
+ traverse,
12
+ } = printer;
8
13
 
14
+ const {node} = path;
9
15
  const {generator, async} = node;
10
16
 
11
17
  maybe.write(async, 'async ');
@@ -19,10 +25,7 @@ module.exports.FunctionExpression = (path, {print, maybe, write, traverse}) => {
19
25
  traverse(id);
20
26
  }
21
27
 
22
- printParams(path, {
23
- print,
24
- traverse,
25
- });
28
+ printParams(path, printer, semantics);
26
29
 
27
30
  print.space();
28
31
  print('__body');
@@ -10,7 +10,9 @@ module.exports.ObjectMethod = {
10
10
  before(path, {write}) {
11
11
  write('async ');
12
12
  },
13
- print(path, {print, maybe, traverse}) {
13
+ print(path, printer, semantics) {
14
+ const {print, maybe} = printer;
15
+
14
16
  const {
15
17
  kind,
16
18
  generator,
@@ -26,10 +28,7 @@ module.exports.ObjectMethod = {
26
28
  print('__key');
27
29
  maybe.print(computed, ']');
28
30
 
29
- printParams(path, {
30
- print,
31
- traverse,
32
- });
31
+ printParams(path, printer, semantics);
33
32
 
34
33
  print.space();
35
34
  print('__body');
@@ -1,10 +1,16 @@
1
1
  'use strict';
2
2
 
3
- module.exports.printParams = (path, {print, traverse}) => {
3
+ const {parseComments} = require('../../comment/comment');
4
+
5
+ module.exports.printParams = (path, printer, semantics) => {
6
+ const {print, traverse} = printer;
7
+
4
8
  printBraceOpen(path, {
5
9
  print,
6
10
  });
7
11
 
12
+ parseComments(path, printer, semantics);
13
+
8
14
  const params = path.get('params');
9
15
  const n = params.length;
10
16
 
@@ -11,7 +11,7 @@ const {
11
11
  exists,
12
12
  } = require('../../is');
13
13
 
14
- const {parseComments} = require('../../comments/comments');
14
+ const {parseComments} = require('../../comment/comment');
15
15
  const {isSpreadElement} = require('@babel/types');
16
16
 
17
17
  const isBodyOfArrow = (path) => path.parentPath.node.body === path.node;
@@ -6,7 +6,7 @@ const {isCoupleLines} = require('../is');
6
6
  const {JSXOpeningElement} = require('./jsx-opening-element');
7
7
  const fragments = require('./jsx-fragment');
8
8
  const {JSXText} = require('./jsx-text');
9
- const {parseComments} = require('../comments/comments');
9
+ const {parseComments} = require('../comment/comment');
10
10
 
11
11
  module.exports = {
12
12
  ...fragments,
@@ -13,7 +13,7 @@ const {
13
13
  } = require('@babel/types');
14
14
 
15
15
  const {markAfter} = require('../../mark');
16
- const {parseComments} = require('../../comments/comments');
16
+ const {parseComments} = require('../../comment/comment');
17
17
  const {insideIfWithNoBody} = require('./inside-if-with-no-body');
18
18
  const {getDirectives} = require('./get-directives');
19
19
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {parseComments} = require('../../comments/comments');
3
+ const {parseComments} = require('../../comment/comment');
4
4
  const {getDirectives} = require('../block-statement/get-directives');
5
5
 
6
6
  module.exports.Program = (path, {print, write, traverse, maybe}, semantics) => {
@@ -13,7 +13,7 @@ const {isExportDeclaration} = require('@babel/types');
13
13
  const {maybeSpaceAfterKeyword} = require('./maybe-space-after-keyword');
14
14
 
15
15
  const {isConcatenation} = require('../../expressions/binary-expression/concatanate');
16
- const {parseLeadingComments} = require('../../comments/comments');
16
+ const {parseLeadingComments} = require('../../comment/comment');
17
17
 
18
18
  const isParentBlock = (path) => /Program|BlockStatement|Export/.test(path.parentPath.type);
19
19
  const isInsideBlock = (path) => /^(Program|BlockStatement)$/.test(path.parentPath.type);
@@ -27,7 +27,7 @@ const {
27
27
  const {
28
28
  parseLeadingComments,
29
29
  parseTrailingComments,
30
- } = require('./comments/comments');
30
+ } = require('./comment/comment');
31
31
 
32
32
  const {parseOverrides} = require('./overrides');
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.57.0",
3
+ "version": "2.58.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",
@@ -53,7 +53,6 @@
53
53
  "@putout/plugin-promises": "^11.0.0",
54
54
  "@putout/plugin-react-hook-form": "^3.4.1",
55
55
  "@putout/plugin-react-hooks": "^5.0.0",
56
- "@putout/test": "^6.0.1",
57
56
  "acorn": "^8.8.2",
58
57
  "c8": "^8.0.0",
59
58
  "escover": "^3.0.0",