@putout/printer 9.3.0 → 9.5.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,14 @@
|
|
|
1
|
+
2024.06.16, v9.5.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- f42012c @putout/printer: c8 v10.1.2
|
|
5
|
+
- b782436 @putout/printer: AssignmentExpression: nested
|
|
6
|
+
|
|
7
|
+
2024.06.10, v9.4.0
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- a446f8e @putout/printer: AssignmentExpression: always add braces inside UnaryExpression
|
|
11
|
+
|
|
1
12
|
2024.06.10, v9.3.0
|
|
2
13
|
|
|
3
14
|
feature:
|
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isCoupleLines} = require('../../is');
|
|
4
|
-
const {isMarkedAfter} = require('../../mark');
|
|
5
3
|
const {
|
|
6
4
|
maybePrintLeftBrace,
|
|
7
5
|
maybePrintRightBrace,
|
|
8
6
|
} = require('./maybe-write-brace');
|
|
9
7
|
|
|
8
|
+
const {
|
|
9
|
+
isExpressionStatement,
|
|
10
|
+
isAssignmentExpression,
|
|
11
|
+
} = require('@putout/babel').types;
|
|
12
|
+
|
|
10
13
|
module.exports.AssignmentExpression = (path, printer, semantics) => {
|
|
11
|
-
const {print
|
|
14
|
+
const {print} = printer;
|
|
12
15
|
const {operator} = path.node;
|
|
13
16
|
|
|
14
|
-
maybe.print.breakline(isPrevCoupleLines(path));
|
|
15
17
|
maybePrintLeftBrace(path, printer, semantics);
|
|
16
18
|
print('__left');
|
|
17
19
|
print.space();
|
|
18
20
|
print(operator);
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
if (isMultiline(path))
|
|
23
|
+
print.breakline();
|
|
24
|
+
else
|
|
25
|
+
print.space();
|
|
26
|
+
|
|
20
27
|
print('__right');
|
|
21
28
|
maybePrintRightBrace(path, printer, semantics);
|
|
22
29
|
};
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
if (isMarkedAfter(prev))
|
|
28
|
-
return false;
|
|
31
|
+
function isMultiline(path) {
|
|
32
|
+
const {right} = path.node;
|
|
29
33
|
|
|
30
|
-
if (!
|
|
34
|
+
if (!path.parentPath.find(isExpressionStatement))
|
|
31
35
|
return false;
|
|
32
36
|
|
|
33
|
-
return
|
|
34
|
-
}
|
|
37
|
+
return isAssignmentExpression(right);
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.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",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"@putout/plugin-react-hook-form": "^4.0.0",
|
|
52
52
|
"@putout/plugin-react-hooks": "^6.0.0",
|
|
53
53
|
"acorn": "^8.8.2",
|
|
54
|
-
"c8": "^
|
|
55
|
-
"goldstein": "^5.14.0",
|
|
54
|
+
"c8": "^10.1.2",
|
|
56
55
|
"check-dts": "^0.8.0",
|
|
57
56
|
"escover": "^4.0.1",
|
|
58
57
|
"eslint": "^9.0.0",
|
|
59
58
|
"eslint-plugin-putout": "^22.0.0",
|
|
60
59
|
"estree-to-babel": "^9.0.0",
|
|
60
|
+
"goldstein": "^5.14.0",
|
|
61
61
|
"just-kebab-case": "^4.2.0",
|
|
62
62
|
"madrun": "^10.0.0",
|
|
63
63
|
"mock-require": "^3.0.3",
|