@putout/bundle 3.19.0 → 3.19.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
@@ -9428,7 +9428,7 @@ __export(lib_exports, {
9428
9428
  return tsTypePredicate;
9429
9429
  },
9430
9430
  TSTypeQuery: function() {
9431
- return tsTypeQuery;
9431
+ return tsTypeQuery$1;
9432
9432
  },
9433
9433
  TSTypeReference: function() {
9434
9434
  return tsTypeReference$1;
@@ -9437,7 +9437,7 @@ __export(lib_exports, {
9437
9437
  return tsUndefinedKeyword;
9438
9438
  },
9439
9439
  TSUnionType: function() {
9440
- return tsUnionType;
9440
+ return tsUnionType$1;
9441
9441
  },
9442
9442
  TSUnknownKeyword: function() {
9443
9443
  return tsUnknownKeyword;
@@ -11171,7 +11171,7 @@ __export(lib_exports, {
11171
11171
  return isJSX;
11172
11172
  },
11173
11173
  isJSXAttribute: function() {
11174
- return isJSXAttribute$2;
11174
+ return isJSXAttribute$3;
11175
11175
  },
11176
11176
  isJSXClosingElement: function() {
11177
11177
  return isJSXClosingElement;
@@ -11192,7 +11192,7 @@ __export(lib_exports, {
11192
11192
  return isJSXFragment;
11193
11193
  },
11194
11194
  isJSXIdentifier: function() {
11195
- return isJSXIdentifier$1;
11195
+ return isJSXIdentifier$3;
11196
11196
  },
11197
11197
  isJSXMemberExpression: function() {
11198
11198
  return isJSXMemberExpression;
@@ -12224,7 +12224,7 @@ __export(lib_exports, {
12224
12224
  return tsTypePredicate;
12225
12225
  },
12226
12226
  tsTypeQuery: function() {
12227
- return tsTypeQuery;
12227
+ return tsTypeQuery$1;
12228
12228
  },
12229
12229
  tsTypeReference: function() {
12230
12230
  return tsTypeReference$1;
@@ -12233,7 +12233,7 @@ __export(lib_exports, {
12233
12233
  return tsUndefinedKeyword;
12234
12234
  },
12235
12235
  tsUnionType: function() {
12236
- return tsUnionType;
12236
+ return tsUnionType$1;
12237
12237
  },
12238
12238
  tsUnknownKeyword: function() {
12239
12239
  return tsUnknownKeyword;
@@ -14418,7 +14418,7 @@ function isOptionalIndexedAccessType(node, opts) {
14418
14418
  if (node.type !== "OptionalIndexedAccessType") return false;
14419
14419
  return opts == null || shallowEqual(node, opts);
14420
14420
  }
14421
- function isJSXAttribute$2(node, opts) {
14421
+ function isJSXAttribute$3(node, opts) {
14422
14422
  if (!node) return false;
14423
14423
  if (node.type !== "JSXAttribute") return false;
14424
14424
  return opts == null || shallowEqual(node, opts);
@@ -14448,7 +14448,7 @@ function isJSXSpreadChild(node, opts) {
14448
14448
  if (node.type !== "JSXSpreadChild") return false;
14449
14449
  return opts == null || shallowEqual(node, opts);
14450
14450
  }
14451
- function isJSXIdentifier$1(node, opts) {
14451
+ function isJSXIdentifier$3(node, opts) {
14452
14452
  if (!node) return false;
14453
14453
  if (node.type !== "JSXIdentifier") return false;
14454
14454
  return opts == null || shallowEqual(node, opts);
@@ -23387,7 +23387,7 @@ function tsTypePredicate(parameterName) {
23387
23387
  validate$4(defs.asserts, node, "asserts", asserts);
23388
23388
  return node;
23389
23389
  }
23390
- function tsTypeQuery(exprName) {
23390
+ function tsTypeQuery$1(exprName) {
23391
23391
  var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
23392
23392
  var node = {
23393
23393
  type: "TSTypeQuery",
@@ -23458,7 +23458,7 @@ function tsNamedTupleMember$1(label, elementType) {
23458
23458
  validate$4(defs.optional, node, "optional", optional);
23459
23459
  return node;
23460
23460
  }
23461
- function tsUnionType(types2) {
23461
+ function tsUnionType$1(types2) {
23462
23462
  var node = {
23463
23463
  type: "TSUnionType",
23464
23464
  types: types2
@@ -25026,7 +25026,7 @@ function createTSUnionType(typeAnnotations) {
25026
25026
  if (flattened.length === 1) {
25027
25027
  return flattened[0];
25028
25028
  } else {
25029
- return tsUnionType(flattened);
25029
+ return tsUnionType$1(flattened);
25030
25030
  }
25031
25031
  }
25032
25032
  function buildUndefinedNode() {
@@ -46990,7 +46990,7 @@ function Identifier$1$1(node, parent, tokenContext, _inForInit, getRawIdentifier
46990
46990
  await: false
46991
46991
  });
46992
46992
  }
46993
- var parens$1 = /* @__PURE__ */ Object.freeze({
46993
+ var parens = /* @__PURE__ */ Object.freeze({
46994
46994
  __proto__: null,
46995
46995
  ArrowFunctionExpression: ConditionalExpression$1,
46996
46996
  AssignmentExpression: AssignmentExpression$1,
@@ -47088,7 +47088,7 @@ function expandAliases(obj) {
47088
47088
  }
47089
47089
  return map;
47090
47090
  }
47091
- var expandedParens = expandAliases(parens$1);
47091
+ var expandedParens = expandAliases(parens);
47092
47092
  var expandedWhitespaceNodes = expandAliases(nodes);
47093
47093
  function isOrHasCallExpression(node) {
47094
47094
  if (isCallExpression$1$1(node)) {
@@ -49835,7 +49835,7 @@ function TSTypePredicate(node) {
49835
49835
  this.print(node.typeAnnotation.typeAnnotation);
49836
49836
  }
49837
49837
  }
49838
- function TSTypeQuery(node) {
49838
+ function TSTypeQuery$1(node) {
49839
49839
  this.word("typeof");
49840
49840
  this.space();
49841
49841
  this.print(node.exprName);
@@ -49874,7 +49874,7 @@ function TSNamedTupleMember$1(node) {
49874
49874
  this.space();
49875
49875
  this.print(node.elementType);
49876
49876
  }
49877
- function TSUnionType(node) {
49877
+ function TSUnionType$2(node) {
49878
49878
  tsPrintUnionOrIntersectionType(this, node, "|");
49879
49879
  }
49880
49880
  function TSIntersectionType$1(node) {
@@ -50457,10 +50457,10 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
50457
50457
  TSTypeParameterDeclaration: TSTypeParameterInstantiation,
50458
50458
  TSTypeParameterInstantiation: TSTypeParameterInstantiation,
50459
50459
  TSTypePredicate: TSTypePredicate,
50460
- TSTypeQuery: TSTypeQuery,
50460
+ TSTypeQuery: TSTypeQuery$1,
50461
50461
  TSTypeReference: TSTypeReference$1,
50462
50462
  TSUndefinedKeyword: TSUndefinedKeyword,
50463
- TSUnionType: TSUnionType,
50463
+ TSUnionType: TSUnionType$2,
50464
50464
  TSUnknownKeyword: TSUnknownKeyword,
50465
50465
  TSVoidKeyword: TSVoidKeyword,
50466
50466
  TaggedTemplateExpression: TaggedTemplateExpression$1,
@@ -79031,12 +79031,13 @@ function isOneArgArrow(path) {
79031
79031
  return param.type === 'Identifier';
79032
79032
  }
79033
79033
 
79034
- var maybeParens$9 = {};
79034
+ var maybeParens$c = {};
79035
79035
 
79036
- maybeParens$9.maybeParens = (print) => ({
79037
- condition(path) {
79038
- return path.node.extra?.parenthesized;
79039
- },
79036
+ const isParens$4 = (path) => path.node.extra?.parenthesized;
79037
+
79038
+ maybeParens$c.isParens = isParens$4;
79039
+ maybeParens$c.maybeParens = (print) => ({
79040
+ condition: isParens$4,
79040
79041
  before(path, {write}) {
79041
79042
  write('(');
79042
79043
  },
@@ -79048,9 +79049,9 @@ maybeParens$9.maybeParens = (print) => ({
79048
79049
 
79049
79050
  const {exists: exists$e} = is$3;
79050
79051
  const {printParams: printParams$c} = params;
79051
- const {maybeParens: maybeParens$8} = maybeParens$9;
79052
+ const {maybeParens: maybeParens$b} = maybeParens$c;
79052
79053
 
79053
- arrowFunctionExpression.ArrowFunctionExpression = maybeParens$8((path, printer, semantics) => {
79054
+ arrowFunctionExpression.ArrowFunctionExpression = maybeParens$b((path, printer, semantics) => {
79054
79055
  const {
79055
79056
  print,
79056
79057
  maybe,
@@ -79306,9 +79307,9 @@ var functionExpression = {};
79306
79307
 
79307
79308
  const {exists: exists$d} = is$3;
79308
79309
  const {printParams: printParams$8} = params;
79309
- const {maybeParens: maybeParens$7} = maybeParens$9;
79310
+ const {maybeParens: maybeParens$a} = maybeParens$c;
79310
79311
 
79311
- functionExpression.FunctionExpression = maybeParens$7((path, printer, semantics) => {
79312
+ functionExpression.FunctionExpression = maybeParens$a((path, printer, semantics) => {
79312
79313
  const {
79313
79314
  print,
79314
79315
  maybe,
@@ -79358,11 +79359,11 @@ var unaryExpressions$1 = {};
79358
79359
 
79359
79360
  const {isLast: isLast$b, isNext: isNext$m} = is$3;
79360
79361
 
79361
- const {maybeParens: maybeParens$6} = maybeParens$9;
79362
+ const {maybeParens: maybeParens$9} = maybeParens$c;
79362
79363
 
79363
79364
  const isWord = (a) => /^(delete|typeof|void|throw)$/.test(a);
79364
79365
 
79365
- const unaryExpression = maybeParens$6((path, printer) => {
79366
+ const unaryExpression = maybeParens$9((path, printer) => {
79366
79367
  const {maybe, traverse} = printer;
79367
79368
  const {prefix, operator} = path.node;
79368
79369
  const argPath = path.get('argument');
@@ -79382,7 +79383,7 @@ unaryExpressions$1.AwaitExpression = (path, {print}) => {
79382
79383
  });
79383
79384
  };
79384
79385
 
79385
- unaryExpressions$1.YieldExpression = maybeParens$6((path, {print, maybe}) => {
79386
+ unaryExpressions$1.YieldExpression = maybeParens$9((path, {print, maybe}) => {
79386
79387
  const {delegate} = path.node;
79387
79388
 
79388
79389
  print(`yield`);
@@ -79495,7 +79496,7 @@ const {chain} = chain$1;
79495
79496
  const {satisfy: satisfy$3} = is$3;
79496
79497
 
79497
79498
  const {maybePrintComputed} = maybePrintComputed$2;
79498
- const {maybeParens: maybeParens$5} = maybeParens$9;
79499
+ const {maybeParens: maybeParens$8} = maybeParens$c;
79499
79500
 
79500
79501
  const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
79501
79502
 
@@ -79530,7 +79531,7 @@ memberExpressions$1.MemberExpression = (path, printer) => {
79530
79531
  maybe.indent.dec(isChain);
79531
79532
  };
79532
79533
 
79533
- memberExpressions$1.OptionalMemberExpression = maybeParens$5((path, {print, maybe}) => {
79534
+ memberExpressions$1.OptionalMemberExpression = maybeParens$8((path, {print, maybe}) => {
79534
79535
  const {computed, optional} = path.node;
79535
79536
 
79536
79537
  print('__object');
@@ -79711,7 +79712,7 @@ _class.ClassDeclaration = {
79711
79712
  var callExpression = {};
79712
79713
 
79713
79714
  const {exists: exists$c} = is$3;
79714
- const {maybeParens: maybeParens$4} = maybeParens$9;
79715
+ const {maybeParens: maybeParens$7} = maybeParens$c;
79715
79716
  const {isArray: isArray$e} = Array;
79716
79717
 
79717
79718
  const parseArgs = (path) => {
@@ -79723,7 +79724,7 @@ const parseArgs = (path) => {
79723
79724
  return argsPath;
79724
79725
  };
79725
79726
 
79726
- const CallExpression$1 = maybeParens$4((path, {indent, print, maybe, traverse}) => {
79727
+ const CallExpression$1 = maybeParens$7((path, {indent, print, maybe, traverse}) => {
79727
79728
  const args = parseArgs(path);
79728
79729
  const isParentCall = tooLong$1(args) && path.parentPath.isCallExpression();
79729
79730
 
@@ -79926,7 +79927,7 @@ objectExpression.ObjectExpression = (path, printer, semantics) => {
79926
79927
 
79927
79928
  const properties = path.get('properties');
79928
79929
  const {length} = properties;
79929
- const parens = isParens$5(path);
79930
+ const parens = isParens$3(path);
79930
79931
  const manyLines = !isOneLine$1(path);
79931
79932
 
79932
79933
  maybe.print(parens, '(');
@@ -80031,7 +80032,7 @@ function isOneLine$1(path) {
80031
80032
  return !isValue(path);
80032
80033
  }
80033
80034
 
80034
- function isParens$5(path) {
80035
+ function isParens$3(path) {
80035
80036
  if (isBodyOfArrow(path))
80036
80037
  return true;
80037
80038
 
@@ -80040,7 +80041,7 @@ function isParens$5(path) {
80040
80041
 
80041
80042
  var objectProperty = {};
80042
80043
 
80043
- var concatanate$1 = {};
80044
+ var concatenate$1 = {};
80044
80045
 
80045
80046
  const {
80046
80047
  isStringLiteral: isStringLiteral$7,
@@ -80055,7 +80056,7 @@ const isStringLike = (a) => {
80055
80056
  return isTemplateLiteral$3(a);
80056
80057
  };
80057
80058
 
80058
- concatanate$1.isConcatenation = (path) => {
80059
+ concatenate$1.isConcatenation = (path) => {
80059
80060
  const {parentPath} = path;
80060
80061
  const {operator} = path.node;
80061
80062
 
@@ -80077,7 +80078,7 @@ concatanate$1.isConcatenation = (path) => {
80077
80078
  return isBinaryExpression(left) && isStringLike(right);
80078
80079
  };
80079
80080
 
80080
- concatanate$1.concatanate = (path, {print, indent}) => {
80081
+ concatenate$1.concatenate = (path, {print, indent}) => {
80081
80082
  if (!path.parentPath.isBinaryExpression()) {
80082
80083
  indent.inc();
80083
80084
  print.breakline();
@@ -80093,7 +80094,7 @@ concatanate$1.concatanate = (path, {print, indent}) => {
80093
80094
  indent.dec();
80094
80095
  };
80095
80096
 
80096
- const {isConcatenation: isConcatenation$2} = concatanate$1;
80097
+ const {isConcatenation: isConcatenation$2} = concatenate$1;
80097
80098
  const {isOneLine} = objectExpression;
80098
80099
  const {printKey: printKey$4} = printKey$7;
80099
80100
 
@@ -80475,22 +80476,7 @@ var assignmentExpression = {};
80475
80476
 
80476
80477
  var maybeWriteBrace$3 = {};
80477
80478
 
80478
- var parens = {};
80479
-
80480
- const isParens$4 = (path) => path.node.extra?.parenthesized;
80481
-
80482
- parens.isParens = isParens$4;
80483
-
80484
- parens.maybeParenOpen = (path, {maybe}) => {
80485
- maybe.write(isParens$4(path), '(');
80486
- };
80487
-
80488
- parens.maybeParenClose = (path, {maybe}) => {
80489
- maybe.write(isParens$4(path), ')');
80490
- };
80491
-
80492
- const {isParens: isParens$3} = parens;
80493
-
80479
+ const {isParens: isParens$2} = maybeParens$c;
80494
80480
  maybeWriteBrace$3.maybePrintLeftBrace = (path, printer, semantics) => {
80495
80481
  maybeWriteBrace$2(path, printer, semantics, {
80496
80482
  brace: '(',
@@ -80527,7 +80513,7 @@ function maybeWriteBrace$2(path, printer, semantics, {brace}) {
80527
80513
  if (!roundBraces.assign)
80528
80514
  return;
80529
80515
 
80530
- if (!isParens$3(path))
80516
+ if (!isParens$2(path))
80531
80517
  return;
80532
80518
 
80533
80519
  write(brace);
@@ -80643,7 +80629,8 @@ const {
80643
80629
  isClassMethod,
80644
80630
  isTemplateLiteral: isTemplateLiteral$2,
80645
80631
  isJSXText: isJSXText$3,
80646
- isJSXAttribute: isJSXAttribute$1,
80632
+ isJSXAttribute: isJSXAttribute$2,
80633
+ isJSXIdentifier: isJSXIdentifier$2,
80647
80634
  isTSTypeReference: isTSTypeReference$2,
80648
80635
  isTSTypeParameter,
80649
80636
  } = types$q;
@@ -80656,6 +80643,9 @@ function extract$5(node) {
80656
80643
  if (isIdentifier$7(node))
80657
80644
  return node.name;
80658
80645
 
80646
+ if (isJSXIdentifier$2(node))
80647
+ return node.name;
80648
+
80659
80649
  if (isRegExpLiteral$1(node))
80660
80650
  return node.pattern;
80661
80651
 
@@ -80677,7 +80667,7 @@ function extract$5(node) {
80677
80667
  if (isJSXText$3(node))
80678
80668
  return node.value;
80679
80669
 
80680
- if (isJSXAttribute$1(node))
80670
+ if (isJSXAttribute$2(node))
80681
80671
  return node.name.name;
80682
80672
 
80683
80673
  if (isClassMethod(node))
@@ -80697,6 +80687,7 @@ function extract$5(node) {
80697
80687
  'RegExpLiteral',
80698
80688
  'ArrayExpression',
80699
80689
  'MemberExpression',
80690
+ 'JSXIdentifier',
80700
80691
  'JSXAttribute',
80701
80692
  'JSXText',
80702
80693
  'TSTypeParameter',
@@ -82149,16 +82140,16 @@ maybeSpace$1.maybeSpace = (path, {print}) => {
82149
82140
  };
82150
82141
 
82151
82142
  const {
82152
- concatanate,
82143
+ concatenate,
82153
82144
  isConcatenation: isConcatenation$1,
82154
- } = concatanate$1;
82145
+ } = concatenate$1;
82155
82146
 
82156
82147
  const {maybeSpace} = maybeSpace$1;
82157
- const {isParens: isParens$2} = parens;
82148
+ const {isParens: isParens$1} = maybeParens$c;
82158
82149
 
82159
82150
  const BinaryExpression$1 = {
82160
82151
  condition(path) {
82161
- if (isParens$2(path))
82152
+ if (isParens$1(path))
82162
82153
  return true;
82163
82154
 
82164
82155
  return path.parentPath.isAwaitExpression();
@@ -82186,7 +82177,7 @@ const BinaryExpression$1 = {
82186
82177
  }
82187
82178
 
82188
82179
  if (isConcatenation$1(path))
82189
- return concatanate(path, {
82180
+ return concatenate(path, {
82190
82181
  print,
82191
82182
  indent,
82192
82183
  maybe,
@@ -82210,28 +82201,19 @@ binaryExpression.LogicalExpression = BinaryExpression$1;
82210
82201
 
82211
82202
  var conditionalExpression = {};
82212
82203
 
82213
- const {isParens: isParens$1} = parens;
82204
+ const {maybeParens: maybeParens$6} = maybeParens$c;
82214
82205
 
82215
- conditionalExpression.ConditionalExpression = {
82216
- condition: isParens$1,
82217
- before(path, {print}) {
82218
- print('(');
82219
- },
82220
- print(path, {print}) {
82221
- print('__test');
82222
- print.space();
82223
- print('?');
82224
- print.space();
82225
- print('__consequent');
82226
- print.space();
82227
- print(':');
82228
- print.space();
82229
- print('__alternate');
82230
- },
82231
- after(path, {print}) {
82232
- print(')');
82233
- },
82234
- };
82206
+ conditionalExpression.ConditionalExpression = maybeParens$6((path, {print}) => {
82207
+ print('__test');
82208
+ print.space();
82209
+ print('?');
82210
+ print.space();
82211
+ print('__consequent');
82212
+ print.space();
82213
+ print(':');
82214
+ print.space();
82215
+ print('__alternate');
82216
+ });
82235
82217
 
82236
82218
  var staticBlock = {};
82237
82219
 
@@ -82660,7 +82642,7 @@ const {hasPrevNewline: hasPrevNewline$2} = mark;
82660
82642
  const {isExportDeclaration: isExportDeclaration$3} = bundle.types;
82661
82643
  const {maybeSpaceAfterKeyword: maybeSpaceAfterKeyword$2} = maybeSpaceAfterKeyword$3;
82662
82644
 
82663
- const {isConcatenation} = concatanate$1;
82645
+ const {isConcatenation} = concatenate$1;
82664
82646
  const {parseLeadingComments: parseLeadingComments$2} = comment;
82665
82647
  const {maybeDeclare: maybeDeclare$4} = maybeDeclare$6;
82666
82648
 
@@ -84138,10 +84120,10 @@ maybeGet.maybeDecorators = (path) => {
84138
84120
  };
84139
84121
 
84140
84122
  const {maybeDecorators} = maybeGet;
84141
- const {maybeParens: maybeParens$3} = maybeParens$9;
84123
+ const {maybeParens: maybeParens$5} = maybeParens$c;
84142
84124
  const {maybeTypeAnnotation} = maybeTypeAnnotation$4;
84143
84125
 
84144
- identifier.Identifier = maybeParens$3(maybeTypeAnnotation((path, printer) => {
84126
+ identifier.Identifier = maybeParens$5(maybeTypeAnnotation((path, printer) => {
84145
84127
  const {
84146
84128
  write,
84147
84129
  maybe,
@@ -84618,13 +84600,13 @@ tsInterfaceDeclaration.TSInterfaceDeclaration = {
84618
84600
 
84619
84601
  var tsAsExpression = {};
84620
84602
 
84621
- const {maybeParens: maybeParens$2} = maybeParens$9;
84603
+ const {maybeParens: maybeParens$4} = maybeParens$c;
84622
84604
  const {
84623
84605
  isVariableDeclarator,
84624
84606
  isObjectExpression: isObjectExpression$1,
84625
84607
  } = bundle.types;
84626
84608
 
84627
- tsAsExpression.TSAsExpression = maybeParens$2((path, {print, maybe}) => {
84609
+ tsAsExpression.TSAsExpression = maybeParens$4((path, {print, maybe}) => {
84628
84610
  const is = isParens(path);
84629
84611
 
84630
84612
  maybe.print(is, '(');
@@ -84752,9 +84734,9 @@ printReturnType$5.printReturnType = (path, {traverse}) => {
84752
84734
  const {printParams: printParams$5} = params;
84753
84735
  const {printReturnType: printReturnType$4} = printReturnType$5;
84754
84736
 
84755
- const {maybeParens: maybeParens$1} = maybeParens$9;
84737
+ const {maybeParens: maybeParens$3} = maybeParens$c;
84756
84738
 
84757
- tsFunctionType.TSFunctionType = maybeParens$1((path, printer, semantics) => {
84739
+ tsFunctionType.TSFunctionType = maybeParens$3((path, printer, semantics) => {
84758
84740
  const {print} = printer;
84759
84741
 
84760
84742
  printParams$5(path, printer, semantics);
@@ -84947,6 +84929,48 @@ tsMethodSignature.TSMethodSignature = (path, printer, semantics) => {
84947
84929
  write.newline();
84948
84930
  };
84949
84931
 
84932
+ var tsUnionType = {};
84933
+
84934
+ const {maybeParens: maybeParens$2} = maybeParens$c;
84935
+ const insideTypeDeclaration = ({parentPath}) => parentPath.isTSTypeAliasDeclaration();
84936
+
84937
+ tsUnionType.TSUnionType = maybeParens$2((path, printer, {maxTypesInOneLine}) => {
84938
+ const types = path.get('types');
84939
+ const {length} = types;
84940
+
84941
+ if (!insideTypeDeclaration(path) || length <= maxTypesInOneLine)
84942
+ printInOneLine(types, printer);
84943
+ else
84944
+ printInCoupleLines(types, printer);
84945
+ });
84946
+
84947
+ function printInOneLine(types, {traverse, write}) {
84948
+ const n = types.length - 1;
84949
+
84950
+ for (const [i, type] of types.entries()) {
84951
+ traverse(type);
84952
+
84953
+ if (i < n) {
84954
+ write.space();
84955
+ write('|');
84956
+ write.space();
84957
+ }
84958
+ }
84959
+ }
84960
+
84961
+ function printInCoupleLines(types, {traverse, write, indent}) {
84962
+ indent.inc();
84963
+
84964
+ for (const type of types) {
84965
+ write.breakline();
84966
+ write('|');
84967
+ write.space();
84968
+ traverse(type);
84969
+ }
84970
+
84971
+ indent.dec();
84972
+ }
84973
+
84950
84974
  var tsImportType = {};
84951
84975
 
84952
84976
  const {createImportExpression} = importExpression;
@@ -84982,9 +85006,9 @@ tsTypeReference.TSTypeReference = (path, {print}) => {
84982
85006
 
84983
85007
  var tsInferType = {};
84984
85008
 
84985
- const {maybeParens} = maybeParens$9;
85009
+ const {maybeParens: maybeParens$1} = maybeParens$c;
84986
85010
 
84987
- tsInferType.TSInferType = maybeParens((path, {print}) => {
85011
+ tsInferType.TSInferType = maybeParens$1((path, {print}) => {
84988
85012
  print('infer ');
84989
85013
  print('__typeParameter');
84990
85014
  });
@@ -85026,6 +85050,15 @@ tsParameterProperty.TSParameterProperty = (path, {print, maybe}) => {
85026
85050
  maybe.print.breakline(decoratorsLength);
85027
85051
  };
85028
85052
 
85053
+ var tsTypeQuery = {};
85054
+
85055
+ const {maybeParens} = maybeParens$c;
85056
+
85057
+ tsTypeQuery.TSTypeQuery = maybeParens((path, {print}) => {
85058
+ print('typeof ');
85059
+ print('__exprName');
85060
+ });
85061
+
85029
85062
  const {isNext: isNext$1} = is$3;
85030
85063
  const {TSTypeLiteral} = tsTypeLiteral;
85031
85064
  const {TSTypeAliasDeclaration} = tsTypeAliasDeclaration;
@@ -85055,11 +85088,7 @@ const {TSConstructorType} = tsConstructorType;
85055
85088
  const {TSCallSignatureDeclaration} = tsCallSignatureDeclaration;
85056
85089
  const {TSConstructSignatureDeclaration} = tsConstructSignatureDeclaration;
85057
85090
  const {TSMethodSignature} = tsMethodSignature;
85058
-
85059
- const {
85060
- maybeParenOpen,
85061
- maybeParenClose,
85062
- } = parens;
85091
+ const {TSUnionType} = tsUnionType;
85063
85092
 
85064
85093
  const {maybePrintTypeAnnotation} = maybeTypeAnnotation$4;
85065
85094
  const {TSImportType} = tsImportType;
@@ -85067,6 +85096,7 @@ const {TSExportAssignment} = tsExportAssignment;
85067
85096
  const {TSTypeReference} = tsTypeReference;
85068
85097
  const {TSInferType} = tsInferType;
85069
85098
  const {TSParameterProperty} = tsParameterProperty;
85099
+ const {TSTypeQuery} = tsTypeQuery;
85070
85100
 
85071
85101
  var typescript$1 = {
85072
85102
  TSAsExpression,
@@ -85081,6 +85111,8 @@ var typescript$1 = {
85081
85111
  TSModuleBlock,
85082
85112
  TSIntersectionType,
85083
85113
  TSImportType,
85114
+ TSUnionType,
85115
+ TSTypeQuery,
85084
85116
  TSBigIntKeyword(path, {write}) {
85085
85117
  write('bigint');
85086
85118
  },
@@ -85090,10 +85122,6 @@ var typescript$1 = {
85090
85122
  TSSymbolKeyword(path, {write}) {
85091
85123
  write('symbol');
85092
85124
  },
85093
- TSTypeQuery(path, {print}) {
85094
- print('typeof ');
85095
- print('__exprName');
85096
- },
85097
85125
  TSNeverKeyword(path, {write}) {
85098
85126
  write('never');
85099
85127
  },
@@ -85153,26 +85181,6 @@ var typescript$1 = {
85153
85181
  print(' satisfies ');
85154
85182
  print('__typeAnnotation');
85155
85183
  },
85156
- TSUnionType(path, printer) {
85157
- const {traverse, write} = printer;
85158
-
85159
- const types = path.get('types');
85160
- const n = types.length - 1;
85161
-
85162
- maybeParenOpen(path, printer);
85163
-
85164
- for (const [i, type] of types.entries()) {
85165
- traverse(type);
85166
-
85167
- if (i < n) {
85168
- write.space();
85169
- write('|');
85170
- write.space();
85171
- }
85172
- }
85173
-
85174
- maybeParenClose(path, printer);
85175
- },
85176
85184
  TSNumberKeyword(path, {write}) {
85177
85185
  write('number');
85178
85186
  },
@@ -85722,6 +85730,7 @@ function initSemantics(semantics = {}) {
85722
85730
  maxSpecifiersInOneLine: 2,
85723
85731
  maxElementsInOneLine: 5,
85724
85732
  maxVariablesInOneLine: 4,
85733
+ maxTypesInOneLine: 3,
85725
85734
  trailingComma: true,
85726
85735
  encodeSingleQuote: true,
85727
85736
  encodeDoubleQuote: false,
@@ -114820,8 +114829,8 @@ const {
114820
114829
  isExportSpecifier,
114821
114830
  isRegExpLiteral,
114822
114831
  isJSXText: isJSXText$2,
114823
- isJSXIdentifier,
114824
- isJSXAttribute,
114832
+ isJSXIdentifier: isJSXIdentifier$1,
114833
+ isJSXAttribute: isJSXAttribute$1,
114825
114834
  isTSTypeReference: isTSTypeReference$1,
114826
114835
  isTSTypeParameterDeclaration,
114827
114836
  } = types$f;
@@ -115002,10 +115011,10 @@ is$2.isJSXChildren = (a) => {
115002
115011
  is$2.isJSXAttributes = (a) => {
115003
115012
  const b = !isArray$6(a) ? a : a[0];
115004
115013
 
115005
- if (!isJSXAttribute(b))
115014
+ if (!isJSXAttribute$1(b))
115006
115015
  return false;
115007
115016
 
115008
- return isJSXIdentifier(b.name, {
115017
+ return isJSXIdentifier$1(b.name, {
115009
115018
  name: JSX_ATTRIBUTES,
115010
115019
  });
115011
115020
  };
@@ -115139,7 +115148,7 @@ is$2.isLinkedNode = (a) => {
115139
115148
  if (isJSXText$2(a) && LINKED_NODE.test(a.value))
115140
115149
  return true;
115141
115150
 
115142
- if (isJSXIdentifier(a) && LINKED_NODE.test(a.name))
115151
+ if (isJSXIdentifier$1(a) && LINKED_NODE.test(a.name))
115143
115152
  return true;
115144
115153
 
115145
115154
  if (isTemplateElement$2(a) && LINKED_NODE.test(a.value.raw))
@@ -115188,6 +115197,7 @@ const {
115188
115197
  isIdentifier: isIdentifier$3,
115189
115198
  isStatement: isStatement$1,
115190
115199
  isJSXElement,
115200
+ isJSXAttribute,
115191
115201
  isStringLiteral: isStringLiteral$3,
115192
115202
  isTemplateLiteral: isTemplateLiteral$1,
115193
115203
  TemplateElement,
@@ -115231,12 +115241,15 @@ function findVarsWays$2(node) {
115231
115241
 
115232
115242
  traverse$7(node, {
115233
115243
  noScope: true,
115234
- 'Identifier|BooleanLiteral|StringLiteral|TemplateElement|RegExpLiteral|JSXText|JSXAttribute|TSTypeReference|TSTypeParameter'(path) {
115244
+ 'Identifier|JSXIdentifier|BooleanLiteral|StringLiteral|TemplateElement|RegExpLiteral|JSXText|JSXAttribute|TSTypeReference|TSTypeParameter'(path) {
115235
115245
  if (isInsideTypeReference(path))
115236
115246
  return;
115237
115247
 
115238
115248
  const {node} = path;
115239
115249
 
115250
+ if (isJSXAttribute(path.parentPath) && path.parentPath.node.name === node)
115251
+ return;
115252
+
115240
115253
  const way = [];
115241
115254
  const name = extract(node);
115242
115255
 
@@ -115394,13 +115407,14 @@ const {
115394
115407
  isTemplateElement: isTemplateElement$1,
115395
115408
  isTSTypeReference,
115396
115409
  isJSXText: isJSXText$1,
115410
+ isJSXIdentifier,
115397
115411
  } = types$d;
115398
115412
 
115399
115413
  const parseName = (node) => {
115400
115414
  node = node[0] || node;
115401
115415
  const {name, value} = node;
115402
115416
 
115403
- if (isIdentifier$2(node))
115417
+ if (isIdentifier$2(node) || isJSXIdentifier(node))
115404
115418
  return name;
115405
115419
 
115406
115420
  if (isLiteral(node))
@@ -115414,6 +115428,8 @@ const parseName = (node) => {
115414
115428
 
115415
115429
  if (isJSXText$1(node))
115416
115430
  return node.value;
115431
+
115432
+ throw Error(`☝️ Looks like type of node '${node.type}' not supported by 'compare -> link -> parseName()'`);
115417
115433
  };
115418
115434
 
115419
115435
  link$1.exports = ({add, value, nodeValue, templateStore}) => {
@@ -115603,7 +115619,9 @@ function compareTemplateElements(node, template) {
115603
115619
  }
115604
115620
 
115605
115621
  function linkNodes(node, template, {add, templateStore}) {
115606
- if (node && isLinkedNode$1(template) || isLinkedArgs(template) || isLinkedId$1(node, template) || isLinkedBool(node, template))
115622
+ const is = node && (isLinkedNode$1(template) || isLinkedArgs(template) || isLinkedId$1(node, template) || isLinkedBool(node, template));
115623
+
115624
+ if (is)
115607
115625
  return link({
115608
115626
  add,
115609
115627
  value: template,