@putout/bundle 4.8.1 → 4.9.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/bundle/putout.js CHANGED
@@ -4099,7 +4099,7 @@ __export(lib_exports, {
4099
4099
  isCompletionStatement: () => isCompletionStatement,
4100
4100
  isConditional: () => isConditional,
4101
4101
  isConditionalExpression: () => isConditionalExpression,
4102
- isContinueStatement: () => isContinueStatement,
4102
+ isContinueStatement: () => isContinueStatement$1,
4103
4103
  isDebuggerStatement: () => isDebuggerStatement,
4104
4104
  isDeclaration: () => isDeclaration,
4105
4105
  isDeclareClass: () => isDeclareClass,
@@ -4140,7 +4140,7 @@ __export(lib_exports, {
4140
4140
  isExportNamespaceSpecifier: () => isExportNamespaceSpecifier$1,
4141
4141
  isExportSpecifier: () => isExportSpecifier$1,
4142
4142
  isExpression: () => isExpression$2,
4143
- isExpressionStatement: () => isExpressionStatement$7,
4143
+ isExpressionStatement: () => isExpressionStatement$8,
4144
4144
  isExpressionWrapper: () => isExpressionWrapper,
4145
4145
  isFile: () => isFile$2,
4146
4146
  isFlow: () => isFlow,
@@ -4254,7 +4254,7 @@ __export(lib_exports, {
4254
4254
  isRegexLiteral: () => isRegexLiteral,
4255
4255
  isRestElement: () => isRestElement,
4256
4256
  isRestProperty: () => isRestProperty,
4257
- isReturnStatement: () => isReturnStatement$3,
4257
+ isReturnStatement: () => isReturnStatement$4,
4258
4258
  isScopable: () => isScopable,
4259
4259
  isScope: () => isScope,
4260
4260
  isSequenceExpression: () => isSequenceExpression$2,
@@ -6129,7 +6129,7 @@ function isConditionalExpression(node, opts) {
6129
6129
  return opts == null || shallowEqual(node, opts);
6130
6130
  }
6131
6131
 
6132
- function isContinueStatement(node, opts) {
6132
+ function isContinueStatement$1(node, opts) {
6133
6133
  if (!node)
6134
6134
  return false;
6135
6135
 
@@ -6169,7 +6169,7 @@ function isEmptyStatement(node, opts) {
6169
6169
  return opts == null || shallowEqual(node, opts);
6170
6170
  }
6171
6171
 
6172
- function isExpressionStatement$7(node, opts) {
6172
+ function isExpressionStatement$8(node, opts) {
6173
6173
  if (!node)
6174
6174
  return false;
6175
6175
 
@@ -6389,7 +6389,7 @@ function isRestElement(node, opts) {
6389
6389
  return opts == null || shallowEqual(node, opts);
6390
6390
  }
6391
6391
 
6392
- function isReturnStatement$3(node, opts) {
6392
+ function isReturnStatement$4(node, opts) {
6393
6393
  if (!node)
6394
6394
  return false;
6395
6395
 
@@ -19762,7 +19762,7 @@ function toComputedKey(node, key = node.key || node.property) {
19762
19762
  }
19763
19763
 
19764
19764
  function toExpression$4(node) {
19765
- if (isExpressionStatement$7(node)) {
19765
+ if (isExpressionStatement$8(node)) {
19766
19766
  node = node.expression;
19767
19767
  }
19768
19768
 
@@ -52073,7 +52073,7 @@ const {
52073
52073
  const {
52074
52074
  isDecorator,
52075
52075
  isMemberExpression: isMemberExpression$6,
52076
- isExpressionStatement: isExpressionStatement$6,
52076
+ isExpressionStatement: isExpressionStatement$7,
52077
52077
  isCallExpression: isCallExpression$7,
52078
52078
  } = types$13;
52079
52079
 
@@ -52218,7 +52218,7 @@ parseTrailingComments$2.parseTrailingComments = (path, printer, semantics, {curr
52218
52218
  function isPrevCall(path) {
52219
52219
  const prev = path.getPrevSibling();
52220
52220
 
52221
- if (isExpressionStatement$6(prev))
52221
+ if (isExpressionStatement$7(prev))
52222
52222
  return false;
52223
52223
 
52224
52224
  const {expression} = path.node;
@@ -52447,7 +52447,7 @@ const {
52447
52447
  isTSModuleBlock: isTSModuleBlock$3,
52448
52448
  isBlockStatement: isBlockStatement$6,
52449
52449
  isExportNamedDeclaration: isExportNamedDeclaration$2,
52450
- isExpressionStatement: isExpressionStatement$5,
52450
+ isExpressionStatement: isExpressionStatement$6,
52451
52451
  isFunctionDeclaration: isFunctionDeclaration$2,
52452
52452
  isExportDefaultDeclaration,
52453
52453
  } = types$12;
@@ -52505,7 +52505,7 @@ const isNextFunction = (path) => {
52505
52505
  const isNextAssign$1 = (path) => {
52506
52506
  const next = path.getNextSibling();
52507
52507
 
52508
- if (!isExpressionStatement$5(next))
52508
+ if (!isExpressionStatement$6(next))
52509
52509
  return false;
52510
52510
 
52511
52511
  return isAssignmentExpression$2(next.node.expression);
@@ -53141,11 +53141,11 @@ const {exists: exists$b} = is$3;
53141
53141
  const {isMarkedAfter: isMarkedAfter$2} = mark;
53142
53142
 
53143
53143
  const {
53144
- isExpressionStatement: isExpressionStatement$4,
53144
+ isExpressionStatement: isExpressionStatement$5,
53145
53145
  isMemberExpression: isMemberExpression$5,
53146
53146
  } = types$10;
53147
53147
 
53148
- const isInsideExpressionStatement = ({parentPath}) => isExpressionStatement$4(parentPath);
53148
+ const isInsideExpressionStatement = ({parentPath}) => isExpressionStatement$5(parentPath);
53149
53149
  const notFirst = ({parentPath}) => exists$b(parentPath.getPrevSibling());
53150
53150
  const isInsideMember = ({parentPath}) => isMemberExpression$5(parentPath);
53151
53151
 
@@ -54095,13 +54095,13 @@ var assignmentExpressionComments = {};
54095
54095
 
54096
54096
  const {types: types$S} = bundle;
54097
54097
  const {hasLeadingComment: hasLeadingComment$1} = is$3;
54098
- const {isReturnStatement: isReturnStatement$2} = types$S;
54098
+ const {isReturnStatement: isReturnStatement$3} = types$S;
54099
54099
 
54100
54100
  assignmentExpressionComments.printLeadingCommentLine = (path, printer, semantics, {printComment, isLast}) => {
54101
54101
  const {parentPath} = path;
54102
54102
  const {print, maybe} = printer;
54103
54103
 
54104
- if (isReturnStatement$2(parentPath))
54104
+ if (isReturnStatement$3(parentPath))
54105
54105
  return;
54106
54106
 
54107
54107
  maybe.print.breakline(!isLast);
@@ -54113,7 +54113,7 @@ assignmentExpressionComments.printLeadingCommentBlock = (path, printer, semantic
54113
54113
  const {parentPath} = path;
54114
54114
  const {print} = printer;
54115
54115
 
54116
- if (isReturnStatement$2(parentPath))
54116
+ if (isReturnStatement$3(parentPath))
54117
54117
  return;
54118
54118
 
54119
54119
  printComment();
@@ -54122,7 +54122,7 @@ assignmentExpressionComments.printLeadingCommentBlock = (path, printer, semantic
54122
54122
 
54123
54123
  assignmentExpressionComments.maybeInsideReturnWithCommentStart = (path, {print, indent}) => {
54124
54124
  const {parentPath} = path;
54125
- const is = isReturnStatement$2(parentPath);
54125
+ const is = isReturnStatement$3(parentPath);
54126
54126
 
54127
54127
  if (is && hasLeadingComment$1(path)) {
54128
54128
  indent.inc();
@@ -54142,7 +54142,7 @@ assignmentExpressionComments.maybeInsideReturnWithCommentStart = (path, {print,
54142
54142
 
54143
54143
  assignmentExpressionComments.maybeInsideReturnWithCommentEnd = (path, {print, indent}) => {
54144
54144
  const {parentPath} = path;
54145
- const is = isReturnStatement$2(parentPath);
54145
+ const is = isReturnStatement$3(parentPath);
54146
54146
 
54147
54147
  if (!is || !hasLeadingComment$1(path))
54148
54148
  return;
@@ -54156,7 +54156,7 @@ var printSeparator = {};
54156
54156
  const {types: types$R} = bundle;
54157
54157
  const {
54158
54158
  isAssignmentExpression: isAssignmentExpression$1,
54159
- isExpressionStatement: isExpressionStatement$3,
54159
+ isExpressionStatement: isExpressionStatement$4,
54160
54160
  } = types$R;
54161
54161
 
54162
54162
  printSeparator.printSeparator = (path, {print}) => {
@@ -54169,7 +54169,7 @@ printSeparator.printSeparator = (path, {print}) => {
54169
54169
  function isMultiline(path) {
54170
54170
  const {right} = path.node;
54171
54171
 
54172
- if (!path.parentPath.find(isExpressionStatement$3))
54172
+ if (!path.parentPath.find(isExpressionStatement$4))
54173
54173
  return false;
54174
54174
 
54175
54175
  return isAssignmentExpression$1(right);
@@ -55989,12 +55989,12 @@ var chain$1 = {};
55989
55989
  const {types: types$G} = bundle;
55990
55990
  const {
55991
55991
  isLogicalExpression,
55992
- isReturnStatement: isReturnStatement$1,
55992
+ isReturnStatement: isReturnStatement$2,
55993
55993
  isVariableDeclarator: isVariableDeclarator$1,
55994
55994
  } = types$G;
55995
55995
 
55996
55996
  chain$1.isRootOk = (path) => {
55997
- return isReturnStatement$1(path) || isVariableDeclarator$1(path);
55997
+ return isReturnStatement$2(path) || isVariableDeclarator$1(path);
55998
55998
  };
55999
55999
 
56000
56000
  chain$1.chain = (path) => {
@@ -56241,7 +56241,7 @@ var isInsideAssignNextAssignFunction = {};
56241
56241
 
56242
56242
  const {types: types$E} = bundle;
56243
56243
  const {
56244
- isExpressionStatement: isExpressionStatement$2,
56244
+ isExpressionStatement: isExpressionStatement$3,
56245
56245
  isFunction: isFunction$4,
56246
56246
  isAssignmentExpression,
56247
56247
  } = types$E;
@@ -56257,7 +56257,7 @@ isInsideAssignNextAssignFunction.isInsideAssignNextAssignFunction = (path) => {
56257
56257
  if (isFunction$4(next) && next.node.leadingComments)
56258
56258
  return true;
56259
56259
 
56260
- if (!isExpressionStatement$2(next))
56260
+ if (!isExpressionStatement$3(next))
56261
56261
  return false;
56262
56262
 
56263
56263
  const {leadingComments} = next.node;
@@ -56765,8 +56765,24 @@ const {
56765
56765
  isBlockStatement: isBlockStatement$3,
56766
56766
  isFunctionDeclaration: isFunctionDeclaration$1,
56767
56767
  isStatement: isStatement$3,
56768
+ isExpressionStatement: isExpressionStatement$2,
56769
+ isReturnStatement: isReturnStatement$1,
56770
+ isContinueStatement,
56768
56771
  } = types$B;
56769
56772
 
56773
+ const isStatementNotExpression = (path) => {
56774
+ if (isBlockStatement$3(path))
56775
+ return false;
56776
+
56777
+ if (isReturnStatement$1(path))
56778
+ return false;
56779
+
56780
+ if (isContinueStatement(path))
56781
+ return false;
56782
+
56783
+ return !isExpressionStatement$2(path);
56784
+ };
56785
+
56770
56786
  const isTopLevel = ({parentPath}) => parentPath.parentPath.isProgram();
56771
56787
  const isEmptyConsequent = (path) => path.get('consequent').isEmptyStatement();
56772
56788
 
@@ -56835,15 +56851,17 @@ ifStatement.IfStatement = {
56835
56851
  write.space();
56836
56852
  traverse(alternate);
56837
56853
  } else if (alternate.isIfStatement()) {
56838
- if (alternate.get('consequent').isBlockStatement())
56854
+ if (alternate.get('consequent').isBlockStatement()) {
56839
56855
  write.space();
56840
- else
56856
+ } else {
56857
+ maybe.write.newline(isStatementNotExpression(consequent));
56841
56858
  indent();
56859
+ }
56842
56860
 
56843
56861
  write('else ');
56844
56862
  traverse(alternate);
56845
56863
  } else if (exists$6(alternate)) {
56846
- maybe.write.newline(isVar);
56864
+ maybe.write.newline(isVar || isStatementNotExpression(consequent));
56847
56865
  maybe.indent(!isConsequentBlock);
56848
56866
  maybe.write.space(isConsequentBlock);
56849
56867
  write('else');
@@ -63770,17 +63788,17 @@ function setup(env) {
63770
63788
 
63771
63789
  var common = setup;
63772
63790
 
63773
- (function (module, exports) {
63791
+ (function (module, exports$1) {
63774
63792
  /**
63775
63793
  * This is the web browser implementation of `debug()`.
63776
63794
  */
63777
63795
 
63778
- exports.formatArgs = formatArgs;
63779
- exports.save = save;
63780
- exports.load = load;
63781
- exports.useColors = useColors;
63782
- exports.storage = localstorage();
63783
- exports.destroy = (() => {
63796
+ exports$1.formatArgs = formatArgs;
63797
+ exports$1.save = save;
63798
+ exports$1.load = load;
63799
+ exports$1.useColors = useColors;
63800
+ exports$1.storage = localstorage();
63801
+ exports$1.destroy = (() => {
63784
63802
  let warned = false;
63785
63803
 
63786
63804
  return () => {
@@ -63795,7 +63813,7 @@ var common = setup;
63795
63813
  * Colors.
63796
63814
  */
63797
63815
 
63798
- exports.colors = [
63816
+ exports$1.colors = [
63799
63817
  '#0000CC',
63800
63818
  '#0000FF',
63801
63819
  '#0033CC',
@@ -63960,7 +63978,7 @@ var common = setup;
63960
63978
  *
63961
63979
  * @api public
63962
63980
  */
63963
- exports.log = console.debug || console.log || (() => {});
63981
+ exports$1.log = console.debug || console.log || (() => {});
63964
63982
 
63965
63983
  /**
63966
63984
  * Save `namespaces`.
@@ -63971,9 +63989,9 @@ var common = setup;
63971
63989
  function save(namespaces) {
63972
63990
  try {
63973
63991
  if (namespaces) {
63974
- exports.storage.setItem('debug', namespaces);
63992
+ exports$1.storage.setItem('debug', namespaces);
63975
63993
  } else {
63976
- exports.storage.removeItem('debug');
63994
+ exports$1.storage.removeItem('debug');
63977
63995
  }
63978
63996
  } catch (error) {
63979
63997
  // Swallow
@@ -63990,7 +64008,7 @@ var common = setup;
63990
64008
  function load() {
63991
64009
  let r;
63992
64010
  try {
63993
- r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
64011
+ r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG') ;
63994
64012
  } catch (error) {
63995
64013
  // Swallow
63996
64014
  // XXX (@Qix-) should we be logging these?
@@ -64026,7 +64044,7 @@ var common = setup;
64026
64044
  }
64027
64045
  }
64028
64046
 
64029
- module.exports = common(exports);
64047
+ module.exports = common(exports$1);
64030
64048
 
64031
64049
  const {formatters} = module.exports;
64032
64050