@putout/printer 1.120.0 → 1.121.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
|
@@ -91,6 +91,7 @@ module.exports.ObjectProperty = (path, {print, maybe}) => {
|
|
|
91
91
|
shorthand,
|
|
92
92
|
computed,
|
|
93
93
|
} = path.node;
|
|
94
|
+
|
|
94
95
|
const properties = path.parentPath.get('properties');
|
|
95
96
|
const isLast = path === properties.at(-1);
|
|
96
97
|
const manyLines = !isOneLine(path.parentPath);
|
|
@@ -141,4 +142,3 @@ function isParens(path) {
|
|
|
141
142
|
|
|
142
143
|
return false;
|
|
143
144
|
}
|
|
144
|
-
|
|
@@ -23,7 +23,9 @@ module.exports.VariableDeclaration = {
|
|
|
23
23
|
print(path, {maybe, store, write, traverse}) {
|
|
24
24
|
maybe.indent(isInsideBlock(path));
|
|
25
25
|
write(String(path.node.kind));
|
|
26
|
-
maybeSpaceAfterKeyword(path, {
|
|
26
|
+
maybeSpaceAfterKeyword(path, {
|
|
27
|
+
write,
|
|
28
|
+
});
|
|
27
29
|
|
|
28
30
|
const declarations = path.get('declarations');
|
|
29
31
|
const n = declarations.length - 1;
|
|
@@ -150,4 +152,3 @@ const isNextAssign = (path) => {
|
|
|
150
152
|
.get('expression')
|
|
151
153
|
.isAssignmentExpression();
|
|
152
154
|
};
|
|
153
|
-
|
package/lib/tokenize/tokenize.js
CHANGED
|
@@ -177,12 +177,15 @@ module.exports.tokenize = (ast, overrides = {}) => {
|
|
|
177
177
|
...overrides.visitors,
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
if (ast.parentPath)
|
|
181
|
+
pathTraverse(ast, traverse);
|
|
182
|
+
else
|
|
183
|
+
babelTraverse(maybeFile(ast), {
|
|
184
|
+
Program(path) {
|
|
185
|
+
traverse(path);
|
|
186
|
+
path.stop();
|
|
187
|
+
},
|
|
188
|
+
});
|
|
186
189
|
|
|
187
190
|
function traverse(path) {
|
|
188
191
|
const {type} = path;
|
|
@@ -266,3 +269,14 @@ const computePath = (path, maybeLine) => {
|
|
|
266
269
|
|
|
267
270
|
return maybeLine;
|
|
268
271
|
};
|
|
272
|
+
|
|
273
|
+
function pathTraverse(ast, traverse) {
|
|
274
|
+
ast.parentPath.traverse({
|
|
275
|
+
enter(path) {
|
|
276
|
+
if (path === ast) {
|
|
277
|
+
traverse(path);
|
|
278
|
+
path.stop();
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
}
|
package/package.json
CHANGED