@putout/bundle 5.2.1 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/putout.js CHANGED
@@ -1,33 +1,4 @@
1
- function getAugmentedNamespace(n) {
2
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
3
- var f = n.default;
4
- if (typeof f == "function") {
5
- var a = function a () {
6
- var isInstance = false;
7
- try {
8
- isInstance = this instanceof a;
9
- } catch {}
10
- if (isInstance) {
11
- return Reflect.construct(f, arguments, this.constructor);
12
- }
13
- return f.apply(this, arguments);
14
- };
15
- a.prototype = f.prototype;
16
- } else a = {};
17
- Object.defineProperty(a, '__esModule', {value: true});
18
- Object.keys(n).forEach(function (k) {
19
- var d = Object.getOwnPropertyDescriptor(n, k);
20
- Object.defineProperty(a, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () {
23
- return n[k];
24
- }
25
- });
26
- });
27
- return a;
28
- }
29
-
30
- var fullstore$1 = (value) => {
1
+ function fullstore(value) {
31
2
  const data = {
32
3
  value,
33
4
  };
@@ -42,9 +13,7 @@ var fullstore$1 = (value) => {
42
13
 
43
14
  return value;
44
15
  };
45
- };
46
-
47
- var fullstore$2 = fullstore$1;
16
+ }
48
17
 
49
18
  var global$1 = (typeof global !== "undefined" ? global :
50
19
  typeof self !== "undefined" ? self :
@@ -3024,7 +2993,7 @@ __export(lib_exports, {
3024
2993
  TSUnionType: () => TSUnionType$1,
3025
2994
  TSUnknownKeyword: () => TSUnknownKeyword$1,
3026
2995
  TSVoidKeyword: () => TSVoidKeyword$1,
3027
- TYPES: () => TYPES$4,
2996
+ TYPES: () => TYPES$3,
3028
2997
  TYPESCRIPT_TYPES: () => TYPESCRIPT_TYPES,
3029
2998
  TaggedTemplateExpression: () => TaggedTemplateExpression$1,
3030
2999
  TemplateElement: () => TemplateElement,
@@ -3890,7 +3859,7 @@ __export(lib_exports, {
3890
3859
  toKeyAlias: () => toKeyAlias,
3891
3860
  toStatement: () => toStatement$1,
3892
3861
  topicReference: () => topicReference,
3893
- traverse: () => traverse$2,
3862
+ traverse: () => traverse$4,
3894
3863
  traverseFast: () => traverseFast,
3895
3864
  tryStatement: () => tryStatement,
3896
3865
  tsAnyKeyword: () => tsAnyKeyword,
@@ -13772,7 +13741,7 @@ for (const {types: types2, set} of allExpandedTypes) {
13772
13741
  }
13773
13742
  }
13774
13743
 
13775
- var TYPES$4 = [].concat(Object.keys(VISITOR_KEYS), Object.keys(FLIPPED_ALIAS_KEYS), Object.keys(DEPRECATED_KEYS));
13744
+ var TYPES$3 = [].concat(Object.keys(VISITOR_KEYS), Object.keys(FLIPPED_ALIAS_KEYS), Object.keys(DEPRECATED_KEYS));
13776
13745
 
13777
13746
  function validate$1$1(node, key, val) {
13778
13747
  if (!node)
@@ -19795,7 +19764,7 @@ function getFunctionName(node, parent) {
19795
19764
  };
19796
19765
  }
19797
19766
 
19798
- function traverse$2(node, handlers, state) {
19767
+ function traverse$4(node, handlers, state) {
19799
19768
  if (typeof handlers === 'function') {
19800
19769
  handlers = {
19801
19770
  enter: handlers,
@@ -21579,7 +21548,7 @@ var TokContext = class {
21579
21548
  preserveSpace;
21580
21549
  };
21581
21550
 
21582
- var types$2 = {
21551
+ var types = {
21583
21552
  brace: new TokContext('{'),
21584
21553
  j_oTag: new TokContext('<tag'),
21585
21554
  j_cTag: new TokContext('</tag'),
@@ -23493,9 +23462,9 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23493
23462
  switch(this.state.type) {
23494
23463
  case 2:
23495
23464
  node = this.startNode();
23496
- this.setContext(types$2.brace);
23465
+ this.setContext(types.brace);
23497
23466
  this.next();
23498
- node = this.jsxParseExpressionContainer(node, types$2.j_oTag);
23467
+ node = this.jsxParseExpressionContainer(node, types.j_oTag);
23499
23468
 
23500
23469
  if (node.expression.type === 'JSXEmptyExpression') {
23501
23470
  this.raise(JsxErrors.AttributeIsEmpty, node);
@@ -23520,7 +23489,7 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23520
23489
  jsxParseSpreadChild(node) {
23521
23490
  this.next();
23522
23491
  node.expression = this.parseExpression();
23523
- this.setContext(types$2.j_expr);
23492
+ this.setContext(types.j_expr);
23524
23493
  this.state.canStartJSXElement = true;
23525
23494
  this.expect(4);
23526
23495
  return this.finishNode(node, 'JSXSpreadChild');
@@ -23549,11 +23518,11 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23549
23518
  const node = this.startNode();
23550
23519
 
23551
23520
  if (this.match(2)) {
23552
- this.setContext(types$2.brace);
23521
+ this.setContext(types.brace);
23553
23522
  this.next();
23554
23523
  this.expect(17);
23555
23524
  node.argument = this.parseMaybeAssignAllowIn();
23556
- this.setContext(types$2.j_oTag);
23525
+ this.setContext(types.j_oTag);
23557
23526
  this.state.canStartJSXElement = true;
23558
23527
  this.expect(4);
23559
23528
  return this.finishNode(node, 'JSXSpreadAttribute');
@@ -23627,13 +23596,13 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23627
23596
 
23628
23597
  case 2: {
23629
23598
  const node2 = this.startNode();
23630
- this.setContext(types$2.brace);
23599
+ this.setContext(types.brace);
23631
23600
  this.next();
23632
23601
 
23633
23602
  if (this.match(17)) {
23634
23603
  children.push(this.jsxParseSpreadChild(node2));
23635
23604
  } else {
23636
- children.push(this.jsxParseExpressionContainer(node2, types$2.j_expr));
23605
+ children.push(this.jsxParseExpressionContainer(node2, types.j_expr));
23637
23606
  }
23638
23607
 
23639
23608
  break;
@@ -23709,12 +23678,12 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23709
23678
  getTokenFromCode(code2) {
23710
23679
  const context = this.curContext();
23711
23680
 
23712
- if (context === types$2.j_expr) {
23681
+ if (context === types.j_expr) {
23713
23682
  this.jsxReadToken();
23714
23683
  return;
23715
23684
  }
23716
23685
 
23717
- if (context === types$2.j_oTag || context === types$2.j_cTag) {
23686
+ if (context === types.j_oTag || context === types.j_cTag) {
23718
23687
  if (isIdentifierStart2(code2)) {
23719
23688
  this.jsxReadWord();
23720
23689
  return;
@@ -23726,7 +23695,7 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23726
23695
  return;
23727
23696
  }
23728
23697
 
23729
- if ((code2 === 34 || code2 === 39) && context === types$2.j_oTag) {
23698
+ if ((code2 === 34 || code2 === 39) && context === types.j_oTag) {
23730
23699
  this.jsxReadString(code2);
23731
23700
  return;
23732
23701
  }
@@ -23745,18 +23714,18 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
23745
23714
  const {context, type} = this.state;
23746
23715
 
23747
23716
  if (type === 52 && prevType === 138) {
23748
- context.splice(-2, 2, types$2.j_cTag);
23717
+ context.splice(-2, 2, types.j_cTag);
23749
23718
  this.state.canStartJSXElement = false;
23750
23719
  } else if (type === 138) {
23751
- context.push(types$2.j_oTag);
23720
+ context.push(types.j_oTag);
23752
23721
  } else if (type === 139) {
23753
23722
  const out = context[context.length - 1];
23754
23723
 
23755
- if (out === types$2.j_oTag && prevType === 52 || out === types$2.j_cTag) {
23724
+ if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
23756
23725
  context.pop();
23757
- this.state.canStartJSXElement = context[context.length - 1] === types$2.j_expr;
23726
+ this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
23758
23727
  } else {
23759
- this.setContext(types$2.j_expr);
23728
+ this.setContext(types.j_expr);
23760
23729
  this.state.canStartJSXElement = true;
23761
23730
  }
23762
23731
  } else {
@@ -24338,7 +24307,7 @@ var State$2 = class _State {
24338
24307
  end = 0;
24339
24308
  lastTokEndLoc = null;
24340
24309
  lastTokStartLoc = null;
24341
- context = [types$2.brace];
24310
+ context = [types.brace];
24342
24311
  get canStartJSXElement() {
24343
24312
  return (this.flags & 1024) > 0;
24344
24313
  }
@@ -28726,7 +28695,7 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
28726
28695
  }
28727
28696
 
28728
28697
  tsInTopLevelContext(cb) {
28729
- if (this.curContext() !== types$2.brace) {
28698
+ if (this.curContext() !== types.brace) {
28730
28699
  const oldContext = this.state.context;
28731
28700
 
28732
28701
  this.state.context = [oldContext[0]];
@@ -29112,7 +29081,7 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
29112
29081
 
29113
29082
  if (node.params.length === 0) {
29114
29083
  this.raise(TSErrors.EmptyTypeArguments, node);
29115
- } else if (!this.state.inType && this.curContext() === types$2.brace) {
29084
+ } else if (!this.state.inType && this.curContext() === types.brace) {
29116
29085
  this.reScan_lt_gt();
29117
29086
  }
29118
29087
 
@@ -30019,7 +29988,7 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
30019
29988
 
30020
29989
  const currentContext = context[context.length - 1];
30021
29990
 
30022
- if (currentContext === types$2.j_oTag || currentContext === types$2.j_expr) {
29991
+ if (currentContext === types.j_oTag || currentContext === types.j_expr) {
30023
29992
  context.pop();
30024
29993
  }
30025
29994
  }
@@ -35636,16 +35605,6 @@ function parse$9(input, options) {
35636
35605
  }
35637
35606
  }
35638
35607
 
35639
- function parseExpression$1(input, options) {
35640
- const parser = getParser$1(options, input);
35641
-
35642
- if (parser.options.strictMode) {
35643
- parser.state.strict = true;
35644
- }
35645
-
35646
- return parser.getExpression();
35647
- }
35648
-
35649
35608
  function generateExportedTokenTypes(internalTokenTypes) {
35650
35609
  const tokenTypes2 = {};
35651
35610
 
@@ -35656,7 +35615,7 @@ function generateExportedTokenTypes(internalTokenTypes) {
35656
35615
  return tokenTypes2;
35657
35616
  }
35658
35617
 
35659
- var tokTypes = generateExportedTokenTypes(tt);
35618
+ generateExportedTokenTypes(tt);
35660
35619
 
35661
35620
  function getParser$1(options, input) {
35662
35621
  let cls = Parser;
@@ -44863,7 +44822,7 @@ function verify$1(visitor) {
44863
44822
  continue;
44864
44823
 
44865
44824
  if (!TYPES2.includes(nodeType)) {
44866
- throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${'8.0.0-beta.3'}`);
44825
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${'8.0.0-beta.4'}`);
44867
44826
  }
44868
44827
 
44869
44828
  const visitors2 = visitor[nodeType];
@@ -47789,7 +47748,7 @@ function replaceWithSourceString(replacement) {
47789
47748
  return this.replaceWith(expressionAST);
47790
47749
  }
47791
47750
 
47792
- function replaceWith$3(replacementPath) {
47751
+ function replaceWith$1(replacementPath) {
47793
47752
  resync.call(this);
47794
47753
 
47795
47754
  if (this.removed) {
@@ -50418,7 +50377,7 @@ var methods = {
50418
50377
  isGenericType,
50419
50378
  replaceWithMultiple: replaceWithMultiple$1,
50420
50379
  replaceWithSourceString,
50421
- replaceWith: replaceWith$3,
50380
+ replaceWith: replaceWith$1,
50422
50381
  replaceExpressionWithStatements,
50423
50382
  replaceInline,
50424
50383
  evaluateTruthy,
@@ -50475,7 +50434,7 @@ var methods = {
50475
50434
  };
50476
50435
 
50477
50436
  Object.assign(NodePath_Final.prototype, methods);
50478
- for (const type of TYPES$4) {
50437
+ for (const type of TYPES$3) {
50479
50438
  const typeKey = `is${type}`;
50480
50439
  const fn = lib_exports[typeKey];
50481
50440
 
@@ -50494,8 +50453,8 @@ for (const type of Object.keys(virtualTypes)) {
50494
50453
  if (type.startsWith('_'))
50495
50454
  continue;
50496
50455
 
50497
- if (!TYPES$4.includes(type))
50498
- TYPES$4.push(type);
50456
+ if (!TYPES$3.includes(type))
50457
+ TYPES$3.push(type);
50499
50458
  }
50500
50459
 
50501
50460
  var {VISITOR_KEYS: VISITOR_KEYS$2} = lib_exports;
@@ -51167,19 +51126,7 @@ traverse3.hasType = function(tree, type, denylistTypes) {
51167
51126
  };
51168
51127
  traverse3.cache = cache;
51169
51128
 
51170
- var bundle = /*#__PURE__*/Object.freeze({
51171
- __proto__: null,
51172
- codeFrameColumns: codeFrameColumns,
51173
- generate: generate$1,
51174
- parse: parse$9,
51175
- parseExpression: parseExpression$1,
51176
- template: index,
51177
- tokTypes: tokTypes,
51178
- traverse: traverse3,
51179
- types: lib_exports
51180
- });
51181
-
51182
- const TYPES$3 = {
51129
+ const TYPES$2 = {
51183
51130
  TOKEN: 'Token',
51184
51131
  NEWLINE: 'Newline',
51185
51132
  SPLITTER: 'Splitter',
@@ -52879,7 +52826,7 @@ function maybePrintBrace(brace, path, printer, semantics) {
52879
52826
 
52880
52827
  const {isArrayExpression: isArrayExpression$8} = lib_exports;
52881
52828
 
52882
- const TYPES$2 = [
52829
+ const TYPES$1 = [
52883
52830
  'NullLiteral',
52884
52831
  'NumericLiteral',
52885
52832
  'BigIntLiteral',
@@ -52896,7 +52843,7 @@ const isInsideTuple = (path) => {
52896
52843
  if (second !== path.node)
52897
52844
  return false;
52898
52845
 
52899
- return TYPES$2.includes(first.type);
52846
+ return TYPES$1.includes(first.type);
52900
52847
  };
52901
52848
 
52902
52849
  const {
@@ -54040,7 +53987,7 @@ function usedInAssignment(path) {
54040
53987
  return false;
54041
53988
  }
54042
53989
 
54043
- const {entries: entries$a} = Object;
53990
+ const {entries: entries$b} = Object;
54044
53991
  const isOneDeclaration = ({node}) => node.declarations.length === 1;
54045
53992
 
54046
53993
  const remove = (path) => {
@@ -54066,7 +54013,7 @@ const remove = (path) => {
54066
54013
  const elements = path.parentPath.get('elements');
54067
54014
  const n = elements.length - 1;
54068
54015
 
54069
- for (const [i, el] of entries$a(elements)) {
54016
+ for (const [i, el] of entries$b(elements)) {
54070
54017
  if (el !== path)
54071
54018
  continue;
54072
54019
 
@@ -54296,7 +54243,7 @@ const getProperties = (path, names) => {
54296
54243
  return result;
54297
54244
  };
54298
54245
 
54299
- const getProperty$2 = (path, name) => {
54246
+ const getProperty = (path, name) => {
54300
54247
  if (!isObjectExpression$4(path) && !isObjectPattern$1(path))
54301
54248
  throw Error(`☝️Looks like path is not 'ObjectExpression | ObjectPattern', but: '${path.type}' for path: ${path}`);
54302
54249
 
@@ -54442,7 +54389,7 @@ const parseNode$2 = (a) => {
54442
54389
  return a;
54443
54390
  };
54444
54391
 
54445
- const replaceWith$2 = (path, node) => {
54392
+ const replaceWith = (path, node) => {
54446
54393
  node = parseNode$2(node);
54447
54394
 
54448
54395
  if (path?.parentPath?.isExpressionStatement() && !path.parentPath.isProgram()) {
@@ -54543,34 +54490,6 @@ const isESM = (path) => {
54543
54490
  return false;
54544
54491
  };
54545
54492
 
54546
- var operate = /*#__PURE__*/Object.freeze({
54547
- __proto__: null,
54548
- compute: compute,
54549
- extract: extract,
54550
- findBinding: findBinding,
54551
- getBinding: getBinding,
54552
- getBindingPath: getBindingPath,
54553
- getExportDefault: getExportDefault,
54554
- getLiteralRaw: getLiteralRaw,
54555
- getPathAfterImports: getPathAfterImports,
54556
- getPathAfterRequires: getPathAfterRequires,
54557
- getProperties: getProperties,
54558
- getProperty: getProperty$2,
54559
- insertAfter: insertAfter,
54560
- insertBefore: insertBefore,
54561
- isESM: isESM,
54562
- isModuleExports: isModuleExports,
54563
- isSimple: isSimple,
54564
- remove: remove,
54565
- rename: rename,
54566
- renameProperty: renameProperty,
54567
- replaceWith: replaceWith$2,
54568
- replaceWithMultiple: replaceWithMultiple,
54569
- setLiteralValue: setLiteralValue,
54570
- toExpression: toExpression,
54571
- traverseProperties: traverseProperties
54572
- });
54573
-
54574
54493
  const {
54575
54494
  isObjectExpression: isObjectExpression$3,
54576
54495
  isArrayExpression: isArrayExpression$3,
@@ -56002,6 +55921,35 @@ const ExportNamedDeclaration = {
56002
55921
  },
56003
55922
  };
56004
55923
 
55924
+ function getAugmentedNamespace(n) {
55925
+ if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
55926
+ var f = n.default;
55927
+ if (typeof f == "function") {
55928
+ var a = function a () {
55929
+ var isInstance = false;
55930
+ try {
55931
+ isInstance = this instanceof a;
55932
+ } catch {}
55933
+ if (isInstance) {
55934
+ return Reflect.construct(f, arguments, this.constructor);
55935
+ }
55936
+ return f.apply(this, arguments);
55937
+ };
55938
+ a.prototype = f.prototype;
55939
+ } else a = {};
55940
+ Object.defineProperty(a, '__esModule', {value: true});
55941
+ Object.keys(n).forEach(function (k) {
55942
+ var d = Object.getOwnPropertyDescriptor(n, k);
55943
+ Object.defineProperty(a, k, d.get ? d : {
55944
+ enumerable: true,
55945
+ get: function () {
55946
+ return n[k];
55947
+ }
55948
+ });
55949
+ });
55950
+ return a;
55951
+ }
55952
+
56005
55953
  var parseImportSpecifiers_1 = (specifiers) => {
56006
55954
  const defaults = [];
56007
55955
  const namespaces = [];
@@ -58660,168 +58608,168 @@ const JSXClosingElement = (path, {print}) => {
58660
58608
  };
58661
58609
 
58662
58610
  var baseVisitors = /*#__PURE__*/Object.freeze({
58663
- __proto__: null,
58664
- ArrayExpression: ArrayExpression,
58665
- ArrayPattern: ArrayPattern,
58666
- ArrowFunctionExpression: ArrowFunctionExpression,
58667
- AssignmentExpression: AssignmentExpression,
58668
- AssignmentPattern: AssignmentPattern,
58669
- AwaitExpression: AwaitExpression,
58670
- BigIntLiteral: BigIntLiteral,
58671
- BinaryExpression: BinaryExpression,
58672
- BlockStatement: BlockStatement,
58673
- BooleanLiteral: BooleanLiteral,
58674
- BreakStatement: BreakStatement,
58675
- CallExpression: CallExpression,
58676
- CatchClause: CatchClause,
58677
- ClassAccessorProperty: ClassAccessorProperty,
58678
- ClassDeclaration: ClassDeclaration,
58679
- ClassExpression: ClassExpression,
58680
- ClassMethod: ClassMethod,
58681
- ClassPrivateMethod: ClassPrivateMethod,
58682
- ClassPrivateProperty: ClassPrivateProperty,
58683
- ClassProperty: ClassProperty,
58684
- ConditionalExpression: ConditionalExpression,
58685
- ContinueStatement: ContinueStatement,
58686
- DebuggerStatement: DebuggerStatement,
58687
- Decorator: Decorator,
58688
- Directive: Directive,
58689
- DirectiveLiteral: DirectiveLiteral,
58690
- DoWhileStatement: DoWhileStatement,
58691
- EmptyStatement: EmptyStatement,
58692
- ExportAllDeclaration: ExportAllDeclaration,
58693
- ExportDefaultDeclaration: ExportDefaultDeclaration,
58694
- ExportDefaultSpecifier: ExportDefaultSpecifier,
58695
- ExportNamedDeclaration: ExportNamedDeclaration,
58696
- ExportNamespaceSpecifier: ExportNamespaceSpecifier,
58697
- ExportSpecifier: ExportSpecifier,
58698
- ExpressionStatement: ExpressionStatement,
58699
- ForInStatement: ForInStatement,
58700
- ForOfStatement: ForOfStatement,
58701
- ForStatement: ForStatement,
58702
- FunctionDeclaration: FunctionDeclaration,
58703
- FunctionExpression: FunctionExpression,
58704
- Identifier: Identifier,
58705
- IfStatement: IfStatement,
58706
- ImportAttribute: ImportAttribute,
58707
- ImportDeclaration: ImportDeclaration,
58708
- ImportExpression: ImportExpression,
58709
- InterpreterDirective: InterpreterDirective,
58710
- JSXAttribute: JSXAttribute,
58711
- JSXClosingElement: JSXClosingElement,
58712
- JSXClosingFragment: JSXClosingFragment,
58713
- JSXElement: JSXElement,
58714
- JSXEmptyExpression: JSXEmptyExpression,
58715
- JSXExpressionContainer: JSXExpressionContainer,
58716
- JSXFragment: JSXFragment,
58717
- JSXIdentifier: JSXIdentifier,
58718
- JSXMemberExpression: JSXMemberExpression,
58719
- JSXOpeningElement: JSXOpeningElement,
58720
- JSXOpeningFragment: JSXOpeningFragment,
58721
- JSXSpreadAttribute: JSXSpreadAttribute,
58722
- JSXText: JSXText,
58723
- LabeledStatement: LabeledStatement,
58724
- LogicalExpression: LogicalExpression,
58725
- MemberExpression: MemberExpression,
58726
- MetaProperty: MetaProperty,
58727
- NewExpression: NewExpression,
58728
- NullLiteral: NullLiteral,
58729
- NumericLiteral: NumericLiteral,
58730
- ObjectExpression: ObjectExpression,
58731
- ObjectMethod: ObjectMethod,
58732
- ObjectPattern: ObjectPattern,
58733
- ObjectProperty: ObjectProperty,
58734
- OptionalCallExpression: OptionalCallExpression,
58735
- OptionalMemberExpression: OptionalMemberExpression,
58736
- ParenthesizedExpression: ParenthesizedExpression,
58737
- PrivateName: PrivateName,
58738
- Program: Program,
58739
- RegExpLiteral: RegExpLiteral,
58740
- RestElement: RestElement,
58741
- ReturnStatement: ReturnStatement,
58742
- SequenceExpression: SequenceExpression,
58743
- SpreadElement: SpreadElement,
58744
- StaticBlock: StaticBlock,
58745
- StringLiteral: StringLiteral,
58746
- Super: Super,
58747
- SwitchStatement: SwitchStatement,
58748
- TSAnyKeyword: TSAnyKeyword,
58749
- TSArrayType: TSArrayType,
58750
- TSAsExpression: TSAsExpression,
58751
- TSBigIntKeyword: TSBigIntKeyword,
58752
- TSBooleanKeyword: TSBooleanKeyword,
58753
- TSCallSignatureDeclaration: TSCallSignatureDeclaration,
58754
- TSClassImplements: TSClassImplements,
58755
- TSConditionalType: TSConditionalType,
58756
- TSConstructSignatureDeclaration: TSConstructSignatureDeclaration,
58757
- TSConstructorType: TSConstructorType,
58758
- TSDeclareFunction: TSDeclareFunction,
58759
- TSDeclareMethod: TSDeclareMethod,
58760
- TSEnumDeclaration: TSEnumDeclaration,
58761
- TSEnumMember: TSEnumMember,
58762
- TSExportAssignment: TSExportAssignment,
58763
- TSExternalModuleReference: TSExternalModuleReference,
58764
- TSFunctionType: TSFunctionType,
58765
- TSImportEqualsDeclaration: TSImportEqualsDeclaration,
58766
- TSImportType: TSImportType,
58767
- TSIndexSignature: TSIndexSignature,
58768
- TSIndexedAccessType: TSIndexedAccessType,
58769
- TSInferType: TSInferType,
58770
- TSInstantiationExpression: TSInstantiationExpression,
58771
- TSInterfaceBody: TSInterfaceBody,
58772
- TSInterfaceDeclaration: TSInterfaceDeclaration,
58773
- TSInterfaceHeritage: TSInterfaceHeritage,
58774
- TSIntersectionType: TSIntersectionType,
58775
- TSLiteralType: TSLiteralType,
58776
- TSMappedType: TSMappedType,
58777
- TSMethodSignature: TSMethodSignature,
58778
- TSModuleBlock: TSModuleBlock,
58779
- TSModuleDeclaration: TSModuleDeclaration,
58780
- TSNamedTupleMember: TSNamedTupleMember,
58781
- TSNeverKeyword: TSNeverKeyword,
58782
- TSNonNullExpression: TSNonNullExpression,
58783
- TSNullKeyword: TSNullKeyword,
58784
- TSNumberKeyword: TSNumberKeyword,
58785
- TSObjectKeyword: TSObjectKeyword,
58786
- TSOptionalType: TSOptionalType,
58787
- TSParameterProperty: TSParameterProperty,
58788
- TSParenthesizedType: TSParenthesizedType,
58789
- TSPropertySignature: TSPropertySignature,
58790
- TSQualifiedName: TSQualifiedName,
58791
- TSRestType: TSRestType,
58792
- TSSatisfiesExpression: TSSatisfiesExpression,
58793
- TSStringKeyword: TSStringKeyword,
58794
- TSSymbolKeyword: TSSymbolKeyword,
58795
- TSTemplateLiteralType: TSTemplateLiteralType,
58796
- TSThisType: TSThisType,
58797
- TSTupleType: TSTupleType,
58798
- TSTypeAliasDeclaration: TSTypeAliasDeclaration,
58799
- TSTypeAnnotation: TSTypeAnnotation,
58800
- TSTypeAssertion: TSTypeAssertion,
58801
- TSTypeLiteral: TSTypeLiteral,
58802
- TSTypeOperator: TSTypeOperator,
58803
- TSTypeParameter: TSTypeParameter,
58804
- TSTypeParameterDeclaration: TSTypeParameterDeclaration,
58805
- TSTypeParameterInstantiation: TSTypeParameterInstantiation,
58806
- TSTypePredicate: TSTypePredicate,
58807
- TSTypeQuery: TSTypeQuery,
58808
- TSTypeReference: TSTypeReference,
58809
- TSUndefinedKeyword: TSUndefinedKeyword,
58810
- TSUnionType: TSUnionType,
58811
- TSUnknownKeyword: TSUnknownKeyword,
58812
- TSVoidKeyword: TSVoidKeyword,
58813
- TaggedTemplateExpression: TaggedTemplateExpression,
58814
- TemplateLiteral: TemplateLiteral,
58815
- ThisExpression: ThisExpression,
58816
- ThrowStatement: ThrowStatement,
58817
- TryStatement: TryStatement,
58818
- UnaryExpression: UnaryExpression,
58819
- UpdateExpression: UpdateExpression,
58820
- VariableDeclaration: VariableDeclaration,
58821
- VoidPattern: VoidPattern,
58822
- WhileStatement: WhileStatement,
58823
- WithStatement: WithStatement,
58824
- YieldExpression: YieldExpression
58611
+ __proto__: null,
58612
+ ArrayExpression: ArrayExpression,
58613
+ ArrayPattern: ArrayPattern,
58614
+ ArrowFunctionExpression: ArrowFunctionExpression,
58615
+ AssignmentExpression: AssignmentExpression,
58616
+ AssignmentPattern: AssignmentPattern,
58617
+ AwaitExpression: AwaitExpression,
58618
+ BigIntLiteral: BigIntLiteral,
58619
+ BinaryExpression: BinaryExpression,
58620
+ BlockStatement: BlockStatement,
58621
+ BooleanLiteral: BooleanLiteral,
58622
+ BreakStatement: BreakStatement,
58623
+ CallExpression: CallExpression,
58624
+ CatchClause: CatchClause,
58625
+ ClassAccessorProperty: ClassAccessorProperty,
58626
+ ClassDeclaration: ClassDeclaration,
58627
+ ClassExpression: ClassExpression,
58628
+ ClassMethod: ClassMethod,
58629
+ ClassPrivateMethod: ClassPrivateMethod,
58630
+ ClassPrivateProperty: ClassPrivateProperty,
58631
+ ClassProperty: ClassProperty,
58632
+ ConditionalExpression: ConditionalExpression,
58633
+ ContinueStatement: ContinueStatement,
58634
+ DebuggerStatement: DebuggerStatement,
58635
+ Decorator: Decorator,
58636
+ Directive: Directive,
58637
+ DirectiveLiteral: DirectiveLiteral,
58638
+ DoWhileStatement: DoWhileStatement,
58639
+ EmptyStatement: EmptyStatement,
58640
+ ExportAllDeclaration: ExportAllDeclaration,
58641
+ ExportDefaultDeclaration: ExportDefaultDeclaration,
58642
+ ExportDefaultSpecifier: ExportDefaultSpecifier,
58643
+ ExportNamedDeclaration: ExportNamedDeclaration,
58644
+ ExportNamespaceSpecifier: ExportNamespaceSpecifier,
58645
+ ExportSpecifier: ExportSpecifier,
58646
+ ExpressionStatement: ExpressionStatement,
58647
+ ForInStatement: ForInStatement,
58648
+ ForOfStatement: ForOfStatement,
58649
+ ForStatement: ForStatement,
58650
+ FunctionDeclaration: FunctionDeclaration,
58651
+ FunctionExpression: FunctionExpression,
58652
+ Identifier: Identifier,
58653
+ IfStatement: IfStatement,
58654
+ ImportAttribute: ImportAttribute,
58655
+ ImportDeclaration: ImportDeclaration,
58656
+ ImportExpression: ImportExpression,
58657
+ InterpreterDirective: InterpreterDirective,
58658
+ JSXAttribute: JSXAttribute,
58659
+ JSXClosingElement: JSXClosingElement,
58660
+ JSXClosingFragment: JSXClosingFragment,
58661
+ JSXElement: JSXElement,
58662
+ JSXEmptyExpression: JSXEmptyExpression,
58663
+ JSXExpressionContainer: JSXExpressionContainer,
58664
+ JSXFragment: JSXFragment,
58665
+ JSXIdentifier: JSXIdentifier,
58666
+ JSXMemberExpression: JSXMemberExpression,
58667
+ JSXOpeningElement: JSXOpeningElement,
58668
+ JSXOpeningFragment: JSXOpeningFragment,
58669
+ JSXSpreadAttribute: JSXSpreadAttribute,
58670
+ JSXText: JSXText,
58671
+ LabeledStatement: LabeledStatement,
58672
+ LogicalExpression: LogicalExpression,
58673
+ MemberExpression: MemberExpression,
58674
+ MetaProperty: MetaProperty,
58675
+ NewExpression: NewExpression,
58676
+ NullLiteral: NullLiteral,
58677
+ NumericLiteral: NumericLiteral,
58678
+ ObjectExpression: ObjectExpression,
58679
+ ObjectMethod: ObjectMethod,
58680
+ ObjectPattern: ObjectPattern,
58681
+ ObjectProperty: ObjectProperty,
58682
+ OptionalCallExpression: OptionalCallExpression,
58683
+ OptionalMemberExpression: OptionalMemberExpression,
58684
+ ParenthesizedExpression: ParenthesizedExpression,
58685
+ PrivateName: PrivateName,
58686
+ Program: Program,
58687
+ RegExpLiteral: RegExpLiteral,
58688
+ RestElement: RestElement,
58689
+ ReturnStatement: ReturnStatement,
58690
+ SequenceExpression: SequenceExpression,
58691
+ SpreadElement: SpreadElement,
58692
+ StaticBlock: StaticBlock,
58693
+ StringLiteral: StringLiteral,
58694
+ Super: Super,
58695
+ SwitchStatement: SwitchStatement,
58696
+ TSAnyKeyword: TSAnyKeyword,
58697
+ TSArrayType: TSArrayType,
58698
+ TSAsExpression: TSAsExpression,
58699
+ TSBigIntKeyword: TSBigIntKeyword,
58700
+ TSBooleanKeyword: TSBooleanKeyword,
58701
+ TSCallSignatureDeclaration: TSCallSignatureDeclaration,
58702
+ TSClassImplements: TSClassImplements,
58703
+ TSConditionalType: TSConditionalType,
58704
+ TSConstructSignatureDeclaration: TSConstructSignatureDeclaration,
58705
+ TSConstructorType: TSConstructorType,
58706
+ TSDeclareFunction: TSDeclareFunction,
58707
+ TSDeclareMethod: TSDeclareMethod,
58708
+ TSEnumDeclaration: TSEnumDeclaration,
58709
+ TSEnumMember: TSEnumMember,
58710
+ TSExportAssignment: TSExportAssignment,
58711
+ TSExternalModuleReference: TSExternalModuleReference,
58712
+ TSFunctionType: TSFunctionType,
58713
+ TSImportEqualsDeclaration: TSImportEqualsDeclaration,
58714
+ TSImportType: TSImportType,
58715
+ TSIndexSignature: TSIndexSignature,
58716
+ TSIndexedAccessType: TSIndexedAccessType,
58717
+ TSInferType: TSInferType,
58718
+ TSInstantiationExpression: TSInstantiationExpression,
58719
+ TSInterfaceBody: TSInterfaceBody,
58720
+ TSInterfaceDeclaration: TSInterfaceDeclaration,
58721
+ TSInterfaceHeritage: TSInterfaceHeritage,
58722
+ TSIntersectionType: TSIntersectionType,
58723
+ TSLiteralType: TSLiteralType,
58724
+ TSMappedType: TSMappedType,
58725
+ TSMethodSignature: TSMethodSignature,
58726
+ TSModuleBlock: TSModuleBlock,
58727
+ TSModuleDeclaration: TSModuleDeclaration,
58728
+ TSNamedTupleMember: TSNamedTupleMember,
58729
+ TSNeverKeyword: TSNeverKeyword,
58730
+ TSNonNullExpression: TSNonNullExpression,
58731
+ TSNullKeyword: TSNullKeyword,
58732
+ TSNumberKeyword: TSNumberKeyword,
58733
+ TSObjectKeyword: TSObjectKeyword,
58734
+ TSOptionalType: TSOptionalType,
58735
+ TSParameterProperty: TSParameterProperty,
58736
+ TSParenthesizedType: TSParenthesizedType,
58737
+ TSPropertySignature: TSPropertySignature,
58738
+ TSQualifiedName: TSQualifiedName,
58739
+ TSRestType: TSRestType,
58740
+ TSSatisfiesExpression: TSSatisfiesExpression,
58741
+ TSStringKeyword: TSStringKeyword,
58742
+ TSSymbolKeyword: TSSymbolKeyword,
58743
+ TSTemplateLiteralType: TSTemplateLiteralType,
58744
+ TSThisType: TSThisType,
58745
+ TSTupleType: TSTupleType,
58746
+ TSTypeAliasDeclaration: TSTypeAliasDeclaration,
58747
+ TSTypeAnnotation: TSTypeAnnotation,
58748
+ TSTypeAssertion: TSTypeAssertion,
58749
+ TSTypeLiteral: TSTypeLiteral,
58750
+ TSTypeOperator: TSTypeOperator,
58751
+ TSTypeParameter: TSTypeParameter,
58752
+ TSTypeParameterDeclaration: TSTypeParameterDeclaration,
58753
+ TSTypeParameterInstantiation: TSTypeParameterInstantiation,
58754
+ TSTypePredicate: TSTypePredicate,
58755
+ TSTypeQuery: TSTypeQuery,
58756
+ TSTypeReference: TSTypeReference,
58757
+ TSUndefinedKeyword: TSUndefinedKeyword,
58758
+ TSUnionType: TSUnionType,
58759
+ TSUnknownKeyword: TSUnknownKeyword,
58760
+ TSVoidKeyword: TSVoidKeyword,
58761
+ TaggedTemplateExpression: TaggedTemplateExpression,
58762
+ TemplateLiteral: TemplateLiteral,
58763
+ ThisExpression: ThisExpression,
58764
+ ThrowStatement: ThrowStatement,
58765
+ TryStatement: TryStatement,
58766
+ UnaryExpression: UnaryExpression,
58767
+ UpdateExpression: UpdateExpression,
58768
+ VariableDeclaration: VariableDeclaration,
58769
+ VoidPattern: VoidPattern,
58770
+ WhileStatement: WhileStatement,
58771
+ WithStatement: WithStatement,
58772
+ YieldExpression: YieldExpression
58825
58773
  });
58826
58774
 
58827
58775
  const isString$c = (a) => typeof a === 'string';
@@ -59007,7 +58955,7 @@ const createDebug$4 = (tokens) => (a) => {
59007
58955
  return;
59008
58956
 
59009
58957
  tokens.push({
59010
- type: TYPES$3.DEBUG,
58958
+ type: TYPES$2.DEBUG,
59011
58959
  value: `/*__${stringSnakeCase(a)}*/`,
59012
58960
  });
59013
58961
  };
@@ -59192,14 +59140,14 @@ const tokenize = (ast, overrides) => {
59192
59140
 
59193
59141
  const write = (value) => {
59194
59142
  addToken({
59195
- type: TYPES$3.TOKEN,
59143
+ type: TYPES$2.TOKEN,
59196
59144
  value,
59197
59145
  });
59198
59146
  };
59199
59147
 
59200
59148
  const indent = () => {
59201
59149
  addToken({
59202
- type: TYPES$3.INDENT,
59150
+ type: TYPES$2.INDENT,
59203
59151
  value: printIndent(i, format.indent),
59204
59152
  });
59205
59153
  };
@@ -59212,7 +59160,7 @@ const tokenize = (ast, overrides) => {
59212
59160
 
59213
59161
  const newline = () => {
59214
59162
  addToken({
59215
- type: TYPES$3.NEWLINE,
59163
+ type: TYPES$2.NEWLINE,
59216
59164
  value: format.newline,
59217
59165
  });
59218
59166
  };
@@ -59236,7 +59184,7 @@ const tokenize = (ast, overrides) => {
59236
59184
 
59237
59185
  const space = () => {
59238
59186
  addToken({
59239
- type: TYPES$3.SPACE,
59187
+ type: TYPES$2.SPACE,
59240
59188
  value: format.space,
59241
59189
  });
59242
59190
  };
@@ -59253,21 +59201,21 @@ const tokenize = (ast, overrides) => {
59253
59201
 
59254
59202
  const splitter = () => {
59255
59203
  addToken({
59256
- type: TYPES$3.SPLITTER,
59204
+ type: TYPES$2.SPLITTER,
59257
59205
  value: format.splitter,
59258
59206
  });
59259
59207
  };
59260
59208
 
59261
59209
  const quote = () => {
59262
59210
  addToken({
59263
- type: TYPES$3.QUOTE,
59211
+ type: TYPES$2.QUOTE,
59264
59212
  value: format.quote,
59265
59213
  });
59266
59214
  };
59267
59215
 
59268
59216
  const endOfFile = () => {
59269
59217
  addToken({
59270
- type: TYPES$3.END_OF_FILE,
59218
+ type: TYPES$2.END_OF_FILE,
59271
59219
  value: format.endOfFile,
59272
59220
  });
59273
59221
  };
@@ -59310,7 +59258,7 @@ const tokenize = (ast, overrides) => {
59310
59258
  traverse,
59311
59259
  maybe,
59312
59260
  quote,
59313
- store: fullstore$2(),
59261
+ store: fullstore(),
59314
59262
  });
59315
59263
 
59316
59264
  const currentTraversers = {
@@ -59468,20 +59416,59 @@ var lib = removeBlankLines;
59468
59416
 
59469
59417
  var removeBlankLines$1 = lib.default;
59470
59418
 
59471
- const __json_name$1 = '__putout_processor_json';
59472
- const __yaml_name$1 = '__putout_processor_yaml';
59473
- const __filesystem_name$3 = '__putout_processor_filesystem';
59474
- const __ignore_name$1 = '__putout_processor_ignore';
59419
+ const cut$1 = (a) => a.slice(0, a.indexOf('('));
59420
+ const createPrefix = (name) => {
59421
+ if (name.includes('('))
59422
+ return `${cut$1(name)}(`;
59423
+
59424
+ return `${name}(`;
59425
+ };
59475
59426
 
59476
- const TYPES$1 = [
59477
- __json_name$1,
59478
- __yaml_name$1,
59479
- __filesystem_name$3,
59480
- __ignore_name$1,
59427
+ const createSuffix = () => ');\n';
59428
+ const maybeNewline = (a) => a.at(-1) === '\n' ? a : `${a}\n`;
59429
+
59430
+ const __json_name = '__putout_processor_json';
59431
+ const __yaml_name = '__putout_processor_yaml';
59432
+ const __toml_name = '__putout_processor_toml';
59433
+ const __filesystem_name = '__putout_processor_filesystem';
59434
+ const __ignore_name = '__putout_processor_ignore';
59435
+
59436
+ const __json = `${__json_name}(__object)`;
59437
+ const __yaml = `${__yaml_name}(__object)`;
59438
+ const __toml = `${__toml_name}(__object)`;
59439
+ const __filesystem = `${__filesystem_name}(__object)`;
59440
+ const __ignore = `${__ignore_name}(__array)`;
59441
+
59442
+ const TYPES = [
59443
+ __json_name,
59444
+ __yaml_name,
59445
+ __filesystem_name,
59446
+ __ignore_name,
59481
59447
  ];
59482
59448
 
59483
- var isJSON$1 = (source) => {
59484
- for (const type of TYPES$1) {
59449
+ const toJS = (source, name = __json) => {
59450
+ const prefix = createPrefix(name);
59451
+ const suffix = createSuffix();
59452
+
59453
+ return `${prefix}${source}${suffix}`;
59454
+ };
59455
+
59456
+ const fromJS = (source, name = __json) => {
59457
+ source = maybeNewline(source);
59458
+ const shortName = cut$1(name);
59459
+
59460
+ source = source.slice(source.indexOf(shortName));
59461
+
59462
+ const prefix = createPrefix(name);
59463
+ const suffix = createSuffix();
59464
+ const length = source.length - suffix.length;
59465
+ const sliced = source.slice(prefix.length, length);
59466
+
59467
+ return maybeNewline(removeBlankLines$1(sliced));
59468
+ };
59469
+
59470
+ const isJSON = (source) => {
59471
+ for (const type of TYPES) {
59485
59472
  if (!source.indexOf(type))
59486
59473
  return true;
59487
59474
  }
@@ -59534,7 +59521,7 @@ function isASTJSON(ast) {
59534
59521
  if (!isIdentifier$5(callee))
59535
59522
  return false;
59536
59523
 
59537
- return isJSON$1(callee.name);
59524
+ return isJSON(callee.name);
59538
59525
  }
59539
59526
 
59540
59527
  const print$2 = (ast, overrides = {}) => {
@@ -60230,11 +60217,11 @@ var onceExports = once$6.exports;
60230
60217
  const noop$3 = () => {};
60231
60218
 
60232
60219
  var empty = /*#__PURE__*/Object.freeze({
60233
- __proto__: null,
60234
- default: noop$3
60220
+ __proto__: null,
60221
+ default: noop$3
60235
60222
  });
60236
60223
 
60237
- var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(empty);
60224
+ var require$$1 = /*@__PURE__*/getAugmentedNamespace(empty);
60238
60225
 
60239
60226
  // eslint-disable-next-line node/no-unsupported-features/es-syntax
60240
60227
 
@@ -60262,11 +60249,11 @@ function privateMethods(Parser) {
60262
60249
  }
60263
60250
 
60264
60251
  var acornPrivateMethods = /*#__PURE__*/Object.freeze({
60265
- __proto__: null,
60266
- default: privateMethods
60252
+ __proto__: null,
60253
+ default: privateMethods
60267
60254
  });
60268
60255
 
60269
- var require$$2$1 = /*@__PURE__*/getAugmentedNamespace(acornPrivateMethods);
60256
+ var require$$2 = /*@__PURE__*/getAugmentedNamespace(acornPrivateMethods);
60270
60257
 
60271
60258
  var acornStage3;
60272
60259
  var hasRequiredAcornStage3;
@@ -60277,9 +60264,9 @@ function requireAcornStage3 () {
60277
60264
 
60278
60265
  acornStage3 = function(Parser) {
60279
60266
  return Parser.extend(
60280
- require$$1$1,
60281
- require$$1$1,
60282
- require$$2$1
60267
+ require$$1,
60268
+ require$$1,
60269
+ require$$2
60283
60270
  )
60284
60271
  };
60285
60272
  return acornStage3;
@@ -60288,10 +60275,10 @@ function requireAcornStage3 () {
60288
60275
  const once$4 = onceExports;
60289
60276
 
60290
60277
  const initAcorn = once$4(() => {
60291
- const {Parser} = require$$1$1;
60278
+ const {Parser} = require$$1;
60292
60279
 
60293
60280
  const stage3 = requireAcornStage3();
60294
- const typescript = require$$1$1.default;
60281
+ const typescript = require$$1.default;
60295
60282
 
60296
60283
  return Parser.extend(typescript(), stage3);
60297
60284
  });
@@ -60344,10 +60331,10 @@ const allowUndeclaredExports = true;
60344
60331
  const allowImportExportEverywhere = true;
60345
60332
 
60346
60333
  var options = /*#__PURE__*/Object.freeze({
60347
- __proto__: null,
60348
- allowImportExportEverywhere: allowImportExportEverywhere,
60349
- allowReturnOutsideFunction: allowReturnOutsideFunction,
60350
- allowUndeclaredExports: allowUndeclaredExports
60334
+ __proto__: null,
60335
+ allowImportExportEverywhere: allowImportExportEverywhere,
60336
+ allowReturnOutsideFunction: allowReturnOutsideFunction,
60337
+ allowUndeclaredExports: allowUndeclaredExports
60351
60338
  });
60352
60339
 
60353
60340
  const {assign: assign$5} = Object;
@@ -60404,7 +60391,7 @@ function getBabelLangExts({isTS, isFlow, isJSX}) {
60404
60391
 
60405
60392
  const once$3 = onceExports;
60406
60393
 
60407
- const initEspree = once$3(() => require$$1$1);
60394
+ const initEspree = once$3(() => require$$1);
60408
60395
 
60409
60396
  var parse$6 = (source) => {
60410
60397
  const {parse} = initEspree();
@@ -60424,7 +60411,7 @@ var parse$6 = (source) => {
60424
60411
 
60425
60412
  const once$2 = onceExports;
60426
60413
 
60427
- const initEsprima = once$2(() => require$$1$1);
60414
+ const initEsprima = once$2(() => require$$1);
60428
60415
 
60429
60416
  var parse$5 = (source) => {
60430
60417
  const {parse} = initEsprima();
@@ -60440,7 +60427,7 @@ var parse$5 = (source) => {
60440
60427
 
60441
60428
  const once$1 = onceExports;
60442
60429
 
60443
- const initTenko = once$1(() => require$$1$1);
60430
+ const initTenko = once$1(() => require$$1);
60444
60431
 
60445
60432
  var parse$4 = (source) => {
60446
60433
  const {Tenko} = initTenko();
@@ -60454,7 +60441,7 @@ var parse$4 = (source) => {
60454
60441
  };
60455
60442
 
60456
60443
  const once = onceExports;
60457
- const initHermes = once(() => require$$1$1);
60444
+ const initHermes = once(() => require$$1);
60458
60445
 
60459
60446
  var parse$3 = (source) => {
60460
60447
  const parser = initHermes();
@@ -61011,7 +60998,7 @@ function relative(from, to) {
61011
60998
  var sep = '/';
61012
60999
  var delimiter = ':';
61013
61000
 
61014
- function dirname$1(path) {
61001
+ function dirname(path) {
61015
61002
  var result = splitPath(path),
61016
61003
  root = result[0],
61017
61004
  dir = result[1];
@@ -61029,7 +61016,7 @@ function dirname$1(path) {
61029
61016
  return root + dir;
61030
61017
  }
61031
61018
 
61032
- function basename$1(path, ext) {
61019
+ function basename(path, ext) {
61033
61020
  var f = splitPath(path)[2];
61034
61021
  // TODO: make this comparison case-insensitive on windows?
61035
61022
  if (ext && f.substr(-1 * ext.length) === ext) {
@@ -61044,8 +61031,8 @@ function extname(path) {
61044
61031
  }
61045
61032
  var path = {
61046
61033
  extname: extname,
61047
- basename: basename$1,
61048
- dirname: dirname$1,
61034
+ basename: basename,
61035
+ dirname: dirname,
61049
61036
  sep: sep,
61050
61037
  delimiter: delimiter,
61051
61038
  relative: relative,
@@ -61072,21 +61059,6 @@ var substr = 'ab'.substr(-1) === 'b' ?
61072
61059
  }
61073
61060
  ;
61074
61061
 
61075
- var _polyfillNode_path = /*#__PURE__*/Object.freeze({
61076
- __proto__: null,
61077
- basename: basename$1,
61078
- default: path,
61079
- delimiter: delimiter,
61080
- dirname: dirname$1,
61081
- extname: extname,
61082
- isAbsolute: isAbsolute,
61083
- join: join$1,
61084
- normalize: normalize,
61085
- relative: relative,
61086
- resolve: resolve,
61087
- sep: sep
61088
- });
61089
-
61090
61062
  const isFn$5 = (a) => typeof a === 'function';
61091
61063
 
61092
61064
  const tryToCatch = async (fn, ...args) => {
@@ -61104,12 +61076,12 @@ function check$a(fn) {
61104
61076
  throw Error('fn should be a function!');
61105
61077
  }
61106
61078
 
61107
- const returns$1 = (a) => () => a;
61079
+ const returns$2 = (a) => () => a;
61108
61080
  const noop$2 = () => {};
61109
61081
 
61110
61082
  const createRequire = (url, overrides = {}) => {
61111
61083
  const {module = _module} = overrides;
61112
- const {createRequire = returns$1(noop$2)} = module;
61084
+ const {createRequire = returns$2(noop$2)} = module;
61113
61085
 
61114
61086
  return createRequire(url);
61115
61087
  };
@@ -61218,7 +61190,7 @@ function buildPluginsDirs(name) {
61218
61190
 
61219
61191
  const isStr$2 = (a) => typeof a === 'string';
61220
61192
  const {isArray: isArray$a} = Array;
61221
- const {entries: entries$9} = Object;
61193
+ const {entries: entries$a} = Object;
61222
61194
 
61223
61195
  const parsePluginNames = (plugins) => {
61224
61196
  const result = [];
@@ -61235,7 +61207,7 @@ const parsePluginNames = (plugins) => {
61235
61207
  continue;
61236
61208
  }
61237
61209
 
61238
- result.push(...entries$9(plugin));
61210
+ result.push(...entries$a(plugin));
61239
61211
  }
61240
61212
 
61241
61213
  return result;
@@ -61245,7 +61217,7 @@ const {isArray: isArray$9} = Array;
61245
61217
  const isBool$1 = (a) => typeof a === 'boolean';
61246
61218
  const isStr$1 = (a) => typeof a === 'string';
61247
61219
  const isObj = (a) => typeof a === 'object';
61248
- const {entries: entries$8} = Object;
61220
+ const {entries: entries$9} = Object;
61249
61221
  const {stringify: stringify$6} = JSON;
61250
61222
 
61251
61223
  const notSupportedError = (a) => Error(`☝️ Rule format not supported ${a}: ${typeof a}`);
@@ -61272,7 +61244,7 @@ const parseRules = (rules) => {
61272
61244
 
61273
61245
  check$9(rules);
61274
61246
 
61275
- for (const [rule, value] of entries$8(rules)) {
61247
+ for (const [rule, value] of entries$9(rules)) {
61276
61248
  if (isStr$1(value)) {
61277
61249
  result.push({
61278
61250
  rule,
@@ -61357,21 +61329,6 @@ function validateState(rule, value) {
61357
61329
  });
61358
61330
  }
61359
61331
 
61360
- const cut$1 = (a) => a.split('/')[0];
61361
-
61362
- const enableNestedRules = (rules) => {
61363
- const newRules = {};
61364
-
61365
- for (const [rule, value] of entries$8(rules)) {
61366
- if (rule.includes('/') && parseState(rule, value))
61367
- newRules[cut$1(rule)] = 'on';
61368
-
61369
- newRules[rule] = value;
61370
- }
61371
-
61372
- return newRules;
61373
- };
61374
-
61375
61332
  function check$9(rules) {
61376
61333
  if (isArray$9(rules))
61377
61334
  throw Error(`☝️Looks like type of 'rules' passed to @putout/engine-loader is 'array', expected: 'object'.`);
@@ -61502,6 +61459,25 @@ const validateRulesRelations = (options) => {
61502
61459
  });
61503
61460
  };
61504
61461
 
61462
+ const {entries: entries$8, fromEntries} = Object;
61463
+ const cut = (a) => a.split('/')[0];
61464
+
61465
+ const enableNestedRules = (rules) => {
61466
+ const newRules = new Map();
61467
+
61468
+ for (const [rule, value] of entries$8(rules)) {
61469
+ if (newRules.has(rule))
61470
+ continue;
61471
+
61472
+ if (rule.includes('/') && parseState(rule, value))
61473
+ newRules.set(cut(rule), 'on');
61474
+
61475
+ newRules.set(rule, value);
61476
+ }
61477
+
61478
+ return fromEntries(newRules);
61479
+ };
61480
+
61505
61481
  const prepareRules = ({rules, pluginNames}) => {
61506
61482
  const enabledRules = enableNestedRules(rules);
61507
61483
  const cookedEnabledRules = parseRules(enabledRules);
@@ -61661,7 +61637,7 @@ function extendRules$1(rule, plugin) {
61661
61637
 
61662
61638
  function parseRuleName(rule) {
61663
61639
  if (rule.startsWith('import:')) {
61664
- const shortName = basename$1(rule.replace('import:', ''));
61640
+ const shortName = basename(rule.replace('import:', ''));
61665
61641
 
61666
61642
  return shortName.replace('plugin-', '');
61667
61643
  }
@@ -62388,7 +62364,7 @@ const isString$6 = (a) => typeof a === 'string';
62388
62364
  const isUndefined = (a) => typeof a === 'undefined';
62389
62365
  const isEmpty = (obj) => !Object.keys(obj).length;
62390
62366
 
62391
- var jessy = (selector, divider, value) => {
62367
+ function jessy(selector, divider, value) {
62392
62368
  if (!value) {
62393
62369
  value = divider;
62394
62370
  divider = '.';
@@ -62425,7 +62401,7 @@ var jessy = (selector, divider, value) => {
62425
62401
  }
62426
62402
 
62427
62403
  return value;
62428
- };
62404
+ }
62429
62405
 
62430
62406
  function check$7(selector, obj) {
62431
62407
  if (!isString$6(selector))
@@ -62435,14 +62411,12 @@ function check$7(selector, obj) {
62435
62411
  throw Error('obj should be object!');
62436
62412
  }
62437
62413
 
62438
- var jessy$1 = jessy.default;
62439
-
62440
62414
  const isNumber$1 = (a) => !Number.isNaN(a) && typeof a === 'number';
62441
62415
  const isNumberLike = (a, b = Number(a)) => isNumber$1(b);
62442
62416
  const isString$5 = (a) => typeof a === 'string';
62443
62417
  const notSecure = (a) => /__proto__|prototype/.test(a);
62444
62418
 
62445
- var nessy = (selector, value, divider, obj) => {
62419
+ function nessy(selector, value, divider, obj) {
62446
62420
  if (!obj) {
62447
62421
  obj = divider || {};
62448
62422
  divider = '.';
@@ -62455,6 +62429,7 @@ var nessy = (selector, value, divider, obj) => {
62455
62429
  const array = selector
62456
62430
  .split(divider)
62457
62431
  .filter(Boolean);
62432
+
62458
62433
  const n = array.length - 1;
62459
62434
 
62460
62435
  for (const [i, name] of array.entries()) {
@@ -62468,21 +62443,17 @@ var nessy = (selector, value, divider, obj) => {
62468
62443
 
62469
62444
  obj[name] = isNumberLike(nextKey) ? [] : {};
62470
62445
  }
62471
-
62472
62446
 
62473
62447
  obj = obj[name];
62474
62448
  }
62475
62449
 
62476
62450
  return result;
62477
- };
62478
-
62451
+ }
62479
62452
  function check$6(selector) {
62480
62453
  if (!isString$5(selector))
62481
62454
  throw Error('selector should be string!');
62482
62455
  }
62483
62456
 
62484
- var nessy$1 = nessy.default;
62485
-
62486
62457
  const TS_MODULE_REG = /\.body\.0\.expression$/;
62487
62458
  const CLASS_BODY_REG = /\.body\.0\.key$/;
62488
62459
  const BODY_REG = /\.body\.0$/;
@@ -62942,7 +62913,7 @@ function getValues({waysFrom, node}) {
62942
62913
  if (isBodyStr(name))
62943
62914
  way = prepareBodyWay(way);
62944
62915
 
62945
- result[name] = result[name] || extractExpression$1(jessy$1(way, node));
62916
+ result[name] = result[name] || extractExpression$1(jessy(way, node));
62946
62917
  }
62947
62918
  }
62948
62919
 
@@ -62957,7 +62928,7 @@ function setValues({waysTo, values, path}) {
62957
62928
  for (const [name, ways] of entries$6(waysTo)) {
62958
62929
  for (let way of ways) {
62959
62930
  if (!way) {
62960
- replaceWith$2(path, values[name]);
62931
+ replaceWith(path, values[name]);
62961
62932
  continue;
62962
62933
  }
62963
62934
 
@@ -62977,14 +62948,14 @@ function setValues({waysTo, values, path}) {
62977
62948
  raw: makeRaw(value),
62978
62949
  });
62979
62950
 
62980
- nessy$1(way, element, node);
62951
+ nessy(way, element, node);
62981
62952
  continue;
62982
62953
  }
62983
62954
 
62984
62955
  if (isBodyStr(name))
62985
62956
  way = prepareBodyWay(way);
62986
62957
 
62987
- const {extra} = jessy$1(way, node);
62958
+ const {extra} = jessy(way, node);
62988
62959
 
62989
62960
  if (extra) {
62990
62961
  const valueExtra = values[name].extra;
@@ -62995,7 +62966,7 @@ function setValues({waysTo, values, path}) {
62995
62966
  };
62996
62967
  }
62997
62968
 
62998
- nessy$1(way, values[name], node);
62969
+ nessy(way, values[name], node);
62999
62970
  }
63000
62971
  }
63001
62972
  }
@@ -64330,7 +64301,7 @@ const parseExpression = (nodeFrom, {node}) => {
64330
64301
  return node;
64331
64302
  };
64332
64303
 
64333
- const fix$4 = (from, to, path) => {
64304
+ const fix$7 = (from, to, path) => {
64334
64305
  const nodeFrom = template$1.ast(from);
64335
64306
  const mark = watermark(from, to, path);
64336
64307
 
@@ -64357,7 +64328,7 @@ const fix$4 = (from, to, path) => {
64357
64328
  checkExpressionStatement(nodeFrom, nodeTo, path);
64358
64329
 
64359
64330
  const waysTo = findVarsWays(nodeTo);
64360
- const newPath = replaceWith$2(path, nodeTo);
64331
+ const newPath = replaceWith(path, nodeTo);
64361
64332
 
64362
64333
  if (!nodeTo.__putout_replace_cooked) {
64363
64334
  validateTemplateValues(waysTo, waysFrom);
@@ -64385,7 +64356,7 @@ const getFix = (items, match) => (path) => {
64385
64356
  const matchFn = match[from];
64386
64357
 
64387
64358
  if (!matchFn || runMatch(path, nodeFrom, matchFn))
64388
- fix$4(from, to, path);
64359
+ fix$7(from, to, path);
64389
64360
  }
64390
64361
  }
64391
64362
  };
@@ -64528,13 +64499,13 @@ const TS_EXCLUDE = [
64528
64499
  ];
64529
64500
 
64530
64501
  const declare$1 = (declarations) => ({
64531
- report: report$3,
64502
+ report: report$6,
64532
64503
  include,
64533
- fix: fix$3(declarations),
64504
+ fix: fix$6(declarations),
64534
64505
  filter: filter(declarations),
64535
64506
  });
64536
64507
 
64537
- const report$3 = (path) => {
64508
+ const report$6 = (path) => {
64538
64509
  const {name} = path.node;
64539
64510
  const peaceOfName = cutName(name);
64540
64511
 
@@ -64574,7 +64545,7 @@ const filter = (declarations) => (path, {options}) => {
64574
64545
  return parseCode(type, allDeclarations[name]);
64575
64546
  };
64576
64547
 
64577
- const fix$3 = (declarations) => (path, {options}) => {
64548
+ const fix$6 = (declarations) => (path, {options}) => {
64578
64549
  const type = getModuleType(path);
64579
64550
 
64580
64551
  const allDeclarations = {
@@ -64693,111 +64664,17 @@ function validateDeclare(declare) {
64693
64664
  throw Error(`☝️ Looks like 'declare' property value is not a 'function', but '${typeof declare}' with value '${stringify(declare)}'.`);
64694
64665
  }
64695
64666
 
64696
- function fullstore(value) {
64697
- const data = {
64698
- value,
64699
- };
64700
-
64701
- return (...args) => {
64702
- const [value] = args;
64703
-
64704
- if (!args.length)
64705
- return data.value;
64706
-
64707
- data.value = value;
64708
-
64709
- return value;
64710
- };
64711
- }
64712
-
64713
- const cut = (a) => a.slice(0, a.indexOf('('));
64714
- const createPrefix = (name) => {
64715
- if (name.includes('('))
64716
- return `${cut(name)}(`;
64717
-
64718
- return `${name}(`;
64719
- };
64720
-
64721
- const createSuffix = () => ');\n';
64722
- const maybeNewline = (a) => a.at(-1) === '\n' ? a : `${a}\n`;
64723
-
64724
- const __json_name = '__putout_processor_json';
64725
- const __yaml_name = '__putout_processor_yaml';
64726
- const __toml_name = '__putout_processor_toml';
64727
- const __filesystem_name$2 = '__putout_processor_filesystem';
64728
- const __ignore_name = '__putout_processor_ignore';
64729
-
64730
- const __json = `${__json_name}(__object)`;
64731
- const __yaml = `${__yaml_name}(__object)`;
64732
- const __toml = `${__toml_name}(__object)`;
64733
- const __filesystem = `${__filesystem_name$2}(__object)`;
64734
- const __ignore = `${__ignore_name}(__array)`;
64735
-
64736
- const TYPES = [
64737
- __json_name,
64738
- __yaml_name,
64739
- __filesystem_name$2,
64740
- __ignore_name,
64741
- ];
64742
-
64743
- const toJS = (source, name = __json) => {
64744
- const prefix = createPrefix(name);
64745
- const suffix = createSuffix();
64746
-
64747
- return `${prefix}${source}${suffix}`;
64748
- };
64749
-
64750
- const fromJS = (source, name = __json) => {
64751
- source = maybeNewline(source);
64752
- const shortName = cut(name);
64753
-
64754
- source = source.slice(source.indexOf(shortName));
64755
-
64756
- const prefix = createPrefix(name);
64757
- const suffix = createSuffix();
64758
- const length = source.length - suffix.length;
64759
- const sliced = source.slice(prefix.length, length);
64760
-
64761
- return maybeNewline(removeBlankLines$1(sliced));
64762
- };
64763
-
64764
- const isJSON = (source) => {
64765
- for (const type of TYPES) {
64766
- if (!source.indexOf(type))
64767
- return true;
64768
- }
64769
-
64770
- return false;
64771
- };
64772
-
64773
- var json = /*#__PURE__*/Object.freeze({
64774
- __proto__: null,
64775
- __filesystem: __filesystem,
64776
- __filesystem_name: __filesystem_name$2,
64777
- __ignore: __ignore,
64778
- __ignore_name: __ignore_name,
64779
- __json: __json,
64780
- __json_name: __json_name,
64781
- __toml: __toml,
64782
- __toml_name: __toml_name,
64783
- __yaml: __yaml,
64784
- __yaml_name: __yaml_name,
64785
- fromJS: fromJS,
64786
- isJSON: isJSON,
64787
- toJS: toJS
64788
- });
64789
-
64790
64667
  const driverStore = fullstore();
64791
64668
 
64792
64669
  const {assign} = Object;
64793
64670
  const noop = () => {};
64794
- const returns = (a) => () => a;
64671
+ const returns$1 = (a) => () => a;
64795
64672
 
64796
64673
  const defaultFS = {
64797
64674
  renameFile: noop,
64798
64675
  removeFile: noop,
64799
64676
  createDirectory: noop,
64800
- readFileContent: returns(''),
64677
+ readFileContent: returns$1(''),
64801
64678
  writeFileContent: noop,
64802
64679
  copyFile: noop,
64803
64680
  };
@@ -64816,7 +64693,7 @@ const copyFile$1 = (from, to) => {
64816
64693
  maybeFS.copyFile(from, to);
64817
64694
  };
64818
64695
 
64819
- const createDirectory$2 = (name) => {
64696
+ const createDirectory$1 = (name) => {
64820
64697
  maybeFS.createDirectory(name);
64821
64698
  };
64822
64699
 
@@ -64846,17 +64723,17 @@ function deinit$1() {
64846
64723
  }
64847
64724
 
64848
64725
  var maybeFS$1 = /*#__PURE__*/Object.freeze({
64849
- __proto__: null,
64850
- copyFile: copyFile$1,
64851
- createDirectory: createDirectory$2,
64852
- deinit: deinit$1,
64853
- init: init$1,
64854
- pause: pause$1,
64855
- readFileContent: readFileContent$1,
64856
- removeFile: removeFile$1,
64857
- renameFile: renameFile$1,
64858
- start: start$1,
64859
- writeFileContent: writeFileContent$1
64726
+ __proto__: null,
64727
+ copyFile: copyFile$1,
64728
+ createDirectory: createDirectory$1,
64729
+ deinit: deinit$1,
64730
+ init: init$1,
64731
+ pause: pause$1,
64732
+ readFileContent: readFileContent$1,
64733
+ removeFile: removeFile$1,
64734
+ renameFile: renameFile$1,
64735
+ start: start$1,
64736
+ writeFileContent: writeFileContent$1
64860
64737
  });
64861
64738
 
64862
64739
  const {
@@ -64950,7 +64827,7 @@ function isExcluded({name, base, exclude}) {
64950
64827
  return false;
64951
64828
  }
64952
64829
 
64953
- function findFile$2(node, name, exclude = []) {
64830
+ function findFile(node, name, exclude = []) {
64954
64831
  checkName(name);
64955
64832
 
64956
64833
  const filePaths = [];
@@ -64958,7 +64835,7 @@ function findFile$2(node, name, exclude = []) {
64958
64835
 
64959
64836
  for (const filenamePath of traverseProperties(node, 'filename')) {
64960
64837
  const {value} = filenamePath.node.value;
64961
- const base = basename$1(value);
64838
+ const base = basename(value);
64962
64839
 
64963
64840
  for (const name of names) {
64964
64841
  if (value === name || getRegExp(name).test(base)) {
@@ -64986,22 +64863,22 @@ function checkName(name) {
64986
64863
  }
64987
64864
 
64988
64865
  function getFilenamePath(filePath) {
64989
- const filenamePath = getProperty$2(filePath, 'filename');
64866
+ const filenamePath = getProperty(filePath, 'filename');
64990
64867
  return filenamePath.get('value');
64991
64868
  }
64992
64869
 
64993
- function getFilename$2(filePath) {
64870
+ function getFilename(filePath) {
64994
64871
  const {value} = getFilenamePath(filePath).node;
64995
64872
  return value;
64996
64873
  }
64997
64874
 
64998
- function getFileType$2(filePath) {
64999
- const typePath = getProperty$2(filePath, 'type');
64875
+ function getFileType(filePath) {
64876
+ const typePath = getProperty(filePath, 'type');
65000
64877
  return typePath.node.value.value;
65001
64878
  }
65002
64879
 
65003
64880
  function getFileContent(filePath) {
65004
- const content = getProperty$2(filePath, 'content');
64881
+ const content = getProperty(filePath, 'content');
65005
64882
 
65006
64883
  return [
65007
64884
  Boolean(content),
@@ -65010,7 +64887,7 @@ function getFileContent(filePath) {
65010
64887
  }
65011
64888
 
65012
64889
  const renameFile = (filePath, name) => {
65013
- const oldName = getFilename$2(filePath);
64890
+ const oldName = getFilename(filePath);
65014
64891
  const valuePath = getFilenamePath(filePath);
65015
64892
  const baseName = oldName
65016
64893
  .split('/')
@@ -65027,7 +64904,7 @@ const renameFile = (filePath, name) => {
65027
64904
  };
65028
64905
 
65029
64906
  function removeFile(filePath) {
65030
- const filename = getFilename$2(filePath);
64907
+ const filename = getFilename(filePath);
65031
64908
 
65032
64909
  if (!getParentDirectory(filePath))
65033
64910
  return;
@@ -65037,7 +64914,7 @@ function removeFile(filePath) {
65037
64914
  }
65038
64915
 
65039
64916
  const removeEmptyDirectory = (dirPath) => {
65040
- const type = getFileType$2(dirPath);
64917
+ const type = getFileType(dirPath);
65041
64918
 
65042
64919
  if (type !== 'directory')
65043
64920
  return;
@@ -65045,7 +64922,7 @@ const removeEmptyDirectory = (dirPath) => {
65045
64922
  let nextParentDir = dirPath;
65046
64923
 
65047
64924
  while (!readDirectory(dirPath).length) {
65048
- const name = getFilename$2(dirPath);
64925
+ const name = getFilename(dirPath);
65049
64926
 
65050
64927
  if (name === '/')
65051
64928
  break;
@@ -65064,10 +64941,10 @@ const moveFile = (filePath, dirPath) => {
65064
64941
  if (filePath === dirPath)
65065
64942
  return;
65066
64943
 
65067
- const dirname = getFilename$2(dirPath);
65068
- const filename = getFilename$2(filePath);
64944
+ const dirname = getFilename(dirPath);
64945
+ const filename = getFilename(filePath);
65069
64946
  const dirPathFiles = getFiles$1(dirPath);
65070
- const filenamePath = getProperty$2(filePath, 'filename');
64947
+ const filenamePath = getProperty(filePath, 'filename');
65071
64948
 
65072
64949
  const basename = filename
65073
64950
  .split('/')
@@ -65085,8 +64962,8 @@ const moveFile = (filePath, dirPath) => {
65085
64962
  };
65086
64963
 
65087
64964
  const copyFile = (filePath, dirPath) => {
65088
- const dirname = getFilename$2(dirPath);
65089
- const filename = getFilename$2(filePath);
64965
+ const dirname = getFilename(dirPath);
64966
+ const filename = getFilename(filePath);
65090
64967
 
65091
64968
  const basename = filename
65092
64969
  .split('/')
@@ -65110,16 +64987,16 @@ const copyFile = (filePath, dirPath) => {
65110
64987
  };
65111
64988
 
65112
64989
  function maybeRemoveFile(dirPath, filename) {
65113
- const type = getFileType$2(dirPath);
64990
+ const type = getFileType(dirPath);
65114
64991
 
65115
64992
  if (type !== 'directory') {
65116
- const filename = getFilename$2(dirPath);
64993
+ const filename = getFilename(dirPath);
65117
64994
  throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`);
65118
64995
  }
65119
64996
 
65120
- const dirPathFiles = getProperty$2(dirPath, 'files');
65121
- const name = join$1(getFilename$2(dirPath), basename$1(filename));
65122
- const [fileToOverwrite] = findFile$2(dirPathFiles, name);
64997
+ const dirPathFiles = getProperty(dirPath, 'files');
64998
+ const name = join$1(getFilename(dirPath), basename(filename));
64999
+ const [fileToOverwrite] = findFile(dirPathFiles, name);
65123
65000
 
65124
65001
  if (!fileToOverwrite)
65125
65002
  return;
@@ -65131,7 +65008,7 @@ const createFile = (dirPath, name, content) => {
65131
65008
  maybeRemoveFile(dirPath, name);
65132
65009
 
65133
65010
  const dirPathFiles = getFiles$1(dirPath);
65134
- const parentFilename = getFilename$2(dirPath);
65011
+ const parentFilename = getFilename(dirPath);
65135
65012
  const filename = join$1(parentFilename, name);
65136
65013
 
65137
65014
  const typeProperty = createTypeProperty('file');
@@ -65153,10 +65030,10 @@ const createFile = (dirPath, name, content) => {
65153
65030
  return filePath;
65154
65031
  };
65155
65032
 
65156
- const getFiles$1 = (dirPath) => getProperty$2(dirPath, 'files');
65033
+ const getFiles$1 = (dirPath) => getProperty(dirPath, 'files');
65157
65034
 
65158
65035
  function readDirectory(dirPath) {
65159
- const fileType = getFileType$2(dirPath);
65036
+ const fileType = getFileType(dirPath);
65160
65037
 
65161
65038
  if (fileType !== 'directory')
65162
65039
  return [];
@@ -65164,9 +65041,9 @@ function readDirectory(dirPath) {
65164
65041
  return getFiles$1(dirPath).get('value.elements');
65165
65042
  }
65166
65043
 
65167
- function createDirectory$1(dirPath, name) {
65044
+ function createDirectory(dirPath, name) {
65168
65045
  const dirPathFiles = getFiles$1(dirPath);
65169
- const parentFilename = getFilename$2(dirPath);
65046
+ const parentFilename = getFilename(dirPath);
65170
65047
  const filename = join$1(parentFilename, name);
65171
65048
 
65172
65049
  const typeProperty = createTypeProperty('directory');
@@ -65179,13 +65056,13 @@ function createDirectory$1(dirPath, name) {
65179
65056
  filesProperty,
65180
65057
  ]));
65181
65058
 
65182
- createDirectory$2(filename);
65059
+ createDirectory$1(filename);
65183
65060
 
65184
65061
  return dirPathFiles.get('value.elements').at(-1);
65185
65062
  }
65186
65063
 
65187
65064
  const readFileContent = (filePath) => {
65188
- const fileType = getFileType$2(filePath);
65065
+ const fileType = getFileType(filePath);
65189
65066
 
65190
65067
  if (fileType === 'directory')
65191
65068
  return '';
@@ -65195,7 +65072,7 @@ const readFileContent = (filePath) => {
65195
65072
  if (hasContent)
65196
65073
  return fromBase64(content);
65197
65074
 
65198
- const filename = getFilename$2(filePath);
65075
+ const filename = getFilename(filePath);
65199
65076
  const fileContent = readFileContent$1(filename);
65200
65077
 
65201
65078
  const property = createContentProperty(toBase64(fileContent));
@@ -65206,16 +65083,16 @@ const readFileContent = (filePath) => {
65206
65083
  };
65207
65084
 
65208
65085
  function writeFileContent(filePath, content) {
65209
- const fileType = getFileType$2(filePath);
65086
+ const fileType = getFileType(filePath);
65210
65087
 
65211
65088
  if (fileType === 'directory')
65212
65089
  return;
65213
65090
 
65214
- const filename = getFilename$2(filePath);
65091
+ const filename = getFilename(filePath);
65215
65092
 
65216
65093
  writeFileContent$1(filename, content);
65217
65094
 
65218
- const contentPath = getProperty$2(filePath, 'content');
65095
+ const contentPath = getProperty(filePath, 'content');
65219
65096
 
65220
65097
  if (contentPath) {
65221
65098
  setLiteralValue(contentPath.node.value, toBase64(content));
@@ -65228,21 +65105,21 @@ function writeFileContent(filePath, content) {
65228
65105
 
65229
65106
  const createNestedDirectory = (path, name) => {
65230
65107
  const rootPath = getRootDirectory(path);
65231
- const dir = dirname$1(name);
65108
+ const dir = dirname(name);
65232
65109
 
65233
- if (dir === getFilename$2(path))
65234
- return createDirectory$1(path, basename$1(name));
65110
+ if (dir === getFilename(path))
65111
+ return createDirectory(path, basename(name));
65235
65112
 
65236
65113
  let currentDir = name;
65237
65114
 
65238
- const rootDir = getFilename$2(rootPath);
65115
+ const rootDir = getFilename(rootPath);
65239
65116
  const directories = [];
65240
65117
  let prevDir = currentDir;
65241
65118
 
65242
65119
  while (currentDir !== rootDir) {
65243
65120
  directories.unshift(currentDir);
65244
65121
  prevDir = currentDir;
65245
- currentDir = dirname$1(currentDir);
65122
+ currentDir = dirname(currentDir);
65246
65123
 
65247
65124
  if (currentDir === prevDir) {
65248
65125
  currentDir = rootDir;
@@ -65256,16 +65133,16 @@ const createNestedDirectory = (path, name) => {
65256
65133
  }
65257
65134
  }
65258
65135
 
65259
- let lastDirectoryPath = findFile$2(rootPath, directories).at(-1) || rootPath;
65260
- const lastDirectoryName = getFilename$2(lastDirectoryPath);
65136
+ let lastDirectoryPath = findFile(rootPath, directories).at(-1) || rootPath;
65137
+ const lastDirectoryName = getFilename(lastDirectoryPath);
65261
65138
 
65262
65139
  const n = directories.length;
65263
65140
 
65264
65141
  let i = directories.indexOf(lastDirectoryName) + 1;
65265
65142
 
65266
65143
  for (; i < n; i++) {
65267
- const name = basename$1(directories[i]);
65268
- lastDirectoryPath = createDirectory$1(lastDirectoryPath, name);
65144
+ const name = basename(directories[i]);
65145
+ lastDirectoryPath = createDirectory(lastDirectoryPath, name);
65269
65146
  }
65270
65147
 
65271
65148
  return lastDirectoryPath;
@@ -65293,55 +65170,6 @@ const {
65293
65170
  start,
65294
65171
  } = maybeFS$1;
65295
65172
 
65296
- var filesystem = /*#__PURE__*/Object.freeze({
65297
- __proto__: null,
65298
- copyFile: copyFile,
65299
- createDirectory: createDirectory$1,
65300
- createFile: createFile,
65301
- createNestedDirectory: createNestedDirectory,
65302
- deinit: deinit,
65303
- findFile: findFile$2,
65304
- getFileContent: getFileContent,
65305
- getFileType: getFileType$2,
65306
- getFilename: getFilename$2,
65307
- getParentDirectory: getParentDirectory,
65308
- getRootDirectory: getRootDirectory,
65309
- init: init,
65310
- moveFile: moveFile,
65311
- pause: pause,
65312
- readDirectory: readDirectory,
65313
- readFileContent: readFileContent,
65314
- removeEmptyDirectory: removeEmptyDirectory,
65315
- removeFile: removeFile,
65316
- renameFile: renameFile,
65317
- start: start,
65318
- writeFileContent: writeFileContent
65319
- });
65320
-
65321
- var convertSimpleFilesystemToFilesystem = {};
65322
-
65323
- var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_path);
65324
-
65325
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(bundle);
65326
-
65327
- var require$$3 = /*@__PURE__*/getAugmentedNamespace(filesystem);
65328
-
65329
- var require$$2 = /*@__PURE__*/getAugmentedNamespace(json);
65330
-
65331
- var require$$1 = /*@__PURE__*/getAugmentedNamespace(operate);
65332
-
65333
- const {basename, dirname} = require$$0$1;
65334
- const {types: types$1} = require$$0;
65335
- const {
65336
- createDirectory,
65337
- getFileType: getFileType$1,
65338
- getFilename: getFilename$1,
65339
- findFile: findFile$1,
65340
- } = require$$3;
65341
-
65342
- const {__filesystem_name: __filesystem_name$1} = require$$2;
65343
- const {replaceWith: replaceWith$1, getProperty: getProperty$1} = require$$1;
65344
-
65345
65173
  const {
65346
65174
  objectExpression,
65347
65175
  arrayExpression: arrayExpression$1,
@@ -65350,9 +65178,9 @@ const {
65350
65178
  isStringLiteral,
65351
65179
  isTemplateLiteral,
65352
65180
  objectProperty: objectProperty$1,
65353
- } = types$1;
65181
+ } = lib_exports;
65354
65182
 
65355
- convertSimpleFilesystemToFilesystem.report = () => `Convert Simple Filesystem to Filesystem`;
65183
+ const report$5 = () => `Convert Simple Filesystem to Filesystem`;
65356
65184
 
65357
65185
  const isDirectory = (a) => a.endsWith('/');
65358
65186
  const getType = (a) => {
@@ -65386,14 +65214,19 @@ function parseContent(node, path) {
65386
65214
  throw Error(`☝️ Looks like wrong content type: '${node.type}' from file: '${path}'`);
65387
65215
  }
65388
65216
 
65389
- convertSimpleFilesystemToFilesystem.fix = (path) => {
65217
+ const fix$5 = (path) => {
65390
65218
  const array = arrayExpression$1([]);
65391
65219
 
65392
65220
  for (const element of path.get('elements')) {
65393
- if (isArrayExpression(element)) {
65221
+ if (isOneElementTuple(element)) {
65222
+ const [node] = element.node.elements;
65223
+ array.elements.push(createFileFromStringLiteral(node));
65224
+ continue;
65225
+ }
65226
+
65227
+ if (isTwoElementsTuple(element)) {
65394
65228
  const [nodeValue, nodeContent] = element.node.elements;
65395
65229
  const {value} = nodeValue;
65396
-
65397
65230
  const content = parseContent(nodeContent, element);
65398
65231
 
65399
65232
  array.elements.push(objectExpression([
@@ -65405,13 +65238,8 @@ convertSimpleFilesystemToFilesystem.fix = (path) => {
65405
65238
  }
65406
65239
 
65407
65240
  if (isStringLiteral(element)) {
65408
- const {value} = element.node;
65409
-
65410
- array.elements.push(objectExpression([
65411
- getType(value),
65412
- createFilename(noTrailingSlash(value)),
65413
- getFiles(value),
65414
- ].filter(Boolean)));
65241
+ const file = createFileFromStringLiteral(element);
65242
+ array.elements.push(file);
65415
65243
  continue;
65416
65244
  }
65417
65245
 
@@ -65421,8 +65249,20 @@ convertSimpleFilesystemToFilesystem.fix = (path) => {
65421
65249
  buildTree(path, array);
65422
65250
  };
65423
65251
 
65424
- convertSimpleFilesystemToFilesystem.traverse = ({push}) => ({
65425
- [`${__filesystem_name$1}(__array)`]: (path) => {
65252
+ const maybeNode = (a) => a.node || a;
65253
+
65254
+ function createFileFromStringLiteral(element) {
65255
+ const {value} = maybeNode(element);
65256
+
65257
+ return objectExpression([
65258
+ getType(value),
65259
+ createFilename(noTrailingSlash(value)),
65260
+ getFiles(value),
65261
+ ].filter(Boolean));
65262
+ }
65263
+
65264
+ const traverse$3 = ({push}) => ({
65265
+ [`${__filesystem_name}(__array)`]: (path) => {
65426
65266
  const root = path.get('arguments.0');
65427
65267
  push(root);
65428
65268
  },
@@ -65436,19 +65276,19 @@ const noTrailingSlash = (a) => {
65436
65276
  };
65437
65277
 
65438
65278
  function buildTree(path, list) {
65439
- const [root, ...files] = findFile$1(list, '*');
65279
+ const [root, ...files] = findFile(list, '*');
65440
65280
 
65441
65281
  for (const filePath of files) {
65442
- const filename = getFilename$1(filePath);
65282
+ const filename = getFilename(filePath);
65443
65283
 
65444
65284
  check$3(filename);
65445
65285
 
65446
- const type = getFileType$1(filePath);
65286
+ const type = getFileType(filePath);
65447
65287
  const dir = dirname(filename);
65448
65288
  const name = basename(filename);
65449
- const [dirPath] = findFile$1(root, dir);
65289
+ const [dirPath] = findFile(root, dir);
65450
65290
 
65451
- if (!dirPath || getFileType$1(dirPath) !== 'directory')
65291
+ if (!dirPath || getFileType(dirPath) !== 'directory')
65452
65292
  throw Error(`☝️ Looks like directory '${dir}/' is missing`);
65453
65293
 
65454
65294
  if (type === 'directory') {
@@ -65456,41 +65296,54 @@ function buildTree(path, list) {
65456
65296
  continue;
65457
65297
  }
65458
65298
 
65459
- const filesProperty = getProperty$1(dirPath, 'files');
65299
+ const filesProperty = getProperty(dirPath, 'files');
65460
65300
  filesProperty.node.value.elements.push(filePath.node);
65461
65301
  }
65462
65302
 
65463
- replaceWith$1(path, root);
65303
+ replaceWith(path, root);
65464
65304
  }
65465
65305
 
65306
+ const isTwoElementsTuple = (a) => {
65307
+ if (!isArrayExpression(a))
65308
+ return false;
65309
+
65310
+ const {elements} = a.node;
65311
+
65312
+ return elements.length === 2;
65313
+ };
65314
+
65315
+ const isOneElementTuple = (a) => {
65316
+ if (!isArrayExpression(a))
65317
+ return false;
65318
+
65319
+ const {elements} = a.node;
65320
+
65321
+ return elements.length === 1;
65322
+ };
65323
+
65466
65324
  function check$3(filename) {
65467
65325
  if (!filename.includes('/'))
65468
65326
  throw Error(`☝️ Looks like directory path is missing: '${filename}'`);
65469
65327
  }
65470
65328
 
65471
- var convertFilesystemToSimpleFilesystem = {};
65472
-
65473
- const {types} = require$$0;
65474
- const {replaceWith, getProperty} = require$$1;
65475
- const {__filesystem_name} = require$$2;
65476
-
65477
- const {
65478
- findFile,
65479
- getFilename,
65480
- getFileType,
65481
- } = require$$3;
65329
+ var fromSimple = /*#__PURE__*/Object.freeze({
65330
+ __proto__: null,
65331
+ fix: fix$5,
65332
+ report: report$5,
65333
+ traverse: traverse$3
65334
+ });
65482
65335
 
65483
65336
  const {
65484
65337
  stringLiteral: stringLiteral$2,
65485
65338
  arrayExpression,
65486
- } = types;
65339
+ } = lib_exports;
65487
65340
 
65488
65341
  const {isArray} = Array;
65489
65342
  const maybeAddSlash = (a) => a === '/' ? a : `${a}/`;
65490
65343
 
65491
- convertFilesystemToSimpleFilesystem.report = () => `Convert Filesystem to Simple Filesystem`;
65344
+ const report$4 = () => `Convert Filesystem to Simple Filesystem`;
65492
65345
 
65493
- convertFilesystemToSimpleFilesystem.fix = (root, {files}) => {
65346
+ const fix$4 = (root, {files}) => {
65494
65347
  const names = [];
65495
65348
 
65496
65349
  for (const file of files) {
@@ -65529,7 +65382,7 @@ convertFilesystemToSimpleFilesystem.fix = (root, {files}) => {
65529
65382
  replaceWith(root, arrayExpression(list));
65530
65383
  };
65531
65384
 
65532
- convertFilesystemToSimpleFilesystem.traverse = ({push}) => ({
65385
+ const traverse$2 = ({push}) => ({
65533
65386
  [`${__filesystem_name}(__object)`]: (path) => {
65534
65387
  const root = path.get('arguments.0');
65535
65388
  const files = findFile(root, '*');
@@ -65540,9 +65393,16 @@ convertFilesystemToSimpleFilesystem.traverse = ({push}) => ({
65540
65393
  },
65541
65394
  });
65542
65395
 
65396
+ var toSimple = /*#__PURE__*/Object.freeze({
65397
+ __proto__: null,
65398
+ fix: fix$4,
65399
+ report: report$4,
65400
+ traverse: traverse$2
65401
+ });
65402
+
65543
65403
  const log = createDebug$1('putout:runner:scanner');
65544
65404
 
65545
- const scan$1 = ({rule, plugin, msg, options}, {progress}) => {
65405
+ const scan = ({rule, plugin, msg, options}, {progress}) => {
65546
65406
  const {
65547
65407
  scan,
65548
65408
  report,
@@ -65587,7 +65447,7 @@ const createFileProgress = ({rule, progress}) => ({i, n}) => {
65587
65447
  };
65588
65448
 
65589
65449
  const createTrackFile = (fileProgress) => function*(...a) {
65590
- const files = findFile$2(...a);
65450
+ const files = findFile(...a);
65591
65451
  const n = files.length;
65592
65452
 
65593
65453
  for (const [i, file] of files.entries()) {
@@ -65600,7 +65460,7 @@ const createTrackFile = (fileProgress) => function*(...a) {
65600
65460
  };
65601
65461
 
65602
65462
  const getTraverse = ({scan, rule, progress}) => ({push, options}) => ({
65603
- [`${__filesystem_name$2}(__)`](path) {
65463
+ [`${__filesystem_name}(__)`](path) {
65604
65464
  log(rule);
65605
65465
  progress.start(rule);
65606
65466
 
@@ -65614,7 +65474,7 @@ const getTraverse = ({scan, rule, progress}) => ({push, options}) => ({
65614
65474
 
65615
65475
  const trackFile = createTrackFile(fileProgress);
65616
65476
 
65617
- runSimple(convertSimpleFilesystemToFilesystem, {
65477
+ runSimple(fromSimple, {
65618
65478
  shouldConvert: true,
65619
65479
  path,
65620
65480
  isSimple,
@@ -65631,7 +65491,7 @@ const getTraverse = ({scan, rule, progress}) => ({push, options}) => ({
65631
65491
  options,
65632
65492
  });
65633
65493
 
65634
- runSimple(convertFilesystemToSimpleFilesystem, {
65494
+ runSimple(toSimple, {
65635
65495
  shouldConvert: isSimple(),
65636
65496
  path,
65637
65497
  isSimple,
@@ -65671,18 +65531,18 @@ function runSimple(plugin, {path, isSimple, shouldConvert = true}) {
65671
65531
  }
65672
65532
 
65673
65533
  function parseVisitor(visitors) {
65674
- const to = visitors[`${__filesystem_name$2}(__object)`];
65675
- const from = visitors[`${__filesystem_name$2}(__array)`];
65534
+ const to = visitors[`${__filesystem_name}(__object)`];
65535
+ const from = visitors[`${__filesystem_name}(__array)`];
65676
65536
 
65677
65537
  if (to)
65678
65538
  return [
65679
65539
  to,
65680
- `${__filesystem_name$2}(__object)`,
65540
+ `${__filesystem_name}(__object)`,
65681
65541
  ];
65682
65542
 
65683
65543
  return [
65684
65544
  from,
65685
- `${__filesystem_name$2}(__array)`,
65545
+ `${__filesystem_name}(__array)`,
65686
65546
  ];
65687
65547
  }
65688
65548
 
@@ -65850,7 +65710,7 @@ function splitPlugins(plugins, {progress}) {
65850
65710
  }
65851
65711
 
65852
65712
  if (plugin.scan) {
65853
- pluginsTraverse.push(scan$1(item, {
65713
+ pluginsTraverse.push(scan(item, {
65854
65714
  progress,
65855
65715
  }));
65856
65716
  continue;
@@ -72204,15 +72064,15 @@ const isCall = (path) => {
72204
72064
  return isCallExpression(path.find(isCallOrStatement));
72205
72065
  };
72206
72066
 
72207
- const report$2 = ({name}) => `Argument '${name}' is missing`;
72067
+ const report$3 = ({name}) => `Argument '${name}' is missing`;
72208
72068
 
72209
72069
  const addArgs = (args) => ({
72210
- report: report$2,
72211
- fix: fix$2,
72070
+ report: report$3,
72071
+ fix: fix$3,
72212
72072
  traverse: traverse(args),
72213
72073
  });
72214
72074
 
72215
- const fix$2 = ({declaration, path, pattern, params, index}) => {
72075
+ const fix$3 = ({declaration, path, pattern, params, index}) => {
72216
72076
  const declarationNode = template$1.ast.fresh(declaration);
72217
72077
 
72218
72078
  if (isBlockStatement(declarationNode)) {
@@ -72450,7 +72310,7 @@ const {join} = path;
72450
72310
 
72451
72311
  const isObject = (a) => a && typeof a === 'object';
72452
72312
  const {entries} = Object;
72453
- const report$1 = (path, {message}) => message;
72313
+ const report$2 = (path, {message}) => message;
72454
72314
 
72455
72315
  const matchFiles = (options) => {
72456
72316
  const {filename} = options;
@@ -72459,20 +72319,20 @@ const matchFiles = (options) => {
72459
72319
 
72460
72320
  check(files);
72461
72321
 
72462
- const scan = createScan({
72322
+ const scan = createScan$2({
72463
72323
  defaultFilename: filename,
72464
72324
  files,
72465
72325
  exclude,
72466
72326
  });
72467
72327
 
72468
72328
  return {
72469
- fix: fix$1,
72329
+ fix: fix$2,
72470
72330
  scan,
72471
- report: report$1,
72331
+ report: report$2,
72472
72332
  };
72473
72333
  };
72474
72334
 
72475
- function fix$1(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJS, matchedAST, options}) {
72335
+ function fix$2(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJS, matchedAST, options}) {
72476
72336
  transform(matchedAST, matchedJS, options);
72477
72337
 
72478
72338
  const matchedJSON = magicPrint(outputFilename, matchedAST);
@@ -72489,19 +72349,19 @@ function fix$1(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJ
72489
72349
  removeFile(inputFile);
72490
72350
  }
72491
72351
 
72492
- const createScan = ({files, exclude, defaultFilename}) => (mainPath, {push, progress, options}) => {
72352
+ const createScan$2 = ({files, exclude, defaultFilename}) => (mainPath, {push, progress, options}) => {
72493
72353
  const allFiles = [];
72494
- const cwd = getFilename$2(mainPath);
72354
+ const cwd = getFilename(mainPath);
72495
72355
 
72496
72356
  options.filename = options.filename ?? defaultFilename;
72497
72357
 
72498
72358
  for (const [filename, rawOptions] of entries(files)) {
72499
72359
  const [matchInputFilenameMask] = parseMatcher(filename, options);
72500
- const inputFiles = findFile$2(mainPath, matchInputFilenameMask, exclude);
72360
+ const inputFiles = findFile(mainPath, matchInputFilenameMask, exclude);
72501
72361
 
72502
72362
  for (const inputFile of inputFiles) {
72503
72363
  const dirPath = getParentDirectory(inputFile);
72504
- const inputFilename = getFilename$2(inputFile);
72364
+ const inputFilename = getFilename(inputFile);
72505
72365
 
72506
72366
  const [matchInputFilename, outputFilename = matchInputFilename] = parseMatcher(filename, {
72507
72367
  filename: inputFilename,
@@ -72603,8 +72463,8 @@ function getOutputFile({dirPath, matchInputFilename, outputFilename, inputFile})
72603
72463
  if (matchInputFilename === outputFilename)
72604
72464
  return inputFile;
72605
72465
 
72606
- const name = join(getFilename$2(dirPath), outputFilename);
72607
- const [outputFile] = findFile$2(dirPath, name);
72466
+ const name = join(getFilename(dirPath), outputFilename);
72467
+ const [outputFile] = findFile(dirPath, name);
72608
72468
 
72609
72469
  if (outputFile)
72610
72470
  return outputFile;
@@ -72643,28 +72503,18 @@ function parseOptions(inputFilename, rawOptions) {
72643
72503
 
72644
72504
  const {parse} = JSON;
72645
72505
 
72646
- const renameFiles = ({type, mask, rename}) => ({
72647
- report,
72648
- fix,
72649
- scan: scan({
72650
- type,
72651
- mask,
72652
- rename,
72653
- }),
72654
- });
72655
-
72656
- const report = (file, {from, to}) => `Rename '${from}' to '${to}'`;
72506
+ const report$1 = (file, {from, to}) => `Rename '${from}' to '${to}'`;
72657
72507
 
72658
- const fix = (file, {to}) => {
72508
+ const fix$1 = (file, {to}) => {
72659
72509
  renameFile(file, to);
72660
72510
  };
72661
72511
 
72662
- const scan = ({type, mask, rename}) => (path, {push, trackFile}) => {
72512
+ const createScan$1 = ({type, mask, rename} = {}) => (path, {push, trackFile}) => {
72663
72513
  for (const file of trackFile(path, mask)) {
72664
72514
  if (type && !checkType(type, file))
72665
72515
  continue;
72666
72516
 
72667
- const from = getFilename$2(file);
72517
+ const from = getFilename(file);
72668
72518
  const to = rename(from);
72669
72519
 
72670
72520
  push(file, {
@@ -72699,13 +72549,118 @@ function findUpPackage(file) {
72699
72549
  let dirPath = getParentDirectory(file);
72700
72550
 
72701
72551
  do {
72702
- const dir = getFilename$2(dirPath);
72703
- [packageJSON] = findFile$2(dirPath, join$1(dir, 'package.json'));
72552
+ const dir = getFilename(dirPath);
72553
+ [packageJSON] = findFile(dirPath, join$1(dir, 'package.json'));
72704
72554
  } while (!packageJSON && (dirPath = getParentDirectory(dirPath)));
72705
72555
 
72706
72556
  return packageJSON;
72707
72557
  }
72708
72558
 
72559
+ var renameFileWithFn = /*#__PURE__*/Object.freeze({
72560
+ __proto__: null,
72561
+ createScan: createScan$1,
72562
+ fix: fix$1,
72563
+ report: report$1
72564
+ });
72565
+
72566
+ const returns = (a) => () => a;
72567
+
72568
+ const report = (path, {mask, from, to}) => {
72569
+ if (!mask)
72570
+ return `Rename '${from}' to '${to}'`;
72571
+
72572
+ return `Rename '${mask}' to '${mask.replace(from, to)}'`;
72573
+ };
72574
+
72575
+ const fix = (path, {from, to}) => {
72576
+ const filename = getFilename(path);
72577
+ const newFilename = filename.replace(from, to);
72578
+
72579
+ renameFile(path, newFilename);
72580
+ };
72581
+
72582
+ const createScan = (baseOptions) => (rootPath, {push, options, trackFile}) => {
72583
+ const from = options.from || baseOptions.from;
72584
+ const to = options.to || baseOptions.to;
72585
+ const mask = options.mask || baseOptions.mask;
72586
+ const near = options.near || baseOptions.near;
72587
+ const checkNear = near ? createCheckNear(near) : returns(true);
72588
+
72589
+ if (!from || !to)
72590
+ return {};
72591
+
72592
+ for (const file of trackFile(rootPath, mask || from).filter(checkNear)) {
72593
+ push(file, {
72594
+ from,
72595
+ to,
72596
+ mask,
72597
+ });
72598
+ }
72599
+ };
72600
+
72601
+ const createCheckNear = (near) => (file) => {
72602
+ const parentDirectory = getParentDirectory(file);
72603
+
72604
+ for (const currentFile of readDirectory(parentDirectory)) {
72605
+ const type = getFileType(currentFile);
72606
+
72607
+ if (type !== 'file')
72608
+ continue;
72609
+
72610
+ const name = getFilename(currentFile);
72611
+ const base = basename(name);
72612
+
72613
+ if (base === near)
72614
+ return true;
72615
+ }
72616
+
72617
+ return false;
72618
+ };
72619
+
72620
+ var renameFileByMask = /*#__PURE__*/Object.freeze({
72621
+ __proto__: null,
72622
+ createScan: createScan,
72623
+ fix: fix,
72624
+ report: report
72625
+ });
72626
+
72627
+ const renameFiles = ({type, mask, rename, from, to, near} = {}) => {
72628
+ if (rename) {
72629
+ const {
72630
+ report,
72631
+ fix,
72632
+ createScan,
72633
+ } = renameFileWithFn;
72634
+
72635
+ return {
72636
+ report,
72637
+ fix,
72638
+ scan: createScan({
72639
+ type,
72640
+ mask,
72641
+ rename,
72642
+ }),
72643
+ };
72644
+ }
72645
+
72646
+ const {
72647
+ report,
72648
+ fix,
72649
+ createScan,
72650
+ } = renameFileByMask;
72651
+
72652
+ return {
72653
+ fix,
72654
+ report,
72655
+ scan: createScan({
72656
+ mask,
72657
+ from,
72658
+ to,
72659
+ near,
72660
+ }),
72661
+ };
72662
+ };
72663
+
72709
72664
  const {stringLiteral} = lib_exports;
72710
72665
  const getValue = ({value}) => value;
72711
72666
 
@@ -72871,106 +72826,106 @@ function hasParens(path, printer = getPrinter(path)) {
72871
72826
  }
72872
72827
 
72873
72828
  var operator = /*#__PURE__*/Object.freeze({
72874
- __proto__: null,
72875
- __filesystem: __filesystem,
72876
- __filesystem_name: __filesystem_name$2,
72877
- __ignore: __ignore,
72878
- __ignore_name: __ignore_name,
72879
- __json: __json,
72880
- __json_name: __json_name,
72881
- __toml: __toml,
72882
- __toml_name: __toml_name,
72883
- __yaml: __yaml,
72884
- __yaml_name: __yaml_name,
72885
- addArgs: addArgs,
72886
- addAttribute: addAttribute,
72887
- addAttributeValue: addAttributeValue,
72888
- addClassName: addClassName,
72889
- addParens: addParens,
72890
- compare: compare,
72891
- compareAll: compareAll,
72892
- compareAny: compareAny,
72893
- compute: compute,
72894
- contains: contains,
72895
- containsClassName: containsClassName,
72896
- copyFile: copyFile,
72897
- createDirectory: createDirectory$1,
72898
- createFile: createFile,
72899
- createNestedDirectory: createNestedDirectory,
72900
- declare: declare$1,
72901
- deinit: deinit,
72902
- extract: extract,
72903
- findBinding: findBinding,
72904
- findFile: findFile$2,
72905
- findVarsWays: findVarsWays,
72906
- fromJS: fromJS,
72907
- getAttributeNode: getAttributeNode,
72908
- getAttributePath: getAttributePath,
72909
- getAttributeValue: getAttributeValue,
72910
- getBinding: getBinding,
72911
- getBindingPath: getBindingPath,
72912
- getClassName: getClassName,
72913
- getExportDefault: getExportDefault,
72914
- getFileContent: getFileContent,
72915
- getFileType: getFileType$2,
72916
- getFilename: getFilename$2,
72917
- getLiteralRaw: getLiteralRaw,
72918
- getParentDirectory: getParentDirectory,
72919
- getPathAfterImports: getPathAfterImports,
72920
- getPathAfterRequires: getPathAfterRequires,
72921
- getProperties: getProperties,
72922
- getProperty: getProperty$2,
72923
- getRootDirectory: getRootDirectory,
72924
- getTemplateValues: getTemplateValues,
72925
- getValues: getValues,
72926
- hasAttributeValue: hasAttributeValue,
72927
- hasDataName: hasDataName,
72928
- hasParens: hasParens,
72929
- hasTagName: hasTagName,
72930
- ignore: ignore,
72931
- init: init,
72932
- insertAfter: insertAfter,
72933
- insertBefore: insertBefore,
72934
- isConditionKeyword: isConditionKeyword,
72935
- isDeclarationKeyword: isDeclarationKeyword,
72936
- isESM: isESM,
72937
- isJSON: isJSON,
72938
- isKeyword: isKeyword,
72939
- isModuleDeclarationKeyword: isModuleDeclarationKeyword,
72940
- isModuleExports: isModuleExports,
72941
- isSimple: isSimple,
72942
- isSimpleRegExp: isSimpleRegExp,
72943
- isStatementKeyword: isStatementKeyword,
72944
- isTSKeyword: isTSKeyword,
72945
- isTemplate: isTemplate,
72946
- matchFiles: matchFiles,
72947
- moveFile: moveFile,
72948
- parseTemplate: parseTemplate,
72949
- pause: pause,
72950
- readDirectory: readDirectory,
72951
- readFileContent: readFileContent,
72952
- remove: remove,
72953
- removeAttributeValue: removeAttributeValue,
72954
- removeClassName: removeClassName,
72955
- removeEmptyDirectory: removeEmptyDirectory,
72956
- removeFile: removeFile,
72957
- removeParens: removeParens,
72958
- rename: rename,
72959
- renameFile: renameFile,
72960
- renameFiles: renameFiles,
72961
- renameProperty: renameProperty,
72962
- replaceWith: replaceWith$2,
72963
- replaceWithMultiple: replaceWithMultiple,
72964
- setAttributeValue: setAttributeValue,
72965
- setLiteralValue: setLiteralValue,
72966
- setValues: setValues,
72967
- start: start,
72968
- toExpression: toExpression,
72969
- toJS: toJS,
72970
- transformRegExp: transformRegExp,
72971
- traverse: traverse$1,
72972
- traverseProperties: traverseProperties,
72973
- writeFileContent: writeFileContent
72829
+ __proto__: null,
72830
+ __filesystem: __filesystem,
72831
+ __filesystem_name: __filesystem_name,
72832
+ __ignore: __ignore,
72833
+ __ignore_name: __ignore_name,
72834
+ __json: __json,
72835
+ __json_name: __json_name,
72836
+ __toml: __toml,
72837
+ __toml_name: __toml_name,
72838
+ __yaml: __yaml,
72839
+ __yaml_name: __yaml_name,
72840
+ addArgs: addArgs,
72841
+ addAttribute: addAttribute,
72842
+ addAttributeValue: addAttributeValue,
72843
+ addClassName: addClassName,
72844
+ addParens: addParens,
72845
+ compare: compare,
72846
+ compareAll: compareAll,
72847
+ compareAny: compareAny,
72848
+ compute: compute,
72849
+ contains: contains,
72850
+ containsClassName: containsClassName,
72851
+ copyFile: copyFile,
72852
+ createDirectory: createDirectory,
72853
+ createFile: createFile,
72854
+ createNestedDirectory: createNestedDirectory,
72855
+ declare: declare$1,
72856
+ deinit: deinit,
72857
+ extract: extract,
72858
+ findBinding: findBinding,
72859
+ findFile: findFile,
72860
+ findVarsWays: findVarsWays,
72861
+ fromJS: fromJS,
72862
+ getAttributeNode: getAttributeNode,
72863
+ getAttributePath: getAttributePath,
72864
+ getAttributeValue: getAttributeValue,
72865
+ getBinding: getBinding,
72866
+ getBindingPath: getBindingPath,
72867
+ getClassName: getClassName,
72868
+ getExportDefault: getExportDefault,
72869
+ getFileContent: getFileContent,
72870
+ getFileType: getFileType,
72871
+ getFilename: getFilename,
72872
+ getLiteralRaw: getLiteralRaw,
72873
+ getParentDirectory: getParentDirectory,
72874
+ getPathAfterImports: getPathAfterImports,
72875
+ getPathAfterRequires: getPathAfterRequires,
72876
+ getProperties: getProperties,
72877
+ getProperty: getProperty,
72878
+ getRootDirectory: getRootDirectory,
72879
+ getTemplateValues: getTemplateValues,
72880
+ getValues: getValues,
72881
+ hasAttributeValue: hasAttributeValue,
72882
+ hasDataName: hasDataName,
72883
+ hasParens: hasParens,
72884
+ hasTagName: hasTagName,
72885
+ ignore: ignore,
72886
+ init: init,
72887
+ insertAfter: insertAfter,
72888
+ insertBefore: insertBefore,
72889
+ isConditionKeyword: isConditionKeyword,
72890
+ isDeclarationKeyword: isDeclarationKeyword,
72891
+ isESM: isESM,
72892
+ isJSON: isJSON,
72893
+ isKeyword: isKeyword,
72894
+ isModuleDeclarationKeyword: isModuleDeclarationKeyword,
72895
+ isModuleExports: isModuleExports,
72896
+ isSimple: isSimple,
72897
+ isSimpleRegExp: isSimpleRegExp,
72898
+ isStatementKeyword: isStatementKeyword,
72899
+ isTSKeyword: isTSKeyword,
72900
+ isTemplate: isTemplate,
72901
+ matchFiles: matchFiles,
72902
+ moveFile: moveFile,
72903
+ parseTemplate: parseTemplate,
72904
+ pause: pause,
72905
+ readDirectory: readDirectory,
72906
+ readFileContent: readFileContent,
72907
+ remove: remove,
72908
+ removeAttributeValue: removeAttributeValue,
72909
+ removeClassName: removeClassName,
72910
+ removeEmptyDirectory: removeEmptyDirectory,
72911
+ removeFile: removeFile,
72912
+ removeParens: removeParens,
72913
+ rename: rename,
72914
+ renameFile: renameFile,
72915
+ renameFiles: renameFiles,
72916
+ renameProperty: renameProperty,
72917
+ replaceWith: replaceWith,
72918
+ replaceWithMultiple: replaceWithMultiple,
72919
+ setAttributeValue: setAttributeValue,
72920
+ setLiteralValue: setLiteralValue,
72921
+ setValues: setValues,
72922
+ start: start,
72923
+ toExpression: toExpression,
72924
+ toJS: toJS,
72925
+ transformRegExp: transformRegExp,
72926
+ traverse: traverse$1,
72927
+ traverseProperties: traverseProperties,
72928
+ writeFileContent: writeFileContent
72974
72929
  });
72975
72930
 
72976
72931
  const codeframe = ({source, error, highlightCode = true}) => {
@@ -72990,20 +72945,20 @@ const codeframe = ({source, error, highlightCode = true}) => {
72990
72945
  };
72991
72946
 
72992
72947
  var exports$1 = /*#__PURE__*/Object.freeze({
72993
- __proto__: null,
72994
- codeframe: codeframe,
72995
- findPlaces: findPlaces,
72996
- findPlacesAsync: findPlacesAsync,
72997
- generate: generate,
72998
- operator: operator,
72999
- parse: parse$2,
73000
- print: print,
73001
- putoutAsync: putoutAsync,
73002
- template: template$1,
73003
- transform: transform,
73004
- transformAsync: transformAsync,
73005
- traverse: traverse3,
73006
- types: lib_exports
72948
+ __proto__: null,
72949
+ codeframe: codeframe,
72950
+ findPlaces: findPlaces,
72951
+ findPlacesAsync: findPlacesAsync,
72952
+ generate: generate,
72953
+ operator: operator,
72954
+ parse: parse$2,
72955
+ print: print,
72956
+ putoutAsync: putoutAsync,
72957
+ template: template$1,
72958
+ transform: transform,
72959
+ transformAsync: transformAsync,
72960
+ traverse: traverse3,
72961
+ types: lib_exports
73007
72962
  });
73008
72963
 
73009
72964
  Object.assign(putout, exports$1);