@putout/bundle 5.3.1 → 5.4.1
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 +1552 -1289
- package/bundle/putout.min.js +7 -7
- package/bundle/putout.slim.js +1552 -1289
- package/package.json +6 -6
package/bundle/putout.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
function fullstore(value) {
|
|
2
|
-
const data = {
|
|
3
|
-
value,
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
return (...args) => {
|
|
7
|
-
const [value] = args;
|
|
8
|
-
|
|
9
|
-
if (!args.length)
|
|
10
|
-
return data.value;
|
|
11
|
-
|
|
12
|
-
data.value = value;
|
|
13
|
-
|
|
14
|
-
return value;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
1
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
19
2
|
typeof self !== "undefined" ? self :
|
|
20
3
|
typeof window !== "undefined" ? window : {});
|
|
@@ -216,7 +199,7 @@ function write (buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
216
199
|
|
|
217
200
|
var toString = {}.toString;
|
|
218
201
|
|
|
219
|
-
var isArray$
|
|
202
|
+
var isArray$g = Array.isArray || function (arr) {
|
|
220
203
|
return toString.call(arr) == '[object Array]';
|
|
221
204
|
};
|
|
222
205
|
|
|
@@ -500,7 +483,7 @@ function fromObject (that, obj) {
|
|
|
500
483
|
return fromArrayLike(that, obj)
|
|
501
484
|
}
|
|
502
485
|
|
|
503
|
-
if (obj.type === 'Buffer' && isArray$
|
|
486
|
+
if (obj.type === 'Buffer' && isArray$g(obj.data)) {
|
|
504
487
|
return fromArrayLike(that, obj.data)
|
|
505
488
|
}
|
|
506
489
|
}
|
|
@@ -565,7 +548,7 @@ Buffer.isEncoding = function isEncoding (encoding) {
|
|
|
565
548
|
};
|
|
566
549
|
|
|
567
550
|
Buffer.concat = function concat (list, length) {
|
|
568
|
-
if (!isArray$
|
|
551
|
+
if (!isArray$g(list)) {
|
|
569
552
|
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
570
553
|
}
|
|
571
554
|
|
|
@@ -2219,7 +2202,7 @@ var browser$1 = {
|
|
|
2219
2202
|
};
|
|
2220
2203
|
|
|
2221
2204
|
var util = /*#__PURE__*/Object.freeze({
|
|
2222
|
-
|
|
2205
|
+
__proto__: null
|
|
2223
2206
|
});
|
|
2224
2207
|
|
|
2225
2208
|
var __create = Object.create;
|
|
@@ -3368,7 +3351,7 @@ __export(lib_exports, {
|
|
|
3368
3351
|
isAccessor: () => isAccessor,
|
|
3369
3352
|
isAnyTypeAnnotation: () => isAnyTypeAnnotation,
|
|
3370
3353
|
isArgumentPlaceholder: () => isArgumentPlaceholder,
|
|
3371
|
-
isArrayExpression: () => isArrayExpression$
|
|
3354
|
+
isArrayExpression: () => isArrayExpression$b,
|
|
3372
3355
|
isArrayPattern: () => isArrayPattern,
|
|
3373
3356
|
isArrayTypeAnnotation: () => isArrayTypeAnnotation,
|
|
3374
3357
|
isArrowFunctionExpression: () => isArrowFunctionExpression$3,
|
|
@@ -3866,9 +3849,6 @@ var nonASCIIidentifierStartChars = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u0
|
|
|
3866
3849
|
var nonASCIIidentifierChars = '\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65';
|
|
3867
3850
|
var nonASCIIidentifierStart = new RegExp('[' + nonASCIIidentifierStartChars + ']');
|
|
3868
3851
|
var nonASCIIidentifier = new RegExp('[' + nonASCIIidentifierStartChars + nonASCIIidentifierChars + ']');
|
|
3869
|
-
|
|
3870
|
-
nonASCIIidentifierStartChars =
|
|
3871
|
-
nonASCIIidentifierChars = null;
|
|
3872
3852
|
var astralIdentifierStartCodes = [
|
|
3873
3853
|
0,
|
|
3874
3854
|
11,
|
|
@@ -5342,7 +5322,7 @@ function captureShortStackTrace(skip2, length) {
|
|
|
5342
5322
|
};
|
|
5343
5323
|
}
|
|
5344
5324
|
|
|
5345
|
-
function isArrayExpression$
|
|
5325
|
+
function isArrayExpression$b(node, opts) {
|
|
5346
5326
|
if (!node)
|
|
5347
5327
|
return false;
|
|
5348
5328
|
|
|
@@ -18616,15 +18596,13 @@ function removeTypeDuplicates$1(nodesIn) {
|
|
|
18616
18596
|
const name = getQualifiedName$1(node.id);
|
|
18617
18597
|
|
|
18618
18598
|
if (generics.has(name)) {
|
|
18619
|
-
|
|
18599
|
+
const existingTypeParameters = generics.get(name).typeParameters;
|
|
18620
18600
|
|
|
18621
|
-
if (
|
|
18601
|
+
if (existingTypeParameters) {
|
|
18622
18602
|
if (node.typeParameters) {
|
|
18623
|
-
|
|
18624
|
-
|
|
18603
|
+
existingTypeParameters.params.push(...node.typeParameters.params);
|
|
18604
|
+
existingTypeParameters.params = removeTypeDuplicates$1(existingTypeParameters.params);
|
|
18625
18605
|
}
|
|
18626
|
-
} else {
|
|
18627
|
-
existing = node.typeParameters;
|
|
18628
18606
|
}
|
|
18629
18607
|
} else {
|
|
18630
18608
|
generics.set(name, node);
|
|
@@ -18703,14 +18681,11 @@ function removeTypeDuplicates(nodesIn) {
|
|
|
18703
18681
|
const name = getQualifiedName(node.typeName);
|
|
18704
18682
|
|
|
18705
18683
|
if (generics.has(name)) {
|
|
18706
|
-
|
|
18707
|
-
const existingTypeArguments = existing[typeArgumentsKey];
|
|
18684
|
+
const existingTypeArguments = generics.get(name)[typeArgumentsKey];
|
|
18708
18685
|
|
|
18709
18686
|
if (existingTypeArguments) {
|
|
18710
18687
|
existingTypeArguments.params.push(...typeArguments.params);
|
|
18711
18688
|
existingTypeArguments.params = removeTypeDuplicates(existingTypeArguments.params);
|
|
18712
|
-
} else {
|
|
18713
|
-
existing = typeArguments;
|
|
18714
18689
|
}
|
|
18715
18690
|
} else {
|
|
18716
18691
|
generics.set(name, node);
|
|
@@ -18770,6 +18745,9 @@ function cloneIfNodeOrArray(obj, deep, withoutLoc, commentsCache) {
|
|
|
18770
18745
|
}
|
|
18771
18746
|
|
|
18772
18747
|
function cloneNode(node, deep = true, withoutLoc = false) {
|
|
18748
|
+
if (!node)
|
|
18749
|
+
return node;
|
|
18750
|
+
|
|
18773
18751
|
return cloneNodeInternal(node, deep, withoutLoc, /* @__PURE__ */new Map());
|
|
18774
18752
|
}
|
|
18775
18753
|
|
|
@@ -19005,7 +18983,7 @@ function toBlock(node, parent) {
|
|
|
19005
18983
|
return node;
|
|
19006
18984
|
}
|
|
19007
18985
|
|
|
19008
|
-
let blockNodes
|
|
18986
|
+
let blockNodes;
|
|
19009
18987
|
|
|
19010
18988
|
if (isEmptyStatement(node)) {
|
|
19011
18989
|
blockNodes = [];
|
|
@@ -20418,8 +20396,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20418
20396
|
regex = new RegExp(pattern, flags);
|
|
20419
20397
|
} catch {}
|
|
20420
20398
|
|
|
20421
|
-
|
|
20422
|
-
const node = this.estreeParseLiteral(regex);
|
|
20399
|
+
const node = this.estreeParseLiteral(regex);
|
|
20423
20400
|
|
|
20424
20401
|
node.regex = {
|
|
20425
20402
|
pattern,
|
|
@@ -20437,8 +20414,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20437
20414
|
bigInt = null;
|
|
20438
20415
|
}
|
|
20439
20416
|
|
|
20440
|
-
|
|
20441
|
-
const node = this.estreeParseLiteral(bigInt);
|
|
20417
|
+
const node = this.estreeParseLiteral(bigInt);
|
|
20442
20418
|
|
|
20443
20419
|
node.bigint = String(node.value || value);
|
|
20444
20420
|
return node;
|
|
@@ -21407,9 +21383,6 @@ var nonASCIIidentifierStartChars2 = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u
|
|
|
21407
21383
|
var nonASCIIidentifierChars2 = '\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65';
|
|
21408
21384
|
var nonASCIIidentifierStart2 = new RegExp('[' + nonASCIIidentifierStartChars2 + ']');
|
|
21409
21385
|
var nonASCIIidentifier2 = new RegExp('[' + nonASCIIidentifierStartChars2 + nonASCIIidentifierChars2 + ']');
|
|
21410
|
-
|
|
21411
|
-
nonASCIIidentifierStartChars2 =
|
|
21412
|
-
nonASCIIidentifierChars2 = null;
|
|
21413
21386
|
var astralIdentifierStartCodes2 = [
|
|
21414
21387
|
0,
|
|
21415
21388
|
11,
|
|
@@ -24013,7 +23986,7 @@ var CommentsParser = class extends BaseParser {
|
|
|
24013
23986
|
};
|
|
24014
23987
|
|
|
24015
23988
|
var State$2 = class _State {
|
|
24016
|
-
flags =
|
|
23989
|
+
flags = 4096;
|
|
24017
23990
|
get strict() {
|
|
24018
23991
|
return (this.flags & 1) > 0;
|
|
24019
23992
|
}
|
|
@@ -24109,32 +24082,61 @@ var State$2 = class _State {
|
|
|
24109
24082
|
this.flags &= -65;
|
|
24110
24083
|
}
|
|
24111
24084
|
|
|
24112
|
-
|
|
24113
|
-
maxNumOfResolvableTopics: 0,
|
|
24114
|
-
maxTopicIndex: null,
|
|
24115
|
-
};
|
|
24116
|
-
get soloAwait() {
|
|
24085
|
+
get inConditionalConsequent() {
|
|
24117
24086
|
return (this.flags & 128) > 0;
|
|
24118
24087
|
}
|
|
24119
24088
|
|
|
24120
|
-
set
|
|
24089
|
+
set inConditionalConsequent(v) {
|
|
24121
24090
|
if (v)
|
|
24122
24091
|
this.flags |= 128;
|
|
24123
24092
|
else
|
|
24124
24093
|
this.flags &= -129;
|
|
24125
24094
|
}
|
|
24126
24095
|
|
|
24127
|
-
get
|
|
24096
|
+
get inHackPipelineBody() {
|
|
24128
24097
|
return (this.flags & 256) > 0;
|
|
24129
24098
|
}
|
|
24130
24099
|
|
|
24131
|
-
set
|
|
24100
|
+
set inHackPipelineBody(v) {
|
|
24132
24101
|
if (v)
|
|
24133
24102
|
this.flags |= 256;
|
|
24134
24103
|
else
|
|
24135
24104
|
this.flags &= -257;
|
|
24136
24105
|
}
|
|
24137
24106
|
|
|
24107
|
+
get seenTopicReference() {
|
|
24108
|
+
return (this.flags & 512) > 0;
|
|
24109
|
+
}
|
|
24110
|
+
|
|
24111
|
+
set seenTopicReference(v) {
|
|
24112
|
+
if (v)
|
|
24113
|
+
this.flags |= 512;
|
|
24114
|
+
else
|
|
24115
|
+
this.flags &= -513;
|
|
24116
|
+
}
|
|
24117
|
+
|
|
24118
|
+
get soloAwait() {
|
|
24119
|
+
return (this.flags & 1024) > 0;
|
|
24120
|
+
}
|
|
24121
|
+
|
|
24122
|
+
set soloAwait(v) {
|
|
24123
|
+
if (v)
|
|
24124
|
+
this.flags |= 1024;
|
|
24125
|
+
else
|
|
24126
|
+
this.flags &= -1025;
|
|
24127
|
+
}
|
|
24128
|
+
|
|
24129
|
+
get inFSharpPipelineDirectBody() {
|
|
24130
|
+
return (this.flags & 2048) > 0;
|
|
24131
|
+
}
|
|
24132
|
+
|
|
24133
|
+
set inFSharpPipelineDirectBody(v) {
|
|
24134
|
+
if (v)
|
|
24135
|
+
this.flags |= 2048;
|
|
24136
|
+
else
|
|
24137
|
+
this.flags &= -2049;
|
|
24138
|
+
}
|
|
24139
|
+
|
|
24138
24140
|
labels = [];
|
|
24139
24141
|
commentsLen = 0;
|
|
24140
24142
|
commentStack = [];
|
|
@@ -24147,37 +24149,37 @@ var State$2 = class _State {
|
|
|
24147
24149
|
lastTokStartLoc = null;
|
|
24148
24150
|
context = [types.brace];
|
|
24149
24151
|
get canStartJSXElement() {
|
|
24150
|
-
return (this.flags &
|
|
24152
|
+
return (this.flags & 4096) > 0;
|
|
24151
24153
|
}
|
|
24152
24154
|
|
|
24153
24155
|
set canStartJSXElement(v) {
|
|
24154
24156
|
if (v)
|
|
24155
|
-
this.flags |=
|
|
24157
|
+
this.flags |= 4096;
|
|
24156
24158
|
else
|
|
24157
|
-
this.flags &= -
|
|
24159
|
+
this.flags &= -4097;
|
|
24158
24160
|
}
|
|
24159
24161
|
|
|
24160
24162
|
get containsEsc() {
|
|
24161
|
-
return (this.flags &
|
|
24163
|
+
return (this.flags & 8192) > 0;
|
|
24162
24164
|
}
|
|
24163
24165
|
|
|
24164
24166
|
set containsEsc(v) {
|
|
24165
24167
|
if (v)
|
|
24166
|
-
this.flags |=
|
|
24168
|
+
this.flags |= 8192;
|
|
24167
24169
|
else
|
|
24168
|
-
this.flags &= -
|
|
24170
|
+
this.flags &= -8193;
|
|
24169
24171
|
}
|
|
24170
24172
|
|
|
24171
24173
|
firstInvalidTemplateEscapePos = null;
|
|
24172
24174
|
get hasTopLevelAwait() {
|
|
24173
|
-
return (this.flags &
|
|
24175
|
+
return (this.flags & 16384) > 0;
|
|
24174
24176
|
}
|
|
24175
24177
|
|
|
24176
24178
|
set hasTopLevelAwait(v) {
|
|
24177
24179
|
if (v)
|
|
24178
|
-
this.flags |=
|
|
24180
|
+
this.flags |= 16384;
|
|
24179
24181
|
else
|
|
24180
|
-
this.flags &= -
|
|
24182
|
+
this.flags &= -16385;
|
|
24181
24183
|
}
|
|
24182
24184
|
|
|
24183
24185
|
strictErrors = /* @__PURE__ */new Map();
|
|
@@ -24199,7 +24201,6 @@ var State$2 = class _State {
|
|
|
24199
24201
|
state.potentialArrowAt = this.potentialArrowAt;
|
|
24200
24202
|
state.noArrowAt = this.noArrowAt.slice();
|
|
24201
24203
|
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
24202
|
-
state.topicContext = this.topicContext;
|
|
24203
24204
|
state.labels = this.labels.slice();
|
|
24204
24205
|
state.commentsLen = this.commentsLen;
|
|
24205
24206
|
state.commentStack = this.commentStack.slice();
|
|
@@ -29580,7 +29581,18 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29580
29581
|
}
|
|
29581
29582
|
}
|
|
29582
29583
|
|
|
29583
|
-
|
|
29584
|
+
this.next();
|
|
29585
|
+
const node = this.startNodeAt(startLoc);
|
|
29586
|
+
|
|
29587
|
+
node.test = expr;
|
|
29588
|
+
const oldInConditionalConsequent = this.state.inConditionalConsequent;
|
|
29589
|
+
|
|
29590
|
+
this.state.inConditionalConsequent = true;
|
|
29591
|
+
node.consequent = this.parseMaybeAssignAllowIn();
|
|
29592
|
+
this.state.inConditionalConsequent = oldInConditionalConsequent;
|
|
29593
|
+
this.expect(10);
|
|
29594
|
+
node.alternate = this.parseMaybeAssign();
|
|
29595
|
+
return this.finishNode(node, 'ConditionalExpression');
|
|
29584
29596
|
}
|
|
29585
29597
|
|
|
29586
29598
|
parseParenItem(node, startLoc) {
|
|
@@ -30165,7 +30177,24 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
30165
30177
|
}
|
|
30166
30178
|
|
|
30167
30179
|
shouldParseAsyncArrow() {
|
|
30168
|
-
|
|
30180
|
+
if (this.match(10)) {
|
|
30181
|
+
if (this.state.inConditionalConsequent)
|
|
30182
|
+
return false;
|
|
30183
|
+
|
|
30184
|
+
return true;
|
|
30185
|
+
}
|
|
30186
|
+
|
|
30187
|
+
return super.shouldParseAsyncArrow();
|
|
30188
|
+
}
|
|
30189
|
+
|
|
30190
|
+
parseParenAndDistinguishExpression(canBeArrow) {
|
|
30191
|
+
const oldInConditionalConsequent = this.state.inConditionalConsequent;
|
|
30192
|
+
|
|
30193
|
+
this.state.inConditionalConsequent = false;
|
|
30194
|
+
const result = super.parseParenAndDistinguishExpression(canBeArrow);
|
|
30195
|
+
|
|
30196
|
+
this.state.inConditionalConsequent = oldInConditionalConsequent;
|
|
30197
|
+
return result;
|
|
30169
30198
|
}
|
|
30170
30199
|
|
|
30171
30200
|
canHaveLeadingDecorator() {
|
|
@@ -32087,8 +32116,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
32087
32116
|
bigInt = null;
|
|
32088
32117
|
}
|
|
32089
32118
|
|
|
32090
|
-
|
|
32091
|
-
const node = this.parseLiteral(bigInt, 'BigIntLiteral');
|
|
32119
|
+
const node = this.parseLiteral(bigInt, 'BigIntLiteral');
|
|
32092
32120
|
|
|
32093
32121
|
return node;
|
|
32094
32122
|
}
|
|
@@ -32386,7 +32414,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
32386
32414
|
}
|
|
32387
32415
|
|
|
32388
32416
|
parsePropertyDefinition(refExpressionErrors) {
|
|
32389
|
-
|
|
32417
|
+
const decorators = [];
|
|
32390
32418
|
|
|
32391
32419
|
if (this.match(22)) {
|
|
32392
32420
|
if (this.hasPlugin('decorators')) {
|
|
@@ -32412,7 +32440,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
32412
32440
|
|
|
32413
32441
|
if (decorators.length) {
|
|
32414
32442
|
prop.decorators = decorators;
|
|
32415
|
-
decorators = [];
|
|
32416
32443
|
}
|
|
32417
32444
|
|
|
32418
32445
|
prop.method = false;
|
|
@@ -32978,16 +33005,17 @@ var ExpressionParser = class extends LValParser {
|
|
|
32978
33005
|
}
|
|
32979
33006
|
|
|
32980
33007
|
withTopicBindingContext(callback) {
|
|
32981
|
-
const
|
|
33008
|
+
const oldInHackPipelineBody = this.state.inHackPipelineBody;
|
|
32982
33009
|
|
|
32983
|
-
this.state.
|
|
32984
|
-
|
|
32985
|
-
|
|
32986
|
-
|
|
33010
|
+
this.state.inHackPipelineBody = true;
|
|
33011
|
+
const oldSeenTopicReference = this.state.seenTopicReference;
|
|
33012
|
+
|
|
33013
|
+
this.state.seenTopicReference = false;
|
|
32987
33014
|
try {
|
|
32988
33015
|
return callback();
|
|
32989
33016
|
} finally {
|
|
32990
|
-
this.state.
|
|
33017
|
+
this.state.inHackPipelineBody = oldInHackPipelineBody;
|
|
33018
|
+
this.state.seenTopicReference = oldSeenTopicReference;
|
|
32991
33019
|
}
|
|
32992
33020
|
}
|
|
32993
33021
|
|
|
@@ -33035,15 +33063,15 @@ var ExpressionParser = class extends LValParser {
|
|
|
33035
33063
|
}
|
|
33036
33064
|
|
|
33037
33065
|
registerTopicReference() {
|
|
33038
|
-
this.state.
|
|
33066
|
+
this.state.seenTopicReference = true;
|
|
33039
33067
|
}
|
|
33040
33068
|
|
|
33041
33069
|
topicReferenceIsAllowedInCurrentContext() {
|
|
33042
|
-
return this.state.
|
|
33070
|
+
return this.state.inHackPipelineBody;
|
|
33043
33071
|
}
|
|
33044
33072
|
|
|
33045
33073
|
topicReferenceWasUsedInCurrentContext() {
|
|
33046
|
-
return this.state.
|
|
33074
|
+
return this.state.seenTopicReference;
|
|
33047
33075
|
}
|
|
33048
33076
|
|
|
33049
33077
|
parseFSharpPipelineBody(prec) {
|
|
@@ -33077,8 +33105,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
33077
33105
|
} finally {
|
|
33078
33106
|
revertScopes();
|
|
33079
33107
|
}
|
|
33080
|
-
|
|
33081
|
-
|
|
33108
|
+
|
|
33082
33109
|
return this.finishNode(node, 'ModuleExpression');
|
|
33083
33110
|
}
|
|
33084
33111
|
|
|
@@ -35402,8 +35429,7 @@ function parse$b(input, options) {
|
|
|
35402
35429
|
return getParser$1(options, input).parse();
|
|
35403
35430
|
} catch {}
|
|
35404
35431
|
|
|
35405
|
-
|
|
35406
|
-
throw moduleError;
|
|
35432
|
+
throw moduleError;
|
|
35407
35433
|
}
|
|
35408
35434
|
} else {
|
|
35409
35435
|
return getParser$1(options, input).parse();
|
|
@@ -44515,7 +44541,7 @@ function verify$1(visitor) {
|
|
|
44515
44541
|
continue;
|
|
44516
44542
|
|
|
44517
44543
|
if (!TYPES2.includes(nodeType)) {
|
|
44518
|
-
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-rc.
|
|
44544
|
+
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-rc.2'}`);
|
|
44519
44545
|
}
|
|
44520
44546
|
|
|
44521
44547
|
const visitors2 = visitor[nodeType];
|
|
@@ -47435,8 +47461,7 @@ function replaceWithSourceString(replacement) {
|
|
|
47435
47461
|
throw err;
|
|
47436
47462
|
}
|
|
47437
47463
|
|
|
47438
|
-
|
|
47439
|
-
const expressionAST = ast.program.body[0].expression;
|
|
47464
|
+
const expressionAST = ast.program.body[0].expression;
|
|
47440
47465
|
traverse3.removeProperties(expressionAST);
|
|
47441
47466
|
return this.replaceWith(expressionAST);
|
|
47442
47467
|
}
|
|
@@ -50463,17 +50488,45 @@ traverse3.hasType = function(tree, type, denylistTypes) {
|
|
|
50463
50488
|
};
|
|
50464
50489
|
traverse3.cache = cache;
|
|
50465
50490
|
|
|
50466
|
-
const
|
|
50467
|
-
|
|
50468
|
-
|
|
50469
|
-
|
|
50470
|
-
|
|
50471
|
-
|
|
50472
|
-
|
|
50473
|
-
|
|
50474
|
-
|
|
50491
|
+
const isString$f = (a) => typeof a === 'string';
|
|
50492
|
+
const constant = (a) => () => a;
|
|
50493
|
+
const {keys: keys$3} = Object;
|
|
50494
|
+
|
|
50495
|
+
const rendy = (template, values, modifiers) => {
|
|
50496
|
+
check$e(template, values);
|
|
50497
|
+
|
|
50498
|
+
let result = template;
|
|
50499
|
+
const names = keys$3(values) ;
|
|
50500
|
+
|
|
50501
|
+
for (const key of names) {
|
|
50502
|
+
const [parsedKey, value] = parseValue$1(key, values);
|
|
50503
|
+
const str = constant(value);
|
|
50504
|
+
|
|
50505
|
+
while (result.includes(parsedKey))
|
|
50506
|
+
result = result.replace(parsedKey, str);
|
|
50507
|
+
}
|
|
50508
|
+
|
|
50509
|
+
if (result.includes('{{'))
|
|
50510
|
+
result = result.replace(/{{.*?}}/g, '');
|
|
50511
|
+
|
|
50512
|
+
return result;
|
|
50475
50513
|
};
|
|
50476
50514
|
|
|
50515
|
+
function check$e(template, values) {
|
|
50516
|
+
if (!isString$f(template))
|
|
50517
|
+
throw Error('template should be a string!');
|
|
50518
|
+
|
|
50519
|
+
if (typeof values !== 'object')
|
|
50520
|
+
throw Error('values should be an object!');
|
|
50521
|
+
}
|
|
50522
|
+
|
|
50523
|
+
function parseValue$1(key, values, modifiers) {
|
|
50524
|
+
return [
|
|
50525
|
+
`{{ ${key} }}`,
|
|
50526
|
+
values[key],
|
|
50527
|
+
];
|
|
50528
|
+
}
|
|
50529
|
+
|
|
50477
50530
|
const {
|
|
50478
50531
|
isStringLiteral: isStringLiteral$a,
|
|
50479
50532
|
isIdentifier: isIdentifier$g,
|
|
@@ -50482,7 +50535,7 @@ const {
|
|
|
50482
50535
|
isForOfStatement: isForOfStatement$1,
|
|
50483
50536
|
isVariableDeclaration: isVariableDeclaration$4,
|
|
50484
50537
|
isMemberExpression: isMemberExpression$8,
|
|
50485
|
-
isArrayExpression: isArrayExpression$
|
|
50538
|
+
isArrayExpression: isArrayExpression$a,
|
|
50486
50539
|
isObjectExpression: isObjectExpression$c,
|
|
50487
50540
|
isLabeledStatement: isLabeledStatement$1,
|
|
50488
50541
|
isTryStatement,
|
|
@@ -50590,7 +50643,7 @@ const isStringAndArray = ([a, b]) => {
|
|
|
50590
50643
|
if (!isStringLiteral$a(a))
|
|
50591
50644
|
return false;
|
|
50592
50645
|
|
|
50593
|
-
if (!isArrayExpression$
|
|
50646
|
+
if (!isArrayExpression$a(b))
|
|
50594
50647
|
return false;
|
|
50595
50648
|
|
|
50596
50649
|
return !isStringAndIdentifier(b.node.elements);
|
|
@@ -50652,39 +50705,214 @@ const hasLeadingComment = (path) => path.node?.leadingComments?.length;
|
|
|
50652
50705
|
const noTrailingComment = (path) => !path.node.trailingComments?.length;
|
|
50653
50706
|
const noLeadingComment = (path) => !path.node.leadingComments?.length;
|
|
50654
50707
|
|
|
50708
|
+
var maybeSatisfy = (plugin) => {
|
|
50709
|
+
if (!plugin.afterSatisfy && !plugin.beforeSatisfy && !plugin.satisfy)
|
|
50710
|
+
return plugin;
|
|
50711
|
+
|
|
50712
|
+
const {
|
|
50713
|
+
satisfy,
|
|
50714
|
+
afterSatisfy = satisfy,
|
|
50715
|
+
beforeSatisfy = satisfy,
|
|
50716
|
+
} = plugin;
|
|
50717
|
+
|
|
50718
|
+
return {
|
|
50719
|
+
afterIf: createIf(afterSatisfy),
|
|
50720
|
+
beforeIf: createIf(beforeSatisfy),
|
|
50721
|
+
...plugin,
|
|
50722
|
+
};
|
|
50723
|
+
};
|
|
50724
|
+
|
|
50725
|
+
const createIf = (getConditions) => {
|
|
50726
|
+
const conditions = getConditions?.() || [];
|
|
50727
|
+
return satisfy(conditions);
|
|
50728
|
+
};
|
|
50729
|
+
|
|
50730
|
+
const {
|
|
50731
|
+
isProgram: isProgram$4,
|
|
50732
|
+
isFile: isFile$1,
|
|
50733
|
+
isStatement: isStatement$5,
|
|
50734
|
+
expressionStatement: expressionStatement$3,
|
|
50735
|
+
program,
|
|
50736
|
+
file,
|
|
50737
|
+
} = lib_exports;
|
|
50738
|
+
|
|
50655
50739
|
const isFn$7 = (a) => typeof a === 'function';
|
|
50656
50740
|
|
|
50657
|
-
const
|
|
50741
|
+
const maybeThrow = (a, path, b) => {
|
|
50742
|
+
if (!a)
|
|
50743
|
+
return;
|
|
50744
|
+
|
|
50745
|
+
throw Error(rendy(b, {
|
|
50746
|
+
path,
|
|
50747
|
+
type: path.type,
|
|
50748
|
+
}));
|
|
50749
|
+
};
|
|
50658
50750
|
|
|
50659
|
-
const
|
|
50660
|
-
|
|
50661
|
-
|
|
50751
|
+
const maybeStatement = (ast) => isStatement$5(ast) ? ast : expressionStatement$3(ast);
|
|
50752
|
+
|
|
50753
|
+
const maybeProgram = (ast) => isProgram$4(ast) ? ast : program([
|
|
50754
|
+
maybeStatement(ast),
|
|
50755
|
+
]);
|
|
50756
|
+
|
|
50757
|
+
const maybeFile = (ast) => isFile$1(ast) ? ast : file(maybeProgram(ast));
|
|
50758
|
+
|
|
50759
|
+
const maybeVisitor = (plugin, path, printer, options) => {
|
|
50760
|
+
if (isFn$7(plugin))
|
|
50761
|
+
return plugin(path, printer, options);
|
|
50662
50762
|
|
|
50663
|
-
return
|
|
50763
|
+
return objectPlugin(plugin, path, printer, options);
|
|
50664
50764
|
};
|
|
50665
50765
|
|
|
50666
|
-
|
|
50667
|
-
|
|
50668
|
-
|
|
50669
|
-
|
|
50670
|
-
|
|
50671
|
-
|
|
50672
|
-
|
|
50673
|
-
|
|
50674
|
-
|
|
50675
|
-
});
|
|
50766
|
+
function objectPlugin(plugin, path, printer, semantics) {
|
|
50767
|
+
const {
|
|
50768
|
+
print,
|
|
50769
|
+
split,
|
|
50770
|
+
condition,
|
|
50771
|
+
before = split,
|
|
50772
|
+
beforeIf = condition,
|
|
50773
|
+
after = split,
|
|
50774
|
+
afterIf = condition,
|
|
50775
|
+
} = maybeSatisfy(plugin);
|
|
50776
|
+
|
|
50777
|
+
if (beforeIf?.(path, printer, semantics))
|
|
50778
|
+
before(path, printer, semantics);
|
|
50779
|
+
|
|
50780
|
+
print(path, printer, semantics);
|
|
50781
|
+
|
|
50782
|
+
if (afterIf?.(path, printer, semantics))
|
|
50783
|
+
after(path, printer, semantics);
|
|
50784
|
+
}
|
|
50676
50785
|
|
|
50677
|
-
|
|
50678
|
-
|
|
50679
|
-
|
|
50680
|
-
|
|
50786
|
+
function fullstore(value) {
|
|
50787
|
+
const data = {
|
|
50788
|
+
value,
|
|
50789
|
+
};
|
|
50790
|
+
|
|
50791
|
+
return (...args) => {
|
|
50792
|
+
const [value] = args;
|
|
50681
50793
|
|
|
50682
|
-
if (!
|
|
50683
|
-
return
|
|
50794
|
+
if (!args.length)
|
|
50795
|
+
return data.value;
|
|
50684
50796
|
|
|
50685
|
-
|
|
50686
|
-
|
|
50687
|
-
|
|
50797
|
+
data.value = value;
|
|
50798
|
+
|
|
50799
|
+
return value;
|
|
50800
|
+
};
|
|
50801
|
+
}
|
|
50802
|
+
|
|
50803
|
+
const TYPES$3 = {
|
|
50804
|
+
TOKEN: 'Token',
|
|
50805
|
+
NEWLINE: 'Newline',
|
|
50806
|
+
SPLITTER: 'Splitter',
|
|
50807
|
+
INDENT: 'Indent',
|
|
50808
|
+
DEBUG: 'Debug',
|
|
50809
|
+
SPACE: 'Space',
|
|
50810
|
+
QUOTE: 'Quote',
|
|
50811
|
+
END_OF_FILE: 'EndOfFile',
|
|
50812
|
+
};
|
|
50813
|
+
|
|
50814
|
+
var stringSnakeCase = snakeCase;
|
|
50815
|
+
|
|
50816
|
+
/*
|
|
50817
|
+
snakeCase('the quick brown fox'); // 'the_quick_brown_fox'
|
|
50818
|
+
snakeCase('the-quick-brown-fox'); // 'the_quick_brown_fox'
|
|
50819
|
+
snakeCase('the_quick_brown_fox'); // 'the_quick_brown_fox'
|
|
50820
|
+
snakeCase('theQuickBrownFox'); // 'the_quick_brown_fox'
|
|
50821
|
+
snakeCase('theQuickBrown Fox'); // 'the_quick_brown_Fox'
|
|
50822
|
+
snakeCase('thequickbrownfox'); // 'thequickbrownfox'
|
|
50823
|
+
snakeCase('the - quick * brown# fox'); // 'the_quick_brown_fox'
|
|
50824
|
+
snakeCase('theQUICKBrownFox'); // 'the_q_u_i_c_k_brown_fox'
|
|
50825
|
+
*/
|
|
50826
|
+
|
|
50827
|
+
// any combination of spaces and punctuation characters
|
|
50828
|
+
// thanks to http://stackoverflow.com/a/25575009
|
|
50829
|
+
var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
|
|
50830
|
+
var capitals = /[A-Z\u00C0-\u00D6\u00D9-\u00DD]/g;
|
|
50831
|
+
|
|
50832
|
+
function snakeCase(str) {
|
|
50833
|
+
//replace capitals with space + lower case equivalent for later parsing
|
|
50834
|
+
str = str.replace(capitals, function(match) {
|
|
50835
|
+
return ' ' + (match.toLowerCase() || match);
|
|
50836
|
+
});
|
|
50837
|
+
return str
|
|
50838
|
+
.trim()
|
|
50839
|
+
.split(wordSeparators)
|
|
50840
|
+
.join('_');
|
|
50841
|
+
}
|
|
50842
|
+
|
|
50843
|
+
const {stringify: stringify$7} = JSON;
|
|
50844
|
+
const {
|
|
50845
|
+
LOG,
|
|
50846
|
+
LOG_ALL,
|
|
50847
|
+
LOG_TOKENS,
|
|
50848
|
+
LOG_TERM,
|
|
50849
|
+
LOG_DEBUG,
|
|
50850
|
+
} = {};
|
|
50851
|
+
|
|
50852
|
+
const createDebug$4 = (tokens) => (a) => {
|
|
50853
|
+
if (!LOG_DEBUG)
|
|
50854
|
+
return;
|
|
50855
|
+
|
|
50856
|
+
tokens.push({
|
|
50857
|
+
type: TYPES$3.DEBUG,
|
|
50858
|
+
value: `/*__${stringSnakeCase(a)}*/`,
|
|
50859
|
+
});
|
|
50860
|
+
};
|
|
50861
|
+
|
|
50862
|
+
const createLog = ({newline = '\n', store = createStore$1()} = {}) => ({type, value}) => {
|
|
50863
|
+
if (LOG_TOKENS) {
|
|
50864
|
+
console.log(codeFrameColumns(stringify$7({
|
|
50865
|
+
type,
|
|
50866
|
+
value,
|
|
50867
|
+
}), {}, {
|
|
50868
|
+
highlightCode: true,
|
|
50869
|
+
}));
|
|
50870
|
+
|
|
50871
|
+
return;
|
|
50872
|
+
}
|
|
50873
|
+
|
|
50874
|
+
if (LOG_ALL) {
|
|
50875
|
+
console.log(codeFrameColumns(value, {}, {
|
|
50876
|
+
highlightCode: true,
|
|
50877
|
+
}));
|
|
50878
|
+
|
|
50879
|
+
return;
|
|
50880
|
+
}
|
|
50881
|
+
|
|
50882
|
+
if (LOG) {
|
|
50883
|
+
if (value === newline) {
|
|
50884
|
+
console.log(codeFrameColumns(store(), {}, {
|
|
50885
|
+
highlightCode: true,
|
|
50886
|
+
}));
|
|
50887
|
+
|
|
50888
|
+
return;
|
|
50889
|
+
}
|
|
50890
|
+
|
|
50891
|
+
store(value);
|
|
50892
|
+
}
|
|
50893
|
+
|
|
50894
|
+
if (LOG_TERM)
|
|
50895
|
+
browser$1.stdout.write(value);
|
|
50896
|
+
};
|
|
50897
|
+
|
|
50898
|
+
function createStore$1() {
|
|
50899
|
+
let chunks = [];
|
|
50900
|
+
|
|
50901
|
+
return (...args) => {
|
|
50902
|
+
const [chunk] = args;
|
|
50903
|
+
|
|
50904
|
+
if (args.length) {
|
|
50905
|
+
chunks.push(chunk);
|
|
50906
|
+
return;
|
|
50907
|
+
}
|
|
50908
|
+
|
|
50909
|
+
const result = chunks.join('');
|
|
50910
|
+
|
|
50911
|
+
chunks = [];
|
|
50912
|
+
|
|
50913
|
+
return result;
|
|
50914
|
+
};
|
|
50915
|
+
}
|
|
50688
50916
|
|
|
50689
50917
|
const WATER_MARK_BEFORE = '__putout_newline_before';
|
|
50690
50918
|
const WATER_MARK_AFTER = '__putout_newline_after';
|
|
@@ -50707,6 +50935,40 @@ const hasPrevNewline = (path) => {
|
|
|
50707
50935
|
return isMarkedAfter(path.getPrevSibling());
|
|
50708
50936
|
};
|
|
50709
50937
|
|
|
50938
|
+
const isFn$6 = (a) => typeof a === 'function';
|
|
50939
|
+
|
|
50940
|
+
const isParens$2 = (path) => path.node.extra?.parenthesized;
|
|
50941
|
+
|
|
50942
|
+
const maybeParens = (print) => {
|
|
50943
|
+
if (isFn$6(print))
|
|
50944
|
+
return maybeParensPrint(print);
|
|
50945
|
+
|
|
50946
|
+
return maybeParensCondition(print);
|
|
50947
|
+
};
|
|
50948
|
+
|
|
50949
|
+
const maybeParensPrint = (print) => ({
|
|
50950
|
+
condition: isParens$2,
|
|
50951
|
+
before(path, {write}) {
|
|
50952
|
+
write('(');
|
|
50953
|
+
},
|
|
50954
|
+
print,
|
|
50955
|
+
after(path, {write}) {
|
|
50956
|
+
write(')');
|
|
50957
|
+
},
|
|
50958
|
+
});
|
|
50959
|
+
|
|
50960
|
+
const maybeParensCondition = ({print, condition, checkParens = true}) => ({
|
|
50961
|
+
...maybeParensPrint(print),
|
|
50962
|
+
condition: (path, print, semantics) => {
|
|
50963
|
+
const is = condition?.(path, print, semantics);
|
|
50964
|
+
|
|
50965
|
+
if (!checkParens)
|
|
50966
|
+
return is;
|
|
50967
|
+
|
|
50968
|
+
return is || isParens$2(path);
|
|
50969
|
+
},
|
|
50970
|
+
});
|
|
50971
|
+
|
|
50710
50972
|
const maybeInsideFn = (insideFn, {print, indent}) => {
|
|
50711
50973
|
if (!insideFn)
|
|
50712
50974
|
return;
|
|
@@ -50981,7 +51243,7 @@ const parseLeadingComments = (path, printer, semantics, {currentTraverse = {}} =
|
|
|
50981
51243
|
}
|
|
50982
51244
|
};
|
|
50983
51245
|
|
|
50984
|
-
const {assign: assign$
|
|
51246
|
+
const {assign: assign$c} = Object;
|
|
50985
51247
|
|
|
50986
51248
|
const chain$1 = (path) => {
|
|
50987
51249
|
const all = [
|
|
@@ -51051,7 +51313,7 @@ function build(path) {
|
|
|
51051
51313
|
};
|
|
51052
51314
|
|
|
51053
51315
|
if (path.isCallExpression())
|
|
51054
|
-
assign$
|
|
51316
|
+
assign$c(prop, {
|
|
51055
51317
|
args: path.node.arguments.length,
|
|
51056
51318
|
name: path.node.callee.property?.name || '',
|
|
51057
51319
|
});
|
|
@@ -51306,6 +51568,8 @@ function isPrevCall(path) {
|
|
|
51306
51568
|
return !isCallExpression$8(expression.arguments[0]);
|
|
51307
51569
|
}
|
|
51308
51570
|
|
|
51571
|
+
const isEmptyBody$1 = ({node}) => !node.body.length;
|
|
51572
|
+
|
|
51309
51573
|
const parseComments = (path, {write, maybe}, semantics) => {
|
|
51310
51574
|
if (!semantics.comments)
|
|
51311
51575
|
return;
|
|
@@ -51324,7 +51588,7 @@ const parseComments = (path, {write, maybe}, semantics) => {
|
|
|
51324
51588
|
write('//');
|
|
51325
51589
|
write(value);
|
|
51326
51590
|
|
|
51327
|
-
if (program) {
|
|
51591
|
+
if (program && isEmptyBody$1(path)) {
|
|
51328
51592
|
maybe.write.newline(i < n);
|
|
51329
51593
|
continue;
|
|
51330
51594
|
}
|
|
@@ -52020,12 +52284,12 @@ const ClassDeclaration = {
|
|
|
52020
52284
|
},
|
|
52021
52285
|
};
|
|
52022
52286
|
|
|
52023
|
-
const {isArray: isArray$
|
|
52287
|
+
const {isArray: isArray$f} = Array;
|
|
52024
52288
|
|
|
52025
52289
|
const parseArgs = (path) => {
|
|
52026
52290
|
const argsPath = path.get('arguments');
|
|
52027
52291
|
|
|
52028
|
-
if (!isArray$
|
|
52292
|
+
if (!isArray$f(argsPath))
|
|
52029
52293
|
return [];
|
|
52030
52294
|
|
|
52031
52295
|
return argsPath;
|
|
@@ -52168,7 +52432,7 @@ function maybePrintBrace(brace, path, printer, semantics) {
|
|
|
52168
52432
|
maybe.print(roundBraces.new, brace);
|
|
52169
52433
|
}
|
|
52170
52434
|
|
|
52171
|
-
const {isArrayExpression: isArrayExpression$
|
|
52435
|
+
const {isArrayExpression: isArrayExpression$9} = lib_exports;
|
|
52172
52436
|
|
|
52173
52437
|
const TYPES$2 = [
|
|
52174
52438
|
'NullLiteral',
|
|
@@ -52179,7 +52443,7 @@ const TYPES$2 = [
|
|
|
52179
52443
|
const isInsideTuple = (path) => {
|
|
52180
52444
|
const {parentPath} = path;
|
|
52181
52445
|
|
|
52182
|
-
if (!isArrayExpression$
|
|
52446
|
+
if (!isArrayExpression$9(parentPath))
|
|
52183
52447
|
return false;
|
|
52184
52448
|
|
|
52185
52449
|
const [first, second] = parentPath.node.elements;
|
|
@@ -52191,13 +52455,13 @@ const isInsideTuple = (path) => {
|
|
|
52191
52455
|
};
|
|
52192
52456
|
|
|
52193
52457
|
const {
|
|
52194
|
-
isArrayExpression: isArrayExpression$
|
|
52458
|
+
isArrayExpression: isArrayExpression$8,
|
|
52195
52459
|
isCallExpression: isCallExpression$7,
|
|
52196
52460
|
isIdentifier: isIdentifier$e,
|
|
52197
52461
|
} = lib_exports;
|
|
52198
52462
|
|
|
52199
52463
|
const isThirdObjectInsideArray = ({parentPath}) => {
|
|
52200
|
-
if (!isArrayExpression$
|
|
52464
|
+
if (!isArrayExpression$8(parentPath))
|
|
52201
52465
|
return false;
|
|
52202
52466
|
|
|
52203
52467
|
const [, second] = parentPath.node.elements;
|
|
@@ -52207,7 +52471,7 @@ const isThirdObjectInsideArray = ({parentPath}) => {
|
|
|
52207
52471
|
|
|
52208
52472
|
const {
|
|
52209
52473
|
isStringLiteral: isStringLiteral$9,
|
|
52210
|
-
isArrayExpression: isArrayExpression$
|
|
52474
|
+
isArrayExpression: isArrayExpression$7,
|
|
52211
52475
|
isSpreadElement: isSpreadElement$2,
|
|
52212
52476
|
} = lib_exports;
|
|
52213
52477
|
|
|
@@ -52231,10 +52495,10 @@ const isMemberExpressionCallee = ({parentPath}) => {
|
|
|
52231
52495
|
const isInsideCall = ({parentPath}) => parentPath.isCallExpression();
|
|
52232
52496
|
|
|
52233
52497
|
function isInsideNestedArrayCall({parentPath}) {
|
|
52234
|
-
if (!isArrayExpression$
|
|
52498
|
+
if (!isArrayExpression$7(parentPath))
|
|
52235
52499
|
return false;
|
|
52236
52500
|
|
|
52237
|
-
if (!isArrayExpression$
|
|
52501
|
+
if (!isArrayExpression$7(parentPath.parentPath))
|
|
52238
52502
|
return false;
|
|
52239
52503
|
|
|
52240
52504
|
return isInsideCall(parentPath.parentPath);
|
|
@@ -52497,7 +52761,7 @@ function maybePrintTypeAnnotation(path, printer) {
|
|
|
52497
52761
|
|
|
52498
52762
|
const {
|
|
52499
52763
|
isAssignmentPattern: isAssignmentPattern$4,
|
|
52500
|
-
isArrayExpression: isArrayExpression$
|
|
52764
|
+
isArrayExpression: isArrayExpression$6,
|
|
52501
52765
|
isObjectExpression: isObjectExpression$a,
|
|
52502
52766
|
isIdentifier: isIdentifier$d,
|
|
52503
52767
|
} = lib_exports;
|
|
@@ -52506,7 +52770,7 @@ const calculateAssigns = (property, semantics) => {
|
|
|
52506
52770
|
const currentAssign = isLongAssignPattern(property, semantics);
|
|
52507
52771
|
|
|
52508
52772
|
const {right} = property.node.value;
|
|
52509
|
-
const isArrayOrObjectRight = isArrayExpression$
|
|
52773
|
+
const isArrayOrObjectRight = isArrayExpression$6(right) || isComplexObject(right);
|
|
52510
52774
|
const complexAssign = currentAssign && isArrayOrObjectRight;
|
|
52511
52775
|
|
|
52512
52776
|
return {
|
|
@@ -53139,7 +53403,7 @@ const isSimple = (a) => {
|
|
|
53139
53403
|
};
|
|
53140
53404
|
|
|
53141
53405
|
const {
|
|
53142
|
-
isArrayExpression: isArrayExpression$
|
|
53406
|
+
isArrayExpression: isArrayExpression$5,
|
|
53143
53407
|
isLiteral: isLiteral$2,
|
|
53144
53408
|
isIdentifier: isIdentifier$8,
|
|
53145
53409
|
isMemberExpression: isMemberExpression$2,
|
|
@@ -53179,7 +53443,7 @@ function extract(node) {
|
|
|
53179
53443
|
if (isMemberExpression$2(node))
|
|
53180
53444
|
return `${extract(node.object)}.${extract(node.property)}`;
|
|
53181
53445
|
|
|
53182
|
-
if (isArrayExpression$
|
|
53446
|
+
if (isArrayExpression$5(node))
|
|
53183
53447
|
return extractArrayExpression(node);
|
|
53184
53448
|
|
|
53185
53449
|
if (isJSXText$3(node))
|
|
@@ -53220,7 +53484,7 @@ function extract(node) {
|
|
|
53220
53484
|
|
|
53221
53485
|
function extractArrayExpression(node, collector = []) {
|
|
53222
53486
|
for (const el of node.elements) {
|
|
53223
|
-
if (isArrayExpression$
|
|
53487
|
+
if (isArrayExpression$5(el)) {
|
|
53224
53488
|
extractArrayExpression(el, collector);
|
|
53225
53489
|
continue;
|
|
53226
53490
|
}
|
|
@@ -53706,22 +53970,22 @@ function maybeEncode(a) {
|
|
|
53706
53970
|
}
|
|
53707
53971
|
|
|
53708
53972
|
const {
|
|
53709
|
-
isStatement: isStatement$
|
|
53973
|
+
isStatement: isStatement$4,
|
|
53710
53974
|
isBlockStatement: isBlockStatement$5,
|
|
53711
53975
|
blockStatement,
|
|
53712
|
-
expressionStatement: expressionStatement$
|
|
53976
|
+
expressionStatement: expressionStatement$2,
|
|
53713
53977
|
} = lib_exports;
|
|
53714
53978
|
|
|
53715
53979
|
const maybeBody = (path, node) => {
|
|
53716
53980
|
const {parentPath} = path;
|
|
53717
53981
|
|
|
53718
|
-
if (node && !isStatement$
|
|
53982
|
+
if (node && !isStatement$4(node) || isBlockStatement$5(node) || !parentPath?.isArrowFunctionExpression?.())
|
|
53719
53983
|
return {
|
|
53720
53984
|
currentPath: path,
|
|
53721
53985
|
};
|
|
53722
53986
|
|
|
53723
53987
|
parentPath.node.body = blockStatement([
|
|
53724
|
-
expressionStatement$
|
|
53988
|
+
expressionStatement$2(path.node),
|
|
53725
53989
|
]);
|
|
53726
53990
|
|
|
53727
53991
|
return {
|
|
@@ -53732,7 +53996,7 @@ const maybeBody = (path, node) => {
|
|
|
53732
53996
|
const {
|
|
53733
53997
|
isExpression: isExpression$1,
|
|
53734
53998
|
toStatement,
|
|
53735
|
-
expressionStatement: expressionStatement$
|
|
53999
|
+
expressionStatement: expressionStatement$1,
|
|
53736
54000
|
} = lib_exports;
|
|
53737
54001
|
|
|
53738
54002
|
const toExpression = (el) => {
|
|
@@ -53746,7 +54010,7 @@ const toExpression = (el) => {
|
|
|
53746
54010
|
return el;
|
|
53747
54011
|
|
|
53748
54012
|
if (isExpression$1(el))
|
|
53749
|
-
return expressionStatement$
|
|
54013
|
+
return expressionStatement$1(el);
|
|
53750
54014
|
|
|
53751
54015
|
return toStatement(el);
|
|
53752
54016
|
};
|
|
@@ -53798,7 +54062,7 @@ function removeDuplicateLeadingComments(nodes) {
|
|
|
53798
54062
|
}
|
|
53799
54063
|
}
|
|
53800
54064
|
|
|
53801
|
-
const {assign: assign$
|
|
54065
|
+
const {assign: assign$b} = Object;
|
|
53802
54066
|
|
|
53803
54067
|
const parseNode$2 = (a) => {
|
|
53804
54068
|
a = extractMark(a);
|
|
@@ -53822,7 +54086,7 @@ const replaceWith = (path, node) => {
|
|
|
53822
54086
|
|
|
53823
54087
|
currentPath.replaceWith(node);
|
|
53824
54088
|
|
|
53825
|
-
assign$
|
|
54089
|
+
assign$b(currentPath.node, {
|
|
53826
54090
|
comments,
|
|
53827
54091
|
loc,
|
|
53828
54092
|
});
|
|
@@ -53845,8 +54109,8 @@ const {
|
|
|
53845
54109
|
matchesPattern,
|
|
53846
54110
|
isImportDeclaration: isImportDeclaration$1,
|
|
53847
54111
|
isExportDeclaration: isExportDeclaration$4,
|
|
53848
|
-
isStatement: isStatement$
|
|
53849
|
-
expressionStatement
|
|
54112
|
+
isStatement: isStatement$3,
|
|
54113
|
+
expressionStatement,
|
|
53850
54114
|
} = lib_exports;
|
|
53851
54115
|
|
|
53852
54116
|
const insertBefore = (path, node) => {
|
|
@@ -53862,8 +54126,8 @@ const insertAfter = (path, node) => {
|
|
|
53862
54126
|
if (node.trailingComments)
|
|
53863
54127
|
delete node.trailingComments;
|
|
53864
54128
|
|
|
53865
|
-
if (isStatement$
|
|
53866
|
-
path.insertAfter(expressionStatement
|
|
54129
|
+
if (isStatement$3(path) && !isStatement$3(node))
|
|
54130
|
+
path.insertAfter(expressionStatement(node));
|
|
53867
54131
|
else
|
|
53868
54132
|
path.insertAfter(node);
|
|
53869
54133
|
|
|
@@ -53912,7 +54176,7 @@ const isESM = (path) => {
|
|
|
53912
54176
|
|
|
53913
54177
|
const {
|
|
53914
54178
|
isObjectExpression: isObjectExpression$4,
|
|
53915
|
-
isArrayExpression: isArrayExpression$
|
|
54179
|
+
isArrayExpression: isArrayExpression$4,
|
|
53916
54180
|
isObjectProperty: isObjectProperty$1,
|
|
53917
54181
|
isCallExpression: isCallExpression$5,
|
|
53918
54182
|
isAwaitExpression,
|
|
@@ -53923,7 +54187,7 @@ const {
|
|
|
53923
54187
|
isIdentifier: isIdentifier$7,
|
|
53924
54188
|
} = lib_exports;
|
|
53925
54189
|
|
|
53926
|
-
const {round
|
|
54190
|
+
const {round} = Math;
|
|
53927
54191
|
|
|
53928
54192
|
const isOneSpread = (elements) => {
|
|
53929
54193
|
if (elements.length > 1)
|
|
@@ -54035,7 +54299,7 @@ const isMultiLine = (path, {elements, maxElementsInOneLine, maxElementLengthInOn
|
|
|
54035
54299
|
if (isSimpleAndObject(elements))
|
|
54036
54300
|
return ONE_LINE;
|
|
54037
54301
|
|
|
54038
|
-
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression$
|
|
54302
|
+
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression$4(path.parentPath.node.elements[0]))
|
|
54039
54303
|
return ONE_LINE;
|
|
54040
54304
|
|
|
54041
54305
|
if (isSiblingIsArray(path))
|
|
@@ -54121,7 +54385,7 @@ function isTwoStringsDifferentLength(strings) {
|
|
|
54121
54385
|
const aLength = a.node.value.length;
|
|
54122
54386
|
const bLength = b.node.value.length;
|
|
54123
54387
|
|
|
54124
|
-
return round
|
|
54388
|
+
return round(bLength / aLength) > 2;
|
|
54125
54389
|
}
|
|
54126
54390
|
|
|
54127
54391
|
function isInsideLoop(path) {
|
|
@@ -54211,7 +54475,7 @@ const isCurrentNewLine = (path) => {
|
|
|
54211
54475
|
|
|
54212
54476
|
const {
|
|
54213
54477
|
isStringLiteral: isStringLiteral$5,
|
|
54214
|
-
isArrayExpression: isArrayExpression$
|
|
54478
|
+
isArrayExpression: isArrayExpression$3,
|
|
54215
54479
|
isObjectExpression: isObjectExpression$3,
|
|
54216
54480
|
isTemplateLiteral: isTemplateLiteral$2,
|
|
54217
54481
|
} = lib_exports;
|
|
@@ -54250,8 +54514,8 @@ function isArrayInsideArray(path) {
|
|
|
54250
54514
|
return false;
|
|
54251
54515
|
|
|
54252
54516
|
const parentElements = path.parentPath.node.elements;
|
|
54253
|
-
const parentHasArrays = parentElements.filter(isArrayExpression$
|
|
54254
|
-
const lastNotArray = !isArrayExpression$
|
|
54517
|
+
const parentHasArrays = parentElements.filter(isArrayExpression$3).length;
|
|
54518
|
+
const lastNotArray = !isArrayExpression$3(parentElements.at(-1));
|
|
54255
54519
|
|
|
54256
54520
|
if (parentHasArrays && lastNotArray)
|
|
54257
54521
|
return false;
|
|
@@ -55847,7 +56111,7 @@ const {
|
|
|
55847
56111
|
isExportDeclaration: isExportDeclaration$2,
|
|
55848
56112
|
isDoWhileStatement,
|
|
55849
56113
|
isBlockStatement: isBlockStatement$4,
|
|
55850
|
-
isArrayExpression: isArrayExpression$
|
|
56114
|
+
isArrayExpression: isArrayExpression$2,
|
|
55851
56115
|
} = lib_exports;
|
|
55852
56116
|
|
|
55853
56117
|
const isFirstStatement = (path) => path.node.body[0];
|
|
@@ -55857,7 +56121,7 @@ const isMethodOrArrow = (path) => isArrowFunctionExpression(path) || isObjectMet
|
|
|
55857
56121
|
const isInsideArrayTupleOfThree = (path) => {
|
|
55858
56122
|
const {parentPath} = path.parentPath;
|
|
55859
56123
|
|
|
55860
|
-
if (!isArrayExpression$
|
|
56124
|
+
if (!isArrayExpression$2(parentPath))
|
|
55861
56125
|
return false;
|
|
55862
56126
|
|
|
55863
56127
|
const {length} = parentPath.node.elements;
|
|
@@ -56077,7 +56341,7 @@ const ForOfStatement = {
|
|
|
56077
56341
|
const {
|
|
56078
56342
|
isBlockStatement: isBlockStatement$3,
|
|
56079
56343
|
isFunctionDeclaration,
|
|
56080
|
-
isStatement: isStatement$
|
|
56344
|
+
isStatement: isStatement$2,
|
|
56081
56345
|
isExpressionStatement: isExpressionStatement$4,
|
|
56082
56346
|
isReturnStatement,
|
|
56083
56347
|
isContinueStatement,
|
|
@@ -56189,7 +56453,7 @@ const IfStatement = {
|
|
|
56189
56453
|
|
|
56190
56454
|
const nextPath = path.parentPath.getNextSibling();
|
|
56191
56455
|
|
|
56192
|
-
if (path === partOfAlternate && !isTopLevel(path) && !isStatement$
|
|
56456
|
+
if (path === partOfAlternate && !isTopLevel(path) && !isStatement$2(nextPath))
|
|
56193
56457
|
print.newline();
|
|
56194
56458
|
|
|
56195
56459
|
if (isLastEmptyInsideBody(path))
|
|
@@ -56447,7 +56711,7 @@ const isInsideAssignNextAssignFunction = (path) => {
|
|
|
56447
56711
|
|
|
56448
56712
|
const {
|
|
56449
56713
|
isBlockStatement: isBlockStatement$2,
|
|
56450
|
-
isProgram: isProgram$
|
|
56714
|
+
isProgram: isProgram$3,
|
|
56451
56715
|
isIfStatement,
|
|
56452
56716
|
} = lib_exports;
|
|
56453
56717
|
|
|
@@ -56476,7 +56740,7 @@ const printLeadingCommentBlock$1 = (path, printer, semantics, {printComment}) =>
|
|
|
56476
56740
|
if (hasTrailingComment(prev))
|
|
56477
56741
|
return;
|
|
56478
56742
|
|
|
56479
|
-
if (isBlockStatement$2(path.parentPath) && !isProgram$
|
|
56743
|
+
if (isBlockStatement$2(path.parentPath) && !isProgram$3(path.parentPath.parentPath))
|
|
56480
56744
|
indent();
|
|
56481
56745
|
|
|
56482
56746
|
printComment();
|
|
@@ -57047,9 +57311,13 @@ const TSDeclareFunction = {
|
|
|
57047
57311
|
|
|
57048
57312
|
printParams(path, printer, semantics);
|
|
57049
57313
|
|
|
57050
|
-
|
|
57051
|
-
|
|
57052
|
-
|
|
57314
|
+
const {returnType} = path.node;
|
|
57315
|
+
|
|
57316
|
+
if (returnType) {
|
|
57317
|
+
print(':');
|
|
57318
|
+
print.space();
|
|
57319
|
+
print('__returnType');
|
|
57320
|
+
}
|
|
57053
57321
|
}),
|
|
57054
57322
|
afterIf: (path) => !isInsideDefaultExport(path),
|
|
57055
57323
|
after: (path, {print}) => {
|
|
@@ -58075,413 +58343,170 @@ const JSXClosingElement = (path, {print}) => {
|
|
|
58075
58343
|
};
|
|
58076
58344
|
|
|
58077
58345
|
var baseVisitors = /*#__PURE__*/Object.freeze({
|
|
58078
|
-
|
|
58079
|
-
|
|
58080
|
-
|
|
58081
|
-
|
|
58082
|
-
|
|
58083
|
-
|
|
58084
|
-
|
|
58085
|
-
|
|
58086
|
-
|
|
58087
|
-
|
|
58088
|
-
|
|
58089
|
-
|
|
58090
|
-
|
|
58091
|
-
|
|
58092
|
-
|
|
58093
|
-
|
|
58094
|
-
|
|
58095
|
-
|
|
58096
|
-
|
|
58097
|
-
|
|
58098
|
-
|
|
58099
|
-
|
|
58100
|
-
|
|
58101
|
-
|
|
58102
|
-
|
|
58103
|
-
|
|
58104
|
-
|
|
58105
|
-
|
|
58106
|
-
|
|
58107
|
-
|
|
58108
|
-
|
|
58109
|
-
|
|
58110
|
-
|
|
58111
|
-
|
|
58112
|
-
|
|
58113
|
-
|
|
58114
|
-
|
|
58115
|
-
|
|
58116
|
-
|
|
58117
|
-
|
|
58118
|
-
|
|
58119
|
-
|
|
58120
|
-
|
|
58121
|
-
|
|
58122
|
-
|
|
58123
|
-
|
|
58124
|
-
|
|
58125
|
-
|
|
58126
|
-
|
|
58127
|
-
|
|
58128
|
-
|
|
58129
|
-
|
|
58130
|
-
|
|
58131
|
-
|
|
58132
|
-
|
|
58133
|
-
|
|
58134
|
-
|
|
58135
|
-
|
|
58136
|
-
|
|
58137
|
-
|
|
58138
|
-
|
|
58139
|
-
|
|
58140
|
-
|
|
58141
|
-
|
|
58142
|
-
|
|
58143
|
-
|
|
58144
|
-
|
|
58145
|
-
|
|
58146
|
-
|
|
58147
|
-
|
|
58148
|
-
|
|
58149
|
-
|
|
58150
|
-
|
|
58151
|
-
|
|
58152
|
-
|
|
58153
|
-
|
|
58154
|
-
|
|
58155
|
-
|
|
58156
|
-
|
|
58157
|
-
|
|
58158
|
-
|
|
58159
|
-
|
|
58160
|
-
|
|
58161
|
-
|
|
58162
|
-
|
|
58163
|
-
|
|
58164
|
-
|
|
58165
|
-
|
|
58166
|
-
|
|
58167
|
-
|
|
58168
|
-
|
|
58169
|
-
|
|
58170
|
-
|
|
58171
|
-
|
|
58172
|
-
|
|
58173
|
-
|
|
58174
|
-
|
|
58175
|
-
|
|
58176
|
-
|
|
58177
|
-
|
|
58178
|
-
|
|
58179
|
-
|
|
58180
|
-
|
|
58181
|
-
|
|
58182
|
-
|
|
58183
|
-
|
|
58184
|
-
|
|
58185
|
-
|
|
58186
|
-
|
|
58187
|
-
|
|
58188
|
-
|
|
58189
|
-
|
|
58190
|
-
|
|
58191
|
-
|
|
58192
|
-
|
|
58193
|
-
|
|
58194
|
-
|
|
58195
|
-
|
|
58196
|
-
|
|
58197
|
-
|
|
58198
|
-
|
|
58199
|
-
|
|
58200
|
-
|
|
58201
|
-
|
|
58202
|
-
|
|
58203
|
-
|
|
58204
|
-
|
|
58205
|
-
|
|
58206
|
-
|
|
58207
|
-
|
|
58208
|
-
|
|
58209
|
-
|
|
58210
|
-
|
|
58211
|
-
|
|
58212
|
-
|
|
58213
|
-
|
|
58214
|
-
|
|
58215
|
-
|
|
58216
|
-
|
|
58217
|
-
|
|
58218
|
-
|
|
58219
|
-
|
|
58220
|
-
|
|
58221
|
-
|
|
58222
|
-
|
|
58223
|
-
|
|
58224
|
-
|
|
58225
|
-
|
|
58226
|
-
|
|
58227
|
-
|
|
58228
|
-
|
|
58229
|
-
|
|
58230
|
-
|
|
58231
|
-
|
|
58232
|
-
|
|
58233
|
-
|
|
58234
|
-
|
|
58235
|
-
|
|
58236
|
-
|
|
58237
|
-
|
|
58238
|
-
|
|
58239
|
-
|
|
58346
|
+
__proto__: null,
|
|
58347
|
+
ArrayExpression: ArrayExpression,
|
|
58348
|
+
ArrayPattern: ArrayPattern,
|
|
58349
|
+
ArrowFunctionExpression: ArrowFunctionExpression,
|
|
58350
|
+
AssignmentExpression: AssignmentExpression,
|
|
58351
|
+
AssignmentPattern: AssignmentPattern,
|
|
58352
|
+
AwaitExpression: AwaitExpression,
|
|
58353
|
+
BigIntLiteral: BigIntLiteral,
|
|
58354
|
+
BinaryExpression: BinaryExpression,
|
|
58355
|
+
BlockStatement: BlockStatement,
|
|
58356
|
+
BooleanLiteral: BooleanLiteral,
|
|
58357
|
+
BreakStatement: BreakStatement,
|
|
58358
|
+
CallExpression: CallExpression,
|
|
58359
|
+
CatchClause: CatchClause,
|
|
58360
|
+
ClassAccessorProperty: ClassAccessorProperty,
|
|
58361
|
+
ClassDeclaration: ClassDeclaration,
|
|
58362
|
+
ClassExpression: ClassExpression,
|
|
58363
|
+
ClassMethod: ClassMethod,
|
|
58364
|
+
ClassPrivateMethod: ClassPrivateMethod,
|
|
58365
|
+
ClassPrivateProperty: ClassPrivateProperty,
|
|
58366
|
+
ClassProperty: ClassProperty,
|
|
58367
|
+
ConditionalExpression: ConditionalExpression,
|
|
58368
|
+
ContinueStatement: ContinueStatement,
|
|
58369
|
+
DebuggerStatement: DebuggerStatement,
|
|
58370
|
+
Decorator: Decorator,
|
|
58371
|
+
Directive: Directive,
|
|
58372
|
+
DirectiveLiteral: DirectiveLiteral,
|
|
58373
|
+
DoWhileStatement: DoWhileStatement,
|
|
58374
|
+
EmptyStatement: EmptyStatement,
|
|
58375
|
+
ExportAllDeclaration: ExportAllDeclaration,
|
|
58376
|
+
ExportDefaultDeclaration: ExportDefaultDeclaration,
|
|
58377
|
+
ExportDefaultSpecifier: ExportDefaultSpecifier,
|
|
58378
|
+
ExportNamedDeclaration: ExportNamedDeclaration,
|
|
58379
|
+
ExportNamespaceSpecifier: ExportNamespaceSpecifier,
|
|
58380
|
+
ExportSpecifier: ExportSpecifier,
|
|
58381
|
+
ExpressionStatement: ExpressionStatement,
|
|
58382
|
+
ForInStatement: ForInStatement,
|
|
58383
|
+
ForOfStatement: ForOfStatement,
|
|
58384
|
+
ForStatement: ForStatement,
|
|
58385
|
+
FunctionDeclaration: FunctionDeclaration,
|
|
58386
|
+
FunctionExpression: FunctionExpression,
|
|
58387
|
+
Identifier: Identifier,
|
|
58388
|
+
IfStatement: IfStatement,
|
|
58389
|
+
ImportAttribute: ImportAttribute,
|
|
58390
|
+
ImportDeclaration: ImportDeclaration,
|
|
58391
|
+
ImportExpression: ImportExpression,
|
|
58392
|
+
InterpreterDirective: InterpreterDirective,
|
|
58393
|
+
JSXAttribute: JSXAttribute,
|
|
58394
|
+
JSXClosingElement: JSXClosingElement,
|
|
58395
|
+
JSXClosingFragment: JSXClosingFragment,
|
|
58396
|
+
JSXElement: JSXElement,
|
|
58397
|
+
JSXEmptyExpression: JSXEmptyExpression,
|
|
58398
|
+
JSXExpressionContainer: JSXExpressionContainer,
|
|
58399
|
+
JSXFragment: JSXFragment,
|
|
58400
|
+
JSXIdentifier: JSXIdentifier,
|
|
58401
|
+
JSXMemberExpression: JSXMemberExpression,
|
|
58402
|
+
JSXOpeningElement: JSXOpeningElement,
|
|
58403
|
+
JSXOpeningFragment: JSXOpeningFragment,
|
|
58404
|
+
JSXSpreadAttribute: JSXSpreadAttribute,
|
|
58405
|
+
JSXText: JSXText,
|
|
58406
|
+
LabeledStatement: LabeledStatement,
|
|
58407
|
+
LogicalExpression: LogicalExpression,
|
|
58408
|
+
MemberExpression: MemberExpression,
|
|
58409
|
+
MetaProperty: MetaProperty,
|
|
58410
|
+
NewExpression: NewExpression,
|
|
58411
|
+
NullLiteral: NullLiteral,
|
|
58412
|
+
NumericLiteral: NumericLiteral,
|
|
58413
|
+
ObjectExpression: ObjectExpression,
|
|
58414
|
+
ObjectMethod: ObjectMethod,
|
|
58415
|
+
ObjectPattern: ObjectPattern,
|
|
58416
|
+
ObjectProperty: ObjectProperty,
|
|
58417
|
+
OptionalCallExpression: OptionalCallExpression,
|
|
58418
|
+
OptionalMemberExpression: OptionalMemberExpression,
|
|
58419
|
+
ParenthesizedExpression: ParenthesizedExpression,
|
|
58420
|
+
PrivateName: PrivateName,
|
|
58421
|
+
Program: Program,
|
|
58422
|
+
RegExpLiteral: RegExpLiteral,
|
|
58423
|
+
RestElement: RestElement,
|
|
58424
|
+
ReturnStatement: ReturnStatement,
|
|
58425
|
+
SequenceExpression: SequenceExpression,
|
|
58426
|
+
SpreadElement: SpreadElement,
|
|
58427
|
+
StaticBlock: StaticBlock,
|
|
58428
|
+
StringLiteral: StringLiteral,
|
|
58429
|
+
Super: Super,
|
|
58430
|
+
SwitchStatement: SwitchStatement,
|
|
58431
|
+
TSAnyKeyword: TSAnyKeyword,
|
|
58432
|
+
TSArrayType: TSArrayType,
|
|
58433
|
+
TSAsExpression: TSAsExpression,
|
|
58434
|
+
TSBigIntKeyword: TSBigIntKeyword,
|
|
58435
|
+
TSBooleanKeyword: TSBooleanKeyword,
|
|
58436
|
+
TSCallSignatureDeclaration: TSCallSignatureDeclaration,
|
|
58437
|
+
TSClassImplements: TSClassImplements,
|
|
58438
|
+
TSConditionalType: TSConditionalType,
|
|
58439
|
+
TSConstructSignatureDeclaration: TSConstructSignatureDeclaration,
|
|
58440
|
+
TSConstructorType: TSConstructorType,
|
|
58441
|
+
TSDeclareFunction: TSDeclareFunction,
|
|
58442
|
+
TSDeclareMethod: TSDeclareMethod,
|
|
58443
|
+
TSEnumDeclaration: TSEnumDeclaration,
|
|
58444
|
+
TSEnumMember: TSEnumMember,
|
|
58445
|
+
TSExportAssignment: TSExportAssignment,
|
|
58446
|
+
TSExternalModuleReference: TSExternalModuleReference,
|
|
58447
|
+
TSFunctionType: TSFunctionType,
|
|
58448
|
+
TSImportEqualsDeclaration: TSImportEqualsDeclaration,
|
|
58449
|
+
TSImportType: TSImportType,
|
|
58450
|
+
TSIndexSignature: TSIndexSignature,
|
|
58451
|
+
TSIndexedAccessType: TSIndexedAccessType,
|
|
58452
|
+
TSInferType: TSInferType,
|
|
58453
|
+
TSInstantiationExpression: TSInstantiationExpression,
|
|
58454
|
+
TSInterfaceBody: TSInterfaceBody,
|
|
58455
|
+
TSInterfaceDeclaration: TSInterfaceDeclaration,
|
|
58456
|
+
TSInterfaceHeritage: TSInterfaceHeritage,
|
|
58457
|
+
TSIntersectionType: TSIntersectionType,
|
|
58458
|
+
TSLiteralType: TSLiteralType,
|
|
58459
|
+
TSMappedType: TSMappedType,
|
|
58460
|
+
TSMethodSignature: TSMethodSignature,
|
|
58461
|
+
TSModuleBlock: TSModuleBlock,
|
|
58462
|
+
TSModuleDeclaration: TSModuleDeclaration,
|
|
58463
|
+
TSNamedTupleMember: TSNamedTupleMember,
|
|
58464
|
+
TSNeverKeyword: TSNeverKeyword,
|
|
58465
|
+
TSNonNullExpression: TSNonNullExpression,
|
|
58466
|
+
TSNullKeyword: TSNullKeyword,
|
|
58467
|
+
TSNumberKeyword: TSNumberKeyword,
|
|
58468
|
+
TSObjectKeyword: TSObjectKeyword,
|
|
58469
|
+
TSOptionalType: TSOptionalType,
|
|
58470
|
+
TSParameterProperty: TSParameterProperty,
|
|
58471
|
+
TSParenthesizedType: TSParenthesizedType,
|
|
58472
|
+
TSPropertySignature: TSPropertySignature,
|
|
58473
|
+
TSQualifiedName: TSQualifiedName,
|
|
58474
|
+
TSRestType: TSRestType,
|
|
58475
|
+
TSSatisfiesExpression: TSSatisfiesExpression,
|
|
58476
|
+
TSStringKeyword: TSStringKeyword,
|
|
58477
|
+
TSSymbolKeyword: TSSymbolKeyword,
|
|
58478
|
+
TSTemplateLiteralType: TSTemplateLiteralType,
|
|
58479
|
+
TSThisType: TSThisType,
|
|
58480
|
+
TSTupleType: TSTupleType,
|
|
58481
|
+
TSTypeAliasDeclaration: TSTypeAliasDeclaration,
|
|
58482
|
+
TSTypeAnnotation: TSTypeAnnotation,
|
|
58483
|
+
TSTypeAssertion: TSTypeAssertion,
|
|
58484
|
+
TSTypeLiteral: TSTypeLiteral,
|
|
58485
|
+
TSTypeOperator: TSTypeOperator,
|
|
58486
|
+
TSTypeParameter: TSTypeParameter,
|
|
58487
|
+
TSTypeParameterDeclaration: TSTypeParameterDeclaration,
|
|
58488
|
+
TSTypeParameterInstantiation: TSTypeParameterInstantiation,
|
|
58489
|
+
TSTypePredicate: TSTypePredicate,
|
|
58490
|
+
TSTypeQuery: TSTypeQuery,
|
|
58491
|
+
TSTypeReference: TSTypeReference,
|
|
58492
|
+
TSUndefinedKeyword: TSUndefinedKeyword,
|
|
58493
|
+
TSUnionType: TSUnionType,
|
|
58494
|
+
TSUnknownKeyword: TSUnknownKeyword,
|
|
58495
|
+
TSVoidKeyword: TSVoidKeyword,
|
|
58496
|
+
TaggedTemplateExpression: TaggedTemplateExpression,
|
|
58497
|
+
TemplateLiteral: TemplateLiteral,
|
|
58498
|
+
ThisExpression: ThisExpression,
|
|
58499
|
+
ThrowStatement: ThrowStatement,
|
|
58500
|
+
TryStatement: TryStatement,
|
|
58501
|
+
UnaryExpression: UnaryExpression,
|
|
58502
|
+
UpdateExpression: UpdateExpression,
|
|
58503
|
+
VariableDeclaration: VariableDeclaration,
|
|
58504
|
+
VoidPattern: VoidPattern,
|
|
58505
|
+
WhileStatement: WhileStatement,
|
|
58506
|
+
WithStatement: WithStatement,
|
|
58507
|
+
YieldExpression: YieldExpression
|
|
58240
58508
|
});
|
|
58241
58509
|
|
|
58242
|
-
const isString$c = (a) => typeof a === 'string';
|
|
58243
|
-
const constant = (a) => () => a;
|
|
58244
|
-
const {keys: keys$3} = Object;
|
|
58245
|
-
|
|
58246
|
-
var rendy = (template, values, modifiers) => {
|
|
58247
|
-
check$e(template, values);
|
|
58248
|
-
|
|
58249
|
-
let result = template;
|
|
58250
|
-
|
|
58251
|
-
const names = !modifiers ? keys$3(values) : template.match(/{{(.*?)}}/g);
|
|
58252
|
-
|
|
58253
|
-
for (const key of names) {
|
|
58254
|
-
const [parsedKey, value] = parseValue$1(key, values, modifiers);
|
|
58255
|
-
const str = constant(value);
|
|
58256
|
-
|
|
58257
|
-
while (result.includes(parsedKey))
|
|
58258
|
-
result = result.replace(parsedKey, str);
|
|
58259
|
-
}
|
|
58260
|
-
|
|
58261
|
-
if (result.includes('{{'))
|
|
58262
|
-
result = result.replace(/{{.*?}}/g, '');
|
|
58263
|
-
|
|
58264
|
-
return result;
|
|
58265
|
-
};
|
|
58266
|
-
|
|
58267
|
-
function check$e(template, values) {
|
|
58268
|
-
if (!isString$c(template))
|
|
58269
|
-
throw Error('template should be a string!');
|
|
58270
|
-
|
|
58271
|
-
if (typeof values !== 'object')
|
|
58272
|
-
throw Error('values should be an object!');
|
|
58273
|
-
}
|
|
58274
|
-
|
|
58275
|
-
function parseValue$1(key, values, modifiers) {
|
|
58276
|
-
if (!modifiers)
|
|
58277
|
-
return [
|
|
58278
|
-
`{{ ${key} }}`,
|
|
58279
|
-
values[key],
|
|
58280
|
-
];
|
|
58281
|
-
|
|
58282
|
-
const preparedKey = key
|
|
58283
|
-
.replaceAll('{{', '')
|
|
58284
|
-
.replaceAll('}}', '')
|
|
58285
|
-
.replaceAll(' ', '');
|
|
58286
|
-
|
|
58287
|
-
const value = values[preparedKey] || '';
|
|
58288
|
-
|
|
58289
|
-
if (!preparedKey.includes('|'))
|
|
58290
|
-
return [key, value];
|
|
58291
|
-
|
|
58292
|
-
const [name, modifierName] = preparedKey.split('|');
|
|
58293
|
-
const fn = modifiers[modifierName];
|
|
58294
|
-
const currentValue = values[name];
|
|
58295
|
-
|
|
58296
|
-
if (!fn)
|
|
58297
|
-
return [key, currentValue];
|
|
58298
|
-
|
|
58299
|
-
return [key, fn(currentValue)];
|
|
58300
|
-
}
|
|
58301
|
-
|
|
58302
|
-
var rendy$1 = rendy.default;
|
|
58303
|
-
|
|
58304
|
-
var maybeSatisfy = (plugin) => {
|
|
58305
|
-
if (!plugin.afterSatisfy && !plugin.beforeSatisfy && !plugin.satisfy)
|
|
58306
|
-
return plugin;
|
|
58307
|
-
|
|
58308
|
-
const {
|
|
58309
|
-
satisfy,
|
|
58310
|
-
afterSatisfy = satisfy,
|
|
58311
|
-
beforeSatisfy = satisfy,
|
|
58312
|
-
} = plugin;
|
|
58313
|
-
|
|
58314
|
-
return {
|
|
58315
|
-
afterIf: createIf(afterSatisfy),
|
|
58316
|
-
beforeIf: createIf(beforeSatisfy),
|
|
58317
|
-
...plugin,
|
|
58318
|
-
};
|
|
58319
|
-
};
|
|
58320
|
-
|
|
58321
|
-
const createIf = (getConditions) => {
|
|
58322
|
-
const conditions = getConditions?.() || [];
|
|
58323
|
-
return satisfy(conditions);
|
|
58324
|
-
};
|
|
58325
|
-
|
|
58326
|
-
const {
|
|
58327
|
-
isProgram: isProgram$3,
|
|
58328
|
-
isFile: isFile$1,
|
|
58329
|
-
isStatement: isStatement$2,
|
|
58330
|
-
expressionStatement,
|
|
58331
|
-
program,
|
|
58332
|
-
file,
|
|
58333
|
-
} = lib_exports;
|
|
58334
|
-
|
|
58335
|
-
const isFn$6 = (a) => typeof a === 'function';
|
|
58336
|
-
|
|
58337
|
-
const maybeThrow = (a, path, b) => {
|
|
58338
|
-
if (!a)
|
|
58339
|
-
return;
|
|
58340
|
-
|
|
58341
|
-
throw Error(rendy$1(b, {
|
|
58342
|
-
path,
|
|
58343
|
-
type: path.type,
|
|
58344
|
-
}));
|
|
58345
|
-
};
|
|
58346
|
-
|
|
58347
|
-
const maybeStatement = (ast) => isStatement$2(ast) ? ast : expressionStatement(ast);
|
|
58348
|
-
|
|
58349
|
-
const maybeProgram = (ast) => isProgram$3(ast) ? ast : program([
|
|
58350
|
-
maybeStatement(ast),
|
|
58351
|
-
]);
|
|
58352
|
-
|
|
58353
|
-
const maybeFile = (ast) => isFile$1(ast) ? ast : file(maybeProgram(ast));
|
|
58354
|
-
|
|
58355
|
-
const maybeVisitor = (plugin, path, printer, options) => {
|
|
58356
|
-
if (isFn$6(plugin))
|
|
58357
|
-
return plugin(path, printer, options);
|
|
58358
|
-
|
|
58359
|
-
return objectPlugin(plugin, path, printer, options);
|
|
58360
|
-
};
|
|
58361
|
-
|
|
58362
|
-
function objectPlugin(plugin, path, printer, semantics) {
|
|
58363
|
-
const {
|
|
58364
|
-
print,
|
|
58365
|
-
split,
|
|
58366
|
-
condition,
|
|
58367
|
-
before = split,
|
|
58368
|
-
beforeIf = condition,
|
|
58369
|
-
after = split,
|
|
58370
|
-
afterIf = condition,
|
|
58371
|
-
} = maybeSatisfy(plugin);
|
|
58372
|
-
|
|
58373
|
-
if (beforeIf?.(path, printer, semantics))
|
|
58374
|
-
before(path, printer, semantics);
|
|
58375
|
-
|
|
58376
|
-
print(path, printer, semantics);
|
|
58377
|
-
|
|
58378
|
-
if (afterIf?.(path, printer, semantics))
|
|
58379
|
-
after(path, printer, semantics);
|
|
58380
|
-
}
|
|
58381
|
-
|
|
58382
|
-
var stringSnakeCase = snakeCase;
|
|
58383
|
-
|
|
58384
|
-
/*
|
|
58385
|
-
snakeCase('the quick brown fox'); // 'the_quick_brown_fox'
|
|
58386
|
-
snakeCase('the-quick-brown-fox'); // 'the_quick_brown_fox'
|
|
58387
|
-
snakeCase('the_quick_brown_fox'); // 'the_quick_brown_fox'
|
|
58388
|
-
snakeCase('theQuickBrownFox'); // 'the_quick_brown_fox'
|
|
58389
|
-
snakeCase('theQuickBrown Fox'); // 'the_quick_brown_Fox'
|
|
58390
|
-
snakeCase('thequickbrownfox'); // 'thequickbrownfox'
|
|
58391
|
-
snakeCase('the - quick * brown# fox'); // 'the_quick_brown_fox'
|
|
58392
|
-
snakeCase('theQUICKBrownFox'); // 'the_q_u_i_c_k_brown_fox'
|
|
58393
|
-
*/
|
|
58394
|
-
|
|
58395
|
-
// any combination of spaces and punctuation characters
|
|
58396
|
-
// thanks to http://stackoverflow.com/a/25575009
|
|
58397
|
-
var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
|
|
58398
|
-
var capitals = /[A-Z\u00C0-\u00D6\u00D9-\u00DD]/g;
|
|
58399
|
-
|
|
58400
|
-
function snakeCase(str) {
|
|
58401
|
-
//replace capitals with space + lower case equivalent for later parsing
|
|
58402
|
-
str = str.replace(capitals, function(match) {
|
|
58403
|
-
return ' ' + (match.toLowerCase() || match);
|
|
58404
|
-
});
|
|
58405
|
-
return str
|
|
58406
|
-
.trim()
|
|
58407
|
-
.split(wordSeparators)
|
|
58408
|
-
.join('_');
|
|
58409
|
-
}
|
|
58410
|
-
|
|
58411
|
-
const {stringify: stringify$7} = JSON;
|
|
58412
|
-
const {
|
|
58413
|
-
LOG,
|
|
58414
|
-
LOG_ALL,
|
|
58415
|
-
LOG_TOKENS,
|
|
58416
|
-
LOG_TERM,
|
|
58417
|
-
LOG_DEBUG,
|
|
58418
|
-
} = {};
|
|
58419
|
-
|
|
58420
|
-
const createDebug$4 = (tokens) => (a) => {
|
|
58421
|
-
if (!LOG_DEBUG)
|
|
58422
|
-
return;
|
|
58423
|
-
|
|
58424
|
-
tokens.push({
|
|
58425
|
-
type: TYPES$3.DEBUG,
|
|
58426
|
-
value: `/*__${stringSnakeCase(a)}*/`,
|
|
58427
|
-
});
|
|
58428
|
-
};
|
|
58429
|
-
|
|
58430
|
-
const createLog = ({newline = '\n', store = createStore$1()} = {}) => ({type, value}) => {
|
|
58431
|
-
if (LOG_TOKENS) {
|
|
58432
|
-
console.log(codeFrameColumns(stringify$7({
|
|
58433
|
-
type,
|
|
58434
|
-
value,
|
|
58435
|
-
}), {}, {
|
|
58436
|
-
highlightCode: true,
|
|
58437
|
-
}));
|
|
58438
|
-
|
|
58439
|
-
return;
|
|
58440
|
-
}
|
|
58441
|
-
|
|
58442
|
-
if (LOG_ALL) {
|
|
58443
|
-
console.log(codeFrameColumns(value, {}, {
|
|
58444
|
-
highlightCode: true,
|
|
58445
|
-
}));
|
|
58446
|
-
|
|
58447
|
-
return;
|
|
58448
|
-
}
|
|
58449
|
-
|
|
58450
|
-
if (LOG) {
|
|
58451
|
-
if (value === newline) {
|
|
58452
|
-
console.log(codeFrameColumns(store(), {}, {
|
|
58453
|
-
highlightCode: true,
|
|
58454
|
-
}));
|
|
58455
|
-
|
|
58456
|
-
return;
|
|
58457
|
-
}
|
|
58458
|
-
|
|
58459
|
-
store(value);
|
|
58460
|
-
}
|
|
58461
|
-
|
|
58462
|
-
if (LOG_TERM)
|
|
58463
|
-
browser$1.stdout.write(value);
|
|
58464
|
-
};
|
|
58465
|
-
|
|
58466
|
-
function createStore$1() {
|
|
58467
|
-
let chunks = [];
|
|
58468
|
-
|
|
58469
|
-
return (...args) => {
|
|
58470
|
-
const [chunk] = args;
|
|
58471
|
-
|
|
58472
|
-
if (args.length) {
|
|
58473
|
-
chunks.push(chunk);
|
|
58474
|
-
return;
|
|
58475
|
-
}
|
|
58476
|
-
|
|
58477
|
-
const result = chunks.join('');
|
|
58478
|
-
|
|
58479
|
-
chunks = [];
|
|
58480
|
-
|
|
58481
|
-
return result;
|
|
58482
|
-
};
|
|
58483
|
-
}
|
|
58484
|
-
|
|
58485
58510
|
const isObject$7 = (a) => a && typeof a === 'object';
|
|
58486
58511
|
const isBool$3 = (a) => typeof a === 'boolean';
|
|
58487
58512
|
|
|
@@ -58577,40 +58602,13 @@ const initSemantics = (format, semantics = {}) => ({
|
|
|
58577
58602
|
roundBraces: parseRoundBraces(semantics),
|
|
58578
58603
|
});
|
|
58579
58604
|
|
|
58580
|
-
const
|
|
58581
|
-
const {round} = Math;
|
|
58582
|
-
const isString$b = (a) => typeof a === 'string';
|
|
58583
|
-
const {assign: assign$9, freeze} = Object;
|
|
58584
|
-
|
|
58585
|
-
const GET = '__';
|
|
58586
|
-
const get = (path, command) => path.get(command.replace(GET, ''));
|
|
58587
|
-
|
|
58588
|
-
const createAddToken = (tokens) => {
|
|
58589
|
-
const log = createLog();
|
|
58590
|
-
|
|
58591
|
-
return (token) => {
|
|
58592
|
-
log(token);
|
|
58593
|
-
tokens.push(token);
|
|
58594
|
-
};
|
|
58595
|
-
};
|
|
58605
|
+
const {assign: assign$a} = Object;
|
|
58596
58606
|
|
|
58597
|
-
const
|
|
58598
|
-
|
|
58599
|
-
visitors,
|
|
58600
|
-
format,
|
|
58601
|
-
semantics,
|
|
58602
|
-
} = parseOverrides(overrides);
|
|
58603
|
-
|
|
58604
|
-
const tokens = [];
|
|
58605
|
-
const addToken = createAddToken(tokens);
|
|
58606
|
-
const debug = createDebug$4(tokens);
|
|
58607
|
+
const createIndent = ({format, addToken}) => {
|
|
58608
|
+
let i = 0;
|
|
58607
58609
|
|
|
58608
|
-
const
|
|
58609
|
-
|
|
58610
|
-
type: TYPES$3.TOKEN,
|
|
58611
|
-
value,
|
|
58612
|
-
});
|
|
58613
|
-
};
|
|
58610
|
+
const incIndent = () => ++i;
|
|
58611
|
+
const decIndent = () => --i;
|
|
58614
58612
|
|
|
58615
58613
|
const indent = () => {
|
|
58616
58614
|
addToken({
|
|
@@ -58619,73 +58617,87 @@ const tokenize = (ast, overrides) => {
|
|
|
58619
58617
|
});
|
|
58620
58618
|
};
|
|
58621
58619
|
|
|
58622
|
-
|
|
58623
|
-
|
|
58624
|
-
|
|
58625
|
-
|
|
58626
|
-
|
|
58620
|
+
assign$a(indent, {
|
|
58621
|
+
inc: incIndent,
|
|
58622
|
+
dec: decIndent,
|
|
58623
|
+
getLevel() {
|
|
58624
|
+
return i;
|
|
58625
|
+
},
|
|
58626
|
+
});
|
|
58627
58627
|
|
|
58628
|
-
|
|
58629
|
-
|
|
58630
|
-
|
|
58631
|
-
|
|
58632
|
-
|
|
58633
|
-
|
|
58628
|
+
return indent;
|
|
58629
|
+
};
|
|
58630
|
+
|
|
58631
|
+
function printIndent(i, indent) {
|
|
58632
|
+
let result = '';
|
|
58633
|
+
++i;
|
|
58634
58634
|
|
|
58635
|
-
|
|
58635
|
+
while (--i > 0) {
|
|
58636
|
+
result += indent;
|
|
58637
|
+
}
|
|
58636
58638
|
|
|
58637
|
-
|
|
58638
|
-
|
|
58639
|
-
|
|
58640
|
-
|
|
58639
|
+
return result;
|
|
58640
|
+
}
|
|
58641
|
+
|
|
58642
|
+
const isObject$6 = (a) => a && typeof a === 'object';
|
|
58643
|
+
const isString$c = (a) => typeof a === 'string';
|
|
58644
|
+
|
|
58645
|
+
const GET = '__';
|
|
58646
|
+
const get = (path, command) => path.get(command.replace(GET, ''));
|
|
58647
|
+
|
|
58648
|
+
const {freeze, assign: assign$9} = Object;
|
|
58649
|
+
|
|
58650
|
+
const createPrinter = (overrides) => {
|
|
58651
|
+
const tokens = [];
|
|
58652
|
+
const {
|
|
58653
|
+
format,
|
|
58654
|
+
semantics,
|
|
58655
|
+
visitors,
|
|
58656
|
+
} = parseOverrides(overrides);
|
|
58641
58657
|
|
|
58642
|
-
const
|
|
58658
|
+
const addToken = createAddToken(tokens);
|
|
58659
|
+
const debug = createDebug$4(tokens);
|
|
58660
|
+
const write = createWrite(addToken);
|
|
58643
58661
|
|
|
58644
|
-
const
|
|
58645
|
-
|
|
58646
|
-
|
|
58647
|
-
};
|
|
58662
|
+
const indent = createIndent({
|
|
58663
|
+
format,
|
|
58664
|
+
addToken,
|
|
58665
|
+
});
|
|
58648
58666
|
|
|
58649
|
-
const
|
|
58650
|
-
|
|
58667
|
+
const newline = createNewline({
|
|
58668
|
+
format,
|
|
58669
|
+
addToken,
|
|
58670
|
+
});
|
|
58651
58671
|
|
|
58652
|
-
const
|
|
58653
|
-
|
|
58654
|
-
|
|
58655
|
-
|
|
58656
|
-
});
|
|
58657
|
-
};
|
|
58672
|
+
const breakline = createBreakline({
|
|
58673
|
+
newline,
|
|
58674
|
+
indent,
|
|
58675
|
+
});
|
|
58658
58676
|
|
|
58659
|
-
const
|
|
58660
|
-
|
|
58661
|
-
|
|
58662
|
-
|
|
58677
|
+
const linebreak = createLinebreak({
|
|
58678
|
+
indent,
|
|
58679
|
+
newline,
|
|
58680
|
+
});
|
|
58663
58681
|
|
|
58664
|
-
|
|
58665
|
-
|
|
58666
|
-
|
|
58682
|
+
const space = createSpace({
|
|
58683
|
+
format,
|
|
58684
|
+
addToken,
|
|
58667
58685
|
});
|
|
58668
58686
|
|
|
58669
|
-
const splitter = (
|
|
58670
|
-
|
|
58671
|
-
|
|
58672
|
-
|
|
58673
|
-
});
|
|
58674
|
-
};
|
|
58687
|
+
const splitter = createSplitter({
|
|
58688
|
+
format,
|
|
58689
|
+
addToken,
|
|
58690
|
+
});
|
|
58675
58691
|
|
|
58676
|
-
const
|
|
58677
|
-
|
|
58678
|
-
|
|
58679
|
-
|
|
58680
|
-
});
|
|
58681
|
-
};
|
|
58692
|
+
const endOfFile = createEndOfFile({
|
|
58693
|
+
format,
|
|
58694
|
+
addToken,
|
|
58695
|
+
});
|
|
58682
58696
|
|
|
58683
|
-
const
|
|
58684
|
-
addToken
|
|
58685
|
-
|
|
58686
|
-
|
|
58687
|
-
});
|
|
58688
|
-
};
|
|
58697
|
+
const quote = createQuote({
|
|
58698
|
+
addToken,
|
|
58699
|
+
format,
|
|
58700
|
+
});
|
|
58689
58701
|
|
|
58690
58702
|
assign$9(write, {
|
|
58691
58703
|
indent,
|
|
@@ -58698,6 +58710,15 @@ const tokenize = (ast, overrides) => {
|
|
|
58698
58710
|
endOfFile,
|
|
58699
58711
|
});
|
|
58700
58712
|
|
|
58713
|
+
const maybeBreakline = createMaybe(breakline);
|
|
58714
|
+
const maybeNewline = createMaybe(newline);
|
|
58715
|
+
const maybeLinebreak = createMaybe(linebreak);
|
|
58716
|
+
const maybeSpace = createMaybe(space);
|
|
58717
|
+
|
|
58718
|
+
const maybeWrite = createMaybeWrite({
|
|
58719
|
+
write,
|
|
58720
|
+
});
|
|
58721
|
+
|
|
58701
58722
|
assign$9(maybeWrite, {
|
|
58702
58723
|
newline: maybeNewline,
|
|
58703
58724
|
breakline: maybeBreakline,
|
|
@@ -58705,6 +58726,8 @@ const tokenize = (ast, overrides) => {
|
|
|
58705
58726
|
space: maybeSpace,
|
|
58706
58727
|
});
|
|
58707
58728
|
|
|
58729
|
+
const maybeIndent = createMaybe(indent);
|
|
58730
|
+
|
|
58708
58731
|
const maybe = {
|
|
58709
58732
|
indent: maybeIndent,
|
|
58710
58733
|
markAfter: maybeMarkAfter,
|
|
@@ -58712,117 +58735,138 @@ const tokenize = (ast, overrides) => {
|
|
|
58712
58735
|
space: maybeSpace,
|
|
58713
58736
|
};
|
|
58714
58737
|
|
|
58738
|
+
const maybeIndentInc = createMaybe(indent.inc);
|
|
58739
|
+
const maybeIndentDec = createMaybe(indent.dec);
|
|
58740
|
+
|
|
58715
58741
|
assign$9(maybe.indent, {
|
|
58716
58742
|
inc: maybeIndentInc,
|
|
58717
58743
|
dec: maybeIndentDec,
|
|
58718
58744
|
});
|
|
58719
58745
|
|
|
58746
|
+
const getMainPrinter = () => mainPrinter;
|
|
58747
|
+
|
|
58748
|
+
const traverse = createTraverse$6({
|
|
58749
|
+
maybeNewline,
|
|
58750
|
+
maybeLinebreak,
|
|
58751
|
+
maybeSpace,
|
|
58752
|
+
maybeBreakline,
|
|
58753
|
+
indent,
|
|
58754
|
+
write,
|
|
58755
|
+
debug,
|
|
58756
|
+
semantics,
|
|
58757
|
+
visitors,
|
|
58758
|
+
getMainPrinter,
|
|
58759
|
+
});
|
|
58760
|
+
|
|
58720
58761
|
// should never change to avoid unexpected errors related to printing path, since it hard to debug
|
|
58721
58762
|
const mainPrinter = freeze({
|
|
58722
58763
|
indent,
|
|
58723
58764
|
write,
|
|
58724
58765
|
debug,
|
|
58725
|
-
traverse,
|
|
58726
58766
|
maybe,
|
|
58727
58767
|
quote,
|
|
58728
58768
|
store: fullstore(),
|
|
58769
|
+
traverse,
|
|
58729
58770
|
});
|
|
58730
58771
|
|
|
58772
|
+
const getTokens = () => tokens;
|
|
58773
|
+
|
|
58774
|
+
return {
|
|
58775
|
+
getTokens,
|
|
58776
|
+
traverse,
|
|
58777
|
+
};
|
|
58778
|
+
};
|
|
58779
|
+
|
|
58780
|
+
const createTraverse$6 = (overrides) => function traverse(path) {
|
|
58781
|
+
const {
|
|
58782
|
+
write,
|
|
58783
|
+
debug,
|
|
58784
|
+
maybeLinebreak,
|
|
58785
|
+
maybeSpace,
|
|
58786
|
+
maybeBreakline,
|
|
58787
|
+
maybeNewline,
|
|
58788
|
+
indent,
|
|
58789
|
+
semantics,
|
|
58790
|
+
visitors,
|
|
58791
|
+
getMainPrinter,
|
|
58792
|
+
} = overrides;
|
|
58793
|
+
|
|
58794
|
+
const mainPrinter = getMainPrinter();
|
|
58795
|
+
|
|
58731
58796
|
const currentTraversers = {
|
|
58732
58797
|
...baseVisitors,
|
|
58733
58798
|
...visitors,
|
|
58734
58799
|
};
|
|
58735
58800
|
|
|
58736
|
-
|
|
58737
|
-
|
|
58738
|
-
else
|
|
58739
|
-
traverse3(maybeFile(ast), {
|
|
58740
|
-
Program(path) {
|
|
58741
|
-
traverse(path);
|
|
58742
|
-
path.stop();
|
|
58743
|
-
},
|
|
58744
|
-
});
|
|
58801
|
+
const {type} = path;
|
|
58802
|
+
const currentTraverse = currentTraversers[type];
|
|
58745
58803
|
|
|
58746
|
-
|
|
58747
|
-
|
|
58748
|
-
const currentTraverse = currentTraversers[type];
|
|
58749
|
-
|
|
58750
|
-
if (!path.node)
|
|
58751
|
-
return;
|
|
58752
|
-
|
|
58753
|
-
const print = createPrint(path, {
|
|
58754
|
-
write,
|
|
58755
|
-
traverse,
|
|
58756
|
-
});
|
|
58757
|
-
|
|
58758
|
-
assign$9(print, write, {
|
|
58759
|
-
space,
|
|
58760
|
-
round,
|
|
58761
|
-
});
|
|
58762
|
-
|
|
58763
|
-
const printer = {
|
|
58764
|
-
...mainPrinter,
|
|
58765
|
-
print,
|
|
58766
|
-
};
|
|
58767
|
-
|
|
58768
|
-
const maybePrint = (a, b) => a && print(b);
|
|
58769
|
-
|
|
58770
|
-
assign$9(maybePrint, {
|
|
58771
|
-
newline: maybeNewline,
|
|
58772
|
-
breakline: maybeBreakline,
|
|
58773
|
-
linebreak: maybeLinebreak,
|
|
58774
|
-
space: maybeSpace,
|
|
58775
|
-
});
|
|
58776
|
-
|
|
58777
|
-
assign$9(printer.maybe, {
|
|
58778
|
-
print: maybePrint,
|
|
58779
|
-
});
|
|
58780
|
-
|
|
58781
|
-
maybeThrow(!currentTraverse, path, `☝️ Node type '{{ type }}' is not supported yet by @putout/printer: '{{ path }}'`);
|
|
58782
|
-
|
|
58783
|
-
const currentIndent = i;
|
|
58784
|
-
parseLeadingComments(path, printer, semantics, {
|
|
58785
|
-
currentTraverse,
|
|
58786
|
-
});
|
|
58787
|
-
|
|
58788
|
-
// this is main thing
|
|
58789
|
-
maybeVisitor(currentTraverse, path, printer, semantics);
|
|
58790
|
-
parseTrailingComments(path, printer, semantics, {
|
|
58791
|
-
currentTraverse,
|
|
58792
|
-
});
|
|
58793
|
-
maybeThrow(i !== currentIndent, path, `☝️Looks like indent level changed after token visitor: '{{ type }}', for code: '{{ path }}'`);
|
|
58794
|
-
|
|
58795
|
-
debug(path.type);
|
|
58796
|
-
}
|
|
58804
|
+
if (!path.node)
|
|
58805
|
+
return;
|
|
58797
58806
|
|
|
58798
|
-
|
|
58799
|
-
|
|
58800
|
-
|
|
58801
|
-
|
|
58802
|
-
let result = '';
|
|
58803
|
-
++i;
|
|
58807
|
+
const print = createPrint(path, {
|
|
58808
|
+
write,
|
|
58809
|
+
traverse,
|
|
58810
|
+
});
|
|
58804
58811
|
|
|
58805
|
-
|
|
58806
|
-
|
|
58807
|
-
|
|
58812
|
+
const printer = {
|
|
58813
|
+
...mainPrinter,
|
|
58814
|
+
traverse,
|
|
58815
|
+
print,
|
|
58816
|
+
};
|
|
58808
58817
|
|
|
58809
|
-
|
|
58810
|
-
|
|
58811
|
-
|
|
58812
|
-
|
|
58813
|
-
|
|
58814
|
-
|
|
58818
|
+
const maybePrint = (a, b) => a && print(b);
|
|
58819
|
+
|
|
58820
|
+
assign$9(maybePrint, {
|
|
58821
|
+
newline: maybeNewline,
|
|
58822
|
+
breakline: maybeBreakline,
|
|
58823
|
+
linebreak: maybeLinebreak,
|
|
58824
|
+
space: maybeSpace,
|
|
58825
|
+
});
|
|
58826
|
+
|
|
58827
|
+
assign$9(printer.maybe, {
|
|
58828
|
+
print: maybePrint,
|
|
58829
|
+
});
|
|
58830
|
+
|
|
58831
|
+
maybeThrow(!currentTraverse, path, `☝️ Node type '{{ type }}' is not supported yet by @putout/printer: '{{ path }}'`);
|
|
58832
|
+
|
|
58833
|
+
const currentIndent = indent.getLevel();
|
|
58834
|
+
|
|
58835
|
+
parseLeadingComments(path, printer, semantics, {
|
|
58836
|
+
currentTraverse,
|
|
58837
|
+
});
|
|
58815
58838
|
|
|
58816
|
-
|
|
58839
|
+
// this is main thing
|
|
58840
|
+
maybeVisitor(currentTraverse, path, printer, semantics);
|
|
58841
|
+
parseTrailingComments(path, printer, semantics, {
|
|
58842
|
+
currentTraverse,
|
|
58843
|
+
});
|
|
58817
58844
|
|
|
58818
|
-
|
|
58819
|
-
return traverse(computed);
|
|
58845
|
+
maybeThrow(indent.getLevel() !== currentIndent, path, `☝️Looks like indent level changed after token visitor: '{{ type }}', for code: '{{ path }}'`);
|
|
58820
58846
|
|
|
58821
|
-
|
|
58847
|
+
debug(path.type);
|
|
58848
|
+
};
|
|
58849
|
+
|
|
58850
|
+
const createPrint = (path, {traverse, write}) => {
|
|
58851
|
+
const print = (maybeLine) => {
|
|
58852
|
+
if (maybeLine === path)
|
|
58853
|
+
return null;
|
|
58854
|
+
|
|
58855
|
+
const computed = computePath(path, maybeLine);
|
|
58856
|
+
|
|
58857
|
+
if (isObject$6(computed))
|
|
58858
|
+
return traverse(computed);
|
|
58859
|
+
|
|
58860
|
+
return write(computed);
|
|
58861
|
+
};
|
|
58862
|
+
|
|
58863
|
+
assign$9(print, write);
|
|
58864
|
+
|
|
58865
|
+
return print;
|
|
58822
58866
|
};
|
|
58823
58867
|
|
|
58824
58868
|
const computePath = (path, maybeLine) => {
|
|
58825
|
-
if (isString$
|
|
58869
|
+
if (isString$c(maybeLine) && maybeLine.startsWith(GET))
|
|
58826
58870
|
return get(path, maybeLine);
|
|
58827
58871
|
|
|
58828
58872
|
if (isObject$6(maybeLine))
|
|
@@ -58831,6 +58875,87 @@ const computePath = (path, maybeLine) => {
|
|
|
58831
58875
|
return maybeLine;
|
|
58832
58876
|
};
|
|
58833
58877
|
|
|
58878
|
+
const createWrite = (addToken) => (value) => {
|
|
58879
|
+
addToken({
|
|
58880
|
+
type: TYPES$3.TOKEN,
|
|
58881
|
+
value,
|
|
58882
|
+
});
|
|
58883
|
+
};
|
|
58884
|
+
|
|
58885
|
+
const createNewline = ({format, addToken}) => () => {
|
|
58886
|
+
addToken({
|
|
58887
|
+
type: TYPES$3.NEWLINE,
|
|
58888
|
+
value: format.newline,
|
|
58889
|
+
});
|
|
58890
|
+
};
|
|
58891
|
+
|
|
58892
|
+
const createMaybe = (fn) => (a) => a && fn();
|
|
58893
|
+
|
|
58894
|
+
const createBreakline = ({newline, indent}) => () => {
|
|
58895
|
+
newline();
|
|
58896
|
+
indent();
|
|
58897
|
+
};
|
|
58898
|
+
|
|
58899
|
+
const createLinebreak = ({indent, newline}) => () => {
|
|
58900
|
+
indent();
|
|
58901
|
+
newline();
|
|
58902
|
+
};
|
|
58903
|
+
|
|
58904
|
+
const createMaybeWrite = ({write}) => (a, b) => a && write(b);
|
|
58905
|
+
|
|
58906
|
+
const createSpace = ({format, addToken}) => () => {
|
|
58907
|
+
addToken({
|
|
58908
|
+
type: TYPES$3.SPACE,
|
|
58909
|
+
value: format.space,
|
|
58910
|
+
});
|
|
58911
|
+
};
|
|
58912
|
+
|
|
58913
|
+
const createSplitter = ({format, addToken}) => () => {
|
|
58914
|
+
addToken({
|
|
58915
|
+
type: TYPES$3.SPLITTER,
|
|
58916
|
+
value: format.splitter,
|
|
58917
|
+
});
|
|
58918
|
+
};
|
|
58919
|
+
|
|
58920
|
+
const createQuote = ({addToken, format}) => () => {
|
|
58921
|
+
addToken({
|
|
58922
|
+
type: TYPES$3.QUOTE,
|
|
58923
|
+
value: format.quote,
|
|
58924
|
+
});
|
|
58925
|
+
};
|
|
58926
|
+
|
|
58927
|
+
const createEndOfFile = ({format, addToken}) => () => {
|
|
58928
|
+
addToken({
|
|
58929
|
+
type: TYPES$3.END_OF_FILE,
|
|
58930
|
+
value: format.endOfFile,
|
|
58931
|
+
});
|
|
58932
|
+
};
|
|
58933
|
+
|
|
58934
|
+
const createAddToken = (tokens) => {
|
|
58935
|
+
const log = createLog();
|
|
58936
|
+
|
|
58937
|
+
return (token) => {
|
|
58938
|
+
log(token);
|
|
58939
|
+
tokens.push(token);
|
|
58940
|
+
};
|
|
58941
|
+
};
|
|
58942
|
+
|
|
58943
|
+
const tokenize = (ast, overrides) => {
|
|
58944
|
+
const {getTokens, traverse} = createPrinter(overrides);
|
|
58945
|
+
|
|
58946
|
+
if (ast.parentPath)
|
|
58947
|
+
pathTraverse(ast, traverse);
|
|
58948
|
+
else
|
|
58949
|
+
traverse3(maybeFile(ast), {
|
|
58950
|
+
Program(path) {
|
|
58951
|
+
traverse(path);
|
|
58952
|
+
path.stop();
|
|
58953
|
+
},
|
|
58954
|
+
});
|
|
58955
|
+
|
|
58956
|
+
return getTokens();
|
|
58957
|
+
};
|
|
58958
|
+
|
|
58834
58959
|
function pathTraverse(ast, traverse) {
|
|
58835
58960
|
ast.parentPath.traverse({
|
|
58836
58961
|
enter(path) {
|
|
@@ -59008,7 +59133,7 @@ function check$d(ast) {
|
|
|
59008
59133
|
throw Error('☝️Looks like ast not an object');
|
|
59009
59134
|
}
|
|
59010
59135
|
|
|
59011
|
-
const isString$
|
|
59136
|
+
const isString$b = (a) => typeof a === 'string';
|
|
59012
59137
|
|
|
59013
59138
|
const alignSpaces = (str) => {
|
|
59014
59139
|
check$c(str);
|
|
@@ -59056,7 +59181,7 @@ function getSpaces(s) {
|
|
|
59056
59181
|
}
|
|
59057
59182
|
|
|
59058
59183
|
function check$c(str) {
|
|
59059
|
-
if (!isString$
|
|
59184
|
+
if (!isString$b(str))
|
|
59060
59185
|
throw Error('str should be a string!');
|
|
59061
59186
|
}
|
|
59062
59187
|
|
|
@@ -59090,12 +59215,12 @@ const print$1 = (ast, options) => {
|
|
|
59090
59215
|
return alignSpaces(code);
|
|
59091
59216
|
};
|
|
59092
59217
|
|
|
59093
|
-
const {isArray: isArray$
|
|
59218
|
+
const {isArray: isArray$e} = Array;
|
|
59094
59219
|
|
|
59095
|
-
const maybeArray$
|
|
59220
|
+
const maybeArray$5 = (a) => isArray$e(a) ? a : [a, {}];
|
|
59096
59221
|
|
|
59097
59222
|
const print = (ast, options = {}) => {
|
|
59098
|
-
const [printer = 'putout', printerOptions] = maybeArray$
|
|
59223
|
+
const [printer = 'putout', printerOptions] = maybeArray$5(options.printer);
|
|
59099
59224
|
|
|
59100
59225
|
if (printer === 'babel')
|
|
59101
59226
|
return print$1(ast, {
|
|
@@ -59360,7 +59485,7 @@ function getCommentGroup({trailing, leading}) {
|
|
|
59360
59485
|
return 'innerComments'; // Dangling comments, such as `[/* a */]`.
|
|
59361
59486
|
}
|
|
59362
59487
|
|
|
59363
|
-
const isString$
|
|
59488
|
+
const isString$a = (a) => typeof a === 'string';
|
|
59364
59489
|
const isNumber$2 = (a) => typeof a === 'number';
|
|
59365
59490
|
const isNull = (a) => a === null;
|
|
59366
59491
|
const isBool$2 = (a) => typeof a === 'boolean';
|
|
@@ -59376,7 +59501,7 @@ var setLiteral = (node) => {
|
|
|
59376
59501
|
return;
|
|
59377
59502
|
}
|
|
59378
59503
|
|
|
59379
|
-
if (isString$
|
|
59504
|
+
if (isString$a(value)) {
|
|
59380
59505
|
node.type = 'StringLiteral';
|
|
59381
59506
|
return;
|
|
59382
59507
|
}
|
|
@@ -59685,8 +59810,8 @@ var onceExports = once$6.exports;
|
|
|
59685
59810
|
const noop$3 = () => {};
|
|
59686
59811
|
|
|
59687
59812
|
var empty = /*#__PURE__*/Object.freeze({
|
|
59688
|
-
|
|
59689
|
-
|
|
59813
|
+
__proto__: null,
|
|
59814
|
+
default: noop$3
|
|
59690
59815
|
});
|
|
59691
59816
|
|
|
59692
59817
|
var require$$1 = /*@__PURE__*/getAugmentedNamespace(empty);
|
|
@@ -59717,8 +59842,8 @@ function privateMethods(Parser) {
|
|
|
59717
59842
|
}
|
|
59718
59843
|
|
|
59719
59844
|
var acornPrivateMethods = /*#__PURE__*/Object.freeze({
|
|
59720
|
-
|
|
59721
|
-
|
|
59845
|
+
__proto__: null,
|
|
59846
|
+
default: privateMethods
|
|
59722
59847
|
});
|
|
59723
59848
|
|
|
59724
59849
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(acornPrivateMethods);
|
|
@@ -59799,10 +59924,10 @@ const allowUndeclaredExports = true;
|
|
|
59799
59924
|
const allowImportExportEverywhere = true;
|
|
59800
59925
|
|
|
59801
59926
|
var options = /*#__PURE__*/Object.freeze({
|
|
59802
|
-
|
|
59803
|
-
|
|
59804
|
-
|
|
59805
|
-
|
|
59927
|
+
__proto__: null,
|
|
59928
|
+
allowImportExportEverywhere: allowImportExportEverywhere,
|
|
59929
|
+
allowReturnOutsideFunction: allowReturnOutsideFunction,
|
|
59930
|
+
allowUndeclaredExports: allowUndeclaredExports
|
|
59806
59931
|
});
|
|
59807
59932
|
|
|
59808
59933
|
const {assign: assign$5} = Object;
|
|
@@ -60039,7 +60164,7 @@ const tryThrowWithReason$1 = (fn, ...args) => {
|
|
|
60039
60164
|
};
|
|
60040
60165
|
|
|
60041
60166
|
const {assign: assign$4} = Object;
|
|
60042
|
-
const isString$
|
|
60167
|
+
const isString$9 = (a) => typeof a === 'string';
|
|
60043
60168
|
|
|
60044
60169
|
const parse$4 = (source, options) => {
|
|
60045
60170
|
check$b(source);
|
|
@@ -60081,7 +60206,7 @@ const getParser = ({parser = 'babel', isTS, isJSX, printer}) => ({
|
|
|
60081
60206
|
});
|
|
60082
60207
|
|
|
60083
60208
|
function check$b(source) {
|
|
60084
|
-
if (!isString$
|
|
60209
|
+
if (!isString$9(source))
|
|
60085
60210
|
throw Error(`☝️ Looks like type of 'source' is not 'string', but '${typeof source}'`);
|
|
60086
60211
|
}
|
|
60087
60212
|
|
|
@@ -60191,6 +60316,126 @@ function $cf838c15c8b009ba$export$22f15dd4e5be7e52(fn, o) {
|
|
|
60191
60316
|
return f;
|
|
60192
60317
|
}
|
|
60193
60318
|
|
|
60319
|
+
const wrap = (fn) => (...a) => (...b) => fn(...a, ...b);
|
|
60320
|
+
|
|
60321
|
+
var wraptile = (fn, ...a) => {
|
|
60322
|
+
check$a(fn);
|
|
60323
|
+
|
|
60324
|
+
if (a.length)
|
|
60325
|
+
return wrap(fn)(...a);
|
|
60326
|
+
|
|
60327
|
+
return wrap(fn);
|
|
60328
|
+
};
|
|
60329
|
+
|
|
60330
|
+
function check$a(fn) {
|
|
60331
|
+
if (typeof fn !== 'function')
|
|
60332
|
+
throw Error('fn should be a function!');
|
|
60333
|
+
}
|
|
60334
|
+
|
|
60335
|
+
var wraptile$1 = wraptile;
|
|
60336
|
+
|
|
60337
|
+
const {entries: entries$a} = Object;
|
|
60338
|
+
const {isArray: isArray$d} = Array;
|
|
60339
|
+
|
|
60340
|
+
var findPath = (parentPath) => {
|
|
60341
|
+
let current = {
|
|
60342
|
+
parentPath,
|
|
60343
|
+
};
|
|
60344
|
+
|
|
60345
|
+
const path = [];
|
|
60346
|
+
|
|
60347
|
+
while (current = current.parentPath) {
|
|
60348
|
+
path.unshift(findKey(current, current.parent));
|
|
60349
|
+
}
|
|
60350
|
+
|
|
60351
|
+
return path.join('.');
|
|
60352
|
+
};
|
|
60353
|
+
|
|
60354
|
+
function findKey(path, parent) {
|
|
60355
|
+
const {node} = path;
|
|
60356
|
+
let key;
|
|
60357
|
+
let value;
|
|
60358
|
+
|
|
60359
|
+
for ([key, value] of entries$a(parent)) {
|
|
60360
|
+
if (isArray$d(value)) {
|
|
60361
|
+
const index = value.indexOf(node);
|
|
60362
|
+
|
|
60363
|
+
if (index >= 0)
|
|
60364
|
+
return `${key}.${index}`;
|
|
60365
|
+
|
|
60366
|
+
continue;
|
|
60367
|
+
}
|
|
60368
|
+
|
|
60369
|
+
if (value === node)
|
|
60370
|
+
break;
|
|
60371
|
+
}
|
|
60372
|
+
|
|
60373
|
+
return key;
|
|
60374
|
+
}
|
|
60375
|
+
|
|
60376
|
+
const {isProgram: isProgram$2} = lib_exports;
|
|
60377
|
+
const hasWatermark = (watermark) => (path) => path.node?.[__watermark]?.has(watermark);
|
|
60378
|
+
|
|
60379
|
+
const __watermark = '__putout_runner_replace';
|
|
60380
|
+
|
|
60381
|
+
const watermark = (from, to, path) => {
|
|
60382
|
+
const {watermark, highWatermark} = create(from, to, path);
|
|
60383
|
+
const program = path.findParent(isProgram$2);
|
|
60384
|
+
const options = {
|
|
60385
|
+
watermark,
|
|
60386
|
+
highWatermark,
|
|
60387
|
+
program,
|
|
60388
|
+
path,
|
|
60389
|
+
};
|
|
60390
|
+
|
|
60391
|
+
return {
|
|
60392
|
+
init: wraptile$1(init, options),
|
|
60393
|
+
has: wraptile$1(has, options),
|
|
60394
|
+
add: wraptile$1(add, options),
|
|
60395
|
+
};
|
|
60396
|
+
};
|
|
60397
|
+
|
|
60398
|
+
function create(from, to, path) {
|
|
60399
|
+
const watermark = `${from} -> ${to}`;
|
|
60400
|
+
const highWatermark = `${findPath(path)}: ${watermark}`;
|
|
60401
|
+
|
|
60402
|
+
return {
|
|
60403
|
+
watermark,
|
|
60404
|
+
highWatermark,
|
|
60405
|
+
};
|
|
60406
|
+
}
|
|
60407
|
+
|
|
60408
|
+
function init({path, program}) {
|
|
60409
|
+
if (path.node)
|
|
60410
|
+
path.node[__watermark] = path.node[__watermark] || new Set();
|
|
60411
|
+
|
|
60412
|
+
program.node[__watermark] = program.node[__watermark] || new Set();
|
|
60413
|
+
}
|
|
60414
|
+
|
|
60415
|
+
function add({path, program, watermark, highWatermark}) {
|
|
60416
|
+
init({
|
|
60417
|
+
path,
|
|
60418
|
+
program,
|
|
60419
|
+
});
|
|
60420
|
+
|
|
60421
|
+
path?.node[__watermark].add(watermark);
|
|
60422
|
+
program.node[__watermark].add(highWatermark);
|
|
60423
|
+
}
|
|
60424
|
+
|
|
60425
|
+
const clearWatermark = (node) => {
|
|
60426
|
+
delete node?.[__watermark];
|
|
60427
|
+
};
|
|
60428
|
+
|
|
60429
|
+
function has({path, program, watermark, highWatermark}) {
|
|
60430
|
+
const {node} = path;
|
|
60431
|
+
const {loc} = node;
|
|
60432
|
+
|
|
60433
|
+
if (node?.[__watermark].has(watermark) || path.findParent(hasWatermark(watermark)) && !loc)
|
|
60434
|
+
return true;
|
|
60435
|
+
|
|
60436
|
+
return program.node[__watermark].has(highWatermark);
|
|
60437
|
+
}
|
|
60438
|
+
|
|
60194
60439
|
const {
|
|
60195
60440
|
nanomemoize = $cf838c15c8b009ba$export$22f15dd4e5be7e52,
|
|
60196
60441
|
} = $cf838c15c8b009ba$export$22f15dd4e5be7e52;
|
|
@@ -60233,7 +60478,7 @@ const template$1 = nanomemoize((value, options) => {
|
|
|
60233
60478
|
|
|
60234
60479
|
template$1.extractExpression = extractExpression$2;
|
|
60235
60480
|
|
|
60236
|
-
|
|
60481
|
+
const templateAst = nanomemoize((value, options) => {
|
|
60237
60482
|
const result = index.ast(value, {
|
|
60238
60483
|
...defaults,
|
|
60239
60484
|
...options,
|
|
@@ -60242,6 +60487,14 @@ template$1.ast = nanomemoize((value, options) => {
|
|
|
60242
60487
|
return extractExpression$2(result);
|
|
60243
60488
|
});
|
|
60244
60489
|
|
|
60490
|
+
template$1.ast = (...a) => {
|
|
60491
|
+
const node = templateAst(...a);
|
|
60492
|
+
|
|
60493
|
+
clearWatermark(node);
|
|
60494
|
+
|
|
60495
|
+
return templateAst(...a);
|
|
60496
|
+
};
|
|
60497
|
+
|
|
60245
60498
|
template$1.program = nanomemoize((value, options) => {
|
|
60246
60499
|
const result = index.program(value, {
|
|
60247
60500
|
...defaults,
|
|
@@ -60269,31 +60522,6 @@ template$1.ast.fresh = (value, options) => {
|
|
|
60269
60522
|
return extractExpression$2(result);
|
|
60270
60523
|
};
|
|
60271
60524
|
|
|
60272
|
-
const mergeShebang = (shebang, source) => {
|
|
60273
|
-
if (!shebang)
|
|
60274
|
-
return source;
|
|
60275
|
-
|
|
60276
|
-
return `${shebang}\n${source}`;
|
|
60277
|
-
};
|
|
60278
|
-
|
|
60279
|
-
const cutShebang = (source) => {
|
|
60280
|
-
if (source.indexOf('#'))
|
|
60281
|
-
return [source, ''];
|
|
60282
|
-
|
|
60283
|
-
const lines = source.split('\n');
|
|
60284
|
-
|
|
60285
|
-
const result = lines
|
|
60286
|
-
.slice(1)
|
|
60287
|
-
.join('\n');
|
|
60288
|
-
|
|
60289
|
-
const [shebang] = lines;
|
|
60290
|
-
|
|
60291
|
-
return [
|
|
60292
|
-
result,
|
|
60293
|
-
`${shebang}\n`,
|
|
60294
|
-
];
|
|
60295
|
-
};
|
|
60296
|
-
|
|
60297
60525
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
60298
60526
|
//
|
|
60299
60527
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -60530,7 +60758,7 @@ var substr = 'ab'.substr(-1) === 'b' ?
|
|
|
60530
60758
|
const isFn$5 = (a) => typeof a === 'function';
|
|
60531
60759
|
|
|
60532
60760
|
const tryToCatch = async (fn, ...args) => {
|
|
60533
|
-
check$
|
|
60761
|
+
check$9(fn);
|
|
60534
60762
|
|
|
60535
60763
|
try {
|
|
60536
60764
|
return [null, await fn(...args)];
|
|
@@ -60539,7 +60767,7 @@ const tryToCatch = async (fn, ...args) => {
|
|
|
60539
60767
|
}
|
|
60540
60768
|
};
|
|
60541
60769
|
|
|
60542
|
-
function check$
|
|
60770
|
+
function check$9(fn) {
|
|
60543
60771
|
if (!isFn$5(fn))
|
|
60544
60772
|
throw Error('fn should be a function!');
|
|
60545
60773
|
}
|
|
@@ -60657,8 +60885,8 @@ function buildPluginsDirs(name) {
|
|
|
60657
60885
|
}
|
|
60658
60886
|
|
|
60659
60887
|
const isStr$2 = (a) => typeof a === 'string';
|
|
60660
|
-
const {isArray: isArray$
|
|
60661
|
-
const {entries: entries$
|
|
60888
|
+
const {isArray: isArray$c} = Array;
|
|
60889
|
+
const {entries: entries$9} = Object;
|
|
60662
60890
|
|
|
60663
60891
|
const parsePluginNames = (plugins) => {
|
|
60664
60892
|
const result = [];
|
|
@@ -60669,23 +60897,23 @@ const parsePluginNames = (plugins) => {
|
|
|
60669
60897
|
continue;
|
|
60670
60898
|
}
|
|
60671
60899
|
|
|
60672
|
-
if (isArray$
|
|
60900
|
+
if (isArray$c(plugin)) {
|
|
60673
60901
|
const [pluginName, fn] = plugin;
|
|
60674
60902
|
result.push([pluginName, fn]);
|
|
60675
60903
|
continue;
|
|
60676
60904
|
}
|
|
60677
60905
|
|
|
60678
|
-
result.push(...entries$
|
|
60906
|
+
result.push(...entries$9(plugin));
|
|
60679
60907
|
}
|
|
60680
60908
|
|
|
60681
60909
|
return result;
|
|
60682
60910
|
};
|
|
60683
60911
|
|
|
60684
|
-
const {isArray: isArray$
|
|
60912
|
+
const {isArray: isArray$b} = Array;
|
|
60685
60913
|
const isBool$1 = (a) => typeof a === 'boolean';
|
|
60686
60914
|
const isStr$1 = (a) => typeof a === 'string';
|
|
60687
60915
|
const isObj = (a) => typeof a === 'object';
|
|
60688
|
-
const {entries: entries$
|
|
60916
|
+
const {entries: entries$8} = Object;
|
|
60689
60917
|
const {stringify: stringify$6} = JSON;
|
|
60690
60918
|
|
|
60691
60919
|
const notSupportedError = (a) => Error(`☝️ Rule format not supported ${a}: ${typeof a}`);
|
|
@@ -60710,9 +60938,9 @@ const parseRules = (rules) => {
|
|
|
60710
60938
|
const plugin = null;
|
|
60711
60939
|
const msg = '';
|
|
60712
60940
|
|
|
60713
|
-
check$
|
|
60941
|
+
check$8(rules);
|
|
60714
60942
|
|
|
60715
|
-
for (const [rule, value] of entries$
|
|
60943
|
+
for (const [rule, value] of entries$8(rules)) {
|
|
60716
60944
|
if (isStr$1(value)) {
|
|
60717
60945
|
result.push({
|
|
60718
60946
|
rule,
|
|
@@ -60735,7 +60963,7 @@ const parseRules = (rules) => {
|
|
|
60735
60963
|
continue;
|
|
60736
60964
|
}
|
|
60737
60965
|
|
|
60738
|
-
const looksLikeArray = isArray$
|
|
60966
|
+
const looksLikeArray = isArray$b(value);
|
|
60739
60967
|
const looksLikeNormalArray = looksLikeArray && value.length;
|
|
60740
60968
|
|
|
60741
60969
|
if (looksLikeNormalArray) {
|
|
@@ -60797,8 +61025,8 @@ function validateState(rule, value) {
|
|
|
60797
61025
|
});
|
|
60798
61026
|
}
|
|
60799
61027
|
|
|
60800
|
-
function check$
|
|
60801
|
-
if (isArray$
|
|
61028
|
+
function check$8(rules) {
|
|
61029
|
+
if (isArray$b(rules))
|
|
60802
61030
|
throw Error(`☝️Looks like type of 'rules' passed to @putout/engine-loader is 'array', expected: 'object'.`);
|
|
60803
61031
|
}
|
|
60804
61032
|
|
|
@@ -60903,22 +61131,26 @@ const getLoadedRules = (rules) => {
|
|
|
60903
61131
|
return loadedRules;
|
|
60904
61132
|
};
|
|
60905
61133
|
|
|
60906
|
-
const isString$
|
|
61134
|
+
const isString$8 = (a) => typeof a === 'string';
|
|
60907
61135
|
|
|
60908
|
-
const check$
|
|
61136
|
+
const check$7 = (options) => {
|
|
60909
61137
|
if (!options || typeof options !== 'object')
|
|
60910
61138
|
throw Error('options should be an object!');
|
|
60911
61139
|
};
|
|
60912
61140
|
|
|
60913
61141
|
const checkRule = (rule) => {
|
|
60914
|
-
if (!isString$
|
|
61142
|
+
if (!isString$8(rule))
|
|
60915
61143
|
throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`);
|
|
60916
61144
|
};
|
|
60917
61145
|
|
|
60918
61146
|
const validateRulesRelations = (options) => {
|
|
60919
|
-
check$
|
|
61147
|
+
check$7(options);
|
|
61148
|
+
|
|
61149
|
+
const {
|
|
61150
|
+
pluginNames = [],
|
|
61151
|
+
rules = {},
|
|
61152
|
+
} = options;
|
|
60920
61153
|
|
|
60921
|
-
const {pluginNames = [], rules = {}} = options;
|
|
60922
61154
|
const items = parsePluginNames(pluginNames);
|
|
60923
61155
|
|
|
60924
61156
|
validateRules({
|
|
@@ -60927,13 +61159,13 @@ const validateRulesRelations = (options) => {
|
|
|
60927
61159
|
});
|
|
60928
61160
|
};
|
|
60929
61161
|
|
|
60930
|
-
const {entries: entries$
|
|
61162
|
+
const {entries: entries$7, fromEntries} = Object;
|
|
60931
61163
|
const cut = (a) => a.split('/')[0];
|
|
60932
61164
|
|
|
60933
61165
|
const enableNestedRules = (rules) => {
|
|
60934
61166
|
const newRules = new Map();
|
|
60935
61167
|
|
|
60936
|
-
for (const [rule, value] of entries$
|
|
61168
|
+
for (const [rule, value] of entries$7(rules)) {
|
|
60937
61169
|
if (newRules.has(rule))
|
|
60938
61170
|
continue;
|
|
60939
61171
|
|
|
@@ -60982,8 +61214,8 @@ var validatePlugin = ({plugin, rule}) => {
|
|
|
60982
61214
|
throw Error(`☝️ Cannot determine type of plugin '${rule}'. Here is list of supported plugins: https://git.io/JqcMn`);
|
|
60983
61215
|
};
|
|
60984
61216
|
|
|
60985
|
-
const {isArray: isArray$
|
|
60986
|
-
const maybeTuple = (a) => isArray$
|
|
61217
|
+
const {isArray: isArray$a} = Array;
|
|
61218
|
+
const maybeTuple = (a) => isArray$a(a) ? a : ['on', a];
|
|
60987
61219
|
|
|
60988
61220
|
// Would be great to have ability to filter
|
|
60989
61221
|
// disabled plugins and prevent them from loading
|
|
@@ -61026,9 +61258,13 @@ function isExactRuleEnabled(name, status, rules) {
|
|
|
61026
61258
|
const loadPluginAsync = createAsyncLoader('plugin');
|
|
61027
61259
|
|
|
61028
61260
|
const loadPluginsAsync = async (options) => {
|
|
61029
|
-
check$
|
|
61261
|
+
check$7(options);
|
|
61262
|
+
|
|
61263
|
+
const {
|
|
61264
|
+
pluginNames = [],
|
|
61265
|
+
rules = {},
|
|
61266
|
+
} = options;
|
|
61030
61267
|
|
|
61031
|
-
const {pluginNames = [], rules = {}} = options;
|
|
61032
61268
|
const {
|
|
61033
61269
|
items,
|
|
61034
61270
|
loadedRules,
|
|
@@ -61118,12 +61354,16 @@ function parseRuleName(rule) {
|
|
|
61118
61354
|
return rule;
|
|
61119
61355
|
}
|
|
61120
61356
|
|
|
61121
|
-
const {isArray: isArray$
|
|
61357
|
+
const {isArray: isArray$9} = Array;
|
|
61122
61358
|
|
|
61123
61359
|
const loadPlugins = (options) => {
|
|
61124
|
-
check$
|
|
61360
|
+
check$7(options);
|
|
61361
|
+
|
|
61362
|
+
const {
|
|
61363
|
+
pluginNames = [],
|
|
61364
|
+
rules = {},
|
|
61365
|
+
} = options;
|
|
61125
61366
|
|
|
61126
|
-
const {pluginNames = [], rules = {}} = options;
|
|
61127
61367
|
const {
|
|
61128
61368
|
items,
|
|
61129
61369
|
loadedRules,
|
|
@@ -61150,16 +61390,17 @@ const parseRule = (rule) => rule
|
|
|
61150
61390
|
.replace('import:@putout/plugin-', '')
|
|
61151
61391
|
.replace('@putout/plugin-', '');
|
|
61152
61392
|
|
|
61153
|
-
const maybeFromTuple = (a) => isArray$
|
|
61393
|
+
const maybeFromTuple = (a) => isArray$9(a) ? a[1] : a;
|
|
61154
61394
|
|
|
61155
61395
|
function loadAllPlugins({items, loadedRules}) {
|
|
61156
61396
|
const plugins = [];
|
|
61157
61397
|
|
|
61158
61398
|
for (const [rule, itemPlugin] of items) {
|
|
61399
|
+
checkRule(rule);
|
|
61400
|
+
|
|
61159
61401
|
if (!isEnabled(rule, loadedRules))
|
|
61160
61402
|
continue;
|
|
61161
61403
|
|
|
61162
|
-
checkRule(rule);
|
|
61163
61404
|
const parsedRule = parseRule(rule);
|
|
61164
61405
|
|
|
61165
61406
|
const [name, namespace] = splitRule(rule);
|
|
@@ -61475,21 +61716,12 @@ const isFn$4 = (a) => typeof a === 'function';
|
|
|
61475
61716
|
const getPath$1 = (path) => path.path || path;
|
|
61476
61717
|
const debug$4 = createDebug$1('putout:runner:fix');
|
|
61477
61718
|
|
|
61478
|
-
const chooseFixArgs = ({path, pathOptions, options}) =>
|
|
61479
|
-
|
|
61480
|
-
|
|
61481
|
-
|
|
61482
|
-
|
|
61483
|
-
|
|
61484
|
-
},
|
|
61485
|
-
];
|
|
61486
|
-
|
|
61487
|
-
return [
|
|
61488
|
-
path, {
|
|
61489
|
-
options,
|
|
61490
|
-
},
|
|
61491
|
-
];
|
|
61492
|
-
};
|
|
61719
|
+
const chooseFixArgs = ({path, pathOptions, options}) => [
|
|
61720
|
+
path, {
|
|
61721
|
+
options,
|
|
61722
|
+
...pathOptions,
|
|
61723
|
+
},
|
|
61724
|
+
];
|
|
61493
61725
|
|
|
61494
61726
|
const tryToFix = (fix, {path, pathOptions, position, options}) => {
|
|
61495
61727
|
const [e] = tryCatch(fix, ...chooseFixArgs({
|
|
@@ -61538,7 +61770,7 @@ function validate$1(name, fn) {
|
|
|
61538
61770
|
|
|
61539
61771
|
const getPath = (item) => item.path || item[0] || item;
|
|
61540
61772
|
|
|
61541
|
-
const getPosition = (path
|
|
61773
|
+
const getPosition = (path) => {
|
|
61542
61774
|
const parsedPath = getPath(path);
|
|
61543
61775
|
|
|
61544
61776
|
validatePath(parsedPath);
|
|
@@ -61548,14 +61780,14 @@ const getPosition = (path, shebang) => {
|
|
|
61548
61780
|
|
|
61549
61781
|
if (!loc)
|
|
61550
61782
|
return {
|
|
61551
|
-
line:
|
|
61783
|
+
line: 1,
|
|
61552
61784
|
column: 1,
|
|
61553
61785
|
};
|
|
61554
61786
|
|
|
61555
61787
|
const {line, column} = node.loc.start;
|
|
61556
61788
|
|
|
61557
61789
|
return {
|
|
61558
|
-
line
|
|
61790
|
+
line,
|
|
61559
61791
|
column: column + 1,
|
|
61560
61792
|
};
|
|
61561
61793
|
};
|
|
@@ -61565,27 +61797,35 @@ function validatePath(path) {
|
|
|
61565
61797
|
throw Error(`☝️ Looks like 'push' called without a 'path' argument.`);
|
|
61566
61798
|
}
|
|
61567
61799
|
|
|
61568
|
-
const {isArray: isArray$
|
|
61569
|
-
const maybeArray$
|
|
61800
|
+
const {isArray: isArray$8} = Array;
|
|
61801
|
+
const maybeArray$3 = (a) => isArray$8(a) ? a : [a];
|
|
61570
61802
|
|
|
61571
|
-
var maybeArray$
|
|
61803
|
+
var maybeArray$4 = (a) => {
|
|
61572
61804
|
if (!a)
|
|
61573
61805
|
return [];
|
|
61574
61806
|
|
|
61575
|
-
return maybeArray$
|
|
61807
|
+
return maybeArray$3(a);
|
|
61576
61808
|
};
|
|
61577
61809
|
|
|
61578
61810
|
const isFn$3 = (a) => typeof a === 'function';
|
|
61579
61811
|
const {stringify: stringify$4} = JSON;
|
|
61812
|
+
const {isArray: isArray$7} = Array;
|
|
61580
61813
|
|
|
61581
61814
|
const validate = (name, fn) => {
|
|
61815
|
+
if (name === 'include-items') {
|
|
61816
|
+
if (!isArray$7(fn))
|
|
61817
|
+
throw Error(`☝️ Looks like 'include' does not return an 'array'. More on using Includer: https://git.io/JqcMn`);
|
|
61818
|
+
|
|
61819
|
+
return;
|
|
61820
|
+
}
|
|
61821
|
+
|
|
61582
61822
|
if (!isFn$3(fn))
|
|
61583
61823
|
throw Error(`☝️ Looks like '${name}' is not a 'function' but '${typeof fn}' with value: '${stringify$4(fn)}'. More on using Includer: https://git.io/JqcMn`);
|
|
61584
61824
|
};
|
|
61585
61825
|
|
|
61586
61826
|
const {
|
|
61587
61827
|
values,
|
|
61588
|
-
entries: entries$
|
|
61828
|
+
entries: entries$6,
|
|
61589
61829
|
assign: assign$2,
|
|
61590
61830
|
} = Object;
|
|
61591
61831
|
|
|
@@ -61644,7 +61884,7 @@ function createStore({set, get}) {
|
|
|
61644
61884
|
map = {};
|
|
61645
61885
|
};
|
|
61646
61886
|
|
|
61647
|
-
fn.entries = () => entries$
|
|
61887
|
+
fn.entries = () => entries$6(map);
|
|
61648
61888
|
|
|
61649
61889
|
return fn;
|
|
61650
61890
|
};
|
|
@@ -61680,16 +61920,16 @@ const parse$3 = (name, plugin, options) => {
|
|
|
61680
61920
|
|
|
61681
61921
|
if (plugin[name]) {
|
|
61682
61922
|
validate(name, plugin[name]);
|
|
61683
|
-
list.push(...maybeArray$
|
|
61923
|
+
list.push(...maybeArray$4(plugin[name]()));
|
|
61684
61924
|
}
|
|
61685
61925
|
|
|
61686
61926
|
if (options[name])
|
|
61687
|
-
list.push(...maybeArray$
|
|
61927
|
+
list.push(...maybeArray$4(options[name]));
|
|
61688
61928
|
|
|
61689
61929
|
return list;
|
|
61690
61930
|
};
|
|
61691
61931
|
|
|
61692
|
-
var mergeVisitors = (pluginsToMerge, {fix,
|
|
61932
|
+
var mergeVisitors = (pluginsToMerge, {fix, template}) => {
|
|
61693
61933
|
const mergeItems = [];
|
|
61694
61934
|
const pushed = {};
|
|
61695
61935
|
|
|
@@ -61705,7 +61945,6 @@ var mergeVisitors = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
61705
61945
|
} = getStore(plugin, {
|
|
61706
61946
|
fix,
|
|
61707
61947
|
rule,
|
|
61708
|
-
shebang,
|
|
61709
61948
|
msg,
|
|
61710
61949
|
options,
|
|
61711
61950
|
});
|
|
@@ -61748,7 +61987,7 @@ var mergeVisitors = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
61748
61987
|
};
|
|
61749
61988
|
};
|
|
61750
61989
|
|
|
61751
|
-
function getStore(plugin, {fix, rule,
|
|
61990
|
+
function getStore(plugin, {fix, rule, msg, options}) {
|
|
61752
61991
|
const store = mapStore();
|
|
61753
61992
|
const list = listStore();
|
|
61754
61993
|
const upstore = upStore();
|
|
@@ -61757,8 +61996,11 @@ function getStore(plugin, {fix, rule, shebang, msg, options}) {
|
|
|
61757
61996
|
const paths = pathStore();
|
|
61758
61997
|
|
|
61759
61998
|
const push = (path, pathOptions) => {
|
|
61760
|
-
const position = getPosition(path
|
|
61761
|
-
const message = msg || plugin.report(path,
|
|
61999
|
+
const position = getPosition(path);
|
|
62000
|
+
const message = msg || plugin.report(path, {
|
|
62001
|
+
options,
|
|
62002
|
+
...pathOptions,
|
|
62003
|
+
});
|
|
61762
62004
|
|
|
61763
62005
|
placesStore({
|
|
61764
62006
|
message,
|
|
@@ -61805,7 +62047,7 @@ function superFind({rule, find, ast, options, template, traverse = traverse3}) {
|
|
|
61805
62047
|
};
|
|
61806
62048
|
|
|
61807
62049
|
const returnItems = find(ast, {
|
|
61808
|
-
traverse: createTraverse$
|
|
62050
|
+
traverse: createTraverse$5({
|
|
61809
62051
|
rule,
|
|
61810
62052
|
options,
|
|
61811
62053
|
template,
|
|
@@ -61823,7 +62065,7 @@ function superFind({rule, find, ast, options, template, traverse = traverse3}) {
|
|
|
61823
62065
|
];
|
|
61824
62066
|
}
|
|
61825
62067
|
|
|
61826
|
-
const createTraverse$
|
|
62068
|
+
const createTraverse$5 = ({rule, options, template, traverse}) => (ast, visitor) => {
|
|
61827
62069
|
const templateVisitors = merge$1(template({
|
|
61828
62070
|
rule,
|
|
61829
62071
|
visitor,
|
|
@@ -61833,7 +62075,7 @@ const createTraverse$4 = ({rule, options, template, traverse}) => (ast, visitor)
|
|
|
61833
62075
|
return traverse(ast, templateVisitors);
|
|
61834
62076
|
};
|
|
61835
62077
|
|
|
61836
|
-
const isString$
|
|
62078
|
+
const isString$7 = (a) => typeof a === 'string';
|
|
61837
62079
|
const isUndefined = (a) => typeof a === 'undefined';
|
|
61838
62080
|
const isEmpty = (obj) => !Object.keys(obj).length;
|
|
61839
62081
|
|
|
@@ -61843,7 +62085,7 @@ function jessy(selector, divider, value) {
|
|
|
61843
62085
|
divider = '.';
|
|
61844
62086
|
}
|
|
61845
62087
|
|
|
61846
|
-
check$
|
|
62088
|
+
check$6(selector, value);
|
|
61847
62089
|
|
|
61848
62090
|
if (!selector)
|
|
61849
62091
|
return value;
|
|
@@ -61876,8 +62118,8 @@ function jessy(selector, divider, value) {
|
|
|
61876
62118
|
return value;
|
|
61877
62119
|
}
|
|
61878
62120
|
|
|
61879
|
-
function check$
|
|
61880
|
-
if (!isString$
|
|
62121
|
+
function check$6(selector, obj) {
|
|
62122
|
+
if (!isString$7(selector))
|
|
61881
62123
|
throw Error('selector should be string!');
|
|
61882
62124
|
|
|
61883
62125
|
if (typeof obj !== 'object')
|
|
@@ -61886,7 +62128,7 @@ function check$7(selector, obj) {
|
|
|
61886
62128
|
|
|
61887
62129
|
const isNumber$1 = (a) => !Number.isNaN(a) && typeof a === 'number';
|
|
61888
62130
|
const isNumberLike = (a, b = Number(a)) => isNumber$1(b);
|
|
61889
|
-
const isString$
|
|
62131
|
+
const isString$6 = (a) => typeof a === 'string';
|
|
61890
62132
|
const notSecure = (a) => /__proto__|prototype/.test(a);
|
|
61891
62133
|
|
|
61892
62134
|
function nessy(selector, value, divider, obj) {
|
|
@@ -61897,7 +62139,7 @@ function nessy(selector, value, divider, obj) {
|
|
|
61897
62139
|
|
|
61898
62140
|
const result = obj;
|
|
61899
62141
|
|
|
61900
|
-
check$
|
|
62142
|
+
check$5(selector);
|
|
61901
62143
|
|
|
61902
62144
|
const array = selector
|
|
61903
62145
|
.split(divider)
|
|
@@ -61922,8 +62164,8 @@ function nessy(selector, value, divider, obj) {
|
|
|
61922
62164
|
|
|
61923
62165
|
return result;
|
|
61924
62166
|
}
|
|
61925
|
-
function check$
|
|
61926
|
-
if (!isString$
|
|
62167
|
+
function check$5(selector) {
|
|
62168
|
+
if (!isString$6(selector))
|
|
61927
62169
|
throw Error('selector should be string!');
|
|
61928
62170
|
}
|
|
61929
62171
|
|
|
@@ -62001,14 +62243,14 @@ const isTemplate = (a) => /[(;={.\s]/.test(a) || !/^[A-Z]/.test(a);
|
|
|
62001
62243
|
|
|
62002
62244
|
const is = (str, array = ALL) => {
|
|
62003
62245
|
for (const item of array) {
|
|
62004
|
-
if (check$
|
|
62246
|
+
if (check$4(str, item))
|
|
62005
62247
|
return true;
|
|
62006
62248
|
}
|
|
62007
62249
|
|
|
62008
62250
|
return false;
|
|
62009
62251
|
};
|
|
62010
62252
|
|
|
62011
|
-
function check$
|
|
62253
|
+
function check$4(str, item) {
|
|
62012
62254
|
if (isStr(item))
|
|
62013
62255
|
return str === item;
|
|
62014
62256
|
|
|
@@ -62063,7 +62305,7 @@ const isBool = (a, b) => {
|
|
|
62063
62305
|
};
|
|
62064
62306
|
|
|
62065
62307
|
const isEqualType = (a, b) => a.type === b.type;
|
|
62066
|
-
const {isArray: isArray$
|
|
62308
|
+
const {isArray: isArray$6} = Array;
|
|
62067
62309
|
|
|
62068
62310
|
const isAny = (a) => {
|
|
62069
62311
|
if (isIdentifier$4(a, {name: ANY}))
|
|
@@ -62082,7 +62324,7 @@ const isAnyLiteral = (a, b) => {
|
|
|
62082
62324
|
};
|
|
62083
62325
|
|
|
62084
62326
|
const isArgs = (a) => {
|
|
62085
|
-
const b = !isArray$
|
|
62327
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62086
62328
|
|
|
62087
62329
|
return isIdentifier$4(b, {
|
|
62088
62330
|
name: ARGS,
|
|
@@ -62112,12 +62354,12 @@ const isEqualTypeParams = (a, b) => {
|
|
|
62112
62354
|
};
|
|
62113
62355
|
|
|
62114
62356
|
const isLinkedArgs = (a) => {
|
|
62115
|
-
const b = !isArray$
|
|
62357
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62116
62358
|
return isIdentifier$4(b) && LINKED_ARGS.test(b.name);
|
|
62117
62359
|
};
|
|
62118
62360
|
|
|
62119
62361
|
const isJSXChildren = (a) => {
|
|
62120
|
-
const b = !isArray$
|
|
62362
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62121
62363
|
|
|
62122
62364
|
return isJSXText$2(b, {
|
|
62123
62365
|
value: JSX_CHILDREN,
|
|
@@ -62125,7 +62367,7 @@ const isJSXChildren = (a) => {
|
|
|
62125
62367
|
};
|
|
62126
62368
|
|
|
62127
62369
|
const isJSXAttributes = (a) => {
|
|
62128
|
-
const b = !isArray$
|
|
62370
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62129
62371
|
|
|
62130
62372
|
if (!isJSXAttribute$1(b))
|
|
62131
62373
|
return false;
|
|
@@ -62162,21 +62404,21 @@ const isObject$4 = (a) => {
|
|
|
62162
62404
|
if (!a)
|
|
62163
62405
|
return false;
|
|
62164
62406
|
|
|
62165
|
-
if (isArray$
|
|
62407
|
+
if (isArray$6(a))
|
|
62166
62408
|
return false;
|
|
62167
62409
|
|
|
62168
62410
|
return typeof a === 'object';
|
|
62169
62411
|
};
|
|
62170
62412
|
|
|
62171
62413
|
const isArrays = (a, b) => {
|
|
62172
|
-
if (!isArray$
|
|
62414
|
+
if (!isArray$6(a) || !isArray$6(b))
|
|
62173
62415
|
return false;
|
|
62174
62416
|
|
|
62175
62417
|
return a.length === b.length;
|
|
62176
62418
|
};
|
|
62177
62419
|
|
|
62178
62420
|
const isImports = (a) => {
|
|
62179
|
-
const b = !isArray$
|
|
62421
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62180
62422
|
|
|
62181
62423
|
if (!isImportDefaultSpecifier(b))
|
|
62182
62424
|
return false;
|
|
@@ -62187,7 +62429,7 @@ const isImports = (a) => {
|
|
|
62187
62429
|
};
|
|
62188
62430
|
|
|
62189
62431
|
const isExports = (a) => {
|
|
62190
|
-
const b = !isArray$
|
|
62432
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
62191
62433
|
|
|
62192
62434
|
if (isExportSpecifier(b))
|
|
62193
62435
|
return isIdentifier$4(b.local, {
|
|
@@ -62309,15 +62551,15 @@ const {
|
|
|
62309
62551
|
|
|
62310
62552
|
const {extractExpression: extractExpression$1} = template$1;
|
|
62311
62553
|
|
|
62312
|
-
const {entries: entries$
|
|
62554
|
+
const {entries: entries$5} = Object;
|
|
62313
62555
|
const isNumber = (a) => typeof a === 'number';
|
|
62314
|
-
const isString$
|
|
62556
|
+
const isString$5 = (a) => typeof a === 'string';
|
|
62315
62557
|
|
|
62316
62558
|
const parseNode$1 = (a) => a.node || a;
|
|
62317
62559
|
const {stringify: stringify$3} = JSON;
|
|
62318
62560
|
|
|
62319
62561
|
const getTemplateValues = (node, str) => {
|
|
62320
|
-
if (!isString$
|
|
62562
|
+
if (!isString$5(str))
|
|
62321
62563
|
throw Error(`☝️ Looks like argument 'template' of 'getTemplateValues(node, template)': is not a string, but '${stringify$3(str)}'`);
|
|
62322
62564
|
|
|
62323
62565
|
node = parseNode$1(node);
|
|
@@ -62394,7 +62636,7 @@ function findVarsWays(node) {
|
|
|
62394
62636
|
function getValues({waysFrom, node}) {
|
|
62395
62637
|
const result = {};
|
|
62396
62638
|
|
|
62397
|
-
for (const [name, ways] of entries$
|
|
62639
|
+
for (const [name, ways] of entries$5(waysFrom)) {
|
|
62398
62640
|
for (let way of ways) {
|
|
62399
62641
|
if (isImportsStr(name))
|
|
62400
62642
|
way = way.replace(/\.0.local$/, '');
|
|
@@ -62421,7 +62663,7 @@ const makeRaw = (a) => a.replace('`', '\\`');
|
|
|
62421
62663
|
function setValues({waysTo, values, path}) {
|
|
62422
62664
|
const node = extractExpression$1(path.node);
|
|
62423
62665
|
|
|
62424
|
-
for (const [name, ways] of entries$
|
|
62666
|
+
for (const [name, ways] of entries$5(waysTo)) {
|
|
62425
62667
|
for (let way of ways) {
|
|
62426
62668
|
if (!way) {
|
|
62427
62669
|
replaceWith(path, values[name]);
|
|
@@ -62488,7 +62730,7 @@ const createDebug = (namespace) => {
|
|
|
62488
62730
|
|
|
62489
62731
|
const debug$3 = createDebug('putout:compare');
|
|
62490
62732
|
|
|
62491
|
-
const {isArray: isArray$
|
|
62733
|
+
const {isArray: isArray$5} = Array;
|
|
62492
62734
|
const isObject$3 = (a) => a && typeof a === 'object';
|
|
62493
62735
|
|
|
62494
62736
|
var log$4 = (a, b) => {
|
|
@@ -62502,7 +62744,7 @@ var log$4 = (a, b) => {
|
|
|
62502
62744
|
};
|
|
62503
62745
|
|
|
62504
62746
|
function parseValue(a) {
|
|
62505
|
-
if (isArray$
|
|
62747
|
+
if (isArray$5(a) && a[0]) {
|
|
62506
62748
|
const [{
|
|
62507
62749
|
type,
|
|
62508
62750
|
name,
|
|
@@ -62772,13 +63014,13 @@ const {extractExpression} = template$1;
|
|
|
62772
63014
|
const addWaterMark = (a) => a;
|
|
62773
63015
|
|
|
62774
63016
|
const {keys: keys$2} = Object;
|
|
62775
|
-
const {isArray: isArray$
|
|
63017
|
+
const {isArray: isArray$4} = Array;
|
|
62776
63018
|
const noop$1 = () => {};
|
|
62777
|
-
const isEmptyArray = (a) => isArray$
|
|
63019
|
+
const isEmptyArray = (a) => isArray$4(a) && !a.length;
|
|
62778
63020
|
|
|
62779
63021
|
const compareType = (type) => (path) => path.type === type;
|
|
62780
63022
|
const superPush = (array) => (a, b, c = {}) => array.push([a, b, c]);
|
|
62781
|
-
const maybeArray$
|
|
63023
|
+
const maybeArray$2 = (a) => isArray$4(a) ? a : [a];
|
|
62782
63024
|
|
|
62783
63025
|
const findParent = (path, type) => {
|
|
62784
63026
|
const newPathNode = path.findParent(compareType(type));
|
|
@@ -62836,7 +63078,7 @@ function compare(path, template, options = {}, equal = noop$1) {
|
|
|
62836
63078
|
}
|
|
62837
63079
|
|
|
62838
63080
|
const compareAny = (path, templateNodes, options) => {
|
|
62839
|
-
templateNodes = maybeArray$
|
|
63081
|
+
templateNodes = maybeArray$2(templateNodes);
|
|
62840
63082
|
|
|
62841
63083
|
for (const template of templateNodes) {
|
|
62842
63084
|
if (compare(path, template, options))
|
|
@@ -62847,7 +63089,7 @@ const compareAny = (path, templateNodes, options) => {
|
|
|
62847
63089
|
};
|
|
62848
63090
|
|
|
62849
63091
|
const compareAll = (path, templateNodes, options) => {
|
|
62850
|
-
templateNodes = maybeArray$
|
|
63092
|
+
templateNodes = maybeArray$2(templateNodes);
|
|
62851
63093
|
|
|
62852
63094
|
for (const template of templateNodes) {
|
|
62853
63095
|
if (!compare(path, template, options))
|
|
@@ -62914,7 +63156,7 @@ function superCompareIterate(node, template) {
|
|
|
62914
63156
|
|
|
62915
63157
|
const debug$2 = createDebug$1('putout:runner:template');
|
|
62916
63158
|
|
|
62917
|
-
const {entries: entries$
|
|
63159
|
+
const {entries: entries$4} = Object;
|
|
62918
63160
|
const isFn$2 = (a) => typeof a === 'function';
|
|
62919
63161
|
|
|
62920
63162
|
const log$3 = (rule, path) => {
|
|
@@ -62943,10 +63185,10 @@ const exclude = ({rule, tmpl, fn, nodesExclude}) => {
|
|
|
62943
63185
|
|
|
62944
63186
|
var template = ({rule, visitor, options}) => {
|
|
62945
63187
|
const parsed = [];
|
|
62946
|
-
const nodesExclude = maybeArray$
|
|
62947
|
-
const nodesInclude = maybeArray$
|
|
63188
|
+
const nodesExclude = maybeArray$4(options.exclude);
|
|
63189
|
+
const nodesInclude = maybeArray$4(options.include);
|
|
62948
63190
|
|
|
62949
|
-
for (const [tmpl, fn] of entries$
|
|
63191
|
+
for (const [tmpl, fn] of entries$4(visitor)) {
|
|
62950
63192
|
if (!tmpl)
|
|
62951
63193
|
continue;
|
|
62952
63194
|
|
|
@@ -63553,6 +63795,10 @@ const include$1 = ({rule, plugin, msg, options}) => {
|
|
|
63553
63795
|
validate('include', include);
|
|
63554
63796
|
validate('report', report);
|
|
63555
63797
|
|
|
63798
|
+
const includeItems = include();
|
|
63799
|
+
|
|
63800
|
+
validate('include-items', includeItems);
|
|
63801
|
+
|
|
63556
63802
|
const traverse = getTraverse(include(), filter, rule);
|
|
63557
63803
|
|
|
63558
63804
|
return {
|
|
@@ -63562,7 +63808,7 @@ const include$1 = ({rule, plugin, msg, options}) => {
|
|
|
63562
63808
|
...options,
|
|
63563
63809
|
exclude: [
|
|
63564
63810
|
...exclude(),
|
|
63565
|
-
...maybeArray$
|
|
63811
|
+
...maybeArray$4(options.exclude),
|
|
63566
63812
|
],
|
|
63567
63813
|
},
|
|
63568
63814
|
plugin: {
|
|
@@ -63597,123 +63843,6 @@ const getTraverse = (include, filter, rule) => ({push, options}) => {
|
|
|
63597
63843
|
return result;
|
|
63598
63844
|
};
|
|
63599
63845
|
|
|
63600
|
-
const wrap = (fn) => (...a) => (...b) => fn(...a, ...b);
|
|
63601
|
-
|
|
63602
|
-
var wraptile = (fn, ...a) => {
|
|
63603
|
-
check$4(fn);
|
|
63604
|
-
|
|
63605
|
-
if (a.length)
|
|
63606
|
-
return wrap(fn)(...a);
|
|
63607
|
-
|
|
63608
|
-
return wrap(fn);
|
|
63609
|
-
};
|
|
63610
|
-
|
|
63611
|
-
function check$4(fn) {
|
|
63612
|
-
if (typeof fn !== 'function')
|
|
63613
|
-
throw Error('fn should be a function!');
|
|
63614
|
-
}
|
|
63615
|
-
|
|
63616
|
-
var wraptile$1 = wraptile;
|
|
63617
|
-
|
|
63618
|
-
const {entries: entries$4} = Object;
|
|
63619
|
-
const {isArray: isArray$2} = Array;
|
|
63620
|
-
|
|
63621
|
-
var findPath = (parentPath) => {
|
|
63622
|
-
let current = {
|
|
63623
|
-
parentPath,
|
|
63624
|
-
};
|
|
63625
|
-
|
|
63626
|
-
const path = [];
|
|
63627
|
-
|
|
63628
|
-
while (current = current.parentPath) {
|
|
63629
|
-
path.unshift(findKey(current, current.parent));
|
|
63630
|
-
}
|
|
63631
|
-
|
|
63632
|
-
return path.join('.');
|
|
63633
|
-
};
|
|
63634
|
-
|
|
63635
|
-
function findKey(path, parent) {
|
|
63636
|
-
const {node} = path;
|
|
63637
|
-
let key;
|
|
63638
|
-
let value;
|
|
63639
|
-
|
|
63640
|
-
for ([key, value] of entries$4(parent)) {
|
|
63641
|
-
if (isArray$2(value)) {
|
|
63642
|
-
const index = value.indexOf(node);
|
|
63643
|
-
|
|
63644
|
-
if (index >= 0)
|
|
63645
|
-
return `${key}.${index}`;
|
|
63646
|
-
|
|
63647
|
-
continue;
|
|
63648
|
-
}
|
|
63649
|
-
|
|
63650
|
-
if (value === node)
|
|
63651
|
-
break;
|
|
63652
|
-
}
|
|
63653
|
-
|
|
63654
|
-
return key;
|
|
63655
|
-
}
|
|
63656
|
-
|
|
63657
|
-
const {isProgram: isProgram$2} = lib_exports;
|
|
63658
|
-
const name = '__putout_runner_replace';
|
|
63659
|
-
const hasWatermark = (watermark) => (path) => path.node?.[name]?.has(watermark);
|
|
63660
|
-
|
|
63661
|
-
const watermark = (from, to, path) => {
|
|
63662
|
-
const {watermark, highWatermark} = create(from, to, path);
|
|
63663
|
-
const program = path.findParent(isProgram$2);
|
|
63664
|
-
const options = {
|
|
63665
|
-
watermark,
|
|
63666
|
-
highWatermark,
|
|
63667
|
-
program,
|
|
63668
|
-
path,
|
|
63669
|
-
};
|
|
63670
|
-
|
|
63671
|
-
return {
|
|
63672
|
-
init: wraptile$1(init, options),
|
|
63673
|
-
has: wraptile$1(has, options),
|
|
63674
|
-
add: wraptile$1(add, options),
|
|
63675
|
-
};
|
|
63676
|
-
};
|
|
63677
|
-
|
|
63678
|
-
const REPLACE_WATERMARK = name;
|
|
63679
|
-
|
|
63680
|
-
function create(from, to, path) {
|
|
63681
|
-
const watermark = `${from} -> ${to}`;
|
|
63682
|
-
const highWatermark = `${findPath(path)}: ${watermark}`;
|
|
63683
|
-
|
|
63684
|
-
return {
|
|
63685
|
-
watermark,
|
|
63686
|
-
highWatermark,
|
|
63687
|
-
};
|
|
63688
|
-
}
|
|
63689
|
-
|
|
63690
|
-
function init({path, program}) {
|
|
63691
|
-
if (path.node)
|
|
63692
|
-
path.node[name] = path.node[name] || new Set();
|
|
63693
|
-
|
|
63694
|
-
program.node[name] = program.node[name] || new Set();
|
|
63695
|
-
}
|
|
63696
|
-
|
|
63697
|
-
function add({path, program, watermark, highWatermark}) {
|
|
63698
|
-
init({
|
|
63699
|
-
path,
|
|
63700
|
-
program,
|
|
63701
|
-
});
|
|
63702
|
-
|
|
63703
|
-
path?.node[name].add(watermark);
|
|
63704
|
-
program.node[name].add(highWatermark);
|
|
63705
|
-
}
|
|
63706
|
-
|
|
63707
|
-
function has({path, program, watermark, highWatermark}) {
|
|
63708
|
-
const {node} = path;
|
|
63709
|
-
const {loc} = node;
|
|
63710
|
-
|
|
63711
|
-
if (node?.[name].has(watermark) || path.findParent(hasWatermark(watermark)) && !loc)
|
|
63712
|
-
return true;
|
|
63713
|
-
|
|
63714
|
-
return program.node[name].has(highWatermark);
|
|
63715
|
-
}
|
|
63716
|
-
|
|
63717
63846
|
const debug$1 = createDebug$1('putout:runner:replace');
|
|
63718
63847
|
|
|
63719
63848
|
const log$1 = (from, path) => {
|
|
@@ -63737,7 +63866,7 @@ const PRINT_OPTIONS = {
|
|
|
63737
63866
|
}],
|
|
63738
63867
|
};
|
|
63739
63868
|
|
|
63740
|
-
const isString$
|
|
63869
|
+
const isString$4 = (a) => typeof a === 'string';
|
|
63741
63870
|
|
|
63742
63871
|
const {keys: keys$1, entries: entries$3} = Object;
|
|
63743
63872
|
const {stringify: stringify$1} = JSON;
|
|
@@ -63774,7 +63903,7 @@ const replace = ({rule, plugin, msg, options}) => {
|
|
|
63774
63903
|
...options,
|
|
63775
63904
|
exclude: [
|
|
63776
63905
|
...exclude(),
|
|
63777
|
-
...maybeArray$
|
|
63906
|
+
...maybeArray$4(options.exclude),
|
|
63778
63907
|
],
|
|
63779
63908
|
},
|
|
63780
63909
|
plugin: {
|
|
@@ -63786,10 +63915,6 @@ const replace = ({rule, plugin, msg, options}) => {
|
|
|
63786
63915
|
};
|
|
63787
63916
|
};
|
|
63788
63917
|
|
|
63789
|
-
const clearWatermark = (ast) => {
|
|
63790
|
-
delete ast.program[REPLACE_WATERMARK];
|
|
63791
|
-
};
|
|
63792
|
-
|
|
63793
63918
|
const isFn$1 = (a) => typeof a === 'function';
|
|
63794
63919
|
|
|
63795
63920
|
const parseExpression = (nodeFrom, {node}) => {
|
|
@@ -63799,7 +63924,7 @@ const parseExpression = (nodeFrom, {node}) => {
|
|
|
63799
63924
|
return node;
|
|
63800
63925
|
};
|
|
63801
63926
|
|
|
63802
|
-
const fix$
|
|
63927
|
+
const fix$b = (from, to, path) => {
|
|
63803
63928
|
const nodeFrom = template$1.ast(from);
|
|
63804
63929
|
const mark = watermark(from, to, path);
|
|
63805
63930
|
|
|
@@ -63854,7 +63979,7 @@ const getFix = (items, match) => (path) => {
|
|
|
63854
63979
|
const matchFn = match[from];
|
|
63855
63980
|
|
|
63856
63981
|
if (!matchFn || runMatch(path, nodeFrom, matchFn))
|
|
63857
|
-
fix$
|
|
63982
|
+
fix$b(from, to, path);
|
|
63858
63983
|
}
|
|
63859
63984
|
}
|
|
63860
63985
|
};
|
|
@@ -63899,7 +64024,7 @@ function parseTo(to, values, path) {
|
|
|
63899
64024
|
return toStr;
|
|
63900
64025
|
}
|
|
63901
64026
|
|
|
63902
|
-
if (!isString$
|
|
64027
|
+
if (!isString$4(toStr))
|
|
63903
64028
|
throw Error(`☝️ Looks like you passed 'replace' value with a wrong type. Allowed: 'string', 'node' and 'path'. Received: '${typeof toStr}' with value '${toStr}'.`);
|
|
63904
64029
|
|
|
63905
64030
|
return template$1.ast.fresh(toStr);
|
|
@@ -63971,7 +64096,7 @@ const {
|
|
|
63971
64096
|
} = lib_exports;
|
|
63972
64097
|
|
|
63973
64098
|
const {keys} = Object;
|
|
63974
|
-
const isString$
|
|
64099
|
+
const isString$3 = (a) => typeof a === 'string';
|
|
63975
64100
|
|
|
63976
64101
|
const getLastVarPath = (bodyPath) => bodyPath
|
|
63977
64102
|
.filter(isVariableDeclaration)
|
|
@@ -63997,13 +64122,13 @@ const TS_EXCLUDE = [
|
|
|
63997
64122
|
];
|
|
63998
64123
|
|
|
63999
64124
|
const declare$1 = (declarations) => ({
|
|
64000
|
-
report: report$
|
|
64125
|
+
report: report$6,
|
|
64001
64126
|
include,
|
|
64002
|
-
fix: fix$
|
|
64127
|
+
fix: fix$a(declarations),
|
|
64003
64128
|
filter: filter(declarations),
|
|
64004
64129
|
});
|
|
64005
64130
|
|
|
64006
|
-
const report$
|
|
64131
|
+
const report$6 = (path) => {
|
|
64007
64132
|
const {name} = path.node;
|
|
64008
64133
|
const peaceOfName = cutName(name);
|
|
64009
64134
|
|
|
@@ -64043,7 +64168,7 @@ const filter = (declarations) => (path, {options}) => {
|
|
|
64043
64168
|
return parseCode(type, allDeclarations[name]);
|
|
64044
64169
|
};
|
|
64045
64170
|
|
|
64046
|
-
const fix$
|
|
64171
|
+
const fix$a = (declarations) => (path, {options}) => {
|
|
64047
64172
|
const type = getModuleType(path);
|
|
64048
64173
|
|
|
64049
64174
|
const allDeclarations = {
|
|
@@ -64065,7 +64190,7 @@ const fix$8 = (declarations) => (path, {options}) => {
|
|
|
64065
64190
|
};
|
|
64066
64191
|
|
|
64067
64192
|
const parseCode = (type, current) => {
|
|
64068
|
-
if (isString$
|
|
64193
|
+
if (isString$3(current))
|
|
64069
64194
|
return current;
|
|
64070
64195
|
|
|
64071
64196
|
return current[type];
|
|
@@ -64226,7 +64351,7 @@ const {entries: entries$2} = Object;
|
|
|
64226
64351
|
|
|
64227
64352
|
const isPath = (path) => Boolean(path.node);
|
|
64228
64353
|
|
|
64229
|
-
const createTraverse$
|
|
64354
|
+
const createTraverse$4 = (path) => {
|
|
64230
64355
|
if (isPath(path))
|
|
64231
64356
|
return path.traverse.bind(path);
|
|
64232
64357
|
|
|
@@ -64243,7 +64368,7 @@ const createTraverse$3 = (path) => {
|
|
|
64243
64368
|
const getTemplate = ([a]) => a;
|
|
64244
64369
|
|
|
64245
64370
|
function traverse$3(basePath, visitor) {
|
|
64246
|
-
const traverse = createTraverse$
|
|
64371
|
+
const traverse = createTraverse$4(basePath);
|
|
64247
64372
|
const items = [];
|
|
64248
64373
|
const parsedVisitors = entries$2(visitor);
|
|
64249
64374
|
|
|
@@ -64351,9 +64476,12 @@ const {
|
|
|
64351
64476
|
objectExpression: objectExpression$1,
|
|
64352
64477
|
} = lib_exports;
|
|
64353
64478
|
|
|
64354
|
-
const isString$
|
|
64355
|
-
const
|
|
64356
|
-
const
|
|
64479
|
+
const isString$2 = (a) => typeof a === 'string';
|
|
64480
|
+
const isSet = (a) => a instanceof Set;
|
|
64481
|
+
const {isArray: isArray$3} = Array;
|
|
64482
|
+
|
|
64483
|
+
const maybeArray$1 = (a) => isArray$3(a) ? a : [a];
|
|
64484
|
+
const maybeArrayFrom = (a) => isSet(a) ? Array.from(a) : maybeArray$1(a);
|
|
64357
64485
|
|
|
64358
64486
|
const escape = (a) => encodeURIComponent(a).replaceAll('%', '+');
|
|
64359
64487
|
const unescape = (a) => decodeURIComponent(a.replaceAll('+', '%'));
|
|
@@ -64421,7 +64549,7 @@ function parseFindFileOptions(options) {
|
|
|
64421
64549
|
excluded: [],
|
|
64422
64550
|
};
|
|
64423
64551
|
|
|
64424
|
-
if (isArray$
|
|
64552
|
+
if (isArray$3(options))
|
|
64425
64553
|
return {
|
|
64426
64554
|
exclude: options,
|
|
64427
64555
|
};
|
|
@@ -64437,8 +64565,8 @@ function findFile(node, name, options) {
|
|
|
64437
64565
|
|
|
64438
64566
|
checkName(name);
|
|
64439
64567
|
|
|
64440
|
-
const filePaths =
|
|
64441
|
-
const names =
|
|
64568
|
+
const filePaths = new Set();
|
|
64569
|
+
const names = maybeArrayFrom(name);
|
|
64442
64570
|
|
|
64443
64571
|
for (const filenamePath of crawled) {
|
|
64444
64572
|
const {value} = filenamePath.node.value;
|
|
@@ -64456,17 +64584,17 @@ function findFile(node, name, options) {
|
|
|
64456
64584
|
if (excluded)
|
|
64457
64585
|
continue;
|
|
64458
64586
|
|
|
64459
|
-
filePaths.
|
|
64587
|
+
filePaths.add(path);
|
|
64460
64588
|
}
|
|
64461
64589
|
}
|
|
64462
64590
|
}
|
|
64463
64591
|
|
|
64464
|
-
return filePaths;
|
|
64592
|
+
return Array.from(filePaths);
|
|
64465
64593
|
}
|
|
64466
64594
|
|
|
64467
64595
|
function checkName(name) {
|
|
64468
|
-
if (!isString$
|
|
64469
|
-
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`);
|
|
64596
|
+
if (!isString$2(name) && !isArray$3(name) && !isSet(name))
|
|
64597
|
+
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[] | Set<string>): FilePath'`);
|
|
64470
64598
|
}
|
|
64471
64599
|
|
|
64472
64600
|
function getFilenamePath(filePath) {
|
|
@@ -64494,7 +64622,7 @@ function getFileContent(filePath) {
|
|
|
64494
64622
|
}
|
|
64495
64623
|
|
|
64496
64624
|
function checkRenameFileName(name) {
|
|
64497
|
-
if (!isString$
|
|
64625
|
+
if (!isString$2(name))
|
|
64498
64626
|
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'renameFile(filePath: FilePath, name: string)'`);
|
|
64499
64627
|
}
|
|
64500
64628
|
|
|
@@ -64639,7 +64767,7 @@ const createFile = (dirPath, name, content) => {
|
|
|
64639
64767
|
|
|
64640
64768
|
const filePath = dirPathFiles.get('value.elements').at(-1);
|
|
64641
64769
|
|
|
64642
|
-
if (isString$
|
|
64770
|
+
if (isString$2(content))
|
|
64643
64771
|
writeFileContent(filePath, content);
|
|
64644
64772
|
|
|
64645
64773
|
return filePath;
|
|
@@ -64793,7 +64921,7 @@ function getRootDirectory(path) {
|
|
|
64793
64921
|
}
|
|
64794
64922
|
|
|
64795
64923
|
function getFile(directoryPath, name, {type} = {}) {
|
|
64796
|
-
const names = maybeArray(name);
|
|
64924
|
+
const names = maybeArray$1(name);
|
|
64797
64925
|
const files = new Map();
|
|
64798
64926
|
let count = 0;
|
|
64799
64927
|
|
|
@@ -64825,7 +64953,7 @@ const {
|
|
|
64825
64953
|
objectExpression,
|
|
64826
64954
|
arrayExpression: arrayExpression$1,
|
|
64827
64955
|
stringLiteral: stringLiteral$4,
|
|
64828
|
-
isArrayExpression,
|
|
64956
|
+
isArrayExpression: isArrayExpression$1,
|
|
64829
64957
|
isStringLiteral,
|
|
64830
64958
|
isTemplateLiteral,
|
|
64831
64959
|
objectProperty: objectProperty$1,
|
|
@@ -64863,7 +64991,7 @@ function parseContent(node, path) {
|
|
|
64863
64991
|
throw Error(`☝️ Looks like wrong content type: '${node.type}' from file: '${path}'`);
|
|
64864
64992
|
}
|
|
64865
64993
|
|
|
64866
|
-
const fix$
|
|
64994
|
+
const fix$9 = (path) => {
|
|
64867
64995
|
const array = arrayExpression$1([]);
|
|
64868
64996
|
|
|
64869
64997
|
for (const element of path.get('elements')) {
|
|
@@ -64953,7 +65081,7 @@ function buildTree(path, list) {
|
|
|
64953
65081
|
}
|
|
64954
65082
|
|
|
64955
65083
|
const isTwoElementsTuple = (a) => {
|
|
64956
|
-
if (!isArrayExpression(a))
|
|
65084
|
+
if (!isArrayExpression$1(a))
|
|
64957
65085
|
return false;
|
|
64958
65086
|
|
|
64959
65087
|
const {elements} = a.node;
|
|
@@ -64962,7 +65090,7 @@ const isTwoElementsTuple = (a) => {
|
|
|
64962
65090
|
};
|
|
64963
65091
|
|
|
64964
65092
|
const isOneElementTuple = (a) => {
|
|
64965
|
-
if (!isArrayExpression(a))
|
|
65093
|
+
if (!isArrayExpression$1(a))
|
|
64966
65094
|
return false;
|
|
64967
65095
|
|
|
64968
65096
|
const {elements} = a.node;
|
|
@@ -64976,9 +65104,9 @@ function check$3(filename) {
|
|
|
64976
65104
|
}
|
|
64977
65105
|
|
|
64978
65106
|
var fromSimple = /*#__PURE__*/Object.freeze({
|
|
64979
|
-
|
|
64980
|
-
|
|
64981
|
-
|
|
65107
|
+
__proto__: null,
|
|
65108
|
+
fix: fix$9,
|
|
65109
|
+
traverse: traverse$2
|
|
64982
65110
|
});
|
|
64983
65111
|
|
|
64984
65112
|
const {
|
|
@@ -64986,10 +65114,10 @@ const {
|
|
|
64986
65114
|
arrayExpression,
|
|
64987
65115
|
} = lib_exports;
|
|
64988
65116
|
|
|
64989
|
-
const {isArray} = Array;
|
|
65117
|
+
const {isArray: isArray$2} = Array;
|
|
64990
65118
|
const maybeAddSlash = (a) => a === '/' ? a : `${a}/`;
|
|
64991
65119
|
|
|
64992
|
-
const fix$
|
|
65120
|
+
const fix$8 = (root, {files}) => {
|
|
64993
65121
|
const names = [];
|
|
64994
65122
|
|
|
64995
65123
|
for (const file of files) {
|
|
@@ -65014,7 +65142,7 @@ const fix$6 = (root, {files}) => {
|
|
|
65014
65142
|
const list = [];
|
|
65015
65143
|
|
|
65016
65144
|
for (const name of names) {
|
|
65017
|
-
if (isArray(name)) {
|
|
65145
|
+
if (isArray$2(name)) {
|
|
65018
65146
|
list.push(arrayExpression([
|
|
65019
65147
|
stringLiteral$3(name[0]),
|
|
65020
65148
|
stringLiteral$3(name[1]),
|
|
@@ -65040,9 +65168,9 @@ const traverse$1 = ({push}) => ({
|
|
|
65040
65168
|
});
|
|
65041
65169
|
|
|
65042
65170
|
var toSimple = /*#__PURE__*/Object.freeze({
|
|
65043
|
-
|
|
65044
|
-
|
|
65045
|
-
|
|
65171
|
+
__proto__: null,
|
|
65172
|
+
fix: fix$8,
|
|
65173
|
+
traverse: traverse$1
|
|
65046
65174
|
});
|
|
65047
65175
|
|
|
65048
65176
|
const log = createDebug$1('putout:runner:scanner');
|
|
@@ -65056,7 +65184,7 @@ const scan$2 = ({rule, plugin, msg, options}, {progress}) => {
|
|
|
65056
65184
|
|
|
65057
65185
|
progress.inc();
|
|
65058
65186
|
|
|
65059
|
-
const traverse = createTraverse$
|
|
65187
|
+
const traverse = createTraverse$3({
|
|
65060
65188
|
scan,
|
|
65061
65189
|
rule,
|
|
65062
65190
|
progress,
|
|
@@ -65113,7 +65241,7 @@ const createTrackFile = ({fileProgress, crawled}) => function*(...a) {
|
|
|
65113
65241
|
}
|
|
65114
65242
|
};
|
|
65115
65243
|
|
|
65116
|
-
const createTraverse$
|
|
65244
|
+
const createTraverse$3 = ({scan, rule, progress}) => ({push, options}) => ({
|
|
65117
65245
|
[`${__filesystem_name}(__)`](path) {
|
|
65118
65246
|
log(rule);
|
|
65119
65247
|
progress.start(rule);
|
|
@@ -65211,7 +65339,7 @@ function parseVisitor(visitors) {
|
|
|
65211
65339
|
const debug = createDebug$1('putout:runner:find');
|
|
65212
65340
|
const isRemoved = (a) => a?.removed;
|
|
65213
65341
|
|
|
65214
|
-
const runPlugins = ({ast,
|
|
65342
|
+
const runPlugins = ({ast, fix, fixCount = 2, plugins, progress = createProgress(), traverse = traverse3}) => {
|
|
65215
65343
|
let places = [];
|
|
65216
65344
|
|
|
65217
65345
|
const merge = onceExports(mergeVisitors);
|
|
@@ -65226,7 +65354,6 @@ const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress = create
|
|
|
65226
65354
|
places = run({
|
|
65227
65355
|
ast,
|
|
65228
65356
|
fix,
|
|
65229
|
-
shebang,
|
|
65230
65357
|
pluginsFind,
|
|
65231
65358
|
pluginsTraverse,
|
|
65232
65359
|
merge,
|
|
@@ -65239,17 +65366,18 @@ const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress = create
|
|
|
65239
65366
|
if (!fix || !places.length)
|
|
65240
65367
|
return places;
|
|
65241
65368
|
|
|
65242
|
-
|
|
65369
|
+
const {program} = ast;
|
|
65370
|
+
|
|
65371
|
+
clearWatermark(program);
|
|
65243
65372
|
}
|
|
65244
65373
|
|
|
65245
65374
|
return places;
|
|
65246
65375
|
};
|
|
65247
65376
|
|
|
65248
|
-
const run = ({ast, fix,
|
|
65377
|
+
const run = ({ast, fix, pluginsFind, pluginsTraverse, template, merge, traverse}) => [
|
|
65249
65378
|
...runWithoutMerge({
|
|
65250
65379
|
ast,
|
|
65251
65380
|
fix,
|
|
65252
|
-
shebang,
|
|
65253
65381
|
template,
|
|
65254
65382
|
pluginsFind,
|
|
65255
65383
|
traverse,
|
|
@@ -65257,7 +65385,6 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
|
|
|
65257
65385
|
...runWithMerge({
|
|
65258
65386
|
ast,
|
|
65259
65387
|
fix,
|
|
65260
|
-
shebang,
|
|
65261
65388
|
template,
|
|
65262
65389
|
pluginsTraverse,
|
|
65263
65390
|
merge,
|
|
@@ -65265,10 +65392,9 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
|
|
|
65265
65392
|
}),
|
|
65266
65393
|
];
|
|
65267
65394
|
|
|
65268
|
-
function runWithMerge({ast, fix,
|
|
65395
|
+
function runWithMerge({ast, fix, template, pluginsTraverse, merge, traverse}) {
|
|
65269
65396
|
const {entries, visitor} = merge(pluginsTraverse, {
|
|
65270
65397
|
fix,
|
|
65271
|
-
shebang,
|
|
65272
65398
|
template,
|
|
65273
65399
|
});
|
|
65274
65400
|
|
|
@@ -65291,7 +65417,7 @@ function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge, trav
|
|
|
65291
65417
|
return places;
|
|
65292
65418
|
}
|
|
65293
65419
|
|
|
65294
|
-
function runWithoutMerge({ast, fix,
|
|
65420
|
+
function runWithoutMerge({ast, fix, template, pluginsFind, traverse}) {
|
|
65295
65421
|
const places = [];
|
|
65296
65422
|
|
|
65297
65423
|
for (const {rule, plugin, msg, options} of pluginsFind) {
|
|
@@ -65305,7 +65431,6 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
|
|
|
65305
65431
|
ast,
|
|
65306
65432
|
options,
|
|
65307
65433
|
fix,
|
|
65308
|
-
shebang,
|
|
65309
65434
|
template,
|
|
65310
65435
|
traverse,
|
|
65311
65436
|
});
|
|
@@ -65316,7 +65441,7 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
|
|
|
65316
65441
|
for (const item of items) {
|
|
65317
65442
|
const message = msg || report(item);
|
|
65318
65443
|
const {parentPath} = getPath(item);
|
|
65319
|
-
const position = getPosition(item
|
|
65444
|
+
const position = getPosition(item);
|
|
65320
65445
|
|
|
65321
65446
|
places.push({
|
|
65322
65447
|
rule,
|
|
@@ -65433,16 +65558,7 @@ const cutBrackets = (a) => a.replace(/\s\(\d:\d+\)/, '');
|
|
|
65433
65558
|
|
|
65434
65559
|
const maybeParseError = (a) => !a ? [] : parseError$1(a, 'loader');
|
|
65435
65560
|
|
|
65436
|
-
|
|
65437
|
-
// because we need to calculate position in a right way
|
|
65438
|
-
// and determine is shebang is existing
|
|
65439
|
-
//
|
|
65440
|
-
// 25 return {¬
|
|
65441
|
-
// 26 line: shebang ? line + 1 : line,¬
|
|
65442
|
-
// 27 column,¬
|
|
65443
|
-
// 28 };¬
|
|
65444
|
-
//
|
|
65445
|
-
const transform = (ast, source, opts) => {
|
|
65561
|
+
const transform = (ast, opts) => {
|
|
65446
65562
|
opts = defaultOptions(opts);
|
|
65447
65563
|
|
|
65448
65564
|
const {
|
|
@@ -65455,8 +65571,6 @@ const transform = (ast, source, opts) => {
|
|
|
65455
65571
|
progress,
|
|
65456
65572
|
} = opts;
|
|
65457
65573
|
|
|
65458
|
-
const [, shebang] = cutShebang(source);
|
|
65459
|
-
|
|
65460
65574
|
const [validationError] = tryCatch(validateRulesRelations, {
|
|
65461
65575
|
rules,
|
|
65462
65576
|
pluginNames,
|
|
@@ -65469,7 +65583,6 @@ const transform = (ast, source, opts) => {
|
|
|
65469
65583
|
|
|
65470
65584
|
const places = runPlugins({
|
|
65471
65585
|
ast,
|
|
65472
|
-
shebang,
|
|
65473
65586
|
fix,
|
|
65474
65587
|
fixCount,
|
|
65475
65588
|
plugins,
|
|
@@ -65482,7 +65595,7 @@ const transform = (ast, source, opts) => {
|
|
|
65482
65595
|
];
|
|
65483
65596
|
};
|
|
65484
65597
|
|
|
65485
|
-
const transformAsync = async (ast,
|
|
65598
|
+
const transformAsync = async (ast, opts) => {
|
|
65486
65599
|
opts = defaultOptions(opts);
|
|
65487
65600
|
|
|
65488
65601
|
const {
|
|
@@ -65495,8 +65608,6 @@ const transformAsync = async (ast, source, opts) => {
|
|
|
65495
65608
|
progress,
|
|
65496
65609
|
} = opts;
|
|
65497
65610
|
|
|
65498
|
-
const [, shebang] = cutShebang(source);
|
|
65499
|
-
|
|
65500
65611
|
const [validationError] = tryCatch(validateRulesRelations, {
|
|
65501
65612
|
rules,
|
|
65502
65613
|
pluginNames,
|
|
@@ -65509,7 +65620,6 @@ const transformAsync = async (ast, source, opts) => {
|
|
|
65509
65620
|
|
|
65510
65621
|
const places = runPlugins({
|
|
65511
65622
|
ast,
|
|
65512
|
-
shebang,
|
|
65513
65623
|
fix,
|
|
65514
65624
|
fixCount,
|
|
65515
65625
|
plugins,
|
|
@@ -65533,16 +65643,14 @@ const putout = (source, opts) => {
|
|
|
65533
65643
|
printer,
|
|
65534
65644
|
} = opts;
|
|
65535
65645
|
|
|
65536
|
-
const
|
|
65537
|
-
|
|
65538
|
-
const ast = parse$4(clearSource, {
|
|
65646
|
+
const ast = parse$4(source, {
|
|
65539
65647
|
parser,
|
|
65540
65648
|
isTS,
|
|
65541
65649
|
isJSX,
|
|
65542
65650
|
printer,
|
|
65543
65651
|
});
|
|
65544
65652
|
|
|
65545
|
-
const places = transform(ast,
|
|
65653
|
+
const places = transform(ast, opts);
|
|
65546
65654
|
|
|
65547
65655
|
if (!opts.fix)
|
|
65548
65656
|
return {
|
|
@@ -65550,13 +65658,11 @@ const putout = (source, opts) => {
|
|
|
65550
65658
|
places,
|
|
65551
65659
|
};
|
|
65552
65660
|
|
|
65553
|
-
const
|
|
65661
|
+
const code = print(ast, {
|
|
65554
65662
|
printer,
|
|
65555
65663
|
source,
|
|
65556
65664
|
});
|
|
65557
65665
|
|
|
65558
|
-
const code = mergeShebang(shebang, printed);
|
|
65559
|
-
|
|
65560
65666
|
return {
|
|
65561
65667
|
code,
|
|
65562
65668
|
places,
|
|
@@ -65574,16 +65680,14 @@ const putoutAsync = async (source, opts) => {
|
|
|
65574
65680
|
printer,
|
|
65575
65681
|
} = opts;
|
|
65576
65682
|
|
|
65577
|
-
const
|
|
65578
|
-
|
|
65579
|
-
const ast = parse$4(clearSource, {
|
|
65683
|
+
const ast = parse$4(source, {
|
|
65580
65684
|
parser,
|
|
65581
65685
|
isTS,
|
|
65582
65686
|
isJSX,
|
|
65583
65687
|
printer,
|
|
65584
65688
|
});
|
|
65585
65689
|
|
|
65586
|
-
const places = await transformAsync(ast,
|
|
65690
|
+
const places = await transformAsync(ast, opts);
|
|
65587
65691
|
|
|
65588
65692
|
if (!opts.fix)
|
|
65589
65693
|
return {
|
|
@@ -65591,22 +65695,20 @@ const putoutAsync = async (source, opts) => {
|
|
|
65591
65695
|
places,
|
|
65592
65696
|
};
|
|
65593
65697
|
|
|
65594
|
-
const
|
|
65698
|
+
const code = print(ast, {
|
|
65595
65699
|
printer,
|
|
65596
65700
|
});
|
|
65597
65701
|
|
|
65598
|
-
const code = mergeShebang(shebang, printed);
|
|
65599
|
-
|
|
65600
65702
|
return {
|
|
65601
65703
|
code,
|
|
65602
65704
|
places,
|
|
65603
65705
|
};
|
|
65604
65706
|
};
|
|
65605
65707
|
|
|
65606
|
-
const isString = (a) => typeof a === 'string';
|
|
65708
|
+
const isString$1 = (a) => typeof a === 'string';
|
|
65607
65709
|
|
|
65608
65710
|
function check$2(source) {
|
|
65609
|
-
if (!isString(source))
|
|
65711
|
+
if (!isString$1(source))
|
|
65610
65712
|
throw Error(`☝️ Looks like 'source' has type '${typeof source}', expected: 'string'`);
|
|
65611
65713
|
}
|
|
65612
65714
|
|
|
@@ -71624,6 +71726,9 @@ function check$1(regExpTransformer) {
|
|
|
71624
71726
|
throw Error('☝️ Looks like RegExpTransformer is missing');
|
|
71625
71727
|
}
|
|
71626
71728
|
|
|
71729
|
+
const isString = (a) => typeof a === 'string';
|
|
71730
|
+
const {isArray: isArray$1} = Array;
|
|
71731
|
+
|
|
71627
71732
|
const {
|
|
71628
71733
|
isBlockStatement,
|
|
71629
71734
|
isFunction,
|
|
@@ -71644,15 +71749,15 @@ const isCall = (path) => {
|
|
|
71644
71749
|
return isCallExpression(path.find(isCallOrStatement));
|
|
71645
71750
|
};
|
|
71646
71751
|
|
|
71647
|
-
const report$
|
|
71752
|
+
const report$5 = ({name}) => `Argument '${name}' is missing`;
|
|
71648
71753
|
|
|
71649
71754
|
const addArgs = (args) => ({
|
|
71650
|
-
report: report$
|
|
71651
|
-
fix: fix$
|
|
71755
|
+
report: report$5,
|
|
71756
|
+
fix: fix$7,
|
|
71652
71757
|
traverse: traverse(args),
|
|
71653
71758
|
});
|
|
71654
71759
|
|
|
71655
|
-
const fix$
|
|
71760
|
+
const fix$7 = ({declaration, path, pattern, params, index}) => {
|
|
71656
71761
|
const declarationNode = template$1.ast.fresh(declaration);
|
|
71657
71762
|
|
|
71658
71763
|
if (isSequenceExpression(declarationNode)) {
|
|
@@ -71687,7 +71792,9 @@ const traverse = (args) => ({push, options}) => {
|
|
|
71687
71792
|
|
|
71688
71793
|
return {
|
|
71689
71794
|
ReferencedIdentifier(path) {
|
|
71690
|
-
for (const [name,
|
|
71795
|
+
for (const [name, config] of entries$1(allArgs)) {
|
|
71796
|
+
const [declaration, include, exclude] = parseConfig(config);
|
|
71797
|
+
|
|
71691
71798
|
if (path.node.name !== name)
|
|
71692
71799
|
continue;
|
|
71693
71800
|
|
|
@@ -71704,7 +71811,7 @@ const traverse = (args) => ({push, options}) => {
|
|
|
71704
71811
|
|
|
71705
71812
|
const {block} = fnPath.scope;
|
|
71706
71813
|
|
|
71707
|
-
if (!compareAny(path.scope.path,
|
|
71814
|
+
if (!compareAny(path.scope.path, include))
|
|
71708
71815
|
continue;
|
|
71709
71816
|
|
|
71710
71817
|
if (compareAny(path.scope.path, exclude))
|
|
@@ -71764,6 +71871,25 @@ function getObjectPattern(params) {
|
|
|
71764
71871
|
];
|
|
71765
71872
|
}
|
|
71766
71873
|
|
|
71874
|
+
function parseConfig(config) {
|
|
71875
|
+
const [declaration, patternsInclude, patternsExclude] = config;
|
|
71876
|
+
|
|
71877
|
+
if (isArray$1(patternsInclude) || isString(patternsInclude))
|
|
71878
|
+
return [
|
|
71879
|
+
declaration,
|
|
71880
|
+
patternsInclude,
|
|
71881
|
+
patternsExclude,
|
|
71882
|
+
];
|
|
71883
|
+
|
|
71884
|
+
const {include, exclude} = patternsInclude;
|
|
71885
|
+
|
|
71886
|
+
return [
|
|
71887
|
+
declaration,
|
|
71888
|
+
include,
|
|
71889
|
+
exclude,
|
|
71890
|
+
];
|
|
71891
|
+
}
|
|
71892
|
+
|
|
71767
71893
|
const moduleDeclarations = [
|
|
71768
71894
|
'import',
|
|
71769
71895
|
'export',
|
|
@@ -71861,15 +71987,15 @@ const isLegacyKeyword = (name) => {
|
|
|
71861
71987
|
return legacyKeywords.includes(name);
|
|
71862
71988
|
};
|
|
71863
71989
|
|
|
71864
|
-
const findPlaces = (ast,
|
|
71865
|
-
return transform(ast,
|
|
71990
|
+
const findPlaces = (ast, opts) => {
|
|
71991
|
+
return transform(ast, {
|
|
71866
71992
|
...opts,
|
|
71867
71993
|
fix: false,
|
|
71868
71994
|
});
|
|
71869
71995
|
};
|
|
71870
71996
|
|
|
71871
|
-
const findPlacesAsync = async (ast,
|
|
71872
|
-
return await transformAsync(ast,
|
|
71997
|
+
const findPlacesAsync = async (ast, opts) => {
|
|
71998
|
+
return await transformAsync(ast, {
|
|
71873
71999
|
...opts,
|
|
71874
72000
|
fix: false,
|
|
71875
72001
|
});
|
|
@@ -71905,7 +72031,7 @@ const {join} = path;
|
|
|
71905
72031
|
|
|
71906
72032
|
const isObject$1 = (a) => a && typeof a === 'object';
|
|
71907
72033
|
const {entries} = Object;
|
|
71908
|
-
const report$
|
|
72034
|
+
const report$4 = (path, {message}) => message;
|
|
71909
72035
|
|
|
71910
72036
|
const matchFiles = (options) => {
|
|
71911
72037
|
const {filename} = options;
|
|
@@ -71914,21 +72040,21 @@ const matchFiles = (options) => {
|
|
|
71914
72040
|
|
|
71915
72041
|
check(files);
|
|
71916
72042
|
|
|
71917
|
-
const scan = createScan$
|
|
72043
|
+
const scan = createScan$3({
|
|
71918
72044
|
defaultFilename: filename,
|
|
71919
72045
|
files,
|
|
71920
72046
|
exclude,
|
|
71921
72047
|
});
|
|
71922
72048
|
|
|
71923
72049
|
return {
|
|
71924
|
-
fix: fix$
|
|
72050
|
+
fix: fix$6,
|
|
71925
72051
|
scan,
|
|
71926
|
-
report: report$
|
|
72052
|
+
report: report$4,
|
|
71927
72053
|
};
|
|
71928
72054
|
};
|
|
71929
72055
|
|
|
71930
|
-
function fix$
|
|
71931
|
-
transform(matchedAST,
|
|
72056
|
+
function fix$6(inputFile, {dirPath, matchInputFilename, outputFilename, matchedAST, options, rawOptions}) {
|
|
72057
|
+
transform(matchedAST, options);
|
|
71932
72058
|
|
|
71933
72059
|
const matchedJSON = magicPrint(outputFilename, matchedAST, rawOptions);
|
|
71934
72060
|
const outputFile = getOutputFile({
|
|
@@ -71944,7 +72070,7 @@ function fix$4(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJ
|
|
|
71944
72070
|
removeFile(inputFile);
|
|
71945
72071
|
}
|
|
71946
72072
|
|
|
71947
|
-
const createScan$
|
|
72073
|
+
const createScan$3 = ({files, exclude, defaultFilename}) => (mainPath, {push, progress, options}) => {
|
|
71948
72074
|
const allFiles = [];
|
|
71949
72075
|
const cwd = getFilename(mainPath);
|
|
71950
72076
|
|
|
@@ -71997,7 +72123,7 @@ const createScan$2 = ({files, exclude, defaultFilename}) => (mainPath, {push, pr
|
|
|
71997
72123
|
const [matchedJS, matchedAST] = magicParse(inputFilename, fileContent);
|
|
71998
72124
|
|
|
71999
72125
|
const options = parseOptions(inputFilename, rawOptions);
|
|
72000
|
-
const places = findPlaces(matchedAST,
|
|
72126
|
+
const places = findPlaces(matchedAST, options);
|
|
72001
72127
|
|
|
72002
72128
|
if (!places.length)
|
|
72003
72129
|
continue;
|
|
@@ -72099,13 +72225,13 @@ function parseOptions(inputFilename, rawOptions) {
|
|
|
72099
72225
|
|
|
72100
72226
|
const {parse: parse$2} = JSON;
|
|
72101
72227
|
|
|
72102
|
-
const report$
|
|
72228
|
+
const report$3 = (file, {from, to}) => `Rename '${from}' to '${to}'`;
|
|
72103
72229
|
|
|
72104
|
-
const fix$
|
|
72230
|
+
const fix$5 = (file, {to}) => {
|
|
72105
72231
|
renameFile(file, to);
|
|
72106
72232
|
};
|
|
72107
72233
|
|
|
72108
|
-
const createScan$
|
|
72234
|
+
const createScan$2 = ({type, mask, rename} = {}) => (path, {push, trackFile}) => {
|
|
72109
72235
|
for (const file of trackFile(path, mask)) {
|
|
72110
72236
|
if (type && !checkType(type, file))
|
|
72111
72237
|
continue;
|
|
@@ -72153,29 +72279,29 @@ function findUpPackage(file) {
|
|
|
72153
72279
|
}
|
|
72154
72280
|
|
|
72155
72281
|
var renameFileWithFn = /*#__PURE__*/Object.freeze({
|
|
72156
|
-
|
|
72157
|
-
|
|
72158
|
-
|
|
72159
|
-
|
|
72282
|
+
__proto__: null,
|
|
72283
|
+
createScan: createScan$2,
|
|
72284
|
+
fix: fix$5,
|
|
72285
|
+
report: report$3
|
|
72160
72286
|
});
|
|
72161
72287
|
|
|
72162
72288
|
const returns = (a) => () => a;
|
|
72163
72289
|
|
|
72164
|
-
const report = (path, {mask, from, to}) => {
|
|
72290
|
+
const report$2 = (path, {mask, from, to}) => {
|
|
72165
72291
|
if (!mask)
|
|
72166
72292
|
return `Rename '${from}' to '${to}'`;
|
|
72167
72293
|
|
|
72168
72294
|
return `Rename '${mask}' to '${mask.replace(from, to)}'`;
|
|
72169
72295
|
};
|
|
72170
72296
|
|
|
72171
|
-
const fix$
|
|
72297
|
+
const fix$4 = (path, {from, to}) => {
|
|
72172
72298
|
const filename = getFilename(path);
|
|
72173
72299
|
const newFilename = filename.replace(from, to);
|
|
72174
72300
|
|
|
72175
72301
|
renameFile(path, newFilename);
|
|
72176
72302
|
};
|
|
72177
72303
|
|
|
72178
|
-
const createScan = (baseOptions) => (rootPath, {push, options, trackFile}) => {
|
|
72304
|
+
const createScan$1 = (baseOptions) => (rootPath, {push, options, trackFile}) => {
|
|
72179
72305
|
const from = options.from || baseOptions.from;
|
|
72180
72306
|
const to = options.to || baseOptions.to;
|
|
72181
72307
|
const mask = options.mask || baseOptions.mask;
|
|
@@ -72214,10 +72340,10 @@ const createCheckNear = (near) => (file) => {
|
|
|
72214
72340
|
};
|
|
72215
72341
|
|
|
72216
72342
|
var renameFileByMask = /*#__PURE__*/Object.freeze({
|
|
72217
|
-
|
|
72218
|
-
|
|
72219
|
-
|
|
72220
|
-
|
|
72343
|
+
__proto__: null,
|
|
72344
|
+
createScan: createScan$1,
|
|
72345
|
+
fix: fix$4,
|
|
72346
|
+
report: report$2
|
|
72221
72347
|
});
|
|
72222
72348
|
|
|
72223
72349
|
const renameFiles = ({type, mask, rename, from, to, near} = {}) => {
|
|
@@ -74354,10 +74480,12 @@ var picomatch$1 = picomatch_1.default;
|
|
|
74354
74480
|
const {stringLiteral: stringLiteral$1} = lib_exports;
|
|
74355
74481
|
const getValue = ({node}) => node.value;
|
|
74356
74482
|
|
|
74483
|
+
const difference$1 = (a, b) => new Set(a).difference(new Set(b));
|
|
74484
|
+
|
|
74357
74485
|
const ignore = ({name, property, list, type = __ignore}) => ({
|
|
74358
74486
|
report: createReport$1(name),
|
|
74359
|
-
fix: fix$
|
|
74360
|
-
traverse: createTraverse$
|
|
74487
|
+
fix: fix$3,
|
|
74488
|
+
traverse: createTraverse$2({
|
|
74361
74489
|
type,
|
|
74362
74490
|
property,
|
|
74363
74491
|
list,
|
|
@@ -74381,12 +74509,12 @@ const createReport$1 = (filename) => ({name, matchedElements}) => {
|
|
|
74381
74509
|
return `Add '${name}'${insteadOf} to '${filename}'`;
|
|
74382
74510
|
};
|
|
74383
74511
|
|
|
74384
|
-
const fix$
|
|
74512
|
+
const fix$3 = ({path, name, matchedElements}) => {
|
|
74385
74513
|
path.node.elements.push(stringLiteral$1(name));
|
|
74386
74514
|
matchedElements.map(remove);
|
|
74387
74515
|
};
|
|
74388
74516
|
|
|
74389
|
-
const createTraverse$
|
|
74517
|
+
const createTraverse$2 = ({type, property, list}) => ({push, options}) => {
|
|
74390
74518
|
const {dismiss = []} = options;
|
|
74391
74519
|
const newNames = filterNames(list, dismiss);
|
|
74392
74520
|
|
|
@@ -74404,10 +74532,7 @@ const createTraverse$1 = ({type, property, list}) => ({push, options}) => {
|
|
|
74404
74532
|
|
|
74405
74533
|
const list = elements.map(getValue);
|
|
74406
74534
|
|
|
74407
|
-
for (const name of newNames) {
|
|
74408
|
-
if (list.includes(name))
|
|
74409
|
-
continue;
|
|
74410
|
-
|
|
74535
|
+
for (const name of difference$1(newNames, list)) {
|
|
74411
74536
|
const match = picomatch$1(name);
|
|
74412
74537
|
const matchedElements = [];
|
|
74413
74538
|
|
|
@@ -74540,15 +74665,18 @@ const findFileUp = (file, name) => {
|
|
|
74540
74665
|
return findFileUp(parentDirectory, name);
|
|
74541
74666
|
};
|
|
74542
74667
|
|
|
74543
|
-
const {
|
|
74668
|
+
const {
|
|
74669
|
+
stringLiteral,
|
|
74670
|
+
isArrayExpression,
|
|
74671
|
+
} = lib_exports;
|
|
74544
74672
|
|
|
74545
74673
|
const sortIgnore = ({name, property, type = __ignore}) => ({
|
|
74546
74674
|
report: createReport({
|
|
74547
74675
|
name,
|
|
74548
74676
|
property,
|
|
74549
74677
|
}),
|
|
74550
|
-
fix,
|
|
74551
|
-
traverse: createTraverse({
|
|
74678
|
+
fix: fix$2,
|
|
74679
|
+
traverse: createTraverse$1({
|
|
74552
74680
|
type,
|
|
74553
74681
|
property,
|
|
74554
74682
|
}),
|
|
@@ -74561,17 +74689,12 @@ const createReport = ({name, property}) => () => {
|
|
|
74561
74689
|
return `Sort '${name}'`;
|
|
74562
74690
|
};
|
|
74563
74691
|
|
|
74564
|
-
const fix = ({path, sortedElements}) => {
|
|
74692
|
+
const fix$2 = ({path, sortedElements}) => {
|
|
74565
74693
|
path.node.elements = sortedElements;
|
|
74566
74694
|
};
|
|
74567
74695
|
|
|
74568
|
-
const createTraverse = ({type, property}) => ({push}) => ({
|
|
74696
|
+
const createTraverse$1 = ({type, property}) => ({push}) => ({
|
|
74569
74697
|
[type]: (path) => {
|
|
74570
|
-
const masks = [];
|
|
74571
|
-
const hidden = [];
|
|
74572
|
-
const files = [];
|
|
74573
|
-
const dirs = [];
|
|
74574
|
-
|
|
74575
74698
|
const parentOfElements = parseElements(path, {
|
|
74576
74699
|
property,
|
|
74577
74700
|
});
|
|
@@ -74581,39 +74704,9 @@ const createTraverse = ({type, property}) => ({push}) => ({
|
|
|
74581
74704
|
|
|
74582
74705
|
const {elements} = parentOfElements.node;
|
|
74583
74706
|
|
|
74584
|
-
|
|
74585
|
-
|
|
74586
|
-
|
|
74587
|
-
if (!value)
|
|
74588
|
-
continue;
|
|
74589
|
-
|
|
74590
|
-
if (value.startsWith('*')) {
|
|
74591
|
-
masks.push(element);
|
|
74592
|
-
continue;
|
|
74593
|
-
}
|
|
74594
|
-
|
|
74595
|
-
if (value.startsWith('.')) {
|
|
74596
|
-
hidden.push(element);
|
|
74597
|
-
continue;
|
|
74598
|
-
}
|
|
74599
|
-
|
|
74600
|
-
if (value.includes('.')) {
|
|
74601
|
-
files.push(element);
|
|
74602
|
-
continue;
|
|
74603
|
-
}
|
|
74604
|
-
|
|
74605
|
-
if (value.startsWith('#'))
|
|
74606
|
-
continue;
|
|
74607
|
-
|
|
74608
|
-
dirs.push(element);
|
|
74609
|
-
}
|
|
74610
|
-
|
|
74611
|
-
const sortedElements = [
|
|
74612
|
-
...maybeSeparate(masks, property),
|
|
74613
|
-
...maybeSeparate(hidden, property),
|
|
74614
|
-
...maybeSeparate(files, property),
|
|
74615
|
-
...dirs,
|
|
74616
|
-
];
|
|
74707
|
+
const sortedElements = cleverSort(elements, {
|
|
74708
|
+
separate: !property,
|
|
74709
|
+
});
|
|
74617
74710
|
|
|
74618
74711
|
for (const [index, {value}] of elements.entries()) {
|
|
74619
74712
|
const current = sortedElements[index];
|
|
@@ -74644,11 +74737,101 @@ function parseElements(path, {property}) {
|
|
|
74644
74737
|
if (!prop)
|
|
74645
74738
|
return null;
|
|
74646
74739
|
|
|
74647
|
-
|
|
74740
|
+
const arrayPath = prop.get('value');
|
|
74741
|
+
|
|
74742
|
+
if (!isArrayExpression(arrayPath))
|
|
74743
|
+
return null;
|
|
74744
|
+
|
|
74745
|
+
return arrayPath;
|
|
74648
74746
|
}
|
|
74649
74747
|
|
|
74650
|
-
function
|
|
74651
|
-
|
|
74748
|
+
function cleverSort(elements, {separate}) {
|
|
74749
|
+
const twoStars = [];
|
|
74750
|
+
const noStars = [];
|
|
74751
|
+
|
|
74752
|
+
for (const element of elements) {
|
|
74753
|
+
const {value} = element;
|
|
74754
|
+
|
|
74755
|
+
if (value.startsWith('**/')) {
|
|
74756
|
+
twoStars.push(element);
|
|
74757
|
+
continue;
|
|
74758
|
+
}
|
|
74759
|
+
|
|
74760
|
+
noStars.push(element);
|
|
74761
|
+
}
|
|
74762
|
+
|
|
74763
|
+
const sortedElements = [
|
|
74764
|
+
...sortElements(twoStars, {
|
|
74765
|
+
separate,
|
|
74766
|
+
}),
|
|
74767
|
+
...sortElements(noStars, {
|
|
74768
|
+
separate,
|
|
74769
|
+
}),
|
|
74770
|
+
];
|
|
74771
|
+
|
|
74772
|
+
if (!sortedElements.length)
|
|
74773
|
+
return elements;
|
|
74774
|
+
|
|
74775
|
+
if (!sortedElements.at(-1).value)
|
|
74776
|
+
return sortedElements.slice(0, -1);
|
|
74777
|
+
|
|
74778
|
+
return sortedElements;
|
|
74779
|
+
}
|
|
74780
|
+
|
|
74781
|
+
function sortElements(elements, {separate} = {}) {
|
|
74782
|
+
const masks = [];
|
|
74783
|
+
const hidden = [];
|
|
74784
|
+
const files = [];
|
|
74785
|
+
const dirs = [];
|
|
74786
|
+
const allowed = [];
|
|
74787
|
+
|
|
74788
|
+
for (const element of elements) {
|
|
74789
|
+
const value = cutStars(element);
|
|
74790
|
+
|
|
74791
|
+
if (!value)
|
|
74792
|
+
continue;
|
|
74793
|
+
|
|
74794
|
+
if (value.startsWith('*')) {
|
|
74795
|
+
masks.push(element);
|
|
74796
|
+
continue;
|
|
74797
|
+
}
|
|
74798
|
+
|
|
74799
|
+
if (value.startsWith('.')) {
|
|
74800
|
+
hidden.push(element);
|
|
74801
|
+
continue;
|
|
74802
|
+
}
|
|
74803
|
+
|
|
74804
|
+
if (value.startsWith('!')) {
|
|
74805
|
+
allowed.push(element);
|
|
74806
|
+
continue;
|
|
74807
|
+
}
|
|
74808
|
+
|
|
74809
|
+
if (value.includes('.')) {
|
|
74810
|
+
files.push(element);
|
|
74811
|
+
continue;
|
|
74812
|
+
}
|
|
74813
|
+
|
|
74814
|
+
if (value.startsWith('#'))
|
|
74815
|
+
continue;
|
|
74816
|
+
|
|
74817
|
+
dirs.push(element);
|
|
74818
|
+
}
|
|
74819
|
+
|
|
74820
|
+
const sortedElements = [
|
|
74821
|
+
masks,
|
|
74822
|
+
hidden,
|
|
74823
|
+
files,
|
|
74824
|
+
dirs,
|
|
74825
|
+
allowed,
|
|
74826
|
+
];
|
|
74827
|
+
|
|
74828
|
+
return sortedElements.flatMap(maybeSeparate({
|
|
74829
|
+
separate,
|
|
74830
|
+
}));
|
|
74831
|
+
}
|
|
74832
|
+
|
|
74833
|
+
const maybeSeparate = ({separate} = {}) => (array) => {
|
|
74834
|
+
if (!separate)
|
|
74652
74835
|
return array;
|
|
74653
74836
|
|
|
74654
74837
|
if (!array.length)
|
|
@@ -74658,113 +74841,193 @@ function maybeSeparate(array, property) {
|
|
|
74658
74841
|
...array,
|
|
74659
74842
|
stringLiteral(''),
|
|
74660
74843
|
];
|
|
74661
|
-
}
|
|
74844
|
+
};
|
|
74662
74845
|
|
|
74663
|
-
|
|
74664
|
-
|
|
74665
|
-
|
|
74666
|
-
|
|
74667
|
-
|
|
74668
|
-
|
|
74669
|
-
|
|
74670
|
-
|
|
74671
|
-
|
|
74672
|
-
|
|
74673
|
-
|
|
74674
|
-
|
|
74675
|
-
|
|
74676
|
-
|
|
74677
|
-
|
|
74678
|
-
|
|
74679
|
-
|
|
74680
|
-
|
|
74681
|
-
|
|
74682
|
-
|
|
74683
|
-
|
|
74684
|
-
|
|
74685
|
-
containsClassName: containsClassName,
|
|
74686
|
-
copyFile: copyFile,
|
|
74687
|
-
crawlDirectory: crawlDirectory,
|
|
74688
|
-
createDirectory: createDirectory,
|
|
74689
|
-
createFile: createFile,
|
|
74690
|
-
createNestedDirectory: createNestedDirectory,
|
|
74691
|
-
declare: declare$1,
|
|
74692
|
-
extract: extract,
|
|
74693
|
-
findBinding: findBinding,
|
|
74694
|
-
findFile: findFile,
|
|
74695
|
-
findFileUp: findFileUp,
|
|
74696
|
-
findVarsWays: findVarsWays,
|
|
74846
|
+
const cutStars = ({value}) => {
|
|
74847
|
+
if (!value)
|
|
74848
|
+
return '';
|
|
74849
|
+
|
|
74850
|
+
if (value.startsWith('**/'))
|
|
74851
|
+
return value.slice(3);
|
|
74852
|
+
|
|
74853
|
+
return value;
|
|
74854
|
+
};
|
|
74855
|
+
|
|
74856
|
+
const difference = (a, b) => new Set(a).difference(new Set(b));
|
|
74857
|
+
const {isArray} = Array;
|
|
74858
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
74859
|
+
|
|
74860
|
+
const report$1 = (file) => `Remove files: '${getFilename(file)}'`;
|
|
74861
|
+
|
|
74862
|
+
const fix$1 = (file) => {
|
|
74863
|
+
removeFile(file);
|
|
74864
|
+
};
|
|
74865
|
+
|
|
74866
|
+
const removeFiles = (defaultNames) => ({
|
|
74867
|
+
report: report$1,
|
|
74697
74868
|
fix: fix$1,
|
|
74698
|
-
|
|
74699
|
-
|
|
74700
|
-
|
|
74701
|
-
|
|
74702
|
-
|
|
74703
|
-
|
|
74704
|
-
|
|
74705
|
-
|
|
74706
|
-
|
|
74707
|
-
|
|
74708
|
-
|
|
74709
|
-
|
|
74710
|
-
|
|
74711
|
-
|
|
74712
|
-
|
|
74713
|
-
|
|
74714
|
-
|
|
74715
|
-
|
|
74716
|
-
|
|
74717
|
-
|
|
74718
|
-
|
|
74719
|
-
|
|
74720
|
-
|
|
74721
|
-
|
|
74722
|
-
|
|
74723
|
-
|
|
74724
|
-
|
|
74725
|
-
|
|
74726
|
-
|
|
74727
|
-
|
|
74728
|
-
|
|
74729
|
-
|
|
74730
|
-
|
|
74731
|
-
|
|
74732
|
-
|
|
74733
|
-
|
|
74734
|
-
|
|
74735
|
-
|
|
74736
|
-
|
|
74737
|
-
|
|
74738
|
-
|
|
74739
|
-
|
|
74740
|
-
|
|
74741
|
-
|
|
74742
|
-
|
|
74743
|
-
|
|
74744
|
-
|
|
74745
|
-
|
|
74746
|
-
|
|
74747
|
-
|
|
74748
|
-
|
|
74749
|
-
|
|
74750
|
-
|
|
74751
|
-
|
|
74752
|
-
|
|
74753
|
-
|
|
74754
|
-
|
|
74755
|
-
|
|
74756
|
-
|
|
74757
|
-
|
|
74758
|
-
|
|
74759
|
-
|
|
74760
|
-
|
|
74761
|
-
|
|
74762
|
-
|
|
74763
|
-
|
|
74764
|
-
|
|
74765
|
-
|
|
74766
|
-
|
|
74767
|
-
|
|
74869
|
+
scan: createScan(defaultNames),
|
|
74870
|
+
});
|
|
74871
|
+
|
|
74872
|
+
const createScan = (defaultNames = []) => (path, {push, trackFile, options}) => {
|
|
74873
|
+
const {names, dismiss} = options;
|
|
74874
|
+
const allNames = [
|
|
74875
|
+
maybeArray(defaultNames),
|
|
74876
|
+
maybeArray(names),
|
|
74877
|
+
];
|
|
74878
|
+
|
|
74879
|
+
const flatNames = allNames
|
|
74880
|
+
.flat()
|
|
74881
|
+
.filter(Boolean);
|
|
74882
|
+
|
|
74883
|
+
if (!flatNames.length)
|
|
74884
|
+
return;
|
|
74885
|
+
|
|
74886
|
+
for (const file of trackFile(path, difference(flatNames, dismiss))) {
|
|
74887
|
+
push(file, {
|
|
74888
|
+
names: allNames,
|
|
74889
|
+
});
|
|
74890
|
+
}
|
|
74891
|
+
};
|
|
74892
|
+
|
|
74893
|
+
const renameProperties = (tuples) => ({
|
|
74894
|
+
report,
|
|
74895
|
+
fix,
|
|
74896
|
+
traverse: createTraverse(tuples),
|
|
74897
|
+
});
|
|
74898
|
+
|
|
74899
|
+
const report = ({from, to}) => `Rename property: '${from}' -> '${to}'`;
|
|
74900
|
+
|
|
74901
|
+
const fix = ({path, to}) => {
|
|
74902
|
+
if (!to) {
|
|
74903
|
+
remove(path);
|
|
74904
|
+
return;
|
|
74905
|
+
}
|
|
74906
|
+
|
|
74907
|
+
setLiteralValue(path.node.key, to);
|
|
74908
|
+
};
|
|
74909
|
+
|
|
74910
|
+
const createTraverse = (tuples) => ({push}) => ({
|
|
74911
|
+
[__json](mainPath) {
|
|
74912
|
+
for (const [from, to] of tuples) {
|
|
74913
|
+
for (const path of traverseProperties(mainPath, from)) {
|
|
74914
|
+
push({
|
|
74915
|
+
path,
|
|
74916
|
+
from,
|
|
74917
|
+
to,
|
|
74918
|
+
});
|
|
74919
|
+
}
|
|
74920
|
+
}
|
|
74921
|
+
},
|
|
74922
|
+
});
|
|
74923
|
+
|
|
74924
|
+
var operator = /*#__PURE__*/Object.freeze({
|
|
74925
|
+
__proto__: null,
|
|
74926
|
+
__filesystem: __filesystem,
|
|
74927
|
+
__filesystem_name: __filesystem_name,
|
|
74928
|
+
__ignore: __ignore,
|
|
74929
|
+
__ignore_name: __ignore_name,
|
|
74930
|
+
__json: __json,
|
|
74931
|
+
__json_name: __json_name,
|
|
74932
|
+
__toml: __toml,
|
|
74933
|
+
__toml_name: __toml_name,
|
|
74934
|
+
__yaml: __yaml,
|
|
74935
|
+
__yaml_name: __yaml_name,
|
|
74936
|
+
addArgs: addArgs,
|
|
74937
|
+
addAttribute: addAttribute,
|
|
74938
|
+
addAttributeValue: addAttributeValue,
|
|
74939
|
+
addClassName: addClassName,
|
|
74940
|
+
addParens: addParens,
|
|
74941
|
+
compare: compare,
|
|
74942
|
+
compareAll: compareAll,
|
|
74943
|
+
compareAny: compareAny,
|
|
74944
|
+
compute: compute,
|
|
74945
|
+
contains: contains,
|
|
74946
|
+
containsClassName: containsClassName,
|
|
74947
|
+
copyFile: copyFile,
|
|
74948
|
+
crawlDirectory: crawlDirectory,
|
|
74949
|
+
createDirectory: createDirectory,
|
|
74950
|
+
createFile: createFile,
|
|
74951
|
+
createNestedDirectory: createNestedDirectory,
|
|
74952
|
+
declare: declare$1,
|
|
74953
|
+
extract: extract,
|
|
74954
|
+
findBinding: findBinding,
|
|
74955
|
+
findFile: findFile,
|
|
74956
|
+
findFileUp: findFileUp,
|
|
74957
|
+
findVarsWays: findVarsWays,
|
|
74958
|
+
fix: fix$3,
|
|
74959
|
+
fromJS: fromJS,
|
|
74960
|
+
getAttributeNode: getAttributeNode,
|
|
74961
|
+
getAttributePath: getAttributePath,
|
|
74962
|
+
getAttributeValue: getAttributeValue,
|
|
74963
|
+
getBinding: getBinding,
|
|
74964
|
+
getBindingPath: getBindingPath,
|
|
74965
|
+
getClassName: getClassName,
|
|
74966
|
+
getExportDefault: getExportDefault,
|
|
74967
|
+
getFile: getFile,
|
|
74968
|
+
getFileContent: getFileContent,
|
|
74969
|
+
getFileType: getFileType,
|
|
74970
|
+
getFilename: getFilename,
|
|
74971
|
+
getLiteralRaw: getLiteralRaw,
|
|
74972
|
+
getParentDirectory: getParentDirectory,
|
|
74973
|
+
getPathAfterImports: getPathAfterImports,
|
|
74974
|
+
getPathAfterRequires: getPathAfterRequires,
|
|
74975
|
+
getProperties: getProperties,
|
|
74976
|
+
getProperty: getProperty,
|
|
74977
|
+
getRootDirectory: getRootDirectory,
|
|
74978
|
+
getTemplateValues: getTemplateValues,
|
|
74979
|
+
getValues: getValues,
|
|
74980
|
+
hasAttributeValue: hasAttributeValue,
|
|
74981
|
+
hasDataName: hasDataName,
|
|
74982
|
+
hasParens: hasParens,
|
|
74983
|
+
hasTagName: hasTagName,
|
|
74984
|
+
ignore: ignore,
|
|
74985
|
+
insertAfter: insertAfter,
|
|
74986
|
+
insertBefore: insertBefore,
|
|
74987
|
+
isConditionKeyword: isConditionKeyword,
|
|
74988
|
+
isDeclarationKeyword: isDeclarationKeyword,
|
|
74989
|
+
isESM: isESM,
|
|
74990
|
+
isJSON: isJSON,
|
|
74991
|
+
isJSONGroup: isJSONGroup,
|
|
74992
|
+
isKeyword: isKeyword,
|
|
74993
|
+
isLegacyKeyword: isLegacyKeyword,
|
|
74994
|
+
isModuleDeclarationKeyword: isModuleDeclarationKeyword,
|
|
74995
|
+
isModuleExports: isModuleExports,
|
|
74996
|
+
isSimple: isSimple,
|
|
74997
|
+
isSimpleRegExp: isSimpleRegExp,
|
|
74998
|
+
isStatementKeyword: isStatementKeyword,
|
|
74999
|
+
isTOML: isTOML,
|
|
75000
|
+
isTSKeyword: isTSKeyword,
|
|
75001
|
+
isTemplate: isTemplate,
|
|
75002
|
+
matchFiles: matchFiles,
|
|
75003
|
+
moveFile: moveFile,
|
|
75004
|
+
parseTemplate: parseTemplate,
|
|
75005
|
+
readDirectory: readDirectory,
|
|
75006
|
+
readFileContent: readFileContent,
|
|
75007
|
+
remove: remove,
|
|
75008
|
+
removeAttributeValue: removeAttributeValue,
|
|
75009
|
+
removeClassName: removeClassName,
|
|
75010
|
+
removeEmptyDirectory: removeEmptyDirectory,
|
|
75011
|
+
removeFile: removeFile,
|
|
75012
|
+
removeFiles: removeFiles,
|
|
75013
|
+
removeParens: removeParens,
|
|
75014
|
+
rename: rename,
|
|
75015
|
+
renameFile: renameFile,
|
|
75016
|
+
renameFiles: renameFiles,
|
|
75017
|
+
renameProperties: renameProperties,
|
|
75018
|
+
renameProperty: renameProperty,
|
|
75019
|
+
replaceWith: replaceWith,
|
|
75020
|
+
replaceWithMultiple: replaceWithMultiple,
|
|
75021
|
+
setAttributeValue: setAttributeValue,
|
|
75022
|
+
setLiteralValue: setLiteralValue,
|
|
75023
|
+
setValues: setValues,
|
|
75024
|
+
sortIgnore: sortIgnore,
|
|
75025
|
+
toExpression: toExpression,
|
|
75026
|
+
toJS: toJS,
|
|
75027
|
+
transformRegExp: transformRegExp,
|
|
75028
|
+
traverse: traverse$3,
|
|
75029
|
+
traverseProperties: traverseProperties,
|
|
75030
|
+
writeFileContent: writeFileContent
|
|
74768
75031
|
});
|
|
74769
75032
|
|
|
74770
75033
|
const codeframe = ({source, error, highlightCode = true}) => {
|
|
@@ -74784,20 +75047,20 @@ const codeframe = ({source, error, highlightCode = true}) => {
|
|
|
74784
75047
|
};
|
|
74785
75048
|
|
|
74786
75049
|
var exports$1 = /*#__PURE__*/Object.freeze({
|
|
74787
|
-
|
|
74788
|
-
|
|
74789
|
-
|
|
74790
|
-
|
|
74791
|
-
|
|
74792
|
-
|
|
74793
|
-
|
|
74794
|
-
|
|
74795
|
-
|
|
74796
|
-
|
|
74797
|
-
|
|
74798
|
-
|
|
74799
|
-
|
|
74800
|
-
|
|
75050
|
+
__proto__: null,
|
|
75051
|
+
codeframe: codeframe,
|
|
75052
|
+
findPlaces: findPlaces,
|
|
75053
|
+
findPlacesAsync: findPlacesAsync,
|
|
75054
|
+
generate: generate,
|
|
75055
|
+
operator: operator,
|
|
75056
|
+
parse: parse$4,
|
|
75057
|
+
print: print,
|
|
75058
|
+
putoutAsync: putoutAsync,
|
|
75059
|
+
template: template$1,
|
|
75060
|
+
transform: transform,
|
|
75061
|
+
transformAsync: transformAsync,
|
|
75062
|
+
traverse: traverse3,
|
|
75063
|
+
types: lib_exports
|
|
74801
75064
|
});
|
|
74802
75065
|
|
|
74803
75066
|
Object.assign(putout, exports$1);
|