@putout/printer 15.8.0 → 15.9.1
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 +13 -0
- package/lib/tokenize/comment/comments-printer/comments-printer.js +17 -4
- package/lib/tokenize/statements/expression-statement/{comments.js → expression-statement-comments.js} +1 -4
- 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 +2 -2
- /package/lib/tokenize/statements/import-declaration/{comments.js → import-declaration-comments.js} +0 -0
package/ChangeLog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2025.07.03, v15.9.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 9419ded @putout/printer: hasTrailingCommentsPrinter
|
|
5
|
+
- eb8d16f ExpressionStatement: inside IfStatement
|
|
6
|
+
|
|
7
|
+
2025.07.03, v15.9.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- 57013dc @putout/printer: ExpressionStatement: inside BlockStatement: leading comment
|
|
11
|
+
- f2f187f @putout/printer: ExpressionStatement inside ArrowFunction: leadinging comment
|
|
12
|
+
- 0afbf8d @putout/printer: @putout/plugin-printer v6.0.0
|
|
13
|
+
|
|
1
14
|
2025.07.02, v15.8.0
|
|
2
15
|
|
|
3
16
|
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;
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
if (printLeadingCommentLine)
|
|
25
|
+
return true;
|
|
26
|
+
|
|
27
|
+
return Boolean(printLeadingCommentBlock);
|
|
16
28
|
};
|
|
17
29
|
|
|
18
30
|
module.exports.printLeadingComments = (path, printer, semantics, {currentTraverse}) => {
|
|
@@ -76,3 +88,4 @@ module.exports.printTrailingComments = (path, printer, semantics, {currentTraver
|
|
|
76
88
|
});
|
|
77
89
|
}
|
|
78
90
|
};
|
|
91
|
+
|
|
@@ -7,23 +7,20 @@ const {
|
|
|
7
7
|
isBlockStatement,
|
|
8
8
|
isProgram,
|
|
9
9
|
isIfStatement,
|
|
10
|
-
isClassMethod,
|
|
11
10
|
} = types;
|
|
12
11
|
|
|
13
12
|
module.exports.printLeadingCommentLine = (path, printer, semantics, {index, isLast, printComment}) => {
|
|
14
13
|
const {print, indent} = printer;
|
|
15
14
|
const prev = path.getPrevSibling();
|
|
16
15
|
const {parentPath} = path;
|
|
17
|
-
const parentParentPath = parentPath.parentPath;
|
|
18
16
|
|
|
19
17
|
if (hasTrailingComment(prev))
|
|
20
18
|
return;
|
|
21
19
|
|
|
22
|
-
if (!index && !prev.node && (isIfStatement(parentPath) ||
|
|
20
|
+
if (!index && !prev.node && (isIfStatement(parentPath) || isBlockStatement(parentPath)))
|
|
23
21
|
indent();
|
|
24
22
|
|
|
25
23
|
printComment();
|
|
26
|
-
|
|
27
24
|
print.newline();
|
|
28
25
|
|
|
29
26
|
if (!isLast && !path.parentPath.isIfStatement())
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.9.1",
|
|
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",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@putout/eslint": "^4.1.0",
|
|
73
73
|
"@putout/plugin-minify": "^10.0.0",
|
|
74
|
-
"@putout/plugin-printer": "^
|
|
74
|
+
"@putout/plugin-printer": "^6.0.0",
|
|
75
75
|
"@putout/plugin-promises": "^18.0.0",
|
|
76
76
|
"@putout/plugin-react-hook-form": "^6.0.0",
|
|
77
77
|
"@putout/plugin-react-hooks": "^9.0.0",
|
/package/lib/tokenize/statements/import-declaration/{comments.js → import-declaration-comments.js}
RENAMED
|
File without changes
|