@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.slim.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
|
|
|
@@ -2011,7 +1994,7 @@ var browser$1 = {
|
|
|
2011
1994
|
env: env};
|
|
2012
1995
|
|
|
2013
1996
|
var util = /*#__PURE__*/Object.freeze({
|
|
2014
|
-
|
|
1997
|
+
__proto__: null
|
|
2015
1998
|
});
|
|
2016
1999
|
|
|
2017
2000
|
var __create = Object.create;
|
|
@@ -3160,7 +3143,7 @@ __export(lib_exports, {
|
|
|
3160
3143
|
isAccessor: () => isAccessor,
|
|
3161
3144
|
isAnyTypeAnnotation: () => isAnyTypeAnnotation,
|
|
3162
3145
|
isArgumentPlaceholder: () => isArgumentPlaceholder,
|
|
3163
|
-
isArrayExpression: () => isArrayExpression$
|
|
3146
|
+
isArrayExpression: () => isArrayExpression$b,
|
|
3164
3147
|
isArrayPattern: () => isArrayPattern,
|
|
3165
3148
|
isArrayTypeAnnotation: () => isArrayTypeAnnotation,
|
|
3166
3149
|
isArrowFunctionExpression: () => isArrowFunctionExpression$3,
|
|
@@ -3658,9 +3641,6 @@ var nonASCIIidentifierStartChars = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u0
|
|
|
3658
3641
|
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';
|
|
3659
3642
|
var nonASCIIidentifierStart = new RegExp('[' + nonASCIIidentifierStartChars + ']');
|
|
3660
3643
|
var nonASCIIidentifier = new RegExp('[' + nonASCIIidentifierStartChars + nonASCIIidentifierChars + ']');
|
|
3661
|
-
|
|
3662
|
-
nonASCIIidentifierStartChars =
|
|
3663
|
-
nonASCIIidentifierChars = null;
|
|
3664
3644
|
var astralIdentifierStartCodes = [
|
|
3665
3645
|
0,
|
|
3666
3646
|
11,
|
|
@@ -5134,7 +5114,7 @@ function captureShortStackTrace(skip2, length) {
|
|
|
5134
5114
|
};
|
|
5135
5115
|
}
|
|
5136
5116
|
|
|
5137
|
-
function isArrayExpression$
|
|
5117
|
+
function isArrayExpression$b(node, opts) {
|
|
5138
5118
|
if (!node)
|
|
5139
5119
|
return false;
|
|
5140
5120
|
|
|
@@ -18408,15 +18388,13 @@ function removeTypeDuplicates$1(nodesIn) {
|
|
|
18408
18388
|
const name = getQualifiedName$1(node.id);
|
|
18409
18389
|
|
|
18410
18390
|
if (generics.has(name)) {
|
|
18411
|
-
|
|
18391
|
+
const existingTypeParameters = generics.get(name).typeParameters;
|
|
18412
18392
|
|
|
18413
|
-
if (
|
|
18393
|
+
if (existingTypeParameters) {
|
|
18414
18394
|
if (node.typeParameters) {
|
|
18415
|
-
|
|
18416
|
-
|
|
18395
|
+
existingTypeParameters.params.push(...node.typeParameters.params);
|
|
18396
|
+
existingTypeParameters.params = removeTypeDuplicates$1(existingTypeParameters.params);
|
|
18417
18397
|
}
|
|
18418
|
-
} else {
|
|
18419
|
-
existing = node.typeParameters;
|
|
18420
18398
|
}
|
|
18421
18399
|
} else {
|
|
18422
18400
|
generics.set(name, node);
|
|
@@ -18495,14 +18473,11 @@ function removeTypeDuplicates(nodesIn) {
|
|
|
18495
18473
|
const name = getQualifiedName(node.typeName);
|
|
18496
18474
|
|
|
18497
18475
|
if (generics.has(name)) {
|
|
18498
|
-
|
|
18499
|
-
const existingTypeArguments = existing[typeArgumentsKey];
|
|
18476
|
+
const existingTypeArguments = generics.get(name)[typeArgumentsKey];
|
|
18500
18477
|
|
|
18501
18478
|
if (existingTypeArguments) {
|
|
18502
18479
|
existingTypeArguments.params.push(...typeArguments.params);
|
|
18503
18480
|
existingTypeArguments.params = removeTypeDuplicates(existingTypeArguments.params);
|
|
18504
|
-
} else {
|
|
18505
|
-
existing = typeArguments;
|
|
18506
18481
|
}
|
|
18507
18482
|
} else {
|
|
18508
18483
|
generics.set(name, node);
|
|
@@ -18562,6 +18537,9 @@ function cloneIfNodeOrArray(obj, deep, withoutLoc, commentsCache) {
|
|
|
18562
18537
|
}
|
|
18563
18538
|
|
|
18564
18539
|
function cloneNode(node, deep = true, withoutLoc = false) {
|
|
18540
|
+
if (!node)
|
|
18541
|
+
return node;
|
|
18542
|
+
|
|
18565
18543
|
return cloneNodeInternal(node, deep, withoutLoc, /* @__PURE__ */new Map());
|
|
18566
18544
|
}
|
|
18567
18545
|
|
|
@@ -18797,7 +18775,7 @@ function toBlock(node, parent) {
|
|
|
18797
18775
|
return node;
|
|
18798
18776
|
}
|
|
18799
18777
|
|
|
18800
|
-
let blockNodes
|
|
18778
|
+
let blockNodes;
|
|
18801
18779
|
|
|
18802
18780
|
if (isEmptyStatement(node)) {
|
|
18803
18781
|
blockNodes = [];
|
|
@@ -20210,8 +20188,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20210
20188
|
regex = new RegExp(pattern, flags);
|
|
20211
20189
|
} catch {}
|
|
20212
20190
|
|
|
20213
|
-
|
|
20214
|
-
const node = this.estreeParseLiteral(regex);
|
|
20191
|
+
const node = this.estreeParseLiteral(regex);
|
|
20215
20192
|
|
|
20216
20193
|
node.regex = {
|
|
20217
20194
|
pattern,
|
|
@@ -20229,8 +20206,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20229
20206
|
bigInt = null;
|
|
20230
20207
|
}
|
|
20231
20208
|
|
|
20232
|
-
|
|
20233
|
-
const node = this.estreeParseLiteral(bigInt);
|
|
20209
|
+
const node = this.estreeParseLiteral(bigInt);
|
|
20234
20210
|
|
|
20235
20211
|
node.bigint = String(node.value || value);
|
|
20236
20212
|
return node;
|
|
@@ -21199,9 +21175,6 @@ var nonASCIIidentifierStartChars2 = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u
|
|
|
21199
21175
|
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';
|
|
21200
21176
|
var nonASCIIidentifierStart2 = new RegExp('[' + nonASCIIidentifierStartChars2 + ']');
|
|
21201
21177
|
var nonASCIIidentifier2 = new RegExp('[' + nonASCIIidentifierStartChars2 + nonASCIIidentifierChars2 + ']');
|
|
21202
|
-
|
|
21203
|
-
nonASCIIidentifierStartChars2 =
|
|
21204
|
-
nonASCIIidentifierChars2 = null;
|
|
21205
21178
|
var astralIdentifierStartCodes2 = [
|
|
21206
21179
|
0,
|
|
21207
21180
|
11,
|
|
@@ -23805,7 +23778,7 @@ var CommentsParser = class extends BaseParser {
|
|
|
23805
23778
|
};
|
|
23806
23779
|
|
|
23807
23780
|
var State$2 = class _State {
|
|
23808
|
-
flags =
|
|
23781
|
+
flags = 4096;
|
|
23809
23782
|
get strict() {
|
|
23810
23783
|
return (this.flags & 1) > 0;
|
|
23811
23784
|
}
|
|
@@ -23901,32 +23874,61 @@ var State$2 = class _State {
|
|
|
23901
23874
|
this.flags &= -65;
|
|
23902
23875
|
}
|
|
23903
23876
|
|
|
23904
|
-
|
|
23905
|
-
maxNumOfResolvableTopics: 0,
|
|
23906
|
-
maxTopicIndex: null,
|
|
23907
|
-
};
|
|
23908
|
-
get soloAwait() {
|
|
23877
|
+
get inConditionalConsequent() {
|
|
23909
23878
|
return (this.flags & 128) > 0;
|
|
23910
23879
|
}
|
|
23911
23880
|
|
|
23912
|
-
set
|
|
23881
|
+
set inConditionalConsequent(v) {
|
|
23913
23882
|
if (v)
|
|
23914
23883
|
this.flags |= 128;
|
|
23915
23884
|
else
|
|
23916
23885
|
this.flags &= -129;
|
|
23917
23886
|
}
|
|
23918
23887
|
|
|
23919
|
-
get
|
|
23888
|
+
get inHackPipelineBody() {
|
|
23920
23889
|
return (this.flags & 256) > 0;
|
|
23921
23890
|
}
|
|
23922
23891
|
|
|
23923
|
-
set
|
|
23892
|
+
set inHackPipelineBody(v) {
|
|
23924
23893
|
if (v)
|
|
23925
23894
|
this.flags |= 256;
|
|
23926
23895
|
else
|
|
23927
23896
|
this.flags &= -257;
|
|
23928
23897
|
}
|
|
23929
23898
|
|
|
23899
|
+
get seenTopicReference() {
|
|
23900
|
+
return (this.flags & 512) > 0;
|
|
23901
|
+
}
|
|
23902
|
+
|
|
23903
|
+
set seenTopicReference(v) {
|
|
23904
|
+
if (v)
|
|
23905
|
+
this.flags |= 512;
|
|
23906
|
+
else
|
|
23907
|
+
this.flags &= -513;
|
|
23908
|
+
}
|
|
23909
|
+
|
|
23910
|
+
get soloAwait() {
|
|
23911
|
+
return (this.flags & 1024) > 0;
|
|
23912
|
+
}
|
|
23913
|
+
|
|
23914
|
+
set soloAwait(v) {
|
|
23915
|
+
if (v)
|
|
23916
|
+
this.flags |= 1024;
|
|
23917
|
+
else
|
|
23918
|
+
this.flags &= -1025;
|
|
23919
|
+
}
|
|
23920
|
+
|
|
23921
|
+
get inFSharpPipelineDirectBody() {
|
|
23922
|
+
return (this.flags & 2048) > 0;
|
|
23923
|
+
}
|
|
23924
|
+
|
|
23925
|
+
set inFSharpPipelineDirectBody(v) {
|
|
23926
|
+
if (v)
|
|
23927
|
+
this.flags |= 2048;
|
|
23928
|
+
else
|
|
23929
|
+
this.flags &= -2049;
|
|
23930
|
+
}
|
|
23931
|
+
|
|
23930
23932
|
labels = [];
|
|
23931
23933
|
commentsLen = 0;
|
|
23932
23934
|
commentStack = [];
|
|
@@ -23939,37 +23941,37 @@ var State$2 = class _State {
|
|
|
23939
23941
|
lastTokStartLoc = null;
|
|
23940
23942
|
context = [types.brace];
|
|
23941
23943
|
get canStartJSXElement() {
|
|
23942
|
-
return (this.flags &
|
|
23944
|
+
return (this.flags & 4096) > 0;
|
|
23943
23945
|
}
|
|
23944
23946
|
|
|
23945
23947
|
set canStartJSXElement(v) {
|
|
23946
23948
|
if (v)
|
|
23947
|
-
this.flags |=
|
|
23949
|
+
this.flags |= 4096;
|
|
23948
23950
|
else
|
|
23949
|
-
this.flags &= -
|
|
23951
|
+
this.flags &= -4097;
|
|
23950
23952
|
}
|
|
23951
23953
|
|
|
23952
23954
|
get containsEsc() {
|
|
23953
|
-
return (this.flags &
|
|
23955
|
+
return (this.flags & 8192) > 0;
|
|
23954
23956
|
}
|
|
23955
23957
|
|
|
23956
23958
|
set containsEsc(v) {
|
|
23957
23959
|
if (v)
|
|
23958
|
-
this.flags |=
|
|
23960
|
+
this.flags |= 8192;
|
|
23959
23961
|
else
|
|
23960
|
-
this.flags &= -
|
|
23962
|
+
this.flags &= -8193;
|
|
23961
23963
|
}
|
|
23962
23964
|
|
|
23963
23965
|
firstInvalidTemplateEscapePos = null;
|
|
23964
23966
|
get hasTopLevelAwait() {
|
|
23965
|
-
return (this.flags &
|
|
23967
|
+
return (this.flags & 16384) > 0;
|
|
23966
23968
|
}
|
|
23967
23969
|
|
|
23968
23970
|
set hasTopLevelAwait(v) {
|
|
23969
23971
|
if (v)
|
|
23970
|
-
this.flags |=
|
|
23972
|
+
this.flags |= 16384;
|
|
23971
23973
|
else
|
|
23972
|
-
this.flags &= -
|
|
23974
|
+
this.flags &= -16385;
|
|
23973
23975
|
}
|
|
23974
23976
|
|
|
23975
23977
|
strictErrors = /* @__PURE__ */new Map();
|
|
@@ -23991,7 +23993,6 @@ var State$2 = class _State {
|
|
|
23991
23993
|
state.potentialArrowAt = this.potentialArrowAt;
|
|
23992
23994
|
state.noArrowAt = this.noArrowAt.slice();
|
|
23993
23995
|
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
23994
|
-
state.topicContext = this.topicContext;
|
|
23995
23996
|
state.labels = this.labels.slice();
|
|
23996
23997
|
state.commentsLen = this.commentsLen;
|
|
23997
23998
|
state.commentStack = this.commentStack.slice();
|
|
@@ -29372,7 +29373,18 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29372
29373
|
}
|
|
29373
29374
|
}
|
|
29374
29375
|
|
|
29375
|
-
|
|
29376
|
+
this.next();
|
|
29377
|
+
const node = this.startNodeAt(startLoc);
|
|
29378
|
+
|
|
29379
|
+
node.test = expr;
|
|
29380
|
+
const oldInConditionalConsequent = this.state.inConditionalConsequent;
|
|
29381
|
+
|
|
29382
|
+
this.state.inConditionalConsequent = true;
|
|
29383
|
+
node.consequent = this.parseMaybeAssignAllowIn();
|
|
29384
|
+
this.state.inConditionalConsequent = oldInConditionalConsequent;
|
|
29385
|
+
this.expect(10);
|
|
29386
|
+
node.alternate = this.parseMaybeAssign();
|
|
29387
|
+
return this.finishNode(node, 'ConditionalExpression');
|
|
29376
29388
|
}
|
|
29377
29389
|
|
|
29378
29390
|
parseParenItem(node, startLoc) {
|
|
@@ -29957,7 +29969,24 @@ var typescript$1 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29957
29969
|
}
|
|
29958
29970
|
|
|
29959
29971
|
shouldParseAsyncArrow() {
|
|
29960
|
-
|
|
29972
|
+
if (this.match(10)) {
|
|
29973
|
+
if (this.state.inConditionalConsequent)
|
|
29974
|
+
return false;
|
|
29975
|
+
|
|
29976
|
+
return true;
|
|
29977
|
+
}
|
|
29978
|
+
|
|
29979
|
+
return super.shouldParseAsyncArrow();
|
|
29980
|
+
}
|
|
29981
|
+
|
|
29982
|
+
parseParenAndDistinguishExpression(canBeArrow) {
|
|
29983
|
+
const oldInConditionalConsequent = this.state.inConditionalConsequent;
|
|
29984
|
+
|
|
29985
|
+
this.state.inConditionalConsequent = false;
|
|
29986
|
+
const result = super.parseParenAndDistinguishExpression(canBeArrow);
|
|
29987
|
+
|
|
29988
|
+
this.state.inConditionalConsequent = oldInConditionalConsequent;
|
|
29989
|
+
return result;
|
|
29961
29990
|
}
|
|
29962
29991
|
|
|
29963
29992
|
canHaveLeadingDecorator() {
|
|
@@ -31879,8 +31908,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
31879
31908
|
bigInt = null;
|
|
31880
31909
|
}
|
|
31881
31910
|
|
|
31882
|
-
|
|
31883
|
-
const node = this.parseLiteral(bigInt, 'BigIntLiteral');
|
|
31911
|
+
const node = this.parseLiteral(bigInt, 'BigIntLiteral');
|
|
31884
31912
|
|
|
31885
31913
|
return node;
|
|
31886
31914
|
}
|
|
@@ -32178,7 +32206,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
32178
32206
|
}
|
|
32179
32207
|
|
|
32180
32208
|
parsePropertyDefinition(refExpressionErrors) {
|
|
32181
|
-
|
|
32209
|
+
const decorators = [];
|
|
32182
32210
|
|
|
32183
32211
|
if (this.match(22)) {
|
|
32184
32212
|
if (this.hasPlugin('decorators')) {
|
|
@@ -32204,7 +32232,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
32204
32232
|
|
|
32205
32233
|
if (decorators.length) {
|
|
32206
32234
|
prop.decorators = decorators;
|
|
32207
|
-
decorators = [];
|
|
32208
32235
|
}
|
|
32209
32236
|
|
|
32210
32237
|
prop.method = false;
|
|
@@ -32770,16 +32797,17 @@ var ExpressionParser = class extends LValParser {
|
|
|
32770
32797
|
}
|
|
32771
32798
|
|
|
32772
32799
|
withTopicBindingContext(callback) {
|
|
32773
|
-
const
|
|
32800
|
+
const oldInHackPipelineBody = this.state.inHackPipelineBody;
|
|
32774
32801
|
|
|
32775
|
-
this.state.
|
|
32776
|
-
|
|
32777
|
-
|
|
32778
|
-
|
|
32802
|
+
this.state.inHackPipelineBody = true;
|
|
32803
|
+
const oldSeenTopicReference = this.state.seenTopicReference;
|
|
32804
|
+
|
|
32805
|
+
this.state.seenTopicReference = false;
|
|
32779
32806
|
try {
|
|
32780
32807
|
return callback();
|
|
32781
32808
|
} finally {
|
|
32782
|
-
this.state.
|
|
32809
|
+
this.state.inHackPipelineBody = oldInHackPipelineBody;
|
|
32810
|
+
this.state.seenTopicReference = oldSeenTopicReference;
|
|
32783
32811
|
}
|
|
32784
32812
|
}
|
|
32785
32813
|
|
|
@@ -32827,15 +32855,15 @@ var ExpressionParser = class extends LValParser {
|
|
|
32827
32855
|
}
|
|
32828
32856
|
|
|
32829
32857
|
registerTopicReference() {
|
|
32830
|
-
this.state.
|
|
32858
|
+
this.state.seenTopicReference = true;
|
|
32831
32859
|
}
|
|
32832
32860
|
|
|
32833
32861
|
topicReferenceIsAllowedInCurrentContext() {
|
|
32834
|
-
return this.state.
|
|
32862
|
+
return this.state.inHackPipelineBody;
|
|
32835
32863
|
}
|
|
32836
32864
|
|
|
32837
32865
|
topicReferenceWasUsedInCurrentContext() {
|
|
32838
|
-
return this.state.
|
|
32866
|
+
return this.state.seenTopicReference;
|
|
32839
32867
|
}
|
|
32840
32868
|
|
|
32841
32869
|
parseFSharpPipelineBody(prec) {
|
|
@@ -32869,8 +32897,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
32869
32897
|
} finally {
|
|
32870
32898
|
revertScopes();
|
|
32871
32899
|
}
|
|
32872
|
-
|
|
32873
|
-
|
|
32900
|
+
|
|
32874
32901
|
return this.finishNode(node, 'ModuleExpression');
|
|
32875
32902
|
}
|
|
32876
32903
|
|
|
@@ -35194,8 +35221,7 @@ function parse$b(input, options) {
|
|
|
35194
35221
|
return getParser$1(options, input).parse();
|
|
35195
35222
|
} catch {}
|
|
35196
35223
|
|
|
35197
|
-
|
|
35198
|
-
throw moduleError;
|
|
35224
|
+
throw moduleError;
|
|
35199
35225
|
}
|
|
35200
35226
|
} else {
|
|
35201
35227
|
return getParser$1(options, input).parse();
|
|
@@ -44307,7 +44333,7 @@ function verify$1(visitor) {
|
|
|
44307
44333
|
continue;
|
|
44308
44334
|
|
|
44309
44335
|
if (!TYPES2.includes(nodeType)) {
|
|
44310
|
-
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.
|
|
44336
|
+
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'}`);
|
|
44311
44337
|
}
|
|
44312
44338
|
|
|
44313
44339
|
const visitors2 = visitor[nodeType];
|
|
@@ -47227,8 +47253,7 @@ function replaceWithSourceString(replacement) {
|
|
|
47227
47253
|
throw err;
|
|
47228
47254
|
}
|
|
47229
47255
|
|
|
47230
|
-
|
|
47231
|
-
const expressionAST = ast.program.body[0].expression;
|
|
47256
|
+
const expressionAST = ast.program.body[0].expression;
|
|
47232
47257
|
traverse3.removeProperties(expressionAST);
|
|
47233
47258
|
return this.replaceWith(expressionAST);
|
|
47234
47259
|
}
|
|
@@ -50255,17 +50280,45 @@ traverse3.hasType = function(tree, type, denylistTypes) {
|
|
|
50255
50280
|
};
|
|
50256
50281
|
traverse3.cache = cache;
|
|
50257
50282
|
|
|
50258
|
-
const
|
|
50259
|
-
|
|
50260
|
-
|
|
50261
|
-
|
|
50262
|
-
|
|
50263
|
-
|
|
50264
|
-
|
|
50265
|
-
|
|
50266
|
-
|
|
50283
|
+
const isString$f = (a) => typeof a === 'string';
|
|
50284
|
+
const constant = (a) => () => a;
|
|
50285
|
+
const {keys: keys$3} = Object;
|
|
50286
|
+
|
|
50287
|
+
const rendy = (template, values, modifiers) => {
|
|
50288
|
+
check$e(template, values);
|
|
50289
|
+
|
|
50290
|
+
let result = template;
|
|
50291
|
+
const names = keys$3(values) ;
|
|
50292
|
+
|
|
50293
|
+
for (const key of names) {
|
|
50294
|
+
const [parsedKey, value] = parseValue$1(key, values);
|
|
50295
|
+
const str = constant(value);
|
|
50296
|
+
|
|
50297
|
+
while (result.includes(parsedKey))
|
|
50298
|
+
result = result.replace(parsedKey, str);
|
|
50299
|
+
}
|
|
50300
|
+
|
|
50301
|
+
if (result.includes('{{'))
|
|
50302
|
+
result = result.replace(/{{.*?}}/g, '');
|
|
50303
|
+
|
|
50304
|
+
return result;
|
|
50267
50305
|
};
|
|
50268
50306
|
|
|
50307
|
+
function check$e(template, values) {
|
|
50308
|
+
if (!isString$f(template))
|
|
50309
|
+
throw Error('template should be a string!');
|
|
50310
|
+
|
|
50311
|
+
if (typeof values !== 'object')
|
|
50312
|
+
throw Error('values should be an object!');
|
|
50313
|
+
}
|
|
50314
|
+
|
|
50315
|
+
function parseValue$1(key, values, modifiers) {
|
|
50316
|
+
return [
|
|
50317
|
+
`{{ ${key} }}`,
|
|
50318
|
+
values[key],
|
|
50319
|
+
];
|
|
50320
|
+
}
|
|
50321
|
+
|
|
50269
50322
|
const {
|
|
50270
50323
|
isStringLiteral: isStringLiteral$a,
|
|
50271
50324
|
isIdentifier: isIdentifier$g,
|
|
@@ -50274,7 +50327,7 @@ const {
|
|
|
50274
50327
|
isForOfStatement: isForOfStatement$1,
|
|
50275
50328
|
isVariableDeclaration: isVariableDeclaration$4,
|
|
50276
50329
|
isMemberExpression: isMemberExpression$8,
|
|
50277
|
-
isArrayExpression: isArrayExpression$
|
|
50330
|
+
isArrayExpression: isArrayExpression$a,
|
|
50278
50331
|
isObjectExpression: isObjectExpression$c,
|
|
50279
50332
|
isLabeledStatement: isLabeledStatement$1,
|
|
50280
50333
|
isTryStatement,
|
|
@@ -50382,7 +50435,7 @@ const isStringAndArray = ([a, b]) => {
|
|
|
50382
50435
|
if (!isStringLiteral$a(a))
|
|
50383
50436
|
return false;
|
|
50384
50437
|
|
|
50385
|
-
if (!isArrayExpression$
|
|
50438
|
+
if (!isArrayExpression$a(b))
|
|
50386
50439
|
return false;
|
|
50387
50440
|
|
|
50388
50441
|
return !isStringAndIdentifier(b.node.elements);
|
|
@@ -50444,39 +50497,214 @@ const hasLeadingComment = (path) => path.node?.leadingComments?.length;
|
|
|
50444
50497
|
const noTrailingComment = (path) => !path.node.trailingComments?.length;
|
|
50445
50498
|
const noLeadingComment = (path) => !path.node.leadingComments?.length;
|
|
50446
50499
|
|
|
50500
|
+
var maybeSatisfy = (plugin) => {
|
|
50501
|
+
if (!plugin.afterSatisfy && !plugin.beforeSatisfy && !plugin.satisfy)
|
|
50502
|
+
return plugin;
|
|
50503
|
+
|
|
50504
|
+
const {
|
|
50505
|
+
satisfy,
|
|
50506
|
+
afterSatisfy = satisfy,
|
|
50507
|
+
beforeSatisfy = satisfy,
|
|
50508
|
+
} = plugin;
|
|
50509
|
+
|
|
50510
|
+
return {
|
|
50511
|
+
afterIf: createIf(afterSatisfy),
|
|
50512
|
+
beforeIf: createIf(beforeSatisfy),
|
|
50513
|
+
...plugin,
|
|
50514
|
+
};
|
|
50515
|
+
};
|
|
50516
|
+
|
|
50517
|
+
const createIf = (getConditions) => {
|
|
50518
|
+
const conditions = getConditions?.() || [];
|
|
50519
|
+
return satisfy(conditions);
|
|
50520
|
+
};
|
|
50521
|
+
|
|
50522
|
+
const {
|
|
50523
|
+
isProgram: isProgram$4,
|
|
50524
|
+
isFile: isFile$1,
|
|
50525
|
+
isStatement: isStatement$5,
|
|
50526
|
+
expressionStatement: expressionStatement$3,
|
|
50527
|
+
program,
|
|
50528
|
+
file,
|
|
50529
|
+
} = lib_exports;
|
|
50530
|
+
|
|
50447
50531
|
const isFn$7 = (a) => typeof a === 'function';
|
|
50448
50532
|
|
|
50449
|
-
const
|
|
50533
|
+
const maybeThrow = (a, path, b) => {
|
|
50534
|
+
if (!a)
|
|
50535
|
+
return;
|
|
50536
|
+
|
|
50537
|
+
throw Error(rendy(b, {
|
|
50538
|
+
path,
|
|
50539
|
+
type: path.type,
|
|
50540
|
+
}));
|
|
50541
|
+
};
|
|
50450
50542
|
|
|
50451
|
-
const
|
|
50452
|
-
|
|
50453
|
-
|
|
50543
|
+
const maybeStatement = (ast) => isStatement$5(ast) ? ast : expressionStatement$3(ast);
|
|
50544
|
+
|
|
50545
|
+
const maybeProgram = (ast) => isProgram$4(ast) ? ast : program([
|
|
50546
|
+
maybeStatement(ast),
|
|
50547
|
+
]);
|
|
50548
|
+
|
|
50549
|
+
const maybeFile = (ast) => isFile$1(ast) ? ast : file(maybeProgram(ast));
|
|
50550
|
+
|
|
50551
|
+
const maybeVisitor = (plugin, path, printer, options) => {
|
|
50552
|
+
if (isFn$7(plugin))
|
|
50553
|
+
return plugin(path, printer, options);
|
|
50454
50554
|
|
|
50455
|
-
return
|
|
50555
|
+
return objectPlugin(plugin, path, printer, options);
|
|
50456
50556
|
};
|
|
50457
50557
|
|
|
50458
|
-
|
|
50459
|
-
|
|
50460
|
-
|
|
50461
|
-
|
|
50462
|
-
|
|
50463
|
-
|
|
50464
|
-
|
|
50465
|
-
|
|
50466
|
-
|
|
50467
|
-
});
|
|
50558
|
+
function objectPlugin(plugin, path, printer, semantics) {
|
|
50559
|
+
const {
|
|
50560
|
+
print,
|
|
50561
|
+
split,
|
|
50562
|
+
condition,
|
|
50563
|
+
before = split,
|
|
50564
|
+
beforeIf = condition,
|
|
50565
|
+
after = split,
|
|
50566
|
+
afterIf = condition,
|
|
50567
|
+
} = maybeSatisfy(plugin);
|
|
50568
|
+
|
|
50569
|
+
if (beforeIf?.(path, printer, semantics))
|
|
50570
|
+
before(path, printer, semantics);
|
|
50571
|
+
|
|
50572
|
+
print(path, printer, semantics);
|
|
50573
|
+
|
|
50574
|
+
if (afterIf?.(path, printer, semantics))
|
|
50575
|
+
after(path, printer, semantics);
|
|
50576
|
+
}
|
|
50468
50577
|
|
|
50469
|
-
|
|
50470
|
-
|
|
50471
|
-
|
|
50472
|
-
|
|
50578
|
+
function fullstore(value) {
|
|
50579
|
+
const data = {
|
|
50580
|
+
value,
|
|
50581
|
+
};
|
|
50582
|
+
|
|
50583
|
+
return (...args) => {
|
|
50584
|
+
const [value] = args;
|
|
50473
50585
|
|
|
50474
|
-
if (!
|
|
50475
|
-
return
|
|
50586
|
+
if (!args.length)
|
|
50587
|
+
return data.value;
|
|
50476
50588
|
|
|
50477
|
-
|
|
50478
|
-
|
|
50479
|
-
|
|
50589
|
+
data.value = value;
|
|
50590
|
+
|
|
50591
|
+
return value;
|
|
50592
|
+
};
|
|
50593
|
+
}
|
|
50594
|
+
|
|
50595
|
+
const TYPES$3 = {
|
|
50596
|
+
TOKEN: 'Token',
|
|
50597
|
+
NEWLINE: 'Newline',
|
|
50598
|
+
SPLITTER: 'Splitter',
|
|
50599
|
+
INDENT: 'Indent',
|
|
50600
|
+
DEBUG: 'Debug',
|
|
50601
|
+
SPACE: 'Space',
|
|
50602
|
+
QUOTE: 'Quote',
|
|
50603
|
+
END_OF_FILE: 'EndOfFile',
|
|
50604
|
+
};
|
|
50605
|
+
|
|
50606
|
+
var stringSnakeCase = snakeCase;
|
|
50607
|
+
|
|
50608
|
+
/*
|
|
50609
|
+
snakeCase('the quick brown fox'); // 'the_quick_brown_fox'
|
|
50610
|
+
snakeCase('the-quick-brown-fox'); // 'the_quick_brown_fox'
|
|
50611
|
+
snakeCase('the_quick_brown_fox'); // 'the_quick_brown_fox'
|
|
50612
|
+
snakeCase('theQuickBrownFox'); // 'the_quick_brown_fox'
|
|
50613
|
+
snakeCase('theQuickBrown Fox'); // 'the_quick_brown_Fox'
|
|
50614
|
+
snakeCase('thequickbrownfox'); // 'thequickbrownfox'
|
|
50615
|
+
snakeCase('the - quick * brown# fox'); // 'the_quick_brown_fox'
|
|
50616
|
+
snakeCase('theQUICKBrownFox'); // 'the_q_u_i_c_k_brown_fox'
|
|
50617
|
+
*/
|
|
50618
|
+
|
|
50619
|
+
// any combination of spaces and punctuation characters
|
|
50620
|
+
// thanks to http://stackoverflow.com/a/25575009
|
|
50621
|
+
var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
|
|
50622
|
+
var capitals = /[A-Z\u00C0-\u00D6\u00D9-\u00DD]/g;
|
|
50623
|
+
|
|
50624
|
+
function snakeCase(str) {
|
|
50625
|
+
//replace capitals with space + lower case equivalent for later parsing
|
|
50626
|
+
str = str.replace(capitals, function(match) {
|
|
50627
|
+
return ' ' + (match.toLowerCase() || match);
|
|
50628
|
+
});
|
|
50629
|
+
return str
|
|
50630
|
+
.trim()
|
|
50631
|
+
.split(wordSeparators)
|
|
50632
|
+
.join('_');
|
|
50633
|
+
}
|
|
50634
|
+
|
|
50635
|
+
const {stringify: stringify$7} = JSON;
|
|
50636
|
+
const {
|
|
50637
|
+
LOG,
|
|
50638
|
+
LOG_ALL,
|
|
50639
|
+
LOG_TOKENS,
|
|
50640
|
+
LOG_TERM,
|
|
50641
|
+
LOG_DEBUG,
|
|
50642
|
+
} = {};
|
|
50643
|
+
|
|
50644
|
+
const createDebug$3 = (tokens) => (a) => {
|
|
50645
|
+
if (!LOG_DEBUG)
|
|
50646
|
+
return;
|
|
50647
|
+
|
|
50648
|
+
tokens.push({
|
|
50649
|
+
type: TYPES$3.DEBUG,
|
|
50650
|
+
value: `/*__${stringSnakeCase(a)}*/`,
|
|
50651
|
+
});
|
|
50652
|
+
};
|
|
50653
|
+
|
|
50654
|
+
const createLog = ({newline = '\n', store = createStore$1()} = {}) => ({type, value}) => {
|
|
50655
|
+
if (LOG_TOKENS) {
|
|
50656
|
+
console.log(codeFrameColumns(stringify$7({
|
|
50657
|
+
type,
|
|
50658
|
+
value,
|
|
50659
|
+
}), {}, {
|
|
50660
|
+
highlightCode: true,
|
|
50661
|
+
}));
|
|
50662
|
+
|
|
50663
|
+
return;
|
|
50664
|
+
}
|
|
50665
|
+
|
|
50666
|
+
if (LOG_ALL) {
|
|
50667
|
+
console.log(codeFrameColumns(value, {}, {
|
|
50668
|
+
highlightCode: true,
|
|
50669
|
+
}));
|
|
50670
|
+
|
|
50671
|
+
return;
|
|
50672
|
+
}
|
|
50673
|
+
|
|
50674
|
+
if (LOG) {
|
|
50675
|
+
if (value === newline) {
|
|
50676
|
+
console.log(codeFrameColumns(store(), {}, {
|
|
50677
|
+
highlightCode: true,
|
|
50678
|
+
}));
|
|
50679
|
+
|
|
50680
|
+
return;
|
|
50681
|
+
}
|
|
50682
|
+
|
|
50683
|
+
store(value);
|
|
50684
|
+
}
|
|
50685
|
+
|
|
50686
|
+
if (LOG_TERM)
|
|
50687
|
+
browser$1.stdout.write(value);
|
|
50688
|
+
};
|
|
50689
|
+
|
|
50690
|
+
function createStore$1() {
|
|
50691
|
+
let chunks = [];
|
|
50692
|
+
|
|
50693
|
+
return (...args) => {
|
|
50694
|
+
const [chunk] = args;
|
|
50695
|
+
|
|
50696
|
+
if (args.length) {
|
|
50697
|
+
chunks.push(chunk);
|
|
50698
|
+
return;
|
|
50699
|
+
}
|
|
50700
|
+
|
|
50701
|
+
const result = chunks.join('');
|
|
50702
|
+
|
|
50703
|
+
chunks = [];
|
|
50704
|
+
|
|
50705
|
+
return result;
|
|
50706
|
+
};
|
|
50707
|
+
}
|
|
50480
50708
|
|
|
50481
50709
|
const WATER_MARK_BEFORE = '__putout_newline_before';
|
|
50482
50710
|
const WATER_MARK_AFTER = '__putout_newline_after';
|
|
@@ -50499,6 +50727,40 @@ const hasPrevNewline = (path) => {
|
|
|
50499
50727
|
return isMarkedAfter(path.getPrevSibling());
|
|
50500
50728
|
};
|
|
50501
50729
|
|
|
50730
|
+
const isFn$6 = (a) => typeof a === 'function';
|
|
50731
|
+
|
|
50732
|
+
const isParens$2 = (path) => path.node.extra?.parenthesized;
|
|
50733
|
+
|
|
50734
|
+
const maybeParens = (print) => {
|
|
50735
|
+
if (isFn$6(print))
|
|
50736
|
+
return maybeParensPrint(print);
|
|
50737
|
+
|
|
50738
|
+
return maybeParensCondition(print);
|
|
50739
|
+
};
|
|
50740
|
+
|
|
50741
|
+
const maybeParensPrint = (print) => ({
|
|
50742
|
+
condition: isParens$2,
|
|
50743
|
+
before(path, {write}) {
|
|
50744
|
+
write('(');
|
|
50745
|
+
},
|
|
50746
|
+
print,
|
|
50747
|
+
after(path, {write}) {
|
|
50748
|
+
write(')');
|
|
50749
|
+
},
|
|
50750
|
+
});
|
|
50751
|
+
|
|
50752
|
+
const maybeParensCondition = ({print, condition, checkParens = true}) => ({
|
|
50753
|
+
...maybeParensPrint(print),
|
|
50754
|
+
condition: (path, print, semantics) => {
|
|
50755
|
+
const is = condition?.(path, print, semantics);
|
|
50756
|
+
|
|
50757
|
+
if (!checkParens)
|
|
50758
|
+
return is;
|
|
50759
|
+
|
|
50760
|
+
return is || isParens$2(path);
|
|
50761
|
+
},
|
|
50762
|
+
});
|
|
50763
|
+
|
|
50502
50764
|
const maybeInsideFn = (insideFn, {print, indent}) => {
|
|
50503
50765
|
if (!insideFn)
|
|
50504
50766
|
return;
|
|
@@ -50773,7 +51035,7 @@ const parseLeadingComments = (path, printer, semantics, {currentTraverse = {}} =
|
|
|
50773
51035
|
}
|
|
50774
51036
|
};
|
|
50775
51037
|
|
|
50776
|
-
const {assign: assign$
|
|
51038
|
+
const {assign: assign$c} = Object;
|
|
50777
51039
|
|
|
50778
51040
|
const chain$1 = (path) => {
|
|
50779
51041
|
const all = [
|
|
@@ -50843,7 +51105,7 @@ function build(path) {
|
|
|
50843
51105
|
};
|
|
50844
51106
|
|
|
50845
51107
|
if (path.isCallExpression())
|
|
50846
|
-
assign$
|
|
51108
|
+
assign$c(prop, {
|
|
50847
51109
|
args: path.node.arguments.length,
|
|
50848
51110
|
name: path.node.callee.property?.name || '',
|
|
50849
51111
|
});
|
|
@@ -51098,6 +51360,8 @@ function isPrevCall(path) {
|
|
|
51098
51360
|
return !isCallExpression$8(expression.arguments[0]);
|
|
51099
51361
|
}
|
|
51100
51362
|
|
|
51363
|
+
const isEmptyBody$1 = ({node}) => !node.body.length;
|
|
51364
|
+
|
|
51101
51365
|
const parseComments = (path, {write, maybe}, semantics) => {
|
|
51102
51366
|
if (!semantics.comments)
|
|
51103
51367
|
return;
|
|
@@ -51116,7 +51380,7 @@ const parseComments = (path, {write, maybe}, semantics) => {
|
|
|
51116
51380
|
write('//');
|
|
51117
51381
|
write(value);
|
|
51118
51382
|
|
|
51119
|
-
if (program) {
|
|
51383
|
+
if (program && isEmptyBody$1(path)) {
|
|
51120
51384
|
maybe.write.newline(i < n);
|
|
51121
51385
|
continue;
|
|
51122
51386
|
}
|
|
@@ -51812,12 +52076,12 @@ const ClassDeclaration = {
|
|
|
51812
52076
|
},
|
|
51813
52077
|
};
|
|
51814
52078
|
|
|
51815
|
-
const {isArray: isArray$
|
|
52079
|
+
const {isArray: isArray$f} = Array;
|
|
51816
52080
|
|
|
51817
52081
|
const parseArgs = (path) => {
|
|
51818
52082
|
const argsPath = path.get('arguments');
|
|
51819
52083
|
|
|
51820
|
-
if (!isArray$
|
|
52084
|
+
if (!isArray$f(argsPath))
|
|
51821
52085
|
return [];
|
|
51822
52086
|
|
|
51823
52087
|
return argsPath;
|
|
@@ -51960,7 +52224,7 @@ function maybePrintBrace(brace, path, printer, semantics) {
|
|
|
51960
52224
|
maybe.print(roundBraces.new, brace);
|
|
51961
52225
|
}
|
|
51962
52226
|
|
|
51963
|
-
const {isArrayExpression: isArrayExpression$
|
|
52227
|
+
const {isArrayExpression: isArrayExpression$9} = lib_exports;
|
|
51964
52228
|
|
|
51965
52229
|
const TYPES$2 = [
|
|
51966
52230
|
'NullLiteral',
|
|
@@ -51971,7 +52235,7 @@ const TYPES$2 = [
|
|
|
51971
52235
|
const isInsideTuple = (path) => {
|
|
51972
52236
|
const {parentPath} = path;
|
|
51973
52237
|
|
|
51974
|
-
if (!isArrayExpression$
|
|
52238
|
+
if (!isArrayExpression$9(parentPath))
|
|
51975
52239
|
return false;
|
|
51976
52240
|
|
|
51977
52241
|
const [first, second] = parentPath.node.elements;
|
|
@@ -51983,13 +52247,13 @@ const isInsideTuple = (path) => {
|
|
|
51983
52247
|
};
|
|
51984
52248
|
|
|
51985
52249
|
const {
|
|
51986
|
-
isArrayExpression: isArrayExpression$
|
|
52250
|
+
isArrayExpression: isArrayExpression$8,
|
|
51987
52251
|
isCallExpression: isCallExpression$7,
|
|
51988
52252
|
isIdentifier: isIdentifier$e,
|
|
51989
52253
|
} = lib_exports;
|
|
51990
52254
|
|
|
51991
52255
|
const isThirdObjectInsideArray = ({parentPath}) => {
|
|
51992
|
-
if (!isArrayExpression$
|
|
52256
|
+
if (!isArrayExpression$8(parentPath))
|
|
51993
52257
|
return false;
|
|
51994
52258
|
|
|
51995
52259
|
const [, second] = parentPath.node.elements;
|
|
@@ -51999,7 +52263,7 @@ const isThirdObjectInsideArray = ({parentPath}) => {
|
|
|
51999
52263
|
|
|
52000
52264
|
const {
|
|
52001
52265
|
isStringLiteral: isStringLiteral$9,
|
|
52002
|
-
isArrayExpression: isArrayExpression$
|
|
52266
|
+
isArrayExpression: isArrayExpression$7,
|
|
52003
52267
|
isSpreadElement: isSpreadElement$2,
|
|
52004
52268
|
} = lib_exports;
|
|
52005
52269
|
|
|
@@ -52023,10 +52287,10 @@ const isMemberExpressionCallee = ({parentPath}) => {
|
|
|
52023
52287
|
const isInsideCall = ({parentPath}) => parentPath.isCallExpression();
|
|
52024
52288
|
|
|
52025
52289
|
function isInsideNestedArrayCall({parentPath}) {
|
|
52026
|
-
if (!isArrayExpression$
|
|
52290
|
+
if (!isArrayExpression$7(parentPath))
|
|
52027
52291
|
return false;
|
|
52028
52292
|
|
|
52029
|
-
if (!isArrayExpression$
|
|
52293
|
+
if (!isArrayExpression$7(parentPath.parentPath))
|
|
52030
52294
|
return false;
|
|
52031
52295
|
|
|
52032
52296
|
return isInsideCall(parentPath.parentPath);
|
|
@@ -52289,7 +52553,7 @@ function maybePrintTypeAnnotation(path, printer) {
|
|
|
52289
52553
|
|
|
52290
52554
|
const {
|
|
52291
52555
|
isAssignmentPattern: isAssignmentPattern$4,
|
|
52292
|
-
isArrayExpression: isArrayExpression$
|
|
52556
|
+
isArrayExpression: isArrayExpression$6,
|
|
52293
52557
|
isObjectExpression: isObjectExpression$a,
|
|
52294
52558
|
isIdentifier: isIdentifier$d,
|
|
52295
52559
|
} = lib_exports;
|
|
@@ -52298,7 +52562,7 @@ const calculateAssigns = (property, semantics) => {
|
|
|
52298
52562
|
const currentAssign = isLongAssignPattern(property, semantics);
|
|
52299
52563
|
|
|
52300
52564
|
const {right} = property.node.value;
|
|
52301
|
-
const isArrayOrObjectRight = isArrayExpression$
|
|
52565
|
+
const isArrayOrObjectRight = isArrayExpression$6(right) || isComplexObject(right);
|
|
52302
52566
|
const complexAssign = currentAssign && isArrayOrObjectRight;
|
|
52303
52567
|
|
|
52304
52568
|
return {
|
|
@@ -52931,7 +53195,7 @@ const isSimple = (a) => {
|
|
|
52931
53195
|
};
|
|
52932
53196
|
|
|
52933
53197
|
const {
|
|
52934
|
-
isArrayExpression: isArrayExpression$
|
|
53198
|
+
isArrayExpression: isArrayExpression$5,
|
|
52935
53199
|
isLiteral: isLiteral$2,
|
|
52936
53200
|
isIdentifier: isIdentifier$8,
|
|
52937
53201
|
isMemberExpression: isMemberExpression$2,
|
|
@@ -52971,7 +53235,7 @@ function extract(node) {
|
|
|
52971
53235
|
if (isMemberExpression$2(node))
|
|
52972
53236
|
return `${extract(node.object)}.${extract(node.property)}`;
|
|
52973
53237
|
|
|
52974
|
-
if (isArrayExpression$
|
|
53238
|
+
if (isArrayExpression$5(node))
|
|
52975
53239
|
return extractArrayExpression(node);
|
|
52976
53240
|
|
|
52977
53241
|
if (isJSXText$3(node))
|
|
@@ -53012,7 +53276,7 @@ function extract(node) {
|
|
|
53012
53276
|
|
|
53013
53277
|
function extractArrayExpression(node, collector = []) {
|
|
53014
53278
|
for (const el of node.elements) {
|
|
53015
|
-
if (isArrayExpression$
|
|
53279
|
+
if (isArrayExpression$5(el)) {
|
|
53016
53280
|
extractArrayExpression(el, collector);
|
|
53017
53281
|
continue;
|
|
53018
53282
|
}
|
|
@@ -53498,22 +53762,22 @@ function maybeEncode(a) {
|
|
|
53498
53762
|
}
|
|
53499
53763
|
|
|
53500
53764
|
const {
|
|
53501
|
-
isStatement: isStatement$
|
|
53765
|
+
isStatement: isStatement$4,
|
|
53502
53766
|
isBlockStatement: isBlockStatement$5,
|
|
53503
53767
|
blockStatement,
|
|
53504
|
-
expressionStatement: expressionStatement$
|
|
53768
|
+
expressionStatement: expressionStatement$2,
|
|
53505
53769
|
} = lib_exports;
|
|
53506
53770
|
|
|
53507
53771
|
const maybeBody = (path, node) => {
|
|
53508
53772
|
const {parentPath} = path;
|
|
53509
53773
|
|
|
53510
|
-
if (node && !isStatement$
|
|
53774
|
+
if (node && !isStatement$4(node) || isBlockStatement$5(node) || !parentPath?.isArrowFunctionExpression?.())
|
|
53511
53775
|
return {
|
|
53512
53776
|
currentPath: path,
|
|
53513
53777
|
};
|
|
53514
53778
|
|
|
53515
53779
|
parentPath.node.body = blockStatement([
|
|
53516
|
-
expressionStatement$
|
|
53780
|
+
expressionStatement$2(path.node),
|
|
53517
53781
|
]);
|
|
53518
53782
|
|
|
53519
53783
|
return {
|
|
@@ -53524,7 +53788,7 @@ const maybeBody = (path, node) => {
|
|
|
53524
53788
|
const {
|
|
53525
53789
|
isExpression: isExpression$1,
|
|
53526
53790
|
toStatement,
|
|
53527
|
-
expressionStatement: expressionStatement$
|
|
53791
|
+
expressionStatement: expressionStatement$1,
|
|
53528
53792
|
} = lib_exports;
|
|
53529
53793
|
|
|
53530
53794
|
const toExpression = (el) => {
|
|
@@ -53538,7 +53802,7 @@ const toExpression = (el) => {
|
|
|
53538
53802
|
return el;
|
|
53539
53803
|
|
|
53540
53804
|
if (isExpression$1(el))
|
|
53541
|
-
return expressionStatement$
|
|
53805
|
+
return expressionStatement$1(el);
|
|
53542
53806
|
|
|
53543
53807
|
return toStatement(el);
|
|
53544
53808
|
};
|
|
@@ -53590,7 +53854,7 @@ function removeDuplicateLeadingComments(nodes) {
|
|
|
53590
53854
|
}
|
|
53591
53855
|
}
|
|
53592
53856
|
|
|
53593
|
-
const {assign: assign$
|
|
53857
|
+
const {assign: assign$b} = Object;
|
|
53594
53858
|
|
|
53595
53859
|
const parseNode$2 = (a) => {
|
|
53596
53860
|
a = extractMark(a);
|
|
@@ -53614,7 +53878,7 @@ const replaceWith = (path, node) => {
|
|
|
53614
53878
|
|
|
53615
53879
|
currentPath.replaceWith(node);
|
|
53616
53880
|
|
|
53617
|
-
assign$
|
|
53881
|
+
assign$b(currentPath.node, {
|
|
53618
53882
|
comments,
|
|
53619
53883
|
loc,
|
|
53620
53884
|
});
|
|
@@ -53637,8 +53901,8 @@ const {
|
|
|
53637
53901
|
matchesPattern,
|
|
53638
53902
|
isImportDeclaration: isImportDeclaration$1,
|
|
53639
53903
|
isExportDeclaration: isExportDeclaration$4,
|
|
53640
|
-
isStatement: isStatement$
|
|
53641
|
-
expressionStatement
|
|
53904
|
+
isStatement: isStatement$3,
|
|
53905
|
+
expressionStatement,
|
|
53642
53906
|
} = lib_exports;
|
|
53643
53907
|
|
|
53644
53908
|
const insertBefore = (path, node) => {
|
|
@@ -53654,8 +53918,8 @@ const insertAfter = (path, node) => {
|
|
|
53654
53918
|
if (node.trailingComments)
|
|
53655
53919
|
delete node.trailingComments;
|
|
53656
53920
|
|
|
53657
|
-
if (isStatement$
|
|
53658
|
-
path.insertAfter(expressionStatement
|
|
53921
|
+
if (isStatement$3(path) && !isStatement$3(node))
|
|
53922
|
+
path.insertAfter(expressionStatement(node));
|
|
53659
53923
|
else
|
|
53660
53924
|
path.insertAfter(node);
|
|
53661
53925
|
|
|
@@ -53704,7 +53968,7 @@ const isESM = (path) => {
|
|
|
53704
53968
|
|
|
53705
53969
|
const {
|
|
53706
53970
|
isObjectExpression: isObjectExpression$4,
|
|
53707
|
-
isArrayExpression: isArrayExpression$
|
|
53971
|
+
isArrayExpression: isArrayExpression$4,
|
|
53708
53972
|
isObjectProperty: isObjectProperty$1,
|
|
53709
53973
|
isCallExpression: isCallExpression$5,
|
|
53710
53974
|
isAwaitExpression,
|
|
@@ -53715,7 +53979,7 @@ const {
|
|
|
53715
53979
|
isIdentifier: isIdentifier$7,
|
|
53716
53980
|
} = lib_exports;
|
|
53717
53981
|
|
|
53718
|
-
const {round
|
|
53982
|
+
const {round} = Math;
|
|
53719
53983
|
|
|
53720
53984
|
const isOneSpread = (elements) => {
|
|
53721
53985
|
if (elements.length > 1)
|
|
@@ -53827,7 +54091,7 @@ const isMultiLine = (path, {elements, maxElementsInOneLine, maxElementLengthInOn
|
|
|
53827
54091
|
if (isSimpleAndObject(elements))
|
|
53828
54092
|
return ONE_LINE;
|
|
53829
54093
|
|
|
53830
|
-
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression$
|
|
54094
|
+
if (isStringAndString(elements) && path.parentPath.isArrayExpression() && isArrayExpression$4(path.parentPath.node.elements[0]))
|
|
53831
54095
|
return ONE_LINE;
|
|
53832
54096
|
|
|
53833
54097
|
if (isSiblingIsArray(path))
|
|
@@ -53913,7 +54177,7 @@ function isTwoStringsDifferentLength(strings) {
|
|
|
53913
54177
|
const aLength = a.node.value.length;
|
|
53914
54178
|
const bLength = b.node.value.length;
|
|
53915
54179
|
|
|
53916
|
-
return round
|
|
54180
|
+
return round(bLength / aLength) > 2;
|
|
53917
54181
|
}
|
|
53918
54182
|
|
|
53919
54183
|
function isInsideLoop(path) {
|
|
@@ -54003,7 +54267,7 @@ const isCurrentNewLine = (path) => {
|
|
|
54003
54267
|
|
|
54004
54268
|
const {
|
|
54005
54269
|
isStringLiteral: isStringLiteral$5,
|
|
54006
|
-
isArrayExpression: isArrayExpression$
|
|
54270
|
+
isArrayExpression: isArrayExpression$3,
|
|
54007
54271
|
isObjectExpression: isObjectExpression$3,
|
|
54008
54272
|
isTemplateLiteral: isTemplateLiteral$2,
|
|
54009
54273
|
} = lib_exports;
|
|
@@ -54042,8 +54306,8 @@ function isArrayInsideArray(path) {
|
|
|
54042
54306
|
return false;
|
|
54043
54307
|
|
|
54044
54308
|
const parentElements = path.parentPath.node.elements;
|
|
54045
|
-
const parentHasArrays = parentElements.filter(isArrayExpression$
|
|
54046
|
-
const lastNotArray = !isArrayExpression$
|
|
54309
|
+
const parentHasArrays = parentElements.filter(isArrayExpression$3).length;
|
|
54310
|
+
const lastNotArray = !isArrayExpression$3(parentElements.at(-1));
|
|
54047
54311
|
|
|
54048
54312
|
if (parentHasArrays && lastNotArray)
|
|
54049
54313
|
return false;
|
|
@@ -55639,7 +55903,7 @@ const {
|
|
|
55639
55903
|
isExportDeclaration: isExportDeclaration$2,
|
|
55640
55904
|
isDoWhileStatement,
|
|
55641
55905
|
isBlockStatement: isBlockStatement$4,
|
|
55642
|
-
isArrayExpression: isArrayExpression$
|
|
55906
|
+
isArrayExpression: isArrayExpression$2,
|
|
55643
55907
|
} = lib_exports;
|
|
55644
55908
|
|
|
55645
55909
|
const isFirstStatement = (path) => path.node.body[0];
|
|
@@ -55649,7 +55913,7 @@ const isMethodOrArrow = (path) => isArrowFunctionExpression(path) || isObjectMet
|
|
|
55649
55913
|
const isInsideArrayTupleOfThree = (path) => {
|
|
55650
55914
|
const {parentPath} = path.parentPath;
|
|
55651
55915
|
|
|
55652
|
-
if (!isArrayExpression$
|
|
55916
|
+
if (!isArrayExpression$2(parentPath))
|
|
55653
55917
|
return false;
|
|
55654
55918
|
|
|
55655
55919
|
const {length} = parentPath.node.elements;
|
|
@@ -55869,7 +56133,7 @@ const ForOfStatement = {
|
|
|
55869
56133
|
const {
|
|
55870
56134
|
isBlockStatement: isBlockStatement$3,
|
|
55871
56135
|
isFunctionDeclaration,
|
|
55872
|
-
isStatement: isStatement$
|
|
56136
|
+
isStatement: isStatement$2,
|
|
55873
56137
|
isExpressionStatement: isExpressionStatement$4,
|
|
55874
56138
|
isReturnStatement,
|
|
55875
56139
|
isContinueStatement,
|
|
@@ -55981,7 +56245,7 @@ const IfStatement = {
|
|
|
55981
56245
|
|
|
55982
56246
|
const nextPath = path.parentPath.getNextSibling();
|
|
55983
56247
|
|
|
55984
|
-
if (path === partOfAlternate && !isTopLevel(path) && !isStatement$
|
|
56248
|
+
if (path === partOfAlternate && !isTopLevel(path) && !isStatement$2(nextPath))
|
|
55985
56249
|
print.newline();
|
|
55986
56250
|
|
|
55987
56251
|
if (isLastEmptyInsideBody(path))
|
|
@@ -56239,7 +56503,7 @@ const isInsideAssignNextAssignFunction = (path) => {
|
|
|
56239
56503
|
|
|
56240
56504
|
const {
|
|
56241
56505
|
isBlockStatement: isBlockStatement$2,
|
|
56242
|
-
isProgram: isProgram$
|
|
56506
|
+
isProgram: isProgram$3,
|
|
56243
56507
|
isIfStatement,
|
|
56244
56508
|
} = lib_exports;
|
|
56245
56509
|
|
|
@@ -56268,7 +56532,7 @@ const printLeadingCommentBlock$1 = (path, printer, semantics, {printComment}) =>
|
|
|
56268
56532
|
if (hasTrailingComment(prev))
|
|
56269
56533
|
return;
|
|
56270
56534
|
|
|
56271
|
-
if (isBlockStatement$2(path.parentPath) && !isProgram$
|
|
56535
|
+
if (isBlockStatement$2(path.parentPath) && !isProgram$3(path.parentPath.parentPath))
|
|
56272
56536
|
indent();
|
|
56273
56537
|
|
|
56274
56538
|
printComment();
|
|
@@ -56839,9 +57103,13 @@ const TSDeclareFunction = {
|
|
|
56839
57103
|
|
|
56840
57104
|
printParams(path, printer, semantics);
|
|
56841
57105
|
|
|
56842
|
-
|
|
56843
|
-
|
|
56844
|
-
|
|
57106
|
+
const {returnType} = path.node;
|
|
57107
|
+
|
|
57108
|
+
if (returnType) {
|
|
57109
|
+
print(':');
|
|
57110
|
+
print.space();
|
|
57111
|
+
print('__returnType');
|
|
57112
|
+
}
|
|
56845
57113
|
}),
|
|
56846
57114
|
afterIf: (path) => !isInsideDefaultExport(path),
|
|
56847
57115
|
after: (path, {print}) => {
|
|
@@ -57867,413 +58135,170 @@ const JSXClosingElement = (path, {print}) => {
|
|
|
57867
58135
|
};
|
|
57868
58136
|
|
|
57869
58137
|
var baseVisitors = /*#__PURE__*/Object.freeze({
|
|
57870
|
-
|
|
57871
|
-
|
|
57872
|
-
|
|
57873
|
-
|
|
57874
|
-
|
|
57875
|
-
|
|
57876
|
-
|
|
57877
|
-
|
|
57878
|
-
|
|
57879
|
-
|
|
57880
|
-
|
|
57881
|
-
|
|
57882
|
-
|
|
57883
|
-
|
|
57884
|
-
|
|
57885
|
-
|
|
57886
|
-
|
|
57887
|
-
|
|
57888
|
-
|
|
57889
|
-
|
|
57890
|
-
|
|
57891
|
-
|
|
57892
|
-
|
|
57893
|
-
|
|
57894
|
-
|
|
57895
|
-
|
|
57896
|
-
|
|
57897
|
-
|
|
57898
|
-
|
|
57899
|
-
|
|
57900
|
-
|
|
57901
|
-
|
|
57902
|
-
|
|
57903
|
-
|
|
57904
|
-
|
|
57905
|
-
|
|
57906
|
-
|
|
57907
|
-
|
|
57908
|
-
|
|
57909
|
-
|
|
57910
|
-
|
|
57911
|
-
|
|
57912
|
-
|
|
57913
|
-
|
|
57914
|
-
|
|
57915
|
-
|
|
57916
|
-
|
|
57917
|
-
|
|
57918
|
-
|
|
57919
|
-
|
|
57920
|
-
|
|
57921
|
-
|
|
57922
|
-
|
|
57923
|
-
|
|
57924
|
-
|
|
57925
|
-
|
|
57926
|
-
|
|
57927
|
-
|
|
57928
|
-
|
|
57929
|
-
|
|
57930
|
-
|
|
57931
|
-
|
|
57932
|
-
|
|
57933
|
-
|
|
57934
|
-
|
|
57935
|
-
|
|
57936
|
-
|
|
57937
|
-
|
|
57938
|
-
|
|
57939
|
-
|
|
57940
|
-
|
|
57941
|
-
|
|
57942
|
-
|
|
57943
|
-
|
|
57944
|
-
|
|
57945
|
-
|
|
57946
|
-
|
|
57947
|
-
|
|
57948
|
-
|
|
57949
|
-
|
|
57950
|
-
|
|
57951
|
-
|
|
57952
|
-
|
|
57953
|
-
|
|
57954
|
-
|
|
57955
|
-
|
|
57956
|
-
|
|
57957
|
-
|
|
57958
|
-
|
|
57959
|
-
|
|
57960
|
-
|
|
57961
|
-
|
|
57962
|
-
|
|
57963
|
-
|
|
57964
|
-
|
|
57965
|
-
|
|
57966
|
-
|
|
57967
|
-
|
|
57968
|
-
|
|
57969
|
-
|
|
57970
|
-
|
|
57971
|
-
|
|
57972
|
-
|
|
57973
|
-
|
|
57974
|
-
|
|
57975
|
-
|
|
57976
|
-
|
|
57977
|
-
|
|
57978
|
-
|
|
57979
|
-
|
|
57980
|
-
|
|
57981
|
-
|
|
57982
|
-
|
|
57983
|
-
|
|
57984
|
-
|
|
57985
|
-
|
|
57986
|
-
|
|
57987
|
-
|
|
57988
|
-
|
|
57989
|
-
|
|
57990
|
-
|
|
57991
|
-
|
|
57992
|
-
|
|
57993
|
-
|
|
57994
|
-
|
|
57995
|
-
|
|
57996
|
-
|
|
57997
|
-
|
|
57998
|
-
|
|
57999
|
-
|
|
58000
|
-
|
|
58001
|
-
|
|
58002
|
-
|
|
58003
|
-
|
|
58004
|
-
|
|
58005
|
-
|
|
58006
|
-
|
|
58007
|
-
|
|
58008
|
-
|
|
58009
|
-
|
|
58010
|
-
|
|
58011
|
-
|
|
58012
|
-
|
|
58013
|
-
|
|
58014
|
-
|
|
58015
|
-
|
|
58016
|
-
|
|
58017
|
-
|
|
58018
|
-
|
|
58019
|
-
|
|
58020
|
-
|
|
58021
|
-
|
|
58022
|
-
|
|
58023
|
-
|
|
58024
|
-
|
|
58025
|
-
|
|
58026
|
-
|
|
58027
|
-
|
|
58028
|
-
|
|
58029
|
-
|
|
58030
|
-
|
|
58031
|
-
|
|
58138
|
+
__proto__: null,
|
|
58139
|
+
ArrayExpression: ArrayExpression,
|
|
58140
|
+
ArrayPattern: ArrayPattern,
|
|
58141
|
+
ArrowFunctionExpression: ArrowFunctionExpression,
|
|
58142
|
+
AssignmentExpression: AssignmentExpression,
|
|
58143
|
+
AssignmentPattern: AssignmentPattern,
|
|
58144
|
+
AwaitExpression: AwaitExpression,
|
|
58145
|
+
BigIntLiteral: BigIntLiteral,
|
|
58146
|
+
BinaryExpression: BinaryExpression,
|
|
58147
|
+
BlockStatement: BlockStatement,
|
|
58148
|
+
BooleanLiteral: BooleanLiteral,
|
|
58149
|
+
BreakStatement: BreakStatement,
|
|
58150
|
+
CallExpression: CallExpression,
|
|
58151
|
+
CatchClause: CatchClause,
|
|
58152
|
+
ClassAccessorProperty: ClassAccessorProperty,
|
|
58153
|
+
ClassDeclaration: ClassDeclaration,
|
|
58154
|
+
ClassExpression: ClassExpression,
|
|
58155
|
+
ClassMethod: ClassMethod,
|
|
58156
|
+
ClassPrivateMethod: ClassPrivateMethod,
|
|
58157
|
+
ClassPrivateProperty: ClassPrivateProperty,
|
|
58158
|
+
ClassProperty: ClassProperty,
|
|
58159
|
+
ConditionalExpression: ConditionalExpression,
|
|
58160
|
+
ContinueStatement: ContinueStatement,
|
|
58161
|
+
DebuggerStatement: DebuggerStatement,
|
|
58162
|
+
Decorator: Decorator,
|
|
58163
|
+
Directive: Directive,
|
|
58164
|
+
DirectiveLiteral: DirectiveLiteral,
|
|
58165
|
+
DoWhileStatement: DoWhileStatement,
|
|
58166
|
+
EmptyStatement: EmptyStatement,
|
|
58167
|
+
ExportAllDeclaration: ExportAllDeclaration,
|
|
58168
|
+
ExportDefaultDeclaration: ExportDefaultDeclaration,
|
|
58169
|
+
ExportDefaultSpecifier: ExportDefaultSpecifier,
|
|
58170
|
+
ExportNamedDeclaration: ExportNamedDeclaration,
|
|
58171
|
+
ExportNamespaceSpecifier: ExportNamespaceSpecifier,
|
|
58172
|
+
ExportSpecifier: ExportSpecifier,
|
|
58173
|
+
ExpressionStatement: ExpressionStatement,
|
|
58174
|
+
ForInStatement: ForInStatement,
|
|
58175
|
+
ForOfStatement: ForOfStatement,
|
|
58176
|
+
ForStatement: ForStatement,
|
|
58177
|
+
FunctionDeclaration: FunctionDeclaration,
|
|
58178
|
+
FunctionExpression: FunctionExpression,
|
|
58179
|
+
Identifier: Identifier,
|
|
58180
|
+
IfStatement: IfStatement,
|
|
58181
|
+
ImportAttribute: ImportAttribute,
|
|
58182
|
+
ImportDeclaration: ImportDeclaration,
|
|
58183
|
+
ImportExpression: ImportExpression,
|
|
58184
|
+
InterpreterDirective: InterpreterDirective,
|
|
58185
|
+
JSXAttribute: JSXAttribute,
|
|
58186
|
+
JSXClosingElement: JSXClosingElement,
|
|
58187
|
+
JSXClosingFragment: JSXClosingFragment,
|
|
58188
|
+
JSXElement: JSXElement,
|
|
58189
|
+
JSXEmptyExpression: JSXEmptyExpression,
|
|
58190
|
+
JSXExpressionContainer: JSXExpressionContainer,
|
|
58191
|
+
JSXFragment: JSXFragment,
|
|
58192
|
+
JSXIdentifier: JSXIdentifier,
|
|
58193
|
+
JSXMemberExpression: JSXMemberExpression,
|
|
58194
|
+
JSXOpeningElement: JSXOpeningElement,
|
|
58195
|
+
JSXOpeningFragment: JSXOpeningFragment,
|
|
58196
|
+
JSXSpreadAttribute: JSXSpreadAttribute,
|
|
58197
|
+
JSXText: JSXText,
|
|
58198
|
+
LabeledStatement: LabeledStatement,
|
|
58199
|
+
LogicalExpression: LogicalExpression,
|
|
58200
|
+
MemberExpression: MemberExpression,
|
|
58201
|
+
MetaProperty: MetaProperty,
|
|
58202
|
+
NewExpression: NewExpression,
|
|
58203
|
+
NullLiteral: NullLiteral,
|
|
58204
|
+
NumericLiteral: NumericLiteral,
|
|
58205
|
+
ObjectExpression: ObjectExpression,
|
|
58206
|
+
ObjectMethod: ObjectMethod,
|
|
58207
|
+
ObjectPattern: ObjectPattern,
|
|
58208
|
+
ObjectProperty: ObjectProperty,
|
|
58209
|
+
OptionalCallExpression: OptionalCallExpression,
|
|
58210
|
+
OptionalMemberExpression: OptionalMemberExpression,
|
|
58211
|
+
ParenthesizedExpression: ParenthesizedExpression,
|
|
58212
|
+
PrivateName: PrivateName,
|
|
58213
|
+
Program: Program,
|
|
58214
|
+
RegExpLiteral: RegExpLiteral,
|
|
58215
|
+
RestElement: RestElement,
|
|
58216
|
+
ReturnStatement: ReturnStatement,
|
|
58217
|
+
SequenceExpression: SequenceExpression,
|
|
58218
|
+
SpreadElement: SpreadElement,
|
|
58219
|
+
StaticBlock: StaticBlock,
|
|
58220
|
+
StringLiteral: StringLiteral,
|
|
58221
|
+
Super: Super,
|
|
58222
|
+
SwitchStatement: SwitchStatement,
|
|
58223
|
+
TSAnyKeyword: TSAnyKeyword,
|
|
58224
|
+
TSArrayType: TSArrayType,
|
|
58225
|
+
TSAsExpression: TSAsExpression,
|
|
58226
|
+
TSBigIntKeyword: TSBigIntKeyword,
|
|
58227
|
+
TSBooleanKeyword: TSBooleanKeyword,
|
|
58228
|
+
TSCallSignatureDeclaration: TSCallSignatureDeclaration,
|
|
58229
|
+
TSClassImplements: TSClassImplements,
|
|
58230
|
+
TSConditionalType: TSConditionalType,
|
|
58231
|
+
TSConstructSignatureDeclaration: TSConstructSignatureDeclaration,
|
|
58232
|
+
TSConstructorType: TSConstructorType,
|
|
58233
|
+
TSDeclareFunction: TSDeclareFunction,
|
|
58234
|
+
TSDeclareMethod: TSDeclareMethod,
|
|
58235
|
+
TSEnumDeclaration: TSEnumDeclaration,
|
|
58236
|
+
TSEnumMember: TSEnumMember,
|
|
58237
|
+
TSExportAssignment: TSExportAssignment,
|
|
58238
|
+
TSExternalModuleReference: TSExternalModuleReference,
|
|
58239
|
+
TSFunctionType: TSFunctionType,
|
|
58240
|
+
TSImportEqualsDeclaration: TSImportEqualsDeclaration,
|
|
58241
|
+
TSImportType: TSImportType,
|
|
58242
|
+
TSIndexSignature: TSIndexSignature,
|
|
58243
|
+
TSIndexedAccessType: TSIndexedAccessType,
|
|
58244
|
+
TSInferType: TSInferType,
|
|
58245
|
+
TSInstantiationExpression: TSInstantiationExpression,
|
|
58246
|
+
TSInterfaceBody: TSInterfaceBody,
|
|
58247
|
+
TSInterfaceDeclaration: TSInterfaceDeclaration,
|
|
58248
|
+
TSInterfaceHeritage: TSInterfaceHeritage,
|
|
58249
|
+
TSIntersectionType: TSIntersectionType,
|
|
58250
|
+
TSLiteralType: TSLiteralType,
|
|
58251
|
+
TSMappedType: TSMappedType,
|
|
58252
|
+
TSMethodSignature: TSMethodSignature,
|
|
58253
|
+
TSModuleBlock: TSModuleBlock,
|
|
58254
|
+
TSModuleDeclaration: TSModuleDeclaration,
|
|
58255
|
+
TSNamedTupleMember: TSNamedTupleMember,
|
|
58256
|
+
TSNeverKeyword: TSNeverKeyword,
|
|
58257
|
+
TSNonNullExpression: TSNonNullExpression,
|
|
58258
|
+
TSNullKeyword: TSNullKeyword,
|
|
58259
|
+
TSNumberKeyword: TSNumberKeyword,
|
|
58260
|
+
TSObjectKeyword: TSObjectKeyword,
|
|
58261
|
+
TSOptionalType: TSOptionalType,
|
|
58262
|
+
TSParameterProperty: TSParameterProperty,
|
|
58263
|
+
TSParenthesizedType: TSParenthesizedType,
|
|
58264
|
+
TSPropertySignature: TSPropertySignature,
|
|
58265
|
+
TSQualifiedName: TSQualifiedName,
|
|
58266
|
+
TSRestType: TSRestType,
|
|
58267
|
+
TSSatisfiesExpression: TSSatisfiesExpression,
|
|
58268
|
+
TSStringKeyword: TSStringKeyword,
|
|
58269
|
+
TSSymbolKeyword: TSSymbolKeyword,
|
|
58270
|
+
TSTemplateLiteralType: TSTemplateLiteralType,
|
|
58271
|
+
TSThisType: TSThisType,
|
|
58272
|
+
TSTupleType: TSTupleType,
|
|
58273
|
+
TSTypeAliasDeclaration: TSTypeAliasDeclaration,
|
|
58274
|
+
TSTypeAnnotation: TSTypeAnnotation,
|
|
58275
|
+
TSTypeAssertion: TSTypeAssertion,
|
|
58276
|
+
TSTypeLiteral: TSTypeLiteral,
|
|
58277
|
+
TSTypeOperator: TSTypeOperator,
|
|
58278
|
+
TSTypeParameter: TSTypeParameter,
|
|
58279
|
+
TSTypeParameterDeclaration: TSTypeParameterDeclaration,
|
|
58280
|
+
TSTypeParameterInstantiation: TSTypeParameterInstantiation,
|
|
58281
|
+
TSTypePredicate: TSTypePredicate,
|
|
58282
|
+
TSTypeQuery: TSTypeQuery,
|
|
58283
|
+
TSTypeReference: TSTypeReference,
|
|
58284
|
+
TSUndefinedKeyword: TSUndefinedKeyword,
|
|
58285
|
+
TSUnionType: TSUnionType,
|
|
58286
|
+
TSUnknownKeyword: TSUnknownKeyword,
|
|
58287
|
+
TSVoidKeyword: TSVoidKeyword,
|
|
58288
|
+
TaggedTemplateExpression: TaggedTemplateExpression,
|
|
58289
|
+
TemplateLiteral: TemplateLiteral,
|
|
58290
|
+
ThisExpression: ThisExpression,
|
|
58291
|
+
ThrowStatement: ThrowStatement,
|
|
58292
|
+
TryStatement: TryStatement,
|
|
58293
|
+
UnaryExpression: UnaryExpression,
|
|
58294
|
+
UpdateExpression: UpdateExpression,
|
|
58295
|
+
VariableDeclaration: VariableDeclaration,
|
|
58296
|
+
VoidPattern: VoidPattern,
|
|
58297
|
+
WhileStatement: WhileStatement,
|
|
58298
|
+
WithStatement: WithStatement,
|
|
58299
|
+
YieldExpression: YieldExpression
|
|
58032
58300
|
});
|
|
58033
58301
|
|
|
58034
|
-
const isString$c = (a) => typeof a === 'string';
|
|
58035
|
-
const constant = (a) => () => a;
|
|
58036
|
-
const {keys: keys$3} = Object;
|
|
58037
|
-
|
|
58038
|
-
var rendy = (template, values, modifiers) => {
|
|
58039
|
-
check$e(template, values);
|
|
58040
|
-
|
|
58041
|
-
let result = template;
|
|
58042
|
-
|
|
58043
|
-
const names = !modifiers ? keys$3(values) : template.match(/{{(.*?)}}/g);
|
|
58044
|
-
|
|
58045
|
-
for (const key of names) {
|
|
58046
|
-
const [parsedKey, value] = parseValue$1(key, values, modifiers);
|
|
58047
|
-
const str = constant(value);
|
|
58048
|
-
|
|
58049
|
-
while (result.includes(parsedKey))
|
|
58050
|
-
result = result.replace(parsedKey, str);
|
|
58051
|
-
}
|
|
58052
|
-
|
|
58053
|
-
if (result.includes('{{'))
|
|
58054
|
-
result = result.replace(/{{.*?}}/g, '');
|
|
58055
|
-
|
|
58056
|
-
return result;
|
|
58057
|
-
};
|
|
58058
|
-
|
|
58059
|
-
function check$e(template, values) {
|
|
58060
|
-
if (!isString$c(template))
|
|
58061
|
-
throw Error('template should be a string!');
|
|
58062
|
-
|
|
58063
|
-
if (typeof values !== 'object')
|
|
58064
|
-
throw Error('values should be an object!');
|
|
58065
|
-
}
|
|
58066
|
-
|
|
58067
|
-
function parseValue$1(key, values, modifiers) {
|
|
58068
|
-
if (!modifiers)
|
|
58069
|
-
return [
|
|
58070
|
-
`{{ ${key} }}`,
|
|
58071
|
-
values[key],
|
|
58072
|
-
];
|
|
58073
|
-
|
|
58074
|
-
const preparedKey = key
|
|
58075
|
-
.replaceAll('{{', '')
|
|
58076
|
-
.replaceAll('}}', '')
|
|
58077
|
-
.replaceAll(' ', '');
|
|
58078
|
-
|
|
58079
|
-
const value = values[preparedKey] || '';
|
|
58080
|
-
|
|
58081
|
-
if (!preparedKey.includes('|'))
|
|
58082
|
-
return [key, value];
|
|
58083
|
-
|
|
58084
|
-
const [name, modifierName] = preparedKey.split('|');
|
|
58085
|
-
const fn = modifiers[modifierName];
|
|
58086
|
-
const currentValue = values[name];
|
|
58087
|
-
|
|
58088
|
-
if (!fn)
|
|
58089
|
-
return [key, currentValue];
|
|
58090
|
-
|
|
58091
|
-
return [key, fn(currentValue)];
|
|
58092
|
-
}
|
|
58093
|
-
|
|
58094
|
-
var rendy$1 = rendy.default;
|
|
58095
|
-
|
|
58096
|
-
var maybeSatisfy = (plugin) => {
|
|
58097
|
-
if (!plugin.afterSatisfy && !plugin.beforeSatisfy && !plugin.satisfy)
|
|
58098
|
-
return plugin;
|
|
58099
|
-
|
|
58100
|
-
const {
|
|
58101
|
-
satisfy,
|
|
58102
|
-
afterSatisfy = satisfy,
|
|
58103
|
-
beforeSatisfy = satisfy,
|
|
58104
|
-
} = plugin;
|
|
58105
|
-
|
|
58106
|
-
return {
|
|
58107
|
-
afterIf: createIf(afterSatisfy),
|
|
58108
|
-
beforeIf: createIf(beforeSatisfy),
|
|
58109
|
-
...plugin,
|
|
58110
|
-
};
|
|
58111
|
-
};
|
|
58112
|
-
|
|
58113
|
-
const createIf = (getConditions) => {
|
|
58114
|
-
const conditions = getConditions?.() || [];
|
|
58115
|
-
return satisfy(conditions);
|
|
58116
|
-
};
|
|
58117
|
-
|
|
58118
|
-
const {
|
|
58119
|
-
isProgram: isProgram$3,
|
|
58120
|
-
isFile: isFile$1,
|
|
58121
|
-
isStatement: isStatement$2,
|
|
58122
|
-
expressionStatement,
|
|
58123
|
-
program,
|
|
58124
|
-
file,
|
|
58125
|
-
} = lib_exports;
|
|
58126
|
-
|
|
58127
|
-
const isFn$6 = (a) => typeof a === 'function';
|
|
58128
|
-
|
|
58129
|
-
const maybeThrow = (a, path, b) => {
|
|
58130
|
-
if (!a)
|
|
58131
|
-
return;
|
|
58132
|
-
|
|
58133
|
-
throw Error(rendy$1(b, {
|
|
58134
|
-
path,
|
|
58135
|
-
type: path.type,
|
|
58136
|
-
}));
|
|
58137
|
-
};
|
|
58138
|
-
|
|
58139
|
-
const maybeStatement = (ast) => isStatement$2(ast) ? ast : expressionStatement(ast);
|
|
58140
|
-
|
|
58141
|
-
const maybeProgram = (ast) => isProgram$3(ast) ? ast : program([
|
|
58142
|
-
maybeStatement(ast),
|
|
58143
|
-
]);
|
|
58144
|
-
|
|
58145
|
-
const maybeFile = (ast) => isFile$1(ast) ? ast : file(maybeProgram(ast));
|
|
58146
|
-
|
|
58147
|
-
const maybeVisitor = (plugin, path, printer, options) => {
|
|
58148
|
-
if (isFn$6(plugin))
|
|
58149
|
-
return plugin(path, printer, options);
|
|
58150
|
-
|
|
58151
|
-
return objectPlugin(plugin, path, printer, options);
|
|
58152
|
-
};
|
|
58153
|
-
|
|
58154
|
-
function objectPlugin(plugin, path, printer, semantics) {
|
|
58155
|
-
const {
|
|
58156
|
-
print,
|
|
58157
|
-
split,
|
|
58158
|
-
condition,
|
|
58159
|
-
before = split,
|
|
58160
|
-
beforeIf = condition,
|
|
58161
|
-
after = split,
|
|
58162
|
-
afterIf = condition,
|
|
58163
|
-
} = maybeSatisfy(plugin);
|
|
58164
|
-
|
|
58165
|
-
if (beforeIf?.(path, printer, semantics))
|
|
58166
|
-
before(path, printer, semantics);
|
|
58167
|
-
|
|
58168
|
-
print(path, printer, semantics);
|
|
58169
|
-
|
|
58170
|
-
if (afterIf?.(path, printer, semantics))
|
|
58171
|
-
after(path, printer, semantics);
|
|
58172
|
-
}
|
|
58173
|
-
|
|
58174
|
-
var stringSnakeCase = snakeCase;
|
|
58175
|
-
|
|
58176
|
-
/*
|
|
58177
|
-
snakeCase('the quick brown fox'); // 'the_quick_brown_fox'
|
|
58178
|
-
snakeCase('the-quick-brown-fox'); // 'the_quick_brown_fox'
|
|
58179
|
-
snakeCase('the_quick_brown_fox'); // 'the_quick_brown_fox'
|
|
58180
|
-
snakeCase('theQuickBrownFox'); // 'the_quick_brown_fox'
|
|
58181
|
-
snakeCase('theQuickBrown Fox'); // 'the_quick_brown_Fox'
|
|
58182
|
-
snakeCase('thequickbrownfox'); // 'thequickbrownfox'
|
|
58183
|
-
snakeCase('the - quick * brown# fox'); // 'the_quick_brown_fox'
|
|
58184
|
-
snakeCase('theQUICKBrownFox'); // 'the_q_u_i_c_k_brown_fox'
|
|
58185
|
-
*/
|
|
58186
|
-
|
|
58187
|
-
// any combination of spaces and punctuation characters
|
|
58188
|
-
// thanks to http://stackoverflow.com/a/25575009
|
|
58189
|
-
var wordSeparators = /[\s\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/;
|
|
58190
|
-
var capitals = /[A-Z\u00C0-\u00D6\u00D9-\u00DD]/g;
|
|
58191
|
-
|
|
58192
|
-
function snakeCase(str) {
|
|
58193
|
-
//replace capitals with space + lower case equivalent for later parsing
|
|
58194
|
-
str = str.replace(capitals, function(match) {
|
|
58195
|
-
return ' ' + (match.toLowerCase() || match);
|
|
58196
|
-
});
|
|
58197
|
-
return str
|
|
58198
|
-
.trim()
|
|
58199
|
-
.split(wordSeparators)
|
|
58200
|
-
.join('_');
|
|
58201
|
-
}
|
|
58202
|
-
|
|
58203
|
-
const {stringify: stringify$7} = JSON;
|
|
58204
|
-
const {
|
|
58205
|
-
LOG,
|
|
58206
|
-
LOG_ALL,
|
|
58207
|
-
LOG_TOKENS,
|
|
58208
|
-
LOG_TERM,
|
|
58209
|
-
LOG_DEBUG,
|
|
58210
|
-
} = {};
|
|
58211
|
-
|
|
58212
|
-
const createDebug$3 = (tokens) => (a) => {
|
|
58213
|
-
if (!LOG_DEBUG)
|
|
58214
|
-
return;
|
|
58215
|
-
|
|
58216
|
-
tokens.push({
|
|
58217
|
-
type: TYPES$3.DEBUG,
|
|
58218
|
-
value: `/*__${stringSnakeCase(a)}*/`,
|
|
58219
|
-
});
|
|
58220
|
-
};
|
|
58221
|
-
|
|
58222
|
-
const createLog = ({newline = '\n', store = createStore$1()} = {}) => ({type, value}) => {
|
|
58223
|
-
if (LOG_TOKENS) {
|
|
58224
|
-
console.log(codeFrameColumns(stringify$7({
|
|
58225
|
-
type,
|
|
58226
|
-
value,
|
|
58227
|
-
}), {}, {
|
|
58228
|
-
highlightCode: true,
|
|
58229
|
-
}));
|
|
58230
|
-
|
|
58231
|
-
return;
|
|
58232
|
-
}
|
|
58233
|
-
|
|
58234
|
-
if (LOG_ALL) {
|
|
58235
|
-
console.log(codeFrameColumns(value, {}, {
|
|
58236
|
-
highlightCode: true,
|
|
58237
|
-
}));
|
|
58238
|
-
|
|
58239
|
-
return;
|
|
58240
|
-
}
|
|
58241
|
-
|
|
58242
|
-
if (LOG) {
|
|
58243
|
-
if (value === newline) {
|
|
58244
|
-
console.log(codeFrameColumns(store(), {}, {
|
|
58245
|
-
highlightCode: true,
|
|
58246
|
-
}));
|
|
58247
|
-
|
|
58248
|
-
return;
|
|
58249
|
-
}
|
|
58250
|
-
|
|
58251
|
-
store(value);
|
|
58252
|
-
}
|
|
58253
|
-
|
|
58254
|
-
if (LOG_TERM)
|
|
58255
|
-
browser$1.stdout.write(value);
|
|
58256
|
-
};
|
|
58257
|
-
|
|
58258
|
-
function createStore$1() {
|
|
58259
|
-
let chunks = [];
|
|
58260
|
-
|
|
58261
|
-
return (...args) => {
|
|
58262
|
-
const [chunk] = args;
|
|
58263
|
-
|
|
58264
|
-
if (args.length) {
|
|
58265
|
-
chunks.push(chunk);
|
|
58266
|
-
return;
|
|
58267
|
-
}
|
|
58268
|
-
|
|
58269
|
-
const result = chunks.join('');
|
|
58270
|
-
|
|
58271
|
-
chunks = [];
|
|
58272
|
-
|
|
58273
|
-
return result;
|
|
58274
|
-
};
|
|
58275
|
-
}
|
|
58276
|
-
|
|
58277
58302
|
const isObject$7 = (a) => a && typeof a === 'object';
|
|
58278
58303
|
const isBool$3 = (a) => typeof a === 'boolean';
|
|
58279
58304
|
|
|
@@ -58369,40 +58394,13 @@ const initSemantics = (format, semantics = {}) => ({
|
|
|
58369
58394
|
roundBraces: parseRoundBraces(semantics),
|
|
58370
58395
|
});
|
|
58371
58396
|
|
|
58372
|
-
const
|
|
58373
|
-
const {round} = Math;
|
|
58374
|
-
const isString$b = (a) => typeof a === 'string';
|
|
58375
|
-
const {assign: assign$9, freeze} = Object;
|
|
58376
|
-
|
|
58377
|
-
const GET = '__';
|
|
58378
|
-
const get = (path, command) => path.get(command.replace(GET, ''));
|
|
58379
|
-
|
|
58380
|
-
const createAddToken = (tokens) => {
|
|
58381
|
-
const log = createLog();
|
|
58382
|
-
|
|
58383
|
-
return (token) => {
|
|
58384
|
-
log(token);
|
|
58385
|
-
tokens.push(token);
|
|
58386
|
-
};
|
|
58387
|
-
};
|
|
58397
|
+
const {assign: assign$a} = Object;
|
|
58388
58398
|
|
|
58389
|
-
const
|
|
58390
|
-
|
|
58391
|
-
visitors,
|
|
58392
|
-
format,
|
|
58393
|
-
semantics,
|
|
58394
|
-
} = parseOverrides(overrides);
|
|
58395
|
-
|
|
58396
|
-
const tokens = [];
|
|
58397
|
-
const addToken = createAddToken(tokens);
|
|
58398
|
-
const debug = createDebug$3(tokens);
|
|
58399
|
+
const createIndent = ({format, addToken}) => {
|
|
58400
|
+
let i = 0;
|
|
58399
58401
|
|
|
58400
|
-
const
|
|
58401
|
-
|
|
58402
|
-
type: TYPES$3.TOKEN,
|
|
58403
|
-
value,
|
|
58404
|
-
});
|
|
58405
|
-
};
|
|
58402
|
+
const incIndent = () => ++i;
|
|
58403
|
+
const decIndent = () => --i;
|
|
58406
58404
|
|
|
58407
58405
|
const indent = () => {
|
|
58408
58406
|
addToken({
|
|
@@ -58411,73 +58409,87 @@ const tokenize = (ast, overrides) => {
|
|
|
58411
58409
|
});
|
|
58412
58410
|
};
|
|
58413
58411
|
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
|
|
58412
|
+
assign$a(indent, {
|
|
58413
|
+
inc: incIndent,
|
|
58414
|
+
dec: decIndent,
|
|
58415
|
+
getLevel() {
|
|
58416
|
+
return i;
|
|
58417
|
+
},
|
|
58418
|
+
});
|
|
58419
58419
|
|
|
58420
|
-
|
|
58421
|
-
|
|
58422
|
-
|
|
58423
|
-
|
|
58424
|
-
|
|
58425
|
-
|
|
58420
|
+
return indent;
|
|
58421
|
+
};
|
|
58422
|
+
|
|
58423
|
+
function printIndent(i, indent) {
|
|
58424
|
+
let result = '';
|
|
58425
|
+
++i;
|
|
58426
58426
|
|
|
58427
|
-
|
|
58427
|
+
while (--i > 0) {
|
|
58428
|
+
result += indent;
|
|
58429
|
+
}
|
|
58428
58430
|
|
|
58429
|
-
|
|
58430
|
-
|
|
58431
|
-
|
|
58432
|
-
|
|
58431
|
+
return result;
|
|
58432
|
+
}
|
|
58433
|
+
|
|
58434
|
+
const isObject$6 = (a) => a && typeof a === 'object';
|
|
58435
|
+
const isString$c = (a) => typeof a === 'string';
|
|
58436
|
+
|
|
58437
|
+
const GET = '__';
|
|
58438
|
+
const get = (path, command) => path.get(command.replace(GET, ''));
|
|
58439
|
+
|
|
58440
|
+
const {freeze, assign: assign$9} = Object;
|
|
58441
|
+
|
|
58442
|
+
const createPrinter = (overrides) => {
|
|
58443
|
+
const tokens = [];
|
|
58444
|
+
const {
|
|
58445
|
+
format,
|
|
58446
|
+
semantics,
|
|
58447
|
+
visitors,
|
|
58448
|
+
} = parseOverrides(overrides);
|
|
58433
58449
|
|
|
58434
|
-
const
|
|
58450
|
+
const addToken = createAddToken(tokens);
|
|
58451
|
+
const debug = createDebug$3(tokens);
|
|
58452
|
+
const write = createWrite(addToken);
|
|
58435
58453
|
|
|
58436
|
-
const
|
|
58437
|
-
|
|
58438
|
-
|
|
58439
|
-
};
|
|
58454
|
+
const indent = createIndent({
|
|
58455
|
+
format,
|
|
58456
|
+
addToken,
|
|
58457
|
+
});
|
|
58440
58458
|
|
|
58441
|
-
const
|
|
58442
|
-
|
|
58459
|
+
const newline = createNewline({
|
|
58460
|
+
format,
|
|
58461
|
+
addToken,
|
|
58462
|
+
});
|
|
58443
58463
|
|
|
58444
|
-
const
|
|
58445
|
-
|
|
58446
|
-
|
|
58447
|
-
|
|
58448
|
-
});
|
|
58449
|
-
};
|
|
58464
|
+
const breakline = createBreakline({
|
|
58465
|
+
newline,
|
|
58466
|
+
indent,
|
|
58467
|
+
});
|
|
58450
58468
|
|
|
58451
|
-
const
|
|
58452
|
-
|
|
58453
|
-
|
|
58454
|
-
|
|
58469
|
+
const linebreak = createLinebreak({
|
|
58470
|
+
indent,
|
|
58471
|
+
newline,
|
|
58472
|
+
});
|
|
58455
58473
|
|
|
58456
|
-
|
|
58457
|
-
|
|
58458
|
-
|
|
58474
|
+
const space = createSpace({
|
|
58475
|
+
format,
|
|
58476
|
+
addToken,
|
|
58459
58477
|
});
|
|
58460
58478
|
|
|
58461
|
-
const splitter = (
|
|
58462
|
-
|
|
58463
|
-
|
|
58464
|
-
|
|
58465
|
-
});
|
|
58466
|
-
};
|
|
58479
|
+
const splitter = createSplitter({
|
|
58480
|
+
format,
|
|
58481
|
+
addToken,
|
|
58482
|
+
});
|
|
58467
58483
|
|
|
58468
|
-
const
|
|
58469
|
-
|
|
58470
|
-
|
|
58471
|
-
|
|
58472
|
-
});
|
|
58473
|
-
};
|
|
58484
|
+
const endOfFile = createEndOfFile({
|
|
58485
|
+
format,
|
|
58486
|
+
addToken,
|
|
58487
|
+
});
|
|
58474
58488
|
|
|
58475
|
-
const
|
|
58476
|
-
addToken
|
|
58477
|
-
|
|
58478
|
-
|
|
58479
|
-
});
|
|
58480
|
-
};
|
|
58489
|
+
const quote = createQuote({
|
|
58490
|
+
addToken,
|
|
58491
|
+
format,
|
|
58492
|
+
});
|
|
58481
58493
|
|
|
58482
58494
|
assign$9(write, {
|
|
58483
58495
|
indent,
|
|
@@ -58490,6 +58502,15 @@ const tokenize = (ast, overrides) => {
|
|
|
58490
58502
|
endOfFile,
|
|
58491
58503
|
});
|
|
58492
58504
|
|
|
58505
|
+
const maybeBreakline = createMaybe(breakline);
|
|
58506
|
+
const maybeNewline = createMaybe(newline);
|
|
58507
|
+
const maybeLinebreak = createMaybe(linebreak);
|
|
58508
|
+
const maybeSpace = createMaybe(space);
|
|
58509
|
+
|
|
58510
|
+
const maybeWrite = createMaybeWrite({
|
|
58511
|
+
write,
|
|
58512
|
+
});
|
|
58513
|
+
|
|
58493
58514
|
assign$9(maybeWrite, {
|
|
58494
58515
|
newline: maybeNewline,
|
|
58495
58516
|
breakline: maybeBreakline,
|
|
@@ -58497,6 +58518,8 @@ const tokenize = (ast, overrides) => {
|
|
|
58497
58518
|
space: maybeSpace,
|
|
58498
58519
|
});
|
|
58499
58520
|
|
|
58521
|
+
const maybeIndent = createMaybe(indent);
|
|
58522
|
+
|
|
58500
58523
|
const maybe = {
|
|
58501
58524
|
indent: maybeIndent,
|
|
58502
58525
|
markAfter: maybeMarkAfter,
|
|
@@ -58504,117 +58527,138 @@ const tokenize = (ast, overrides) => {
|
|
|
58504
58527
|
space: maybeSpace,
|
|
58505
58528
|
};
|
|
58506
58529
|
|
|
58530
|
+
const maybeIndentInc = createMaybe(indent.inc);
|
|
58531
|
+
const maybeIndentDec = createMaybe(indent.dec);
|
|
58532
|
+
|
|
58507
58533
|
assign$9(maybe.indent, {
|
|
58508
58534
|
inc: maybeIndentInc,
|
|
58509
58535
|
dec: maybeIndentDec,
|
|
58510
58536
|
});
|
|
58511
58537
|
|
|
58538
|
+
const getMainPrinter = () => mainPrinter;
|
|
58539
|
+
|
|
58540
|
+
const traverse = createTraverse$6({
|
|
58541
|
+
maybeNewline,
|
|
58542
|
+
maybeLinebreak,
|
|
58543
|
+
maybeSpace,
|
|
58544
|
+
maybeBreakline,
|
|
58545
|
+
indent,
|
|
58546
|
+
write,
|
|
58547
|
+
debug,
|
|
58548
|
+
semantics,
|
|
58549
|
+
visitors,
|
|
58550
|
+
getMainPrinter,
|
|
58551
|
+
});
|
|
58552
|
+
|
|
58512
58553
|
// should never change to avoid unexpected errors related to printing path, since it hard to debug
|
|
58513
58554
|
const mainPrinter = freeze({
|
|
58514
58555
|
indent,
|
|
58515
58556
|
write,
|
|
58516
58557
|
debug,
|
|
58517
|
-
traverse,
|
|
58518
58558
|
maybe,
|
|
58519
58559
|
quote,
|
|
58520
58560
|
store: fullstore(),
|
|
58561
|
+
traverse,
|
|
58521
58562
|
});
|
|
58522
58563
|
|
|
58564
|
+
const getTokens = () => tokens;
|
|
58565
|
+
|
|
58566
|
+
return {
|
|
58567
|
+
getTokens,
|
|
58568
|
+
traverse,
|
|
58569
|
+
};
|
|
58570
|
+
};
|
|
58571
|
+
|
|
58572
|
+
const createTraverse$6 = (overrides) => function traverse(path) {
|
|
58573
|
+
const {
|
|
58574
|
+
write,
|
|
58575
|
+
debug,
|
|
58576
|
+
maybeLinebreak,
|
|
58577
|
+
maybeSpace,
|
|
58578
|
+
maybeBreakline,
|
|
58579
|
+
maybeNewline,
|
|
58580
|
+
indent,
|
|
58581
|
+
semantics,
|
|
58582
|
+
visitors,
|
|
58583
|
+
getMainPrinter,
|
|
58584
|
+
} = overrides;
|
|
58585
|
+
|
|
58586
|
+
const mainPrinter = getMainPrinter();
|
|
58587
|
+
|
|
58523
58588
|
const currentTraversers = {
|
|
58524
58589
|
...baseVisitors,
|
|
58525
58590
|
...visitors,
|
|
58526
58591
|
};
|
|
58527
58592
|
|
|
58528
|
-
|
|
58529
|
-
|
|
58530
|
-
else
|
|
58531
|
-
traverse3(maybeFile(ast), {
|
|
58532
|
-
Program(path) {
|
|
58533
|
-
traverse(path);
|
|
58534
|
-
path.stop();
|
|
58535
|
-
},
|
|
58536
|
-
});
|
|
58593
|
+
const {type} = path;
|
|
58594
|
+
const currentTraverse = currentTraversers[type];
|
|
58537
58595
|
|
|
58538
|
-
|
|
58539
|
-
|
|
58540
|
-
const currentTraverse = currentTraversers[type];
|
|
58541
|
-
|
|
58542
|
-
if (!path.node)
|
|
58543
|
-
return;
|
|
58544
|
-
|
|
58545
|
-
const print = createPrint(path, {
|
|
58546
|
-
write,
|
|
58547
|
-
traverse,
|
|
58548
|
-
});
|
|
58549
|
-
|
|
58550
|
-
assign$9(print, write, {
|
|
58551
|
-
space,
|
|
58552
|
-
round,
|
|
58553
|
-
});
|
|
58554
|
-
|
|
58555
|
-
const printer = {
|
|
58556
|
-
...mainPrinter,
|
|
58557
|
-
print,
|
|
58558
|
-
};
|
|
58559
|
-
|
|
58560
|
-
const maybePrint = (a, b) => a && print(b);
|
|
58561
|
-
|
|
58562
|
-
assign$9(maybePrint, {
|
|
58563
|
-
newline: maybeNewline,
|
|
58564
|
-
breakline: maybeBreakline,
|
|
58565
|
-
linebreak: maybeLinebreak,
|
|
58566
|
-
space: maybeSpace,
|
|
58567
|
-
});
|
|
58568
|
-
|
|
58569
|
-
assign$9(printer.maybe, {
|
|
58570
|
-
print: maybePrint,
|
|
58571
|
-
});
|
|
58572
|
-
|
|
58573
|
-
maybeThrow(!currentTraverse, path, `☝️ Node type '{{ type }}' is not supported yet by @putout/printer: '{{ path }}'`);
|
|
58574
|
-
|
|
58575
|
-
const currentIndent = i;
|
|
58576
|
-
parseLeadingComments(path, printer, semantics, {
|
|
58577
|
-
currentTraverse,
|
|
58578
|
-
});
|
|
58579
|
-
|
|
58580
|
-
// this is main thing
|
|
58581
|
-
maybeVisitor(currentTraverse, path, printer, semantics);
|
|
58582
|
-
parseTrailingComments(path, printer, semantics, {
|
|
58583
|
-
currentTraverse,
|
|
58584
|
-
});
|
|
58585
|
-
maybeThrow(i !== currentIndent, path, `☝️Looks like indent level changed after token visitor: '{{ type }}', for code: '{{ path }}'`);
|
|
58586
|
-
|
|
58587
|
-
debug(path.type);
|
|
58588
|
-
}
|
|
58596
|
+
if (!path.node)
|
|
58597
|
+
return;
|
|
58589
58598
|
|
|
58590
|
-
|
|
58591
|
-
|
|
58592
|
-
|
|
58593
|
-
|
|
58594
|
-
let result = '';
|
|
58595
|
-
++i;
|
|
58599
|
+
const print = createPrint(path, {
|
|
58600
|
+
write,
|
|
58601
|
+
traverse,
|
|
58602
|
+
});
|
|
58596
58603
|
|
|
58597
|
-
|
|
58598
|
-
|
|
58599
|
-
|
|
58604
|
+
const printer = {
|
|
58605
|
+
...mainPrinter,
|
|
58606
|
+
traverse,
|
|
58607
|
+
print,
|
|
58608
|
+
};
|
|
58600
58609
|
|
|
58601
|
-
|
|
58602
|
-
|
|
58603
|
-
|
|
58604
|
-
|
|
58605
|
-
|
|
58606
|
-
|
|
58610
|
+
const maybePrint = (a, b) => a && print(b);
|
|
58611
|
+
|
|
58612
|
+
assign$9(maybePrint, {
|
|
58613
|
+
newline: maybeNewline,
|
|
58614
|
+
breakline: maybeBreakline,
|
|
58615
|
+
linebreak: maybeLinebreak,
|
|
58616
|
+
space: maybeSpace,
|
|
58617
|
+
});
|
|
58618
|
+
|
|
58619
|
+
assign$9(printer.maybe, {
|
|
58620
|
+
print: maybePrint,
|
|
58621
|
+
});
|
|
58622
|
+
|
|
58623
|
+
maybeThrow(!currentTraverse, path, `☝️ Node type '{{ type }}' is not supported yet by @putout/printer: '{{ path }}'`);
|
|
58624
|
+
|
|
58625
|
+
const currentIndent = indent.getLevel();
|
|
58626
|
+
|
|
58627
|
+
parseLeadingComments(path, printer, semantics, {
|
|
58628
|
+
currentTraverse,
|
|
58629
|
+
});
|
|
58607
58630
|
|
|
58608
|
-
|
|
58631
|
+
// this is main thing
|
|
58632
|
+
maybeVisitor(currentTraverse, path, printer, semantics);
|
|
58633
|
+
parseTrailingComments(path, printer, semantics, {
|
|
58634
|
+
currentTraverse,
|
|
58635
|
+
});
|
|
58609
58636
|
|
|
58610
|
-
|
|
58611
|
-
return traverse(computed);
|
|
58637
|
+
maybeThrow(indent.getLevel() !== currentIndent, path, `☝️Looks like indent level changed after token visitor: '{{ type }}', for code: '{{ path }}'`);
|
|
58612
58638
|
|
|
58613
|
-
|
|
58639
|
+
debug(path.type);
|
|
58640
|
+
};
|
|
58641
|
+
|
|
58642
|
+
const createPrint = (path, {traverse, write}) => {
|
|
58643
|
+
const print = (maybeLine) => {
|
|
58644
|
+
if (maybeLine === path)
|
|
58645
|
+
return null;
|
|
58646
|
+
|
|
58647
|
+
const computed = computePath(path, maybeLine);
|
|
58648
|
+
|
|
58649
|
+
if (isObject$6(computed))
|
|
58650
|
+
return traverse(computed);
|
|
58651
|
+
|
|
58652
|
+
return write(computed);
|
|
58653
|
+
};
|
|
58654
|
+
|
|
58655
|
+
assign$9(print, write);
|
|
58656
|
+
|
|
58657
|
+
return print;
|
|
58614
58658
|
};
|
|
58615
58659
|
|
|
58616
58660
|
const computePath = (path, maybeLine) => {
|
|
58617
|
-
if (isString$
|
|
58661
|
+
if (isString$c(maybeLine) && maybeLine.startsWith(GET))
|
|
58618
58662
|
return get(path, maybeLine);
|
|
58619
58663
|
|
|
58620
58664
|
if (isObject$6(maybeLine))
|
|
@@ -58623,6 +58667,87 @@ const computePath = (path, maybeLine) => {
|
|
|
58623
58667
|
return maybeLine;
|
|
58624
58668
|
};
|
|
58625
58669
|
|
|
58670
|
+
const createWrite = (addToken) => (value) => {
|
|
58671
|
+
addToken({
|
|
58672
|
+
type: TYPES$3.TOKEN,
|
|
58673
|
+
value,
|
|
58674
|
+
});
|
|
58675
|
+
};
|
|
58676
|
+
|
|
58677
|
+
const createNewline = ({format, addToken}) => () => {
|
|
58678
|
+
addToken({
|
|
58679
|
+
type: TYPES$3.NEWLINE,
|
|
58680
|
+
value: format.newline,
|
|
58681
|
+
});
|
|
58682
|
+
};
|
|
58683
|
+
|
|
58684
|
+
const createMaybe = (fn) => (a) => a && fn();
|
|
58685
|
+
|
|
58686
|
+
const createBreakline = ({newline, indent}) => () => {
|
|
58687
|
+
newline();
|
|
58688
|
+
indent();
|
|
58689
|
+
};
|
|
58690
|
+
|
|
58691
|
+
const createLinebreak = ({indent, newline}) => () => {
|
|
58692
|
+
indent();
|
|
58693
|
+
newline();
|
|
58694
|
+
};
|
|
58695
|
+
|
|
58696
|
+
const createMaybeWrite = ({write}) => (a, b) => a && write(b);
|
|
58697
|
+
|
|
58698
|
+
const createSpace = ({format, addToken}) => () => {
|
|
58699
|
+
addToken({
|
|
58700
|
+
type: TYPES$3.SPACE,
|
|
58701
|
+
value: format.space,
|
|
58702
|
+
});
|
|
58703
|
+
};
|
|
58704
|
+
|
|
58705
|
+
const createSplitter = ({format, addToken}) => () => {
|
|
58706
|
+
addToken({
|
|
58707
|
+
type: TYPES$3.SPLITTER,
|
|
58708
|
+
value: format.splitter,
|
|
58709
|
+
});
|
|
58710
|
+
};
|
|
58711
|
+
|
|
58712
|
+
const createQuote = ({addToken, format}) => () => {
|
|
58713
|
+
addToken({
|
|
58714
|
+
type: TYPES$3.QUOTE,
|
|
58715
|
+
value: format.quote,
|
|
58716
|
+
});
|
|
58717
|
+
};
|
|
58718
|
+
|
|
58719
|
+
const createEndOfFile = ({format, addToken}) => () => {
|
|
58720
|
+
addToken({
|
|
58721
|
+
type: TYPES$3.END_OF_FILE,
|
|
58722
|
+
value: format.endOfFile,
|
|
58723
|
+
});
|
|
58724
|
+
};
|
|
58725
|
+
|
|
58726
|
+
const createAddToken = (tokens) => {
|
|
58727
|
+
const log = createLog();
|
|
58728
|
+
|
|
58729
|
+
return (token) => {
|
|
58730
|
+
log(token);
|
|
58731
|
+
tokens.push(token);
|
|
58732
|
+
};
|
|
58733
|
+
};
|
|
58734
|
+
|
|
58735
|
+
const tokenize = (ast, overrides) => {
|
|
58736
|
+
const {getTokens, traverse} = createPrinter(overrides);
|
|
58737
|
+
|
|
58738
|
+
if (ast.parentPath)
|
|
58739
|
+
pathTraverse(ast, traverse);
|
|
58740
|
+
else
|
|
58741
|
+
traverse3(maybeFile(ast), {
|
|
58742
|
+
Program(path) {
|
|
58743
|
+
traverse(path);
|
|
58744
|
+
path.stop();
|
|
58745
|
+
},
|
|
58746
|
+
});
|
|
58747
|
+
|
|
58748
|
+
return getTokens();
|
|
58749
|
+
};
|
|
58750
|
+
|
|
58626
58751
|
function pathTraverse(ast, traverse) {
|
|
58627
58752
|
ast.parentPath.traverse({
|
|
58628
58753
|
enter(path) {
|
|
@@ -58800,7 +58925,7 @@ function check$d(ast) {
|
|
|
58800
58925
|
throw Error('☝️Looks like ast not an object');
|
|
58801
58926
|
}
|
|
58802
58927
|
|
|
58803
|
-
const isString$
|
|
58928
|
+
const isString$b = (a) => typeof a === 'string';
|
|
58804
58929
|
|
|
58805
58930
|
const alignSpaces = (str) => {
|
|
58806
58931
|
check$c(str);
|
|
@@ -58848,7 +58973,7 @@ function getSpaces(s) {
|
|
|
58848
58973
|
}
|
|
58849
58974
|
|
|
58850
58975
|
function check$c(str) {
|
|
58851
|
-
if (!isString$
|
|
58976
|
+
if (!isString$b(str))
|
|
58852
58977
|
throw Error('str should be a string!');
|
|
58853
58978
|
}
|
|
58854
58979
|
|
|
@@ -58882,12 +59007,12 @@ const print$1 = (ast, options) => {
|
|
|
58882
59007
|
return alignSpaces(code);
|
|
58883
59008
|
};
|
|
58884
59009
|
|
|
58885
|
-
const {isArray: isArray$
|
|
59010
|
+
const {isArray: isArray$e} = Array;
|
|
58886
59011
|
|
|
58887
|
-
const maybeArray$
|
|
59012
|
+
const maybeArray$5 = (a) => isArray$e(a) ? a : [a, {}];
|
|
58888
59013
|
|
|
58889
59014
|
const print = (ast, options = {}) => {
|
|
58890
|
-
const [printer = 'putout', printerOptions] = maybeArray$
|
|
59015
|
+
const [printer = 'putout', printerOptions] = maybeArray$5(options.printer);
|
|
58891
59016
|
|
|
58892
59017
|
if (printer === 'babel')
|
|
58893
59018
|
return print$1(ast, {
|
|
@@ -59152,7 +59277,7 @@ function getCommentGroup({trailing, leading}) {
|
|
|
59152
59277
|
return 'innerComments'; // Dangling comments, such as `[/* a */]`.
|
|
59153
59278
|
}
|
|
59154
59279
|
|
|
59155
|
-
const isString$
|
|
59280
|
+
const isString$a = (a) => typeof a === 'string';
|
|
59156
59281
|
const isNumber$2 = (a) => typeof a === 'number';
|
|
59157
59282
|
const isNull = (a) => a === null;
|
|
59158
59283
|
const isBool$2 = (a) => typeof a === 'boolean';
|
|
@@ -59168,7 +59293,7 @@ var setLiteral = (node) => {
|
|
|
59168
59293
|
return;
|
|
59169
59294
|
}
|
|
59170
59295
|
|
|
59171
|
-
if (isString$
|
|
59296
|
+
if (isString$a(value)) {
|
|
59172
59297
|
node.type = 'StringLiteral';
|
|
59173
59298
|
return;
|
|
59174
59299
|
}
|
|
@@ -59477,8 +59602,8 @@ var onceExports = once$6.exports;
|
|
|
59477
59602
|
const noop$3 = () => {};
|
|
59478
59603
|
|
|
59479
59604
|
var empty = /*#__PURE__*/Object.freeze({
|
|
59480
|
-
|
|
59481
|
-
|
|
59605
|
+
__proto__: null,
|
|
59606
|
+
default: noop$3
|
|
59482
59607
|
});
|
|
59483
59608
|
|
|
59484
59609
|
var require$$1 = /*@__PURE__*/getAugmentedNamespace(empty);
|
|
@@ -59509,8 +59634,8 @@ function privateMethods(Parser) {
|
|
|
59509
59634
|
}
|
|
59510
59635
|
|
|
59511
59636
|
var acornPrivateMethods = /*#__PURE__*/Object.freeze({
|
|
59512
|
-
|
|
59513
|
-
|
|
59637
|
+
__proto__: null,
|
|
59638
|
+
default: privateMethods
|
|
59514
59639
|
});
|
|
59515
59640
|
|
|
59516
59641
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(acornPrivateMethods);
|
|
@@ -59591,10 +59716,10 @@ const allowUndeclaredExports = true;
|
|
|
59591
59716
|
const allowImportExportEverywhere = true;
|
|
59592
59717
|
|
|
59593
59718
|
var options = /*#__PURE__*/Object.freeze({
|
|
59594
|
-
|
|
59595
|
-
|
|
59596
|
-
|
|
59597
|
-
|
|
59719
|
+
__proto__: null,
|
|
59720
|
+
allowImportExportEverywhere: allowImportExportEverywhere,
|
|
59721
|
+
allowReturnOutsideFunction: allowReturnOutsideFunction,
|
|
59722
|
+
allowUndeclaredExports: allowUndeclaredExports
|
|
59598
59723
|
});
|
|
59599
59724
|
|
|
59600
59725
|
const {assign: assign$5} = Object;
|
|
@@ -59831,7 +59956,7 @@ const tryThrowWithReason$1 = (fn, ...args) => {
|
|
|
59831
59956
|
};
|
|
59832
59957
|
|
|
59833
59958
|
const {assign: assign$4} = Object;
|
|
59834
|
-
const isString$
|
|
59959
|
+
const isString$9 = (a) => typeof a === 'string';
|
|
59835
59960
|
|
|
59836
59961
|
const parse$4 = (source, options) => {
|
|
59837
59962
|
check$b(source);
|
|
@@ -59873,7 +59998,7 @@ const getParser = ({parser = 'babel', isTS, isJSX, printer}) => ({
|
|
|
59873
59998
|
});
|
|
59874
59999
|
|
|
59875
60000
|
function check$b(source) {
|
|
59876
|
-
if (!isString$
|
|
60001
|
+
if (!isString$9(source))
|
|
59877
60002
|
throw Error(`☝️ Looks like type of 'source' is not 'string', but '${typeof source}'`);
|
|
59878
60003
|
}
|
|
59879
60004
|
|
|
@@ -59983,6 +60108,126 @@ function $cf838c15c8b009ba$export$22f15dd4e5be7e52(fn, o) {
|
|
|
59983
60108
|
return f;
|
|
59984
60109
|
}
|
|
59985
60110
|
|
|
60111
|
+
const wrap = (fn) => (...a) => (...b) => fn(...a, ...b);
|
|
60112
|
+
|
|
60113
|
+
var wraptile = (fn, ...a) => {
|
|
60114
|
+
check$a(fn);
|
|
60115
|
+
|
|
60116
|
+
if (a.length)
|
|
60117
|
+
return wrap(fn)(...a);
|
|
60118
|
+
|
|
60119
|
+
return wrap(fn);
|
|
60120
|
+
};
|
|
60121
|
+
|
|
60122
|
+
function check$a(fn) {
|
|
60123
|
+
if (typeof fn !== 'function')
|
|
60124
|
+
throw Error('fn should be a function!');
|
|
60125
|
+
}
|
|
60126
|
+
|
|
60127
|
+
var wraptile$1 = wraptile;
|
|
60128
|
+
|
|
60129
|
+
const {entries: entries$a} = Object;
|
|
60130
|
+
const {isArray: isArray$d} = Array;
|
|
60131
|
+
|
|
60132
|
+
var findPath = (parentPath) => {
|
|
60133
|
+
let current = {
|
|
60134
|
+
parentPath,
|
|
60135
|
+
};
|
|
60136
|
+
|
|
60137
|
+
const path = [];
|
|
60138
|
+
|
|
60139
|
+
while (current = current.parentPath) {
|
|
60140
|
+
path.unshift(findKey(current, current.parent));
|
|
60141
|
+
}
|
|
60142
|
+
|
|
60143
|
+
return path.join('.');
|
|
60144
|
+
};
|
|
60145
|
+
|
|
60146
|
+
function findKey(path, parent) {
|
|
60147
|
+
const {node} = path;
|
|
60148
|
+
let key;
|
|
60149
|
+
let value;
|
|
60150
|
+
|
|
60151
|
+
for ([key, value] of entries$a(parent)) {
|
|
60152
|
+
if (isArray$d(value)) {
|
|
60153
|
+
const index = value.indexOf(node);
|
|
60154
|
+
|
|
60155
|
+
if (index >= 0)
|
|
60156
|
+
return `${key}.${index}`;
|
|
60157
|
+
|
|
60158
|
+
continue;
|
|
60159
|
+
}
|
|
60160
|
+
|
|
60161
|
+
if (value === node)
|
|
60162
|
+
break;
|
|
60163
|
+
}
|
|
60164
|
+
|
|
60165
|
+
return key;
|
|
60166
|
+
}
|
|
60167
|
+
|
|
60168
|
+
const {isProgram: isProgram$2} = lib_exports;
|
|
60169
|
+
const hasWatermark = (watermark) => (path) => path.node?.[__watermark]?.has(watermark);
|
|
60170
|
+
|
|
60171
|
+
const __watermark = '__putout_runner_replace';
|
|
60172
|
+
|
|
60173
|
+
const watermark = (from, to, path) => {
|
|
60174
|
+
const {watermark, highWatermark} = create(from, to, path);
|
|
60175
|
+
const program = path.findParent(isProgram$2);
|
|
60176
|
+
const options = {
|
|
60177
|
+
watermark,
|
|
60178
|
+
highWatermark,
|
|
60179
|
+
program,
|
|
60180
|
+
path,
|
|
60181
|
+
};
|
|
60182
|
+
|
|
60183
|
+
return {
|
|
60184
|
+
init: wraptile$1(init, options),
|
|
60185
|
+
has: wraptile$1(has, options),
|
|
60186
|
+
add: wraptile$1(add, options),
|
|
60187
|
+
};
|
|
60188
|
+
};
|
|
60189
|
+
|
|
60190
|
+
function create(from, to, path) {
|
|
60191
|
+
const watermark = `${from} -> ${to}`;
|
|
60192
|
+
const highWatermark = `${findPath(path)}: ${watermark}`;
|
|
60193
|
+
|
|
60194
|
+
return {
|
|
60195
|
+
watermark,
|
|
60196
|
+
highWatermark,
|
|
60197
|
+
};
|
|
60198
|
+
}
|
|
60199
|
+
|
|
60200
|
+
function init({path, program}) {
|
|
60201
|
+
if (path.node)
|
|
60202
|
+
path.node[__watermark] = path.node[__watermark] || new Set();
|
|
60203
|
+
|
|
60204
|
+
program.node[__watermark] = program.node[__watermark] || new Set();
|
|
60205
|
+
}
|
|
60206
|
+
|
|
60207
|
+
function add({path, program, watermark, highWatermark}) {
|
|
60208
|
+
init({
|
|
60209
|
+
path,
|
|
60210
|
+
program,
|
|
60211
|
+
});
|
|
60212
|
+
|
|
60213
|
+
path?.node[__watermark].add(watermark);
|
|
60214
|
+
program.node[__watermark].add(highWatermark);
|
|
60215
|
+
}
|
|
60216
|
+
|
|
60217
|
+
const clearWatermark = (node) => {
|
|
60218
|
+
delete node?.[__watermark];
|
|
60219
|
+
};
|
|
60220
|
+
|
|
60221
|
+
function has({path, program, watermark, highWatermark}) {
|
|
60222
|
+
const {node} = path;
|
|
60223
|
+
const {loc} = node;
|
|
60224
|
+
|
|
60225
|
+
if (node?.[__watermark].has(watermark) || path.findParent(hasWatermark(watermark)) && !loc)
|
|
60226
|
+
return true;
|
|
60227
|
+
|
|
60228
|
+
return program.node[__watermark].has(highWatermark);
|
|
60229
|
+
}
|
|
60230
|
+
|
|
59986
60231
|
const {
|
|
59987
60232
|
nanomemoize = $cf838c15c8b009ba$export$22f15dd4e5be7e52,
|
|
59988
60233
|
} = $cf838c15c8b009ba$export$22f15dd4e5be7e52;
|
|
@@ -60025,7 +60270,7 @@ const template$1 = nanomemoize((value, options) => {
|
|
|
60025
60270
|
|
|
60026
60271
|
template$1.extractExpression = extractExpression$2;
|
|
60027
60272
|
|
|
60028
|
-
|
|
60273
|
+
const templateAst = nanomemoize((value, options) => {
|
|
60029
60274
|
const result = index.ast(value, {
|
|
60030
60275
|
...defaults,
|
|
60031
60276
|
...options,
|
|
@@ -60034,6 +60279,14 @@ template$1.ast = nanomemoize((value, options) => {
|
|
|
60034
60279
|
return extractExpression$2(result);
|
|
60035
60280
|
});
|
|
60036
60281
|
|
|
60282
|
+
template$1.ast = (...a) => {
|
|
60283
|
+
const node = templateAst(...a);
|
|
60284
|
+
|
|
60285
|
+
clearWatermark(node);
|
|
60286
|
+
|
|
60287
|
+
return templateAst(...a);
|
|
60288
|
+
};
|
|
60289
|
+
|
|
60037
60290
|
template$1.program = nanomemoize((value, options) => {
|
|
60038
60291
|
const result = index.program(value, {
|
|
60039
60292
|
...defaults,
|
|
@@ -60061,31 +60314,6 @@ template$1.ast.fresh = (value, options) => {
|
|
|
60061
60314
|
return extractExpression$2(result);
|
|
60062
60315
|
};
|
|
60063
60316
|
|
|
60064
|
-
const mergeShebang = (shebang, source) => {
|
|
60065
|
-
if (!shebang)
|
|
60066
|
-
return source;
|
|
60067
|
-
|
|
60068
|
-
return `${shebang}\n${source}`;
|
|
60069
|
-
};
|
|
60070
|
-
|
|
60071
|
-
const cutShebang = (source) => {
|
|
60072
|
-
if (source.indexOf('#'))
|
|
60073
|
-
return [source, ''];
|
|
60074
|
-
|
|
60075
|
-
const lines = source.split('\n');
|
|
60076
|
-
|
|
60077
|
-
const result = lines
|
|
60078
|
-
.slice(1)
|
|
60079
|
-
.join('\n');
|
|
60080
|
-
|
|
60081
|
-
const [shebang] = lines;
|
|
60082
|
-
|
|
60083
|
-
return [
|
|
60084
|
-
result,
|
|
60085
|
-
`${shebang}\n`,
|
|
60086
|
-
];
|
|
60087
|
-
};
|
|
60088
|
-
|
|
60089
60317
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
60090
60318
|
//
|
|
60091
60319
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -60322,7 +60550,7 @@ var substr = 'ab'.substr(-1) === 'b' ?
|
|
|
60322
60550
|
const isFn$5 = (a) => typeof a === 'function';
|
|
60323
60551
|
|
|
60324
60552
|
const tryToCatch = async (fn, ...args) => {
|
|
60325
|
-
check$
|
|
60553
|
+
check$9(fn);
|
|
60326
60554
|
|
|
60327
60555
|
try {
|
|
60328
60556
|
return [null, await fn(...args)];
|
|
@@ -60331,7 +60559,7 @@ const tryToCatch = async (fn, ...args) => {
|
|
|
60331
60559
|
}
|
|
60332
60560
|
};
|
|
60333
60561
|
|
|
60334
|
-
function check$
|
|
60562
|
+
function check$9(fn) {
|
|
60335
60563
|
if (!isFn$5(fn))
|
|
60336
60564
|
throw Error('fn should be a function!');
|
|
60337
60565
|
}
|
|
@@ -60449,8 +60677,8 @@ function buildPluginsDirs(name) {
|
|
|
60449
60677
|
}
|
|
60450
60678
|
|
|
60451
60679
|
const isStr$2 = (a) => typeof a === 'string';
|
|
60452
|
-
const {isArray: isArray$
|
|
60453
|
-
const {entries: entries$
|
|
60680
|
+
const {isArray: isArray$c} = Array;
|
|
60681
|
+
const {entries: entries$9} = Object;
|
|
60454
60682
|
|
|
60455
60683
|
const parsePluginNames = (plugins) => {
|
|
60456
60684
|
const result = [];
|
|
@@ -60461,23 +60689,23 @@ const parsePluginNames = (plugins) => {
|
|
|
60461
60689
|
continue;
|
|
60462
60690
|
}
|
|
60463
60691
|
|
|
60464
|
-
if (isArray$
|
|
60692
|
+
if (isArray$c(plugin)) {
|
|
60465
60693
|
const [pluginName, fn] = plugin;
|
|
60466
60694
|
result.push([pluginName, fn]);
|
|
60467
60695
|
continue;
|
|
60468
60696
|
}
|
|
60469
60697
|
|
|
60470
|
-
result.push(...entries$
|
|
60698
|
+
result.push(...entries$9(plugin));
|
|
60471
60699
|
}
|
|
60472
60700
|
|
|
60473
60701
|
return result;
|
|
60474
60702
|
};
|
|
60475
60703
|
|
|
60476
|
-
const {isArray: isArray$
|
|
60704
|
+
const {isArray: isArray$b} = Array;
|
|
60477
60705
|
const isBool$1 = (a) => typeof a === 'boolean';
|
|
60478
60706
|
const isStr$1 = (a) => typeof a === 'string';
|
|
60479
60707
|
const isObj = (a) => typeof a === 'object';
|
|
60480
|
-
const {entries: entries$
|
|
60708
|
+
const {entries: entries$8} = Object;
|
|
60481
60709
|
const {stringify: stringify$6} = JSON;
|
|
60482
60710
|
|
|
60483
60711
|
const notSupportedError = (a) => Error(`☝️ Rule format not supported ${a}: ${typeof a}`);
|
|
@@ -60502,9 +60730,9 @@ const parseRules = (rules) => {
|
|
|
60502
60730
|
const plugin = null;
|
|
60503
60731
|
const msg = '';
|
|
60504
60732
|
|
|
60505
|
-
check$
|
|
60733
|
+
check$8(rules);
|
|
60506
60734
|
|
|
60507
|
-
for (const [rule, value] of entries$
|
|
60735
|
+
for (const [rule, value] of entries$8(rules)) {
|
|
60508
60736
|
if (isStr$1(value)) {
|
|
60509
60737
|
result.push({
|
|
60510
60738
|
rule,
|
|
@@ -60527,7 +60755,7 @@ const parseRules = (rules) => {
|
|
|
60527
60755
|
continue;
|
|
60528
60756
|
}
|
|
60529
60757
|
|
|
60530
|
-
const looksLikeArray = isArray$
|
|
60758
|
+
const looksLikeArray = isArray$b(value);
|
|
60531
60759
|
const looksLikeNormalArray = looksLikeArray && value.length;
|
|
60532
60760
|
|
|
60533
60761
|
if (looksLikeNormalArray) {
|
|
@@ -60589,8 +60817,8 @@ function validateState(rule, value) {
|
|
|
60589
60817
|
});
|
|
60590
60818
|
}
|
|
60591
60819
|
|
|
60592
|
-
function check$
|
|
60593
|
-
if (isArray$
|
|
60820
|
+
function check$8(rules) {
|
|
60821
|
+
if (isArray$b(rules))
|
|
60594
60822
|
throw Error(`☝️Looks like type of 'rules' passed to @putout/engine-loader is 'array', expected: 'object'.`);
|
|
60595
60823
|
}
|
|
60596
60824
|
|
|
@@ -60695,22 +60923,26 @@ const getLoadedRules = (rules) => {
|
|
|
60695
60923
|
return loadedRules;
|
|
60696
60924
|
};
|
|
60697
60925
|
|
|
60698
|
-
const isString$
|
|
60926
|
+
const isString$8 = (a) => typeof a === 'string';
|
|
60699
60927
|
|
|
60700
|
-
const check$
|
|
60928
|
+
const check$7 = (options) => {
|
|
60701
60929
|
if (!options || typeof options !== 'object')
|
|
60702
60930
|
throw Error('options should be an object!');
|
|
60703
60931
|
};
|
|
60704
60932
|
|
|
60705
60933
|
const checkRule = (rule) => {
|
|
60706
|
-
if (!isString$
|
|
60934
|
+
if (!isString$8(rule))
|
|
60707
60935
|
throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`);
|
|
60708
60936
|
};
|
|
60709
60937
|
|
|
60710
60938
|
const validateRulesRelations = (options) => {
|
|
60711
|
-
check$
|
|
60939
|
+
check$7(options);
|
|
60940
|
+
|
|
60941
|
+
const {
|
|
60942
|
+
pluginNames = [],
|
|
60943
|
+
rules = {},
|
|
60944
|
+
} = options;
|
|
60712
60945
|
|
|
60713
|
-
const {pluginNames = [], rules = {}} = options;
|
|
60714
60946
|
const items = parsePluginNames(pluginNames);
|
|
60715
60947
|
|
|
60716
60948
|
validateRules({
|
|
@@ -60719,13 +60951,13 @@ const validateRulesRelations = (options) => {
|
|
|
60719
60951
|
});
|
|
60720
60952
|
};
|
|
60721
60953
|
|
|
60722
|
-
const {entries: entries$
|
|
60954
|
+
const {entries: entries$7, fromEntries} = Object;
|
|
60723
60955
|
const cut = (a) => a.split('/')[0];
|
|
60724
60956
|
|
|
60725
60957
|
const enableNestedRules = (rules) => {
|
|
60726
60958
|
const newRules = new Map();
|
|
60727
60959
|
|
|
60728
|
-
for (const [rule, value] of entries$
|
|
60960
|
+
for (const [rule, value] of entries$7(rules)) {
|
|
60729
60961
|
if (newRules.has(rule))
|
|
60730
60962
|
continue;
|
|
60731
60963
|
|
|
@@ -60774,8 +61006,8 @@ var validatePlugin = ({plugin, rule}) => {
|
|
|
60774
61006
|
throw Error(`☝️ Cannot determine type of plugin '${rule}'. Here is list of supported plugins: https://git.io/JqcMn`);
|
|
60775
61007
|
};
|
|
60776
61008
|
|
|
60777
|
-
const {isArray: isArray$
|
|
60778
|
-
const maybeTuple = (a) => isArray$
|
|
61009
|
+
const {isArray: isArray$a} = Array;
|
|
61010
|
+
const maybeTuple = (a) => isArray$a(a) ? a : ['on', a];
|
|
60779
61011
|
|
|
60780
61012
|
// Would be great to have ability to filter
|
|
60781
61013
|
// disabled plugins and prevent them from loading
|
|
@@ -60818,9 +61050,13 @@ function isExactRuleEnabled(name, status, rules) {
|
|
|
60818
61050
|
const loadPluginAsync = createAsyncLoader('plugin');
|
|
60819
61051
|
|
|
60820
61052
|
const loadPluginsAsync = async (options) => {
|
|
60821
|
-
check$
|
|
61053
|
+
check$7(options);
|
|
61054
|
+
|
|
61055
|
+
const {
|
|
61056
|
+
pluginNames = [],
|
|
61057
|
+
rules = {},
|
|
61058
|
+
} = options;
|
|
60822
61059
|
|
|
60823
|
-
const {pluginNames = [], rules = {}} = options;
|
|
60824
61060
|
const {
|
|
60825
61061
|
items,
|
|
60826
61062
|
loadedRules,
|
|
@@ -60910,12 +61146,16 @@ function parseRuleName(rule) {
|
|
|
60910
61146
|
return rule;
|
|
60911
61147
|
}
|
|
60912
61148
|
|
|
60913
|
-
const {isArray: isArray$
|
|
61149
|
+
const {isArray: isArray$9} = Array;
|
|
60914
61150
|
|
|
60915
61151
|
const loadPlugins = (options) => {
|
|
60916
|
-
check$
|
|
61152
|
+
check$7(options);
|
|
61153
|
+
|
|
61154
|
+
const {
|
|
61155
|
+
pluginNames = [],
|
|
61156
|
+
rules = {},
|
|
61157
|
+
} = options;
|
|
60917
61158
|
|
|
60918
|
-
const {pluginNames = [], rules = {}} = options;
|
|
60919
61159
|
const {
|
|
60920
61160
|
items,
|
|
60921
61161
|
loadedRules,
|
|
@@ -60942,16 +61182,17 @@ const parseRule = (rule) => rule
|
|
|
60942
61182
|
.replace('import:@putout/plugin-', '')
|
|
60943
61183
|
.replace('@putout/plugin-', '');
|
|
60944
61184
|
|
|
60945
|
-
const maybeFromTuple = (a) => isArray$
|
|
61185
|
+
const maybeFromTuple = (a) => isArray$9(a) ? a[1] : a;
|
|
60946
61186
|
|
|
60947
61187
|
function loadAllPlugins({items, loadedRules}) {
|
|
60948
61188
|
const plugins = [];
|
|
60949
61189
|
|
|
60950
61190
|
for (const [rule, itemPlugin] of items) {
|
|
61191
|
+
checkRule(rule);
|
|
61192
|
+
|
|
60951
61193
|
if (!isEnabled(rule, loadedRules))
|
|
60952
61194
|
continue;
|
|
60953
61195
|
|
|
60954
|
-
checkRule(rule);
|
|
60955
61196
|
const parsedRule = parseRule(rule);
|
|
60956
61197
|
|
|
60957
61198
|
const [name, namespace] = splitRule(rule);
|
|
@@ -61028,21 +61269,12 @@ const isFn$4 = (a) => typeof a === 'function';
|
|
|
61028
61269
|
const getPath$1 = (path) => path.path || path;
|
|
61029
61270
|
const debug$4 = createDebug$1('putout:runner:fix');
|
|
61030
61271
|
|
|
61031
|
-
const chooseFixArgs = ({path, pathOptions, options}) =>
|
|
61032
|
-
|
|
61033
|
-
|
|
61034
|
-
|
|
61035
|
-
|
|
61036
|
-
|
|
61037
|
-
},
|
|
61038
|
-
];
|
|
61039
|
-
|
|
61040
|
-
return [
|
|
61041
|
-
path, {
|
|
61042
|
-
options,
|
|
61043
|
-
},
|
|
61044
|
-
];
|
|
61045
|
-
};
|
|
61272
|
+
const chooseFixArgs = ({path, pathOptions, options}) => [
|
|
61273
|
+
path, {
|
|
61274
|
+
options,
|
|
61275
|
+
...pathOptions,
|
|
61276
|
+
},
|
|
61277
|
+
];
|
|
61046
61278
|
|
|
61047
61279
|
const tryToFix = (fix, {path, pathOptions, position, options}) => {
|
|
61048
61280
|
const [e] = tryCatch(fix, ...chooseFixArgs({
|
|
@@ -61091,7 +61323,7 @@ function validate$1(name, fn) {
|
|
|
61091
61323
|
|
|
61092
61324
|
const getPath = (item) => item.path || item[0] || item;
|
|
61093
61325
|
|
|
61094
|
-
const getPosition = (path
|
|
61326
|
+
const getPosition = (path) => {
|
|
61095
61327
|
const parsedPath = getPath(path);
|
|
61096
61328
|
|
|
61097
61329
|
validatePath(parsedPath);
|
|
@@ -61101,14 +61333,14 @@ const getPosition = (path, shebang) => {
|
|
|
61101
61333
|
|
|
61102
61334
|
if (!loc)
|
|
61103
61335
|
return {
|
|
61104
|
-
line:
|
|
61336
|
+
line: 1,
|
|
61105
61337
|
column: 1,
|
|
61106
61338
|
};
|
|
61107
61339
|
|
|
61108
61340
|
const {line, column} = node.loc.start;
|
|
61109
61341
|
|
|
61110
61342
|
return {
|
|
61111
|
-
line
|
|
61343
|
+
line,
|
|
61112
61344
|
column: column + 1,
|
|
61113
61345
|
};
|
|
61114
61346
|
};
|
|
@@ -61118,27 +61350,35 @@ function validatePath(path) {
|
|
|
61118
61350
|
throw Error(`☝️ Looks like 'push' called without a 'path' argument.`);
|
|
61119
61351
|
}
|
|
61120
61352
|
|
|
61121
|
-
const {isArray: isArray$
|
|
61122
|
-
const maybeArray$
|
|
61353
|
+
const {isArray: isArray$8} = Array;
|
|
61354
|
+
const maybeArray$3 = (a) => isArray$8(a) ? a : [a];
|
|
61123
61355
|
|
|
61124
|
-
var maybeArray$
|
|
61356
|
+
var maybeArray$4 = (a) => {
|
|
61125
61357
|
if (!a)
|
|
61126
61358
|
return [];
|
|
61127
61359
|
|
|
61128
|
-
return maybeArray$
|
|
61360
|
+
return maybeArray$3(a);
|
|
61129
61361
|
};
|
|
61130
61362
|
|
|
61131
61363
|
const isFn$3 = (a) => typeof a === 'function';
|
|
61132
61364
|
const {stringify: stringify$4} = JSON;
|
|
61365
|
+
const {isArray: isArray$7} = Array;
|
|
61133
61366
|
|
|
61134
61367
|
const validate = (name, fn) => {
|
|
61368
|
+
if (name === 'include-items') {
|
|
61369
|
+
if (!isArray$7(fn))
|
|
61370
|
+
throw Error(`☝️ Looks like 'include' does not return an 'array'. More on using Includer: https://git.io/JqcMn`);
|
|
61371
|
+
|
|
61372
|
+
return;
|
|
61373
|
+
}
|
|
61374
|
+
|
|
61135
61375
|
if (!isFn$3(fn))
|
|
61136
61376
|
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`);
|
|
61137
61377
|
};
|
|
61138
61378
|
|
|
61139
61379
|
const {
|
|
61140
61380
|
values,
|
|
61141
|
-
entries: entries$
|
|
61381
|
+
entries: entries$6,
|
|
61142
61382
|
assign: assign$2,
|
|
61143
61383
|
} = Object;
|
|
61144
61384
|
|
|
@@ -61197,7 +61437,7 @@ function createStore({set, get}) {
|
|
|
61197
61437
|
map = {};
|
|
61198
61438
|
};
|
|
61199
61439
|
|
|
61200
|
-
fn.entries = () => entries$
|
|
61440
|
+
fn.entries = () => entries$6(map);
|
|
61201
61441
|
|
|
61202
61442
|
return fn;
|
|
61203
61443
|
};
|
|
@@ -61233,16 +61473,16 @@ const parse$3 = (name, plugin, options) => {
|
|
|
61233
61473
|
|
|
61234
61474
|
if (plugin[name]) {
|
|
61235
61475
|
validate(name, plugin[name]);
|
|
61236
|
-
list.push(...maybeArray$
|
|
61476
|
+
list.push(...maybeArray$4(plugin[name]()));
|
|
61237
61477
|
}
|
|
61238
61478
|
|
|
61239
61479
|
if (options[name])
|
|
61240
|
-
list.push(...maybeArray$
|
|
61480
|
+
list.push(...maybeArray$4(options[name]));
|
|
61241
61481
|
|
|
61242
61482
|
return list;
|
|
61243
61483
|
};
|
|
61244
61484
|
|
|
61245
|
-
var mergeVisitors = (pluginsToMerge, {fix,
|
|
61485
|
+
var mergeVisitors = (pluginsToMerge, {fix, template}) => {
|
|
61246
61486
|
const mergeItems = [];
|
|
61247
61487
|
const pushed = {};
|
|
61248
61488
|
|
|
@@ -61258,7 +61498,6 @@ var mergeVisitors = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
61258
61498
|
} = getStore(plugin, {
|
|
61259
61499
|
fix,
|
|
61260
61500
|
rule,
|
|
61261
|
-
shebang,
|
|
61262
61501
|
msg,
|
|
61263
61502
|
options,
|
|
61264
61503
|
});
|
|
@@ -61301,7 +61540,7 @@ var mergeVisitors = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
61301
61540
|
};
|
|
61302
61541
|
};
|
|
61303
61542
|
|
|
61304
|
-
function getStore(plugin, {fix, rule,
|
|
61543
|
+
function getStore(plugin, {fix, rule, msg, options}) {
|
|
61305
61544
|
const store = mapStore();
|
|
61306
61545
|
const list = listStore();
|
|
61307
61546
|
const upstore = upStore();
|
|
@@ -61310,8 +61549,11 @@ function getStore(plugin, {fix, rule, shebang, msg, options}) {
|
|
|
61310
61549
|
const paths = pathStore();
|
|
61311
61550
|
|
|
61312
61551
|
const push = (path, pathOptions) => {
|
|
61313
|
-
const position = getPosition(path
|
|
61314
|
-
const message = msg || plugin.report(path,
|
|
61552
|
+
const position = getPosition(path);
|
|
61553
|
+
const message = msg || plugin.report(path, {
|
|
61554
|
+
options,
|
|
61555
|
+
...pathOptions,
|
|
61556
|
+
});
|
|
61315
61557
|
|
|
61316
61558
|
placesStore({
|
|
61317
61559
|
message,
|
|
@@ -61358,7 +61600,7 @@ function superFind({rule, find, ast, options, template, traverse = traverse3}) {
|
|
|
61358
61600
|
};
|
|
61359
61601
|
|
|
61360
61602
|
const returnItems = find(ast, {
|
|
61361
|
-
traverse: createTraverse$
|
|
61603
|
+
traverse: createTraverse$5({
|
|
61362
61604
|
rule,
|
|
61363
61605
|
options,
|
|
61364
61606
|
template,
|
|
@@ -61376,7 +61618,7 @@ function superFind({rule, find, ast, options, template, traverse = traverse3}) {
|
|
|
61376
61618
|
];
|
|
61377
61619
|
}
|
|
61378
61620
|
|
|
61379
|
-
const createTraverse$
|
|
61621
|
+
const createTraverse$5 = ({rule, options, template, traverse}) => (ast, visitor) => {
|
|
61380
61622
|
const templateVisitors = merge$1(template({
|
|
61381
61623
|
rule,
|
|
61382
61624
|
visitor,
|
|
@@ -61386,7 +61628,7 @@ const createTraverse$4 = ({rule, options, template, traverse}) => (ast, visitor)
|
|
|
61386
61628
|
return traverse(ast, templateVisitors);
|
|
61387
61629
|
};
|
|
61388
61630
|
|
|
61389
|
-
const isString$
|
|
61631
|
+
const isString$7 = (a) => typeof a === 'string';
|
|
61390
61632
|
const isUndefined = (a) => typeof a === 'undefined';
|
|
61391
61633
|
const isEmpty = (obj) => !Object.keys(obj).length;
|
|
61392
61634
|
|
|
@@ -61396,7 +61638,7 @@ function jessy(selector, divider, value) {
|
|
|
61396
61638
|
divider = '.';
|
|
61397
61639
|
}
|
|
61398
61640
|
|
|
61399
|
-
check$
|
|
61641
|
+
check$6(selector, value);
|
|
61400
61642
|
|
|
61401
61643
|
if (!selector)
|
|
61402
61644
|
return value;
|
|
@@ -61429,8 +61671,8 @@ function jessy(selector, divider, value) {
|
|
|
61429
61671
|
return value;
|
|
61430
61672
|
}
|
|
61431
61673
|
|
|
61432
|
-
function check$
|
|
61433
|
-
if (!isString$
|
|
61674
|
+
function check$6(selector, obj) {
|
|
61675
|
+
if (!isString$7(selector))
|
|
61434
61676
|
throw Error('selector should be string!');
|
|
61435
61677
|
|
|
61436
61678
|
if (typeof obj !== 'object')
|
|
@@ -61439,7 +61681,7 @@ function check$7(selector, obj) {
|
|
|
61439
61681
|
|
|
61440
61682
|
const isNumber$1 = (a) => !Number.isNaN(a) && typeof a === 'number';
|
|
61441
61683
|
const isNumberLike = (a, b = Number(a)) => isNumber$1(b);
|
|
61442
|
-
const isString$
|
|
61684
|
+
const isString$6 = (a) => typeof a === 'string';
|
|
61443
61685
|
const notSecure = (a) => /__proto__|prototype/.test(a);
|
|
61444
61686
|
|
|
61445
61687
|
function nessy(selector, value, divider, obj) {
|
|
@@ -61450,7 +61692,7 @@ function nessy(selector, value, divider, obj) {
|
|
|
61450
61692
|
|
|
61451
61693
|
const result = obj;
|
|
61452
61694
|
|
|
61453
|
-
check$
|
|
61695
|
+
check$5(selector);
|
|
61454
61696
|
|
|
61455
61697
|
const array = selector
|
|
61456
61698
|
.split(divider)
|
|
@@ -61475,8 +61717,8 @@ function nessy(selector, value, divider, obj) {
|
|
|
61475
61717
|
|
|
61476
61718
|
return result;
|
|
61477
61719
|
}
|
|
61478
|
-
function check$
|
|
61479
|
-
if (!isString$
|
|
61720
|
+
function check$5(selector) {
|
|
61721
|
+
if (!isString$6(selector))
|
|
61480
61722
|
throw Error('selector should be string!');
|
|
61481
61723
|
}
|
|
61482
61724
|
|
|
@@ -61554,14 +61796,14 @@ const isTemplate = (a) => /[(;={.\s]/.test(a) || !/^[A-Z]/.test(a);
|
|
|
61554
61796
|
|
|
61555
61797
|
const is = (str, array = ALL) => {
|
|
61556
61798
|
for (const item of array) {
|
|
61557
|
-
if (check$
|
|
61799
|
+
if (check$4(str, item))
|
|
61558
61800
|
return true;
|
|
61559
61801
|
}
|
|
61560
61802
|
|
|
61561
61803
|
return false;
|
|
61562
61804
|
};
|
|
61563
61805
|
|
|
61564
|
-
function check$
|
|
61806
|
+
function check$4(str, item) {
|
|
61565
61807
|
if (isStr(item))
|
|
61566
61808
|
return str === item;
|
|
61567
61809
|
|
|
@@ -61616,7 +61858,7 @@ const isBool = (a, b) => {
|
|
|
61616
61858
|
};
|
|
61617
61859
|
|
|
61618
61860
|
const isEqualType = (a, b) => a.type === b.type;
|
|
61619
|
-
const {isArray: isArray$
|
|
61861
|
+
const {isArray: isArray$6} = Array;
|
|
61620
61862
|
|
|
61621
61863
|
const isAny = (a) => {
|
|
61622
61864
|
if (isIdentifier$4(a, {name: ANY}))
|
|
@@ -61635,7 +61877,7 @@ const isAnyLiteral = (a, b) => {
|
|
|
61635
61877
|
};
|
|
61636
61878
|
|
|
61637
61879
|
const isArgs = (a) => {
|
|
61638
|
-
const b = !isArray$
|
|
61880
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61639
61881
|
|
|
61640
61882
|
return isIdentifier$4(b, {
|
|
61641
61883
|
name: ARGS,
|
|
@@ -61665,12 +61907,12 @@ const isEqualTypeParams = (a, b) => {
|
|
|
61665
61907
|
};
|
|
61666
61908
|
|
|
61667
61909
|
const isLinkedArgs = (a) => {
|
|
61668
|
-
const b = !isArray$
|
|
61910
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61669
61911
|
return isIdentifier$4(b) && LINKED_ARGS.test(b.name);
|
|
61670
61912
|
};
|
|
61671
61913
|
|
|
61672
61914
|
const isJSXChildren = (a) => {
|
|
61673
|
-
const b = !isArray$
|
|
61915
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61674
61916
|
|
|
61675
61917
|
return isJSXText$2(b, {
|
|
61676
61918
|
value: JSX_CHILDREN,
|
|
@@ -61678,7 +61920,7 @@ const isJSXChildren = (a) => {
|
|
|
61678
61920
|
};
|
|
61679
61921
|
|
|
61680
61922
|
const isJSXAttributes = (a) => {
|
|
61681
|
-
const b = !isArray$
|
|
61923
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61682
61924
|
|
|
61683
61925
|
if (!isJSXAttribute$1(b))
|
|
61684
61926
|
return false;
|
|
@@ -61715,21 +61957,21 @@ const isObject$4 = (a) => {
|
|
|
61715
61957
|
if (!a)
|
|
61716
61958
|
return false;
|
|
61717
61959
|
|
|
61718
|
-
if (isArray$
|
|
61960
|
+
if (isArray$6(a))
|
|
61719
61961
|
return false;
|
|
61720
61962
|
|
|
61721
61963
|
return typeof a === 'object';
|
|
61722
61964
|
};
|
|
61723
61965
|
|
|
61724
61966
|
const isArrays = (a, b) => {
|
|
61725
|
-
if (!isArray$
|
|
61967
|
+
if (!isArray$6(a) || !isArray$6(b))
|
|
61726
61968
|
return false;
|
|
61727
61969
|
|
|
61728
61970
|
return a.length === b.length;
|
|
61729
61971
|
};
|
|
61730
61972
|
|
|
61731
61973
|
const isImports = (a) => {
|
|
61732
|
-
const b = !isArray$
|
|
61974
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61733
61975
|
|
|
61734
61976
|
if (!isImportDefaultSpecifier(b))
|
|
61735
61977
|
return false;
|
|
@@ -61740,7 +61982,7 @@ const isImports = (a) => {
|
|
|
61740
61982
|
};
|
|
61741
61983
|
|
|
61742
61984
|
const isExports = (a) => {
|
|
61743
|
-
const b = !isArray$
|
|
61985
|
+
const b = !isArray$6(a) ? a : a[0];
|
|
61744
61986
|
|
|
61745
61987
|
if (isExportSpecifier(b))
|
|
61746
61988
|
return isIdentifier$4(b.local, {
|
|
@@ -61862,15 +62104,15 @@ const {
|
|
|
61862
62104
|
|
|
61863
62105
|
const {extractExpression: extractExpression$1} = template$1;
|
|
61864
62106
|
|
|
61865
|
-
const {entries: entries$
|
|
62107
|
+
const {entries: entries$5} = Object;
|
|
61866
62108
|
const isNumber = (a) => typeof a === 'number';
|
|
61867
|
-
const isString$
|
|
62109
|
+
const isString$5 = (a) => typeof a === 'string';
|
|
61868
62110
|
|
|
61869
62111
|
const parseNode$1 = (a) => a.node || a;
|
|
61870
62112
|
const {stringify: stringify$3} = JSON;
|
|
61871
62113
|
|
|
61872
62114
|
const getTemplateValues = (node, str) => {
|
|
61873
|
-
if (!isString$
|
|
62115
|
+
if (!isString$5(str))
|
|
61874
62116
|
throw Error(`☝️ Looks like argument 'template' of 'getTemplateValues(node, template)': is not a string, but '${stringify$3(str)}'`);
|
|
61875
62117
|
|
|
61876
62118
|
node = parseNode$1(node);
|
|
@@ -61947,7 +62189,7 @@ function findVarsWays(node) {
|
|
|
61947
62189
|
function getValues({waysFrom, node}) {
|
|
61948
62190
|
const result = {};
|
|
61949
62191
|
|
|
61950
|
-
for (const [name, ways] of entries$
|
|
62192
|
+
for (const [name, ways] of entries$5(waysFrom)) {
|
|
61951
62193
|
for (let way of ways) {
|
|
61952
62194
|
if (isImportsStr(name))
|
|
61953
62195
|
way = way.replace(/\.0.local$/, '');
|
|
@@ -61974,7 +62216,7 @@ const makeRaw = (a) => a.replace('`', '\\`');
|
|
|
61974
62216
|
function setValues({waysTo, values, path}) {
|
|
61975
62217
|
const node = extractExpression$1(path.node);
|
|
61976
62218
|
|
|
61977
|
-
for (const [name, ways] of entries$
|
|
62219
|
+
for (const [name, ways] of entries$5(waysTo)) {
|
|
61978
62220
|
for (let way of ways) {
|
|
61979
62221
|
if (!way) {
|
|
61980
62222
|
replaceWith(path, values[name]);
|
|
@@ -62041,7 +62283,7 @@ const createDebug = (namespace) => {
|
|
|
62041
62283
|
|
|
62042
62284
|
const debug$3 = createDebug('putout:compare');
|
|
62043
62285
|
|
|
62044
|
-
const {isArray: isArray$
|
|
62286
|
+
const {isArray: isArray$5} = Array;
|
|
62045
62287
|
const isObject$3 = (a) => a && typeof a === 'object';
|
|
62046
62288
|
|
|
62047
62289
|
var log$4 = (a, b) => {
|
|
@@ -62055,7 +62297,7 @@ var log$4 = (a, b) => {
|
|
|
62055
62297
|
};
|
|
62056
62298
|
|
|
62057
62299
|
function parseValue(a) {
|
|
62058
|
-
if (isArray$
|
|
62300
|
+
if (isArray$5(a) && a[0]) {
|
|
62059
62301
|
const [{
|
|
62060
62302
|
type,
|
|
62061
62303
|
name,
|
|
@@ -62325,13 +62567,13 @@ const {extractExpression} = template$1;
|
|
|
62325
62567
|
const addWaterMark = (a) => a;
|
|
62326
62568
|
|
|
62327
62569
|
const {keys: keys$2} = Object;
|
|
62328
|
-
const {isArray: isArray$
|
|
62570
|
+
const {isArray: isArray$4} = Array;
|
|
62329
62571
|
const noop$1 = () => {};
|
|
62330
|
-
const isEmptyArray = (a) => isArray$
|
|
62572
|
+
const isEmptyArray = (a) => isArray$4(a) && !a.length;
|
|
62331
62573
|
|
|
62332
62574
|
const compareType = (type) => (path) => path.type === type;
|
|
62333
62575
|
const superPush = (array) => (a, b, c = {}) => array.push([a, b, c]);
|
|
62334
|
-
const maybeArray$
|
|
62576
|
+
const maybeArray$2 = (a) => isArray$4(a) ? a : [a];
|
|
62335
62577
|
|
|
62336
62578
|
const findParent = (path, type) => {
|
|
62337
62579
|
const newPathNode = path.findParent(compareType(type));
|
|
@@ -62389,7 +62631,7 @@ function compare(path, template, options = {}, equal = noop$1) {
|
|
|
62389
62631
|
}
|
|
62390
62632
|
|
|
62391
62633
|
const compareAny = (path, templateNodes, options) => {
|
|
62392
|
-
templateNodes = maybeArray$
|
|
62634
|
+
templateNodes = maybeArray$2(templateNodes);
|
|
62393
62635
|
|
|
62394
62636
|
for (const template of templateNodes) {
|
|
62395
62637
|
if (compare(path, template, options))
|
|
@@ -62400,7 +62642,7 @@ const compareAny = (path, templateNodes, options) => {
|
|
|
62400
62642
|
};
|
|
62401
62643
|
|
|
62402
62644
|
const compareAll = (path, templateNodes, options) => {
|
|
62403
|
-
templateNodes = maybeArray$
|
|
62645
|
+
templateNodes = maybeArray$2(templateNodes);
|
|
62404
62646
|
|
|
62405
62647
|
for (const template of templateNodes) {
|
|
62406
62648
|
if (!compare(path, template, options))
|
|
@@ -62467,7 +62709,7 @@ function superCompareIterate(node, template) {
|
|
|
62467
62709
|
|
|
62468
62710
|
const debug$2 = createDebug$1('putout:runner:template');
|
|
62469
62711
|
|
|
62470
|
-
const {entries: entries$
|
|
62712
|
+
const {entries: entries$4} = Object;
|
|
62471
62713
|
const isFn$2 = (a) => typeof a === 'function';
|
|
62472
62714
|
|
|
62473
62715
|
const log$3 = (rule, path) => {
|
|
@@ -62496,10 +62738,10 @@ const exclude = ({rule, tmpl, fn, nodesExclude}) => {
|
|
|
62496
62738
|
|
|
62497
62739
|
var template = ({rule, visitor, options}) => {
|
|
62498
62740
|
const parsed = [];
|
|
62499
|
-
const nodesExclude = maybeArray$
|
|
62500
|
-
const nodesInclude = maybeArray$
|
|
62741
|
+
const nodesExclude = maybeArray$4(options.exclude);
|
|
62742
|
+
const nodesInclude = maybeArray$4(options.include);
|
|
62501
62743
|
|
|
62502
|
-
for (const [tmpl, fn] of entries$
|
|
62744
|
+
for (const [tmpl, fn] of entries$4(visitor)) {
|
|
62503
62745
|
if (!tmpl)
|
|
62504
62746
|
continue;
|
|
62505
62747
|
|
|
@@ -63106,6 +63348,10 @@ const include$1 = ({rule, plugin, msg, options}) => {
|
|
|
63106
63348
|
validate('include', include);
|
|
63107
63349
|
validate('report', report);
|
|
63108
63350
|
|
|
63351
|
+
const includeItems = include();
|
|
63352
|
+
|
|
63353
|
+
validate('include-items', includeItems);
|
|
63354
|
+
|
|
63109
63355
|
const traverse = getTraverse(include(), filter, rule);
|
|
63110
63356
|
|
|
63111
63357
|
return {
|
|
@@ -63115,7 +63361,7 @@ const include$1 = ({rule, plugin, msg, options}) => {
|
|
|
63115
63361
|
...options,
|
|
63116
63362
|
exclude: [
|
|
63117
63363
|
...exclude(),
|
|
63118
|
-
...maybeArray$
|
|
63364
|
+
...maybeArray$4(options.exclude),
|
|
63119
63365
|
],
|
|
63120
63366
|
},
|
|
63121
63367
|
plugin: {
|
|
@@ -63150,123 +63396,6 @@ const getTraverse = (include, filter, rule) => ({push, options}) => {
|
|
|
63150
63396
|
return result;
|
|
63151
63397
|
};
|
|
63152
63398
|
|
|
63153
|
-
const wrap = (fn) => (...a) => (...b) => fn(...a, ...b);
|
|
63154
|
-
|
|
63155
|
-
var wraptile = (fn, ...a) => {
|
|
63156
|
-
check$4(fn);
|
|
63157
|
-
|
|
63158
|
-
if (a.length)
|
|
63159
|
-
return wrap(fn)(...a);
|
|
63160
|
-
|
|
63161
|
-
return wrap(fn);
|
|
63162
|
-
};
|
|
63163
|
-
|
|
63164
|
-
function check$4(fn) {
|
|
63165
|
-
if (typeof fn !== 'function')
|
|
63166
|
-
throw Error('fn should be a function!');
|
|
63167
|
-
}
|
|
63168
|
-
|
|
63169
|
-
var wraptile$1 = wraptile;
|
|
63170
|
-
|
|
63171
|
-
const {entries: entries$4} = Object;
|
|
63172
|
-
const {isArray: isArray$2} = Array;
|
|
63173
|
-
|
|
63174
|
-
var findPath = (parentPath) => {
|
|
63175
|
-
let current = {
|
|
63176
|
-
parentPath,
|
|
63177
|
-
};
|
|
63178
|
-
|
|
63179
|
-
const path = [];
|
|
63180
|
-
|
|
63181
|
-
while (current = current.parentPath) {
|
|
63182
|
-
path.unshift(findKey(current, current.parent));
|
|
63183
|
-
}
|
|
63184
|
-
|
|
63185
|
-
return path.join('.');
|
|
63186
|
-
};
|
|
63187
|
-
|
|
63188
|
-
function findKey(path, parent) {
|
|
63189
|
-
const {node} = path;
|
|
63190
|
-
let key;
|
|
63191
|
-
let value;
|
|
63192
|
-
|
|
63193
|
-
for ([key, value] of entries$4(parent)) {
|
|
63194
|
-
if (isArray$2(value)) {
|
|
63195
|
-
const index = value.indexOf(node);
|
|
63196
|
-
|
|
63197
|
-
if (index >= 0)
|
|
63198
|
-
return `${key}.${index}`;
|
|
63199
|
-
|
|
63200
|
-
continue;
|
|
63201
|
-
}
|
|
63202
|
-
|
|
63203
|
-
if (value === node)
|
|
63204
|
-
break;
|
|
63205
|
-
}
|
|
63206
|
-
|
|
63207
|
-
return key;
|
|
63208
|
-
}
|
|
63209
|
-
|
|
63210
|
-
const {isProgram: isProgram$2} = lib_exports;
|
|
63211
|
-
const name = '__putout_runner_replace';
|
|
63212
|
-
const hasWatermark = (watermark) => (path) => path.node?.[name]?.has(watermark);
|
|
63213
|
-
|
|
63214
|
-
const watermark = (from, to, path) => {
|
|
63215
|
-
const {watermark, highWatermark} = create(from, to, path);
|
|
63216
|
-
const program = path.findParent(isProgram$2);
|
|
63217
|
-
const options = {
|
|
63218
|
-
watermark,
|
|
63219
|
-
highWatermark,
|
|
63220
|
-
program,
|
|
63221
|
-
path,
|
|
63222
|
-
};
|
|
63223
|
-
|
|
63224
|
-
return {
|
|
63225
|
-
init: wraptile$1(init, options),
|
|
63226
|
-
has: wraptile$1(has, options),
|
|
63227
|
-
add: wraptile$1(add, options),
|
|
63228
|
-
};
|
|
63229
|
-
};
|
|
63230
|
-
|
|
63231
|
-
const REPLACE_WATERMARK = name;
|
|
63232
|
-
|
|
63233
|
-
function create(from, to, path) {
|
|
63234
|
-
const watermark = `${from} -> ${to}`;
|
|
63235
|
-
const highWatermark = `${findPath(path)}: ${watermark}`;
|
|
63236
|
-
|
|
63237
|
-
return {
|
|
63238
|
-
watermark,
|
|
63239
|
-
highWatermark,
|
|
63240
|
-
};
|
|
63241
|
-
}
|
|
63242
|
-
|
|
63243
|
-
function init({path, program}) {
|
|
63244
|
-
if (path.node)
|
|
63245
|
-
path.node[name] = path.node[name] || new Set();
|
|
63246
|
-
|
|
63247
|
-
program.node[name] = program.node[name] || new Set();
|
|
63248
|
-
}
|
|
63249
|
-
|
|
63250
|
-
function add({path, program, watermark, highWatermark}) {
|
|
63251
|
-
init({
|
|
63252
|
-
path,
|
|
63253
|
-
program,
|
|
63254
|
-
});
|
|
63255
|
-
|
|
63256
|
-
path?.node[name].add(watermark);
|
|
63257
|
-
program.node[name].add(highWatermark);
|
|
63258
|
-
}
|
|
63259
|
-
|
|
63260
|
-
function has({path, program, watermark, highWatermark}) {
|
|
63261
|
-
const {node} = path;
|
|
63262
|
-
const {loc} = node;
|
|
63263
|
-
|
|
63264
|
-
if (node?.[name].has(watermark) || path.findParent(hasWatermark(watermark)) && !loc)
|
|
63265
|
-
return true;
|
|
63266
|
-
|
|
63267
|
-
return program.node[name].has(highWatermark);
|
|
63268
|
-
}
|
|
63269
|
-
|
|
63270
63399
|
const debug$1 = createDebug$1('putout:runner:replace');
|
|
63271
63400
|
|
|
63272
63401
|
const log$1 = (from, path) => {
|
|
@@ -63290,7 +63419,7 @@ const PRINT_OPTIONS = {
|
|
|
63290
63419
|
}],
|
|
63291
63420
|
};
|
|
63292
63421
|
|
|
63293
|
-
const isString$
|
|
63422
|
+
const isString$4 = (a) => typeof a === 'string';
|
|
63294
63423
|
|
|
63295
63424
|
const {keys: keys$1, entries: entries$3} = Object;
|
|
63296
63425
|
const {stringify: stringify$1} = JSON;
|
|
@@ -63327,7 +63456,7 @@ const replace = ({rule, plugin, msg, options}) => {
|
|
|
63327
63456
|
...options,
|
|
63328
63457
|
exclude: [
|
|
63329
63458
|
...exclude(),
|
|
63330
|
-
...maybeArray$
|
|
63459
|
+
...maybeArray$4(options.exclude),
|
|
63331
63460
|
],
|
|
63332
63461
|
},
|
|
63333
63462
|
plugin: {
|
|
@@ -63339,10 +63468,6 @@ const replace = ({rule, plugin, msg, options}) => {
|
|
|
63339
63468
|
};
|
|
63340
63469
|
};
|
|
63341
63470
|
|
|
63342
|
-
const clearWatermark = (ast) => {
|
|
63343
|
-
delete ast.program[REPLACE_WATERMARK];
|
|
63344
|
-
};
|
|
63345
|
-
|
|
63346
63471
|
const isFn$1 = (a) => typeof a === 'function';
|
|
63347
63472
|
|
|
63348
63473
|
const parseExpression = (nodeFrom, {node}) => {
|
|
@@ -63352,7 +63477,7 @@ const parseExpression = (nodeFrom, {node}) => {
|
|
|
63352
63477
|
return node;
|
|
63353
63478
|
};
|
|
63354
63479
|
|
|
63355
|
-
const fix$
|
|
63480
|
+
const fix$b = (from, to, path) => {
|
|
63356
63481
|
const nodeFrom = template$1.ast(from);
|
|
63357
63482
|
const mark = watermark(from, to, path);
|
|
63358
63483
|
|
|
@@ -63407,7 +63532,7 @@ const getFix = (items, match) => (path) => {
|
|
|
63407
63532
|
const matchFn = match[from];
|
|
63408
63533
|
|
|
63409
63534
|
if (!matchFn || runMatch(path, nodeFrom, matchFn))
|
|
63410
|
-
fix$
|
|
63535
|
+
fix$b(from, to, path);
|
|
63411
63536
|
}
|
|
63412
63537
|
}
|
|
63413
63538
|
};
|
|
@@ -63452,7 +63577,7 @@ function parseTo(to, values, path) {
|
|
|
63452
63577
|
return toStr;
|
|
63453
63578
|
}
|
|
63454
63579
|
|
|
63455
|
-
if (!isString$
|
|
63580
|
+
if (!isString$4(toStr))
|
|
63456
63581
|
throw Error(`☝️ Looks like you passed 'replace' value with a wrong type. Allowed: 'string', 'node' and 'path'. Received: '${typeof toStr}' with value '${toStr}'.`);
|
|
63457
63582
|
|
|
63458
63583
|
return template$1.ast.fresh(toStr);
|
|
@@ -63524,7 +63649,7 @@ const {
|
|
|
63524
63649
|
} = lib_exports;
|
|
63525
63650
|
|
|
63526
63651
|
const {keys} = Object;
|
|
63527
|
-
const isString$
|
|
63652
|
+
const isString$3 = (a) => typeof a === 'string';
|
|
63528
63653
|
|
|
63529
63654
|
const getLastVarPath = (bodyPath) => bodyPath
|
|
63530
63655
|
.filter(isVariableDeclaration)
|
|
@@ -63550,13 +63675,13 @@ const TS_EXCLUDE = [
|
|
|
63550
63675
|
];
|
|
63551
63676
|
|
|
63552
63677
|
const declare$1 = (declarations) => ({
|
|
63553
|
-
report: report$
|
|
63678
|
+
report: report$6,
|
|
63554
63679
|
include,
|
|
63555
|
-
fix: fix$
|
|
63680
|
+
fix: fix$a(declarations),
|
|
63556
63681
|
filter: filter(declarations),
|
|
63557
63682
|
});
|
|
63558
63683
|
|
|
63559
|
-
const report$
|
|
63684
|
+
const report$6 = (path) => {
|
|
63560
63685
|
const {name} = path.node;
|
|
63561
63686
|
const peaceOfName = cutName(name);
|
|
63562
63687
|
|
|
@@ -63596,7 +63721,7 @@ const filter = (declarations) => (path, {options}) => {
|
|
|
63596
63721
|
return parseCode(type, allDeclarations[name]);
|
|
63597
63722
|
};
|
|
63598
63723
|
|
|
63599
|
-
const fix$
|
|
63724
|
+
const fix$a = (declarations) => (path, {options}) => {
|
|
63600
63725
|
const type = getModuleType(path);
|
|
63601
63726
|
|
|
63602
63727
|
const allDeclarations = {
|
|
@@ -63618,7 +63743,7 @@ const fix$8 = (declarations) => (path, {options}) => {
|
|
|
63618
63743
|
};
|
|
63619
63744
|
|
|
63620
63745
|
const parseCode = (type, current) => {
|
|
63621
|
-
if (isString$
|
|
63746
|
+
if (isString$3(current))
|
|
63622
63747
|
return current;
|
|
63623
63748
|
|
|
63624
63749
|
return current[type];
|
|
@@ -63779,7 +63904,7 @@ const {entries: entries$2} = Object;
|
|
|
63779
63904
|
|
|
63780
63905
|
const isPath = (path) => Boolean(path.node);
|
|
63781
63906
|
|
|
63782
|
-
const createTraverse$
|
|
63907
|
+
const createTraverse$4 = (path) => {
|
|
63783
63908
|
if (isPath(path))
|
|
63784
63909
|
return path.traverse.bind(path);
|
|
63785
63910
|
|
|
@@ -63796,7 +63921,7 @@ const createTraverse$3 = (path) => {
|
|
|
63796
63921
|
const getTemplate = ([a]) => a;
|
|
63797
63922
|
|
|
63798
63923
|
function traverse$3(basePath, visitor) {
|
|
63799
|
-
const traverse = createTraverse$
|
|
63924
|
+
const traverse = createTraverse$4(basePath);
|
|
63800
63925
|
const items = [];
|
|
63801
63926
|
const parsedVisitors = entries$2(visitor);
|
|
63802
63927
|
|
|
@@ -63904,9 +64029,12 @@ const {
|
|
|
63904
64029
|
objectExpression: objectExpression$1,
|
|
63905
64030
|
} = lib_exports;
|
|
63906
64031
|
|
|
63907
|
-
const isString$
|
|
63908
|
-
const
|
|
63909
|
-
const
|
|
64032
|
+
const isString$2 = (a) => typeof a === 'string';
|
|
64033
|
+
const isSet = (a) => a instanceof Set;
|
|
64034
|
+
const {isArray: isArray$3} = Array;
|
|
64035
|
+
|
|
64036
|
+
const maybeArray$1 = (a) => isArray$3(a) ? a : [a];
|
|
64037
|
+
const maybeArrayFrom = (a) => isSet(a) ? Array.from(a) : maybeArray$1(a);
|
|
63910
64038
|
|
|
63911
64039
|
const escape = (a) => encodeURIComponent(a).replaceAll('%', '+');
|
|
63912
64040
|
const unescape = (a) => decodeURIComponent(a.replaceAll('+', '%'));
|
|
@@ -63974,7 +64102,7 @@ function parseFindFileOptions(options) {
|
|
|
63974
64102
|
excluded: [],
|
|
63975
64103
|
};
|
|
63976
64104
|
|
|
63977
|
-
if (isArray$
|
|
64105
|
+
if (isArray$3(options))
|
|
63978
64106
|
return {
|
|
63979
64107
|
exclude: options,
|
|
63980
64108
|
};
|
|
@@ -63990,8 +64118,8 @@ function findFile(node, name, options) {
|
|
|
63990
64118
|
|
|
63991
64119
|
checkName(name);
|
|
63992
64120
|
|
|
63993
|
-
const filePaths =
|
|
63994
|
-
const names =
|
|
64121
|
+
const filePaths = new Set();
|
|
64122
|
+
const names = maybeArrayFrom(name);
|
|
63995
64123
|
|
|
63996
64124
|
for (const filenamePath of crawled) {
|
|
63997
64125
|
const {value} = filenamePath.node.value;
|
|
@@ -64009,17 +64137,17 @@ function findFile(node, name, options) {
|
|
|
64009
64137
|
if (excluded)
|
|
64010
64138
|
continue;
|
|
64011
64139
|
|
|
64012
|
-
filePaths.
|
|
64140
|
+
filePaths.add(path);
|
|
64013
64141
|
}
|
|
64014
64142
|
}
|
|
64015
64143
|
}
|
|
64016
64144
|
|
|
64017
|
-
return filePaths;
|
|
64145
|
+
return Array.from(filePaths);
|
|
64018
64146
|
}
|
|
64019
64147
|
|
|
64020
64148
|
function checkName(name) {
|
|
64021
|
-
if (!isString$
|
|
64022
|
-
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`);
|
|
64149
|
+
if (!isString$2(name) && !isArray$3(name) && !isSet(name))
|
|
64150
|
+
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[] | Set<string>): FilePath'`);
|
|
64023
64151
|
}
|
|
64024
64152
|
|
|
64025
64153
|
function getFilenamePath(filePath) {
|
|
@@ -64047,7 +64175,7 @@ function getFileContent(filePath) {
|
|
|
64047
64175
|
}
|
|
64048
64176
|
|
|
64049
64177
|
function checkRenameFileName(name) {
|
|
64050
|
-
if (!isString$
|
|
64178
|
+
if (!isString$2(name))
|
|
64051
64179
|
throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'renameFile(filePath: FilePath, name: string)'`);
|
|
64052
64180
|
}
|
|
64053
64181
|
|
|
@@ -64192,7 +64320,7 @@ const createFile = (dirPath, name, content) => {
|
|
|
64192
64320
|
|
|
64193
64321
|
const filePath = dirPathFiles.get('value.elements').at(-1);
|
|
64194
64322
|
|
|
64195
|
-
if (isString$
|
|
64323
|
+
if (isString$2(content))
|
|
64196
64324
|
writeFileContent(filePath, content);
|
|
64197
64325
|
|
|
64198
64326
|
return filePath;
|
|
@@ -64346,7 +64474,7 @@ function getRootDirectory(path) {
|
|
|
64346
64474
|
}
|
|
64347
64475
|
|
|
64348
64476
|
function getFile(directoryPath, name, {type} = {}) {
|
|
64349
|
-
const names = maybeArray(name);
|
|
64477
|
+
const names = maybeArray$1(name);
|
|
64350
64478
|
const files = new Map();
|
|
64351
64479
|
let count = 0;
|
|
64352
64480
|
|
|
@@ -64378,7 +64506,7 @@ const {
|
|
|
64378
64506
|
objectExpression,
|
|
64379
64507
|
arrayExpression: arrayExpression$1,
|
|
64380
64508
|
stringLiteral: stringLiteral$4,
|
|
64381
|
-
isArrayExpression,
|
|
64509
|
+
isArrayExpression: isArrayExpression$1,
|
|
64382
64510
|
isStringLiteral,
|
|
64383
64511
|
isTemplateLiteral,
|
|
64384
64512
|
objectProperty: objectProperty$1,
|
|
@@ -64416,7 +64544,7 @@ function parseContent(node, path) {
|
|
|
64416
64544
|
throw Error(`☝️ Looks like wrong content type: '${node.type}' from file: '${path}'`);
|
|
64417
64545
|
}
|
|
64418
64546
|
|
|
64419
|
-
const fix$
|
|
64547
|
+
const fix$9 = (path) => {
|
|
64420
64548
|
const array = arrayExpression$1([]);
|
|
64421
64549
|
|
|
64422
64550
|
for (const element of path.get('elements')) {
|
|
@@ -64506,7 +64634,7 @@ function buildTree(path, list) {
|
|
|
64506
64634
|
}
|
|
64507
64635
|
|
|
64508
64636
|
const isTwoElementsTuple = (a) => {
|
|
64509
|
-
if (!isArrayExpression(a))
|
|
64637
|
+
if (!isArrayExpression$1(a))
|
|
64510
64638
|
return false;
|
|
64511
64639
|
|
|
64512
64640
|
const {elements} = a.node;
|
|
@@ -64515,7 +64643,7 @@ const isTwoElementsTuple = (a) => {
|
|
|
64515
64643
|
};
|
|
64516
64644
|
|
|
64517
64645
|
const isOneElementTuple = (a) => {
|
|
64518
|
-
if (!isArrayExpression(a))
|
|
64646
|
+
if (!isArrayExpression$1(a))
|
|
64519
64647
|
return false;
|
|
64520
64648
|
|
|
64521
64649
|
const {elements} = a.node;
|
|
@@ -64529,9 +64657,9 @@ function check$3(filename) {
|
|
|
64529
64657
|
}
|
|
64530
64658
|
|
|
64531
64659
|
var fromSimple = /*#__PURE__*/Object.freeze({
|
|
64532
|
-
|
|
64533
|
-
|
|
64534
|
-
|
|
64660
|
+
__proto__: null,
|
|
64661
|
+
fix: fix$9,
|
|
64662
|
+
traverse: traverse$2
|
|
64535
64663
|
});
|
|
64536
64664
|
|
|
64537
64665
|
const {
|
|
@@ -64539,10 +64667,10 @@ const {
|
|
|
64539
64667
|
arrayExpression,
|
|
64540
64668
|
} = lib_exports;
|
|
64541
64669
|
|
|
64542
|
-
const {isArray} = Array;
|
|
64670
|
+
const {isArray: isArray$2} = Array;
|
|
64543
64671
|
const maybeAddSlash = (a) => a === '/' ? a : `${a}/`;
|
|
64544
64672
|
|
|
64545
|
-
const fix$
|
|
64673
|
+
const fix$8 = (root, {files}) => {
|
|
64546
64674
|
const names = [];
|
|
64547
64675
|
|
|
64548
64676
|
for (const file of files) {
|
|
@@ -64567,7 +64695,7 @@ const fix$6 = (root, {files}) => {
|
|
|
64567
64695
|
const list = [];
|
|
64568
64696
|
|
|
64569
64697
|
for (const name of names) {
|
|
64570
|
-
if (isArray(name)) {
|
|
64698
|
+
if (isArray$2(name)) {
|
|
64571
64699
|
list.push(arrayExpression([
|
|
64572
64700
|
stringLiteral$3(name[0]),
|
|
64573
64701
|
stringLiteral$3(name[1]),
|
|
@@ -64593,9 +64721,9 @@ const traverse$1 = ({push}) => ({
|
|
|
64593
64721
|
});
|
|
64594
64722
|
|
|
64595
64723
|
var toSimple = /*#__PURE__*/Object.freeze({
|
|
64596
|
-
|
|
64597
|
-
|
|
64598
|
-
|
|
64724
|
+
__proto__: null,
|
|
64725
|
+
fix: fix$8,
|
|
64726
|
+
traverse: traverse$1
|
|
64599
64727
|
});
|
|
64600
64728
|
|
|
64601
64729
|
const log = createDebug$1('putout:runner:scanner');
|
|
@@ -64609,7 +64737,7 @@ const scan$2 = ({rule, plugin, msg, options}, {progress}) => {
|
|
|
64609
64737
|
|
|
64610
64738
|
progress.inc();
|
|
64611
64739
|
|
|
64612
|
-
const traverse = createTraverse$
|
|
64740
|
+
const traverse = createTraverse$3({
|
|
64613
64741
|
scan,
|
|
64614
64742
|
rule,
|
|
64615
64743
|
progress,
|
|
@@ -64666,7 +64794,7 @@ const createTrackFile = ({fileProgress, crawled}) => function*(...a) {
|
|
|
64666
64794
|
}
|
|
64667
64795
|
};
|
|
64668
64796
|
|
|
64669
|
-
const createTraverse$
|
|
64797
|
+
const createTraverse$3 = ({scan, rule, progress}) => ({push, options}) => ({
|
|
64670
64798
|
[`${__filesystem_name}(__)`](path) {
|
|
64671
64799
|
log(rule);
|
|
64672
64800
|
progress.start(rule);
|
|
@@ -64764,7 +64892,7 @@ function parseVisitor(visitors) {
|
|
|
64764
64892
|
const debug = createDebug$1('putout:runner:find');
|
|
64765
64893
|
const isRemoved = (a) => a?.removed;
|
|
64766
64894
|
|
|
64767
|
-
const runPlugins = ({ast,
|
|
64895
|
+
const runPlugins = ({ast, fix, fixCount = 2, plugins, progress = createProgress(), traverse = traverse3}) => {
|
|
64768
64896
|
let places = [];
|
|
64769
64897
|
|
|
64770
64898
|
const merge = onceExports(mergeVisitors);
|
|
@@ -64779,7 +64907,6 @@ const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress = create
|
|
|
64779
64907
|
places = run({
|
|
64780
64908
|
ast,
|
|
64781
64909
|
fix,
|
|
64782
|
-
shebang,
|
|
64783
64910
|
pluginsFind,
|
|
64784
64911
|
pluginsTraverse,
|
|
64785
64912
|
merge,
|
|
@@ -64792,17 +64919,18 @@ const runPlugins = ({ast, shebang, fix, fixCount = 2, plugins, progress = create
|
|
|
64792
64919
|
if (!fix || !places.length)
|
|
64793
64920
|
return places;
|
|
64794
64921
|
|
|
64795
|
-
|
|
64922
|
+
const {program} = ast;
|
|
64923
|
+
|
|
64924
|
+
clearWatermark(program);
|
|
64796
64925
|
}
|
|
64797
64926
|
|
|
64798
64927
|
return places;
|
|
64799
64928
|
};
|
|
64800
64929
|
|
|
64801
|
-
const run = ({ast, fix,
|
|
64930
|
+
const run = ({ast, fix, pluginsFind, pluginsTraverse, template, merge, traverse}) => [
|
|
64802
64931
|
...runWithoutMerge({
|
|
64803
64932
|
ast,
|
|
64804
64933
|
fix,
|
|
64805
|
-
shebang,
|
|
64806
64934
|
template,
|
|
64807
64935
|
pluginsFind,
|
|
64808
64936
|
traverse,
|
|
@@ -64810,7 +64938,6 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
|
|
|
64810
64938
|
...runWithMerge({
|
|
64811
64939
|
ast,
|
|
64812
64940
|
fix,
|
|
64813
|
-
shebang,
|
|
64814
64941
|
template,
|
|
64815
64942
|
pluginsTraverse,
|
|
64816
64943
|
merge,
|
|
@@ -64818,10 +64945,9 @@ const run = ({ast, fix, shebang, pluginsFind, pluginsTraverse, template, merge,
|
|
|
64818
64945
|
}),
|
|
64819
64946
|
];
|
|
64820
64947
|
|
|
64821
|
-
function runWithMerge({ast, fix,
|
|
64948
|
+
function runWithMerge({ast, fix, template, pluginsTraverse, merge, traverse}) {
|
|
64822
64949
|
const {entries, visitor} = merge(pluginsTraverse, {
|
|
64823
64950
|
fix,
|
|
64824
|
-
shebang,
|
|
64825
64951
|
template,
|
|
64826
64952
|
});
|
|
64827
64953
|
|
|
@@ -64844,7 +64970,7 @@ function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge, trav
|
|
|
64844
64970
|
return places;
|
|
64845
64971
|
}
|
|
64846
64972
|
|
|
64847
|
-
function runWithoutMerge({ast, fix,
|
|
64973
|
+
function runWithoutMerge({ast, fix, template, pluginsFind, traverse}) {
|
|
64848
64974
|
const places = [];
|
|
64849
64975
|
|
|
64850
64976
|
for (const {rule, plugin, msg, options} of pluginsFind) {
|
|
@@ -64858,7 +64984,6 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
|
|
|
64858
64984
|
ast,
|
|
64859
64985
|
options,
|
|
64860
64986
|
fix,
|
|
64861
|
-
shebang,
|
|
64862
64987
|
template,
|
|
64863
64988
|
traverse,
|
|
64864
64989
|
});
|
|
@@ -64869,7 +64994,7 @@ function runWithoutMerge({ast, fix, shebang, template, pluginsFind, traverse}) {
|
|
|
64869
64994
|
for (const item of items) {
|
|
64870
64995
|
const message = msg || report(item);
|
|
64871
64996
|
const {parentPath} = getPath(item);
|
|
64872
|
-
const position = getPosition(item
|
|
64997
|
+
const position = getPosition(item);
|
|
64873
64998
|
|
|
64874
64999
|
places.push({
|
|
64875
65000
|
rule,
|
|
@@ -64986,16 +65111,7 @@ const cutBrackets = (a) => a.replace(/\s\(\d:\d+\)/, '');
|
|
|
64986
65111
|
|
|
64987
65112
|
const maybeParseError = (a) => !a ? [] : parseError$1(a, 'loader');
|
|
64988
65113
|
|
|
64989
|
-
|
|
64990
|
-
// because we need to calculate position in a right way
|
|
64991
|
-
// and determine is shebang is existing
|
|
64992
|
-
//
|
|
64993
|
-
// 25 return {¬
|
|
64994
|
-
// 26 line: shebang ? line + 1 : line,¬
|
|
64995
|
-
// 27 column,¬
|
|
64996
|
-
// 28 };¬
|
|
64997
|
-
//
|
|
64998
|
-
const transform = (ast, source, opts) => {
|
|
65114
|
+
const transform = (ast, opts) => {
|
|
64999
65115
|
opts = defaultOptions(opts);
|
|
65000
65116
|
|
|
65001
65117
|
const {
|
|
@@ -65008,8 +65124,6 @@ const transform = (ast, source, opts) => {
|
|
|
65008
65124
|
progress,
|
|
65009
65125
|
} = opts;
|
|
65010
65126
|
|
|
65011
|
-
const [, shebang] = cutShebang(source);
|
|
65012
|
-
|
|
65013
65127
|
const [validationError] = tryCatch(validateRulesRelations, {
|
|
65014
65128
|
rules,
|
|
65015
65129
|
pluginNames,
|
|
@@ -65022,7 +65136,6 @@ const transform = (ast, source, opts) => {
|
|
|
65022
65136
|
|
|
65023
65137
|
const places = runPlugins({
|
|
65024
65138
|
ast,
|
|
65025
|
-
shebang,
|
|
65026
65139
|
fix,
|
|
65027
65140
|
fixCount,
|
|
65028
65141
|
plugins,
|
|
@@ -65035,7 +65148,7 @@ const transform = (ast, source, opts) => {
|
|
|
65035
65148
|
];
|
|
65036
65149
|
};
|
|
65037
65150
|
|
|
65038
|
-
const transformAsync = async (ast,
|
|
65151
|
+
const transformAsync = async (ast, opts) => {
|
|
65039
65152
|
opts = defaultOptions(opts);
|
|
65040
65153
|
|
|
65041
65154
|
const {
|
|
@@ -65048,8 +65161,6 @@ const transformAsync = async (ast, source, opts) => {
|
|
|
65048
65161
|
progress,
|
|
65049
65162
|
} = opts;
|
|
65050
65163
|
|
|
65051
|
-
const [, shebang] = cutShebang(source);
|
|
65052
|
-
|
|
65053
65164
|
const [validationError] = tryCatch(validateRulesRelations, {
|
|
65054
65165
|
rules,
|
|
65055
65166
|
pluginNames,
|
|
@@ -65062,7 +65173,6 @@ const transformAsync = async (ast, source, opts) => {
|
|
|
65062
65173
|
|
|
65063
65174
|
const places = runPlugins({
|
|
65064
65175
|
ast,
|
|
65065
|
-
shebang,
|
|
65066
65176
|
fix,
|
|
65067
65177
|
fixCount,
|
|
65068
65178
|
plugins,
|
|
@@ -65086,16 +65196,14 @@ const putout = (source, opts) => {
|
|
|
65086
65196
|
printer,
|
|
65087
65197
|
} = opts;
|
|
65088
65198
|
|
|
65089
|
-
const
|
|
65090
|
-
|
|
65091
|
-
const ast = parse$4(clearSource, {
|
|
65199
|
+
const ast = parse$4(source, {
|
|
65092
65200
|
parser,
|
|
65093
65201
|
isTS,
|
|
65094
65202
|
isJSX,
|
|
65095
65203
|
printer,
|
|
65096
65204
|
});
|
|
65097
65205
|
|
|
65098
|
-
const places = transform(ast,
|
|
65206
|
+
const places = transform(ast, opts);
|
|
65099
65207
|
|
|
65100
65208
|
if (!opts.fix)
|
|
65101
65209
|
return {
|
|
@@ -65103,13 +65211,11 @@ const putout = (source, opts) => {
|
|
|
65103
65211
|
places,
|
|
65104
65212
|
};
|
|
65105
65213
|
|
|
65106
|
-
const
|
|
65214
|
+
const code = print(ast, {
|
|
65107
65215
|
printer,
|
|
65108
65216
|
source,
|
|
65109
65217
|
});
|
|
65110
65218
|
|
|
65111
|
-
const code = mergeShebang(shebang, printed);
|
|
65112
|
-
|
|
65113
65219
|
return {
|
|
65114
65220
|
code,
|
|
65115
65221
|
places,
|
|
@@ -65127,16 +65233,14 @@ const putoutAsync = async (source, opts) => {
|
|
|
65127
65233
|
printer,
|
|
65128
65234
|
} = opts;
|
|
65129
65235
|
|
|
65130
|
-
const
|
|
65131
|
-
|
|
65132
|
-
const ast = parse$4(clearSource, {
|
|
65236
|
+
const ast = parse$4(source, {
|
|
65133
65237
|
parser,
|
|
65134
65238
|
isTS,
|
|
65135
65239
|
isJSX,
|
|
65136
65240
|
printer,
|
|
65137
65241
|
});
|
|
65138
65242
|
|
|
65139
|
-
const places = await transformAsync(ast,
|
|
65243
|
+
const places = await transformAsync(ast, opts);
|
|
65140
65244
|
|
|
65141
65245
|
if (!opts.fix)
|
|
65142
65246
|
return {
|
|
@@ -65144,22 +65248,20 @@ const putoutAsync = async (source, opts) => {
|
|
|
65144
65248
|
places,
|
|
65145
65249
|
};
|
|
65146
65250
|
|
|
65147
|
-
const
|
|
65251
|
+
const code = print(ast, {
|
|
65148
65252
|
printer,
|
|
65149
65253
|
});
|
|
65150
65254
|
|
|
65151
|
-
const code = mergeShebang(shebang, printed);
|
|
65152
|
-
|
|
65153
65255
|
return {
|
|
65154
65256
|
code,
|
|
65155
65257
|
places,
|
|
65156
65258
|
};
|
|
65157
65259
|
};
|
|
65158
65260
|
|
|
65159
|
-
const isString = (a) => typeof a === 'string';
|
|
65261
|
+
const isString$1 = (a) => typeof a === 'string';
|
|
65160
65262
|
|
|
65161
65263
|
function check$2(source) {
|
|
65162
|
-
if (!isString(source))
|
|
65264
|
+
if (!isString$1(source))
|
|
65163
65265
|
throw Error(`☝️ Looks like 'source' has type '${typeof source}', expected: 'string'`);
|
|
65164
65266
|
}
|
|
65165
65267
|
|
|
@@ -71177,6 +71279,9 @@ function check$1(regExpTransformer) {
|
|
|
71177
71279
|
throw Error('☝️ Looks like RegExpTransformer is missing');
|
|
71178
71280
|
}
|
|
71179
71281
|
|
|
71282
|
+
const isString = (a) => typeof a === 'string';
|
|
71283
|
+
const {isArray: isArray$1} = Array;
|
|
71284
|
+
|
|
71180
71285
|
const {
|
|
71181
71286
|
isBlockStatement,
|
|
71182
71287
|
isFunction,
|
|
@@ -71197,15 +71302,15 @@ const isCall = (path) => {
|
|
|
71197
71302
|
return isCallExpression(path.find(isCallOrStatement));
|
|
71198
71303
|
};
|
|
71199
71304
|
|
|
71200
|
-
const report$
|
|
71305
|
+
const report$5 = ({name}) => `Argument '${name}' is missing`;
|
|
71201
71306
|
|
|
71202
71307
|
const addArgs = (args) => ({
|
|
71203
|
-
report: report$
|
|
71204
|
-
fix: fix$
|
|
71308
|
+
report: report$5,
|
|
71309
|
+
fix: fix$7,
|
|
71205
71310
|
traverse: traverse(args),
|
|
71206
71311
|
});
|
|
71207
71312
|
|
|
71208
|
-
const fix$
|
|
71313
|
+
const fix$7 = ({declaration, path, pattern, params, index}) => {
|
|
71209
71314
|
const declarationNode = template$1.ast.fresh(declaration);
|
|
71210
71315
|
|
|
71211
71316
|
if (isSequenceExpression(declarationNode)) {
|
|
@@ -71240,7 +71345,9 @@ const traverse = (args) => ({push, options}) => {
|
|
|
71240
71345
|
|
|
71241
71346
|
return {
|
|
71242
71347
|
ReferencedIdentifier(path) {
|
|
71243
|
-
for (const [name,
|
|
71348
|
+
for (const [name, config] of entries$1(allArgs)) {
|
|
71349
|
+
const [declaration, include, exclude] = parseConfig(config);
|
|
71350
|
+
|
|
71244
71351
|
if (path.node.name !== name)
|
|
71245
71352
|
continue;
|
|
71246
71353
|
|
|
@@ -71257,7 +71364,7 @@ const traverse = (args) => ({push, options}) => {
|
|
|
71257
71364
|
|
|
71258
71365
|
const {block} = fnPath.scope;
|
|
71259
71366
|
|
|
71260
|
-
if (!compareAny(path.scope.path,
|
|
71367
|
+
if (!compareAny(path.scope.path, include))
|
|
71261
71368
|
continue;
|
|
71262
71369
|
|
|
71263
71370
|
if (compareAny(path.scope.path, exclude))
|
|
@@ -71317,6 +71424,25 @@ function getObjectPattern(params) {
|
|
|
71317
71424
|
];
|
|
71318
71425
|
}
|
|
71319
71426
|
|
|
71427
|
+
function parseConfig(config) {
|
|
71428
|
+
const [declaration, patternsInclude, patternsExclude] = config;
|
|
71429
|
+
|
|
71430
|
+
if (isArray$1(patternsInclude) || isString(patternsInclude))
|
|
71431
|
+
return [
|
|
71432
|
+
declaration,
|
|
71433
|
+
patternsInclude,
|
|
71434
|
+
patternsExclude,
|
|
71435
|
+
];
|
|
71436
|
+
|
|
71437
|
+
const {include, exclude} = patternsInclude;
|
|
71438
|
+
|
|
71439
|
+
return [
|
|
71440
|
+
declaration,
|
|
71441
|
+
include,
|
|
71442
|
+
exclude,
|
|
71443
|
+
];
|
|
71444
|
+
}
|
|
71445
|
+
|
|
71320
71446
|
const moduleDeclarations = [
|
|
71321
71447
|
'import',
|
|
71322
71448
|
'export',
|
|
@@ -71414,15 +71540,15 @@ const isLegacyKeyword = (name) => {
|
|
|
71414
71540
|
return legacyKeywords.includes(name);
|
|
71415
71541
|
};
|
|
71416
71542
|
|
|
71417
|
-
const findPlaces = (ast,
|
|
71418
|
-
return transform(ast,
|
|
71543
|
+
const findPlaces = (ast, opts) => {
|
|
71544
|
+
return transform(ast, {
|
|
71419
71545
|
...opts,
|
|
71420
71546
|
fix: false,
|
|
71421
71547
|
});
|
|
71422
71548
|
};
|
|
71423
71549
|
|
|
71424
|
-
const findPlacesAsync = async (ast,
|
|
71425
|
-
return await transformAsync(ast,
|
|
71550
|
+
const findPlacesAsync = async (ast, opts) => {
|
|
71551
|
+
return await transformAsync(ast, {
|
|
71426
71552
|
...opts,
|
|
71427
71553
|
fix: false,
|
|
71428
71554
|
});
|
|
@@ -71458,7 +71584,7 @@ const {join} = path;
|
|
|
71458
71584
|
|
|
71459
71585
|
const isObject$1 = (a) => a && typeof a === 'object';
|
|
71460
71586
|
const {entries} = Object;
|
|
71461
|
-
const report$
|
|
71587
|
+
const report$4 = (path, {message}) => message;
|
|
71462
71588
|
|
|
71463
71589
|
const matchFiles = (options) => {
|
|
71464
71590
|
const {filename} = options;
|
|
@@ -71467,21 +71593,21 @@ const matchFiles = (options) => {
|
|
|
71467
71593
|
|
|
71468
71594
|
check(files);
|
|
71469
71595
|
|
|
71470
|
-
const scan = createScan$
|
|
71596
|
+
const scan = createScan$3({
|
|
71471
71597
|
defaultFilename: filename,
|
|
71472
71598
|
files,
|
|
71473
71599
|
exclude,
|
|
71474
71600
|
});
|
|
71475
71601
|
|
|
71476
71602
|
return {
|
|
71477
|
-
fix: fix$
|
|
71603
|
+
fix: fix$6,
|
|
71478
71604
|
scan,
|
|
71479
|
-
report: report$
|
|
71605
|
+
report: report$4,
|
|
71480
71606
|
};
|
|
71481
71607
|
};
|
|
71482
71608
|
|
|
71483
|
-
function fix$
|
|
71484
|
-
transform(matchedAST,
|
|
71609
|
+
function fix$6(inputFile, {dirPath, matchInputFilename, outputFilename, matchedAST, options, rawOptions}) {
|
|
71610
|
+
transform(matchedAST, options);
|
|
71485
71611
|
|
|
71486
71612
|
const matchedJSON = magicPrint(outputFilename, matchedAST, rawOptions);
|
|
71487
71613
|
const outputFile = getOutputFile({
|
|
@@ -71497,7 +71623,7 @@ function fix$4(inputFile, {dirPath, matchInputFilename, outputFilename, matchedJ
|
|
|
71497
71623
|
removeFile(inputFile);
|
|
71498
71624
|
}
|
|
71499
71625
|
|
|
71500
|
-
const createScan$
|
|
71626
|
+
const createScan$3 = ({files, exclude, defaultFilename}) => (mainPath, {push, progress, options}) => {
|
|
71501
71627
|
const allFiles = [];
|
|
71502
71628
|
const cwd = getFilename(mainPath);
|
|
71503
71629
|
|
|
@@ -71550,7 +71676,7 @@ const createScan$2 = ({files, exclude, defaultFilename}) => (mainPath, {push, pr
|
|
|
71550
71676
|
const [matchedJS, matchedAST] = magicParse(inputFilename, fileContent);
|
|
71551
71677
|
|
|
71552
71678
|
const options = parseOptions(inputFilename, rawOptions);
|
|
71553
|
-
const places = findPlaces(matchedAST,
|
|
71679
|
+
const places = findPlaces(matchedAST, options);
|
|
71554
71680
|
|
|
71555
71681
|
if (!places.length)
|
|
71556
71682
|
continue;
|
|
@@ -71652,13 +71778,13 @@ function parseOptions(inputFilename, rawOptions) {
|
|
|
71652
71778
|
|
|
71653
71779
|
const {parse: parse$2} = JSON;
|
|
71654
71780
|
|
|
71655
|
-
const report$
|
|
71781
|
+
const report$3 = (file, {from, to}) => `Rename '${from}' to '${to}'`;
|
|
71656
71782
|
|
|
71657
|
-
const fix$
|
|
71783
|
+
const fix$5 = (file, {to}) => {
|
|
71658
71784
|
renameFile(file, to);
|
|
71659
71785
|
};
|
|
71660
71786
|
|
|
71661
|
-
const createScan$
|
|
71787
|
+
const createScan$2 = ({type, mask, rename} = {}) => (path, {push, trackFile}) => {
|
|
71662
71788
|
for (const file of trackFile(path, mask)) {
|
|
71663
71789
|
if (type && !checkType(type, file))
|
|
71664
71790
|
continue;
|
|
@@ -71706,29 +71832,29 @@ function findUpPackage(file) {
|
|
|
71706
71832
|
}
|
|
71707
71833
|
|
|
71708
71834
|
var renameFileWithFn = /*#__PURE__*/Object.freeze({
|
|
71709
|
-
|
|
71710
|
-
|
|
71711
|
-
|
|
71712
|
-
|
|
71835
|
+
__proto__: null,
|
|
71836
|
+
createScan: createScan$2,
|
|
71837
|
+
fix: fix$5,
|
|
71838
|
+
report: report$3
|
|
71713
71839
|
});
|
|
71714
71840
|
|
|
71715
71841
|
const returns = (a) => () => a;
|
|
71716
71842
|
|
|
71717
|
-
const report = (path, {mask, from, to}) => {
|
|
71843
|
+
const report$2 = (path, {mask, from, to}) => {
|
|
71718
71844
|
if (!mask)
|
|
71719
71845
|
return `Rename '${from}' to '${to}'`;
|
|
71720
71846
|
|
|
71721
71847
|
return `Rename '${mask}' to '${mask.replace(from, to)}'`;
|
|
71722
71848
|
};
|
|
71723
71849
|
|
|
71724
|
-
const fix$
|
|
71850
|
+
const fix$4 = (path, {from, to}) => {
|
|
71725
71851
|
const filename = getFilename(path);
|
|
71726
71852
|
const newFilename = filename.replace(from, to);
|
|
71727
71853
|
|
|
71728
71854
|
renameFile(path, newFilename);
|
|
71729
71855
|
};
|
|
71730
71856
|
|
|
71731
|
-
const createScan = (baseOptions) => (rootPath, {push, options, trackFile}) => {
|
|
71857
|
+
const createScan$1 = (baseOptions) => (rootPath, {push, options, trackFile}) => {
|
|
71732
71858
|
const from = options.from || baseOptions.from;
|
|
71733
71859
|
const to = options.to || baseOptions.to;
|
|
71734
71860
|
const mask = options.mask || baseOptions.mask;
|
|
@@ -71767,10 +71893,10 @@ const createCheckNear = (near) => (file) => {
|
|
|
71767
71893
|
};
|
|
71768
71894
|
|
|
71769
71895
|
var renameFileByMask = /*#__PURE__*/Object.freeze({
|
|
71770
|
-
|
|
71771
|
-
|
|
71772
|
-
|
|
71773
|
-
|
|
71896
|
+
__proto__: null,
|
|
71897
|
+
createScan: createScan$1,
|
|
71898
|
+
fix: fix$4,
|
|
71899
|
+
report: report$2
|
|
71774
71900
|
});
|
|
71775
71901
|
|
|
71776
71902
|
const renameFiles = ({type, mask, rename, from, to, near} = {}) => {
|
|
@@ -73907,10 +74033,12 @@ var picomatch$1 = picomatch_1.default;
|
|
|
73907
74033
|
const {stringLiteral: stringLiteral$1} = lib_exports;
|
|
73908
74034
|
const getValue = ({node}) => node.value;
|
|
73909
74035
|
|
|
74036
|
+
const difference$1 = (a, b) => new Set(a).difference(new Set(b));
|
|
74037
|
+
|
|
73910
74038
|
const ignore = ({name, property, list, type = __ignore}) => ({
|
|
73911
74039
|
report: createReport$1(name),
|
|
73912
|
-
fix: fix$
|
|
73913
|
-
traverse: createTraverse$
|
|
74040
|
+
fix: fix$3,
|
|
74041
|
+
traverse: createTraverse$2({
|
|
73914
74042
|
type,
|
|
73915
74043
|
property,
|
|
73916
74044
|
list,
|
|
@@ -73934,12 +74062,12 @@ const createReport$1 = (filename) => ({name, matchedElements}) => {
|
|
|
73934
74062
|
return `Add '${name}'${insteadOf} to '${filename}'`;
|
|
73935
74063
|
};
|
|
73936
74064
|
|
|
73937
|
-
const fix$
|
|
74065
|
+
const fix$3 = ({path, name, matchedElements}) => {
|
|
73938
74066
|
path.node.elements.push(stringLiteral$1(name));
|
|
73939
74067
|
matchedElements.map(remove);
|
|
73940
74068
|
};
|
|
73941
74069
|
|
|
73942
|
-
const createTraverse$
|
|
74070
|
+
const createTraverse$2 = ({type, property, list}) => ({push, options}) => {
|
|
73943
74071
|
const {dismiss = []} = options;
|
|
73944
74072
|
const newNames = filterNames(list, dismiss);
|
|
73945
74073
|
|
|
@@ -73957,10 +74085,7 @@ const createTraverse$1 = ({type, property, list}) => ({push, options}) => {
|
|
|
73957
74085
|
|
|
73958
74086
|
const list = elements.map(getValue);
|
|
73959
74087
|
|
|
73960
|
-
for (const name of newNames) {
|
|
73961
|
-
if (list.includes(name))
|
|
73962
|
-
continue;
|
|
73963
|
-
|
|
74088
|
+
for (const name of difference$1(newNames, list)) {
|
|
73964
74089
|
const match = picomatch$1(name);
|
|
73965
74090
|
const matchedElements = [];
|
|
73966
74091
|
|
|
@@ -74093,15 +74218,18 @@ const findFileUp = (file, name) => {
|
|
|
74093
74218
|
return findFileUp(parentDirectory, name);
|
|
74094
74219
|
};
|
|
74095
74220
|
|
|
74096
|
-
const {
|
|
74221
|
+
const {
|
|
74222
|
+
stringLiteral,
|
|
74223
|
+
isArrayExpression,
|
|
74224
|
+
} = lib_exports;
|
|
74097
74225
|
|
|
74098
74226
|
const sortIgnore = ({name, property, type = __ignore}) => ({
|
|
74099
74227
|
report: createReport({
|
|
74100
74228
|
name,
|
|
74101
74229
|
property,
|
|
74102
74230
|
}),
|
|
74103
|
-
fix,
|
|
74104
|
-
traverse: createTraverse({
|
|
74231
|
+
fix: fix$2,
|
|
74232
|
+
traverse: createTraverse$1({
|
|
74105
74233
|
type,
|
|
74106
74234
|
property,
|
|
74107
74235
|
}),
|
|
@@ -74114,17 +74242,12 @@ const createReport = ({name, property}) => () => {
|
|
|
74114
74242
|
return `Sort '${name}'`;
|
|
74115
74243
|
};
|
|
74116
74244
|
|
|
74117
|
-
const fix = ({path, sortedElements}) => {
|
|
74245
|
+
const fix$2 = ({path, sortedElements}) => {
|
|
74118
74246
|
path.node.elements = sortedElements;
|
|
74119
74247
|
};
|
|
74120
74248
|
|
|
74121
|
-
const createTraverse = ({type, property}) => ({push}) => ({
|
|
74249
|
+
const createTraverse$1 = ({type, property}) => ({push}) => ({
|
|
74122
74250
|
[type]: (path) => {
|
|
74123
|
-
const masks = [];
|
|
74124
|
-
const hidden = [];
|
|
74125
|
-
const files = [];
|
|
74126
|
-
const dirs = [];
|
|
74127
|
-
|
|
74128
74251
|
const parentOfElements = parseElements(path, {
|
|
74129
74252
|
property,
|
|
74130
74253
|
});
|
|
@@ -74134,39 +74257,9 @@ const createTraverse = ({type, property}) => ({push}) => ({
|
|
|
74134
74257
|
|
|
74135
74258
|
const {elements} = parentOfElements.node;
|
|
74136
74259
|
|
|
74137
|
-
|
|
74138
|
-
|
|
74139
|
-
|
|
74140
|
-
if (!value)
|
|
74141
|
-
continue;
|
|
74142
|
-
|
|
74143
|
-
if (value.startsWith('*')) {
|
|
74144
|
-
masks.push(element);
|
|
74145
|
-
continue;
|
|
74146
|
-
}
|
|
74147
|
-
|
|
74148
|
-
if (value.startsWith('.')) {
|
|
74149
|
-
hidden.push(element);
|
|
74150
|
-
continue;
|
|
74151
|
-
}
|
|
74152
|
-
|
|
74153
|
-
if (value.includes('.')) {
|
|
74154
|
-
files.push(element);
|
|
74155
|
-
continue;
|
|
74156
|
-
}
|
|
74157
|
-
|
|
74158
|
-
if (value.startsWith('#'))
|
|
74159
|
-
continue;
|
|
74160
|
-
|
|
74161
|
-
dirs.push(element);
|
|
74162
|
-
}
|
|
74163
|
-
|
|
74164
|
-
const sortedElements = [
|
|
74165
|
-
...maybeSeparate(masks, property),
|
|
74166
|
-
...maybeSeparate(hidden, property),
|
|
74167
|
-
...maybeSeparate(files, property),
|
|
74168
|
-
...dirs,
|
|
74169
|
-
];
|
|
74260
|
+
const sortedElements = cleverSort(elements, {
|
|
74261
|
+
separate: !property,
|
|
74262
|
+
});
|
|
74170
74263
|
|
|
74171
74264
|
for (const [index, {value}] of elements.entries()) {
|
|
74172
74265
|
const current = sortedElements[index];
|
|
@@ -74197,11 +74290,101 @@ function parseElements(path, {property}) {
|
|
|
74197
74290
|
if (!prop)
|
|
74198
74291
|
return null;
|
|
74199
74292
|
|
|
74200
|
-
|
|
74293
|
+
const arrayPath = prop.get('value');
|
|
74294
|
+
|
|
74295
|
+
if (!isArrayExpression(arrayPath))
|
|
74296
|
+
return null;
|
|
74297
|
+
|
|
74298
|
+
return arrayPath;
|
|
74201
74299
|
}
|
|
74202
74300
|
|
|
74203
|
-
function
|
|
74204
|
-
|
|
74301
|
+
function cleverSort(elements, {separate}) {
|
|
74302
|
+
const twoStars = [];
|
|
74303
|
+
const noStars = [];
|
|
74304
|
+
|
|
74305
|
+
for (const element of elements) {
|
|
74306
|
+
const {value} = element;
|
|
74307
|
+
|
|
74308
|
+
if (value.startsWith('**/')) {
|
|
74309
|
+
twoStars.push(element);
|
|
74310
|
+
continue;
|
|
74311
|
+
}
|
|
74312
|
+
|
|
74313
|
+
noStars.push(element);
|
|
74314
|
+
}
|
|
74315
|
+
|
|
74316
|
+
const sortedElements = [
|
|
74317
|
+
...sortElements(twoStars, {
|
|
74318
|
+
separate,
|
|
74319
|
+
}),
|
|
74320
|
+
...sortElements(noStars, {
|
|
74321
|
+
separate,
|
|
74322
|
+
}),
|
|
74323
|
+
];
|
|
74324
|
+
|
|
74325
|
+
if (!sortedElements.length)
|
|
74326
|
+
return elements;
|
|
74327
|
+
|
|
74328
|
+
if (!sortedElements.at(-1).value)
|
|
74329
|
+
return sortedElements.slice(0, -1);
|
|
74330
|
+
|
|
74331
|
+
return sortedElements;
|
|
74332
|
+
}
|
|
74333
|
+
|
|
74334
|
+
function sortElements(elements, {separate} = {}) {
|
|
74335
|
+
const masks = [];
|
|
74336
|
+
const hidden = [];
|
|
74337
|
+
const files = [];
|
|
74338
|
+
const dirs = [];
|
|
74339
|
+
const allowed = [];
|
|
74340
|
+
|
|
74341
|
+
for (const element of elements) {
|
|
74342
|
+
const value = cutStars(element);
|
|
74343
|
+
|
|
74344
|
+
if (!value)
|
|
74345
|
+
continue;
|
|
74346
|
+
|
|
74347
|
+
if (value.startsWith('*')) {
|
|
74348
|
+
masks.push(element);
|
|
74349
|
+
continue;
|
|
74350
|
+
}
|
|
74351
|
+
|
|
74352
|
+
if (value.startsWith('.')) {
|
|
74353
|
+
hidden.push(element);
|
|
74354
|
+
continue;
|
|
74355
|
+
}
|
|
74356
|
+
|
|
74357
|
+
if (value.startsWith('!')) {
|
|
74358
|
+
allowed.push(element);
|
|
74359
|
+
continue;
|
|
74360
|
+
}
|
|
74361
|
+
|
|
74362
|
+
if (value.includes('.')) {
|
|
74363
|
+
files.push(element);
|
|
74364
|
+
continue;
|
|
74365
|
+
}
|
|
74366
|
+
|
|
74367
|
+
if (value.startsWith('#'))
|
|
74368
|
+
continue;
|
|
74369
|
+
|
|
74370
|
+
dirs.push(element);
|
|
74371
|
+
}
|
|
74372
|
+
|
|
74373
|
+
const sortedElements = [
|
|
74374
|
+
masks,
|
|
74375
|
+
hidden,
|
|
74376
|
+
files,
|
|
74377
|
+
dirs,
|
|
74378
|
+
allowed,
|
|
74379
|
+
];
|
|
74380
|
+
|
|
74381
|
+
return sortedElements.flatMap(maybeSeparate({
|
|
74382
|
+
separate,
|
|
74383
|
+
}));
|
|
74384
|
+
}
|
|
74385
|
+
|
|
74386
|
+
const maybeSeparate = ({separate} = {}) => (array) => {
|
|
74387
|
+
if (!separate)
|
|
74205
74388
|
return array;
|
|
74206
74389
|
|
|
74207
74390
|
if (!array.length)
|
|
@@ -74211,113 +74394,193 @@ function maybeSeparate(array, property) {
|
|
|
74211
74394
|
...array,
|
|
74212
74395
|
stringLiteral(''),
|
|
74213
74396
|
];
|
|
74214
|
-
}
|
|
74397
|
+
};
|
|
74215
74398
|
|
|
74216
|
-
|
|
74217
|
-
|
|
74218
|
-
|
|
74219
|
-
|
|
74220
|
-
|
|
74221
|
-
|
|
74222
|
-
|
|
74223
|
-
|
|
74224
|
-
|
|
74225
|
-
|
|
74226
|
-
|
|
74227
|
-
|
|
74228
|
-
|
|
74229
|
-
|
|
74230
|
-
|
|
74231
|
-
|
|
74232
|
-
|
|
74233
|
-
|
|
74234
|
-
|
|
74235
|
-
|
|
74236
|
-
|
|
74237
|
-
|
|
74238
|
-
containsClassName: containsClassName,
|
|
74239
|
-
copyFile: copyFile,
|
|
74240
|
-
crawlDirectory: crawlDirectory,
|
|
74241
|
-
createDirectory: createDirectory,
|
|
74242
|
-
createFile: createFile,
|
|
74243
|
-
createNestedDirectory: createNestedDirectory,
|
|
74244
|
-
declare: declare$1,
|
|
74245
|
-
extract: extract,
|
|
74246
|
-
findBinding: findBinding,
|
|
74247
|
-
findFile: findFile,
|
|
74248
|
-
findFileUp: findFileUp,
|
|
74249
|
-
findVarsWays: findVarsWays,
|
|
74399
|
+
const cutStars = ({value}) => {
|
|
74400
|
+
if (!value)
|
|
74401
|
+
return '';
|
|
74402
|
+
|
|
74403
|
+
if (value.startsWith('**/'))
|
|
74404
|
+
return value.slice(3);
|
|
74405
|
+
|
|
74406
|
+
return value;
|
|
74407
|
+
};
|
|
74408
|
+
|
|
74409
|
+
const difference = (a, b) => new Set(a).difference(new Set(b));
|
|
74410
|
+
const {isArray} = Array;
|
|
74411
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
74412
|
+
|
|
74413
|
+
const report$1 = (file) => `Remove files: '${getFilename(file)}'`;
|
|
74414
|
+
|
|
74415
|
+
const fix$1 = (file) => {
|
|
74416
|
+
removeFile(file);
|
|
74417
|
+
};
|
|
74418
|
+
|
|
74419
|
+
const removeFiles = (defaultNames) => ({
|
|
74420
|
+
report: report$1,
|
|
74250
74421
|
fix: fix$1,
|
|
74251
|
-
|
|
74252
|
-
|
|
74253
|
-
|
|
74254
|
-
|
|
74255
|
-
|
|
74256
|
-
|
|
74257
|
-
|
|
74258
|
-
|
|
74259
|
-
|
|
74260
|
-
|
|
74261
|
-
|
|
74262
|
-
|
|
74263
|
-
|
|
74264
|
-
|
|
74265
|
-
|
|
74266
|
-
|
|
74267
|
-
|
|
74268
|
-
|
|
74269
|
-
|
|
74270
|
-
|
|
74271
|
-
|
|
74272
|
-
|
|
74273
|
-
|
|
74274
|
-
|
|
74275
|
-
|
|
74276
|
-
|
|
74277
|
-
|
|
74278
|
-
|
|
74279
|
-
|
|
74280
|
-
|
|
74281
|
-
|
|
74282
|
-
|
|
74283
|
-
|
|
74284
|
-
|
|
74285
|
-
|
|
74286
|
-
|
|
74287
|
-
|
|
74288
|
-
|
|
74289
|
-
|
|
74290
|
-
|
|
74291
|
-
|
|
74292
|
-
|
|
74293
|
-
|
|
74294
|
-
|
|
74295
|
-
|
|
74296
|
-
|
|
74297
|
-
|
|
74298
|
-
|
|
74299
|
-
|
|
74300
|
-
|
|
74301
|
-
|
|
74302
|
-
|
|
74303
|
-
|
|
74304
|
-
|
|
74305
|
-
|
|
74306
|
-
|
|
74307
|
-
|
|
74308
|
-
|
|
74309
|
-
|
|
74310
|
-
|
|
74311
|
-
|
|
74312
|
-
|
|
74313
|
-
|
|
74314
|
-
|
|
74315
|
-
|
|
74316
|
-
|
|
74317
|
-
|
|
74318
|
-
|
|
74319
|
-
|
|
74320
|
-
|
|
74422
|
+
scan: createScan(defaultNames),
|
|
74423
|
+
});
|
|
74424
|
+
|
|
74425
|
+
const createScan = (defaultNames = []) => (path, {push, trackFile, options}) => {
|
|
74426
|
+
const {names, dismiss} = options;
|
|
74427
|
+
const allNames = [
|
|
74428
|
+
maybeArray(defaultNames),
|
|
74429
|
+
maybeArray(names),
|
|
74430
|
+
];
|
|
74431
|
+
|
|
74432
|
+
const flatNames = allNames
|
|
74433
|
+
.flat()
|
|
74434
|
+
.filter(Boolean);
|
|
74435
|
+
|
|
74436
|
+
if (!flatNames.length)
|
|
74437
|
+
return;
|
|
74438
|
+
|
|
74439
|
+
for (const file of trackFile(path, difference(flatNames, dismiss))) {
|
|
74440
|
+
push(file, {
|
|
74441
|
+
names: allNames,
|
|
74442
|
+
});
|
|
74443
|
+
}
|
|
74444
|
+
};
|
|
74445
|
+
|
|
74446
|
+
const renameProperties = (tuples) => ({
|
|
74447
|
+
report,
|
|
74448
|
+
fix,
|
|
74449
|
+
traverse: createTraverse(tuples),
|
|
74450
|
+
});
|
|
74451
|
+
|
|
74452
|
+
const report = ({from, to}) => `Rename property: '${from}' -> '${to}'`;
|
|
74453
|
+
|
|
74454
|
+
const fix = ({path, to}) => {
|
|
74455
|
+
if (!to) {
|
|
74456
|
+
remove(path);
|
|
74457
|
+
return;
|
|
74458
|
+
}
|
|
74459
|
+
|
|
74460
|
+
setLiteralValue(path.node.key, to);
|
|
74461
|
+
};
|
|
74462
|
+
|
|
74463
|
+
const createTraverse = (tuples) => ({push}) => ({
|
|
74464
|
+
[__json](mainPath) {
|
|
74465
|
+
for (const [from, to] of tuples) {
|
|
74466
|
+
for (const path of traverseProperties(mainPath, from)) {
|
|
74467
|
+
push({
|
|
74468
|
+
path,
|
|
74469
|
+
from,
|
|
74470
|
+
to,
|
|
74471
|
+
});
|
|
74472
|
+
}
|
|
74473
|
+
}
|
|
74474
|
+
},
|
|
74475
|
+
});
|
|
74476
|
+
|
|
74477
|
+
var operator = /*#__PURE__*/Object.freeze({
|
|
74478
|
+
__proto__: null,
|
|
74479
|
+
__filesystem: __filesystem,
|
|
74480
|
+
__filesystem_name: __filesystem_name,
|
|
74481
|
+
__ignore: __ignore,
|
|
74482
|
+
__ignore_name: __ignore_name,
|
|
74483
|
+
__json: __json,
|
|
74484
|
+
__json_name: __json_name,
|
|
74485
|
+
__toml: __toml,
|
|
74486
|
+
__toml_name: __toml_name,
|
|
74487
|
+
__yaml: __yaml,
|
|
74488
|
+
__yaml_name: __yaml_name,
|
|
74489
|
+
addArgs: addArgs,
|
|
74490
|
+
addAttribute: addAttribute,
|
|
74491
|
+
addAttributeValue: addAttributeValue,
|
|
74492
|
+
addClassName: addClassName,
|
|
74493
|
+
addParens: addParens,
|
|
74494
|
+
compare: compare,
|
|
74495
|
+
compareAll: compareAll,
|
|
74496
|
+
compareAny: compareAny,
|
|
74497
|
+
compute: compute,
|
|
74498
|
+
contains: contains,
|
|
74499
|
+
containsClassName: containsClassName,
|
|
74500
|
+
copyFile: copyFile,
|
|
74501
|
+
crawlDirectory: crawlDirectory,
|
|
74502
|
+
createDirectory: createDirectory,
|
|
74503
|
+
createFile: createFile,
|
|
74504
|
+
createNestedDirectory: createNestedDirectory,
|
|
74505
|
+
declare: declare$1,
|
|
74506
|
+
extract: extract,
|
|
74507
|
+
findBinding: findBinding,
|
|
74508
|
+
findFile: findFile,
|
|
74509
|
+
findFileUp: findFileUp,
|
|
74510
|
+
findVarsWays: findVarsWays,
|
|
74511
|
+
fix: fix$3,
|
|
74512
|
+
fromJS: fromJS,
|
|
74513
|
+
getAttributeNode: getAttributeNode,
|
|
74514
|
+
getAttributePath: getAttributePath,
|
|
74515
|
+
getAttributeValue: getAttributeValue,
|
|
74516
|
+
getBinding: getBinding,
|
|
74517
|
+
getBindingPath: getBindingPath,
|
|
74518
|
+
getClassName: getClassName,
|
|
74519
|
+
getExportDefault: getExportDefault,
|
|
74520
|
+
getFile: getFile,
|
|
74521
|
+
getFileContent: getFileContent,
|
|
74522
|
+
getFileType: getFileType,
|
|
74523
|
+
getFilename: getFilename,
|
|
74524
|
+
getLiteralRaw: getLiteralRaw,
|
|
74525
|
+
getParentDirectory: getParentDirectory,
|
|
74526
|
+
getPathAfterImports: getPathAfterImports,
|
|
74527
|
+
getPathAfterRequires: getPathAfterRequires,
|
|
74528
|
+
getProperties: getProperties,
|
|
74529
|
+
getProperty: getProperty,
|
|
74530
|
+
getRootDirectory: getRootDirectory,
|
|
74531
|
+
getTemplateValues: getTemplateValues,
|
|
74532
|
+
getValues: getValues,
|
|
74533
|
+
hasAttributeValue: hasAttributeValue,
|
|
74534
|
+
hasDataName: hasDataName,
|
|
74535
|
+
hasParens: hasParens,
|
|
74536
|
+
hasTagName: hasTagName,
|
|
74537
|
+
ignore: ignore,
|
|
74538
|
+
insertAfter: insertAfter,
|
|
74539
|
+
insertBefore: insertBefore,
|
|
74540
|
+
isConditionKeyword: isConditionKeyword,
|
|
74541
|
+
isDeclarationKeyword: isDeclarationKeyword,
|
|
74542
|
+
isESM: isESM,
|
|
74543
|
+
isJSON: isJSON,
|
|
74544
|
+
isJSONGroup: isJSONGroup,
|
|
74545
|
+
isKeyword: isKeyword,
|
|
74546
|
+
isLegacyKeyword: isLegacyKeyword,
|
|
74547
|
+
isModuleDeclarationKeyword: isModuleDeclarationKeyword,
|
|
74548
|
+
isModuleExports: isModuleExports,
|
|
74549
|
+
isSimple: isSimple,
|
|
74550
|
+
isSimpleRegExp: isSimpleRegExp,
|
|
74551
|
+
isStatementKeyword: isStatementKeyword,
|
|
74552
|
+
isTOML: isTOML,
|
|
74553
|
+
isTSKeyword: isTSKeyword,
|
|
74554
|
+
isTemplate: isTemplate,
|
|
74555
|
+
matchFiles: matchFiles,
|
|
74556
|
+
moveFile: moveFile,
|
|
74557
|
+
parseTemplate: parseTemplate,
|
|
74558
|
+
readDirectory: readDirectory,
|
|
74559
|
+
readFileContent: readFileContent,
|
|
74560
|
+
remove: remove,
|
|
74561
|
+
removeAttributeValue: removeAttributeValue,
|
|
74562
|
+
removeClassName: removeClassName,
|
|
74563
|
+
removeEmptyDirectory: removeEmptyDirectory,
|
|
74564
|
+
removeFile: removeFile,
|
|
74565
|
+
removeFiles: removeFiles,
|
|
74566
|
+
removeParens: removeParens,
|
|
74567
|
+
rename: rename,
|
|
74568
|
+
renameFile: renameFile,
|
|
74569
|
+
renameFiles: renameFiles,
|
|
74570
|
+
renameProperties: renameProperties,
|
|
74571
|
+
renameProperty: renameProperty,
|
|
74572
|
+
replaceWith: replaceWith,
|
|
74573
|
+
replaceWithMultiple: replaceWithMultiple,
|
|
74574
|
+
setAttributeValue: setAttributeValue,
|
|
74575
|
+
setLiteralValue: setLiteralValue,
|
|
74576
|
+
setValues: setValues,
|
|
74577
|
+
sortIgnore: sortIgnore,
|
|
74578
|
+
toExpression: toExpression,
|
|
74579
|
+
toJS: toJS,
|
|
74580
|
+
transformRegExp: transformRegExp,
|
|
74581
|
+
traverse: traverse$3,
|
|
74582
|
+
traverseProperties: traverseProperties,
|
|
74583
|
+
writeFileContent: writeFileContent
|
|
74321
74584
|
});
|
|
74322
74585
|
|
|
74323
74586
|
const codeframe = ({source, error, highlightCode = true}) => {
|
|
@@ -74337,20 +74600,20 @@ const codeframe = ({source, error, highlightCode = true}) => {
|
|
|
74337
74600
|
};
|
|
74338
74601
|
|
|
74339
74602
|
var exports$1 = /*#__PURE__*/Object.freeze({
|
|
74340
|
-
|
|
74341
|
-
|
|
74342
|
-
|
|
74343
|
-
|
|
74344
|
-
|
|
74345
|
-
|
|
74346
|
-
|
|
74347
|
-
|
|
74348
|
-
|
|
74349
|
-
|
|
74350
|
-
|
|
74351
|
-
|
|
74352
|
-
|
|
74353
|
-
|
|
74603
|
+
__proto__: null,
|
|
74604
|
+
codeframe: codeframe,
|
|
74605
|
+
findPlaces: findPlaces,
|
|
74606
|
+
findPlacesAsync: findPlacesAsync,
|
|
74607
|
+
generate: generate,
|
|
74608
|
+
operator: operator,
|
|
74609
|
+
parse: parse$4,
|
|
74610
|
+
print: print,
|
|
74611
|
+
putoutAsync: putoutAsync,
|
|
74612
|
+
template: template$1,
|
|
74613
|
+
transform: transform,
|
|
74614
|
+
transformAsync: transformAsync,
|
|
74615
|
+
traverse: traverse3,
|
|
74616
|
+
types: lib_exports
|
|
74354
74617
|
});
|
|
74355
74618
|
|
|
74356
74619
|
Object.assign(putout, exports$1);
|