@vercel/routing-utils 6.0.2 → 6.1.0

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
@@ -177,7 +177,7 @@ function normalizeRoutes(inputRoutes) {
177
177
  function checkRegexSyntax(type, index, src) {
178
178
  try {
179
179
  new RegExp(src);
180
- } catch (err) {
180
+ } catch (_err) {
181
181
  const prop = type === "Route" ? "src`/`source" : "source";
182
182
  return `${type} at index ${index} has invalid \`${prop}\` regular expression "${src}".`;
183
183
  }
@@ -192,7 +192,7 @@ function checkPatternSyntax(type, index, {
192
192
  const destinationSegments = /* @__PURE__ */ new Set();
193
193
  try {
194
194
  sourceSegments = new Set((0, import_superstatic.sourceToRegex)(source).segments);
195
- } catch (err) {
195
+ } catch (_err) {
196
196
  return {
197
197
  message: `${type} at index ${index} has invalid \`source\` pattern "${source}".`,
198
198
  link: "https://vercel.link/invalid-route-source-pattern"
@@ -213,7 +213,7 @@ function checkPatternSyntax(type, index, {
213
213
  (name) => destinationSegments.add(name)
214
214
  );
215
215
  }
216
- } catch (err) {
216
+ } catch (_err) {
217
217
  }
218
218
  const hasSegments = (0, import_superstatic.collectHasSegments)(has);
219
219
  for (const segment of destinationSegments) {
package/dist/schemas.d.ts CHANGED
@@ -2171,41 +2171,3 @@ export declare const trailingSlashSchema: {
2171
2171
  readonly description: "When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.";
2172
2172
  readonly type: "boolean";
2173
2173
  };
2174
- export declare const bulkRedirectsSchema: {
2175
- readonly type: "array";
2176
- readonly description: "A list of bulk redirect definitions.";
2177
- readonly items: {
2178
- readonly type: "object";
2179
- readonly additionalProperties: false;
2180
- readonly required: readonly ["source", "destination"];
2181
- readonly properties: {
2182
- readonly source: {
2183
- readonly description: "The exact URL path or pattern to match.";
2184
- readonly type: "string";
2185
- readonly maxLength: 2048;
2186
- };
2187
- readonly destination: {
2188
- readonly description: "The target URL path where traffic should be redirected.";
2189
- readonly type: "string";
2190
- readonly maxLength: 2048;
2191
- };
2192
- readonly permanent: {
2193
- readonly description: "A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.";
2194
- readonly type: "boolean";
2195
- };
2196
- readonly statusCode: {
2197
- readonly description: "An optional integer to define the status code of the redirect.";
2198
- readonly type: "integer";
2199
- readonly enum: readonly [301, 302, 307, 308];
2200
- };
2201
- readonly sensitive: {
2202
- readonly description: "A boolean to toggle between case-sensitive and case-insensitive redirect. When `true`, the redirect is case-sensitive. When `false` the redirect is case-insensitive.";
2203
- readonly type: "boolean";
2204
- };
2205
- readonly query: {
2206
- readonly description: "Whether the query string should be preserved by the redirect. The default is `false`.";
2207
- readonly type: "boolean";
2208
- };
2209
- };
2210
- };
2211
- };
package/dist/schemas.js CHANGED
@@ -18,7 +18,6 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var schemas_exports = {};
20
20
  __export(schemas_exports, {
21
- bulkRedirectsSchema: () => bulkRedirectsSchema,
22
21
  cleanUrlsSchema: () => cleanUrlsSchema,
23
22
  hasSchema: () => hasSchema,
24
23
  headersSchema: () => headersSchema,
@@ -304,6 +303,7 @@ const transformsSchema = {
304
303
  }
305
304
  }
306
305
  },
306
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
307
307
  then: {
308
308
  required: ["args"]
309
309
  }
@@ -327,6 +327,7 @@ const transformsSchema = {
327
327
  }
328
328
  ]
329
329
  },
330
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
330
331
  then: {
331
332
  properties: {
332
333
  target: {
@@ -335,6 +336,7 @@ const transformsSchema = {
335
336
  if: {
336
337
  type: "string"
337
338
  },
339
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then keyword
338
340
  then: {
339
341
  pattern: "^[a-zA-Z0-9_-]+$"
340
342
  }
@@ -658,47 +660,8 @@ const trailingSlashSchema = {
658
660
  description: "When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.",
659
661
  type: "boolean"
660
662
  };
661
- const bulkRedirectsSchema = {
662
- type: "array",
663
- description: "A list of bulk redirect definitions.",
664
- items: {
665
- type: "object",
666
- additionalProperties: false,
667
- required: ["source", "destination"],
668
- properties: {
669
- source: {
670
- description: "The exact URL path or pattern to match.",
671
- type: "string",
672
- maxLength: 2048
673
- },
674
- destination: {
675
- description: "The target URL path where traffic should be redirected.",
676
- type: "string",
677
- maxLength: 2048
678
- },
679
- permanent: {
680
- description: "A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",
681
- type: "boolean"
682
- },
683
- statusCode: {
684
- description: "An optional integer to define the status code of the redirect.",
685
- type: "integer",
686
- enum: [301, 302, 307, 308]
687
- },
688
- sensitive: {
689
- description: "A boolean to toggle between case-sensitive and case-insensitive redirect. When `true`, the redirect is case-sensitive. When `false` the redirect is case-insensitive.",
690
- type: "boolean"
691
- },
692
- query: {
693
- description: "Whether the query string should be preserved by the redirect. The default is `false`.",
694
- type: "boolean"
695
- }
696
- }
697
- }
698
- };
699
663
  // Annotate the CommonJS export names for ESM import in node:
700
664
  0 && (module.exports = {
701
- bulkRedirectsSchema,
702
665
  cleanUrlsSchema,
703
666
  hasSchema,
704
667
  headersSchema,
@@ -133,7 +133,7 @@ function convertRedirects(redirects, defaultStatus = 308) {
133
133
  route.missing = r.missing;
134
134
  }
135
135
  return route;
136
- } catch (e) {
136
+ } catch (_e) {
137
137
  throw new Error(`Failed to parse redirect: ${JSON.stringify(r)}`);
138
138
  }
139
139
  });
@@ -166,7 +166,7 @@ function convertRewrites(rewrites, internalParamNames) {
166
166
  route.status = r.statusCode;
167
167
  }
168
168
  return route;
169
- } catch (e) {
169
+ } catch (_e) {
170
170
  throw new Error(`Failed to parse rewrite: ${JSON.stringify(r)}`);
171
171
  }
172
172
  });
@@ -377,7 +377,7 @@ function safelyCompile(value, indexes, attemptDirectCompile) {
377
377
  if (attemptDirectCompile) {
378
378
  try {
379
379
  return (0, import_path_to_regexp.compile)(value, { validate: false })(indexes);
380
- } catch (e) {
380
+ } catch (_e) {
381
381
  }
382
382
  }
383
383
  for (const key of Object.keys(indexes)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/routing-utils",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "Vercel routing utilities",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",