@putout/printer 1.40.0 → 1.40.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
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
isNext,
|
|
5
5
|
isParentProgram,
|
|
6
6
|
isLast,
|
|
7
|
+
exists,
|
|
7
8
|
} = require('../is');
|
|
8
9
|
|
|
9
10
|
const isFirstStatement = (path) => path.get('body.0')?.isStatement();
|
|
@@ -56,9 +57,26 @@ function shouldAddNewlineAfter(path) {
|
|
|
56
57
|
if (isLast(path))
|
|
57
58
|
return false;
|
|
58
59
|
|
|
60
|
+
if (isNextIfAlternate(path))
|
|
61
|
+
return false;
|
|
62
|
+
|
|
59
63
|
return true;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
function isNextIfAlternate(path) {
|
|
67
|
+
const {parentPath} = path;
|
|
68
|
+
|
|
69
|
+
if (!parentPath.isIfStatement())
|
|
70
|
+
return false;
|
|
71
|
+
|
|
72
|
+
const alternate = parentPath.get('alternate');
|
|
73
|
+
|
|
74
|
+
if (path === alternate)
|
|
75
|
+
return false;
|
|
76
|
+
|
|
77
|
+
return exists(alternate);
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
function isTry({parentPath}) {
|
|
63
81
|
if (parentPath.isTryStatement())
|
|
64
82
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.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",
|