@putout/printer 18.12.0 → 18.14.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/array-expression/is.js +18 -0
- package/lib/tokenize/expressions/array-expression/newline.js +5 -1
- package/lib/tokenize/expressions/member-expression/member-expressions.js +1 -2
- package/lib/tokenize/literals/decorator/decorator.js +1 -11
- package/package.json +4 -4
package/ChangeLog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2026.06.05, v18.14.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 84a01426 @putout/printer: MemberExpression: parens: improve support
|
|
5
|
+
|
|
6
|
+
2026.05.22, v18.13.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 26783f0b @putout/printer: ArrayExpression: newline: strings and object
|
|
10
|
+
- e6d930c3 @putout/printer: supertape v13.2.0
|
|
11
|
+
- 15bd1f83 @putout/printer: montag v2.0.1
|
|
12
|
+
- 6a74d29a @putout/printer: @putout/plugin-promises v20.0.0
|
|
13
|
+
|
|
1
14
|
2026.04.15, v18.12.0
|
|
2
15
|
|
|
3
16
|
feature:
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
+
import {types} from '@putout/babel';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
isStringLiteral,
|
|
5
|
+
isObjectExpression,
|
|
6
|
+
} = types;
|
|
7
|
+
|
|
1
8
|
export const isMultilineOption = (a, {multiline}) => multiline;
|
|
2
9
|
export const isNeedsToHideIndentOption = (a, {needsToHideIndent}) => needsToHideIndent;
|
|
3
10
|
export const isLastOption = (a, {isLast}) => isLast;
|
|
4
11
|
|
|
5
12
|
export const isTrailingCommaOption = (a, {trailingComma}) => trailingComma;
|
|
6
13
|
export const isNeedsIndentBeforeElementOption = (a, {needsIndentBeforeElement}) => needsIndentBeforeElement;
|
|
14
|
+
|
|
15
|
+
export const isStringsAndObject = (path) => {
|
|
16
|
+
const elements = path.get('elements');
|
|
17
|
+
|
|
18
|
+
if (!isObjectExpression(elements.at(-1)))
|
|
19
|
+
return false;
|
|
20
|
+
|
|
21
|
+
const strings = elements.filter(isStringLiteral);
|
|
22
|
+
|
|
23
|
+
return strings.length === elements.length - 1;
|
|
24
|
+
};
|
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
isInsideArray,
|
|
14
14
|
} from '#is';
|
|
15
15
|
import {isIncreaseIndent} from './indent.js';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
isMultilineOption,
|
|
18
|
+
isStringsAndObject,
|
|
19
|
+
} from './is.js';
|
|
17
20
|
|
|
18
21
|
const {
|
|
19
22
|
isObjectExpression,
|
|
@@ -253,6 +256,7 @@ const isMixedTuples = (path, {maxElementLengthInOneLine}) => {
|
|
|
253
256
|
|
|
254
257
|
export const isMultiLine = createTypeChecker([
|
|
255
258
|
['-: node.elements.length -> -'],
|
|
259
|
+
['-', isStringsAndObject],
|
|
256
260
|
['-', isTupleInsideArray],
|
|
257
261
|
['+', isMixedTuples],
|
|
258
262
|
['+', isBodyWithOneElement],
|
|
@@ -9,8 +9,7 @@ const isObjectInsideArrow = createTypeChecker([
|
|
|
9
9
|
]);
|
|
10
10
|
|
|
11
11
|
export const MemberExpression = maybeParens({
|
|
12
|
-
|
|
13
|
-
condition: (path) => isObjectInsideArrow(path),
|
|
12
|
+
condition: isObjectInsideArrow,
|
|
14
13
|
print: (path, printer) => {
|
|
15
14
|
const {
|
|
16
15
|
print,
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {isMemberExpression} = types;
|
|
4
|
-
|
|
5
|
-
export const Decorator = (path, {print, maybe}) => {
|
|
6
|
-
const {expression} = path.node;
|
|
7
|
-
const isMember = isMemberExpression(expression);
|
|
8
|
-
|
|
1
|
+
export const Decorator = (path, {print}) => {
|
|
9
2
|
print('@');
|
|
10
|
-
|
|
11
|
-
maybe.print(isMember, '(');
|
|
12
3
|
print('__expression');
|
|
13
|
-
maybe.print(isMember, ')');
|
|
14
4
|
};
|
|
15
5
|
|
|
16
6
|
Decorator.printLeadingCommentLine = (path, printer, semantics, {printComment}) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@putout/eslint-flat": "^4.0.0",
|
|
82
82
|
"@putout/plugin-minify": "^12.0.0",
|
|
83
83
|
"@putout/plugin-printer": "^8.0.0",
|
|
84
|
-
"@putout/plugin-promises": "^
|
|
84
|
+
"@putout/plugin-promises": "^20.0.0",
|
|
85
85
|
"@putout/plugin-react-hook-form": "^6.0.0",
|
|
86
86
|
"@putout/plugin-react-hooks": "^9.0.0",
|
|
87
87
|
"@supertape/operator-strip": "^1.0.0",
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"goldstein": "^7.0.0",
|
|
96
96
|
"just-kebab-case": "^4.2.0",
|
|
97
97
|
"madrun": "^13.0.0",
|
|
98
|
-
"montag": "^
|
|
98
|
+
"montag": "^2.0.1",
|
|
99
99
|
"nodemon": "^3.0.1",
|
|
100
100
|
"putout": "^42.0.1",
|
|
101
101
|
"redlint": "^6.0.0",
|
|
102
102
|
"samadhi": "^4.0.2",
|
|
103
103
|
"superc8": "^12.2.4",
|
|
104
|
-
"supertape": "^
|
|
104
|
+
"supertape": "^13.2.0",
|
|
105
105
|
"try-catch": "^4.0.6",
|
|
106
106
|
"typescript": "^6.0.2"
|
|
107
107
|
},
|