@vercel/next 3.2.3 → 3.2.4

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({
@@ -45798,8 +45800,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45798
45800
  dynamicRoutes
45799
45801
  .map(route => {
45800
45802
  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');
45803
+ let normalizedSrc = route.src;
45804
+ if (routesManifest.basePath) {
45805
+ normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
45806
+ }
45807
+ route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
45808
+ .replace(/\^\(\?:\/\(\?</, '(?:(?<')
45809
+ .replace(/(^\^|\$$)/g, '') + '.json$');
45810
+ const parsedDestination = new URL(route.dest || '/', 'http://n');
45811
+ let pathname = parsedDestination.pathname;
45812
+ const search = parsedDestination.search;
45803
45813
  let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
45804
45814
  if (routesManifest.i18n) {
45805
45815
  for (const locale of routesManifest.i18n?.locales || []) {
@@ -45811,7 +45821,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45811
45821
  }
45812
45822
  }
45813
45823
  if (isPrerender) {
45814
- route.dest = `/_next/data/${buildId}${pathname}.json${search || ''}`;
45824
+ if (routesManifest.basePath) {
45825
+ pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
45826
+ }
45827
+ route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
45815
45828
  }
45816
45829
  return route;
45817
45830
  })
@@ -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({
@@ -949,8 +951,16 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
949
951
  dynamicRoutes
950
952
  .map(route => {
951
953
  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');
954
+ let normalizedSrc = route.src;
955
+ if (routesManifest.basePath) {
956
+ normalizedSrc = normalizedSrc.replace(new RegExp(`\\^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '^');
957
+ }
958
+ route.src = path_1.default.posix.join('^/', entryDirectory, '_next/data/', escapedBuildId, normalizedSrc
959
+ .replace(/\^\(\?:\/\(\?</, '(?:(?<')
960
+ .replace(/(^\^|\$$)/g, '') + '.json$');
961
+ const parsedDestination = new URL(route.dest || '/', 'http://n');
962
+ let pathname = parsedDestination.pathname;
963
+ const search = parsedDestination.search;
954
964
  let isPrerender = !!prerenders[path_1.default.join('./', pathname)];
955
965
  if (routesManifest.i18n) {
956
966
  for (const locale of routesManifest.i18n?.locales || []) {
@@ -962,7 +972,10 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
962
972
  }
963
973
  }
964
974
  if (isPrerender) {
965
- route.dest = `/_next/data/${buildId}${pathname}.json${search || ''}`;
975
+ if (routesManifest.basePath) {
976
+ pathname = pathname.replace(new RegExp(`^${(0, escape_string_regexp_1.default)(routesManifest.basePath)}`), '');
977
+ }
978
+ route.dest = `${routesManifest.basePath || ''}/_next/data/${buildId}${pathname}.json${search || ''}`;
966
979
  }
967
980
  return route;
968
981
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
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": "45bd855250436b73bee892c53f0407e1f24bc689"
72
+ "gitHead": "3b5b397b355a6c1f044049e02dac5aa9f9d1621c"
73
73
  }