vike-lite 1.16.0 → 1.16.1
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/vite.mjs +10 -4
- package/package.json +2 -2
package/dist/vite.mjs
CHANGED
|
@@ -389,15 +389,21 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
389
389
|
for (const [key, value] of response.headers) if (key.toLowerCase() !== "set-cookie") res.setHeader(key, value);
|
|
390
390
|
const cookies = response.headers.getSetCookie();
|
|
391
391
|
if (cookies.length > 0) res.setHeader("Set-Cookie", cookies);
|
|
392
|
+
async function safeCancelBody(body) {
|
|
393
|
+
if (!body || body.locked) return;
|
|
394
|
+
try {
|
|
395
|
+
await body.cancel();
|
|
396
|
+
} catch {}
|
|
397
|
+
}
|
|
392
398
|
if (response.headers.get("content-type")?.includes("text/html")) {
|
|
393
399
|
res.removeHeader("content-length");
|
|
394
400
|
server.config.logger.info(`📄 Page: ${req.url}`, { timestamp: true });
|
|
395
401
|
if (req.method === "HEAD" || !response.body) {
|
|
396
|
-
await response.body
|
|
402
|
+
await safeCancelBody(response.body);
|
|
397
403
|
return res.end();
|
|
398
404
|
}
|
|
399
405
|
if (res.destroyed || res.closed) {
|
|
400
|
-
await response.body
|
|
406
|
+
await safeCancelBody(response.body);
|
|
401
407
|
return;
|
|
402
408
|
}
|
|
403
409
|
let headBuffered = "";
|
|
@@ -435,12 +441,12 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
435
441
|
return;
|
|
436
442
|
}
|
|
437
443
|
if (req.method === "HEAD" || !response.body) {
|
|
438
|
-
await response.body
|
|
444
|
+
await safeCancelBody(response.body);
|
|
439
445
|
if (!res.destroyed && !res.closed) res.end();
|
|
440
446
|
return;
|
|
441
447
|
}
|
|
442
448
|
if (res.destroyed || res.closed) {
|
|
443
|
-
await response.body
|
|
449
|
+
await safeCancelBody(response.body);
|
|
444
450
|
return;
|
|
445
451
|
}
|
|
446
452
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike-lite",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/node": "^26.1.1",
|
|
85
|
-
"tsdown": "^0.22.
|
|
85
|
+
"tsdown": "^0.22.13",
|
|
86
86
|
"vite": "^8.1.5",
|
|
87
87
|
"vitest": "^4.1.10"
|
|
88
88
|
},
|