@putout/printer 8.7.1 → 8.8.1

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.03.06, v8.8.1
2
+
3
+ fix:
4
+ - cce2240 @putout/printer: TSImportType
5
+
6
+ 2024.03.04, v8.8.0
7
+
8
+ feature:
9
+ - fda0513 @putout/printer: import-expression: TSImportType: createImportExpression
10
+
1
11
  2024.02.29, v8.7.1
2
12
 
3
13
  fix:
package/README.md CHANGED
@@ -23,7 +23,7 @@ Supports:
23
23
 
24
24
  - ✅ **ES2023**;
25
25
  - ✅ **JSX**;
26
- - ✅ **TypeScript**;
26
+ - ✅ [**TypeScript**](https://www.typescriptlang.org/);
27
27
  - ✅ [**JSON**](https://github.com/coderaiser/putout/tree/master/packages/processor-json#readme);
28
28
 
29
29
  ## Install
@@ -183,10 +183,7 @@ When you want to improve support of existing visitor or extend **Printer** with
183
183
  When you need to override behavior of existing visitor use:
184
184
 
185
185
  ```js
186
- import {
187
- print,
188
- visitors as v,
189
- } from '@putout/printer';
186
+ import {print, visitors as v} from '@putout/printer';
190
187
 
191
188
  print(ast, {
192
189
  visitors: {
@@ -1,14 +1,18 @@
1
1
  'use strict';
2
2
 
3
- module.exports.ImportExpression = (path, {print, maybe}) => {
3
+ module.exports.ImportExpression = createImportExpression;
4
+ module.exports.createImportExpression = createImportExpression;
5
+
6
+ function createImportExpression(path, printer, semantics, {source = 'source'} = {}) {
7
+ const {print, maybe} = printer;
4
8
  const {options} = path.node;
5
9
 
6
10
  print('import(');
7
- print('__source');
11
+ print(`__${source}`);
8
12
 
9
13
  maybe.print(options, ',');
10
14
  maybe.print.space(options);
11
15
 
12
16
  print('__options');
13
17
  print(')');
14
- };
18
+ }
@@ -1,14 +1,9 @@
1
1
  'use strict';
2
2
 
3
- module.exports.TSImportType = (path, {print, maybe}) => {
4
- const {options} = path.node;
5
-
6
- print('import(');
7
- print('__argument');
8
-
9
- maybe.print(options, ',');
10
- maybe.print.space(options);
11
-
12
- print('__options');
13
- print(')');
3
+ const {createImportExpression} = require('../expressions/import-expression');
4
+
5
+ module.exports.TSImportType = (path, printer, semantics) => {
6
+ createImportExpression(path, printer, semantics, {
7
+ source: 'argument',
8
+ });
14
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "8.7.1",
3
+ "version": "8.8.1",
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",