@putout/printer 2.92.0 → 2.94.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,13 @@
1
+ 2023.08.01, v2.94.0
2
+
3
+ feature:
4
+ - b12d1d8 @putout/printer: TSInterfaceDeclaration: newlines
5
+
6
+ 2023.08.01, v2.93.0
7
+
8
+ feature:
9
+ - b1d5d54 @putout/printer: TSTypeAliasDeclaration inside ExportDeclaration: newline
10
+
1
11
  2023.07.31, v2.92.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,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const {isNext, isNextParent} = require('../../is');
4
- const {isTSTypeAliasDeclaration} = require('@babel/types');
4
+ const {
5
+ isTSTypeAliasDeclaration,
6
+ isExportDeclaration,
7
+ } = require('@babel/types');
5
8
 
6
9
  module.exports.TSInterfaceDeclaration = {
7
10
  print(path, {print}) {
@@ -10,10 +13,12 @@ module.exports.TSInterfaceDeclaration = {
10
13
  print('__body');
11
14
  },
12
15
  afterSatisfy: () => [isNext, isNextParent],
13
- after(path, {print, maybe}) {
16
+ after(path, {print}) {
14
17
  const next = path.parentPath.getNextSibling();
15
18
 
16
19
  print.breakline();
17
- maybe.print.breakline(!isTSTypeAliasDeclaration(next));
20
+
21
+ if (!isTSTypeAliasDeclaration(next) && !isExportDeclaration(next))
22
+ print.breakline();
18
23
  },
19
24
  };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const {isLast} = require('../is');
4
- const {markAfter} = require('../mark');
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() || isLast(path.parentPath);
27
+ const last = store();
28
28
 
29
29
  if (last)
30
30
  return false;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {isNext} = require('../is');
3
+ const {isNext} = require('../../is');
4
4
 
5
5
  module.exports.TSTypeLiteral = (path, {indent, traverse, write, maybe}) => {
6
6
  const members = path.get('members');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {exists} = require('../is');
3
+ const {exists} = require('../../is');
4
4
 
5
5
  module.exports.TSTypeParameter = (path, {write, traverse}) => {
6
6
  const constraint = path.get('constraint');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.92.0",
3
+ "version": "2.94.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",