@vercel/routing-utils 5.2.2 → 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 +40 -0
- package/dist/schemas.js +42 -2
- package/dist/superstatic.js +6 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -801,6 +801,16 @@ export declare const routesSchema: {
|
|
|
801
801
|
};
|
|
802
802
|
}];
|
|
803
803
|
};
|
|
804
|
+
readonly env: {
|
|
805
|
+
readonly description: "An array of environment variable names that should be replaced at runtime in the args value";
|
|
806
|
+
readonly type: "array";
|
|
807
|
+
readonly minItems: 1;
|
|
808
|
+
readonly maxItems: 64;
|
|
809
|
+
readonly items: {
|
|
810
|
+
readonly type: "string";
|
|
811
|
+
readonly maxLength: 256;
|
|
812
|
+
};
|
|
813
|
+
};
|
|
804
814
|
};
|
|
805
815
|
readonly allOf: readonly [{
|
|
806
816
|
readonly if: {
|
|
@@ -860,6 +870,16 @@ export declare const routesSchema: {
|
|
|
860
870
|
}];
|
|
861
871
|
};
|
|
862
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
|
+
};
|
|
863
883
|
};
|
|
864
884
|
}, {
|
|
865
885
|
readonly type: "object";
|
|
@@ -1274,6 +1294,16 @@ export declare const rewritesSchema: {
|
|
|
1274
1294
|
readonly minimum: 100;
|
|
1275
1295
|
readonly maximum: 999;
|
|
1276
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
|
+
};
|
|
1277
1307
|
};
|
|
1278
1308
|
};
|
|
1279
1309
|
};
|
|
@@ -1682,6 +1712,16 @@ export declare const redirectsSchema: {
|
|
|
1682
1712
|
}];
|
|
1683
1713
|
};
|
|
1684
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
|
+
};
|
|
1685
1725
|
};
|
|
1686
1726
|
};
|
|
1687
1727
|
};
|
package/dist/schemas.js
CHANGED
|
@@ -283,6 +283,16 @@ const transformsSchema = {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
]
|
|
286
|
+
},
|
|
287
|
+
env: {
|
|
288
|
+
description: "An array of environment variable names that should be replaced at runtime in the args value",
|
|
289
|
+
type: "array",
|
|
290
|
+
minItems: 1,
|
|
291
|
+
maxItems: 64,
|
|
292
|
+
items: {
|
|
293
|
+
type: "string",
|
|
294
|
+
maxLength: 256
|
|
295
|
+
}
|
|
286
296
|
}
|
|
287
297
|
},
|
|
288
298
|
allOf: [
|
|
@@ -464,7 +474,17 @@ const routesSchema = {
|
|
|
464
474
|
has: hasSchema,
|
|
465
475
|
missing: hasSchema,
|
|
466
476
|
mitigate: mitigateSchema,
|
|
467
|
-
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
|
+
}
|
|
468
488
|
}
|
|
469
489
|
},
|
|
470
490
|
{
|
|
@@ -508,6 +528,16 @@ const rewritesSchema = {
|
|
|
508
528
|
type: "integer",
|
|
509
529
|
minimum: 100,
|
|
510
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
|
+
}
|
|
511
541
|
}
|
|
512
542
|
}
|
|
513
543
|
}
|
|
@@ -544,7 +574,17 @@ const redirectsSchema = {
|
|
|
544
574
|
maximum: 999
|
|
545
575
|
},
|
|
546
576
|
has: hasSchema,
|
|
547
|
-
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
|
+
}
|
|
548
588
|
}
|
|
549
589
|
}
|
|
550
590
|
};
|
package/dist/superstatic.js
CHANGED
|
@@ -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
|
@@ -47,6 +47,7 @@ type Transform = {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
args?: string | string[];
|
|
50
|
+
env?: string[];
|
|
50
51
|
};
|
|
51
52
|
export type RouteWithSrc = {
|
|
52
53
|
src: string;
|
|
@@ -67,6 +68,7 @@ export type RouteWithSrc = {
|
|
|
67
68
|
action: MitigateAction;
|
|
68
69
|
};
|
|
69
70
|
transforms?: Transform[];
|
|
71
|
+
env?: string[];
|
|
70
72
|
locale?: {
|
|
71
73
|
redirect?: Record<string, string>;
|
|
72
74
|
cookie?: string;
|
|
@@ -119,6 +121,7 @@ export interface Rewrite {
|
|
|
119
121
|
has?: HasField;
|
|
120
122
|
missing?: HasField;
|
|
121
123
|
statusCode?: number;
|
|
124
|
+
env?: string[];
|
|
122
125
|
}
|
|
123
126
|
export interface Redirect {
|
|
124
127
|
source: string;
|
|
@@ -127,6 +130,7 @@ export interface Redirect {
|
|
|
127
130
|
statusCode?: number;
|
|
128
131
|
has?: HasField;
|
|
129
132
|
missing?: HasField;
|
|
133
|
+
env?: string[];
|
|
130
134
|
}
|
|
131
135
|
export interface Header {
|
|
132
136
|
source: string;
|