@putout/printer 4.2.0 → 5.0.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
+ 2023.09.18, v5.0.0
2
+
3
+ feature:
4
+ - 9ad0e3c package: putout v32.0.4
5
+ - b8e15fc package: estree-to-babel v7.0.0
6
+ - ebcf3aa package: @putout/plugin-react-hook-form v4.0.0
7
+ - efbf8e8 package: @putout/plugin-promises v13.0.0
8
+ - 7ebee8a package: @putout/operate v11.0.0
9
+ - a40cb80 package: @putout/compare v13.0.0
10
+ - 84c933d @putout/printer: TSMappedType: nameType
11
+
1
12
  2023.09.13, v4.2.0
2
13
 
3
14
  feature:
@@ -1,33 +1,47 @@
1
1
  'use strict';
2
2
 
3
- module.exports.TSMappedType = (path, {print, write, indent, maybe}) => {
4
- const {readonly, optional} = path.node;
3
+ const {types} = require('@putout/babel');
4
+ const {isTSConditionalType} = types;
5
+
6
+ module.exports.TSMappedType = (path, {print, indent, maybe}) => {
7
+ const {
8
+ readonly,
9
+ optional,
10
+ nameType,
11
+ } = path.node;
5
12
 
6
- write('{');
7
- write.newline();
13
+ print('{');
14
+ print.newline();
8
15
  indent.inc();
9
16
  indent();
10
17
 
11
18
  if (readonly) {
12
- maybe.write(readonly === '-', '-');
13
- write('readonly ');
19
+ maybe.print(readonly === '-', '-');
20
+ print('readonly ');
14
21
  }
15
22
 
16
- write('[');
23
+ print('[');
17
24
  print('__typeParameter');
18
- write(']');
25
+
26
+ if (nameType) {
27
+ print(' as');
28
+ maybe.space(!isTSConditionalType(nameType));
29
+ print('__nameType');
30
+ }
31
+
32
+ print(']');
19
33
 
20
34
  if (optional) {
21
- maybe.write(optional === '+', '+');
22
- maybe.write(optional === '-', '-');
23
- write('?');
35
+ maybe.print(optional === '+', '+');
36
+ maybe.print(optional === '-', '-');
37
+ print('?');
24
38
  }
25
39
 
26
- write(':');
27
- write.space();
40
+ print(':');
41
+ print.space();
28
42
  print('__typeAnnotation');
29
- write(';');
43
+ print(';');
30
44
  indent.dec();
31
- write.breakline();
32
- write('}');
45
+ print.breakline();
46
+ print('}');
33
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "4.2.0",
3
+ "version": "5.0.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",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@putout/babel": "^1.1.1",
30
- "@putout/compare": "^12.0.4",
31
- "@putout/operate": "^10.0.2",
30
+ "@putout/compare": "^13.0.0",
31
+ "@putout/operate": "^11.0.0",
32
32
  "@putout/processor-json": "^7.0.0",
33
33
  "fullstore": "^3.0.0",
34
34
  "just-snake-case": "^3.2.0",
@@ -48,8 +48,8 @@
48
48
  "@babel/plugin-codemod-object-assign-to-object-spread": "^7.10.4",
49
49
  "@putout/plugin-minify": "^4.0.0",
50
50
  "@putout/plugin-printer": "^2.0.0",
51
- "@putout/plugin-promises": "^12.0.0",
52
- "@putout/plugin-react-hook-form": "^3.4.1",
51
+ "@putout/plugin-promises": "^13.0.0",
52
+ "@putout/plugin-react-hook-form": "^4.0.0",
53
53
  "@putout/plugin-react-hooks": "^5.0.0",
54
54
  "acorn": "^8.8.2",
55
55
  "c8": "^8.0.0",
@@ -57,13 +57,13 @@
57
57
  "eslint": "^8.0.1",
58
58
  "eslint-plugin-n": "^16.0.0",
59
59
  "eslint-plugin-putout": "^19.0.2",
60
- "estree-to-babel": "^6.0.0",
60
+ "estree-to-babel": "^7.0.0",
61
61
  "just-kebab-case": "^4.2.0",
62
62
  "madrun": "^9.0.0",
63
63
  "mock-require": "^3.0.3",
64
64
  "montag": "^1.0.0",
65
65
  "nodemon": "^3.0.1",
66
- "putout": "^31.0.3",
66
+ "putout": "^32.0.4",
67
67
  "supertape": "^8.0.0",
68
68
  "try-catch": "^3.0.0"
69
69
  },