@vercel/next 4.20.4 → 4.21.1
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 +38 -33
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -11875,6 +11875,18 @@ async function createLambdaFromPseudoLayers({
|
|
|
11875
11875
|
shouldDisableAutomaticFetchInstrumentation: process.env.VERCEL_TRACING_DISABLE_AUTOMATIC_FETCH_INSTRUMENTATION === "1"
|
|
11876
11876
|
});
|
|
11877
11877
|
}
|
|
11878
|
+
function toPrerenderClassification(entry) {
|
|
11879
|
+
const { routeType, response, compute, htmlSize } = entry;
|
|
11880
|
+
if (!routeType || !response || !compute) {
|
|
11881
|
+
return void 0;
|
|
11882
|
+
}
|
|
11883
|
+
return {
|
|
11884
|
+
routeType,
|
|
11885
|
+
response,
|
|
11886
|
+
compute,
|
|
11887
|
+
...htmlSize !== void 0 ? { htmlSize } : {}
|
|
11888
|
+
};
|
|
11889
|
+
}
|
|
11878
11890
|
async function getExportIntent(entryPath) {
|
|
11879
11891
|
const pathExportMarker = import_path3.default.join(entryPath, ".next", "export-marker.json");
|
|
11880
11892
|
const hasExportMarker = await import_fs_extra3.default.access(pathExportMarker, import_fs_extra3.default.constants.F_OK).then(() => true).catch(() => false);
|
|
@@ -12042,7 +12054,11 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12042
12054
|
let prefetchDataRoute;
|
|
12043
12055
|
let allowHeader;
|
|
12044
12056
|
let renderingMode;
|
|
12057
|
+
let prerenderClassification;
|
|
12045
12058
|
if (manifest.version === 4) {
|
|
12059
|
+
prerenderClassification = toPrerenderClassification(
|
|
12060
|
+
manifest.routes[route]
|
|
12061
|
+
);
|
|
12046
12062
|
initialExpireSeconds = manifest.routes[route].initialExpireSeconds;
|
|
12047
12063
|
initialStatus = manifest.routes[route].initialStatus;
|
|
12048
12064
|
initialHeaders = manifest.routes[route].initialHeaders;
|
|
@@ -12055,6 +12071,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12055
12071
|
allowHeader = void 0;
|
|
12056
12072
|
}
|
|
12057
12073
|
ret.staticRoutes[route] = {
|
|
12074
|
+
prerenderClassification,
|
|
12058
12075
|
initialRevalidate: initialRevalidateSeconds === false ? false : Math.max(1, initialRevalidateSeconds),
|
|
12059
12076
|
initialExpire: initialExpireSeconds,
|
|
12060
12077
|
dataRoute,
|
|
@@ -12080,7 +12097,11 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12080
12097
|
let fallbackRootParams;
|
|
12081
12098
|
let allowHeader;
|
|
12082
12099
|
let fallbackSourceRoute;
|
|
12100
|
+
let prerenderClassification;
|
|
12083
12101
|
if (manifest.version === 4) {
|
|
12102
|
+
prerenderClassification = toPrerenderClassification(
|
|
12103
|
+
manifest.dynamicRoutes[lazyRoute]
|
|
12104
|
+
);
|
|
12084
12105
|
experimentalBypassFor = manifest.dynamicRoutes[lazyRoute].experimentalBypassFor;
|
|
12085
12106
|
prefetchDataRoute = manifest.dynamicRoutes[lazyRoute].prefetchDataRoute;
|
|
12086
12107
|
prefetchDataRouteRegex = manifest.dynamicRoutes[lazyRoute].prefetchDataRouteRegex;
|
|
@@ -12097,6 +12118,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12097
12118
|
}
|
|
12098
12119
|
if (typeof fallback === "string") {
|
|
12099
12120
|
ret.fallbackRoutes[lazyRoute] = {
|
|
12121
|
+
prerenderClassification,
|
|
12100
12122
|
experimentalBypassFor,
|
|
12101
12123
|
routeRegex,
|
|
12102
12124
|
fallback,
|
|
@@ -12115,6 +12137,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12115
12137
|
};
|
|
12116
12138
|
} else if (fallback === null) {
|
|
12117
12139
|
ret.blockingFallbackRoutes[lazyRoute] = {
|
|
12140
|
+
prerenderClassification,
|
|
12118
12141
|
experimentalBypassFor,
|
|
12119
12142
|
routeRegex,
|
|
12120
12143
|
dataRoute,
|
|
@@ -12128,6 +12151,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
|
|
|
12128
12151
|
};
|
|
12129
12152
|
} else {
|
|
12130
12153
|
ret.omittedRoutes[lazyRoute] = {
|
|
12154
|
+
prerenderClassification,
|
|
12131
12155
|
experimentalBypassFor,
|
|
12132
12156
|
routeRegex,
|
|
12133
12157
|
dataRoute,
|
|
@@ -12381,11 +12405,11 @@ async function getPageLambdaGroups({
|
|
|
12381
12405
|
const normalBudget = getMaxUncompressedLambdaSize(nodeVersion.runtime) - LAMBDA_RESERVED_UNCOMPRESSED_SIZE;
|
|
12382
12406
|
isLargeFunction = standaloneUncompressedSize >= normalBudget;
|
|
12383
12407
|
}
|
|
12384
|
-
const skipGroupBundling = experimentalAllowBundling || isLargeFunction;
|
|
12408
|
+
const skipGroupBundling = experimentalAllowBundling || isLargeFunction || opts.maxConcurrency !== void 0;
|
|
12385
12409
|
let matchingGroup = skipGroupBundling ? void 0 : groups.find((group) => {
|
|
12386
12410
|
const matches = (
|
|
12387
12411
|
// Never merge a normal route into a large (single-route) group.
|
|
12388
|
-
(group.isLargeFunctions ?? false) === isLargeFunction && group.maxDuration === opts.maxDuration && group.memory === opts.memory && compareRegions(group.regions, opts.regions) && compareRegions(
|
|
12412
|
+
(group.isLargeFunctions ?? false) === isLargeFunction && group.maxDuration === opts.maxDuration && group.maxConcurrency === opts.maxConcurrency && group.memory === opts.memory && compareRegions(group.regions, opts.regions) && compareRegions(
|
|
12389
12413
|
group.functionFailoverRegions,
|
|
12390
12414
|
opts.functionFailoverRegions
|
|
12391
12415
|
) && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR && JSON.stringify(group.experimentalTriggers) === JSON.stringify(opts.experimentalTriggers) && group.supportsCancellation === opts.supportsCancellation
|
|
@@ -12651,13 +12675,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12651
12675
|
message: "invariant: isOmitted and isFallback cannot both be true"
|
|
12652
12676
|
});
|
|
12653
12677
|
}
|
|
12654
|
-
const routeIsDynamic = Boolean(isFallback || isBlocking || isOmitted);
|
|
12655
|
-
let hasFallback;
|
|
12656
|
-
if (isFallback) {
|
|
12657
|
-
hasFallback = true;
|
|
12658
|
-
} else if (isBlocking || isOmitted) {
|
|
12659
|
-
hasFallback = false;
|
|
12660
|
-
}
|
|
12661
12678
|
let routeFileNoExt = routeKey === "/" ? "/index" : routeKey;
|
|
12662
12679
|
let origRouteFileNoExt = routeFileNoExt;
|
|
12663
12680
|
const { isLocalePrefixed } = prerenderManifest;
|
|
@@ -12689,8 +12706,10 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12689
12706
|
let experimentalBypassFor;
|
|
12690
12707
|
let renderingMode;
|
|
12691
12708
|
let allowHeader;
|
|
12709
|
+
let prerenderClassification;
|
|
12692
12710
|
if (isFallback || isBlocking) {
|
|
12693
12711
|
const pr = isFallback ? prerenderManifest.fallbackRoutes[routeKey] : prerenderManifest.blockingFallbackRoutes[routeKey];
|
|
12712
|
+
prerenderClassification = pr.prerenderClassification;
|
|
12694
12713
|
initialRevalidate = 1;
|
|
12695
12714
|
if (initialRevalidate === false) {
|
|
12696
12715
|
throw new import_build_utils.NowBuildError({
|
|
@@ -12705,6 +12724,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12705
12724
|
renderingMode = pr.renderingMode;
|
|
12706
12725
|
prefetchDataRoute = pr.prefetchDataRoute;
|
|
12707
12726
|
} else if (isOmitted) {
|
|
12727
|
+
prerenderClassification = prerenderManifest.omittedRoutes[routeKey].prerenderClassification;
|
|
12708
12728
|
initialRevalidate = false;
|
|
12709
12729
|
srcRoute = routeKey;
|
|
12710
12730
|
dataRoute = prerenderManifest.omittedRoutes[routeKey].dataRoute;
|
|
@@ -12714,6 +12734,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12714
12734
|
prefetchDataRoute = prerenderManifest.omittedRoutes[routeKey].prefetchDataRoute;
|
|
12715
12735
|
} else {
|
|
12716
12736
|
const pr = prerenderManifest.staticRoutes[routeKey];
|
|
12737
|
+
prerenderClassification = pr.prerenderClassification;
|
|
12717
12738
|
({
|
|
12718
12739
|
initialRevalidate,
|
|
12719
12740
|
initialExpire,
|
|
@@ -12758,23 +12779,12 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12758
12779
|
}
|
|
12759
12780
|
const isOmittedOrNotFound = isOmitted || isNotFound;
|
|
12760
12781
|
let htmlFallbackFsRef = null;
|
|
12761
|
-
let htmlSize;
|
|
12762
|
-
if (appDir) {
|
|
12763
|
-
try {
|
|
12764
|
-
htmlSize = import_fs_extra3.default.statSync(
|
|
12765
|
-
import_path3.default.join(appDir, `${routeFileNoExt}.html`)
|
|
12766
|
-
).size;
|
|
12767
|
-
} catch {
|
|
12768
|
-
}
|
|
12769
|
-
}
|
|
12770
12782
|
let postponedPrerender;
|
|
12771
12783
|
let postponedState = null;
|
|
12772
12784
|
let didPostpone = false;
|
|
12773
|
-
let hasPostponed;
|
|
12774
12785
|
if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && appDir && // TODO(NAR-402): Investigate omitted routes
|
|
12775
12786
|
!isBlocking) {
|
|
12776
12787
|
postponedState = getHTMLPostponedState({ appDir, routeFileNoExt });
|
|
12777
|
-
hasPostponed = Boolean(postponedState);
|
|
12778
12788
|
const htmlPath = import_path3.default.join(appDir, `${routeFileNoExt}.html`);
|
|
12779
12789
|
if (import_fs_extra3.default.existsSync(htmlPath)) {
|
|
12780
12790
|
const html = import_fs_extra3.default.readFileSync(htmlPath, "utf8");
|
|
@@ -13043,10 +13053,11 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
13043
13053
|
chain,
|
|
13044
13054
|
allowHeader,
|
|
13045
13055
|
partialFallback: partialFallback || void 0,
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13056
|
+
// The classification goes on the primary output only, so each route
|
|
13057
|
+
// group has exactly one classified entry; the sibling data and
|
|
13058
|
+
// segment prerenders below are grouped back to it by `sourcePath`
|
|
13059
|
+
// downstream.
|
|
13060
|
+
prerenderClassification,
|
|
13050
13061
|
...isNotFound ? {
|
|
13051
13062
|
initialStatus: 404
|
|
13052
13063
|
} : {},
|
|
@@ -13080,9 +13091,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
13080
13091
|
experimentalBypassFor,
|
|
13081
13092
|
allowHeader,
|
|
13082
13093
|
partialFallback: void 0,
|
|
13083
|
-
hasPostponed,
|
|
13084
|
-
hasFallback,
|
|
13085
|
-
isDynamicRoute: routeIsDynamic,
|
|
13086
13094
|
...isNotFound ? {
|
|
13087
13095
|
initialStatus: 404
|
|
13088
13096
|
} : {},
|
|
@@ -13137,9 +13145,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
13137
13145
|
experimentalBypassFor,
|
|
13138
13146
|
allowHeader,
|
|
13139
13147
|
partialFallback: void 0,
|
|
13140
|
-
hasPostponed,
|
|
13141
|
-
hasFallback,
|
|
13142
|
-
isDynamicRoute: routeIsDynamic,
|
|
13143
13148
|
chain: {
|
|
13144
13149
|
outputPath: normalizePathData(outputPathData),
|
|
13145
13150
|
headers: routesManifest.ppr.chain.headers
|
|
@@ -13206,9 +13211,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
13206
13211
|
group: prerenderGroup,
|
|
13207
13212
|
allowHeader,
|
|
13208
13213
|
partialFallback: void 0,
|
|
13209
|
-
hasPostponed,
|
|
13210
|
-
hasFallback,
|
|
13211
|
-
isDynamicRoute: routeIsDynamic,
|
|
13212
13214
|
// These routes are always only static, so they should not
|
|
13213
13215
|
// permit any bypass unless it's for preview
|
|
13214
13216
|
bypassToken: prerenderManifest.bypassToken,
|
|
@@ -15438,6 +15440,7 @@ ${JSON.stringify(
|
|
|
15438
15440
|
functionFailoverRegions: group.functionFailoverRegions,
|
|
15439
15441
|
runtime: nodeVersion.runtime,
|
|
15440
15442
|
maxDuration: group.maxDuration,
|
|
15443
|
+
maxConcurrency: group.maxConcurrency,
|
|
15441
15444
|
supportsCancellation: group.supportsCancellation,
|
|
15442
15445
|
isStreaming: group.isStreaming,
|
|
15443
15446
|
nextVersion,
|
|
@@ -18035,6 +18038,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
18035
18038
|
isApiLambda: !!routeIsApi,
|
|
18036
18039
|
pseudoLayer: group.pseudoLayer,
|
|
18037
18040
|
lambdaCombinedBytes: group.pseudoLayerBytes,
|
|
18041
|
+
maxConcurrency: group.maxConcurrency,
|
|
18038
18042
|
lambdaIdentifier: import_path6.default.join(
|
|
18039
18043
|
entryDirectory,
|
|
18040
18044
|
`__NEXT_${routeIsApi ? "API" : "PAGE"}_LAMBDA_${lambdaGroupIndex}`
|
|
@@ -18369,6 +18373,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
18369
18373
|
),
|
|
18370
18374
|
operationType,
|
|
18371
18375
|
runtime: nodeVersion.runtime,
|
|
18376
|
+
maxConcurrency: group.maxConcurrency,
|
|
18372
18377
|
nextVersion
|
|
18373
18378
|
});
|
|
18374
18379
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"text-table": "0.2.0",
|
|
54
54
|
"vitest": "2.0.3",
|
|
55
55
|
"webpack-sources": "3.2.3",
|
|
56
|
-
"@vercel/
|
|
57
|
-
"@vercel/
|
|
56
|
+
"@vercel/build-utils": "14.0.1",
|
|
57
|
+
"@vercel/routing-utils": "6.4.1"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "node build.mjs",
|