@putout/printer 1.93.0 → 1.95.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 +10 -0
- package/lib/tokenize/expressions/member-expressions/member-expressions.js +5 -3
- package/lib/tokenize/expressions/object-pattern.js +6 -2
- package/lib/tokenize/typescript/index.js +3 -5
- package/lib/tokenize/typescript/ts-interface-declaration.js +10 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2023.05.11, v1.95.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- f8e7e47 @putout/printer: improve support of OptionalMemberExpression
|
|
5
|
+
|
|
6
|
+
2023.05.11, v1.94.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 2df6b15 @putout/printer: improve support of newline in TSInterfaceDeclaration
|
|
10
|
+
|
|
1
11
|
2023.05.11, v1.93.0
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -40,10 +40,11 @@ module.exports.MemberExpression = (path, {print, maybe, traverse}) => {
|
|
|
40
40
|
maybe.indent.dec(isChain);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
module.exports.OptionalMemberExpression = (path, {print}) => {
|
|
44
|
-
const {computed} = path.node;
|
|
43
|
+
module.exports.OptionalMemberExpression = (path, {print, maybe}) => {
|
|
44
|
+
const {computed, optional} = path.node;
|
|
45
45
|
print('__object');
|
|
46
|
-
print('
|
|
46
|
+
maybe.print(optional, '?');
|
|
47
|
+
print('.');
|
|
47
48
|
|
|
48
49
|
if (computed) {
|
|
49
50
|
print('[');
|
|
@@ -79,3 +80,4 @@ function likeChain(path) {
|
|
|
79
80
|
|
|
80
81
|
return calls.length > 1;
|
|
81
82
|
}
|
|
83
|
+
|
|
@@ -30,7 +30,12 @@ module.exports.ObjectPattern = {
|
|
|
30
30
|
const valuePath = property.get('value');
|
|
31
31
|
const keyPath = property.get('key');
|
|
32
32
|
const isAssign = valuePath.isAssignmentPattern();
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
shorthand,
|
|
36
|
+
computed,
|
|
37
|
+
} = property.node;
|
|
38
|
+
|
|
34
39
|
const couple = isCoupleLines(valuePath) && !exists(property.getPrevSibling());
|
|
35
40
|
|
|
36
41
|
maybe.indent(is);
|
|
@@ -101,4 +106,3 @@ function shouldAddNewline(path) {
|
|
|
101
106
|
|
|
102
107
|
return false;
|
|
103
108
|
}
|
|
104
|
-
|
|
@@ -13,6 +13,8 @@ const {
|
|
|
13
13
|
TSModuleBlock,
|
|
14
14
|
} = require('./ts-module-declaration');
|
|
15
15
|
|
|
16
|
+
const {TSInterfaceDeclaration} = require('./ts-interface-declaration');
|
|
17
|
+
|
|
16
18
|
module.exports = {
|
|
17
19
|
TSTypeLiteral,
|
|
18
20
|
TSTypeAliasDeclaration,
|
|
@@ -84,11 +86,7 @@ module.exports = {
|
|
|
84
86
|
write(`${operator} `);
|
|
85
87
|
print('__typeAnnotation');
|
|
86
88
|
},
|
|
87
|
-
TSInterfaceDeclaration
|
|
88
|
-
print('interface ');
|
|
89
|
-
print('__id');
|
|
90
|
-
print('__body');
|
|
91
|
-
},
|
|
89
|
+
TSInterfaceDeclaration,
|
|
92
90
|
TSInterfaceBody(path, {traverse, write, indent}) {
|
|
93
91
|
write(' {');
|
|
94
92
|
write.newline();
|
package/package.json
CHANGED