@vercel/next 4.1.0 → 4.1.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 +106 -30
- package/dist/server-launcher.js +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -9971,6 +9971,7 @@ async function createLambdaFromPseudoLayers({
|
|
9971
9971
|
layers,
|
9972
9972
|
isStreaming,
|
9973
9973
|
nextVersion,
|
9974
|
+
experimentalAllowBundling,
|
9974
9975
|
...lambdaOptions
|
9975
9976
|
}) {
|
9976
9977
|
await createLambdaSema.acquire();
|
@@ -10007,7 +10008,8 @@ async function createLambdaFromPseudoLayers({
|
|
10007
10008
|
framework: {
|
10008
10009
|
slug: "nextjs",
|
10009
10010
|
version: nextVersion
|
10010
|
-
}
|
10011
|
+
},
|
10012
|
+
experimentalAllowBundling
|
10011
10013
|
});
|
10012
10014
|
}
|
10013
10015
|
async function getExportIntent(entryPath) {
|
@@ -10365,7 +10367,8 @@ async function getPageLambdaGroups({
|
|
10365
10367
|
lambdaCompressedByteLimit,
|
10366
10368
|
internalPages,
|
10367
10369
|
pageExtensions,
|
10368
|
-
inversedAppPathManifest
|
10370
|
+
inversedAppPathManifest,
|
10371
|
+
experimentalAllowBundling
|
10369
10372
|
}) {
|
10370
10373
|
const groups = [];
|
10371
10374
|
for (const page of pages) {
|
@@ -10392,7 +10395,7 @@ async function getPageLambdaGroups({
|
|
10392
10395
|
});
|
10393
10396
|
opts = { ...vercelConfigOpts, ...opts };
|
10394
10397
|
}
|
10395
|
-
let matchingGroup = groups.find((group) => {
|
10398
|
+
let matchingGroup = experimentalAllowBundling ? void 0 : groups.find((group) => {
|
10396
10399
|
const matches = group.maxDuration === opts.maxDuration && group.memory === opts.memory && group.isPrerenders === isPrerenderRoute && group.isExperimentalPPR === isExperimentalPPR;
|
10397
10400
|
if (matches) {
|
10398
10401
|
let newTracedFilesSize = group.pseudoLayerBytes;
|
@@ -10703,6 +10706,9 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10703
10706
|
} = pr);
|
10704
10707
|
}
|
10705
10708
|
let isAppPathRoute = false;
|
10709
|
+
if (appDir && experimentalPPR) {
|
10710
|
+
isAppPathRoute = true;
|
10711
|
+
}
|
10706
10712
|
if (appDir && srcRoute && (!dataRoute || dataRoute?.endsWith(".rsc"))) {
|
10707
10713
|
isAppPathRoute = true;
|
10708
10714
|
}
|
@@ -10786,7 +10792,6 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10786
10792
|
if (routeKey !== "/index" && routeKey.endsWith("/index")) {
|
10787
10793
|
routeKey = `${routeKey}/index`;
|
10788
10794
|
routeFileNoExt = routeKey;
|
10789
|
-
origRouteFileNoExt = routeKey;
|
10790
10795
|
}
|
10791
10796
|
}
|
10792
10797
|
let outputPathPage = import_path2.default.posix.join(entryDirectory, routeFileNoExt);
|
@@ -10841,13 +10846,16 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10841
10846
|
const lambdaId = pageLambdaMap[outputSrcPathPage];
|
10842
10847
|
lambda = lambdas[lambdaId];
|
10843
10848
|
} else {
|
10844
|
-
|
10845
|
-
|
10846
|
-
|
10847
|
-
srcRoute === "/" ? "/index" : srcRoute
|
10848
|
-
),
|
10849
|
-
isServerMode
|
10849
|
+
let outputSrcPathPage = srcRoute == null ? outputPathPageOrig : import_path2.default.posix.join(
|
10850
|
+
entryDirectory,
|
10851
|
+
srcRoute === "/" ? "/index" : srcRoute
|
10850
10852
|
);
|
10853
|
+
if (!isAppPathRoute) {
|
10854
|
+
outputSrcPathPage = normalizeIndexOutput(
|
10855
|
+
outputSrcPathPage,
|
10856
|
+
isServerMode
|
10857
|
+
);
|
10858
|
+
}
|
10851
10859
|
lambda = lambdas[outputSrcPathPage];
|
10852
10860
|
}
|
10853
10861
|
if (!isAppPathRoute && !isNotFound && initialRevalidate === false) {
|
@@ -10973,10 +10981,16 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
10973
10981
|
routesManifest,
|
10974
10982
|
locale2
|
10975
10983
|
);
|
10976
|
-
|
10977
|
-
|
10978
|
-
|
10984
|
+
let localeOutputPathPage = import_path2.default.posix.join(
|
10985
|
+
entryDirectory,
|
10986
|
+
localeRouteFileNoExt
|
10979
10987
|
);
|
10988
|
+
if (!isAppPathRoute) {
|
10989
|
+
localeOutputPathPage = normalizeIndexOutput(
|
10990
|
+
localeOutputPathPage,
|
10991
|
+
isServerMode
|
10992
|
+
);
|
10993
|
+
}
|
10980
10994
|
const origPrerenderPage = prerenders[outputPathPage];
|
10981
10995
|
prerenders[localeOutputPathPage] = {
|
10982
10996
|
...origPrerenderPage,
|
@@ -11280,14 +11294,15 @@ async function getMiddlewareBundle({
|
|
11280
11294
|
shortPath = normalizeEdgeFunctionPath(shortPath, appPathRoutesManifest);
|
11281
11295
|
}
|
11282
11296
|
if (routesManifest?.basePath) {
|
11283
|
-
|
11284
|
-
|
11285
|
-
|
11286
|
-
|
11287
|
-
|
11288
|
-
),
|
11289
|
-
true
|
11297
|
+
const isAppPathRoute = !!appPathRoutesManifest[shortPath];
|
11298
|
+
shortPath = import_path2.default.posix.join(
|
11299
|
+
"./",
|
11300
|
+
routesManifest?.basePath,
|
11301
|
+
shortPath.replace(/^\//, "")
|
11290
11302
|
);
|
11303
|
+
if (!isAppPathRoute) {
|
11304
|
+
shortPath = normalizeIndexOutput(shortPath, true);
|
11305
|
+
}
|
11291
11306
|
}
|
11292
11307
|
worker.edgeFunction.name = shortPath;
|
11293
11308
|
source.edgeFunctions[shortPath] = worker.edgeFunction;
|
@@ -11939,6 +11954,27 @@ var CORRECT_MIDDLEWARE_ORDER_VERSION = "v12.1.7-canary.29";
|
|
11939
11954
|
var NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = "v12.1.7-canary.33";
|
11940
11955
|
var EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = "v12.2.0";
|
11941
11956
|
var CORRECTED_MANIFESTS_VERSION = "v12.2.0";
|
11957
|
+
var PRELOAD_CHUNKS = {
|
11958
|
+
APP_ROUTER_PAGES: [
|
11959
|
+
".next/server/webpack-runtime.js",
|
11960
|
+
"next/dist/client/components/action-async-storage.external.js",
|
11961
|
+
"next/dist/client/components/request-async-storage.external.js",
|
11962
|
+
"next/dist/client/components/static-generation-async-storage.external.js",
|
11963
|
+
"next/dist/compiled/next-server/app-page.runtime.prod.js"
|
11964
|
+
],
|
11965
|
+
APP_ROUTER_HANDLER: [
|
11966
|
+
".next/server/webpack-runtime.js",
|
11967
|
+
"next/dist/compiled/next-server/app-route.runtime.prod.js"
|
11968
|
+
],
|
11969
|
+
PAGES_ROUTER_PAGES: [
|
11970
|
+
".next/server/webpack-runtime.js",
|
11971
|
+
"next/dist/compiled/next-server/pages.runtime.prod.js"
|
11972
|
+
],
|
11973
|
+
PAGES_ROUTER_API: [
|
11974
|
+
".next/server/webpack-api-runtime.js",
|
11975
|
+
"next/dist/compiled/next-server/pages-api.runtime.prod.js"
|
11976
|
+
]
|
11977
|
+
};
|
11942
11978
|
var BUNDLED_SERVER_NEXT_VERSION = "v13.5.4";
|
11943
11979
|
var BUNDLED_SERVER_NEXT_PATH = "next/dist/compiled/next-server/server.runtime.prod.js";
|
11944
11980
|
async function serverBuild({
|
@@ -11984,6 +12020,9 @@ async function serverBuild({
|
|
11984
12020
|
variantsManifest
|
11985
12021
|
}) {
|
11986
12022
|
lambdaPages = Object.assign({}, lambdaPages, lambdaAppPaths);
|
12023
|
+
const experimentalAllowBundling = Boolean(
|
12024
|
+
process.env.NEXT_EXPERIMENTAL_FUNCTION_BUNDLING
|
12025
|
+
);
|
11987
12026
|
const lambdas = {};
|
11988
12027
|
const prerenders = {};
|
11989
12028
|
const lambdaPageKeys = Object.keys(lambdaPages);
|
@@ -12020,7 +12059,7 @@ async function serverBuild({
|
|
12020
12059
|
for (const rewrite of afterFilesRewrites) {
|
12021
12060
|
if (rewrite.src && rewrite.dest) {
|
12022
12061
|
rewrite.src = rewrite.src.replace(
|
12023
|
-
|
12062
|
+
/\/?\(\?:\/\)\?/,
|
12024
12063
|
"(?<rscsuff>(\\.prefetch)?\\.rsc)?(?:/)?"
|
12025
12064
|
);
|
12026
12065
|
let destQueryIndex = rewrite.dest.indexOf("?");
|
@@ -12497,6 +12536,7 @@ async function serverBuild({
|
|
12497
12536
|
);
|
12498
12537
|
const pageExtensions = requiredServerFilesManifest.config?.pageExtensions;
|
12499
12538
|
const pageLambdaGroups = await getPageLambdaGroups({
|
12539
|
+
experimentalAllowBundling,
|
12500
12540
|
entryPath: projectDir,
|
12501
12541
|
config,
|
12502
12542
|
functionsConfigManifest,
|
@@ -12516,6 +12556,7 @@ async function serverBuild({
|
|
12516
12556
|
group.isPages = true;
|
12517
12557
|
}
|
12518
12558
|
const appRouterLambdaGroups = await getPageLambdaGroups({
|
12559
|
+
experimentalAllowBundling,
|
12519
12560
|
entryPath: projectDir,
|
12520
12561
|
config,
|
12521
12562
|
functionsConfigManifest,
|
@@ -12533,6 +12574,7 @@ async function serverBuild({
|
|
12533
12574
|
inversedAppPathManifest
|
12534
12575
|
});
|
12535
12576
|
const appRouteHandlersLambdaGroups = await getPageLambdaGroups({
|
12577
|
+
experimentalAllowBundling,
|
12536
12578
|
entryPath: projectDir,
|
12537
12579
|
config,
|
12538
12580
|
functionsConfigManifest,
|
@@ -12681,8 +12723,40 @@ async function serverBuild({
|
|
12681
12723
|
});
|
12682
12724
|
}
|
12683
12725
|
}
|
12726
|
+
let launcherData2 = group.isAppRouter ? appLauncher : launcher;
|
12727
|
+
let preloadChunks = [];
|
12728
|
+
if (process.env.VERCEL_NEXT_PRELOAD_COMMON === "1") {
|
12729
|
+
const nextPackageDir = import_path4.default.dirname(
|
12730
|
+
(0, import_resolve_from.default)(projectDir, "next/package.json")
|
12731
|
+
);
|
12732
|
+
if (group.isPages) {
|
12733
|
+
preloadChunks = PRELOAD_CHUNKS.PAGES_ROUTER_PAGES;
|
12734
|
+
} else if (group.isApiLambda) {
|
12735
|
+
preloadChunks = PRELOAD_CHUNKS.PAGES_ROUTER_API;
|
12736
|
+
} else if (group.isAppRouter && !group.isAppRouteHandler) {
|
12737
|
+
preloadChunks = PRELOAD_CHUNKS.APP_ROUTER_PAGES;
|
12738
|
+
} else if (group.isAppRouteHandler) {
|
12739
|
+
preloadChunks = PRELOAD_CHUNKS.APP_ROUTER_HANDLER;
|
12740
|
+
}
|
12741
|
+
const normalizedPreloadChunks = [];
|
12742
|
+
for (const preloadChunk of preloadChunks) {
|
12743
|
+
const absoluteChunk = preloadChunk.startsWith(".next") ? import_path4.default.join(projectDir, preloadChunk) : import_path4.default.join(nextPackageDir, "..", preloadChunk);
|
12744
|
+
if (group.pseudoLayer[import_path4.default.join(".", import_path4.default.relative(baseDir, absoluteChunk))]) {
|
12745
|
+
normalizedPreloadChunks.push(
|
12746
|
+
// relative files need to be prefixed with ./ for require
|
12747
|
+
preloadChunk.startsWith(".next") ? `./${preloadChunk}` : preloadChunk
|
12748
|
+
);
|
12749
|
+
}
|
12750
|
+
}
|
12751
|
+
if (normalizedPreloadChunks.length > 0) {
|
12752
|
+
launcherData2 = launcherData2.replace(
|
12753
|
+
"// @preserve next-server-preload-target",
|
12754
|
+
normalizedPreloadChunks.map((name) => `require('${name}');`).join("\n")
|
12755
|
+
);
|
12756
|
+
}
|
12757
|
+
}
|
12684
12758
|
const launcherFiles = {
|
12685
|
-
[import_path4.default.join(import_path4.default.relative(baseDir, projectDir), "___next_launcher.cjs")]: new import_build_utils2.FileBlob({ data:
|
12759
|
+
[import_path4.default.join(import_path4.default.relative(baseDir, projectDir), "___next_launcher.cjs")]: new import_build_utils2.FileBlob({ data: launcherData2 })
|
12686
12760
|
};
|
12687
12761
|
const operationType = getOperationType({ group, prerenderManifest });
|
12688
12762
|
const options = {
|
@@ -12700,7 +12774,8 @@ async function serverBuild({
|
|
12700
12774
|
runtime: nodeVersion.runtime,
|
12701
12775
|
maxDuration: group.maxDuration,
|
12702
12776
|
isStreaming: group.isStreaming,
|
12703
|
-
nextVersion
|
12777
|
+
nextVersion,
|
12778
|
+
experimentalAllowBundling
|
12704
12779
|
};
|
12705
12780
|
const lambda = await createLambdaFromPseudoLayers(options);
|
12706
12781
|
const isPPR = experimental.ppr && group.isAppRouter && !group.isAppRouteHandler;
|
@@ -12726,10 +12801,10 @@ async function serverBuild({
|
|
12726
12801
|
);
|
12727
12802
|
});
|
12728
12803
|
}
|
12729
|
-
let outputName =
|
12730
|
-
|
12731
|
-
true
|
12732
|
-
|
12804
|
+
let outputName = import_path4.default.posix.join(entryDirectory, pageNoExt);
|
12805
|
+
if (!group.isAppRouter && !group.isAppRouteHandler) {
|
12806
|
+
outputName = normalizeIndexOutput(outputName, true);
|
12807
|
+
}
|
12733
12808
|
if (isPPR) {
|
12734
12809
|
if (!revalidate) {
|
12735
12810
|
throw new Error("Invariant: PPR lambda isn't set");
|
@@ -12983,9 +13058,10 @@ async function serverBuild({
|
|
12983
13058
|
if (ogRoute.endsWith("/route")) {
|
12984
13059
|
continue;
|
12985
13060
|
}
|
12986
|
-
const pathname =
|
12987
|
-
|
12988
|
-
|
13061
|
+
const pathname = import_path4.default.posix.join(
|
13062
|
+
"./",
|
13063
|
+
entryDirectory,
|
13064
|
+
route === "/" ? "/index" : route
|
12989
13065
|
);
|
12990
13066
|
if (lambdas[pathname]) {
|
12991
13067
|
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.1.
|
3
|
+
"version": "4.1.2",
|
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.4"
|
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.7.0",
|
34
34
|
"@vercel/routing-utils": "3.1.0",
|
35
35
|
"async-sema": "3.0.1",
|
36
36
|
"buffer-crc32": "0.2.13",
|