@putout/printer 2.49.0 → 2.51.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 +13 -0
- package/lib/tokenize/expressions/class/static-block.js +0 -1
- package/lib/tokenize/expressions/index.js +4 -2
- package/lib/tokenize/expressions/object-expression/record-expression.js +9 -0
- package/lib/tokenize/statements/if-statement/if-statement.js +10 -1
- package/package.json +4 -4
package/ChangeLog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2023.07.05, v2.51.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- f24b8f3 @putout/printer: add support of RecordExpression
|
|
5
|
+
|
|
6
|
+
2023.07.05, v2.50.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- f77a990 @putout/printer: BlockStatement: newlines
|
|
10
|
+
- 483494a package: c8 v8.0.0
|
|
11
|
+
- dabddf7 package: @putout/plugin-promises v11.0.0
|
|
12
|
+
- bf8f478 package: putout v30.0.0
|
|
13
|
+
|
|
1
14
|
2023.07.05, v2.49.0
|
|
2
15
|
|
|
3
16
|
feature:
|
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
|
|
43
43
|
const {ConditionalExpression} = require('./conditional-expression');
|
|
44
44
|
const {StaticBlock} = require('./class/static-block');
|
|
45
|
+
const {RecordExpression} = require('./object-expression/record-expression');
|
|
45
46
|
|
|
46
47
|
module.exports = {
|
|
47
48
|
...functions,
|
|
@@ -70,7 +71,8 @@ module.exports = {
|
|
|
70
71
|
SequenceExpression,
|
|
71
72
|
StaticBlock,
|
|
72
73
|
TaggedTemplateExpression,
|
|
73
|
-
ThisExpression(path, {
|
|
74
|
-
|
|
74
|
+
ThisExpression(path, {write}) {
|
|
75
|
+
write('this');
|
|
75
76
|
},
|
|
77
|
+
RecordExpression,
|
|
76
78
|
};
|
|
@@ -4,6 +4,12 @@ const {markAfter} = require('../../mark');
|
|
|
4
4
|
const {exists} = require('../../is');
|
|
5
5
|
|
|
6
6
|
const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement();
|
|
7
|
+
const isInsideNestedBody = ({parentPath}) => {
|
|
8
|
+
if (parentPath.type !== 'BlockStatement')
|
|
9
|
+
return false;
|
|
10
|
+
|
|
11
|
+
return parentPath.parentPath.type === 'BlockStatement';
|
|
12
|
+
};
|
|
7
13
|
|
|
8
14
|
const isInsideIf = (path) => path.parentPath.parentPath?.isIfStatement();
|
|
9
15
|
const isEmptyBody = (path) => !path.node.body.length;
|
|
@@ -24,7 +30,10 @@ module.exports.IfStatement = {
|
|
|
24
30
|
if (isConsequentBlock) {
|
|
25
31
|
print.space();
|
|
26
32
|
print(consequent);
|
|
27
|
-
|
|
33
|
+
|
|
34
|
+
if (isInsideIf(path) || isInsideNestedBody(path)) {
|
|
35
|
+
maybe.print.newline(isEmptyBody(consequent));
|
|
36
|
+
}
|
|
28
37
|
} else {
|
|
29
38
|
const is = !isEmptyConsequent(path);
|
|
30
39
|
maybe.print.newline(is);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.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",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@babel/plugin-codemod-object-assign-to-object-spread": "^7.10.4",
|
|
51
51
|
"@putout/plugin-minify": "^1.8.0",
|
|
52
52
|
"@putout/plugin-printer": "^1.0.0",
|
|
53
|
-
"@putout/plugin-promises": "^
|
|
53
|
+
"@putout/plugin-promises": "^11.0.0",
|
|
54
54
|
"@putout/plugin-react-hook-form": "^3.4.1",
|
|
55
55
|
"@putout/plugin-react-hooks": "^5.0.0",
|
|
56
56
|
"@putout/test": "^6.0.1",
|
|
57
57
|
"acorn": "^8.8.2",
|
|
58
|
-
"c8": "^
|
|
58
|
+
"c8": "^8.0.0",
|
|
59
59
|
"escover": "^3.0.0",
|
|
60
60
|
"eslint": "^8.0.1",
|
|
61
61
|
"eslint-plugin-n": "^16.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"mock-require": "^3.0.3",
|
|
67
67
|
"montag": "^1.0.0",
|
|
68
68
|
"nodemon": "^2.0.1",
|
|
69
|
-
"putout": "
|
|
69
|
+
"putout": "^30.0.0",
|
|
70
70
|
"supertape": "^8.0.0",
|
|
71
71
|
"try-catch": "^3.0.0"
|
|
72
72
|
},
|