@vercel/routing-utils 5.3.0 → 5.3.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.
package/dist/schemas.d.ts CHANGED
@@ -870,6 +870,20 @@ 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
+ };
883
+ readonly respectOriginCacheControl: {
884
+ readonly description: "When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.";
885
+ readonly type: "boolean";
886
+ };
873
887
  };
874
888
  }, {
875
889
  readonly type: "object";
@@ -1284,6 +1298,20 @@ export declare const rewritesSchema: {
1284
1298
  readonly minimum: 100;
1285
1299
  readonly maximum: 999;
1286
1300
  };
1301
+ readonly env: {
1302
+ readonly description: "An array of environment variable names that should be replaced at runtime in the destination";
1303
+ readonly type: "array";
1304
+ readonly minItems: 1;
1305
+ readonly maxItems: 64;
1306
+ readonly items: {
1307
+ readonly type: "string";
1308
+ readonly maxLength: 256;
1309
+ };
1310
+ };
1311
+ readonly respectOriginCacheControl: {
1312
+ readonly description: "When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.";
1313
+ readonly type: "boolean";
1314
+ };
1287
1315
  };
1288
1316
  };
1289
1317
  };
@@ -1692,6 +1720,16 @@ export declare const redirectsSchema: {
1692
1720
  }];
1693
1721
  };
1694
1722
  };
1723
+ readonly env: {
1724
+ readonly description: "An array of environment variable names that should be replaced at runtime in the destination";
1725
+ readonly type: "array";
1726
+ readonly minItems: 1;
1727
+ readonly maxItems: 64;
1728
+ readonly items: {
1729
+ readonly type: "string";
1730
+ readonly maxLength: 256;
1731
+ };
1732
+ };
1695
1733
  };
1696
1734
  };
1697
1735
  };
package/dist/schemas.js CHANGED
@@ -474,7 +474,21 @@ 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
+ },
488
+ respectOriginCacheControl: {
489
+ description: "When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",
490
+ type: "boolean"
491
+ }
478
492
  }
479
493
  },
480
494
  {
@@ -518,6 +532,20 @@ const rewritesSchema = {
518
532
  type: "integer",
519
533
  minimum: 100,
520
534
  maximum: 999
535
+ },
536
+ env: {
537
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
538
+ type: "array",
539
+ minItems: 1,
540
+ maxItems: 64,
541
+ items: {
542
+ type: "string",
543
+ maxLength: 256
544
+ }
545
+ },
546
+ respectOriginCacheControl: {
547
+ description: "When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",
548
+ type: "boolean"
521
549
  }
522
550
  }
523
551
  }
@@ -554,7 +582,17 @@ const redirectsSchema = {
554
582
  maximum: 999
555
583
  },
556
584
  has: hasSchema,
557
- missing: hasSchema
585
+ missing: hasSchema,
586
+ env: {
587
+ description: "An array of environment variable names that should be replaced at runtime in the destination",
588
+ type: "array",
589
+ minItems: 1,
590
+ maxItems: 64,
591
+ items: {
592
+ type: "string",
593
+ maxLength: 256
594
+ }
595
+ }
558
596
  }
559
597
  }
560
598
  };
@@ -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;
@@ -85,6 +86,7 @@ export type RouteWithSrc = {
85
86
  * A middleware index in the `middleware` key under the build result
86
87
  */
87
88
  middleware?: number;
89
+ respectOriginCacheControl?: boolean;
88
90
  };
89
91
  export type RouteWithHandle = {
90
92
  handle: HandleValue;
@@ -120,6 +122,8 @@ export interface Rewrite {
120
122
  has?: HasField;
121
123
  missing?: HasField;
122
124
  statusCode?: number;
125
+ env?: string[];
126
+ respectOriginCacheControl?: boolean;
123
127
  }
124
128
  export interface Redirect {
125
129
  source: string;
@@ -128,6 +132,7 @@ export interface Redirect {
128
132
  statusCode?: number;
129
133
  has?: HasField;
130
134
  missing?: HasField;
135
+ env?: string[];
131
136
  }
132
137
  export interface Header {
133
138
  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.2",
4
4
  "description": "Vercel routing utilities",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",