@vercel/next 4.3.6 → 4.3.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 +34 -128
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -10682,7 +10682,6 @@ async function getDynamicRoutes({
|
|
10682
10682
|
bypassToken,
|
10683
10683
|
isServerMode,
|
10684
10684
|
dynamicMiddlewareRouteMap,
|
10685
|
-
hasActionOutputSupport,
|
10686
10685
|
isAppPPREnabled
|
10687
10686
|
}) {
|
10688
10687
|
if (routesManifest) {
|
@@ -10751,25 +10750,14 @@ async function getDynamicRoutes({
|
|
10751
10750
|
dest
|
10752
10751
|
});
|
10753
10752
|
}
|
10754
|
-
|
10755
|
-
|
10756
|
-
|
10757
|
-
|
10758
|
-
|
10759
|
-
|
10760
|
-
|
10761
|
-
|
10762
|
-
});
|
10763
|
-
} else {
|
10764
|
-
routes2.push({
|
10765
|
-
...route,
|
10766
|
-
src: route.src.replace(
|
10767
|
-
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
10768
|
-
"(?:\\.rsc)(?:/)?$"
|
10769
|
-
),
|
10770
|
-
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
10771
|
-
});
|
10772
|
-
}
|
10753
|
+
routes2.push({
|
10754
|
+
...route,
|
10755
|
+
src: route.src.replace(
|
10756
|
+
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
10757
|
+
"(?:\\.rsc)(?:/)?$"
|
10758
|
+
),
|
10759
|
+
dest: route.dest?.replace(/($|\?)/, ".rsc$1")
|
10760
|
+
});
|
10773
10761
|
routes2.push(route);
|
10774
10762
|
}
|
10775
10763
|
return routes2;
|
@@ -11196,11 +11184,15 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
11196
11184
|
let experimentalPPR;
|
11197
11185
|
let prefetchDataRoute;
|
11198
11186
|
let prefetchDataRouteRegex;
|
11187
|
+
let fallbackStatus;
|
11188
|
+
let fallbackHeaders;
|
11199
11189
|
if (manifest.version === 4) {
|
11200
11190
|
experimentalBypassFor = manifest.dynamicRoutes[lazyRoute].experimentalBypassFor;
|
11201
11191
|
experimentalPPR = manifest.dynamicRoutes[lazyRoute].experimentalPPR;
|
11202
11192
|
prefetchDataRoute = manifest.dynamicRoutes[lazyRoute].prefetchDataRoute;
|
11203
11193
|
prefetchDataRouteRegex = manifest.dynamicRoutes[lazyRoute].prefetchDataRouteRegex;
|
11194
|
+
fallbackStatus = manifest.dynamicRoutes[lazyRoute].fallbackStatus;
|
11195
|
+
fallbackHeaders = manifest.dynamicRoutes[lazyRoute].fallbackHeaders;
|
11204
11196
|
}
|
11205
11197
|
if (typeof fallback === "string") {
|
11206
11198
|
ret.fallbackRoutes[lazyRoute] = {
|
@@ -11208,6 +11200,8 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
11208
11200
|
experimentalPPR,
|
11209
11201
|
routeRegex,
|
11210
11202
|
fallback,
|
11203
|
+
fallbackStatus,
|
11204
|
+
fallbackHeaders,
|
11211
11205
|
dataRoute,
|
11212
11206
|
dataRouteRegex,
|
11213
11207
|
prefetchDataRoute,
|
@@ -11635,8 +11629,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
11635
11629
|
routesManifest,
|
11636
11630
|
isCorrectNotFoundRoutes,
|
11637
11631
|
isEmptyAllowQueryForPrendered,
|
11638
|
-
isAppPPREnabled
|
11639
|
-
hasActionOutputSupport
|
11632
|
+
isAppPPREnabled
|
11640
11633
|
} = prerenderRouteArgs;
|
11641
11634
|
if (isBlocking && isFallback) {
|
11642
11635
|
throw new import_build_utils.NowBuildError({
|
@@ -11716,6 +11709,15 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
11716
11709
|
let isAppPathRoute = false;
|
11717
11710
|
if (appDir && experimentalPPR) {
|
11718
11711
|
isAppPathRoute = true;
|
11712
|
+
if (isFallback) {
|
11713
|
+
const { fallbackStatus, fallbackHeaders } = prerenderManifest.fallbackRoutes[routeKey];
|
11714
|
+
if (fallbackStatus) {
|
11715
|
+
initialStatus = fallbackStatus;
|
11716
|
+
}
|
11717
|
+
if (fallbackHeaders) {
|
11718
|
+
initialHeaders = fallbackHeaders;
|
11719
|
+
}
|
11720
|
+
}
|
11719
11721
|
}
|
11720
11722
|
if (appDir && srcRoute && (!dataRoute || dataRoute?.endsWith(".rsc"))) {
|
11721
11723
|
isAppPathRoute = true;
|
@@ -11964,12 +11966,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
11964
11966
|
}
|
11965
11967
|
} : {}
|
11966
11968
|
});
|
11967
|
-
if (hasActionOutputSupport) {
|
11968
|
-
const actionOutputKey = `${import_path2.default.join("./", srcRoute || "")}.action`;
|
11969
|
-
if (srcRoute !== routeKey && lambdas[actionOutputKey]) {
|
11970
|
-
lambdas[`${routeKey}.action`] = lambdas[actionOutputKey];
|
11971
|
-
}
|
11972
|
-
}
|
11973
11969
|
const normalizePathData = (pathData) => {
|
11974
11970
|
if ((srcRoute === "/" || srcRoute == "/index") && pathData.endsWith(RSC_PREFETCH_SUFFIX)) {
|
11975
11971
|
delete lambdas[pathData];
|
@@ -12001,7 +11997,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
12001
11997
|
...isAppPathRoute ? {
|
12002
11998
|
"content-type": rscContentTypeHeader
|
12003
11999
|
} : {},
|
12004
|
-
...postponedPrerender && rscDidPostponeHeader ? { [rscDidPostponeHeader]: "1" } : {}
|
12000
|
+
...postponedPrerender && rscDidPostponeHeader && !isFallback ? { [rscDidPostponeHeader]: "1" } : {}
|
12005
12001
|
}
|
12006
12002
|
} : {}
|
12007
12003
|
});
|
@@ -12557,9 +12553,7 @@ async function getVariantsManifest(entryPath, outputDirectory) {
|
|
12557
12553
|
const hasVariantsManifest = await import_fs_extra3.default.access(pathVariantsManifest).then(() => true).catch(() => false);
|
12558
12554
|
if (!hasVariantsManifest)
|
12559
12555
|
return null;
|
12560
|
-
const variantsManifest = await import_fs_extra3.default.readJSON(
|
12561
|
-
pathVariantsManifest
|
12562
|
-
);
|
12556
|
+
const variantsManifest = await import_fs_extra3.default.readJSON(pathVariantsManifest);
|
12563
12557
|
return variantsManifest;
|
12564
12558
|
}
|
12565
12559
|
async function getServerlessPages(params) {
|
@@ -13042,7 +13036,6 @@ var CORRECT_NOT_FOUND_ROUTES_VERSION = "v12.0.1";
|
|
13042
13036
|
var CORRECT_MIDDLEWARE_ORDER_VERSION = "v12.1.7-canary.29";
|
13043
13037
|
var NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = "v12.1.7-canary.33";
|
13044
13038
|
var EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = "v12.2.0";
|
13045
|
-
var ACTION_OUTPUT_SUPPORT_VERSION = "v14.2.2";
|
13046
13039
|
var CORRECTED_MANIFESTS_VERSION = "v12.2.0";
|
13047
13040
|
var PRELOAD_CHUNKS = {
|
13048
13041
|
APP_ROUTER_PAGES: [
|
@@ -13129,7 +13122,6 @@ async function serverBuild({
|
|
13129
13122
|
nextVersion,
|
13130
13123
|
EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION
|
13131
13124
|
);
|
13132
|
-
const hasActionOutputSupport = import_semver3.default.gte(nextVersion, ACTION_OUTPUT_SUPPORT_VERSION) && Boolean(process.env.NEXT_EXPERIMENTAL_STREAMING_ACTIONS) && !routesManifest.i18n;
|
13133
13125
|
const projectDir = requiredServerFilesManifest.relativeAppDir ? import_path4.default.join(baseDir, requiredServerFilesManifest.relativeAppDir) : requiredServerFilesManifest.appDir || entryPath;
|
13134
13126
|
const inversedAppPathManifest = {};
|
13135
13127
|
if (appPathRoutesManifest) {
|
@@ -13153,7 +13145,7 @@ async function serverBuild({
|
|
13153
13145
|
}
|
13154
13146
|
for (const rewrite of afterFilesRewrites) {
|
13155
13147
|
if (rewrite.src && rewrite.dest) {
|
13156
|
-
const rscSuffix = isAppPPREnabled ? `(\\.prefetch)?\\.rsc
|
13148
|
+
const rscSuffix = isAppPPREnabled ? `(\\.prefetch)?\\.rsc` : "\\.rsc";
|
13157
13149
|
rewrite.src = rewrite.src.replace(
|
13158
13150
|
/\/?\(\?:\/\)\?/,
|
13159
13151
|
`(?<rscsuff>${rscSuffix})?(?:/)?`
|
@@ -13684,13 +13676,6 @@ ${JSON.stringify(
|
|
13684
13676
|
for (const group of appRouterLambdaGroups) {
|
13685
13677
|
group.isStreaming = true;
|
13686
13678
|
group.isAppRouter = true;
|
13687
|
-
if (hasActionOutputSupport) {
|
13688
|
-
appRouterStreamingActionLambdaGroups.push({
|
13689
|
-
...group,
|
13690
|
-
isActionLambda: true,
|
13691
|
-
isStreaming: true
|
13692
|
-
});
|
13693
|
-
}
|
13694
13679
|
}
|
13695
13680
|
for (const group of appRouteHandlersLambdaGroups) {
|
13696
13681
|
if (!group.isPrerenders) {
|
@@ -13894,16 +13879,6 @@ ${JSON.stringify(
|
|
13894
13879
|
options.layers.push(appNotFoundPsuedoLayer.pseudoLayer);
|
13895
13880
|
}
|
13896
13881
|
const lambda = await createLambdaFromPseudoLayers(options);
|
13897
|
-
let revalidate;
|
13898
|
-
if (group.isExperimentalPPR) {
|
13899
|
-
if (!options.isStreaming) {
|
13900
|
-
throw new Error("Invariant: PPR lambda isn't streaming");
|
13901
|
-
}
|
13902
|
-
revalidate = await createLambdaFromPseudoLayers({
|
13903
|
-
...options,
|
13904
|
-
isStreaming: false
|
13905
|
-
});
|
13906
|
-
}
|
13907
13882
|
for (const pageFilename of group.pages) {
|
13908
13883
|
const pageName = pageFilename.replace(/\.js$/, "");
|
13909
13884
|
const pagePathname = normalizePage(pageName);
|
@@ -13921,10 +13896,10 @@ ${JSON.stringify(
|
|
13921
13896
|
outputName = `${outputName}.action`;
|
13922
13897
|
}
|
13923
13898
|
if (isRoutePPREnabled) {
|
13924
|
-
if (!
|
13925
|
-
throw new Error("Invariant: PPR lambda isn't
|
13899
|
+
if (!options.isStreaming) {
|
13900
|
+
throw new Error("Invariant: PPR lambda isn't streaming");
|
13926
13901
|
}
|
13927
|
-
lambdas[outputName] =
|
13902
|
+
lambdas[outputName] = lambda;
|
13928
13903
|
if (!omittedPrerenderRoutes.has(pagePathname)) {
|
13929
13904
|
const key = getPostponeResumePathname(entryDirectory, pageName);
|
13930
13905
|
lambdas[key] = lambda;
|
@@ -13994,8 +13969,7 @@ ${JSON.stringify(
|
|
13994
13969
|
hasPages404: routesManifest.pages404,
|
13995
13970
|
isCorrectNotFoundRoutes,
|
13996
13971
|
isEmptyAllowQueryForPrendered,
|
13997
|
-
isAppPPREnabled
|
13998
|
-
hasActionOutputSupport
|
13972
|
+
isAppPPREnabled
|
13999
13973
|
});
|
14000
13974
|
await Promise.all(
|
14001
13975
|
Object.keys(prerenderManifest.staticRoutes).map(
|
@@ -14060,8 +14034,7 @@ ${JSON.stringify(
|
|
14060
14034
|
bypassToken: prerenderManifest.bypassToken || "",
|
14061
14035
|
isServerMode: true,
|
14062
14036
|
dynamicMiddlewareRouteMap: middleware.dynamicRouteMap,
|
14063
|
-
isAppPPREnabled
|
14064
|
-
hasActionOutputSupport
|
14037
|
+
isAppPPREnabled
|
14065
14038
|
}).then(
|
14066
14039
|
(arr) => localizeDynamicRoutes(
|
14067
14040
|
arr,
|
@@ -14218,9 +14191,6 @@ ${JSON.stringify(
|
|
14218
14191
|
if (isAppPPREnabled) {
|
14219
14192
|
edgeFunctions[`${pathname}${RSC_PREFETCH_SUFFIX}`] = edgeFunctions[pathname];
|
14220
14193
|
}
|
14221
|
-
if (hasActionOutputSupport) {
|
14222
|
-
edgeFunctions[`${pathname}.action`] = edgeFunctions[pathname];
|
14223
|
-
}
|
14224
14194
|
}
|
14225
14195
|
}
|
14226
14196
|
}
|
@@ -14481,52 +14451,6 @@ ${JSON.stringify(
|
|
14481
14451
|
override: true
|
14482
14452
|
}
|
14483
14453
|
] : [],
|
14484
|
-
...hasActionOutputSupport ? [
|
14485
|
-
// Create rewrites for streaming prerenders (.action routes)
|
14486
|
-
// This contains separate rewrites for each possible "has" (action header, or content-type)
|
14487
|
-
// Also includes separate handling for index routes which should match to /index.action.
|
14488
|
-
// This follows the same pattern as the rewrites for .rsc files.
|
14489
|
-
{
|
14490
|
-
src: `^${import_path4.default.posix.join("/", entryDirectory, "/?")}`,
|
14491
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/index.action"),
|
14492
|
-
has: [
|
14493
|
-
{
|
14494
|
-
type: "header",
|
14495
|
-
key: "next-action"
|
14496
|
-
}
|
14497
|
-
],
|
14498
|
-
missing: [
|
14499
|
-
{
|
14500
|
-
type: "header",
|
14501
|
-
key: rscHeader
|
14502
|
-
}
|
14503
|
-
],
|
14504
|
-
continue: true,
|
14505
|
-
override: true
|
14506
|
-
},
|
14507
|
-
{
|
14508
|
-
src: `^${import_path4.default.posix.join(
|
14509
|
-
"/",
|
14510
|
-
entryDirectory,
|
14511
|
-
"/((?!.+\\.action).+?)(?:/)?$"
|
14512
|
-
)}`,
|
14513
|
-
dest: import_path4.default.posix.join("/", entryDirectory, "/$1.action"),
|
14514
|
-
has: [
|
14515
|
-
{
|
14516
|
-
type: "header",
|
14517
|
-
key: "next-action"
|
14518
|
-
}
|
14519
|
-
],
|
14520
|
-
missing: [
|
14521
|
-
{
|
14522
|
-
type: "header",
|
14523
|
-
key: rscHeader
|
14524
|
-
}
|
14525
|
-
],
|
14526
|
-
continue: true,
|
14527
|
-
override: true
|
14528
|
-
}
|
14529
|
-
] : [],
|
14530
14454
|
{
|
14531
14455
|
src: `^${import_path4.default.posix.join("/", entryDirectory, "/?")}`,
|
14532
14456
|
has: [
|
@@ -14597,22 +14521,6 @@ ${JSON.stringify(
|
|
14597
14521
|
// These need to come before handle: miss or else they are grouped
|
14598
14522
|
// with that routing section
|
14599
14523
|
...afterFilesRewrites,
|
14600
|
-
// Ensure that after we normalize `afterFilesRewrites`, unmatched actions are routed to the correct handler
|
14601
|
-
// e.g. /foo/.action -> /foo.action. This should only ever match in cases where we're routing to an action handler
|
14602
|
-
// and the rewrite normalization led to something like /foo/$1$rscsuff, and $1 had no match.
|
14603
|
-
// This is meant to have parity with the .rsc handling below.
|
14604
|
-
...hasActionOutputSupport ? [
|
14605
|
-
{
|
14606
|
-
src: `${import_path4.default.posix.join("/", entryDirectory, "/\\.action$")}`,
|
14607
|
-
dest: `${import_path4.default.posix.join("/", entryDirectory, "/index.action")}`,
|
14608
|
-
check: true
|
14609
|
-
},
|
14610
|
-
{
|
14611
|
-
src: `${import_path4.default.posix.join("/", entryDirectory, "(.+)/\\.action$")}`,
|
14612
|
-
dest: `${import_path4.default.posix.join("/", entryDirectory, "$1.action")}`,
|
14613
|
-
check: true
|
14614
|
-
}
|
14615
|
-
] : [],
|
14616
14524
|
// ensure non-normalized /.rsc from rewrites is handled
|
14617
14525
|
...appPathRoutesManifest ? [
|
14618
14526
|
{
|
@@ -16251,8 +16159,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
16251
16159
|
canUsePreviewMode,
|
16252
16160
|
bypassToken: prerenderManifest.bypassToken || "",
|
16253
16161
|
isServerMode,
|
16254
|
-
isAppPPREnabled: false
|
16255
|
-
hasActionOutputSupport: false
|
16162
|
+
isAppPPREnabled: false
|
16256
16163
|
}).then(
|
16257
16164
|
(arr) => localizeDynamicRoutes(
|
16258
16165
|
arr,
|
@@ -16278,8 +16185,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
16278
16185
|
canUsePreviewMode,
|
16279
16186
|
bypassToken: prerenderManifest.bypassToken || "",
|
16280
16187
|
isServerMode,
|
16281
|
-
isAppPPREnabled: false
|
16282
|
-
hasActionOutputSupport: false
|
16188
|
+
isAppPPREnabled: false
|
16283
16189
|
}).then(
|
16284
16190
|
(arr) => arr.map((route) => {
|
16285
16191
|
route.src = route.src.replace("^", `^${dynamicPrefix}`);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.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": "8.
|
33
|
+
"@vercel/build-utils": "8.4.0",
|
34
34
|
"@vercel/routing-utils": "3.1.0",
|
35
35
|
"async-sema": "3.0.1",
|
36
36
|
"buffer-crc32": "0.2.13",
|