@zuplo/cli 6.59.44 → 6.59.47
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/cmds/dev.d.ts.map +1 -1
- package/dist/cmds/dev.js +6 -0
- package/dist/cmds/dev.js.map +1 -1
- package/dist/common/worker-output.d.ts.map +1 -1
- package/dist/common/worker-output.js +4 -1
- package/dist/common/worker-output.js.map +1 -1
- package/dist/dev/handler.d.ts +1 -0
- package/dist/dev/handler.d.ts.map +1 -1
- package/dist/dev/handler.js +2 -1
- package/dist/dev/handler.js.map +1 -1
- package/package.json +4 -4
package/dist/cmds/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cmds/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAWV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAwCf,OAAO;;AA3C/B,wBAwDE"}
|
package/dist/cmds/dev.js
CHANGED
|
@@ -34,6 +34,11 @@ export default {
|
|
|
34
34
|
.option("debug-port", {
|
|
35
35
|
type: "number",
|
|
36
36
|
describe: "The port to run the Chrome inspector on",
|
|
37
|
+
})
|
|
38
|
+
.option("unsafely-ignore-certificate-errors", {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
describe: "Unsafely ignore certificate errors",
|
|
41
|
+
default: false,
|
|
37
42
|
})
|
|
38
43
|
.middleware([setBlocking, identify])
|
|
39
44
|
.check(async (argv) => {
|
|
@@ -45,6 +50,7 @@ export default {
|
|
|
45
50
|
argv,
|
|
46
51
|
properties: {
|
|
47
52
|
"debug-port": argv["debugPort"],
|
|
53
|
+
"unsafely-ignore-certificate-errors": argv["unsafelyIgnoreCertificateErrors"],
|
|
48
54
|
},
|
|
49
55
|
event: "zuplo dev",
|
|
50
56
|
});
|
package/dist/cmds/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/cmds/dev.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;AAC3D,OAAO,EAAa,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAe;IACb,IAAI,EAAE,4BAA4B;IAClC,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,MAAM,CAAC,KAAK,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;YACnD,OAAO,EAAE,GAAG;YACZ,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;SACb,CAAC;aACD,MAAM,CAAC,cAAc,EAAE;YACtB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,wCAAwC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,qCAAqC;YAC/C,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,aAAa,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,YAAY,EAAE;YACpB,IAAI,EAA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E;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,qCAAqC;YAC/C,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,aAAa,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,uCAAuC;YACjD,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,YAAY,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,yCAAyC;SACpD,CAAC;aACD,MAAM,CAAC,oCAAoC,EAAE;YAC5C,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,oCAAoC;YAC9C,OAAO,EAAE,KAAK;SACf,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;YACjB,IAAI;YACJ,UAAU,EAAE;gBACV,YAAY,EAAG,IAAkB,CAAC,WAAW,CAAC;gBAC9C,oCAAoC,EAAG,IAAkB,CACvD,iCAAiC,CAClC;aACF;YACD,KAAK,EAAE,WAAW;SACnB,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,IAAiB,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\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\";\nimport { Arguments, dev } from \"../dev/handler.js\";\n\nexport default {\n desc: \"Runs the Zuplo API locally\",\n command: \"dev\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .option(\"dir\", {\n type: \"string\",\n describe: \"The directory containing your Zuplo API\",\n default: \".\",\n normalize: true,\n hidden: true,\n })\n .option(\"start-editor\", {\n type: \"boolean\",\n describe: \"Start the editor with the local server\",\n default: true,\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"The port to run the local server on\",\n default: 9000,\n })\n .option(\"editor-port\", {\n type: \"number\",\n describe: \"The port to run the route designer on\",\n default: 9100,\n })\n .option(\"debug-port\", {\n type: \"number\",\n describe: \"The port to run the Chrome inspector on\",\n })\n .option(\"unsafely-ignore-certificate-errors\", {\n type: \"boolean\",\n describe: \"Unsafely ignore certificate errors\",\n default: false,\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({\n argv,\n properties: {\n \"debug-port\": (argv as Arguments)[\"debugPort\"],\n \"unsafely-ignore-certificate-errors\": (argv as Arguments)[\n \"unsafelyIgnoreCertificateErrors\"\n ],\n },\n event: \"zuplo dev\",\n });\n await dev(argv as Arguments);\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.d.ts","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAiC,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"worker-output.d.ts","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAiC,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAO1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,QA2JpE;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,5 +1,8 @@
|
|
|
1
1
|
import { LogFormatter } from "@zuplo/core/cli";
|
|
2
|
-
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
const logFormatter = new LogFormatter(async (path) => {
|
|
4
|
+
return readFile(path, { encoding: "utf8" });
|
|
5
|
+
});
|
|
3
6
|
export function handleRuntimeStdio(stdout, stderr) {
|
|
4
7
|
const classifiers = {
|
|
5
8
|
isBarf(chunk) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-output.js","sourceRoot":"","sources":["../../src/common/worker-output.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE1E,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,OAAO,KAAK,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAC;QACjE,CAAC;QACD,SAAS,CAAC,KAAa;YACrB,OAAO,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QA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ter, LogLevel } from \"@zuplo/core/cli\";\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 isZenoLog(chunk: string) {\n return chunk.startsWith(\"[ZENO]:\");\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 } else if (classifiers.isZenoLog(chunk)) {\n // Route to the specified logging level\n const levels = [\"debug\", \"info\", \"warn\", \"error\"];\n const level = levels.find((level) =>\n chunk.includes(`[${level.toUpperCase()}]`)\n );\n // Strip the prefixes for zeno and the zeno logging level\n chunk = chunk.substring(\"[ZENO]:\".length);\n chunk = chunk.substring(`[${level?.toUpperCase()}]`.length);\n if (level) {\n logConsole(level as LogLevel, chunk);\n } else {\n logConsole(\"info\", chunk);\n }\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 // Handle Zeno error logs\n else if (classifiers.isZenoLog(chunk)) {\n // Strip the prefixes\n chunk = chunk.substring(\"[ZENO]:\".length);\n chunk = chunk.substring(\"[ERROR]\".length);\n logConsole(\"error\", chunk);\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 {\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 {\n const line = logFormatter.formatLine(level, data);\n\n console[level](line);\n }\n}\n"]}
|
|
1
|
+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SAAS,EAAE,CAAC,CAAC,CAChE,CAAC;oBACF,OAAO;gBACT,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC;YACH,CAAC;YACD,MAAM,OAAO,CAAC,GAAG,CACf,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBAClC,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBAChE,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,MAAM,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAEpD,MAAM,IAAI,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACrD,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,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 { Readable } from \"node:stream\";\nimport { ConsoleLogEntry, LogFormatter, LogLevel } from \"@zuplo/core/cli\";\nimport { readFile } from \"node:fs/promises\";\n\nconst logFormatter = new LogFormatter(async (path: string) => {\n return readFile(path, { encoding: \"utf8\" });\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 isZenoLog(chunk: string) {\n return chunk.startsWith(\"[ZENO]:\");\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 } else if (classifiers.isZenoLog(chunk)) {\n // Route to the specified logging level\n const levels = [\"debug\", \"info\", \"warn\", \"error\"];\n const level = levels.find((level) =>\n chunk.includes(`[${level.toUpperCase()}]`)\n );\n // Strip the prefixes for zeno and the zeno logging level\n chunk = chunk.substring(\"[ZENO]:\".length);\n chunk = chunk.substring(`[${level?.toUpperCase()}]`.length);\n if (level) {\n logConsole(level as LogLevel, chunk);\n } else {\n logConsole(\"info\", chunk);\n }\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 // Handle Zeno error logs\n else if (classifiers.isZenoLog(chunk)) {\n // Strip the prefixes\n chunk = chunk.substring(\"[ZENO]:\".length);\n chunk = chunk.substring(\"[ERROR]\".length);\n logConsole(\"error\", chunk);\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 {\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 {\n const line = logFormatter.formatLine(level, data);\n\n console[level](line);\n }\n}\n"]}
|
package/dist/dev/handler.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/dev/handler.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/dev/handler.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B,CAAC,EAAE,OAAO,CAAC;CAC3C;AAED,wBAAsB,GAAG,CAAC,IAAI,EAAE,SAAS,iBAiKxC"}
|
package/dist/dev/handler.js
CHANGED
|
@@ -56,7 +56,8 @@ export async function dev(argv) {
|
|
|
56
56
|
output: new ConsoleOutput(),
|
|
57
57
|
sourceDirectory,
|
|
58
58
|
port: zupPort,
|
|
59
|
-
debugPort: argv.debugPort
|
|
59
|
+
debugPort: argv.debugPort,
|
|
60
|
+
unsafelyIgnoreCertificateErrors: argv.unsafelyIgnoreCertificateErrors,
|
|
60
61
|
publicZuploEnvironmentVariables: envZuplo
|
|
61
62
|
? {
|
|
62
63
|
ZUPLO_ACCOUNT_NAME: envZuplo.ZUPLO_ACCOUNT_NAME,
|
package/dist/dev/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/dev/handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAA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AAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable node/no-process-env */\n\nimport { randomUUID } from \"node:crypto\";\nimport { cpSync, existsSync, readFileSync } from \"node:fs\";\nimport { join, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport dotenv from \"dotenv\";\nimport { logger } from \"../common/logger.js\";\nimport {\n ConsoleOutput,\n printCriticalFailureToConsoleAndExit,\n printDiagnosticsToConsole,\n} from \"../common/output.js\";\nimport { isPortAvailable } from \"../common/utils/ports.js\";\nimport { handleRuntimeStdio } from \"../common/worker-output.js\";\nimport { ApiServer } from \"../editor/server/server.js\";\n\nexport interface Arguments {\n dir: string;\n \"start-editor\": boolean;\n port: number;\n editorPort: number;\n debugPort?: number;\n unsafelyIgnoreCertificateErrors?: boolean;\n}\n\nexport async function dev(argv: Arguments) {\n const sourceDirectory = resolve(join(relative(process.cwd(), argv.dir)));\n\n // When we build, we MIGHT need to use the @zuplo/runtime from the node_modules if the user\n // has installed our packages using https://www.npmjs.com/package/zuplo in a global directory\n\n // Try to copy the @zuplo/runtime locally\n const zuploRuntimePath = new URL(\n \"../../node_modules/@zuplo/runtime\",\n import.meta.url\n );\n if (existsSync(zuploRuntimePath)) {\n cpSync(\n zuploRuntimePath,\n join(sourceDirectory, \"node_modules/@zuplo/runtime\"),\n {\n recursive: true,\n dereference: true,\n }\n );\n }\n\n // Set GLOBAL_MODULE_LOCATION to the location of the CLIs node_modules\n process.env.GLOBAL_MODULE_LOCATION = fileURLToPath(\n new URL(\"../../node_modules\", import.meta.url)\n );\n\n const loadedEnvFiles: string[] = [];\n\n // Check if the user has a .env file\n const envFile = join(sourceDirectory, \".env\");\n if (existsSync(envFile)) {\n loadedEnvFiles.push(\".env\");\n }\n\n // Check if the user has a .env.zuplo file\n let envZuplo: dotenv.DotenvParseOutput | undefined;\n const envZuploFile = join(sourceDirectory, \".env.zuplo\");\n if (existsSync(envZuploFile)) {\n const contents = readFileSync(envZuploFile);\n envZuplo = dotenv.parse(contents);\n loadedEnvFiles.push(\".env.zuplo\");\n }\n\n // Set other variables using __ZUPLO_CONFIG as necessary\n // const config = {\n // };\n // process.env.__ZUPLO_CONFIG = btoa(JSON.stringify(config));\n process.env.ZUPLO_IS_LOCAL_DEVELOPMENT = \"true\";\n\n // Use a dynamic import so that setting process.env has effect\n const core = await import(\"@zuplo/core/cli\");\n\n const zupPort = argv.port;\n const zupEditorPort = argv.editorPort;\n const zupDebugPort = argv.debugPort;\n\n const isZupPortAvailable = await isPortAvailable(\"localhost\", zupPort);\n if (!isZupPortAvailable) {\n await printCriticalFailureToConsoleAndExit(\n `Port ${zupPort} is already in use. Please specify a different port using --port.`\n );\n }\n\n const isZupEditorPortAvailable = await isPortAvailable(\n \"localhost\",\n zupEditorPort\n );\n if (!isZupEditorPortAvailable) {\n await printCriticalFailureToConsoleAndExit(\n `Port ${zupEditorPort} is already in use. Please specify a different port using --editor-port.`\n );\n }\n\n if (zupDebugPort) {\n const isZupDebugPortAvailable = await isPortAvailable(\n \"localhost\",\n zupDebugPort\n );\n if (!isZupDebugPortAvailable) {\n await printCriticalFailureToConsoleAndExit(\n `Port ${zupDebugPort} is already in use. Please specify a different port using --debug-port.`\n );\n }\n }\n\n const buildId = randomUUID();\n\n let firstLoad = true;\n\n await core.startDevServer({\n buildId,\n output: new ConsoleOutput(),\n sourceDirectory,\n port: zupPort,\n debugPort: argv.debugPort,\n unsafelyIgnoreCertificateErrors: argv.unsafelyIgnoreCertificateErrors,\n publicZuploEnvironmentVariables: envZuplo\n ? {\n ZUPLO_ACCOUNT_NAME: envZuplo.ZUPLO_ACCOUNT_NAME,\n ZUPLO_PROJECT_NAME: envZuplo.ZUPLO_PROJECT_NAME,\n ZUPLO_ENVIRONMENT_TYPE: envZuplo.ZUPLO_ENVIRONMENT_TYPE,\n }\n : // Leave this as undefined to simulate the old behavior\n undefined,\n logger,\n handleRuntimeStdio,\n onReload: () => {\n if (firstLoad) {\n firstLoad = false;\n } else {\n printDiagnosticsToConsole(\"Code changed. Server reloaded...\");\n }\n },\n });\n\n let editor: ApiServer;\n\n if (argv[\"start-editor\"]) {\n editor = new ApiServer({\n cliArgs: argv,\n workingDir: sourceDirectory,\n port: argv.editorPort,\n isStandalone: false,\n });\n editor.start().catch((err) => logger.error(err));\n }\n\n printDiagnosticsToConsole(\"Started local development setup\");\n printDiagnosticsToConsole(\"Ctrl+C to exit\");\n printDiagnosticsToConsole(\"\");\n printDiagnosticsToConsole(`🚀 Zuplo Gateway: http://localhost:${zupPort}`);\n if (argv[\"start-editor\"]) {\n printDiagnosticsToConsole(\n `📘 Route Designer: http://localhost:${argv.editorPort}`\n );\n }\n if (loadedEnvFiles.length > 0) {\n printDiagnosticsToConsole(\n `⚙️ Loaded env files: \\n - ${loadedEnvFiles.join(\" \\n - \")}`\n );\n }\n printDiagnosticsToConsole(\"\");\n printDiagnosticsToConsole(\"\");\n\n return new Promise<void>((resolve) => {\n async function exit() {\n printDiagnosticsToConsole(\"\");\n printDiagnosticsToConsole(\"Stopping local development server...\");\n\n if (argv[\"start-editor\"]) {\n await editor.close();\n }\n resolve();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n process.on(\"SIGTERM\", exit);\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n process.on(\"SIGINT\", exit);\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "6.59.
|
|
3
|
+
"version": "6.59.47",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@opentelemetry/api": "1.9.0",
|
|
30
30
|
"@sentry/node": "9.22.0",
|
|
31
31
|
"@swc/core": "1.10.18",
|
|
32
|
-
"@zuplo/core": "6.59.
|
|
33
|
-
"@zuplo/openapi-tools": "6.59.
|
|
34
|
-
"@zuplo/runtime": "6.59.
|
|
32
|
+
"@zuplo/core": "6.59.47",
|
|
33
|
+
"@zuplo/openapi-tools": "6.59.47",
|
|
34
|
+
"@zuplo/runtime": "6.59.47",
|
|
35
35
|
"as-table": "1.0.55",
|
|
36
36
|
"chalk": "5.4.1",
|
|
37
37
|
"chokidar": "3.5.3",
|