@vercel/next 4.20.5 → 4.21.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 +33 -31
- package/package.json +9 -12
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,
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
|
@@ -53,20 +53,17 @@
|
|
|
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/routing-utils": "6.4.1",
|
|
57
|
+
"@vercel/build-utils": "14.0.3"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "node build.mjs",
|
|
61
61
|
"test": "vitest run --config ../../vitest.config.mts",
|
|
62
|
-
"test-unit": "
|
|
63
|
-
"test-next-local": "
|
|
64
|
-
"test-next-local-legacy": "
|
|
65
|
-
"test-next-local:middleware": "
|
|
66
|
-
"test-e2e": "rm -f test/builder-info.json;
|
|
67
|
-
"type-check": "tsc --noEmit"
|
|
68
|
-
"vitest-run": "vitest -c ../../vitest.config.mts",
|
|
69
|
-
"vitest-unit": "glob --absolute 'test/unit/'",
|
|
70
|
-
"vitest-e2e": "glob --absolute 'test/fixtures/**/*.test.js'"
|
|
62
|
+
"test-unit": "vitest run --config ../../vitest.config.mts test/unit/",
|
|
63
|
+
"test-next-local": "vitest run --config ../../vitest.config.mts test/integration/*.test.js test/integration/*.test.ts",
|
|
64
|
+
"test-next-local-legacy": "vitest run --config ../../vitest.config.mts test/integration/legacy/*.test.js",
|
|
65
|
+
"test-next-local:middleware": "vitest run --config ../../vitest.config.mts test/integration/middleware.test.ts",
|
|
66
|
+
"test-e2e": "rm -f test/builder-info.json; vitest run --config ../../vitest.config.mts test/fixtures/ --exclude test/fixtures/00-bun-runtime/index.test.ts",
|
|
67
|
+
"type-check": "tsc --noEmit"
|
|
71
68
|
}
|
|
72
69
|
}
|