@vercel/next 3.8.2 → 3.8.4
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 +45 -38
- package/dist/server-build.js +25 -31
- package/dist/server-launcher.js +1 -0
- package/dist/utils.js +20 -7
- package/package.json +11 -12
package/dist/index.js
CHANGED
@@ -43242,7 +43242,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43242
43242
|
console.time(lambdaCreationLabel);
|
43243
43243
|
const apiPages = [];
|
43244
43244
|
const nonApiPages = [];
|
43245
|
-
const
|
43245
|
+
const appRouterPages = [];
|
43246
43246
|
lambdaPageKeys.forEach(page => {
|
43247
43247
|
if (internalPages.includes(page) &&
|
43248
43248
|
page !== '404.js' &&
|
@@ -43253,14 +43253,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43253
43253
|
if (nonLambdaSsgPages.has(pathname)) {
|
43254
43254
|
return;
|
43255
43255
|
}
|
43256
|
-
|
43257
|
-
|
43256
|
+
const normalizedPathname = (0, utils_1.normalizePage)(pathname);
|
43257
|
+
if ((0, utils_1.isDynamicRoute)(normalizedPathname)) {
|
43258
|
+
dynamicPages.push(normalizedPathname);
|
43258
43259
|
}
|
43259
43260
|
if (pageMatchesApi(page)) {
|
43260
43261
|
apiPages.push(page);
|
43261
43262
|
}
|
43262
|
-
else if (
|
43263
|
-
|
43263
|
+
else if ((appPathRoutesManifest?.[`${normalizedPathname}/page`] ||
|
43264
|
+
appPathRoutesManifest?.[`${normalizedPathname}/route`]) &&
|
43265
|
+
lambdaAppPaths[page]) {
|
43266
|
+
appRouterPages.push(page);
|
43264
43267
|
}
|
43265
43268
|
else {
|
43266
43269
|
nonApiPages.push(page);
|
@@ -43358,6 +43361,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43358
43361
|
compress: false,
|
43359
43362
|
})}`)
|
43360
43363
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
43364
|
+
const appLauncher = launcher.replace('// pre-next-server-target', `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT = "${requiredServerFilesManifest.config?.experimental?.serverActions
|
43365
|
+
? 'experimental'
|
43366
|
+
: 'next'}"`);
|
43361
43367
|
if (entryDirectory !== '.' &&
|
43362
43368
|
path_1.default.posix.join('/', entryDirectory) !== routesManifest.basePath) {
|
43363
43369
|
// we normalize the entryDirectory in the request URL since
|
@@ -43367,14 +43373,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43367
43373
|
.join('/', entryDirectory)
|
43368
43374
|
.replace(/\//g, '\\/')}/, '')`);
|
43369
43375
|
}
|
43370
|
-
const launcherFiles = {
|
43371
|
-
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: launcher }),
|
43372
|
-
};
|
43373
43376
|
const pageTraces = {};
|
43374
43377
|
const compressedPages = {};
|
43375
43378
|
const mergedPageKeys = [
|
43376
43379
|
...nonApiPages,
|
43377
|
-
...
|
43380
|
+
...appRouterPages,
|
43378
43381
|
...apiPages,
|
43379
43382
|
...internalPages,
|
43380
43383
|
];
|
@@ -43479,10 +43482,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43479
43482
|
internalPages,
|
43480
43483
|
pageExtensions,
|
43481
43484
|
});
|
43482
|
-
const
|
43485
|
+
const appRouterLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
43483
43486
|
entryPath: projectDir,
|
43484
43487
|
config,
|
43485
|
-
pages:
|
43488
|
+
pages: appRouterPages,
|
43486
43489
|
prerenderRoutes,
|
43487
43490
|
pageTraces,
|
43488
43491
|
compressedPages,
|
@@ -43493,10 +43496,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43493
43496
|
internalPages,
|
43494
43497
|
pageExtensions,
|
43495
43498
|
});
|
43496
|
-
for (const group of
|
43499
|
+
for (const group of appRouterLambdaGroups) {
|
43497
43500
|
if (!group.isPrerenders) {
|
43498
43501
|
group.isStreaming = true;
|
43499
43502
|
}
|
43503
|
+
group.isAppRouter = true;
|
43500
43504
|
}
|
43501
43505
|
const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
43502
43506
|
entryPath: projectDir,
|
@@ -43527,7 +43531,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43527
43531
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
43528
43532
|
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
|
43529
43533
|
})),
|
43530
|
-
|
43534
|
+
appRouterLambdaGroups: appRouterLambdaGroups.map(group => ({
|
43531
43535
|
pages: group.pages,
|
43532
43536
|
isPrerender: group.isPrerenders,
|
43533
43537
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
@@ -43537,7 +43541,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43537
43541
|
}, null, 2));
|
43538
43542
|
const combinedGroups = [
|
43539
43543
|
...pageLambdaGroups,
|
43540
|
-
...
|
43544
|
+
...appRouterLambdaGroups,
|
43541
43545
|
...apiLambdaGroups,
|
43542
43546
|
];
|
43543
43547
|
await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
|
@@ -43597,6 +43601,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43597
43601
|
});
|
43598
43602
|
}
|
43599
43603
|
}
|
43604
|
+
const launcherFiles = {
|
43605
|
+
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: group.isAppRouter ? appLauncher : launcher }),
|
43606
|
+
};
|
43600
43607
|
const operationType = (0, utils_1.getOperationType)({ group, prerenderManifest });
|
43601
43608
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
43602
43609
|
files: {
|
@@ -43682,7 +43689,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43682
43689
|
});
|
43683
43690
|
const isNextDataServerResolving = middleware.staticRoutes.length > 0 &&
|
43684
43691
|
semver_1.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
|
43685
|
-
const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
|
43692
|
+
const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap, inversedAppPathManifest).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
|
43686
43693
|
const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } = await (0, utils_1.getStaticFiles)(entryPath, entryDirectory, outputDirectory);
|
43687
43694
|
const normalizeNextDataRoute = (isOverride = false) => {
|
43688
43695
|
return isNextDataServerResolving
|
@@ -43780,20 +43787,6 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
43780
43787
|
const rscHeader = routesManifest.rsc?.header?.toLowerCase() || '__rsc__';
|
43781
43788
|
const rscVaryHeader = routesManifest?.rsc?.varyHeader ||
|
43782
43789
|
'RSC, Next-Router-State-Tree, Next-Router-Prefetch';
|
43783
|
-
const completeDynamicRoutes = [];
|
43784
|
-
if (appDir) {
|
43785
|
-
for (const route of dynamicRoutes) {
|
43786
|
-
completeDynamicRoutes.push({
|
43787
|
-
...route,
|
43788
|
-
src: route.src.replace(new RegExp((0, escape_string_regexp_1.default)('(?:/)?$')), '(?:\\.rsc)(?:/)?$'),
|
43789
|
-
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
43790
|
-
});
|
43791
|
-
completeDynamicRoutes.push(route);
|
43792
|
-
}
|
43793
|
-
}
|
43794
|
-
else {
|
43795
|
-
completeDynamicRoutes.push(...dynamicRoutes);
|
43796
|
-
}
|
43797
43790
|
return {
|
43798
43791
|
wildcard: wildcardConfig,
|
43799
43792
|
images: (0, utils_1.getImagesConfig)(imagesManifest),
|
@@ -44089,7 +44082,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44089
44082
|
? // when resolving data routes for middleware we need to include
|
44090
44083
|
// all dynamic routes including non-SSG/SSP so that the priority
|
44091
44084
|
// is correct
|
44092
|
-
|
44085
|
+
dynamicRoutes
|
44086
|
+
.filter(route => !route.src.includes('.rsc'))
|
44093
44087
|
.map(route => {
|
44094
44088
|
route = Object.assign({}, route);
|
44095
44089
|
let normalizedSrc = route.src;
|
@@ -44135,7 +44129,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44135
44129
|
: []),
|
44136
44130
|
// Dynamic routes (must come after dataRoutes as dataRoutes are more
|
44137
44131
|
// specific)
|
44138
|
-
...
|
44132
|
+
...dynamicRoutes,
|
44139
44133
|
...(isNextDataServerResolving
|
44140
44134
|
? [
|
44141
44135
|
{
|
@@ -44551,7 +44545,7 @@ async function getRoutesManifest(entryPath, outputDirectory, nextVersion) {
|
|
44551
44545
|
return routesManifest;
|
44552
44546
|
}
|
44553
44547
|
exports.getRoutesManifest = getRoutesManifest;
|
44554
|
-
async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev, routesManifest, omittedRoutes, canUsePreviewMode, bypassToken, isServerMode, dynamicMiddlewareRouteMap) {
|
44548
|
+
async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev, routesManifest, omittedRoutes, canUsePreviewMode, bypassToken, isServerMode, dynamicMiddlewareRouteMap, appPathRoutesManifest) {
|
44555
44549
|
if (routesManifest) {
|
44556
44550
|
switch (routesManifest.version) {
|
44557
44551
|
case 1:
|
@@ -44569,15 +44563,19 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
44569
44563
|
}
|
44570
44564
|
case 3:
|
44571
44565
|
case 4: {
|
44572
|
-
|
44573
|
-
|
44574
|
-
|
44566
|
+
const routes = [];
|
44567
|
+
for (const dynamicRoute of routesManifest.dynamicRoutes) {
|
44568
|
+
if (!canUsePreviewMode && omittedRoutes?.has(dynamicRoute.page)) {
|
44569
|
+
continue;
|
44570
|
+
}
|
44571
|
+
const params = dynamicRoute;
|
44575
44572
|
if ('isMiddleware' in params) {
|
44576
44573
|
const route = dynamicMiddlewareRouteMap?.get(params.page);
|
44577
44574
|
if (!route) {
|
44578
44575
|
throw new Error(`Could not find dynamic middleware route for ${params.page}`);
|
44579
44576
|
}
|
44580
|
-
|
44577
|
+
routes.push(route);
|
44578
|
+
continue;
|
44581
44579
|
}
|
44582
44580
|
const { page, namedRegex, regex, routeKeys } = params;
|
44583
44581
|
const route = {
|
@@ -44606,8 +44604,17 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
44606
44604
|
},
|
44607
44605
|
];
|
44608
44606
|
}
|
44609
|
-
|
44610
|
-
|
44607
|
+
if (appPathRoutesManifest?.[page]) {
|
44608
|
+
routes.push({
|
44609
|
+
...route,
|
44610
|
+
src: route.src.replace(new RegExp((0, escape_string_regexp_1.default)('(?:/)?$')), '(?:\\.rsc)(?:/)?$'),
|
44611
|
+
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
44612
|
+
});
|
44613
|
+
}
|
44614
|
+
routes.push(route);
|
44615
|
+
continue;
|
44616
|
+
}
|
44617
|
+
return routes;
|
44611
44618
|
}
|
44612
44619
|
default: {
|
44613
44620
|
// update MIN_ROUTES_MANIFEST_VERSION
|
package/dist/server-build.js
CHANGED
@@ -168,7 +168,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
168
168
|
console.time(lambdaCreationLabel);
|
169
169
|
const apiPages = [];
|
170
170
|
const nonApiPages = [];
|
171
|
-
const
|
171
|
+
const appRouterPages = [];
|
172
172
|
lambdaPageKeys.forEach(page => {
|
173
173
|
if (internalPages.includes(page) &&
|
174
174
|
page !== '404.js' &&
|
@@ -179,14 +179,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
179
179
|
if (nonLambdaSsgPages.has(pathname)) {
|
180
180
|
return;
|
181
181
|
}
|
182
|
-
|
183
|
-
|
182
|
+
const normalizedPathname = (0, utils_1.normalizePage)(pathname);
|
183
|
+
if ((0, utils_1.isDynamicRoute)(normalizedPathname)) {
|
184
|
+
dynamicPages.push(normalizedPathname);
|
184
185
|
}
|
185
186
|
if (pageMatchesApi(page)) {
|
186
187
|
apiPages.push(page);
|
187
188
|
}
|
188
|
-
else if (
|
189
|
-
|
189
|
+
else if ((appPathRoutesManifest?.[`${normalizedPathname}/page`] ||
|
190
|
+
appPathRoutesManifest?.[`${normalizedPathname}/route`]) &&
|
191
|
+
lambdaAppPaths[page]) {
|
192
|
+
appRouterPages.push(page);
|
190
193
|
}
|
191
194
|
else {
|
192
195
|
nonApiPages.push(page);
|
@@ -284,6 +287,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
284
287
|
compress: false,
|
285
288
|
})}`)
|
286
289
|
.replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
|
290
|
+
const appLauncher = launcher.replace('// pre-next-server-target', `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT = "${requiredServerFilesManifest.config?.experimental?.serverActions
|
291
|
+
? 'experimental'
|
292
|
+
: 'next'}"`);
|
287
293
|
if (entryDirectory !== '.' &&
|
288
294
|
path_1.default.posix.join('/', entryDirectory) !== routesManifest.basePath) {
|
289
295
|
// we normalize the entryDirectory in the request URL since
|
@@ -293,14 +299,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
293
299
|
.join('/', entryDirectory)
|
294
300
|
.replace(/\//g, '\\/')}/, '')`);
|
295
301
|
}
|
296
|
-
const launcherFiles = {
|
297
|
-
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: launcher }),
|
298
|
-
};
|
299
302
|
const pageTraces = {};
|
300
303
|
const compressedPages = {};
|
301
304
|
const mergedPageKeys = [
|
302
305
|
...nonApiPages,
|
303
|
-
...
|
306
|
+
...appRouterPages,
|
304
307
|
...apiPages,
|
305
308
|
...internalPages,
|
306
309
|
];
|
@@ -405,10 +408,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
405
408
|
internalPages,
|
406
409
|
pageExtensions,
|
407
410
|
});
|
408
|
-
const
|
411
|
+
const appRouterLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
409
412
|
entryPath: projectDir,
|
410
413
|
config,
|
411
|
-
pages:
|
414
|
+
pages: appRouterPages,
|
412
415
|
prerenderRoutes,
|
413
416
|
pageTraces,
|
414
417
|
compressedPages,
|
@@ -419,10 +422,11 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
419
422
|
internalPages,
|
420
423
|
pageExtensions,
|
421
424
|
});
|
422
|
-
for (const group of
|
425
|
+
for (const group of appRouterLambdaGroups) {
|
423
426
|
if (!group.isPrerenders) {
|
424
427
|
group.isStreaming = true;
|
425
428
|
}
|
429
|
+
group.isAppRouter = true;
|
426
430
|
}
|
427
431
|
const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
|
428
432
|
entryPath: projectDir,
|
@@ -453,7 +457,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
453
457
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
454
458
|
uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
|
455
459
|
})),
|
456
|
-
|
460
|
+
appRouterLambdaGroups: appRouterLambdaGroups.map(group => ({
|
457
461
|
pages: group.pages,
|
458
462
|
isPrerender: group.isPrerenders,
|
459
463
|
pseudoLayerBytes: group.pseudoLayerBytes,
|
@@ -463,7 +467,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
463
467
|
}, null, 2));
|
464
468
|
const combinedGroups = [
|
465
469
|
...pageLambdaGroups,
|
466
|
-
...
|
470
|
+
...appRouterLambdaGroups,
|
467
471
|
...apiLambdaGroups,
|
468
472
|
];
|
469
473
|
await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
|
@@ -523,6 +527,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
523
527
|
});
|
524
528
|
}
|
525
529
|
}
|
530
|
+
const launcherFiles = {
|
531
|
+
[path_1.default.join(path_1.default.relative(baseDir, projectDir), '___next_launcher.cjs')]: new build_utils_1.FileBlob({ data: group.isAppRouter ? appLauncher : launcher }),
|
532
|
+
};
|
526
533
|
const operationType = (0, utils_1.getOperationType)({ group, prerenderManifest });
|
527
534
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
528
535
|
files: {
|
@@ -608,7 +615,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
608
615
|
});
|
609
616
|
const isNextDataServerResolving = middleware.staticRoutes.length > 0 &&
|
610
617
|
semver_1.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
|
611
|
-
const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
|
618
|
+
const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap, inversedAppPathManifest).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
|
612
619
|
const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } = await (0, utils_1.getStaticFiles)(entryPath, entryDirectory, outputDirectory);
|
613
620
|
const normalizeNextDataRoute = (isOverride = false) => {
|
614
621
|
return isNextDataServerResolving
|
@@ -706,20 +713,6 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
706
713
|
const rscHeader = routesManifest.rsc?.header?.toLowerCase() || '__rsc__';
|
707
714
|
const rscVaryHeader = routesManifest?.rsc?.varyHeader ||
|
708
715
|
'RSC, Next-Router-State-Tree, Next-Router-Prefetch';
|
709
|
-
const completeDynamicRoutes = [];
|
710
|
-
if (appDir) {
|
711
|
-
for (const route of dynamicRoutes) {
|
712
|
-
completeDynamicRoutes.push({
|
713
|
-
...route,
|
714
|
-
src: route.src.replace(new RegExp((0, escape_string_regexp_1.default)('(?:/)?$')), '(?:\\.rsc)(?:/)?$'),
|
715
|
-
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
716
|
-
});
|
717
|
-
completeDynamicRoutes.push(route);
|
718
|
-
}
|
719
|
-
}
|
720
|
-
else {
|
721
|
-
completeDynamicRoutes.push(...dynamicRoutes);
|
722
|
-
}
|
723
716
|
return {
|
724
717
|
wildcard: wildcardConfig,
|
725
718
|
images: (0, utils_1.getImagesConfig)(imagesManifest),
|
@@ -1015,7 +1008,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
1015
1008
|
? // when resolving data routes for middleware we need to include
|
1016
1009
|
// all dynamic routes including non-SSG/SSP so that the priority
|
1017
1010
|
// is correct
|
1018
|
-
|
1011
|
+
dynamicRoutes
|
1012
|
+
.filter(route => !route.src.includes('.rsc'))
|
1019
1013
|
.map(route => {
|
1020
1014
|
route = Object.assign({}, route);
|
1021
1015
|
let normalizedSrc = route.src;
|
@@ -1061,7 +1055,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
1061
1055
|
: []),
|
1062
1056
|
// Dynamic routes (must come after dataRoutes as dataRoutes are more
|
1063
1057
|
// specific)
|
1064
|
-
...
|
1058
|
+
...dynamicRoutes,
|
1065
1059
|
...(isNextDataServerResolving
|
1066
1060
|
? [
|
1067
1061
|
{
|
package/dist/server-launcher.js
CHANGED
@@ -13,6 +13,7 @@ if (process.env.NODE_ENV !== 'production' && region !== 'dev1') {
|
|
13
13
|
console.warn(`Warning: NODE_ENV was incorrectly set to "${process.env.NODE_ENV}", this value is being overridden to "production"`);
|
14
14
|
process.env.NODE_ENV = 'production';
|
15
15
|
}
|
16
|
+
// pre-next-server-target
|
16
17
|
// eslint-disable-next-line
|
17
18
|
const NextServer = require('__NEXT_SERVER_PATH__').default;
|
18
19
|
const nextServer = new NextServer({
|
package/dist/utils.js
CHANGED
@@ -194,7 +194,7 @@ async function getRoutesManifest(entryPath, outputDirectory, nextVersion) {
|
|
194
194
|
return routesManifest;
|
195
195
|
}
|
196
196
|
exports.getRoutesManifest = getRoutesManifest;
|
197
|
-
async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev, routesManifest, omittedRoutes, canUsePreviewMode, bypassToken, isServerMode, dynamicMiddlewareRouteMap) {
|
197
|
+
async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev, routesManifest, omittedRoutes, canUsePreviewMode, bypassToken, isServerMode, dynamicMiddlewareRouteMap, appPathRoutesManifest) {
|
198
198
|
if (routesManifest) {
|
199
199
|
switch (routesManifest.version) {
|
200
200
|
case 1:
|
@@ -212,15 +212,19 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
212
212
|
}
|
213
213
|
case 3:
|
214
214
|
case 4: {
|
215
|
-
|
216
|
-
|
217
|
-
|
215
|
+
const routes = [];
|
216
|
+
for (const dynamicRoute of routesManifest.dynamicRoutes) {
|
217
|
+
if (!canUsePreviewMode && omittedRoutes?.has(dynamicRoute.page)) {
|
218
|
+
continue;
|
219
|
+
}
|
220
|
+
const params = dynamicRoute;
|
218
221
|
if ('isMiddleware' in params) {
|
219
222
|
const route = dynamicMiddlewareRouteMap?.get(params.page);
|
220
223
|
if (!route) {
|
221
224
|
throw new Error(`Could not find dynamic middleware route for ${params.page}`);
|
222
225
|
}
|
223
|
-
|
226
|
+
routes.push(route);
|
227
|
+
continue;
|
224
228
|
}
|
225
229
|
const { page, namedRegex, regex, routeKeys } = params;
|
226
230
|
const route = {
|
@@ -249,8 +253,17 @@ async function getDynamicRoutes(entryPath, entryDirectory, dynamicPages, isDev,
|
|
249
253
|
},
|
250
254
|
];
|
251
255
|
}
|
252
|
-
|
253
|
-
|
256
|
+
if (appPathRoutesManifest?.[page]) {
|
257
|
+
routes.push({
|
258
|
+
...route,
|
259
|
+
src: route.src.replace(new RegExp((0, escape_string_regexp_1.default)('(?:/)?$')), '(?:\\.rsc)(?:/)?$'),
|
260
|
+
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
|
261
|
+
});
|
262
|
+
}
|
263
|
+
routes.push(route);
|
264
|
+
continue;
|
265
|
+
}
|
266
|
+
return routes;
|
254
267
|
}
|
255
268
|
default: {
|
256
269
|
// update MIN_ROUTES_MANIFEST_VERSION
|
package/package.json
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.8.
|
3
|
+
"version": "3.8.4",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
7
|
-
"scripts": {
|
8
|
-
"build": "node build.js",
|
9
|
-
"build-dev": "node build.js --dev",
|
10
|
-
"test": "jest --env node --verbose --bail --runInBand --testTimeout=360000",
|
11
|
-
"test-unit": "pnpm test test/unit/",
|
12
|
-
"test-next-local": "pnpm test test/integration/*.test.js test/integration/*.test.ts",
|
13
|
-
"test-next-local:middleware": "pnpm test test/integration/middleware.test.ts",
|
14
|
-
"test-e2e": "rm -f test/builder-info.json; pnpm test test/fixtures/**/*.test.js"
|
15
|
-
},
|
16
7
|
"repository": {
|
17
8
|
"type": "git",
|
18
9
|
"url": "https://github.com/vercel/vercel.git",
|
@@ -60,5 +51,13 @@
|
|
60
51
|
"text-table": "0.2.0",
|
61
52
|
"webpack-sources": "3.2.3"
|
62
53
|
},
|
63
|
-
"
|
64
|
-
|
54
|
+
"scripts": {
|
55
|
+
"build": "node build.js",
|
56
|
+
"build-dev": "node build.js --dev",
|
57
|
+
"test": "jest --env node --verbose --bail --runInBand --testTimeout=360000",
|
58
|
+
"test-unit": "pnpm test test/unit/",
|
59
|
+
"test-next-local": "pnpm test test/integration/*.test.js test/integration/*.test.ts",
|
60
|
+
"test-next-local:middleware": "pnpm test test/integration/middleware.test.ts",
|
61
|
+
"test-e2e": "rm -f test/builder-info.json; pnpm test test/fixtures/**/*.test.js"
|
62
|
+
}
|
63
|
+
}
|