@putout/bundle 1.8.0 → 1.8.1
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/bundle/putout-iife.js +1 -1
- package/bundle/putout.js +40 -20
- package/package.json +1 -1
package/bundle/putout.js
CHANGED
|
@@ -116459,6 +116459,8 @@ is.satisfy = (conditions) => (path) => {
|
|
|
116459
116459
|
return false;
|
|
116460
116460
|
};
|
|
116461
116461
|
|
|
116462
|
+
is.noTrailingComment = (path) => !path.node.trailingComments;
|
|
116463
|
+
|
|
116462
116464
|
const {exists: exists$4} = is;
|
|
116463
116465
|
|
|
116464
116466
|
arrowFunctionExpression.ArrowFunctionExpression = {
|
|
@@ -116979,6 +116981,8 @@ const {
|
|
|
116979
116981
|
isCoupleLines: isCoupleLines$5,
|
|
116980
116982
|
isForOf: isForOf$3,
|
|
116981
116983
|
isIf,
|
|
116984
|
+
noTrailingComment: noTrailingComment$1,
|
|
116985
|
+
|
|
116982
116986
|
} = is;
|
|
116983
116987
|
|
|
116984
116988
|
const {isFunction} = requireLib$a();
|
|
@@ -117021,7 +117025,7 @@ objectExpression.ObjectExpression = (path, {print, maybe, indent}) => {
|
|
|
117021
117025
|
}
|
|
117022
117026
|
|
|
117023
117027
|
print(property);
|
|
117024
|
-
maybe.print.newline(manyLines);
|
|
117028
|
+
maybe.print.newline(manyLines && noTrailingComment$1(property));
|
|
117025
117029
|
}
|
|
117026
117030
|
|
|
117027
117031
|
indent.dec();
|
|
@@ -118089,28 +118093,41 @@ function isTry({parentPath}) {
|
|
|
118089
118093
|
|
|
118090
118094
|
var returnStatement = {};
|
|
118091
118095
|
|
|
118092
|
-
const {
|
|
118096
|
+
const {
|
|
118097
|
+
isPrevBody,
|
|
118098
|
+
noTrailingComment,
|
|
118099
|
+
} = is;
|
|
118100
|
+
|
|
118093
118101
|
const {hasPrevNewline} = mark;
|
|
118094
118102
|
const isBodyLength = ({parentPath}) => parentPath.node?.body?.length > 2;
|
|
118095
118103
|
|
|
118096
|
-
returnStatement.ReturnStatement =
|
|
118097
|
-
|
|
118104
|
+
returnStatement.ReturnStatement = {
|
|
118105
|
+
beforeIf(path) {
|
|
118106
|
+
return !hasPrevNewline(path) && isBodyLength(path) || isPrevBody(path);
|
|
118107
|
+
},
|
|
118108
|
+
before(path, {print}) {
|
|
118098
118109
|
print.indent();
|
|
118099
118110
|
print.newline();
|
|
118100
|
-
}
|
|
118101
|
-
|
|
118102
|
-
|
|
118103
|
-
|
|
118104
|
-
|
|
118105
|
-
|
|
118106
|
-
|
|
118107
|
-
|
|
118108
|
-
|
|
118109
|
-
|
|
118110
|
-
|
|
118111
|
-
|
|
118112
|
-
|
|
118113
|
-
|
|
118111
|
+
},
|
|
118112
|
+
print(path, {indent, traverse, print}) {
|
|
118113
|
+
indent();
|
|
118114
|
+
print('return');
|
|
118115
|
+
|
|
118116
|
+
const argPath = path.get('argument');
|
|
118117
|
+
|
|
118118
|
+
if (argPath.node) {
|
|
118119
|
+
print(' ');
|
|
118120
|
+
traverse(argPath);
|
|
118121
|
+
}
|
|
118122
|
+
|
|
118123
|
+
print(';');
|
|
118124
|
+
},
|
|
118125
|
+
afterSatisfy: () => [
|
|
118126
|
+
noTrailingComment,
|
|
118127
|
+
],
|
|
118128
|
+
after(path, {print}) {
|
|
118129
|
+
print.newline();
|
|
118130
|
+
},
|
|
118114
118131
|
};
|
|
118115
118132
|
|
|
118116
118133
|
var tryStatements = {};
|
|
@@ -119259,7 +119276,9 @@ maybe.maybeThrow = (a, path, b) => {
|
|
|
119259
119276
|
}));
|
|
119260
119277
|
};
|
|
119261
119278
|
|
|
119262
|
-
const maybeProgram = (ast) => isProgram(ast) ? ast : Program([
|
|
119279
|
+
const maybeProgram = (ast) => isProgram(ast) ? ast : Program([
|
|
119280
|
+
ExpressionStatement$1(ast),
|
|
119281
|
+
]);
|
|
119263
119282
|
|
|
119264
119283
|
maybe.maybeFile = (ast) => isFile(ast) ? ast : File(maybeProgram(ast));
|
|
119265
119284
|
|
|
@@ -119460,10 +119479,11 @@ comments.parseTrailingComments = (path, {write, maybe}) => {
|
|
|
119460
119479
|
for (const {type, value, loc} of trailingComments) {
|
|
119461
119480
|
if (type === 'CommentLine') {
|
|
119462
119481
|
const sameLine = isSameLine(path, loc);
|
|
119482
|
+
|
|
119463
119483
|
maybe.write.space(sameLine);
|
|
119464
119484
|
maybe.indent(!sameLine);
|
|
119465
119485
|
write(`//${value}`);
|
|
119466
|
-
|
|
119486
|
+
write.newline();
|
|
119467
119487
|
}
|
|
119468
119488
|
}
|
|
119469
119489
|
};
|
package/package.json
CHANGED