@vercel/next 4.0.17 → 4.1.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 +94 -28
- package/dist/server-launcher.js +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -10703,6 +10703,9 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10703
10703
|
} = pr);
|
10704
10704
|
}
|
10705
10705
|
let isAppPathRoute = false;
|
10706
|
+
if (appDir && experimentalPPR) {
|
10707
|
+
isAppPathRoute = true;
|
10708
|
+
}
|
10706
10709
|
if (appDir && srcRoute && (!dataRoute || dataRoute?.endsWith(".rsc"))) {
|
10707
10710
|
isAppPathRoute = true;
|
10708
10711
|
}
|
@@ -10786,7 +10789,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10786
10789
|
if (routeKey !== "/index" && routeKey.endsWith("/index")) {
|
10787
10790
|
routeKey = `${routeKey}/index`;
|
10788
10791
|
routeFileNoExt = routeKey;
|
10789
|
-
origRouteFileNoExt = routeKey;
|
10790
10792
|
}
|
10791
10793
|
}
|
10792
10794
|
let outputPathPage = import_path2.default.posix.join(entryDirectory, routeFileNoExt);
|
@@ -10841,13 +10843,16 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10841
10843
|
const lambdaId = pageLambdaMap[outputSrcPathPage];
|
10842
10844
|
lambda = lambdas[lambdaId];
|
10843
10845
|
} else {
|
10844
|
-
|
10845
|
-
|
10846
|
-
|
10847
|
-
srcRoute === "/" ? "/index" : srcRoute
|
10848
|
-
),
|
10849
|
-
isServerMode
|
10846
|
+
let outputSrcPathPage = srcRoute == null ? outputPathPageOrig : import_path2.default.posix.join(
|
10847
|
+
entryDirectory,
|
10848
|
+
srcRoute === "/" ? "/index" : srcRoute
|
10850
10849
|
);
|
10850
|
+
if (!isAppPathRoute) {
|
10851
|
+
outputSrcPathPage = normalizeIndexOutput(
|
10852
|
+
outputSrcPathPage,
|
10853
|
+
isServerMode
|
10854
|
+
);
|
10855
|
+
}
|
10851
10856
|
lambda = lambdas[outputSrcPathPage];
|
10852
10857
|
}
|
10853
10858
|
if (!isAppPathRoute && !isNotFound && initialRevalidate === false) {
|
@@ -10973,10 +10978,16 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10973
10978
|
routesManifest,
|
10974
10979
|
locale2
|
10975
10980
|
);
|
10976
|
-
|
10977
|
-
|
10978
|
-
|
10981
|
+
let localeOutputPathPage = import_path2.default.posix.join(
|
10982
|
+
entryDirectory,
|
10983
|
+
localeRouteFileNoExt
|
10979
10984
|
);
|
10985
|
+
if (!isAppPathRoute) {
|
10986
|
+
localeOutputPathPage = normalizeIndexOutput(
|
10987
|
+
localeOutputPathPage,
|
10988
|
+
isServerMode
|
10989
|
+
);
|
10990
|
+
}
|
10980
10991
|
const origPrerenderPage = prerenders[outputPathPage];
|
10981
10992
|
prerenders[localeOutputPathPage] = {
|
10982
10993
|
...origPrerenderPage,
|
@@ -11188,6 +11199,7 @@ async function getMiddlewareBundle({
|
|
11188
11199
|
return {
|
11189
11200
|
type,
|
11190
11201
|
page: edgeFunction.page,
|
11202
|
+
name: edgeFunction.name,
|
11191
11203
|
edgeFunction: (() => {
|
11192
11204
|
const { source: source2, map } = wrappedModuleSource.sourceAndMap();
|
11193
11205
|
const transformedMap = stringifySourceMap(
|
@@ -11272,22 +11284,22 @@ async function getMiddlewareBundle({
|
|
11272
11284
|
edgeFunctions: {}
|
11273
11285
|
};
|
11274
11286
|
for (const worker of workerConfigs.values()) {
|
11275
|
-
|
11276
|
-
let shortPath = edgeFile;
|
11287
|
+
let shortPath = worker.name;
|
11277
11288
|
if (shortPath.startsWith("pages/")) {
|
11278
11289
|
shortPath = shortPath.replace(/^pages\//, "");
|
11279
11290
|
} else {
|
11280
11291
|
shortPath = normalizeEdgeFunctionPath(shortPath, appPathRoutesManifest);
|
11281
11292
|
}
|
11282
11293
|
if (routesManifest?.basePath) {
|
11283
|
-
|
11284
|
-
|
11285
|
-
|
11286
|
-
|
11287
|
-
|
11288
|
-
),
|
11289
|
-
true
|
11294
|
+
const isAppPathRoute = !!appPathRoutesManifest[shortPath];
|
11295
|
+
shortPath = import_path2.default.posix.join(
|
11296
|
+
"./",
|
11297
|
+
routesManifest?.basePath,
|
11298
|
+
shortPath.replace(/^\//, "")
|
11290
11299
|
);
|
11300
|
+
if (!isAppPathRoute) {
|
11301
|
+
shortPath = normalizeIndexOutput(shortPath, true);
|
11302
|
+
}
|
11291
11303
|
}
|
11292
11304
|
worker.edgeFunction.name = shortPath;
|
11293
11305
|
source.edgeFunctions[shortPath] = worker.edgeFunction;
|
@@ -11939,6 +11951,27 @@ var CORRECT_MIDDLEWARE_ORDER_VERSION = "v12.1.7-canary.29";
|
|
11939
11951
|
var NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = "v12.1.7-canary.33";
|
11940
11952
|
var EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = "v12.2.0";
|
11941
11953
|
var CORRECTED_MANIFESTS_VERSION = "v12.2.0";
|
11954
|
+
var PRELOAD_CHUNKS = {
|
11955
|
+
APP_ROUTER_PAGES: [
|
11956
|
+
".next/server/webpack-runtime.js",
|
11957
|
+
"next/dist/client/components/action-async-storage.external.js",
|
11958
|
+
"next/dist/client/components/request-async-storage.external.js",
|
11959
|
+
"next/dist/client/components/static-generation-async-storage.external.js",
|
11960
|
+
"next/dist/compiled/next-server/app-page.runtime.prod.js"
|
11961
|
+
],
|
11962
|
+
APP_ROUTER_HANDLER: [
|
11963
|
+
".next/server/webpack-runtime.js",
|
11964
|
+
"next/dist/compiled/next-server/app-route.runtime.prod.js"
|
11965
|
+
],
|
11966
|
+
PAGES_ROUTER_PAGES: [
|
11967
|
+
".next/server/webpack-runtime.js",
|
11968
|
+
"next/dist/compiled/next-server/pages.runtime.prod.js"
|
11969
|
+
],
|
11970
|
+
PAGES_ROUTER_API: [
|
11971
|
+
".next/server/webpack-api-runtime.js",
|
11972
|
+
"next/dist/compiled/next-server/pages-api.runtime.prod.js"
|
11973
|
+
]
|
11974
|
+
};
|
11942
11975
|
var BUNDLED_SERVER_NEXT_VERSION = "v13.5.4";
|
11943
11976
|
var BUNDLED_SERVER_NEXT_PATH = "next/dist/compiled/next-server/server.runtime.prod.js";
|
11944
11977
|
async function serverBuild({
|
@@ -12020,7 +12053,7 @@ async function serverBuild({
|
|
12020
12053
|
for (const rewrite of afterFilesRewrites) {
|
12021
12054
|
if (rewrite.src && rewrite.dest) {
|
12022
12055
|
rewrite.src = rewrite.src.replace(
|
12023
|
-
|
12056
|
+
/\/?\(\?:\/\)\?/,
|
12024
12057
|
"(?<rscsuff>(\\.prefetch)?\\.rsc)?(?:/)?"
|
12025
12058
|
);
|
12026
12059
|
let destQueryIndex = rewrite.dest.indexOf("?");
|
@@ -12681,8 +12714,40 @@ async function serverBuild({
|
|
12681
12714
|
});
|
12682
12715
|
}
|
12683
12716
|
}
|
12717
|
+
let launcherData2 = group.isAppRouter ? appLauncher : launcher;
|
12718
|
+
let preloadChunks = [];
|
12719
|
+
if (process.env.VERCEL_NEXT_PRELOAD_COMMON === "1") {
|
12720
|
+
const nextPackageDir = import_path4.default.dirname(
|
12721
|
+
(0, import_resolve_from.default)(projectDir, "next/package.json")
|
12722
|
+
);
|
12723
|
+
if (group.isPages) {
|
12724
|
+
preloadChunks = PRELOAD_CHUNKS.PAGES_ROUTER_PAGES;
|
12725
|
+
} else if (group.isApiLambda) {
|
12726
|
+
preloadChunks = PRELOAD_CHUNKS.PAGES_ROUTER_API;
|
12727
|
+
} else if (group.isAppRouter && !group.isAppRouteHandler) {
|
12728
|
+
preloadChunks = PRELOAD_CHUNKS.APP_ROUTER_PAGES;
|
12729
|
+
} else if (group.isAppRouteHandler) {
|
12730
|
+
preloadChunks = PRELOAD_CHUNKS.APP_ROUTER_HANDLER;
|
12731
|
+
}
|
12732
|
+
const normalizedPreloadChunks = [];
|
12733
|
+
for (const preloadChunk of preloadChunks) {
|
12734
|
+
const absoluteChunk = preloadChunk.startsWith(".next") ? import_path4.default.join(projectDir, preloadChunk) : import_path4.default.join(nextPackageDir, "..", preloadChunk);
|
12735
|
+
if (group.pseudoLayer[import_path4.default.join(".", import_path4.default.relative(baseDir, absoluteChunk))]) {
|
12736
|
+
normalizedPreloadChunks.push(
|
12737
|
+
// relative files need to be prefixed with ./ for require
|
12738
|
+
preloadChunk.startsWith(".next") ? `./${preloadChunk}` : preloadChunk
|
12739
|
+
);
|
12740
|
+
}
|
12741
|
+
}
|
12742
|
+
if (normalizedPreloadChunks.length > 0) {
|
12743
|
+
launcherData2 = launcherData2.replace(
|
12744
|
+
"// @preserve next-server-preload-target",
|
12745
|
+
normalizedPreloadChunks.map((name) => `require('${name}');`).join("\n")
|
12746
|
+
);
|
12747
|
+
}
|
12748
|
+
}
|
12684
12749
|
const launcherFiles = {
|
12685
|
-
[import_path4.default.join(import_path4.default.relative(baseDir, projectDir), "___next_launcher.cjs")]: new import_build_utils2.FileBlob({ data:
|
12750
|
+
[import_path4.default.join(import_path4.default.relative(baseDir, projectDir), "___next_launcher.cjs")]: new import_build_utils2.FileBlob({ data: launcherData2 })
|
12686
12751
|
};
|
12687
12752
|
const operationType = getOperationType({ group, prerenderManifest });
|
12688
12753
|
const options = {
|
@@ -12726,10 +12791,10 @@ async function serverBuild({
|
|
12726
12791
|
);
|
12727
12792
|
});
|
12728
12793
|
}
|
12729
|
-
let outputName =
|
12730
|
-
|
12731
|
-
true
|
12732
|
-
|
12794
|
+
let outputName = import_path4.default.posix.join(entryDirectory, pageNoExt);
|
12795
|
+
if (!group.isAppRouter && !group.isAppRouteHandler) {
|
12796
|
+
outputName = normalizeIndexOutput(outputName, true);
|
12797
|
+
}
|
12733
12798
|
if (isPPR) {
|
12734
12799
|
if (!revalidate) {
|
12735
12800
|
throw new Error("Invariant: PPR lambda isn't set");
|
@@ -12983,9 +13048,10 @@ async function serverBuild({
|
|
12983
13048
|
if (ogRoute.endsWith("/route")) {
|
12984
13049
|
continue;
|
12985
13050
|
}
|
12986
|
-
const pathname =
|
12987
|
-
|
12988
|
-
|
13051
|
+
const pathname = import_path4.default.posix.join(
|
13052
|
+
"./",
|
13053
|
+
entryDirectory,
|
13054
|
+
route === "/" ? "/index" : route
|
12989
13055
|
);
|
12990
13056
|
if (lambdas[pathname]) {
|
12991
13057
|
lambdas[`${pathname}.rsc`] = lambdas[pathname];
|
package/dist/server-launcher.js
CHANGED
@@ -12,6 +12,7 @@ if (process.env.NODE_ENV !== "production" && region !== "dev1") {
|
|
12
12
|
}
|
13
13
|
// @preserve pre-next-server-target
|
14
14
|
const NextServer = require("__NEXT_SERVER_PATH__").default;
|
15
|
+
// @preserve next-server-preload-target
|
15
16
|
const conf = __NEXT_CONFIG__;
|
16
17
|
const nextServer = new NextServer({
|
17
18
|
conf,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.1.1",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"dist"
|
14
14
|
],
|
15
15
|
"dependencies": {
|
16
|
-
"@vercel/nft": "0.26.
|
16
|
+
"@vercel/nft": "0.26.3"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"@types/aws-lambda": "8.10.19",
|
@@ -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.6.0",
|
34
34
|
"@vercel/routing-utils": "3.1.0",
|
35
35
|
"async-sema": "3.0.1",
|
36
36
|
"buffer-crc32": "0.2.13",
|