@vercel/next 3.2.4 → 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
@@ -45510,7 +45538,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45510
45538
  if (lambdas[route]) {
45511
45539
  lambdas[`${route}.rsc`] = lambdas[route];
45512
45540
  }
45513
- else if (edgeFunctions[route]) {
45541
+ if (edgeFunctions[route]) {
45514
45542
  edgeFunctions[`${route}.rsc`] = edgeFunctions[route];
45515
45543
  }
45516
45544
  }
@@ -45709,6 +45737,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45709
45737
  ...(!isCorrectMiddlewareOrder ? middleware.staticRoutes : []),
45710
45738
  ...(appDir
45711
45739
  ? [
45740
+ {
45741
+ src: `^${path_1.default.posix.join('/', entryDirectory, '/')}`,
45742
+ has: [
45743
+ {
45744
+ type: 'header',
45745
+ key: '__rsc__',
45746
+ },
45747
+ ],
45748
+ dest: path_1.default.posix.join('/', entryDirectory, '/index.rsc'),
45749
+ check: true,
45750
+ },
45712
45751
  {
45713
45752
  src: `^${path_1.default.posix.join('/', entryDirectory, '/(.*)$')}`,
45714
45753
  has: [
@@ -45877,6 +45916,20 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45877
45916
  continue: true,
45878
45917
  important: true,
45879
45918
  },
45919
+ ...(appDir
45920
+ ? [
45921
+ {
45922
+ src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
45923
+ headers: {
45924
+ 'content-type': 'application/octet-stream',
45925
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
45926
+ },
45927
+ continue: true,
45928
+ important: true,
45929
+ },
45930
+ ...appDirVaryRoutes,
45931
+ ]
45932
+ : []),
45880
45933
  // TODO: remove below workaround when `/` is allowed to be output
45881
45934
  // different than `/index`
45882
45935
  {
@@ -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
@@ -661,7 +689,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
661
689
  if (lambdas[route]) {
662
690
  lambdas[`${route}.rsc`] = lambdas[route];
663
691
  }
664
- else if (edgeFunctions[route]) {
692
+ if (edgeFunctions[route]) {
665
693
  edgeFunctions[`${route}.rsc`] = edgeFunctions[route];
666
694
  }
667
695
  }
@@ -860,6 +888,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
860
888
  ...(!isCorrectMiddlewareOrder ? middleware.staticRoutes : []),
861
889
  ...(appDir
862
890
  ? [
891
+ {
892
+ src: `^${path_1.default.posix.join('/', entryDirectory, '/')}`,
893
+ has: [
894
+ {
895
+ type: 'header',
896
+ key: '__rsc__',
897
+ },
898
+ ],
899
+ dest: path_1.default.posix.join('/', entryDirectory, '/index.rsc'),
900
+ check: true,
901
+ },
863
902
  {
864
903
  src: `^${path_1.default.posix.join('/', entryDirectory, '/(.*)$')}`,
865
904
  has: [
@@ -1028,6 +1067,20 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
1028
1067
  continue: true,
1029
1068
  important: true,
1030
1069
  },
1070
+ ...(appDir
1071
+ ? [
1072
+ {
1073
+ src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
1074
+ headers: {
1075
+ 'content-type': 'application/octet-stream',
1076
+ vary: '__rsc__, __next_router_state_tree__, __next_router_prefetch__',
1077
+ },
1078
+ continue: true,
1079
+ important: true,
1080
+ },
1081
+ ...appDirVaryRoutes,
1082
+ ]
1083
+ : []),
1031
1084
  // TODO: remove below workaround when `/` is allowed to be output
1032
1085
  // different than `/index`
1033
1086
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.2.4",
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",
@@ -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.4",
47
+ "@vercel/build-utils": "5.5.5",
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": "3b5b397b355a6c1f044049e02dac5aa9f9d1621c"
72
+ "gitHead": "dd94dcab3255839c7c9addbba35026dc88cf0e95"
73
73
  }