@vercel/next 3.1.4 → 3.1.7
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 +48 -10
- package/dist/server-build.js +3 -0
- package/dist/utils.js +44 -10
- package/package.json +4 -4
package/dist/index.js
CHANGED
@@ -42668,6 +42668,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
|
|
42668
42668
|
const env = { ...spawnOpts.env };
|
42669
42669
|
const memoryToConsume = Math.floor(os_1.default.totalmem() / 1024 ** 2) - 128;
|
42670
42670
|
env.NODE_OPTIONS = `--max_old_space_size=${memoryToConsume}`;
|
42671
|
+
env.NEXT_EDGE_RUNTIME_PROVIDER = 'vercel';
|
42671
42672
|
if (target) {
|
42672
42673
|
// Since version v10.0.8-canary.15 of Next.js the NEXT_PRIVATE_TARGET env
|
42673
42674
|
// value can be used to override the target set in next.config.js
|
@@ -44632,12 +44633,14 @@ const pretty_bytes_1 = __importDefault(__webpack_require__(539));
|
|
44632
44633
|
const CORRECT_NOT_FOUND_ROUTES_VERSION = 'v12.0.1';
|
44633
44634
|
const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
|
44634
44635
|
const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
|
44636
|
+
const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
|
44635
44637
|
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, }) {
|
44636
44638
|
const lambdas = {};
|
44637
44639
|
const prerenders = {};
|
44638
44640
|
const lambdaPageKeys = Object.keys(lambdaPages);
|
44639
44641
|
const internalPages = ['_app.js', '_error.js', '_document.js'];
|
44640
44642
|
const pageBuildTraces = await (0, build_utils_1.glob)('**/*.js.nft.json', pagesDir);
|
44643
|
+
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
44641
44644
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
44642
44645
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
44643
44646
|
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
@@ -45029,6 +45032,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
45029
45032
|
static404Page,
|
45030
45033
|
hasPages404: routesManifest.pages404,
|
45031
45034
|
isCorrectNotFoundRoutes,
|
45035
|
+
isEmptyAllowQueryForPrendered,
|
45032
45036
|
});
|
45033
45037
|
Object.keys(prerenderManifest.staticRoutes).forEach(route => prerenderRoute(route, {}));
|
45034
45038
|
Object.keys(prerenderManifest.fallbackRoutes).forEach(route => prerenderRoute(route, { isFallback: true }));
|
@@ -46678,7 +46682,7 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
|
|
46678
46682
|
exports.onPrerenderRouteInitial = onPrerenderRouteInitial;
|
46679
46683
|
let prerenderGroup = 1;
|
46680
46684
|
const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFallback, isOmitted, locale, }) => {
|
46681
|
-
const { pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, } = prerenderRouteArgs;
|
46685
|
+
const { pagesDir, hasPages404, static404Page, entryDirectory, prerenderManifest, isSharedLambdas, isServerMode, canUsePreviewMode, lambdas, prerenders, pageLambdaMap, routesManifest, isCorrectNotFoundRoutes, isEmptyAllowQueryForPrendered, } = prerenderRouteArgs;
|
46682
46686
|
if (isBlocking && isFallback) {
|
46683
46687
|
throw new build_utils_1.NowBuildError({
|
46684
46688
|
code: 'NEXT_ISBLOCKING_ISFALLBACK',
|
@@ -46818,21 +46822,39 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
46818
46822
|
// a given path. All other query keys will be striped. We can automatically
|
46819
46823
|
// detect this for prerender (ISR) pages by reading the routes manifest file.
|
46820
46824
|
const pageKey = srcRoute || routeKey;
|
46821
|
-
const isDynamic = isDynamicRoute(pageKey);
|
46822
46825
|
const route = routesManifest?.dynamicRoutes.find((r) => r.page === pageKey && !('isMiddleware' in r));
|
46823
46826
|
const routeKeys = route?.routeKeys;
|
46824
46827
|
// by default allowQuery should be undefined and only set when
|
46825
46828
|
// we have sufficient information to set it
|
46826
46829
|
let allowQuery;
|
46827
|
-
if (
|
46828
|
-
|
46829
|
-
|
46830
|
-
|
46830
|
+
if (isEmptyAllowQueryForPrendered) {
|
46831
|
+
const isDynamic = isDynamicRoute(routeKey);
|
46832
|
+
if (!isDynamic) {
|
46833
|
+
// for non-dynamic routes we use an empty array since
|
46834
|
+
// no query values bust the cache for non-dynamic prerenders
|
46835
|
+
// prerendered paths also do not pass allowQuery as they match
|
46836
|
+
// during handle: 'filesystem' so should not cache differently
|
46837
|
+
// by query values
|
46838
|
+
allowQuery = [];
|
46839
|
+
}
|
46840
|
+
else if (routeKeys) {
|
46841
|
+
// if we have routeKeys in the routes-manifest we use those
|
46842
|
+
// for allowQuery for dynamic routes
|
46843
|
+
allowQuery = Object.values(routeKeys);
|
46844
|
+
}
|
46831
46845
|
}
|
46832
|
-
else
|
46833
|
-
|
46834
|
-
|
46835
|
-
|
46846
|
+
else {
|
46847
|
+
const isDynamic = isDynamicRoute(pageKey);
|
46848
|
+
if (routeKeys) {
|
46849
|
+
// if we have routeKeys in the routes-manifest we use those
|
46850
|
+
// for allowQuery for dynamic routes
|
46851
|
+
allowQuery = Object.values(routeKeys);
|
46852
|
+
}
|
46853
|
+
else if (!isDynamic) {
|
46854
|
+
// for non-dynamic routes we use an empty array since
|
46855
|
+
// no query values bust the cache for non-dynamic prerenders
|
46856
|
+
allowQuery = [];
|
46857
|
+
}
|
46836
46858
|
}
|
46837
46859
|
prerenders[outputPathPage] = new build_utils_1.Prerender({
|
46838
46860
|
expiration: initialRevalidate,
|
@@ -47030,6 +47052,15 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
47030
47052
|
});
|
47031
47053
|
return acc;
|
47032
47054
|
}, {});
|
47055
|
+
const assetFiles = (edgeFunction.assets ?? []).reduce((acc, { filePath, name }) => {
|
47056
|
+
const fullFilePath = path_1.default.join(entryPath, outputDirectory, filePath);
|
47057
|
+
acc[`assets/${name}`] = new build_utils_1.FileFsRef({
|
47058
|
+
mode: 0o644,
|
47059
|
+
contentType: 'application/octet-stream',
|
47060
|
+
fsPath: fullFilePath,
|
47061
|
+
});
|
47062
|
+
return acc;
|
47063
|
+
}, {});
|
47033
47064
|
return new build_utils_1.EdgeFunction({
|
47034
47065
|
deploymentTarget: 'v8-worker',
|
47035
47066
|
name: edgeFunction.name,
|
@@ -47047,9 +47078,16 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
47047
47078
|
}),
|
47048
47079
|
}),
|
47049
47080
|
...wasmFiles,
|
47081
|
+
...assetFiles,
|
47050
47082
|
},
|
47051
47083
|
entrypoint: 'index.js',
|
47052
47084
|
envVarsInUse: edgeFunction.env,
|
47085
|
+
assets: (edgeFunction.assets ?? []).map(({ name }) => {
|
47086
|
+
return {
|
47087
|
+
name,
|
47088
|
+
path: `assets/${name}`,
|
47089
|
+
};
|
47090
|
+
}),
|
47053
47091
|
});
|
47054
47092
|
})(),
|
47055
47093
|
routeSrc: getRouteSrc(edgeFunction, routesManifest),
|
package/dist/server-build.js
CHANGED
@@ -19,12 +19,14 @@ const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
|
19
19
|
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
|
+
const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
|
22
23
|
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, }) {
|
23
24
|
const lambdas = {};
|
24
25
|
const prerenders = {};
|
25
26
|
const lambdaPageKeys = Object.keys(lambdaPages);
|
26
27
|
const internalPages = ['_app.js', '_error.js', '_document.js'];
|
27
28
|
const pageBuildTraces = await (0, build_utils_1.glob)('**/*.js.nft.json', pagesDir);
|
29
|
+
const isEmptyAllowQueryForPrendered = semver_1.default.gte(nextVersion, EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION);
|
28
30
|
const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
|
29
31
|
const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
|
30
32
|
let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
|
@@ -416,6 +418,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
|
|
416
418
|
static404Page,
|
417
419
|
hasPages404: routesManifest.pages404,
|
418
420
|
isCorrectNotFoundRoutes,
|
421
|
+
isEmptyAllowQueryForPrendered,
|
419
422
|
});
|
420
423
|
Object.keys(prerenderManifest.staticRoutes).forEach(route => prerenderRoute(route, {}));
|
421
424
|
Object.keys(prerenderManifest.fallbackRoutes).forEach(route => prerenderRoute(route, { isFallback: true }));
|
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, } = prerenderRouteArgs;
|
1030
|
+
const { 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',
|
@@ -1167,21 +1167,39 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
|
|
1167
1167
|
// a given path. All other query keys will be striped. We can automatically
|
1168
1168
|
// detect this for prerender (ISR) pages by reading the routes manifest file.
|
1169
1169
|
const pageKey = srcRoute || routeKey;
|
1170
|
-
const isDynamic = isDynamicRoute(pageKey);
|
1171
1170
|
const route = routesManifest?.dynamicRoutes.find((r) => r.page === pageKey && !('isMiddleware' in r));
|
1172
1171
|
const routeKeys = route?.routeKeys;
|
1173
1172
|
// by default allowQuery should be undefined and only set when
|
1174
1173
|
// we have sufficient information to set it
|
1175
1174
|
let allowQuery;
|
1176
|
-
if (
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1175
|
+
if (isEmptyAllowQueryForPrendered) {
|
1176
|
+
const isDynamic = isDynamicRoute(routeKey);
|
1177
|
+
if (!isDynamic) {
|
1178
|
+
// for non-dynamic routes we use an empty array since
|
1179
|
+
// no query values bust the cache for non-dynamic prerenders
|
1180
|
+
// prerendered paths also do not pass allowQuery as they match
|
1181
|
+
// during handle: 'filesystem' so should not cache differently
|
1182
|
+
// by query values
|
1183
|
+
allowQuery = [];
|
1184
|
+
}
|
1185
|
+
else if (routeKeys) {
|
1186
|
+
// if we have routeKeys in the routes-manifest we use those
|
1187
|
+
// for allowQuery for dynamic routes
|
1188
|
+
allowQuery = Object.values(routeKeys);
|
1189
|
+
}
|
1180
1190
|
}
|
1181
|
-
else
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1191
|
+
else {
|
1192
|
+
const isDynamic = isDynamicRoute(pageKey);
|
1193
|
+
if (routeKeys) {
|
1194
|
+
// if we have routeKeys in the routes-manifest we use those
|
1195
|
+
// for allowQuery for dynamic routes
|
1196
|
+
allowQuery = Object.values(routeKeys);
|
1197
|
+
}
|
1198
|
+
else if (!isDynamic) {
|
1199
|
+
// for non-dynamic routes we use an empty array since
|
1200
|
+
// no query values bust the cache for non-dynamic prerenders
|
1201
|
+
allowQuery = [];
|
1202
|
+
}
|
1185
1203
|
}
|
1186
1204
|
prerenders[outputPathPage] = new build_utils_1.Prerender({
|
1187
1205
|
expiration: initialRevalidate,
|
@@ -1379,6 +1397,15 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
1379
1397
|
});
|
1380
1398
|
return acc;
|
1381
1399
|
}, {});
|
1400
|
+
const assetFiles = (edgeFunction.assets ?? []).reduce((acc, { filePath, name }) => {
|
1401
|
+
const fullFilePath = path_1.default.join(entryPath, outputDirectory, filePath);
|
1402
|
+
acc[`assets/${name}`] = new build_utils_1.FileFsRef({
|
1403
|
+
mode: 0o644,
|
1404
|
+
contentType: 'application/octet-stream',
|
1405
|
+
fsPath: fullFilePath,
|
1406
|
+
});
|
1407
|
+
return acc;
|
1408
|
+
}, {});
|
1382
1409
|
return new build_utils_1.EdgeFunction({
|
1383
1410
|
deploymentTarget: 'v8-worker',
|
1384
1411
|
name: edgeFunction.name,
|
@@ -1396,9 +1423,16 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
|
|
1396
1423
|
}),
|
1397
1424
|
}),
|
1398
1425
|
...wasmFiles,
|
1426
|
+
...assetFiles,
|
1399
1427
|
},
|
1400
1428
|
entrypoint: 'index.js',
|
1401
1429
|
envVarsInUse: edgeFunction.env,
|
1430
|
+
assets: (edgeFunction.assets ?? []).map(({ name }) => {
|
1431
|
+
return {
|
1432
|
+
name,
|
1433
|
+
path: `assets/${name}`,
|
1434
|
+
};
|
1435
|
+
}),
|
1402
1436
|
});
|
1403
1437
|
})(),
|
1404
1438
|
routeSrc: getRouteSrc(edgeFunction, routesManifest),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/next",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.7",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index",
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
|
@@ -45,9 +45,9 @@
|
|
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.3",
|
49
49
|
"@vercel/nft": "0.20.1",
|
50
|
-
"@vercel/routing-utils": "
|
50
|
+
"@vercel/routing-utils": "2.0.0",
|
51
51
|
"async-sema": "3.0.1",
|
52
52
|
"buffer-crc32": "0.2.13",
|
53
53
|
"cheerio": "1.0.0-rc.10",
|
@@ -70,5 +70,5 @@
|
|
70
70
|
"typescript": "4.5.2",
|
71
71
|
"webpack-sources": "3.2.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "bef1aec76609ae661f084dcc391edd66f891f0b4"
|
74
74
|
}
|