@vercel/next 3.1.5 → 3.1.6

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 CHANGED
@@ -44633,12 +44633,14 @@ const pretty_bytes_1 = __importDefault(__webpack_require__(539));
44633
44633
  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
+ const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
44636
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, }) {
44637
44638
  const lambdas = {};
44638
44639
  const prerenders = {};
44639
44640
  const lambdaPageKeys = Object.keys(lambdaPages);
44640
44641
  const internalPages = ['_app.js', '_error.js', '_document.js'];
44641
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);
44642
44644
  const isCorrectNotFoundRoutes = semver_1.default.gte(nextVersion, CORRECT_NOT_FOUND_ROUTES_VERSION);
44643
44645
  const isCorrectMiddlewareOrder = semver_1.default.gte(nextVersion, CORRECT_MIDDLEWARE_ORDER_VERSION);
44644
44646
  let hasStatic500 = !!staticPages[path_1.default.join(entryDirectory, '500')];
@@ -45030,6 +45032,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45030
45032
  static404Page,
45031
45033
  hasPages404: routesManifest.pages404,
45032
45034
  isCorrectNotFoundRoutes,
45035
+ isEmptyAllowQueryForPrendered,
45033
45036
  });
45034
45037
  Object.keys(prerenderManifest.staticRoutes).forEach(route => prerenderRoute(route, {}));
45035
45038
  Object.keys(prerenderManifest.fallbackRoutes).forEach(route => prerenderRoute(route, { isFallback: true }));
@@ -46679,7 +46682,7 @@ const onPrerenderRouteInitial = (prerenderManifest, canUsePreviewMode, entryDire
46679
46682
  exports.onPrerenderRouteInitial = onPrerenderRouteInitial;
46680
46683
  let prerenderGroup = 1;
46681
46684
  const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFallback, isOmitted, locale, }) => {
46682
- 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;
46683
46686
  if (isBlocking && isFallback) {
46684
46687
  throw new build_utils_1.NowBuildError({
46685
46688
  code: 'NEXT_ISBLOCKING_ISFALLBACK',
@@ -46819,21 +46822,39 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
46819
46822
  // a given path. All other query keys will be striped. We can automatically
46820
46823
  // detect this for prerender (ISR) pages by reading the routes manifest file.
46821
46824
  const pageKey = srcRoute || routeKey;
46822
- const isDynamic = isDynamicRoute(pageKey);
46823
46825
  const route = routesManifest?.dynamicRoutes.find((r) => r.page === pageKey && !('isMiddleware' in r));
46824
46826
  const routeKeys = route?.routeKeys;
46825
46827
  // by default allowQuery should be undefined and only set when
46826
46828
  // we have sufficient information to set it
46827
46829
  let allowQuery;
46828
- if (routeKeys) {
46829
- // if we have routeKeys in the routes-manifest we use those
46830
- // for allowQuery for dynamic routes
46831
- allowQuery = Object.values(routeKeys);
46832
- }
46833
- else if (!isDynamic) {
46834
- // for non-dynamic routes we use an empty array since
46835
- // no query values bust the cache for non-dynamic prerenders
46836
- allowQuery = [];
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
+ }
46845
+ }
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
+ }
46837
46858
  }
46838
46859
  prerenders[outputPathPage] = new build_utils_1.Prerender({
46839
46860
  expiration: initialRevalidate,
@@ -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 (routeKeys) {
1177
- // if we have routeKeys in the routes-manifest we use those
1178
- // for allowQuery for dynamic routes
1179
- allowQuery = Object.values(routeKeys);
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 if (!isDynamic) {
1182
- // for non-dynamic routes we use an empty array since
1183
- // no query values bust the cache for non-dynamic prerenders
1184
- allowQuery = [];
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -70,5 +70,5 @@
70
70
  "typescript": "4.5.2",
71
71
  "webpack-sources": "3.2.3"
72
72
  },
73
- "gitHead": "d2f8d178f77e15cb490cce73f5766537d892f763"
73
+ "gitHead": "1be7a80bb8688cd3567fd1f2dacf9ab4b8c4149e"
74
74
  }