@vercel/static-build 2.10.0 → 2.10.2

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 +7 -7
package/dist/index.js CHANGED
@@ -19799,14 +19799,23 @@ var require_superstatic = __commonJS({
19799
19799
  normalizeHasKeys(r.has);
19800
19800
  normalizeHasKeys(r.missing);
19801
19801
  try {
19802
- const dest = replaceSegments(
19802
+ const interpolate = (value) => replaceSegments(
19803
19803
  segments,
19804
19804
  hasSegments,
19805
- r.destination,
19805
+ value,
19806
19806
  false,
19807
19807
  internalParamNames
19808
19808
  );
19809
- const route = { src, dest, check: true };
19809
+ let route;
19810
+ if (typeof r.destination === "string") {
19811
+ route = { src, dest: interpolate(r.destination), check: true };
19812
+ } else {
19813
+ const destination = { ...r.destination };
19814
+ if (typeof destination.path === "string") {
19815
+ destination.path = interpolate(destination.path);
19816
+ }
19817
+ route = { src, destination };
19818
+ }
19810
19819
  if (typeof r.env !== "undefined") {
19811
19820
  route.env = r.env;
19812
19821
  }
@@ -20364,6 +20373,32 @@ var require_schemas = __commonJS({
20364
20373
  }
20365
20374
  }
20366
20375
  };
20376
+ var serviceNameSchema = {
20377
+ description: "A service name identifier.",
20378
+ type: "string",
20379
+ minLength: 1,
20380
+ maxLength: 64,
20381
+ pattern: "^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"
20382
+ };
20383
+ var serviceDestinationSchema = {
20384
+ description: "A service-targeted destination that delegates routing into a named service from `services`.",
20385
+ type: "object",
20386
+ additionalProperties: false,
20387
+ required: ["type", "service"],
20388
+ properties: {
20389
+ type: {
20390
+ description: "Discriminator. Must be `service`.",
20391
+ type: "string",
20392
+ enum: ["service"]
20393
+ },
20394
+ service: serviceNameSchema,
20395
+ path: {
20396
+ description: "Routing-only path used to select a route inside the target service. It does not mutate the URL observed by user code.",
20397
+ type: "string",
20398
+ maxLength: 4096
20399
+ }
20400
+ }
20401
+ };
20367
20402
  var matchableValueSchema = {
20368
20403
  description: "A value to match against. Can be a string (regex) or a condition operation object",
20369
20404
  anyOf: [
@@ -20712,8 +20747,10 @@ var require_schemas = __commonJS({
20712
20747
  maxLength: 4096
20713
20748
  },
20714
20749
  destination: {
20715
- type: "string",
20716
- maxLength: 4096
20750
+ anyOf: [
20751
+ { type: "string", maxLength: 4096 },
20752
+ serviceDestinationSchema
20753
+ ]
20717
20754
  },
20718
20755
  headers: {
20719
20756
  type: "object",
@@ -20862,9 +20899,8 @@ var require_schemas = __commonJS({
20862
20899
  maxLength: 4096
20863
20900
  },
20864
20901
  destination: {
20865
- description: "An absolute pathname to an existing resource or an external URL.",
20866
- type: "string",
20867
- maxLength: 4096
20902
+ description: "An absolute pathname to an existing resource, an external URL, or a service-targeted destination object.",
20903
+ anyOf: [{ type: "string", maxLength: 4096 }, serviceDestinationSchema]
20868
20904
  },
20869
20905
  has: hasSchema,
20870
20906
  missing: hasSchema,
@@ -21085,8 +21121,10 @@ var require_dist7 = __commonJS({
21085
21121
  `Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`
21086
21122
  );
21087
21123
  }
21088
- route.dest = route.destination;
21089
- delete route.destination;
21124
+ if (typeof route.destination === "string") {
21125
+ route.dest = route.destination;
21126
+ delete route.destination;
21127
+ }
21090
21128
  }
21091
21129
  if (route.statusCode !== void 0) {
21092
21130
  if (route.status !== void 0) {
@@ -21146,6 +21184,11 @@ var require_dist7 = __commonJS({
21146
21184
  if (regError) {
21147
21185
  errors.push(regError);
21148
21186
  }
21187
+ if (route.destination && typeof route.destination === "object" && route.continue) {
21188
+ errors.push(
21189
+ `Route at index ${i} cannot define \`continue: true\` with a service \`destination\`. The service handoff is terminal.`
21190
+ );
21191
+ }
21149
21192
  const handleValue = handling[handling.length - 1];
21150
21193
  if (handleValue === "hit") {
21151
21194
  if (route.dest) {
@@ -21212,9 +21255,10 @@ var require_dist7 = __commonJS({
21212
21255
  link: "https://vercel.link/invalid-route-source-pattern"
21213
21256
  };
21214
21257
  }
21215
- if (destination) {
21258
+ const destinationString = typeof destination === "string" ? destination : typeof destination?.path === "string" ? destination.path : void 0;
21259
+ if (destinationString !== void 0) {
21216
21260
  try {
21217
- const { hostname, pathname, query } = (0, import_url.parse)(destination, true);
21261
+ const { hostname, pathname, query } = (0, import_url.parse)(destinationString, true);
21218
21262
  (0, import_superstatic.sourceToRegex)(hostname || "").segments.forEach(
21219
21263
  (name) => destinationSegments.add(name)
21220
21264
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "ts-morph": "12.0.0",
17
- "@vercel/gatsby-plugin-vercel-analytics": "1.0.11",
18
- "@vercel/gatsby-plugin-vercel-builder": "2.2.16",
19
- "@vercel/static-config": "3.4.0"
17
+ "@vercel/gatsby-plugin-vercel-builder": "2.2.18",
18
+ "@vercel/static-config": "3.4.0",
19
+ "@vercel/gatsby-plugin-vercel-analytics": "1.0.11"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/aws-lambda": "8.10.64",
@@ -37,11 +37,11 @@
37
37
  "semver": "7.5.2",
38
38
  "tree-kill": "1.2.2",
39
39
  "vitest": "2.0.3",
40
- "@vercel/build-utils": "13.28.0",
40
+ "@vercel/build-utils": "13.29.1",
41
41
  "@vercel/frameworks": "3.28.0",
42
42
  "@vercel/error-utils": "2.2.0",
43
- "@vercel/fs-detectors": "6.8.1",
44
- "@vercel/routing-utils": "6.2.0"
43
+ "@vercel/fs-detectors": "6.8.3",
44
+ "@vercel/routing-utils": "6.3.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "node ../../utils/build-builder.mjs",