@putout/printer 18.42.1 → 18.42.3
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
|
+
2026.09.02, v18.42.3
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- 41c18081 @putout/printer: ConditionalExpression: inside CallExpression: not multiline
|
|
5
|
+
|
|
6
|
+
2026.09.02, v18.42.2
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 455bdcf0 @putout/printer: ConditionalExpression: consequent is ObjectExpression: no multiline
|
|
10
|
+
|
|
1
11
|
2026.08.31, v18.42.1
|
|
2
12
|
|
|
3
13
|
fix:
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import {createTypeChecker} from '#type-checker';
|
|
2
|
+
import {isCoupleLines} from '#is';
|
|
3
|
+
|
|
4
|
+
export const isConditionalExpressionMultiline = createTypeChecker([
|
|
5
|
+
['-: node.alternate -> ObjectExpression'],
|
|
6
|
+
['-: node.consequent -> ObjectExpression'],
|
|
7
|
+
['-: parentPath -> CallExpression'],
|
|
8
|
+
['+', isCoupleLines],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export const printConditionalExpressionMultiline = (path, {print, indent}) => {
|
|
2
12
|
print('__test');
|
|
3
13
|
print.space();
|
|
4
14
|
print('?');
|
|
@@ -11,3 +21,4 @@ export const ConditionalExpressionMultiline = (path, {print, indent}) => {
|
|
|
11
21
|
indent.dec();
|
|
12
22
|
print('__alternate');
|
|
13
23
|
};
|
|
24
|
+
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {types} from '@putout/babel';
|
|
2
1
|
import {maybeParens} from '#maybe-parens';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import {
|
|
3
|
+
isConditionalExpressionMultiline,
|
|
4
|
+
printConditionalExpressionMultiline,
|
|
5
|
+
} from './conditional-expression-multiline.js';
|
|
7
6
|
|
|
8
7
|
export const ConditionalExpression = maybeParens((path, printer) => {
|
|
9
8
|
const {print} = printer;
|
|
10
|
-
const {alternate} = path.node;
|
|
11
9
|
|
|
12
|
-
if (
|
|
13
|
-
|
|
10
|
+
if (isConditionalExpressionMultiline(path)) {
|
|
11
|
+
printConditionalExpressionMultiline(path, printer);
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -24,4 +22,3 @@ export const ConditionalExpression = maybeParens((path, printer) => {
|
|
|
24
22
|
print.space();
|
|
25
23
|
print('__alternate');
|
|
26
24
|
});
|
|
27
|
-
|
package/package.json
CHANGED