@vercel/next 4.1.5 → 4.2.0
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 +68 -34
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -10640,8 +10640,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10640
10640
|
pageLambdaMap,
|
10641
10641
|
routesManifest,
|
10642
10642
|
isCorrectNotFoundRoutes,
|
10643
|
-
isEmptyAllowQueryForPrendered
|
10644
|
-
omittedPrerenderRoutes
|
10643
|
+
isEmptyAllowQueryForPrendered
|
10645
10644
|
} = prerenderRouteArgs;
|
10646
10645
|
if (isBlocking && isFallback) {
|
10647
10646
|
throw new import_build_utils.NowBuildError({
|
@@ -10801,10 +10800,12 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10801
10800
|
if (isOmittedOrNotFound) {
|
10802
10801
|
initialStatus = 404;
|
10803
10802
|
}
|
10803
|
+
let addedIndexSuffix = false;
|
10804
10804
|
if (isAppPathRoute) {
|
10805
10805
|
if (routeKey !== "/index" && routeKey.endsWith("/index")) {
|
10806
10806
|
routeKey = `${routeKey}/index`;
|
10807
10807
|
routeFileNoExt = routeKey;
|
10808
|
+
addedIndexSuffix = true;
|
10808
10809
|
}
|
10809
10810
|
}
|
10810
10811
|
let outputPathPage = import_path2.default.posix.join(entryDirectory, routeFileNoExt);
|
@@ -10930,13 +10931,17 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10930
10931
|
"Invariant: experimentalStreamingLambdaPaths doesn't exist"
|
10931
10932
|
);
|
10932
10933
|
}
|
10933
|
-
|
10934
|
+
experimentalStreamingLambdaPath = experimentalStreamingLambdaPaths.get(
|
10935
|
+
pathnameToOutputName(entryDirectory, routeKey, addedIndexSuffix)
|
10936
|
+
);
|
10937
|
+
if (!experimentalStreamingLambdaPath && srcRoute) {
|
10934
10938
|
experimentalStreamingLambdaPath = experimentalStreamingLambdaPaths.get(
|
10935
10939
|
pathnameToOutputName(entryDirectory, srcRoute)
|
10936
10940
|
);
|
10937
|
-
}
|
10938
|
-
|
10939
|
-
|
10941
|
+
}
|
10942
|
+
if (!experimentalStreamingLambdaPath) {
|
10943
|
+
throw new Error(
|
10944
|
+
`Invariant: experimentalStreamingLambdaPath is undefined for routeKey=${routeKey} and srcRoute=${srcRoute ?? "null"}`
|
10940
10945
|
);
|
10941
10946
|
}
|
10942
10947
|
}
|
@@ -11095,9 +11100,12 @@ function normalizeIndexOutput(outputName, isServerMode) {
|
|
11095
11100
|
function getNextServerPath(nextVersion) {
|
11096
11101
|
return import_semver.default.gte(nextVersion, "v11.0.2-canary.4") ? "next/dist/server" : "next/dist/next-server/server";
|
11097
11102
|
}
|
11098
|
-
function pathnameToOutputName(entryDirectory, pathname) {
|
11099
|
-
if (pathname === "/")
|
11103
|
+
function pathnameToOutputName(entryDirectory, pathname, addedIndexSuffix = false) {
|
11104
|
+
if (pathname === "/") {
|
11100
11105
|
pathname = "/index";
|
11106
|
+
} else if (addedIndexSuffix) {
|
11107
|
+
pathname = pathname.replace(/\/index$/, "");
|
11108
|
+
}
|
11101
11109
|
return import_path2.default.posix.join(entryDirectory, pathname);
|
11102
11110
|
}
|
11103
11111
|
function getPostponeResumePathname(entryDirectory, pathname) {
|
@@ -11299,7 +11307,8 @@ async function getMiddlewareBundle({
|
|
11299
11307
|
framework: {
|
11300
11308
|
slug: "nextjs",
|
11301
11309
|
version: nextVersion
|
11302
|
-
}
|
11310
|
+
},
|
11311
|
+
environment: edgeFunction.environments
|
11303
11312
|
});
|
11304
11313
|
})(),
|
11305
11314
|
routeMatchers: getRouteMatchers(edgeFunction, routesManifest)
|
@@ -11400,14 +11409,21 @@ async function getMiddlewareManifest(entryPath, outputDirectory) {
|
|
11400
11409
|
const manifest = await import_fs_extra3.default.readJSON(
|
11401
11410
|
middlewareManifestPath
|
11402
11411
|
);
|
11403
|
-
|
11412
|
+
if (manifest.version === 1) {
|
11413
|
+
return upgradeMiddlewareManifestV1(manifest);
|
11414
|
+
}
|
11415
|
+
if (manifest.version === 2) {
|
11416
|
+
return upgradeMiddlewareManifestV2(manifest);
|
11417
|
+
}
|
11418
|
+
return manifest;
|
11404
11419
|
}
|
11405
|
-
function
|
11420
|
+
function upgradeMiddlewareManifestV1(v1) {
|
11406
11421
|
function updateInfo(v1Info) {
|
11407
11422
|
const { regexp, ...rest } = v1Info;
|
11408
11423
|
return {
|
11409
11424
|
...rest,
|
11410
|
-
matchers: [{ regexp }]
|
11425
|
+
matchers: [{ regexp }],
|
11426
|
+
environments: {}
|
11411
11427
|
};
|
11412
11428
|
}
|
11413
11429
|
const middleware = Object.fromEntries(
|
@@ -11418,7 +11434,28 @@ function upgradeMiddlewareManifest(v1) {
|
|
11418
11434
|
) : void 0;
|
11419
11435
|
return {
|
11420
11436
|
...v1,
|
11421
|
-
version:
|
11437
|
+
version: 3,
|
11438
|
+
middleware,
|
11439
|
+
functions
|
11440
|
+
};
|
11441
|
+
}
|
11442
|
+
function upgradeMiddlewareManifestV2(v2) {
|
11443
|
+
function updateInfo(v2Info) {
|
11444
|
+
const { ...rest } = v2Info;
|
11445
|
+
return {
|
11446
|
+
...rest,
|
11447
|
+
environments: {}
|
11448
|
+
};
|
11449
|
+
}
|
11450
|
+
const middleware = Object.fromEntries(
|
11451
|
+
Object.entries(v2.middleware).map(([p, info]) => [p, updateInfo(info)])
|
11452
|
+
);
|
11453
|
+
const functions = v2.functions ? Object.fromEntries(
|
11454
|
+
Object.entries(v2.functions).map(([p, info]) => [p, updateInfo(info)])
|
11455
|
+
) : void 0;
|
11456
|
+
return {
|
11457
|
+
...v2,
|
11458
|
+
version: 3,
|
11422
11459
|
middleware,
|
11423
11460
|
functions
|
11424
11461
|
};
|
@@ -12828,23 +12865,22 @@ async function serverBuild({
|
|
12828
12865
|
const key = getPostponeResumePathname(entryDirectory, pageName);
|
12829
12866
|
lambdas[key] = lambda;
|
12830
12867
|
experimentalStreamingLambdaPaths.set(outputName, key);
|
12831
|
-
}
|
12832
|
-
|
12833
|
-
|
12834
|
-
|
12835
|
-
|
12836
|
-
|
12837
|
-
|
12838
|
-
|
12839
|
-
|
12840
|
-
|
12841
|
-
|
12842
|
-
|
12843
|
-
|
12844
|
-
|
12845
|
-
|
12846
|
-
|
12847
|
-
}
|
12868
|
+
}
|
12869
|
+
for (const [
|
12870
|
+
routePathname,
|
12871
|
+
{ srcRoute, experimentalPPR }
|
12872
|
+
] of Object.entries(prerenderManifest.staticRoutes)) {
|
12873
|
+
if (srcRoute !== pagePathname || !experimentalPPR)
|
12874
|
+
continue;
|
12875
|
+
if (routePathname === pagePathname)
|
12876
|
+
continue;
|
12877
|
+
const key = getPostponeResumePathname(
|
12878
|
+
entryDirectory,
|
12879
|
+
routePathname
|
12880
|
+
);
|
12881
|
+
lambdas[key] = lambda;
|
12882
|
+
outputName = import_path4.default.posix.join(entryDirectory, routePathname);
|
12883
|
+
experimentalStreamingLambdaPaths.set(outputName, key);
|
12848
12884
|
}
|
12849
12885
|
continue;
|
12850
12886
|
}
|
@@ -12887,8 +12923,7 @@ async function serverBuild({
|
|
12887
12923
|
localePrefixed404,
|
12888
12924
|
hasPages404: routesManifest.pages404,
|
12889
12925
|
isCorrectNotFoundRoutes,
|
12890
|
-
isEmptyAllowQueryForPrendered
|
12891
|
-
omittedPrerenderRoutes
|
12926
|
+
isEmptyAllowQueryForPrendered
|
12892
12927
|
});
|
12893
12928
|
await Promise.all(
|
12894
12929
|
Object.keys(prerenderManifest.staticRoutes).map(
|
@@ -15260,8 +15295,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
15260
15295
|
prerenderManifest,
|
15261
15296
|
appPathRoutesManifest,
|
15262
15297
|
isSharedLambdas,
|
15263
|
-
canUsePreviewMode
|
15264
|
-
omittedPrerenderRoutes
|
15298
|
+
canUsePreviewMode
|
15265
15299
|
});
|
15266
15300
|
await Promise.all(
|
15267
15301
|
Object.keys(prerenderManifest.staticRoutes).map(
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.2.0",
|
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": "7.
|
33
|
+
"@vercel/build-utils": "7.11.0",
|
34
34
|
"@vercel/routing-utils": "3.1.0",
|
35
35
|
"async-sema": "3.0.1",
|
36
36
|
"buffer-crc32": "0.2.13",
|