@vercel/routing-utils 5.3.0 → 5.3.1

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
@@ -870,6 +870,16 @@ export declare const routesSchema: {
870
870
  }];
871
871
  };
872
872
  };
873
+ readonly env: {
874
+ readonly description: "An array of environment variable names that should be replaced at runtime in the destination or headers";
875
+ readonly type: "array";
876
+ readonly minItems: 1;
877
+ readonly maxItems: 64;
878
+ readonly items: {
879
+ readonly type: "string";
880
+ readonly maxLength: 256;
881
+ };
882
+ };
873
883
  };
874
884
  }, {
875
885
  readonly type: "object";
@@ -1284,6 +1294,16 @@ export declare const rewritesSchema: {
1284
1294
  readonly minimum: 100;
1285
1295
  readonly maximum: 999;
1286
1296
  };
1297
+ readonly env: {
1298
+ readonly description: "An array of environment variable names that should be replaced at runtime in the destination";
1299
+ readonly type: "array";
1300
+ readonly minItems: 1;
1301
+ readonly maxItems: 64;
1302
+ readonly items: {
1303
+ readonly type: "string";
1304
+ readonly maxLength: 256;
1305
+ };
1306
+ };
1287
1307
  };
1288
1308
  };
1289
1309
  };
@@ -1692,6 +1712,16 @@ export declare const redirectsSchema: {
1692
1712
  }];
1693
1713
  };
1694
1714
  };
1715
+ readonly env: {
1716
+ readonly description: "An array of environment variable names that should be replaced at runtime in the destination";
1717
+ readonly type: "array";
1718
+ readonly minItems: 1;
1719
+ readonly maxItems: 64;
1720
+ readonly items: {
1721
+ readonly type: "string";
1722
+ readonly maxLength: 256;
1723
+ };
1724
+ };
1695
1725
  };
1696
1726
  };
1697
1727
  };
package/dist/schemas.js CHANGED
@@ -474,7 +474,17 @@ const routesSchema = {
474
474
  has: hasSchema,
475
475
  missing: hasSchema,
476
476
  mitigate: mitigateSchema,
477
- transforms: transformsSchema
477
+ transforms: transformsSchema,
478
+ env: {
479
+ description: "An array of environment variable names that should be replaced at runtime in the destination or headers",
480
+ type: "array",
481
+ minItems: 1,
482
+ maxItems: 64,
483
+ items: {
484
+ type: "string",
485
+ maxLength: 256
486
+ }
487
+ }
478
488
  }
479
489
  },
480
490
  {
@@ -518,6 +528,16 @@ const rewritesSchema = {
518
528
  type: "integer",
519
529
  minimum: 100,
520
530
  maximum: 999
531
+ },
532
+ env: {
533
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
534
+ type: "array",
535
+ minItems: 1,
536
+ maxItems: 64,
537
+ items: {
538
+ type: "string",
539
+ maxLength: 256
540
+ }
521
541
  }
522
542
  }
523
543
  }
@@ -554,7 +574,17 @@ const redirectsSchema = {
554
574
  maximum: 999
555
575
  },
556
576
  has: hasSchema,
557
- missing: hasSchema
577
+ missing: hasSchema,
578
+ env: {
579
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
580
+ type: "array",
581
+ minItems: 1,
582
+ maxItems: 64,
583
+ items: {
584
+ type: "string",
585
+ maxLength: 256
586
+ }
587
+ }
558
588
  }
559
589
  }
560
590
  };
@@ -123,6 +123,9 @@ function convertRedirects(redirects, defaultStatus = 308) {
123
123
  headers: { Location: loc },
124
124
  status
125
125
  };
126
+ if (typeof r.env !== "undefined") {
127
+ route.env = r.env;
128
+ }
126
129
  if (r.has) {
127
130
  route.has = r.has;
128
131
  }
@@ -150,6 +153,9 @@ function convertRewrites(rewrites, internalParamNames) {
150
153
  internalParamNames
151
154
  );
152
155
  const route = { src, dest, check: true };
156
+ if (typeof r.env !== "undefined") {
157
+ route.env = r.env;
158
+ }
153
159
  if (r.has) {
154
160
  route.has = r.has;
155
161
  }
package/dist/types.d.ts CHANGED
@@ -68,6 +68,7 @@ export type RouteWithSrc = {
68
68
  action: MitigateAction;
69
69
  };
70
70
  transforms?: Transform[];
71
+ env?: string[];
71
72
  locale?: {
72
73
  redirect?: Record<string, string>;
73
74
  cookie?: string;
@@ -120,6 +121,7 @@ export interface Rewrite {
120
121
  has?: HasField;
121
122
  missing?: HasField;
122
123
  statusCode?: number;
124
+ env?: string[];
123
125
  }
124
126
  export interface Redirect {
125
127
  source: string;
@@ -128,6 +130,7 @@ export interface Redirect {
128
130
  statusCode?: number;
129
131
  has?: HasField;
130
132
  missing?: HasField;
133
+ env?: string[];
131
134
  }
132
135
  export interface Header {
133
136
  source: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/routing-utils",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "description": "Vercel routing utilities",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",