@vercel/next 4.2.2 → 4.2.3
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 +114 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -12017,7 +12017,8 @@ async function getDynamicRoutes({
|
|
12017
12017
|
bypassToken,
|
12018
12018
|
isServerMode,
|
12019
12019
|
dynamicMiddlewareRouteMap,
|
12020
|
-
experimentalPPRRoutes
|
12020
|
+
experimentalPPRRoutes,
|
12021
|
+
hasActionOutputSupport
|
12021
12022
|
}) {
|
12022
12023
|
if (routesManifest) {
|
12023
12024
|
switch (routesManifest.version) {
|
@@ -12085,14 +12086,25 @@ async function getDynamicRoutes({
|
|
12085
12086
|
dest
|
12086
12087
|
});
|
12087
12088
|
}
|
12088
|
-
|
12089
|
-
|
12090
|
-
|
12091
|
-
|
12092
|
-
|
12093
|
-
|
12094
|
-
|
12095
|
-
|
12089
|
+
if (hasActionOutputSupport) {
|
12090
|
+
routes2.push({
|
12091
|
+
...route,
|
12092
|
+
src: route.src.replace(
|
12093
|
+
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
12094
|
+
"(?<nxtsuffix>(?:\\.action|\\.rsc))(?:/)?$"
|
12095
|
+
),
|
12096
|
+
dest: route.dest?.replace(/($|\?)/, "$nxtsuffix$1")
|
12097
|
+
});
|
12098
|
+
} else {
|
12099
|
+
routes2.push({
|
12100
|
+
...route,
|
12101
|
+
src: route.src.replace(
|
12102
|
+
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
12103
|
+
"(?:\\.rsc)(?:/)?$"
|
12104
|
+
),
|
12105
|
+
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
12106
|
+
});
|
12107
|
+
}
|
12096
12108
|
routes2.push(route);
|
12097
12109
|
}
|
12098
12110
|
return routes2;
|
@@ -14309,6 +14321,7 @@ var CORRECT_NOT_FOUND_ROUTES_VERSION = "v12.0.1";
|
|
14309
14321
|
var CORRECT_MIDDLEWARE_ORDER_VERSION = "v12.1.7-canary.29";
|
14310
14322
|
var NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = "v12.1.7-canary.33";
|
14311
14323
|
var EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = "v12.2.0";
|
14324
|
+
var ACTION_OUTPUT_SUPPORT_VERSION = "v14.2.2";
|
14312
14325
|
var CORRECTED_MANIFESTS_VERSION = "v12.2.0";
|
14313
14326
|
var PRELOAD_CHUNKS = {
|
14314
14327
|
APP_ROUTER_PAGES: [
|
@@ -14388,6 +14401,10 @@ async function serverBuild({
|
|
14388
14401
|
nextVersion,
|
14389
14402
|
EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION
|
14390
14403
|
);
|
14404
|
+
const hasActionOutputSupport = import_semver3.default.gte(
|
14405
|
+
nextVersion,
|
14406
|
+
ACTION_OUTPUT_SUPPORT_VERSION
|
14407
|
+
);
|
14391
14408
|
const projectDir = requiredServerFilesManifest.relativeAppDir ? import_path4.default.join(baseDir, requiredServerFilesManifest.relativeAppDir) : requiredServerFilesManifest.appDir || entryPath;
|
14392
14409
|
const inversedAppPathManifest = {};
|
14393
14410
|
if (appPathRoutesManifest) {
|
@@ -14928,11 +14945,19 @@ async function serverBuild({
|
|
14928
14945
|
pageExtensions,
|
14929
14946
|
inversedAppPathManifest
|
14930
14947
|
});
|
14948
|
+
const appRouterStreamingActionLambdaGroups = [];
|
14931
14949
|
for (const group of appRouterLambdaGroups) {
|
14932
14950
|
if (!group.isPrerenders || group.isExperimentalPPR) {
|
14933
14951
|
group.isStreaming = true;
|
14934
14952
|
}
|
14935
14953
|
group.isAppRouter = true;
|
14954
|
+
if (hasActionOutputSupport) {
|
14955
|
+
appRouterStreamingActionLambdaGroups.push({
|
14956
|
+
...group,
|
14957
|
+
isActionLambda: true,
|
14958
|
+
isStreaming: true
|
14959
|
+
});
|
14960
|
+
}
|
14936
14961
|
}
|
14937
14962
|
for (const group of appRouteHandlersLambdaGroups) {
|
14938
14963
|
if (!group.isPrerenders) {
|
@@ -14980,6 +15005,12 @@ async function serverBuild({
|
|
14980
15005
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
14981
15006
|
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes
|
14982
15007
|
})),
|
15008
|
+
appRouterStreamingPrerenderLambdaGroups: appRouterStreamingActionLambdaGroups.map((group) => ({
|
15009
|
+
pages: group.pages,
|
15010
|
+
isPrerender: group.isPrerenders,
|
15011
|
+
pseudoLayerBytes: group.pseudoLayerBytes,
|
15012
|
+
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes
|
15013
|
+
})),
|
14983
15014
|
appRouteHandlersLambdaGroups: appRouteHandlersLambdaGroups.map(
|
14984
15015
|
(group) => ({
|
14985
15016
|
pages: group.pages,
|
@@ -14997,6 +15028,7 @@ async function serverBuild({
|
|
14997
15028
|
const combinedGroups = [
|
14998
15029
|
...pageLambdaGroups,
|
14999
15030
|
...appRouterLambdaGroups,
|
15031
|
+
...appRouterStreamingActionLambdaGroups,
|
15000
15032
|
...apiLambdaGroups,
|
15001
15033
|
...appRouteHandlersLambdaGroups
|
15002
15034
|
];
|
@@ -15143,6 +15175,9 @@ async function serverBuild({
|
|
15143
15175
|
});
|
15144
15176
|
}
|
15145
15177
|
let outputName = import_path4.default.posix.join(entryDirectory, pageName);
|
15178
|
+
if (group.isActionLambda) {
|
15179
|
+
outputName = `${outputName}.action`;
|
15180
|
+
}
|
15146
15181
|
if (isPPR) {
|
15147
15182
|
if (!revalidate) {
|
15148
15183
|
throw new Error("Invariant: PPR lambda isn't set");
|
@@ -15267,7 +15302,8 @@ async function serverBuild({
|
|
15267
15302
|
bypassToken: prerenderManifest.bypassToken || "",
|
15268
15303
|
isServerMode: true,
|
15269
15304
|
dynamicMiddlewareRouteMap: middleware.dynamicRouteMap,
|
15270
|
-
experimentalPPRRoutes
|
15305
|
+
experimentalPPRRoutes,
|
15306
|
+
hasActionOutputSupport
|
15271
15307
|
}).then(
|
15272
15308
|
(arr) => localizeDynamicRoutes(
|
15273
15309
|
arr,
|
@@ -15682,6 +15718,70 @@ async function serverBuild({
|
|
15682
15718
|
override: true
|
15683
15719
|
}
|
15684
15720
|
] : [],
|
15721
|
+
...hasActionOutputSupport ? [
|
15722
|
+
// Create rewrites for streaming prerenders (.action routes)
|
15723
|
+
// This contains separate rewrites for each possible "has" (action header, or content-type)
|
15724
|
+
// Also includes separate handling for index routes which should match to /index.action.
|
15725
|
+
// This follows the same pattern as the rewrites for .rsc files.
|
15726
|
+
{
|
15727
|
+
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
15728
|
+
dest: import_path4.default.posix.join("/", entryDirectory, "/index.action"),
|
15729
|
+
has: [
|
15730
|
+
{
|
15731
|
+
type: "header",
|
15732
|
+
key: "next-action"
|
15733
|
+
}
|
15734
|
+
],
|
15735
|
+
continue: true,
|
15736
|
+
override: true
|
15737
|
+
},
|
15738
|
+
{
|
15739
|
+
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
15740
|
+
dest: import_path4.default.posix.join("/", entryDirectory, "/index.action"),
|
15741
|
+
has: [
|
15742
|
+
{
|
15743
|
+
type: "header",
|
15744
|
+
key: "content-type",
|
15745
|
+
value: "multipart/form-data;.*"
|
15746
|
+
}
|
15747
|
+
],
|
15748
|
+
continue: true,
|
15749
|
+
override: true
|
15750
|
+
},
|
15751
|
+
{
|
15752
|
+
src: `^${import_path4.default.posix.join(
|
15753
|
+
"/",
|
15754
|
+
entryDirectory,
|
15755
|
+
"/((?!.+\\.action).+?)(?:/)?$"
|
15756
|
+
)}`,
|
15757
|
+
dest: import_path4.default.posix.join("/", entryDirectory, "/$1.action"),
|
15758
|
+
has: [
|
15759
|
+
{
|
15760
|
+
type: "header",
|
15761
|
+
key: "next-action"
|
15762
|
+
}
|
15763
|
+
],
|
15764
|
+
continue: true,
|
15765
|
+
override: true
|
15766
|
+
},
|
15767
|
+
{
|
15768
|
+
src: `^${import_path4.default.posix.join(
|
15769
|
+
"/",
|
15770
|
+
entryDirectory,
|
15771
|
+
"/((?!.+\\.action).+?)(?:/)?$"
|
15772
|
+
)}`,
|
15773
|
+
dest: import_path4.default.posix.join("/", entryDirectory, "/$1.action"),
|
15774
|
+
has: [
|
15775
|
+
{
|
15776
|
+
type: "header",
|
15777
|
+
key: "content-type",
|
15778
|
+
value: "multipart/form-data;.*"
|
15779
|
+
}
|
15780
|
+
],
|
15781
|
+
continue: true,
|
15782
|
+
override: true
|
15783
|
+
}
|
15784
|
+
] : [],
|
15685
15785
|
{
|
15686
15786
|
src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}`,
|
15687
15787
|
has: [
|
@@ -17387,7 +17487,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
17387
17487
|
canUsePreviewMode,
|
17388
17488
|
bypassToken: prerenderManifest.bypassToken || "",
|
17389
17489
|
isServerMode,
|
17390
|
-
experimentalPPRRoutes
|
17490
|
+
experimentalPPRRoutes,
|
17491
|
+
hasActionOutputSupport: false
|
17391
17492
|
}).then(
|
17392
17493
|
(arr) => localizeDynamicRoutes(
|
17393
17494
|
arr,
|
@@ -17413,7 +17514,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
17413
17514
|
canUsePreviewMode,
|
17414
17515
|
bypassToken: prerenderManifest.bypassToken || "",
|
17415
17516
|
isServerMode,
|
17416
|
-
experimentalPPRRoutes
|
17517
|
+
experimentalPPRRoutes,
|
17518
|
+
hasActionOutputSupport: false
|
17417
17519
|
}).then(
|
17418
17520
|
(arr) => arr.map((route) => {
|
17419
17521
|
route.src = route.src.replace("^", `^${dynamicPrefix}`);
|