@putout/bundle 4.4.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/putout.js CHANGED
@@ -5797,7 +5797,7 @@ __export$1(lib_exports$1, {
5797
5797
  isArrayPattern: () => isArrayPattern$1,
5798
5798
  isArrayTypeAnnotation: () => isArrayTypeAnnotation$1,
5799
5799
  isArrowFunctionExpression: () => isArrowFunctionExpression$b,
5800
- isAssignmentExpression: () => isAssignmentExpression$g,
5800
+ isAssignmentExpression: () => isAssignmentExpression$f,
5801
5801
  isAssignmentPattern: () => isAssignmentPattern$b,
5802
5802
  isAwaitExpression: () => isAwaitExpression$6,
5803
5803
  isBigIntLiteral: () => isBigIntLiteral$1,
@@ -5869,7 +5869,7 @@ __export$1(lib_exports$1, {
5869
5869
  isExportNamespaceSpecifier: () => isExportNamespaceSpecifier$6,
5870
5870
  isExportSpecifier: () => isExportSpecifier$2,
5871
5871
  isExpression: () => isExpression$5,
5872
- isExpressionStatement: () => isExpressionStatement$w,
5872
+ isExpressionStatement: () => isExpressionStatement$v,
5873
5873
  isExpressionWrapper: () => isExpressionWrapper$1,
5874
5874
  isFile: () => isFile$7,
5875
5875
  isFlow: () => isFlow$1,
@@ -5983,7 +5983,7 @@ __export$1(lib_exports$1, {
5983
5983
  isRegexLiteral: () => isRegexLiteral$1,
5984
5984
  isRestElement: () => isRestElement$1,
5985
5985
  isRestProperty: () => isRestProperty$1,
5986
- isReturnStatement: () => isReturnStatement$b,
5986
+ isReturnStatement: () => isReturnStatement$c,
5987
5987
  isScopable: () => isScopable$1,
5988
5988
  isScope: () => isScope$1,
5989
5989
  isSequenceExpression: () => isSequenceExpression$7,
@@ -7758,7 +7758,7 @@ function isArrayExpression$C(node, opts) {
7758
7758
  return opts == null || shallowEqual$1(node, opts);
7759
7759
  }
7760
7760
 
7761
- function isAssignmentExpression$g(node, opts) {
7761
+ function isAssignmentExpression$f(node, opts) {
7762
7762
  if (!node)
7763
7763
  return false;
7764
7764
 
@@ -7898,7 +7898,7 @@ function isEmptyStatement$1(node, opts) {
7898
7898
  return opts == null || shallowEqual$1(node, opts);
7899
7899
  }
7900
7900
 
7901
- function isExpressionStatement$w(node, opts) {
7901
+ function isExpressionStatement$v(node, opts) {
7902
7902
  if (!node)
7903
7903
  return false;
7904
7904
 
@@ -8118,7 +8118,7 @@ function isRestElement$1(node, opts) {
8118
8118
  return opts == null || shallowEqual$1(node, opts);
8119
8119
  }
8120
8120
 
8121
- function isReturnStatement$b(node, opts) {
8121
+ function isReturnStatement$c(node, opts) {
8122
8122
  if (!node)
8123
8123
  return false;
8124
8124
 
@@ -21672,7 +21672,7 @@ function toComputedKey$1(node, key = node.key || node.property) {
21672
21672
  }
21673
21673
 
21674
21674
  function toExpression$5(node) {
21675
- if (isExpressionStatement$w(node)) {
21675
+ if (isExpressionStatement$v(node)) {
21676
21676
  node = node.expression;
21677
21677
  }
21678
21678
 
@@ -21826,7 +21826,7 @@ function toStatement$2(node, ignore) {
21826
21826
  } else if (isFunction$s(node)) {
21827
21827
  mustHaveId = true;
21828
21828
  newType = 'FunctionDeclaration';
21829
- } else if (isAssignmentExpression$g(node)) {
21829
+ } else if (isAssignmentExpression$f(node)) {
21830
21830
  return expressionStatement$e(node);
21831
21831
  }
21832
21832
 
@@ -22051,7 +22051,7 @@ function getBindingIdentifiers$4(node, duplicates, outerOnly, newBindingsOnly) {
22051
22051
  if (!id)
22052
22052
  continue;
22053
22053
 
22054
- if (newBindingsOnly && (isAssignmentExpression$g(id) || isUnaryExpression$6(id) || isUpdateExpression$1(id))) {
22054
+ if (newBindingsOnly && (isAssignmentExpression$f(id) || isUnaryExpression$6(id) || isUpdateExpression$1(id))) {
22055
22055
  continue;
22056
22056
  }
22057
22057
 
@@ -22205,7 +22205,7 @@ function getFunctionName$1(node, parent) {
22205
22205
  prefix2 = 'set ';
22206
22206
  } else if (isVariableDeclarator$l(parent, {init: node})) {
22207
22207
  id = parent.id;
22208
- } else if (isAssignmentExpression$g(parent, {operator: '=', right: node})) {
22208
+ } else if (isAssignmentExpression$f(parent, {operator: '=', right: node})) {
22209
22209
  id = parent.left;
22210
22210
  }
22211
22211
 
@@ -56984,7 +56984,7 @@ const {
56984
56984
  const {
56985
56985
  isDecorator: isDecorator$9,
56986
56986
  isMemberExpression: isMemberExpression$r,
56987
- isExpressionStatement: isExpressionStatement$v,
56987
+ isExpressionStatement: isExpressionStatement$u,
56988
56988
  isCallExpression: isCallExpression$A,
56989
56989
  } = types$3p;
56990
56990
 
@@ -57129,7 +57129,7 @@ parseTrailingComments$e.parseTrailingComments = (path, printer, semantics, {curr
57129
57129
  function isPrevCall$4(path) {
57130
57130
  const prev = path.getPrevSibling();
57131
57131
 
57132
- if (isExpressionStatement$v(prev))
57132
+ if (isExpressionStatement$u(prev))
57133
57133
  return false;
57134
57134
 
57135
57135
  const {expression} = path.node;
@@ -57347,11 +57347,11 @@ const not$4 = (fn) => (...a) => !fn(...a);
57347
57347
  const notInsideExportDefaultWithBody$4 = not$4(isInsideExportDefaultWithBody$4);
57348
57348
 
57349
57349
  const {
57350
- isAssignmentExpression: isAssignmentExpression$f,
57350
+ isAssignmentExpression: isAssignmentExpression$e,
57351
57351
  isTSModuleBlock: isTSModuleBlock$c,
57352
57352
  isBlockStatement: isBlockStatement$n,
57353
57353
  isExportNamedDeclaration: isExportNamedDeclaration$b,
57354
- isExpressionStatement: isExpressionStatement$u,
57354
+ isExpressionStatement: isExpressionStatement$t,
57355
57355
  isFunctionDeclaration: isFunctionDeclaration$f,
57356
57356
  isExportDefaultDeclaration: isExportDefaultDeclaration$5,
57357
57357
  } = types$3o;
@@ -57409,10 +57409,10 @@ const isNextFunction$4 = (path) => {
57409
57409
  const isNextAssign$9 = (path) => {
57410
57410
  const next = path.getNextSibling();
57411
57411
 
57412
- if (!isExpressionStatement$u(next))
57412
+ if (!isExpressionStatement$t(next))
57413
57413
  return false;
57414
57414
 
57415
- return isAssignmentExpression$f(next.node.expression);
57415
+ return isAssignmentExpression$e(next.node.expression);
57416
57416
  };
57417
57417
 
57418
57418
  function isInsideBlockStatement$4(path) {
@@ -57502,7 +57502,7 @@ kind$4.printKind = (path, {write}) => {
57502
57502
  var printFunctionParams$9 = {};
57503
57503
 
57504
57504
  const {printParams: printParams$_} = params$4;
57505
- const {hasLeadingComment: hasLeadingComment$9} = is$8;
57505
+ const {hasLeadingComment: hasLeadingComment$b} = is$8;
57506
57506
 
57507
57507
  const isAllParamsHasLeadingComments$4 = (path) => {
57508
57508
  const params = path.get('params');
@@ -57518,7 +57518,7 @@ const isAllParamsHasLeadingComments$4 = (path) => {
57518
57518
  const [firstDecorator] = decorators;
57519
57519
  ++decoratorsCount;
57520
57520
 
57521
- if (hasLeadingComment$9(firstDecorator))
57521
+ if (hasLeadingComment$b(firstDecorator))
57522
57522
  ++commentsCount;
57523
57523
  }
57524
57524
 
@@ -58045,11 +58045,11 @@ const {exists: exists$17} = is$8;
58045
58045
  const {isMarkedAfter: isMarkedAfter$i} = mark$4;
58046
58046
 
58047
58047
  const {
58048
- isExpressionStatement: isExpressionStatement$t,
58048
+ isExpressionStatement: isExpressionStatement$s,
58049
58049
  isMemberExpression: isMemberExpression$q,
58050
58050
  } = types$3m;
58051
58051
 
58052
- const isInsideExpressionStatement$4 = ({parentPath}) => isExpressionStatement$t(parentPath);
58052
+ const isInsideExpressionStatement$4 = ({parentPath}) => isExpressionStatement$s(parentPath);
58053
58053
  const notFirst$4 = ({parentPath}) => exists$17(parentPath.getPrevSibling());
58054
58054
  const isInsideMember$4 = ({parentPath}) => isMemberExpression$q(parentPath);
58055
58055
 
@@ -58175,7 +58175,7 @@ const {
58175
58175
  noTrailingComment: noTrailingComment$e,
58176
58176
  isNewlineBetweenSiblings: isNewlineBetweenSiblings$i,
58177
58177
  noLeadingComment: noLeadingComment$4,
58178
- hasLeadingComment: hasLeadingComment$8,
58178
+ hasLeadingComment: hasLeadingComment$a,
58179
58179
  exists: exists$16,
58180
58180
  } = is$8;
58181
58181
 
@@ -58302,7 +58302,7 @@ const hasNextLeadingComment$4 = (path) => {
58302
58302
  if (!exists$16(next))
58303
58303
  return false;
58304
58304
 
58305
- return hasLeadingComment$8(next);
58305
+ return hasLeadingComment$a(next);
58306
58306
  };
58307
58307
 
58308
58308
  const notLastArgInsideCall$4 = (path) => {
@@ -58898,10 +58898,11 @@ classProperty$5.ClassAccessorProperty = (path, printer, semantics) => {
58898
58898
  });
58899
58899
  };
58900
58900
 
58901
- var assignmentExpression$5 = {};
58901
+ var assignmentExpression$5 = {exports: {}};
58902
58902
 
58903
58903
  var maybeWriteBrace$j = {};
58904
58904
 
58905
+ const {hasLeadingComment: hasLeadingComment$9} = is$8;
58905
58906
  const {isParens: isParens$h} = maybeParens$1a;
58906
58907
 
58907
58908
  maybeWriteBrace$j.maybePrintLeftBrace = (path, printer, semantics) => {
@@ -58942,7 +58943,7 @@ function maybeWriteBrace$i(path, printer, semantics, {brace}) {
58942
58943
  return;
58943
58944
  }
58944
58945
 
58945
- if (!roundBraces.assign)
58946
+ if (!roundBraces.assign && !hasLeadingComment$9(path))
58946
58947
  return;
58947
58948
 
58948
58949
  if (!isParens$h(path))
@@ -58951,51 +58952,107 @@ function maybeWriteBrace$i(path, printer, semantics, {brace}) {
58951
58952
  write(brace);
58952
58953
  }
58953
58954
 
58954
- const {types: types$3d} = bundle$1;
58955
- const {
58956
- maybePrintLeftBrace: maybePrintLeftBrace$4,
58957
- maybePrintRightBrace: maybePrintRightBrace$4,
58958
- } = maybeWriteBrace$j;
58955
+ var assignmentExpressionComments = {};
58959
58956
 
58960
- const {
58961
- isExpressionStatement: isExpressionStatement$s,
58962
- isAssignmentExpression: isAssignmentExpression$e,
58963
- } = types$3d;
58957
+ const {types: types$3d} = bundle$1;
58958
+ const {hasLeadingComment: hasLeadingComment$8} = is$8;
58959
+ const {isReturnStatement: isReturnStatement$b} = types$3d;
58964
58960
 
58965
- const isInsideBlock$o = ({parentPath}) => /BlockStatement|Program/.test(parentPath.type);
58961
+ assignmentExpressionComments.printLeadingCommentLine = ({parentPath}) => !isReturnStatement$b(parentPath);
58966
58962
 
58967
- assignmentExpression$5.AssignmentExpression = (path, printer, semantics) => {
58968
- const {print} = printer;
58969
- const {operator} = path.node;
58970
-
58971
- maybePrintLeftBrace$4(path, printer, semantics);
58972
- print('__left');
58973
- print.space();
58974
- print(operator);
58975
-
58976
- if (isMultiline$4(path))
58977
- print.breakline();
58978
- else
58979
- print.space();
58980
-
58981
- print('__right');
58963
+ assignmentExpressionComments.maybeInsideReturnWithCommentStart = (path, {print, indent}) => {
58964
+ const {parentPath} = path;
58982
58965
 
58983
- if (isInsideBlock$o(path)) {
58984
- print(';');
58966
+ if (isReturnStatement$b(parentPath) && hasLeadingComment$8(path)) {
58967
+ indent.inc();
58968
+ const {leadingComments} = path.node;
58969
+
58985
58970
  print.breakline();
58971
+ for (const {type, value} of leadingComments) {
58972
+ if (type === 'CommentLine')
58973
+ print(`//${value}`);
58974
+ else
58975
+ print(`/*${value}*/`);
58976
+
58977
+ print.breakline();
58978
+ }
58986
58979
  }
58987
-
58988
- maybePrintRightBrace$4(path, printer, semantics);
58989
58980
  };
58990
58981
 
58991
- function isMultiline$4(path) {
58992
- const {right} = path.node;
58982
+ assignmentExpressionComments.maybeInsideReturnWithCommentEnd = (path, {print, indent}) => {
58983
+ const {parentPath} = path;
58993
58984
 
58994
- if (!path.parentPath.find(isExpressionStatement$s))
58995
- return false;
58985
+ if (!isReturnStatement$b(parentPath) || !hasLeadingComment$8(path))
58986
+ return;
58996
58987
 
58997
- return isAssignmentExpression$e(right);
58998
- }
58988
+ indent.dec();
58989
+ print.breakline();
58990
+ };
58991
+
58992
+ (function (module) {
58993
+
58994
+ const {types} = bundle$1;
58995
+
58996
+ const {
58997
+ maybePrintLeftBrace,
58998
+ maybePrintRightBrace,
58999
+ } = maybeWriteBrace$j;
59000
+
59001
+ const {
59002
+ printLeadingCommentLine,
59003
+ maybeInsideReturnWithCommentEnd,
59004
+ maybeInsideReturnWithCommentStart,
59005
+ } = assignmentExpressionComments;
59006
+
59007
+ const {
59008
+ isExpressionStatement,
59009
+ isAssignmentExpression,
59010
+ } = types;
59011
+
59012
+ const isInsideBlock = ({parentPath}) => /BlockStatement|Program/.test(parentPath.type);
59013
+
59014
+ module.exports.AssignmentExpression = (path, printer, semantics) => {
59015
+ const {print} = printer;
59016
+ const {operator} = path.node;
59017
+
59018
+ maybePrintLeftBrace(path, printer, semantics);
59019
+ maybeInsideReturnWithCommentStart(path, printer);
59020
+
59021
+ print('__left');
59022
+ print.space();
59023
+ print(operator);
59024
+
59025
+ if (isMultiline(path))
59026
+ print.breakline();
59027
+ else
59028
+ print.space();
59029
+
59030
+ print('__right');
59031
+
59032
+ if (isInsideBlock(path)) {
59033
+ print(';');
59034
+ print.breakline();
59035
+ }
59036
+
59037
+ maybeInsideReturnWithCommentEnd(path, printer);
59038
+
59039
+ maybePrintRightBrace(path, printer, semantics);
59040
+ };
59041
+
59042
+ module.exports.AssignmentExpression.printLeadingCommentLine = printLeadingCommentLine;
59043
+
59044
+ function isMultiline(path) {
59045
+ const {right} = path.node;
59046
+
59047
+ if (!path.parentPath.find(isExpressionStatement))
59048
+ return false;
59049
+
59050
+ return isAssignmentExpression(right);
59051
+ }
59052
+ } (assignmentExpression$5));
59053
+
59054
+ var assignmentExpressionExports = assignmentExpression$5.exports;
59055
+ assignmentExpressionExports.default;
58999
59056
 
59000
59057
  var arrayExpression$8 = {};
59001
59058
 
@@ -60918,7 +60975,7 @@ const {
60918
60975
  PrivateName: PrivateName$6,
60919
60976
  } = classProperty$5;
60920
60977
 
60921
- const {AssignmentExpression: AssignmentExpression$5} = assignmentExpression$5;
60978
+ const {AssignmentExpression: AssignmentExpression$5} = assignmentExpressionExports;
60922
60979
  const {ArrayExpression: ArrayExpression$5} = arrayExpression$8;
60923
60980
  const {ArrayPattern: ArrayPattern$4} = arrayPattern$5;
60924
60981
  const {AssignmentPattern: AssignmentPattern$5} = assignmentPattern$5;