@vercel/gatsby-plugin-vercel-builder 2.2.56 → 2.2.58

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -22
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1410,6 +1410,24 @@ var require_merge = __commonJS({
1410
1410
  }
1411
1411
  return builderRoutes;
1412
1412
  }
1413
+ function addToHandleMap(path2, routesMapping, handleMap) {
1414
+ const br = routesMapping[path2];
1415
+ Object.keys(br).sort().forEach((use) => {
1416
+ let prevHandle = null;
1417
+ br[use].forEach((route) => {
1418
+ if ((0, import_index.isHandler)(route)) {
1419
+ prevHandle = route.handle;
1420
+ } else {
1421
+ const routes = handleMap.get(prevHandle);
1422
+ if (!routes) {
1423
+ handleMap.set(prevHandle, [route]);
1424
+ } else {
1425
+ routes.push(route);
1426
+ }
1427
+ }
1428
+ });
1429
+ });
1430
+ }
1413
1431
  function getCheckAndContinue(routes) {
1414
1432
  const checks = [];
1415
1433
  const continues = [];
@@ -1446,43 +1464,36 @@ var require_merge = __commonJS({
1446
1464
  }
1447
1465
  }
1448
1466
  });
1467
+ const projectHandleMap = /* @__PURE__ */ new Map();
1468
+ const projectMiddlewareRoutes = getBuilderRoutesMapping(
1469
+ builds.filter((b) => b.projectMiddleware)
1470
+ );
1471
+ Object.keys(projectMiddlewareRoutes).sort().forEach(
1472
+ (path2) => addToHandleMap(path2, projectMiddlewareRoutes, projectHandleMap)
1473
+ );
1449
1474
  const builderHandleMap = /* @__PURE__ */ new Map();
1450
- const builderRoutes = getBuilderRoutesMapping(builds);
1451
- const sortedPaths = Object.keys(builderRoutes).sort();
1452
- sortedPaths.forEach((path2) => {
1453
- const br = builderRoutes[path2];
1454
- const sortedBuilders = Object.keys(br).sort();
1455
- sortedBuilders.forEach((use) => {
1456
- let builderPrevHandle = null;
1457
- br[use].forEach((route) => {
1458
- if ((0, import_index.isHandler)(route)) {
1459
- builderPrevHandle = route.handle;
1460
- } else {
1461
- const routes = builderHandleMap.get(builderPrevHandle);
1462
- if (!routes) {
1463
- builderHandleMap.set(builderPrevHandle, [route]);
1464
- } else {
1465
- routes.push(route);
1466
- }
1467
- }
1468
- });
1469
- });
1470
- });
1475
+ const builderRoutes = getBuilderRoutesMapping(
1476
+ builds.filter((b) => !b.projectMiddleware)
1477
+ );
1478
+ Object.keys(builderRoutes).sort().forEach((path2) => addToHandleMap(path2, builderRoutes, builderHandleMap));
1471
1479
  const outputRoutes = [];
1472
1480
  const uniqueHandleValues = /* @__PURE__ */ new Set([
1473
1481
  null,
1474
1482
  ...userHandleMap.keys(),
1483
+ ...projectHandleMap.keys(),
1475
1484
  ...builderHandleMap.keys()
1476
1485
  ]);
1477
1486
  for (const handle of uniqueHandleValues) {
1478
1487
  const userRoutes2 = userHandleMap.get(handle) || [];
1488
+ const projectRoutes = projectHandleMap.get(handle) || [];
1479
1489
  const builderRoutes2 = builderHandleMap.get(handle) || [];
1480
1490
  const builderSorted = getCheckAndContinue(builderRoutes2);
1481
- if (handle !== null && (userRoutes2.length > 0 || builderRoutes2.length > 0)) {
1491
+ if (handle !== null && (userRoutes2.length > 0 || projectRoutes.length > 0 || builderRoutes2.length > 0)) {
1482
1492
  outputRoutes.push({ handle });
1483
1493
  }
1484
1494
  outputRoutes.push(...builderSorted.continues);
1485
1495
  outputRoutes.push(...userRoutes2);
1496
+ outputRoutes.push(...projectRoutes);
1486
1497
  outputRoutes.push(...builderSorted.checks);
1487
1498
  outputRoutes.push(...builderSorted.others);
1488
1499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/gatsby-plugin-vercel-builder",
3
- "version": "2.2.56",
3
+ "version": "2.2.58",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -17,7 +17,7 @@
17
17
  "esbuild": "0.27.0",
18
18
  "etag": "1.8.1",
19
19
  "fs-extra": "11.1.0",
20
- "@vercel/build-utils": "14.10.0"
20
+ "@vercel/build-utils": "14.10.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/etag": "1.8.0",
@@ -26,7 +26,7 @@
26
26
  "@types/react": "18.0.26",
27
27
  "vite": "6.4.3",
28
28
  "vitest": "4.1.10",
29
- "@vercel/routing-utils": "6.5.0"
29
+ "@vercel/routing-utils": "6.6.0"
30
30
  },
31
31
  "license": "Apache-2.0",
32
32
  "scripts": {