@putout/printer 15.10.0 → 15.12.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,14 @@
1
+ 2025.07.19, v15.12.0
2
+
3
+ feature:
4
+ - bd895ad @putout/printer: ImportAttribute: improve
5
+
6
+ 2025.07.15, v15.11.0
7
+
8
+ feature:
9
+ - 26c8d24 @putout/printer: WhileStatement/DoWhileStatement: minify
10
+ - 64809ba @putout/printer: eslint-plugin-putout v28.0.0
11
+
1
12
  2025.07.04, v15.10.0
2
13
 
3
14
  feature:
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {isLast} = require('../is');
3
+ const {isLast} = require('#is');
4
4
  const notLast = (path) => !isLast(path);
5
5
 
6
6
  module.exports.DoWhileStatement = {
@@ -10,7 +10,8 @@ module.exports.DoWhileStatement = {
10
10
  print.space();
11
11
  print('__body');
12
12
  print.space();
13
- print('while ');
13
+ print('while');
14
+ print.space();
14
15
  print('(');
15
16
  print('__test');
16
17
  print(')');
@@ -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,16 @@ 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
  }
42
+
@@ -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))
@@ -13,12 +13,12 @@ const importDeclarations = require('./import-declaration/import-declaration');
13
13
  const exportDeclarations = require('./export-declaration/export-declaration');
14
14
  const {ExportAllDeclaration} = require('./export-declaration/export-all-declaration');
15
15
 
16
- const {WhileStatement} = require('./while-statement');
16
+ const {WhileStatement} = require('./while-statement/while-statement');
17
17
  const {SwitchStatement} = require('./switch-statement');
18
18
  const {ForInStatement} = require('./for-in-statement');
19
19
  const {ExportDefaultDeclaration} = require('./export-declaration/export-default-declaration');
20
20
  const {BreakStatement} = require('./break-statement/break-statement');
21
- const {DoWhileStatement} = require('./do-while-statement');
21
+ const {DoWhileStatement} = require('./do-while-statement/do-while-statement');
22
22
  const {Program} = require('./program/program');
23
23
  const {ContinueStatement} = require('./continue-statement/continue-statement');
24
24
  const {LabeledStatement} = require('./labeled-statement/labeled-statement');
@@ -1,17 +1,19 @@
1
1
  'use strict';
2
2
 
3
- const {isNext} = require('../is');
4
- const {markAfter} = require('../mark');
3
+ const {isNext} = require('#is');
4
+ const {markAfter} = require('../../mark');
5
5
 
6
6
  module.exports.WhileStatement = {
7
7
  print(path, {print, indent}) {
8
8
  indent();
9
- print('while (');
9
+ print('while');
10
+ print.space();
11
+ print('(');
10
12
  print('__test');
11
13
  print(')');
12
14
 
13
15
  if (path.node.body.body) {
14
- print(' ');
16
+ print.space();
15
17
  print('__body');
16
18
  } else {
17
19
  indent.inc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "15.10.0",
3
+ "version": "15.12.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",
@@ -80,7 +80,7 @@
80
80
  "check-dts": "^0.9.0",
81
81
  "escover": "^4.0.1",
82
82
  "eslint": "^9.0.0",
83
- "eslint-plugin-putout": "^27.0.0",
83
+ "eslint-plugin-putout": "^28.0.0",
84
84
  "estree-to-babel": "^11.0.2",
85
85
  "goldstein": "^6.0.1",
86
86
  "just-kebab-case": "^4.2.0",