@putout/bundle 1.8.0 → 1.8.2
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 +155 -101
- package/package.json +1 -1
package/bundle/putout.js
CHANGED
|
@@ -230,8 +230,8 @@ generated$3.isExportDefaultSpecifier = isExportDefaultSpecifier$1;
|
|
|
230
230
|
generated$3.isExportNamedDeclaration = isExportNamedDeclaration$1;
|
|
231
231
|
generated$3.isExportNamespaceSpecifier = isExportNamespaceSpecifier$1;
|
|
232
232
|
generated$3.isExportSpecifier = isExportSpecifier;
|
|
233
|
-
generated$3.isExpression = isExpression$
|
|
234
|
-
generated$3.isExpressionStatement = isExpressionStatement$
|
|
233
|
+
generated$3.isExpression = isExpression$3;
|
|
234
|
+
generated$3.isExpressionStatement = isExpressionStatement$4;
|
|
235
235
|
generated$3.isExpressionWrapper = isExpressionWrapper;
|
|
236
236
|
generated$3.isFile = isFile$1;
|
|
237
237
|
generated$3.isFlow = isFlow$1;
|
|
@@ -308,7 +308,7 @@ generated$3.isNumberTypeAnnotation = isNumberTypeAnnotation$1;
|
|
|
308
308
|
generated$3.isNumericLiteral = isNumericLiteral;
|
|
309
309
|
generated$3.isObjectExpression = isObjectExpression$2;
|
|
310
310
|
generated$3.isObjectMember = isObjectMember;
|
|
311
|
-
generated$3.isObjectMethod = isObjectMethod$
|
|
311
|
+
generated$3.isObjectMethod = isObjectMethod$2;
|
|
312
312
|
generated$3.isObjectPattern = isObjectPattern$2;
|
|
313
313
|
generated$3.isObjectProperty = isObjectProperty$2;
|
|
314
314
|
generated$3.isObjectTypeAnnotation = isObjectTypeAnnotation;
|
|
@@ -345,7 +345,7 @@ generated$3.isSequenceExpression = isSequenceExpression$1;
|
|
|
345
345
|
generated$3.isSpreadElement = isSpreadElement;
|
|
346
346
|
generated$3.isSpreadProperty = isSpreadProperty$1;
|
|
347
347
|
generated$3.isStandardized = isStandardized;
|
|
348
|
-
generated$3.isStatement = isStatement$
|
|
348
|
+
generated$3.isStatement = isStatement$8;
|
|
349
349
|
generated$3.isStaticBlock = isStaticBlock;
|
|
350
350
|
generated$3.isStringLiteral = isStringLiteral$6;
|
|
351
351
|
generated$3.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation;
|
|
@@ -638,7 +638,7 @@ function isEmptyStatement(node, opts) {
|
|
|
638
638
|
}
|
|
639
639
|
return false;
|
|
640
640
|
}
|
|
641
|
-
function isExpressionStatement$
|
|
641
|
+
function isExpressionStatement$4(node, opts) {
|
|
642
642
|
if (!node) return false;
|
|
643
643
|
const nodeType = node.type;
|
|
644
644
|
if (nodeType === "ExpressionStatement") {
|
|
@@ -866,7 +866,7 @@ function isObjectExpression$2(node, opts) {
|
|
|
866
866
|
}
|
|
867
867
|
return false;
|
|
868
868
|
}
|
|
869
|
-
function isObjectMethod$
|
|
869
|
+
function isObjectMethod$2(node, opts) {
|
|
870
870
|
if (!node) return false;
|
|
871
871
|
const nodeType = node.type;
|
|
872
872
|
if (nodeType === "ObjectMethod") {
|
|
@@ -3458,7 +3458,7 @@ function isStandardized(node, opts) {
|
|
|
3458
3458
|
}
|
|
3459
3459
|
return false;
|
|
3460
3460
|
}
|
|
3461
|
-
function isExpression$
|
|
3461
|
+
function isExpression$3(node, opts) {
|
|
3462
3462
|
if (!node) return false;
|
|
3463
3463
|
const nodeType = node.type;
|
|
3464
3464
|
if ("ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "ModuleExpression" === nodeType || "TopicReference" === nodeType || "PipelineTopicExpression" === nodeType || "PipelineBareFunction" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "TSInstantiationExpression" === nodeType || "TSAsExpression" === nodeType || "TSSatisfiesExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) {
|
|
@@ -3518,7 +3518,7 @@ function isBlock(node, opts) {
|
|
|
3518
3518
|
}
|
|
3519
3519
|
return false;
|
|
3520
3520
|
}
|
|
3521
|
-
function isStatement$
|
|
3521
|
+
function isStatement$8(node, opts) {
|
|
3522
3522
|
if (!node) return false;
|
|
3523
3523
|
const nodeType = node.type;
|
|
3524
3524
|
if ("BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) {
|
|
@@ -23374,7 +23374,7 @@ parentheses.BinaryExpression = BinaryExpression$2;
|
|
|
23374
23374
|
parentheses.ClassExpression = ClassExpression$1;
|
|
23375
23375
|
parentheses.ConditionalExpression = ConditionalExpression$2;
|
|
23376
23376
|
parentheses.DoExpression = DoExpression$1;
|
|
23377
|
-
parentheses.FunctionExpression = FunctionExpression$
|
|
23377
|
+
parentheses.FunctionExpression = FunctionExpression$2;
|
|
23378
23378
|
parentheses.FunctionTypeAnnotation = FunctionTypeAnnotation;
|
|
23379
23379
|
parentheses.Identifier = Identifier$3;
|
|
23380
23380
|
parentheses.LogicalExpression = LogicalExpression$1;
|
|
@@ -23407,7 +23407,7 @@ const {
|
|
|
23407
23407
|
isConditionalExpression,
|
|
23408
23408
|
isExportDeclaration: isExportDeclaration$3,
|
|
23409
23409
|
isExportDefaultDeclaration: isExportDefaultDeclaration$1,
|
|
23410
|
-
isExpressionStatement: isExpressionStatement$
|
|
23410
|
+
isExpressionStatement: isExpressionStatement$3,
|
|
23411
23411
|
isFor: isFor$1,
|
|
23412
23412
|
isForInStatement,
|
|
23413
23413
|
isForOfStatement: isForOfStatement$2,
|
|
@@ -23542,7 +23542,7 @@ function BinaryExpression$2(node, parent) {
|
|
|
23542
23542
|
return node.operator === "in" && (isVariableDeclarator$1(parent) || isFor$1(parent));
|
|
23543
23543
|
}
|
|
23544
23544
|
function SequenceExpression$2(node, parent) {
|
|
23545
|
-
if (isForStatement$2(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement$3(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement$
|
|
23545
|
+
if (isForStatement$2(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement$3(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement$3(parent) && parent.expression === node) {
|
|
23546
23546
|
return false;
|
|
23547
23547
|
}
|
|
23548
23548
|
return true;
|
|
@@ -23559,7 +23559,7 @@ function UnaryLike(node, parent) {
|
|
|
23559
23559
|
left: node
|
|
23560
23560
|
}) || isClassExtendsClause(node, parent);
|
|
23561
23561
|
}
|
|
23562
|
-
function FunctionExpression$
|
|
23562
|
+
function FunctionExpression$2(node, parent, printStack) {
|
|
23563
23563
|
return isFirstInContext(printStack, 1 | 4);
|
|
23564
23564
|
}
|
|
23565
23565
|
function ArrowFunctionExpression$2(node, parent) {
|
|
@@ -23634,7 +23634,7 @@ function isFirstInContext(printStack, checkParam) {
|
|
|
23634
23634
|
i--;
|
|
23635
23635
|
let parent = printStack[i];
|
|
23636
23636
|
while (i >= 0) {
|
|
23637
|
-
if (expressionStatement && isExpressionStatement$
|
|
23637
|
+
if (expressionStatement && isExpressionStatement$3(parent, {
|
|
23638
23638
|
expression: node
|
|
23639
23639
|
}) || exportDefault && isExportDefaultDeclaration$1(parent, {
|
|
23640
23640
|
declaration: node
|
|
@@ -23679,7 +23679,7 @@ var _t$o = requireLib$a();
|
|
|
23679
23679
|
const {
|
|
23680
23680
|
FLIPPED_ALIAS_KEYS,
|
|
23681
23681
|
isCallExpression: isCallExpression$3,
|
|
23682
|
-
isExpressionStatement: isExpressionStatement$
|
|
23682
|
+
isExpressionStatement: isExpressionStatement$2,
|
|
23683
23683
|
isMemberExpression: isMemberExpression$2,
|
|
23684
23684
|
isNewExpression: isNewExpression$2
|
|
23685
23685
|
} = _t$o;
|
|
@@ -23718,7 +23718,7 @@ function isOrHasCallExpression(node) {
|
|
|
23718
23718
|
}
|
|
23719
23719
|
function needsWhitespace(node, parent, type) {
|
|
23720
23720
|
if (!node) return false;
|
|
23721
|
-
if (isExpressionStatement$
|
|
23721
|
+
if (isExpressionStatement$2(node)) {
|
|
23722
23722
|
node = node.expression;
|
|
23723
23723
|
}
|
|
23724
23724
|
const flag = find$1(expandedWhitespaceNodes, node, parent);
|
|
@@ -24100,7 +24100,7 @@ const {
|
|
|
24100
24100
|
isFor,
|
|
24101
24101
|
isForStatement: isForStatement$1,
|
|
24102
24102
|
isIfStatement: isIfStatement$2,
|
|
24103
|
-
isStatement: isStatement$
|
|
24103
|
+
isStatement: isStatement$7
|
|
24104
24104
|
} = _t$m;
|
|
24105
24105
|
function WithStatement(node) {
|
|
24106
24106
|
this.word("with");
|
|
@@ -24140,7 +24140,7 @@ function getLastStatement(statement) {
|
|
|
24140
24140
|
const {
|
|
24141
24141
|
body
|
|
24142
24142
|
} = statement;
|
|
24143
|
-
if (isStatement$
|
|
24143
|
+
if (isStatement$7(body) === false) {
|
|
24144
24144
|
return statement;
|
|
24145
24145
|
}
|
|
24146
24146
|
return getLastStatement(body);
|
|
@@ -24532,7 +24532,7 @@ Object.defineProperty(methods, "__esModule", {
|
|
|
24532
24532
|
value: true
|
|
24533
24533
|
});
|
|
24534
24534
|
methods.ArrowFunctionExpression = ArrowFunctionExpression$1;
|
|
24535
|
-
methods.FunctionDeclaration = methods.FunctionExpression = FunctionExpression;
|
|
24535
|
+
methods.FunctionDeclaration = methods.FunctionExpression = FunctionExpression$1;
|
|
24536
24536
|
methods._functionHead = _functionHead;
|
|
24537
24537
|
methods._methodHead = _methodHead;
|
|
24538
24538
|
methods._param = _param;
|
|
@@ -24631,7 +24631,7 @@ function _functionHead(node, parent) {
|
|
|
24631
24631
|
this._predicate(node);
|
|
24632
24632
|
}
|
|
24633
24633
|
}
|
|
24634
|
-
function FunctionExpression(node, parent) {
|
|
24634
|
+
function FunctionExpression$1(node, parent) {
|
|
24635
24635
|
this._functionHead(node, parent);
|
|
24636
24636
|
this.space();
|
|
24637
24637
|
this.print(node.body, node);
|
|
@@ -24722,7 +24722,7 @@ const {
|
|
|
24722
24722
|
isExportNamespaceSpecifier,
|
|
24723
24723
|
isImportDefaultSpecifier,
|
|
24724
24724
|
isImportNamespaceSpecifier,
|
|
24725
|
-
isStatement: isStatement$
|
|
24725
|
+
isStatement: isStatement$6
|
|
24726
24726
|
} = _t$j;
|
|
24727
24727
|
function ImportSpecifier(node) {
|
|
24728
24728
|
if (node.importKind === "type" || node.importKind === "typeof") {
|
|
@@ -24805,7 +24805,7 @@ function ExportNamedDeclaration(node) {
|
|
|
24805
24805
|
if (node.declaration) {
|
|
24806
24806
|
const declar = node.declaration;
|
|
24807
24807
|
this.print(declar, node);
|
|
24808
|
-
if (!isStatement$
|
|
24808
|
+
if (!isStatement$6(declar)) this.semicolon();
|
|
24809
24809
|
} else {
|
|
24810
24810
|
if (node.exportKind === "type") {
|
|
24811
24811
|
this.word("type");
|
|
@@ -24860,7 +24860,7 @@ function ExportDefaultDeclaration$1(node) {
|
|
|
24860
24860
|
this.space();
|
|
24861
24861
|
const declar = node.declaration;
|
|
24862
24862
|
this.print(declar, node);
|
|
24863
|
-
if (!isStatement$
|
|
24863
|
+
if (!isStatement$6(declar)) this.semicolon();
|
|
24864
24864
|
}
|
|
24865
24865
|
function ImportDeclaration(node) {
|
|
24866
24866
|
var _node$assertions3;
|
|
@@ -25279,7 +25279,7 @@ types$5.Identifier = Identifier$2;
|
|
|
25279
25279
|
types$5.NullLiteral = NullLiteral;
|
|
25280
25280
|
types$5.NumericLiteral = NumericLiteral;
|
|
25281
25281
|
types$5.ObjectPattern = types$5.ObjectExpression = ObjectExpression$1;
|
|
25282
|
-
types$5.ObjectMethod = ObjectMethod$
|
|
25282
|
+
types$5.ObjectMethod = ObjectMethod$2;
|
|
25283
25283
|
types$5.ObjectProperty = ObjectProperty$1;
|
|
25284
25284
|
types$5.PipelineBareFunction = PipelineBareFunction;
|
|
25285
25285
|
types$5.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
|
|
@@ -25322,7 +25322,7 @@ function ObjectExpression$1(node) {
|
|
|
25322
25322
|
this.sourceWithOffset("end", node.loc, 0, -1);
|
|
25323
25323
|
this.tokenChar(125);
|
|
25324
25324
|
}
|
|
25325
|
-
function ObjectMethod$
|
|
25325
|
+
function ObjectMethod$2(node) {
|
|
25326
25326
|
this.printJoin(node.decorators, node);
|
|
25327
25327
|
this._methodHead(node);
|
|
25328
25328
|
this.space();
|
|
@@ -27202,7 +27202,7 @@ var generatorFunctions = generators;
|
|
|
27202
27202
|
|
|
27203
27203
|
const {
|
|
27204
27204
|
isFunction: isFunction$4,
|
|
27205
|
-
isStatement: isStatement$
|
|
27205
|
+
isStatement: isStatement$5,
|
|
27206
27206
|
isClassBody,
|
|
27207
27207
|
isTSInterfaceBody,
|
|
27208
27208
|
isTSEnumDeclaration
|
|
@@ -27794,7 +27794,7 @@ class Printer {
|
|
|
27794
27794
|
}
|
|
27795
27795
|
if (len === 1) {
|
|
27796
27796
|
const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
|
|
27797
|
-
const shouldSkipNewline = singleLine && !isStatement$
|
|
27797
|
+
const shouldSkipNewline = singleLine && !isStatement$5(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumDeclaration(parent);
|
|
27798
27798
|
if (type === 0) {
|
|
27799
27799
|
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction$4(parent, {
|
|
27800
27800
|
body: node
|
|
@@ -44027,13 +44027,13 @@ var _parser$2 = lib$c;
|
|
|
44027
44027
|
var _codeFrame$2 = requireLib$8();
|
|
44028
44028
|
const {
|
|
44029
44029
|
isCallExpression: isCallExpression$1,
|
|
44030
|
-
isExpressionStatement,
|
|
44030
|
+
isExpressionStatement: isExpressionStatement$1,
|
|
44031
44031
|
isFunction: isFunction$3,
|
|
44032
44032
|
isIdentifier: isIdentifier$8,
|
|
44033
44033
|
isJSXIdentifier: isJSXIdentifier$1,
|
|
44034
44034
|
isNewExpression,
|
|
44035
44035
|
isPlaceholder,
|
|
44036
|
-
isStatement: isStatement$
|
|
44036
|
+
isStatement: isStatement$4,
|
|
44037
44037
|
isStringLiteral: isStringLiteral$4,
|
|
44038
44038
|
removePropertiesDeep,
|
|
44039
44039
|
traverse: traverse$7
|
|
@@ -44114,10 +44114,10 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
|
|
44114
44114
|
type = "string";
|
|
44115
44115
|
} else if (isNewExpression(parent) && key === "arguments" || isCallExpression$1(parent) && key === "arguments" || isFunction$3(parent) && key === "params") {
|
|
44116
44116
|
type = "param";
|
|
44117
|
-
} else if (isExpressionStatement(parent) && !isPlaceholder(node)) {
|
|
44117
|
+
} else if (isExpressionStatement$1(parent) && !isPlaceholder(node)) {
|
|
44118
44118
|
type = "statement";
|
|
44119
44119
|
ancestors = ancestors.slice(0, -1);
|
|
44120
|
-
} else if (isStatement$
|
|
44120
|
+
} else if (isStatement$4(node) && isPlaceholder(node)) {
|
|
44121
44121
|
type = "statement";
|
|
44122
44122
|
} else {
|
|
44123
44123
|
type = "other";
|
|
@@ -44196,7 +44196,7 @@ const {
|
|
|
44196
44196
|
emptyStatement,
|
|
44197
44197
|
expressionStatement: expressionStatement$3,
|
|
44198
44198
|
identifier: identifier$3,
|
|
44199
|
-
isStatement: isStatement$
|
|
44199
|
+
isStatement: isStatement$3,
|
|
44200
44200
|
isStringLiteral: isStringLiteral$3,
|
|
44201
44201
|
stringLiteral: stringLiteral$2,
|
|
44202
44202
|
validate: validate$2
|
|
@@ -44258,7 +44258,7 @@ function applyReplacement(placeholder, ast, replacement) {
|
|
|
44258
44258
|
replacement = blockStatement$3(replacement);
|
|
44259
44259
|
} else if (typeof replacement === "string") {
|
|
44260
44260
|
replacement = expressionStatement$3(identifier$3(replacement));
|
|
44261
|
-
} else if (!isStatement$
|
|
44261
|
+
} else if (!isStatement$3(replacement)) {
|
|
44262
44262
|
replacement = expressionStatement$3(replacement);
|
|
44263
44263
|
}
|
|
44264
44264
|
} else {
|
|
@@ -44266,7 +44266,7 @@ function applyReplacement(placeholder, ast, replacement) {
|
|
|
44266
44266
|
if (typeof replacement === "string") {
|
|
44267
44267
|
replacement = identifier$3(replacement);
|
|
44268
44268
|
}
|
|
44269
|
-
if (!isStatement$
|
|
44269
|
+
if (!isStatement$3(replacement)) {
|
|
44270
44270
|
replacement = expressionStatement$3(replacement);
|
|
44271
44271
|
}
|
|
44272
44272
|
}
|
|
@@ -44499,7 +44499,7 @@ const {
|
|
|
44499
44499
|
isIdentifier: isIdentifier$7,
|
|
44500
44500
|
isLiteral: isLiteral$1,
|
|
44501
44501
|
isNullLiteral,
|
|
44502
|
-
isObjectMethod,
|
|
44502
|
+
isObjectMethod: isObjectMethod$1,
|
|
44503
44503
|
isObjectProperty: isObjectProperty$1,
|
|
44504
44504
|
isRegExpLiteral,
|
|
44505
44505
|
isRestElement,
|
|
@@ -44610,7 +44610,7 @@ function _default$3({
|
|
|
44610
44610
|
id
|
|
44611
44611
|
}, localBinding = false, supportUnicodeId = false) {
|
|
44612
44612
|
if (node.id) return;
|
|
44613
|
-
if ((isObjectProperty$1(parent) || isObjectMethod(parent, {
|
|
44613
|
+
if ((isObjectProperty$1(parent) || isObjectMethod$1(parent, {
|
|
44614
44614
|
kind: "method"
|
|
44615
44615
|
})) && (!parent.computed || isLiteral$1(parent.key))) {
|
|
44616
44616
|
id = parent.key;
|
|
@@ -45144,7 +45144,7 @@ const {
|
|
|
45144
45144
|
STATEMENT_OR_BLOCK_KEYS,
|
|
45145
45145
|
VISITOR_KEYS,
|
|
45146
45146
|
isBlockStatement,
|
|
45147
|
-
isExpression: isExpression$
|
|
45147
|
+
isExpression: isExpression$2,
|
|
45148
45148
|
isIdentifier: isIdentifier$5,
|
|
45149
45149
|
isLiteral,
|
|
45150
45150
|
isStringLiteral: isStringLiteral$2,
|
|
@@ -45186,7 +45186,7 @@ function canSwapBetweenExpressionAndStatement(replacement) {
|
|
|
45186
45186
|
if (this.isExpression()) {
|
|
45187
45187
|
return isBlockStatement(replacement);
|
|
45188
45188
|
} else if (this.isBlockStatement()) {
|
|
45189
|
-
return isExpression$
|
|
45189
|
+
return isExpression$2(replacement);
|
|
45190
45190
|
}
|
|
45191
45191
|
return false;
|
|
45192
45192
|
}
|
|
@@ -46638,7 +46638,7 @@ Object.defineProperty(virtualTypesValidator, "__esModule", {
|
|
|
46638
46638
|
virtualTypesValidator.isBindingIdentifier = isBindingIdentifier;
|
|
46639
46639
|
virtualTypesValidator.isBlockScoped = isBlockScoped;
|
|
46640
46640
|
virtualTypesValidator.isExistentialTypeParam = isExistentialTypeParam;
|
|
46641
|
-
virtualTypesValidator.isExpression = isExpression;
|
|
46641
|
+
virtualTypesValidator.isExpression = isExpression$1;
|
|
46642
46642
|
virtualTypesValidator.isFlow = isFlow;
|
|
46643
46643
|
virtualTypesValidator.isForAwaitStatement = isForAwaitStatement;
|
|
46644
46644
|
virtualTypesValidator.isGenerated = isGenerated;
|
|
@@ -46650,7 +46650,7 @@ virtualTypesValidator.isReferencedMemberExpression = isReferencedMemberExpressio
|
|
|
46650
46650
|
virtualTypesValidator.isRestProperty = isRestProperty;
|
|
46651
46651
|
virtualTypesValidator.isScope = isScope;
|
|
46652
46652
|
virtualTypesValidator.isSpreadProperty = isSpreadProperty;
|
|
46653
|
-
virtualTypesValidator.isStatement = isStatement$
|
|
46653
|
+
virtualTypesValidator.isStatement = isStatement$2;
|
|
46654
46654
|
virtualTypesValidator.isUser = isUser;
|
|
46655
46655
|
virtualTypesValidator.isVar = isVar;
|
|
46656
46656
|
var _t$3 = requireLib$a();
|
|
@@ -46709,7 +46709,7 @@ function isBindingIdentifier() {
|
|
|
46709
46709
|
const grandparent = this.parentPath.parent;
|
|
46710
46710
|
return isIdentifier$4(node) && isBinding(node, parent, grandparent);
|
|
46711
46711
|
}
|
|
46712
|
-
function isStatement$
|
|
46712
|
+
function isStatement$2() {
|
|
46713
46713
|
const {
|
|
46714
46714
|
node,
|
|
46715
46715
|
parent
|
|
@@ -46728,7 +46728,7 @@ function isStatement$1() {
|
|
|
46728
46728
|
return false;
|
|
46729
46729
|
}
|
|
46730
46730
|
}
|
|
46731
|
-
function isExpression() {
|
|
46731
|
+
function isExpression$1() {
|
|
46732
46732
|
if (this.isIdentifier()) {
|
|
46733
46733
|
return this.isReferencedIdentifier();
|
|
46734
46734
|
} else {
|
|
@@ -69080,7 +69080,7 @@ main$1.default;
|
|
|
69080
69080
|
|
|
69081
69081
|
const {
|
|
69082
69082
|
isFunctionExpression,
|
|
69083
|
-
ObjectMethod,
|
|
69083
|
+
ObjectMethod: ObjectMethod$1,
|
|
69084
69084
|
} = requireLib$a();
|
|
69085
69085
|
|
|
69086
69086
|
const {assign: assign$8} = Object;
|
|
@@ -69094,7 +69094,7 @@ var traverseObjectExpression$1 = (propertiesPaths) => {
|
|
|
69094
69094
|
} = propPath.node;
|
|
69095
69095
|
|
|
69096
69096
|
if (isFunctionExpression(value)) {
|
|
69097
|
-
propPath.replaceWith(ObjectMethod('method', key, value.params, value.body, computed));
|
|
69097
|
+
propPath.replaceWith(ObjectMethod$1('method', key, value.params, value.body, computed));
|
|
69098
69098
|
|
|
69099
69099
|
assign$8(propPath.node, {
|
|
69100
69100
|
id: null,
|
|
@@ -100423,7 +100423,7 @@ const {
|
|
|
100423
100423
|
exportNamedDeclaration,
|
|
100424
100424
|
exportSpecifier,
|
|
100425
100425
|
expressionStatement: expressionStatement$1,
|
|
100426
|
-
functionExpression,
|
|
100426
|
+
functionExpression: functionExpression$1,
|
|
100427
100427
|
identifier,
|
|
100428
100428
|
memberExpression,
|
|
100429
100429
|
objectExpression: objectExpression$1,
|
|
@@ -100449,7 +100449,7 @@ const buildUmdWrapper = replacements => _template().default.statement`
|
|
|
100449
100449
|
function buildGlobal(allowlist) {
|
|
100450
100450
|
const namespace = identifier("babelHelpers");
|
|
100451
100451
|
const body = [];
|
|
100452
|
-
const container = functionExpression(null, [identifier("global")], blockStatement$1(body));
|
|
100452
|
+
const container = functionExpression$1(null, [identifier("global")], blockStatement$1(body));
|
|
100453
100453
|
const tree = program([expressionStatement$1(callExpression$1(container, [conditionalExpression$1(binaryExpression$1("===", unaryExpression$1("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]);
|
|
100454
100454
|
body.push(variableDeclaration$1("var", [variableDeclarator(namespace, assignmentExpression$1("=", memberExpression(identifier("global"), namespace), objectExpression$1([])))]));
|
|
100455
100455
|
buildHelpers(body, namespace, allowlist);
|
|
@@ -115597,16 +115597,24 @@ var watermarkExports = watermark$1.exports;
|
|
|
115597
115597
|
|
|
115598
115598
|
const {template: template$4} = requireParser$1();
|
|
115599
115599
|
|
|
115600
|
+
const {
|
|
115601
|
+
isExpression,
|
|
115602
|
+
isStatement: isStatement$1,
|
|
115603
|
+
isExpressionStatement,
|
|
115604
|
+
} = requireLib$a();
|
|
115605
|
+
|
|
115600
115606
|
const {
|
|
115601
115607
|
remove,
|
|
115602
115608
|
replaceWith,
|
|
115603
115609
|
} = requireOperate();
|
|
115610
|
+
|
|
115604
115611
|
const {
|
|
115605
115612
|
compare: compare$1,
|
|
115606
115613
|
findVarsWays,
|
|
115607
115614
|
getValues,
|
|
115608
115615
|
setValues,
|
|
115609
115616
|
} = requireCompare();
|
|
115617
|
+
|
|
115610
115618
|
const debug$2 = browserExports('putout:runner:replace');
|
|
115611
115619
|
const maybeArray = maybeArray_1;
|
|
115612
115620
|
|
|
@@ -115689,6 +115697,8 @@ const fix = (from, to, path) => {
|
|
|
115689
115697
|
return remove(path);
|
|
115690
115698
|
}
|
|
115691
115699
|
|
|
115700
|
+
checkExpressionStatement(nodeFrom, nodeTo, path);
|
|
115701
|
+
|
|
115692
115702
|
const waysTo = findVarsWays(nodeTo);
|
|
115693
115703
|
const newPath = replaceWith(path, nodeTo);
|
|
115694
115704
|
|
|
@@ -115764,6 +115774,19 @@ const validateTemplateValues = (a, b) => {
|
|
|
115764
115774
|
}
|
|
115765
115775
|
};
|
|
115766
115776
|
|
|
115777
|
+
function checkExpressionStatement(nodeFrom, nodeTo, path) {
|
|
115778
|
+
if (!isExpression(nodeFrom))
|
|
115779
|
+
return;
|
|
115780
|
+
|
|
115781
|
+
if (!isStatement$1(nodeTo) || isExpressionStatement(nodeTo))
|
|
115782
|
+
return;
|
|
115783
|
+
|
|
115784
|
+
if (isExpressionStatement(path) || isExpressionStatement(path.parentPath))
|
|
115785
|
+
return;
|
|
115786
|
+
|
|
115787
|
+
throw Error(`☝️ Looks like try to put Statement in place of Expression, use 'match' to filter out such cases`);
|
|
115788
|
+
}
|
|
115789
|
+
|
|
115767
115790
|
var replaceExports = replace$1.exports;
|
|
115768
115791
|
|
|
115769
115792
|
var declare$2 = {};
|
|
@@ -116459,7 +116482,9 @@ is.satisfy = (conditions) => (path) => {
|
|
|
116459
116482
|
return false;
|
|
116460
116483
|
};
|
|
116461
116484
|
|
|
116462
|
-
|
|
116485
|
+
is.noTrailingComment = (path) => !path.node.trailingComments;
|
|
116486
|
+
|
|
116487
|
+
const {exists: exists$5} = is;
|
|
116463
116488
|
|
|
116464
116489
|
arrowFunctionExpression.ArrowFunctionExpression = {
|
|
116465
116490
|
condition({parentPath}) {
|
|
@@ -116488,7 +116513,7 @@ arrowFunctionExpression.ArrowFunctionExpression = {
|
|
|
116488
116513
|
|
|
116489
116514
|
const returnType = path.get('returnType');
|
|
116490
116515
|
|
|
116491
|
-
if (exists$
|
|
116516
|
+
if (exists$5(returnType)) {
|
|
116492
116517
|
write(':');
|
|
116493
116518
|
write.space();
|
|
116494
116519
|
traverse(returnType);
|
|
@@ -116592,15 +116617,34 @@ classMethod.ClassMethod = {
|
|
|
116592
116617
|
},
|
|
116593
116618
|
};
|
|
116594
116619
|
|
|
116595
|
-
|
|
116596
|
-
const {FunctionDeclaration} = functionDeclaration;
|
|
116597
|
-
const {ClassMethod} = classMethod;
|
|
116620
|
+
var objectMethod = {};
|
|
116598
116621
|
|
|
116599
|
-
|
|
116600
|
-
|
|
116601
|
-
|
|
116622
|
+
objectMethod.ObjectMethod = (path, {print}) => {
|
|
116623
|
+
const {kind} = path.node;
|
|
116624
|
+
|
|
116625
|
+
if (kind !== 'method')
|
|
116626
|
+
print(`${kind} `);
|
|
116627
|
+
|
|
116628
|
+
print('__key');
|
|
116629
|
+
print('(');
|
|
116630
|
+
|
|
116631
|
+
const params = path.get('params');
|
|
116632
|
+
const n = params.length - 1;
|
|
116633
|
+
|
|
116634
|
+
for (let i = 0; i <= n; i++) {
|
|
116635
|
+
print(params[i]);
|
|
116636
|
+
|
|
116637
|
+
if (i < n)
|
|
116638
|
+
print(', ');
|
|
116639
|
+
}
|
|
116640
|
+
|
|
116641
|
+
print(') ');
|
|
116642
|
+
print('__body');
|
|
116643
|
+
};
|
|
116602
116644
|
|
|
116603
|
-
|
|
116645
|
+
var functionExpression = {};
|
|
116646
|
+
|
|
116647
|
+
functionExpression.FunctionExpression = (path, {print, maybe, write, traverse}) => {
|
|
116604
116648
|
const {node} = path;
|
|
116605
116649
|
|
|
116606
116650
|
const {
|
|
@@ -116635,28 +116679,17 @@ functions$1.FunctionExpression = (path, {print, maybe, write, traverse}) => {
|
|
|
116635
116679
|
print('__body');
|
|
116636
116680
|
};
|
|
116637
116681
|
|
|
116638
|
-
|
|
116639
|
-
|
|
116640
|
-
|
|
116641
|
-
|
|
116642
|
-
|
|
116643
|
-
|
|
116644
|
-
|
|
116645
|
-
|
|
116646
|
-
|
|
116647
|
-
|
|
116648
|
-
|
|
116649
|
-
|
|
116650
|
-
for (let i = 0; i <= n; i++) {
|
|
116651
|
-
print(params[i]);
|
|
116652
|
-
|
|
116653
|
-
if (i < n)
|
|
116654
|
-
print(', ');
|
|
116655
|
-
}
|
|
116656
|
-
|
|
116657
|
-
print(') ');
|
|
116658
|
-
print('__body');
|
|
116659
|
-
};
|
|
116682
|
+
const {ArrowFunctionExpression} = arrowFunctionExpression;
|
|
116683
|
+
const {FunctionDeclaration} = functionDeclaration;
|
|
116684
|
+
const {ClassMethod} = classMethod;
|
|
116685
|
+
const {ObjectMethod} = objectMethod;
|
|
116686
|
+
const {FunctionExpression} = functionExpression;
|
|
116687
|
+
|
|
116688
|
+
functions$1.FunctionDeclaration = FunctionDeclaration;
|
|
116689
|
+
functions$1.FunctionExpression = FunctionExpression;
|
|
116690
|
+
functions$1.ArrowFunctionExpression = ArrowFunctionExpression;
|
|
116691
|
+
functions$1.ClassMethod = ClassMethod;
|
|
116692
|
+
functions$1.ObjectMethod = ObjectMethod;
|
|
116660
116693
|
|
|
116661
116694
|
var unaryExpressions$1 = {};
|
|
116662
116695
|
|
|
@@ -116887,7 +116920,7 @@ function classVisitor(path, {print, indent, maybe}) {
|
|
|
116887
116920
|
|
|
116888
116921
|
var callExpression = {};
|
|
116889
116922
|
|
|
116890
|
-
const {exists: exists$
|
|
116923
|
+
const {exists: exists$4} = is;
|
|
116891
116924
|
|
|
116892
116925
|
function CallExpression$1(path, {indent, print, maybe, traverse}) {
|
|
116893
116926
|
const isParentCall = toLong(path) && path.parentPath.isCallExpression();
|
|
@@ -116898,7 +116931,7 @@ function CallExpression$1(path, {indent, print, maybe, traverse}) {
|
|
|
116898
116931
|
maybe.write(isFn, '(');
|
|
116899
116932
|
traverse(callee);
|
|
116900
116933
|
|
|
116901
|
-
if (exists$
|
|
116934
|
+
if (exists$4(typeParameters))
|
|
116902
116935
|
traverse(typeParameters);
|
|
116903
116936
|
|
|
116904
116937
|
maybe.write(isFn, ')');
|
|
@@ -116979,6 +117012,7 @@ const {
|
|
|
116979
117012
|
isCoupleLines: isCoupleLines$5,
|
|
116980
117013
|
isForOf: isForOf$3,
|
|
116981
117014
|
isIf,
|
|
117015
|
+
noTrailingComment: noTrailingComment$1,
|
|
116982
117016
|
} = is;
|
|
116983
117017
|
|
|
116984
117018
|
const {isFunction} = requireLib$a();
|
|
@@ -117021,7 +117055,7 @@ objectExpression.ObjectExpression = (path, {print, maybe, indent}) => {
|
|
|
117021
117055
|
}
|
|
117022
117056
|
|
|
117023
117057
|
print(property);
|
|
117024
|
-
maybe.print.newline(manyLines);
|
|
117058
|
+
maybe.print.newline(manyLines && noTrailingComment$1(property));
|
|
117025
117059
|
}
|
|
117026
117060
|
|
|
117027
117061
|
indent.dec();
|
|
@@ -117885,6 +117919,7 @@ const isNextAssign = (path) => {
|
|
|
117885
117919
|
var ifStatement = {};
|
|
117886
117920
|
|
|
117887
117921
|
const {markAfter: markAfter$3} = mark;
|
|
117922
|
+
const {exists: exists$3} = is;
|
|
117888
117923
|
|
|
117889
117924
|
const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement();
|
|
117890
117925
|
|
|
@@ -117917,7 +117952,7 @@ ifStatement.IfStatement = {
|
|
|
117917
117952
|
write('else');
|
|
117918
117953
|
write.space();
|
|
117919
117954
|
traverse(alternate);
|
|
117920
|
-
} else if (alternate
|
|
117955
|
+
} else if (exists$3(alternate)) {
|
|
117921
117956
|
write('else');
|
|
117922
117957
|
print.newline();
|
|
117923
117958
|
indent.inc();
|
|
@@ -117937,8 +117972,7 @@ ifStatement.IfStatement = {
|
|
|
117937
117972
|
return true;
|
|
117938
117973
|
},
|
|
117939
117974
|
after: (path, {print}) => {
|
|
117940
|
-
print.
|
|
117941
|
-
print.newline();
|
|
117975
|
+
print.linebreak();
|
|
117942
117976
|
markAfter$3(path);
|
|
117943
117977
|
},
|
|
117944
117978
|
};
|
|
@@ -118006,6 +118040,7 @@ const {
|
|
|
118006
118040
|
isLast: isLast$4,
|
|
118007
118041
|
exists: exists$2,
|
|
118008
118042
|
} = is;
|
|
118043
|
+
const {isObjectMethod} = requireLib$a();
|
|
118009
118044
|
|
|
118010
118045
|
const isFirstStatement = (path) => path.get('body.0')?.isStatement();
|
|
118011
118046
|
|
|
@@ -118048,6 +118083,9 @@ function shouldAddNewlineAfter$1(path) {
|
|
|
118048
118083
|
if (!isNext$5(path) && !isNext$5(path.parentPath) && isParentProgram(path.parentPath))
|
|
118049
118084
|
return false;
|
|
118050
118085
|
|
|
118086
|
+
if (path.find(isObjectMethod))
|
|
118087
|
+
return true;
|
|
118088
|
+
|
|
118051
118089
|
if (parentPath.isStatement() && !path.node.body.length && !isNext$5(parentPath))
|
|
118052
118090
|
return false;
|
|
118053
118091
|
|
|
@@ -118089,28 +118127,41 @@ function isTry({parentPath}) {
|
|
|
118089
118127
|
|
|
118090
118128
|
var returnStatement = {};
|
|
118091
118129
|
|
|
118092
|
-
const {
|
|
118130
|
+
const {
|
|
118131
|
+
isPrevBody,
|
|
118132
|
+
noTrailingComment,
|
|
118133
|
+
} = is;
|
|
118134
|
+
|
|
118093
118135
|
const {hasPrevNewline} = mark;
|
|
118094
118136
|
const isBodyLength = ({parentPath}) => parentPath.node?.body?.length > 2;
|
|
118095
118137
|
|
|
118096
|
-
returnStatement.ReturnStatement =
|
|
118097
|
-
|
|
118138
|
+
returnStatement.ReturnStatement = {
|
|
118139
|
+
beforeIf(path) {
|
|
118140
|
+
return !hasPrevNewline(path) && isBodyLength(path) || isPrevBody(path);
|
|
118141
|
+
},
|
|
118142
|
+
before(path, {print}) {
|
|
118098
118143
|
print.indent();
|
|
118099
118144
|
print.newline();
|
|
118100
|
-
}
|
|
118101
|
-
|
|
118102
|
-
|
|
118103
|
-
|
|
118104
|
-
|
|
118105
|
-
|
|
118106
|
-
|
|
118107
|
-
|
|
118108
|
-
|
|
118109
|
-
|
|
118110
|
-
|
|
118111
|
-
|
|
118112
|
-
|
|
118113
|
-
|
|
118145
|
+
},
|
|
118146
|
+
print(path, {indent, traverse, print}) {
|
|
118147
|
+
indent();
|
|
118148
|
+
print('return');
|
|
118149
|
+
|
|
118150
|
+
const argPath = path.get('argument');
|
|
118151
|
+
|
|
118152
|
+
if (argPath.node) {
|
|
118153
|
+
print(' ');
|
|
118154
|
+
traverse(argPath);
|
|
118155
|
+
}
|
|
118156
|
+
|
|
118157
|
+
print(';');
|
|
118158
|
+
},
|
|
118159
|
+
afterSatisfy: () => [
|
|
118160
|
+
noTrailingComment,
|
|
118161
|
+
],
|
|
118162
|
+
after(path, {print}) {
|
|
118163
|
+
print.newline();
|
|
118164
|
+
},
|
|
118114
118165
|
};
|
|
118115
118166
|
|
|
118116
118167
|
var tryStatements = {};
|
|
@@ -119259,7 +119310,9 @@ maybe.maybeThrow = (a, path, b) => {
|
|
|
119259
119310
|
}));
|
|
119260
119311
|
};
|
|
119261
119312
|
|
|
119262
|
-
const maybeProgram = (ast) => isProgram(ast) ? ast : Program([
|
|
119313
|
+
const maybeProgram = (ast) => isProgram(ast) ? ast : Program([
|
|
119314
|
+
ExpressionStatement$1(ast),
|
|
119315
|
+
]);
|
|
119263
119316
|
|
|
119264
119317
|
maybe.maybeFile = (ast) => isFile(ast) ? ast : File(maybeProgram(ast));
|
|
119265
119318
|
|
|
@@ -119460,10 +119513,11 @@ comments.parseTrailingComments = (path, {write, maybe}) => {
|
|
|
119460
119513
|
for (const {type, value, loc} of trailingComments) {
|
|
119461
119514
|
if (type === 'CommentLine') {
|
|
119462
119515
|
const sameLine = isSameLine(path, loc);
|
|
119516
|
+
|
|
119463
119517
|
maybe.write.space(sameLine);
|
|
119464
119518
|
maybe.indent(!sameLine);
|
|
119465
119519
|
write(`//${value}`);
|
|
119466
|
-
|
|
119520
|
+
write.newline();
|
|
119467
119521
|
}
|
|
119468
119522
|
}
|
|
119469
119523
|
};
|