Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@vercel/config

Package Overview
Dependencies
Maintainers
336
Versions
40
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.13
to
0.0.14
+154
dist/types.d.ts
/**
* Vercel configuration type that mirrors the vercel.json 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 interface CronJob {
schedule: string;
path: string;
}
export interface FunctionConfig {
excludeFiles?: string;
includeFiles?: string;
maxDuration?: number;
memory?: number;
runtime?: string;
supportsCancellation?: boolean;
experimentalTriggers?: Array<{
type: 'queue/v1beta';
topic: string;
consumer: string;
maxDeliveries?: number;
retryAfterSeconds?: number;
initialDelaySeconds?: number;
}>;
}
export interface GitDeploymentConfig {
[branch: string]: boolean;
}
export interface GitConfig {
deploymentEnabled?: boolean | GitDeploymentConfig;
}
export interface GithubConfig {
enabled?: boolean;
autoAlias?: boolean;
autoJobCancelation?: boolean;
}
export interface Header {
key: string;
value: string;
}
export interface HeaderRule {
source: string;
headers: Header[];
}
/**
* Route represents a single routing rule that can be a redirect, rewrite, or header rule
* Matches the output of router.redirect(), router.rewrite(), router.header(), etc.
*/
export type RouteType = any;
export interface WildcardDomain {
domain: string;
value: string;
}
export interface VercelConfig {
/**
* Aliases that will get assigned when the deployment is `READY` and the target is `production`.
*/
alias?: string | string[];
/**
* When set to `true`, all HTML files and Serverless Functions will have their extension removed.
*/
cleanUrls?: boolean;
/**
* An array of cron jobs that should be created for production Deployments.
*/
crons?: CronJob[];
/**
* An object containing the deployment's environment variables.
*/
env?: Record<string, string>;
/**
* An array of the passive regions the deployment's Serverless Functions should be deployed to.
*/
passiveRegions?: string[];
/**
* Same as passiveRegions. An array of passive regions for failover.
*/
functionFailoverRegions?: string[];
/**
* An object describing custom options for Serverless Functions.
*/
functions?: Record<string, FunctionConfig>;
/**
* Git-related configuration.
*/
git?: GitConfig;
/**
* GitHub-related configuration.
*/
github?: GithubConfig;
/**
* HTTP headers configuration.
* Can use router.header() and router.cacheControl() helpers.
*/
headers?: RouteType[];
/**
* HTTP redirects configuration.
* Can use router.redirect() helper.
*/
redirects?: RouteType[];
/**
* HTTP rewrites configuration.
* Can use router.rewrite() helper.
*/
rewrites?: RouteType[];
/**
* Wildcard domain configuration.
*/
wildcard?: WildcardDomain[];
/**
* The build command for this project. When `null`, automatically detected.
*/
buildCommand?: string | null;
/**
* The ignore command for this project.
*/
ignoreCommand?: string | null;
/**
* The dev command for this project. When `null`, automatically detected.
*/
devCommand?: string | null;
/**
* The framework being used. When `null`, no framework is selected.
*/
framework?: Framework;
/**
* The install command for this project. When `null`, automatically detected.
*/
installCommand?: string | null;
/**
* The output directory of the project. When `null`, automatically detected.
*/
outputDirectory?: string | null;
/**
* When `false`, visiting a path that ends with a forward slash will redirect to the path without the trailing slash.
*/
trailingSlash?: boolean;
/**
* An array of projectIds to associate with the current project.
*/
relatedProjects?: string[];
/**
* Enables Fluid compute for the project.
*/
fluid?: boolean;
/**
* Enables Bun for the project and specifies the version to use.
*/
bunVersion?: string;
/**
* Node.js version for this project.
*/
nodeVersion?: string;
}
"use strict";
/**
* Vercel configuration type that mirrors the vercel.json schema
* https://openapi.vercel.sh/vercel.json
*/
Object.defineProperty(exports, "__esModule", { value: true });
+1
-2

@@ -40,6 +40,5 @@ #!/usr/bin/env node

'headers',
'crons',
'env',
'cacheControl',
'__esModule' // ES module metadata
'__esModule'
]);

@@ -46,0 +45,0 @@ /**

export { createRouter, Router } from "./router";
export * from "./router";
export type { VercelConfig } from "./types";

@@ -610,7 +610,63 @@ "use strict";

const allRoutes = [...routesFromRewrites, ...this.routeRules];
// If routes exist, only return routes (not the legacy fields)
// If routes exist, convert everything to routes format
// Vercel doesn't allow mixing routes with redirects, rewrites, headers, cleanUrls, or trailingSlash
if (allRoutes.length > 0) {
// Convert standalone redirects to routes
const routesFromRedirects = this.redirectRules.map(redirectRule => {
const route = {
src: redirectRule.source,
dest: redirectRule.destination,
redirect: true,
status: redirectRule.statusCode || (redirectRule.permanent ? 308 : 307),
};
if (redirectRule.has)
route.has = redirectRule.has;
if (redirectRule.missing)
route.missing = redirectRule.missing;
return route;
});
// Convert legacy rewrites (without transforms) to routes
const routesFromLegacyRewrites = legacyRewrites.map(rewrite => {
const route = {
src: rewrite.source,
dest: rewrite.destination,
};
if (rewrite.has)
route.has = rewrite.has;
if (rewrite.missing)
route.missing = rewrite.missing;
return route;
});
// Convert standalone headers to routes (except rewrite caching headers)
const routesFromHeaders = this.headerRules
.filter(rule => {
// Exclude rewrite caching headers (they're automatically added for rewrites)
const isCachingHeader = rule.headers.length === 1 &&
rule.headers[0].key === 'x-vercel-enable-rewrite-caching';
return !isCachingHeader;
})
.map(headerRule => {
const transforms = headerRule.headers.map(header => ({
type: 'response.headers',
op: 'set',
target: { key: header.key },
args: header.value,
}));
const route = {
src: headerRule.source,
transforms,
};
if (headerRule.has)
route.has = headerRule.has;
if (headerRule.missing)
route.missing = headerRule.missing;
return route;
});
// Combine all routes: redirects, legacy rewrites, rewrites with transforms, explicit routes, and headers as routes
const combinedRoutes = [...routesFromRedirects, ...routesFromLegacyRewrites, ...routesFromRewrites, ...this.routeRules, ...routesFromHeaders];
const config = {
routes: allRoutes,
routes: combinedRoutes,
};
// NOTE: crons are now handled via export const crons in vercel.ts
// They are no longer included in router.getConfig()
// Only include optional fields if they're explicitly set

@@ -635,3 +691,3 @@ if (this.bulkRedirectsPathConfig !== undefined) {

trailingSlash: this.trailingSlashConfig,
crons: this.cronRules,
// NOTE: crons are now handled via export const crons in vercel.ts
};

@@ -638,0 +694,0 @@ // Only include optional fields if they're explicitly set

{
"name": "@vercel/config",
"version": "0.0.13",
"version": "0.0.14",
"description": "A TypeScript SDK for programmatically generating Vercel configuration files",

@@ -5,0 +5,0 @@ "bugs": {

@@ -37,3 +37,3 @@ # @vercel/config

public: true,
maxAge: '1week',
maxAge: '1 week',
immutable: true

@@ -122,3 +122,3 @@ });

public: true,
maxAge: '1week',
maxAge: '1 week',
immutable: true

@@ -125,0 +125,0 @@ });