@putout/bundle 1.8.1 → 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.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$2;
234
- generated$3.isExpressionStatement = isExpressionStatement$3;
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$1;
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$7;
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$3(node, opts) {
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$1(node, opts) {
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$2(node, opts) {
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$7(node, opts) {
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$1;
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$2,
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$2(parent) && parent.expression === node) {
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$1(node, parent, printStack) {
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$2(parent, {
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$1,
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$1(node)) {
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$6
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$6(body) === false) {
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$5
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$5(declar)) this.semicolon();
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$5(declar)) this.semicolon();
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$1;
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$1(node) {
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$4,
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$4(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumDeclaration(parent);
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$3,
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$3(node) && isPlaceholder(node)) {
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$2,
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$2(replacement)) {
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$2(replacement)) {
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$1,
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$1(replacement);
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$1;
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$1() {
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 = {};
@@ -116461,7 +116484,7 @@ is.satisfy = (conditions) => (path) => {
116461
116484
 
116462
116485
  is.noTrailingComment = (path) => !path.node.trailingComments;
116463
116486
 
116464
- const {exists: exists$4} = is;
116487
+ const {exists: exists$5} = is;
116465
116488
 
116466
116489
  arrowFunctionExpression.ArrowFunctionExpression = {
116467
116490
  condition({parentPath}) {
@@ -116490,7 +116513,7 @@ arrowFunctionExpression.ArrowFunctionExpression = {
116490
116513
 
116491
116514
  const returnType = path.get('returnType');
116492
116515
 
116493
- if (exists$4(returnType)) {
116516
+ if (exists$5(returnType)) {
116494
116517
  write(':');
116495
116518
  write.space();
116496
116519
  traverse(returnType);
@@ -116594,15 +116617,34 @@ classMethod.ClassMethod = {
116594
116617
  },
116595
116618
  };
116596
116619
 
116597
- const {ArrowFunctionExpression} = arrowFunctionExpression;
116598
- const {FunctionDeclaration} = functionDeclaration;
116599
- const {ClassMethod} = classMethod;
116620
+ var objectMethod = {};
116600
116621
 
116601
- functions$1.ArrowFunctionExpression = ArrowFunctionExpression;
116602
- functions$1.FunctionDeclaration = FunctionDeclaration;
116603
- functions$1.ClassMethod = ClassMethod;
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
+ };
116644
+
116645
+ var functionExpression = {};
116604
116646
 
116605
- functions$1.FunctionExpression = (path, {print, maybe, write, traverse}) => {
116647
+ functionExpression.FunctionExpression = (path, {print, maybe, write, traverse}) => {
116606
116648
  const {node} = path;
116607
116649
 
116608
116650
  const {
@@ -116637,28 +116679,17 @@ functions$1.FunctionExpression = (path, {print, maybe, write, traverse}) => {
116637
116679
  print('__body');
116638
116680
  };
116639
116681
 
116640
- functions$1.ObjectMethod = (path, {print}) => {
116641
- const {kind} = path.node;
116642
-
116643
- if (kind !== 'method')
116644
- print(`${kind} `);
116645
-
116646
- print('__key');
116647
- print('(');
116648
-
116649
- const params = path.get('params');
116650
- const n = params.length - 1;
116651
-
116652
- for (let i = 0; i <= n; i++) {
116653
- print(params[i]);
116654
-
116655
- if (i < n)
116656
- print(', ');
116657
- }
116658
-
116659
- print(') ');
116660
- print('__body');
116661
- };
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;
116662
116693
 
116663
116694
  var unaryExpressions$1 = {};
116664
116695
 
@@ -116889,7 +116920,7 @@ function classVisitor(path, {print, indent, maybe}) {
116889
116920
 
116890
116921
  var callExpression = {};
116891
116922
 
116892
- const {exists: exists$3} = is;
116923
+ const {exists: exists$4} = is;
116893
116924
 
116894
116925
  function CallExpression$1(path, {indent, print, maybe, traverse}) {
116895
116926
  const isParentCall = toLong(path) && path.parentPath.isCallExpression();
@@ -116900,7 +116931,7 @@ function CallExpression$1(path, {indent, print, maybe, traverse}) {
116900
116931
  maybe.write(isFn, '(');
116901
116932
  traverse(callee);
116902
116933
 
116903
- if (exists$3(typeParameters))
116934
+ if (exists$4(typeParameters))
116904
116935
  traverse(typeParameters);
116905
116936
 
116906
116937
  maybe.write(isFn, ')');
@@ -116982,7 +117013,6 @@ const {
116982
117013
  isForOf: isForOf$3,
116983
117014
  isIf,
116984
117015
  noTrailingComment: noTrailingComment$1,
116985
-
116986
117016
  } = is;
116987
117017
 
116988
117018
  const {isFunction} = requireLib$a();
@@ -117889,6 +117919,7 @@ const isNextAssign = (path) => {
117889
117919
  var ifStatement = {};
117890
117920
 
117891
117921
  const {markAfter: markAfter$3} = mark;
117922
+ const {exists: exists$3} = is;
117892
117923
 
117893
117924
  const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement();
117894
117925
 
@@ -117921,7 +117952,7 @@ ifStatement.IfStatement = {
117921
117952
  write('else');
117922
117953
  write.space();
117923
117954
  traverse(alternate);
117924
- } else if (alternate.node) {
117955
+ } else if (exists$3(alternate)) {
117925
117956
  write('else');
117926
117957
  print.newline();
117927
117958
  indent.inc();
@@ -117941,8 +117972,7 @@ ifStatement.IfStatement = {
117941
117972
  return true;
117942
117973
  },
117943
117974
  after: (path, {print}) => {
117944
- print.indent();
117945
- print.newline();
117975
+ print.linebreak();
117946
117976
  markAfter$3(path);
117947
117977
  },
117948
117978
  };
@@ -118010,6 +118040,7 @@ const {
118010
118040
  isLast: isLast$4,
118011
118041
  exists: exists$2,
118012
118042
  } = is;
118043
+ const {isObjectMethod} = requireLib$a();
118013
118044
 
118014
118045
  const isFirstStatement = (path) => path.get('body.0')?.isStatement();
118015
118046
 
@@ -118052,6 +118083,9 @@ function shouldAddNewlineAfter$1(path) {
118052
118083
  if (!isNext$5(path) && !isNext$5(path.parentPath) && isParentProgram(path.parentPath))
118053
118084
  return false;
118054
118085
 
118086
+ if (path.find(isObjectMethod))
118087
+ return true;
118088
+
118055
118089
  if (parentPath.isStatement() && !path.node.body.length && !isNext$5(parentPath))
118056
118090
  return false;
118057
118091
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/bundle",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout bundle suitable for Deno or Browsers",