@edgeone/nuxt-pages 1.0.7 → 1.0.9
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/build/plugin-context.js +1 -1
- package/dist/build/routes.js +1 -1
- package/dist/build/templates/nuxt-handler-monorepo.tmpl.js +28 -1
- package/dist/esm-chunks/{chunk-ZYJTEPF7.js → chunk-3BGGEHKE.js} +2 -1
- package/dist/esm-chunks/{chunk-VCO654TD.js → chunk-ABEHWNBD.js} +7 -2
- package/dist/index.js +6 -6
- package/dist/run/handlers/cache.cjs +1 -1
- package/dist/run/handlers/tags-handler.cjs +1 -1
- package/dist/run/handlers/use-cache-handler.js +1 -1
- package/package.json +1 -1
package/dist/build/routes.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
convertNuxtRoutePattern,
|
|
9
9
|
createNuxtApiRoutesMeta,
|
|
10
10
|
createNuxtPagesRouteMeta
|
|
11
|
-
} from "../esm-chunks/chunk-
|
|
11
|
+
} from "../esm-chunks/chunk-ABEHWNBD.js";
|
|
12
12
|
import "../esm-chunks/chunk-5VJRCUAW.js";
|
|
13
13
|
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
14
14
|
export {
|
|
@@ -204,9 +204,36 @@ export default async function handler(req, res, context) {
|
|
|
204
204
|
body
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
+
// 正确处理 headers,特别是多个 set-cookie 的情况
|
|
208
|
+
const responseHeaders = new Headers();
|
|
209
|
+
|
|
210
|
+
// 如果 response.headers 是 Headers 对象,直接复制
|
|
211
|
+
if (response.headers instanceof Headers) {
|
|
212
|
+
response.headers.forEach((value, key) => {
|
|
213
|
+
responseHeaders.append(key, value);
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
// 如果是普通对象,需要特殊处理 set-cookie 数组
|
|
217
|
+
for (const [key, value] of Object.entries(response.headers)) {
|
|
218
|
+
const lowerKey = key.toLowerCase();
|
|
219
|
+
|
|
220
|
+
// set-cookie 是特殊 header,可以有多个值
|
|
221
|
+
if (lowerKey === 'set-cookie' && Array.isArray(value)) {
|
|
222
|
+
// 为每个 cookie 单独添加
|
|
223
|
+
value.forEach(cookie => {
|
|
224
|
+
responseHeaders.append('Set-Cookie', cookie);
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
// 其他 header 直接设置
|
|
228
|
+
responseHeaders.set(key, Array.isArray(value) ? value.join(', ') : value);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// console.log('responseHeaders.getSetCookie() --->', responseHeaders.getSetCookie());
|
|
207
234
|
return new Response(response.body, {
|
|
208
235
|
status: response.status || response.statusCode,
|
|
209
|
-
headers:
|
|
236
|
+
headers: responseHeaders
|
|
210
237
|
});
|
|
211
238
|
} catch (nitroError) {
|
|
212
239
|
// Handle Nitro static file read errors (prerender files not found)
|
|
@@ -425,7 +425,8 @@ var PluginContext = class {
|
|
|
425
425
|
const serverRoutes = getRoutesArrayWithAST(await this.getNuxtServerFile() || "");
|
|
426
426
|
serverRoutes.forEach((item) => {
|
|
427
427
|
const keys = result.map((obj) => obj.path);
|
|
428
|
-
|
|
428
|
+
const pathWithoutBracket = item.path.replace(/\[|\]$/g, "").replace(/\(|\)$/g, "");
|
|
429
|
+
if (!keys.includes(pathWithoutBracket)) {
|
|
429
430
|
if (nitroPrerenderRoutes.includes(item.path)) {
|
|
430
431
|
result.push({
|
|
431
432
|
path: item.path,
|
|
@@ -196,8 +196,10 @@ var createNuxtApiRoutesMeta = async (ctx) => {
|
|
|
196
196
|
route.path = route.path.replace(/\(/g, "").replace(/\)/g, "");
|
|
197
197
|
return route;
|
|
198
198
|
});
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
let staticAllIndex = -1;
|
|
200
|
+
processedRoutes = processedRoutes.map((route, index) => {
|
|
201
|
+
if (route.path.startsWith("/:") && route.path.endsWith("*")) {
|
|
202
|
+
staticAllIndex = index;
|
|
201
203
|
if (route.hasOwnProperty("isStatic")) {
|
|
202
204
|
route.isStatic = true;
|
|
203
205
|
} else {
|
|
@@ -210,6 +212,9 @@ var createNuxtApiRoutesMeta = async (ctx) => {
|
|
|
210
212
|
}
|
|
211
213
|
return route;
|
|
212
214
|
});
|
|
215
|
+
if (staticAllIndex !== -1) {
|
|
216
|
+
[processedRoutes[staticAllIndex], processedRoutes[processedRoutes.length - 1]] = [processedRoutes[processedRoutes.length - 1], processedRoutes[staticAllIndex]];
|
|
217
|
+
}
|
|
213
218
|
const finalMetaData = {
|
|
214
219
|
frameworkRoutes: processedRoutes,
|
|
215
220
|
conf: {
|
package/dist/index.js
CHANGED
|
@@ -4,23 +4,23 @@
|
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
|
+
import {
|
|
8
|
+
addNitroBuildOutputConfig,
|
|
9
|
+
resetNitroConfig
|
|
10
|
+
} from "./esm-chunks/chunk-7JK67XZ2.js";
|
|
7
11
|
import {
|
|
8
12
|
createServerHandler,
|
|
9
13
|
patchNitroHandler
|
|
10
14
|
} from "./esm-chunks/chunk-QG7JLDXY.js";
|
|
11
15
|
import "./esm-chunks/chunk-NJ4SUJNF.js";
|
|
12
|
-
import {
|
|
13
|
-
addNitroBuildOutputConfig,
|
|
14
|
-
resetNitroConfig
|
|
15
|
-
} from "./esm-chunks/chunk-7JK67XZ2.js";
|
|
16
16
|
import "./esm-chunks/chunk-V2LFVP3C.js";
|
|
17
17
|
import {
|
|
18
18
|
PluginContext
|
|
19
|
-
} from "./esm-chunks/chunk-
|
|
19
|
+
} from "./esm-chunks/chunk-3BGGEHKE.js";
|
|
20
20
|
import {
|
|
21
21
|
createNuxtApiRoutesMeta,
|
|
22
22
|
createNuxtPagesRouteMeta
|
|
23
|
-
} from "./esm-chunks/chunk-
|
|
23
|
+
} from "./esm-chunks/chunk-ABEHWNBD.js";
|
|
24
24
|
import "./esm-chunks/chunk-5VJRCUAW.js";
|
|
25
25
|
import "./esm-chunks/chunk-6BT4RYQJ.js";
|
|
26
26
|
|
|
@@ -199,7 +199,7 @@ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
|
|
|
199
199
|
|
|
200
200
|
// package.json
|
|
201
201
|
var name = "@edgeone/nuxt-pages";
|
|
202
|
-
var version = "1.0.
|
|
202
|
+
var version = "1.0.9";
|
|
203
203
|
|
|
204
204
|
// src/run/handlers/tags-handler.cts
|
|
205
205
|
var purgeCacheUserAgent = `${name}@${version}`;
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(tags_handler_exports);
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name = "@edgeone/nuxt-pages";
|
|
31
|
-
var version = "1.0.
|
|
31
|
+
var version = "1.0.9";
|
|
32
32
|
|
|
33
33
|
// src/run/handlers/request-context.cts
|
|
34
34
|
var import_node_async_hooks = require("node:async_hooks");
|