@putout/printer 8.0.1 → 8.1.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,10 @@
1
+ 2024.02.05, v8.1.0
2
+
3
+ feature:
4
+ - 71ffbfe @putout/printer: supertape v10.0.0
5
+ - 67c1bba @putout/printer: ArrayExpression: improve support
6
+ - 9e52931 @putout/printer: @putout/plugin-minify v8.0.0
7
+
1
8
  2024.01.19, v8.0.1
2
9
 
3
10
  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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "8.0.1",
3
+ "version": "8.1.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": "^7.1.1",
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": "^9.0.0",
68
+ "supertape": "^10.0.0",
69
69
  "try-catch": "^3.0.0",
70
70
  "typescript": "^5.3.3"
71
71
  },