@putout/printer 15.11.0 → 15.13.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
+ 2025.07.25, v15.13.0
2
+
3
+ feature:
4
+ - 8039e5d @putout/printer: TSModuleDeclaration: kind === global
5
+
6
+ 2025.07.19, v15.12.0
7
+
8
+ feature:
9
+ - bd895ad @putout/printer: ImportAttribute: improve
10
+
1
11
  2025.07.15, v15.11.0
2
12
 
3
13
  feature:
@@ -5,28 +5,19 @@ module.exports.ImportAttribute = (path, {print}) => {
5
5
  print(':');
6
6
  print.space();
7
7
  print('__value');
8
+ print(',');
8
9
  };
9
10
 
10
- module.exports.maybePrintAttributes = (path, {write, traverse}) => {
11
+ module.exports.maybePrintAttributes = (path, printer) => {
11
12
  if (isAssertions(path))
12
- return printAttributes(path, {
13
- write,
14
- traverse,
15
-
16
- keyword: 'assert',
17
- });
13
+ return printAttributes(path, 'assert', printer);
18
14
 
19
- printAttributes(path, {
20
- write,
21
- traverse,
22
-
23
- keyword: 'with',
24
- });
15
+ printAttributes(path, 'with', printer);
25
16
  };
26
17
 
27
18
  const isAssertions = (path) => path.node.extra?.deprecatedAssertSyntax;
28
19
 
29
- function printAttributes(path, {write, traverse, keyword}) {
20
+ function printAttributes(path, keyword, {write, traverse, indent}) {
30
21
  const attributes = path.get('attributes');
31
22
 
32
23
  if (!attributes.length)
@@ -36,12 +27,15 @@ function printAttributes(path, {write, traverse, keyword}) {
36
27
  write.space();
37
28
 
38
29
  write('{');
39
- write.space();
30
+ write.breakline();
31
+ indent.inc();
40
32
 
41
33
  for (const attr of attributes) {
34
+ indent();
42
35
  traverse(attr);
36
+ write.newline();
43
37
  }
44
38
 
45
- write.space();
39
+ indent.dec();
46
40
  write('}');
47
41
  }
@@ -102,10 +102,7 @@ module.exports.ImportDeclaration = {
102
102
  print.space();
103
103
 
104
104
  print('__source');
105
- maybePrintAttributes(path, {
106
- write,
107
- traverse,
108
- });
105
+ maybePrintAttributes(path, printer);
109
106
  print(';');
110
107
 
111
108
  if (isNext(path))
@@ -5,11 +5,12 @@ const {maybeDeclare} = require('../../maybe/maybe-declare');
5
5
 
6
6
  module.exports.TSModuleDeclaration = {
7
7
  print: maybeDeclare((path, {print}) => {
8
+ const {kind} = path.node;
8
9
  const id = path.get('id');
9
10
 
10
11
  if (id.isStringLiteral())
11
12
  print('module ');
12
- else
13
+ else if (kind === 'namespace')
13
14
  print('namespace ');
14
15
 
15
16
  print('__id');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "15.11.0",
3
+ "version": "15.13.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",