@vercel/next 3.2.5 → 3.2.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
@@ -45387,6 +45387,34 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45387
45387
  const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
45388
45388
  const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } = await (0, utils_1.getStaticFiles)(entryPath, entryDirectory, outputDirectory);
45389
45389
  const notFoundPreviewRoutes = [];
45390
+ const appDirVaryRoutes = [];
45391
+ // ensure Vary header is set for static app paths
45392
+ // TODO: remove when we are able to set initial headers on Prerender
45393
+ if (appPathRoutesManifest) {
45394
+ for (const route of Object.values(appPathRoutesManifest)) {
45395
+ if (!prerenders[path_1.default.posix.join('.', entryDirectory, route)]) {
45396
+ continue;
45397
+ }
45398
+ let src = path_1.default.posix.join('/', entryDirectory, route);
45399
+ if ((0, utils_1.isDynamicRoute)(route)) {
45400
+ const dynamicRoute = routesManifest.dynamicRoutes.find(r => {
45401
+ return r.page === route;
45402
+ });
45403
+ if (dynamicRoute &&
45404
+ 'namedRegex' in dynamicRoute &&
45405
+ dynamicRoute.namedRegex) {
45406
+ src = src.replace(new RegExp(`${(0, escape_string_regexp_1.default)(route)}$`), dynamicRoute.namedRegex.replace(/^\^/, ''));
45407
+ }
45408
+ }
45409
+ appDirVaryRoutes.push({
45410
+ src,
45411
+ headers: {
45412
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
45413
+ },
45414
+ continue: true,
45415
+ });
45416
+ }
45417
+ }
45390
45418
  if (prerenderManifest.notFoundRoutes?.length > 0 && canUsePreviewMode) {
45391
45419
  // we combine routes into one src here to reduce the number of needed
45392
45420
  // routes since only the status is being modified and we don't want
@@ -45894,10 +45922,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45894
45922
  src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
45895
45923
  headers: {
45896
45924
  'content-type': 'application/octet-stream',
45925
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
45897
45926
  },
45898
45927
  continue: true,
45899
45928
  important: true,
45900
45929
  },
45930
+ ...appDirVaryRoutes,
45901
45931
  ]
45902
45932
  : []),
45903
45933
  // TODO: remove below workaround when `/` is allowed to be output
@@ -538,6 +538,34 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
538
538
  const dynamicRoutes = await (0, utils_1.getDynamicRoutes)(entryPath, entryDirectory, dynamicPages, false, routesManifest, omittedPrerenderRoutes, canUsePreviewMode, prerenderManifest.bypassToken || '', true, middleware.dynamicRouteMap).then(arr => (0, utils_1.localizeDynamicRoutes)(arr, dynamicPrefix, entryDirectory, staticPages, prerenderManifest, routesManifest, true, isCorrectLocaleAPIRoutes));
539
539
  const { staticFiles, publicDirectoryFiles, staticDirectoryFiles } = await (0, utils_1.getStaticFiles)(entryPath, entryDirectory, outputDirectory);
540
540
  const notFoundPreviewRoutes = [];
541
+ const appDirVaryRoutes = [];
542
+ // ensure Vary header is set for static app paths
543
+ // TODO: remove when we are able to set initial headers on Prerender
544
+ if (appPathRoutesManifest) {
545
+ for (const route of Object.values(appPathRoutesManifest)) {
546
+ if (!prerenders[path_1.default.posix.join('.', entryDirectory, route)]) {
547
+ continue;
548
+ }
549
+ let src = path_1.default.posix.join('/', entryDirectory, route);
550
+ if ((0, utils_1.isDynamicRoute)(route)) {
551
+ const dynamicRoute = routesManifest.dynamicRoutes.find(r => {
552
+ return r.page === route;
553
+ });
554
+ if (dynamicRoute &&
555
+ 'namedRegex' in dynamicRoute &&
556
+ dynamicRoute.namedRegex) {
557
+ src = src.replace(new RegExp(`${(0, escape_string_regexp_1.default)(route)}$`), dynamicRoute.namedRegex.replace(/^\^/, ''));
558
+ }
559
+ }
560
+ appDirVaryRoutes.push({
561
+ src,
562
+ headers: {
563
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
564
+ },
565
+ continue: true,
566
+ });
567
+ }
568
+ }
541
569
  if (prerenderManifest.notFoundRoutes?.length > 0 && canUsePreviewMode) {
542
570
  // we combine routes into one src here to reduce the number of needed
543
571
  // routes since only the status is being modified and we don't want
@@ -1045,10 +1073,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
1045
1073
  src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
1046
1074
  headers: {
1047
1075
  'content-type': 'application/octet-stream',
1076
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
1048
1077
  },
1049
1078
  continue: true,
1050
1079
  important: true,
1051
1080
  },
1081
+ ...appDirVaryRoutes,
1052
1082
  ]
1053
1083
  : []),
1054
1084
  // TODO: remove below workaround when `/` is allowed to be output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -69,5 +69,5 @@
69
69
  "typescript": "4.5.2",
70
70
  "webpack-sources": "3.2.3"
71
71
  },
72
- "gitHead": "40f38948a04d83a9e260ddd455685d74e3eb9209"
72
+ "gitHead": "dd94dcab3255839c7c9addbba35026dc88cf0e95"
73
73
  }