@vercel/next 3.1.7 → 3.1.8
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 +63 -10
- package/dist/server-build.js +63 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -44634,6 +44634,7 @@ const CORRECT_NOT_FOUND_ROUTES_VERSION = 'v12.0.1';
|
|
44634
44634
|
const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
|
44635
44635
|
const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
|
44636
44636
|
const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
|
44637
|
+
const CORRECTED_MANIFESTS_VERSION = 'v12.2.0';
|
44637
44638
|
async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, trailingSlash, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
|
44638
44639
|
const lambdas = {};
|
44639
44640
|
const prerenders = {};
|
@@ -44643,6 +44644,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44643
44644
|
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
44644
44645
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
44645
44646
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
44647
|
+
const isCorrectManifests = semver_1.default.gte(nextVersion, CORRECTED_MANIFESTS_VERSION);
|
44646
44648
|
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
44647
44649
|
if (lambdaPageKeys.length === 0) {
|
44648
44650
|
throw new build_utils_1.NowBuildError({
|
@@ -44821,7 +44823,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44821
44823
|
if (requiredServerFilesManifest.appDir) {
|
44822
44824
|
fsPath = path_1.default.join(requiredServerFilesManifest.appDir, file);
|
44823
44825
|
}
|
44824
|
-
const relativePath = path_1.default.
|
44826
|
+
const relativePath = path_1.default.relative(baseDir, fsPath);
|
44825
44827
|
const { mode } = await fs_extra_1.default.lstat(fsPath);
|
44826
44828
|
lstatSema.release();
|
44827
44829
|
requiredFiles[relativePath] = new build_utils_1.FileFsRef({
|
@@ -44977,16 +44979,67 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
44977
44979
|
const combinedGroups = [...pageLambdaGroups, ...apiLambdaGroups];
|
44978
44980
|
await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
|
44979
44981
|
for (const group of combinedGroups) {
|
44982
|
+
const groupPageFiles = {};
|
44983
|
+
for (const page of [...group.pages, ...internalPages]) {
|
44984
|
+
const pageFileName = path_1.default.normalize(path_1.default.relative(baseDir, lambdaPages[page].fsPath));
|
44985
|
+
groupPageFiles[pageFileName] = compressedPages[page];
|
44986
|
+
}
|
44987
|
+
const updatedManifestFiles = {};
|
44988
|
+
if (isCorrectManifests) {
|
44989
|
+
// filter dynamic routes to only the included dynamic routes
|
44990
|
+
// in this specific serverless function so that we don't
|
44991
|
+
// accidentally match a dynamic route while resolving that
|
44992
|
+
// is not actually in this specific serverless function
|
44993
|
+
for (const manifest of [
|
44994
|
+
'routes-manifest.json',
|
44995
|
+
'server/pages-manifest.json',
|
44996
|
+
]) {
|
44997
|
+
const fsPath = path_1.default.join(entryPath, outputDirectory, manifest);
|
44998
|
+
const relativePath = path_1.default.relative(baseDir, fsPath);
|
44999
|
+
delete group.pseudoLayer[relativePath];
|
45000
|
+
const manifestData = await fs_extra_1.default.readJSON(fsPath);
|
45001
|
+
const normalizedPages = new Set(group.pages.map(page => {
|
45002
|
+
page = `/${page.replace(/\.js$/, '')}`;
|
45003
|
+
if (page === '/index')
|
45004
|
+
page = '/';
|
45005
|
+
return page;
|
45006
|
+
}));
|
45007
|
+
switch (manifest) {
|
45008
|
+
case 'routes-manifest.json': {
|
45009
|
+
const filterItem = (item) => normalizedPages.has(item.page);
|
45010
|
+
manifestData.dynamicRoutes =
|
45011
|
+
manifestData.dynamicRoutes?.filter(filterItem);
|
45012
|
+
manifestData.staticRoutes =
|
45013
|
+
manifestData.staticRoutes?.filter(filterItem);
|
45014
|
+
break;
|
45015
|
+
}
|
45016
|
+
case 'server/pages-manifest.json': {
|
45017
|
+
for (const key of Object.keys(manifestData)) {
|
45018
|
+
if ((0, utils_1.isDynamicRoute)(key) && !normalizedPages.has(key)) {
|
45019
|
+
delete manifestData[key];
|
45020
|
+
}
|
45021
|
+
}
|
45022
|
+
break;
|
45023
|
+
}
|
45024
|
+
default: {
|
45025
|
+
throw new build_utils_1.NowBuildError({
|
45026
|
+
message: `Unexpected manifest value ${manifest}, please contact support if this continues`,
|
45027
|
+
code: 'NEXT_MANIFEST_INVARIANT',
|
45028
|
+
});
|
45029
|
+
}
|
45030
|
+
}
|
45031
|
+
updatedManifestFiles[relativePath] = new build_utils_1.FileBlob({
|
45032
|
+
contentType: 'application/json',
|
45033
|
+
data: JSON.stringify(manifestData),
|
45034
|
+
});
|
45035
|
+
}
|
45036
|
+
}
|
44980
45037
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
44981
|
-
files:
|
44982
|
-
|
44983
|
-
|
44984
|
-
|
44985
|
-
|
44986
|
-
prev[pageFileName] = compressedPages[page];
|
44987
|
-
return prev;
|
44988
|
-
}, {}),
|
44989
|
-
],
|
45038
|
+
files: {
|
45039
|
+
...launcherFiles,
|
45040
|
+
...updatedManifestFiles,
|
45041
|
+
},
|
45042
|
+
layers: [group.pseudoLayer, groupPageFiles],
|
44990
45043
|
handler: path_1.default.join(path_1.default.relative(baseDir, requiredServerFilesManifest.appDir || entryPath), '___next_launcher.cjs'),
|
44991
45044
|
memory: group.memory,
|
44992
45045
|
runtime: nodeVersion.runtime,
|
package/dist/server-build.js
CHANGED
@@ -20,6 +20,7 @@ const CORRECT_NOT_FOUND_ROUTES_VERSION = 'v12.0.1';
|
|
20
20
|
const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
|
21
21
|
const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
|
22
22
|
const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
|
23
|
+
const CORRECTED_MANIFESTS_VERSION = 'v12.2.0';
|
23
24
|
async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, trailingSlash, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
|
24
25
|
const lambdas = {};
|
25
26
|
const prerenders = {};
|
@@ -29,6 +30,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
29
30
|
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
30
31
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
31
32
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
33
|
+
const isCorrectManifests = semver_1.default.gte(nextVersion, CORRECTED_MANIFESTS_VERSION);
|
32
34
|
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
33
35
|
if (lambdaPageKeys.length === 0) {
|
34
36
|
throw new build_utils_1.NowBuildError({
|
@@ -207,7 +209,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
207
209
|
if (requiredServerFilesManifest.appDir) {
|
208
210
|
fsPath = path_1.default.join(requiredServerFilesManifest.appDir, file);
|
209
211
|
}
|
210
|
-
const relativePath = path_1.default.
|
212
|
+
const relativePath = path_1.default.relative(baseDir, fsPath);
|
211
213
|
const { mode } = await fs_extra_1.default.lstat(fsPath);
|
212
214
|
lstatSema.release();
|
213
215
|
requiredFiles[relativePath] = new build_utils_1.FileFsRef({
|
@@ -363,16 +365,67 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
363
365
|
const combinedGroups = [...pageLambdaGroups, ...apiLambdaGroups];
|
364
366
|
await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
|
365
367
|
for (const group of combinedGroups) {
|
368
|
+
const groupPageFiles = {};
|
369
|
+
for (const page of [...group.pages, ...internalPages]) {
|
370
|
+
const pageFileName = path_1.default.normalize(path_1.default.relative(baseDir, lambdaPages[page].fsPath));
|
371
|
+
groupPageFiles[pageFileName] = compressedPages[page];
|
372
|
+
}
|
373
|
+
const updatedManifestFiles = {};
|
374
|
+
if (isCorrectManifests) {
|
375
|
+
// filter dynamic routes to only the included dynamic routes
|
376
|
+
// in this specific serverless function so that we don't
|
377
|
+
// accidentally match a dynamic route while resolving that
|
378
|
+
// is not actually in this specific serverless function
|
379
|
+
for (const manifest of [
|
380
|
+
'routes-manifest.json',
|
381
|
+
'server/pages-manifest.json',
|
382
|
+
]) {
|
383
|
+
const fsPath = path_1.default.join(entryPath, outputDirectory, manifest);
|
384
|
+
const relativePath = path_1.default.relative(baseDir, fsPath);
|
385
|
+
delete group.pseudoLayer[relativePath];
|
386
|
+
const manifestData = await fs_extra_1.default.readJSON(fsPath);
|
387
|
+
const normalizedPages = new Set(group.pages.map(page => {
|
388
|
+
page = `/${page.replace(/\.js$/, '')}`;
|
389
|
+
if (page === '/index')
|
390
|
+
page = '/';
|
391
|
+
return page;
|
392
|
+
}));
|
393
|
+
switch (manifest) {
|
394
|
+
case 'routes-manifest.json': {
|
395
|
+
const filterItem = (item) => normalizedPages.has(item.page);
|
396
|
+
manifestData.dynamicRoutes =
|
397
|
+
manifestData.dynamicRoutes?.filter(filterItem);
|
398
|
+
manifestData.staticRoutes =
|
399
|
+
manifestData.staticRoutes?.filter(filterItem);
|
400
|
+
break;
|
401
|
+
}
|
402
|
+
case 'server/pages-manifest.json': {
|
403
|
+
for (const key of Object.keys(manifestData)) {
|
404
|
+
if ((0, utils_1.isDynamicRoute)(key) && !normalizedPages.has(key)) {
|
405
|
+
delete manifestData[key];
|
406
|
+
}
|
407
|
+
}
|
408
|
+
break;
|
409
|
+
}
|
410
|
+
default: {
|
411
|
+
throw new build_utils_1.NowBuildError({
|
412
|
+
message: `Unexpected manifest value ${manifest}, please contact support if this continues`,
|
413
|
+
code: 'NEXT_MANIFEST_INVARIANT',
|
414
|
+
});
|
415
|
+
}
|
416
|
+
}
|
417
|
+
updatedManifestFiles[relativePath] = new build_utils_1.FileBlob({
|
418
|
+
contentType: 'application/json',
|
419
|
+
data: JSON.stringify(manifestData),
|
420
|
+
});
|
421
|
+
}
|
422
|
+
}
|
366
423
|
const lambda = await (0, utils_1.createLambdaFromPseudoLayers)({
|
367
|
-
files:
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
prev[pageFileName] = compressedPages[page];
|
373
|
-
return prev;
|
374
|
-
}, {}),
|
375
|
-
],
|
424
|
+
files: {
|
425
|
+
...launcherFiles,
|
426
|
+
...updatedManifestFiles,
|
427
|
+
},
|
428
|
+
layers: [group.pseudoLayer, groupPageFiles],
|
376
429
|
handler: path_1.default.join(path_1.default.relative(baseDir, requiredServerFilesManifest.appDir || entryPath), '___next_launcher.cjs'),
|
377
430
|
memory: group.memory,
|
378
431
|
runtime: nodeVersion.runtime,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.8",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"@types/semver": "6.0.0",
|
46
46
|
"@types/text-table": "0.2.1",
|
47
47
|
"@types/webpack-sources": "3.2.0",
|
48
|
-
"@vercel/build-utils": "5.0.
|
48
|
+
"@vercel/build-utils": "5.0.4",
|
49
49
|
"@vercel/nft": "0.20.1",
|
50
50
|
"@vercel/routing-utils": "2.0.0",
|
51
51
|
"async-sema": "3.0.1",
|
@@ -70,5 +70,5 @@
|
|
70
70
|
"typescript": "4.5.2",
|
71
71
|
"webpack-sources": "3.2.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "3d3774ee7e3d344b3292d2166d485bdf41a68d4c"
|
74
74
|
}
|