@putout/printer 16.2.0 → 16.4.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/expressions/member-expression/is-looks-like-chain.js +12 -0
- package/lib/tokenize/expressions/object-expression/object-property.js +1 -4
- package/lib/tokenize/typescript/index.js +1 -1
- package/lib/tokenize/typescript/{ts-import-type.js → ts-import-type/ts-import-type.js} +1 -1
- package/lib/tokenize/typescript/type/ts-type-literal.js +8 -3
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2025.12.11, v16.4.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 34371e9 @putout/printer: MemberExpression: chain: improve support
|
|
5
|
+
|
|
6
|
+
2025.12.09, v16.3.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 5c8c2ff @putout/printer: TSTypeLiteral: indent
|
|
10
|
+
- 6419576 @putout/printer: TSImportType: trailing comma
|
|
11
|
+
|
|
1
12
|
2025.12.09, v16.2.0
|
|
2
13
|
|
|
3
14
|
feature:
|
|
@@ -24,9 +24,21 @@ const isInsideMemberCall = (path) => {
|
|
|
24
24
|
if (!isIdentifier(path.node.property))
|
|
25
25
|
return false;
|
|
26
26
|
|
|
27
|
+
if (isLastArgInCall(path))
|
|
28
|
+
return true;
|
|
29
|
+
|
|
27
30
|
return isCallExpression(path.parentPath.parentPath);
|
|
28
31
|
};
|
|
29
32
|
|
|
33
|
+
function isLastArgInCall(path) {
|
|
34
|
+
const {parentPath} = path;
|
|
35
|
+
|
|
36
|
+
if (!isCallExpression(parentPath))
|
|
37
|
+
return false;
|
|
38
|
+
|
|
39
|
+
return path === parentPath.get('arguments').at(-1);
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
module.exports.isLooksLikeChain = (path) => {
|
|
31
43
|
const [root, properties] = chain(path);
|
|
32
44
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {types} = require('@putout/babel');
|
|
4
3
|
const {isConcatenation} = require('../binary-expression/concatenate');
|
|
5
4
|
const {isOneLine} = require('./object-expression');
|
|
6
5
|
const {printKey} = require('./print-key');
|
|
7
|
-
const {isTSImportType} = types;
|
|
8
|
-
const isInsideTSImportType = ({parentPath}) => isTSImportType(parentPath.parentPath);
|
|
9
6
|
|
|
10
7
|
module.exports.ObjectProperty = (path, printer, semantics) => {
|
|
11
8
|
const {trailingComma} = semantics;
|
|
@@ -29,7 +26,7 @@ module.exports.ObjectProperty = (path, printer, semantics) => {
|
|
|
29
26
|
traverse(value);
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
if (manyLines
|
|
29
|
+
if (manyLines)
|
|
33
30
|
maybe.write(!isLast || trailingComma, ',');
|
|
34
31
|
else if (!isLast && properties.length)
|
|
35
32
|
write(', ');
|
|
@@ -32,7 +32,7 @@ const {TSMethodSignature} = require('./function/ts-method-signature');
|
|
|
32
32
|
const {TSUnionType} = require('./ts-union-type/ts-union-type');
|
|
33
33
|
|
|
34
34
|
const {maybePrintTypeAnnotation} = require('../maybe/maybe-type-annotation');
|
|
35
|
-
const {TSImportType} = require('./ts-import-type');
|
|
35
|
+
const {TSImportType} = require('./ts-import-type/ts-import-type');
|
|
36
36
|
const {TSExportAssignment} = require('./ts-export-assignment/ts-export-assignment');
|
|
37
37
|
const {TSTypeReference} = require('./ts-type-reference/ts-type-reference');
|
|
38
38
|
const {TSInferType} = require('./ts-infer-type/ts-infer-type');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {createImportExpression} = require('
|
|
3
|
+
const {createImportExpression} = require('../../expressions/import-expression');
|
|
4
4
|
|
|
5
5
|
module.exports.TSImportType = (path, printer) => {
|
|
6
6
|
createImportExpression(path, printer);
|
|
@@ -25,10 +25,15 @@ module.exports.TSTypeLiteral = (path, {indent, traverse, write}) => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
function isNewline(path) {
|
|
28
|
-
const
|
|
28
|
+
const {parentPath} = path;
|
|
29
|
+
|
|
30
|
+
const {length} = path.get('members');
|
|
29
31
|
|
|
30
|
-
if (
|
|
32
|
+
if (!length)
|
|
31
33
|
return false;
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
if (length > 1)
|
|
36
|
+
return true;
|
|
37
|
+
|
|
38
|
+
return !parentPath.isTSTypeParameterInstantiation();
|
|
34
39
|
}
|
package/package.json
CHANGED