@vercel/next 4.2.14 → 4.2.16
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 +82 -22
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -13057,18 +13057,18 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13057
13057
|
}
|
13058
13058
|
const isOmittedOrNotFound = isOmitted || isNotFound;
|
13059
13059
|
let htmlFsRef = null;
|
13060
|
-
let
|
13060
|
+
let postponedPrerender;
|
13061
13061
|
if (experimentalPPR && appDir) {
|
13062
13062
|
const htmlPath = import_path2.default.join(appDir, `${routeFileNoExt}.html`);
|
13063
13063
|
const metaPath = import_path2.default.join(appDir, `${routeFileNoExt}.meta`);
|
13064
13064
|
if (import_fs_extra3.default.existsSync(htmlPath) && import_fs_extra3.default.existsSync(metaPath)) {
|
13065
13065
|
const meta = JSON.parse(await import_fs_extra3.default.readFile(metaPath, "utf8"));
|
13066
13066
|
if ("postponed" in meta && typeof meta.postponed === "string") {
|
13067
|
-
|
13067
|
+
postponedPrerender = meta.postponed;
|
13068
13068
|
initialHeaders ??= {};
|
13069
13069
|
initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${meta.postponed.length}`;
|
13070
13070
|
const html = await import_fs_extra3.default.readFileSync(htmlPath, "utf8");
|
13071
|
-
|
13071
|
+
postponedPrerender += html;
|
13072
13072
|
}
|
13073
13073
|
}
|
13074
13074
|
if (!dataRoute?.endsWith(".rsc")) {
|
@@ -13082,12 +13082,12 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13082
13082
|
);
|
13083
13083
|
}
|
13084
13084
|
}
|
13085
|
-
if (
|
13085
|
+
if (postponedPrerender) {
|
13086
13086
|
const contentType = initialHeaders?.["content-type"];
|
13087
13087
|
if (!contentType) {
|
13088
13088
|
throw new Error("Invariant: contentType can't be undefined");
|
13089
13089
|
}
|
13090
|
-
htmlFsRef = new import_build_utils.FileBlob({ contentType, data:
|
13090
|
+
htmlFsRef = new import_build_utils.FileBlob({ contentType, data: postponedPrerender });
|
13091
13091
|
} else if (appDir && !dataRoute && !prefetchDataRoute && isAppPathRoute && !(isBlocking || isFallback)) {
|
13092
13092
|
const contentType = initialHeaders?.["content-type"];
|
13093
13093
|
const fsPath = import_path2.default.join(appDir, `${routeFileNoExt}.body`);
|
@@ -13124,7 +13124,14 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13124
13124
|
isFallback || isBlocking || isNotFound && !static404Page || !dataRoute ? null : new import_build_utils.FileFsRef({
|
13125
13125
|
fsPath: import_path2.default.join(
|
13126
13126
|
isAppPathRoute && !isOmittedOrNotFound && appDir ? appDir : pagesDir,
|
13127
|
-
`${isOmittedOrNotFound ? localePrefixed404 ? addLocaleOrDefault("/404.html", routesManifest, locale) : "/404.html" : isAppPathRoute ?
|
13127
|
+
`${isOmittedOrNotFound ? localePrefixed404 ? addLocaleOrDefault("/404.html", routesManifest, locale) : "/404.html" : isAppPathRoute ? (
|
13128
|
+
// When experimental PPR is enabled, we expect that the data
|
13129
|
+
// that should be served as a part of the prerender should
|
13130
|
+
// be from the prefetch data route. If this isn't enabled
|
13131
|
+
// for ppr, the only way to get the data is from the data
|
13132
|
+
// route.
|
13133
|
+
experimentalPPR ? prefetchDataRoute : dataRoute
|
13134
|
+
) : routeFileNoExt + ".json"}`
|
13128
13135
|
)
|
13129
13136
|
})
|
13130
13137
|
);
|
@@ -13168,7 +13175,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13168
13175
|
} else if (experimentalPPR) {
|
13169
13176
|
throw new Error("Invariant: expected to find prefetch data route PPR");
|
13170
13177
|
}
|
13171
|
-
const outputPrerenderPathData = outputPathPrefetchData || outputPathData;
|
13172
13178
|
if (isSharedLambdas) {
|
13173
13179
|
const outputSrcPathPage = normalizeIndexOutput(
|
13174
13180
|
import_path2.default.join(
|
@@ -13205,8 +13211,11 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13205
13211
|
if (!canUsePreviewMode || routeKey === "/404" && !lambdas[outputPathPage]) {
|
13206
13212
|
htmlFsRef.contentType = htmlContentType;
|
13207
13213
|
prerenders[outputPathPage] = htmlFsRef;
|
13208
|
-
if (
|
13209
|
-
prerenders[
|
13214
|
+
if (outputPathPrefetchData) {
|
13215
|
+
prerenders[outputPathPrefetchData] = jsonFsRef;
|
13216
|
+
}
|
13217
|
+
if (outputPathData && !experimentalPPR) {
|
13218
|
+
prerenders[outputPathData] = jsonFsRef;
|
13210
13219
|
}
|
13211
13220
|
}
|
13212
13221
|
}
|
@@ -13290,16 +13299,15 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13290
13299
|
}
|
13291
13300
|
} : {}
|
13292
13301
|
});
|
13293
|
-
|
13294
|
-
|
13295
|
-
|
13296
|
-
|
13297
|
-
normalizedPathData = normalizedPathData.replace(
|
13298
|
-
/([^/]+\.prefetch\.rsc)$/,
|
13299
|
-
"__$1"
|
13300
|
-
);
|
13302
|
+
const normalizePathData = (pathData) => {
|
13303
|
+
if ((srcRoute === "/" || srcRoute == "/index") && pathData.endsWith(RSC_PREFETCH_SUFFIX)) {
|
13304
|
+
delete lambdas[pathData];
|
13305
|
+
return pathData.replace(/([^/]+\.prefetch\.rsc)$/, "__$1");
|
13301
13306
|
}
|
13302
|
-
|
13307
|
+
return pathData;
|
13308
|
+
};
|
13309
|
+
if (outputPathData || outputPathPrefetchData) {
|
13310
|
+
const prerender = new import_build_utils.Prerender({
|
13303
13311
|
expiration: initialRevalidate,
|
13304
13312
|
lambda,
|
13305
13313
|
allowQuery,
|
@@ -13315,13 +13323,18 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
13315
13323
|
...initialHeaders,
|
13316
13324
|
"content-type": rscContentTypeHeader,
|
13317
13325
|
vary: rscVaryHeader,
|
13318
|
-
|
13319
|
-
...prerender && rscDidPostponeHeader ? { [rscDidPostponeHeader]: "1" } : {}
|
13326
|
+
...postponedPrerender && rscDidPostponeHeader ? { [rscDidPostponeHeader]: "1" } : {}
|
13320
13327
|
}
|
13321
13328
|
} : {}
|
13322
13329
|
});
|
13330
|
+
if (outputPathPrefetchData) {
|
13331
|
+
prerenders[normalizePathData(outputPathPrefetchData)] = prerender;
|
13332
|
+
}
|
13333
|
+
if (outputPathData && !experimentalPPR) {
|
13334
|
+
prerenders[normalizePathData(outputPathData)] = prerender;
|
13335
|
+
}
|
13323
13336
|
}
|
13324
|
-
if (
|
13337
|
+
if (outputPathData?.endsWith(".json") && appDir) {
|
13325
13338
|
const dummyOutput = new import_build_utils.FileBlob({
|
13326
13339
|
data: "{}",
|
13327
13340
|
contentType: "application/json"
|
@@ -14438,7 +14451,7 @@ async function serverBuild({
|
|
14438
14451
|
nextVersion,
|
14439
14452
|
EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION
|
14440
14453
|
);
|
14441
|
-
const hasActionOutputSupport = import_semver3.default.gte(nextVersion, ACTION_OUTPUT_SUPPORT_VERSION) && Boolean(process.env.NEXT_EXPERIMENTAL_STREAMING_ACTIONS);
|
14454
|
+
const hasActionOutputSupport = import_semver3.default.gte(nextVersion, ACTION_OUTPUT_SUPPORT_VERSION) && Boolean(process.env.NEXT_EXPERIMENTAL_STREAMING_ACTIONS) && !routesManifest.i18n;
|
14442
14455
|
const projectDir = requiredServerFilesManifest.relativeAppDir ? import_path4.default.join(baseDir, requiredServerFilesManifest.relativeAppDir) : requiredServerFilesManifest.appDir || entryPath;
|
14443
14456
|
const inversedAppPathManifest = {};
|
14444
14457
|
if (appPathRoutesManifest) {
|
@@ -15875,9 +15888,38 @@ async function serverBuild({
|
|
15875
15888
|
check: true
|
15876
15889
|
}
|
15877
15890
|
] : [],
|
15891
|
+
// before processing rewrites, remove any special `/index` routes that were added
|
15892
|
+
// as these won't be properly normalized by `afterFilesRewrites` / `dynamicRoutes`
|
15893
|
+
...appPathRoutesManifest ? [
|
15894
|
+
{
|
15895
|
+
src: import_path4.default.posix.join(
|
15896
|
+
"/",
|
15897
|
+
entryDirectory,
|
15898
|
+
"/index(\\.action|\\.rsc)"
|
15899
|
+
),
|
15900
|
+
dest: import_path4.default.posix.join("/", entryDirectory),
|
15901
|
+
continue: true
|
15902
|
+
}
|
15903
|
+
] : [],
|
15878
15904
|
// These need to come before handle: miss or else they are grouped
|
15879
15905
|
// with that routing section
|
15880
15906
|
...afterFilesRewrites,
|
15907
|
+
// Ensure that after we normalize `afterFilesRewrites`, unmatched actions are routed to the correct handler
|
15908
|
+
// e.g. /foo/.action -> /foo.action. This should only ever match in cases where we're routing to an action handler
|
15909
|
+
// and the rewrite normalization led to something like /foo/$1$rscsuff, and $1 had no match.
|
15910
|
+
// This is meant to have parity with the .rsc handling below.
|
15911
|
+
...hasActionOutputSupport ? [
|
15912
|
+
{
|
15913
|
+
src: `${import_path4.default.posix.join("/", entryDirectory, "/\\.action$")}`,
|
15914
|
+
dest: `${import_path4.default.posix.join("/", entryDirectory, "/index.action")}`,
|
15915
|
+
check: true
|
15916
|
+
},
|
15917
|
+
{
|
15918
|
+
src: `${import_path4.default.posix.join("/", entryDirectory, "(.+)/\\.action$")}`,
|
15919
|
+
dest: `${import_path4.default.posix.join("/", entryDirectory, "$1.action")}`,
|
15920
|
+
check: true
|
15921
|
+
}
|
15922
|
+
] : [],
|
15881
15923
|
// ensure non-normalized /.rsc from rewrites is handled
|
15882
15924
|
...appPathRoutesManifest ? [
|
15883
15925
|
{
|
@@ -15889,10 +15931,28 @@ async function serverBuild({
|
|
15889
15931
|
),
|
15890
15932
|
check: true
|
15891
15933
|
},
|
15934
|
+
{
|
15935
|
+
src: import_path4.default.posix.join(
|
15936
|
+
"/",
|
15937
|
+
entryDirectory,
|
15938
|
+
"(.+)/\\.prefetch\\.rsc$"
|
15939
|
+
),
|
15940
|
+
dest: import_path4.default.posix.join(
|
15941
|
+
"/",
|
15942
|
+
entryDirectory,
|
15943
|
+
`$1${RSC_PREFETCH_SUFFIX}`
|
15944
|
+
),
|
15945
|
+
check: true
|
15946
|
+
},
|
15892
15947
|
{
|
15893
15948
|
src: import_path4.default.posix.join("/", entryDirectory, "/\\.rsc$"),
|
15894
15949
|
dest: import_path4.default.posix.join("/", entryDirectory, `/index.rsc`),
|
15895
15950
|
check: true
|
15951
|
+
},
|
15952
|
+
{
|
15953
|
+
src: import_path4.default.posix.join("/", entryDirectory, "(.+)/\\.rsc$"),
|
15954
|
+
dest: import_path4.default.posix.join("/", entryDirectory, "$1.rsc"),
|
15955
|
+
check: true
|
15896
15956
|
}
|
15897
15957
|
] : [],
|
15898
15958
|
{ handle: "resource" },
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.16",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"dist"
|
14
14
|
],
|
15
15
|
"dependencies": {
|
16
|
-
"@vercel/nft": "0.27.
|
16
|
+
"@vercel/nft": "0.27.2"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"@types/aws-lambda": "8.10.19",
|
@@ -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": "8.2.
|
33
|
+
"@vercel/build-utils": "8.2.2",
|
34
34
|
"@vercel/routing-utils": "3.1.0",
|
35
35
|
"async-sema": "3.0.1",
|
36
36
|
"buffer-crc32": "0.2.13",
|