@vercel/next 4.10.7 → 4.10.8
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/index.js +53 -143
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11124,42 +11124,12 @@ async function getRoutesManifest(entryPath, outputDirectory, nextVersion) {
|
|
|
11124
11124
|
}
|
|
11125
11125
|
return routesManifest;
|
|
11126
11126
|
}
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
case 4: {
|
|
11134
|
-
const routes = [];
|
|
11135
|
-
for (const {
|
|
11136
|
-
routeKeys,
|
|
11137
|
-
prefetchSegmentDataRoutes
|
|
11138
|
-
} of routesManifest.staticRoutes) {
|
|
11139
|
-
if (prefetchSegmentDataRoutes && prefetchSegmentDataRoutes.length > 0) {
|
|
11140
|
-
for (const prefetchSegmentDataRoute of prefetchSegmentDataRoutes) {
|
|
11141
|
-
routes.push({
|
|
11142
|
-
src: prefetchSegmentDataRoute.source,
|
|
11143
|
-
dest: getDestinationForSegmentRoute(
|
|
11144
|
-
false,
|
|
11145
|
-
entryDirectory,
|
|
11146
|
-
routeKeys,
|
|
11147
|
-
prefetchSegmentDataRoute
|
|
11148
|
-
),
|
|
11149
|
-
check: true
|
|
11150
|
-
});
|
|
11151
|
-
}
|
|
11152
|
-
}
|
|
11153
|
-
}
|
|
11154
|
-
return routes;
|
|
11155
|
-
}
|
|
11156
|
-
default: {
|
|
11157
|
-
throw new import_build_utils.NowBuildError({
|
|
11158
|
-
message: "This version of `@vercel/next` does not support the version of Next.js you are trying to deploy.\nPlease upgrade your `@vercel/next` builder and try again. Contact support if this continues to happen.",
|
|
11159
|
-
code: "NEXT_VERSION_UPGRADE"
|
|
11160
|
-
});
|
|
11161
|
-
}
|
|
11162
|
-
}
|
|
11127
|
+
function getDestinationForSegmentRoute(isDev, entryDirectory, routeKeys, prefetchSegmentDataRoute) {
|
|
11128
|
+
return `${!isDev ? import_path2.default.posix.join(
|
|
11129
|
+
"/",
|
|
11130
|
+
entryDirectory,
|
|
11131
|
+
prefetchSegmentDataRoute.destination
|
|
11132
|
+
) : prefetchSegmentDataRoute.destination}?${Object.entries(prefetchSegmentDataRoute.routeKeys ?? routeKeys ?? {}).map(([key, value]) => `${value}=$${key}`).join("&")}`;
|
|
11163
11133
|
}
|
|
11164
11134
|
async function getDynamicRoutes({
|
|
11165
11135
|
entryPath,
|
|
@@ -11248,28 +11218,25 @@ async function getDynamicRoutes({
|
|
|
11248
11218
|
});
|
|
11249
11219
|
}
|
|
11250
11220
|
}
|
|
11251
|
-
if (isAppPPREnabled) {
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11221
|
+
if (isAppPPREnabled || isAppClientSegmentCacheEnabled) {
|
|
11222
|
+
routes2.push({
|
|
11223
|
+
...route,
|
|
11224
|
+
src: route.src.replace(
|
|
11225
|
+
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
|
11226
|
+
"(?<rscSuffix>\\.rsc|\\.prefetch\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$"
|
|
11227
|
+
),
|
|
11228
|
+
dest: route.dest?.replace(/($|\?)/, "$rscSuffix$1")
|
|
11229
|
+
});
|
|
11230
|
+
} else {
|
|
11256
11231
|
routes2.push({
|
|
11257
11232
|
...route,
|
|
11258
11233
|
src: route.src.replace(
|
|
11259
11234
|
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
|
11260
|
-
"(?:\\.
|
|
11235
|
+
"(?:\\.rsc)(?:/)?$"
|
|
11261
11236
|
),
|
|
11262
|
-
dest
|
|
11237
|
+
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
|
11263
11238
|
});
|
|
11264
11239
|
}
|
|
11265
|
-
routes2.push({
|
|
11266
|
-
...route,
|
|
11267
|
-
src: route.src.replace(
|
|
11268
|
-
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
|
11269
|
-
"(?:\\.rsc)(?:/)?$"
|
|
11270
|
-
),
|
|
11271
|
-
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
|
11272
|
-
});
|
|
11273
11240
|
routes2.push(route);
|
|
11274
11241
|
}
|
|
11275
11242
|
return routes2;
|
|
@@ -11333,13 +11300,6 @@ async function getDynamicRoutes({
|
|
|
11333
11300
|
});
|
|
11334
11301
|
return routes;
|
|
11335
11302
|
}
|
|
11336
|
-
function getDestinationForSegmentRoute(isDev, entryDirectory, routeKeys, prefetchSegmentDataRoute) {
|
|
11337
|
-
return `${!isDev ? import_path2.default.posix.join(
|
|
11338
|
-
"/",
|
|
11339
|
-
entryDirectory,
|
|
11340
|
-
prefetchSegmentDataRoute.destination
|
|
11341
|
-
) : prefetchSegmentDataRoute.destination}?${Object.entries(prefetchSegmentDataRoute.routeKeys ?? routeKeys ?? {}).map(([key, value]) => `${value}=$${key}`).join("&")}`;
|
|
11342
|
-
}
|
|
11343
11303
|
function localizeDynamicRoutes(dynamicRoutes, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, isServerMode, isCorrectLocaleAPIRoutes, inversedAppPathRoutesManifest) {
|
|
11344
11304
|
const finalDynamicRoutes = [];
|
|
11345
11305
|
const nonLocalePrefixedRoutes = [];
|
|
@@ -14054,64 +14014,15 @@ async function serverBuild({
|
|
|
14054
14014
|
continue;
|
|
14055
14015
|
if (protocol || !pathname && !query)
|
|
14056
14016
|
continue;
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
!m.value || m.value === "1"
|
|
14066
|
-
)
|
|
14067
|
-
)) {
|
|
14068
|
-
continue;
|
|
14069
|
-
}
|
|
14070
|
-
const has = "has" in rewrite && rewrite.has ? (
|
|
14071
|
-
// As we mutate the array below, we need to clone it to avoid
|
|
14072
|
-
// mutating the original
|
|
14073
|
-
[...rewrite.has]
|
|
14074
|
-
) : [];
|
|
14075
|
-
found = has.filter(
|
|
14076
|
-
(h) => h.type === "header" && h.key.toLowerCase() === rscHeader
|
|
14077
|
-
);
|
|
14078
|
-
if (found.some(
|
|
14079
|
-
(h) => (
|
|
14080
|
-
// These are rules that have a value set to anything other than
|
|
14081
|
-
// '1'.
|
|
14082
|
-
h.value && h.value !== "1"
|
|
14083
|
-
)
|
|
14084
|
-
)) {
|
|
14085
|
-
continue;
|
|
14086
|
-
}
|
|
14087
|
-
for (const h of found) {
|
|
14088
|
-
has.splice(has.indexOf(h), 1);
|
|
14089
|
-
}
|
|
14090
|
-
has.push({ type: "header", key: rscHeader, value: "1" });
|
|
14091
|
-
const headers2 = "headers" in rewrite && rewrite.headers ? (
|
|
14092
|
-
// Clone the existing headers to avoid mutating the original
|
|
14093
|
-
// object.
|
|
14094
|
-
{ ...rewrite.headers }
|
|
14095
|
-
) : {};
|
|
14096
|
-
const updated = {
|
|
14097
|
-
...rewrite,
|
|
14098
|
-
// We don't want to perform the actual rewrite here, instead we want
|
|
14099
|
-
// to just add the headers associated with the rewrite.
|
|
14100
|
-
dest: void 0,
|
|
14101
|
-
// We don't want to check here, so omit the check property but we do
|
|
14102
|
-
// want to maintain the order of the rewrites, so add the continue
|
|
14103
|
-
// property.
|
|
14104
|
-
check: void 0,
|
|
14105
|
-
continue: true,
|
|
14106
|
-
has,
|
|
14107
|
-
headers: headers2
|
|
14017
|
+
rewrite.headers = {
|
|
14018
|
+
...rewrite.headers,
|
|
14019
|
+
...pathname ? {
|
|
14020
|
+
[rewriteHeaders.pathHeader]: pathname
|
|
14021
|
+
} : {},
|
|
14022
|
+
...query ? {
|
|
14023
|
+
[rewriteHeaders.queryHeader]: query
|
|
14024
|
+
} : {}
|
|
14108
14025
|
};
|
|
14109
|
-
if (pathname)
|
|
14110
|
-
headers2[rewriteHeaders.pathHeader] = pathname;
|
|
14111
|
-
if (query)
|
|
14112
|
-
headers2[rewriteHeaders.queryHeader] = query;
|
|
14113
|
-
rewrites.splice(i, 0, updated);
|
|
14114
|
-
i++;
|
|
14115
14026
|
}
|
|
14116
14027
|
};
|
|
14117
14028
|
modifyRewrites(beforeFilesRewrites);
|
|
@@ -15066,10 +14977,6 @@ ${JSON.stringify(
|
|
|
15066
14977
|
)];
|
|
15067
14978
|
});
|
|
15068
14979
|
const isNextDataServerResolving = (middleware.staticRoutes.length > 0 || nodeMiddleware) && import_semver3.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
|
|
15069
|
-
const staticSegmentRoutes = isAppClientSegmentCacheEnabled ? await getStaticSegmentRoutes({
|
|
15070
|
-
entryDirectory,
|
|
15071
|
-
routesManifest
|
|
15072
|
-
}) : [];
|
|
15073
14980
|
const dynamicRoutes = await getDynamicRoutes({
|
|
15074
14981
|
entryPath,
|
|
15075
14982
|
entryDirectory,
|
|
@@ -15107,10 +15014,14 @@ ${JSON.stringify(
|
|
|
15107
15014
|
const pagesEntries = Object.keys(pagesData);
|
|
15108
15015
|
for (const page of pagesEntries) {
|
|
15109
15016
|
const pathName = page.startsWith("/") ? page.slice(1) : page;
|
|
15110
|
-
|
|
15017
|
+
const dummyBlob = new import_build_utils2.FileBlob({
|
|
15111
15018
|
data: "{}",
|
|
15112
15019
|
contentType: "application/json"
|
|
15113
15020
|
});
|
|
15021
|
+
pagesPlaceholderRscEntries[`${pathName}.rsc`] = dummyBlob;
|
|
15022
|
+
if (isAppClientSegmentCacheEnabled) {
|
|
15023
|
+
pagesPlaceholderRscEntries[`${pathName}.segments/_tree.segment.rsc`] = dummyBlob;
|
|
15024
|
+
}
|
|
15114
15025
|
}
|
|
15115
15026
|
}
|
|
15116
15027
|
const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } = await getStaticFiles(entryPath, entryDirectory, outputDirectory);
|
|
@@ -15513,7 +15424,9 @@ ${JSON.stringify(
|
|
|
15513
15424
|
override: true
|
|
15514
15425
|
}
|
|
15515
15426
|
] : [],
|
|
15516
|
-
...rscPrefetchHeader && isAppPPREnabled
|
|
15427
|
+
...rscPrefetchHeader && isAppPPREnabled && // when client segment cache is enabled we do not need
|
|
15428
|
+
// the .prefetch.rsc routing
|
|
15429
|
+
!isAppClientSegmentCacheEnabled ? [
|
|
15517
15430
|
{
|
|
15518
15431
|
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}$`,
|
|
15519
15432
|
has: [
|
|
@@ -15725,6 +15638,23 @@ ${JSON.stringify(
|
|
|
15725
15638
|
check: true
|
|
15726
15639
|
}
|
|
15727
15640
|
] : [],
|
|
15641
|
+
// If it didn't match any of the static routes or dynamic ones, then we
|
|
15642
|
+
// should fallback to the regular RSC request.
|
|
15643
|
+
...isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix ? [
|
|
15644
|
+
{
|
|
15645
|
+
src: import_path4.default.posix.join(
|
|
15646
|
+
"/",
|
|
15647
|
+
entryDirectory,
|
|
15648
|
+
`/(?<path>.+)${(0, import_escape_string_regexp2.default)(prefetchSegmentDirSuffix)}/.+${(0, import_escape_string_regexp2.default)(prefetchSegmentSuffix)}$`
|
|
15649
|
+
),
|
|
15650
|
+
dest: import_path4.default.posix.join(
|
|
15651
|
+
"/",
|
|
15652
|
+
entryDirectory,
|
|
15653
|
+
isAppPPREnabled ? "/$path.prefetch.rsc" : "/$path.rsc"
|
|
15654
|
+
),
|
|
15655
|
+
check: true
|
|
15656
|
+
}
|
|
15657
|
+
] : [],
|
|
15728
15658
|
// routes that are called after each rewrite or after routes
|
|
15729
15659
|
// if there no rewrites
|
|
15730
15660
|
{ handle: "rewrite" },
|
|
@@ -15796,7 +15726,6 @@ ${JSON.stringify(
|
|
|
15796
15726
|
status: 404
|
|
15797
15727
|
}
|
|
15798
15728
|
] : [],
|
|
15799
|
-
...staticSegmentRoutes,
|
|
15800
15729
|
// Dynamic routes (must come after dataRoutes as dataRoutes are more
|
|
15801
15730
|
// specific)
|
|
15802
15731
|
...dynamicRoutes,
|
|
@@ -15828,23 +15757,6 @@ ${JSON.stringify(
|
|
|
15828
15757
|
dest: "__next_data_catchall"
|
|
15829
15758
|
}
|
|
15830
15759
|
] : [],
|
|
15831
|
-
// If it didn't match any of the static routes or dynamic ones, then we
|
|
15832
|
-
// should fallback to the regular RSC request.
|
|
15833
|
-
...isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix ? [
|
|
15834
|
-
{
|
|
15835
|
-
src: import_path4.default.posix.join(
|
|
15836
|
-
"/",
|
|
15837
|
-
entryDirectory,
|
|
15838
|
-
`/(?<path>.+)${(0, import_escape_string_regexp2.default)(prefetchSegmentDirSuffix)}/.+${(0, import_escape_string_regexp2.default)(prefetchSegmentSuffix)}$`
|
|
15839
|
-
),
|
|
15840
|
-
dest: import_path4.default.posix.join(
|
|
15841
|
-
"/",
|
|
15842
|
-
entryDirectory,
|
|
15843
|
-
isAppPPREnabled ? "/$path.prefetch.rsc" : "/$path.rsc"
|
|
15844
|
-
),
|
|
15845
|
-
check: true
|
|
15846
|
-
}
|
|
15847
|
-
] : [],
|
|
15848
15760
|
// routes to call after a file has been matched
|
|
15849
15761
|
{ handle: "hit" },
|
|
15850
15762
|
// Before we handle static files we need to set proper caching headers
|
|
@@ -17388,8 +17300,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17388
17300
|
canUsePreviewMode,
|
|
17389
17301
|
bypassToken: prerenderManifest.bypassToken || "",
|
|
17390
17302
|
isServerMode,
|
|
17391
|
-
isAppPPREnabled: false
|
|
17392
|
-
isAppClientSegmentCacheEnabled: false
|
|
17303
|
+
isAppPPREnabled: false
|
|
17393
17304
|
}).then(
|
|
17394
17305
|
(arr) => localizeDynamicRoutes(
|
|
17395
17306
|
arr,
|
|
@@ -17415,8 +17326,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17415
17326
|
canUsePreviewMode,
|
|
17416
17327
|
bypassToken: prerenderManifest.bypassToken || "",
|
|
17417
17328
|
isServerMode,
|
|
17418
|
-
isAppPPREnabled: false
|
|
17419
|
-
isAppClientSegmentCacheEnabled: false
|
|
17329
|
+
isAppPPREnabled: false
|
|
17420
17330
|
}).then(
|
|
17421
17331
|
(arr) => arr.map((route) => {
|
|
17422
17332
|
route.src = route.src.replace("^", `^${dynamicPrefix}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/semver": "6.0.0",
|
|
31
31
|
"@types/text-table": "0.2.1",
|
|
32
32
|
"@types/webpack-sources": "3.2.0",
|
|
33
|
-
"@vercel/build-utils": "
|
|
33
|
+
"@vercel/build-utils": "11.0.0",
|
|
34
34
|
"@vercel/routing-utils": "5.1.1",
|
|
35
35
|
"async-sema": "3.0.1",
|
|
36
36
|
"buffer-crc32": "0.2.13",
|