@putout/bundle 5.2.0 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/putout.js CHANGED
@@ -27,7 +27,7 @@ function getAugmentedNamespace(n) {
27
27
  return a;
28
28
  }
29
29
 
30
- var fullstore = (value) => {
30
+ var fullstore$1 = (value) => {
31
31
  const data = {
32
32
  value,
33
33
  };
@@ -44,7 +44,7 @@ var fullstore = (value) => {
44
44
  };
45
45
  };
46
46
 
47
- var fullstore$1 = fullstore.default;
47
+ var fullstore$2 = fullstore$1;
48
48
 
49
49
  var global$1 = (typeof global !== "undefined" ? global :
50
50
  typeof self !== "undefined" ? self :
@@ -59310,7 +59310,7 @@ const tokenize = (ast, overrides) => {
59310
59310
  traverse,
59311
59311
  maybe,
59312
59312
  quote,
59313
- store: fullstore$1(),
59313
+ store: fullstore$2(),
59314
59314
  });
59315
59315
 
59316
59316
  const currentTraversers = {
@@ -59470,13 +59470,13 @@ var removeBlankLines$1 = lib.default;
59470
59470
 
59471
59471
  const __json_name$1 = '__putout_processor_json';
59472
59472
  const __yaml_name$1 = '__putout_processor_yaml';
59473
- const __filesystem_name$4 = '__putout_processor_filesystem';
59473
+ const __filesystem_name$3 = '__putout_processor_filesystem';
59474
59474
  const __ignore_name$1 = '__putout_processor_ignore';
59475
59475
 
59476
59476
  const TYPES$1 = [
59477
59477
  __json_name$1,
59478
59478
  __yaml_name$1,
59479
- __filesystem_name$4,
59479
+ __filesystem_name$3,
59480
59480
  __ignore_name$1,
59481
59481
  ];
59482
59482
 
@@ -62388,7 +62388,7 @@ const isString$6 = (a) => typeof a === 'string';
62388
62388
  const isUndefined = (a) => typeof a === 'undefined';
62389
62389
  const isEmpty = (obj) => !Object.keys(obj).length;
62390
62390
 
62391
- var jessy = (selector, divider, value) => {
62391
+ function jessy(selector, divider, value) {
62392
62392
  if (!value) {
62393
62393
  value = divider;
62394
62394
  divider = '.';
@@ -62425,7 +62425,7 @@ var jessy = (selector, divider, value) => {
62425
62425
  }
62426
62426
 
62427
62427
  return value;
62428
- };
62428
+ }
62429
62429
 
62430
62430
  function check$7(selector, obj) {
62431
62431
  if (!isString$6(selector))
@@ -62435,14 +62435,12 @@ function check$7(selector, obj) {
62435
62435
  throw Error('obj should be object!');
62436
62436
  }
62437
62437
 
62438
- var jessy$1 = jessy.default;
62439
-
62440
62438
  const isNumber$1 = (a) => !Number.isNaN(a) && typeof a === 'number';
62441
62439
  const isNumberLike = (a, b = Number(a)) => isNumber$1(b);
62442
62440
  const isString$5 = (a) => typeof a === 'string';
62443
62441
  const notSecure = (a) => /__proto__|prototype/.test(a);
62444
62442
 
62445
- var nessy = (selector, value, divider, obj) => {
62443
+ function nessy(selector, value, divider, obj) {
62446
62444
  if (!obj) {
62447
62445
  obj = divider || {};
62448
62446
  divider = '.';
@@ -62455,6 +62453,7 @@ var nessy = (selector, value, divider, obj) => {
62455
62453
  const array = selector
62456
62454
  .split(divider)
62457
62455
  .filter(Boolean);
62456
+
62458
62457
  const n = array.length - 1;
62459
62458
 
62460
62459
  for (const [i, name] of array.entries()) {
@@ -62468,21 +62467,17 @@ var nessy = (selector, value, divider, obj) => {
62468
62467
 
62469
62468
  obj[name] = isNumberLike(nextKey) ? [] : {};
62470
62469
  }
62471
-
62472
62470
 
62473
62471
  obj = obj[name];
62474
62472
  }
62475
62473
 
62476
62474
  return result;
62477
- };
62478
-
62475
+ }
62479
62476
  function check$6(selector) {
62480
62477
  if (!isString$5(selector))
62481
62478
  throw Error('selector should be string!');
62482
62479
  }
62483
62480
 
62484
- var nessy$1 = nessy.default;
62485
-
62486
62481
  const TS_MODULE_REG = /\.body\.0\.expression$/;
62487
62482
  const CLASS_BODY_REG = /\.body\.0\.key$/;
62488
62483
  const BODY_REG = /\.body\.0$/;
@@ -62942,7 +62937,7 @@ function getValues({waysFrom, node}) {
62942
62937
  if (isBodyStr(name))
62943
62938
  way = prepareBodyWay(way);
62944
62939
 
62945
- result[name] = result[name] || extractExpression$1(jessy$1(way, node));
62940
+ result[name] = result[name] || extractExpression$1(jessy(way, node));
62946
62941
  }
62947
62942
  }
62948
62943
 
@@ -62977,14 +62972,14 @@ function setValues({waysTo, values, path}) {
62977
62972
  raw: makeRaw(value),
62978
62973
  });
62979
62974
 
62980
- nessy$1(way, element, node);
62975
+ nessy(way, element, node);
62981
62976
  continue;
62982
62977
  }
62983
62978
 
62984
62979
  if (isBodyStr(name))
62985
62980
  way = prepareBodyWay(way);
62986
62981
 
62987
- const {extra} = jessy$1(way, node);
62982
+ const {extra} = jessy(way, node);
62988
62983
 
62989
62984
  if (extra) {
62990
62985
  const valueExtra = values[name].extra;
@@ -62995,7 +62990,7 @@ function setValues({waysTo, values, path}) {
62995
62990
  };
62996
62991
  }
62997
62992
 
62998
- nessy$1(way, values[name], node);
62993
+ nessy(way, values[name], node);
62999
62994
  }
63000
62995
  }
63001
62996
  }
@@ -64693,10 +64688,101 @@ function validateDeclare(declare) {
64693
64688
  throw Error(`☝️ Looks like 'declare' property value is not a 'function', but '${typeof declare}' with value '${stringify(declare)}'.`);
64694
64689
  }
64695
64690
 
64696
- const __filesystem_name$3 = '__putout_processor_filesystem';
64697
- var __filesystem_name_1 = __filesystem_name$3;
64691
+ function fullstore(value) {
64692
+ const data = {
64693
+ value,
64694
+ };
64695
+
64696
+ return (...args) => {
64697
+ const [value] = args;
64698
+
64699
+ if (!args.length)
64700
+ return data.value;
64701
+
64702
+ data.value = value;
64703
+
64704
+ return value;
64705
+ };
64706
+ }
64707
+
64708
+ const cut = (a) => a.slice(0, a.indexOf('('));
64709
+ const createPrefix = (name) => {
64710
+ if (name.includes('('))
64711
+ return `${cut(name)}(`;
64712
+
64713
+ return `${name}(`;
64714
+ };
64715
+
64716
+ const createSuffix = () => ');\n';
64717
+ const maybeNewline = (a) => a.at(-1) === '\n' ? a : `${a}\n`;
64718
+
64719
+ const __json_name = '__putout_processor_json';
64720
+ const __yaml_name = '__putout_processor_yaml';
64721
+ const __toml_name = '__putout_processor_toml';
64722
+ const __filesystem_name$2 = '__putout_processor_filesystem';
64723
+ const __ignore_name = '__putout_processor_ignore';
64724
+
64725
+ const __json = `${__json_name}(__object)`;
64726
+ const __yaml = `${__yaml_name}(__object)`;
64727
+ const __toml = `${__toml_name}(__object)`;
64728
+ const __filesystem = `${__filesystem_name$2}(__object)`;
64729
+ const __ignore = `${__ignore_name}(__array)`;
64730
+
64731
+ const TYPES = [
64732
+ __json_name,
64733
+ __yaml_name,
64734
+ __filesystem_name$2,
64735
+ __ignore_name,
64736
+ ];
64737
+
64738
+ const toJS = (source, name = __json) => {
64739
+ const prefix = createPrefix(name);
64740
+ const suffix = createSuffix();
64741
+
64742
+ return `${prefix}${source}${suffix}`;
64743
+ };
64744
+
64745
+ const fromJS = (source, name = __json) => {
64746
+ source = maybeNewline(source);
64747
+ const shortName = cut(name);
64748
+
64749
+ source = source.slice(source.indexOf(shortName));
64750
+
64751
+ const prefix = createPrefix(name);
64752
+ const suffix = createSuffix();
64753
+ const length = source.length - suffix.length;
64754
+ const sliced = source.slice(prefix.length, length);
64755
+
64756
+ return maybeNewline(removeBlankLines$1(sliced));
64757
+ };
64758
+
64759
+ const isJSON = (source) => {
64760
+ for (const type of TYPES) {
64761
+ if (!source.indexOf(type))
64762
+ return true;
64763
+ }
64764
+
64765
+ return false;
64766
+ };
64767
+
64768
+ var json = /*#__PURE__*/Object.freeze({
64769
+ __proto__: null,
64770
+ __filesystem: __filesystem,
64771
+ __filesystem_name: __filesystem_name$2,
64772
+ __ignore: __ignore,
64773
+ __ignore_name: __ignore_name,
64774
+ __json: __json,
64775
+ __json_name: __json_name,
64776
+ __toml: __toml,
64777
+ __toml_name: __toml_name,
64778
+ __yaml: __yaml,
64779
+ __yaml_name: __yaml_name,
64780
+ fromJS: fromJS,
64781
+ isJSON: isJSON,
64782
+ toJS: toJS
64783
+ });
64698
64784
 
64699
- const driverStore = fullstore$1();
64785
+ const driverStore = fullstore();
64700
64786
 
64701
64787
  const {assign} = Object;
64702
64788
  const noop = () => {};
@@ -65235,83 +65321,6 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(bundle);
65235
65321
 
65236
65322
  var require$$3 = /*@__PURE__*/getAugmentedNamespace(filesystem);
65237
65323
 
65238
- const cut = (a) => a.slice(0, a.indexOf('('));
65239
- const createPrefix = (name) => {
65240
- if (name.includes('('))
65241
- return `${cut(name)}(`;
65242
-
65243
- return `${name}(`;
65244
- };
65245
-
65246
- const createSuffix = () => ');\n';
65247
- const maybeNewline = (a) => a.at(-1) === '\n' ? a : `${a}\n`;
65248
-
65249
- const __json_name = '__putout_processor_json';
65250
- const __yaml_name = '__putout_processor_yaml';
65251
- const __toml_name = '__putout_processor_toml';
65252
- const __filesystem_name$2 = '__putout_processor_filesystem';
65253
- const __ignore_name = '__putout_processor_ignore';
65254
-
65255
- const __json = `${__json_name}(__object)`;
65256
- const __yaml = `${__yaml_name}(__object)`;
65257
- const __toml = `${__toml_name}(__object)`;
65258
- const __filesystem = `${__filesystem_name$2}(__object)`;
65259
- const __ignore = `${__ignore_name}(__array)`;
65260
-
65261
- const TYPES = [
65262
- __json_name,
65263
- __yaml_name,
65264
- __filesystem_name$2,
65265
- __ignore_name,
65266
- ];
65267
-
65268
- const toJS = (source, name = __json) => {
65269
- const prefix = createPrefix(name);
65270
- const suffix = createSuffix();
65271
-
65272
- return `${prefix}${source}${suffix}`;
65273
- };
65274
-
65275
- const fromJS = (source, name = __json) => {
65276
- source = maybeNewline(source);
65277
- const shortName = cut(name);
65278
-
65279
- source = source.slice(source.indexOf(shortName));
65280
-
65281
- const prefix = createPrefix(name);
65282
- const suffix = createSuffix();
65283
- const length = source.length - suffix.length;
65284
- const sliced = source.slice(prefix.length, length);
65285
-
65286
- return maybeNewline(removeBlankLines$1(sliced));
65287
- };
65288
-
65289
- const isJSON = (source) => {
65290
- for (const type of TYPES) {
65291
- if (!source.indexOf(type))
65292
- return true;
65293
- }
65294
-
65295
- return false;
65296
- };
65297
-
65298
- var json = /*#__PURE__*/Object.freeze({
65299
- __proto__: null,
65300
- __filesystem: __filesystem,
65301
- __filesystem_name: __filesystem_name$2,
65302
- __ignore: __ignore,
65303
- __ignore_name: __ignore_name,
65304
- __json: __json,
65305
- __json_name: __json_name,
65306
- __toml: __toml,
65307
- __toml_name: __toml_name,
65308
- __yaml: __yaml,
65309
- __yaml_name: __yaml_name,
65310
- fromJS: fromJS,
65311
- isJSON: isJSON,
65312
- toJS: toJS
65313
- });
65314
-
65315
65324
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(json);
65316
65325
 
65317
65326
  var require$$1 = /*@__PURE__*/getAugmentedNamespace(operate);
@@ -65586,12 +65595,12 @@ const createTrackFile = (fileProgress) => function*(...a) {
65586
65595
  };
65587
65596
 
65588
65597
  const getTraverse = ({scan, rule, progress}) => ({push, options}) => ({
65589
- [`${__filesystem_name_1}(__)`](path) {
65598
+ [`${__filesystem_name$2}(__)`](path) {
65590
65599
  log(rule);
65591
65600
  progress.start(rule);
65592
65601
 
65593
65602
  const rootPath = path.get('arguments.0');
65594
- const isSimple = fullstore$1(false);
65603
+ const isSimple = fullstore(false);
65595
65604
 
65596
65605
  const fileProgress = createFileProgress({
65597
65606
  rule,
@@ -65657,18 +65666,18 @@ function runSimple(plugin, {path, isSimple, shouldConvert = true}) {
65657
65666
  }
65658
65667
 
65659
65668
  function parseVisitor(visitors) {
65660
- const to = visitors[`${__filesystem_name_1}(__object)`];
65661
- const from = visitors[`${__filesystem_name_1}(__array)`];
65669
+ const to = visitors[`${__filesystem_name$2}(__object)`];
65670
+ const from = visitors[`${__filesystem_name$2}(__array)`];
65662
65671
 
65663
65672
  if (to)
65664
65673
  return [
65665
65674
  to,
65666
- `${__filesystem_name_1}(__object)`,
65675
+ `${__filesystem_name$2}(__object)`,
65667
65676
  ];
65668
65677
 
65669
65678
  return [
65670
65679
  from,
65671
- `${__filesystem_name_1}(__array)`,
65680
+ `${__filesystem_name$2}(__array)`,
65672
65681
  ];
65673
65682
  }
65674
65683