@putout/bundle 4.4.2 → 4.4.3

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
@@ -178,15 +178,15 @@ var versions = {};
178
178
  var release = {};
179
179
  var config = {};
180
180
 
181
- function noop$8() {}
181
+ function noop$9() {}
182
182
 
183
- var on = noop$8;
184
- var addListener = noop$8;
185
- var once$y = noop$8;
186
- var off = noop$8;
187
- var removeListener = noop$8;
188
- var removeAllListeners = noop$8;
189
- var emit = noop$8;
183
+ var on = noop$9;
184
+ var addListener = noop$9;
185
+ var once$y = noop$9;
186
+ var off = noop$9;
187
+ var removeListener = noop$9;
188
+ var removeAllListeners = noop$9;
189
+ var emit = noop$9;
190
190
 
191
191
  function binding(name) {
192
192
  throw new Error('process.binding is not supported');
@@ -57189,7 +57189,7 @@ comment$4.parseComments = parseComments$H;
57189
57189
 
57190
57190
  const {parseComments: parseComments$G} = comment$4;
57191
57191
 
57192
- const noop$7 = () => {};
57192
+ const noop$8 = () => {};
57193
57193
  const parseParams$4 = (path) => path.get('params');
57194
57194
 
57195
57195
  params$4.printParams = (path, printer, semantics, customization = {}) => {
@@ -57205,8 +57205,8 @@ params$4.printParams = (path, printer, semantics, customization = {}) => {
57205
57205
  braceOpen = '(',
57206
57206
  braceClose = ')',
57207
57207
  printSpace = print.space,
57208
- printAfterOpen = noop$7,
57209
- printBeforeClose = noop$7,
57208
+ printAfterOpen = noop$8,
57209
+ printBeforeClose = noop$8,
57210
57210
  } = customization;
57211
57211
 
57212
57212
  if (typeParameters)
@@ -57509,7 +57509,7 @@ kind$4.printKind = (path, {write}) => {
57509
57509
  var printFunctionParams$9 = {};
57510
57510
 
57511
57511
  const {printParams: printParams$_} = params$4;
57512
- const {hasLeadingComment: hasLeadingComment$b} = is$8;
57512
+ const {hasLeadingComment: hasLeadingComment$c} = is$8;
57513
57513
 
57514
57514
  const isAllParamsHasLeadingComments$4 = (path) => {
57515
57515
  const params = path.get('params');
@@ -57525,7 +57525,7 @@ const isAllParamsHasLeadingComments$4 = (path) => {
57525
57525
  const [firstDecorator] = decorators;
57526
57526
  ++decoratorsCount;
57527
57527
 
57528
- if (hasLeadingComment$b(firstDecorator))
57528
+ if (hasLeadingComment$c(firstDecorator))
57529
57529
  ++commentsCount;
57530
57530
  }
57531
57531
 
@@ -58182,7 +58182,7 @@ const {
58182
58182
  noTrailingComment: noTrailingComment$e,
58183
58183
  isNewlineBetweenSiblings: isNewlineBetweenSiblings$i,
58184
58184
  noLeadingComment: noLeadingComment$4,
58185
- hasLeadingComment: hasLeadingComment$a,
58185
+ hasLeadingComment: hasLeadingComment$b,
58186
58186
  exists: exists$16,
58187
58187
  } = is$8;
58188
58188
 
@@ -58309,7 +58309,7 @@ const hasNextLeadingComment$4 = (path) => {
58309
58309
  if (!exists$16(next))
58310
58310
  return false;
58311
58311
 
58312
- return hasLeadingComment$a(next);
58312
+ return hasLeadingComment$b(next);
58313
58313
  };
58314
58314
 
58315
58315
  const notLastArgInsideCall$4 = (path) => {
@@ -58909,7 +58909,7 @@ var assignmentExpression$5 = {exports: {}};
58909
58909
 
58910
58910
  var maybeParensCondition$4 = {};
58911
58911
 
58912
- const {hasLeadingComment: hasLeadingComment$9} = is$8;
58912
+ const {hasLeadingComment: hasLeadingComment$a} = is$8;
58913
58913
 
58914
58914
  const {isParens: isParens$h} = maybeParens$1a;
58915
58915
 
@@ -58930,7 +58930,7 @@ maybeParensCondition$4.condition = (path, printer, semantics) => {
58930
58930
  if (type === 'UnaryExpression')
58931
58931
  return true;
58932
58932
 
58933
- if (!roundBraces.assign && !hasLeadingComment$9(path))
58933
+ if (!roundBraces.assign && !hasLeadingComment$a(path))
58934
58934
  return false;
58935
58935
 
58936
58936
  return isParens$h(path);
@@ -58939,10 +58939,22 @@ maybeParensCondition$4.condition = (path, printer, semantics) => {
58939
58939
  var assignmentExpressionComments = {};
58940
58940
 
58941
58941
  const {types: types$3e} = bundle$1;
58942
- const {hasLeadingComment: hasLeadingComment$8} = is$8;
58942
+ const {hasLeadingComment: hasLeadingComment$9} = is$8;
58943
58943
  const {isReturnStatement: isReturnStatement$b} = types$3e;
58944
58944
 
58945
- assignmentExpressionComments.printLeadingCommentLine = (path, printer, semantics, {printComment}) => {
58945
+ assignmentExpressionComments.printLeadingCommentLine = (path, printer, semantics, {printComment, isLast}) => {
58946
+ const {parentPath} = path;
58947
+ const {print, maybe} = printer;
58948
+
58949
+ if (isReturnStatement$b(parentPath))
58950
+ return;
58951
+
58952
+ maybe.print.breakline(!isLast);
58953
+ printComment();
58954
+ print.breakline();
58955
+ };
58956
+
58957
+ assignmentExpressionComments.printLeadingCommentBlock = (path, printer, semantics, {printComment}) => {
58946
58958
  const {parentPath} = path;
58947
58959
  const {print} = printer;
58948
58960
 
@@ -58950,14 +58962,14 @@ assignmentExpressionComments.printLeadingCommentLine = (path, printer, semantics
58950
58962
  return;
58951
58963
 
58952
58964
  printComment();
58953
- print.newline();
58965
+ print.indent();
58954
58966
  };
58955
58967
 
58956
58968
  assignmentExpressionComments.maybeInsideReturnWithCommentStart = (path, {print, indent}) => {
58957
58969
  const {parentPath} = path;
58958
58970
  const is = isReturnStatement$b(parentPath);
58959
58971
 
58960
- if (is && hasLeadingComment$8(path)) {
58972
+ if (is && hasLeadingComment$9(path)) {
58961
58973
  indent.inc();
58962
58974
  const {leadingComments} = path.node;
58963
58975
 
@@ -58977,7 +58989,7 @@ assignmentExpressionComments.maybeInsideReturnWithCommentEnd = (path, {print, in
58977
58989
  const {parentPath} = path;
58978
58990
  const is = isReturnStatement$b(parentPath);
58979
58991
 
58980
- if (!is || !hasLeadingComment$8(path))
58992
+ if (!is || !hasLeadingComment$9(path))
58981
58993
  return;
58982
58994
 
58983
58995
  indent.dec();
@@ -59016,6 +59028,7 @@ function isMultiline$4(path) {
59016
59028
  printLeadingCommentLine,
59017
59029
  maybeInsideReturnWithCommentEnd,
59018
59030
  maybeInsideReturnWithCommentStart,
59031
+ printLeadingCommentBlock,
59019
59032
  } = assignmentExpressionComments;
59020
59033
 
59021
59034
  const {maybeParens} = maybeParens$1a;
@@ -59047,7 +59060,8 @@ function isMultiline$4(path) {
59047
59060
  },
59048
59061
  });
59049
59062
 
59050
- module.exports.AssignmentExpression.printLeadingCommentLine = printLeadingCommentLine;
59063
+ module.exports.AssignmentExpression.printLeadingCommentLine = printLeadingCommentLine;
59064
+ module.exports.AssignmentExpression.printLeadingCommentBlock = printLeadingCommentBlock;
59051
59065
  } (assignmentExpression$5));
59052
59066
 
59053
59067
  var assignmentExpressionExports = assignmentExpression$5.exports;
@@ -60649,71 +60663,108 @@ spreadElement$5.SpreadElement = (path, printer) => {
60649
60663
  print(',');
60650
60664
  };
60651
60665
 
60652
- var sequenceExpression$5 = {};
60653
-
60654
- var maybeWriteBrace$h = {};
60655
-
60656
- maybeWriteBrace$h.maybeWriteLeftBrace = (path, printer, semantics) => {
60657
- maybeWriteBrace$g(path, printer, semantics, {
60658
- brace: '(',
60659
- });
60660
- };
60666
+ var sequenceExpression$5 = {exports: {}};
60661
60667
 
60662
- maybeWriteBrace$h.maybeWriteRightBrace = (path, printer, semantics) => {
60663
- maybeWriteBrace$g(path, printer, semantics, {
60664
- brace: ')',
60665
- });
60666
- };
60668
+ var maybeWriteBrace$g = {};
60667
60669
 
60668
- function maybeWriteBrace$g(path, printer, semantics, {brace}) {
60670
+ maybeWriteBrace$g.condition = (path, printer, semantics) => {
60669
60671
  const {parentPath} = path;
60670
60672
  const {type} = parentPath;
60671
60673
  const {roundBraces} = semantics;
60672
- const {write} = printer;
60673
60674
 
60674
- if (type === 'ArrowFunctionExpression') {
60675
- write(brace);
60676
- return;
60677
- }
60678
-
60679
- if (type === 'ConditionalExpression' && path !== parentPath.get('test')) {
60680
- write(brace);
60681
- return;
60682
- }
60675
+ if (type === 'ArrowFunctionExpression')
60676
+ return true;
60683
60677
 
60684
- if (type === 'LogicalExpression') {
60685
- write(brace);
60686
- return;
60687
- }
60678
+ if (type === 'ConditionalExpression' && path !== parentPath.get('test'))
60679
+ return true;
60688
60680
 
60689
- if (!roundBraces.sequence)
60690
- return;
60681
+ if (type === 'LogicalExpression')
60682
+ return true;
60691
60683
 
60692
- write(brace);
60693
- }
60684
+ return roundBraces.sequence;
60685
+ };
60694
60686
 
60695
- const {
60696
- maybeWriteLeftBrace: maybeWriteLeftBrace$4,
60697
- maybeWriteRightBrace: maybeWriteRightBrace$4,
60698
- } = maybeWriteBrace$h;
60687
+ var sequenceExpressionComments = {};
60699
60688
 
60700
- sequenceExpression$5.SequenceExpression = (path, printer, semantics) => {
60701
- const {maybe, traverse} = printer;
60702
-
60703
- const expressions = path.get('expressions');
60704
- const n = expressions.length - 1;
60705
-
60706
- maybeWriteLeftBrace$4(path, printer, semantics);
60707
-
60708
- for (const [index, expression] of expressions.entries()) {
60709
- traverse(expression);
60710
- maybe.write(index < n, ',');
60711
- maybe.write.space(index < n);
60689
+ const {hasLeadingComment: hasLeadingComment$8} = is$8;
60690
+ const noop$7 = () => {};
60691
+
60692
+ sequenceExpressionComments.printLeadingCommentLine = noop$7;
60693
+ sequenceExpressionComments.printLeadingCommentBlock = noop$7;
60694
+
60695
+ sequenceExpressionComments.maybePrintComments = (path, {print}) => {
60696
+ if (hasLeadingComment$8(path)) {
60697
+ const {leadingComments} = path.node;
60698
+
60699
+ for (const {type, value} of leadingComments) {
60700
+ if (type === 'CommentLine')
60701
+ print(`//${value}`);
60702
+ else
60703
+ print(`/*${value}*/`);
60704
+
60705
+ print.breakline();
60706
+ }
60712
60707
  }
60713
-
60714
- maybeWriteRightBrace$4(path, printer, semantics);
60715
60708
  };
60716
60709
 
60710
+ (function (module) {
60711
+
60712
+ const {hasLeadingComment} = is$8;
60713
+ const {maybeParens} = maybeParens$1a;
60714
+ const {condition} = maybeWriteBrace$g;
60715
+
60716
+ const {
60717
+ maybePrintComments,
60718
+ printLeadingCommentLine,
60719
+ printLeadingCommentBlock,
60720
+ } = sequenceExpressionComments;
60721
+
60722
+ module.exports.SequenceExpression = maybeParens({
60723
+ checkParens: false,
60724
+ condition,
60725
+ print(path, printer) {
60726
+ const {
60727
+ write,
60728
+ traverse,
60729
+ indent,
60730
+ maybe,
60731
+ } = printer;
60732
+
60733
+ const expressions = path.get('expressions');
60734
+ const n = expressions.length - 1;
60735
+
60736
+ const withComment = hasLeadingComment(path);
60737
+
60738
+ if (withComment) {
60739
+ indent.inc();
60740
+ write.breakline();
60741
+ maybePrintComments(path, printer);
60742
+ }
60743
+
60744
+ for (const [index, expression] of expressions.entries()) {
60745
+ traverse(expression);
60746
+
60747
+ if (index < n) {
60748
+ write(',');
60749
+ maybe.write.space(!withComment);
60750
+ maybe.print.breakline(withComment);
60751
+ }
60752
+ }
60753
+
60754
+ if (withComment) {
60755
+ indent.dec();
60756
+ write.breakline();
60757
+ }
60758
+ },
60759
+ });
60760
+
60761
+ module.exports.SequenceExpression.printLeadingCommentLine = printLeadingCommentLine;
60762
+ module.exports.SequenceExpression.printLeadingCommentBlock = printLeadingCommentBlock;
60763
+ } (sequenceExpression$5));
60764
+
60765
+ var sequenceExpressionExports = sequenceExpression$5.exports;
60766
+ sequenceExpressionExports.default;
60767
+
60717
60768
  var taggedTemplateExpression$5 = {};
60718
60769
 
60719
60770
  taggedTemplateExpression$5.TaggedTemplateExpression = (path, {print}) => {
@@ -60980,7 +61031,7 @@ const {ArrayPattern: ArrayPattern$4} = arrayPattern$5;
60980
61031
  const {AssignmentPattern: AssignmentPattern$5} = assignmentPattern$5;
60981
61032
  const {RestElement: RestElement$5} = restElement$5;
60982
61033
  const {SpreadElement: SpreadElement$4} = spreadElement$5;
60983
- const {SequenceExpression: SequenceExpression$5} = sequenceExpression$5;
61034
+ const {SequenceExpression: SequenceExpression$5} = sequenceExpressionExports;
60984
61035
  const {TaggedTemplateExpression: TaggedTemplateExpression$5} = taggedTemplateExpression$5;
60985
61036
  const {BinaryExpression: BinaryExpression$5} = binaryExpression$5;
60986
61037
  const {LogicalExpression: LogicalExpression$5} = logicalExpression$5;
@@ -64506,7 +64557,7 @@ jsxText$5.JSXText = (path, {write, indent}) => {
64506
64557
  const isSpacesOnly = /^\s+$/.test(value);
64507
64558
  const hasNext = isNext$1E(path);
64508
64559
 
64509
- if (extra.raw.includes('&'))
64560
+ if (extra?.raw.includes('&'))
64510
64561
  return write(extra.raw);
64511
64562
 
64512
64563
  if (isSpacesOnly && hasNext) {