@vesk/vesk-cli 0.2.88 → 0.2.89

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.
Files changed (2) hide show
  1. package/dist/cli.js +22 -1
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -51129,6 +51129,15 @@ ${extracted.body}
51129
51129
  " const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
51130
51130
  " return new Response(null, { status: 302, headers: { Location: target } });",
51131
51131
  " }",
51132
+ " // Any other TypeError from the middleware (e.g. reading a property of",
51133
+ " // `undefined` like `ctx.cookies[SESSION_COOKIE]` when `ctx.cookies` is",
51134
+ " // missing) must not crash the server. On serverless platforms (Vercel,",
51135
+ " // Netlify, Cloudflare) an uncaught throw surfaces as",
51136
+ " // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
51137
+ " // points the same way. Return a 500 instead.",
51138
+ " if (e instanceof TypeError) {",
51139
+ " return new Response(null, { status: 500 });",
51140
+ " }",
51132
51141
  " throw e;",
51133
51142
  " }",
51134
51143
  " }",
@@ -51200,6 +51209,15 @@ ${extracted.body}
51200
51209
  " const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
51201
51210
  " return new Response(null, { status: 302, headers: { Location: target } });",
51202
51211
  " }",
51212
+ " // Any other TypeError from the middleware (e.g. reading a property of",
51213
+ " // `undefined` like `ctx.cookies[SESSION_COOKIE]` when `ctx.cookies` is",
51214
+ " // missing) must not crash the server. On serverless platforms (Vercel,",
51215
+ " // Netlify, Cloudflare) an uncaught throw surfaces as",
51216
+ " // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
51217
+ " // points the same way. Return a 500 instead.",
51218
+ " if (e instanceof TypeError) {",
51219
+ " return new Response(null, { status: 500 });",
51220
+ " }",
51203
51221
  " throw e;",
51204
51222
  " }",
51205
51223
  " }",
@@ -58309,7 +58327,7 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
58309
58327
  const url = new URL(request.url, "http://localhost");
58310
58328
  const serverStore = globalThis.__vesk_server_ctx;
58311
58329
  const locals2 = Object.assign({}, serverStore || {});
58312
- const cookies2 = parseCookies2(request.headers?.get("cookie") || "");
58330
+ const cookies2 = parseCookies2(request.headers?.get("cookie") || "") || {};
58313
58331
  const ctx2 = new Proxy({
58314
58332
  request,
58315
58333
  params,
@@ -58417,6 +58435,9 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
58417
58435
  const target = /Failed to parse URL from (\S+)/.exec(String(e.message))?.[1] ?? "";
58418
58436
  return new Response(null, { status: 302, headers: { Location: target } });
58419
58437
  }
58438
+ if (e instanceof TypeError) {
58439
+ return new Response(null, { status: 500 });
58440
+ }
58420
58441
  throw e;
58421
58442
  }
58422
58443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.88",
3
+ "version": "0.2.89",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.88",
12
- "@vesk/compiler": "^0.2.88",
13
- "@vesk/plugin-tailwind": "^0.2.88",
14
- "@vesk/runtime": "^0.2.88",
11
+ "@vesk/adapter": "^0.2.89",
12
+ "@vesk/compiler": "^0.2.89",
13
+ "@vesk/plugin-tailwind": "^0.2.89",
14
+ "@vesk/runtime": "^0.2.89",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",