@putout/printer 2.91.0 → 2.93.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/typescript/index.js +3 -3
- package/lib/tokenize/typescript/interface/ts-interface-declaration.js +7 -4
- package/lib/tokenize/typescript/tuple/ts-tuple-type.js +0 -1
- package/lib/tokenize/typescript/{ts-type-alias-declaration.js → type/ts-type-alias-declaration.js} +4 -4
- package/lib/tokenize/typescript/{ts-type-literal.js → type/ts-type-literal.js} +1 -1
- package/lib/tokenize/typescript/{ts-type-parameter.js → type/ts-type-parameter.js} +1 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2023.08.01, v2.93.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- b1d5d54 @putout/printer: TSTypeAliasDeclaration inside ExportDeclaration: newline
|
|
5
|
+
|
|
6
|
+
2023.07.31, v2.92.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 20ecdfa @putout/printer: TSTypeAliasDeclaration: newline
|
|
10
|
+
|
|
1
11
|
2023.07.31, v2.91.0
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {exists, isNext} = require('../is');
|
|
4
|
-
const {TSTypeLiteral} = require('./ts-type-literal');
|
|
5
|
-
const {TSTypeAliasDeclaration} = require('./ts-type-alias-declaration');
|
|
4
|
+
const {TSTypeLiteral} = require('./type/ts-type-literal');
|
|
5
|
+
const {TSTypeAliasDeclaration} = require('./type/ts-type-alias-declaration');
|
|
6
6
|
const {TSMappedType} = require('./ts-mapped-type');
|
|
7
7
|
const {TSConditionalType} = require('./ts-conditional-type');
|
|
8
|
-
const {TSTypeParameter} = require('./ts-type-parameter');
|
|
8
|
+
const {TSTypeParameter} = require('./type/ts-type-parameter');
|
|
9
9
|
const {TSDeclareFunction} = require('./function/ts-declare-function');
|
|
10
10
|
const {TSDeclareMethod} = require('./function/ts-declare-method');
|
|
11
11
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isNext} = require('../../is');
|
|
3
|
+
const {isNext, isNextParent} = require('../../is');
|
|
4
|
+
const {isTSTypeAliasDeclaration} = require('@babel/types');
|
|
4
5
|
|
|
5
6
|
module.exports.TSInterfaceDeclaration = {
|
|
6
7
|
print(path, {print}) {
|
|
@@ -8,9 +9,11 @@ module.exports.TSInterfaceDeclaration = {
|
|
|
8
9
|
print('__id');
|
|
9
10
|
print('__body');
|
|
10
11
|
},
|
|
11
|
-
afterSatisfy: () => [isNext],
|
|
12
|
-
after(path, {print}) {
|
|
13
|
-
|
|
12
|
+
afterSatisfy: () => [isNext, isNextParent],
|
|
13
|
+
after(path, {print, maybe}) {
|
|
14
|
+
const next = path.parentPath.getNextSibling();
|
|
15
|
+
|
|
14
16
|
print.breakline();
|
|
17
|
+
maybe.print.breakline(!isTSTypeAliasDeclaration(next));
|
|
15
18
|
},
|
|
16
19
|
};
|
package/lib/tokenize/typescript/{ts-type-alias-declaration.js → type/ts-type-alias-declaration.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isLast} = require('
|
|
4
|
-
const {markAfter} = require('
|
|
3
|
+
const {isLast} = require('../../is');
|
|
4
|
+
const {markAfter} = require('../../mark');
|
|
5
5
|
const isNextType = (a) => a.getNextSibling().isTSTypeAliasDeclaration();
|
|
6
6
|
|
|
7
7
|
module.exports.TSTypeAliasDeclaration = {
|
|
@@ -20,11 +20,11 @@ module.exports.TSTypeAliasDeclaration = {
|
|
|
20
20
|
print('__typeAnnotation');
|
|
21
21
|
print(';');
|
|
22
22
|
|
|
23
|
-
const is = store(isLast(path));
|
|
23
|
+
const is = store(isLast(path) || isLast(path.parentPath));
|
|
24
24
|
maybe.print.newline(!is);
|
|
25
25
|
},
|
|
26
26
|
afterIf(path, {store}) {
|
|
27
|
-
const last = store()
|
|
27
|
+
const last = store();
|
|
28
28
|
|
|
29
29
|
if (last)
|
|
30
30
|
return false;
|
package/package.json
CHANGED