@zuplo/cli 6.17.17 → 6.17.19
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/build/handler.d.ts +0 -1
- package/dist/build/handler.d.ts.map +1 -1
- package/dist/build/handler.js +0 -2
- package/dist/build/handler.js.map +1 -1
- package/dist/cmds/build.d.ts.map +1 -1
- package/dist/cmds/build.js +1 -6
- package/dist/cmds/build.js.map +1 -1
- package/dist/common/worker-output.d.ts +1 -19
- package/dist/common/worker-output.d.ts.map +1 -1
- package/dist/common/worker-output.js +9 -97
- package/dist/common/worker-output.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -7
- package/dist/common/errors/stacktracy.d.ts +0 -30
- package/dist/common/errors/stacktracy.d.ts.map +0 -1
- package/dist/common/errors/stacktracy.js +0 -251
- package/dist/common/errors/stacktracy.js.map +0 -1
- package/dist/common/errors/youch-terminal.d.ts +0 -3
- package/dist/common/errors/youch-terminal.d.ts.map +0 -1
- package/dist/common/errors/youch-terminal.js +0 -156
- package/dist/common/errors/youch-terminal.js.map +0 -1
- package/dist/common/errors/youch.d.ts +0 -20
- package/dist/common/errors/youch.d.ts.map +0 -1
- package/dist/common/errors/youch.js +0 -123
- package/dist/common/errors/youch.js.map +0 -1
- package/dist/common/worker-output.spec.d.ts +0 -2
- package/dist/common/worker-output.spec.d.ts.map +0 -1
- package/dist/common/worker-output.spec.js +0 -64
- package/dist/common/worker-output.spec.js.map +0 -1
package/dist/build/handler.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/build/handler.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/build/handler.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,KAAK,CAAC,IAAI,EAAE,SAAS,iBAwB1C"}
|
package/dist/build/handler.js
CHANGED
|
@@ -5,7 +5,6 @@ import { logger } from "../common/logger.js";
|
|
|
5
5
|
import { printDiagnosticsToConsole } from "../common/output.js";
|
|
6
6
|
export async function build(argv) {
|
|
7
7
|
const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));
|
|
8
|
-
const generateSourceMaps = argv.generateSourceMaps ?? false;
|
|
9
8
|
const customDomain = argv.customDomain ?? undefined;
|
|
10
9
|
const buildId = randomUUID();
|
|
11
10
|
try {
|
|
@@ -14,7 +13,6 @@ export async function build(argv) {
|
|
|
14
13
|
output: console,
|
|
15
14
|
sourceDirectory,
|
|
16
15
|
command: "build",
|
|
17
|
-
generateSourceMaps,
|
|
18
16
|
logger,
|
|
19
17
|
customDomain,
|
|
20
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/build/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/build/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAOhE,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAe;IACzC,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEzE,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC;IAEpD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC;YAC5B,OAAO;YACP,MAAM,EAAE,OAAO;YACf,eAAe;YACf,OAAO,EAAE,OAAO;YAChB,MAAM;YACN,YAAY;SACb,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,yBAAyB,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable node/no-process-env */\nimport { build as runBuild } from \"@zuplo/core/cli\";\nimport { randomUUID } from \"node:crypto\";\nimport { join, relative, resolve } from \"node:path\";\nimport { logger } from \"../common/logger.js\";\nimport { printDiagnosticsToConsole } from \"../common/output.js\";\n\nexport interface Arguments {\n dir: string;\n customDomain?: string;\n}\n\nexport async function build(argv: Arguments) {\n const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));\n\n const customDomain = argv.customDomain ?? undefined;\n\n const buildId = randomUUID();\n\n try {\n const result = await runBuild({\n buildId,\n output: console,\n sourceDirectory,\n command: \"build\",\n logger,\n customDomain,\n });\n if (result.status === \"Failed\") {\n process.exit(1);\n } else {\n process.exit();\n }\n } catch (err) {\n printDiagnosticsToConsole(`Build error occurred: ${err.message}`);\n }\n}\n"]}
|
package/dist/cmds/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cmds/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cmds/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAaV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAqBf,OAAO;;AA1B/B,wBA8BE"}
|
package/dist/cmds/build.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { build } from "../build/handler.js";
|
|
1
2
|
import { captureEvent } from "../common/analytics/lib.js";
|
|
2
3
|
import { identify } from "../common/middleware/user-identification.js";
|
|
3
4
|
import setBlocking from "../common/output.js";
|
|
4
5
|
import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
|
|
5
6
|
import { YargsChecker } from "../common/validators/lib.js";
|
|
6
|
-
import { build } from "../build/handler.js";
|
|
7
7
|
export default {
|
|
8
8
|
desc: false,
|
|
9
9
|
command: "build",
|
|
@@ -15,11 +15,6 @@ export default {
|
|
|
15
15
|
default: ".",
|
|
16
16
|
normalize: true,
|
|
17
17
|
hidden: true,
|
|
18
|
-
})
|
|
19
|
-
.option("generateSourceMaps", {
|
|
20
|
-
type: "boolean",
|
|
21
|
-
describe: "Should source maps be generated for the zup ?",
|
|
22
|
-
default: false,
|
|
23
18
|
})
|
|
24
19
|
.option("customDomain", {
|
|
25
20
|
type: "string",
|
package/dist/cmds/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/cmds/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/cmds/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAe;IAEb,IAAI,EAAE,KAAK;IAEX,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,mCAAmC;YAC7C,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,cAAc,EAAE;YACtB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,mCAAmC;YAC7C,OAAO,EAAE,SAAS;SACnB,CAAC;aACD,UAAU,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACnC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,MAAM,IAAI,YAAY,CAC3B,IAAI,qBAAqB,EAAE,CAC5B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC,IAAiB,CAAC,CAAC;IACjC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { Arguments, build } from \"../build/handler.js\";\nimport { captureEvent } from \"../common/analytics/lib.js\";\nimport { identify } from \"../common/middleware/user-identification.js\";\nimport setBlocking from \"../common/output.js\";\nimport { ZuploProjectValidator } from \"../common/validators/file-system-validator.js\";\nimport { YargsChecker } from \"../common/validators/lib.js\";\n\nexport default {\n // For now, hide this command\n desc: false,\n // desc: \"Compiles/builds a self-contained zup\",\n command: \"build\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your zup\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"customDomain\", {\n type: \"string\",\n describe: \"The custom domain for the project\",\n default: undefined,\n })\n .middleware([setBlocking, identify])\n .check(async (argv) => {\n return await new YargsChecker<typeof argv>(\n new ZuploProjectValidator()\n ).check(argv);\n });\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zup build\" });\n await build(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
+
import { LogLevel } from "@zuplo/core/cli";
|
|
1
2
|
import { Readable } from "node:stream";
|
|
2
|
-
type LogLevel = "error" | "warn" | "info" | "debug";
|
|
3
|
-
export interface ConsoleLogEntry {
|
|
4
|
-
logId: string;
|
|
5
|
-
logOwner: string;
|
|
6
|
-
logSource: string;
|
|
7
|
-
level: LogLevel;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
loggingId: string;
|
|
10
|
-
buildId: string;
|
|
11
|
-
rayId: string | null;
|
|
12
|
-
messages: string[];
|
|
13
|
-
requestId: string;
|
|
14
|
-
vectorClock: number;
|
|
15
|
-
url: string;
|
|
16
|
-
route: string;
|
|
17
|
-
method: string;
|
|
18
|
-
}
|
|
19
3
|
export declare function handleRuntimeStdio(stdout: Readable, stderr: Readable): void;
|
|
20
4
|
export declare function logConsole(level: LogLevel, data: string, callDepth?: number): void;
|
|
21
5
|
export declare function logConsoleAsync(level: LogLevel, data: string, callDepth?: number): Promise<void>;
|
|
22
|
-
export declare function logStructured(logEntry: ConsoleLogEntry, message: string): Promise<void>;
|
|
23
|
-
export {};
|
|
24
6
|
//# sourceMappingURL=worker-output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.d.ts","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"worker-output.d.ts","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiC,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,QAkIpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,SAAI,QAEtE;AAKD,wBAAsB,eAAe,CACnC,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,MAAM,EACZ,SAAS,SAAI,iBAwDd"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import forTerminal from "./errors/youch-terminal.js";
|
|
4
|
-
import Youch from "./errors/youch.js";
|
|
1
|
+
import { LogFormatter } from "@zuplo/core/cli";
|
|
2
|
+
const logFormatter = new LogFormatter();
|
|
5
3
|
export function handleRuntimeStdio(stdout, stderr) {
|
|
6
4
|
const classifiers = {
|
|
7
5
|
isBarf(chunk) {
|
|
@@ -102,106 +100,20 @@ export async function logConsoleAsync(level, data, callDepth = 0) {
|
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
|
-
await Promise.all(logEntry.messages.map((msg) =>
|
|
103
|
+
await Promise.all(logEntry.messages.map(async (msg) => {
|
|
104
|
+
const line = await logFormatter.formatStructured(logEntry, msg);
|
|
105
|
+
console[level](line);
|
|
106
|
+
}));
|
|
106
107
|
}
|
|
107
108
|
else {
|
|
108
|
-
message = await formatMessage(message);
|
|
109
|
-
const line =
|
|
109
|
+
message = await logFormatter.formatMessage(message);
|
|
110
|
+
const line = logFormatter.formatLine(level, message);
|
|
110
111
|
console[level](line);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
catch (err) {
|
|
114
|
-
const line =
|
|
115
|
+
const line = logFormatter.formatLine(level, data);
|
|
115
116
|
console[level](line);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
export async function logStructured(logEntry, message) {
|
|
119
|
-
if (typeof message === "object" &&
|
|
120
|
-
message &&
|
|
121
|
-
Object.keys(message).length === 0) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const { level, route, method, timestamp } = logEntry;
|
|
125
|
-
const routeStr = route.endsWith("{/}?") ? route.slice(0, -4) : route;
|
|
126
|
-
const msg = await formatMessage(message);
|
|
127
|
-
const line = `${getTimestamp(timestamp)} ${levelFormats[level]} [${methodFormats[method.toUpperCase()]} ${chalk.blue(routeStr)}] ${msg}`;
|
|
128
|
-
console[level](line);
|
|
129
|
-
}
|
|
130
|
-
const methodFormats = {
|
|
131
|
-
GET: chalk.green(chalk.bold("GET")),
|
|
132
|
-
POST: chalk.blue(chalk.bold("POST")),
|
|
133
|
-
PUT: chalk.yellow(chalk.bold("PUT")),
|
|
134
|
-
DELETE: chalk.red(chalk.bold("DELETE")),
|
|
135
|
-
PATCH: chalk.magenta(chalk.bold("PATCH")),
|
|
136
|
-
HEAD: chalk.cyan(chalk.bold("HEAD")),
|
|
137
|
-
OPTIONS: chalk.gray(chalk.bold("OPTIONS")),
|
|
138
|
-
};
|
|
139
|
-
const levelFormats = {
|
|
140
|
-
error: chalk.red(chalk.bold("ERROR".padEnd(5))),
|
|
141
|
-
warn: chalk.yellow(chalk.bold("WARN".padEnd(5))),
|
|
142
|
-
info: chalk.blue(chalk.bold("INFO".padEnd(5))),
|
|
143
|
-
debug: chalk.gray(chalk.bold("DEBUG".padEnd(5))),
|
|
144
|
-
};
|
|
145
|
-
let timeFormatter;
|
|
146
|
-
function getTimeFormatter() {
|
|
147
|
-
timeFormatter ??= new Intl.DateTimeFormat(undefined, {
|
|
148
|
-
hour: "2-digit",
|
|
149
|
-
minute: "2-digit",
|
|
150
|
-
second: "2-digit",
|
|
151
|
-
hour12: false,
|
|
152
|
-
fractionalSecondDigits: 3,
|
|
153
|
-
});
|
|
154
|
-
return timeFormatter;
|
|
155
|
-
}
|
|
156
|
-
function getTimestamp(timestamp) {
|
|
157
|
-
return chalk.white(chalk.dim(`[${getTimeFormatter().format(timestamp ? new Date(timestamp) : new Date())}]`));
|
|
158
|
-
}
|
|
159
|
-
async function formatMessage(message) {
|
|
160
|
-
const trimmed = message.trim();
|
|
161
|
-
if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
|
|
162
|
-
try {
|
|
163
|
-
const data = JSON.parse(trimmed);
|
|
164
|
-
if ("stack" in data && isJavaScriptStackTrace(data.stack)) {
|
|
165
|
-
const { stack, message, name, ...err } = data;
|
|
166
|
-
const formatted = await formatError(stack);
|
|
167
|
-
let line;
|
|
168
|
-
if (name && message) {
|
|
169
|
-
line = `${name}: ${message}`;
|
|
170
|
-
}
|
|
171
|
-
else if (message) {
|
|
172
|
-
line = `Error: ${message}`;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
line = "An error occurred";
|
|
176
|
-
}
|
|
177
|
-
if (Object.keys(err).length > 0) {
|
|
178
|
-
line += "\n";
|
|
179
|
-
line += JSON.stringify(err);
|
|
180
|
-
}
|
|
181
|
-
return `${line}\n${formatted}`;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return message;
|
|
188
|
-
}
|
|
189
|
-
async function formatError(error) {
|
|
190
|
-
const stack = await new StackTracey(error).cleanAsync();
|
|
191
|
-
const jsonResponse = await new Youch(stack, {}).toJSON();
|
|
192
|
-
const options = {
|
|
193
|
-
displayShortPath: false,
|
|
194
|
-
fileShort: true,
|
|
195
|
-
prefix: " ",
|
|
196
|
-
hideErrorTitle: false,
|
|
197
|
-
hideMessage: true,
|
|
198
|
-
displayMainFrameOnly: true,
|
|
199
|
-
framesMaxLimit: 3,
|
|
200
|
-
};
|
|
201
|
-
return forTerminal(jsonResponse, options);
|
|
202
|
-
}
|
|
203
|
-
function isJavaScriptStackTrace(str) {
|
|
204
|
-
const stackTraceRegex = /at\s+(.*?)\s+\((.*?):(\d+):(\d+)\)|at\s+(.*?):(\d+):(\d+)/;
|
|
205
|
-
return stackTraceRegex.test(str);
|
|
206
|
-
}
|
|
207
119
|
//# sourceMappingURL=worker-output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.js","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,MAAM,mBAAmB,CAAC;AAwBtC,MAAM,UAAU,kBAAkB,CAAC,MAAgB,EAAE,MAAgB;IAKnE,MAAM,WAAW,GAAG;QAElB,MAAM,CAAC,KAAa;YAClB,MAAM,6BAA6B,GAAG,KAAK,CAAC,QAAQ,CAClD,kEAAkE,CACnE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EAAE,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,IAAI,GAAG,mBAAmB,CAAC;gBAC7B,CAAC;gBAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChC,IAAI,IAAI,IAAI,CAAC;oBACb,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC;gBAED,OAAO,GAAG,IAAI,KAAK,SAAS,EAAE,CAAC;YACjC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;QAEf,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,KAAqB;IAC9C,MAAM,KAAK,GAAG,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC;IAExD,MAAM,YAAY,GAAG,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAEzD,MAAM,OAAO,GAAG;QAEd,gBAAgB,EAAE,KAAK;QAEvB,SAAS,EAAE,IAAI;QAGf,MAAM,EAAE,GAAG;QAGX,cAAc,EAAE,KAAK;QAGrB,WAAW,EAAE,IAAI;QAGjB,oBAAoB,EAAE,IAAI;QAG1B,cAAc,EAAE,CAAC;KAClB,CAAC;IAEF,OAAO,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW;IACzC,MAAM,eAAe,GACnB,2DAA2D,CAAC;IAC9D,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport chalk from \"chalk\";\nimport { Readable } from \"node:stream\";\nimport StackTracey from \"./errors/stacktracy.js\";\nimport forTerminal from \"./errors/youch-terminal.js\";\nimport Youch from \"./errors/youch.js\";\n\ntype LogLevel = \"error\" | \"warn\" | \"info\" | \"debug\";\n\n/**\n * This is the structure of the runtime console log transport log entry\n */\nexport interface ConsoleLogEntry {\n logId: string;\n logOwner: string;\n logSource: string;\n level: LogLevel;\n timestamp: string;\n loggingId: string;\n buildId: string;\n rayId: string | null;\n messages: string[];\n requestId: string;\n vectorClock: number;\n url: string;\n route: string;\n method: string;\n}\n\nexport function handleRuntimeStdio(stdout: Readable, stderr: Readable) {\n // ASSUMPTION: each chunk is a whole message from workerd\n // This may not hold across OSes/architectures, but it seems to work on macOS M-line\n // I'm going with this simple approach to avoid complicating this too early\n // We can iterate on this heuristic in the future if it causes issues\n const classifiers = {\n // Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?\n isBarf(chunk: string) {\n const containsLlvmSymbolizerWarning = chunk.includes(\n \"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set\"\n );\n const containsRecursiveIsolateLockWarning = chunk.includes(\n \"took recursive isolate lock\"\n );\n // Matches stack traces from workerd\n // - on unix: groups of 9 hex digits separated by spaces\n // - on windows: groups of 12 hex digits, or a single digit 0, separated by spaces\n const containsHexStack = /stack:( (0|[a-f\\d]{4,})){3,}/.test(chunk);\n\n return (\n containsLlvmSymbolizerWarning ||\n containsRecursiveIsolateLockWarning ||\n containsHexStack\n );\n },\n // Is this chunk an Address In Use error?\n isAddressInUse(chunk: string) {\n return chunk.includes(\"Address already in use; toString() = \");\n },\n isWarning(chunk: string) {\n return /\\.c\\+\\+:\\d+: warning:/.test(chunk);\n },\n isCodeMovedWarning(chunk: string) {\n return /CODE_MOVED for unknown code block/.test(chunk);\n },\n isAccessViolation(chunk: string) {\n return chunk.includes(\"access violation;\");\n },\n };\n\n stdout.on(\"data\", (chunk: Buffer | string) => {\n chunk = chunk.toString().trim();\n\n if (classifiers.isBarf(chunk)) {\n // this is a big chonky barf from workerd that we want to hijack to cleanup/ignore\n\n // CLEANABLE:\n // there are no known cases to cleanup yet\n // but, as they are identified, we will do that here\n\n // IGNORABLE:\n // anything else not handled above is considered ignorable\n // so send it to the debug logs which are discarded unless\n // the user explicitly sets a logLevel indicating they care\n logConsole(\"debug\", chunk);\n }\n\n // known case: warnings are not info, log them as such\n else if (classifiers.isWarning(chunk)) {\n logConsole(\"warn\", chunk);\n }\n\n // anything not explicitly handled above should be logged as info (via stdout)\n else {\n logConsole(\"error\", chunk);\n }\n });\n\n stderr.on(\"data\", (chunk: Buffer | string) => {\n chunk = chunk.toString().trim();\n\n if (classifiers.isBarf(chunk)) {\n // this is a big chonky barf from workerd that we want to hijack to cleanup/ignore\n\n // CLEANABLE:\n // known case to cleanup: Address in use errors\n if (classifiers.isAddressInUse(chunk)) {\n const address = chunk.match(\n /Address already in use; toString\\(\\) = (.+)\\n/\n )?.[1];\n\n logConsole(\n \"error\",\n `Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`\n );\n\n // Log the original error to the debug logs.\n logConsole(\"debug\", chunk);\n }\n // In the past we have seen Access Violation errors on Windows, which may be caused by an outdated\n // version of the Windows OS or the Microsoft Visual C++ Redistributable.\n // See https://github.com/cloudflare/workers-sdk/issues/6170#issuecomment-2245209918\n else if (classifiers.isAccessViolation(chunk)) {\n let error = \"There was an access violation in the runtime.\";\n if (process.platform === \"win32\") {\n error +=\n \"\\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\\n\" +\n \"Check that you have the latest version installed.\\n\" +\n \"See https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.\";\n }\n logConsole(\"error\", error);\n\n // Log the original error to the debug logs.\n logConsole(\"debug\", chunk);\n }\n\n // IGNORABLE:\n // anything else not handled above is considered ignorable\n // so send it to the debug logs which are discarded unless\n // the user explicitly sets a logLevel indicating they care\n else {\n logConsole(\"debug\", chunk);\n }\n }\n\n // known case: warnings are not errors, log them as such\n else if (classifiers.isWarning(chunk)) {\n logConsole(\"warn\", chunk);\n }\n\n // known case: \"error: CODE_MOVED for unknown code block?\", warning for workerd devs, not application devs\n else if (classifiers.isCodeMovedWarning(chunk)) {\n // ignore entirely, don't even send it to the debug log file\n }\n\n // anything not explicitly handled above should be logged as an error (via stderr)\n else {\n logConsole(\"error\", chunk);\n }\n });\n}\n\nexport function logConsole(level: LogLevel, data: string, callDepth = 0) {\n void logConsoleAsync(level, data, callDepth);\n}\n\n/**\n * This is what is logged when the runtime calls console.log, etc.\n */\nexport async function logConsoleAsync(\n level: LogLevel,\n data: string,\n callDepth = 0\n) {\n try {\n if (!data) {\n return;\n }\n\n // This shouldn't happen, but just in case\n if (typeof data !== \"string\") {\n console[level](data);\n return;\n }\n\n let message = data?.trim();\n if (!message || message?.length === 0) {\n return;\n }\n\n // Probably a JSON object\n if (message.startsWith(`{`) && message.endsWith(`}`)) {\n let logEntry: ConsoleLogEntry;\n try {\n logEntry = JSON.parse(message);\n } catch (e) {\n // If we are at a depth of 1 it means we are trying to handle the case\n // where a chunk might be multiple JSON entries.\n if (callDepth === 1) {\n // We might have multiple log entries in a single chunk\n // so split them and log each one\n const lines = message.split(\"\\n\");\n await Promise.all(\n lines.map(async (line) => logConsole(level, line, callDepth++))\n );\n return;\n } else {\n console[level](data);\n return;\n }\n }\n await Promise.all(\n logEntry.messages.map((msg) => logStructured(logEntry, msg))\n );\n } else {\n message = await formatMessage(message);\n\n const line = `${getTimestamp()} ${levelFormats[level]} ${message}`;\n\n console[level](line);\n }\n } catch (err) {\n const line = `${getTimestamp()} ${levelFormats[level]} ${JSON.stringify(data)}`;\n\n console[level](line);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function logStructured(\n logEntry: ConsoleLogEntry,\n message: string\n) {\n if (\n typeof message === \"object\" &&\n message &&\n Object.keys(message).length === 0\n ) {\n return;\n }\n\n // Get the log properties we care about\n const { level, route, method, timestamp } = logEntry;\n\n const routeStr = route.endsWith(\"{/}?\") ? route.slice(0, -4) : route;\n\n const msg = await formatMessage(message);\n\n const line = `${getTimestamp(timestamp)} ${levelFormats[level]} [${methodFormats[method.toUpperCase() as HttpMethod]} ${chalk.blue(routeStr)}] ${msg}`;\n\n // Log the line\n console[level](line);\n}\n\ntype HttpMethod =\n | \"GET\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"OPTIONS\";\nconst methodFormats: Record<HttpMethod, string> = {\n GET: chalk.green(chalk.bold(\"GET\")),\n POST: chalk.blue(chalk.bold(\"POST\")),\n PUT: chalk.yellow(chalk.bold(\"PUT\")),\n DELETE: chalk.red(chalk.bold(\"DELETE\")),\n PATCH: chalk.magenta(chalk.bold(\"PATCH\")),\n HEAD: chalk.cyan(chalk.bold(\"HEAD\")),\n OPTIONS: chalk.gray(chalk.bold(\"OPTIONS\")),\n};\n\nconst levelFormats: Record<LogLevel, string> = {\n error: chalk.red(chalk.bold(\"ERROR\".padEnd(5))),\n warn: chalk.yellow(chalk.bold(\"WARN\".padEnd(5))),\n info: chalk.blue(chalk.bold(\"INFO\".padEnd(5))),\n debug: chalk.gray(chalk.bold(\"DEBUG\".padEnd(5))),\n};\n\n// Only initialize the timeFormatter when the timestamp option is used, and\n// reuse it across all loggers\nlet timeFormatter: Intl.DateTimeFormat;\nfunction getTimeFormatter() {\n timeFormatter ??= new Intl.DateTimeFormat(undefined, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n fractionalSecondDigits: 3,\n });\n return timeFormatter;\n}\n\nfunction getTimestamp(timestamp?: string) {\n return chalk.white(\n chalk.dim(\n `[${getTimeFormatter().format(timestamp ? new Date(timestamp) : new Date())}]`\n )\n );\n}\n\nasync function formatMessage(message: string): Promise<string> {\n const trimmed = message.trim();\n if (trimmed.startsWith(\"{\") && trimmed.endsWith(\"}\")) {\n try {\n const data = JSON.parse(trimmed);\n if (\"stack\" in data && isJavaScriptStackTrace(data.stack)) {\n const { stack, message, name, ...err } = data;\n\n const formatted = await formatError(stack);\n let line: string;\n if (name && message) {\n line = `${name}: ${message}`;\n } else if (message) {\n line = `Error: ${message}`;\n } else {\n line = \"An error occurred\";\n }\n\n if (Object.keys(err).length > 0) {\n line += \"\\n\";\n line += JSON.stringify(err);\n }\n\n return `${line}\\n${formatted}`;\n }\n } catch (err) {\n // Ignore\n }\n }\n\n return message;\n}\n\nasync function formatError(error: string | Error) {\n const stack = await new StackTracey(error).cleanAsync();\n\n const jsonResponse = await new Youch(stack, {}).toJSON();\n\n const options = {\n // Defaults to false\n displayShortPath: false,\n\n fileShort: true,\n\n // Defaults to single whitspace\n prefix: \" \",\n\n // Defaults to false\n hideErrorTitle: false,\n\n // Defaults to false\n hideMessage: true,\n\n // Defaults to false\n displayMainFrameOnly: true,\n\n // Defaults to 3\n framesMaxLimit: 3,\n };\n\n return forTerminal(jsonResponse, options);\n}\n\nfunction isJavaScriptStackTrace(str: string): boolean {\n const stackTraceRegex =\n /at\\s+(.*?)\\s+\\((.*?):(\\d+):(\\d+)\\)|at\\s+(.*?):(\\d+):(\\d+)/;\n return stackTraceRegex.test(str);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"worker-output.js","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAG1E,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC,MAAM,UAAU,kBAAkB,CAAC,MAAgB,EAAE,MAAgB;IAKnE,MAAM,WAAW,GAAG;QAElB,MAAM,CAAC,KAAa;YAClB,MAAM,6BAA6B,GAAG,KAAK,CAAC,QAAQ,CAClD,kEAAkE,CACnE,CAAC;YACF,MAAM,mCAAmC,GAAG,KAAK,CAAC,QAAQ,CACxD,6BAA6B,CAC9B,CAAC;YAIF,MAAM,gBAAgB,GAAG,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEpE,OAAO,CACL,6BAA6B;gBAC7B,mCAAmC;gBACnC,gBAAgB,CACjB,CAAC;QACJ,CAAC;QAED,cAAc,CAAC,KAAa;YAC1B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AAY,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACrD,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAElD,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-console */\n\nimport { ConsoleLogEntry, LogFormatter, LogLevel } from \"@zuplo/core/cli\";\nimport { Readable } from \"node:stream\";\n\nconst logFormatter = new LogFormatter();\n\nexport function handleRuntimeStdio(stdout: Readable, stderr: Readable) {\n // ASSUMPTION: each chunk is a whole message from workerd\n // This may not hold across OSes/architectures, but it seems to work on macOS M-line\n // I'm going with this simple approach to avoid complicating this too early\n // We can iterate on this heuristic in the future if it causes issues\n const classifiers = {\n // Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?\n isBarf(chunk: string) {\n const containsLlvmSymbolizerWarning = chunk.includes(\n \"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set\"\n );\n const containsRecursiveIsolateLockWarning = chunk.includes(\n \"took recursive isolate lock\"\n );\n // Matches stack traces from workerd\n // - on unix: groups of 9 hex digits separated by spaces\n // - on windows: groups of 12 hex digits, or a single digit 0, separated by spaces\n const containsHexStack = /stack:( (0|[a-f\\d]{4,})){3,}/.test(chunk);\n\n return (\n containsLlvmSymbolizerWarning ||\n containsRecursiveIsolateLockWarning ||\n containsHexStack\n );\n },\n // Is this chunk an Address In Use error?\n isAddressInUse(chunk: string) {\n return chunk.includes(\"Address already in use; toString() = \");\n },\n isWarning(chunk: string) {\n return /\\.c\\+\\+:\\d+: warning:/.test(chunk);\n },\n isCodeMovedWarning(chunk: string) {\n return /CODE_MOVED for unknown code block/.test(chunk);\n },\n isAccessViolation(chunk: string) {\n return chunk.includes(\"access violation;\");\n },\n };\n\n stdout.on(\"data\", (chunk: Buffer | string) => {\n chunk = chunk.toString().trim();\n\n if (classifiers.isBarf(chunk)) {\n // this is a big chonky barf from workerd that we want to hijack to cleanup/ignore\n\n // CLEANABLE:\n // there are no known cases to cleanup yet\n // but, as they are identified, we will do that here\n\n // IGNORABLE:\n // anything else not handled above is considered ignorable\n // so send it to the debug logs which are discarded unless\n // the user explicitly sets a logLevel indicating they care\n logConsole(\"debug\", chunk);\n }\n\n // known case: warnings are not info, log them as such\n else if (classifiers.isWarning(chunk)) {\n logConsole(\"warn\", chunk);\n }\n\n // anything not explicitly handled above should be logged as info (via stdout)\n else {\n logConsole(\"error\", chunk);\n }\n });\n\n stderr.on(\"data\", (chunk: Buffer | string) => {\n chunk = chunk.toString().trim();\n\n if (classifiers.isBarf(chunk)) {\n // this is a big chonky barf from workerd that we want to hijack to cleanup/ignore\n\n // CLEANABLE:\n // known case to cleanup: Address in use errors\n if (classifiers.isAddressInUse(chunk)) {\n const address = chunk.match(\n /Address already in use; toString\\(\\) = (.+)\\n/\n )?.[1];\n\n logConsole(\n \"error\",\n `Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`\n );\n\n // Log the original error to the debug logs.\n logConsole(\"debug\", chunk);\n }\n // In the past we have seen Access Violation errors on Windows, which may be caused by an outdated\n // version of the Windows OS or the Microsoft Visual C++ Redistributable.\n // See https://github.com/cloudflare/workers-sdk/issues/6170#issuecomment-2245209918\n else if (classifiers.isAccessViolation(chunk)) {\n let error = \"There was an access violation in the runtime.\";\n if (process.platform === \"win32\") {\n error +=\n \"\\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\\n\" +\n \"Check that you have the latest version installed.\\n\" +\n \"See https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.\";\n }\n logConsole(\"error\", error);\n\n // Log the original error to the debug logs.\n logConsole(\"debug\", chunk);\n }\n\n // IGNORABLE:\n // anything else not handled above is considered ignorable\n // so send it to the debug logs which are discarded unless\n // the user explicitly sets a logLevel indicating they care\n else {\n logConsole(\"debug\", chunk);\n }\n }\n\n // known case: warnings are not errors, log them as such\n else if (classifiers.isWarning(chunk)) {\n logConsole(\"warn\", chunk);\n }\n\n // known case: \"error: CODE_MOVED for unknown code block?\", warning for workerd devs, not application devs\n else if (classifiers.isCodeMovedWarning(chunk)) {\n // ignore entirely, don't even send it to the debug log file\n }\n\n // anything not explicitly handled above should be logged as an error (via stderr)\n else {\n logConsole(\"error\", chunk);\n }\n });\n}\n\nexport function logConsole(level: LogLevel, data: string, callDepth = 0) {\n void logConsoleAsync(level, data, callDepth);\n}\n\n/**\n * This is what is logged when the runtime calls console.log, etc.\n */\nexport async function logConsoleAsync(\n level: LogLevel,\n data: string,\n callDepth = 0\n) {\n try {\n if (!data) {\n return;\n }\n\n // This shouldn't happen, but just in case\n if (typeof data !== \"string\") {\n console[level](data);\n return;\n }\n\n let message = data?.trim();\n if (!message || message?.length === 0) {\n return;\n }\n\n // Probably a JSON object\n if (message.startsWith(`{`) && message.endsWith(`}`)) {\n let logEntry: ConsoleLogEntry;\n try {\n logEntry = JSON.parse(message);\n } catch (e) {\n // If we are at a depth of 1 it means we are trying to handle the case\n // where a chunk might be multiple JSON entries.\n if (callDepth === 1) {\n // We might have multiple log entries in a single chunk\n // so split them and log each one\n const lines = message.split(\"\\n\");\n await Promise.all(\n lines.map(async (line) => logConsole(level, line, callDepth++))\n );\n return;\n } else {\n console[level](data);\n return;\n }\n }\n await Promise.all(\n logEntry.messages.map(async (msg) => {\n const line = await logFormatter.formatStructured(logEntry, msg);\n console[level](line);\n })\n );\n } else {\n message = await logFormatter.formatMessage(message);\n\n const line = logFormatter.formatLine(level, message);\n console[level](line);\n }\n } catch (err) {\n const line = logFormatter.formatLine(level, data);\n\n console[level](line);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/cli.ts","../src/types.d.ts","../src/__tests__/archive-utils.test.ts","../src/__tests__/engine.test.ts","../src/__tests__/import-openapi-utils.test.ts","../src/__tests__/import-openapi.test.ts","../src/__tests__/oas-test-data.ts","../src/__tests__/outdated.test.ts","../src/__tests__/tsconfig-upgrader.test.ts","../src/build/handler.ts","../src/cmds/build.ts","../src/cmds/compile.ts","../src/cmds/convert.ts","../src/cmds/delete.ts","../src/cmds/deploy.ts","../src/cmds/dev.ts","../src/cmds/editor.ts","../src/cmds/link.ts","../src/cmds/list.ts","../src/cmds/login.ts","../src/cmds/test.ts","../src/cmds/project/import-openapi.ts","../src/cmds/project/index.ts","../src/cmds/project/update.ts","../src/cmds/tunnel/create.ts","../src/cmds/tunnel/delete.ts","../src/cmds/tunnel/describe.ts","../src/cmds/tunnel/index.ts","../src/cmds/tunnel/list.ts","../src/cmds/tunnel/rotate-token.ts","../src/cmds/tunnel/services/describe.ts","../src/cmds/tunnel/services/index.ts","../src/cmds/tunnel/services/update.ts","../src/cmds/variable/create.ts","../src/cmds/variable/index.ts","../src/cmds/variable/update.ts","../src/common/alias.ts","../src/common/args.ts","../src/common/constants.ts","../src/common/handler.ts","../src/common/logger.ts","../src/common/models.ts","../src/common/outdated.ts","../src/common/output.ts","../src/common/settings.ts","../src/common/worker-output.
|
|
1
|
+
{"root":["../src/cli.ts","../src/types.d.ts","../src/__tests__/archive-utils.test.ts","../src/__tests__/engine.test.ts","../src/__tests__/import-openapi-utils.test.ts","../src/__tests__/import-openapi.test.ts","../src/__tests__/oas-test-data.ts","../src/__tests__/outdated.test.ts","../src/__tests__/tsconfig-upgrader.test.ts","../src/build/handler.ts","../src/cmds/build.ts","../src/cmds/compile.ts","../src/cmds/convert.ts","../src/cmds/delete.ts","../src/cmds/deploy.ts","../src/cmds/dev.ts","../src/cmds/editor.ts","../src/cmds/link.ts","../src/cmds/list.ts","../src/cmds/login.ts","../src/cmds/test.ts","../src/cmds/project/import-openapi.ts","../src/cmds/project/index.ts","../src/cmds/project/update.ts","../src/cmds/tunnel/create.ts","../src/cmds/tunnel/delete.ts","../src/cmds/tunnel/describe.ts","../src/cmds/tunnel/index.ts","../src/cmds/tunnel/list.ts","../src/cmds/tunnel/rotate-token.ts","../src/cmds/tunnel/services/describe.ts","../src/cmds/tunnel/services/index.ts","../src/cmds/tunnel/services/update.ts","../src/cmds/variable/create.ts","../src/cmds/variable/index.ts","../src/cmds/variable/update.ts","../src/common/alias.ts","../src/common/args.ts","../src/common/constants.ts","../src/common/handler.ts","../src/common/logger.ts","../src/common/models.ts","../src/common/outdated.ts","../src/common/output.ts","../src/common/settings.ts","../src/common/worker-output.ts","../src/common/analytics/lib.ts","../src/common/api/lib.ts","../src/common/machine-id/lib.ts","../src/common/middleware/user-configuration.ts","../src/common/middleware/user-identification.ts","../src/common/upgraders/lib.ts","../src/common/upgraders/package-json-upgrader.ts","../src/common/upgraders/tsconfig-upgrader.ts","../src/common/upgraders/vscode-settings-json-upgrader.ts","../src/common/utils/box.ts","../src/common/utils/ports.ts","../src/common/utils/types.ts","../src/common/utils/urls.ts","../src/common/validators/file-system-validator.ts","../src/common/validators/lib.ts","../src/common/validators/login-state-validator.ts","../src/common/validators/project-name-validator.ts","../src/common/xdg/lib.ts","../src/compile/handler.ts","../src/convert/engine.ts","../src/convert/handler.ts","../src/convert/routes.legacy.ts","../src/delete/handler.ts","../src/delete/poll-deployment.ts","../src/deploy/archive.ts","../src/deploy/environments.ts","../src/deploy/file-upload.ts","../src/deploy/handler.ts","../src/deploy/poll-deployment.ts","../src/dev/handler.ts","../src/editor/handler.ts","../src/editor/assets/index-03352ce7.js","../src/editor/server/cors-plugin.ts","../src/editor/server/server.ts","../src/editor/server/xfs.ts","../src/link/handler.ts","../src/link/populate.ts","../src/list/handler.ts","../src/login/handler.ts","../src/login/server.ts","../src/project/import-openapi/handler.ts","../src/project/import-openapi/interfaces.ts","../src/project/import-openapi/utils.ts","../src/project/update/handler.ts","../src/test/esbuild-config.ts","../src/test/handler.ts","../src/test/invoke-test.ts","../src/test/esbuild-plugins/node-test-prep-plugin.ts","../src/tunnel/models.ts","../src/tunnel/create/handler.ts","../src/tunnel/delete/handler.ts","../src/tunnel/delete/poll-teardown-operation.ts","../src/tunnel/describe/handler.ts","../src/tunnel/list/handler.ts","../src/tunnel/rotate-token/handler.ts","../src/tunnel/services/describe/handler.ts","../src/tunnel/services/update/handler.ts","../src/tunnel/services/update/poll-provisioning-operations.ts","../src/variable/models.ts","../src/variable/create/handler.ts","../src/variable/update/handler.ts"],"version":"5.6.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "6.17.
|
|
3
|
+
"version": "6.17.19",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@opentelemetry/api": "^1.8.0",
|
|
30
30
|
"@sentry/node": "^7.119.2",
|
|
31
31
|
"@swc/core": "1.7.22",
|
|
32
|
-
"@zuplo/core": "^6.17.
|
|
33
|
-
"@zuplo/runtime": "^6.17.
|
|
32
|
+
"@zuplo/core": "^6.17.19",
|
|
33
|
+
"@zuplo/runtime": "^6.17.19",
|
|
34
34
|
"as-table": "^1.0.55",
|
|
35
35
|
"chalk": "^5.3.0",
|
|
36
36
|
"chokidar": "^3.5.3",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"fastify": "^4.27.0",
|
|
43
43
|
"fastify-plugin": "^4.5.1",
|
|
44
44
|
"fastify-sse-v2": "^3.1.2",
|
|
45
|
-
"get-source": "^2.0.12",
|
|
46
45
|
"ignore": "^5.3.0",
|
|
47
46
|
"jose": "^5.6.3",
|
|
48
47
|
"js-yaml": "^4.1.0",
|
|
@@ -57,12 +56,9 @@
|
|
|
57
56
|
"rimraf": "^6.0.1",
|
|
58
57
|
"semver": "7.6.3",
|
|
59
58
|
"simple-git": "^3.22.0",
|
|
60
|
-
"source-map": "^0.7.4",
|
|
61
|
-
"string-width": "^7.2.0",
|
|
62
59
|
"strip-ansi": "^7.1.0",
|
|
63
60
|
"tar": "^7.4.3",
|
|
64
61
|
"uuid": "^10.0.0",
|
|
65
|
-
"wordwrap": "^1.0.0",
|
|
66
62
|
"workerd": "1.20241011.1",
|
|
67
63
|
"yargs": "^17.7.1"
|
|
68
64
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class StackTracey {
|
|
2
|
-
static resetCache(): void;
|
|
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
|
-
maxColumnWidths(): {
|
|
25
|
-
callee: number;
|
|
26
|
-
file: number;
|
|
27
|
-
sourceLine: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=stacktracy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stacktracy.d.ts","sourceRoot":"","sources":["../../../src/common/errors/stacktracy.js"],"names":[],"mappings":"AAyCA;IAqSE,0BAGC;IAED,+CAEC;IA3SD,qCAkDC;IAJG,aAAkB;IAMtB,kCAaC;IAED,oCAKC;IAED,oCAiBC;IAED,0DAQC;IAED,wBAoDC;IAED,0BAEC;IAED,+BAEC;IAED,0BAYC;IAED,wCAcC;IAED,mCAIC;IAED,iDAmBC;IAED,mBAEC;IAED,yCAIC;IAED,kCAmBC;IAED,aAGC;IAED,2BAKC;IAED,yCAEC;IAED,gBAaC;IAED;;;;MAMC;CAUF"}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const partition = (arr_, pred) => {
|
|
3
|
-
const arr = arr_ || [], spans = [];
|
|
4
|
-
let span = { label: undefined, items: [arr.first] };
|
|
5
|
-
arr.forEach((x) => {
|
|
6
|
-
const label = pred(x);
|
|
7
|
-
if (span.label !== label && span.items.length) {
|
|
8
|
-
spans.push((span = { label: label, items: [x] }));
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
span.items.push(x);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return spans;
|
|
15
|
-
};
|
|
16
|
-
import getSource from "get-source";
|
|
17
|
-
import path from "node:path";
|
|
18
|
-
import util from "node:util";
|
|
19
|
-
const O = Object;
|
|
20
|
-
const lastOf = (x) => x[x.length - 1];
|
|
21
|
-
const nixSlashes = (x) => x.replace(/\\/g, "/");
|
|
22
|
-
const pathRoot = nixSlashes(process.cwd()) + "/";
|
|
23
|
-
export default class StackTracey {
|
|
24
|
-
constructor(input, offset) {
|
|
25
|
-
const originalInput = input, isParseableSyntaxError = input && input instanceof SyntaxError;
|
|
26
|
-
if (!input) {
|
|
27
|
-
input = new Error();
|
|
28
|
-
offset = offset === undefined ? 1 : offset;
|
|
29
|
-
}
|
|
30
|
-
if (input instanceof Error) {
|
|
31
|
-
input = input.stack || "";
|
|
32
|
-
}
|
|
33
|
-
if (typeof input === "string") {
|
|
34
|
-
input = this.rawParse(input)
|
|
35
|
-
.slice(offset)
|
|
36
|
-
.map((x) => this.extractEntryMetadata(x));
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(input)) {
|
|
39
|
-
if (isParseableSyntaxError) {
|
|
40
|
-
const rawLines = util.inspect(originalInput).split("\n"), fileLine = rawLines[0].split(":"), line = fileLine.pop(), file = fileLine.join(":");
|
|
41
|
-
if (file) {
|
|
42
|
-
input.unshift({
|
|
43
|
-
file: nixSlashes(file),
|
|
44
|
-
line: line,
|
|
45
|
-
column: (rawLines[2] || "").indexOf("^") + 1,
|
|
46
|
-
sourceLine: rawLines[1],
|
|
47
|
-
callee: "(syntax error)",
|
|
48
|
-
syntaxError: true,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
this.items = input;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.items = [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
extractEntryMetadata(e) {
|
|
59
|
-
const decomposedPath = this.decomposePath(e.file || "");
|
|
60
|
-
const fileRelative = decomposedPath[0];
|
|
61
|
-
const externalDomain = decomposedPath[1];
|
|
62
|
-
return O.assign(e, {
|
|
63
|
-
calleeShort: e.calleeShort || lastOf((e.callee || "").split(".")),
|
|
64
|
-
fileRelative: fileRelative,
|
|
65
|
-
fileShort: this.shortenPath(fileRelative),
|
|
66
|
-
fileName: lastOf((e.file || "").split("/")),
|
|
67
|
-
thirdParty: this.isThirdParty(fileRelative, externalDomain) && !e.index,
|
|
68
|
-
externalDomain: externalDomain,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
shortenPath(relativePath) {
|
|
72
|
-
return relativePath
|
|
73
|
-
.replace(/^node_modules\//, "")
|
|
74
|
-
.replace(/^webpack\/bootstrap\//, "")
|
|
75
|
-
.replace(/^__parcel_source_root\//, "");
|
|
76
|
-
}
|
|
77
|
-
decomposePath(fullPath) {
|
|
78
|
-
let result = fullPath;
|
|
79
|
-
const externalDomainMatch = result.match(/^(http|https)\:\/\/?([^\/]+)\/(.*)/);
|
|
80
|
-
const externalDomain = externalDomainMatch
|
|
81
|
-
? externalDomainMatch[2]
|
|
82
|
-
: undefined;
|
|
83
|
-
result = externalDomainMatch ? externalDomainMatch[3] : result;
|
|
84
|
-
result = path.relative(pathRoot, result);
|
|
85
|
-
return [
|
|
86
|
-
nixSlashes(result).replace(/^.*\:\/\/?\/?/, ""),
|
|
87
|
-
externalDomain,
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
isThirdParty(relativePath, externalDomain) {
|
|
91
|
-
return (externalDomain ||
|
|
92
|
-
relativePath[0] === "~" ||
|
|
93
|
-
relativePath[0] === "/" ||
|
|
94
|
-
relativePath.indexOf("node_modules") === 0 ||
|
|
95
|
-
relativePath.indexOf("webpack/bootstrap") === 0);
|
|
96
|
-
}
|
|
97
|
-
rawParse(str) {
|
|
98
|
-
const lines = (str || "").split("\n");
|
|
99
|
-
const entries = lines.map((line) => {
|
|
100
|
-
line = line.trim();
|
|
101
|
-
let callee, fileLineColumn = [], native, planA, planB;
|
|
102
|
-
if ((planA = line.match(/at (.+) \(eval at .+ \((.+)\), .+\)/)) ||
|
|
103
|
-
(planA = line.match(/at (.+) \((.+)\)/)) ||
|
|
104
|
-
(line.slice(0, 3) !== "at " && (planA = line.match(/(.*)@(.*)/)))) {
|
|
105
|
-
callee = planA[1];
|
|
106
|
-
native = planA[2] === "native";
|
|
107
|
-
fileLineColumn = (planA[2].match(/(.*):(\d+):(\d+)/) ||
|
|
108
|
-
planA[2].match(/(.*):(\d+)/) ||
|
|
109
|
-
[]).slice(1);
|
|
110
|
-
}
|
|
111
|
-
else if ((planB = line.match(/^(at\s+)*(.+):(\d+):(\d+)/))) {
|
|
112
|
-
fileLineColumn = planB.slice(2);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
if (callee && !fileLineColumn[0]) {
|
|
118
|
-
const type = callee.split(".")[0];
|
|
119
|
-
if (type === "Array") {
|
|
120
|
-
native = true;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
beforeParse: line,
|
|
125
|
-
callee: callee || "",
|
|
126
|
-
index: fileLineColumn[0] === "/",
|
|
127
|
-
native: native || false,
|
|
128
|
-
file: nixSlashes(fileLineColumn[0] || ""),
|
|
129
|
-
line: parseInt(fileLineColumn[1] || "", 10) || undefined,
|
|
130
|
-
column: parseInt(fileLineColumn[2] || "", 10) || undefined,
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
return entries.filter((x) => x !== undefined);
|
|
134
|
-
}
|
|
135
|
-
withSourceAt(i) {
|
|
136
|
-
return this.items[i] && this.withSource(this.items[i]);
|
|
137
|
-
}
|
|
138
|
-
withSourceAsyncAt(i) {
|
|
139
|
-
return this.items[i] && this.withSourceAsync(this.items[i]);
|
|
140
|
-
}
|
|
141
|
-
withSource(loc) {
|
|
142
|
-
if (this.shouldSkipResolving(loc)) {
|
|
143
|
-
return loc;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
let resolved = getSource(loc.file || "").resolve(loc);
|
|
147
|
-
if (!resolved.sourceFile) {
|
|
148
|
-
return loc;
|
|
149
|
-
}
|
|
150
|
-
return this.withSourceResolved(loc, resolved);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
withSourceAsync(loc) {
|
|
154
|
-
if (this.shouldSkipResolving(loc)) {
|
|
155
|
-
return Promise.resolve(loc);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
const fsPath = (loc.file || "").replace("file://", "");
|
|
159
|
-
return getSource
|
|
160
|
-
.async(fsPath)
|
|
161
|
-
.then((x) => x.resolve(loc))
|
|
162
|
-
.then((resolved) => this.withSourceResolved(loc, resolved))
|
|
163
|
-
.catch((e) => {
|
|
164
|
-
this.withSourceResolved(loc, { error: e, sourceLine: "" });
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
shouldSkipResolving(loc) {
|
|
169
|
-
return (loc.sourceFile || loc.error || (loc.file && loc.file.indexOf("<") >= 0));
|
|
170
|
-
}
|
|
171
|
-
withSourceResolved(loc, resolved) {
|
|
172
|
-
if (resolved.sourceFile && !resolved.sourceFile.error) {
|
|
173
|
-
resolved.file = nixSlashes(resolved.sourceFile.path);
|
|
174
|
-
resolved = this.extractEntryMetadata(resolved);
|
|
175
|
-
}
|
|
176
|
-
if (resolved.sourceLine.includes("// @hide")) {
|
|
177
|
-
resolved.sourceLine = resolved.sourceLine.replace("// @hide", "");
|
|
178
|
-
resolved.hide = true;
|
|
179
|
-
}
|
|
180
|
-
if (resolved.sourceLine.includes("__webpack_require__") ||
|
|
181
|
-
resolved.sourceLine.includes("/******/ ({")) {
|
|
182
|
-
resolved.thirdParty = true;
|
|
183
|
-
}
|
|
184
|
-
return O.assign({ sourceLine: "" }, loc, resolved);
|
|
185
|
-
}
|
|
186
|
-
withSources() {
|
|
187
|
-
return this.map((x) => this.withSource(x));
|
|
188
|
-
}
|
|
189
|
-
withSourcesAsync() {
|
|
190
|
-
return Promise.all(this.items.map((x) => this.withSourceAsync(x))).then((items) => new StackTracey(items));
|
|
191
|
-
}
|
|
192
|
-
mergeRepeatedLines() {
|
|
193
|
-
return new StackTracey(partition(this.items, (e) => e.file + e.line).map((group) => {
|
|
194
|
-
return group.items.slice(1).reduce((memo, entry) => {
|
|
195
|
-
memo.callee =
|
|
196
|
-
(memo.callee || "<anonymous>") +
|
|
197
|
-
" → " +
|
|
198
|
-
(entry.callee || "<anonymous>");
|
|
199
|
-
memo.calleeShort =
|
|
200
|
-
(memo.calleeShort || "<anonymous>") +
|
|
201
|
-
" → " +
|
|
202
|
-
(entry.calleeShort || "<anonymous>");
|
|
203
|
-
return memo;
|
|
204
|
-
}, O.assign({}, group.items[0]));
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
clean() {
|
|
208
|
-
const s = this.withSources().mergeRepeatedLines();
|
|
209
|
-
return s.filter(s.isClean.bind(s));
|
|
210
|
-
}
|
|
211
|
-
cleanAsync() {
|
|
212
|
-
return this.withSourcesAsync().then((s) => {
|
|
213
|
-
s = s.mergeRepeatedLines();
|
|
214
|
-
return s.filter(s.isClean.bind(s));
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
isClean(entry, index) {
|
|
218
|
-
return index === 0 || !(entry.thirdParty || entry.hide || entry.native);
|
|
219
|
-
}
|
|
220
|
-
at(i) {
|
|
221
|
-
return O.assign({
|
|
222
|
-
beforeParse: "",
|
|
223
|
-
callee: "<???>",
|
|
224
|
-
index: false,
|
|
225
|
-
native: false,
|
|
226
|
-
file: "<???>",
|
|
227
|
-
line: 0,
|
|
228
|
-
column: 0,
|
|
229
|
-
}, this.items[i]);
|
|
230
|
-
}
|
|
231
|
-
maxColumnWidths() {
|
|
232
|
-
return {
|
|
233
|
-
callee: 30,
|
|
234
|
-
file: 60,
|
|
235
|
-
sourceLine: 80,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
static resetCache() {
|
|
239
|
-
getSource.resetCache();
|
|
240
|
-
getSource.async.resetCache();
|
|
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
|
-
//# sourceMappingURL=stacktracy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stacktracy.js","sourceRoot":"","sources":["../../../src/common/errors/stacktracy.js"],"names":[],"mappings":"AAEA,YAAY,CAAC;AAQb,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;IAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,EACpB,KAAK,GAAG,EAAE,CAAC;IAEb,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f,SAAS,CAAC,UAAU,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IAC/B,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","sourcesContent":["/* eslint-disable */\n\n\"use strict\";\n\n/**\n * Adapted from Stacktracey (https://github.com/xpl/stacktracey).\n *\n * For the original license, see https://github.com/xpl/stacktracey/blob/master/LICENSE\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\nimport getSource from \"get-source\";\nimport path from \"node:path\";\nimport util from \"node:util\";\n\nconst O = Object;\nconst // to prevent bundlers from expanding the require call\n lastOf = (x) => x[x.length - 1];\nconst nixSlashes = (x) => x.replace(/\\\\/g, \"/\");\n\nconst pathRoot = nixSlashes(process.cwd()) + \"/\";\n/* ------------------------------------------------------------------------ */\n\nexport default class 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 = 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 result = path.relative(pathRoot, 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: fileLineColumn[0] === \"/\",\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 // Fix file path\n const fsPath = (loc.file || \"\").replace(\"file://\", \"\");\n return getSource\n .async(fsPath)\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 maxColumnWidths() {\n return {\n callee: 30,\n file: 60,\n sourceLine: 80,\n };\n }\n\n static resetCache() {\n getSource.resetCache();\n getSource.async.resetCache();\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"youch-terminal.d.ts","sourceRoot":"","sources":["../../../src/common/errors/youch-terminal.js"],"names":[],"mappings":"AA8Se,qCAVH,MAAM,wBA2CjB"}
|
|
@@ -1,156 +0,0 @@
|
|
|
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");
|
|
155
|
-
};
|
|
156
|
-
//# sourceMappingURL=youch-terminal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"youch-terminal.js","sourceRoot":"","sources":["../../../src/common/errors/youch-terminal.js"],"names":[],"mappings":"AAUA,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;AAEhD,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AAC7C,MAAM,OAAO,GAAG,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5E,MAAM,IAAI,GAAG,QAAQ,K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O,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"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
class Youch {
|
|
4
|
-
constructor(error, request, options = {}) {
|
|
5
|
-
this.options = options;
|
|
6
|
-
this.options.postLines = options.postLines || 5;
|
|
7
|
-
this.options.preLines = options.preLines || 5;
|
|
8
|
-
this._filterHeaders = ["cookie", "connection"];
|
|
9
|
-
this.error = error;
|
|
10
|
-
this.request = request;
|
|
11
|
-
this.links = [];
|
|
12
|
-
this.showAllFrames = false;
|
|
13
|
-
}
|
|
14
|
-
_getFrameSource(frame) {
|
|
15
|
-
let path = frame.file
|
|
16
|
-
.replace(/dist\/webpack:\//g, "")
|
|
17
|
-
.replace(/dist\\webpack:\\/g, "");
|
|
18
|
-
try {
|
|
19
|
-
path = path.startsWith("file:") ? fileURLToPath(path) : path;
|
|
20
|
-
}
|
|
21
|
-
catch { }
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
readFile(path, "utf-8", (error, contents) => {
|
|
24
|
-
if (error) {
|
|
25
|
-
resolve(null);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const lines = contents.split(/\r?\n/);
|
|
29
|
-
const lineNumber = frame.line;
|
|
30
|
-
resolve({
|
|
31
|
-
pre: lines.slice(Math.max(0, lineNumber - (this.options.preLines + 1)), lineNumber - 1),
|
|
32
|
-
line: lines[lineNumber - 1],
|
|
33
|
-
post: lines.slice(lineNumber, lineNumber + this.options.postLines),
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
_parseError() {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const stack = this.error;
|
|
41
|
-
Promise.all(stack.items.map(async (frame) => {
|
|
42
|
-
if (this._isNode(frame)) {
|
|
43
|
-
return Promise.resolve(frame);
|
|
44
|
-
}
|
|
45
|
-
return this._getFrameSource(frame).then((context) => {
|
|
46
|
-
frame.context = context;
|
|
47
|
-
return frame;
|
|
48
|
-
});
|
|
49
|
-
}))
|
|
50
|
-
.then(resolve)
|
|
51
|
-
.catch(reject);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
_getContext(frame) {
|
|
55
|
-
if (!frame.context) {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
start: frame.line - (frame.context.pre || []).length,
|
|
60
|
-
pre: frame.context.pre.join("\n"),
|
|
61
|
-
line: frame.context.line,
|
|
62
|
-
post: frame.context.post.join("\n"),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
_serializeFrame(frame) {
|
|
66
|
-
return {
|
|
67
|
-
file: frame.fileRelative,
|
|
68
|
-
filePath: frame.file.startsWith("file:")
|
|
69
|
-
? fileURLToPath(frame.file).replaceAll("\\", "/")
|
|
70
|
-
: frame.file,
|
|
71
|
-
line: frame.line,
|
|
72
|
-
callee: frame.callee,
|
|
73
|
-
calleeShort: frame.calleeShort,
|
|
74
|
-
column: frame.column,
|
|
75
|
-
context: this._getContext(frame),
|
|
76
|
-
isModule: frame.thirdParty,
|
|
77
|
-
isNative: frame.native,
|
|
78
|
-
isApp: this._isApp(frame),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
_isNode(frame) {
|
|
82
|
-
if (frame.native) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
const filename = frame.file || "";
|
|
86
|
-
if (filename.startsWith("node:")) {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
_isApp(frame) {
|
|
92
|
-
return !this._isNode(frame) && !this._isNodeModule(frame);
|
|
93
|
-
}
|
|
94
|
-
_isNodeModule(frame) {
|
|
95
|
-
return (frame.file || "").indexOf("node_modules/") > -1;
|
|
96
|
-
}
|
|
97
|
-
_serializeData(stack, callback) {
|
|
98
|
-
callback = callback || this._serializeFrame.bind(this);
|
|
99
|
-
return {
|
|
100
|
-
message: this.error.message,
|
|
101
|
-
help: this.error.help,
|
|
102
|
-
cause: this.error.cause,
|
|
103
|
-
name: this.error.name,
|
|
104
|
-
status: this.error.status,
|
|
105
|
-
frames: stack instanceof Array === true
|
|
106
|
-
? stack.filter((frame) => frame.file).map(callback)
|
|
107
|
-
: [],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
toJSON() {
|
|
111
|
-
return new Promise((resolve, reject) => {
|
|
112
|
-
this._parseError()
|
|
113
|
-
.then((stack) => {
|
|
114
|
-
resolve({
|
|
115
|
-
error: this._serializeData(stack),
|
|
116
|
-
});
|
|
117
|
-
})
|
|
118
|
-
.catch(reject);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
export default Youch;
|
|
123
|
-
//# sourceMappingURL=youch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1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IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;iBAClC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,eAAe,KAAK,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/poppinss/youch/tree/develop\n */\n\nimport { readFile } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nclass Youch {\n constructor(error, request, options = {}) {\n this.options = options;\n this.options.postLines = options.postLines || 5;\n this.options.preLines = options.preLines || 5;\n\n this._filterHeaders = [\"cookie\", \"connection\"];\n this.error = error;\n this.request = request;\n this.links = [];\n this.showAllFrames = false;\n }\n\n /**\n * Returns the source code for a given file. It unable to\n * read file it resolves the promise with a null.\n *\n * @param {Object} frame\n * @return {Promise}\n */\n _getFrameSource(frame) {\n let path = frame.file\n .replace(/dist\\/webpack:\\//g, \"\") // unix\n .replace(/dist\\\\webpack:\\\\/g, \"\"); // windows\n\n /**\n * We ignore the error when \"fileURLToPath\" is unable to parse\n * the path, since returning the frame source is an optional\n * thing\n */\n try {\n path = path.startsWith(\"file:\") ? fileURLToPath(path) : path;\n } catch {}\n\n return new Promise((resolve) => {\n readFile(path, \"utf-8\", (error, contents) => {\n if (error) {\n resolve(null);\n return;\n }\n\n const lines = contents.split(/\\r?\\n/);\n const lineNumber = frame.line;\n\n resolve({\n pre: lines.slice(\n Math.max(0, lineNumber - (this.options.preLines + 1)),\n lineNumber - 1\n ),\n line: lines[lineNumber - 1],\n post: lines.slice(lineNumber, lineNumber + this.options.postLines),\n });\n });\n });\n }\n\n /**\n * Parses the error stack and returns serialized\n * frames out of it.\n *\n * @return {Object}\n */\n _parseError() {\n return new Promise((resolve, reject) => {\n // const stack = new StackTracey(this.error);\n const stack = this.error;\n Promise.all(\n stack.items.map(async (frame) => {\n if (this._isNode(frame)) {\n return Promise.resolve(frame);\n }\n return this._getFrameSource(frame).then((context) => {\n frame.context = context;\n return frame;\n });\n })\n )\n .then(resolve)\n .catch(reject);\n });\n }\n\n /**\n * Returns the context with code for a given\n * frame.\n *\n * @param {Object}\n * @return {Object}\n */\n _getContext(frame) {\n if (!frame.context) {\n return {};\n }\n\n return {\n start: frame.line - (frame.context.pre || []).length,\n pre: frame.context.pre.join(\"\\n\"),\n line: frame.context.line,\n post: frame.context.post.join(\"\\n\"),\n };\n }\n\n /**\n * Serializes frame to a usable error object.\n *\n * @param {Object}\n *\n * @return {Object}\n */\n _serializeFrame(frame) {\n return {\n file: frame.fileRelative,\n filePath: frame.file.startsWith(\"file:\")\n ? fileURLToPath(frame.file).replaceAll(\"\\\\\", \"/\")\n : frame.file,\n line: frame.line,\n callee: frame.callee,\n calleeShort: frame.calleeShort,\n column: frame.column,\n context: this._getContext(frame),\n isModule: frame.thirdParty,\n isNative: frame.native,\n isApp: this._isApp(frame),\n };\n }\n\n /**\n * Returns whether frame belongs to nodejs\n * or not.\n *\n * @return {Boolean} [description]\n */\n _isNode(frame) {\n if (frame.native) {\n return true;\n }\n\n const filename = frame.file || \"\";\n if (filename.startsWith(\"node:\")) {\n return true;\n }\n return false;\n\n // return !path.isAbsolute(filename) && filename[0] !== '.'\n }\n\n /**\n * Returns whether code belongs to the app\n * or not.\n *\n * @return {Boolean} [description]\n */\n _isApp(frame) {\n return !this._isNode(frame) && !this._isNodeModule(frame);\n }\n\n /**\n * Returns whether frame belongs to a node_module or\n * not\n *\n * @method _isNodeModule\n *\n * @param {Object} frame\n *\n * @return {Boolean}\n *\n * @private\n */\n _isNodeModule(frame) {\n return (frame.file || \"\").indexOf(\"node_modules/\") > -1;\n }\n\n /**\n * Serializes stack to Mustache friendly object to\n * be used within the view. Optionally can pass\n * a callback to customize the frames output.\n *\n * @param {Object}\n * @param {Function} [callback]\n *\n * @return {Object}\n */\n _serializeData(stack, callback) {\n callback = callback || this._serializeFrame.bind(this);\n return {\n message: this.error.message,\n help: this.error.help,\n cause: this.error.cause,\n name: this.error.name,\n status: this.error.status,\n frames:\n stack instanceof Array === true\n ? stack.filter((frame) => frame.file).map(callback)\n : [],\n };\n }\n\n /**\n * Returns error stack as JSON.\n *\n * @return {Promise}\n */\n toJSON() {\n return new Promise((resolve, reject) => {\n this._parseError()\n .then((stack) => {\n resolve({\n error: this._serializeData(stack),\n });\n })\n .catch(reject);\n });\n }\n}\n\nexport default Youch;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.spec.d.ts","sourceRoot":"","sources":["../../src/common/worker-output.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { logConsole, logStructured } from "./worker-output.js";
|
|
2
|
-
const lines = [
|
|
3
|
-
{
|
|
4
|
-
type: "structured",
|
|
5
|
-
line: `{"logId":"d5a57adb-4cb8-414b-95ba-7d5490823bde","requestId":"b674109a-8519-4c23-a405-916fbcd470d5","rayId":null,"level":"debug","logSource":"request","messages":["Request received '/hello'",{"method":"GET","url":"/hello","hostname":"localhost","route":"/hello"}],"timestamp":"2024-10-30T21:48:29.945Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":0,"url":"http://localhost:9000/hello","method":"GET","route":"/hello{/}?"}`,
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
type: "structured",
|
|
9
|
-
line: `{"logId":"0bef78e0-0665-4439-9f01-5c698d30c08a","requestId":"b674109a-8519-4c23-a405-916fbcd470d5","rayId":null,"level":"info","logSource":"request","messages":["Hello"],"timestamp":"2024-10-30T21:48:29.982Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":1,"url":"http://localhost:9000/hello","method":"GET","route":"/hello{/}?"}`,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
type: "structured",
|
|
13
|
-
line: `{"logId":"0af9543a-892d-4e48-b58b-5ac73eec7232","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["Request received '/echo'",{"method":"GET","url":"/echo","hostname":"localhost","route":"/echo"}],"timestamp":"2024-10-30T21:48:30.054Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":2,"url":"http://localhost:9000/echo","method":"GET","route":"/echo{/}?"}`,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: "structured",
|
|
17
|
-
line: `{"logId":"7047f560-0bcd-4314-bd42-350372055556","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["URL Forwarding to 'https://echo.zuplo.io/echo'"],"timestamp":"2024-10-30T21:48:30.087Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":3,"url":"http://localhost:9000/echo","method":"GET","route":"/echo{/}?"}`,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: "structured",
|
|
21
|
-
line: `{"logId":"7047f560-0bcd-4314-bd42-350372055556","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["URL Forwarding to 'https://echo.zuplo.io/echo'"],"timestamp":"2024-10-30T21:48:30.087Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":3,"url":"http://localhost:9000/echo","method":"POST","route":"/echo{/}?"}`,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: "structured",
|
|
25
|
-
line: `{"logId":"7047f560-0bcd-4314-bd42-350372055556","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["URL Forwarding to 'https://echo.zuplo.io/echo'"],"timestamp":"2024-10-30T21:48:30.087Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":3,"url":"http://localhost:9000/echo","method":"PUT","route":"/echo{/}?"}`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: "structured",
|
|
29
|
-
line: `{"logId":"7047f560-0bcd-4314-bd42-350372055556","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["URL Forwarding to 'https://echo.zuplo.io/echo'"],"timestamp":"2024-10-30T21:48:30.087Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":3,"url":"http://localhost:9000/echo","method":"DELETE","route":"/echo{/}?"}`,
|
|
30
|
-
},
|
|
31
|
-
{ type: "raw", line: `Error exporting traces 404 page not found` },
|
|
32
|
-
{ type: "raw", line: `` },
|
|
33
|
-
{
|
|
34
|
-
type: "structured",
|
|
35
|
-
line: `{"logId":"43d05a54-1a53-4e3a-8284-de73cde5c1cf","requestId":"2f07c260-f2d9-45d5-9908-dc54e6bf6ead","rayId":null,"level":"debug","logSource":"request","messages":["URL Forward received response 200 - OK in 66ms"],"timestamp":"2024-10-30T21:48:30.153Z","logOwner":"user","loggingId":"local","buildId":"475a3d75-1873-42dc-9215-46de28f9661b","vectorClock":4,"url":"http://localhost:9000/echo","method":"GET","route":"/echo{/}?"}`,
|
|
36
|
-
},
|
|
37
|
-
{ type: "raw", line: `Error exporting traces 404 page not found` },
|
|
38
|
-
{ type: "raw", line: `` },
|
|
39
|
-
{
|
|
40
|
-
type: "raw",
|
|
41
|
-
line: `Error: this is an unhandled error
|
|
42
|
-
at buildRouteHandler (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:5112:13)
|
|
43
|
-
at file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3819:39
|
|
44
|
-
at file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3799:34
|
|
45
|
-
at AsyncLocalStorageContextManager.with (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:5122:36)
|
|
46
|
-
at _ContextAPI.with (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:797:46)
|
|
47
|
-
at WorkerTracer.startActiveSpan (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:4365:37)
|
|
48
|
-
at file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3797:21
|
|
49
|
-
at nextPipe (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3822:35)
|
|
50
|
-
at metricsProcessor (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:5029:21)
|
|
51
|
-
at nextPipe (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3825:16)`,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
lines.forEach((line) => {
|
|
55
|
-
if (line.type === "structured") {
|
|
56
|
-
const logEntry = JSON.parse(line.line);
|
|
57
|
-
const messages = logEntry.messages;
|
|
58
|
-
messages.forEach((msg) => logStructured(logEntry, msg));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
logConsole("error", line.line);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=worker-output.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.spec.js","sourceRoot":"","sources":["../../src/common/worker-output.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,+dAA+d;KACte;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,kYAAkY;KACzY;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,0dAA0d;KACje;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,0aAA0a;KACjb;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,2aAA2a;KAClb;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,0aAA0a;KACjb;IACD;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,6aAA6a;KACpb;IACD,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,2CAA2C,EAAE;IAClE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;IACzB;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,0aAA0a;KACjb;IACD,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,2CAA2C,EAAE;IAClE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;IACzB;QACE,IAAI,EAAE,KAAK;QACX,IAAI,EAAE;;;;;;;;;;iGAUuF;KAC9F;CACF,CAAC;AAEF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;IACrB,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { logConsole, logStructured } from \"./worker-output.js\";\n\nconst lines = [\n {\n type: \"structured\",\n line: `{\"logId\":\"d5a57adb-4cb8-414b-95ba-7d5490823bde\",\"requestId\":\"b674109a-8519-4c23-a405-916fbcd470d5\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"Request received '/hello'\",{\"method\":\"GET\",\"url\":\"/hello\",\"hostname\":\"localhost\",\"route\":\"/hello\"}],\"timestamp\":\"2024-10-30T21:48:29.945Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":0,\"url\":\"http://localhost:9000/hello\",\"method\":\"GET\",\"route\":\"/hello{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"0bef78e0-0665-4439-9f01-5c698d30c08a\",\"requestId\":\"b674109a-8519-4c23-a405-916fbcd470d5\",\"rayId\":null,\"level\":\"info\",\"logSource\":\"request\",\"messages\":[\"Hello\"],\"timestamp\":\"2024-10-30T21:48:29.982Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":1,\"url\":\"http://localhost:9000/hello\",\"method\":\"GET\",\"route\":\"/hello{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"0af9543a-892d-4e48-b58b-5ac73eec7232\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"Request received '/echo'\",{\"method\":\"GET\",\"url\":\"/echo\",\"hostname\":\"localhost\",\"route\":\"/echo\"}],\"timestamp\":\"2024-10-30T21:48:30.054Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":2,\"url\":\"http://localhost:9000/echo\",\"method\":\"GET\",\"route\":\"/echo{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"7047f560-0bcd-4314-bd42-350372055556\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"URL Forwarding to 'https://echo.zuplo.io/echo'\"],\"timestamp\":\"2024-10-30T21:48:30.087Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":3,\"url\":\"http://localhost:9000/echo\",\"method\":\"GET\",\"route\":\"/echo{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"7047f560-0bcd-4314-bd42-350372055556\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"URL Forwarding to 'https://echo.zuplo.io/echo'\"],\"timestamp\":\"2024-10-30T21:48:30.087Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":3,\"url\":\"http://localhost:9000/echo\",\"method\":\"POST\",\"route\":\"/echo{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"7047f560-0bcd-4314-bd42-350372055556\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"URL Forwarding to 'https://echo.zuplo.io/echo'\"],\"timestamp\":\"2024-10-30T21:48:30.087Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":3,\"url\":\"http://localhost:9000/echo\",\"method\":\"PUT\",\"route\":\"/echo{/}?\"}`,\n },\n {\n type: \"structured\",\n line: `{\"logId\":\"7047f560-0bcd-4314-bd42-350372055556\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"URL Forwarding to 'https://echo.zuplo.io/echo'\"],\"timestamp\":\"2024-10-30T21:48:30.087Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":3,\"url\":\"http://localhost:9000/echo\",\"method\":\"DELETE\",\"route\":\"/echo{/}?\"}`,\n },\n { type: \"raw\", line: `Error exporting traces 404 page not found` },\n { type: \"raw\", line: `` },\n {\n type: \"structured\",\n line: `{\"logId\":\"43d05a54-1a53-4e3a-8284-de73cde5c1cf\",\"requestId\":\"2f07c260-f2d9-45d5-9908-dc54e6bf6ead\",\"rayId\":null,\"level\":\"debug\",\"logSource\":\"request\",\"messages\":[\"URL Forward received response 200 - OK in 66ms\"],\"timestamp\":\"2024-10-30T21:48:30.153Z\",\"logOwner\":\"user\",\"loggingId\":\"local\",\"buildId\":\"475a3d75-1873-42dc-9215-46de28f9661b\",\"vectorClock\":4,\"url\":\"http://localhost:9000/echo\",\"method\":\"GET\",\"route\":\"/echo{/}?\"}`,\n },\n { type: \"raw\", line: `Error exporting traces 404 page not found` },\n { type: \"raw\", line: `` },\n {\n type: \"raw\",\n line: `Error: this is an unhandled error\nat buildRouteHandler (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:5112:13)\nat file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3819:39\nat file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3799:34\nat AsyncLocalStorageContextManager.with (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:5122:36)\nat _ContextAPI.with (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:797:46)\nat WorkerTracer.startActiveSpan (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/worker.js:4365:37)\nat file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3797:21\nat nextPipe (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3822:35)\nat metricsProcessor (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:5029:21)\nat nextPipe (file:///Users/ntotten/zuplo/core/test-fixtures/otel/dist/chunk-UK2CLRIC.js:3825:16)`,\n },\n];\n\nlines.forEach((line) => {\n if (line.type === \"structured\") {\n const logEntry = JSON.parse(line.line);\n const messages = logEntry.messages;\n messages.forEach((msg: any) => logStructured(logEntry, msg));\n } else {\n logConsole(\"error\", line.line);\n }\n});\n"]}
|