@vercel/next 3.2.3 → 3.2.5

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
@@ -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 !== '.' ? path_1.default.posix.join('/', 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({
@@ -45508,7 +45510,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45508
45510
  if (lambdas[route]) {
45509
45511
  lambdas[`${route}.rsc`] = lambdas[route];
45510
45512
  }
45511
- else if (edgeFunctions[route]) {
45513
+ if (edgeFunctions[route]) {
45512
45514
  edgeFunctions[`${route}.rsc`] = edgeFunctions[route];
45513
45515
  }
45514
45516
  }
@@ -45707,6 +45709,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45707
45709
  ...(!isCorrectMiddlewareOrder ? middleware.staticRoutes : []),
45708
45710
  ...(appDir
45709
45711
  ? [
45712
+ {
45713
+ src: `^${path_1.default.posix.join('/', entryDirectory, '/')}`,
45714
+ has: [
45715
+ {
45716
+ type: 'header',
45717
+ key: '__rsc__',
45718
+ },
45719
+ ],
45720
+ dest: path_1.default.posix.join('/', entryDirectory, '/index.rsc'),
45721
+ check: true,
45722
+ },
45710
45723
  {
45711
45724
  src: `^${path_1.default.posix.join('/', entryDirectory, '/(.*)$')}`,
45712
45725
  has: [
@@ -45798,8 +45811,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45798
45811
  dynamicRoutes
45799
45812
  .map(route => {
45800
45813
  route = Object.assign({}, route);
45801
- route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, route.src.replace(/(^\^|\$$)/g, '') + '.json$');
45802
- const { pathname, search } = new URL(route.dest || '/', 'http://n');
45814
+ let normalizedSrc = route.src;
45815
+ if (routesManifest.basePath) {
45816
+ normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
45817
+ }
45818
+ route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
45819
+ .replace(/\^\(\?:\/\(\?</, '(?:(?<')
45820
+ .replace(/(^\^|\$$)/g, '') + '.json$');
45821
+ const parsedDestination = new URL(route.dest || '/', 'http://n');
45822
+ let pathname = parsedDestination.pathname;
45823
+ const search = parsedDestination.search;
45803
45824
  let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
45804
45825
  if (routesManifest.i18n) {
45805
45826
  for (const locale of routesManifest.i18n?.locales || []) {
@@ -45811,7 +45832,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45811
45832
  }
45812
45833
  }
45813
45834
  if (isPrerender) {
45814
- route.dest = `/_next/data/${buildId}${pathname}.json${search || ''}`;
45835
+ if (routesManifest.basePath) {
45836
+ pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
45837
+ }
45838
+ route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
45815
45839
  }
45816
45840
  return route;
45817
45841
  })
@@ -45864,6 +45888,18 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45864
45888
  continue: true,
45865
45889
  important: true,
45866
45890
  },
45891
+ ...(appDir
45892
+ ? [
45893
+ {
45894
+ src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
45895
+ headers: {
45896
+ 'content-type': 'application/octet-stream',
45897
+ },
45898
+ continue: true,
45899
+ important: true,
45900
+ },
45901
+ ]
45902
+ : []),
45867
45903
  // TODO: remove below workaround when `/` is allowed to be output
45868
45904
  // different than `/index`
45869
45905
  {
@@ -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 !== '.' ? path_1.default.posix.join('/', 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({
@@ -659,7 +661,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
659
661
  if (lambdas[route]) {
660
662
  lambdas[`${route}.rsc`] = lambdas[route];
661
663
  }
662
- else if (edgeFunctions[route]) {
664
+ if (edgeFunctions[route]) {
663
665
  edgeFunctions[`${route}.rsc`] = edgeFunctions[route];
664
666
  }
665
667
  }
@@ -858,6 +860,17 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
858
860
  ...(!isCorrectMiddlewareOrder ? middleware.staticRoutes : []),
859
861
  ...(appDir
860
862
  ? [
863
+ {
864
+ src: `^${path_1.default.posix.join('/', entryDirectory, '/')}`,
865
+ has: [
866
+ {
867
+ type: 'header',
868
+ key: '__rsc__',
869
+ },
870
+ ],
871
+ dest: path_1.default.posix.join('/', entryDirectory, '/index.rsc'),
872
+ check: true,
873
+ },
861
874
  {
862
875
  src: `^${path_1.default.posix.join('/', entryDirectory, '/(.*)$')}`,
863
876
  has: [
@@ -949,8 +962,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
949
962
  dynamicRoutes
950
963
  .map(route => {
951
964
  route = Object.assign({}, route);
952
- route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, route.src.replace(/(^\^|\$$)/g, '') + '.json$');
953
- const { pathname, search } = new URL(route.dest || '/', 'http://n');
965
+ let normalizedSrc = route.src;
966
+ if (routesManifest.basePath) {
967
+ normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
968
+ }
969
+ route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
970
+ .replace(/\^\(\?:\/\(\?</, '(?:(?<')
971
+ .replace(/(^\^|\$$)/g, '') + '.json$');
972
+ const parsedDestination = new URL(route.dest || '/', 'http://n');
973
+ let pathname = parsedDestination.pathname;
974
+ const search = parsedDestination.search;
954
975
  let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
955
976
  if (routesManifest.i18n) {
956
977
  for (const locale of routesManifest.i18n?.locales || []) {
@@ -962,7 +983,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
962
983
  }
963
984
  }
964
985
  if (isPrerender) {
965
- route.dest = `/_next/data/${buildId}${pathname}.json${search || ''}`;
986
+ if (routesManifest.basePath) {
987
+ pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
988
+ }
989
+ route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
966
990
  }
967
991
  return route;
968
992
  })
@@ -1015,6 +1039,18 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
1015
1039
  continue: true,
1016
1040
  important: true,
1017
1041
  },
1042
+ ...(appDir
1043
+ ? [
1044
+ {
1045
+ src: path_1.default.posix.join('/', entryDirectory, '/(.*).rsc$'),
1046
+ headers: {
1047
+ 'content-type': 'application/octet-stream',
1048
+ },
1049
+ continue: true,
1050
+ important: true,
1051
+ },
1052
+ ]
1053
+ : []),
1018
1054
  // TODO: remove below workaround when `/` is allowed to be output
1019
1055
  // different than `/index`
1020
1056
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
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": "45bd855250436b73bee892c53f0407e1f24bc689"
72
+ "gitHead": "40f38948a04d83a9e260ddd455685d74e3eb9209"
73
73
  }