@putout/printer 8.6.0 → 8.7.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
+ 2024.02.28, v8.7.0
2
+
3
+ feature:
4
+ - 7cbacc0 @putout/printer: TSImportType: add (babel/babel#16276)
5
+
6
+ 2024.02.19, v8.6.1
7
+
8
+ fix:
9
+ - 2fa4230 @putout/printer: maybePlugin -> maybeVisitor
10
+
1
11
  2024.02.19, v8.6.0
2
12
 
3
13
  feature:
package/lib/printer.js CHANGED
@@ -4,7 +4,7 @@ const {tokenize} = require('./tokenize/tokenize');
4
4
  const {printTokens} = require('./print-tokens');
5
5
  const {maybeJSON} = require('./json');
6
6
 
7
- const {maybePlugin} = require('./tokenize/maybe/index');
7
+ const {maybeVisitor} = require('./tokenize/maybe/index');
8
8
  const visitors = require('./tokenize/visitors');
9
9
 
10
10
  module.exports.print = (ast, overrides = {}) => {
@@ -15,4 +15,4 @@ module.exports.print = (ast, overrides = {}) => {
15
15
  };
16
16
 
17
17
  module.exports.visitors = visitors;
18
- module.exports.maybePlugin = maybePlugin;
18
+ module.exports.maybeVisitor = maybeVisitor;
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const {ArrayExpression} = require('./array-expression');
4
- const {maybePlugin} = require('../../maybe');
4
+ const {maybeVisitor} = require('../../maybe');
5
5
 
6
6
  module.exports.TupleExpression = (path, operations, semantics) => {
7
7
  const {write} = operations;
8
8
  write('#');
9
- maybePlugin(ArrayExpression, path, operations, semantics);
9
+ maybeVisitor(ArrayExpression, path, operations, semantics);
10
10
  };
@@ -32,7 +32,7 @@ const maybeProgram = (ast) => isProgram(ast) ? ast : Program([
32
32
 
33
33
  module.exports.maybeFile = (ast) => isFile(ast) ? ast : File(maybeProgram(ast));
34
34
 
35
- module.exports.maybePlugin = (plugin, path, printer, options) => {
35
+ module.exports.maybeVisitor = (plugin, path, printer, options) => {
36
36
  if (isFn(plugin))
37
37
  return plugin(path, printer, options);
38
38
 
@@ -9,7 +9,7 @@ const baseVisitors = require('./visitors');
9
9
 
10
10
  const {
11
11
  maybeFile,
12
- maybePlugin,
12
+ maybeVisitor,
13
13
  maybeThrow,
14
14
  } = require('./maybe');
15
15
 
@@ -221,7 +221,7 @@ module.exports.tokenize = (ast, overrides) => {
221
221
  const currentIndent = i;
222
222
  parseLeadingComments(path, printer, semantics);
223
223
  // this is main thing
224
- maybePlugin(currentTraverse, path, printer, semantics);
224
+ maybeVisitor(currentTraverse, path, printer, semantics);
225
225
  parseTrailingComments(path, printer, semantics);
226
226
  maybeThrow(i !== currentIndent, path, `☝️Looks like indent level changed after token visitor: '{{ type }}', for code: '{{ path }}'`);
227
227
 
@@ -36,6 +36,7 @@ const {
36
36
  } = require('../expressions/unary-expression/parens');
37
37
 
38
38
  const {maybePrintTypeAnnotation} = require('../maybe/maybe-type-annotation');
39
+ const {TSImportType} = require('./ts-import-type');
39
40
 
40
41
  module.exports = {
41
42
  TSAsExpression,
@@ -48,6 +49,7 @@ module.exports = {
48
49
  TSModuleDeclaration,
49
50
  TSModuleBlock,
50
51
  TSIntersectionType,
52
+ TSImportType,
51
53
  TSBigIntKeyword(path, {write}) {
52
54
  write('bigint');
53
55
  },
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ module.exports.TSImportType = (path, {print, maybe}) => {
4
+ print('import(');
5
+ print('__argument');
6
+ maybe.print(path.node.options, ',');
7
+ print.space();
8
+ print('__options');
9
+ print(')');
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "8.6.0",
3
+ "version": "8.7.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",