@putout/printer 8.39.0 → 8.40.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,14 @@
1
+ 2024.05.31, v8.40.0
2
+
3
+ feature:
4
+ - 5ef27d5 @putout/printer: samadhi v2.8.0
5
+ - 9d00b2c @putout/printer: VariableDeclaration: newline before IfStatement
6
+
7
+ 2024.05.27, v8.39.1
8
+
9
+ fix:
10
+ - 3248f64 @putout/printer: VariableDeclaration: loc
11
+
1
12
  2024.05.26, v8.39.0
2
13
 
3
14
  feature:
@@ -94,6 +94,7 @@ module.exports.VariableDeclaration = {
94
94
  store(wasNewline);
95
95
  }),
96
96
  afterSatisfy: () => [
97
+ isNextIf,
97
98
  noNextParentBlock,
98
99
  notLastCoupleLines,
99
100
  isNextAssign,
@@ -156,7 +157,7 @@ function isNextCoupleLines(path) {
156
157
  if (!exists(prev.getPrevSibling()) && next.isVariableDeclaration())
157
158
  return false;
158
159
 
159
- if (path.node.loc?.start.line === prev.node?.loc?.start.line + 2)
160
+ if (path.node.loc?.start.line === prev.node?.loc?.start?.line + 2)
160
161
  return false;
161
162
 
162
163
  return isCoupleLines(next);
@@ -186,6 +187,11 @@ function isFirst(path) {
186
187
  return path.node === path.parentPath.node.body?.[0];
187
188
  }
188
189
 
190
+ const isNextIf = (path) => {
191
+ const nextPath = path.getNextSibling();
192
+ return nextPath.isIfStatement();
193
+ };
194
+
189
195
  const isNextAssign = (path) => {
190
196
  const nextPath = path.getNextSibling();
191
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "8.39.0",
3
+ "version": "8.40.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",
@@ -45,7 +45,6 @@
45
45
  "generate"
46
46
  ],
47
47
  "devDependencies": {
48
- "@babel/plugin-codemod-object-assign-to-object-spread": "^7.10.4",
49
48
  "@putout/plugin-minify": "^8.0.0",
50
49
  "@putout/plugin-printer": "^3.0.0",
51
50
  "@putout/plugin-promises": "^15.0.0",
@@ -64,6 +63,7 @@
64
63
  "montag": "^1.0.0",
65
64
  "nodemon": "^3.0.1",
66
65
  "putout": "^35.0.0",
66
+ "samadhi": "^2.8.0",
67
67
  "supertape": "^10.0.0",
68
68
  "try-catch": "^3.0.0",
69
69
  "typescript": "^5.3.3"