@vercel/next 3.1.24 → 3.1.25

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
@@ -47453,7 +47453,22 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
47453
47453
  };
47454
47454
  for (const worker of workerConfigs.values()) {
47455
47455
  const edgeFile = worker.edgeFunction.name;
47456
- const shortPath = edgeFile.replace(/^pages\//, '');
47456
+ let shortPath = edgeFile;
47457
+ // Replacing the folder prefix for the page
47458
+ //
47459
+ // For `pages/`, use file base name directly:
47460
+ // pages/index -> index
47461
+ // For `app/`, use folder name, handle the root page as index:
47462
+ // app/route/page -> route
47463
+ // app/page -> index
47464
+ // app/index/page -> index/index
47465
+ if (shortPath.startsWith('pages/')) {
47466
+ shortPath = shortPath.replace(/^pages\//, '');
47467
+ }
47468
+ else if (shortPath.startsWith('app/') && shortPath.endsWith('/page')) {
47469
+ shortPath =
47470
+ shortPath.replace(/^app\//, '').replace(/(^|\/)page$/, '') || 'index';
47471
+ }
47457
47472
  worker.edgeFunction.name = shortPath;
47458
47473
  source.edgeFunctions[shortPath] = worker.edgeFunction;
47459
47474
  // we don't add the route for edge functions as these
package/dist/utils.js CHANGED
@@ -1454,7 +1454,22 @@ async function getMiddlewareBundle({ entryPath, outputDirectory, routesManifest,
1454
1454
  };
1455
1455
  for (const worker of workerConfigs.values()) {
1456
1456
  const edgeFile = worker.edgeFunction.name;
1457
- const shortPath = edgeFile.replace(/^pages\//, '');
1457
+ let shortPath = edgeFile;
1458
+ // Replacing the folder prefix for the page
1459
+ //
1460
+ // For `pages/`, use file base name directly:
1461
+ // pages/index -> index
1462
+ // For `app/`, use folder name, handle the root page as index:
1463
+ // app/route/page -> route
1464
+ // app/page -> index
1465
+ // app/index/page -> index/index
1466
+ if (shortPath.startsWith('pages/')) {
1467
+ shortPath = shortPath.replace(/^pages\//, '');
1468
+ }
1469
+ else if (shortPath.startsWith('app/') && shortPath.endsWith('/page')) {
1470
+ shortPath =
1471
+ shortPath.replace(/^app\//, '').replace(/(^|\/)page$/, '') || 'index';
1472
+ }
1458
1473
  worker.edgeFunction.name = shortPath;
1459
1474
  source.edgeFunctions[shortPath] = worker.edgeFunction;
1460
1475
  // we don't add the route for edge functions as these
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.1.24",
3
+ "version": "3.1.25",
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.4.1",
47
+ "@vercel/build-utils": "5.4.2",
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": "3ff93279cd53bbfb620d27c93ca59d28917a5598"
72
+ "gitHead": "d5537500d8957985c1ffb3798659a611cc2e5d5d"
73
73
  }