@vercel/next 3.6.3 → 3.6.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
@@ -42420,6 +42420,13 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
42420
42420
  const projectDir = requiredServerFilesManifest.relativeAppDir
42421
42421
  ? path_1.default.join(baseDir, requiredServerFilesManifest.relativeAppDir)
42422
42422
  : requiredServerFilesManifest.appDir || entryPath;
42423
+ // allow looking up original route from normalized route
42424
+ const inversedAppPathManifest = {};
42425
+ if (appPathRoutesManifest) {
42426
+ for (const ogRoute of Object.keys(appPathRoutesManifest)) {
42427
+ inversedAppPathManifest[appPathRoutesManifest[ogRoute]] = ogRoute;
42428
+ }
42429
+ }
42423
42430
  let appBuildTraces = {};
42424
42431
  let appDir = null;
42425
42432
  if (appPathRoutesManifest) {
@@ -42438,7 +42445,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
42438
42445
  });
42439
42446
  }
42440
42447
  const pageMatchesApi = (page) => {
42441
- return (!appPathRoutesManifest?.[page] &&
42448
+ const normalizedPage = `/${page.replace(/\.js$/, '')}`;
42449
+ return (!inversedAppPathManifest[normalizedPage] &&
42442
42450
  (page.startsWith('api/') || page === 'api.js'));
42443
42451
  };
42444
42452
  const { i18n } = routesManifest;
@@ -43068,13 +43076,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
43068
43076
  // to match prerenders so we can route the same when the
43069
43077
  // __rsc__ header is present
43070
43078
  const edgeFunctions = middleware.edgeFunctions;
43071
- // allow looking up original route from normalized route
43072
- const inverseAppPathManifest = {};
43073
- for (const ogRoute of Object.keys(appPathRoutesManifest)) {
43074
- inverseAppPathManifest[appPathRoutesManifest[ogRoute]] = ogRoute;
43075
- }
43076
43079
  for (let route of Object.values(appPathRoutesManifest)) {
43077
- const ogRoute = inverseAppPathManifest[route];
43080
+ const ogRoute = inversedAppPathManifest[route];
43078
43081
  if (ogRoute.endsWith('/route')) {
43079
43082
  continue;
43080
43083
  }
@@ -43370,7 +43373,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
43370
43373
  {
43371
43374
  src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
43372
43375
  .map(locale => (0, escape_string_regexp_1.default)(locale))
43373
- .join('|')})/?(.*)`,
43376
+ .join('|')})/(.*)`,
43374
43377
  dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
43375
43378
  check: true,
43376
43379
  },
@@ -45290,6 +45293,9 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
45290
45293
  ],
45291
45294
  };
45292
45295
  route.middlewarePath = shortPath;
45296
+ route.middlewareRawSrc = matcher.originalSource
45297
+ ? [matcher.originalSource]
45298
+ : [];
45293
45299
  if (isCorrectMiddlewareOrder) {
45294
45300
  route.override = true;
45295
45301
  }
@@ -45382,6 +45388,7 @@ function getRouteMatchers(info, { basePath = '', i18n }) {
45382
45388
  return info.matchers.map(matcher => {
45383
45389
  const m = {
45384
45390
  regexp: getRegexp(matcher.regexp),
45391
+ originalSource: matcher.originalSource,
45385
45392
  };
45386
45393
  if (matcher.has) {
45387
45394
  m.has = normalizeHas(matcher.has);
@@ -32,6 +32,13 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
32
32
  const projectDir = requiredServerFilesManifest.relativeAppDir
33
33
  ? path_1.default.join(baseDir, requiredServerFilesManifest.relativeAppDir)
34
34
  : requiredServerFilesManifest.appDir || entryPath;
35
+ // allow looking up original route from normalized route
36
+ const inversedAppPathManifest = {};
37
+ if (appPathRoutesManifest) {
38
+ for (const ogRoute of Object.keys(appPathRoutesManifest)) {
39
+ inversedAppPathManifest[appPathRoutesManifest[ogRoute]] = ogRoute;
40
+ }
41
+ }
35
42
  let appBuildTraces = {};
36
43
  let appDir = null;
37
44
  if (appPathRoutesManifest) {
@@ -50,7 +57,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
50
57
  });
51
58
  }
52
59
  const pageMatchesApi = (page) => {
53
- return (!appPathRoutesManifest?.[page] &&
60
+ const normalizedPage = `/${page.replace(/\.js$/, '')}`;
61
+ return (!inversedAppPathManifest[normalizedPage] &&
54
62
  (page.startsWith('api/') || page === 'api.js'));
55
63
  };
56
64
  const { i18n } = routesManifest;
@@ -680,13 +688,8 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
680
688
  // to match prerenders so we can route the same when the
681
689
  // __rsc__ header is present
682
690
  const edgeFunctions = middleware.edgeFunctions;
683
- // allow looking up original route from normalized route
684
- const inverseAppPathManifest = {};
685
- for (const ogRoute of Object.keys(appPathRoutesManifest)) {
686
- inverseAppPathManifest[appPathRoutesManifest[ogRoute]] = ogRoute;
687
- }
688
691
  for (let route of Object.values(appPathRoutesManifest)) {
689
- const ogRoute = inverseAppPathManifest[route];
692
+ const ogRoute = inversedAppPathManifest[route];
690
693
  if (ogRoute.endsWith('/route')) {
691
694
  continue;
692
695
  }
@@ -982,7 +985,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
982
985
  {
983
986
  src: `^${path_1.default.posix.join('/', entryDirectory)}/?(?:${i18n.locales
984
987
  .map(locale => (0, escape_string_regexp_1.default)(locale))
985
- .join('|')})/?(.*)`,
988
+ .join('|')})/(.*)`,
986
989
  dest: `${path_1.default.posix.join('/', entryDirectory, '/')}$1`,
987
990
  check: true,
988
991
  },
package/dist/utils.js CHANGED
@@ -1628,6 +1628,9 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
1628
1628
  ],
1629
1629
  };
1630
1630
  route.middlewarePath = shortPath;
1631
+ route.middlewareRawSrc = matcher.originalSource
1632
+ ? [matcher.originalSource]
1633
+ : [];
1631
1634
  if (isCorrectMiddlewareOrder) {
1632
1635
  route.override = true;
1633
1636
  }
@@ -1720,6 +1723,7 @@ function getRouteMatchers(info, { basePath = '', i18n }) {
1720
1723
  return info.matchers.map(matcher => {
1721
1724
  const m = {
1722
1725
  regexp: getRegexp(matcher.regexp),
1726
+ originalSource: matcher.originalSource,
1723
1727
  };
1724
1728
  if (matcher.has) {
1725
1729
  m.has = normalizeHas(matcher.has);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.6.3",
3
+ "version": "3.6.6",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -45,7 +45,7 @@
45
45
  "@types/semver": "6.0.0",
46
46
  "@types/text-table": "0.2.1",
47
47
  "@types/webpack-sources": "3.2.0",
48
- "@vercel/build-utils": "6.3.2",
48
+ "@vercel/build-utils": "6.3.4",
49
49
  "@vercel/nft": "0.22.5",
50
50
  "@vercel/routing-utils": "2.1.10",
51
51
  "async-sema": "3.0.1",
@@ -71,5 +71,5 @@
71
71
  "typescript": "4.5.2",
72
72
  "webpack-sources": "3.2.3"
73
73
  },
74
- "gitHead": "cfc1c9e818ebb55d440479cf0edf18536b772b28"
74
+ "gitHead": "21a440b83262760ccae70f5c58dc73b3718182a5"
75
75
  }