@putout/bundle 3.14.1 → 3.15.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
@@ -8392,7 +8392,7 @@ __export(lib_exports, {
8392
8392
  return tsTypeQuery;
8393
8393
  },
8394
8394
  TSTypeReference: function() {
8395
- return tsTypeReference;
8395
+ return tsTypeReference$1;
8396
8396
  },
8397
8397
  TSUndefinedKeyword: function() {
8398
8398
  return tsUndefinedKeyword;
@@ -11185,7 +11185,7 @@ __export(lib_exports, {
11185
11185
  return tsTypeQuery;
11186
11186
  },
11187
11187
  tSTypeReference: function() {
11188
- return tsTypeReference;
11188
+ return tsTypeReference$1;
11189
11189
  },
11190
11190
  tSUndefinedKeyword: function() {
11191
11191
  return tsUndefinedKeyword;
@@ -11431,7 +11431,7 @@ __export(lib_exports, {
11431
11431
  return tsTypeQuery;
11432
11432
  },
11433
11433
  tsTypeReference: function() {
11434
- return tsTypeReference;
11434
+ return tsTypeReference$1;
11435
11435
  },
11436
11436
  tsUndefinedKeyword: function() {
11437
11437
  return tsUndefinedKeyword;
@@ -21863,7 +21863,7 @@ function tsConstructorType$1() {
21863
21863
  typeAnnotation: typeAnnotation2
21864
21864
  });
21865
21865
  }
21866
- function tsTypeReference(typeName) {
21866
+ function tsTypeReference$1(typeName) {
21867
21867
  var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
21868
21868
  return validateNode({
21869
21869
  type: "TSTypeReference",
@@ -47566,7 +47566,7 @@ function tsPrintFunctionOrConstructorType(node) {
47566
47566
  var returnType = node.returnType;
47567
47567
  this.print(returnType.typeAnnotation, node);
47568
47568
  }
47569
- function TSTypeReference(node) {
47569
+ function TSTypeReference$1(node) {
47570
47570
  this.print(node.typeName, node, true);
47571
47571
  this.print(node.typeParameters, node, true);
47572
47572
  }
@@ -48172,7 +48172,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
48172
48172
  TSTypeParameterInstantiation: TSTypeParameterInstantiation,
48173
48173
  TSTypePredicate: TSTypePredicate,
48174
48174
  TSTypeQuery: TSTypeQuery,
48175
- TSTypeReference: TSTypeReference,
48175
+ TSTypeReference: TSTypeReference$1,
48176
48176
  TSUndefinedKeyword: TSUndefinedKeyword,
48177
48177
  TSUnionType: TSUnionType,
48178
48178
  TSUnknownKeyword: TSUnknownKeyword,
@@ -77151,15 +77151,30 @@ maybeDecorators$4.maybeDecorators = (visitor) => (path, printer, semantics, opti
77151
77151
  visitor(path, printer, semantics, options);
77152
77152
  };
77153
77153
 
77154
- var kind = {};
77154
+ var printKey$7 = {};
77155
+
77156
+ var maybePrintComputed$2 = {};
77155
77157
 
77156
- kind.printKey = (path, {write, traverse, maybe}) => {
77158
+ maybePrintComputed$2.maybePrintComputed = (path, key, {maybe, traverse}) => {
77159
+ const {computed} = path.node;
77160
+
77161
+ maybe.write(computed, '[');
77162
+ traverse(key);
77163
+ maybe.write(computed, ']');
77164
+ };
77165
+
77166
+ const {maybePrintComputed: maybePrintComputed$1} = maybePrintComputed$2;
77167
+
77168
+ printKey$7.printKey = (path, printer) => {
77157
77169
  const key = path.get('key');
77158
- const {
77159
- kind,
77160
- computed,
77161
- generator,
77162
- } = path.node;
77170
+
77171
+ maybePrintComputed$1(path, key, printer);
77172
+ };
77173
+
77174
+ var kind = {};
77175
+
77176
+ kind.printKind = (path, {write}) => {
77177
+ const {kind, generator} = path.node;
77163
77178
 
77164
77179
  const isGetter = kind === 'get' || kind === 'set';
77165
77180
 
@@ -77167,16 +77182,13 @@ kind.printKey = (path, {write, traverse, maybe}) => {
77167
77182
  write(`${kind} `);
77168
77183
  else if (generator)
77169
77184
  write('*');
77170
-
77171
- maybe.write(computed, '[');
77172
- traverse(key);
77173
- maybe.write(computed, ']');
77174
77185
  };
77175
77186
 
77176
77187
  const {isNext: isNext$n} = is$3;
77177
77188
  const {printParams: printParams$a} = params;
77178
77189
  const {maybeDecorators: maybeDecorators$3} = maybeDecorators$4;
77179
- const {printKey: printKey$2} = kind;
77190
+ const {printKey: printKey$6} = printKey$7;
77191
+ const {printKind: printKind$3} = kind;
77180
77192
 
77181
77193
  const ClassMethod$1 = {
77182
77194
  print: maybeDecorators$3((path, printer, semantics) => {
@@ -77199,7 +77211,8 @@ const ClassMethod$1 = {
77199
77211
  print(' ');
77200
77212
  }
77201
77213
 
77202
- printKey$2(path, printer);
77214
+ printKind$3(path, printer);
77215
+ printKey$6(path, printer);
77203
77216
  printParams$a(path, printer, semantics);
77204
77217
 
77205
77218
  if (returnType) {
@@ -77224,7 +77237,8 @@ var objectMethod = {};
77224
77237
 
77225
77238
  const {isNewlineBetweenSiblings: isNewlineBetweenSiblings$4} = is$3;
77226
77239
  const {printParams: printParams$9} = params;
77227
- const {printKey: printKey$1} = kind;
77240
+ const {printKey: printKey$5} = printKey$7;
77241
+ const {printKind: printKind$2} = kind;
77228
77242
 
77229
77243
  objectMethod.ObjectMethod = {
77230
77244
  beforeIf(path) {
@@ -77236,7 +77250,8 @@ objectMethod.ObjectMethod = {
77236
77250
  print(path, printer, semantics) {
77237
77251
  const {print} = printer;
77238
77252
 
77239
- printKey$1(path, printer);
77253
+ printKind$2(path, printer);
77254
+ printKey$5(path, printer);
77240
77255
  printParams$9(path, printer, semantics);
77241
77256
 
77242
77257
  print.space();
@@ -77330,14 +77345,14 @@ unaryExpressions$1.AwaitExpression = (path, {print}) => {
77330
77345
  });
77331
77346
  };
77332
77347
 
77333
- unaryExpressions$1.YieldExpression = (path, {print, maybe}) => {
77348
+ unaryExpressions$1.YieldExpression = maybeParens$3((path, {print, maybe}) => {
77334
77349
  const {delegate} = path.node;
77335
77350
 
77336
77351
  print(`yield`);
77337
77352
  maybe.print(delegate, '*');
77338
77353
  print(' ');
77339
77354
  print('__argument');
77340
- };
77355
+ });
77341
77356
 
77342
77357
  unaryExpressions$1.ThrowStatement = (path, {print, indent, maybe}) => {
77343
77358
  indent();
@@ -77442,10 +77457,19 @@ const {
77442
77457
  const {chain} = chain$1;
77443
77458
  const {satisfy: satisfy$3} = is$3;
77444
77459
 
77460
+ const {maybePrintComputed} = maybePrintComputed$2;
77461
+
77445
77462
  const isArgOfCall = (path) => path.parentPath.isCallExpression() && path.parentPath.get('arguments.0') === path;
77446
77463
 
77447
- memberExpressions$1.MemberExpression = (path, {print, maybe, traverse}) => {
77464
+ memberExpressions$1.MemberExpression = (path, printer) => {
77465
+ const {
77466
+ print,
77467
+ maybe,
77468
+ traverse,
77469
+ } = printer;
77470
+
77448
77471
  const object = path.get('object');
77472
+ const property = path.get('property');
77449
77473
  const isParens = object.isAwaitExpression() || object.isAssignmentExpression();
77450
77474
  const {computed} = path.node;
77451
77475
 
@@ -77453,13 +77477,8 @@ memberExpressions$1.MemberExpression = (path, {print, maybe, traverse}) => {
77453
77477
  traverse(object);
77454
77478
  maybe.print(isParens, ')');
77455
77479
 
77456
- if (computed) {
77457
- print('[');
77458
- print('__property');
77459
- print(']');
77460
-
77461
- return;
77462
- }
77480
+ if (computed)
77481
+ return maybePrintComputed(path, property, printer);
77463
77482
 
77464
77483
  const isChain = likeChain$1(path);
77465
77484
 
@@ -78017,21 +78036,24 @@ concatanate$1.concatanate = (path, {print, indent}) => {
78017
78036
 
78018
78037
  const {isConcatenation: isConcatenation$2} = concatanate$1;
78019
78038
  const {isOneLine} = objectExpression;
78039
+ const {printKey: printKey$4} = printKey$7;
78020
78040
 
78021
- objectProperty.ObjectProperty = (path, {maybe, traverse, write}, semantics) => {
78041
+ objectProperty.ObjectProperty = (path, printer, semantics) => {
78022
78042
  const {trailingComma} = semantics;
78023
- const {shorthand, computed} = path.node;
78043
+ const {shorthand} = path.node;
78044
+ const {
78045
+ maybe,
78046
+ traverse,
78047
+ write,
78048
+ } = printer;
78024
78049
 
78025
- const key = path.get('key');
78026
78050
  const value = path.get('value');
78027
78051
 
78028
78052
  const properties = path.parentPath.get('properties');
78029
78053
  const isLast = path === properties.at(-1);
78030
78054
  const manyLines = !isOneLine(path.parentPath);
78031
78055
 
78032
- maybe.write(computed, '[');
78033
- traverse(key);
78034
- maybe.write(computed, ']');
78056
+ printKey$4(path, printer);
78035
78057
 
78036
78058
  if (!shorthand) {
78037
78059
  write(':');
@@ -78140,6 +78162,7 @@ const {moreThenMaxPropertiesInOneLine} = moreThenMaxPropertiesInOneLine$1;
78140
78162
 
78141
78163
  const {maybeTypeAnnotation: maybeTypeAnnotation$3} = maybeTypeAnnotation$4;
78142
78164
  const {moreThenMaxPropertiesLengthInOneLine} = moreThenMaxPropertiesLengthInOneLine$1;
78165
+ const {printKey: printKey$3} = printKey$7;
78143
78166
 
78144
78167
  const isTwoLevelsDeep = ({parentPath}) => parentPath.parentPath.parentPath.isObjectProperty();
78145
78168
  const isOneParentProperty = ({parentPath}) => parentPath.parentPath.node.properties?.length === 1;
@@ -78159,13 +78182,19 @@ const isCoupleProperties = ({path, valuePath, property}) => {
78159
78182
  };
78160
78183
 
78161
78184
  objectPattern.ObjectPattern = {
78162
- print: maybeTypeAnnotation$3((path, {print, maybe, indent}, semantics) => {
78185
+ print: maybeTypeAnnotation$3((path, printer, semantics) => {
78163
78186
  const shouldIndent = isIndent(path);
78164
78187
  const {
78165
78188
  maxPropertiesInOneLine,
78166
78189
  maxPropertiesLengthInOneLine,
78167
78190
  } = semantics;
78168
78191
 
78192
+ const {
78193
+ print,
78194
+ maybe,
78195
+ indent,
78196
+ } = printer;
78197
+
78169
78198
  maybe.indent.inc(shouldIndent);
78170
78199
  print('{');
78171
78200
 
@@ -78205,9 +78234,7 @@ objectPattern.ObjectPattern = {
78205
78234
  maybe.indent(is);
78206
78235
  maybe.print.breakline(couple);
78207
78236
 
78208
- maybe.print(computed, '[');
78209
- print(keyPath);
78210
- maybe.print(computed, ']');
78237
+ printKey$3(property, printer);
78211
78238
 
78212
78239
  if (!shorthand || wrongShorthand({computed, isAssign, keyPath, valuePath})) {
78213
78240
  print(':');
@@ -78336,6 +78363,8 @@ var classProperty = {};
78336
78363
  const {exists: exists$8} = is$3;
78337
78364
  const {maybePrintTypeAnnotation: maybePrintTypeAnnotation$2} = maybeTypeAnnotation$4;
78338
78365
  const {maybeDecorators: maybeDecorators$1} = maybeDecorators$4;
78366
+ const {printKey: printKey$2} = printKey$7;
78367
+ const {printKind: printKind$1} = kind;
78339
78368
 
78340
78369
  const processClassProperty = maybeDecorators$1((path, printer, semantics, {accessor} = {}) => {
78341
78370
  const {node} = path;
@@ -78356,7 +78385,9 @@ const processClassProperty = maybeDecorators$1((path, printer, semantics, {acces
78356
78385
  maybe.print(node.readonly, 'readonly ');
78357
78386
  maybe.print(declare, 'declare ');
78358
78387
 
78359
- print('__key');
78388
+ printKind$1(path, printer);
78389
+ printKey$2(path, printer);
78390
+
78360
78391
  maybe.print(optional, '?');
78361
78392
 
78362
78393
  maybePrintTypeAnnotation$2(path, printer);
@@ -81182,9 +81213,10 @@ tryStatements.CatchClause = (path, {print, maybe}) => {
81182
81213
 
81183
81214
  print.space();
81184
81215
  print('catch');
81185
- print.space();
81186
81216
 
81187
- if (param.node) {
81217
+ if (!param.node) {
81218
+ print.space();
81219
+ } else {
81188
81220
  print('(');
81189
81221
  print(param);
81190
81222
  print(')');
@@ -82493,23 +82525,15 @@ const {
82493
82525
  isNext: isNext$4,
82494
82526
  } = is$3;
82495
82527
 
82528
+ const {printKey: printKey$1} = printKey$7;
82529
+
82496
82530
  tsPropertySignature.TSPropertySignature = (path, printer) => {
82497
- const {
82498
- print,
82499
- maybe,
82500
- write,
82501
- } = printer;
82531
+ const {maybe, write} = printer;
82502
82532
 
82503
- const {
82504
- computed,
82505
- optional,
82506
- readonly,
82507
- } = path.node;
82533
+ const {optional, readonly} = path.node;
82508
82534
 
82509
82535
  maybe.print(readonly, 'readonly ');
82510
- maybe.print(computed, '[');
82511
- print('__key');
82512
- maybe.print(computed, ']');
82536
+ printKey$1(path, printer);
82513
82537
  maybe.print(optional, '?');
82514
82538
 
82515
82539
  maybePrintTypeAnnotation$1(path, printer);
@@ -82696,15 +82720,18 @@ tsConstructSignatureDeclaration.TSConstructSignatureDeclaration = (path, printer
82696
82720
  var tsMethodSignature = {};
82697
82721
 
82698
82722
  const {printParams: printParams$1} = params;
82699
- const {printKey} = kind;
82723
+ const {printKind} = kind;
82700
82724
  const {
82701
82725
  hasReturnType,
82702
82726
  printReturnType,
82703
82727
  } = printReturnType$5;
82704
82728
 
82729
+ const {printKey} = printKey$7;
82730
+
82705
82731
  tsMethodSignature.TSMethodSignature = (path, printer, semantics) => {
82706
82732
  const {write} = printer;
82707
82733
 
82734
+ printKind(path, printer);
82708
82735
  printKey(path, printer);
82709
82736
  printParams$1(path, printer, semantics);
82710
82737
 
@@ -82744,6 +82771,13 @@ tsExportAssignment.TSExportAssignment = {
82744
82771
  },
82745
82772
  };
82746
82773
 
82774
+ var tsTypeReference = {};
82775
+
82776
+ tsTypeReference.TSTypeReference = (path, {print}) => {
82777
+ print('__typeName');
82778
+ print('__typeParameters');
82779
+ };
82780
+
82747
82781
  const {isNext: isNext$1} = is$3;
82748
82782
  const {TSTypeLiteral} = tsTypeLiteral;
82749
82783
  const {TSTypeAliasDeclaration} = tsTypeAliasDeclaration;
@@ -82782,6 +82816,7 @@ const {
82782
82816
  const {maybePrintTypeAnnotation} = maybeTypeAnnotation$4;
82783
82817
  const {TSImportType} = tsImportType;
82784
82818
  const {TSExportAssignment} = tsExportAssignment;
82819
+ const {TSTypeReference} = tsTypeReference;
82785
82820
 
82786
82821
  var typescript$1 = {
82787
82822
  TSAsExpression,
@@ -82842,14 +82877,11 @@ var typescript$1 = {
82842
82877
  braceClose: '>',
82843
82878
  });
82844
82879
  },
82845
- TSTypeReference(path, {print}) {
82846
- print('__typeName');
82847
- print('__typeParameters');
82848
- },
82849
82880
  TSArrayType(path, {print}) {
82850
82881
  print('__elementType');
82851
82882
  print('[]');
82852
82883
  },
82884
+ TSTypeReference,
82853
82885
  TSTypeOperator(path, {write, print}) {
82854
82886
  const {operator} = path.node;
82855
82887
  write(`${operator} `);
@@ -83167,7 +83199,7 @@ jsxText.JSXText = (path, {write, indent}) => {
83167
83199
  const isSpacesOnly = /^\s+$/.test(value);
83168
83200
  const hasNext = isNext(path);
83169
83201
 
83170
- if (extra?.raw.startsWith('&'))
83202
+ if (extra.raw.includes('&'))
83171
83203
  return write(extra.raw);
83172
83204
 
83173
83205
  if (isSpacesOnly && hasNext) {
@@ -112831,6 +112863,9 @@ function setValues$2({waysTo, values, path}) {
112831
112863
  continue;
112832
112864
  }
112833
112865
 
112866
+ if (isImportsStr(name) || isExportsStr(name))
112867
+ way = way.replace(/\.0.local$/, '');
112868
+
112834
112869
  if (isArgsStr(name) || isJSXChildrenStr(name) || isJSXAttributesStr(name))
112835
112870
  way = way.replace(/\.0$/, '');
112836
112871
 
@@ -112852,12 +112887,16 @@ function setValues$2({waysTo, values, path}) {
112852
112887
  way = way.replace(BODY_AND_CLASS_REG, '');
112853
112888
 
112854
112889
  const {extra} = jessy(way, node);
112855
- const valueExtra = values[name].extra;
112856
112890
 
112857
- values[name].extra = {
112858
- ...extra,
112859
- ...valueExtra,
112860
- };
112891
+ if (extra) {
112892
+ const valueExtra = values[name].extra;
112893
+
112894
+ values[name].extra = {
112895
+ ...extra,
112896
+ ...valueExtra,
112897
+ };
112898
+ }
112899
+
112861
112900
  nessy(way, values[name], node);
112862
112901
  }
112863
112902
  }