@zuplo/cli 6.13.1 → 6.14.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/common/errors/stacktracy.d.ts +31 -0
- package/dist/common/errors/stacktracy.d.ts.map +1 -0
- package/dist/common/errors/stacktracy.js +252 -0
- package/dist/common/errors/stacktracy.js.map +1 -0
- package/dist/common/errors/youch-terminal.d.ts +3 -0
- package/dist/common/errors/youch-terminal.d.ts.map +1 -0
- package/dist/common/errors/youch-terminal.js +156 -0
- package/dist/common/errors/youch-terminal.js.map +1 -0
- package/dist/common/errors/youch.d.ts +20 -0
- package/dist/common/errors/youch.d.ts.map +1 -0
- package/dist/common/errors/youch.js +123 -0
- package/dist/common/errors/youch.js.map +1 -0
- package/dist/common/worker-output.d.ts +23 -0
- package/dist/common/worker-output.d.ts.map +1 -0
- package/dist/common/worker-output.js +180 -0
- package/dist/common/worker-output.js.map +1 -0
- package/dist/common/worker-output.spec.d.ts +2 -0
- package/dist/common/worker-output.spec.d.ts.map +1 -0
- package/dist/common/worker-output.spec.js +64 -0
- package/dist/common/worker-output.spec.js.map +1 -0
- package/dist/compile/handler.d.ts.map +1 -1
- package/dist/compile/handler.js +2 -0
- package/dist/compile/handler.js.map +1 -1
- package/dist/dev/handler.d.ts.map +1 -1
- package/dist/dev/handler.js +13 -2
- package/dist/dev/handler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default StackTracey;
|
|
2
|
+
declare class StackTracey {
|
|
3
|
+
static locationsEqual(a: any, b: any): boolean;
|
|
4
|
+
constructor(input: any, offset: any);
|
|
5
|
+
items: any[];
|
|
6
|
+
extractEntryMetadata(e: any): any;
|
|
7
|
+
shortenPath(relativePath: any): any;
|
|
8
|
+
decomposePath(fullPath: any): any[];
|
|
9
|
+
isThirdParty(relativePath: any, externalDomain: any): any;
|
|
10
|
+
rawParse(str: any): any;
|
|
11
|
+
withSourceAt(i: any): any;
|
|
12
|
+
withSourceAsyncAt(i: any): any;
|
|
13
|
+
withSource(loc: any): any;
|
|
14
|
+
withSourceAsync(loc: any): Promise<any>;
|
|
15
|
+
shouldSkipResolving(loc: any): any;
|
|
16
|
+
withSourceResolved(loc: any, resolved: any): any;
|
|
17
|
+
withSources(): any;
|
|
18
|
+
withSourcesAsync(): Promise<StackTracey>;
|
|
19
|
+
mergeRepeatedLines(): StackTracey;
|
|
20
|
+
clean(): any;
|
|
21
|
+
cleanAsync(): Promise<any>;
|
|
22
|
+
isClean(entry: any, index: any): boolean;
|
|
23
|
+
at(i: any): any;
|
|
24
|
+
asTable(opts: any): string;
|
|
25
|
+
maxColumnWidths(): {
|
|
26
|
+
callee: number;
|
|
27
|
+
file: number;
|
|
28
|
+
sourceLine: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=stacktracy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacktracy.d.ts","sourceRoot":"","sources":["../../../src/common/errors/stacktracy.js"],"names":[],"mappings":";AA6CA;IAoTE,+CAEC;IArTD,qCAkDC;IAJG,aAAkB;IAMtB,kCAaC;IAED,oCAKC;IAED,oCAeC;IAED,0DAQC;IAED,wBAoDC;IAED,0BAEC;IAED,+BAEC;IAED,0BAYC;IAED,wCAWC;IAED,mCAIC;IAED,iDAmBC;IAED,mBAEC;IAED,yCAIC;IAED,kCAmBC;IAED,aAGC;IAED,2BAKC;IAED,yCAEC;IAED,gBAaC;IAED,2BAkBC;IAED;;;;MAMC;CAKF"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
const partition = (arr_, pred) => {
|
|
2
|
+
const arr = arr_ || [], spans = [];
|
|
3
|
+
let span = { label: undefined, items: [arr.first] };
|
|
4
|
+
arr.forEach((x) => {
|
|
5
|
+
const label = pred(x);
|
|
6
|
+
if (span.label !== label && span.items.length) {
|
|
7
|
+
spans.push((span = { label: label, items: [x] }));
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
span.items.push(x);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return spans;
|
|
14
|
+
};
|
|
15
|
+
const O = Object;
|
|
16
|
+
const lastOf = (x) => x[x.length - 1];
|
|
17
|
+
import asTable from "as-table";
|
|
18
|
+
import getSource, { async } from "get-source";
|
|
19
|
+
const nixSlashes = (x) => x.replace(/\\/g, "/");
|
|
20
|
+
const pathRoot = nixSlashes(process.cwd()) + "/";
|
|
21
|
+
class StackTracey {
|
|
22
|
+
constructor(input, offset) {
|
|
23
|
+
const originalInput = input, isParseableSyntaxError = input && input instanceof SyntaxError;
|
|
24
|
+
if (!input) {
|
|
25
|
+
input = new Error();
|
|
26
|
+
offset = offset === undefined ? 1 : offset;
|
|
27
|
+
}
|
|
28
|
+
if (input instanceof Error) {
|
|
29
|
+
input = input.stack || "";
|
|
30
|
+
}
|
|
31
|
+
if (typeof input === "string") {
|
|
32
|
+
input = this.rawParse(input)
|
|
33
|
+
.slice(offset)
|
|
34
|
+
.map((x) => this.extractEntryMetadata(x));
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(input)) {
|
|
37
|
+
if (isParseableSyntaxError) {
|
|
38
|
+
const rawLines = nodeRequire("util").inspect(originalInput).split("\n"), fileLine = rawLines[0].split(":"), line = fileLine.pop(), file = fileLine.join(":");
|
|
39
|
+
if (file) {
|
|
40
|
+
input.unshift({
|
|
41
|
+
file: nixSlashes(file),
|
|
42
|
+
line: line,
|
|
43
|
+
column: (rawLines[2] || "").indexOf("^") + 1,
|
|
44
|
+
sourceLine: rawLines[1],
|
|
45
|
+
callee: "(syntax error)",
|
|
46
|
+
syntaxError: true,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
this.items = input;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.items = [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
extractEntryMetadata(e) {
|
|
57
|
+
const decomposedPath = this.decomposePath(e.file || "");
|
|
58
|
+
const fileRelative = decomposedPath[0];
|
|
59
|
+
const externalDomain = decomposedPath[1];
|
|
60
|
+
return O.assign(e, {
|
|
61
|
+
calleeShort: e.calleeShort || lastOf((e.callee || "").split(".")),
|
|
62
|
+
fileRelative: fileRelative,
|
|
63
|
+
fileShort: this.shortenPath(fileRelative),
|
|
64
|
+
fileName: lastOf((e.file || "").split("/")),
|
|
65
|
+
thirdParty: this.isThirdParty(fileRelative, externalDomain) && !e.index,
|
|
66
|
+
externalDomain: externalDomain,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
shortenPath(relativePath) {
|
|
70
|
+
return relativePath
|
|
71
|
+
.replace(/^node_modules\//, "")
|
|
72
|
+
.replace(/^webpack\/bootstrap\//, "")
|
|
73
|
+
.replace(/^__parcel_source_root\//, "");
|
|
74
|
+
}
|
|
75
|
+
decomposePath(fullPath) {
|
|
76
|
+
let result = fullPath;
|
|
77
|
+
const externalDomainMatch = result.match(/^(http|https)\:\/\/?([^\/]+)\/(.*)/);
|
|
78
|
+
const externalDomain = externalDomainMatch
|
|
79
|
+
? externalDomainMatch[2]
|
|
80
|
+
: undefined;
|
|
81
|
+
result = externalDomainMatch ? externalDomainMatch[3] : result;
|
|
82
|
+
return [
|
|
83
|
+
nixSlashes(result).replace(/^.*\:\/\/?\/?/, ""),
|
|
84
|
+
externalDomain,
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
isThirdParty(relativePath, externalDomain) {
|
|
88
|
+
return (externalDomain ||
|
|
89
|
+
relativePath[0] === "~" ||
|
|
90
|
+
relativePath[0] === "/" ||
|
|
91
|
+
relativePath.indexOf("node_modules") === 0 ||
|
|
92
|
+
relativePath.indexOf("webpack/bootstrap") === 0);
|
|
93
|
+
}
|
|
94
|
+
rawParse(str) {
|
|
95
|
+
const lines = (str || "").split("\n");
|
|
96
|
+
const entries = lines.map((line) => {
|
|
97
|
+
line = line.trim();
|
|
98
|
+
let callee, fileLineColumn = [], native, planA, planB;
|
|
99
|
+
if ((planA = line.match(/at (.+) \(eval at .+ \((.+)\), .+\)/)) ||
|
|
100
|
+
(planA = line.match(/at (.+) \((.+)\)/)) ||
|
|
101
|
+
(line.slice(0, 3) !== "at " && (planA = line.match(/(.*)@(.*)/)))) {
|
|
102
|
+
callee = planA[1];
|
|
103
|
+
native = planA[2] === "native";
|
|
104
|
+
fileLineColumn = (planA[2].match(/(.*):(\d+):(\d+)/) ||
|
|
105
|
+
planA[2].match(/(.*):(\d+)/) ||
|
|
106
|
+
[]).slice(1);
|
|
107
|
+
}
|
|
108
|
+
else if ((planB = line.match(/^(at\s+)*(.+):(\d+):(\d+)/))) {
|
|
109
|
+
fileLineColumn = planB.slice(2);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (callee && !fileLineColumn[0]) {
|
|
115
|
+
const type = callee.split(".")[0];
|
|
116
|
+
if (type === "Array") {
|
|
117
|
+
native = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
beforeParse: line,
|
|
122
|
+
callee: callee || "",
|
|
123
|
+
index: false,
|
|
124
|
+
native: native || false,
|
|
125
|
+
file: nixSlashes(fileLineColumn[0] || ""),
|
|
126
|
+
line: parseInt(fileLineColumn[1] || "", 10) || undefined,
|
|
127
|
+
column: parseInt(fileLineColumn[2] || "", 10) || undefined,
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
return entries.filter((x) => x !== undefined);
|
|
131
|
+
}
|
|
132
|
+
withSourceAt(i) {
|
|
133
|
+
return this.items[i] && this.withSource(this.items[i]);
|
|
134
|
+
}
|
|
135
|
+
withSourceAsyncAt(i) {
|
|
136
|
+
return this.items[i] && this.withSourceAsync(this.items[i]);
|
|
137
|
+
}
|
|
138
|
+
withSource(loc) {
|
|
139
|
+
if (this.shouldSkipResolving(loc)) {
|
|
140
|
+
return loc;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
let resolved = getSource(loc.file || "").resolve(loc);
|
|
144
|
+
if (!resolved.sourceFile) {
|
|
145
|
+
return loc;
|
|
146
|
+
}
|
|
147
|
+
return this.withSourceResolved(loc, resolved);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
withSourceAsync(loc) {
|
|
151
|
+
if (this.shouldSkipResolving(loc)) {
|
|
152
|
+
return Promise.resolve(loc);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return async(loc.file || "")
|
|
156
|
+
.then((x) => x.resolve(loc))
|
|
157
|
+
.then((resolved) => this.withSourceResolved(loc, resolved))
|
|
158
|
+
.catch((e) => this.withSourceResolved(loc, { error: e, sourceLine: "" }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
shouldSkipResolving(loc) {
|
|
162
|
+
return (loc.sourceFile || loc.error || (loc.file && loc.file.indexOf("<") >= 0));
|
|
163
|
+
}
|
|
164
|
+
withSourceResolved(loc, resolved) {
|
|
165
|
+
if (resolved.sourceFile && !resolved.sourceFile.error) {
|
|
166
|
+
resolved.file = nixSlashes(resolved.sourceFile.path);
|
|
167
|
+
resolved = this.extractEntryMetadata(resolved);
|
|
168
|
+
}
|
|
169
|
+
if (resolved.sourceLine.includes("// @hide")) {
|
|
170
|
+
resolved.sourceLine = resolved.sourceLine.replace("// @hide", "");
|
|
171
|
+
resolved.hide = true;
|
|
172
|
+
}
|
|
173
|
+
if (resolved.sourceLine.includes("__webpack_require__") ||
|
|
174
|
+
resolved.sourceLine.includes("/******/ ({")) {
|
|
175
|
+
resolved.thirdParty = true;
|
|
176
|
+
}
|
|
177
|
+
return O.assign({ sourceLine: "" }, loc, resolved);
|
|
178
|
+
}
|
|
179
|
+
withSources() {
|
|
180
|
+
return this.map((x) => this.withSource(x));
|
|
181
|
+
}
|
|
182
|
+
withSourcesAsync() {
|
|
183
|
+
return Promise.all(this.items.map((x) => this.withSourceAsync(x))).then((items) => new StackTracey(items));
|
|
184
|
+
}
|
|
185
|
+
mergeRepeatedLines() {
|
|
186
|
+
return new StackTracey(partition(this.items, (e) => e.file + e.line).map((group) => {
|
|
187
|
+
return group.items.slice(1).reduce((memo, entry) => {
|
|
188
|
+
memo.callee =
|
|
189
|
+
(memo.callee || "<anonymous>") +
|
|
190
|
+
" → " +
|
|
191
|
+
(entry.callee || "<anonymous>");
|
|
192
|
+
memo.calleeShort =
|
|
193
|
+
(memo.calleeShort || "<anonymous>") +
|
|
194
|
+
" → " +
|
|
195
|
+
(entry.calleeShort || "<anonymous>");
|
|
196
|
+
return memo;
|
|
197
|
+
}, O.assign({}, group.items[0]));
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
clean() {
|
|
201
|
+
const s = this.withSources().mergeRepeatedLines();
|
|
202
|
+
return s.filter(s.isClean.bind(s));
|
|
203
|
+
}
|
|
204
|
+
cleanAsync() {
|
|
205
|
+
return this.withSourcesAsync().then((s) => {
|
|
206
|
+
s = s.mergeRepeatedLines();
|
|
207
|
+
return s.filter(s.isClean.bind(s));
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
isClean(entry, index) {
|
|
211
|
+
return index === 0 || !(entry.thirdParty || entry.hide || entry.native);
|
|
212
|
+
}
|
|
213
|
+
at(i) {
|
|
214
|
+
return O.assign({
|
|
215
|
+
beforeParse: "",
|
|
216
|
+
callee: "<???>",
|
|
217
|
+
index: false,
|
|
218
|
+
native: false,
|
|
219
|
+
file: "<???>",
|
|
220
|
+
line: 0,
|
|
221
|
+
column: 0,
|
|
222
|
+
}, this.items[i]);
|
|
223
|
+
}
|
|
224
|
+
asTable(opts) {
|
|
225
|
+
const maxColumnWidths = (opts && opts.maxColumnWidths) || this.maxColumnWidths();
|
|
226
|
+
const trimEnd = (s, n) => s && (s.length > n ? s.slice(0, n - 1) + "…" : s);
|
|
227
|
+
const trimStart = (s, n) => s && (s.length > n ? "…" + s.slice(-(n - 1)) : s);
|
|
228
|
+
const trimmed = this.map((e) => [
|
|
229
|
+
"at " + trimEnd(e.calleeShort, maxColumnWidths.callee),
|
|
230
|
+
trimStart((e.fileShort && e.fileShort + ":" + e.line) || "", maxColumnWidths.file),
|
|
231
|
+
trimEnd((e.sourceLine || "").trim() || "", maxColumnWidths.sourceLine),
|
|
232
|
+
]);
|
|
233
|
+
return asTable(trimmed.items);
|
|
234
|
+
}
|
|
235
|
+
maxColumnWidths() {
|
|
236
|
+
return {
|
|
237
|
+
callee: 30,
|
|
238
|
+
file: 60,
|
|
239
|
+
sourceLine: 80,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
static locationsEqual(a, b) {
|
|
243
|
+
return a.file === b.file && a.line === b.line && a.column === b.column;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
["map", "filter", "slice", "concat"].forEach((method) => {
|
|
247
|
+
StackTracey.prototype[method] = function () {
|
|
248
|
+
return new StackTracey(this.items[method].apply(this.items, arguments));
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
export default StackTracey;
|
|
252
|
+
//# sourceMappingURL=stacktracy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacktracy.js","sourceRoot":"","sources":["../../../src/common/errors/stacktracy.js"],"names":[],"mappings":"AAaA,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;IAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,EACpB,KAAK,GAAG,EAAE,CAAC;IAEb,IAAI,IAAI,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;IAEpD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM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AAC,EAAE,EAAE,CAAC;YAC9B,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC;YACtD,SAAS,CACP,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,EACjD,eAAe,CAAC,IAAI,CACrB;YACD,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,eAAe,CAAC,UAAU,CAAC;SACvE,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,eAAe;QACb,OAAO;YACL,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;SACf,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC;IACzE,CAAC;CACF;AAKD,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;IACtD,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG;QAE9B,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAIH,eAAe,WAAW,CAAC","sourcesContent":["/* eslint-disable */\n/*\n * youch\n *\n * (c) Harminder Virk <virk@adonisjs.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n *\n *\n * Source: https://github.com/xpl/stacktracey\n */\n\nconst partition = (arr_, pred) => {\n const arr = arr_ || [],\n spans = [];\n\n let span = { label: undefined, items: [arr.first] };\n\n arr.forEach((x) => {\n const label = pred(x);\n\n if (span.label !== label && span.items.length) {\n spans.push((span = { label: label, items: [x] }));\n } else {\n span.items.push(x);\n }\n });\n\n return spans;\n};\n\n/* ------------------------------------------------------------------------ */\n\nconst O = Object;\n\nconst // to prevent bundlers from expanding the require call\n lastOf = (x) => x[x.length - 1];\nimport asTable from \"as-table\";\nimport getSource, { async } from \"get-source\";\nconst nixSlashes = (x) => x.replace(/\\\\/g, \"/\");\nconst pathRoot = nixSlashes(process.cwd()) + \"/\";\n\n/* ------------------------------------------------------------------------ */\n\nclass StackTracey {\n constructor(input, offset) {\n const originalInput = input,\n isParseableSyntaxError = input && input instanceof SyntaxError;\n\n /* new StackTracey () */\n\n if (!input) {\n input = new Error();\n offset = offset === undefined ? 1 : offset;\n }\n\n /* new StackTracey (Error) */\n\n if (input instanceof Error) {\n input = input.stack || \"\";\n }\n\n /* new StackTracey (string) */\n\n if (typeof input === \"string\") {\n input = this.rawParse(input)\n .slice(offset)\n .map((x) => this.extractEntryMetadata(x));\n }\n\n /* new StackTracey (array) */\n\n if (Array.isArray(input)) {\n if (isParseableSyntaxError) {\n const rawLines = nodeRequire(\"util\").inspect(originalInput).split(\"\\n\"),\n fileLine = rawLines[0].split(\":\"),\n line = fileLine.pop(),\n file = fileLine.join(\":\");\n\n if (file) {\n input.unshift({\n file: nixSlashes(file),\n line: line,\n column: (rawLines[2] || \"\").indexOf(\"^\") + 1,\n sourceLine: rawLines[1],\n callee: \"(syntax error)\",\n syntaxError: true,\n });\n }\n }\n\n this.items = input;\n } else {\n this.items = [];\n }\n }\n\n extractEntryMetadata(e) {\n const decomposedPath = this.decomposePath(e.file || \"\");\n const fileRelative = decomposedPath[0];\n const externalDomain = decomposedPath[1];\n\n return O.assign(e, {\n calleeShort: e.calleeShort || lastOf((e.callee || \"\").split(\".\")),\n fileRelative: fileRelative,\n fileShort: this.shortenPath(fileRelative),\n fileName: lastOf((e.file || \"\").split(\"/\")),\n thirdParty: this.isThirdParty(fileRelative, externalDomain) && !e.index,\n externalDomain: externalDomain,\n });\n }\n\n shortenPath(relativePath) {\n return relativePath\n .replace(/^node_modules\\//, \"\")\n .replace(/^webpack\\/bootstrap\\//, \"\")\n .replace(/^__parcel_source_root\\//, \"\");\n }\n\n decomposePath(fullPath) {\n let result = fullPath;\n\n const externalDomainMatch = result.match(\n /^(http|https)\\:\\/\\/?([^\\/]+)\\/(.*)/\n );\n const externalDomain = externalDomainMatch\n ? externalDomainMatch[2]\n : undefined;\n result = externalDomainMatch ? externalDomainMatch[3] : result;\n\n return [\n nixSlashes(result).replace(/^.*\\:\\/\\/?\\/?/, \"\"), // cut webpack:/// and webpack:/ things\n externalDomain,\n ];\n }\n\n isThirdParty(relativePath, externalDomain) {\n return (\n externalDomain ||\n relativePath[0] === \"~\" || // webpack-specific heuristic\n relativePath[0] === \"/\" || // external source\n relativePath.indexOf(\"node_modules\") === 0 ||\n relativePath.indexOf(\"webpack/bootstrap\") === 0\n );\n }\n\n rawParse(str) {\n const lines = (str || \"\").split(\"\\n\");\n\n const entries = lines.map((line) => {\n line = line.trim();\n\n let callee,\n fileLineColumn = [],\n native,\n planA,\n planB;\n\n if (\n (planA = line.match(/at (.+) \\(eval at .+ \\((.+)\\), .+\\)/)) || // eval calls\n (planA = line.match(/at (.+) \\((.+)\\)/)) ||\n (line.slice(0, 3) !== \"at \" && (planA = line.match(/(.*)@(.*)/)))\n ) {\n callee = planA[1];\n native = planA[2] === \"native\";\n fileLineColumn = (\n planA[2].match(/(.*):(\\d+):(\\d+)/) ||\n planA[2].match(/(.*):(\\d+)/) ||\n []\n ).slice(1);\n } else if ((planB = line.match(/^(at\\s+)*(.+):(\\d+):(\\d+)/))) {\n fileLineColumn = planB.slice(2);\n } else {\n return undefined;\n }\n\n /* Detect things like Array.reduce\n TODO: detect more built-in types */\n\n if (callee && !fileLineColumn[0]) {\n const type = callee.split(\".\")[0];\n if (type === \"Array\") {\n native = true;\n }\n }\n\n return {\n beforeParse: line,\n callee: callee || \"\",\n index: false,\n native: native || false,\n file: nixSlashes(fileLineColumn[0] || \"\"),\n line: parseInt(fileLineColumn[1] || \"\", 10) || undefined,\n column: parseInt(fileLineColumn[2] || \"\", 10) || undefined,\n };\n });\n\n return entries.filter((x) => x !== undefined);\n }\n\n withSourceAt(i) {\n return this.items[i] && this.withSource(this.items[i]);\n }\n\n withSourceAsyncAt(i) {\n return this.items[i] && this.withSourceAsync(this.items[i]);\n }\n\n withSource(loc) {\n if (this.shouldSkipResolving(loc)) {\n return loc;\n } else {\n let resolved = getSource(loc.file || \"\").resolve(loc);\n\n if (!resolved.sourceFile) {\n return loc;\n }\n\n return this.withSourceResolved(loc, resolved);\n }\n }\n\n withSourceAsync(loc) {\n if (this.shouldSkipResolving(loc)) {\n return Promise.resolve(loc);\n } else {\n return async(loc.file || \"\")\n .then((x) => x.resolve(loc))\n .then((resolved) => this.withSourceResolved(loc, resolved))\n .catch((e) =>\n this.withSourceResolved(loc, { error: e, sourceLine: \"\" })\n );\n }\n }\n\n shouldSkipResolving(loc) {\n return (\n loc.sourceFile || loc.error || (loc.file && loc.file.indexOf(\"<\") >= 0)\n ); // skip things like <anonymous> and stuff that was already fetched\n }\n\n withSourceResolved(loc, resolved) {\n if (resolved.sourceFile && !resolved.sourceFile.error) {\n resolved.file = nixSlashes(resolved.sourceFile.path);\n resolved = this.extractEntryMetadata(resolved);\n }\n\n if (resolved.sourceLine.includes(\"// @hide\")) {\n resolved.sourceLine = resolved.sourceLine.replace(\"// @hide\", \"\");\n resolved.hide = true;\n }\n\n if (\n resolved.sourceLine.includes(\"__webpack_require__\") || // webpack-specific heuristics\n resolved.sourceLine.includes(\"/******/ ({\")\n ) {\n resolved.thirdParty = true;\n }\n\n return O.assign({ sourceLine: \"\" }, loc, resolved);\n }\n\n withSources() {\n return this.map((x) => this.withSource(x));\n }\n\n withSourcesAsync() {\n return Promise.all(this.items.map((x) => this.withSourceAsync(x))).then(\n (items) => new StackTracey(items)\n );\n }\n\n mergeRepeatedLines() {\n return new StackTracey(\n partition(this.items, (e) => e.file + e.line).map((group) => {\n return group.items.slice(1).reduce(\n (memo, entry) => {\n memo.callee =\n (memo.callee || \"<anonymous>\") +\n \" → \" +\n (entry.callee || \"<anonymous>\");\n memo.calleeShort =\n (memo.calleeShort || \"<anonymous>\") +\n \" → \" +\n (entry.calleeShort || \"<anonymous>\");\n return memo;\n },\n O.assign({}, group.items[0])\n );\n })\n );\n }\n\n clean() {\n const s = this.withSources().mergeRepeatedLines();\n return s.filter(s.isClean.bind(s));\n }\n\n cleanAsync() {\n return this.withSourcesAsync().then((s) => {\n s = s.mergeRepeatedLines();\n return s.filter(s.isClean.bind(s));\n });\n }\n\n isClean(entry, index) {\n return index === 0 || !(entry.thirdParty || entry.hide || entry.native);\n }\n\n at(i) {\n return O.assign(\n {\n beforeParse: \"\",\n callee: \"<???>\",\n index: false,\n native: false,\n file: \"<???>\",\n line: 0,\n column: 0,\n },\n this.items[i]\n );\n }\n\n asTable(opts) {\n const maxColumnWidths =\n (opts && opts.maxColumnWidths) || this.maxColumnWidths();\n\n const trimEnd = (s, n) => s && (s.length > n ? s.slice(0, n - 1) + \"…\" : s);\n const trimStart = (s, n) =>\n s && (s.length > n ? \"…\" + s.slice(-(n - 1)) : s);\n\n const trimmed = this.map((e) => [\n \"at \" + trimEnd(e.calleeShort, maxColumnWidths.callee),\n trimStart(\n (e.fileShort && e.fileShort + \":\" + e.line) || \"\",\n maxColumnWidths.file\n ),\n trimEnd((e.sourceLine || \"\").trim() || \"\", maxColumnWidths.sourceLine),\n ]);\n\n return asTable(trimmed.items);\n }\n\n maxColumnWidths() {\n return {\n callee: 30,\n file: 60,\n sourceLine: 80,\n };\n }\n\n static locationsEqual(a, b) {\n return a.file === b.file && a.line === b.line && a.column === b.column;\n }\n}\n\n/* Array methods\n ------------------------------------------------------------------------ */\n\n[\"map\", \"filter\", \"slice\", \"concat\"].forEach((method) => {\n StackTracey.prototype[method] = function (/*...args */) {\n // no support for ...args in Node v4 :(\n return new StackTracey(this.items[method].apply(this.items, arguments));\n };\n});\n\n/* ------------------------------------------------------------------------ */\n\nexport default StackTracey;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youch-terminal.d.ts","sourceRoot":"","sources":["../../../src/common/errors/youch-terminal.js"],"names":[],"mappings":"AA8Se,qCAVH,MAAM,wBA2CjB"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const { platform, cwd } = process;
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { relative } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { inspect } from "node:util";
|
|
6
|
+
import stringWidth from "string-width";
|
|
7
|
+
import wordwrap from "wordwrap";
|
|
8
|
+
const { red, yellow, green, cyan, dim } = chalk;
|
|
9
|
+
const TERMINAL_SIZE = process.stdout.columns;
|
|
10
|
+
const POINTER = platform === "win32" && !process.env.WT_SESSION ? ">" : "❯";
|
|
11
|
+
const DASH = platform === "win32" && !process.env.WT_SESSION ? "⁃" : "⁃";
|
|
12
|
+
const CWD = cwd();
|
|
13
|
+
function getRelativePath(filePath) {
|
|
14
|
+
filePath = filePath.replace("async file:", "file:");
|
|
15
|
+
return relative(CWD, filePath.startsWith("file:") ? fileURLToPath(filePath) : filePath);
|
|
16
|
+
}
|
|
17
|
+
function mainFrame(frames) {
|
|
18
|
+
return frames.find((frame) => frame.isApp) || null;
|
|
19
|
+
}
|
|
20
|
+
function filterNativeFrames(frames, mainFrame) {
|
|
21
|
+
return frames.filter((frame) => {
|
|
22
|
+
return ((frame.isApp || frame.isModule) &&
|
|
23
|
+
(!mainFrame ||
|
|
24
|
+
frame.file !== mainFrame.file ||
|
|
25
|
+
frame.line !== mainFrame.line));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function frameMethod(frame) {
|
|
29
|
+
return frame.callee || "anonymous";
|
|
30
|
+
}
|
|
31
|
+
function whiteSpace(biggestChar, currentChar) {
|
|
32
|
+
let whiteSpace = "";
|
|
33
|
+
const whiteSpaceLength = biggestChar.length - currentChar.length;
|
|
34
|
+
for (let i = 0; i <= whiteSpaceLength; i++) {
|
|
35
|
+
whiteSpace += " ";
|
|
36
|
+
}
|
|
37
|
+
return whiteSpace;
|
|
38
|
+
}
|
|
39
|
+
function codeLine(line, counter, maxCounter, isMain, prefix) {
|
|
40
|
+
const space = whiteSpace(String(maxCounter), String(counter));
|
|
41
|
+
if (isMain) {
|
|
42
|
+
return `${prefix}${red(POINTER)}${space}${red(counter)}${red("|")}${space} ${red(line)}`;
|
|
43
|
+
}
|
|
44
|
+
return `${prefix} ${space}${dim(counter)}${dim("|")}${space} ${dim(line)}`;
|
|
45
|
+
}
|
|
46
|
+
function getMessage(error, prefix, hideErrorTitle) {
|
|
47
|
+
let message;
|
|
48
|
+
const wrapper = wordwrap(stringWidth(prefix) + 2, TERMINAL_SIZE);
|
|
49
|
+
if (!hideErrorTitle) {
|
|
50
|
+
message = `${prefix} ${red(wrapper(`${error.name}: ${error.message}`).trim())}`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
message = `${prefix} ${red(wrapper(`${error.message}`).trim())}`;
|
|
54
|
+
}
|
|
55
|
+
return [message, prefix];
|
|
56
|
+
}
|
|
57
|
+
function getHelpText(error, prefix) {
|
|
58
|
+
let help = error.help;
|
|
59
|
+
if (!help) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
const wrapper = wordwrap(stringWidth(prefix) + 4, TERMINAL_SIZE);
|
|
63
|
+
if (Array.isArray(help)) {
|
|
64
|
+
return help
|
|
65
|
+
.map((line) => {
|
|
66
|
+
return `${prefix} ${cyan(wrapper(`- ${line}`).trim())}`;
|
|
67
|
+
})
|
|
68
|
+
.concat([prefix]);
|
|
69
|
+
}
|
|
70
|
+
return [`${prefix} ${cyan(help)}`, prefix];
|
|
71
|
+
}
|
|
72
|
+
function getShortPath(filePath) {
|
|
73
|
+
const posixCwd = cwd().replace(/\\/g, "/");
|
|
74
|
+
return filePath.replace(`${posixCwd}/`, "");
|
|
75
|
+
}
|
|
76
|
+
function getMainFrameLocation(frame, prefix, displayShortPath) {
|
|
77
|
+
if (!frame) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const filePath = displayShortPath
|
|
81
|
+
? getRelativePath(frame.filePath)
|
|
82
|
+
: frame.filePath;
|
|
83
|
+
return [
|
|
84
|
+
`${prefix} at ${yellow(`${frameMethod(frame)}`)} ${green(filePath)}:${green(frame.line)}`,
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
function getCodeLines(frame, prefix) {
|
|
88
|
+
if (!frame || !frame.context || !frame.context.line) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
let counter = frame.context.start - 1;
|
|
92
|
+
const pre = frame.context.pre.split("\n");
|
|
93
|
+
const post = frame.context.post.split("\n");
|
|
94
|
+
const maxCounter = counter + (pre.length + post.length + 1);
|
|
95
|
+
return []
|
|
96
|
+
.concat(pre.map((line) => {
|
|
97
|
+
counter++;
|
|
98
|
+
return codeLine(line, counter, maxCounter, false, prefix);
|
|
99
|
+
}))
|
|
100
|
+
.concat([frame.context.line].map((line) => {
|
|
101
|
+
counter++;
|
|
102
|
+
return codeLine(line, counter, maxCounter, true, prefix);
|
|
103
|
+
}))
|
|
104
|
+
.concat(post.map((line) => {
|
|
105
|
+
counter++;
|
|
106
|
+
return codeLine(line, counter, maxCounter, false, prefix);
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
function getFramesInfo(frames, prefix, displayShortPath) {
|
|
110
|
+
const totalFrames = String(frames.length);
|
|
111
|
+
const padding = whiteSpace(String(totalFrames.length), "");
|
|
112
|
+
return frames.map((frame) => {
|
|
113
|
+
const filePath = displayShortPath
|
|
114
|
+
? getRelativePath(frame.filePath)
|
|
115
|
+
: frame.filePath;
|
|
116
|
+
return [
|
|
117
|
+
`${prefix}${padding}${yellow(`${DASH} ${frameMethod(frame)}`)}`,
|
|
118
|
+
`${prefix}${padding} ${green(filePath)}${":" + green(frame.line)}`,
|
|
119
|
+
].join("\n");
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function getErrorCause(errorCause, prefix) {
|
|
123
|
+
return [
|
|
124
|
+
"",
|
|
125
|
+
`${prefix} ${cyan("[cause] {")}`,
|
|
126
|
+
inspect(errorCause)
|
|
127
|
+
.split("\n")
|
|
128
|
+
.map((line) => {
|
|
129
|
+
return `${prefix} ${cyan(line)}`;
|
|
130
|
+
})
|
|
131
|
+
.join("\n"),
|
|
132
|
+
`${prefix} ${cyan("}")}`,
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
export default ({ error }, options) => {
|
|
136
|
+
const firstFrame = mainFrame(error.frames);
|
|
137
|
+
options = { prefix: " ", framesMaxLimit: 3, ...options };
|
|
138
|
+
const otherFrames = options.displayMainFrameOnly && firstFrame
|
|
139
|
+
? []
|
|
140
|
+
: getFramesInfo(filterNativeFrames(error.frames, firstFrame), options.prefix, options.displayShortPath);
|
|
141
|
+
return [""]
|
|
142
|
+
.concat(options.hideMessage
|
|
143
|
+
? []
|
|
144
|
+
: getMessage(error, options.prefix, options.hideErrorTitle))
|
|
145
|
+
.concat(getHelpText(error, options.prefix))
|
|
146
|
+
.concat(getMainFrameLocation(firstFrame, options.prefix, options.displayShortPath))
|
|
147
|
+
.concat(getCodeLines(firstFrame, options.prefix))
|
|
148
|
+
.concat(error.cause ? getErrorCause(error.cause, options.prefix) : [])
|
|
149
|
+
.concat(otherFrames.length ? [""] : [])
|
|
150
|
+
.concat(Number.isFinite(options.framesMaxLimit)
|
|
151
|
+
? otherFrames.slice(0, options.framesMaxLimit)
|
|
152
|
+
: otherFrames)
|
|
153
|
+
.concat([""])
|
|
154
|
+
.join("\n");
|
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CAAC,MAAM,EAAE,UAAU,CAAC,EAC5C,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,gBAAgB,CACzB,CAAC;IAER,OAAO,CAAC,EAAE,CAAC;SACR,MAAM,CACL,OAAO,CAAC,WAAW;QACjB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAC9D;SACA,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;SAC1C,MAAM,CACL,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAC3E;SACA,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;SAChD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACtC,MAAM,CACL,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC;QACrC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;QAC9C,CAAC,CAAC,WAAW,CAChB;SACA,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;SACZ,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/* eslint-disable */\n/**\n * youch-terminal\n *\n * (c) Harminder Virk <virk@adonisjs.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nconst { platform, cwd } = process;\nimport chalk from \"chalk\";\nimport { relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { inspect } from \"node:util\";\nimport stringWidth from \"string-width\";\nimport wordwrap from \"wordwrap\";\n\nconst { red, yellow, green, cyan, dim } = chalk;\n\nconst TERMINAL_SIZE = process.stdout.columns;\nconst POINTER = platform === \"win32\" && !process.env.WT_SESSION ? \">\" : \"❯\";\nconst DASH = platform === \"win32\" && !process.env.WT_SESSION ? \"⁃\" : \"⁃\";\nconst CWD = cwd();\n\nfunction getRelativePath(filePath) {\n /**\n * Node.js error stack is all messed up. Some lines have file info\n * enclosed in parenthesis and some are not\n */\n filePath = filePath.replace(\"async file:\", \"file:\");\n return relative(\n CWD,\n filePath.startsWith(\"file:\") ? fileURLToPath(filePath) : filePath\n );\n}\n\n/**\n * Pulls the main frame from the frames stack\n *\n * @method mainFrame\n *\n * @param {Array} frames\n *\n * @return {Object|Null}\n */\nfunction mainFrame(frames) {\n return frames.find((frame) => frame.isApp) || null;\n}\n\n/**\n * Filter only relevant frames that are supposed to\n * be printed on the screen\n *\n * @method filterNativeFrames\n *\n * @param {Array} frames\n * @param {Object} mainFrame\n *\n * @return {void}\n */\nfunction filterNativeFrames(frames, mainFrame) {\n return frames.filter((frame) => {\n return (\n (frame.isApp || frame.isModule) &&\n (!mainFrame ||\n frame.file !== mainFrame.file ||\n frame.line !== mainFrame.line)\n );\n });\n}\n\n/**\n * Returns the method name for a given frame\n *\n * @method frameMethod\n *\n * @param {Object} frame\n *\n * @return {String}\n */\nfunction frameMethod(frame) {\n return frame.callee || \"anonymous\";\n}\n\n/**\n * Returns the white space for a given char based\n * upon the biggest char.\n *\n * This is done to keep rows symmetrical.\n *\n * @method whiteSpace\n *\n * @param {String} biggestChar\n * @param {String} currentChar\n *\n * @return {String}\n */\nfunction whiteSpace(biggestChar, currentChar) {\n let whiteSpace = \"\";\n const whiteSpaceLength = biggestChar.length - currentChar.length;\n\n for (let i = 0; i <= whiteSpaceLength; i++) {\n whiteSpace += \" \";\n }\n\n return whiteSpace;\n}\n\n/**\n * Returns the line of code with the line number\n *\n * @method codeLine\n *\n * @param {String} line\n * @param {Number} counter\n * @param {Number} maxCounter\n * @param {Boolean} isMain\n *\n * @return {String}\n */\nfunction codeLine(line, counter, maxCounter, isMain, prefix) {\n const space = whiteSpace(String(maxCounter), String(counter));\n\n if (isMain) {\n return `${prefix}${red(POINTER)}${space}${red(counter)}${red(\"|\")}${space} ${red(line)}`;\n }\n return `${prefix} ${space}${dim(counter)}${dim(\"|\")}${space} ${dim(line)}`;\n}\n\n/**\n * Returns the error message\n */\nfunction getMessage(error, prefix, hideErrorTitle) {\n let message;\n\n const wrapper = wordwrap(stringWidth(prefix) + 2, TERMINAL_SIZE);\n\n if (!hideErrorTitle) {\n message = `${prefix} ${red(wrapper(`${error.name}: ${error.message}`).trim())}`;\n } else {\n message = `${prefix} ${red(wrapper(`${error.message}`).trim())}`;\n }\n\n return [message, prefix];\n}\n\n/**\n * Returns the error help text\n */\nfunction getHelpText(error, prefix) {\n let help = error.help;\n if (!help) {\n return [];\n }\n\n const wrapper = wordwrap(stringWidth(prefix) + 4, TERMINAL_SIZE);\n\n if (Array.isArray(help)) {\n return help\n .map((line) => {\n return `${prefix} ${cyan(wrapper(`- ${line}`).trim())}`;\n })\n .concat([prefix]);\n }\n\n return [`${prefix} ${cyan(help)}`, prefix];\n}\n\n/**\n * Get the relative path for a given file path, from the current working directory\n *\n * @param {String} filePath\n *\n * @return {String}\n */\nfunction getShortPath(filePath) {\n const posixCwd = cwd().replace(/\\\\/g, \"/\");\n return filePath.replace(`${posixCwd}/`, \"\");\n}\n\n/**\n * Returns the main frame location with line number\n *\n * @method getMainFrameLocation\n *\n * @param {Object} frame\n *\n * @return {Array}\n */\nfunction getMainFrameLocation(frame, prefix, displayShortPath) {\n if (!frame) {\n return [];\n }\n\n const filePath = displayShortPath\n ? getRelativePath(frame.filePath)\n : frame.filePath;\n return [\n `${prefix} at ${yellow(`${frameMethod(frame)}`)} ${green(filePath)}:${green(frame.line)}`,\n ];\n}\n\n/**\n * Returns the main frame code lines\n *\n * @method getCodeLines\n *\n * @param {Object} frame\n *\n * @return {Array}\n */\nfunction getCodeLines(frame, prefix) {\n if (!frame || !frame.context || !frame.context.line) {\n return [];\n }\n\n let counter = frame.context.start - 1;\n\n const pre = frame.context.pre.split(\"\\n\");\n const post = frame.context.post.split(\"\\n\");\n const maxCounter = counter + (pre.length + post.length + 1);\n\n return []\n .concat(\n pre.map((line) => {\n counter++;\n return codeLine(line, counter, maxCounter, false, prefix);\n })\n )\n .concat(\n [frame.context.line].map((line) => {\n counter++;\n return codeLine(line, counter, maxCounter, true, prefix);\n })\n )\n .concat(\n post.map((line) => {\n counter++;\n return codeLine(line, counter, maxCounter, false, prefix);\n })\n );\n}\n\n/**\n * Returns info for all other secondary frames\n *\n * @method getFramesInfo\n *\n * @param {Array} frames\n *\n * @return {Array}\n */\nfunction getFramesInfo(frames, prefix, displayShortPath) {\n const totalFrames = String(frames.length);\n const padding = whiteSpace(String(totalFrames.length), \"\");\n\n return frames.map((frame) => {\n const filePath = displayShortPath\n ? getRelativePath(frame.filePath)\n : frame.filePath;\n\n return [\n `${prefix}${padding}${yellow(`${DASH} ${frameMethod(frame)}`)}`,\n `${prefix}${padding} ${green(filePath)}${\":\" + green(frame.line)}`,\n ].join(\"\\n\");\n });\n}\n\nfunction getErrorCause(errorCause, prefix) {\n return [\n \"\",\n `${prefix} ${cyan(\"[cause] {\")}`,\n inspect(errorCause)\n .split(\"\\n\")\n .map((line) => {\n return `${prefix} ${cyan(line)}`;\n })\n .join(\"\\n\"),\n `${prefix} ${cyan(\"}\")}`,\n ];\n}\n\n/**\n * Returns a multi-line string all ready to be printed\n * on console.\n *\n * Everything will break if error is not the output of\n * youch.toJSON()\n *\n * @method\n *\n * @param {Object} json.error\n * @param {String} options.prefix\n * @param {Number} options.framesMaxLimit\n * @param {Boolean} options.displayShortPath\n * @param {Boolean} options.hideErrorTitle\n * @param {Boolean} options.hideMessage\n * @param {Boolean} options.displayMainFrameOnly\n *\n * @return {String}\n */\nexport default ({ error }, options) => {\n const firstFrame = mainFrame(error.frames);\n options = { prefix: \" \", framesMaxLimit: 3, ...options };\n\n const otherFrames =\n options.displayMainFrameOnly && firstFrame\n ? []\n : getFramesInfo(\n filterNativeFrames(error.frames, firstFrame),\n options.prefix,\n options.displayShortPath\n );\n\n return [\"\"]\n .concat(\n options.hideMessage\n ? []\n : getMessage(error, options.prefix, options.hideErrorTitle)\n )\n .concat(getHelpText(error, options.prefix))\n .concat(\n getMainFrameLocation(firstFrame, options.prefix, options.displayShortPath)\n )\n .concat(getCodeLines(firstFrame, options.prefix))\n .concat(error.cause ? getErrorCause(error.cause, options.prefix) : [])\n .concat(otherFrames.length ? [\"\"] : [])\n .concat(\n Number.isFinite(options.framesMaxLimit)\n ? otherFrames.slice(0, options.framesMaxLimit)\n : otherFrames\n )\n .concat([\"\"])\n .join(\"\\n\");\n};\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default Youch;
|
|
2
|
+
declare class Youch {
|
|
3
|
+
constructor(error: any, request: any, options?: {});
|
|
4
|
+
options: {};
|
|
5
|
+
_filterHeaders: string[];
|
|
6
|
+
error: any;
|
|
7
|
+
request: any;
|
|
8
|
+
links: any[];
|
|
9
|
+
showAllFrames: boolean;
|
|
10
|
+
_getFrameSource(frame: Object): Promise<any>;
|
|
11
|
+
_parseError(): Object;
|
|
12
|
+
_getContext(frame: any): Object;
|
|
13
|
+
_serializeFrame(frame: any): Object;
|
|
14
|
+
_isNode(frame: any): boolean;
|
|
15
|
+
_isApp(frame: any): boolean;
|
|
16
|
+
private _isNodeModule;
|
|
17
|
+
_serializeData(stack: any, callback?: Function | undefined): Object;
|
|
18
|
+
toJSON(): Promise<any>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=youch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youch.d.ts","sourceRoot":"","sources":["../../../src/common/errors/youch.js"],"names":[],"mappings":";AAgBA;IACE,oDAUC;IATC,YAAsB;IAItB,yBAA8C;IAC9C,WAAkB;IAClB,aAAsB;IACtB,aAAe;IACf,uBAA0B;IAU5B,uBAHY,MAAM,gBAqCjB;IAQD,eAFY,MAAM,CAoBjB;IASD,yBAFY,MAAM,CAajB;IASD,6BAFY,MAAM,CAiBjB;IAQD,6BAYC;IAQD,4BAEC;IAcD,sBAEC;IAYD,6DAFY,MAAM,CAejB;IAOD,uBAUC;CACF"}
|