@putout/printer 1.7.0 → 1.7.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,8 @@
1
+ 2023.03.23, v1.7.1
2
+
3
+ feature:
4
+ - f1db3bd @putout/printer: print: path.get(__a) => __a
5
+
1
6
  2023.03.23, v1.7.0
2
7
 
3
8
  feature:
@@ -23,7 +23,7 @@ function CallExpression(path, {indent, print, maybe}) {
23
23
  if (isNewLineBefore(path) && !isMarkedParentBefore(path) && !hasPrevNewline(path.parentPath))
24
24
  print.breakline();
25
25
 
26
- print(path.get('callee'));
26
+ print('__callee');
27
27
  print('(');
28
28
 
29
29
  const args = path.get('arguments');
@@ -11,7 +11,7 @@ module.exports.ClassDeclaration = (path, {maybe, print, indent}) => {
11
11
 
12
12
  indent();
13
13
  print('class ');
14
- print(path.get('id'));
14
+ print('__id');
15
15
  print(' {\n');
16
16
  indent.inc();
17
17
 
@@ -53,7 +53,7 @@ function ArrowFunctionExpression(path, {print, maybe}) {
53
53
  }
54
54
 
55
55
  module.exports.ObjectMethod = (path, {print}) => {
56
- print(path.get('key'));
56
+ print('__key');
57
57
  print('(');
58
58
 
59
59
  const params = path.get('params');
@@ -67,7 +67,7 @@ module.exports.ObjectMethod = (path, {print}) => {
67
67
  }
68
68
 
69
69
  print(') ');
70
- print(path.get('body'));
70
+ print('__body');
71
71
  };
72
72
 
73
73
  module.exports.FunctionDeclaration = (path, {print, maybe}) => {
@@ -78,7 +78,7 @@ module.exports.FunctionDeclaration = (path, {print, maybe}) => {
78
78
 
79
79
  maybe.print(async, 'async ');
80
80
  print('function ');
81
- print(path.get('id'));
81
+ print('__id');
82
82
  print('(');
83
83
 
84
84
  const params = path.get('params');
@@ -92,11 +92,11 @@ module.exports.FunctionDeclaration = (path, {print, maybe}) => {
92
92
  }
93
93
 
94
94
  print(') ');
95
- print(path.get('body'));
95
+ print('__body');
96
96
  };
97
97
 
98
98
  module.exports.ClassMethod = (path, {print}) => {
99
- print(path.get('key'));
99
+ print('__key');
100
100
  print('(');
101
101
 
102
102
  const params = path.get('params');
@@ -110,5 +110,5 @@ module.exports.ClassMethod = (path, {print}) => {
110
110
  }
111
111
 
112
112
  print(') ');
113
- print(path.get('body'));
113
+ print('__body');
114
114
  };
@@ -11,7 +11,7 @@ module.exports.IfStatement = (path, {indent, print}) => {
11
11
 
12
12
  indent();
13
13
  print('if (');
14
- print(path.get('test'));
14
+ print('__test');
15
15
  print(')');
16
16
 
17
17
  const consequent = path.get('consequent');
@@ -5,8 +5,8 @@ module.exports.TryStatement = (path, {print, maybe}) => {
5
5
  const finalizer = path.get('finalizer');
6
6
 
7
7
  print('try ');
8
- print(path.get('block'));
9
- print(path.get('handler'));
8
+ print('__block');
9
+ print('__handler');
10
10
 
11
11
  if (finalizer.node) {
12
12
  print(' ');
@@ -27,7 +27,7 @@ module.exports.VariableDeclaration = (path, {maybe, print}) => {
27
27
 
28
28
  maybe.indent(isParentBlock);
29
29
  print(`${path.node.kind} `);
30
- print(path.get('declarations.0.id'));
30
+ print('__declarations.0.id');
31
31
 
32
32
  const initPath = path.get('declarations.0.init');
33
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
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",
@@ -41,6 +41,7 @@
41
41
  "generate"
42
42
  ],
43
43
  "devDependencies": {
44
+ "@putout/test": "^6.0.1",
44
45
  "c8": "^7.5.0",
45
46
  "eslint": "^8.0.1",
46
47
  "eslint-plugin-n": "^15.2.4",
@@ -0,0 +1,2 @@
1
+ print('__block');
2
+ print('__handler');
@@ -0,0 +1,2 @@
1
+ print(path.get('block'));
2
+ print(path.get('handler'));
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ module.exports.report = () => `Use print('__path') instead of path.get(__path)`;
4
+
5
+ module.exports.replace = () => ({
6
+ 'print(path.get(__a))': ({__a}) => {
7
+ __a.value = '__' + __a.value;
8
+ return 'print(__a)';
9
+ },
10
+ });
11
+