@vercel/next 4.21.3 → 4.21.6
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 +17 -11
- package/dist/index.js +13 -3
- package/package.json +4 -4
package/dist/adapter/index.js
CHANGED
|
@@ -9581,6 +9581,11 @@ function sha256(input) {
|
|
|
9581
9581
|
function fallbackHasFilePath(fallback) {
|
|
9582
9582
|
return fallback !== void 0 && "filePath" in fallback && typeof fallback.filePath === "string";
|
|
9583
9583
|
}
|
|
9584
|
+
function getPostponedStateContentType(postponedState, originContentType) {
|
|
9585
|
+
return `application/x-nextjs-pre-render; state-length=${Buffer.byteLength(
|
|
9586
|
+
postponedState
|
|
9587
|
+
)}; origin=${JSON.stringify(originContentType)}`;
|
|
9588
|
+
}
|
|
9584
9589
|
var copy = async (src, dest) => {
|
|
9585
9590
|
await import_fs_extra3.default.remove(dest);
|
|
9586
9591
|
await import_fs_extra3.default.copy(src, dest);
|
|
@@ -10059,13 +10064,19 @@ async function handlePrerenderOutputs(prerenderOutputs, {
|
|
|
10059
10064
|
`${output.fallback.postponedState}${fallbackContent}`
|
|
10060
10065
|
);
|
|
10061
10066
|
const originContentType = isRscOutput ? rscContentType : "text/html; charset=utf-8";
|
|
10062
|
-
initialHeaders["content-type"] =
|
|
10067
|
+
initialHeaders["content-type"] = getPostponedStateContentType(
|
|
10068
|
+
output.fallback.postponedState,
|
|
10069
|
+
originContentType
|
|
10070
|
+
);
|
|
10063
10071
|
} else if (output.fallback?.postponedState && !fallbackHasFilePath(output.fallback) && prerenderFallbackPath) {
|
|
10064
10072
|
await writeIfNotExists(
|
|
10065
10073
|
prerenderFallbackPath,
|
|
10066
10074
|
output.fallback.postponedState
|
|
10067
10075
|
);
|
|
10068
|
-
initialHeaders["content-type"] =
|
|
10076
|
+
initialHeaders["content-type"] = getPostponedStateContentType(
|
|
10077
|
+
output.fallback.postponedState,
|
|
10078
|
+
rscContentType
|
|
10079
|
+
);
|
|
10069
10080
|
}
|
|
10070
10081
|
await import_promises.default.mkdir(import_node_path.default.dirname(prerenderConfigPath), { recursive: true });
|
|
10071
10082
|
await writeIfNotExists(
|
|
@@ -10308,10 +10319,6 @@ async function getSourceFilePathFromPage({
|
|
|
10308
10319
|
}
|
|
10309
10320
|
|
|
10310
10321
|
// src/routing.ts
|
|
10311
|
-
var API_PATH_PREFIX_PATTERN = "api(?:/.*|$)";
|
|
10312
|
-
function getI18nPathPrefixExclusion(locales) {
|
|
10313
|
-
return `(?!(?:_next/.*|api|${locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))`;
|
|
10314
|
-
}
|
|
10315
10322
|
function modifyWithRewriteHeaders(rewrites, {
|
|
10316
10323
|
isAfterFilesRewrite = false,
|
|
10317
10324
|
shouldHandleSegmentPrefetches
|
|
@@ -10671,7 +10678,6 @@ var myAdapter = {
|
|
|
10671
10678
|
const hasPagesDir = outputs.pages.length > 0 || outputs.pagesApi.length > 0;
|
|
10672
10679
|
const shouldHandleMiddlewareDataResolving = routing.shouldNormalizeNextData;
|
|
10673
10680
|
const i18nConfig = config.i18n;
|
|
10674
|
-
const i18nPathPrefixExclusion = i18nConfig ? getI18nPathPrefixExclusion(i18nConfig.locales) : "";
|
|
10675
10681
|
const vercelConfig2 = {
|
|
10676
10682
|
version: 3,
|
|
10677
10683
|
overrides: {},
|
|
@@ -10870,7 +10876,7 @@ var myAdapter = {
|
|
|
10870
10876
|
"/",
|
|
10871
10877
|
config.basePath,
|
|
10872
10878
|
"/"
|
|
10873
|
-
)}
|
|
10879
|
+
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
|
|
10874
10880
|
// we aren't able to ensure trailing slash mode here
|
|
10875
10881
|
// so ensure this comes after the trailing slash redirect
|
|
10876
10882
|
dest: `${config.basePath && config.basePath !== "/" ? import_node_path2.default.posix.join("/", config.basePath) : ""}$wildcard/$1`,
|
|
@@ -10944,7 +10950,7 @@ var myAdapter = {
|
|
|
10944
10950
|
"/",
|
|
10945
10951
|
config.basePath,
|
|
10946
10952
|
"/"
|
|
10947
|
-
)}
|
|
10953
|
+
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
|
|
10948
10954
|
dest: `${import_node_path2.default.posix.join(
|
|
10949
10955
|
"/",
|
|
10950
10956
|
config.basePath,
|
|
@@ -11209,7 +11215,7 @@ var myAdapter = {
|
|
|
11209
11215
|
"/",
|
|
11210
11216
|
config.basePath,
|
|
11211
11217
|
"/"
|
|
11212
|
-
)}
|
|
11218
|
+
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
|
|
11213
11219
|
dest: `${import_node_path2.default.posix.join(
|
|
11214
11220
|
"/",
|
|
11215
11221
|
config.basePath,
|
|
@@ -11231,7 +11237,7 @@ var myAdapter = {
|
|
|
11231
11237
|
src: `^${import_node_path2.default.posix.join(
|
|
11232
11238
|
"/",
|
|
11233
11239
|
config.basePath
|
|
11234
|
-
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})/(
|
|
11240
|
+
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})/(.*)`,
|
|
11235
11241
|
dest: `${import_node_path2.default.posix.join("/", config.basePath, "/")}$1`,
|
|
11236
11242
|
check: true
|
|
11237
11243
|
}
|
package/dist/index.js
CHANGED
|
@@ -12796,7 +12796,10 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12796
12796
|
const html = import_fs_extra3.default.readFileSync(htmlPath, "utf8");
|
|
12797
12797
|
initialHeaders ??= {};
|
|
12798
12798
|
if (postponedState) {
|
|
12799
|
-
initialHeaders["content-type"] =
|
|
12799
|
+
initialHeaders["content-type"] = getPostponedStateContentType(
|
|
12800
|
+
postponedState,
|
|
12801
|
+
"text/html; charset=utf-8"
|
|
12802
|
+
);
|
|
12800
12803
|
postponedPrerender = postponedState + html;
|
|
12801
12804
|
didPostpone = true;
|
|
12802
12805
|
} else {
|
|
@@ -13128,9 +13131,10 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
13128
13131
|
} else {
|
|
13129
13132
|
let contentType = rscContentTypeHeader;
|
|
13130
13133
|
if (postponedState) {
|
|
13131
|
-
contentType =
|
|
13134
|
+
contentType = getPostponedStateContentType(
|
|
13135
|
+
postponedState,
|
|
13132
13136
|
rscContentTypeHeader
|
|
13133
|
-
)
|
|
13137
|
+
);
|
|
13134
13138
|
}
|
|
13135
13139
|
const rdcRSCAllowQuery = isAppClientParamParsingEnabled ? htmlAllowQuery : allowQuery;
|
|
13136
13140
|
let fallback = null;
|
|
@@ -13985,6 +13989,11 @@ function normalizePrefetches(prefetches) {
|
|
|
13985
13989
|
}
|
|
13986
13990
|
return updatedPrefetches;
|
|
13987
13991
|
}
|
|
13992
|
+
function getPostponedStateContentType(postponedState, originContentType) {
|
|
13993
|
+
return `application/x-nextjs-pre-render; state-length=${Buffer.byteLength(
|
|
13994
|
+
postponedState
|
|
13995
|
+
)}; origin=${JSON.stringify(originContentType)}`;
|
|
13996
|
+
}
|
|
13988
13997
|
function getHTMLPostponedState({
|
|
13989
13998
|
appDir,
|
|
13990
13999
|
routeFileNoExt
|
|
@@ -16807,6 +16816,7 @@ var build = async (buildOptions) => {
|
|
|
16807
16816
|
cliType,
|
|
16808
16817
|
lockfileVersion,
|
|
16809
16818
|
packageJsonPackageManager,
|
|
16819
|
+
nodeVersion,
|
|
16810
16820
|
env: process.env,
|
|
16811
16821
|
turboSupportsCorepackHome,
|
|
16812
16822
|
projectCreatedAt: config.projectSettings?.createdAt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@vercel/nft": "1.10.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@next-community/adapter-vercel": "0.0.1-beta.
|
|
19
|
+
"@next-community/adapter-vercel": "0.0.1-beta.27",
|
|
20
20
|
"@types/aws-lambda": "8.10.19",
|
|
21
21
|
"@types/buffer-crc32": "0.2.0",
|
|
22
22
|
"@types/bytes": "3.1.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"vite": "6.4.3",
|
|
55
55
|
"vitest": "4.1.10",
|
|
56
56
|
"webpack-sources": "3.2.3",
|
|
57
|
-
"@vercel/
|
|
58
|
-
"@vercel/
|
|
57
|
+
"@vercel/routing-utils": "6.5.0",
|
|
58
|
+
"@vercel/build-utils": "14.1.1"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "node build.mjs",
|