@vercel/config 0.0.24 → 0.0.25
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/router.d.ts +12 -0
- package/dist/router.js +7 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/router.d.ts
CHANGED
|
@@ -280,6 +280,11 @@ export interface Route {
|
|
|
280
280
|
headers?: Record<string, string>;
|
|
281
281
|
/** Environment variables referenced in dest or transforms */
|
|
282
282
|
env?: string[];
|
|
283
|
+
/**
|
|
284
|
+
* When true (default), external rewrites will respect the Cache-Control header from the origin.
|
|
285
|
+
* When false, caching is disabled for this rewrite.
|
|
286
|
+
*/
|
|
287
|
+
respectOriginCacheControl?: boolean;
|
|
283
288
|
}
|
|
284
289
|
/**
|
|
285
290
|
* Represents a single HTTP header key/value pair.
|
|
@@ -447,6 +452,11 @@ export interface RewriteRule {
|
|
|
447
452
|
missing?: Condition[];
|
|
448
453
|
/** Internal field: transforms generated from requestHeaders/responseHeaders/requestQuery */
|
|
449
454
|
transforms?: Transform[];
|
|
455
|
+
/**
|
|
456
|
+
* When true (default), external rewrites will respect the Cache-Control header from the origin.
|
|
457
|
+
* When false, caching is disabled for this rewrite.
|
|
458
|
+
*/
|
|
459
|
+
respectOriginCacheControl?: boolean;
|
|
450
460
|
}
|
|
451
461
|
/**
|
|
452
462
|
* CronRule defines a scheduled function invocation on Vercel.
|
|
@@ -540,6 +550,7 @@ export declare class Router {
|
|
|
540
550
|
requestHeaders?: Record<string, string | string[]>;
|
|
541
551
|
responseHeaders?: Record<string, string | string[]>;
|
|
542
552
|
requestQuery?: Record<string, string | string[]>;
|
|
553
|
+
respectOriginCacheControl?: boolean;
|
|
543
554
|
}): Rewrite | Route;
|
|
544
555
|
rewrite<T extends string>(source: T, destination: string, options: {
|
|
545
556
|
has?: Condition[];
|
|
@@ -547,6 +558,7 @@ export declare class Router {
|
|
|
547
558
|
requestHeaders?: Record<string, string | string[]>;
|
|
548
559
|
responseHeaders?: Record<string, string | string[]>;
|
|
549
560
|
requestQuery?: Record<string, string | string[]>;
|
|
561
|
+
respectOriginCacheControl?: boolean;
|
|
550
562
|
} & Record<never, never>): Rewrite | Route;
|
|
551
563
|
/**
|
|
552
564
|
* Creates a redirect rule. Returns either a Redirect object (simple case) or Route with transforms.
|
package/dist/router.js
CHANGED
|
@@ -86,7 +86,7 @@ class Router {
|
|
|
86
86
|
else {
|
|
87
87
|
options = optionsOrCallback;
|
|
88
88
|
}
|
|
89
|
-
const { has, missing, requestHeaders, responseHeaders, requestQuery } = options || {};
|
|
89
|
+
const { has, missing, requestHeaders, responseHeaders, requestQuery, respectOriginCacheControl, } = options || {};
|
|
90
90
|
// Check if any transforms were provided
|
|
91
91
|
const hasTransforms = requestHeaders || responseHeaders || requestQuery;
|
|
92
92
|
if (hasTransforms) {
|
|
@@ -147,6 +147,8 @@ class Router {
|
|
|
147
147
|
route.has = has;
|
|
148
148
|
if (missing)
|
|
149
149
|
route.missing = missing;
|
|
150
|
+
if (respectOriginCacheControl !== undefined)
|
|
151
|
+
route.respectOriginCacheControl = respectOriginCacheControl;
|
|
150
152
|
// Extract env vars from destination
|
|
151
153
|
const destEnvVars = extractEnvVars(destination, pathParams);
|
|
152
154
|
if (destEnvVars.length > 0) {
|
|
@@ -168,6 +170,8 @@ class Router {
|
|
|
168
170
|
route.has = has;
|
|
169
171
|
if (missing)
|
|
170
172
|
route.missing = missing;
|
|
173
|
+
if (respectOriginCacheControl !== undefined)
|
|
174
|
+
route.respectOriginCacheControl = respectOriginCacheControl;
|
|
171
175
|
return route;
|
|
172
176
|
}
|
|
173
177
|
// Simple rewrite without transforms or env vars
|
|
@@ -179,6 +183,8 @@ class Router {
|
|
|
179
183
|
rewrite.has = has;
|
|
180
184
|
if (missing)
|
|
181
185
|
rewrite.missing = missing;
|
|
186
|
+
if (respectOriginCacheControl !== undefined)
|
|
187
|
+
rewrite.respectOriginCacheControl = respectOriginCacheControl;
|
|
182
188
|
return rewrite;
|
|
183
189
|
}
|
|
184
190
|
redirect(source, destination, optionsOrCallback) {
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED