@putout/bundle 5.2.5 → 5.3.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
@@ -23,7 +23,7 @@ var lookup = [];
23
23
  var revLookup = [];
24
24
  var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
25
25
  var inited = false;
26
- function init$3 () {
26
+ function init$1 () {
27
27
  inited = true;
28
28
  var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
29
29
  for (var i = 0, len = code.length; i < len; ++i) {
@@ -37,7 +37,7 @@ function init$3 () {
37
37
 
38
38
  function toByteArray (b64) {
39
39
  if (!inited) {
40
- init$3();
40
+ init$1();
41
41
  }
42
42
  var i, j, l, tmp, placeHolders, arr;
43
43
  var len = b64.length;
@@ -96,7 +96,7 @@ function encodeChunk (uint8, start, end) {
96
96
 
97
97
  function fromByteArray (uint8) {
98
98
  if (!inited) {
99
- init$3();
99
+ init$1();
100
100
  }
101
101
  var tmp;
102
102
  var len = uint8.length;
@@ -2909,7 +2909,7 @@ __export(lib_exports, {
2909
2909
  TSUnionType: () => TSUnionType$1,
2910
2910
  TSUnknownKeyword: () => TSUnknownKeyword$1,
2911
2911
  TSVoidKeyword: () => TSVoidKeyword$1,
2912
- TYPES: () => TYPES$3,
2912
+ TYPES: () => TYPES$4,
2913
2913
  TYPESCRIPT_TYPES: () => TYPESCRIPT_TYPES,
2914
2914
  TaggedTemplateExpression: () => TaggedTemplateExpression$1,
2915
2915
  TemplateElement: () => TemplateElement,
@@ -3439,7 +3439,7 @@ __export(lib_exports, {
3439
3439
  isExportAllDeclaration: () => isExportAllDeclaration,
3440
3440
  isExportDeclaration: () => isExportDeclaration$5,
3441
3441
  isExportDefaultDeclaration: () => isExportDefaultDeclaration$1,
3442
- isExportDefaultSpecifier: () => isExportDefaultSpecifier$1,
3442
+ isExportDefaultSpecifier: () => isExportDefaultSpecifier$2,
3443
3443
  isExportNamedDeclaration: () => isExportNamedDeclaration$3,
3444
3444
  isExportNamespaceSpecifier: () => isExportNamespaceSpecifier$1,
3445
3445
  isExportSpecifier: () => isExportSpecifier$1,
@@ -3523,7 +3523,7 @@ __export(lib_exports, {
3523
3523
  isNumberLiteralTypeAnnotation: () => isNumberLiteralTypeAnnotation,
3524
3524
  isNumberTypeAnnotation: () => isNumberTypeAnnotation,
3525
3525
  isNumericLiteral: () => isNumericLiteral$1,
3526
- isObjectExpression: () => isObjectExpression$c,
3526
+ isObjectExpression: () => isObjectExpression$d,
3527
3527
  isObjectMember: () => isObjectMember,
3528
3528
  isObjectMethod: () => isObjectMethod$1,
3529
3529
  isObjectPattern: () => isObjectPattern$3,
@@ -3557,7 +3557,7 @@ __export(lib_exports, {
3557
3557
  isReturnStatement: () => isReturnStatement$4,
3558
3558
  isScopable: () => isScopable,
3559
3559
  isScope: () => isScope,
3560
- isSequenceExpression: () => isSequenceExpression$2,
3560
+ isSequenceExpression: () => isSequenceExpression$3,
3561
3561
  isSpecifierDefault: () => isSpecifierDefault,
3562
3562
  isSpreadElement: () => isSpreadElement$4,
3563
3563
  isSpreadProperty: () => isSpreadProperty,
@@ -3645,7 +3645,7 @@ __export(lib_exports, {
3645
3645
  isTSVoidKeyword: () => isTSVoidKeyword,
3646
3646
  isTaggedTemplateExpression: () => isTaggedTemplateExpression,
3647
3647
  isTemplateElement: () => isTemplateElement$4,
3648
- isTemplateLiteral: () => isTemplateLiteral$4,
3648
+ isTemplateLiteral: () => isTemplateLiteral$5,
3649
3649
  isTerminatorless: () => isTerminatorless,
3650
3650
  isThisExpression: () => isThisExpression,
3651
3651
  isThisTypeAnnotation: () => isThisTypeAnnotation,
@@ -5672,7 +5672,7 @@ function isProgram$5(node, opts) {
5672
5672
  return opts == null || shallowEqual(node, opts);
5673
5673
  }
5674
5674
 
5675
- function isObjectExpression$c(node, opts) {
5675
+ function isObjectExpression$d(node, opts) {
5676
5676
  if (!node)
5677
5677
  return false;
5678
5678
 
@@ -5722,7 +5722,7 @@ function isReturnStatement$4(node, opts) {
5722
5722
  return opts == null || shallowEqual(node, opts);
5723
5723
  }
5724
5724
 
5725
- function isSequenceExpression$2(node, opts) {
5725
+ function isSequenceExpression$3(node, opts) {
5726
5726
  if (!node)
5727
5727
  return false;
5728
5728
 
@@ -6082,7 +6082,7 @@ function isTemplateElement$4(node, opts) {
6082
6082
  return opts == null || shallowEqual(node, opts);
6083
6083
  }
6084
6084
 
6085
- function isTemplateLiteral$4(node, opts) {
6085
+ function isTemplateLiteral$5(node, opts) {
6086
6086
  if (!node)
6087
6087
  return false;
6088
6088
 
@@ -7092,7 +7092,7 @@ function isDoExpression(node, opts) {
7092
7092
  return opts == null || shallowEqual(node, opts);
7093
7093
  }
7094
7094
 
7095
- function isExportDefaultSpecifier$1(node, opts) {
7095
+ function isExportDefaultSpecifier$2(node, opts) {
7096
7096
  if (!node)
7097
7097
  return false;
7098
7098
 
@@ -13623,7 +13623,7 @@ for (const {types: types2, set} of allExpandedTypes) {
13623
13623
  }
13624
13624
  }
13625
13625
 
13626
- var TYPES$3 = [].concat(Object.keys(VISITOR_KEYS), Object.keys(FLIPPED_ALIAS_KEYS), Object.keys(DEPRECATED_KEYS));
13626
+ var TYPES$4 = [].concat(Object.keys(VISITOR_KEYS), Object.keys(FLIPPED_ALIAS_KEYS), Object.keys(DEPRECATED_KEYS));
13627
13627
 
13628
13628
  function validate$1$1(node, key, val) {
13629
13629
  if (!node)
@@ -19559,7 +19559,7 @@ function getNameFromLiteralId(id) {
19559
19559
  return `/${id.pattern}/${id.flags}`;
19560
19560
  }
19561
19561
 
19562
- if (isTemplateLiteral$4(id)) {
19562
+ if (isTemplateLiteral$5(id)) {
19563
19563
  return id.quasis
19564
19564
  .map((quasi) => quasi.value.raw)
19565
19565
  .join('');
@@ -38222,7 +38222,7 @@ var Buffer2 = class {
38222
38222
  this._last = char;
38223
38223
 
38224
38224
  if (char === -1) {
38225
- const indent = repeat > 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2];
38225
+ const indent = repeat >= 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2];
38226
38226
  this._str += indent;
38227
38227
  } else {
38228
38228
  this._str += repeat > 1 ? String
@@ -50182,7 +50182,7 @@ var methods = {
50182
50182
  };
50183
50183
 
50184
50184
  Object.assign(NodePath_Final.prototype, methods);
50185
- for (const type of TYPES$3) {
50185
+ for (const type of TYPES$4) {
50186
50186
  const typeKey = `is${type}`;
50187
50187
  const fn = lib_exports[typeKey];
50188
50188
 
@@ -50201,8 +50201,8 @@ for (const type of Object.keys(virtualTypes)) {
50201
50201
  if (type.startsWith('_'))
50202
50202
  continue;
50203
50203
 
50204
- if (!TYPES$3.includes(type))
50205
- TYPES$3.push(type);
50204
+ if (!TYPES$4.includes(type))
50205
+ TYPES$4.push(type);
50206
50206
  }
50207
50207
 
50208
50208
  function _call(fns) {
@@ -50519,7 +50519,7 @@ traverse3.hasType = function(tree, type, denylistTypes) {
50519
50519
  };
50520
50520
  traverse3.cache = cache;
50521
50521
 
50522
- const TYPES$2 = {
50522
+ const TYPES$3 = {
50523
50523
  TOKEN: 'Token',
50524
50524
  NEWLINE: 'Newline',
50525
50525
  SPLITTER: 'Splitter',
@@ -50539,7 +50539,7 @@ const {
50539
50539
  isVariableDeclaration: isVariableDeclaration$4,
50540
50540
  isMemberExpression: isMemberExpression$8,
50541
50541
  isArrayExpression: isArrayExpression$9,
50542
- isObjectExpression: isObjectExpression$b,
50542
+ isObjectExpression: isObjectExpression$c,
50543
50543
  isLabeledStatement: isLabeledStatement$1,
50544
50544
  } = lib_exports;
50545
50545
 
@@ -50603,10 +50603,10 @@ function isStringAndIdentifier([a, b]) {
50603
50603
  const checkObject = (elements) => {
50604
50604
  let a = elements.at(-1);
50605
50605
 
50606
- if (!isObjectExpression$b(a))
50606
+ if (!isObjectExpression$c(a))
50607
50607
  a = elements.at(-2);
50608
50608
 
50609
- if (!isObjectExpression$b(a))
50609
+ if (!isObjectExpression$c(a))
50610
50610
  return false;
50611
50611
 
50612
50612
  return a.node.properties.length;
@@ -51893,7 +51893,7 @@ function printUnary(name, {print}) {
51893
51893
  }
51894
51894
 
51895
51895
  const {
51896
- isObjectExpression: isObjectExpression$a,
51896
+ isObjectExpression: isObjectExpression$b,
51897
51897
  isArrowFunctionExpression: isArrowFunctionExpression$1,
51898
51898
  } = lib_exports;
51899
51899
 
@@ -51948,7 +51948,7 @@ const OptionalMemberExpression = maybeParens((path, {print, maybe}) => {
51948
51948
  });
51949
51949
 
51950
51950
  const isObjectInsideArrow = ({node, parentPath}) => {
51951
- if (!isObjectExpression$a(node.object))
51951
+ if (!isObjectExpression$b(node.object))
51952
51952
  return false;
51953
51953
 
51954
51954
  return isArrowFunctionExpression$1(parentPath);
@@ -52219,7 +52219,7 @@ function maybePrintBrace(brace, path, printer, semantics) {
52219
52219
 
52220
52220
  const {isArrayExpression: isArrayExpression$8} = lib_exports;
52221
52221
 
52222
- const TYPES$1 = [
52222
+ const TYPES$2 = [
52223
52223
  'NullLiteral',
52224
52224
  'NumericLiteral',
52225
52225
  'BigIntLiteral',
@@ -52236,7 +52236,7 @@ const isInsideTuple = (path) => {
52236
52236
  if (second !== path.node)
52237
52237
  return false;
52238
52238
 
52239
- return TYPES$1.includes(first.type);
52239
+ return TYPES$2.includes(first.type);
52240
52240
  };
52241
52241
 
52242
52242
  const {
@@ -52433,7 +52433,7 @@ function isParens$1(path) {
52433
52433
 
52434
52434
  const {
52435
52435
  isStringLiteral: isStringLiteral$8,
52436
- isTemplateLiteral: isTemplateLiteral$3,
52436
+ isTemplateLiteral: isTemplateLiteral$4,
52437
52437
  isBinaryExpression,
52438
52438
  } = lib_exports;
52439
52439
 
@@ -52441,7 +52441,7 @@ const isStringLike = (a) => {
52441
52441
  if (isStringLiteral$8(a))
52442
52442
  return true;
52443
52443
 
52444
- return isTemplateLiteral$3(a);
52444
+ return isTemplateLiteral$4(a);
52445
52445
  };
52446
52446
 
52447
52447
  const isConcatenation = (path) => {
@@ -52516,7 +52516,7 @@ const wrongShorthand = ({computed, isAssign, keyPath, valuePath}) => {
52516
52516
 
52517
52517
  const {
52518
52518
  isMemberExpression: isMemberExpression$5,
52519
- isSequenceExpression: isSequenceExpression$1,
52519
+ isSequenceExpression: isSequenceExpression$2,
52520
52520
  } = lib_exports;
52521
52521
 
52522
52522
  const maybeTypeAnnotation = (visit) => (path, printer, semantics) => {
@@ -52531,7 +52531,7 @@ function maybePrintTypeAnnotation(path, printer) {
52531
52531
  const {typeAnnotation} = node;
52532
52532
  const {write, traverse} = printer;
52533
52533
 
52534
- if (isSequenceExpression$1(parentPath))
52534
+ if (isSequenceExpression$2(parentPath))
52535
52535
  return;
52536
52536
 
52537
52537
  if (isMemberExpression$5(parentPath))
@@ -52547,7 +52547,7 @@ function maybePrintTypeAnnotation(path, printer) {
52547
52547
  const {
52548
52548
  isAssignmentPattern: isAssignmentPattern$4,
52549
52549
  isArrayExpression: isArrayExpression$5,
52550
- isObjectExpression: isObjectExpression$9,
52550
+ isObjectExpression: isObjectExpression$a,
52551
52551
  isIdentifier: isIdentifier$d,
52552
52552
  } = lib_exports;
52553
52553
 
@@ -52578,7 +52578,7 @@ function isLongAssignPattern(path, semantics) {
52578
52578
  }
52579
52579
 
52580
52580
  function isComplexObject(node) {
52581
- if (!isObjectExpression$9(node))
52581
+ if (!isObjectExpression$a(node))
52582
52582
  return false;
52583
52583
 
52584
52584
  return node.properties.length;
@@ -52660,7 +52660,7 @@ const {
52660
52660
  isAssignmentPattern: isAssignmentPattern$2,
52661
52661
  isObjectPattern: isObjectPattern$2,
52662
52662
  isVariableDeclaration: isVariableDeclaration$3,
52663
- isObjectExpression: isObjectExpression$8,
52663
+ isObjectExpression: isObjectExpression$9,
52664
52664
  } = lib_exports;
52665
52665
 
52666
52666
  function hasObjectPattern(properties) {
@@ -52699,7 +52699,7 @@ function hasAssignObject(path, maxPropertiesLengthInOneLine) {
52699
52699
  for (const prop of properties) {
52700
52700
  const {value} = prop.node;
52701
52701
 
52702
- if (isAssignmentPattern$2(value) && isObjectExpression$8(value.right))
52702
+ if (isAssignmentPattern$2(value) && isObjectExpression$9(value.right))
52703
52703
  return n > 1 || maxPropertiesLengthInOneLine <= value.left;
52704
52704
  }
52705
52705
 
@@ -52822,7 +52822,7 @@ function hasComputed(properties) {
52822
52822
  }
52823
52823
 
52824
52824
  const {
52825
- isObjectExpression: isObjectExpression$7,
52825
+ isObjectExpression: isObjectExpression$8,
52826
52826
  isAssignmentPattern,
52827
52827
  isForOfStatement,
52828
52828
  isFunction: isFunction$6,
@@ -52875,7 +52875,7 @@ function isPrevAssignObject(path) {
52875
52875
 
52876
52876
  const {right} = prev.node.value;
52877
52877
 
52878
- return isObjectExpression$7(right);
52878
+ return isObjectExpression$8(right);
52879
52879
  }
52880
52880
 
52881
52881
  function isNextAssignObject(path) {
@@ -52889,10 +52889,10 @@ function isNextAssignObject(path) {
52889
52889
 
52890
52890
  const {right} = next.node.value;
52891
52891
 
52892
- return isObjectExpression$7(right);
52892
+ return isObjectExpression$8(right);
52893
52893
  }
52894
52894
 
52895
- const {isObjectExpression: isObjectExpression$6} = lib_exports;
52895
+ const {isObjectExpression: isObjectExpression$7} = lib_exports;
52896
52896
 
52897
52897
  const ObjectPattern = {
52898
52898
  print: maybeTypeAnnotation((path, printer, semantics) => {
@@ -52972,7 +52972,7 @@ const ObjectPattern = {
52972
52972
 
52973
52973
  const {right} = valuePath.node;
52974
52974
 
52975
- if (i && !isPrevAssign(property) && !isInsideForOf(path) && isObjectExpression$6(right)) {
52975
+ if (i && !isPrevAssign(property) && !isInsideForOf(path) && isObjectExpression$7(right)) {
52976
52976
  print(',');
52977
52977
  print.newline();
52978
52978
  continue;
@@ -53195,7 +53195,7 @@ const {
53195
53195
  isTemplateElement: isTemplateElement$3,
53196
53196
  isRegExpLiteral: isRegExpLiteral$1,
53197
53197
  isClassMethod,
53198
- isTemplateLiteral: isTemplateLiteral$2,
53198
+ isTemplateLiteral: isTemplateLiteral$3,
53199
53199
  isJSXText: isJSXText$3,
53200
53200
  isJSXAttribute: isJSXAttribute$2,
53201
53201
  isJSXIdentifier: isJSXIdentifier$2,
@@ -53216,7 +53216,7 @@ function extract(node) {
53216
53216
  if (isRegExpLiteral$1(node))
53217
53217
  return node.pattern;
53218
53218
 
53219
- if (isTemplateLiteral$2(node))
53219
+ if (isTemplateLiteral$3(node))
53220
53220
  return extract(node.quasis[0]);
53221
53221
 
53222
53222
  if (isLiteral$2(node))
@@ -53553,9 +53553,7 @@ const setLiteralValue = (path, newValue) => {
53553
53553
  const node = path.node || path;
53554
53554
 
53555
53555
  if (isNumericLiteral(node)) {
53556
- node.value = newValue;
53557
- node.raw = newValue;
53558
-
53556
+ setNumericLiteral(node, newValue);
53559
53557
  return;
53560
53558
  }
53561
53559
 
@@ -53563,6 +53561,17 @@ const setLiteralValue = (path, newValue) => {
53563
53561
  setStringLiteral(node, newValue);
53564
53562
  };
53565
53563
 
53564
+ function setNumericLiteral(node, newValue) {
53565
+ const raw = String(newValue);
53566
+
53567
+ node.value = newValue;
53568
+ node.raw = raw;
53569
+ node.extra.rawValue = newValue;
53570
+ node.extra.raw = raw;
53571
+
53572
+ return;
53573
+ }
53574
+
53566
53575
  function setStringLiteral(node, newValue) {
53567
53576
  const {
53568
53577
  raw,
@@ -53617,13 +53626,13 @@ function isRequire$1(path) {
53617
53626
 
53618
53627
  const {
53619
53628
  isCallExpression: isCallExpression$6,
53620
- isObjectExpression: isObjectExpression$5,
53629
+ isObjectExpression: isObjectExpression$6,
53621
53630
  } = lib_exports;
53622
53631
 
53623
53632
  const nodeOrPath = (path) => path.node || path;
53624
53633
 
53625
53634
  function getNode$1(path) {
53626
- if (!isObjectExpression$5(path))
53635
+ if (!isObjectExpression$6(path))
53627
53636
  return nodeOrPath(path);
53628
53637
 
53629
53638
  if (isCallExpression$6(path.parentPath))
@@ -53678,7 +53687,7 @@ const collect = ({name, collector}) => (path) => {
53678
53687
  };
53679
53688
 
53680
53689
  const {
53681
- isObjectExpression: isObjectExpression$4,
53690
+ isObjectExpression: isObjectExpression$5,
53682
53691
  isObjectPattern: isObjectPattern$1,
53683
53692
  } = lib_exports;
53684
53693
 
@@ -53704,7 +53713,7 @@ const getProperties = (path, names) => {
53704
53713
  };
53705
53714
 
53706
53715
  const getProperty = (path, name) => {
53707
- if (!isObjectExpression$4(path) && !isObjectPattern$1(path))
53716
+ if (!isObjectExpression$5(path) && !isObjectPattern$1(path))
53708
53717
  throw Error(`☝️Looks like path is not 'ObjectExpression | ObjectPattern', but: '${path.type}' for path: ${path}`);
53709
53718
 
53710
53719
  const propertyPaths = path.get(`properties`);
@@ -53791,7 +53800,7 @@ const toExpression = (el) => {
53791
53800
  return toStatement(el);
53792
53801
  };
53793
53802
 
53794
- const {isSequenceExpression} = lib_exports;
53803
+ const {isSequenceExpression: isSequenceExpression$1} = lib_exports;
53795
53804
 
53796
53805
  const replaceWithMultiple = (path, nodes) => {
53797
53806
  const {node} = path;
@@ -53817,7 +53826,7 @@ const replaceWithMultiple = (path, nodes) => {
53817
53826
  if (!newPath.length)
53818
53827
  return newPath;
53819
53828
 
53820
- if (!leadingComments && !isSequenceExpression(path))
53829
+ if (!leadingComments && !isSequenceExpression$1(path))
53821
53830
  delete newPath[0].node.leadingComments;
53822
53831
 
53823
53832
  newPath[0].node.comments = comments || parentComments;
@@ -53951,7 +53960,7 @@ const isESM = (path) => {
53951
53960
  };
53952
53961
 
53953
53962
  const {
53954
- isObjectExpression: isObjectExpression$3,
53963
+ isObjectExpression: isObjectExpression$4,
53955
53964
  isArrayExpression: isArrayExpression$3,
53956
53965
  isObjectProperty: isObjectProperty$1,
53957
53966
  isCallExpression: isCallExpression$5,
@@ -53982,9 +53991,9 @@ const isSimpleAndCall = ([a, b]) => {
53982
53991
  };
53983
53992
 
53984
53993
  const isBooleanAndSimple = ([a, b]) => isBooleanLiteral$1(a) && isSimple(b);
53985
- const isBooleanAndObject = ([a, b]) => isBooleanLiteral$1(a) && isObjectExpression$3(b);
53994
+ const isBooleanAndObject = ([a, b]) => isBooleanLiteral$1(a) && isObjectExpression$4(b);
53986
53995
  const isNullAndSimple = ([a, b]) => isNullLiteral(a) && isSimple(b);
53987
- const isSimpleAndObject = ([a, b]) => isSimple(a) && isObjectExpression$3(b);
53996
+ const isSimpleAndObject = ([a, b]) => isSimple(a) && isObjectExpression$4(b);
53988
53997
  const ONE_LINE = false;
53989
53998
  const MULTI_LINE = true;
53990
53999
 
@@ -54018,7 +54027,7 @@ const isMultiLine = (path, {elements, maxElementsInOneLine, maxElementLengthInOn
54018
54027
  if (elements.length > maxElementsInOneLine && isStringLiteral$6(first))
54019
54028
  return MULTI_LINE;
54020
54029
 
54021
- if (elements.length > 3 && !isObjectExpression$3(first))
54030
+ if (elements.length > 3 && !isObjectExpression$4(first))
54022
54031
  return MULTI_LINE;
54023
54032
 
54024
54033
  if (isSimpleAndNotEmptyObject(elements))
@@ -54239,7 +54248,7 @@ const isStringAndObject = (elements) => {
54239
54248
  const first = elements.at(0);
54240
54249
  const last = elements.at(-1);
54241
54250
 
54242
- return isStringLiteral$6(first) && isObjectExpression$3(last);
54251
+ return isStringLiteral$6(first) && isObjectExpression$4(last);
54243
54252
  };
54244
54253
 
54245
54254
  const isCurrentNewLine = (path) => {
@@ -54252,10 +54261,25 @@ const isCurrentNewLine = (path) => {
54252
54261
  const {
54253
54262
  isStringLiteral: isStringLiteral$5,
54254
54263
  isArrayExpression: isArrayExpression$2,
54264
+ isObjectExpression: isObjectExpression$3,
54265
+ isTemplateLiteral: isTemplateLiteral$2,
54255
54266
  } = lib_exports;
54256
54267
 
54257
54268
  const isInsideArray = (path) => path.parentPath.isArrayExpression();
54258
54269
 
54270
+ const isObjectAfterString = ([first, second]) => {
54271
+ if (!first || !second)
54272
+ return false;
54273
+
54274
+ if (!isObjectExpression$3(second))
54275
+ return false;
54276
+
54277
+ if (isStringLiteral$5(first))
54278
+ return true;
54279
+
54280
+ return isTemplateLiteral$2(first);
54281
+ };
54282
+
54259
54283
  const isArrayIndented = (path) => {
54260
54284
  const elements = path.get('elements');
54261
54285
 
@@ -54264,6 +54288,9 @@ const isArrayIndented = (path) => {
54264
54288
 
54265
54289
  const [first] = elements;
54266
54290
 
54291
+ if (isObjectAfterString(elements))
54292
+ return false;
54293
+
54267
54294
  return !isTwoLongStrings(elements) || !isInsideArray(path) && isIndented(first);
54268
54295
  };
54269
54296
 
@@ -55207,8 +55234,42 @@ const WhileStatement = {
55207
55234
  },
55208
55235
  };
55209
55236
 
55210
- const ExportAllDeclaration = (path, {print}) => {
55237
+ const ImportAttribute = (path, {print}) => {
55238
+ print('__key');
55239
+ print(':');
55240
+ print.space();
55241
+ print('__value');
55242
+ print(',');
55243
+ };
55244
+
55245
+ const printAttributes = (path, {write, traverse, indent}) => {
55246
+ const attributes = path.get('attributes');
55247
+
55248
+ if (!attributes.length)
55249
+ return;
55250
+
55251
+ write.space();
55252
+ write('with');
55253
+ write.space();
55254
+
55255
+ write('{');
55256
+ write.breakline();
55257
+ indent.inc();
55258
+
55259
+ for (const attr of attributes) {
55260
+ indent();
55261
+ traverse(attr);
55262
+ write.newline();
55263
+ }
55264
+
55265
+ indent.dec();
55266
+ write('}');
55267
+ };
55268
+
55269
+ const ExportAllDeclaration = (path, printer) => {
55270
+ const {print} = printer;
55211
55271
  const {exportKind} = path.node;
55272
+
55212
55273
  print('export ');
55213
55274
 
55214
55275
  if (exportKind === 'type')
@@ -55216,6 +55277,7 @@ const ExportAllDeclaration = (path, {print}) => {
55216
55277
 
55217
55278
  print('* from ');
55218
55279
  print('__source');
55280
+ printAttributes(path, printer);
55219
55281
  print(';');
55220
55282
  print.newline();
55221
55283
  };
@@ -55224,7 +55286,7 @@ const {
55224
55286
  isExportNamespaceSpecifier,
55225
55287
  isVariableDeclaration: isVariableDeclaration$1,
55226
55288
  isExportNamedDeclaration: isExportNamedDeclaration$1,
55227
- isExportDefaultSpecifier,
55289
+ isExportDefaultSpecifier: isExportDefaultSpecifier$1,
55228
55290
  } = lib_exports;
55229
55291
 
55230
55292
  const isDeclarationNewline = (path) => isMarkedAfter(path.get('declaration'));
@@ -55268,7 +55330,14 @@ const ExportNamedDeclaration = {
55268
55330
  before(path, {print}) {
55269
55331
  print.linebreak();
55270
55332
  },
55271
- print(path, {print, traverse, indent, maybe}, semantics) {
55333
+ print(path, printer, semantics) {
55334
+ const {
55335
+ print,
55336
+ traverse,
55337
+ indent,
55338
+ maybe,
55339
+ } = printer;
55340
+
55272
55341
  const {trailingComma} = semantics;
55273
55342
  const {exportKind} = path.node;
55274
55343
  const specifiers = path.get('specifiers');
@@ -55286,6 +55355,7 @@ const ExportNamedDeclaration = {
55286
55355
  print(specifiers[0]);
55287
55356
  print(' from ');
55288
55357
  print('__source');
55358
+ printAttributes(path, printer);
55289
55359
  print(';');
55290
55360
  maybe.print.newline(!isLast$2(path));
55291
55361
 
@@ -55302,10 +55372,10 @@ const ExportNamedDeclaration = {
55302
55372
 
55303
55373
  if (!specifiers.length) {
55304
55374
  print('{}');
55305
- } else if (isExportDefaultSpecifier(first) && !rest.length) {
55375
+ } else if (isExportDefaultSpecifier$1(first) && !rest.length) {
55306
55376
  traverse(first);
55307
55377
  } else {
55308
- if (isExportDefaultSpecifier(first)) {
55378
+ if (isExportDefaultSpecifier$1(first)) {
55309
55379
  traverse(first);
55310
55380
  print(',');
55311
55381
  print.space();
@@ -55346,6 +55416,7 @@ const ExportNamedDeclaration = {
55346
55416
  if (exists(source)) {
55347
55417
  print(' from ');
55348
55418
  traverse(source);
55419
+ printAttributes(path, printer);
55349
55420
  }
55350
55421
 
55351
55422
  print(';');
@@ -55439,37 +55510,6 @@ var parseImportSpecifiers_1 = (specifiers) => {
55439
55510
  };
55440
55511
  };
55441
55512
 
55442
- const ImportAttribute = (path, {print}) => {
55443
- print('__key');
55444
- print(':');
55445
- print.space();
55446
- print('__value');
55447
- print(',');
55448
- };
55449
-
55450
- const printAttributes = (path, keyword, {write, traverse, indent}) => {
55451
- const attributes = path.get('attributes');
55452
-
55453
- if (!attributes.length)
55454
- return;
55455
-
55456
- write(` ${keyword}`);
55457
- write.space();
55458
-
55459
- write('{');
55460
- write.breakline();
55461
- indent.inc();
55462
-
55463
- for (const attr of attributes) {
55464
- indent();
55465
- traverse(attr);
55466
- write.newline();
55467
- }
55468
-
55469
- indent.dec();
55470
- write('}');
55471
- };
55472
-
55473
55513
  const {isExportDeclaration: isExportDeclaration$3} = lib_exports;
55474
55514
 
55475
55515
  const printTrailingCommentLine = (path, printer, semantics, {printComment}) => {
@@ -55572,7 +55612,7 @@ const ImportDeclaration = {
55572
55612
  print.space();
55573
55613
 
55574
55614
  print('__source');
55575
- printAttributes(path, 'with', printer);
55615
+ printAttributes(path, printer);
55576
55616
 
55577
55617
  print(';');
55578
55618
 
@@ -56758,20 +56798,20 @@ const maybeEscape = (value, {escapeDoubleQuote, escapeSingleQuote}) => {
56758
56798
  };
56759
56799
 
56760
56800
  const escape$1 = (list, {slash, quote}) => {
56761
- const res = [];
56801
+ const result = [];
56762
56802
 
56763
56803
  for (const [index, char] of list.entries()) {
56764
56804
  const prev = list[index - 1];
56765
56805
 
56766
56806
  if (char === quote && prev !== slash) {
56767
- res.push(`${slash}${char}`);
56807
+ result.push(`${slash}${char}`);
56768
56808
  continue;
56769
56809
  }
56770
56810
 
56771
- res.push(char);
56811
+ result.push(char);
56772
56812
  }
56773
56813
 
56774
- return res.join('');
56814
+ return result.join('');
56775
56815
  };
56776
56816
 
56777
56817
  const DirectiveLiteral = (path, {write}) => {
@@ -58419,7 +58459,7 @@ const createDebug$4 = (tokens) => (a) => {
58419
58459
  return;
58420
58460
 
58421
58461
  tokens.push({
58422
- type: TYPES$2.DEBUG,
58462
+ type: TYPES$3.DEBUG,
58423
58463
  value: `/*__${stringSnakeCase(a)}*/`,
58424
58464
  });
58425
58465
  };
@@ -58604,14 +58644,14 @@ const tokenize = (ast, overrides) => {
58604
58644
 
58605
58645
  const write = (value) => {
58606
58646
  addToken({
58607
- type: TYPES$2.TOKEN,
58647
+ type: TYPES$3.TOKEN,
58608
58648
  value,
58609
58649
  });
58610
58650
  };
58611
58651
 
58612
58652
  const indent = () => {
58613
58653
  addToken({
58614
- type: TYPES$2.INDENT,
58654
+ type: TYPES$3.INDENT,
58615
58655
  value: printIndent(i, format.indent),
58616
58656
  });
58617
58657
  };
@@ -58624,7 +58664,7 @@ const tokenize = (ast, overrides) => {
58624
58664
 
58625
58665
  const newline = () => {
58626
58666
  addToken({
58627
- type: TYPES$2.NEWLINE,
58667
+ type: TYPES$3.NEWLINE,
58628
58668
  value: format.newline,
58629
58669
  });
58630
58670
  };
@@ -58648,7 +58688,7 @@ const tokenize = (ast, overrides) => {
58648
58688
 
58649
58689
  const space = () => {
58650
58690
  addToken({
58651
- type: TYPES$2.SPACE,
58691
+ type: TYPES$3.SPACE,
58652
58692
  value: format.space,
58653
58693
  });
58654
58694
  };
@@ -58665,21 +58705,21 @@ const tokenize = (ast, overrides) => {
58665
58705
 
58666
58706
  const splitter = () => {
58667
58707
  addToken({
58668
- type: TYPES$2.SPLITTER,
58708
+ type: TYPES$3.SPLITTER,
58669
58709
  value: format.splitter,
58670
58710
  });
58671
58711
  };
58672
58712
 
58673
58713
  const quote = () => {
58674
58714
  addToken({
58675
- type: TYPES$2.QUOTE,
58715
+ type: TYPES$3.QUOTE,
58676
58716
  value: format.quote,
58677
58717
  });
58678
58718
  };
58679
58719
 
58680
58720
  const endOfFile = () => {
58681
58721
  addToken({
58682
- type: TYPES$2.END_OF_FILE,
58722
+ type: TYPES$3.END_OF_FILE,
58683
58723
  value: format.endOfFile,
58684
58724
  });
58685
58725
  };
@@ -58903,7 +58943,7 @@ const __toml = `${__toml_name}(__object)`;
58903
58943
  const __filesystem = `${__filesystem_name}(__object)`;
58904
58944
  const __ignore = `${__ignore_name}(__array)`;
58905
58945
 
58906
- const TYPES = [
58946
+ const TYPES$1 = [
58907
58947
  __json_name,
58908
58948
  __toml_name,
58909
58949
  __yaml_name,
@@ -58935,7 +58975,7 @@ const fromJS = (source, name = __json) => {
58935
58975
  const isJSON = (source) => !source.indexOf(__json_name);
58936
58976
  const isTOML = (source) => !source.indexOf(__toml_name);
58937
58977
  const isJSONGroup = (source) => {
58938
- for (const type of TYPES) {
58978
+ for (const type of TYPES$1) {
58939
58979
  if (!source.indexOf(type))
58940
58980
  return true;
58941
58981
  }
@@ -59007,7 +59047,7 @@ function check$d(ast) {
59007
59047
 
59008
59048
  const isString$a = (a) => typeof a === 'string';
59009
59049
 
59010
- var alignSpaces = (str) => {
59050
+ const alignSpaces = (str) => {
59011
59051
  check$c(str);
59012
59052
 
59013
59053
  const array = str.split('\n');
@@ -59057,14 +59097,12 @@ function check$c(str) {
59057
59097
  throw Error('str should be a string!');
59058
59098
  }
59059
59099
 
59060
- var align = alignSpaces.default;
59061
-
59062
59100
  const defaultOptions$5 = {
59063
59101
  alignSpaces: true,
59064
59102
  };
59065
59103
 
59066
59104
  const print$1 = (ast, options) => {
59067
- const {source, alignSpaces} = {
59105
+ const {source, alignSpaces: alignSpaces$1} = {
59068
59106
  ...defaultOptions$5,
59069
59107
  ...options,
59070
59108
  };
@@ -59083,10 +59121,10 @@ const print$1 = (ast, options) => {
59083
59121
 
59084
59122
  code += '\n';
59085
59123
 
59086
- if (!alignSpaces)
59124
+ if (!alignSpaces$1)
59087
59125
  return code;
59088
59126
 
59089
- return align(code);
59127
+ return alignSpaces(code);
59090
59128
  };
59091
59129
 
59092
59130
  const {isArray: isArray$b} = Array;
@@ -61548,14 +61586,14 @@ const getPosition = (path, shebang) => {
61548
61586
  if (!loc)
61549
61587
  return {
61550
61588
  line: 0,
61551
- column: 0,
61589
+ column: 1,
61552
61590
  };
61553
61591
 
61554
61592
  const {line, column} = node.loc.start;
61555
61593
 
61556
61594
  return {
61557
61595
  line: shebang ? line + 1 : line,
61558
- column,
61596
+ column: column + 1,
61559
61597
  };
61560
61598
  };
61561
61599
 
@@ -61947,6 +61985,7 @@ const {
61947
61985
  isFunction: isFunction$1,
61948
61986
  isImportDefaultSpecifier,
61949
61987
  isExportSpecifier,
61988
+ isExportDefaultSpecifier,
61950
61989
  isRegExpLiteral,
61951
61990
  isJSXText: isJSXText$2,
61952
61991
  isJSXIdentifier: isJSXIdentifier$1,
@@ -62187,12 +62226,17 @@ const isImports = (a) => {
62187
62226
  const isExports = (a) => {
62188
62227
  const b = !isArray$5(a) ? a : a[0];
62189
62228
 
62190
- if (!isExportSpecifier(b))
62191
- return false;
62229
+ if (isExportSpecifier(b))
62230
+ return isIdentifier$4(b.local, {
62231
+ name: EXPORTS,
62232
+ });
62192
62233
 
62193
- return isIdentifier$4(b.local, {
62194
- name: EXPORTS,
62195
- });
62234
+ if (isExportDefaultSpecifier(b))
62235
+ return isIdentifier$4(b.exported, {
62236
+ name: EXPORTS,
62237
+ });
62238
+
62239
+ return false;
62196
62240
  };
62197
62241
 
62198
62242
  const __OBJECT_TYPE = 'ObjectPattern|ObjectExpression';
@@ -62324,6 +62368,21 @@ const getTemplateValues = (node, str) => {
62324
62368
  });
62325
62369
  };
62326
62370
 
62371
+ const TYPES = [
62372
+ 'Identifier',
62373
+ 'JSXIdentifier',
62374
+ 'BooleanLiteral',
62375
+ 'StringLiteral',
62376
+ 'TemplateElement',
62377
+ 'RegExpLiteral',
62378
+ 'JSXText',
62379
+ 'JSXAttribute',
62380
+ 'TSTypeReference',
62381
+ 'TSTypeParameter',
62382
+ ];
62383
+
62384
+ const JOINED_TYPES = TYPES.join('|');
62385
+
62327
62386
  function findVarsWays(node) {
62328
62387
  if (isIdentifier$3(node) && is(node.name))
62329
62388
  return {
@@ -62334,7 +62393,7 @@ function findVarsWays(node) {
62334
62393
 
62335
62394
  traverse3(node, {
62336
62395
  noScope: true,
62337
- 'Identifier|JSXIdentifier|BooleanLiteral|StringLiteral|TemplateElement|RegExpLiteral|JSXText|JSXAttribute|TSTypeReference|TSTypeParameter'(path) {
62396
+ [JOINED_TYPES](path) {
62338
62397
  if (isInsideTypeReference(path))
62339
62398
  return;
62340
62399
 
@@ -62374,8 +62433,10 @@ function getValues({waysFrom, node}) {
62374
62433
 
62375
62434
  for (const [name, ways] of entries$6(waysFrom)) {
62376
62435
  for (let way of ways) {
62377
- if (isImportsStr(name) || isExportsStr(name))
62436
+ if (isImportsStr(name))
62378
62437
  way = way.replace(/\.0.local$/, '');
62438
+ else if (isExportsStr(name))
62439
+ way = way.replace(/\.0.(local|exported)$/, '');
62379
62440
  else if (isArgsStr(name) || isJSXChildrenStr(name) || isJSXAttributesStr(name) || isTypeParamsStr(name))
62380
62441
  way = way.replace(/\.0$/, '');
62381
62442
 
@@ -62404,8 +62465,10 @@ function setValues({waysTo, values, path}) {
62404
62465
  continue;
62405
62466
  }
62406
62467
 
62407
- if (isImportsStr(name) || isExportsStr(name))
62468
+ if (isImportsStr(name))
62408
62469
  way = way.replace(/\.0.local$/, '');
62470
+ else if (isExportsStr(name))
62471
+ way = way.replace(/\.0.(local|exported)$/, '');
62409
62472
 
62410
62473
  if (isArgsStr(name) || isJSXChildrenStr(name) || isJSXAttributesStr(name))
62411
62474
  way = way.replace(/\.0$/, '');
@@ -63643,7 +63706,7 @@ const watermark = (from, to, path) => {
63643
63706
  };
63644
63707
 
63645
63708
  return {
63646
- init: wraptile$1(init$2, options),
63709
+ init: wraptile$1(init, options),
63647
63710
  has: wraptile$1(has, options),
63648
63711
  add: wraptile$1(add, options),
63649
63712
  };
@@ -63661,7 +63724,7 @@ function create(from, to, path) {
63661
63724
  };
63662
63725
  }
63663
63726
 
63664
- function init$2({path, program}) {
63727
+ function init({path, program}) {
63665
63728
  if (path.node)
63666
63729
  path.node[name] = path.node[name] || new Set();
63667
63730
 
@@ -63669,7 +63732,7 @@ function init$2({path, program}) {
63669
63732
  }
63670
63733
 
63671
63734
  function add({path, program, watermark, highWatermark}) {
63672
- init$2({
63735
+ init({
63673
63736
  path,
63674
63737
  program,
63675
63738
  });
@@ -64177,37 +64240,23 @@ const writeFileContent$1 = (name, content) => {
64177
64240
  maybeFS.writeFileContent(name, content);
64178
64241
  };
64179
64242
 
64180
- function init$1(fsDriver) {
64243
+ const inject = (fsDriver) => {
64181
64244
  assign(maybeFS, fsDriver);
64182
- }
64245
+ };
64183
64246
 
64184
- const pause$1 = () => {
64247
+ const pause = () => {
64185
64248
  driverStore(maybeFS);
64186
- deinit$1();
64249
+ eject();
64187
64250
  };
64188
64251
 
64189
- const start$1 = () => {
64190
- init$1(driverStore());
64252
+ const start = () => {
64253
+ inject(driverStore());
64191
64254
  };
64192
64255
 
64193
- function deinit$1() {
64256
+ function eject() {
64194
64257
  assign(maybeFS, defaultFS);
64195
64258
  }
64196
64259
 
64197
- var maybeFS$1 = /*#__PURE__*/Object.freeze({
64198
- __proto__: null,
64199
- copyFile: copyFile$1,
64200
- createDirectory: createDirectory$1,
64201
- deinit: deinit$1,
64202
- init: init$1,
64203
- pause: pause$1,
64204
- readFileContent: readFileContent$1,
64205
- removeFile: removeFile$1,
64206
- renameFile: renameFile$1,
64207
- start: start$1,
64208
- writeFileContent: writeFileContent$1
64209
- });
64210
-
64211
64260
  const {isFile, isProgram: isProgram$1} = lib_exports;
64212
64261
  const {merge} = traverse3.visitors;
64213
64262
  const {entries: entries$2} = Object;
@@ -64418,7 +64467,10 @@ function parseFindFileOptions(options) {
64418
64467
  }
64419
64468
 
64420
64469
  function findFile(node, name, options) {
64421
- const {exclude = [], crawled = crawlDirectory(node)} = parseFindFileOptions(options);
64470
+ const {
64471
+ exclude = [],
64472
+ crawled = crawlDirectory(node),
64473
+ } = parseFindFileOptions(options);
64422
64474
 
64423
64475
  checkName(name);
64424
64476
 
@@ -64806,13 +64858,6 @@ function getFile(directoryPath, name, {type} = {}) {
64806
64858
  return files.values();
64807
64859
  }
64808
64860
 
64809
- const {
64810
- init,
64811
- deinit,
64812
- pause,
64813
- start,
64814
- } = maybeFS$1;
64815
-
64816
64861
  const {
64817
64862
  objectExpression,
64818
64863
  arrayExpression: arrayExpression$1,
@@ -65130,6 +65175,7 @@ const createTraverse = ({scan, rule, progress}) => ({push, options}) => ({
65130
65175
  fileProgress,
65131
65176
  crawled,
65132
65177
  });
65178
+
65133
65179
  const crawlFile = createCrawlFile(crawled);
65134
65180
 
65135
65181
  scan(rootPath, {
@@ -71621,6 +71667,7 @@ const {
71621
71667
  isLabeledStatement,
71622
71668
  isObjectPattern,
71623
71669
  isCallExpression,
71670
+ isSequenceExpression,
71624
71671
  objectPattern,
71625
71672
  objectProperty,
71626
71673
  } = lib_exports;
@@ -71645,6 +71692,15 @@ const addArgs = (args) => ({
71645
71692
  const fix$3 = ({declaration, path, pattern, params, index}) => {
71646
71693
  const declarationNode = template$1.ast.fresh(declaration);
71647
71694
 
71695
+ if (isSequenceExpression(declarationNode)) {
71696
+ const {expressions} = declarationNode;
71697
+ const {block} = path.scope;
71698
+ const {params} = block;
71699
+
71700
+ block.params.push(...expressions.slice(params.length));
71701
+ return;
71702
+ }
71703
+
71648
71704
  if (isBlockStatement(declarationNode)) {
71649
71705
  const prop = createProperty(declarationNode.body[0]);
71650
71706
  pattern.properties.push(prop);
@@ -71781,6 +71837,7 @@ const expressions = [
71781
71837
  'yield',
71782
71838
  'typeof',
71783
71839
  'function',
71840
+ 'instanceof',
71784
71841
  ];
71785
71842
 
71786
71843
  const statements = [
@@ -72002,7 +72059,7 @@ function magicParse(name, content) {
72002
72059
  return [js, ast];
72003
72060
  }
72004
72061
 
72005
- if (/\.(c|m)?ts(x)?$/.test(name)) {
72062
+ if (/\.[cm]?ts(x)?$/.test(name)) {
72006
72063
  const ast = parse$2(content, {
72007
72064
  isTS: true,
72008
72065
  });
@@ -72441,7 +72498,6 @@ var operator = /*#__PURE__*/Object.freeze({
72441
72498
  createFile: createFile,
72442
72499
  createNestedDirectory: createNestedDirectory,
72443
72500
  declare: declare$1,
72444
- deinit: deinit,
72445
72501
  extract: extract,
72446
72502
  findBinding: findBinding,
72447
72503
  findFile: findFile,
@@ -72473,7 +72529,6 @@ var operator = /*#__PURE__*/Object.freeze({
72473
72529
  hasParens: hasParens,
72474
72530
  hasTagName: hasTagName,
72475
72531
  ignore: ignore,
72476
- init: init,
72477
72532
  insertAfter: insertAfter,
72478
72533
  insertBefore: insertBefore,
72479
72534
  isConditionKeyword: isConditionKeyword,
@@ -72493,7 +72548,6 @@ var operator = /*#__PURE__*/Object.freeze({
72493
72548
  matchFiles: matchFiles,
72494
72549
  moveFile: moveFile,
72495
72550
  parseTemplate: parseTemplate,
72496
- pause: pause,
72497
72551
  readDirectory: readDirectory,
72498
72552
  readFileContent: readFileContent,
72499
72553
  remove: remove,
@@ -72511,7 +72565,6 @@ var operator = /*#__PURE__*/Object.freeze({
72511
72565
  setAttributeValue: setAttributeValue,
72512
72566
  setLiteralValue: setLiteralValue,
72513
72567
  setValues: setValues,
72514
- start: start,
72515
72568
  toExpression: toExpression,
72516
72569
  toJS: toJS,
72517
72570
  transformRegExp: transformRegExp,