@vercel/next 3.2.2 → 3.2.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 +20 -6
- package/dist/server-build.js +18 -5
- package/dist/utils.js +2 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -45391,7 +45391,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45391
45391
|
// we combine routes into one src here to reduce the number of needed
|
45392
45392
|
// routes since only the status is being modified and we don't want
|
45393
45393
|
// to exceed the routes limit
|
45394
|
-
const starterRouteSrc = `^${entryDirectory !== '.'
|
45394
|
+
const starterRouteSrc = `^${entryDirectory !== '.'
|
45395
|
+
? `${path_1.default.posix.join('/', entryDirectory)}()`
|
45396
|
+
: '()'}`;
|
45395
45397
|
let currentRouteSrc = starterRouteSrc;
|
45396
45398
|
const pushRoute = (src) => {
|
45397
45399
|
notFoundPreviewRoutes.push({
|
@@ -45414,7 +45416,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45414
45416
|
const route = prerenderManifest.notFoundRoutes[i];
|
45415
45417
|
const isLastRoute = i === prerenderManifest.notFoundRoutes.length - 1;
|
45416
45418
|
if (prerenderManifest.staticRoutes[route]?.initialRevalidate === false) {
|
45417
|
-
if (currentRouteSrc.length + route.length + 1 >=
|
45419
|
+
if (currentRouteSrc.length + route.length + 1 >= 4000) {
|
45418
45420
|
pushRoute(currentRouteSrc);
|
45419
45421
|
currentRouteSrc = starterRouteSrc;
|
45420
45422
|
}
|
@@ -45798,8 +45800,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45798
45800
|
dynamicRoutes
|
45799
45801
|
.map(route => {
|
45800
45802
|
route = Object.assign({}, route);
|
45801
|
-
|
45802
|
-
|
45803
|
+
let normalizedSrc = route.src;
|
45804
|
+
if (routesManifest.basePath) {
|
45805
|
+
normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
|
45806
|
+
}
|
45807
|
+
route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
|
45808
|
+
.replace(/\^\(\?:\/\(\?</, '(?:(?<')
|
45809
|
+
.replace(/(^\^|\$$)/g, '') + '.json$');
|
45810
|
+
const parsedDestination = new URL(route.dest || '/', 'http://n');
|
45811
|
+
let pathname = parsedDestination.pathname;
|
45812
|
+
const search = parsedDestination.search;
|
45803
45813
|
let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
|
45804
45814
|
if (routesManifest.i18n) {
|
45805
45815
|
for (const locale of routesManifest.i18n?.locales || []) {
|
@@ -45811,7 +45821,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45811
45821
|
}
|
45812
45822
|
}
|
45813
45823
|
if (isPrerender) {
|
45814
|
-
|
45824
|
+
if (routesManifest.basePath) {
|
45825
|
+
pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
|
45826
|
+
}
|
45827
|
+
route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
|
45815
45828
|
}
|
45816
45829
|
return route;
|
45817
45830
|
})
|
@@ -47204,7 +47217,8 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
47204
47217
|
}
|
47205
47218
|
// if preview mode/On-Demand ISR can't be leveraged
|
47206
47219
|
// we can output pure static outputs instead of prerenders
|
47207
|
-
if (!canUsePreviewMode
|
47220
|
+
if (!canUsePreviewMode ||
|
47221
|
+
(routeKey === '/404' && !lambdas[outputPathPage])) {
|
47208
47222
|
htmlFsRef.contentType = _1.htmlContentType;
|
47209
47223
|
prerenders[outputPathPage] = htmlFsRef;
|
47210
47224
|
prerenders[outputPathData] = jsonFsRef;
|
package/dist/server-build.js
CHANGED
@@ -542,7 +542,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
542
542
|
// we combine routes into one src here to reduce the number of needed
|
543
543
|
// routes since only the status is being modified and we don't want
|
544
544
|
// to exceed the routes limit
|
545
|
-
const starterRouteSrc = `^${entryDirectory !== '.'
|
545
|
+
const starterRouteSrc = `^${entryDirectory !== '.'
|
546
|
+
? `${path_1.default.posix.join('/', entryDirectory)}()`
|
547
|
+
: '()'}`;
|
546
548
|
let currentRouteSrc = starterRouteSrc;
|
547
549
|
const pushRoute = (src) => {
|
548
550
|
notFoundPreviewRoutes.push({
|
@@ -565,7 +567,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
565
567
|
const route = prerenderManifest.notFoundRoutes[i];
|
566
568
|
const isLastRoute = i === prerenderManifest.notFoundRoutes.length - 1;
|
567
569
|
if (prerenderManifest.staticRoutes[route]?.initialRevalidate === false) {
|
568
|
-
if (currentRouteSrc.length + route.length + 1 >=
|
570
|
+
if (currentRouteSrc.length + route.length + 1 >= 4000) {
|
569
571
|
pushRoute(currentRouteSrc);
|
570
572
|
currentRouteSrc = starterRouteSrc;
|
571
573
|
}
|
@@ -949,8 +951,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
949
951
|
dynamicRoutes
|
950
952
|
.map(route => {
|
951
953
|
route = Object.assign({}, route);
|
952
|
-
|
953
|
-
|
954
|
+
let normalizedSrc = route.src;
|
955
|
+
if (routesManifest.basePath) {
|
956
|
+
normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
|
957
|
+
}
|
958
|
+
route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
|
959
|
+
.replace(/\^\(\?:\/\(\?</, '(?:(?<')
|
960
|
+
.replace(/(^\^|\$$)/g, '') + '.json$');
|
961
|
+
const parsedDestination = new URL(route.dest || '/', 'http://n');
|
962
|
+
let pathname = parsedDestination.pathname;
|
963
|
+
const search = parsedDestination.search;
|
954
964
|
let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
|
955
965
|
if (routesManifest.i18n) {
|
956
966
|
for (const locale of routesManifest.i18n?.locales || []) {
|
@@ -962,7 +972,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
962
972
|
}
|
963
973
|
}
|
964
974
|
if (isPrerender) {
|
965
|
-
|
975
|
+
if (routesManifest.basePath) {
|
976
|
+
pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
|
977
|
+
}
|
978
|
+
route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
|
966
979
|
}
|
967
980
|
return route;
|
968
981
|
})
|
package/dist/utils.js
CHANGED
@@ -1153,7 +1153,8 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
1153
1153
|
}
|
1154
1154
|
// if preview mode/On-Demand ISR can't be leveraged
|
1155
1155
|
// we can output pure static outputs instead of prerenders
|
1156
|
-
if (!canUsePreviewMode
|
1156
|
+
if (!canUsePreviewMode ||
|
1157
|
+
(routeKey === '/404' && !lambdas[outputPathPage])) {
|
1157
1158
|
htmlFsRef.contentType = _1.htmlContentType;
|
1158
1159
|
prerenders[outputPathPage] = htmlFsRef;
|
1159
1160
|
prerenders[outputPathData] = jsonFsRef;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.2.
|
3
|
+
"version": "3.2.4",
|
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.5.
|
47
|
+
"@vercel/build-utils": "5.5.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": "3b5b397b355a6c1f044049e02dac5aa9f9d1621c"
|
73
73
|
}
|