@vercel/gatsby-plugin-vercel-builder 2.2.15 → 2.2.17

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 +56 -12
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -940,14 +940,23 @@ var require_superstatic = __commonJS({
940
940
  normalizeHasKeys(r.has);
941
941
  normalizeHasKeys(r.missing);
942
942
  try {
943
- const dest = replaceSegments(
943
+ const interpolate = (value) => replaceSegments(
944
944
  segments,
945
945
  hasSegments,
946
- r.destination,
946
+ value,
947
947
  false,
948
948
  internalParamNames
949
949
  );
950
- const route = { src, dest, check: true };
950
+ let route;
951
+ if (typeof r.destination === "string") {
952
+ route = { src, dest: interpolate(r.destination), check: true };
953
+ } else {
954
+ const destination = { ...r.destination };
955
+ if (typeof destination.path === "string") {
956
+ destination.path = interpolate(destination.path);
957
+ }
958
+ route = { src, destination };
959
+ }
951
960
  if (typeof r.env !== "undefined") {
952
961
  route.env = r.env;
953
962
  }
@@ -1505,6 +1514,32 @@ var require_schemas = __commonJS({
1505
1514
  }
1506
1515
  }
1507
1516
  };
1517
+ var serviceNameSchema = {
1518
+ description: "A service name identifier.",
1519
+ type: "string",
1520
+ minLength: 1,
1521
+ maxLength: 64,
1522
+ pattern: "^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"
1523
+ };
1524
+ var serviceDestinationSchema = {
1525
+ description: "A service-targeted destination that delegates routing into a named service from `services`.",
1526
+ type: "object",
1527
+ additionalProperties: false,
1528
+ required: ["type", "service"],
1529
+ properties: {
1530
+ type: {
1531
+ description: "Discriminator. Must be `service`.",
1532
+ type: "string",
1533
+ enum: ["service"]
1534
+ },
1535
+ service: serviceNameSchema,
1536
+ path: {
1537
+ description: "Routing-only path used to select a route inside the target service. It does not mutate the URL observed by user code.",
1538
+ type: "string",
1539
+ maxLength: 4096
1540
+ }
1541
+ }
1542
+ };
1508
1543
  var matchableValueSchema = {
1509
1544
  description: "A value to match against. Can be a string (regex) or a condition operation object",
1510
1545
  anyOf: [
@@ -1853,8 +1888,10 @@ var require_schemas = __commonJS({
1853
1888
  maxLength: 4096
1854
1889
  },
1855
1890
  destination: {
1856
- type: "string",
1857
- maxLength: 4096
1891
+ anyOf: [
1892
+ { type: "string", maxLength: 4096 },
1893
+ serviceDestinationSchema
1894
+ ]
1858
1895
  },
1859
1896
  headers: {
1860
1897
  type: "object",
@@ -2003,9 +2040,8 @@ var require_schemas = __commonJS({
2003
2040
  maxLength: 4096
2004
2041
  },
2005
2042
  destination: {
2006
- description: "An absolute pathname to an existing resource or an external URL.",
2007
- type: "string",
2008
- maxLength: 4096
2043
+ description: "An absolute pathname to an existing resource, an external URL, or a service-targeted destination object.",
2044
+ anyOf: [{ type: "string", maxLength: 4096 }, serviceDestinationSchema]
2009
2045
  },
2010
2046
  has: hasSchema,
2011
2047
  missing: hasSchema,
@@ -2226,8 +2262,10 @@ var require_dist3 = __commonJS({
2226
2262
  `Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`
2227
2263
  );
2228
2264
  }
2229
- route.dest = route.destination;
2230
- delete route.destination;
2265
+ if (typeof route.destination === "string") {
2266
+ route.dest = route.destination;
2267
+ delete route.destination;
2268
+ }
2231
2269
  }
2232
2270
  if (route.statusCode !== void 0) {
2233
2271
  if (route.status !== void 0) {
@@ -2287,6 +2325,11 @@ var require_dist3 = __commonJS({
2287
2325
  if (regError) {
2288
2326
  errors.push(regError);
2289
2327
  }
2328
+ if (route.destination && typeof route.destination === "object" && route.continue) {
2329
+ errors.push(
2330
+ `Route at index ${i} cannot define \`continue: true\` with a service \`destination\`. The service handoff is terminal.`
2331
+ );
2332
+ }
2290
2333
  const handleValue = handling[handling.length - 1];
2291
2334
  if (handleValue === "hit") {
2292
2335
  if (route.dest) {
@@ -2353,9 +2396,10 @@ var require_dist3 = __commonJS({
2353
2396
  link: "https://vercel.link/invalid-route-source-pattern"
2354
2397
  };
2355
2398
  }
2356
- if (destination) {
2399
+ const destinationString = typeof destination === "string" ? destination : typeof destination?.path === "string" ? destination.path : void 0;
2400
+ if (destinationString !== void 0) {
2357
2401
  try {
2358
- const { hostname, pathname, query } = (0, import_url.parse)(destination, true);
2402
+ const { hostname, pathname, query } = (0, import_url.parse)(destinationString, true);
2359
2403
  (0, import_superstatic.sourceToRegex)(hostname || "").segments.forEach(
2360
2404
  (name) => destinationSegments.add(name)
2361
2405
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/gatsby-plugin-vercel-builder",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
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": "13.27.2"
20
+ "@vercel/build-utils": "13.29.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/etag": "1.8.0",
@@ -25,7 +25,7 @@
25
25
  "@types/node": "20.11.0",
26
26
  "@types/react": "18.0.26",
27
27
  "vitest": "2.0.3",
28
- "@vercel/routing-utils": "6.2.0"
28
+ "@vercel/routing-utils": "6.3.0"
29
29
  },
30
30
  "license": "Apache-2.0",
31
31
  "scripts": {