@vesk/vesk-cli 0.2.88 → 0.2.90

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 +27 -1
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -34850,6 +34850,11 @@ function bodyNeedsRuntimeCells(nodes) {
34850
34850
  return false;
34851
34851
  }
34852
34852
  function buildComponentEntries(irRoot) {
34853
+ for (const name of ["redirect", "permanentRedirect", "notFound"]) {
34854
+ if (!irRoot.imports.includes(`import { ${name} } from '@vesk/runtime';`)) {
34855
+ irRoot.imports.push(`import { ${name} } from '@vesk/runtime';`);
34856
+ }
34857
+ }
34853
34858
  const runtimeNames = extractRuntimeNames(irRoot.imports);
34854
34859
  const localValueNames = localValueImportNames(irRoot.imports);
34855
34860
  const topNames = extractTopLevelNames(irRoot.topLevelCode);
@@ -51129,6 +51134,15 @@ ${extracted.body}
51129
51134
  " const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
51130
51135
  " return new Response(null, { status: 302, headers: { Location: target } });",
51131
51136
  " }",
51137
+ " // Any other TypeError from the middleware (e.g. reading a property of",
51138
+ " // `undefined` like `ctx.cookies[SESSION_COOKIE]` when `ctx.cookies` is",
51139
+ " // missing) must not crash the server. On serverless platforms (Vercel,",
51140
+ " // Netlify, Cloudflare) an uncaught throw surfaces as",
51141
+ " // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
51142
+ " // points the same way. Return a 500 instead.",
51143
+ " if (e instanceof TypeError) {",
51144
+ " return new Response(null, { status: 500 });",
51145
+ " }",
51132
51146
  " throw e;",
51133
51147
  " }",
51134
51148
  " }",
@@ -51200,6 +51214,15 @@ ${extracted.body}
51200
51214
  " const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
51201
51215
  " return new Response(null, { status: 302, headers: { Location: target } });",
51202
51216
  " }",
51217
+ " // Any other TypeError from the middleware (e.g. reading a property of",
51218
+ " // `undefined` like `ctx.cookies[SESSION_COOKIE]` when `ctx.cookies` is",
51219
+ " // missing) must not crash the server. On serverless platforms (Vercel,",
51220
+ " // Netlify, Cloudflare) an uncaught throw surfaces as",
51221
+ " // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
51222
+ " // points the same way. Return a 500 instead.",
51223
+ " if (e instanceof TypeError) {",
51224
+ " return new Response(null, { status: 500 });",
51225
+ " }",
51203
51226
  " throw e;",
51204
51227
  " }",
51205
51228
  " }",
@@ -58309,7 +58332,7 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
58309
58332
  const url = new URL(request.url, "http://localhost");
58310
58333
  const serverStore = globalThis.__vesk_server_ctx;
58311
58334
  const locals2 = Object.assign({}, serverStore || {});
58312
- const cookies2 = parseCookies2(request.headers?.get("cookie") || "");
58335
+ const cookies2 = parseCookies2(request.headers?.get("cookie") || "") || {};
58313
58336
  const ctx2 = new Proxy({
58314
58337
  request,
58315
58338
  params,
@@ -58417,6 +58440,9 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
58417
58440
  const target = /Failed to parse URL from (\S+)/.exec(String(e.message))?.[1] ?? "";
58418
58441
  return new Response(null, { status: 302, headers: { Location: target } });
58419
58442
  }
58443
+ if (e instanceof TypeError) {
58444
+ return new Response(null, { status: 500 });
58445
+ }
58420
58446
  throw e;
58421
58447
  }
58422
58448
  }
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.90",
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.90",
12
+ "@vesk/compiler": "^0.2.90",
13
+ "@vesk/plugin-tailwind": "^0.2.90",
14
+ "@vesk/runtime": "^0.2.90",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",