@vercel/next 4.15.0 → 4.15.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 +155 -52
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10822,13 +10822,13 @@ var import_escape_string_regexp3 = __toESM(require_escape_string_regexp());
|
|
|
10822
10822
|
var import_find_up = __toESM(require_find_up());
|
|
10823
10823
|
var import_fs_extra6 = __toESM(require_lib2());
|
|
10824
10824
|
var import_path6 = __toESM(require("path"));
|
|
10825
|
-
var
|
|
10825
|
+
var import_semver5 = __toESM(require_semver());
|
|
10826
10826
|
var import_url2 = __toESM(require("url"));
|
|
10827
10827
|
|
|
10828
10828
|
// src/create-serverless-config.ts
|
|
10829
10829
|
var import_fs_extra4 = __toESM(require_lib2());
|
|
10830
10830
|
var import_path4 = __toESM(require("path"));
|
|
10831
|
-
var
|
|
10831
|
+
var import_semver3 = __toESM(require_semver());
|
|
10832
10832
|
|
|
10833
10833
|
// src/utils.ts
|
|
10834
10834
|
var import_build_utils = require("@vercel/build-utils");
|
|
@@ -10836,7 +10836,7 @@ var import_async_sema = __toESM(require_lib());
|
|
|
10836
10836
|
var import_buffer_crc32 = __toESM(require_buffer_crc32());
|
|
10837
10837
|
var import_fs_extra3 = __toESM(require_lib2());
|
|
10838
10838
|
var import_path3 = __toESM(require("path"));
|
|
10839
|
-
var
|
|
10839
|
+
var import_semver2 = __toESM(require_semver());
|
|
10840
10840
|
var import_url = __toESM(require("url"));
|
|
10841
10841
|
var import_module = require("module");
|
|
10842
10842
|
var import_escape_string_regexp = __toESM(require_escape_string_regexp());
|
|
@@ -11112,6 +11112,107 @@ function getAppRouterPathnameFilesMap(files) {
|
|
|
11112
11112
|
return appPathnameFilesMap;
|
|
11113
11113
|
}
|
|
11114
11114
|
|
|
11115
|
+
// src/is-dynamic-route.ts
|
|
11116
|
+
var import_semver = __toESM(require_semver());
|
|
11117
|
+
function ensureLeadingSlash(path6) {
|
|
11118
|
+
return path6.startsWith("/") ? path6 : `/${path6}`;
|
|
11119
|
+
}
|
|
11120
|
+
function isGroupSegment(segment) {
|
|
11121
|
+
return segment[0] === "(" && segment.endsWith(")");
|
|
11122
|
+
}
|
|
11123
|
+
function normalizeAppPath2(route) {
|
|
11124
|
+
return ensureLeadingSlash(
|
|
11125
|
+
route.split("/").reduce((pathname, segment, index, segments) => {
|
|
11126
|
+
if (!segment) {
|
|
11127
|
+
return pathname;
|
|
11128
|
+
}
|
|
11129
|
+
if (isGroupSegment(segment)) {
|
|
11130
|
+
return pathname;
|
|
11131
|
+
}
|
|
11132
|
+
if (segment[0] === "@") {
|
|
11133
|
+
return pathname;
|
|
11134
|
+
}
|
|
11135
|
+
if ((segment === "page" || segment === "route") && index === segments.length - 1) {
|
|
11136
|
+
return pathname;
|
|
11137
|
+
}
|
|
11138
|
+
return `${pathname}/${segment}`;
|
|
11139
|
+
}, "")
|
|
11140
|
+
);
|
|
11141
|
+
}
|
|
11142
|
+
var INTERCEPTION_ROUTE_MARKERS = [
|
|
11143
|
+
"(..)(..)",
|
|
11144
|
+
"(.)",
|
|
11145
|
+
"(..)",
|
|
11146
|
+
"(...)"
|
|
11147
|
+
];
|
|
11148
|
+
function isInterceptionRouteAppPath(path6) {
|
|
11149
|
+
return path6.split("/").some(
|
|
11150
|
+
(segment) => INTERCEPTION_ROUTE_MARKERS.some((m) => segment.startsWith(m))
|
|
11151
|
+
);
|
|
11152
|
+
}
|
|
11153
|
+
function extractInterceptionRouteInformation(path6) {
|
|
11154
|
+
let interceptingRoute;
|
|
11155
|
+
let marker;
|
|
11156
|
+
let interceptedRoute;
|
|
11157
|
+
for (const segment of path6.split("/")) {
|
|
11158
|
+
marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m));
|
|
11159
|
+
if (marker) {
|
|
11160
|
+
[interceptingRoute, interceptedRoute] = path6.split(marker, 2);
|
|
11161
|
+
break;
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
if (!interceptingRoute || !marker || !interceptedRoute) {
|
|
11165
|
+
throw new Error(
|
|
11166
|
+
`Invalid interception route: ${path6}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`
|
|
11167
|
+
);
|
|
11168
|
+
}
|
|
11169
|
+
interceptingRoute = normalizeAppPath2(interceptingRoute);
|
|
11170
|
+
switch (marker) {
|
|
11171
|
+
case "(.)":
|
|
11172
|
+
if (interceptingRoute === "/") {
|
|
11173
|
+
interceptedRoute = `/${interceptedRoute}`;
|
|
11174
|
+
} else {
|
|
11175
|
+
interceptedRoute = interceptingRoute + "/" + interceptedRoute;
|
|
11176
|
+
}
|
|
11177
|
+
break;
|
|
11178
|
+
case "(..)":
|
|
11179
|
+
if (interceptingRoute === "/") {
|
|
11180
|
+
throw new Error(
|
|
11181
|
+
`Invalid interception route: ${path6}. Cannot use (..) marker at the root level, use (.) instead.`
|
|
11182
|
+
);
|
|
11183
|
+
}
|
|
11184
|
+
interceptedRoute = interceptingRoute.split("/").slice(0, -1).concat(interceptedRoute).join("/");
|
|
11185
|
+
break;
|
|
11186
|
+
case "(...)":
|
|
11187
|
+
interceptedRoute = "/" + interceptedRoute;
|
|
11188
|
+
break;
|
|
11189
|
+
case "(..)(..)": {
|
|
11190
|
+
const splitInterceptingRoute = interceptingRoute.split("/");
|
|
11191
|
+
if (splitInterceptingRoute.length <= 2) {
|
|
11192
|
+
throw new Error(
|
|
11193
|
+
`Invalid interception route: ${path6}. Cannot use (..)(..) marker at the root level or one level up.`
|
|
11194
|
+
);
|
|
11195
|
+
}
|
|
11196
|
+
interceptedRoute = splitInterceptingRoute.slice(0, -2).concat(interceptedRoute).join("/");
|
|
11197
|
+
break;
|
|
11198
|
+
}
|
|
11199
|
+
default:
|
|
11200
|
+
throw new Error("Invariant: unexpected marker");
|
|
11201
|
+
}
|
|
11202
|
+
return { interceptingRoute, interceptedRoute };
|
|
11203
|
+
}
|
|
11204
|
+
var TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
|
11205
|
+
function isDynamicRoute(route, nextVersion) {
|
|
11206
|
+
const coerced = nextVersion ? import_semver.default.coerce(nextVersion) : null;
|
|
11207
|
+
if (coerced && import_semver.default.gte(coerced, "16.0.0", {
|
|
11208
|
+
loose: true,
|
|
11209
|
+
includePrerelease: true
|
|
11210
|
+
}) && isInterceptionRouteAppPath(route)) {
|
|
11211
|
+
route = extractInterceptionRouteInformation(route).interceptedRoute;
|
|
11212
|
+
}
|
|
11213
|
+
return TEST_DYNAMIC_ROUTE.test(ensureLeadingSlash(route));
|
|
11214
|
+
}
|
|
11215
|
+
|
|
11115
11216
|
// src/utils.ts
|
|
11116
11217
|
var require_ = (0, import_module.createRequire)(__filename);
|
|
11117
11218
|
var RSC_CONTENT_TYPE = "x-component";
|
|
@@ -11125,11 +11226,6 @@ function getMaxUncompressedLambdaSize(runtime) {
|
|
|
11125
11226
|
var skipDefaultLocaleRewrite = Boolean(
|
|
11126
11227
|
process.env.NEXT_EXPERIMENTAL_DEFER_DEFAULT_LOCALE_REWRITE
|
|
11127
11228
|
);
|
|
11128
|
-
var TEST_DYNAMIC_ROUTE = /\/\[[^\/]+?\](?=\/|$)/;
|
|
11129
|
-
function isDynamicRoute(route) {
|
|
11130
|
-
route = route.startsWith("/") ? route : `/${route}`;
|
|
11131
|
-
return TEST_DYNAMIC_ROUTE.test(route);
|
|
11132
|
-
}
|
|
11133
11229
|
function validateEntrypoint(entrypoint) {
|
|
11134
11230
|
if (!/package\.json$/.exec(entrypoint) && !/next\.config\.js$/.exec(entrypoint)) {
|
|
11135
11231
|
throw new import_build_utils.NowBuildError({
|
|
@@ -11221,7 +11317,7 @@ function normalizePage(page) {
|
|
|
11221
11317
|
return page;
|
|
11222
11318
|
}
|
|
11223
11319
|
async function getRoutesManifest(entryPath, outputDirectory, nextVersion) {
|
|
11224
|
-
const shouldHaveManifest = nextVersion &&
|
|
11320
|
+
const shouldHaveManifest = nextVersion && import_semver2.default.gte(nextVersion, "9.1.4-canary.0");
|
|
11225
11321
|
if (!shouldHaveManifest)
|
|
11226
11322
|
return;
|
|
11227
11323
|
const pathRoutesManifest = import_path3.default.join(
|
|
@@ -11511,7 +11607,7 @@ async function getImagesManifest(entryPath, outputDirectory) {
|
|
|
11511
11607
|
}
|
|
11512
11608
|
return import_fs_extra3.default.readJson(pathImagesManifest);
|
|
11513
11609
|
}
|
|
11514
|
-
function filterStaticPages(staticPageFiles, dynamicPages, entryDirectory, htmlContentType2, prerenderManifest, routesManifest) {
|
|
11610
|
+
function filterStaticPages(staticPageFiles, dynamicPages, entryDirectory, htmlContentType2, prerenderManifest, nextVersion, routesManifest) {
|
|
11515
11611
|
const staticPages = {};
|
|
11516
11612
|
Object.keys(staticPageFiles).forEach((page) => {
|
|
11517
11613
|
const pathname = page.replace(/\.html$/, "");
|
|
@@ -11525,7 +11621,7 @@ function filterStaticPages(staticPageFiles, dynamicPages, entryDirectory, htmlCo
|
|
|
11525
11621
|
const staticRoute = import_path3.default.posix.join(entryDirectory, pathname);
|
|
11526
11622
|
staticPages[staticRoute] = staticPageFiles[page];
|
|
11527
11623
|
staticPages[staticRoute].contentType = htmlContentType2;
|
|
11528
|
-
if (isDynamicRoute(pathname)) {
|
|
11624
|
+
if (isDynamicRoute(pathname, nextVersion)) {
|
|
11529
11625
|
dynamicPages.push(routeName);
|
|
11530
11626
|
return;
|
|
11531
11627
|
}
|
|
@@ -11971,7 +12067,7 @@ async function getSourceFilePathFromPage({
|
|
|
11971
12067
|
}) {
|
|
11972
12068
|
const usesSrcDir = await usesSrcDirectory(workPath);
|
|
11973
12069
|
const extensionsToTry = pageExtensions || ["js", "jsx", "ts", "tsx"];
|
|
11974
|
-
const isNextJs16Plus = nextVersion &&
|
|
12070
|
+
const isNextJs16Plus = nextVersion && import_semver2.default.gte(nextVersion, "16.0.0");
|
|
11975
12071
|
const pagesToCheck = page === "middleware" && isNextJs16Plus ? ["proxy", "middleware"] : [page];
|
|
11976
12072
|
for (const pageToCheck of pagesToCheck) {
|
|
11977
12073
|
for (const pageType of [
|
|
@@ -12374,7 +12470,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12374
12470
|
isAppPPREnabled,
|
|
12375
12471
|
isAppClientSegmentCacheEnabled,
|
|
12376
12472
|
isAppClientParamParsingEnabled,
|
|
12377
|
-
appPathnameFilesMap
|
|
12473
|
+
appPathnameFilesMap,
|
|
12474
|
+
nextVersion
|
|
12378
12475
|
} = prerenderRouteArgs;
|
|
12379
12476
|
if (isBlocking && isFallback) {
|
|
12380
12477
|
throw new import_build_utils.NowBuildError({
|
|
@@ -12663,7 +12760,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12663
12760
|
const route = routesManifest?.dynamicRoutes.find(
|
|
12664
12761
|
(r) => r.page === pageKey && !("isMiddleware" in r)
|
|
12665
12762
|
);
|
|
12666
|
-
const isDynamic = isDynamicRoute(routeKey);
|
|
12763
|
+
const isDynamic = isDynamicRoute(routeKey, nextVersion);
|
|
12667
12764
|
const routeKeys = route?.routeKeys;
|
|
12668
12765
|
let allowQuery;
|
|
12669
12766
|
if (isEmptyAllowQueryForPrendered) {
|
|
@@ -12673,7 +12770,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
|
|
|
12673
12770
|
allowQuery = Object.values(routeKeys);
|
|
12674
12771
|
}
|
|
12675
12772
|
} else {
|
|
12676
|
-
const isDynamic2 = isDynamicRoute(pageKey);
|
|
12773
|
+
const isDynamic2 = isDynamicRoute(pageKey, nextVersion);
|
|
12677
12774
|
if (routeKeys) {
|
|
12678
12775
|
allowQuery = Object.values(routeKeys);
|
|
12679
12776
|
} else if (!isDynamic2) {
|
|
@@ -13018,7 +13115,7 @@ function normalizeIndexOutput(outputName, isServerMode) {
|
|
|
13018
13115
|
return outputName;
|
|
13019
13116
|
}
|
|
13020
13117
|
function getNextServerPath(nextVersion) {
|
|
13021
|
-
return
|
|
13118
|
+
return import_semver2.default.gte(nextVersion, "v11.0.2-canary.4") ? "next/dist/server" : "next/dist/next-server/server";
|
|
13022
13119
|
}
|
|
13023
13120
|
function pathnameToOutputName(entryDirectory, pathname) {
|
|
13024
13121
|
if (pathname === "/") {
|
|
@@ -13416,7 +13513,7 @@ async function getMiddlewareBundle({
|
|
|
13416
13513
|
if (isCorrectMiddlewareOrder) {
|
|
13417
13514
|
route.override = true;
|
|
13418
13515
|
}
|
|
13419
|
-
if (routesManifest.version > 3 && isDynamicRoute(worker.page)) {
|
|
13516
|
+
if (routesManifest.version > 3 && isDynamicRoute(worker.page, nextVersion)) {
|
|
13420
13517
|
source.dynamicRouteMap.set(worker.page, route);
|
|
13421
13518
|
} else {
|
|
13422
13519
|
source.staticRoutes.push(route);
|
|
@@ -13746,7 +13843,7 @@ async function createServerlessConfig(workPath, entryPath, nextVersion) {
|
|
|
13746
13843
|
let target = "serverless";
|
|
13747
13844
|
if (nextVersion) {
|
|
13748
13845
|
try {
|
|
13749
|
-
if (
|
|
13846
|
+
if (import_semver3.default.gte(nextVersion, ExperimentalTraceVersion)) {
|
|
13750
13847
|
target = "experimental-serverless-trace";
|
|
13751
13848
|
}
|
|
13752
13849
|
} catch (_ignored) {
|
|
@@ -14118,7 +14215,7 @@ var legacy_versions_default = [
|
|
|
14118
14215
|
|
|
14119
14216
|
// src/server-build.ts
|
|
14120
14217
|
var import_path5 = __toESM(require("path"));
|
|
14121
|
-
var
|
|
14218
|
+
var import_semver4 = __toESM(require_semver());
|
|
14122
14219
|
var import_async_sema2 = __toESM(require_lib());
|
|
14123
14220
|
var import_build_utils2 = require("@vercel/build-utils");
|
|
14124
14221
|
var import_nft = require("@vercel/nft");
|
|
@@ -14220,7 +14317,7 @@ async function serverBuild({
|
|
|
14220
14317
|
const prerenders = {};
|
|
14221
14318
|
const lambdaPageKeys = Object.keys(lambdaPages);
|
|
14222
14319
|
const pageBuildTraces = await (0, import_build_utils2.glob)("**/*.js.nft.json", pagesDir);
|
|
14223
|
-
const isEmptyAllowQueryForPrendered =
|
|
14320
|
+
const isEmptyAllowQueryForPrendered = import_semver4.default.gte(
|
|
14224
14321
|
nextVersion,
|
|
14225
14322
|
EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION
|
|
14226
14323
|
);
|
|
@@ -14336,15 +14433,15 @@ async function serverBuild({
|
|
|
14336
14433
|
modifyRewrites(afterFilesRewrites, true);
|
|
14337
14434
|
modifyRewrites(fallbackRewrites);
|
|
14338
14435
|
}
|
|
14339
|
-
const isCorrectNotFoundRoutes =
|
|
14436
|
+
const isCorrectNotFoundRoutes = import_semver4.default.gte(
|
|
14340
14437
|
nextVersion,
|
|
14341
14438
|
CORRECT_NOT_FOUND_ROUTES_VERSION
|
|
14342
14439
|
);
|
|
14343
|
-
const isCorrectMiddlewareOrder =
|
|
14440
|
+
const isCorrectMiddlewareOrder = import_semver4.default.gte(
|
|
14344
14441
|
nextVersion,
|
|
14345
14442
|
CORRECT_MIDDLEWARE_ORDER_VERSION
|
|
14346
14443
|
);
|
|
14347
|
-
const isCorrectManifests = !experimentalAllowBundling &&
|
|
14444
|
+
const isCorrectManifests = !experimentalAllowBundling && import_semver4.default.gte(nextVersion, CORRECTED_MANIFESTS_VERSION);
|
|
14348
14445
|
let hasStatic500 = !!staticPages[import_path5.default.posix.join(entryDirectory, "500")];
|
|
14349
14446
|
if (lambdaPageKeys.length === 0) {
|
|
14350
14447
|
throw new import_build_utils2.NowBuildError({
|
|
@@ -14415,7 +14512,7 @@ async function serverBuild({
|
|
|
14415
14512
|
let initialFileReasons;
|
|
14416
14513
|
let nextServerBuildTrace;
|
|
14417
14514
|
let instrumentationHookBuildTrace;
|
|
14418
|
-
const useBundledServer =
|
|
14515
|
+
const useBundledServer = import_semver4.default.gte(nextVersion, BUNDLED_SERVER_NEXT_VERSION) && process.env.VERCEL_NEXT_BUNDLED_SERVER === "1";
|
|
14419
14516
|
if (useBundledServer) {
|
|
14420
14517
|
(0, import_build_utils2.debug)("Using bundled Next.js server");
|
|
14421
14518
|
}
|
|
@@ -14527,7 +14624,7 @@ async function serverBuild({
|
|
|
14527
14624
|
return;
|
|
14528
14625
|
}
|
|
14529
14626
|
const normalizedPathname = normalizePage(pathname);
|
|
14530
|
-
if (isDynamicRoute(normalizedPathname)) {
|
|
14627
|
+
if (isDynamicRoute(normalizedPathname, nextVersion)) {
|
|
14531
14628
|
dynamicPages.push(normalizedPathname);
|
|
14532
14629
|
}
|
|
14533
14630
|
if (lambdaAppPaths[page]) {
|
|
@@ -14986,7 +15083,7 @@ ${JSON.stringify(
|
|
|
14986
15083
|
}
|
|
14987
15084
|
case "server/pages-manifest.json": {
|
|
14988
15085
|
for (const key of Object.keys(manifestData)) {
|
|
14989
|
-
if (isDynamicRoute(key) && !normalizedPages.has(key)) {
|
|
15086
|
+
if (isDynamicRoute(key, nextVersion) && !normalizedPages.has(key)) {
|
|
14990
15087
|
delete manifestData[key];
|
|
14991
15088
|
}
|
|
14992
15089
|
}
|
|
@@ -14995,7 +15092,7 @@ ${JSON.stringify(
|
|
|
14995
15092
|
case "server/app-paths-manifest.json": {
|
|
14996
15093
|
for (const key of Object.keys(manifestData)) {
|
|
14997
15094
|
const normalizedKey = appPathRoutesManifest?.[key] || key.replace(/(^|\/)(page|route)$/, "");
|
|
14998
|
-
if (isDynamicRoute(normalizedKey) && !normalizedPages.has(normalizedKey)) {
|
|
15095
|
+
if (isDynamicRoute(normalizedKey, nextVersion) && !normalizedPages.has(normalizedKey)) {
|
|
14999
15096
|
delete manifestData[key];
|
|
15000
15097
|
}
|
|
15001
15098
|
}
|
|
@@ -15249,7 +15346,8 @@ ${JSON.stringify(
|
|
|
15249
15346
|
isAppPPREnabled,
|
|
15250
15347
|
isAppClientSegmentCacheEnabled,
|
|
15251
15348
|
isAppClientParamParsingEnabled,
|
|
15252
|
-
appPathnameFilesMap: getAppRouterPathnameFilesMap(files)
|
|
15349
|
+
appPathnameFilesMap: getAppRouterPathnameFilesMap(files),
|
|
15350
|
+
nextVersion
|
|
15253
15351
|
});
|
|
15254
15352
|
await Promise.all(
|
|
15255
15353
|
Object.keys(prerenderManifest.staticRoutes).map(
|
|
@@ -15283,7 +15381,7 @@ ${JSON.stringify(
|
|
|
15283
15381
|
// we can't delete dynamic app route lambdas just because
|
|
15284
15382
|
// they are in the prerender manifest since a dynamic
|
|
15285
15383
|
// route can have some prerendered paths and the rest SSR
|
|
15286
|
-
inversedAppPathManifest[route] && isDynamicRoute(route)
|
|
15384
|
+
inversedAppPathManifest[route] && isDynamicRoute(route, nextVersion)
|
|
15287
15385
|
) {
|
|
15288
15386
|
return;
|
|
15289
15387
|
}
|
|
@@ -15292,7 +15390,7 @@ ${JSON.stringify(
|
|
|
15292
15390
|
true
|
|
15293
15391
|
)];
|
|
15294
15392
|
});
|
|
15295
|
-
const isNextDataServerResolving = (middleware.staticRoutes.length > 0 || nodeMiddleware) &&
|
|
15393
|
+
const isNextDataServerResolving = (middleware.staticRoutes.length > 0 || nodeMiddleware) && import_semver4.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
|
|
15296
15394
|
const dynamicRoutes = await getDynamicRoutes({
|
|
15297
15395
|
entryPath,
|
|
15298
15396
|
entryDirectory,
|
|
@@ -16028,7 +16126,10 @@ ${JSON.stringify(
|
|
|
16028
16126
|
...denormalizeNextDataRoute(),
|
|
16029
16127
|
...isNextDataServerResolving ? dataRoutes.filter((route) => {
|
|
16030
16128
|
const { pathname } = new URL(route.dest || "/", "http://n");
|
|
16031
|
-
return !isDynamicRoute(
|
|
16129
|
+
return !isDynamicRoute(
|
|
16130
|
+
pathname.replace(/(\\)?\.json$/, ""),
|
|
16131
|
+
nextVersion
|
|
16132
|
+
);
|
|
16032
16133
|
}) : [],
|
|
16033
16134
|
// /_next/data routes for getServerProps/getStaticProps pages
|
|
16034
16135
|
...isNextDataServerResolving ? (
|
|
@@ -16250,6 +16351,7 @@ var htmlContentType = "text/html; charset=utf-8";
|
|
|
16250
16351
|
var SERVER_BUILD_MINIMUM_NEXT_VERSION = "v10.0.9-canary.4";
|
|
16251
16352
|
var BEFORE_FILES_CONTINUE_NEXT_VERSION = "v10.2.3-canary.1";
|
|
16252
16353
|
var REDIRECTS_NO_STATIC_NEXT_VERSION = "v11.0.2-canary.15";
|
|
16354
|
+
var IS_APP_CLIENT_SEGMENT_CACHE_ENABLED_VERSION = "v16.0.0";
|
|
16253
16355
|
var MAX_AGE_ONE_YEAR = 31536e3;
|
|
16254
16356
|
async function readPackageJson(entryPath) {
|
|
16255
16357
|
const packagePath = import_path6.default.join(entryPath, "package.json");
|
|
@@ -16304,7 +16406,7 @@ function isLegacyNext(nextVersion) {
|
|
|
16304
16406
|
if (legacy_versions_default.indexOf(nextVersion) !== -1) {
|
|
16305
16407
|
return true;
|
|
16306
16408
|
}
|
|
16307
|
-
const maxSatisfying =
|
|
16409
|
+
const maxSatisfying = import_semver5.default.maxSatisfying(legacy_versions_default, nextVersion);
|
|
16308
16410
|
if (maxSatisfying === null) {
|
|
16309
16411
|
return false;
|
|
16310
16412
|
}
|
|
@@ -16358,18 +16460,17 @@ var build = async (buildOptions) => {
|
|
|
16358
16460
|
let pkg = await readPackageJson(entryPath);
|
|
16359
16461
|
const nextVersionRange = await getNextVersionRange(entryPath);
|
|
16360
16462
|
const nodeVersion = await (0, import_build_utils3.getNodeVersion)(entryPath, void 0, config, meta);
|
|
16361
|
-
const spawnOpts = (0, import_build_utils3.getSpawnOptions)(meta, nodeVersion);
|
|
16362
16463
|
const {
|
|
16363
16464
|
cliType,
|
|
16364
16465
|
lockfileVersion,
|
|
16365
16466
|
packageJsonPackageManager,
|
|
16366
16467
|
turboSupportsCorepackHome
|
|
16367
16468
|
} = await (0, import_build_utils3.scanParentDirs)(entryPath, true);
|
|
16368
|
-
|
|
16469
|
+
const spawnEnv = (0, import_build_utils3.getEnvForPackageManager)({
|
|
16369
16470
|
cliType,
|
|
16370
16471
|
lockfileVersion,
|
|
16371
16472
|
packageJsonPackageManager,
|
|
16372
|
-
env:
|
|
16473
|
+
env: process.env,
|
|
16373
16474
|
turboSupportsCorepackHome,
|
|
16374
16475
|
projectCreatedAt: config.projectSettings?.createdAt
|
|
16375
16476
|
});
|
|
@@ -16446,14 +16547,14 @@ var build = async (buildOptions) => {
|
|
|
16446
16547
|
`Running "install" command: \`${trimmedInstallCommand}\`...`
|
|
16447
16548
|
);
|
|
16448
16549
|
await (0, import_build_utils3.execCommand)(trimmedInstallCommand, {
|
|
16449
|
-
|
|
16550
|
+
env: spawnEnv,
|
|
16450
16551
|
cwd: entryPath
|
|
16451
16552
|
});
|
|
16452
16553
|
} else {
|
|
16453
16554
|
await (0, import_build_utils3.runNpmInstall)(
|
|
16454
16555
|
entryPath,
|
|
16455
16556
|
[],
|
|
16456
|
-
|
|
16557
|
+
{ env: spawnEnv },
|
|
16457
16558
|
meta,
|
|
16458
16559
|
config.projectSettings?.createdAt
|
|
16459
16560
|
);
|
|
@@ -16462,14 +16563,14 @@ var build = async (buildOptions) => {
|
|
|
16462
16563
|
} else {
|
|
16463
16564
|
console.log(`Skipping "install" command...`);
|
|
16464
16565
|
}
|
|
16465
|
-
if (
|
|
16566
|
+
if (spawnEnv.VERCEL_ANALYTICS_ID) {
|
|
16466
16567
|
(0, import_build_utils3.debug)("Found VERCEL_ANALYTICS_ID in environment");
|
|
16467
16568
|
const version2 = await (0, import_build_utils3.getInstalledPackageVersion)(
|
|
16468
16569
|
"@vercel/speed-insights",
|
|
16469
16570
|
entryPath
|
|
16470
16571
|
);
|
|
16471
16572
|
if (version2) {
|
|
16472
|
-
delete
|
|
16573
|
+
delete spawnEnv.VERCEL_ANALYTICS_ID;
|
|
16473
16574
|
delete process.env.VERCEL_ANALYTICS_ID;
|
|
16474
16575
|
(0, import_build_utils3.debug)(
|
|
16475
16576
|
"@vercel/speed-insights is installed, removing VERCEL_ANALYTICS_ID from environment"
|
|
@@ -16483,12 +16584,12 @@ var build = async (buildOptions) => {
|
|
|
16483
16584
|
message: 'No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies". Also check your Root Directory setting matches the directory of your package.json file.'
|
|
16484
16585
|
});
|
|
16485
16586
|
}
|
|
16486
|
-
let isServerMode = !(config.framework === "blitzjs") &&
|
|
16487
|
-
const beforeFilesShouldContinue =
|
|
16587
|
+
let isServerMode = !(config.framework === "blitzjs") && import_semver5.default.gte(nextVersion, SERVER_BUILD_MINIMUM_NEXT_VERSION);
|
|
16588
|
+
const beforeFilesShouldContinue = import_semver5.default.gte(
|
|
16488
16589
|
nextVersion,
|
|
16489
16590
|
BEFORE_FILES_CONTINUE_NEXT_VERSION
|
|
16490
16591
|
);
|
|
16491
|
-
const isCorrectLocaleAPIRoutes =
|
|
16592
|
+
const isCorrectLocaleAPIRoutes = import_semver5.default.gte(nextVersion, "v11.0.2-canary.3");
|
|
16492
16593
|
if (isServerMode) {
|
|
16493
16594
|
(0, import_build_utils3.debug)(
|
|
16494
16595
|
`Application is being built in server mode since ${nextVersion} meets minimum version of ${SERVER_BUILD_MINIMUM_NEXT_VERSION}`
|
|
@@ -16519,7 +16620,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16519
16620
|
} else if (!isLegacy) {
|
|
16520
16621
|
target = await createServerlessConfig(workPath, entryPath, nextVersion);
|
|
16521
16622
|
}
|
|
16522
|
-
const env = { ...
|
|
16623
|
+
const env = { ...spawnEnv };
|
|
16523
16624
|
env.NEXT_EDGE_RUNTIME_PROVIDER = "vercel";
|
|
16524
16625
|
if (target) {
|
|
16525
16626
|
env.NEXT_PRIVATE_TARGET = target;
|
|
@@ -16552,7 +16653,6 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16552
16653
|
);
|
|
16553
16654
|
console.log(`Running "${buildCommand}"`);
|
|
16554
16655
|
await (0, import_build_utils3.execCommand)(buildCommand, {
|
|
16555
|
-
...spawnOpts,
|
|
16556
16656
|
cwd: entryPath,
|
|
16557
16657
|
env
|
|
16558
16658
|
});
|
|
@@ -16561,7 +16661,6 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16561
16661
|
entryPath,
|
|
16562
16662
|
buildScriptName,
|
|
16563
16663
|
{
|
|
16564
|
-
...spawnOpts,
|
|
16565
16664
|
env
|
|
16566
16665
|
},
|
|
16567
16666
|
config.projectSettings?.createdAt
|
|
@@ -16695,7 +16794,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16695
16794
|
if (routesManifest.headers) {
|
|
16696
16795
|
headers.push(...(0, import_superstatic.convertHeaders)(routesManifest.headers));
|
|
16697
16796
|
}
|
|
16698
|
-
if (
|
|
16797
|
+
if (import_semver5.default.gte(nextVersion, REDIRECTS_NO_STATIC_NEXT_VERSION)) {
|
|
16699
16798
|
redirects.forEach(
|
|
16700
16799
|
(r, i) => updateRouteSrc(r, i, routesManifest.redirects)
|
|
16701
16800
|
);
|
|
@@ -16968,7 +17067,9 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
16968
17067
|
await (0, import_build_utils3.runNpmInstall)(
|
|
16969
17068
|
entryPath,
|
|
16970
17069
|
["--production"],
|
|
16971
|
-
|
|
17070
|
+
{
|
|
17071
|
+
env: spawnEnv
|
|
17072
|
+
},
|
|
16972
17073
|
meta,
|
|
16973
17074
|
config.projectSettings?.createdAt
|
|
16974
17075
|
);
|
|
@@ -17117,6 +17218,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17117
17218
|
entryDirectory,
|
|
17118
17219
|
htmlContentType,
|
|
17119
17220
|
prerenderManifest,
|
|
17221
|
+
nextVersion,
|
|
17120
17222
|
routesManifest
|
|
17121
17223
|
);
|
|
17122
17224
|
hasStatic500 = !!staticPages[import_path6.default.posix.join(entryDirectory, "500")];
|
|
@@ -17226,7 +17328,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17226
17328
|
}
|
|
17227
17329
|
const isAppPPREnabled = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.ppr === true || requiredServerFilesManifest.config.experimental?.ppr === "incremental" || requiredServerFilesManifest.config.experimental?.cacheComponents === true : false;
|
|
17228
17330
|
const isAppFullPPREnabled = requiredServerFilesManifest ? requiredServerFilesManifest?.config.experimental?.ppr === true || requiredServerFilesManifest.config.experimental?.cacheComponents === true : false;
|
|
17229
|
-
const isAppClientSegmentCacheEnabled = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.clientSegmentCache === true : false;
|
|
17331
|
+
const isAppClientSegmentCacheEnabled = import_semver5.default.gte(nextVersion, IS_APP_CLIENT_SEGMENT_CACHE_ENABLED_VERSION) || (requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.clientSegmentCache === true : false);
|
|
17230
17332
|
const isAppClientParamParsingEnabled = routesManifest?.rsc?.clientParamParsing ?? false;
|
|
17231
17333
|
const clientParamParsingOrigins = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.clientParamParsingOrigins : void 0;
|
|
17232
17334
|
if (requiredServerFilesManifest) {
|
|
@@ -17302,7 +17404,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17302
17404
|
}
|
|
17303
17405
|
let requiresTracing = hasLambdas;
|
|
17304
17406
|
try {
|
|
17305
|
-
if (nextVersion &&
|
|
17407
|
+
if (nextVersion && import_semver5.default.lt(nextVersion, ExperimentalTraceVersion)) {
|
|
17306
17408
|
(0, import_build_utils3.debug)(
|
|
17307
17409
|
"Next.js version is too old for us to trace the required dependencies.\nAssuming Next.js has handled it!"
|
|
17308
17410
|
);
|
|
@@ -17509,7 +17611,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17509
17611
|
import_path6.default.relative(workPath, pages[page].fsPath)
|
|
17510
17612
|
);
|
|
17511
17613
|
const pathname = page.replace(/\.js$/, "");
|
|
17512
|
-
const routeIsDynamic = isDynamicRoute(pathname);
|
|
17614
|
+
const routeIsDynamic = isDynamicRoute(pathname, nextVersion);
|
|
17513
17615
|
routeIsApi = isApiPage(pageFileName);
|
|
17514
17616
|
if (routeIsDynamic) {
|
|
17515
17617
|
dynamicPages.push(normalizePage(pathname));
|
|
@@ -17587,7 +17689,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17587
17689
|
return;
|
|
17588
17690
|
}
|
|
17589
17691
|
const pathname = page.replace(/\.js$/, "");
|
|
17590
|
-
if (isDynamicRoute(pathname)) {
|
|
17692
|
+
if (isDynamicRoute(pathname, nextVersion)) {
|
|
17591
17693
|
dynamicPages.push(normalizePage(pathname));
|
|
17592
17694
|
}
|
|
17593
17695
|
const pageFileName = import_path6.default.normalize(
|
|
@@ -17891,7 +17993,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
|
|
|
17891
17993
|
isAppPPREnabled: false,
|
|
17892
17994
|
isAppClientSegmentCacheEnabled: false,
|
|
17893
17995
|
isAppClientParamParsingEnabled: false,
|
|
17894
|
-
appPathnameFilesMap: getAppRouterPathnameFilesMap(files)
|
|
17996
|
+
appPathnameFilesMap: getAppRouterPathnameFilesMap(files),
|
|
17997
|
+
nextVersion
|
|
17895
17998
|
});
|
|
17896
17999
|
await Promise.all(
|
|
17897
18000
|
Object.keys(prerenderManifest.staticRoutes).map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/next",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.2",
|
|
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": "
|
|
33
|
+
"@vercel/build-utils": "13.0.0",
|
|
34
34
|
"@vercel/routing-utils": "5.2.1",
|
|
35
35
|
"async-sema": "3.0.1",
|
|
36
36
|
"buffer-crc32": "0.2.13",
|