🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More
Socket
Book a DemoSign in
Socket

@vercel/config

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/config - npm Package Compare versions

Comparing version
0.0.37
to
0.0.38
+5
-82
dist/router.d.ts

@@ -1,2 +0,2 @@

import type { Redirect, Rewrite } from './types';
import type { Condition, MatchableValueObject, Redirect, Rewrite } from './types';
/**

@@ -99,84 +99,7 @@ * Type utility to extract path parameter names from a route pattern string.

}
/**
* Condition type for matching in redirects, headers, and rewrites.
* - 'header': Match if a specific HTTP header key/value is present (or missing).
* - 'cookie': Match if a specific cookie is present (or missing).
* - 'host': Match if the incoming host matches a given pattern.
* - 'query': Match if a query parameter is present (or missing).
* - 'path': Match if the path matches a given pattern.
*/
export type ConditionType = 'header' | 'cookie' | 'host' | 'query' | 'path';
/**
* Conditional matching operators for has/missing conditions.
* These can be used with the value field to perform advanced matching.
*/
export interface ConditionOperators {
/** Check equality on a value (exact match) */
eq?: string | number;
/** Check inequality on a value (not equal) */
neq?: string;
/** Check inclusion in an array of values (value is one of) */
inc?: string[];
/** Check non-inclusion in an array of values (value is not one of) */
ninc?: string[];
/** Check if value starts with a prefix */
pre?: string;
/** Check if value ends with a suffix */
suf?: string;
/** Check if value is greater than (numeric comparison) */
gt?: number;
/** Check if value is greater than or equal to */
gte?: number;
/** Check if value is less than (numeric comparison) */
lt?: number;
/** Check if value is less than or equal to */
lte?: number;
}
/**
* Used to define "has" or "missing" conditions with advanced matching operators.
*
* @example
* // Simple header presence check
* { type: 'header', key: 'x-api-key' }
*
* @example
* // Header with exact value match
* { type: 'header', key: 'x-api-version', value: 'v2' }
*
* @example
* // Header with conditional operators
* { type: 'header', key: 'x-user-role', inc: ['admin', 'moderator'] }
*
* @example
* // Cookie with prefix matching
* { type: 'cookie', key: 'session', pre: 'prod-' }
*
* @example
* // Host matching
* { type: 'host', value: 'api.example.com' }
*
* @example
* // Query parameter with numeric comparison
* { type: 'query', key: 'version', gte: 2 }
*
* @example
* // Path pattern matching
* { type: 'path', value: '^/api/v[0-9]+/.*' }
*/
export interface Condition extends ConditionOperators {
type: ConditionType;
/** The key to match. Not used for 'host' or 'path' types. */
key?: string;
/**
* Simple string/regex pattern to match against.
* For 'host' and 'path' types, this is the only matching option.
* For other types, you can use value OR the conditional operators (eq, neq, etc).
*/
value?: string;
}
export declare const matchers: {
header: (key: string, value?: string | ConditionOperators) => Condition;
cookie: (key: string, value?: string | ConditionOperators) => Condition;
query: (key: string, value?: string | ConditionOperators) => Condition;
host: (value: string | ConditionOperators) => Condition;
header: (key: string, value?: string | MatchableValueObject) => Condition;
cookie: (key: string, value?: string | MatchableValueObject) => Condition;
query: (key: string, value?: string | MatchableValueObject) => Condition;
host: (value: string | MatchableValueObject) => Condition;
};

@@ -183,0 +106,0 @@ /**

+2
-2

@@ -51,3 +51,3 @@ "use strict";

}
return { type, key, ...value };
return { type, key, value };
};

@@ -60,3 +60,3 @@ }

}
return { type, ...value };
return { type, value };
};

@@ -63,0 +63,0 @@ }

/**
* Vercel configuration type that mirrors the vercel.json schema
* https://openapi.vercel.sh/vercel.json
* AUTO-GENERATED — DO NOT EDIT
*
* This file is generated from the vercel.json OpenAPI schema.
* To modify, update scripts/generate-types.ts and re-run:
* pnpm generate-types
*
* Schema: https://openapi.vercel.sh/vercel.json
*/
export type Framework = 'blitzjs' | 'nextjs' | 'gatsby' | 'remix' | 'react-router' | 'astro' | 'hexo' | 'eleventy' | 'docusaurus-2' | 'docusaurus' | 'preact' | 'solidstart-1' | 'solidstart' | 'dojo' | 'ember' | 'vue' | 'scully' | 'ionic-angular' | 'angular' | 'polymer' | 'svelte' | 'sveltekit' | 'sveltekit-1' | 'ionic-react' | 'create-react-app' | 'gridsome' | 'umijs' | 'sapper' | 'saber' | 'stencil' | 'nuxtjs' | 'redwoodjs' | 'hugo' | 'jekyll' | 'brunch' | 'middleman' | 'zola' | 'hydrogen' | 'vite' | 'tanstack-start' | 'vitepress' | 'vuepress' | 'parcel' | 'fastapi' | 'flask' | 'fasthtml' | 'sanity-v3' | 'sanity' | 'storybook' | 'nitro' | 'hono' | 'express' | 'h3' | 'nestjs' | 'elysia' | 'fastify' | 'xmcp' | null;
export type Framework = 'blitzjs' | 'nextjs' | 'gatsby' | 'remix' | 'react-router' | 'astro' | 'hexo' | 'eleventy' | 'docusaurus-2' | 'docusaurus' | 'preact' | 'solidstart-1' | 'solidstart' | 'dojo' | 'ember' | 'vue' | 'scully' | 'ionic-angular' | 'angular' | 'polymer' | 'svelte' | 'sveltekit' | 'sveltekit-1' | 'ionic-react' | 'create-react-app' | 'gridsome' | 'umijs' | 'sapper' | 'saber' | 'stencil' | 'nuxtjs' | 'redwoodjs' | 'hugo' | 'jekyll' | 'brunch' | 'middleman' | 'zola' | 'hydrogen' | 'vite' | 'tanstack-start' | 'vitepress' | 'vuepress' | 'parcel' | 'fastapi' | 'flask' | 'fasthtml' | 'django' | 'sanity-v3' | 'sanity' | 'storybook' | 'nitro' | 'hono' | 'express' | 'h3' | 'koa' | 'nestjs' | 'elysia' | 'fastify' | 'xmcp' | 'python' | 'ruby' | 'rust' | 'node' | 'go' | 'services' | null;
export interface FunctionConfig {

@@ -24,16 +29,14 @@ /**

/**
* An array of regions where this Serverless Function will be deployed.
* This setting overrides the top-level `regions` setting for matching functions.
* The npm package name of a Runtime, including its version
*/
runtime?: string;
/**
* An array of regions this Serverless Function should be deployed to.
*/
regions?: string[];
/**
* An array of passive regions where this Serverless Function can fail over during outages.
* This setting overrides top-level `functionFailoverRegions` for matching functions.
* An array of passive regions this Serverless Function can fail over to during a lambda outage.
*/
functionFailoverRegions?: string[];
/**
* The npm package name of a Runtime, including its version
*/
runtime?: string;
/**
* A boolean that defines whether the Function supports cancellation (default: false)

@@ -45,42 +48,58 @@ */

*/
experimentalTriggers?: (TriggerEventConfigV1 | TriggerEventConfigV2)[];
experimentalTriggers?: ({
/**
* Event type pattern this trigger handles
*/
type: 'queue/v1beta';
/**
* Name of the queue topic to consume from
*/
topic: string;
/**
* Name of the consumer group for this trigger
*/
consumer: string;
/**
* Maximum number of delivery attempts
*/
maxDeliveries?: number;
/**
* Delay in seconds before retrying failed executions
*/
retryAfterSeconds?: number;
/**
* Initial delay in seconds before first execution attempt
*/
initialDelaySeconds?: number;
/**
* Maximum number of concurrent executions for this consumer
*/
maxConcurrency?: number;
} | {
/**
* Event type pattern this trigger handles
*/
type: 'queue/v2beta';
/**
* Name of the queue topic to consume from
*/
topic: string;
/**
* Maximum number of delivery attempts
*/
maxDeliveries?: number;
/**
* Delay in seconds before retrying failed executions
*/
retryAfterSeconds?: number;
/**
* Initial delay in seconds before first execution attempt
*/
initialDelaySeconds?: number;
/**
* Maximum number of concurrent executions for this consumer
*/
maxConcurrency?: number;
})[];
}
interface TriggerEventConfigBase {
/**
* Name of the queue topic to consume from
*/
topic: string;
/**
* Maximum number of delivery attempts
*/
maxDeliveries?: number;
/**
* Delay in seconds before retrying failed executions
*/
retryAfterSeconds?: number;
/**
* Initial delay in seconds before first execution attempt
*/
initialDelaySeconds?: number;
/**
* Maximum number of concurrent executions for this consumer
*/
maxConcurrency?: number;
}
/**
* Queue trigger config for v1beta - requires explicit consumer name
*/
export interface TriggerEventConfigV1 extends TriggerEventConfigBase {
type: 'queue/v1beta';
/**
* Name of the consumer group for this trigger (required for v1beta)
*/
consumer: string;
}
/**
* Queue trigger config for v2beta - consumer is derived from function path
*/
export interface TriggerEventConfigV2 extends TriggerEventConfigBase {
type: 'queue/v2beta';
}
export interface CronJob {

@@ -133,3 +152,3 @@ schedule: string;

domains?: string[];
formats?: 'image/avif' | 'image/webp' | 'image/jpeg' | 'image/png'[];
formats?: ('image/avif' | 'image/webp' | 'image/jpeg' | 'image/png')[];
localPatterns?: {

@@ -151,64 +170,162 @@ pathname?: string;

/**
* HTTP header key/value pair
* Value for condition matching - can be a string or an operator object
*/
export interface Header {
key: string;
value: string;
}
/**
* Condition for matching in redirects, rewrites, and headers
*/
export interface Condition {
type: 'header' | 'cookie' | 'host' | 'query' | 'path';
key?: string;
value?: string | number;
export type MatchableValue = string | {
/**
* Equal to
*/
eq?: string | number;
/**
* Not equal
*/
neq?: string;
/**
* In array
*/
inc?: string[];
/**
* Not in array
*/
ninc?: string[];
/**
* Starts with
*/
pre?: string;
/**
* Ends with
*/
suf?: string;
/**
* Regex
*/
re?: string;
/**
* Greater than
*/
gt?: number;
/**
* Greater than or equal to
*/
gte?: number;
/**
* Less than
*/
lt?: number;
/**
* Less than or equal to
*/
lte?: number;
};
/**
* Condition for matching in redirects, rewrites, and headers
*/
export type Condition = {
type: 'host';
value: MatchableValue;
} | {
type: 'header' | 'cookie' | 'query';
key: string;
value?: MatchableValue;
};
/**
* The object form of MatchableValue (excludes the plain string shorthand)
*/
export type MatchableValueObject = Exclude<MatchableValue, string>;
/**
* HTTP header key/value pair
*/
export interface Header {
key: string;
value: string;
}
/**
* Redirect matching vercel.json schema
* Returned by routes.redirect()
* Redirect definition matching vercel.json schema
*/
export interface Redirect {
/**
* A pattern that matches each incoming pathname (excluding querystring).
*/
source: string;
/**
* A location destination defined as an absolute pathname or external URL.
*/
destination: string;
/**
* A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.
*/
permanent?: boolean;
/**
* An optional integer to define the status code of the redirect.
* @private
*/
statusCode?: number;
/**
* An array of requirements that are needed to match
*/
has?: Condition[];
/**
* An array of requirements that are needed to match
*/
missing?: Condition[];
/**
* An array of environment variable names that should be replaced at runtime in the destination
*/
env?: string[];
}
/**
* Rewrite matching vercel.json schema
* Returned by routes.rewrite()
* Rewrite definition matching vercel.json schema
*/
export interface Rewrite {
/**
* A pattern that matches each incoming pathname (excluding querystring).
*/
source: string;
/**
* An absolute pathname to an existing resource or an external URL.
*/
destination: string;
/**
* An array of requirements that are needed to match
*/
has?: Condition[];
/**
* An array of requirements that are needed to match
*/
missing?: Condition[];
/**
* An optional integer to override the status code of the response.
*/
statusCode?: number;
/**
* An array of environment variable names that should be replaced at runtime in the destination
*/
env?: string[];
/**
* When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.
*/
respectOriginCacheControl?: boolean;
}
/**
* Header rule matching vercel.json schema
* Returned by routes.header() and routes.cacheControl()
* Header rule definition matching vercel.json schema
*/
export interface HeaderRule {
/**
* A pattern that matches each incoming pathname (excluding querystring)
*/
source: string;
/**
* An array of key/value pairs representing each response header.
*/
headers: Header[];
/**
* An array of requirements that are needed to match
*/
has?: Condition[];
/**
* An array of requirements that are needed to match
*/
missing?: Condition[];
}
/**
* Union type for all router helper outputs
* Can be simple schema objects (Redirect, Rewrite, HeaderRule) or Routes with transforms
* Note: Route type is defined in router.ts (uses src/dest instead of source/destination)
* Union type for all routing helper outputs
*/

@@ -272,3 +389,3 @@ export type RouteType = Redirect | Rewrite | HeaderRule | any;

*/
headers?: RouteType[];
headers?: HeaderRule[];
images?: ImageConfig;

@@ -286,3 +403,3 @@ /**

*/
redirects?: RouteType[];
redirects?: Redirect[];
/**

@@ -299,3 +416,3 @@ * The path to a file containing bulk redirects; supports JSON, JSONL, and CSV

*/
rewrites?: RouteType[];
rewrites?: Rewrite[];
/**

@@ -359,2 +476,77 @@ * A list of routes objects used to rewrite paths to point towards other internal or external paths

bunVersion?: string;
/**
* Enables configuration of multiple services in a single deployment. Map of service name to service configuration.
* @private
*/
experimentalServices?: Record<string, {
/**
* Service type: web, cron, or worker. Defaults to web.
*/
type?: 'web' | 'cron' | 'worker';
/**
* Entry file for the service, relative to the workspace directory.
*/
entrypoint?: string;
/**
* Path to the directory containing the service manifest file (package.json, pyproject.toml, etc.). Defaults to "." (project root).
*/
workspace?: string;
/**
* URL prefix for routing (web services only).
*/
routePrefix?: string;
/**
* Framework to use.
*/
framework?: string;
/**
* Builder to use, e.g. @vercel/node, @vercel/python.
*/
builder?: string;
/**
* Specific lambda runtime to use, e.g. nodejs24.x, python3.14.
*/
runtime?: string;
/**
* Build command for the service.
*/
buildCommand?: string;
/**
* Install command for the service.
*/
installCommand?: string;
/**
* Memory allocation in MB (128-10240).
*/
memory?: number;
/**
* Max duration in seconds (1-900).
*/
maxDuration?: number;
/**
* Files to include in bundle.
*/
includeFiles?: string | string[];
/**
* Files to exclude from bundle.
*/
excludeFiles?: string | string[];
/**
* Cron schedule expression (e.g., "0 0 * * *"). Required for cron services.
*/
schedule?: string;
/**
* Topic name for worker subscription.
*/
topic?: string;
/**
* Consumer group name for worker subscription.
*/
consumer?: string;
}>;
/**
* Enables grouping of services. Map of service group name to an array of service names belonging to that group.
* @private
*/
experimentalServiceGroups?: Record<string, string[]>;
}

@@ -365,2 +557,1 @@ /**

export declare const VercelConfig: {};
export {};
"use strict";
/**
* Vercel configuration type that mirrors the vercel.json schema
* https://openapi.vercel.sh/vercel.json
* AUTO-GENERATED — DO NOT EDIT
*
* This file is generated from the vercel.json OpenAPI schema.
* To modify, update scripts/generate-types.ts and re-run:
* pnpm generate-types
*
* Schema: https://openapi.vercel.sh/vercel.json
*/

@@ -6,0 +11,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -35,3 +35,3 @@ "use strict";

}
catch (e) {
catch (_e) {
throw new Error(`Invalid regex pattern: ${pattern}`);

@@ -38,0 +38,0 @@ }

export { createRoutes, routes, Router } from '../router';
export * from '../router';
export { VercelConfig } from '../types';
export type { Redirect, Rewrite, HeaderRule, Condition, RouteType, } from '../types';
export type { Redirect, Rewrite, HeaderRule, Condition, MatchableValue, RouteType, } from '../types';
export { validateStaticString, validateStaticBoolean, validateStaticObject, validateStaticStringArray, validateStaticFields, } from '../utils/validation';

@@ -7,2 +7,2 @@ /**

*/
export type { VercelConfig, Framework, FunctionConfig, CronJob, GitDeploymentConfig, GitConfig, GithubConfig, ImageConfig, Header, Condition, Redirect, Rewrite, HeaderRule, RouteType, WildcardDomain, BuildConfig, BuildItem, } from '../types';
export type { VercelConfig, Framework, FunctionConfig, CronJob, GitDeploymentConfig, GitConfig, GithubConfig, ImageConfig, Header, Condition, MatchableValue, Redirect, Rewrite, HeaderRule, RouteType, WildcardDomain, BuildConfig, BuildItem, } from '../types';
{
"name": "@vercel/config",
"version": "0.0.37",
"version": "0.0.38",
"description": "A TypeScript SDK for programmatically configuring Vercel projects",

@@ -5,0 +5,0 @@ "license": "MIT",