@putout/printer 15.9.0 → 15.10.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 +11 -0
- package/lib/tokenize/comment/comments-printer/comments-printer.js +16 -4
- package/lib/tokenize/expressions/member-expression/is-looks-like-chain.js +14 -0
- package/lib/tokenize/statements/expression-statement/expression-statement.js +1 -1
- package/lib/tokenize/statements/import-declaration/import-declaration.js +1 -1
- package/package.json +1 -1
- /package/lib/tokenize/statements/expression-statement/{comments.js → expression-statement-comments.js} +0 -0
- /package/lib/tokenize/statements/import-declaration/{comments.js → import-declaration-comments.js} +0 -0
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2025.07.04, v15.10.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 38782c7 @putout/printer: MemberExpresison: both identifiers inside nested MemberExpression call
|
|
5
|
+
|
|
6
|
+
2025.07.03, v15.9.1
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 9419ded @putout/printer: hasTrailingCommentsPrinter
|
|
10
|
+
- eb8d16f ExpressionStatement: inside IfStatement
|
|
11
|
+
|
|
1
12
|
2025.07.03, v15.9.0
|
|
2
13
|
|
|
3
14
|
feature:
|
|
@@ -4,15 +4,27 @@ const createPrintCommentLine = (fn, value) => () => fn(`//${value}`);
|
|
|
4
4
|
const createPrintCommentBlock = (fn, value) => () => fn(`/*${value}*/\n`);
|
|
5
5
|
|
|
6
6
|
module.exports.hasTrailingCommentsPrinter = (currentTraverse) => {
|
|
7
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
printTrailingCommentBlock,
|
|
9
|
+
printTrailingCommentLine,
|
|
10
|
+
} = currentTraverse;
|
|
11
|
+
|
|
12
|
+
if (printTrailingCommentBlock)
|
|
13
|
+
return true;
|
|
8
14
|
|
|
9
|
-
return Boolean(
|
|
15
|
+
return Boolean(printTrailingCommentLine);
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
module.exports.hasLeadingCommentsPrinter = (currentTraverse) => {
|
|
13
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
printLeadingCommentLine,
|
|
21
|
+
printLeadingCommentBlock,
|
|
22
|
+
} = currentTraverse;
|
|
23
|
+
|
|
24
|
+
if (printLeadingCommentLine)
|
|
25
|
+
return true;
|
|
14
26
|
|
|
15
|
-
return Boolean(
|
|
27
|
+
return Boolean(printLeadingCommentBlock);
|
|
16
28
|
};
|
|
17
29
|
|
|
18
30
|
module.exports.printLeadingComments = (path, printer, semantics, {currentTraverse}) => {
|
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
isUnaryExpression,
|
|
9
9
|
isIfStatement,
|
|
10
10
|
isCallExpression,
|
|
11
|
+
isIdentifier,
|
|
11
12
|
} = types;
|
|
12
13
|
|
|
13
14
|
const isArgOfCall = (path) => path.parentPath?.isCallExpression() && path.parentPath.get('arguments.0') === path;
|
|
@@ -16,9 +17,22 @@ const isCall = (a) => a.type === 'CallExpression';
|
|
|
16
17
|
const isExcludedFromChain = satisfy([isUnaryExpression, isIfStatement]);
|
|
17
18
|
const hasComment = ({type}) => type === 'CommentLine';
|
|
18
19
|
|
|
20
|
+
const isInsideMemberCall = (path) => {
|
|
21
|
+
if (!isIdentifier(path.node.object))
|
|
22
|
+
return false;
|
|
23
|
+
|
|
24
|
+
if (!isIdentifier(path.node.property))
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
return isCallExpression(path.parentPath.parentPath);
|
|
28
|
+
};
|
|
29
|
+
|
|
19
30
|
module.exports.isLooksLikeChain = (path) => {
|
|
20
31
|
const [root, properties] = chain(path);
|
|
21
32
|
|
|
33
|
+
if (isInsideMemberCall(path))
|
|
34
|
+
return false;
|
|
35
|
+
|
|
22
36
|
if (isExcludedFromChain(root))
|
|
23
37
|
return false;
|
|
24
38
|
|
|
@@ -19,7 +19,7 @@ const {isInsideAssignNextAssignFunction} = require('./is-inside-assign-next-assi
|
|
|
19
19
|
const {
|
|
20
20
|
printLeadingCommentLine,
|
|
21
21
|
printLeadingCommentBlock,
|
|
22
|
-
} = require('./comments');
|
|
22
|
+
} = require('./expression-statement-comments');
|
|
23
23
|
|
|
24
24
|
const isCommentBlock = (a) => a?.type === 'CommentBlock';
|
|
25
25
|
|
package/package.json
CHANGED
|
File without changes
|
/package/lib/tokenize/statements/import-declaration/{comments.js → import-declaration-comments.js}
RENAMED
|
File without changes
|