@putout/bundle 3.20.1 → 3.20.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
@@ -10871,7 +10871,7 @@ __export(lib_exports, {
10871
10871
  return isBlockScoped;
10872
10872
  },
10873
10873
  isBlockStatement: function() {
10874
- return isBlockStatement$4;
10874
+ return isBlockStatement$5;
10875
10875
  },
10876
10876
  isBooleanLiteral: function() {
10877
10877
  return isBooleanLiteral$2;
@@ -11042,7 +11042,7 @@ __export(lib_exports, {
11042
11042
  return isExportDefaultSpecifier;
11043
11043
  },
11044
11044
  isExportNamedDeclaration: function() {
11045
- return isExportNamedDeclaration$1;
11045
+ return isExportNamedDeclaration$2;
11046
11046
  },
11047
11047
  isExportNamespaceSpecifier: function() {
11048
11048
  return isExportNamespaceSpecifier$1;
@@ -11219,7 +11219,7 @@ __export(lib_exports, {
11219
11219
  return isLVal;
11220
11220
  },
11221
11221
  isLabeledStatement: function() {
11222
- return isLabeledStatement$1;
11222
+ return isLabeledStatement$2;
11223
11223
  },
11224
11224
  isLet: function() {
11225
11225
  return isLet;
@@ -11543,7 +11543,7 @@ __export(lib_exports, {
11543
11543
  return isTSMethodSignature;
11544
11544
  },
11545
11545
  isTSModuleBlock: function() {
11546
- return isTSModuleBlock$1;
11546
+ return isTSModuleBlock$2;
11547
11547
  },
11548
11548
  isTSModuleDeclaration: function() {
11549
11549
  return isTSModuleDeclaration;
@@ -13683,7 +13683,7 @@ function isDirectiveLiteral(node, opts) {
13683
13683
  if (node.type !== "DirectiveLiteral") return false;
13684
13684
  return opts == null || shallowEqual(node, opts);
13685
13685
  }
13686
- function isBlockStatement$4(node, opts) {
13686
+ function isBlockStatement$5(node, opts) {
13687
13687
  if (!node) return false;
13688
13688
  if (node.type !== "BlockStatement") return false;
13689
13689
  return opts == null || shallowEqual(node, opts);
@@ -13768,7 +13768,7 @@ function isIfStatement$2(node, opts) {
13768
13768
  if (node.type !== "IfStatement") return false;
13769
13769
  return opts == null || shallowEqual(node, opts);
13770
13770
  }
13771
- function isLabeledStatement$1(node, opts) {
13771
+ function isLabeledStatement$2(node, opts) {
13772
13772
  if (!node) return false;
13773
13773
  if (node.type !== "LabeledStatement") return false;
13774
13774
  return opts == null || shallowEqual(node, opts);
@@ -13948,7 +13948,7 @@ function isExportDefaultDeclaration(node, opts) {
13948
13948
  if (node.type !== "ExportDefaultDeclaration") return false;
13949
13949
  return opts == null || shallowEqual(node, opts);
13950
13950
  }
13951
- function isExportNamedDeclaration$1(node, opts) {
13951
+ function isExportNamedDeclaration$2(node, opts) {
13952
13952
  if (!node) return false;
13953
13953
  if (node.type !== "ExportNamedDeclaration") return false;
13954
13954
  return opts == null || shallowEqual(node, opts);
@@ -14843,7 +14843,7 @@ function isTSModuleDeclaration(node, opts) {
14843
14843
  if (node.type !== "TSModuleDeclaration") return false;
14844
14844
  return opts == null || shallowEqual(node, opts);
14845
14845
  }
14846
- function isTSModuleBlock$1(node, opts) {
14846
+ function isTSModuleBlock$2(node, opts) {
14847
14847
  if (!node) return false;
14848
14848
  if (node.type !== "TSModuleBlock") return false;
14849
14849
  return opts == null || shallowEqual(node, opts);
@@ -25252,7 +25252,7 @@ var TSTYPE_TYPES = FLIPPED_ALIAS_KEYS["TSType"];
25252
25252
  var TSBASETYPE_TYPES = FLIPPED_ALIAS_KEYS["TSBaseType"];
25253
25253
  var MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES;
25254
25254
  function toBlock(node, parent) {
25255
- if (isBlockStatement$4(node)) {
25255
+ if (isBlockStatement$5(node)) {
25256
25256
  return node;
25257
25257
  }
25258
25258
  var blockNodes = [];
@@ -26223,7 +26223,7 @@ function isReferenced(node, parent, grandparent) {
26223
26223
  return true;
26224
26224
  }
26225
26225
  function isScope(node, parent) {
26226
- if (isBlockStatement$4(node) && (isFunction$4(parent) || isCatchClause(parent))) {
26226
+ if (isBlockStatement$5(node) && (isFunction$4(parent) || isCatchClause(parent))) {
26227
26227
  return false;
26228
26228
  }
26229
26229
  if (isPattern(node) && (isFunction$4(parent) || isCatchClause(parent))) {
@@ -47902,7 +47902,7 @@ function ThrowStatement(node) {
47902
47902
  this.word("throw");
47903
47903
  printStatementAfterKeyword(this, node.argument);
47904
47904
  }
47905
- function LabeledStatement(node) {
47905
+ function LabeledStatement$1(node) {
47906
47906
  this.print(node.label);
47907
47907
  this.tokenChar(58);
47908
47908
  this.space();
@@ -50347,7 +50347,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
50347
50347
  JSXSpreadAttribute: JSXSpreadAttribute,
50348
50348
  JSXSpreadChild: JSXSpreadChild,
50349
50349
  JSXText: JSXText$1,
50350
- LabeledStatement: LabeledStatement,
50350
+ LabeledStatement: LabeledStatement$1,
50351
50351
  LogicalExpression: AssignmentExpression$2,
50352
50352
  MemberExpression: MemberExpression,
50353
50353
  MetaProperty: MetaProperty,
@@ -79057,7 +79057,7 @@ const maybeParensPrint = (print) => ({
79057
79057
 
79058
79058
  const maybeParensCondition = ({print, condition}) => ({
79059
79059
  ...maybeParensPrint(print),
79060
- condition: (path) => condition(path) || isParens$3(path),
79060
+ condition: (path) => condition?.(path) || isParens$3(path),
79061
79061
  });
79062
79062
 
79063
79063
  const {exists: exists$e} = is$3;
@@ -79099,17 +79099,21 @@ arrowFunctionExpression.ArrowFunctionExpression = maybeParens$d((path, printer,
79099
79099
 
79100
79100
  var functionDeclaration = {};
79101
79101
 
79102
+ const {
79103
+ isTSModuleBlock: isTSModuleBlock$1,
79104
+ isBlockStatement: isBlockStatement$4,
79105
+ isExportNamedDeclaration: isExportNamedDeclaration$1,
79106
+ } = bundle.types;
79107
+
79102
79108
  const {markAfter: markAfter$b} = mark;
79103
79109
  const {isNext: isNext$o, isNextParent: isNextParent$4} = is$3;
79104
79110
  const {printParams: printParams$b} = params;
79105
79111
 
79112
+ const isInsideNamedExport$1 = ({parentPath}) => isExportNamedDeclaration$1(parentPath);
79113
+
79106
79114
  functionDeclaration.FunctionDeclaration = {
79107
79115
  print(path, printer, semantics) {
79108
- const {
79109
- print,
79110
- maybe,
79111
- indent,
79112
- } = printer;
79116
+ const {print, maybe} = printer;
79113
79117
 
79114
79118
  const {
79115
79119
  async,
@@ -79117,7 +79121,7 @@ functionDeclaration.FunctionDeclaration = {
79117
79121
  returnType,
79118
79122
  } = path.node;
79119
79123
 
79120
- indent();
79124
+ maybe.indent(!isInsideNamedExport$1(path));
79121
79125
  maybe.print(async, 'async ');
79122
79126
 
79123
79127
  print('function');
@@ -79148,7 +79152,12 @@ functionDeclaration.FunctionDeclaration = {
79148
79152
  };
79149
79153
 
79150
79154
  function isInsideBlockStatement(path) {
79151
- if (!path.parentPath.isBlockStatement())
79155
+ const {parentPath} = path;
79156
+
79157
+ if (isTSModuleBlock$1(parentPath.parentPath))
79158
+ return true;
79159
+
79160
+ if (!isBlockStatement$4(parentPath))
79152
79161
  return false;
79153
79162
 
79154
79163
  return !path.node.body.body.length;
@@ -79390,11 +79399,11 @@ const unaryExpression = maybeParens$b((path, printer) => {
79390
79399
  unaryExpressions$1.UnaryExpression = unaryExpression;
79391
79400
  unaryExpressions$1.UpdateExpression = unaryExpression;
79392
79401
 
79393
- unaryExpressions$1.AwaitExpression = (path, {print}) => {
79402
+ unaryExpressions$1.AwaitExpression = maybeParens$b((path, {print}) => {
79394
79403
  printUnary(path, 'await', {
79395
79404
  print,
79396
79405
  });
79397
- };
79406
+ });
79398
79407
 
79399
79408
  unaryExpressions$1.YieldExpression = maybeParens$b((path, {print, maybe}) => {
79400
79409
  const {delegate} = path.node;
@@ -79522,7 +79531,7 @@ memberExpressions$1.MemberExpression = (path, printer) => {
79522
79531
 
79523
79532
  const object = path.get('object');
79524
79533
  const property = path.get('property');
79525
- const isParens = object.isAwaitExpression() || object.isAssignmentExpression();
79534
+ const isParens = object.isAssignmentExpression();
79526
79535
  const {computed} = path.node;
79527
79536
 
79528
79537
  maybe.print(isParens, '(');
@@ -82582,6 +82591,7 @@ var expressions$1 = {
82582
82591
 
82583
82592
  var expressionStatement = {};
82584
82593
 
82594
+ const {isLabeledStatement: isLabeledStatement$1} = bundle.types;
82585
82595
  const {
82586
82596
  isNext: isNext$k,
82587
82597
  isLast: isLast$b,
@@ -82617,9 +82627,11 @@ const shouldBreakline = satisfy$1([
82617
82627
  isStrictMode,
82618
82628
  ]);
82619
82629
 
82630
+ const isInsideLabel = ({parentPath}) => isLabeledStatement$1(parentPath);
82631
+
82620
82632
  expressionStatement.ExpressionStatement = {
82621
- print(path, {indent, print, maybe, store}) {
82622
- indent();
82633
+ print(path, {print, maybe, store}) {
82634
+ maybe.indent(!isInsideLabel(path));
82623
82635
 
82624
82636
  print('__expression');
82625
82637
  print(';');
@@ -84100,6 +84112,16 @@ continueStatement.ContinueStatement = (path, {indent, print, maybe, write}) => {
84100
84112
  print.newline();
84101
84113
  };
84102
84114
 
84115
+ var labeledSatement = {};
84116
+
84117
+ labeledSatement.LabeledStatement = (path, {print, indent}) => {
84118
+ indent();
84119
+ print('__label');
84120
+ print(':');
84121
+ print.space();
84122
+ print('__body');
84123
+ };
84124
+
84103
84125
  const {ExpressionStatement: ExpressionStatement$1} = expressionStatement;
84104
84126
  const {VariableDeclaration} = variableDeclaration;
84105
84127
  const {IfStatement} = ifStatement;
@@ -84121,6 +84143,7 @@ const {BreakStatement} = breakStatement;
84121
84143
  const {DoWhileStatement} = doWhileStatement;
84122
84144
  const {Program} = program;
84123
84145
  const {ContinueStatement} = continueStatement;
84146
+ const {LabeledStatement} = labeledSatement;
84124
84147
 
84125
84148
  const {
84126
84149
  ExportNamespaceSpecifier,
@@ -84144,12 +84167,7 @@ var statements$1 = {
84144
84167
  ForOfStatement,
84145
84168
  ReturnStatement,
84146
84169
  DebuggerStatement,
84147
- LabeledStatement(path, {print}) {
84148
- print('__label');
84149
- print(':');
84150
- print.space();
84151
- print('__body');
84152
- },
84170
+ LabeledStatement,
84153
84171
  Program,
84154
84172
  EmptyStatement(path, {write}) {
84155
84173
  write(';');