@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 +5 -0
- package/lib/tokenize/{comments/comments.js → comment/comment.js} +0 -1
- package/lib/tokenize/{comments → comment}/maybe-inside-fn.js +0 -1
- package/lib/tokenize/{comments → comment}/parse-comments.js +0 -1
- package/lib/tokenize/{comments → comment}/parse-leading-comments.js +0 -1
- package/lib/tokenize/{comments → comment}/parse-trailing-comments.js +0 -1
- package/lib/tokenize/expressions/functions/arrow-function-expression.js +9 -5
- package/lib/tokenize/expressions/functions/class-method.js +4 -5
- package/lib/tokenize/expressions/functions/function-declaration.js +4 -5
- package/lib/tokenize/expressions/functions/function-expression.js +9 -6
- package/lib/tokenize/expressions/functions/object-method.js +4 -5
- package/lib/tokenize/expressions/functions/params.js +7 -1
- package/lib/tokenize/expressions/object-expression/object-expression.js +1 -1
- package/lib/tokenize/jsx/index.js +1 -1
- package/lib/tokenize/statements/block-statement/block-statement.js +1 -1
- package/lib/tokenize/statements/program/program.js +1 -1
- package/lib/tokenize/statements/variable-declaration/variable-declaration.js +1 -1
- package/lib/tokenize/tokenize.js +1 -1
- package/package.json +1 -2
package/ChangeLog
CHANGED
|
@@ -10,15 +10,19 @@ module.exports.ArrowFunctionExpression = {
|
|
|
10
10
|
before(path, {write}) {
|
|
11
11
|
write('(');
|
|
12
12
|
},
|
|
13
|
-
print(path,
|
|
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,
|
|
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,
|
|
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,
|
|
7
|
-
const {
|
|
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,
|
|
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
|
-
|
|
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('../../
|
|
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('../
|
|
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('../../
|
|
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('../../
|
|
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('../../
|
|
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);
|
package/lib/tokenize/tokenize.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "2.
|
|
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",
|