@vercel/next 29.0.0-snapshot-801db9d533c3 → 29.0.0
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/adapter/index.js +883 -509
- package/dist/adapter/node-handler.js +14 -1
- package/package.json +5 -5
|
@@ -52,8 +52,14 @@ const getHandlerSource = (ctx) => `
|
|
|
52
52
|
const fromSymbol = globalThis;
|
|
53
53
|
return fromSymbol[SYMBOL_FOR_REQ_CONTEXT]?.get?.() ?? {};
|
|
54
54
|
}
|
|
55
|
+
const middlewareModulePath = `./${path.posix.join(relativeDistDir, "server", "middleware.js")}`;
|
|
56
|
+
try {
|
|
57
|
+
Promise.resolve(require(middlewareModulePath)).catch(() => {
|
|
58
|
+
});
|
|
59
|
+
} catch (_) {
|
|
60
|
+
}
|
|
55
61
|
return async function handler(request) {
|
|
56
|
-
let middlewareHandler = await require(
|
|
62
|
+
let middlewareHandler = await require(middlewareModulePath);
|
|
57
63
|
middlewareHandler = middlewareHandler.handler || middlewareHandler;
|
|
58
64
|
const context = getRequestContext();
|
|
59
65
|
const response = await middlewareHandler(request, {
|
|
@@ -71,6 +77,7 @@ const getHandlerSource = (ctx) => `
|
|
|
71
77
|
const path = require("path");
|
|
72
78
|
const relativeDistDir = process.env.__PRIVATE_RELATIVE_DIST_DIR;
|
|
73
79
|
const prerenderFallbackFalseMap = process.env.__PRIVATE_PRERENDER_FALLBACK_MAP;
|
|
80
|
+
const basePath = process.env.__PRIVATE_BASE_PATH;
|
|
74
81
|
const {
|
|
75
82
|
dynamicRoutes: dynamicRoutesRaw,
|
|
76
83
|
staticRoutes: staticRoutesRaw,
|
|
@@ -253,6 +260,9 @@ const getHandlerSource = (ctx) => `
|
|
|
253
260
|
let urlPathname = typeof req.headers["x-matched-path"] === "string" ? fixMojibake(req.headers["x-matched-path"]) : void 0;
|
|
254
261
|
if (typeof urlPathname !== "string") {
|
|
255
262
|
urlPathname = parsedUrl.pathname || "/";
|
|
263
|
+
if (basePath && (urlPathname === basePath || urlPathname.startsWith(`${basePath}/`))) {
|
|
264
|
+
urlPathname = urlPathname.slice(basePath.length) || "/";
|
|
265
|
+
}
|
|
256
266
|
}
|
|
257
267
|
const {
|
|
258
268
|
matchedPathname: page,
|
|
@@ -319,6 +329,9 @@ const getHandlerSource = (ctx) => `
|
|
|
319
329
|
).replaceAll(
|
|
320
330
|
"process.env.__PRIVATE_PRERENDER_FALLBACK_MAP",
|
|
321
331
|
JSON.stringify(ctx.prerenderFallbackFalseMap)
|
|
332
|
+
).replaceAll(
|
|
333
|
+
"process.env.__PRIVATE_BASE_PATH",
|
|
334
|
+
JSON.stringify(ctx.nextConfig?.basePath || "")
|
|
322
335
|
).replaceAll(
|
|
323
336
|
"process.env.__PRIVATE_NEXT_CONFIG",
|
|
324
337
|
JSON.stringify(ctx.nextConfig)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "29.0.0
|
|
3
|
+
"version": "29.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"@vercel/nft": "1.10.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@vercel/build-utils": "15.3.0
|
|
19
|
+
"@vercel/build-utils": "15.3.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@next-community/adapter-vercel": "0.0.1-beta.
|
|
22
|
+
"@next-community/adapter-vercel": "0.0.1-beta.36",
|
|
23
23
|
"@types/aws-lambda": "8.10.19",
|
|
24
24
|
"@types/buffer-crc32": "0.2.0",
|
|
25
25
|
"@types/bytes": "3.1.1",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"vite": "6.4.3",
|
|
60
60
|
"vitest": "4.1.10",
|
|
61
61
|
"webpack-sources": "3.2.3",
|
|
62
|
-
"@vercel/
|
|
63
|
-
"@vercel/
|
|
62
|
+
"@vercel/routing-utils": "6.6.1",
|
|
63
|
+
"@vercel/build-utils": "15.3.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "node build.mjs",
|