@vercel/next 3.1.26 → 3.1.28
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 +39 -24
- package/dist/server-build.js +2 -0
- package/dist/utils.js +30 -23
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -43356,7 +43356,11 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
43356
43356
|
else {
|
43357
43357
|
(0, build_utils_1.debug)('Preparing serverless function files...');
|
43358
43358
|
const pagesDir = path_1.default.join(entryPath, outputDirectory, isServerMode ? 'server' : 'serverless', 'pages');
|
43359
|
+
let appDir = null;
|
43359
43360
|
const appPathRoutesManifest = await (0, fs_extra_1.readJSON)(path_1.default.join(entryPath, outputDirectory, 'app-path-routes-manifest.json')).catch(() => null);
|
43361
|
+
if (appPathRoutesManifest) {
|
43362
|
+
appDir = path_1.default.join(pagesDir, '../app');
|
43363
|
+
}
|
43360
43364
|
const { pages, appPaths: lambdaAppPaths } = await getServerlessPages({
|
43361
43365
|
pagesDir,
|
43362
43366
|
entryPath,
|
@@ -44002,9 +44006,10 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
44002
44006
|
console.timeEnd(allLambdasLabel);
|
44003
44007
|
}
|
44004
44008
|
const prerenderRoute = (0, utils_1.onPrerenderRoute)({
|
44009
|
+
appDir,
|
44010
|
+
pagesDir,
|
44005
44011
|
hasPages404,
|
44006
44012
|
static404Page,
|
44007
|
-
pagesDir,
|
44008
44013
|
pageLambdaMap,
|
44009
44014
|
lambdas,
|
44010
44015
|
isServerMode,
|
@@ -44012,6 +44017,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
44012
44017
|
entryDirectory,
|
44013
44018
|
routesManifest,
|
44014
44019
|
prerenderManifest,
|
44020
|
+
appPathRoutesManifest,
|
44015
44021
|
isSharedLambdas,
|
44016
44022
|
canUsePreviewMode,
|
44017
44023
|
});
|
@@ -45338,6 +45344,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45338
45344
|
console.timeEnd(lambdaCreationLabel);
|
45339
45345
|
}
|
45340
45346
|
const prerenderRoute = (0, utils_1.onPrerenderRoute)({
|
45347
|
+
appDir,
|
45341
45348
|
pagesDir,
|
45342
45349
|
pageLambdaMap: {},
|
45343
45350
|
lambdas,
|
@@ -45345,6 +45352,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45345
45352
|
entryDirectory,
|
45346
45353
|
routesManifest,
|
45347
45354
|
prerenderManifest,
|
45355
|
+
appPathRoutesManifest,
|
45348
45356
|
isServerMode: true,
|
45349
45357
|
isSharedLambdas: false,
|
45350
45358
|
canUsePreviewMode,
|
@@ -47028,7 +47036,7 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
|
|
47028
47036
|
exports.onPrerenderRouteInitial = onPrerenderRouteInitial;
|
47029
47037
|
let prerenderGroup = 1;
|
47030
47038
|
const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFallback, isOmitted, locale, }) => {
|
47031
|
-
const { pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, isEmptyAllowQueryForPrendered, } = prerenderRouteArgs;
|
47039
|
+
const { appDir, pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, isEmptyAllowQueryForPrendered, } = prerenderRouteArgs;
|
47032
47040
|
if (isBlocking && isFallback) {
|
47033
47041
|
throw new build_utils_1.NowBuildError({
|
47034
47042
|
code: 'NEXT_ISBLOCKING_ISFALLBACK',
|
@@ -47064,28 +47072,6 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
47064
47072
|
routeFileNoExt, routesManifest, locale);
|
47065
47073
|
}
|
47066
47074
|
const isNotFound = prerenderManifest.notFoundRoutes.includes(routeKey);
|
47067
|
-
const htmlFsRef = isBlocking || (isNotFound && !static404Page)
|
47068
|
-
? // Blocking pages do not have an HTML fallback
|
47069
|
-
null
|
47070
|
-
: new build_utils_1.FileFsRef({
|
47071
|
-
fsPath: path_1.default.join(pagesDir, isFallback
|
47072
|
-
? // Fallback pages have a special file.
|
47073
|
-
addLocaleOrDefault(prerenderManifest.fallbackRoutes[routeKey].fallback, routesManifest, locale)
|
47074
|
-
: // Otherwise, the route itself should exist as a static HTML
|
47075
|
-
// file.
|
47076
|
-
`${isOmitted || isNotFound
|
47077
|
-
? addLocaleOrDefault('/404', routesManifest, locale)
|
47078
|
-
: routeFileNoExt}.html`),
|
47079
|
-
});
|
47080
|
-
const jsonFsRef =
|
47081
|
-
// JSON data does not exist for fallback or blocking pages
|
47082
|
-
isFallback || isBlocking || (isNotFound && !static404Page)
|
47083
|
-
? null
|
47084
|
-
: new build_utils_1.FileFsRef({
|
47085
|
-
fsPath: path_1.default.join(pagesDir, `${isOmitted || isNotFound
|
47086
|
-
? addLocaleOrDefault('/404.html', routesManifest, locale)
|
47087
|
-
: routeFileNoExt + '.json'}`),
|
47088
|
-
});
|
47089
47075
|
let initialRevalidate;
|
47090
47076
|
let srcRoute;
|
47091
47077
|
let dataRoute;
|
@@ -47114,6 +47100,35 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
47114
47100
|
const pr = prerenderManifest.staticRoutes[routeKey];
|
47115
47101
|
({ initialRevalidate, srcRoute, dataRoute } = pr);
|
47116
47102
|
}
|
47103
|
+
let isAppPathRoute = false;
|
47104
|
+
// TODO: leverage manifest to determine app paths more accurately
|
47105
|
+
if (appDir && srcRoute && dataRoute.endsWith('.rsc')) {
|
47106
|
+
isAppPathRoute = true;
|
47107
|
+
}
|
47108
|
+
const htmlFsRef = isBlocking || (isNotFound && !static404Page)
|
47109
|
+
? // Blocking pages do not have an HTML fallback
|
47110
|
+
null
|
47111
|
+
: new build_utils_1.FileFsRef({
|
47112
|
+
fsPath: path_1.default.join(isAppPathRoute && appDir ? appDir : pagesDir, isFallback
|
47113
|
+
? // Fallback pages have a special file.
|
47114
|
+
addLocaleOrDefault(prerenderManifest.fallbackRoutes[routeKey].fallback, routesManifest, locale)
|
47115
|
+
: // Otherwise, the route itself should exist as a static HTML
|
47116
|
+
// file.
|
47117
|
+
`${isOmitted || isNotFound
|
47118
|
+
? addLocaleOrDefault('/404', routesManifest, locale)
|
47119
|
+
: routeFileNoExt}.html`),
|
47120
|
+
});
|
47121
|
+
const jsonFsRef =
|
47122
|
+
// JSON data does not exist for fallback or blocking pages
|
47123
|
+
isFallback || isBlocking || (isNotFound && !static404Page)
|
47124
|
+
? null
|
47125
|
+
: new build_utils_1.FileFsRef({
|
47126
|
+
fsPath: path_1.default.join(isAppPathRoute && appDir ? appDir : pagesDir, `${isOmitted || isNotFound
|
47127
|
+
? addLocaleOrDefault('/404.html', routesManifest, locale)
|
47128
|
+
: isAppPathRoute
|
47129
|
+
? dataRoute
|
47130
|
+
: routeFileNoExt + '.json'}`),
|
47131
|
+
});
|
47117
47132
|
const outputPathPage = normalizeIndexOutput(path_1.default.posix.join(entryDirectory, routeFileNoExt), isServerMode);
|
47118
47133
|
const outputPathPageOrig = path_1.default.posix.join(entryDirectory, origRouteFileNoExt);
|
47119
47134
|
let lambda;
|
package/dist/server-build.js
CHANGED
@@ -495,6 +495,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
495
495
|
console.timeEnd(lambdaCreationLabel);
|
496
496
|
}
|
497
497
|
const prerenderRoute = (0, utils_1.onPrerenderRoute)({
|
498
|
+
appDir,
|
498
499
|
pagesDir,
|
499
500
|
pageLambdaMap: {},
|
500
501
|
lambdas,
|
@@ -502,6 +503,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
502
503
|
entryDirectory,
|
503
504
|
routesManifest,
|
504
505
|
prerenderManifest,
|
506
|
+
appPathRoutesManifest,
|
505
507
|
isServerMode: true,
|
506
508
|
isSharedLambdas: false,
|
507
509
|
canUsePreviewMode,
|
package/dist/utils.js
CHANGED
@@ -1027,7 +1027,7 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
|
|
1027
1027
|
exports.onPrerenderRouteInitial = onPrerenderRouteInitial;
|
1028
1028
|
let prerenderGroup = 1;
|
1029
1029
|
const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFallback, isOmitted, locale, }) => {
|
1030
|
-
const { pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, isEmptyAllowQueryForPrendered, } = prerenderRouteArgs;
|
1030
|
+
const { appDir, pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, isEmptyAllowQueryForPrendered, } = prerenderRouteArgs;
|
1031
1031
|
if (isBlocking && isFallback) {
|
1032
1032
|
throw new build_utils_1.NowBuildError({
|
1033
1033
|
code: 'NEXT_ISBLOCKING_ISFALLBACK',
|
@@ -1063,28 +1063,6 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
1063
1063
|
routeFileNoExt, routesManifest, locale);
|
1064
1064
|
}
|
1065
1065
|
const isNotFound = prerenderManifest.notFoundRoutes.includes(routeKey);
|
1066
|
-
const htmlFsRef = isBlocking || (isNotFound && !static404Page)
|
1067
|
-
? // Blocking pages do not have an HTML fallback
|
1068
|
-
null
|
1069
|
-
: new build_utils_1.FileFsRef({
|
1070
|
-
fsPath: path_1.default.join(pagesDir, isFallback
|
1071
|
-
? // Fallback pages have a special file.
|
1072
|
-
addLocaleOrDefault(prerenderManifest.fallbackRoutes[routeKey].fallback, routesManifest, locale)
|
1073
|
-
: // Otherwise, the route itself should exist as a static HTML
|
1074
|
-
// file.
|
1075
|
-
`${isOmitted || isNotFound
|
1076
|
-
? addLocaleOrDefault('/404', routesManifest, locale)
|
1077
|
-
: routeFileNoExt}.html`),
|
1078
|
-
});
|
1079
|
-
const jsonFsRef =
|
1080
|
-
// JSON data does not exist for fallback or blocking pages
|
1081
|
-
isFallback || isBlocking || (isNotFound && !static404Page)
|
1082
|
-
? null
|
1083
|
-
: new build_utils_1.FileFsRef({
|
1084
|
-
fsPath: path_1.default.join(pagesDir, `${isOmitted || isNotFound
|
1085
|
-
? addLocaleOrDefault('/404.html', routesManifest, locale)
|
1086
|
-
: routeFileNoExt + '.json'}`),
|
1087
|
-
});
|
1088
1066
|
let initialRevalidate;
|
1089
1067
|
let srcRoute;
|
1090
1068
|
let dataRoute;
|
@@ -1113,6 +1091,35 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
1113
1091
|
const pr = prerenderManifest.staticRoutes[routeKey];
|
1114
1092
|
({ initialRevalidate, srcRoute, dataRoute } = pr);
|
1115
1093
|
}
|
1094
|
+
let isAppPathRoute = false;
|
1095
|
+
// TODO: leverage manifest to determine app paths more accurately
|
1096
|
+
if (appDir && srcRoute && dataRoute.endsWith('.rsc')) {
|
1097
|
+
isAppPathRoute = true;
|
1098
|
+
}
|
1099
|
+
const htmlFsRef = isBlocking || (isNotFound && !static404Page)
|
1100
|
+
? // Blocking pages do not have an HTML fallback
|
1101
|
+
null
|
1102
|
+
: new build_utils_1.FileFsRef({
|
1103
|
+
fsPath: path_1.default.join(isAppPathRoute && appDir ? appDir : pagesDir, isFallback
|
1104
|
+
? // Fallback pages have a special file.
|
1105
|
+
addLocaleOrDefault(prerenderManifest.fallbackRoutes[routeKey].fallback, routesManifest, locale)
|
1106
|
+
: // Otherwise, the route itself should exist as a static HTML
|
1107
|
+
// file.
|
1108
|
+
`${isOmitted || isNotFound
|
1109
|
+
? addLocaleOrDefault('/404', routesManifest, locale)
|
1110
|
+
: routeFileNoExt}.html`),
|
1111
|
+
});
|
1112
|
+
const jsonFsRef =
|
1113
|
+
// JSON data does not exist for fallback or blocking pages
|
1114
|
+
isFallback || isBlocking || (isNotFound && !static404Page)
|
1115
|
+
? null
|
1116
|
+
: new build_utils_1.FileFsRef({
|
1117
|
+
fsPath: path_1.default.join(isAppPathRoute && appDir ? appDir : pagesDir, `${isOmitted || isNotFound
|
1118
|
+
? addLocaleOrDefault('/404.html', routesManifest, locale)
|
1119
|
+
: isAppPathRoute
|
1120
|
+
? dataRoute
|
1121
|
+
: routeFileNoExt + '.json'}`),
|
1122
|
+
});
|
1116
1123
|
const outputPathPage = normalizeIndexOutput(path_1.default.posix.join(entryDirectory, routeFileNoExt), isServerMode);
|
1117
1124
|
const outputPathPageOrig = path_1.default.posix.join(entryDirectory, origRouteFileNoExt);
|
1118
1125
|
let lambda;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.28",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"@types/semver": "6.0.0",
|
45
45
|
"@types/text-table": "0.2.1",
|
46
46
|
"@types/webpack-sources": "3.2.0",
|
47
|
-
"@vercel/build-utils": "5.4.
|
47
|
+
"@vercel/build-utils": "5.4.4",
|
48
48
|
"@vercel/nft": "0.22.1",
|
49
49
|
"@vercel/routing-utils": "2.0.2",
|
50
50
|
"async-sema": "3.0.1",
|
@@ -69,5 +69,5 @@
|
|
69
69
|
"typescript": "4.5.2",
|
70
70
|
"webpack-sources": "3.2.3"
|
71
71
|
},
|
72
|
-
"gitHead": "
|
72
|
+
"gitHead": "51d968314f5914138defa2a9fe724324d53efdd1"
|
73
73
|
}
|