@vercel/config 0.0.38 → 0.0.40

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 CHANGED
@@ -476,7 +476,7 @@ export declare class Router {
476
476
  * })
477
477
  * @internal Can return Route with transforms internally
478
478
  */
479
- rewrite<T extends string>(source: T, destination: string): Rewrite | Route;
479
+ rewrite<T extends string>(source: T, destination: string): Rewrite;
480
480
  rewrite<T extends string>(source: T, destination: string, callback: (params: PathParams<T>) => {
481
481
  has?: Condition[];
482
482
  missing?: Condition[];
@@ -523,7 +523,7 @@ export declare class Router {
523
523
  * })
524
524
  * @internal Can return Route with transforms internally
525
525
  */
526
- redirect<T extends string>(source: T, destination: string): Redirect | Route;
526
+ redirect<T extends string>(source: T, destination: string): Redirect;
527
527
  redirect<T extends string>(source: T, destination: string, callback: (params: PathParams<T>) => {
528
528
  permanent?: boolean;
529
529
  statusCode?: number;
package/dist/router.js CHANGED
@@ -203,32 +203,15 @@ class Router {
203
203
  }
204
204
  return route;
205
205
  }
206
- // Simple rewrite without transforms - check if destination has env vars
206
+ // Simple rewrite without transforms
207
207
  const pathParams = this.extractPathParams(source);
208
208
  const destEnvVars = extractEnvVars(destination, pathParams);
209
- if (destEnvVars.length > 0) {
210
- // Need Route format to include env field
211
- // Convert path-to-regexp patterns to regex for routes format
212
- const { src: regexSrc, segments } = (0, routing_utils_1.sourceToRegex)(source);
213
- const convertedDest = convertDestination(destination, segments);
214
- const route = {
215
- src: regexSrc,
216
- dest: convertedDest,
217
- env: destEnvVars,
218
- };
219
- if (has)
220
- route.has = has;
221
- if (missing)
222
- route.missing = missing;
223
- if (respectOriginCacheControl !== undefined)
224
- route.respectOriginCacheControl = respectOriginCacheControl;
225
- return route;
226
- }
227
- // Simple rewrite without transforms or env vars
228
209
  const rewrite = {
229
210
  source,
230
211
  destination,
231
212
  };
213
+ if (destEnvVars.length > 0)
214
+ rewrite.env = destEnvVars;
232
215
  if (has)
233
216
  rewrite.has = has;
234
217
  if (missing)
@@ -290,31 +273,15 @@ class Router {
290
273
  }
291
274
  return route;
292
275
  }
293
- // Simple redirect without transforms - check if destination has env vars
276
+ // Simple redirect without transforms
294
277
  const pathParams = this.extractPathParams(source);
295
278
  const destEnvVars = extractEnvVars(destination, pathParams);
296
- if (destEnvVars.length > 0) {
297
- // Need Route format to include env field
298
- // Convert path-to-regexp patterns to regex for routes format
299
- const { src: regexSrc, segments } = (0, routing_utils_1.sourceToRegex)(source);
300
- const convertedDest = convertDestination(destination, segments);
301
- const route = {
302
- src: regexSrc,
303
- dest: convertedDest,
304
- status: statusCode || (permanent ? 308 : 307),
305
- env: destEnvVars,
306
- };
307
- if (has)
308
- route.has = has;
309
- if (missing)
310
- route.missing = missing;
311
- return route;
312
- }
313
- // Simple redirect without transforms or env vars
314
279
  const redirect = {
315
280
  source,
316
281
  destination,
317
282
  };
283
+ if (destEnvVars.length > 0)
284
+ redirect.env = destEnvVars;
318
285
  if (permanent !== undefined)
319
286
  redirect.permanent = permanent;
320
287
  if (statusCode !== undefined)
package/dist/types.d.ts CHANGED
@@ -18,9 +18,9 @@ export interface FunctionConfig {
18
18
  */
19
19
  includeFiles?: string;
20
20
  /**
21
- * An integer defining how long your Serverless Function should be allowed to run on every request in seconds (between 1 and the maximum limit of your plan).
21
+ * An integer defining how long your Serverless Function should be allowed to run on every request in seconds (between 1 and the maximum limit of your plan), or the string `'max'` to use the maximum duration allowed by your plan.
22
22
  */
23
- maxDuration?: number;
23
+ maxDuration?: number | 'max';
24
24
  /**
25
25
  * An integer defining the memory your Serverless Function should be provided with (between 128 and 10240).
26
26
  */
@@ -487,6 +487,10 @@ export interface VercelConfig {
487
487
  * URL prefix for routing (web services only).
488
488
  */
489
489
  routePrefix?: string;
490
+ /**
491
+ * Subdomain for host-based routing (web services only).
492
+ */
493
+ subdomain?: string;
490
494
  /**
491
495
  * Framework to use.
492
496
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/config",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "description": "A TypeScript SDK for programmatically configuring Vercel projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://vercel.com/docs/projects/project-configuration",