@vercel/routing-utils 5.1.1 → 5.2.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/schemas.d.ts CHANGED
@@ -2104,3 +2104,41 @@ export declare const trailingSlashSchema: {
2104
2104
  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.";
2105
2105
  readonly type: "boolean";
2106
2106
  };
2107
+ export declare const bulkRedirectsSchema: {
2108
+ readonly type: "array";
2109
+ readonly description: "A list of bulk redirect definitions.";
2110
+ readonly items: {
2111
+ readonly type: "object";
2112
+ readonly additionalProperties: false;
2113
+ readonly required: readonly ["source", "destination"];
2114
+ readonly properties: {
2115
+ readonly source: {
2116
+ readonly description: "The exact URL path or pattern to match.";
2117
+ readonly type: "string";
2118
+ readonly maxLength: 2048;
2119
+ };
2120
+ readonly destination: {
2121
+ readonly description: "The target URL path where traffic should be redirected.";
2122
+ readonly type: "string";
2123
+ readonly maxLength: 2048;
2124
+ };
2125
+ readonly permanent: {
2126
+ 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`.";
2127
+ readonly type: "boolean";
2128
+ };
2129
+ readonly statusCode: {
2130
+ readonly description: "An optional integer to define the status code of the redirect.";
2131
+ readonly type: "integer";
2132
+ readonly enum: readonly [301, 302, 307, 308];
2133
+ };
2134
+ readonly sensitive: {
2135
+ 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.";
2136
+ readonly type: "boolean";
2137
+ };
2138
+ readonly query: {
2139
+ readonly description: "Whether the query string should be preserved by the redirect. The default is `false`.";
2140
+ readonly type: "boolean";
2141
+ };
2142
+ };
2143
+ };
2144
+ };
package/dist/schemas.js CHANGED
@@ -18,6 +18,7 @@ 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,
21
22
  cleanUrlsSchema: () => cleanUrlsSchema,
22
23
  hasSchema: () => hasSchema,
23
24
  headersSchema: () => headersSchema,
@@ -594,8 +595,47 @@ const trailingSlashSchema = {
594
595
  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.",
595
596
  type: "boolean"
596
597
  };
598
+ const bulkRedirectsSchema = {
599
+ type: "array",
600
+ description: "A list of bulk redirect definitions.",
601
+ items: {
602
+ type: "object",
603
+ additionalProperties: false,
604
+ required: ["source", "destination"],
605
+ properties: {
606
+ source: {
607
+ description: "The exact URL path or pattern to match.",
608
+ type: "string",
609
+ maxLength: 2048
610
+ },
611
+ destination: {
612
+ description: "The target URL path where traffic should be redirected.",
613
+ type: "string",
614
+ maxLength: 2048
615
+ },
616
+ permanent: {
617
+ description: "A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",
618
+ type: "boolean"
619
+ },
620
+ statusCode: {
621
+ description: "An optional integer to define the status code of the redirect.",
622
+ type: "integer",
623
+ enum: [301, 302, 307, 308]
624
+ },
625
+ sensitive: {
626
+ 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.",
627
+ type: "boolean"
628
+ },
629
+ query: {
630
+ description: "Whether the query string should be preserved by the redirect. The default is `false`.",
631
+ type: "boolean"
632
+ }
633
+ }
634
+ }
635
+ };
597
636
  // Annotate the CommonJS export names for ESM import in node:
598
637
  0 && (module.exports = {
638
+ bulkRedirectsSchema,
599
639
  cleanUrlsSchema,
600
640
  hasSchema,
601
641
  headersSchema,
@@ -245,7 +245,7 @@ function sourceToRegex(source) {
245
245
  });
246
246
  return { src: r.source, segments };
247
247
  }
248
- const namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9]*)>/g;
248
+ const namedGroupsRegex = /\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g;
249
249
  const normalizeHasKeys = (hasItems = []) => {
250
250
  for (const hasItem of hasItems) {
251
251
  if ("key" in hasItem && hasItem.type === "header") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/routing-utils",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "description": "Vercel routing utilities",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",