@putout/bundle 3.19.1 → 3.20.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
@@ -9008,7 +9008,7 @@ __export(lib_exports, {
9008
9008
  return labeledStatement;
9009
9009
  },
9010
9010
  LogicalExpression: function() {
9011
- return logicalExpression;
9011
+ return logicalExpression$1;
9012
9012
  },
9013
9013
  METHOD_TYPES: function() {
9014
9014
  return METHOD_TYPES;
@@ -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;
@@ -11393,7 +11393,7 @@ __export(lib_exports, {
11393
11393
  return isRestProperty;
11394
11394
  },
11395
11395
  isReturnStatement: function() {
11396
- return isReturnStatement;
11396
+ return isReturnStatement$1;
11397
11397
  },
11398
11398
  isScopable: function() {
11399
11399
  return isScopable;
@@ -11744,7 +11744,7 @@ __export(lib_exports, {
11744
11744
  return isVariableDeclaration$2;
11745
11745
  },
11746
11746
  isVariableDeclarator: function() {
11747
- return isVariableDeclarator$3;
11747
+ return isVariableDeclarator$4;
11748
11748
  },
11749
11749
  isVariance: function() {
11750
11750
  return isVariance;
@@ -11813,7 +11813,7 @@ __export(lib_exports, {
11813
11813
  return labeledStatement;
11814
11814
  },
11815
11815
  logicalExpression: function() {
11816
- return logicalExpression;
11816
+ return logicalExpression$1;
11817
11817
  },
11818
11818
  matchesPattern: function() {
11819
11819
  return matchesPattern$1;
@@ -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;
@@ -13838,7 +13838,7 @@ function isRestElement(node, opts) {
13838
13838
  if (node.type !== "RestElement") return false;
13839
13839
  return opts == null || shallowEqual(node, opts);
13840
13840
  }
13841
- function isReturnStatement(node, opts) {
13841
+ function isReturnStatement$1(node, opts) {
13842
13842
  if (!node) return false;
13843
13843
  if (node.type !== "ReturnStatement") return false;
13844
13844
  return opts == null || shallowEqual(node, opts);
@@ -13893,7 +13893,7 @@ function isVariableDeclaration$2(node, opts) {
13893
13893
  if (node.type !== "VariableDeclaration") return false;
13894
13894
  return opts == null || shallowEqual(node, opts);
13895
13895
  }
13896
- function isVariableDeclarator$3(node, opts) {
13896
+ function isVariableDeclarator$4(node, opts) {
13897
13897
  if (!node) return false;
13898
13898
  if (node.type !== "VariableDeclarator") return false;
13899
13899
  return opts == null || shallowEqual(node, opts);
@@ -16319,7 +16319,7 @@ function validateOptionalType() {
16319
16319
  };
16320
16320
  }
16321
16321
  function arrayOf(elementType) {
16322
- return chain$2(assertValueType("array"), assertEach(elementType));
16322
+ return chain$4(assertValueType("array"), assertEach(elementType));
16323
16323
  }
16324
16324
  function arrayOfType() {
16325
16325
  for(var _len = arguments.length, typeNames = new Array(_len), _key = 0; _key < _len; _key++){
@@ -16494,7 +16494,7 @@ function assertOptionalChainStart() {
16494
16494
  }
16495
16495
  return validate4;
16496
16496
  }
16497
- function chain$2() {
16497
+ function chain$4() {
16498
16498
  for(var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++){
16499
16499
  fns[_key] = arguments[_key];
16500
16500
  }
@@ -16735,7 +16735,7 @@ var utils$1 = /* @__PURE__ */ Object.freeze({
16735
16735
  assertOptionalChainStart: assertOptionalChainStart,
16736
16736
  assertShape: assertShape,
16737
16737
  assertValueType: assertValueType,
16738
- chain: chain$2,
16738
+ chain: chain$4,
16739
16739
  default: defineType$5,
16740
16740
  defineAliasedType: defineAliasedType,
16741
16741
  validate: validate$2$1,
@@ -17253,7 +17253,7 @@ defineType$4("Identifier", {
17253
17253
  ],
17254
17254
  fields: Object.assign({}, patternLikeCommon(), {
17255
17255
  name: {
17256
- validate: chain$2(assertValueType("string"), Object.assign(function(node, key, val) {
17256
+ validate: chain$4(assertValueType("string"), Object.assign(function(node, key, val) {
17257
17257
  if (!isValidIdentifier(val, false)) {
17258
17258
  throw new TypeError('"'.concat(val, '" is not a valid identifier name'));
17259
17259
  }
@@ -17354,7 +17354,7 @@ defineType$4("NumericLiteral", {
17354
17354
  deprecatedAlias: "NumberLiteral",
17355
17355
  fields: {
17356
17356
  value: {
17357
- validate: chain$2(assertValueType("number"), Object.assign(function(node, key, val) {
17357
+ validate: chain$4(assertValueType("number"), Object.assign(function(node, key, val) {
17358
17358
  if (1 / val < 0 || !Number.isFinite(val)) {
17359
17359
  var error = new Error("NumericLiterals must be non-negative finite numbers. You can use t.valueToNode(".concat(val, ") instead."));
17360
17360
  {
@@ -17417,7 +17417,7 @@ defineType$4("RegExpLiteral", {
17417
17417
  validate: assertValueType("string")
17418
17418
  },
17419
17419
  flags: {
17420
- validate: chain$2(assertValueType("string"), Object.assign(function(node, key, val) {
17420
+ validate: chain$4(assertValueType("string"), Object.assign(function(node, key, val) {
17421
17421
  var invalid = /[^gimsuy]/.exec(val);
17422
17422
  if (invalid) {
17423
17423
  throw new TypeError('"'.concat(invalid[0], '" is not a valid RegExp flag'));
@@ -17637,7 +17637,7 @@ defineType$4("ObjectProperty", {
17637
17637
  validate: assertNodeType("Expression", "PatternLike")
17638
17638
  },
17639
17639
  shorthand: {
17640
- validate: chain$2(assertValueType("boolean"), Object.assign(function(node, key, shorthand) {
17640
+ validate: chain$4(assertValueType("boolean"), Object.assign(function(node, key, shorthand) {
17641
17641
  if (!shorthand) return;
17642
17642
  if (node.computed) {
17643
17643
  throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");
@@ -17803,7 +17803,7 @@ defineType$4("TryStatement", {
17803
17803
  ],
17804
17804
  fields: {
17805
17805
  block: {
17806
- validate: chain$2(assertNodeType("BlockStatement"), Object.assign(function(node) {
17806
+ validate: chain$4(assertNodeType("BlockStatement"), Object.assign(function(node) {
17807
17807
  if (!node.handler && !node.finalizer) {
17808
17808
  throw new TypeError("TryStatement expects either a handler or finalizer, or both");
17809
17809
  }
@@ -18011,7 +18011,7 @@ defineType$4("ArrayPattern", {
18011
18011
  ],
18012
18012
  fields: Object.assign({}, patternLikeCommon(), {
18013
18013
  elements: {
18014
- validate: chain$2(assertValueType("array"), assertEach(assertNodeOrValueType("null", "PatternLike", "LVal")))
18014
+ validate: chain$4(assertValueType("array"), assertEach(assertNodeOrValueType("null", "PatternLike", "LVal")))
18015
18015
  }
18016
18016
  })
18017
18017
  });
@@ -18237,7 +18237,7 @@ defineType$4("ExportNamedDeclaration", {
18237
18237
  fields: Object.assign({
18238
18238
  declaration: {
18239
18239
  optional: true,
18240
- validate: chain$2(assertNodeType("Declaration"), Object.assign(function(node, key, val) {
18240
+ validate: chain$4(assertNodeType("Declaration"), Object.assign(function(node, key, val) {
18241
18241
  if (val && node.specifiers.length) {
18242
18242
  throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");
18243
18243
  }
@@ -18470,7 +18470,7 @@ defineType$4("MetaProperty", {
18470
18470
  ],
18471
18471
  fields: {
18472
18472
  meta: {
18473
- validate: chain$2(assertNodeType("Identifier"), Object.assign(function(node, key, val) {
18473
+ validate: chain$4(assertNodeType("Identifier"), Object.assign(function(node, key, val) {
18474
18474
  var property;
18475
18475
  switch(val.name){
18476
18476
  case "function":
@@ -18523,7 +18523,7 @@ var classMethodOrPropertyCommon = function() {
18523
18523
  optional: true
18524
18524
  },
18525
18525
  key: {
18526
- validate: chain$2(function() {
18526
+ validate: chain$4(function() {
18527
18527
  var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral");
18528
18528
  var computed = assertNodeType("Expression");
18529
18529
  return function(node, key, val) {
@@ -18542,7 +18542,7 @@ var classMethodOrDeclareMethodCommon = function() {
18542
18542
  default: "method"
18543
18543
  },
18544
18544
  access: {
18545
- validate: chain$2(assertValueType("string"), assertOneOf("public", "private", "protected")),
18545
+ validate: chain$4(assertValueType("string"), assertOneOf("public", "private", "protected")),
18546
18546
  optional: true
18547
18547
  },
18548
18548
  decorators: {
@@ -18649,7 +18649,7 @@ defineType$4("TemplateElement", {
18649
18649
  ],
18650
18650
  fields: {
18651
18651
  value: {
18652
- validate: chain$2(assertShape({
18652
+ validate: chain$4(assertShape({
18653
18653
  raw: {
18654
18654
  validate: assertValueType("string")
18655
18655
  },
@@ -18695,7 +18695,7 @@ defineType$4("TemplateLiteral", {
18695
18695
  fields: {
18696
18696
  quasis: validateArrayOfType("TemplateElement"),
18697
18697
  expressions: {
18698
- validate: chain$2(assertValueType("array"), assertEach(assertNodeType("Expression", "TSType")), function(node, key, val) {
18698
+ validate: chain$4(assertValueType("array"), assertEach(assertNodeType("Expression", "TSType")), function(node, key, val) {
18699
18699
  if (node.quasis.length !== val.length + 1) {
18700
18700
  throw new TypeError("Number of ".concat(node.type, " quasis should be exactly one more than the number of expressions.\nExpected ").concat(val.length + 1, " quasis but got ").concat(node.quasis.length));
18701
18701
  }
@@ -18717,7 +18717,7 @@ defineType$4("YieldExpression", {
18717
18717
  ],
18718
18718
  fields: {
18719
18719
  delegate: {
18720
- validate: chain$2(assertValueType("boolean"), Object.assign(function(node, key, val) {
18720
+ validate: chain$4(assertValueType("boolean"), Object.assign(function(node, key, val) {
18721
18721
  if (val && !node.argument) {
18722
18722
  throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument");
18723
18723
  }
@@ -18821,7 +18821,7 @@ defineType$4("OptionalMemberExpression", {
18821
18821
  default: false
18822
18822
  },
18823
18823
  optional: {
18824
- validate: chain$2(assertValueType("boolean"), assertOptionalChainStart())
18824
+ validate: chain$4(assertValueType("boolean"), assertOptionalChainStart())
18825
18825
  }
18826
18826
  }
18827
18827
  });
@@ -18846,7 +18846,7 @@ defineType$4("OptionalCallExpression", {
18846
18846
  },
18847
18847
  arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder"),
18848
18848
  optional: {
18849
- validate: chain$2(assertValueType("boolean"), assertOptionalChainStart())
18849
+ validate: chain$4(assertValueType("boolean"), assertOptionalChainStart())
18850
18850
  },
18851
18851
  typeArguments: {
18852
18852
  validate: assertNodeType("TypeParameterInstantiation"),
@@ -18928,7 +18928,7 @@ defineType$4("ClassAccessorProperty", {
18928
18928
  ],
18929
18929
  fields: Object.assign({}, classMethodOrPropertyCommon(), {
18930
18930
  key: {
18931
- validate: chain$2(function() {
18931
+ validate: chain$4(function() {
18932
18932
  var normal = assertNodeType("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName");
18933
18933
  var computed = assertNodeType("Expression");
18934
18934
  return function(node, key, val) {
@@ -21474,7 +21474,7 @@ function regExpLiteral(pattern) {
21474
21474
  validate$4(defs.flags, node, "flags", flags);
21475
21475
  return node;
21476
21476
  }
21477
- function logicalExpression(operator, left, right) {
21477
+ function logicalExpression$1(operator, left, right) {
21478
21478
  var node = {
21479
21479
  type: "LogicalExpression",
21480
21480
  operator: operator,
@@ -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",
@@ -25944,7 +25944,7 @@ function getFunctionName(node, parent) {
25944
25944
  id = getObjectMemberKey(node);
25945
25945
  if (node.kind === "get") prefix2 = "get ";
25946
25946
  else if (node.kind === "set") prefix2 = "set ";
25947
- } else if (isVariableDeclarator$3(parent, {
25947
+ } else if (isVariableDeclarator$4(parent, {
25948
25948
  init: node
25949
25949
  })) {
25950
25950
  id = parent.id;
@@ -29368,7 +29368,7 @@ var CommentsParser = /*#__PURE__*/ function(BaseParser) {
29368
29368
  }(BaseParser);
29369
29369
  var lineBreak = /\r\n|[\r\n\u2028\u2029]/;
29370
29370
  var lineBreakG = new RegExp(lineBreak.source, "g");
29371
- function isNewLine(code2) {
29371
+ function isNewLine$1(code2) {
29372
29372
  switch(code2){
29373
29373
  case 10:
29374
29374
  case 13:
@@ -29381,7 +29381,7 @@ function isNewLine(code2) {
29381
29381
  }
29382
29382
  function hasNewLine(input, start, end) {
29383
29383
  for(var i = start; i < end; i++){
29384
- if (isNewLine(input.charCodeAt(i))) {
29384
+ if (isNewLine$1(input.charCodeAt(i))) {
29385
29385
  return true;
29386
29386
  }
29387
29387
  }
@@ -30186,7 +30186,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
30186
30186
  if (!this.isLookahead) startLoc = this.state.curPosition();
30187
30187
  var ch = this.input.charCodeAt(this.state.pos += startSkip);
30188
30188
  if (this.state.pos < this.length) {
30189
- while(!isNewLine(ch) && ++this.state.pos < this.length){
30189
+ while(!isNewLine$1(ch) && ++this.state.pos < this.length){
30190
30190
  ch = this.input.charCodeAt(this.state.pos);
30191
30191
  }
30192
30192
  }
@@ -30382,7 +30382,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
30382
30382
  if (ch !== 33) return false;
30383
30383
  var start = this.state.pos;
30384
30384
  this.state.pos += 1;
30385
- while(!isNewLine(ch) && ++this.state.pos < this.length){
30385
+ while(!isNewLine$1(ch) && ++this.state.pos < this.length){
30386
30386
  ch = this.input.charCodeAt(this.state.pos);
30387
30387
  }
30388
30388
  var value1 = this.input.slice(start + 2, this.state.pos);
@@ -30724,7 +30724,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
30724
30724
  throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
30725
30725
  }
30726
30726
  var ch = this.input.charCodeAt(pos);
30727
- if (isNewLine(ch)) {
30727
+ if (isNewLine$1(ch)) {
30728
30728
  throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
30729
30729
  }
30730
30730
  if (escaped) {
@@ -35054,7 +35054,7 @@ var jsx$3 = function(superClass) {
35054
35054
  });
35055
35055
  }
35056
35056
  default:
35057
- if (isNewLine(ch)) {
35057
+ if (isNewLine$1(ch)) {
35058
35058
  out += this.input.slice(chunkStart, this.state.pos);
35059
35059
  out += this.jsxReadNewLine(true);
35060
35060
  chunkStart = this.state.pos;
@@ -35097,7 +35097,7 @@ var jsx$3 = function(superClass) {
35097
35097
  out += this.input.slice(chunkStart, this.state.pos);
35098
35098
  out += this.jsxReadEntity();
35099
35099
  chunkStart = this.state.pos;
35100
- } else if (isNewLine(ch)) {
35100
+ } else if (isNewLine$1(ch)) {
35101
35101
  out += this.input.slice(chunkStart, this.state.pos);
35102
35102
  out += this.jsxReadNewLine(false);
35103
35103
  chunkStart = this.state.pos;
@@ -46897,7 +46897,7 @@ function TSInstantiationExpression$1(node, parent) {
46897
46897
  var parentType = parent.type;
46898
46898
  return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
46899
46899
  }
46900
- function BinaryExpression$2(node, parent, tokenContext, inForStatementInit) {
46900
+ function BinaryExpression$1(node, parent, tokenContext, inForStatementInit) {
46901
46901
  return node.operator === "in" && inForStatementInit;
46902
46902
  }
46903
46903
  function SequenceExpression$1(node, parent) {
@@ -46990,13 +46990,13 @@ 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,
46997
46997
  AwaitExpression: YieldExpression$1,
46998
46998
  Binary: Binary,
46999
- BinaryExpression: BinaryExpression$2,
46999
+ BinaryExpression: BinaryExpression$1,
47000
47000
  ClassExpression: ClassExpression$1,
47001
47001
  ConditionalExpression: ConditionalExpression$1,
47002
47002
  DoExpression: DoExpression$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);
@@ -50457,7 +50457,7 @@ 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
50463
  TSUnionType: TSUnionType$2,
@@ -78646,7 +78646,7 @@ const {maybeInsideFn} = maybeInsideFn$1;
78646
78646
 
78647
78647
  const {
78648
78648
  isObjectProperty: isObjectProperty$1,
78649
- isVariableDeclarator: isVariableDeclarator$2,
78649
+ isVariableDeclarator: isVariableDeclarator$3,
78650
78650
  isClassProperty,
78651
78651
  isTSPropertySignature,
78652
78652
  isSpreadElement: isSpreadElement$2,
@@ -78654,17 +78654,17 @@ const {
78654
78654
 
78655
78655
  const isProperty = satisfy$4([
78656
78656
  isObjectProperty$1,
78657
- isVariableDeclarator$2,
78657
+ isVariableDeclarator$3,
78658
78658
  isClassProperty,
78659
78659
  isTSPropertySignature,
78660
78660
  isSpreadElement$2,
78661
78661
  ]);
78662
78662
 
78663
78663
  const isInsideVar = ({parentPath}) => {
78664
- if (isVariableDeclarator$2(parentPath))
78664
+ if (isVariableDeclarator$3(parentPath))
78665
78665
  return true;
78666
78666
 
78667
- return isVariableDeclarator$2(parentPath.parentPath);
78667
+ return isVariableDeclarator$3(parentPath.parentPath);
78668
78668
  };
78669
78669
 
78670
78670
  const hasDecorators = (path) => {
@@ -79031,12 +79031,21 @@ function isOneArgArrow(path) {
79031
79031
  return param.type === 'Identifier';
79032
79032
  }
79033
79033
 
79034
- var maybeParens$9 = {};
79034
+ var maybeParens$e = {};
79035
79035
 
79036
- maybeParens$9.maybeParens = (print) => ({
79037
- condition(path) {
79038
- return path.node.extra?.parenthesized;
79039
- },
79036
+ const isFn$6 = (a) => typeof a === 'function';
79037
+ const isParens$3 = (path) => path.node.extra?.parenthesized;
79038
+
79039
+ maybeParens$e.isParens = isParens$3;
79040
+ maybeParens$e.maybeParens = (print) => {
79041
+ if (isFn$6(print))
79042
+ return maybeParensPrint(print);
79043
+
79044
+ return maybeParensCondition(print);
79045
+ };
79046
+
79047
+ const maybeParensPrint = (print) => ({
79048
+ condition: isParens$3,
79040
79049
  before(path, {write}) {
79041
79050
  write('(');
79042
79051
  },
@@ -79046,11 +79055,16 @@ maybeParens$9.maybeParens = (print) => ({
79046
79055
  },
79047
79056
  });
79048
79057
 
79058
+ const maybeParensCondition = ({print, condition}) => ({
79059
+ ...maybeParensPrint(print),
79060
+ condition: (path) => condition(path) || isParens$3(path),
79061
+ });
79062
+
79049
79063
  const {exists: exists$e} = is$3;
79050
79064
  const {printParams: printParams$c} = params;
79051
- const {maybeParens: maybeParens$8} = maybeParens$9;
79065
+ const {maybeParens: maybeParens$d} = maybeParens$e;
79052
79066
 
79053
- arrowFunctionExpression.ArrowFunctionExpression = maybeParens$8((path, printer, semantics) => {
79067
+ arrowFunctionExpression.ArrowFunctionExpression = maybeParens$d((path, printer, semantics) => {
79054
79068
  const {
79055
79069
  print,
79056
79070
  maybe,
@@ -79306,9 +79320,9 @@ var functionExpression = {};
79306
79320
 
79307
79321
  const {exists: exists$d} = is$3;
79308
79322
  const {printParams: printParams$8} = params;
79309
- const {maybeParens: maybeParens$7} = maybeParens$9;
79323
+ const {maybeParens: maybeParens$c} = maybeParens$e;
79310
79324
 
79311
- functionExpression.FunctionExpression = maybeParens$7((path, printer, semantics) => {
79325
+ functionExpression.FunctionExpression = maybeParens$c((path, printer, semantics) => {
79312
79326
  const {
79313
79327
  print,
79314
79328
  maybe,
@@ -79358,11 +79372,11 @@ var unaryExpressions$1 = {};
79358
79372
 
79359
79373
  const {isLast: isLast$b, isNext: isNext$m} = is$3;
79360
79374
 
79361
- const {maybeParens: maybeParens$6} = maybeParens$9;
79375
+ const {maybeParens: maybeParens$b} = maybeParens$e;
79362
79376
 
79363
79377
  const isWord = (a) => /^(delete|typeof|void|throw)$/.test(a);
79364
79378
 
79365
- const unaryExpression = maybeParens$6((path, printer) => {
79379
+ const unaryExpression = maybeParens$b((path, printer) => {
79366
79380
  const {maybe, traverse} = printer;
79367
79381
  const {prefix, operator} = path.node;
79368
79382
  const argPath = path.get('argument');
@@ -79382,7 +79396,7 @@ unaryExpressions$1.AwaitExpression = (path, {print}) => {
79382
79396
  });
79383
79397
  };
79384
79398
 
79385
- unaryExpressions$1.YieldExpression = maybeParens$6((path, {print, maybe}) => {
79399
+ unaryExpressions$1.YieldExpression = maybeParens$b((path, {print, maybe}) => {
79386
79400
  const {delegate} = path.node;
79387
79401
 
79388
79402
  print(`yield`);
@@ -79410,14 +79424,14 @@ function printUnary(path, name, {print}) {
79410
79424
 
79411
79425
  var memberExpressions$1 = {};
79412
79426
 
79413
- var chain$1 = {};
79427
+ var chain$3 = {};
79414
79428
 
79415
79429
  const {assign: assign$c} = Object;
79416
79430
 
79417
- chain$1.chain = (path) => {
79431
+ chain$3.chain = (path) => {
79418
79432
  const all = [
79419
- ...down(path),
79420
- ...up(path),
79433
+ ...down$1(path),
79434
+ ...up$1(path),
79421
79435
  ];
79422
79436
 
79423
79437
  const properties = all.slice(0, -1);
@@ -79426,7 +79440,7 @@ chain$1.chain = (path) => {
79426
79440
  return [root, properties];
79427
79441
  };
79428
79442
 
79429
- function down(path) {
79443
+ function down$1(path) {
79430
79444
  const properties = [];
79431
79445
 
79432
79446
  let current = path.get('object');
@@ -79449,7 +79463,7 @@ function down(path) {
79449
79463
  return properties;
79450
79464
  }
79451
79465
 
79452
- function up(current) {
79466
+ function up$1(current) {
79453
79467
  const properties = [];
79454
79468
 
79455
79469
  while (current.isMemberExpression()) {
@@ -79491,11 +79505,11 @@ const {
79491
79505
  isIfStatement,
79492
79506
  } = bundle.types;
79493
79507
 
79494
- const {chain} = chain$1;
79508
+ const {chain: chain$2} = chain$3;
79495
79509
  const {satisfy: satisfy$3} = is$3;
79496
79510
 
79497
79511
  const {maybePrintComputed} = maybePrintComputed$2;
79498
- const {maybeParens: maybeParens$5} = maybeParens$9;
79512
+ const {maybeParens: maybeParens$a} = maybeParens$e;
79499
79513
 
79500
79514
  const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
79501
79515
 
@@ -79530,7 +79544,7 @@ memberExpressions$1.MemberExpression = (path, printer) => {
79530
79544
  maybe.indent.dec(isChain);
79531
79545
  };
79532
79546
 
79533
- memberExpressions$1.OptionalMemberExpression = maybeParens$5((path, {print, maybe}) => {
79547
+ memberExpressions$1.OptionalMemberExpression = maybeParens$a((path, {print, maybe}) => {
79534
79548
  const {computed, optional} = path.node;
79535
79549
 
79536
79550
  print('__object');
@@ -79580,7 +79594,7 @@ const isIfUp = (path) => {
79580
79594
 
79581
79595
  memberExpressions$1.likeChain = likeChain$1;
79582
79596
  function likeChain$1(path) {
79583
- const [root, properties] = chain(path);
79597
+ const [root, properties] = chain$2(path);
79584
79598
 
79585
79599
  if (isExcludedFromChain(root))
79586
79600
  return false;
@@ -79711,7 +79725,7 @@ _class.ClassDeclaration = {
79711
79725
  var callExpression = {};
79712
79726
 
79713
79727
  const {exists: exists$c} = is$3;
79714
- const {maybeParens: maybeParens$4} = maybeParens$9;
79728
+ const {maybeParens: maybeParens$9} = maybeParens$e;
79715
79729
  const {isArray: isArray$e} = Array;
79716
79730
 
79717
79731
  const parseArgs = (path) => {
@@ -79723,7 +79737,7 @@ const parseArgs = (path) => {
79723
79737
  return argsPath;
79724
79738
  };
79725
79739
 
79726
- const CallExpression$1 = maybeParens$4((path, {indent, print, maybe, traverse}) => {
79740
+ const CallExpression$1 = maybeParens$9((path, {indent, print, maybe, traverse}) => {
79727
79741
  const args = parseArgs(path);
79728
79742
  const isParentCall = tooLong$1(args) && path.parentPath.isCallExpression();
79729
79743
 
@@ -79926,7 +79940,7 @@ objectExpression.ObjectExpression = (path, printer, semantics) => {
79926
79940
 
79927
79941
  const properties = path.get('properties');
79928
79942
  const {length} = properties;
79929
- const parens = isParens$5(path);
79943
+ const parens = isParens$2(path);
79930
79944
  const manyLines = !isOneLine$1(path);
79931
79945
 
79932
79946
  maybe.print(parens, '(');
@@ -80031,7 +80045,7 @@ function isOneLine$1(path) {
80031
80045
  return !isValue(path);
80032
80046
  }
80033
80047
 
80034
- function isParens$5(path) {
80048
+ function isParens$2(path) {
80035
80049
  if (isBodyOfArrow(path))
80036
80050
  return true;
80037
80051
 
@@ -80059,6 +80073,9 @@ concatenate$1.isConcatenation = (path) => {
80059
80073
  const {parentPath} = path;
80060
80074
  const {operator} = path.node;
80061
80075
 
80076
+ if (operator !== '+')
80077
+ return false;
80078
+
80062
80079
  const startLine = path.node.loc?.start.line;
80063
80080
  const endLine = path.node.loc?.end.line;
80064
80081
 
@@ -80068,9 +80085,6 @@ concatenate$1.isConcatenation = (path) => {
80068
80085
  const left = path.get('left');
80069
80086
  const right = path.get('right');
80070
80087
 
80071
- if (operator !== '+')
80072
- return false;
80073
-
80074
80088
  if (isStringLike(left) && isStringLike(right) && isBinaryExpression(parentPath))
80075
80089
  return true;
80076
80090
 
@@ -80208,7 +80222,7 @@ const {
80208
80222
  isIdentifier: isIdentifier$a,
80209
80223
  isObjectPattern: isObjectPattern$2,
80210
80224
  isAssignmentPattern,
80211
- isVariableDeclarator: isVariableDeclarator$1,
80225
+ isVariableDeclarator: isVariableDeclarator$2,
80212
80226
  } = bundle.types;
80213
80227
 
80214
80228
  const {wrongShorthand} = wrongShortand;
@@ -80390,7 +80404,7 @@ function shouldAddNewline(path, semantics) {
80390
80404
  if (hasObjectPattern(properties))
80391
80405
  return COUPLE_LINES;
80392
80406
 
80393
- if (moreCount && !moreLength && isVariableDeclarator$1(path.parentPath))
80407
+ if (moreCount && !moreLength && isVariableDeclarator$2(path.parentPath))
80394
80408
  return ONE_LINE$1;
80395
80409
 
80396
80410
  if (!fnParam && n && !isForOf$2(path) && checkLength(properties))
@@ -80475,21 +80489,7 @@ var assignmentExpression = {};
80475
80489
 
80476
80490
  var maybeWriteBrace$3 = {};
80477
80491
 
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;
80492
+ const {isParens: isParens$1} = maybeParens$e;
80493
80493
 
80494
80494
  maybeWriteBrace$3.maybePrintLeftBrace = (path, printer, semantics) => {
80495
80495
  maybeWriteBrace$2(path, printer, semantics, {
@@ -80527,7 +80527,7 @@ function maybeWriteBrace$2(path, printer, semantics, {brace}) {
80527
80527
  if (!roundBraces.assign)
80528
80528
  return;
80529
80529
 
80530
- if (!isParens$3(path))
80530
+ if (!isParens$1(path))
80531
80531
  return;
80532
80532
 
80533
80533
  write(brace);
@@ -82159,84 +82159,146 @@ const {
82159
82159
  } = concatenate$1;
82160
82160
 
82161
82161
  const {maybeSpace} = maybeSpace$1;
82162
- const {isParens: isParens$2} = parens;
82162
+ const {maybeParens: maybeParens$8} = maybeParens$e;
82163
+
82164
+ binaryExpression.BinaryExpression = maybeParens$8((path, {print, indent, maybe}) => {
82165
+ const {operator} = path.node;
82166
+
82167
+ if (operator === 'in' || operator === 'instanceof') {
82168
+ print('__left');
82169
+ print(' ');
82170
+ print(operator);
82171
+ print(' ');
82172
+ print('__right');
82173
+
82174
+ return;
82175
+ }
82176
+
82177
+ if (isConcatenation$1(path))
82178
+ return concatenate(path, {
82179
+ print,
82180
+ indent,
82181
+ maybe,
82182
+ });
82183
+
82184
+ print('__left');
82185
+ print.space();
82186
+ print(path.node.operator);
82187
+ maybeSpace(path, {
82188
+ print,
82189
+ });
82190
+ print('__right');
82191
+ });
82192
+
82193
+ var logicalExpression = {};
82194
+
82195
+ var chain$1 = {};
82196
+
82197
+ const {
82198
+ isReturnStatement,
82199
+ isVariableDeclarator: isVariableDeclarator$1,
82200
+ } = bundle.types;
82201
+
82202
+ chain$1.isRootOk = (path) => {
82203
+ return isReturnStatement(path) || isVariableDeclarator$1(path);
82204
+ };
82205
+
82206
+ chain$1.chain = (path) => {
82207
+ const [downCount] = down(path);
82208
+ const [upCount, root] = up(path);
82209
+
82210
+ return [
82211
+ root,
82212
+ downCount + upCount,
82213
+ downCount,
82214
+ upCount,
82215
+ ];
82216
+ };
82217
+
82218
+ function down(current) {
82219
+ let count = 0;
82220
+
82221
+ do {
82222
+ ++count;
82223
+ current = current.get('left');
82224
+ const {operator} = current.node;
82225
+
82226
+ if (operator !== '||' && operator !== '&&')
82227
+ break;
82228
+ } while (current.isLogicalExpression());
82229
+
82230
+ return [count];
82231
+ }
82232
+
82233
+ function up(current) {
82234
+ let count = 0;
82235
+
82236
+ do {
82237
+ ++count;
82238
+ current = current.parentPath;
82239
+ } while (current.isLogicalExpression());
82240
+
82241
+ return [
82242
+ count, {
82243
+ type: current.type,
82244
+ },
82245
+ ];
82246
+ }
82247
+
82248
+ const {maybeParens: maybeParens$7} = maybeParens$e;
82249
+ const {chain, isRootOk} = chain$1;
82163
82250
 
82164
- const BinaryExpression$1 = {
82251
+ logicalExpression.LogicalExpression = maybeParens$7({
82165
82252
  condition(path) {
82166
- if (isParens$2(path))
82253
+ if (path.parentPath.isUnaryExpression())
82167
82254
  return true;
82168
82255
 
82169
82256
  return path.parentPath.isAwaitExpression();
82170
82257
  },
82171
- before(path, {print}) {
82172
- print('(');
82173
- },
82174
- print(path, {print, indent, maybe}) {
82175
- const {operator} = path.node;
82258
+ print(path, {print, maybe}, semantics) {
82259
+ print('__left');
82176
82260
 
82177
- if (operator === 'instanceof') {
82178
- print('__left');
82179
- print(' instanceof ');
82180
- print('__right');
82181
-
82182
- return;
82183
- }
82261
+ const needNewLine = isNewLine(path, semantics);
82184
82262
 
82185
- if (operator === 'in') {
82186
- print('__left');
82187
- print(' in ');
82188
- print('__right');
82189
-
82190
- return;
82191
- }
82263
+ maybe.indent.inc(needNewLine);
82264
+ needNewLine ? print.breakline() : print.space();
82265
+ maybe.indent.dec(needNewLine);
82192
82266
 
82193
- if (isConcatenation$1(path))
82194
- return concatenate(path, {
82195
- print,
82196
- indent,
82197
- maybe,
82198
- });
82199
-
82200
- print('__left');
82201
- print.space();
82202
82267
  print(path.node.operator);
82203
- maybeSpace(path, {
82204
- print,
82205
- });
82268
+ print.space();
82206
82269
  print('__right');
82207
82270
  },
82208
- after(path, {print}) {
82209
- print(')');
82210
- },
82211
- };
82271
+ });
82212
82272
 
82213
- binaryExpression.BinaryExpression = BinaryExpression$1;
82214
- binaryExpression.LogicalExpression = BinaryExpression$1;
82273
+ function isNewLine(path, semantics) {
82274
+ const [root, count] = chain(path);
82275
+
82276
+ if (!isRootOk(root))
82277
+ return false;
82278
+
82279
+ if (count <= semantics.maxElementsInOneLine)
82280
+ return false;
82281
+
82282
+ const {operator} = path.node;
82283
+
82284
+ return operator === '||' || operator === '&&';
82285
+ }
82215
82286
 
82216
82287
  var conditionalExpression = {};
82217
82288
 
82218
- const {isParens: isParens$1} = parens;
82289
+ const {maybeParens: maybeParens$6} = maybeParens$e;
82219
82290
 
82220
- conditionalExpression.ConditionalExpression = {
82221
- condition: isParens$1,
82222
- before(path, {print}) {
82223
- print('(');
82224
- },
82225
- print(path, {print}) {
82226
- print('__test');
82227
- print.space();
82228
- print('?');
82229
- print.space();
82230
- print('__consequent');
82231
- print.space();
82232
- print(':');
82233
- print.space();
82234
- print('__alternate');
82235
- },
82236
- after(path, {print}) {
82237
- print(')');
82238
- },
82239
- };
82291
+ conditionalExpression.ConditionalExpression = maybeParens$6((path, {print}) => {
82292
+ print('__test');
82293
+ print.space();
82294
+ print('?');
82295
+ print.space();
82296
+ print('__consequent');
82297
+ print.space();
82298
+ print(':');
82299
+ print.space();
82300
+ print('__alternate');
82301
+ });
82240
82302
 
82241
82303
  var staticBlock = {};
82242
82304
 
@@ -82474,12 +82536,8 @@ const {RestElement} = restElement;
82474
82536
  const {SpreadElement} = spreadElement;
82475
82537
  const {SequenceExpression} = sequenceExpression;
82476
82538
  const {TaggedTemplateExpression} = taggedTemplateExpression;
82477
-
82478
- const {
82479
- BinaryExpression,
82480
- LogicalExpression,
82481
- } = binaryExpression;
82482
-
82539
+ const {BinaryExpression} = binaryExpression;
82540
+ const {LogicalExpression} = logicalExpression;
82483
82541
  const {ConditionalExpression} = conditionalExpression;
82484
82542
  const {StaticBlock} = staticBlock;
82485
82543
  const {RecordExpression} = recordExpression;
@@ -84143,10 +84201,10 @@ maybeGet.maybeDecorators = (path) => {
84143
84201
  };
84144
84202
 
84145
84203
  const {maybeDecorators} = maybeGet;
84146
- const {maybeParens: maybeParens$3} = maybeParens$9;
84204
+ const {maybeParens: maybeParens$5} = maybeParens$e;
84147
84205
  const {maybeTypeAnnotation} = maybeTypeAnnotation$4;
84148
84206
 
84149
- identifier.Identifier = maybeParens$3(maybeTypeAnnotation((path, printer) => {
84207
+ identifier.Identifier = maybeParens$5(maybeTypeAnnotation((path, printer) => {
84150
84208
  const {
84151
84209
  write,
84152
84210
  maybe,
@@ -84623,13 +84681,13 @@ tsInterfaceDeclaration.TSInterfaceDeclaration = {
84623
84681
 
84624
84682
  var tsAsExpression = {};
84625
84683
 
84626
- const {maybeParens: maybeParens$2} = maybeParens$9;
84684
+ const {maybeParens: maybeParens$4} = maybeParens$e;
84627
84685
  const {
84628
84686
  isVariableDeclarator,
84629
84687
  isObjectExpression: isObjectExpression$1,
84630
84688
  } = bundle.types;
84631
84689
 
84632
- tsAsExpression.TSAsExpression = maybeParens$2((path, {print, maybe}) => {
84690
+ tsAsExpression.TSAsExpression = maybeParens$4((path, {print, maybe}) => {
84633
84691
  const is = isParens(path);
84634
84692
 
84635
84693
  maybe.print(is, '(');
@@ -84757,9 +84815,9 @@ printReturnType$5.printReturnType = (path, {traverse}) => {
84757
84815
  const {printParams: printParams$5} = params;
84758
84816
  const {printReturnType: printReturnType$4} = printReturnType$5;
84759
84817
 
84760
- const {maybeParens: maybeParens$1} = maybeParens$9;
84818
+ const {maybeParens: maybeParens$3} = maybeParens$e;
84761
84819
 
84762
- tsFunctionType.TSFunctionType = maybeParens$1((path, printer, semantics) => {
84820
+ tsFunctionType.TSFunctionType = maybeParens$3((path, printer, semantics) => {
84763
84821
  const {print} = printer;
84764
84822
 
84765
84823
  printParams$5(path, printer, semantics);
@@ -84954,23 +85012,18 @@ tsMethodSignature.TSMethodSignature = (path, printer, semantics) => {
84954
85012
 
84955
85013
  var tsUnionType = {};
84956
85014
 
84957
- const {
84958
- maybeParenOpen,
84959
- maybeParenClose,
84960
- } = parens;
85015
+ const {maybeParens: maybeParens$2} = maybeParens$e;
85016
+ const insideTypeDeclaration = ({parentPath}) => parentPath.isTSTypeAliasDeclaration();
84961
85017
 
84962
- tsUnionType.TSUnionType = (path, printer, semantics) => {
85018
+ tsUnionType.TSUnionType = maybeParens$2((path, printer, {maxTypesInOneLine}) => {
84963
85019
  const types = path.get('types');
85020
+ const {length} = types;
84964
85021
 
84965
- maybeParenOpen(path, printer);
84966
-
84967
- if (types.length <= semantics.maxTypesInOneLine)
85022
+ if (!insideTypeDeclaration(path) || length <= maxTypesInOneLine)
84968
85023
  printInOneLine(types, printer);
84969
85024
  else
84970
85025
  printInCoupleLines(types, printer);
84971
-
84972
- maybeParenClose(path, printer);
84973
- };
85026
+ });
84974
85027
 
84975
85028
  function printInOneLine(types, {traverse, write}) {
84976
85029
  const n = types.length - 1;
@@ -85034,9 +85087,9 @@ tsTypeReference.TSTypeReference = (path, {print}) => {
85034
85087
 
85035
85088
  var tsInferType = {};
85036
85089
 
85037
- const {maybeParens} = maybeParens$9;
85090
+ const {maybeParens: maybeParens$1} = maybeParens$e;
85038
85091
 
85039
- tsInferType.TSInferType = maybeParens((path, {print}) => {
85092
+ tsInferType.TSInferType = maybeParens$1((path, {print}) => {
85040
85093
  print('infer ');
85041
85094
  print('__typeParameter');
85042
85095
  });
@@ -85078,6 +85131,15 @@ tsParameterProperty.TSParameterProperty = (path, {print, maybe}) => {
85078
85131
  maybe.print.breakline(decoratorsLength);
85079
85132
  };
85080
85133
 
85134
+ var tsTypeQuery = {};
85135
+
85136
+ const {maybeParens} = maybeParens$e;
85137
+
85138
+ tsTypeQuery.TSTypeQuery = maybeParens((path, {print}) => {
85139
+ print('typeof ');
85140
+ print('__exprName');
85141
+ });
85142
+
85081
85143
  const {isNext: isNext$1} = is$3;
85082
85144
  const {TSTypeLiteral} = tsTypeLiteral;
85083
85145
  const {TSTypeAliasDeclaration} = tsTypeAliasDeclaration;
@@ -85115,6 +85177,7 @@ const {TSExportAssignment} = tsExportAssignment;
85115
85177
  const {TSTypeReference} = tsTypeReference;
85116
85178
  const {TSInferType} = tsInferType;
85117
85179
  const {TSParameterProperty} = tsParameterProperty;
85180
+ const {TSTypeQuery} = tsTypeQuery;
85118
85181
 
85119
85182
  var typescript$1 = {
85120
85183
  TSAsExpression,
@@ -85130,6 +85193,7 @@ var typescript$1 = {
85130
85193
  TSIntersectionType,
85131
85194
  TSImportType,
85132
85195
  TSUnionType,
85196
+ TSTypeQuery,
85133
85197
  TSBigIntKeyword(path, {write}) {
85134
85198
  write('bigint');
85135
85199
  },
@@ -85139,10 +85203,6 @@ var typescript$1 = {
85139
85203
  TSSymbolKeyword(path, {write}) {
85140
85204
  write('symbol');
85141
85205
  },
85142
- TSTypeQuery(path, {print}) {
85143
- print('typeof ');
85144
- print('__exprName');
85145
- },
85146
85206
  TSNeverKeyword(path, {write}) {
85147
85207
  write('never');
85148
85208
  },