@putout/printer 18.48.0 → 18.49.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,10 @@
1
+ 2026.11.03, v18.49.0
2
+
3
+ feature:
4
+ - 80d1224d @putout/printer: ExportDeclaration: defer (https://github.com/tc39/proposal-deferred-reexports)
5
+ - d8ad8369 @putout/printer: ImportExpression: sync (https://github.com/tc39/proposal-import-sync)
6
+ - cf513b78 @putout/printer: StructDeclaration (https://github.com/tc39/proposal-structs)
7
+
1
8
  2026.10.17, v18.48.0
2
9
 
3
10
  feature:
@@ -25,7 +25,7 @@ const isSpaceBeforeImplements = createTypeChecker([
25
25
  ['+: node.typeParameters.params.length', '<', 2],
26
26
  ]);
27
27
 
28
- const classVisitor = maybeDecorators((path, printer, semantics) => {
28
+ const createVisitor = (name) => (path, printer, semantics) => {
29
29
  const {node} = path;
30
30
  const {
31
31
  id,
@@ -41,7 +41,7 @@ const classVisitor = maybeDecorators((path, printer, semantics) => {
41
41
  } = printer;
42
42
 
43
43
  maybe.print(abstract, 'abstract ');
44
- print('class');
44
+ print(name);
45
45
  maybe.print(id || superClass, ' ');
46
46
  print('__id');
47
47
  print('__typeParameters');
@@ -93,7 +93,9 @@ const classVisitor = maybeDecorators((path, printer, semantics) => {
93
93
  indent();
94
94
 
95
95
  print('}');
96
- });
96
+ };
97
+
98
+ const classVisitor = maybeDecorators(createVisitor('class'));
97
99
 
98
100
  export const ClassExpression = classVisitor;
99
101
 
@@ -106,9 +108,7 @@ export const ClassDeclaration = {
106
108
  before: (path, {indent}) => {
107
109
  indent();
108
110
  },
109
- print: maybeDeclare((path, printer, semantics) => {
110
- classVisitor(path, printer, semantics);
111
- }),
111
+ print: maybeDeclare(classVisitor),
112
112
  afterIf,
113
113
  after(path, {write}) {
114
114
  write.newline();
@@ -119,3 +119,5 @@ export const ClassDeclaration = {
119
119
  }
120
120
  },
121
121
  };
122
+
123
+ export const StructDeclaration = createVisitor('struct');
@@ -3,9 +3,11 @@ import {maybeParens} from '#maybe-parens';
3
3
  export const ImportExpression = maybeParens({
4
4
  print: (path, printer) => {
5
5
  const {print, maybe} = printer;
6
- const {options} = path.node;
6
+ const {sync, options} = path.node;
7
7
 
8
- print('import(');
8
+ print('import');
9
+ maybe.print(sync, '.sync');
10
+ print('(');
9
11
  print('__source');
10
12
 
11
13
  maybe.print(options, ',');
@@ -1,7 +1,11 @@
1
1
  export * from './function/functions.js';
2
2
  export * from './unary-expression/unary-expressions.js';
3
3
  export * from './member-expression/member-expressions.js';
4
- export {ClassExpression, ClassDeclaration} from './class/class.js';
4
+ export {
5
+ ClassExpression,
6
+ ClassDeclaration,
7
+ StructDeclaration,
8
+ } from './class/class.js';
5
9
  export {CallExpression, OptionalCallExpression} from './call-expression/call-expression.js';
6
10
  export {NewExpression} from './new-expression/new-expression.js';
7
11
  export {ObjectExpression} from './object-expression/object-expression.js';
@@ -71,7 +71,7 @@ export const ExportNamedDeclaration = maybeDecorators({
71
71
  } = printer;
72
72
 
73
73
  const {trailingComma} = semantics;
74
- const {exportKind} = path.node;
74
+ const {phase, exportKind} = path.node;
75
75
  const specifiers = path.get('specifiers');
76
76
  const {maxOneLineSpecifiers} = options.exports;
77
77
  const source = path.get('source');
@@ -79,6 +79,9 @@ export const ExportNamedDeclaration = maybeDecorators({
79
79
  indent();
80
80
  print('export');
81
81
 
82
+ if (phase === 'defer')
83
+ print(' defer');
84
+
82
85
  if (exportKind === 'type' && specifiers.length)
83
86
  print(' type');
84
87
 
@@ -183,3 +186,4 @@ export const ExportNamedDeclaration = maybeDecorators({
183
186
  markAfter(path);
184
187
  },
185
188
  });
189
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "18.48.0",
3
+ "version": "18.49.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",