@putout/printer 1.42.0 → 1.44.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.04.13, v1.44.0
2
+
3
+ feature:
4
+ - 89d7922 @putout/printer: add support of ExportSpecifier
5
+
6
+ 2023.04.13, v1.43.0
7
+
8
+ feature:
9
+ - 2114032 @putout/printer: add support of BigIntLiteral
10
+
1
11
  2023.04.13, v1.42.0
2
12
 
3
13
  feature:
@@ -57,6 +57,7 @@ function ArrowFunctionExpression(path, {print, maybe, write, traverse}) {
57
57
  }
58
58
 
59
59
  print(')');
60
+
60
61
  const returnType = path.get('returnType');
61
62
 
62
63
  if (exists(returnType)) {
@@ -140,4 +141,3 @@ module.exports.ClassMethod = (path, {print, maybe}) => {
140
141
  print(') ');
141
142
  print('__body');
142
143
  };
143
-
@@ -4,6 +4,9 @@ const {TemplateLiteral} = require('./template-literal');
4
4
 
5
5
  module.exports = {
6
6
  TemplateLiteral,
7
+ BigIntLiteral(path, {write}) {
8
+ write(path.node.raw);
9
+ },
7
10
  NumericLiteral(path, {write}) {
8
11
  const {
9
12
  raw,
@@ -1,6 +1,37 @@
1
1
  'use strict';
2
2
 
3
- module.exports.ExportNamedDeclaration = (path, {print}) => {
4
- print('export ');
3
+ module.exports.ExportSpecifier = (path, {print}) => {
4
+ const {
5
+ local,
6
+ exported,
7
+ } = path.node;
8
+ print('__local');
9
+
10
+ if (exported.name !== local.name) {
11
+ print(' as ');
12
+ print('__exported');
13
+ }
14
+ };
15
+
16
+ module.exports.ExportNamedDeclaration = (path, {print, traverse, write, indent}) => {
17
+ const specifiers = path.get('specifiers');
18
+ write('export ');
19
+
20
+ if (specifiers.length) {
21
+ write('{');
22
+ indent.inc();
23
+ write.newline();
24
+
25
+ for (const spec of specifiers) {
26
+ indent();
27
+ traverse(spec);
28
+ write(',');
29
+ write.newline();
30
+ }
31
+
32
+ indent.dec();
33
+ write('}');
34
+ }
35
+
5
36
  print('__declaration');
6
37
  };
@@ -16,12 +16,14 @@ const {SwitchStatement} = require('./switch-statement');
16
16
  const {ForInStatement} = require('./for-in-statement');
17
17
  const {ExportDefaultDeclaration} = require('./export-default-declaration');
18
18
  const {BreakStatement} = require('./break-statement');
19
+ const {ExportSpecifier} = exportDeclarations;
19
20
 
20
21
  module.exports = {
21
22
  ...importDeclarations,
22
23
  ...exportDeclarations,
23
24
  BlockStatement,
24
25
  ExpressionStatement,
26
+ ExportSpecifier,
25
27
  ExportDefaultDeclaration,
26
28
  VariableDeclaration,
27
29
  IfStatement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.42.0",
3
+ "version": "1.44.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",