@vesk/vesk-cli 0.2.87 → 0.2.88
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/cli.js +83 -15
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -37523,9 +37523,10 @@ function __matchPath(pattern, pathname) {
|
|
|
37523
37523
|
}
|
|
37524
37524
|
|
|
37525
37525
|
export async function handleRequest(request) {
|
|
37526
|
-
|
|
37527
|
-
|
|
37528
|
-
|
|
37526
|
+
try {
|
|
37527
|
+
const url = new URL(request.url);
|
|
37528
|
+
const pathname = url.pathname;
|
|
37529
|
+
const isDataRequest = request.headers.get('x-vesk-data') === '1';
|
|
37529
37530
|
${serverStoreLine}
|
|
37530
37531
|
|
|
37531
37532
|
if (__prerendered.has(pathname) && !isDataRequest) {
|
|
@@ -37620,6 +37621,17 @@ ${eventsRequestLine}
|
|
|
37620
37621
|
status: 404,
|
|
37621
37622
|
headers: { 'Content-Type': 'text/html' },
|
|
37622
37623
|
});
|
|
37624
|
+
} catch (e) {
|
|
37625
|
+
// Any error that escapes the route (a thrown exception, a bad import, a
|
|
37626
|
+
// middleware failure, ...) must not bubble out of handleRequest. On
|
|
37627
|
+
// serverless platforms (Vercel, Netlify, Cloudflare) an uncaught throw is
|
|
37628
|
+
// surfaced as FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping
|
|
37629
|
+
// its entry points the same way. Convert it into a proper 500 response.
|
|
37630
|
+
return new Response(renderDefaultErrorPage({ url: request.url }), {
|
|
37631
|
+
status: 500,
|
|
37632
|
+
headers: { 'Content-Type': 'text/html' },
|
|
37633
|
+
});
|
|
37634
|
+
}
|
|
37623
37635
|
}
|
|
37624
37636
|
`;
|
|
37625
37637
|
}
|
|
@@ -51097,13 +51109,39 @@ ${extracted.body}
|
|
|
51097
51109
|
" nextResult = await run(index + 1);",
|
|
51098
51110
|
" return nextResult;",
|
|
51099
51111
|
" }",
|
|
51100
|
-
"
|
|
51101
|
-
"
|
|
51102
|
-
"
|
|
51103
|
-
"
|
|
51104
|
-
"
|
|
51112
|
+
" try {",
|
|
51113
|
+
" const result = await fn(ctx, next);",
|
|
51114
|
+
" if (result instanceof Response) return result;",
|
|
51115
|
+
" if (nextResult instanceof Response) return nextResult;",
|
|
51116
|
+
" if (!nextCalled) return run(index + 1);",
|
|
51117
|
+
" return null;",
|
|
51118
|
+
" } catch (e) {",
|
|
51119
|
+
" if (e && typeof e === 'object' && e.name === 'Redirect') {",
|
|
51120
|
+
" return new Response(null, {",
|
|
51121
|
+
" status: Number(e.status) || 302,",
|
|
51122
|
+
" headers: { Location: String(e.url || '') },",
|
|
51123
|
+
" });",
|
|
51124
|
+
" }",
|
|
51125
|
+
" if (e instanceof TypeError && /Failed to parse URL from/.test(String(e.message))) {",
|
|
51126
|
+
" const msg = String(e.message);",
|
|
51127
|
+
" const prefix = 'Failed to parse URL from ';",
|
|
51128
|
+
" const start = msg.indexOf(prefix);",
|
|
51129
|
+
" const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
|
|
51130
|
+
" return new Response(null, { status: 302, headers: { Location: target } });",
|
|
51131
|
+
" }",
|
|
51132
|
+
" throw e;",
|
|
51133
|
+
" }",
|
|
51134
|
+
" }",
|
|
51135
|
+
" let response = null;",
|
|
51136
|
+
" try {",
|
|
51137
|
+
" response = await run(0);",
|
|
51138
|
+
" } catch (e) {",
|
|
51139
|
+
" // Unexpected middleware errors must not crash the server. On serverless",
|
|
51140
|
+
" // platforms (Vercel, Netlify, Cloudflare) an uncaught throw surfaces as",
|
|
51141
|
+
" // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
|
|
51142
|
+
" // points the same way. Convert it into a 500 response.",
|
|
51143
|
+
" response = new Response(null, { status: 500 });",
|
|
51105
51144
|
" }",
|
|
51106
|
-
" const response = await run(0);",
|
|
51107
51145
|
" return { response, rewriteUrl };",
|
|
51108
51146
|
"}",
|
|
51109
51147
|
""
|
|
@@ -51142,13 +51180,39 @@ ${extracted.body}
|
|
|
51142
51180
|
" ncResult = await run(index + 1);",
|
|
51143
51181
|
" return ncResult;",
|
|
51144
51182
|
" }",
|
|
51145
|
-
"
|
|
51146
|
-
"
|
|
51147
|
-
"
|
|
51148
|
-
"
|
|
51149
|
-
"
|
|
51183
|
+
" try {",
|
|
51184
|
+
" const result = await fn(ctx, next);",
|
|
51185
|
+
" if (result instanceof Response) return result;",
|
|
51186
|
+
" if (ncResult instanceof Response) return ncResult;",
|
|
51187
|
+
" if (!nc) return run(index + 1);",
|
|
51188
|
+
" return null;",
|
|
51189
|
+
" } catch (e) {",
|
|
51190
|
+
" if (e && typeof e === 'object' && e.name === 'Redirect') {",
|
|
51191
|
+
" return new Response(null, {",
|
|
51192
|
+
" status: Number(e.status) || 302,",
|
|
51193
|
+
" headers: { Location: String(e.url || '') },",
|
|
51194
|
+
" });",
|
|
51195
|
+
" }",
|
|
51196
|
+
" if (e instanceof TypeError && /Failed to parse URL from/.test(String(e.message))) {",
|
|
51197
|
+
" const msg = String(e.message);",
|
|
51198
|
+
" const prefix = 'Failed to parse URL from ';",
|
|
51199
|
+
" const start = msg.indexOf(prefix);",
|
|
51200
|
+
" const target = start === -1 ? '' : msg.slice(start + prefix.length).trim().split(' ')[0];",
|
|
51201
|
+
" return new Response(null, { status: 302, headers: { Location: target } });",
|
|
51202
|
+
" }",
|
|
51203
|
+
" throw e;",
|
|
51204
|
+
" }",
|
|
51205
|
+
" }",
|
|
51206
|
+
" let response = null;",
|
|
51207
|
+
" try {",
|
|
51208
|
+
" response = await run(0);",
|
|
51209
|
+
" } catch (e) {",
|
|
51210
|
+
" // Unexpected middleware errors must not crash the server. On serverless",
|
|
51211
|
+
" // platforms (Vercel, Netlify, Cloudflare) an uncaught throw surfaces as",
|
|
51212
|
+
" // FUNCTION_INVOCATION_FAILED \u2014 Next.js avoids this by wrapping entry",
|
|
51213
|
+
" // points the same way. Convert it into a 500 response.",
|
|
51214
|
+
" response = new Response(null, { status: 500 });",
|
|
51150
51215
|
" }",
|
|
51151
|
-
" const response = await run(0);",
|
|
51152
51216
|
" return { response, rewriteUrl };",
|
|
51153
51217
|
"}",
|
|
51154
51218
|
""
|
|
@@ -58349,6 +58413,10 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
|
|
|
58349
58413
|
headers: { Location: err.url || "" }
|
|
58350
58414
|
});
|
|
58351
58415
|
}
|
|
58416
|
+
if (e instanceof TypeError && /Failed to parse URL from/.test(String(e.message))) {
|
|
58417
|
+
const target = /Failed to parse URL from (\S+)/.exec(String(e.message))?.[1] ?? "";
|
|
58418
|
+
return new Response(null, { status: 302, headers: { Location: target } });
|
|
58419
|
+
}
|
|
58352
58420
|
throw e;
|
|
58353
58421
|
}
|
|
58354
58422
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.88",
|
|
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.
|
|
12
|
-
"@vesk/compiler": "^0.2.
|
|
13
|
-
"@vesk/plugin-tailwind": "^0.2.
|
|
14
|
-
"@vesk/runtime": "^0.2.
|
|
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",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|