@putout/printer 8.0.1 → 8.2.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
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
2024.02.12, v8.2.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 673ec74 @putout/printer: ArrayExpression: isStringAndArray: check array count
|
|
5
|
+
|
|
6
|
+
2024.02.05, v8.1.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 71ffbfe @putout/printer: supertape v10.0.0
|
|
10
|
+
- 67c1bba @putout/printer: ArrayExpression: improve support
|
|
11
|
+
- 9e52931 @putout/printer: @putout/plugin-minify v8.0.0
|
|
12
|
+
|
|
1
13
|
2024.01.19, v8.0.1
|
|
2
14
|
|
|
3
15
|
feature:
|
|
@@ -47,6 +47,15 @@ const isSimpleAndObject = ([a, b]) => isSimple(a) && isObjectExpression(b);
|
|
|
47
47
|
const ONE_LINE = false;
|
|
48
48
|
const MULTI_LINE = true;
|
|
49
49
|
|
|
50
|
+
const isSiblingIsArray = (path) => {
|
|
51
|
+
if (path.getNextSibling().isArrayExpression())
|
|
52
|
+
return true;
|
|
53
|
+
|
|
54
|
+
return path
|
|
55
|
+
.getPrevSibling()
|
|
56
|
+
.isArrayExpression();
|
|
57
|
+
};
|
|
58
|
+
|
|
50
59
|
module.exports.isMultiLine = (path, {elements, maxElementsInOneLine}) => {
|
|
51
60
|
if (elements.length > 3 && !isObjectExpression(elements[0]))
|
|
52
61
|
return MULTI_LINE;
|
|
@@ -105,6 +114,9 @@ module.exports.isMultiLine = (path, {elements, maxElementsInOneLine}) => {
|
|
|
105
114
|
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression(path.parentPath.node.elements[0]))
|
|
106
115
|
return ONE_LINE;
|
|
107
116
|
|
|
117
|
+
if (isSiblingIsArray(path))
|
|
118
|
+
return ONE_LINE;
|
|
119
|
+
|
|
108
120
|
if (tooLong(path) || isCoupleLines(path) || !isNumbers(elements) && !isForOf(path) && isLastArg(path) && !isParentProperty(path))
|
|
109
121
|
return MULTI_LINE;
|
|
110
122
|
|
package/lib/tokenize/is.js
CHANGED
|
@@ -65,7 +65,12 @@ module.exports.isIdentifierAndIdentifier = ([a, b]) => {
|
|
|
65
65
|
};
|
|
66
66
|
module.exports.isStringAndMember = ([a, b]) => isStringLiteral(a) && isMemberExpression(b);
|
|
67
67
|
module.exports.isIdentifierAndString = ([a, b]) => isIdentifier(a) && isStringLiteral(b);
|
|
68
|
-
module.exports.isStringAndArray = (
|
|
68
|
+
module.exports.isStringAndArray = (array) => {
|
|
69
|
+
if (array.length > 2)
|
|
70
|
+
return false;
|
|
71
|
+
|
|
72
|
+
const [a, b] = array;
|
|
73
|
+
|
|
69
74
|
if (!isStringLiteral(a))
|
|
70
75
|
return false;
|
|
71
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.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",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
],
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@babel/plugin-codemod-object-assign-to-object-spread": "^7.10.4",
|
|
49
|
-
"@putout/plugin-minify": "^
|
|
49
|
+
"@putout/plugin-minify": "^8.0.0",
|
|
50
50
|
"@putout/plugin-printer": "^3.0.0",
|
|
51
51
|
"@putout/plugin-promises": "^14.0.0",
|
|
52
52
|
"@putout/plugin-react-hook-form": "^4.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"montag": "^1.0.0",
|
|
66
66
|
"nodemon": "^3.0.1",
|
|
67
67
|
"putout": "^35.0.0",
|
|
68
|
-
"supertape": "^
|
|
68
|
+
"supertape": "^10.0.0",
|
|
69
69
|
"try-catch": "^3.0.0",
|
|
70
70
|
"typescript": "^5.3.3"
|
|
71
71
|
},
|