@vercel/next 4.10.10 → 4.11.2
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 +100 -39
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11162,6 +11162,14 @@ async function getDynamicRoutes({
|
|
|
11162
11162
|
case 3:
|
|
11163
11163
|
case 4: {
|
|
11164
11164
|
const routes2 = [];
|
|
11165
|
+
if (isAppClientSegmentCacheEnabled && !isAppPPREnabled) {
|
|
11166
|
+
routes2.push({
|
|
11167
|
+
src: "^/(?<path>.+)(?<rscSuffix>\\.segments/.+\\.segment\\.rsc)(?:/)?$",
|
|
11168
|
+
dest: `/$path${isAppPPREnabled ? ".prefetch.rsc" : ".rsc"}`,
|
|
11169
|
+
check: true,
|
|
11170
|
+
override: true
|
|
11171
|
+
});
|
|
11172
|
+
}
|
|
11165
11173
|
for (const dynamicRoute of routesManifest.dynamicRoutes) {
|
|
11166
11174
|
if (!canUsePreviewMode && omittedRoutes?.has(dynamicRoute.page)) {
|
|
11167
11175
|
continue;
|
|
@@ -11182,7 +11190,8 @@ async function getDynamicRoutes({
|
|
|
11182
11190
|
namedRegex,
|
|
11183
11191
|
regex,
|
|
11184
11192
|
routeKeys,
|
|
11185
|
-
prefetchSegmentDataRoutes
|
|
11193
|
+
prefetchSegmentDataRoutes,
|
|
11194
|
+
hasFallbackRootParams
|
|
11186
11195
|
} = params;
|
|
11187
11196
|
const route = {
|
|
11188
11197
|
src: namedRegex || regex,
|
|
@@ -11191,6 +11200,10 @@ async function getDynamicRoutes({
|
|
|
11191
11200
|
if (!isServerMode) {
|
|
11192
11201
|
route.check = true;
|
|
11193
11202
|
}
|
|
11203
|
+
if (isAppPPREnabled || isAppClientSegmentCacheEnabled) {
|
|
11204
|
+
route.check = true;
|
|
11205
|
+
route.override = true;
|
|
11206
|
+
}
|
|
11194
11207
|
if (isServerMode && canUsePreviewMode && omittedRoutes?.has(page)) {
|
|
11195
11208
|
route.has = [
|
|
11196
11209
|
{
|
|
@@ -11207,7 +11220,6 @@ async function getDynamicRoutes({
|
|
|
11207
11220
|
if (isAppClientSegmentCacheEnabled && prefetchSegmentDataRoutes && prefetchSegmentDataRoutes.length > 0) {
|
|
11208
11221
|
for (const prefetchSegmentDataRoute of prefetchSegmentDataRoutes) {
|
|
11209
11222
|
routes2.push({
|
|
11210
|
-
...route,
|
|
11211
11223
|
src: prefetchSegmentDataRoute.source,
|
|
11212
11224
|
dest: getDestinationForSegmentRoute(
|
|
11213
11225
|
isDev === true,
|
|
@@ -11215,18 +11227,23 @@ async function getDynamicRoutes({
|
|
|
11215
11227
|
routeKeys,
|
|
11216
11228
|
prefetchSegmentDataRoute
|
|
11217
11229
|
),
|
|
11218
|
-
check: true
|
|
11230
|
+
check: true,
|
|
11231
|
+
override: true
|
|
11219
11232
|
});
|
|
11220
11233
|
}
|
|
11221
11234
|
}
|
|
11222
11235
|
if (isAppPPREnabled || isAppClientSegmentCacheEnabled) {
|
|
11223
11236
|
routes2.push({
|
|
11224
|
-
...route,
|
|
11225
11237
|
src: route.src.replace(
|
|
11226
11238
|
new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
|
|
11227
|
-
"(?<rscSuffix>\\.rsc|\\.prefetch\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$"
|
|
11239
|
+
hasFallbackRootParams ? "\\.rsc(?:/)?$" : "(?<rscSuffix>\\.rsc|\\.prefetch\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$"
|
|
11228
11240
|
),
|
|
11229
|
-
dest: route.dest?.replace(
|
|
11241
|
+
dest: route.dest?.replace(
|
|
11242
|
+
/($|\?)/,
|
|
11243
|
+
hasFallbackRootParams ? ".rsc$1" : "$rscSuffix$1"
|
|
11244
|
+
),
|
|
11245
|
+
check: true,
|
|
11246
|
+
override: true
|
|
11230
11247
|
});
|
|
11231
11248
|
} else {
|
|
11232
11249
|
routes2.push({
|
|
@@ -11621,7 +11638,13 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
11621
11638
|
};
|
|
11622
11639
|
});
|
|
11623
11640
|
lazyRoutes.forEach((lazyRoute) => {
|
|
11624
|
-
const {
|
|
11641
|
+
const {
|
|
11642
|
+
routeRegex,
|
|
11643
|
+
fallback,
|
|
11644
|
+
dataRoute,
|
|
11645
|
+
dataRouteRegex,
|
|
11646
|
+
fallbackRootParams
|
|
11647
|
+
} = manifest.dynamicRoutes[lazyRoute];
|
|
11625
11648
|
if (fallback) {
|
|
11626
11649
|
ret.fallbackRoutes[lazyRoute] = {
|
|
11627
11650
|
routeRegex,
|
|
@@ -11635,6 +11658,8 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
11635
11658
|
ret.blockingFallbackRoutes[lazyRoute] = {
|
|
11636
11659
|
routeRegex,
|
|
11637
11660
|
dataRoute,
|
|
11661
|
+
fallback: null,
|
|
11662
|
+
fallbackRootParams,
|
|
11638
11663
|
dataRouteRegex,
|
|
11639
11664
|
renderingMode: "STATIC" /* STATIC */,
|
|
11640
11665
|
allowHeader: void 0
|
|
@@ -11750,7 +11775,8 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
11750
11775
|
prefetchDataRouteRegex,
|
|
11751
11776
|
renderingMode,
|
|
11752
11777
|
allowHeader,
|
|
11753
|
-
fallbackRootParams
|
|
11778
|
+
fallbackRootParams,
|
|
11779
|
+
fallback: null
|
|
11754
11780
|
};
|
|
11755
11781
|
} else {
|
|
11756
11782
|
ret.omittedRoutes[lazyRoute] = {
|
|
@@ -11937,6 +11963,30 @@ async function getPageLambdaGroups({
|
|
|
11937
11963
|
});
|
|
11938
11964
|
opts = { ...vercelConfigOpts, ...opts };
|
|
11939
11965
|
}
|
|
11966
|
+
const isGeneratedSteps = routeName.includes("api/generated/steps");
|
|
11967
|
+
const isGeneratedWorkflows = routeName.includes("api/generated/workflows");
|
|
11968
|
+
if (isGeneratedSteps || isGeneratedWorkflows) {
|
|
11969
|
+
const sourceFile = await getSourceFilePathFromPage({
|
|
11970
|
+
workPath: entryPath,
|
|
11971
|
+
page: normalizeSourceFilePageFromManifest(
|
|
11972
|
+
routeName,
|
|
11973
|
+
page,
|
|
11974
|
+
inversedAppPathManifest
|
|
11975
|
+
),
|
|
11976
|
+
pageExtensions
|
|
11977
|
+
});
|
|
11978
|
+
const config2 = JSON.parse(
|
|
11979
|
+
await import_fs_extra3.default.readFile(
|
|
11980
|
+
import_path2.default.join(entryPath, import_path2.default.dirname(sourceFile), "../config.json"),
|
|
11981
|
+
"utf8"
|
|
11982
|
+
).catch(() => "{}")
|
|
11983
|
+
);
|
|
11984
|
+
if (isGeneratedSteps && config2.steps) {
|
|
11985
|
+
Object.assign(opts, config2.steps);
|
|
11986
|
+
} else if (isGeneratedWorkflows && config2.workflows) {
|
|
11987
|
+
Object.assign(opts, config2.workflows);
|
|
11988
|
+
}
|
|
11989
|
+
}
|
|
11940
11990
|
let matchingGroup = experimentalAllowBundling ? void 0 : groups.find((group) => {
|
|
11941
11991
|
const matches = group.maxDuration === opts.maxDuration && group.memory === opts.memory && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR && JSON.stringify(group.experimentalTriggers) === JSON.stringify(opts.experimentalTriggers);
|
|
11942
11992
|
if (matches) {
|
|
@@ -12519,8 +12569,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12519
12569
|
}
|
|
12520
12570
|
let htmlAllowQuery = allowQuery;
|
|
12521
12571
|
if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && (isFallback || isBlocking)) {
|
|
12522
|
-
const { fallbackRootParams } = isFallback ? prerenderManifest.fallbackRoutes[routeKey] : prerenderManifest.blockingFallbackRoutes[routeKey];
|
|
12523
|
-
if (fallbackRootParams && fallbackRootParams.length > 0) {
|
|
12572
|
+
const { fallbackRootParams, fallback } = isFallback ? prerenderManifest.fallbackRoutes[routeKey] : prerenderManifest.blockingFallbackRoutes[routeKey];
|
|
12573
|
+
if (fallback && typeof fallback === "string" && fallbackRootParams && fallbackRootParams.length > 0) {
|
|
12524
12574
|
htmlAllowQuery = fallbackRootParams;
|
|
12525
12575
|
} else if (postponedPrerender) {
|
|
12526
12576
|
htmlAllowQuery = [];
|
|
@@ -15165,6 +15215,9 @@ ${JSON.stringify(
|
|
|
15165
15215
|
lambdas[dataPathname] = lambdas[srcPathname];
|
|
15166
15216
|
}
|
|
15167
15217
|
}
|
|
15218
|
+
const shouldHandleSegmentToRsc = Boolean(
|
|
15219
|
+
isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix
|
|
15220
|
+
);
|
|
15168
15221
|
return {
|
|
15169
15222
|
wildcard: wildcardConfig,
|
|
15170
15223
|
images: getImagesConfig(imagesManifest),
|
|
@@ -15183,7 +15236,18 @@ ${JSON.stringify(
|
|
|
15183
15236
|
...nodeMiddleware?.lambdas,
|
|
15184
15237
|
...isNextDataServerResolving ? {
|
|
15185
15238
|
__next_data_catchall: nextDataCatchallOutput
|
|
15186
|
-
} : {}
|
|
15239
|
+
} : {},
|
|
15240
|
+
// When bots crawl a site, they may render the page after awhile (e.g. re-sync),
|
|
15241
|
+
// and the sub-assets may not be available then. In this case, the link to
|
|
15242
|
+
// static assets could be not found, and return a 404 HTML. This behavior can
|
|
15243
|
+
// bait the bots as if they found 404 pages. In Next.js it is handled on the
|
|
15244
|
+
// server to return a plain text "Not Found". However, as we handle the "_next/static/"
|
|
15245
|
+
// routes in Vercel CLI, the Next.js behavior is overwritten. Therefore, create a
|
|
15246
|
+
// ".txt" file with "Not Found" content and rewrite any not found static assets to it.
|
|
15247
|
+
[import_path4.default.posix.join(".", entryDirectory, "_next/static/not-found.txt")]: new import_build_utils2.FileBlob({
|
|
15248
|
+
data: "Not Found",
|
|
15249
|
+
contentType: "text/plain"
|
|
15250
|
+
})
|
|
15187
15251
|
},
|
|
15188
15252
|
routes: [
|
|
15189
15253
|
/*
|
|
@@ -15587,14 +15651,17 @@ ${JSON.stringify(
|
|
|
15587
15651
|
// We need to make sure to 404 for /_next after handle: miss since
|
|
15588
15652
|
// handle: miss is called before rewrites and to prevent rewriting /_next
|
|
15589
15653
|
{
|
|
15590
|
-
src: import_path4.default.posix.join(
|
|
15654
|
+
src: import_path4.default.posix.join("/", entryDirectory, "_next/static/.+"),
|
|
15655
|
+
status: 404,
|
|
15656
|
+
check: true,
|
|
15657
|
+
dest: import_path4.default.posix.join(
|
|
15591
15658
|
"/",
|
|
15592
15659
|
entryDirectory,
|
|
15593
|
-
"_next/static/
|
|
15660
|
+
"_next/static/not-found.txt"
|
|
15594
15661
|
),
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15662
|
+
headers: {
|
|
15663
|
+
"content-type": "text/plain; charset=utf-8"
|
|
15664
|
+
}
|
|
15598
15665
|
},
|
|
15599
15666
|
// remove locale prefixes to check public files and
|
|
15600
15667
|
// to allow checking non-prefixed lambda outputs
|
|
@@ -15646,19 +15713,11 @@ ${JSON.stringify(
|
|
|
15646
15713
|
}
|
|
15647
15714
|
] : [],
|
|
15648
15715
|
// If it didn't match any of the static routes or dynamic ones, then we
|
|
15649
|
-
// should fallback to
|
|
15650
|
-
...
|
|
15716
|
+
// should fallback to either prefetch or normal RSC request
|
|
15717
|
+
...shouldHandleSegmentToRsc && prefetchSegmentDirSuffix && prefetchSegmentSuffix ? [
|
|
15651
15718
|
{
|
|
15652
|
-
src:
|
|
15653
|
-
|
|
15654
|
-
entryDirectory,
|
|
15655
|
-
`/(?<path>.+)${(0, import_escape_string_regexp2.default)(prefetchSegmentDirSuffix)}/.+${(0, import_escape_string_regexp2.default)(prefetchSegmentSuffix)}$`
|
|
15656
|
-
),
|
|
15657
|
-
dest: import_path4.default.posix.join(
|
|
15658
|
-
"/",
|
|
15659
|
-
entryDirectory,
|
|
15660
|
-
isAppPPREnabled ? "/$path.prefetch.rsc" : "/$path.rsc"
|
|
15661
|
-
),
|
|
15719
|
+
src: "^/(?<path>.+)(?<rscSuffix>\\.segments/.+\\.segment\\.rsc)(?:/)?$",
|
|
15720
|
+
dest: `/$path${isAppPPREnabled ? ".prefetch.rsc" : ".rsc"}`,
|
|
15662
15721
|
check: true
|
|
15663
15722
|
}
|
|
15664
15723
|
] : [],
|
|
@@ -16559,14 +16618,17 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16559
16618
|
// /_next
|
|
16560
16619
|
{ handle: "miss" },
|
|
16561
16620
|
{
|
|
16562
|
-
src: import_path5.default.posix.join(
|
|
16621
|
+
src: import_path5.default.posix.join("/", entryDirectory, "_next/static/.+"),
|
|
16622
|
+
status: 404,
|
|
16623
|
+
check: true,
|
|
16624
|
+
dest: import_path5.default.posix.join(
|
|
16563
16625
|
"/",
|
|
16564
16626
|
entryDirectory,
|
|
16565
|
-
"_next/static/
|
|
16627
|
+
"_next/static/not-found.txt"
|
|
16566
16628
|
),
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16629
|
+
headers: {
|
|
16630
|
+
"content-type": "text/plain; charset=utf-8"
|
|
16631
|
+
}
|
|
16570
16632
|
},
|
|
16571
16633
|
// Dynamic routes
|
|
16572
16634
|
// TODO: do we want to do this?: ...dynamicRoutes,
|
|
@@ -17807,14 +17869,13 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17807
17869
|
// handle: miss is called before rewrites and to prevent rewriting /_next
|
|
17808
17870
|
{ handle: "miss" },
|
|
17809
17871
|
{
|
|
17810
|
-
src: import_path5.default.join(
|
|
17811
|
-
"/",
|
|
17812
|
-
entryDirectory,
|
|
17813
|
-
"_next/static/(?:[^/]+/pages|pages|chunks|runtime|css|image|media)/.+"
|
|
17814
|
-
),
|
|
17872
|
+
src: import_path5.default.join("/", entryDirectory, "_next/static/.+"),
|
|
17815
17873
|
status: 404,
|
|
17816
17874
|
check: true,
|
|
17817
|
-
dest: "
|
|
17875
|
+
dest: import_path5.default.join("/", entryDirectory, "_next/static/not-found.txt"),
|
|
17876
|
+
headers: {
|
|
17877
|
+
"content-type": "text/plain; charset=utf-8"
|
|
17878
|
+
}
|
|
17818
17879
|
},
|
|
17819
17880
|
// remove locale prefixes to check public files
|
|
17820
17881
|
...i18n ? [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.2",
|
|
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": "11.0.
|
|
33
|
+
"@vercel/build-utils": "11.0.1",
|
|
34
34
|
"@vercel/routing-utils": "5.1.1",
|
|
35
35
|
"async-sema": "3.0.1",
|
|
36
36
|
"buffer-crc32": "0.2.13",
|