@putout/printer 1.53.0 → 1.54.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,10 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const {isObjectPattern} = require('@babel/types');
|
|
4
|
+
|
|
5
|
+
module.exports.AssignmentExpression = {
|
|
6
|
+
condition: (path) => isObjectPattern(path.node.left),
|
|
7
|
+
before(path, {write}) {
|
|
8
|
+
write('(');
|
|
9
|
+
},
|
|
10
|
+
print(path, {print}) {
|
|
11
|
+
const {operator} = path.node;
|
|
12
|
+
print('__left');
|
|
13
|
+
print(' ');
|
|
14
|
+
print(operator);
|
|
15
|
+
print(' ');
|
|
16
|
+
print('__right');
|
|
17
|
+
},
|
|
18
|
+
after(path, {write}) {
|
|
19
|
+
write(')');
|
|
20
|
+
},
|
|
10
21
|
};
|
|
22
|
+
|
|
@@ -57,7 +57,10 @@ module.exports.VariableDeclaration = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
function noNextParentBlock(path) {
|
|
60
|
-
|
|
60
|
+
if (isNext(path))
|
|
61
|
+
return false;
|
|
62
|
+
|
|
63
|
+
return path.parentPath.isBlockStatement();
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
function notLastParentExport(path) {
|
|
@@ -68,7 +71,10 @@ function notLastParentExport(path) {
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
function notLastCoupleLines(path) {
|
|
71
|
-
|
|
74
|
+
if (isLast(path))
|
|
75
|
+
return false;
|
|
76
|
+
|
|
77
|
+
return isCoupleLines(path);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
function notLastPrevVarNotNextVar(path) {
|
|
@@ -83,7 +89,6 @@ function isNextCoupleLines(path) {
|
|
|
83
89
|
|
|
84
90
|
return isCoupleLines(next);
|
|
85
91
|
}
|
|
86
|
-
|
|
87
92
|
const isLast = (path) => path.parentPath?.isProgram() && !isNext(path);
|
|
88
93
|
|
|
89
94
|
function shouldAddNewlineBefore(path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.54.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",
|