@html-validate/stylish 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +245 -0
- package/dist/cjs/browser.js.map +7 -0
- package/dist/cjs/{index.js → node.js} +23 -15
- package/dist/cjs/node.js.map +7 -0
- package/dist/esm/browser.js +230 -0
- package/dist/esm/browser.js.map +7 -0
- package/dist/esm/{index.js → node.js} +22 -14
- package/dist/esm/node.js.map +7 -0
- package/package.json +12 -6
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/index.js.map +0 -7
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/text-table/index.js
|
|
34
|
+
var require_text_table = __commonJS({
|
|
35
|
+
"node_modules/text-table/index.js"(exports, module2) {
|
|
36
|
+
module2.exports = function(rows_, opts) {
|
|
37
|
+
if (!opts)
|
|
38
|
+
opts = {};
|
|
39
|
+
var hsep = opts.hsep === void 0 ? " " : opts.hsep;
|
|
40
|
+
var align = opts.align || [];
|
|
41
|
+
var stringLength = opts.stringLength || function(s) {
|
|
42
|
+
return String(s).length;
|
|
43
|
+
};
|
|
44
|
+
var dotsizes = reduce(rows_, function(acc, row) {
|
|
45
|
+
forEach(row, function(c, ix) {
|
|
46
|
+
var n = dotindex(c);
|
|
47
|
+
if (!acc[ix] || n > acc[ix])
|
|
48
|
+
acc[ix] = n;
|
|
49
|
+
});
|
|
50
|
+
return acc;
|
|
51
|
+
}, []);
|
|
52
|
+
var rows = map(rows_, function(row) {
|
|
53
|
+
return map(row, function(c_, ix) {
|
|
54
|
+
var c = String(c_);
|
|
55
|
+
if (align[ix] === ".") {
|
|
56
|
+
var index = dotindex(c);
|
|
57
|
+
var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) - (stringLength(c) - index);
|
|
58
|
+
return c + Array(size).join(" ");
|
|
59
|
+
} else
|
|
60
|
+
return c;
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
var sizes = reduce(rows, function(acc, row) {
|
|
64
|
+
forEach(row, function(c, ix) {
|
|
65
|
+
var n = stringLength(c);
|
|
66
|
+
if (!acc[ix] || n > acc[ix])
|
|
67
|
+
acc[ix] = n;
|
|
68
|
+
});
|
|
69
|
+
return acc;
|
|
70
|
+
}, []);
|
|
71
|
+
return map(rows, function(row) {
|
|
72
|
+
return map(row, function(c, ix) {
|
|
73
|
+
var n = sizes[ix] - stringLength(c) || 0;
|
|
74
|
+
var s = Array(Math.max(n + 1, 1)).join(" ");
|
|
75
|
+
if (align[ix] === "r" || align[ix] === ".") {
|
|
76
|
+
return s + c;
|
|
77
|
+
}
|
|
78
|
+
if (align[ix] === "c") {
|
|
79
|
+
return Array(Math.ceil(n / 2 + 1)).join(" ") + c + Array(Math.floor(n / 2 + 1)).join(" ");
|
|
80
|
+
}
|
|
81
|
+
return c + s;
|
|
82
|
+
}).join(hsep).replace(/\s+$/, "");
|
|
83
|
+
}).join("\n");
|
|
84
|
+
};
|
|
85
|
+
function dotindex(c) {
|
|
86
|
+
var m = /\.[^.]*$/.exec(c);
|
|
87
|
+
return m ? m.index + 1 : c.length;
|
|
88
|
+
}
|
|
89
|
+
function reduce(xs, f, init) {
|
|
90
|
+
if (xs.reduce)
|
|
91
|
+
return xs.reduce(f, init);
|
|
92
|
+
var i = 0;
|
|
93
|
+
var acc = arguments.length >= 3 ? init : xs[i++];
|
|
94
|
+
for (; i < xs.length; i++) {
|
|
95
|
+
f(acc, xs[i], i);
|
|
96
|
+
}
|
|
97
|
+
return acc;
|
|
98
|
+
}
|
|
99
|
+
function forEach(xs, f) {
|
|
100
|
+
if (xs.forEach)
|
|
101
|
+
return xs.forEach(f);
|
|
102
|
+
for (var i = 0; i < xs.length; i++) {
|
|
103
|
+
f.call(xs, xs[i], i);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function map(xs, f) {
|
|
107
|
+
if (xs.map)
|
|
108
|
+
return xs.map(f);
|
|
109
|
+
var res = [];
|
|
110
|
+
for (var i = 0; i < xs.length; i++) {
|
|
111
|
+
res.push(f.call(xs, xs[i], i));
|
|
112
|
+
}
|
|
113
|
+
return res;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// src/index.ts
|
|
119
|
+
var src_exports = {};
|
|
120
|
+
__export(src_exports, {
|
|
121
|
+
Severity: () => Severity,
|
|
122
|
+
stylish: () => stylish
|
|
123
|
+
});
|
|
124
|
+
module.exports = __toCommonJS(src_exports);
|
|
125
|
+
|
|
126
|
+
// src/stylish.ts
|
|
127
|
+
var import_text_table = __toESM(require_text_table());
|
|
128
|
+
|
|
129
|
+
// src/colors-browser.ts
|
|
130
|
+
function passtru(value) {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
var reset = passtru;
|
|
134
|
+
var bold = passtru;
|
|
135
|
+
var dim = passtru;
|
|
136
|
+
var underline = passtru;
|
|
137
|
+
var yellow = passtru;
|
|
138
|
+
var red = passtru;
|
|
139
|
+
|
|
140
|
+
// src/severity.ts
|
|
141
|
+
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
142
|
+
Severity2[Severity2["OFF"] = 0] = "OFF";
|
|
143
|
+
Severity2[Severity2["WARN"] = 1] = "WARN";
|
|
144
|
+
Severity2[Severity2["ERROR"] = 2] = "ERROR";
|
|
145
|
+
return Severity2;
|
|
146
|
+
})(Severity || {});
|
|
147
|
+
|
|
148
|
+
// src/stylish.ts
|
|
149
|
+
function pluralize(word, count) {
|
|
150
|
+
return count === 1 ? word : `${word}s`;
|
|
151
|
+
}
|
|
152
|
+
function centerLineColumn(el) {
|
|
153
|
+
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim(`${p1}:${p2}`));
|
|
154
|
+
}
|
|
155
|
+
function stripAnsi(text) {
|
|
156
|
+
return text.replace(/\u001B\[[0-9;]*m/g, "");
|
|
157
|
+
}
|
|
158
|
+
function stylish(results) {
|
|
159
|
+
let output = "\n";
|
|
160
|
+
let errorCount = 0;
|
|
161
|
+
let warningCount = 0;
|
|
162
|
+
let fixableErrorCount = 0;
|
|
163
|
+
let fixableWarningCount = 0;
|
|
164
|
+
let summaryColor = yellow;
|
|
165
|
+
results.forEach((result) => {
|
|
166
|
+
const messages = result.messages;
|
|
167
|
+
if (messages.length === 0) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
errorCount += result.errorCount;
|
|
171
|
+
warningCount += result.warningCount;
|
|
172
|
+
fixableErrorCount += result.fixableErrorCount;
|
|
173
|
+
fixableWarningCount += result.fixableWarningCount;
|
|
174
|
+
const rows = messages.map((message) => {
|
|
175
|
+
let messageType;
|
|
176
|
+
if (Boolean(message.fatal) || message.severity === 2 /* ERROR */) {
|
|
177
|
+
messageType = red("error");
|
|
178
|
+
summaryColor = red;
|
|
179
|
+
} else {
|
|
180
|
+
messageType = yellow("warning");
|
|
181
|
+
}
|
|
182
|
+
return [
|
|
183
|
+
"",
|
|
184
|
+
message.line ?? 0,
|
|
185
|
+
message.column ?? 0,
|
|
186
|
+
messageType,
|
|
187
|
+
message.message.replace(/([^ ])\.$/u, "$1"),
|
|
188
|
+
message.ruleId ? dim(message.ruleId) : ""
|
|
189
|
+
];
|
|
190
|
+
});
|
|
191
|
+
const options = {
|
|
192
|
+
align: ["l", "r", "l"],
|
|
193
|
+
stringLength(str) {
|
|
194
|
+
return stripAnsi(str).length;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const formattedTable = (0, import_text_table.default)(rows, options).split("\n").map(centerLineColumn).join("\n");
|
|
198
|
+
output += `${underline(result.filePath)}
|
|
199
|
+
`;
|
|
200
|
+
output += `${formattedTable}
|
|
201
|
+
|
|
202
|
+
`;
|
|
203
|
+
});
|
|
204
|
+
const total = errorCount + warningCount;
|
|
205
|
+
if (total > 0) {
|
|
206
|
+
output += summaryColor(
|
|
207
|
+
bold(
|
|
208
|
+
[
|
|
209
|
+
"\u2716 ",
|
|
210
|
+
total,
|
|
211
|
+
pluralize(" problem", total),
|
|
212
|
+
" (",
|
|
213
|
+
errorCount,
|
|
214
|
+
pluralize(" error", errorCount),
|
|
215
|
+
", ",
|
|
216
|
+
warningCount,
|
|
217
|
+
pluralize(" warning", warningCount),
|
|
218
|
+
")\n"
|
|
219
|
+
].join("")
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
if (fixableErrorCount > 0 || fixableWarningCount > 0) {
|
|
223
|
+
output += summaryColor(
|
|
224
|
+
bold(
|
|
225
|
+
[
|
|
226
|
+
" ",
|
|
227
|
+
fixableErrorCount,
|
|
228
|
+
pluralize(" error", fixableErrorCount),
|
|
229
|
+
" and ",
|
|
230
|
+
fixableWarningCount,
|
|
231
|
+
pluralize(" warning", fixableWarningCount),
|
|
232
|
+
" potentially fixable with the `--fix` option.\n"
|
|
233
|
+
].join("")
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return total > 0 ? reset(output) : "";
|
|
239
|
+
}
|
|
240
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
241
|
+
0 && (module.exports = {
|
|
242
|
+
Severity,
|
|
243
|
+
stylish
|
|
244
|
+
});
|
|
245
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/text-table/index.js", "../../src/index.ts", "../../src/stylish.ts", "../../src/colors-browser.ts", "../../src/severity.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "export { stylish } from \"./stylish\";\nexport { Severity } from \"./severity\";\n", "import table, { type Options } from \"text-table\";\nimport * as colors from \"./colors-node\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => colors.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: colors.Colorize = colors.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (Boolean(message.fatal) || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = colors.red(\"error\");\n\t\t\t\tsummaryColor = colors.red;\n\t\t\t} else {\n\t\t\t\tmessageType = colors.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line ?? 0,\n\t\t\t\tmessage.column ?? 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? colors.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${colors.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tcolors.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tcolors.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? colors.reset(output) : \"\";\n}\n", "function passtru(value: string): string {\n\treturn value;\n}\n\nexport const reset = passtru;\nexport const bold = passtru;\nexport const dim = passtru;\nexport const underline = passtru;\n\nexport const yellow = passtru;\nexport const red = passtru;\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8CAAAA,SAAA;AAAA,IAAAA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;AAAA,IACD;AAAA,EACD;AAGA,SAAO,QAAQ,IAAW,MAAM,MAAM,IAAI;AAC3C;",
|
|
6
|
+
"names": ["module", "Severity", "table"]
|
|
7
|
+
}
|
|
@@ -124,9 +124,17 @@ __export(src_exports, {
|
|
|
124
124
|
module.exports = __toCommonJS(src_exports);
|
|
125
125
|
|
|
126
126
|
// src/stylish.ts
|
|
127
|
-
var kleur = __toESM(require("kleur/colors"));
|
|
128
127
|
var import_text_table = __toESM(require_text_table());
|
|
129
128
|
|
|
129
|
+
// src/colors-node.ts
|
|
130
|
+
var kleur = __toESM(require("kleur/colors"));
|
|
131
|
+
var reset2 = kleur.reset;
|
|
132
|
+
var bold2 = kleur.bold;
|
|
133
|
+
var dim2 = kleur.dim;
|
|
134
|
+
var underline2 = kleur.underline;
|
|
135
|
+
var yellow2 = kleur.yellow;
|
|
136
|
+
var red2 = kleur.red;
|
|
137
|
+
|
|
130
138
|
// src/severity.ts
|
|
131
139
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
132
140
|
Severity2[Severity2["OFF"] = 0] = "OFF";
|
|
@@ -140,7 +148,7 @@ function pluralize(word, count) {
|
|
|
140
148
|
return count === 1 ? word : `${word}s`;
|
|
141
149
|
}
|
|
142
150
|
function centerLineColumn(el) {
|
|
143
|
-
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) =>
|
|
151
|
+
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim2(`${p1}:${p2}`));
|
|
144
152
|
}
|
|
145
153
|
function stripAnsi(text) {
|
|
146
154
|
return text.replace(/\u001B\[[0-9;]*m/g, "");
|
|
@@ -151,7 +159,7 @@ function stylish(results) {
|
|
|
151
159
|
let warningCount = 0;
|
|
152
160
|
let fixableErrorCount = 0;
|
|
153
161
|
let fixableWarningCount = 0;
|
|
154
|
-
let summaryColor =
|
|
162
|
+
let summaryColor = yellow2;
|
|
155
163
|
results.forEach((result) => {
|
|
156
164
|
const messages = result.messages;
|
|
157
165
|
if (messages.length === 0) {
|
|
@@ -163,19 +171,19 @@ function stylish(results) {
|
|
|
163
171
|
fixableWarningCount += result.fixableWarningCount;
|
|
164
172
|
const rows = messages.map((message) => {
|
|
165
173
|
let messageType;
|
|
166
|
-
if (message.fatal || message.severity === 2 /* ERROR */) {
|
|
167
|
-
messageType =
|
|
168
|
-
summaryColor =
|
|
174
|
+
if (Boolean(message.fatal) || message.severity === 2 /* ERROR */) {
|
|
175
|
+
messageType = red2("error");
|
|
176
|
+
summaryColor = red2;
|
|
169
177
|
} else {
|
|
170
|
-
messageType =
|
|
178
|
+
messageType = yellow2("warning");
|
|
171
179
|
}
|
|
172
180
|
return [
|
|
173
181
|
"",
|
|
174
|
-
message.line
|
|
175
|
-
message.column
|
|
182
|
+
message.line ?? 0,
|
|
183
|
+
message.column ?? 0,
|
|
176
184
|
messageType,
|
|
177
185
|
message.message.replace(/([^ ])\.$/u, "$1"),
|
|
178
|
-
message.ruleId ?
|
|
186
|
+
message.ruleId ? dim2(message.ruleId) : ""
|
|
179
187
|
];
|
|
180
188
|
});
|
|
181
189
|
const options = {
|
|
@@ -185,7 +193,7 @@ function stylish(results) {
|
|
|
185
193
|
}
|
|
186
194
|
};
|
|
187
195
|
const formattedTable = (0, import_text_table.default)(rows, options).split("\n").map(centerLineColumn).join("\n");
|
|
188
|
-
output += `${
|
|
196
|
+
output += `${underline2(result.filePath)}
|
|
189
197
|
`;
|
|
190
198
|
output += `${formattedTable}
|
|
191
199
|
|
|
@@ -194,7 +202,7 @@ function stylish(results) {
|
|
|
194
202
|
const total = errorCount + warningCount;
|
|
195
203
|
if (total > 0) {
|
|
196
204
|
output += summaryColor(
|
|
197
|
-
|
|
205
|
+
bold2(
|
|
198
206
|
[
|
|
199
207
|
"\u2716 ",
|
|
200
208
|
total,
|
|
@@ -211,7 +219,7 @@ function stylish(results) {
|
|
|
211
219
|
);
|
|
212
220
|
if (fixableErrorCount > 0 || fixableWarningCount > 0) {
|
|
213
221
|
output += summaryColor(
|
|
214
|
-
|
|
222
|
+
bold2(
|
|
215
223
|
[
|
|
216
224
|
" ",
|
|
217
225
|
fixableErrorCount,
|
|
@@ -225,11 +233,11 @@ function stylish(results) {
|
|
|
225
233
|
);
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
|
-
return total > 0 ?
|
|
236
|
+
return total > 0 ? reset2(output) : "";
|
|
229
237
|
}
|
|
230
238
|
// Annotate the CommonJS export names for ESM import in node:
|
|
231
239
|
0 && (module.exports = {
|
|
232
240
|
Severity,
|
|
233
241
|
stylish
|
|
234
242
|
});
|
|
235
|
-
//# sourceMappingURL=
|
|
243
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/text-table/index.js", "../../src/index.ts", "../../src/stylish.ts", "../../src/colors-node.ts", "../../src/severity.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "export { stylish } from \"./stylish\";\nexport { Severity } from \"./severity\";\n", "import table, { type Options } from \"text-table\";\nimport * as colors from \"./colors-node\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => colors.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: colors.Colorize = colors.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (Boolean(message.fatal) || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = colors.red(\"error\");\n\t\t\t\tsummaryColor = colors.red;\n\t\t\t} else {\n\t\t\t\tmessageType = colors.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line ?? 0,\n\t\t\t\tmessage.column ?? 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? colors.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${colors.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tcolors.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tcolors.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? colors.reset(output) : \"\";\n}\n", "import * as kleur from \"kleur/colors\";\n\nexport type Colorize = kleur.Colorize;\n\nexport const reset = kleur.reset;\nexport const bold = kleur.bold;\nexport const dim = kleur.dim;\nexport const underline = kleur.underline;\n\nexport const yellow = kleur.yellow;\nexport const red = kleur.red;\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8CAAAA,SAAA;AAAA,IAAAA,QAAO,UAAU,SAAU,OAAO,MAAM;AACpC,UAAI,CAAC;AAAM,eAAO,CAAC;AACnB,UAAI,OAAO,KAAK,SAAS,SAAY,OAAO,KAAK;AACjD,UAAI,QAAQ,KAAK,SAAS,CAAC;AAC3B,UAAI,eAAe,KAAK,gBACjB,SAAU,GAAG;AAAE,eAAO,OAAO,CAAC,EAAE;AAAA,MAAQ;AAG/C,UAAI,WAAW,OAA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SAAgBD,KAAI,QAAQ,MAAM,IAAI;AAAA,MAC/C;AAAA,IACD,CAAC;AAED,UAAM,UAAmB;AAAA,MACxB,OAAO,CAAC,KAAK,KAAK,GAAG;AAAA,MACrB,aAAa,KAAqB;AACjC,eAAO,UAAU,GAAG,EAAE;AAAA,MACvB;AAAA,IACD;AACA,UAAM,qBAAiB,kBAAAG,SAAM,MAAM,OAAO,EAAE,MAAM,IAAI,EAAE,IAAI,gBAAgB,EAAE,KAAK,IAAI;AAEvF,cAAU,GAAUC,WAAU,OAAO,QAAQ,CAAC;AAAA;AAC9C,cAAU,GAAG,cAAc;AAAA;AAAA;AAAA,EAC5B,CAAC;AAED,QAAM,QAAQ,aAAa;AAE3B,MAAI,QAAQ,GAAG;AACd,cAAU;AAAA,MACFC;AAAA,QACN;AAAA,UACC;AAAA,UACA;AAAA,UACA,UAAU,YAAY,KAAK;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,UAAU,UAAU,UAAU;AAAA,UAC9B;AAAA,UACA;AAAA,UACA,UAAU,YAAY,YAAY;AAAA,UAClC;AAAA,QACD,EAAE,KAAK,EAAE;AAAA,MACV;AAAA,IACD;AAEA,QAAI,oBAAoB,KAAK,sBAAsB,GAAG;AACrD,gBAAU;AAAA,QACFA;AAAA,UACN;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,UAAU,iBAAiB;AAAA,YACrC;AAAA,YACA;AAAA,YACA,UAAU,YAAY,mBAAmB;AAAA,YACzC;AAAA,UACD,EAAE,KAAK,EAAE;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAGA,SAAO,QAAQ,IAAWC,OAAM,MAAM,IAAI;AAC3C;",
|
|
6
|
+
"names": ["module", "reset", "bold", "dim", "underline", "yellow", "red", "Severity", "dim", "yellow", "red", "table", "underline", "bold", "reset"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/text-table/index.js
|
|
28
|
+
var require_text_table = __commonJS({
|
|
29
|
+
"node_modules/text-table/index.js"(exports, module) {
|
|
30
|
+
module.exports = function(rows_, opts) {
|
|
31
|
+
if (!opts)
|
|
32
|
+
opts = {};
|
|
33
|
+
var hsep = opts.hsep === void 0 ? " " : opts.hsep;
|
|
34
|
+
var align = opts.align || [];
|
|
35
|
+
var stringLength = opts.stringLength || function(s) {
|
|
36
|
+
return String(s).length;
|
|
37
|
+
};
|
|
38
|
+
var dotsizes = reduce(rows_, function(acc, row) {
|
|
39
|
+
forEach(row, function(c, ix) {
|
|
40
|
+
var n = dotindex(c);
|
|
41
|
+
if (!acc[ix] || n > acc[ix])
|
|
42
|
+
acc[ix] = n;
|
|
43
|
+
});
|
|
44
|
+
return acc;
|
|
45
|
+
}, []);
|
|
46
|
+
var rows = map(rows_, function(row) {
|
|
47
|
+
return map(row, function(c_, ix) {
|
|
48
|
+
var c = String(c_);
|
|
49
|
+
if (align[ix] === ".") {
|
|
50
|
+
var index = dotindex(c);
|
|
51
|
+
var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) - (stringLength(c) - index);
|
|
52
|
+
return c + Array(size).join(" ");
|
|
53
|
+
} else
|
|
54
|
+
return c;
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var sizes = reduce(rows, function(acc, row) {
|
|
58
|
+
forEach(row, function(c, ix) {
|
|
59
|
+
var n = stringLength(c);
|
|
60
|
+
if (!acc[ix] || n > acc[ix])
|
|
61
|
+
acc[ix] = n;
|
|
62
|
+
});
|
|
63
|
+
return acc;
|
|
64
|
+
}, []);
|
|
65
|
+
return map(rows, function(row) {
|
|
66
|
+
return map(row, function(c, ix) {
|
|
67
|
+
var n = sizes[ix] - stringLength(c) || 0;
|
|
68
|
+
var s = Array(Math.max(n + 1, 1)).join(" ");
|
|
69
|
+
if (align[ix] === "r" || align[ix] === ".") {
|
|
70
|
+
return s + c;
|
|
71
|
+
}
|
|
72
|
+
if (align[ix] === "c") {
|
|
73
|
+
return Array(Math.ceil(n / 2 + 1)).join(" ") + c + Array(Math.floor(n / 2 + 1)).join(" ");
|
|
74
|
+
}
|
|
75
|
+
return c + s;
|
|
76
|
+
}).join(hsep).replace(/\s+$/, "");
|
|
77
|
+
}).join("\n");
|
|
78
|
+
};
|
|
79
|
+
function dotindex(c) {
|
|
80
|
+
var m = /\.[^.]*$/.exec(c);
|
|
81
|
+
return m ? m.index + 1 : c.length;
|
|
82
|
+
}
|
|
83
|
+
function reduce(xs, f, init) {
|
|
84
|
+
if (xs.reduce)
|
|
85
|
+
return xs.reduce(f, init);
|
|
86
|
+
var i = 0;
|
|
87
|
+
var acc = arguments.length >= 3 ? init : xs[i++];
|
|
88
|
+
for (; i < xs.length; i++) {
|
|
89
|
+
f(acc, xs[i], i);
|
|
90
|
+
}
|
|
91
|
+
return acc;
|
|
92
|
+
}
|
|
93
|
+
function forEach(xs, f) {
|
|
94
|
+
if (xs.forEach)
|
|
95
|
+
return xs.forEach(f);
|
|
96
|
+
for (var i = 0; i < xs.length; i++) {
|
|
97
|
+
f.call(xs, xs[i], i);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function map(xs, f) {
|
|
101
|
+
if (xs.map)
|
|
102
|
+
return xs.map(f);
|
|
103
|
+
var res = [];
|
|
104
|
+
for (var i = 0; i < xs.length; i++) {
|
|
105
|
+
res.push(f.call(xs, xs[i], i));
|
|
106
|
+
}
|
|
107
|
+
return res;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// src/stylish.ts
|
|
113
|
+
var import_text_table = __toESM(require_text_table());
|
|
114
|
+
|
|
115
|
+
// src/colors-browser.ts
|
|
116
|
+
function passtru(value) {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
var reset = passtru;
|
|
120
|
+
var bold = passtru;
|
|
121
|
+
var dim = passtru;
|
|
122
|
+
var underline = passtru;
|
|
123
|
+
var yellow = passtru;
|
|
124
|
+
var red = passtru;
|
|
125
|
+
|
|
126
|
+
// src/severity.ts
|
|
127
|
+
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
128
|
+
Severity2[Severity2["OFF"] = 0] = "OFF";
|
|
129
|
+
Severity2[Severity2["WARN"] = 1] = "WARN";
|
|
130
|
+
Severity2[Severity2["ERROR"] = 2] = "ERROR";
|
|
131
|
+
return Severity2;
|
|
132
|
+
})(Severity || {});
|
|
133
|
+
|
|
134
|
+
// src/stylish.ts
|
|
135
|
+
function pluralize(word, count) {
|
|
136
|
+
return count === 1 ? word : `${word}s`;
|
|
137
|
+
}
|
|
138
|
+
function centerLineColumn(el) {
|
|
139
|
+
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim(`${p1}:${p2}`));
|
|
140
|
+
}
|
|
141
|
+
function stripAnsi(text) {
|
|
142
|
+
return text.replace(/\u001B\[[0-9;]*m/g, "");
|
|
143
|
+
}
|
|
144
|
+
function stylish(results) {
|
|
145
|
+
let output = "\n";
|
|
146
|
+
let errorCount = 0;
|
|
147
|
+
let warningCount = 0;
|
|
148
|
+
let fixableErrorCount = 0;
|
|
149
|
+
let fixableWarningCount = 0;
|
|
150
|
+
let summaryColor = yellow;
|
|
151
|
+
results.forEach((result) => {
|
|
152
|
+
const messages = result.messages;
|
|
153
|
+
if (messages.length === 0) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
errorCount += result.errorCount;
|
|
157
|
+
warningCount += result.warningCount;
|
|
158
|
+
fixableErrorCount += result.fixableErrorCount;
|
|
159
|
+
fixableWarningCount += result.fixableWarningCount;
|
|
160
|
+
const rows = messages.map((message) => {
|
|
161
|
+
let messageType;
|
|
162
|
+
if (Boolean(message.fatal) || message.severity === 2 /* ERROR */) {
|
|
163
|
+
messageType = red("error");
|
|
164
|
+
summaryColor = red;
|
|
165
|
+
} else {
|
|
166
|
+
messageType = yellow("warning");
|
|
167
|
+
}
|
|
168
|
+
return [
|
|
169
|
+
"",
|
|
170
|
+
message.line ?? 0,
|
|
171
|
+
message.column ?? 0,
|
|
172
|
+
messageType,
|
|
173
|
+
message.message.replace(/([^ ])\.$/u, "$1"),
|
|
174
|
+
message.ruleId ? dim(message.ruleId) : ""
|
|
175
|
+
];
|
|
176
|
+
});
|
|
177
|
+
const options = {
|
|
178
|
+
align: ["l", "r", "l"],
|
|
179
|
+
stringLength(str) {
|
|
180
|
+
return stripAnsi(str).length;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const formattedTable = (0, import_text_table.default)(rows, options).split("\n").map(centerLineColumn).join("\n");
|
|
184
|
+
output += `${underline(result.filePath)}
|
|
185
|
+
`;
|
|
186
|
+
output += `${formattedTable}
|
|
187
|
+
|
|
188
|
+
`;
|
|
189
|
+
});
|
|
190
|
+
const total = errorCount + warningCount;
|
|
191
|
+
if (total > 0) {
|
|
192
|
+
output += summaryColor(
|
|
193
|
+
bold(
|
|
194
|
+
[
|
|
195
|
+
"\u2716 ",
|
|
196
|
+
total,
|
|
197
|
+
pluralize(" problem", total),
|
|
198
|
+
" (",
|
|
199
|
+
errorCount,
|
|
200
|
+
pluralize(" error", errorCount),
|
|
201
|
+
", ",
|
|
202
|
+
warningCount,
|
|
203
|
+
pluralize(" warning", warningCount),
|
|
204
|
+
")\n"
|
|
205
|
+
].join("")
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
if (fixableErrorCount > 0 || fixableWarningCount > 0) {
|
|
209
|
+
output += summaryColor(
|
|
210
|
+
bold(
|
|
211
|
+
[
|
|
212
|
+
" ",
|
|
213
|
+
fixableErrorCount,
|
|
214
|
+
pluralize(" error", fixableErrorCount),
|
|
215
|
+
" and ",
|
|
216
|
+
fixableWarningCount,
|
|
217
|
+
pluralize(" warning", fixableWarningCount),
|
|
218
|
+
" potentially fixable with the `--fix` option.\n"
|
|
219
|
+
].join("")
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return total > 0 ? reset(output) : "";
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
Severity,
|
|
228
|
+
stylish
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/text-table/index.js", "../../src/stylish.ts", "../../src/colors-browser.ts", "../../src/severity.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "import table, { type Options } from \"text-table\";\nimport * as colors from \"./colors-node\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => colors.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: colors.Colorize = colors.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (Boolean(message.fatal) || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = colors.red(\"error\");\n\t\t\t\tsummaryColor = colors.red;\n\t\t\t} else {\n\t\t\t\tmessageType = colors.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line ?? 0,\n\t\t\t\tmessage.column ?? 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? colors.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${colors.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tcolors.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tcolors.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? colors.reset(output) : \"\";\n}\n", "function passtru(value: string): string {\n\treturn value;\n}\n\nexport const reset = passtru;\nexport const bold = passtru;\nexport const dim = passtru;\nexport const underline = passtru;\n\nexport const yellow = passtru;\nexport const red = passtru;\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,WAAO,UAAU,SAAU,OAAO,MAAM;AACpC,UAAI,CAAC;AAAM,eAAO,CAAC;AACnB,UAAI,OAAO,KAAK,SAAS,SAAY,OAAO,KAAK;AACjD,UAAI,QAAQ,KAAK,SAAS,CAAC;AAC3B,UAAI,eAAe,KAAK,gBACjB,SAAU,GAAG;AAAE,eAAO,OAAO,CAAC,EAAE;AAAA,MAAQ;AAG/C,UAAI,WAAW,OAAO,OAAO,SAAU,KAAK,KAAK;AAC7C,gBAAQ,KAAK,SAAU,GAAG,IAAI;AAC1B,cAAI,IAAI,SAAS,CAAC;AAClB,cAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE;AAAG,gBAAI,EAAE,IAAI;AAAA,QAC3C,CAAC;AACD,eAAO;AAAA,MACX,GAAG,CAAC,CAAC;AAEL,UAAI,OAAO,IAAI,OAAO,SAAU,KAAK;AACjC,eAAO,IAAI,KAAK,SAAU,IAAI,IAAI;AAC9B,cAAI,IAAI,OAAO,EAAE;AACjB,cAAI,MAAM,EAAE,MAAM,KAAK;AACnB,gBAAI,QAAQ,SAAS,CAAC;AACtB,gBAAI,OAAO,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,IAAI,IAAI,MACvC,aAAa,CAAC,IAAI;AAEzB,mBAAO,IAAI,MAAM,IAAI,EAAE,KAAK,GAAG;AAAA,UACnC;AACK,mBAAO;AAAA,QAChB,CAAC;AAAA,MACL,CAAC;AAED,UAAI,QAAQ,OAAO,MAAM,SAAU,KAAK,KAAK;AACzC,gBAAQ,KAAK,SAAU,GAAG,IAAI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KAAK,sBAAsB,GAAG;AACrD,gBAAU;AAAA,QACF;AAAA,UACN;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,UAAU,iBAAiB;AAAA,YACrC;AAAA,YACA;AAAA,YACA,UAAU,YAAY,mBAAmB;AAAA,YACzC;AAAA,UACD,EAAE,KAAK,EAAE;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAGA,SAAO,QAAQ,IAAW,MAAM,MAAM,IAAI;AAC3C;",
|
|
6
|
+
"names": ["Severity", "table"]
|
|
7
|
+
}
|
|
@@ -111,7 +111,15 @@ var require_text_table = __commonJS({
|
|
|
111
111
|
|
|
112
112
|
// src/stylish.ts
|
|
113
113
|
var import_text_table = __toESM(require_text_table());
|
|
114
|
+
|
|
115
|
+
// src/colors-node.ts
|
|
114
116
|
import * as kleur from "kleur/colors";
|
|
117
|
+
var reset2 = kleur.reset;
|
|
118
|
+
var bold2 = kleur.bold;
|
|
119
|
+
var dim2 = kleur.dim;
|
|
120
|
+
var underline2 = kleur.underline;
|
|
121
|
+
var yellow2 = kleur.yellow;
|
|
122
|
+
var red2 = kleur.red;
|
|
115
123
|
|
|
116
124
|
// src/severity.ts
|
|
117
125
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
@@ -126,7 +134,7 @@ function pluralize(word, count) {
|
|
|
126
134
|
return count === 1 ? word : `${word}s`;
|
|
127
135
|
}
|
|
128
136
|
function centerLineColumn(el) {
|
|
129
|
-
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) =>
|
|
137
|
+
return el.replace(/(\d+)\s+(\d+)/u, (_m, p1, p2) => dim2(`${p1}:${p2}`));
|
|
130
138
|
}
|
|
131
139
|
function stripAnsi(text) {
|
|
132
140
|
return text.replace(/\u001B\[[0-9;]*m/g, "");
|
|
@@ -137,7 +145,7 @@ function stylish(results) {
|
|
|
137
145
|
let warningCount = 0;
|
|
138
146
|
let fixableErrorCount = 0;
|
|
139
147
|
let fixableWarningCount = 0;
|
|
140
|
-
let summaryColor =
|
|
148
|
+
let summaryColor = yellow2;
|
|
141
149
|
results.forEach((result) => {
|
|
142
150
|
const messages = result.messages;
|
|
143
151
|
if (messages.length === 0) {
|
|
@@ -149,19 +157,19 @@ function stylish(results) {
|
|
|
149
157
|
fixableWarningCount += result.fixableWarningCount;
|
|
150
158
|
const rows = messages.map((message) => {
|
|
151
159
|
let messageType;
|
|
152
|
-
if (message.fatal || message.severity === 2 /* ERROR */) {
|
|
153
|
-
messageType =
|
|
154
|
-
summaryColor =
|
|
160
|
+
if (Boolean(message.fatal) || message.severity === 2 /* ERROR */) {
|
|
161
|
+
messageType = red2("error");
|
|
162
|
+
summaryColor = red2;
|
|
155
163
|
} else {
|
|
156
|
-
messageType =
|
|
164
|
+
messageType = yellow2("warning");
|
|
157
165
|
}
|
|
158
166
|
return [
|
|
159
167
|
"",
|
|
160
|
-
message.line
|
|
161
|
-
message.column
|
|
168
|
+
message.line ?? 0,
|
|
169
|
+
message.column ?? 0,
|
|
162
170
|
messageType,
|
|
163
171
|
message.message.replace(/([^ ])\.$/u, "$1"),
|
|
164
|
-
message.ruleId ?
|
|
172
|
+
message.ruleId ? dim2(message.ruleId) : ""
|
|
165
173
|
];
|
|
166
174
|
});
|
|
167
175
|
const options = {
|
|
@@ -171,7 +179,7 @@ function stylish(results) {
|
|
|
171
179
|
}
|
|
172
180
|
};
|
|
173
181
|
const formattedTable = (0, import_text_table.default)(rows, options).split("\n").map(centerLineColumn).join("\n");
|
|
174
|
-
output += `${
|
|
182
|
+
output += `${underline2(result.filePath)}
|
|
175
183
|
`;
|
|
176
184
|
output += `${formattedTable}
|
|
177
185
|
|
|
@@ -180,7 +188,7 @@ function stylish(results) {
|
|
|
180
188
|
const total = errorCount + warningCount;
|
|
181
189
|
if (total > 0) {
|
|
182
190
|
output += summaryColor(
|
|
183
|
-
|
|
191
|
+
bold2(
|
|
184
192
|
[
|
|
185
193
|
"\u2716 ",
|
|
186
194
|
total,
|
|
@@ -197,7 +205,7 @@ function stylish(results) {
|
|
|
197
205
|
);
|
|
198
206
|
if (fixableErrorCount > 0 || fixableWarningCount > 0) {
|
|
199
207
|
output += summaryColor(
|
|
200
|
-
|
|
208
|
+
bold2(
|
|
201
209
|
[
|
|
202
210
|
" ",
|
|
203
211
|
fixableErrorCount,
|
|
@@ -211,10 +219,10 @@ function stylish(results) {
|
|
|
211
219
|
);
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
|
-
return total > 0 ?
|
|
222
|
+
return total > 0 ? reset2(output) : "";
|
|
215
223
|
}
|
|
216
224
|
export {
|
|
217
225
|
Severity,
|
|
218
226
|
stylish
|
|
219
227
|
};
|
|
220
|
-
//# sourceMappingURL=
|
|
228
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/text-table/index.js", "../../src/stylish.ts", "../../src/colors-node.ts", "../../src/severity.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "import table, { type Options } from \"text-table\";\nimport * as colors from \"./colors-node\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => colors.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: colors.Colorize = colors.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (Boolean(message.fatal) || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = colors.red(\"error\");\n\t\t\t\tsummaryColor = colors.red;\n\t\t\t} else {\n\t\t\t\tmessageType = colors.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line ?? 0,\n\t\t\t\tmessage.column ?? 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? colors.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${colors.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tcolors.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tcolors.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? colors.reset(output) : \"\";\n}\n", "import * as kleur from \"kleur/colors\";\n\nexport type Colorize = kleur.Colorize;\n\nexport const reset = kleur.reset;\nexport const bold = kleur.bold;\nexport const dim = kleur.dim;\nexport const underline = kleur.underline;\n\nexport const yellow = kleur.yellow;\nexport const red = kleur.red;\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,WAAO,UAAU,SAAU,OAAO,MAAM;AACpC,UAAI,CAAC;AAAM,eAAO,CAAC;AACnB,UAAI,OAAO,KAAK,SAAS,SAAY,OAAO,KAAK;AACjD,UAAI,QAAQ,KAAK,SAAS,CAAC;AAC3B,UAAI,eAAe,KAAK,gBACjB,SAAU,GAAG;AAAE,eAAO,OAAO,CAAC,EAAE;AAAA,MAAQ;AAG/C,UAAI,WAAW,OAAO,OAAO,SAAU,KAAK,KAAK;AA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;AAED,UAAM,UAAmB;AAAA,MACxB,OAAO,CAAC,KAAK,KAAK,GAAG;AAAA,MACrB,aAAa,KAAqB;AACjC,eAAO,UAAU,GAAG,EAAE;AAAA,MACvB;AAAA,IACD;AACA,UAAM,qBAAiB,kBAAAG,SAAM,MAAM,OAAO,EAAE,MAAM,IAAI,EAAE,IAAI,gBAAgB,EAAE,KAAK,IAAI;AAEvF,cAAU,GAAUC,WAAU,OAAO,QAAQ,CAAC;AAAA;AAC9C,cAAU,GAAG,cAAc;AAAA;AAAA;AAAA,EAC5B,CAAC;AAED,QAAM,QAAQ,aAAa;AAE3B,MAAI,QAAQ,GAAG;AACd,cAAU;AAAA,MACFC;AAAA,QACN;AAAA,UACC;AAAA,UACA;AAAA,UACA,UAAU,YAAY,KAAK;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,UAAU,UAAU,UAAU;AAAA,UAC9B;AAAA,UACA;AAAA,UACA,UAAU,YAAY,YAAY;AAAA,UAClC;AAAA,QACD,EAAE,KAAK,EAAE;AAAA,MACV;AAAA,IACD;AAEA,QAAI,oBAAoB,KAAK,sBAAsB,GAAG;AACrD,gBAAU;AAAA,QACFA;AAAA,UACN;AAAA,YACC;AAAA,YACA;AAAA,YACA,UAAU,UAAU,iBAAiB;AAAA,YACrC;AAAA,YACA;AAAA,YACA,UAAU,YAAY,mBAAmB;AAAA,YACzC;AAAA,UACD,EAAE,KAAK,EAAE;AAAA,QACV;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAGA,SAAO,QAAQ,IAAWC,OAAM,MAAM,IAAI;AAC3C;",
|
|
6
|
+
"names": ["reset", "bold", "dim", "underline", "yellow", "red", "Severity", "dim", "yellow", "red", "table", "underline", "bold", "reset"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/stylish",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "ESLint compatible stylish formatter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stylish",
|
|
@@ -17,14 +17,20 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": "David Sveningsson <ext@sidvind.com>",
|
|
19
19
|
"sideEffects": false,
|
|
20
|
-
"main": "dist/cjs/
|
|
21
|
-
"module": "dist/esm/
|
|
20
|
+
"main": "dist/cjs/node.js",
|
|
21
|
+
"module": "dist/esm/node.js",
|
|
22
22
|
"types": "dist/types/index.d.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
|
-
"
|
|
27
|
-
|
|
26
|
+
"browser": {
|
|
27
|
+
"require": "./dist/cjs/browser.js",
|
|
28
|
+
"import": "./dist/esm/browser.js"
|
|
29
|
+
},
|
|
30
|
+
"node": {
|
|
31
|
+
"require": "./dist/cjs/node.js",
|
|
32
|
+
"import": "./dist/esm/node.js"
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
"files": [
|
|
@@ -34,7 +40,7 @@
|
|
|
34
40
|
"kleur": "^4.0.0"
|
|
35
41
|
},
|
|
36
42
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
43
|
+
"node": ">= 16"
|
|
38
44
|
},
|
|
39
45
|
"publishConfig": {
|
|
40
46
|
"access": "public"
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/text-table/index.js", "../../src/index.ts", "../../src/stylish.ts", "../../src/severity.ts"],
|
|
4
|
-
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "export { stylish } from \"./stylish\";\nexport { Severity } from \"./severity\";\n", "import * as kleur from \"kleur/colors\";\nimport table, { type Options } from \"text-table\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => kleur.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: kleur.Colorize = kleur.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (message.fatal || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = kleur.red(\"error\");\n\t\t\t\tsummaryColor = kleur.red;\n\t\t\t} else {\n\t\t\t\tmessageType = kleur.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line || 0,\n\t\t\t\tmessage.column || 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? kleur.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${kleur.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tkleur.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tkleur.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? kleur.reset(output) : \"\";\n}\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8CAAAA,S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@@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/text-table/index.js", "../../src/stylish.ts", "../../src/severity.ts"],
|
|
4
|
-
"sourcesContent": ["module.exports = function (rows_, opts) {\n if (!opts) opts = {};\n var hsep = opts.hsep === undefined ? ' ' : opts.hsep;\n var align = opts.align || [];\n var stringLength = opts.stringLength\n || function (s) { return String(s).length; }\n ;\n \n var dotsizes = reduce(rows_, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = dotindex(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n var rows = map(rows_, function (row) {\n return map(row, function (c_, ix) {\n var c = String(c_);\n if (align[ix] === '.') {\n var index = dotindex(c);\n var size = dotsizes[ix] + (/\\./.test(c) ? 1 : 2)\n - (stringLength(c) - index)\n ;\n return c + Array(size).join(' ');\n }\n else return c;\n });\n });\n \n var sizes = reduce(rows, function (acc, row) {\n forEach(row, function (c, ix) {\n var n = stringLength(c);\n if (!acc[ix] || n > acc[ix]) acc[ix] = n;\n });\n return acc;\n }, []);\n \n return map(rows, function (row) {\n return map(row, function (c, ix) {\n var n = (sizes[ix] - stringLength(c)) || 0;\n var s = Array(Math.max(n + 1, 1)).join(' ');\n if (align[ix] === 'r' || align[ix] === '.') {\n return s + c;\n }\n if (align[ix] === 'c') {\n return Array(Math.ceil(n / 2 + 1)).join(' ')\n + c + Array(Math.floor(n / 2 + 1)).join(' ')\n ;\n }\n \n return c + s;\n }).join(hsep).replace(/\\s+$/, '');\n }).join('\\n');\n};\n\nfunction dotindex (c) {\n var m = /\\.[^.]*$/.exec(c);\n return m ? m.index + 1 : c.length;\n}\n\nfunction reduce (xs, f, init) {\n if (xs.reduce) return xs.reduce(f, init);\n var i = 0;\n var acc = arguments.length >= 3 ? init : xs[i++];\n for (; i < xs.length; i++) {\n f(acc, xs[i], i);\n }\n return acc;\n}\n\nfunction forEach (xs, f) {\n if (xs.forEach) return xs.forEach(f);\n for (var i = 0; i < xs.length; i++) {\n f.call(xs, xs[i], i);\n }\n}\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f.call(xs, xs[i], i));\n }\n return res;\n}\n", "import * as kleur from \"kleur/colors\";\nimport table, { type Options } from \"text-table\";\nimport { type Result } from \"./result\";\nimport { Severity } from \"./severity\";\n\n/**\n * Given a word and a count, append an s if count is not one.\n * @param word - A word in its singular form.\n * @param count - A number controlling whether word should be pluralized.\n * @returns - The original word with an s on the end if count is not one.\n */\nfunction pluralize(word: string, count: number): string {\n\treturn count === 1 ? word : `${word}s`;\n}\n\n/**\n * Given a line with \" $\\{line\\} $\\{column\\} \" where line is right-aligned and\n * column is left-aligned it replaces the delimiter with a colon.\n */\nfunction centerLineColumn(el: string): string {\n\treturn el.replace(/(\\d+)\\s+(\\d+)/u, (_m, p1: string, p2: string) => kleur.dim(`${p1}:${p2}`));\n}\n\n/**\n * Strip ANSI color escape sequences from text.\n */\nfunction stripAnsi(text: string): string {\n\t/* eslint-disable-next-line no-control-regex -- expected to match control characters */\n\treturn text.replace(/\\u001B\\[[0-9;]*m/g, \"\");\n}\n\n/* eslint-disable-next-line sonarjs/cognitive-complexity -- technical debt */\nexport function stylish(results: Result[]): string {\n\tlet output = \"\\n\";\n\tlet errorCount = 0;\n\tlet warningCount = 0;\n\tlet fixableErrorCount = 0;\n\tlet fixableWarningCount = 0;\n\tlet summaryColor: kleur.Colorize = kleur.yellow;\n\n\tresults.forEach((result) => {\n\t\tconst messages = result.messages;\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\terrorCount += result.errorCount;\n\t\twarningCount += result.warningCount;\n\t\tfixableErrorCount += result.fixableErrorCount;\n\t\tfixableWarningCount += result.fixableWarningCount;\n\n\t\tconst rows = messages.map((message) => {\n\t\t\tlet messageType;\n\n\t\t\tif (message.fatal || message.severity === Severity.ERROR) {\n\t\t\t\tmessageType = kleur.red(\"error\");\n\t\t\t\tsummaryColor = kleur.red;\n\t\t\t} else {\n\t\t\t\tmessageType = kleur.yellow(\"warning\");\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t\"\",\n\t\t\t\tmessage.line || 0,\n\t\t\t\tmessage.column || 0,\n\t\t\t\tmessageType,\n\t\t\t\tmessage.message.replace(/([^ ])\\.$/u, \"$1\"),\n\t\t\t\tmessage.ruleId ? kleur.dim(message.ruleId) : \"\",\n\t\t\t];\n\t\t});\n\n\t\tconst options: Options = {\n\t\t\talign: [\"l\", \"r\", \"l\"],\n\t\t\tstringLength(str: string): number {\n\t\t\t\treturn stripAnsi(str).length;\n\t\t\t},\n\t\t};\n\t\tconst formattedTable = table(rows, options).split(\"\\n\").map(centerLineColumn).join(\"\\n\");\n\n\t\toutput += `${kleur.underline(result.filePath)}\\n`;\n\t\toutput += `${formattedTable}\\n\\n`;\n\t});\n\n\tconst total = errorCount + warningCount;\n\n\tif (total > 0) {\n\t\toutput += summaryColor(\n\t\t\tkleur.bold(\n\t\t\t\t[\n\t\t\t\t\t\"\\u2716 \",\n\t\t\t\t\ttotal,\n\t\t\t\t\tpluralize(\" problem\", total),\n\t\t\t\t\t\" (\",\n\t\t\t\t\terrorCount,\n\t\t\t\t\tpluralize(\" error\", errorCount),\n\t\t\t\t\t\", \",\n\t\t\t\t\twarningCount,\n\t\t\t\t\tpluralize(\" warning\", warningCount),\n\t\t\t\t\t\")\\n\",\n\t\t\t\t].join(\"\")\n\t\t\t)\n\t\t);\n\n\t\tif (fixableErrorCount > 0 || fixableWarningCount > 0) {\n\t\t\toutput += summaryColor(\n\t\t\t\tkleur.bold(\n\t\t\t\t\t[\n\t\t\t\t\t\t\" \",\n\t\t\t\t\t\tfixableErrorCount,\n\t\t\t\t\t\tpluralize(\" error\", fixableErrorCount),\n\t\t\t\t\t\t\" and \",\n\t\t\t\t\t\tfixableWarningCount,\n\t\t\t\t\t\tpluralize(\" warning\", fixableWarningCount),\n\t\t\t\t\t\t\" potentially fixable with the `--fix` option.\\n\",\n\t\t\t\t\t].join(\"\")\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t// Resets output color, for prevent change on top level\n\treturn total > 0 ? kleur.reset(output) : \"\";\n}\n", "export enum Severity {\n\tOFF = 0,\n\tWARN = 1,\n\tERROR = 2,\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,WAAO,UAAU,SAAU,OAAO,MAAM;AACpC,UAAI,CAAC;AAAM,eAAO,CAAC;AACnB,UAAI,OAAO,KAAK,SAAS,SAAY,OAAO,KAAK;AACjD,UAAI,QAAQ,KAAK,SAAS,CAAC;AAC3B,UAAI,eAAe,KAAK,gBACjB,SAAU,GAAG;AAAE,eAAO,OAAO,CAAC,EAAE;AAAA,MAAQ;AAG/C,UAAI,WAAW,OAAO,OAAO,SAAU,KAAK,KAAK;AAC7C,gBAAQ,KAAK,SAAU,GAAG,IAAI;AAC1B,cAAI,IAAI,SAAS,CAAC;AAClB,cAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE;AAAG,gBAAI,EAAE,IAAI;AAAA,QAC3C,CAAC;AACD,eAAO;AAAA,MACX,GAAG,CAAC,CAAC;AAEL,UAAI,OAAO,IAAI,OAAO,SAAU,KAAK;AACjC,eAAO,IAAI,KAAK,SAAU,IAAI,IAAI;AAC9B,cAAI,IAAI,OAAO,EAAE;AACjB,cAAI,MAAM,EAAE,MAAM,KAAK;AACnB,gBAAI,QAAQ,SAAS,CAAC;AACtB,gBAAI,OAAO,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,IAAI,IAAI,MACvC,aAAa,CAAC,IAAI;AAEzB,mBAAO,IAAI,MAAM,IAAI,EAAE,KAAK,GAAG;AAAA,UACnC;AACK,mBAAO;AAAA,QAChB,CAAC;AAAA,MACL,CAAC;AAED,UAAI,QAAQ,OAAO,MAAM,SAAU,KAAK,KAAK;AACzC,gBAAQ,KAAK,S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