Update app and tooling

This commit is contained in:
Lawrence Chen 2026-01-29 17:36:26 -08:00
parent 3046531bdd
commit e620ec7349
4950 changed files with 2975120 additions and 10 deletions

10
node_modules/@vercel/build-utils/dist/clone-env.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import type { Env } from './types';
/**
* Clones zero or more objects into a single new object while ensuring that the
* `PATH` environment variable is defined when the `PATH` or `Path` environment
* variables are defined.
*
* @param {Object} [...envs] Objects and/or `process.env` to clone and merge
* @returns {Object} The new object
*/
export declare function cloneEnv(...envs: (Env | undefined)[]): Env;

43
node_modules/@vercel/build-utils/dist/clone-env.js generated vendored Normal file
View file

@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var clone_env_exports = {};
__export(clone_env_exports, {
cloneEnv: () => cloneEnv
});
module.exports = __toCommonJS(clone_env_exports);
const { hasOwnProperty } = Object.prototype;
function cloneEnv(...envs) {
return envs.reduce((obj, env) => {
if (env === void 0 || env === null) {
return obj;
}
obj = Object.assign(obj, env);
if (hasOwnProperty.call(env, "Path")) {
if (obj.Path !== void 0) {
obj.PATH = obj.Path;
}
delete obj.Path;
}
return obj;
}, {});
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
cloneEnv
});

1
node_modules/@vercel/build-utils/dist/debug.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export default function debug(message: string, ...additional: any[]): void;

31
node_modules/@vercel/build-utils/dist/debug.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var debug_exports = {};
__export(debug_exports, {
default: () => debug
});
module.exports = __toCommonJS(debug_exports);
var import_get_platform_env = require("./get-platform-env");
function debug(message, ...additional) {
if ((0, import_get_platform_env.getPlatformEnv)("BUILDER_DEBUG")) {
console.log(message, ...additional);
} else if (process.env.VERCEL_DEBUG_PREFIX) {
console.log(`${process.env.VERCEL_DEBUG_PREFIX}${message}`, ...additional);
}
}

View file

@ -0,0 +1 @@
export declare const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";

View file

@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var default_cache_path_glob_exports = {};
__export(default_cache_path_glob_exports, {
defaultCachePathGlob: () => defaultCachePathGlob
});
module.exports = __toCommonJS(default_cache_path_glob_exports);
const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
defaultCachePathGlob
});

View file

@ -0,0 +1,41 @@
import type { Env, Files, FunctionFramework } from './types';
/**
* An Edge Functions output
*/
export declare class EdgeFunction {
type: 'EdgeFunction';
/**
* A display name for the edge function.
* @deprecated This property should no longer be used. The name is inferred from the URL path of the function.
*/
name?: string;
/**
* The deployment target.
* Only `v8-worker` is currently supported.
*/
deploymentTarget: 'v8-worker';
/**
* The entrypoint for the edge function.
*/
entrypoint: string;
/**
* Environment variables for the edge function to use at runtime.
*/
environment?: Env;
/**
* The list of files to be included in the edge function bundle.
*/
files: Files;
/**
* Extra binary files to be included in the edge function
*/
assets?: {
name: string;
path: string;
}[];
/** The regions where the edge function will be executed on */
regions?: string | string[];
/** The framework */
framework?: FunctionFramework;
constructor(params: Omit<EdgeFunction, 'type'>);
}

40
node_modules/@vercel/build-utils/dist/edge-function.js generated vendored Normal file
View file

@ -0,0 +1,40 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var edge_function_exports = {};
__export(edge_function_exports, {
EdgeFunction: () => EdgeFunction
});
module.exports = __toCommonJS(edge_function_exports);
class EdgeFunction {
constructor(params) {
this.type = "EdgeFunction";
this.name = params.name;
this.deploymentTarget = params.deploymentTarget;
this.entrypoint = params.entrypoint;
this.files = params.files;
this.assets = params.assets;
this.regions = params.regions;
this.framework = params.framework;
this.environment = params.environment;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
EdgeFunction
});

39
node_modules/@vercel/build-utils/dist/errors.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
/**
* This error should be thrown from a Builder in
* order to stop the build and print a message.
* This is necessary to avoid printing a stack trace.
*/
export declare class NowBuildError extends Error {
hideStackTrace: boolean;
code: string;
link?: string;
action?: string;
constructor({ message, code, link, action }: Props);
}
interface Props {
/**
* The error message to display to the end-user.
* Should be short yet descriptive of what they did wrong.
*/
message: string;
/**
* A unique error code for this particular error.
* Should start with the builder name such as `NODE_`.
*/
code: string;
/**
* Optional hyperlink starting with https://vercel.com to
* link to more information about this error.
*/
link?: string;
/**
* Optional "action" to display before the `link`, such as "Learn More".
*/
action?: string;
}
export declare function getPrettyError(obj: {
dataPath?: string;
message?: string;
params: any;
}): NowBuildError;
export {};

95
node_modules/@vercel/build-utils/dist/errors.js generated vendored Normal file
View file

@ -0,0 +1,95 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var errors_exports = {};
__export(errors_exports, {
NowBuildError: () => NowBuildError,
getPrettyError: () => getPrettyError
});
module.exports = __toCommonJS(errors_exports);
class NowBuildError extends Error {
constructor({ message, code, link, action }) {
super(message);
this.hideStackTrace = true;
this.code = code;
this.link = link;
this.action = action;
}
}
function getPrettyError(obj) {
const docsUrl = "https://vercel.com/docs/concepts/projects/project-configuration";
try {
const { dataPath, params, message: ajvMessage } = obj;
const prop = getTopLevelPropertyName(dataPath);
let message = dataPath && dataPath.startsWith(".") ? `\`${dataPath.slice(1)}\` ` : "";
if (params && typeof params.additionalProperty === "string") {
const suggestion = getSuggestion(prop, params.additionalProperty);
message += `should NOT have additional property \`${params.additionalProperty}\`. ${suggestion}`;
} else if (params && typeof params.missingProperty === "string") {
message += `missing required property \`${params.missingProperty}\`.`;
} else {
message += `${ajvMessage}.`;
}
return new NowBuildError({
code: "INVALID_VERCEL_CONFIG",
message,
link: prop ? `${docsUrl}#${prop.toLowerCase()}` : docsUrl,
action: "View Documentation"
});
} catch (e) {
return new NowBuildError({
code: "INVALID_VERCEL_CONFIG",
message: `Failed to validate configuration.`,
link: docsUrl,
action: "View Documentation"
});
}
}
function getTopLevelPropertyName(dataPath) {
if (dataPath && dataPath.startsWith(".")) {
const lastIndex = dataPath.indexOf("[");
return lastIndex > -1 ? dataPath.slice(1, lastIndex) : dataPath.slice(1);
}
return "";
}
const mapTypoToSuggestion = {
"": {
builder: "builds",
"build.env": '{ "build": { "env": {"name": "value"} } }',
"builds.env": '{ "build": { "env": {"name": "value"} } }'
},
rewrites: { src: "source", dest: "destination" },
redirects: { src: "source", dest: "destination", status: "statusCode" },
headers: { src: "source", header: "headers" },
routes: {
source: "src",
destination: "dest",
header: "headers",
method: "methods"
}
};
function getSuggestion(topLevelProp, additionalProperty) {
const choices = mapTypoToSuggestion[topLevelProp];
const choice = choices ? choices[additionalProperty] : void 0;
return choice ? `Did you mean \`${choice}\`?` : "Please remove it.";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NowBuildError,
getPrettyError
});

24
node_modules/@vercel/build-utils/dist/file-blob.d.ts generated vendored Normal file
View file

@ -0,0 +1,24 @@
/// <reference types="node" />
/// <reference types="node" />
import { FileBase } from './types';
interface FileBlobOptions {
mode?: number;
contentType?: string;
data: string | Buffer;
}
interface FromStreamOptions {
mode?: number;
contentType?: string;
stream: NodeJS.ReadableStream;
}
export default class FileBlob implements FileBase {
type: 'FileBlob';
mode: number;
data: string | Buffer;
contentType: string | undefined;
constructor({ mode, contentType, data }: FileBlobOptions);
static fromStream({ mode, contentType, stream, }: FromStreamOptions): Promise<FileBlob>;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export {};

67
node_modules/@vercel/build-utils/dist/file-blob.js generated vendored Normal file
View file

@ -0,0 +1,67 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_blob_exports = {};
__export(file_blob_exports, {
default: () => FileBlob
});
module.exports = __toCommonJS(file_blob_exports);
var import_assert = __toESM(require("assert"));
var import_into_stream = __toESM(require("into-stream"));
class FileBlob {
constructor({ mode = 33188, contentType, data }) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof data === "string" || Buffer.isBuffer(data));
this.type = "FileBlob";
this.mode = mode;
this.contentType = contentType;
this.data = data;
}
static async fromStream({
mode = 33188,
contentType,
stream
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof stream.pipe === "function");
const chunks = [];
await new Promise((resolve, reject) => {
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
stream.on("error", (error) => reject(error));
stream.on("end", () => resolve());
});
const data = Buffer.concat(chunks);
return new FileBlob({ mode, contentType, data });
}
async toStreamAsync() {
return this.toStream();
}
toStream() {
return (0, import_into_stream.default)(this.data);
}
}

27
node_modules/@vercel/build-utils/dist/file-fs-ref.d.ts generated vendored Normal file
View file

@ -0,0 +1,27 @@
/// <reference types="node" />
import { FileBase } from './types';
interface FileFsRefOptions {
mode?: number;
contentType?: string;
fsPath: string;
size?: number;
}
interface FromStreamOptions {
mode: number;
contentType?: string;
stream: NodeJS.ReadableStream;
fsPath: string;
}
declare class FileFsRef implements FileBase {
type: 'FileFsRef';
mode: number;
fsPath: string;
size?: number;
contentType: string | undefined;
constructor({ mode, contentType, fsPath, size, }: FileFsRefOptions);
static fromFsPath({ mode, contentType, fsPath, size, }: FileFsRefOptions): Promise<FileFsRef>;
static fromStream({ mode, contentType, stream, fsPath, }: FromStreamOptions): Promise<FileFsRef>;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export default FileFsRef;

113
node_modules/@vercel/build-utils/dist/file-fs-ref.js generated vendored Normal file
View file

@ -0,0 +1,113 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_fs_ref_exports = {};
__export(file_fs_ref_exports, {
default: () => file_fs_ref_default
});
module.exports = __toCommonJS(file_fs_ref_exports);
var import_assert = __toESM(require("assert"));
var import_fs_extra = __toESM(require("fs-extra"));
var import_multistream = __toESM(require("multistream"));
var import_path = __toESM(require("path"));
var import_async_sema = __toESM(require("async-sema"));
const semaToPreventEMFILE = new import_async_sema.default(20);
class FileFsRef {
constructor({
mode = 33188,
contentType,
fsPath,
size
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof fsPath === "string");
this.type = "FileFsRef";
this.mode = mode;
this.contentType = contentType;
this.fsPath = fsPath;
this.size = size;
}
static async fromFsPath({
mode,
contentType,
fsPath,
size
}) {
let m = mode;
let s = size;
if (!m || typeof s === "undefined") {
const stat = await import_fs_extra.default.lstat(fsPath);
m = stat.mode;
s = stat.size;
}
return new FileFsRef({ mode: m, contentType, fsPath, size: s });
}
static async fromStream({
mode = 33188,
contentType,
stream,
fsPath
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof stream.pipe === "function");
(0, import_assert.default)(typeof fsPath === "string");
await import_fs_extra.default.mkdirp(import_path.default.dirname(fsPath));
await new Promise((resolve, reject) => {
const dest = import_fs_extra.default.createWriteStream(fsPath, {
mode: mode & 511
});
stream.pipe(dest);
stream.on("error", reject);
dest.on("finish", resolve);
dest.on("error", reject);
});
return FileFsRef.fromFsPath({ mode, contentType, fsPath });
}
async toStreamAsync() {
await semaToPreventEMFILE.acquire();
const release = () => semaToPreventEMFILE.release();
const stream = import_fs_extra.default.createReadStream(this.fsPath);
stream.on("close", release);
stream.on("error", release);
return stream;
}
toStream() {
let flag = false;
return (0, import_multistream.default)((cb) => {
if (flag)
return cb(null, null);
flag = true;
this.toStreamAsync().then((stream) => {
cb(null, stream);
}).catch((error) => {
cb(error, null);
});
});
}
}
var file_fs_ref_default = FileFsRef;

38
node_modules/@vercel/build-utils/dist/file-ref.d.ts generated vendored Normal file
View file

@ -0,0 +1,38 @@
/// <reference types="node" />
import { FileBase } from './types';
interface FileRefOptions {
mode?: number;
digest: string;
contentType?: string;
mutable?: boolean;
}
export default class FileRef implements FileBase {
type: 'FileRef';
mode: number;
digest: string;
contentType: string | undefined;
private mutable;
constructor({ mode, digest, contentType, mutable, }: FileRefOptions);
/**
* Retrieves the URL of the CloudFront distribution for the S3
* bucket represented by {@link getNowFilesS3Url}.
*
* @returns The URL of the CloudFront distribution
*/
private getNowFilesCloudfrontUrl;
/**
* Retrieves the URL of the S3 bucket for storing ephemeral files.
*
* @returns The URL of the S3 bucket
*/
private getNowEphemeralFilesS3Url;
/**
* Retrieves the URL of the S3 bucket for storing files.
*
* @returns The URL of the S3 bucket
*/
private getNowFilesS3Url;
toStreamAsync(): Promise<NodeJS.ReadableStream>;
toStream(): NodeJS.ReadableStream;
}
export {};

147
node_modules/@vercel/build-utils/dist/file-ref.js generated vendored Normal file
View file

@ -0,0 +1,147 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var file_ref_exports = {};
__export(file_ref_exports, {
default: () => FileRef
});
module.exports = __toCommonJS(file_ref_exports);
var import_assert = __toESM(require("assert"));
var import_node_fetch = __toESM(require("node-fetch"));
var import_multistream = __toESM(require("multistream"));
var import_async_retry = __toESM(require("async-retry"));
var import_async_sema = __toESM(require("async-sema"));
const semaToDownloadFromS3 = new import_async_sema.default(5);
class BailableError extends Error {
constructor(...args) {
super(...args);
this.bail = false;
}
}
class FileRef {
constructor({
mode = 33188,
digest,
contentType,
mutable = false
}) {
(0, import_assert.default)(typeof mode === "number");
(0, import_assert.default)(typeof digest === "string");
this.type = "FileRef";
this.mode = mode;
this.digest = digest;
this.contentType = contentType;
this.mutable = mutable;
}
/**
* Retrieves the URL of the CloudFront distribution for the S3
* bucket represented by {@link getNowFilesS3Url}.
*
* @returns The URL of the CloudFront distribution
*/
getNowFilesCloudfrontUrl() {
return getEnvAsUrlOrThrow("NOW_FILES_CLOUDFRONT_URL") || "https://dmmcy0pwk6bqi.cloudfront.net";
}
/**
* Retrieves the URL of the S3 bucket for storing ephemeral files.
*
* @returns The URL of the S3 bucket
*/
getNowEphemeralFilesS3Url() {
return getEnvAsUrlOrThrow("NOW_EPHEMERAL_FILES_S3_URL") || "https://now-ephemeral-files.s3.amazonaws.com";
}
/**
* Retrieves the URL of the S3 bucket for storing files.
*
* @returns The URL of the S3 bucket
*/
getNowFilesS3Url() {
return getEnvAsUrlOrThrow("NOW_FILES_S3_URL") || "https://now-files.s3.amazonaws.com";
}
async toStreamAsync() {
let url = "";
const [digestType, digestHash] = this.digest.split(":");
if (digestType === "sha") {
url = this.mutable ? `${this.getNowFilesS3Url()}/${digestHash}` : `${this.getNowFilesCloudfrontUrl()}/${digestHash}`;
} else if (digestType === "sha+ephemeral") {
url = `${this.getNowEphemeralFilesS3Url()}/${digestHash}`;
} else {
throw new Error("Expected digest to be sha");
}
await semaToDownloadFromS3.acquire();
try {
return await (0, import_async_retry.default)(
async () => {
const resp = await (0, import_node_fetch.default)(url);
if (!resp.ok) {
const error = new BailableError(
`download: ${resp.status} ${resp.statusText} for ${url}`
);
if (resp.status === 403)
error.bail = true;
throw error;
}
return resp.body;
},
{ factor: 1, retries: 3 }
);
} finally {
semaToDownloadFromS3.release();
}
}
toStream() {
let flag = false;
return (0, import_multistream.default)((cb) => {
if (flag)
return cb(null, null);
flag = true;
this.toStreamAsync().then((stream) => {
cb(null, stream);
}).catch((error) => {
cb(error, null);
});
});
}
}
function getEnvAsUrlOrThrow(key) {
const value = process.env[key];
if (value === void 0)
return void 0;
try {
new URL(value);
return value;
} catch (e) {
if (e instanceof TypeError && "code" in e && e.code === "ERR_INVALID_URL") {
throw new Error(
`A non-URL value was supplied to the ${key} environment variable`
);
} else {
throw e;
}
}
}

View file

@ -0,0 +1,22 @@
import { Builder } from '.';
/**
* List of backend frameworks supported by the experimental backends feature
*/
export declare const BACKEND_FRAMEWORKS: readonly ["express", "hono", "h3", "koa", "nestjs", "fastify", "elysia"];
export declare const PYTHON_FRAMEWORKS: readonly ["fastapi", "flask", "python"];
export declare const RUNTIME_FRAMEWORKS: readonly ["python"];
export declare const BACKEND_BUILDERS: readonly ["@vercel/express", "@vercel/hono", "@vercel/h3", "@vercel/koa", "@vercel/nestjs", "@vercel/fastify", "@vercel/elysia"];
export type BackendFramework = (typeof BACKEND_FRAMEWORKS)[number];
export type PythonFramework = (typeof PYTHON_FRAMEWORKS)[number];
/**
* Checks if the given framework is a backend framework
*/
export declare function isBackendFramework(framework: string | null | undefined): framework is BackendFramework;
export declare function isPythonFramework(framework: string | null | undefined): framework is (typeof PYTHON_FRAMEWORKS)[number];
export declare function isExperimentalBackendsWithoutIntrospectionEnabled(): boolean;
export declare function isExperimentalBackendsEnabled(): boolean;
export declare function isBackendBuilder(builder: Builder | null | undefined): boolean;
/**
* Checks if experimental backends are enabled AND the framework is a backend framework
*/
export declare function shouldUseExperimentalBackends(framework: string | null | undefined): boolean;

View file

@ -0,0 +1,96 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var framework_helpers_exports = {};
__export(framework_helpers_exports, {
BACKEND_BUILDERS: () => BACKEND_BUILDERS,
BACKEND_FRAMEWORKS: () => BACKEND_FRAMEWORKS,
PYTHON_FRAMEWORKS: () => PYTHON_FRAMEWORKS,
RUNTIME_FRAMEWORKS: () => RUNTIME_FRAMEWORKS,
isBackendBuilder: () => isBackendBuilder,
isBackendFramework: () => isBackendFramework,
isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
isPythonFramework: () => isPythonFramework,
shouldUseExperimentalBackends: () => shouldUseExperimentalBackends
});
module.exports = __toCommonJS(framework_helpers_exports);
const BACKEND_FRAMEWORKS = [
"express",
"hono",
"h3",
"koa",
"nestjs",
"fastify",
"elysia"
];
const PYTHON_FRAMEWORKS = [
"fastapi",
"flask",
"python"
// Generic Python framework preset
];
const RUNTIME_FRAMEWORKS = ["python"];
const BACKEND_BUILDERS = [
"@vercel/express",
"@vercel/hono",
"@vercel/h3",
"@vercel/koa",
"@vercel/nestjs",
"@vercel/fastify",
"@vercel/elysia"
];
function isBackendFramework(framework) {
if (!framework)
return false;
return BACKEND_FRAMEWORKS.includes(framework);
}
function isPythonFramework(framework) {
if (!framework)
return false;
return PYTHON_FRAMEWORKS.includes(framework);
}
function isExperimentalBackendsWithoutIntrospectionEnabled() {
return process.env.VERCEL_BACKENDS_BUILDS === "1";
}
function isExperimentalBackendsEnabled() {
return isExperimentalBackendsWithoutIntrospectionEnabled() || process.env.VERCEL_EXPERIMENTAL_BACKENDS === "1" || // Previously used for experimental express and hono builds
process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD === "1" || process.env.VERCEL_EXPERIMENTAL_HONO_BUILD === "1";
}
function isBackendBuilder(builder) {
if (!builder)
return false;
const use = builder.use;
return BACKEND_BUILDERS.includes(use);
}
function shouldUseExperimentalBackends(framework) {
return isExperimentalBackendsEnabled() && isBackendFramework(framework);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BACKEND_BUILDERS,
BACKEND_FRAMEWORKS,
PYTHON_FRAMEWORKS,
RUNTIME_FRAMEWORKS,
isBackendBuilder,
isBackendFramework,
isExperimentalBackendsEnabled,
isExperimentalBackendsWithoutIntrospectionEnabled,
isPythonFramework,
shouldUseExperimentalBackends
});

View file

@ -0,0 +1,9 @@
import FileFsRef from '../file-fs-ref';
import { File, Files, Meta } from '../types';
export interface DownloadedFiles {
[filePath: string]: FileFsRef;
}
export declare function isDirectory(mode: number): boolean;
export declare function isSymbolicLink(mode: number): boolean;
export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;

136
node_modules/@vercel/build-utils/dist/fs/download.js generated vendored Normal file
View file

@ -0,0 +1,136 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var download_exports = {};
__export(download_exports, {
default: () => download,
downloadFile: () => downloadFile,
isDirectory: () => isDirectory,
isSymbolicLink: () => isSymbolicLink
});
module.exports = __toCommonJS(download_exports);
var import_path = __toESM(require("path"));
var import_debug = __toESM(require("../debug"));
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
var import_fs_extra = require("fs-extra");
var import_stream_to_buffer = __toESM(require("./stream-to-buffer"));
const S_IFDIR = 16384;
const S_IFLNK = 40960;
const S_IFMT = 61440;
function isDirectory(mode) {
return (mode & S_IFMT) === S_IFDIR;
}
function isSymbolicLink(mode) {
return (mode & S_IFMT) === S_IFLNK;
}
async function prepareSymlinkTarget(file, fsPath) {
const mkdirPromise = (0, import_fs_extra.mkdirp)(import_path.default.dirname(fsPath));
if (file.type === "FileFsRef") {
const [target] = await Promise.all([(0, import_fs_extra.readlink)(file.fsPath), mkdirPromise]);
return target;
}
if (file.type === "FileRef" || file.type === "FileBlob") {
const targetPathBufferPromise = (0, import_stream_to_buffer.default)(await file.toStreamAsync());
const [targetPathBuffer] = await Promise.all([
targetPathBufferPromise,
mkdirPromise
]);
return targetPathBuffer.toString("utf8");
}
throw new Error(
`file.type "${file.type}" not supported for symlink`
);
}
async function downloadFile(file, fsPath) {
const { mode } = file;
if (isDirectory(mode)) {
await (0, import_fs_extra.mkdirp)(fsPath);
await (0, import_fs_extra.chmod)(fsPath, mode);
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
}
if (isSymbolicLink(mode)) {
const target = await prepareSymlinkTarget(file, fsPath);
await (0, import_fs_extra.symlink)(target, fsPath);
return import_file_fs_ref.default.fromFsPath({ mode, fsPath });
}
const stream = file.toStream();
return import_file_fs_ref.default.fromStream({ mode, stream, fsPath });
}
async function removeFile(basePath, fileMatched) {
const file = import_path.default.join(basePath, fileMatched);
await (0, import_fs_extra.remove)(file);
}
async function download(files, basePath, meta) {
const {
isDev = false,
skipDownload = false,
filesChanged = null,
filesRemoved = null
} = meta || {};
if (isDev || skipDownload) {
return files;
}
(0, import_debug.default)("Downloading deployment source files...");
const start = Date.now();
const files2 = {};
const filenames = Object.keys(files);
await Promise.all(
filenames.map(async (name) => {
if (Array.isArray(filesRemoved) && filesRemoved.includes(name)) {
await removeFile(basePath, name);
return;
}
if (Array.isArray(filesChanged) && !filesChanged.includes(name)) {
return;
}
const parts = name.split("/");
for (let i = 1; i < parts.length; i++) {
const dir = parts.slice(0, i).join("/");
const parent = files[dir];
if (parent && isSymbolicLink(parent.mode)) {
console.warn(
`Warning: file "${name}" is within a symlinked directory "${dir}" and will be ignored`
);
return;
}
}
const file = files[name];
const fsPath = import_path.default.join(basePath, name);
files2[name] = await downloadFile(file, fsPath);
})
);
const duration = Date.now() - start;
(0, import_debug.default)(`Downloaded ${filenames.length} source files: ${duration}ms`);
return files2;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
downloadFile,
isDirectory,
isSymbolicLink
});

View file

@ -0,0 +1 @@
export default function getWritableDirectory(): Promise<string>;

View file

@ -0,0 +1,32 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_writable_directory_exports = {};
__export(get_writable_directory_exports, {
default: () => getWritableDirectory
});
module.exports = __toCommonJS(get_writable_directory_exports);
var import_path = require("path");
var import_os = require("os");
var import_fs_extra = require("fs-extra");
async function getWritableDirectory() {
const name = Math.floor(Math.random() * 2147483647).toString(16);
const directory = (0, import_path.join)((0, import_os.tmpdir)(), name);
await (0, import_fs_extra.mkdirp)(directory);
return directory;
}

10
node_modules/@vercel/build-utils/dist/fs/glob.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import FileFsRef from '../file-fs-ref';
export interface GlobOptions {
cwd?: string;
dot?: boolean;
follow?: boolean;
ignore?: string | ReadonlyArray<string>;
includeDirectories?: boolean;
nodir?: boolean;
}
export default function glob(pattern: string, opts: GlobOptions | string, mountpoint?: string): Promise<Record<string, FileFsRef>>;

111
node_modules/@vercel/build-utils/dist/fs/glob.js generated vendored Normal file
View file

@ -0,0 +1,111 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var glob_exports = {};
__export(glob_exports, {
default: () => glob
});
module.exports = __toCommonJS(glob_exports);
var import_path = __toESM(require("path"));
var import_assert = __toESM(require("assert"));
var import_glob = __toESM(require("glob"));
var import_util = require("util");
var import_fs_extra = require("fs-extra");
var import_normalize_path = require("./normalize-path");
var import_file_fs_ref = __toESM(require("../file-fs-ref"));
const vanillaGlob = (0, import_util.promisify)(import_glob.default);
async function glob(pattern, opts, mountpoint) {
const options = typeof opts === "string" ? { cwd: opts } : opts;
if (!options.cwd) {
throw new Error(
"Second argument (basePath) must be specified for names of resulting files"
);
}
if (!import_path.default.isAbsolute(options.cwd)) {
throw new Error(`basePath/cwd must be an absolute path (${options.cwd})`);
}
const results = {};
const statCache = {};
const symlinks = {};
const files = await vanillaGlob(pattern, {
...options,
symlinks,
statCache,
stat: true,
dot: true
});
const dirs = /* @__PURE__ */ new Set();
const dirsWithEntries = /* @__PURE__ */ new Set();
for (const relativePath of files) {
const absPath = import_path.default.join(options.cwd, relativePath);
const fsPath = (0, import_normalize_path.normalizePath)(absPath);
let stat = statCache[fsPath];
(0, import_assert.default)(
stat,
`statCache does not contain value for ${relativePath} (resolved to ${fsPath})`
);
const isSymlink = symlinks[fsPath];
if (options.follow && (isSymlink || (await (0, import_fs_extra.lstat)(fsPath)).isSymbolicLink())) {
const target = await (0, import_fs_extra.readlink)(absPath);
const absTarget = import_path.default.resolve(import_path.default.dirname(absPath), target);
if (import_path.default.relative(options.cwd, absTarget).startsWith(`..${import_path.default.sep}`)) {
continue;
}
}
if (isSymlink || stat.isFile() || stat.isDirectory()) {
if (isSymlink) {
stat = await (0, import_fs_extra.lstat)(absPath);
}
const dirname = import_path.default.dirname(relativePath);
dirsWithEntries.add(dirname);
if (stat.isDirectory()) {
dirs.add(relativePath);
continue;
}
let finalPath = relativePath;
if (mountpoint) {
finalPath = import_path.default.join(mountpoint, finalPath);
}
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
}
}
if (options.includeDirectories) {
for (const relativePath of dirs) {
if (dirsWithEntries.has(relativePath))
continue;
let finalPath = relativePath;
if (mountpoint) {
finalPath = import_path.default.join(mountpoint, finalPath);
}
const fsPath = (0, import_normalize_path.normalizePath)(import_path.default.join(options.cwd, relativePath));
const stat = statCache[fsPath];
results[finalPath] = new import_file_fs_ref.default({ mode: stat.mode, fsPath });
}
}
return results;
}

View file

@ -0,0 +1,13 @@
import { BunVersion, NodeVersion, Version } from '../types';
export type NodeVersionMajor = ReturnType<typeof getOptions>[number]['major'];
export declare const NODE_VERSIONS: NodeVersion[];
export declare const BUN_VERSIONS: BunVersion[];
export declare function getNodeVersionByMajor(major: number): NodeVersion | undefined;
declare function getOptions(): NodeVersion[];
export declare function getAvailableNodeVersions(): NodeVersionMajor[];
export declare function getLatestNodeVersion(availableVersions?: NodeVersionMajor[]): NodeVersion;
export declare function getDiscontinuedNodeVersions(): NodeVersion[];
export declare function getSupportedNodeVersion(engineRange: string | undefined, isAuto?: boolean, availableVersions?: NodeVersionMajor[]): Promise<NodeVersion>;
export declare function getSupportedBunVersion(engineRange: string): BunVersion;
export declare function isBunVersion(version: Version): boolean;
export {};

View file

@ -0,0 +1,222 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var node_version_exports = {};
__export(node_version_exports, {
BUN_VERSIONS: () => BUN_VERSIONS,
NODE_VERSIONS: () => NODE_VERSIONS,
getAvailableNodeVersions: () => getAvailableNodeVersions,
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
getLatestNodeVersion: () => getLatestNodeVersion,
getNodeVersionByMajor: () => getNodeVersionByMajor,
getSupportedBunVersion: () => getSupportedBunVersion,
getSupportedNodeVersion: () => getSupportedNodeVersion,
isBunVersion: () => isBunVersion
});
module.exports = __toCommonJS(node_version_exports);
var import_fs = require("fs");
var import_semver = require("semver");
var import_types = require("../types");
var import_errors = require("../errors");
var import_debug = __toESM(require("../debug"));
const NODE_VERSIONS = [
new import_types.NodeVersion({
major: 24,
range: "24.x",
runtime: "nodejs24.x"
}),
new import_types.NodeVersion({
major: 22,
range: "22.x",
runtime: "nodejs22.x"
}),
new import_types.NodeVersion({
major: 20,
range: "20.x",
runtime: "nodejs20.x"
}),
new import_types.NodeVersion({
major: 18,
range: "18.x",
runtime: "nodejs18.x",
discontinueDate: /* @__PURE__ */ new Date("2025-09-01")
}),
new import_types.NodeVersion({
major: 16,
range: "16.x",
runtime: "nodejs16.x",
discontinueDate: /* @__PURE__ */ new Date("2025-02-03")
}),
new import_types.NodeVersion({
major: 14,
range: "14.x",
runtime: "nodejs14.x",
discontinueDate: /* @__PURE__ */ new Date("2023-08-15")
}),
new import_types.NodeVersion({
major: 12,
range: "12.x",
runtime: "nodejs12.x",
discontinueDate: /* @__PURE__ */ new Date("2022-10-03")
}),
new import_types.NodeVersion({
major: 10,
range: "10.x",
runtime: "nodejs10.x",
discontinueDate: /* @__PURE__ */ new Date("2021-04-20")
}),
new import_types.NodeVersion({
major: 8,
range: "8.10.x",
runtime: "nodejs8.10",
discontinueDate: /* @__PURE__ */ new Date("2020-01-06")
})
];
const BUN_VERSIONS = [
new import_types.BunVersion({
major: 1,
range: "1.x",
runtime: "bun1.x"
})
];
function getNodeVersionByMajor(major) {
return getOptions().find((v) => v.major === major);
}
function getOptions() {
return NODE_VERSIONS;
}
function isNodeVersionAvailable(version) {
const stat = (0, import_fs.statSync)(`/node${version.major}`, { throwIfNoEntry: false });
return stat?.isDirectory() ?? false;
}
function getAvailableNodeVersions() {
return getOptions().filter((v) => v.major >= 18).filter(isNodeVersionAvailable).map((n) => n.major);
}
function getHint(isAuto = false, availableVersions) {
const { major, range } = getLatestNodeVersion(availableVersions);
return isAuto ? `Please set Node.js Version to ${range} in your Project Settings to use Node.js ${major}.` : `Please set "engines": { "node": "${range}" } in your \`package.json\` file to use Node.js ${major}.`;
}
function getLatestNodeVersion(availableVersions) {
const all = getOptions();
if (availableVersions) {
for (const version of all) {
for (const major of availableVersions) {
if (version.major === major) {
return version;
}
}
}
}
return all[0];
}
function getDiscontinuedNodeVersions() {
return getOptions().filter((version) => {
return version.state === "discontinued";
});
}
async function getSupportedNodeVersion(engineRange, isAuto = false, availableVersions) {
let selection;
if (engineRange) {
const found = (0, import_semver.validRange)(engineRange) && getOptions().some((o) => {
selection = o;
return (0, import_semver.intersects)(o.range, engineRange) && (availableVersions?.length ? availableVersions.includes(o.major) : true);
});
if (!found) {
throw new import_errors.NowBuildError({
code: "BUILD_UTILS_NODE_VERSION_INVALID",
link: "https://vercel.link/node-version",
message: `Found invalid or discontinued Node.js Version: "${engineRange}". ${getHint(
isAuto,
availableVersions
)}`
});
}
}
if (!selection) {
selection = getLatestNodeVersion(availableVersions);
}
if (selection.state === "discontinued") {
const intro = `Node.js Version "${selection.range}" is discontinued and must be upgraded.`;
throw new import_errors.NowBuildError({
code: "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
link: "https://vercel.link/node-version",
message: `${intro} ${getHint(isAuto)}`
});
}
(0, import_debug.default)(`Selected Node.js ${selection.range}`);
if (selection.state === "deprecated") {
const d = selection.formattedDate;
if (d) {
console.warn(
`Error: Node.js version ${selection.range} is deprecated. Deployments created on or after ${d} will fail to build. ${getHint(
isAuto
)}`
);
} else {
console.warn(
`Error: Node.js version ${selection.range} is deprecated. ${getHint(
isAuto
)}`
);
}
}
return selection;
}
function getSupportedBunVersion(engineRange) {
if ((0, import_semver.validRange)(engineRange)) {
const selected = BUN_VERSIONS.find((version) => {
return (0, import_semver.intersects)(version.range, engineRange);
});
if (selected) {
return new import_types.BunVersion({
major: selected.major,
range: selected.range,
runtime: selected.runtime
});
}
}
throw new import_errors.NowBuildError({
message: `Found invalid Bun Version: "${engineRange}".`,
code: "BUILD_UTILS_BUN_VERSION_INVALID"
});
}
function isBunVersion(version) {
return version.runtime.startsWith("bun");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUN_VERSIONS,
NODE_VERSIONS,
getAvailableNodeVersions,
getDiscontinuedNodeVersions,
getLatestNodeVersion,
getNodeVersionByMajor,
getSupportedBunVersion,
getSupportedNodeVersion,
isBunVersion
});

View file

@ -0,0 +1,4 @@
/**
* Convert Windows separators to Unix separators.
*/
export declare function normalizePath(p: string): string;

View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var normalize_path_exports = {};
__export(normalize_path_exports, {
normalizePath: () => normalizePath
});
module.exports = __toCommonJS(normalize_path_exports);
const isWin = process.platform === "win32";
function normalizePath(p) {
return isWin ? p.replace(/\\/g, "/") : p;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
normalizePath
});

View file

@ -0,0 +1,7 @@
import type { PackageJson } from '../types';
export declare function readConfigFile<T>(files: string | string[]): Promise<T | null>;
/**
* Reads and parses the package.json file from a directory.
* Returns an empty object if the file doesn't exist or can't be parsed.
*/
export declare function getPackageJson(dir: string): Promise<PackageJson>;

View file

@ -0,0 +1,87 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var read_config_file_exports = {};
__export(read_config_file_exports, {
getPackageJson: () => getPackageJson,
readConfigFile: () => readConfigFile
});
module.exports = __toCommonJS(read_config_file_exports);
var import_js_yaml = __toESM(require("js-yaml"));
var import_toml = __toESM(require("@iarna/toml"));
var import_fs_extra = require("fs-extra");
var import_error_utils = require("@vercel/error-utils");
var import_path = require("path");
async function readFileOrNull(file) {
try {
const data = await (0, import_fs_extra.readFile)(file);
return data;
} catch (error) {
if (!(0, import_error_utils.isErrnoException)(error)) {
throw error;
}
if (error.code !== "ENOENT") {
throw error;
}
}
return null;
}
async function readConfigFile(files) {
files = Array.isArray(files) ? files : [files];
for (const name of files) {
const data = await readFileOrNull(name);
if (data) {
const str = data.toString("utf8");
try {
if (name.endsWith(".json")) {
return JSON.parse(str);
} else if (name.endsWith(".toml")) {
return import_toml.default.parse(str);
} else if (name.endsWith(".yaml") || name.endsWith(".yml")) {
return import_js_yaml.default.safeLoad(str, { filename: name });
}
} catch (error) {
console.log(`Error while parsing config file: "${name}"`);
}
}
}
return null;
}
async function getPackageJson(dir) {
const packagePath = (0, import_path.join)(dir, "package.json");
try {
return JSON.parse(await (0, import_fs_extra.readFile)(packagePath, "utf8"));
} catch (err) {
return {};
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPackageJson,
readConfigFile
});

11
node_modules/@vercel/build-utils/dist/fs/rename.d.ts generated vendored Normal file
View file

@ -0,0 +1,11 @@
import { Files } from '../types';
type Delegate = (name: string) => string;
/**
* Renames the keys of a `Files` map.
*
* @param files A map of filenames to `File` instances
* @param delegate A function that returns the new filename
* @returns A new file map with the renamed filenames
*/
export default function rename(files: Files, delegate: Delegate): Files;
export {};

30
node_modules/@vercel/build-utils/dist/fs/rename.js generated vendored Normal file
View file

@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var rename_exports = {};
__export(rename_exports, {
default: () => rename
});
module.exports = __toCommonJS(rename_exports);
function rename(files, delegate) {
const result = {};
for (const [name, file] of Object.entries(files)) {
result[delegate(name)] = file;
}
return result;
}

View file

@ -0,0 +1,230 @@
/// <reference types="node" />
import { SpawnOptions } from 'child_process';
import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
export interface FindPackageJsonResult {
/**
* The file path of found `package.json` file, or `undefined` if not found.
*/
packageJsonPath?: string;
/**
* The contents of found `package.json` file, when the `readPackageJson`
* option is enabled.
*/
packageJson?: PackageJson;
}
export interface ScanParentDirsResult extends FindPackageJsonResult {
/**
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
*/
cliType: CliType;
/**
* The file path of the lockfile (`yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`)
* or `undefined` if not found.
*/
lockfilePath?: string;
/**
* The `lockfileVersion` number from lockfile (`package-lock.json` or `pnpm-lock.yaml`),
* or `undefined` if not found.
*/
lockfileVersion?: number;
/**
* The contents of the `packageManager` field from `package.json` if found.
* The value may come from a different `package.json` file than the one
* specified by `packageJsonPath`, in the case of a monorepo.
*/
packageJsonPackageManager?: string;
/**
* Whether Turborepo supports the `COREPACK_HOME` environment variable.
* `undefined` if not a Turborepo project.
*/
turboSupportsCorepackHome?: boolean;
}
export interface TraverseUpDirectoriesProps {
/**
* The directory to start iterating from, typically the same directory of the entrypoint.
*/
start: string;
/**
* The highest directory, typically the workPath root of the project.
*/
base?: string;
}
export interface WalkParentDirsProps extends Required<TraverseUpDirectoriesProps> {
/**
* The name of the file to search for, typically `package.json` or `Gemfile`.
*/
filename: string;
}
export interface WalkParentDirsMultiProps extends Required<TraverseUpDirectoriesProps> {
/**
* The name of the file to search for, typically `package.json` or `Gemfile`.
*/
filenames: string[];
}
export interface SpawnOptionsExtended extends SpawnOptions {
/**
* Pretty formatted command that is being spawned for logging purposes.
*/
prettyCommand?: string;
/**
* Returns instead of throwing an error when the process exits with a
* non-0 exit code. When relevant, the returned object will include
* the error code, stdout and stderr.
*/
ignoreNon0Exit?: boolean;
}
export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>;
export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess;
export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>;
export declare function traverseUpDirectories({ start, base, }: TraverseUpDirectoriesProps): Generator<string, void, unknown>;
/**
* @deprecated Use `getNodeBinPaths()` instead.
*/
export declare function getNodeBinPath({ cwd, }: {
cwd: string;
}): Promise<string>;
export declare function getNodeBinPaths({ start, base, }: TraverseUpDirectoriesProps): string[];
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
/**
* @deprecated Don't use this function directly.
*
* Use getEnvForPackageManager() instead when within a builder.
*/
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
export declare function getNodeVersion(destPath: string, fallbackVersion?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion | BunVersion>;
/**
* Traverses up directories to find and optionally read package.json.
* This is a lightweight alternative to `scanParentDirs` when only
* package.json information is needed (without lockfile detection).
*/
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
export declare function turboVersionSpecifierSupportsCorepack(turboVersionSpecifier: string): boolean;
export declare function usingCorepack(env: {
[x: string]: string | undefined;
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
/**
* Reset the customInstallCommandSet. This should be called at the start of each build
* to prevent custom install commands from being skipped due to the set persisting
* across multiple builds in the same Node process (e.g., in unit tests).
*/
export declare function resetCustomInstallCommandSet(): void;
export declare function runNpmInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta, projectCreatedAt?: number): Promise<boolean>;
/**
* Prepares the input environment based on the used package manager and lockfile
* versions.
*/
export declare function getEnvForPackageManager({ cliType, lockfileVersion, packageJsonPackageManager, env, packageJsonEngines, turboSupportsCorepackHome, projectCreatedAt, }: {
cliType: CliType;
lockfileVersion: number | undefined;
packageJsonPackageManager?: string | undefined;
env: {
[x: string]: string | undefined;
};
packageJsonEngines?: PackageJson.Engines;
turboSupportsCorepackHome?: boolean | undefined;
projectCreatedAt?: number | undefined;
}): {
[x: string]: string | undefined;
};
export declare const PNPM_10_PREFERRED_AT: Date;
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.
*/
export declare function getPathOverrideForPackageManager({ cliType, lockfileVersion, corepackPackageManager, corepackEnabled, packageJsonEngines, projectCreatedAt, }: {
cliType: CliType;
lockfileVersion: number | undefined;
corepackPackageManager: string | undefined;
corepackEnabled?: boolean;
packageJsonEngines?: PackageJson.Engines;
projectCreatedAt?: number;
}): {
/**
* Which lockfile was detected.
*/
detectedLockfile: string | undefined;
/**
* Detected package manager that generated the found lockfile.
*/
detectedPackageManager: string | undefined;
/**
* Value of $PATH that includes the binaries for the detected package manager.
* Undefined if no $PATH are necessary.
*/
path: string | undefined;
};
export declare function detectPackageManager(cliType: CliType, lockfileVersion: number | undefined, projectCreatedAt?: number): {
path: string;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange: string;
} | {
path: string;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange?: undefined;
} | {
path: undefined;
detectedLockfile: string;
detectedPackageManager: string;
pnpmVersionRange?: undefined;
} | undefined;
/**
* Helper to get the binary paths that link to the used package manager.
* Note: Make sure it doesn't contain any `console.log` calls.
* @deprecated use `getEnvForPackageManager` instead
*/
export declare function getPathForPackageManager({ cliType, lockfileVersion, env, }: {
cliType: CliType;
lockfileVersion: number | undefined;
env: {
[x: string]: string | undefined;
};
}): {
/**
* Which lockfile was detected.
*/
detectedLockfile: string | undefined;
/**
* Detected package manager that generated the found lockfile.
*/
detectedPackageManager: string | undefined;
/**
* Value of $PATH that includes the binaries for the detected package manager.
* Undefined if no $PATH are necessary.
*/
path: string | undefined;
/**
* Set if yarn was identified as package manager and `YARN_NODE_LINKER`
* environment variable was not found on the input environment.
*/
yarnNodeLinker: string | undefined;
};
export declare function runCustomInstallCommand({ destPath, installCommand, spawnOpts, projectCreatedAt, }: {
destPath: string;
installCommand: string;
spawnOpts?: SpawnOptions;
projectCreatedAt?: number;
}): Promise<boolean>;
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions, projectCreatedAt?: number): Promise<boolean>;
export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
export type PipInstallResult = {
installed: false;
} | {
installed: true;
/**
* The directory where packages were installed.
* Add this to PYTHONPATH when running Python commands.
*/
targetDir: string;
};
export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<PipInstallResult>;
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | undefined;
/**
* @deprecate installDependencies() is deprecated.
* Please use runNpmInstall() instead.
*/
export declare const installDependencies: typeof runNpmInstall;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
/// <reference types="node" />
/// <reference types="node" />
export default function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>;
export declare function streamToBufferChunks(stream: NodeJS.ReadableStream, chunkSize?: number): Promise<Buffer[]>;

View file

@ -0,0 +1,87 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stream_to_buffer_exports = {};
__export(stream_to_buffer_exports, {
default: () => streamToBuffer,
streamToBufferChunks: () => streamToBufferChunks
});
module.exports = __toCommonJS(stream_to_buffer_exports);
var import_end_of_stream = __toESM(require("end-of-stream"));
function streamToBuffer(stream) {
return new Promise((resolve, reject) => {
const buffers = [];
stream.on("data", buffers.push.bind(buffers));
(0, import_end_of_stream.default)(stream, (err) => {
if (err) {
reject(err);
return;
}
switch (buffers.length) {
case 0:
resolve(Buffer.allocUnsafe(0));
break;
case 1:
resolve(buffers[0]);
break;
default:
resolve(Buffer.concat(buffers));
}
});
});
}
const MB = 1024 * 1024;
async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
const chunks = [];
let currentChunk = [];
let currentSize = 0;
for await (const chunk of stream) {
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
let offset = 0;
while (offset < buffer.length) {
const remainingSpace = chunkSize - currentSize;
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
currentChunk.push(buffer.slice(offset, offset + sliceSize));
currentSize += sliceSize;
offset += sliceSize;
if (currentSize >= chunkSize) {
chunks.push(Buffer.concat(currentChunk));
currentChunk = [];
currentSize = 0;
}
}
}
if (currentChunk.length > 0) {
chunks.push(Buffer.concat(currentChunk));
}
return chunks;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
streamToBufferChunks
});

View file

@ -0,0 +1,17 @@
import { BuildV3, Config } from './types';
import type FileFsRef from './file-fs-ref';
export declare function generateNodeBuilderFunctions(frameworkName: string, regex: RegExp, validFilenames: string[], validExtensions: string[], nodeBuild: any, // necessary to avoid circular dependency
opts?: {
checks?: (info: {
config: Config;
isBun: boolean;
}) => void;
}): {
require_: NodeRequire;
findEntrypoint: (files: Record<string, FileFsRef>) => {
entrypoint: string;
entrypointsNotMatchingRegex: string[];
};
build: BuildV3;
entrypointCallback: (args: Parameters<BuildV3>[0]) => Promise<string>;
};

View file

@ -0,0 +1,198 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var generate_node_builder_functions_exports = {};
__export(generate_node_builder_functions_exports, {
generateNodeBuilderFunctions: () => generateNodeBuilderFunctions
});
module.exports = __toCommonJS(generate_node_builder_functions_exports);
var import_glob = __toESM(require("./fs/glob"));
var import_node_path = require("node:path");
var import_node_fs = __toESM(require("node:fs"));
var import_node_module = require("node:module");
function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, validExtensions, nodeBuild, opts) {
const entrypointsForMessage = validFilenames.map((filename) => `- ${filename}.{${validExtensions.join(",")}}`).join("\n");
const require_ = (0, import_node_module.createRequire)(__filename);
const build = async (args) => {
process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS = "1";
const includeFiles = ["views/**/*"];
const includeFilesFromConfig = args.config.includeFiles;
if (includeFilesFromConfig) {
includeFiles.push(...includeFilesFromConfig);
}
const res = await nodeBuild({
...args,
config: {
...args.config,
includeFiles
},
// this is package.json, but we'll replace it with the return value of the entrypointCallback
// after install and build scripts have had a chance to run
entrypoint: "package.json",
considerBuildCommand: true,
entrypointCallback: async () => {
return entrypointCallback(args);
},
checks: opts?.checks ?? (() => {
})
});
let version = void 0;
try {
const resolved = require_.resolve(`${frameworkName}/package.json`, {
paths: [args.workPath]
});
const frameworkVersion = require_(resolved).version;
if (frameworkVersion) {
version = frameworkVersion;
}
} catch (e) {
}
res.output.framework = {
slug: frameworkName,
version
};
return res;
};
const entrypointCallback = async (args) => {
const mainPackageEntrypoint = findMainPackageEntrypoint(args.files);
const entrypointGlob = `{${validFilenames.map((entrypoint) => `${entrypoint}`).join(",")}}.{${validExtensions.join(",")}}`;
const dir = args.config.projectSettings?.outputDirectory?.replace(
/^\/+|\/+$/g,
""
);
if (dir) {
const {
entrypoint: entrypointFromOutputDir,
entrypointsNotMatchingRegex: entrypointsNotMatchingRegex2
} = findEntrypoint(await (0, import_glob.default)(entrypointGlob, (0, import_node_path.join)(args.workPath, dir)));
if (entrypointFromOutputDir) {
return (0, import_node_path.join)(dir, entrypointFromOutputDir);
}
if (entrypointsNotMatchingRegex2.length > 0) {
throw new Error(
`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex2.length)}: ${entrypointsNotMatchingRegex2.join(", ")}`
);
}
throw new Error(
`No entrypoint found in output directory: "${dir}". Searched for:
${entrypointsForMessage}`
);
}
const files = await (0, import_glob.default)(entrypointGlob, args.workPath);
const { entrypoint: entrypointFromRoot, entrypointsNotMatchingRegex } = findEntrypoint(files);
if (entrypointFromRoot) {
return entrypointFromRoot;
}
if (mainPackageEntrypoint) {
const entrypointFromPackageJson = await (0, import_glob.default)(
mainPackageEntrypoint,
args.workPath
);
if (entrypointFromPackageJson[mainPackageEntrypoint]) {
if (checkMatchesRegex(entrypointFromPackageJson[mainPackageEntrypoint])) {
return mainPackageEntrypoint;
}
}
}
if (entrypointsNotMatchingRegex.length > 0) {
throw new Error(
`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint", entrypointsNotMatchingRegex.length)}: ${entrypointsNotMatchingRegex.join(", ")}`
);
}
throw new Error(
`No entrypoint found. Searched for:
${entrypointsForMessage}`
);
};
function pluralize(word, count) {
return count === 1 ? word : `${word}s`;
}
const findEntrypoint = (files) => {
const allEntrypoints = validFilenames.flatMap(
(filename) => validExtensions.map((extension) => `${filename}.${extension}`)
);
const possibleEntrypointsInFiles = allEntrypoints.filter((entrypoint2) => {
return files[entrypoint2] !== void 0;
});
const entrypointsMatchingRegex = possibleEntrypointsInFiles.filter(
(entrypoint2) => {
const file = files[entrypoint2];
return checkMatchesRegex(file);
}
);
const entrypointsNotMatchingRegex = possibleEntrypointsInFiles.filter(
(entrypoint2) => {
const file = files[entrypoint2];
return !checkMatchesRegex(file);
}
);
const entrypoint = entrypointsMatchingRegex[0];
if (entrypointsMatchingRegex.length > 1) {
console.warn(
`Multiple entrypoints found: ${entrypointsMatchingRegex.join(", ")}. Using ${entrypoint}.`
);
}
return {
entrypoint,
entrypointsNotMatchingRegex
};
};
const checkMatchesRegex = (file) => {
const content = import_node_fs.default.readFileSync(file.fsPath, "utf-8");
const matchesContent = content.match(regex);
return matchesContent !== null;
};
const findMainPackageEntrypoint = (files) => {
const packageJson = files["package.json"];
if (packageJson) {
if (packageJson.type === "FileFsRef") {
const packageJsonContent = import_node_fs.default.readFileSync(packageJson.fsPath, "utf-8");
let packageJsonJson;
try {
packageJsonJson = JSON.parse(packageJsonContent);
} catch (_e) {
packageJsonJson = {};
}
if ("main" in packageJsonJson && typeof packageJsonJson.main === "string") {
return packageJsonJson.main;
}
}
}
return null;
};
return {
require_,
findEntrypoint,
build,
entrypointCallback
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
generateNodeBuilderFunctions
});

View file

@ -0,0 +1 @@
export default function (downloadPath: string, rootDirectory?: string | undefined): Promise<(p: string) => any>;

View file

@ -0,0 +1,90 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_ignore_filter_exports = {};
__export(get_ignore_filter_exports, {
default: () => get_ignore_filter_default
});
module.exports = __toCommonJS(get_ignore_filter_exports);
var import_path = __toESM(require("path"));
var import_fs_extra = __toESM(require("fs-extra"));
var import_ignore = __toESM(require("ignore"));
function isCodedError(error) {
return error !== null && error !== void 0 && error.code !== void 0;
}
function clearRelative(s) {
return s.replace(/(\n|^)\.\//g, "$1");
}
async function get_ignore_filter_default(downloadPath, rootDirectory) {
const readFile = async (p) => {
try {
return await import_fs_extra.default.readFile(p, "utf8");
} catch (error) {
if (error.code === "ENOENT" || error instanceof Error && error.message.includes("ENOENT")) {
return void 0;
}
throw error;
}
};
const vercelIgnorePath = import_path.default.join(
downloadPath,
rootDirectory || "",
".vercelignore"
);
const nowIgnorePath = import_path.default.join(
downloadPath,
rootDirectory || "",
".nowignore"
);
const ignoreContents = [];
try {
ignoreContents.push(
...(await Promise.all([readFile(vercelIgnorePath), readFile(nowIgnorePath)])).filter(Boolean)
);
} catch (error) {
if (isCodedError(error) && error.code === "ENOTDIR") {
console.log(`Warning: Cannot read ignore file from ${vercelIgnorePath}`);
} else {
throw error;
}
}
if (ignoreContents.length === 2) {
throw new Error(
"Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file."
);
}
if (ignoreContents.length === 0) {
return () => false;
}
const ignoreFilter = (0, import_ignore.default)().add(clearRelative(ignoreContents[0]));
return function(p) {
if (p === "now.json" || p === "vercel.json")
return false;
return ignoreFilter.test(p).ignored;
};
}

View file

@ -0,0 +1 @@
export declare function getInstalledPackageVersion(packageName: string, path?: string | string[]): Promise<string | undefined>;

View file

@ -0,0 +1,53 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_installed_package_version_exports = {};
__export(get_installed_package_version_exports, {
getInstalledPackageVersion: () => getInstalledPackageVersion
});
module.exports = __toCommonJS(get_installed_package_version_exports);
var import_debug = __toESM(require("./debug"));
async function getInstalledPackageVersion(packageName, path) {
try {
const resolved = require.resolve(`${packageName}/package.json`, {
paths: path ? Array.isArray(path) ? path : [path] : [process.cwd()]
});
const version = require(resolved).version;
return version;
} catch (err) {
(0, import_debug.default)(
`Could not resolve package "${packageName}". Package is not installed.`,
err
);
return void 0;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getInstalledPackageVersion
});

View file

@ -0,0 +1,5 @@
/**
* Helper function to support both `VERCEL_` and legacy `NOW_` env vars.
* Throws an error if *both* env vars are defined.
*/
export declare const getPlatformEnv: (name: string) => string | undefined;

View file

@ -0,0 +1,45 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_platform_env_exports = {};
__export(get_platform_env_exports, {
getPlatformEnv: () => getPlatformEnv
});
module.exports = __toCommonJS(get_platform_env_exports);
var import_errors = require("./errors");
const getPlatformEnv = (name) => {
const vName = `VERCEL_${name}`;
const nName = `NOW_${name}`;
const v = process.env[vName];
const n = process.env[nName];
if (typeof v === "string") {
if (typeof n === "string") {
throw new import_errors.NowBuildError({
code: "CONFLICTING_ENV_VAR_NAMES",
message: `Both "${vName}" and "${nName}" env vars are defined. Please only define the "${vName}" env var.`,
link: "https://vercel.link/combining-old-and-new-config"
});
}
return v;
}
return n;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPlatformEnv
});

View file

@ -0,0 +1,14 @@
type Envs = {
[key: string]: string | undefined;
};
/**
* Get the framework-specific prefixed System Environment Variables.
* See https://vercel.com/docs/concepts/projects/environment-variables#system-environment-variables
* @param envPrefix - Prefix, typically from `@vercel/frameworks`
* @param envs - Environment Variables, typically from `process.env`
*/
export declare function getPrefixedEnvVars({ envPrefix, envs, }: {
envPrefix: string | undefined;
envs: Envs;
}): Envs;
export {};

View file

@ -0,0 +1,54 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_prefixed_env_vars_exports = {};
__export(get_prefixed_env_vars_exports, {
getPrefixedEnvVars: () => getPrefixedEnvVars
});
module.exports = __toCommonJS(get_prefixed_env_vars_exports);
function getPrefixedEnvVars({
envPrefix,
envs
}) {
const vercelSystemEnvPrefix = "VERCEL_";
const allowed = [
"VERCEL_URL",
"VERCEL_ENV",
"VERCEL_TARGET_ENV",
"VERCEL_REGION",
"VERCEL_BRANCH_URL",
"VERCEL_PROJECT_PRODUCTION_URL",
"VERCEL_DEPLOYMENT_ID",
"VERCEL_PROJECT_ID"
];
const newEnvs = {};
if (envPrefix && envs.VERCEL_URL) {
Object.keys(envs).filter((key) => allowed.includes(key) || key.startsWith("VERCEL_GIT_")).forEach((key) => {
const newKey = `${envPrefix}${key}`;
if (!(newKey in envs)) {
newEnvs[newKey] = envs[key];
}
});
newEnvs.TURBO_CI_VENDOR_ENV_KEY = `${envPrefix}${vercelSystemEnvPrefix}`;
}
return newEnvs;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPrefixedEnvVars
});

View file

@ -0,0 +1 @@
export declare function hardLinkDir(src: string, destDirs: string[]): Promise<void>;

104
node_modules/@vercel/build-utils/dist/hard-link-dir.js generated vendored Normal file
View file

@ -0,0 +1,104 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var hard_link_dir_exports = {};
__export(hard_link_dir_exports, {
hardLinkDir: () => hardLinkDir
});
module.exports = __toCommonJS(hard_link_dir_exports);
var import_path = __toESM(require("path"));
var import_fs = require("fs");
async function hardLinkDir(src, destDirs) {
if (destDirs.length === 0)
return;
destDirs = destDirs.filter((destDir) => import_path.default.relative(destDir, src) !== "");
const files = await import_fs.promises.readdir(src);
await Promise.all(
files.map(async (file) => {
if (file === "node_modules")
return;
const srcFile = import_path.default.join(src, file);
if ((await import_fs.promises.lstat(srcFile)).isDirectory()) {
const destSubdirs = await Promise.all(
destDirs.map(async (destDir) => {
const destSubdir = import_path.default.join(destDir, file);
try {
await import_fs.promises.mkdir(destSubdir, { recursive: true });
} catch (err) {
if (err.code !== "EEXIST")
throw err;
}
return destSubdir;
})
);
await hardLinkDir(srcFile, destSubdirs);
return;
}
await Promise.all(
destDirs.map(async (destDir) => {
const destFile = import_path.default.join(destDir, file);
try {
await linkOrCopyFile(srcFile, destFile);
} catch (err) {
if (err.code === "ENOENT") {
return;
}
throw err;
}
})
);
})
);
}
async function linkOrCopyFile(srcFile, destFile) {
try {
await linkOrCopy(srcFile, destFile);
} catch (err) {
if (err.code === "ENOENT") {
await import_fs.promises.mkdir(import_path.default.dirname(destFile), { recursive: true });
await linkOrCopy(srcFile, destFile);
return;
}
if (err.code !== "EEXIST") {
throw err;
}
}
}
async function linkOrCopy(srcFile, destFile) {
try {
await import_fs.promises.link(srcFile, destFile);
} catch (err) {
if (err.code !== "EXDEV")
throw err;
await import_fs.promises.copyFile(srcFile, destFile);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
hardLinkDir
});

36
node_modules/@vercel/build-utils/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,36 @@
import FileBlob from './file-blob';
import FileFsRef from './file-fs-ref';
import FileRef from './file-ref';
import { Lambda, createLambda, getLambdaOptionsFromFunction } from './lambda';
import { NodejsLambda } from './nodejs-lambda';
import { Prerender } from './prerender';
import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory } from './fs/download';
import getWriteableDirectory from './fs/get-writable-directory';
import glob, { GlobOptions } from './fs/glob';
import rename from './fs/rename';
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, findPackageJson, traverseUpDirectories, PipInstallResult } from './fs/run-user-scripts';
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion } from './fs/node-version';
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
import debug from './debug';
import getIgnoreFilter from './get-ignore-filter';
import { getPlatformEnv } from './get-platform-env';
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
import { cloneEnv } from './clone-env';
import { hardLinkDir } from './hard-link-dir';
import { validateNpmrc } from './validate-npmrc';
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
export { EdgeFunction } from './edge-function';
export { readConfigFile, getPackageJson } from './fs/read-config-file';
export { normalizePath } from './fs/normalize-path';
export { getOsRelease, getProvidedRuntime } from './os';
export * from './should-serve';
export * from './schemas';
export * from './types';
export * from './errors';
export * from './trace';
export { NODE_VERSIONS } from './fs/node-version';
export { getInstalledPackageVersion } from './get-installed-package-version';
export { defaultCachePathGlob } from './default-cache-path-glob';
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
export { BACKEND_FRAMEWORKS, BackendFramework, isBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
export * from './python';

26940
node_modules/@vercel/build-utils/dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

138
node_modules/@vercel/build-utils/dist/lambda.d.ts generated vendored Normal file
View file

@ -0,0 +1,138 @@
/// <reference types="node" />
import type { Config, Env, Files, FunctionFramework, TriggerEvent } from './types';
export type { TriggerEvent };
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
export type LambdaExecutableRuntimeLanguages = 'rust' | 'go';
export type LambdaArchitecture = 'x86_64' | 'arm64';
export interface LambdaOptionsBase {
handler: string;
runtime: string;
runtimeLanguage?: LambdaExecutableRuntimeLanguages;
architecture?: LambdaArchitecture;
memory?: number;
maxDuration?: number;
environment?: Env;
allowQuery?: string[];
regions?: string[];
supportsMultiPayloads?: boolean;
supportsWrapper?: boolean;
supportsResponseStreaming?: boolean;
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
experimentalResponseStreaming?: boolean;
operationType?: string;
framework?: FunctionFramework;
/**
* Experimental trigger event definitions that this Lambda can receive.
* Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
* Currently supports queue triggers for Vercel's queue system.
*
* The delivery configuration provides HINTS to the system about preferred
* execution behavior (concurrency, retries) but these are NOT guarantees.
* The system may disregard these hints based on resource constraints.
*
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
* of delivery configuration. Callers receive immediate responses.
*
* @experimental This feature is experimental and may change.
*/
experimentalTriggers?: TriggerEvent[];
/**
* Whether this Lambda supports cancellation.
* When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
*/
supportsCancellation?: boolean;
/**
* Whether to disable automatic fetch instrumentation.
* When true, the Function runtime will not automatically instrument fetch calls.
*/
shouldDisableAutomaticFetchInstrumentation?: boolean;
}
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
files: Files;
experimentalAllowBundling?: boolean;
}
/**
* @deprecated Use `LambdaOptionsWithFiles` instead.
*/
export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
/**
* @deprecated Use `files` property instead.
*/
zipBuffer: Buffer;
}
interface GetLambdaOptionsFromFunctionOptions {
sourceFile: string;
config?: Pick<Config, 'functions'>;
}
export declare class Lambda {
type: 'Lambda';
/**
* This is a label for the type of Lambda a framework is producing.
* The value can be any string that makes sense for a given framework.
* Examples: "API", "ISR", "SSR", "SSG", "Render", "Resource"
*/
operationType?: string;
files?: Files;
handler: string;
runtime: string;
/**
* When using a generic runtime such as "executable" or "provided" (custom runtimes),
* this field can be used to specify the language the executable was compiled with.
*/
runtimeLanguage?: LambdaExecutableRuntimeLanguages;
architecture: LambdaArchitecture;
memory?: number;
maxDuration?: number;
environment: Env;
allowQuery?: string[];
regions?: string[];
/**
* @deprecated Use `await lambda.createZip()` instead.
*/
zipBuffer?: Buffer;
supportsMultiPayloads?: boolean;
supportsWrapper?: boolean;
supportsResponseStreaming?: boolean;
framework?: FunctionFramework;
experimentalAllowBundling?: boolean;
/**
* Experimental trigger event definitions that this Lambda can receive.
* Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
* Currently supports queue triggers for Vercel's queue system.
*
* The delivery configuration provides HINTS to the system about preferred
* execution behavior (concurrency, retries) but these are NOT guarantees.
* The system may disregard these hints based on resource constraints.
*
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
* of delivery configuration. Callers receive immediate responses.
*
* @experimental This feature is experimental and may change.
*/
experimentalTriggers?: TriggerEvent[];
/**
* Whether this Lambda supports cancellation.
* When true, the Lambda runtime can be terminated mid-execution if the request is cancelled.
*/
supportsCancellation?: boolean;
/**
* Whether to disable automatic fetch instrumentation.
* When true, the Function runtime will not automatically instrument fetch calls.
*/
shouldDisableAutomaticFetchInstrumentation?: boolean;
constructor(opts: LambdaOptions);
createZip(): Promise<Buffer>;
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
get experimentalResponseStreaming(): boolean | undefined;
set experimentalResponseStreaming(v: boolean | undefined);
}
/**
* @deprecated Use `new Lambda()` instead.
*/
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
export declare function createZip(files: Files): Promise<Buffer>;
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'experimentalTriggers' | 'supportsCancellation'>>;

339
node_modules/@vercel/build-utils/dist/lambda.js generated vendored Normal file
View file

@ -0,0 +1,339 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var lambda_exports = {};
__export(lambda_exports, {
Lambda: () => Lambda,
createLambda: () => createLambda,
createZip: () => createZip,
getLambdaOptionsFromFunction: () => getLambdaOptionsFromFunction
});
module.exports = __toCommonJS(lambda_exports);
var import_assert = __toESM(require("assert"));
var import_async_sema = __toESM(require("async-sema"));
var import_yazl = require("yazl");
var import_minimatch = __toESM(require("minimatch"));
var import_fs_extra = require("fs-extra");
var import_download = require("./fs/download");
var import_stream_to_buffer = __toESM(require("./fs/stream-to-buffer"));
function getDefaultLambdaArchitecture(architecture) {
if (architecture) {
return architecture;
}
switch (process.arch) {
case "arm":
case "arm64": {
return "arm64";
}
default: {
return "x86_64";
}
}
}
class Lambda {
constructor(opts) {
const {
handler,
runtime,
runtimeLanguage,
maxDuration,
architecture,
memory,
environment = {},
allowQuery,
regions,
supportsMultiPayloads,
supportsWrapper,
supportsResponseStreaming,
experimentalResponseStreaming,
operationType,
framework,
experimentalTriggers,
supportsCancellation,
shouldDisableAutomaticFetchInstrumentation
} = opts;
if ("files" in opts) {
(0, import_assert.default)(typeof opts.files === "object", '"files" must be an object');
}
if ("zipBuffer" in opts) {
(0, import_assert.default)(Buffer.isBuffer(opts.zipBuffer), '"zipBuffer" must be a Buffer');
}
(0, import_assert.default)(typeof handler === "string", '"handler" is not a string');
(0, import_assert.default)(typeof runtime === "string", '"runtime" is not a string');
(0, import_assert.default)(typeof environment === "object", '"environment" is not an object');
if (architecture !== void 0) {
(0, import_assert.default)(
architecture === "x86_64" || architecture === "arm64",
'"architecture" must be either "x86_64" or "arm64"'
);
}
if (runtimeLanguage !== void 0) {
(0, import_assert.default)(
runtimeLanguage === "rust" || runtimeLanguage === "go",
'"runtimeLanguage" is invalid. Valid options: "rust", "go"'
);
}
if ("experimentalAllowBundling" in opts && opts.experimentalAllowBundling !== void 0) {
(0, import_assert.default)(
typeof opts.experimentalAllowBundling === "boolean",
'"experimentalAllowBundling" is not a boolean'
);
}
if (memory !== void 0) {
(0, import_assert.default)(typeof memory === "number", '"memory" is not a number');
}
if (maxDuration !== void 0) {
(0, import_assert.default)(typeof maxDuration === "number", '"maxDuration" is not a number');
}
if (allowQuery !== void 0) {
(0, import_assert.default)(Array.isArray(allowQuery), '"allowQuery" is not an Array');
(0, import_assert.default)(
allowQuery.every((q) => typeof q === "string"),
'"allowQuery" is not a string Array'
);
}
if (supportsMultiPayloads !== void 0) {
(0, import_assert.default)(
typeof supportsMultiPayloads === "boolean",
'"supportsMultiPayloads" is not a boolean'
);
}
if (supportsWrapper !== void 0) {
(0, import_assert.default)(
typeof supportsWrapper === "boolean",
'"supportsWrapper" is not a boolean'
);
}
if (regions !== void 0) {
(0, import_assert.default)(Array.isArray(regions), '"regions" is not an Array');
(0, import_assert.default)(
regions.every((r) => typeof r === "string"),
'"regions" is not a string Array'
);
}
if (framework !== void 0) {
(0, import_assert.default)(typeof framework === "object", '"framework" is not an object');
(0, import_assert.default)(
typeof framework.slug === "string",
'"framework.slug" is not a string'
);
if (framework.version !== void 0) {
(0, import_assert.default)(
typeof framework.version === "string",
'"framework.version" is not a string'
);
}
}
if (experimentalTriggers !== void 0) {
(0, import_assert.default)(
Array.isArray(experimentalTriggers),
'"experimentalTriggers" is not an Array'
);
for (let i = 0; i < experimentalTriggers.length; i++) {
const trigger = experimentalTriggers[i];
const prefix = `"experimentalTriggers[${i}]"`;
(0, import_assert.default)(
typeof trigger === "object" && trigger !== null,
`${prefix} is not an object`
);
(0, import_assert.default)(
trigger.type === "queue/v1beta",
`${prefix}.type must be "queue/v1beta"`
);
(0, import_assert.default)(
typeof trigger.topic === "string",
`${prefix}.topic is required and must be a string`
);
(0, import_assert.default)(trigger.topic.length > 0, `${prefix}.topic cannot be empty`);
(0, import_assert.default)(
typeof trigger.consumer === "string",
`${prefix}.consumer is required and must be a string`
);
(0, import_assert.default)(
trigger.consumer.length > 0,
`${prefix}.consumer cannot be empty`
);
if (trigger.maxDeliveries !== void 0) {
(0, import_assert.default)(
typeof trigger.maxDeliveries === "number",
`${prefix}.maxDeliveries must be a number`
);
(0, import_assert.default)(
Number.isInteger(trigger.maxDeliveries) && trigger.maxDeliveries >= 1,
`${prefix}.maxDeliveries must be at least 1`
);
}
if (trigger.retryAfterSeconds !== void 0) {
(0, import_assert.default)(
typeof trigger.retryAfterSeconds === "number",
`${prefix}.retryAfterSeconds must be a number`
);
(0, import_assert.default)(
trigger.retryAfterSeconds > 0,
`${prefix}.retryAfterSeconds must be a positive number`
);
}
if (trigger.initialDelaySeconds !== void 0) {
(0, import_assert.default)(
typeof trigger.initialDelaySeconds === "number",
`${prefix}.initialDelaySeconds must be a number`
);
(0, import_assert.default)(
trigger.initialDelaySeconds >= 0,
`${prefix}.initialDelaySeconds must be a non-negative number`
);
}
if (trigger.maxConcurrency !== void 0) {
(0, import_assert.default)(
typeof trigger.maxConcurrency === "number",
`${prefix}.maxConcurrency must be a number`
);
(0, import_assert.default)(
Number.isInteger(trigger.maxConcurrency) && trigger.maxConcurrency >= 1,
`${prefix}.maxConcurrency must be at least 1`
);
}
}
}
if (supportsCancellation !== void 0) {
(0, import_assert.default)(
typeof supportsCancellation === "boolean",
'"supportsCancellation" is not a boolean'
);
}
this.type = "Lambda";
this.operationType = operationType;
this.files = "files" in opts ? opts.files : void 0;
this.handler = handler;
this.runtime = runtime;
this.runtimeLanguage = runtimeLanguage;
this.architecture = getDefaultLambdaArchitecture(architecture);
this.memory = memory;
this.maxDuration = maxDuration;
this.environment = environment;
this.allowQuery = allowQuery;
this.regions = regions;
this.zipBuffer = "zipBuffer" in opts ? opts.zipBuffer : void 0;
this.supportsMultiPayloads = supportsMultiPayloads;
this.supportsWrapper = supportsWrapper;
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
this.framework = framework;
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
this.experimentalTriggers = experimentalTriggers;
this.supportsCancellation = supportsCancellation;
this.shouldDisableAutomaticFetchInstrumentation = shouldDisableAutomaticFetchInstrumentation;
}
async createZip() {
let { zipBuffer } = this;
if (!zipBuffer) {
if (!this.files) {
throw new Error("`files` is not defined");
}
await sema.acquire();
try {
zipBuffer = await createZip(this.files);
} finally {
sema.release();
}
}
return zipBuffer;
}
/**
* @deprecated Use the `supportsResponseStreaming` property instead.
*/
get experimentalResponseStreaming() {
return this.supportsResponseStreaming;
}
set experimentalResponseStreaming(v) {
this.supportsResponseStreaming = v;
}
}
const sema = new import_async_sema.default(10);
const mtime = /* @__PURE__ */ new Date(154e10);
async function createLambda(opts) {
const lambda = new Lambda(opts);
lambda.zipBuffer = await lambda.createZip();
return lambda;
}
async function createZip(files) {
const names = Object.keys(files).sort();
const symlinkTargets = /* @__PURE__ */ new Map();
for (const name of names) {
const file = files[name];
if (file.mode && (0, import_download.isSymbolicLink)(file.mode) && file.type === "FileFsRef") {
const symlinkTarget = await (0, import_fs_extra.readlink)(file.fsPath);
symlinkTargets.set(name, symlinkTarget);
}
}
const zipFile = new import_yazl.ZipFile();
const zipBuffer = await new Promise((resolve, reject) => {
for (const name of names) {
const file = files[name];
const opts = { mode: file.mode, mtime };
const symlinkTarget = symlinkTargets.get(name);
if (typeof symlinkTarget === "string") {
zipFile.addBuffer(Buffer.from(symlinkTarget, "utf8"), name, opts);
} else if (file.mode && (0, import_download.isDirectory)(file.mode)) {
zipFile.addEmptyDirectory(name, opts);
} else {
const stream = file.toStream();
stream.on("error", reject);
zipFile.addReadStream(stream, name, opts);
}
}
zipFile.end();
(0, import_stream_to_buffer.default)(zipFile.outputStream).then(resolve).catch(reject);
});
return zipBuffer;
}
async function getLambdaOptionsFromFunction({
sourceFile,
config
}) {
if (config?.functions) {
for (const [pattern, fn] of Object.entries(config.functions)) {
if (sourceFile === pattern || (0, import_minimatch.default)(sourceFile, pattern)) {
return {
architecture: fn.architecture,
memory: fn.memory,
maxDuration: fn.maxDuration,
experimentalTriggers: fn.experimentalTriggers,
supportsCancellation: fn.supportsCancellation
};
}
}
}
return {};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Lambda,
createLambda,
createZip,
getLambdaOptionsFromFunction
});

View file

@ -0,0 +1,16 @@
import { Lambda, LambdaOptionsWithFiles } from './lambda';
interface NodejsLambdaOptions extends LambdaOptionsWithFiles {
shouldAddHelpers: boolean;
shouldAddSourcemapSupport: boolean;
awsLambdaHandler?: string;
useWebApi?: boolean;
}
export declare class NodejsLambda extends Lambda {
launcherType: 'Nodejs';
shouldAddHelpers: boolean;
shouldAddSourcemapSupport: boolean;
awsLambdaHandler?: string;
useWebApi?: boolean;
constructor({ shouldAddHelpers, shouldAddSourcemapSupport, awsLambdaHandler, useWebApi, ...opts }: NodejsLambdaOptions);
}
export {};

44
node_modules/@vercel/build-utils/dist/nodejs-lambda.js generated vendored Normal file
View file

@ -0,0 +1,44 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var nodejs_lambda_exports = {};
__export(nodejs_lambda_exports, {
NodejsLambda: () => NodejsLambda
});
module.exports = __toCommonJS(nodejs_lambda_exports);
var import_lambda = require("./lambda");
class NodejsLambda extends import_lambda.Lambda {
constructor({
shouldAddHelpers,
shouldAddSourcemapSupport,
awsLambdaHandler,
useWebApi,
...opts
}) {
super(opts);
this.launcherType = "Nodejs";
this.shouldAddHelpers = shouldAddHelpers;
this.shouldAddSourcemapSupport = shouldAddSourcemapSupport;
this.awsLambdaHandler = awsLambdaHandler;
this.useWebApi = useWebApi;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NodejsLambda
});

3
node_modules/@vercel/build-utils/dist/os.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
export declare function getOsRelease(): Promise<Record<string, string> | null>;
export declare function parseOsRelease(data: string): Promise<Record<string, string>>;
export declare function getProvidedRuntime(): Promise<"provided.al2023" | "provided.al2">;

62
node_modules/@vercel/build-utils/dist/os.js generated vendored Normal file
View file

@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var os_exports = {};
__export(os_exports, {
getOsRelease: () => getOsRelease,
getProvidedRuntime: () => getProvidedRuntime,
parseOsRelease: () => parseOsRelease
});
module.exports = __toCommonJS(os_exports);
var import_fs_extra = require("fs-extra");
var import_error_utils = require("@vercel/error-utils");
async function getOsRelease() {
try {
const data = await (0, import_fs_extra.readFile)("/etc/os-release", "utf8");
return await parseOsRelease(data);
} catch (err) {
if ((0, import_error_utils.isErrnoException)(err) && err.code === "ENOENT") {
return null;
}
throw err;
}
}
async function parseOsRelease(data) {
const obj = {};
for (const line of data.trim().split("\n")) {
const m = /(?<key>.*)="(?<value>.*)"/.exec(line);
if (!m?.groups) {
continue;
}
obj[m.groups.key] = m.groups.value;
}
return obj;
}
async function getProvidedRuntime() {
const os = await getOsRelease();
if (!os) {
return "provided.al2023";
}
return os.PRETTY_NAME === "Amazon Linux 2" ? "provided.al2" : "provided.al2023";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getOsRelease,
getProvidedRuntime,
parseOsRelease
});

48
node_modules/@vercel/build-utils/dist/prerender.d.ts generated vendored Normal file
View file

@ -0,0 +1,48 @@
import type { File, HasField, Chain } from './types';
import { Lambda } from './lambda';
interface PrerenderOptions {
expiration: number | false;
staleExpiration?: number;
lambda?: Lambda;
fallback: File | null;
group?: number;
bypassToken?: string | null;
allowQuery?: string[];
allowHeader?: string[];
initialHeaders?: Record<string, string>;
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
experimentalBypassFor?: HasField;
experimentalStreamingLambdaPath?: string;
chain?: Chain;
}
export declare class Prerender {
type: 'Prerender';
/**
* `expiration` is `revalidate` in Next.js terms, and `s-maxage` in
* `cache-control` terms.
*/
expiration: number | false;
/**
* `staleExpiration` is `expire` in Next.js terms, and
* `stale-while-revalidate` + `s-maxage` in `cache-control` terms. It's
* expected to be undefined if `expiration` is `false`.
*/
staleExpiration?: number;
lambda?: Lambda;
fallback: File | null;
group?: number;
bypassToken: string | null;
allowQuery?: string[];
allowHeader?: string[];
initialHeaders?: Record<string, string>;
initialStatus?: number;
passQuery?: boolean;
sourcePath?: string;
experimentalBypassFor?: HasField;
experimentalStreamingLambdaPath?: string;
chain?: Chain;
constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
}
export {};

170
node_modules/@vercel/build-utils/dist/prerender.js generated vendored Normal file
View file

@ -0,0 +1,170 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var prerender_exports = {};
__export(prerender_exports, {
Prerender: () => Prerender
});
module.exports = __toCommonJS(prerender_exports);
class Prerender {
constructor({
expiration,
staleExpiration,
lambda,
fallback,
group,
bypassToken,
allowQuery,
allowHeader,
initialHeaders,
initialStatus,
passQuery,
sourcePath,
experimentalBypassFor,
experimentalStreamingLambdaPath,
chain
}) {
this.type = "Prerender";
this.expiration = expiration;
this.staleExpiration = staleExpiration;
this.sourcePath = sourcePath;
this.lambda = lambda;
if (this.lambda) {
this.lambda.operationType = this.lambda.operationType || "ISR";
}
if (typeof group !== "undefined" && (group <= 0 || !Number.isInteger(group))) {
throw new Error(
"The `group` argument for `Prerender` needs to be a natural number."
);
}
this.group = group;
if (passQuery === true) {
this.passQuery = true;
} else if (typeof passQuery !== "boolean" && typeof passQuery !== "undefined") {
throw new Error(
`The \`passQuery\` argument for \`Prerender\` must be a boolean.`
);
}
if (bypassToken == null) {
this.bypassToken = null;
} else if (typeof bypassToken === "string") {
if (bypassToken.length < 32) {
throw new Error(
"The `bypassToken` argument for `Prerender` must be 32 characters or more."
);
}
this.bypassToken = bypassToken;
} else {
throw new Error(
"The `bypassToken` argument for `Prerender` must be a `string`."
);
}
if (experimentalBypassFor !== void 0) {
if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
(field) => typeof field !== "object" || typeof field.type !== "string" || field.type === "host" && "key" in field || field.type !== "host" && typeof field.key !== "string" || field.value !== void 0 && typeof field.value !== "string" && (typeof field.value !== "object" || field.value === null || Array.isArray(field.value))
)) {
throw new Error(
"The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
);
}
this.experimentalBypassFor = experimentalBypassFor;
}
if (typeof fallback === "undefined") {
throw new Error(
"The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null."
);
}
this.fallback = fallback;
if (initialHeaders !== void 0) {
if (!initialHeaders || typeof initialHeaders !== "object" || Object.entries(initialHeaders).some(
([key, value]) => typeof key !== "string" || typeof value !== "string"
)) {
throw new Error(
`The \`initialHeaders\` argument for \`Prerender\` must be an object with string key/values`
);
}
this.initialHeaders = initialHeaders;
}
if (initialStatus !== void 0) {
if (initialStatus <= 0 || !Number.isInteger(initialStatus)) {
throw new Error(
`The \`initialStatus\` argument for \`Prerender\` must be a natural number.`
);
}
this.initialStatus = initialStatus;
}
if (allowQuery !== void 0) {
if (!Array.isArray(allowQuery)) {
throw new Error(
"The `allowQuery` argument for `Prerender` must be Array."
);
}
if (!allowQuery.every((q) => typeof q === "string")) {
throw new Error(
"The `allowQuery` argument for `Prerender` must be Array of strings."
);
}
this.allowQuery = allowQuery;
}
if (allowHeader !== void 0) {
if (!Array.isArray(allowHeader)) {
throw new Error(
"The `allowHeader` argument for `Prerender` must be Array."
);
}
if (!allowHeader.every((q) => typeof q === "string")) {
throw new Error(
"The `allowHeader` argument for `Prerender` must be Array of strings."
);
}
this.allowHeader = allowHeader;
}
if (experimentalStreamingLambdaPath !== void 0) {
if (typeof experimentalStreamingLambdaPath !== "string") {
throw new Error(
"The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string."
);
}
this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
}
if (chain !== void 0) {
if (typeof chain !== "object") {
throw new Error(
"The `chain` argument for `Prerender` must be an object."
);
}
if (!chain.headers || typeof chain.headers !== "object" || Object.entries(chain.headers).some(
([key, value]) => typeof key !== "string" || typeof value !== "string"
)) {
throw new Error(
`The \`chain.headers\` argument for \`Prerender\` must be an object with string key/values`
);
}
if (!chain.outputPath || typeof chain.outputPath !== "string") {
throw new Error(
"The `chain.outputPath` argument for `Prerender` must be a string."
);
}
this.chain = chain;
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Prerender
});

22
node_modules/@vercel/build-utils/dist/python.d.ts generated vendored Normal file
View file

@ -0,0 +1,22 @@
import FileFsRef from './file-fs-ref';
/**
* Run a Python script that only uses the standard library.
*/
export declare function runStdlibPyScript(options: {
scriptName: string;
pythonPath?: string;
args?: string[];
cwd?: string;
}): Promise<{
exitCode: number;
stdout: string;
stderr: string;
}>;
/**
* Check if a Python file is a valid entrypoint by detecting:
* - A top-level 'app' callable (Flask, FastAPI, Sanic, WSGI/ASGI, etc.)
* - A top-level 'handler' class (BaseHTTPRequestHandler subclass)
*/
export declare function isPythonEntrypoint(file: FileFsRef | {
fsPath?: string;
}): Promise<boolean>;

85
node_modules/@vercel/build-utils/dist/python.js generated vendored Normal file
View file

@ -0,0 +1,85 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var python_exports = {};
__export(python_exports, {
isPythonEntrypoint: () => isPythonEntrypoint,
runStdlibPyScript: () => runStdlibPyScript
});
module.exports = __toCommonJS(python_exports);
var import_fs = __toESM(require("fs"));
var import_path = require("path");
var import_execa = __toESM(require("execa"));
var import_debug = __toESM(require("./debug"));
const isWin = process.platform === "win32";
async function runStdlibPyScript(options) {
const { scriptName, pythonPath, args = [], cwd } = options;
const scriptPath = (0, import_path.join)(__dirname, "..", "lib", "python", `${scriptName}.py`);
if (!import_fs.default.existsSync(scriptPath)) {
throw new Error(`Python script not found: ${scriptPath}`);
}
const pythonCmd = pythonPath ?? (isWin ? "python" : "python3");
(0, import_debug.default)(
`Running stdlib Python script: ${pythonCmd} ${scriptPath} ${args.join(" ")}`
);
try {
const result = await (0, import_execa.default)(pythonCmd, [scriptPath, ...args], { cwd });
return { exitCode: 0, stdout: result.stdout, stderr: result.stderr };
} catch (err) {
const execaErr = err;
return {
exitCode: execaErr.exitCode ?? 1,
stdout: execaErr.stdout ?? "",
stderr: execaErr.stderr ?? ""
};
}
}
async function isPythonEntrypoint(file) {
try {
const fsPath = file.fsPath;
if (!fsPath)
return false;
const content = await import_fs.default.promises.readFile(fsPath, "utf-8");
if (!content.includes("app") && !content.includes("handler") && !content.includes("Handler")) {
return false;
}
const result = await runStdlibPyScript({
scriptName: "ast_parser",
args: [fsPath]
});
return result.exitCode === 0;
} catch (err) {
(0, import_debug.default)(`Failed to check Python entrypoint: ${err}`);
return false;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
isPythonEntrypoint,
runStdlibPyScript
});

105
node_modules/@vercel/build-utils/dist/schemas.d.ts generated vendored Normal file
View file

@ -0,0 +1,105 @@
export declare const functionsSchema: {
type: string;
minProperties: number;
maxProperties: number;
additionalProperties: boolean;
patternProperties: {
'^.{1,256}$': {
type: string;
additionalProperties: boolean;
properties: {
architecture: {
type: string;
enum: string[];
};
runtime: {
type: string;
maxLength: number;
};
memory: {
minimum: number;
maximum: number;
};
maxDuration: {
type: string;
minimum: number;
maximum: number;
};
includeFiles: {
type: string;
maxLength: number;
};
excludeFiles: {
type: string;
maxLength: number;
};
experimentalTriggers: {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
const: string;
};
topic: {
type: string;
minLength: number;
};
consumer: {
type: string;
minLength: number;
};
maxDeliveries: {
type: string;
minimum: number;
};
retryAfterSeconds: {
type: string;
exclusiveMinimum: number;
};
initialDelaySeconds: {
type: string;
minimum: number;
};
maxConcurrency: {
type: string;
minimum: number;
};
};
required: string[];
additionalProperties: boolean;
};
};
supportsCancellation: {
type: string;
};
};
};
};
};
export declare const buildsSchema: {
type: string;
minItems: number;
maxItems: number;
items: {
type: string;
additionalProperties: boolean;
required: string[];
properties: {
src: {
type: string;
minLength: number;
maxLength: number;
};
use: {
type: string;
minLength: number;
maxLength: number;
};
config: {
type: string;
};
};
};
};

133
node_modules/@vercel/build-utils/dist/schemas.js generated vendored Normal file
View file

@ -0,0 +1,133 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var schemas_exports = {};
__export(schemas_exports, {
buildsSchema: () => buildsSchema,
functionsSchema: () => functionsSchema
});
module.exports = __toCommonJS(schemas_exports);
const triggerEventSchema = {
type: "object",
properties: {
type: {
type: "string",
const: "queue/v1beta"
},
topic: {
type: "string",
minLength: 1
},
consumer: {
type: "string",
minLength: 1
},
maxDeliveries: {
type: "number",
minimum: 1
},
retryAfterSeconds: {
type: "number",
exclusiveMinimum: 0
},
initialDelaySeconds: {
type: "number",
minimum: 0
},
maxConcurrency: {
type: "number",
minimum: 1
}
},
required: ["type", "topic", "consumer"],
additionalProperties: false
};
const functionsSchema = {
type: "object",
minProperties: 1,
maxProperties: 50,
additionalProperties: false,
patternProperties: {
"^.{1,256}$": {
type: "object",
additionalProperties: false,
properties: {
architecture: {
type: "string",
enum: ["x86_64", "arm64"]
},
runtime: {
type: "string",
maxLength: 256
},
memory: {
minimum: 128,
maximum: 10240
},
maxDuration: {
type: "number",
minimum: 1,
maximum: 900
},
includeFiles: {
type: "string",
maxLength: 256
},
excludeFiles: {
type: "string",
maxLength: 256
},
experimentalTriggers: {
type: "array",
items: triggerEventSchema
},
supportsCancellation: {
type: "boolean"
}
}
}
}
};
const buildsSchema = {
type: "array",
minItems: 0,
maxItems: 128,
items: {
type: "object",
additionalProperties: false,
required: ["use"],
properties: {
src: {
type: "string",
minLength: 1,
maxLength: 4096
},
use: {
type: "string",
minLength: 3,
maxLength: 256
},
config: { type: "object" }
}
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buildsSchema,
functionsSchema
});

View file

@ -0,0 +1,2 @@
import type { ShouldServe } from './types';
export declare const shouldServe: ShouldServe;

47
node_modules/@vercel/build-utils/dist/should-serve.js generated vendored Normal file
View file

@ -0,0 +1,47 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var should_serve_exports = {};
__export(should_serve_exports, {
shouldServe: () => shouldServe
});
module.exports = __toCommonJS(should_serve_exports);
var import_path = require("path");
const shouldServe = ({
entrypoint,
files,
requestPath
}) => {
requestPath = requestPath.replace(/\/$/, "");
entrypoint = entrypoint.replace(/\\/, "/");
if (entrypoint === requestPath && hasProp(files, entrypoint)) {
return true;
}
const { dir, name } = (0, import_path.parse)(entrypoint);
if (name === "index" && dir === requestPath && hasProp(files, entrypoint)) {
return true;
}
return false;
};
function hasProp(obj, key) {
return Object.hasOwnProperty.call(obj, key);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
shouldServe
});

View file

@ -0,0 +1,2 @@
export declare const BUILDER_INSTALLER_STEP = "vc.builder.install";
export declare const BUILDER_COMPILE_STEP = "vc.builder.build";

View file

@ -0,0 +1,31 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var constants_exports = {};
__export(constants_exports, {
BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP
});
module.exports = __toCommonJS(constants_exports);
const BUILDER_INSTALLER_STEP = "vc.builder.install";
const BUILDER_COMPILE_STEP = "vc.builder.build";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP
});

View file

@ -0,0 +1,3 @@
export { Span } from './trace';
export { BUILDER_COMPILE_STEP, BUILDER_INSTALLER_STEP } from './constants';
export type { SpanId, TraceEvent, Reporter } from './trace';

33
node_modules/@vercel/build-utils/dist/trace/index.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var trace_exports = {};
__export(trace_exports, {
BUILDER_COMPILE_STEP: () => import_constants.BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP: () => import_constants.BUILDER_INSTALLER_STEP,
Span: () => import_trace.Span
});
module.exports = __toCommonJS(trace_exports);
var import_trace = require("./trace");
var import_constants = require("./constants");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUILDER_COMPILE_STEP,
BUILDER_INSTALLER_STEP,
Span
});

37
node_modules/@vercel/build-utils/dist/trace/trace.d.ts generated vendored Normal file
View file

@ -0,0 +1,37 @@
export type SpanId = string;
export type TraceEvent = {
parentId?: SpanId;
name: string;
id: SpanId;
timestamp: number;
duration: number;
tags: Record<string, string>;
startTime: number;
};
export type Reporter = {
report: (event: TraceEvent) => void;
};
interface Attributes {
[key: string]: string | undefined;
}
export declare class Span {
private name;
private id;
private parentId?;
private attrs;
private status;
private _start;
private now;
private _reporter;
constructor({ name, parentId, attrs, reporter, }: {
name: string;
parentId?: SpanId;
attrs?: Attributes;
reporter?: Reporter;
});
stop(): void;
setAttributes(attrs: Attributes): void;
child(name: string, attrs?: Attributes): Span;
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
}
export {};

92
node_modules/@vercel/build-utils/dist/trace/trace.js generated vendored Normal file
View file

@ -0,0 +1,92 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var trace_exports = {};
__export(trace_exports, {
Span: () => Span
});
module.exports = __toCommonJS(trace_exports);
var import_node_crypto = require("node:crypto");
const NUM_OF_MICROSEC_IN_NANOSEC = BigInt("1000");
function mapUndefinedAttributes(attrs) {
return Object.fromEntries(
Object.entries(attrs ?? {}).filter(
(attr) => !!attr[1]
)
);
}
class Span {
constructor({
name,
parentId,
attrs,
reporter
}) {
this.name = name;
this.parentId = parentId;
this.attrs = mapUndefinedAttributes(attrs);
this.status = "started";
this.id = (0, import_node_crypto.randomUUID)();
this._reporter = reporter;
this.now = Date.now();
this._start = process.hrtime.bigint();
}
stop() {
if (this.status === "stopped") {
throw new Error(`Cannot stop a span which is already stopped`);
}
this.status = "stopped";
const end = process.hrtime.bigint();
const duration = Number((end - this._start) / NUM_OF_MICROSEC_IN_NANOSEC);
const timestamp = Number(this._start / NUM_OF_MICROSEC_IN_NANOSEC);
const traceEvent = {
name: this.name,
duration,
timestamp,
id: this.id,
parentId: this.parentId,
tags: this.attrs,
startTime: this.now
};
if (this._reporter) {
this._reporter.report(traceEvent);
}
}
setAttributes(attrs) {
Object.assign(this.attrs, mapUndefinedAttributes(attrs));
}
child(name, attrs) {
return new Span({
name,
parentId: this.id,
attrs,
reporter: this._reporter
});
}
async trace(fn) {
try {
return await fn(this);
} finally {
this.stop();
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Span
});

611
node_modules/@vercel/build-utils/dist/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,611 @@
/// <reference types="node" />
import type FileRef from './file-ref';
import type FileFsRef from './file-fs-ref';
import type FileBlob from './file-blob';
import type { Lambda, LambdaArchitecture } from './lambda';
import type { Prerender } from './prerender';
import type { EdgeFunction } from './edge-function';
import type { Span } from './trace';
import type { HasField } from '@vercel/routing-utils';
export interface Env {
[name: string]: string | undefined;
}
export type File = FileRef | FileFsRef | FileBlob;
export interface FileBase {
type: string;
mode: number;
contentType?: string;
toStream: () => NodeJS.ReadableStream;
toStreamAsync?: () => Promise<NodeJS.ReadableStream>;
}
export interface Files {
[filePath: string]: File;
}
export interface Config {
bunVersion?: string;
maxLambdaSize?: string;
includeFiles?: string | string[];
excludeFiles?: string | string[];
bundle?: boolean;
ldsflags?: string;
helpers?: boolean;
rust?: string;
debug?: boolean;
zeroConfig?: boolean;
import?: {
[key: string]: string;
};
functions?: BuilderFunctions;
projectSettings?: ProjectSettings;
outputDirectory?: string;
installCommand?: string;
buildCommand?: string;
devCommand?: string;
framework?: string | null;
nodeVersion?: string;
middleware?: boolean;
[key: string]: unknown;
}
export type { HasField };
export interface Meta {
isDev?: boolean;
devCacheDir?: string;
skipDownload?: boolean;
requestPath?: string | null;
filesChanged?: string[];
filesRemoved?: string[];
env?: Env;
buildEnv?: Env;
[key: string]: unknown;
}
export interface BuildOptions {
/**
* All source files of the project
*/
files: Files;
/**
* Name of entrypoint file for this particular build job. Value
* `files[entrypoint]` is guaranteed to exist and be a valid File reference.
* `entrypoint` is always a discrete file and never a glob, since globs are
* expanded into separate builds at deployment time.
*/
entrypoint: string;
/**
* A writable temporary directory where you are encouraged to perform your
* build process. This directory will be populated with the restored cache.
*/
workPath: string;
/**
* The "Root Directory" is assigned to the `workPath` so the `repoRootPath`
* is the Git Repository Root. This is only relevant for Monorepos.
* See https://vercel.com/blog/monorepos
*/
repoRootPath: string;
/**
* An arbitrary object passed by the user in the build definition defined
* in `vercel.json`.
*/
config: Config;
/**
* Metadata related to the invoker of the builder, used by `vercel dev`.
* Builders may use the properties on this object to change behavior based
* on the build environment.
*/
meta?: Meta;
/**
* A callback to be invoked by a builder after a project's
* build command has been run but before the outputs have been
* fully processed
*/
buildCallback?: (opts: Omit<BuildOptions, 'buildCallback'>) => Promise<void>;
/**
* The current trace state from the internal vc tracing
*/
span?: Span;
}
export interface PrepareCacheOptions {
/**
* All source files of the project
*/
files: Files;
/**
* Name of entrypoint file for this particular build job. Value
* `files[entrypoint]` is guaranteed to exist and be a valid File reference.
* `entrypoint` is always a discrete file and never a glob, since globs are
* expanded into separate builds at deployment time.
*/
entrypoint: string;
/**
* A writable temporary directory where you are encouraged to perform your
* build process.
*/
workPath: string;
/**
* The "Root Directory" is assigned to the `workPath` so the `repoRootPath`
* is the Git Repository Root. This is only relevant for Monorepos.
* See https://vercel.com/blog/monorepos
*/
repoRootPath: string;
/**
* An arbitrary object passed by the user in the build definition defined
* in `vercel.json`.
*/
config: Config;
}
export interface ShouldServeOptions {
/**
* A path string from a request.
*/
requestPath: string;
/**
* Name of entrypoint file for this particular build job. Value
* `files[entrypoint]` is guaranteed to exist and be a valid File reference.
* `entrypoint` is always a discrete file and never a glob, since globs are
* expanded into separate builds at deployment time.
*/
entrypoint: string;
/**
* All source files of the project
*/
files: {
[path: string]: FileFsRef;
};
/**
* A writable temporary directory where you are encouraged to perform your
* build process. This directory will be populated with the restored cache.
*/
workPath: string;
/**
* An arbitrary object passed by the user in the build definition defined
* in `vercel.json`.
*/
config: Config;
/**
* Whether another builder has already matched the given request.
*/
hasMatched?: boolean;
}
/**
* `startDevServer()` is given the same parameters as `build()`.
*/
export type StartDevServerOptions = BuildOptions & {
/**
* Directory to serve static files from in dev mode
*/
publicDir?: string;
};
export interface StartDevServerSuccess {
/**
* Port number where the dev server can be connected to, assumed to be running
* on `localhost`.
*/
port: number;
/**
* Process ID number of the dev server. Useful for the `vercel dev` server to
* shut down the dev server once an HTTP request has been fulfilled.
*/
pid: number;
/**
* An optional function to shut down the dev server. If not provided, the
* dev server will forcefully be killed.
*/
shutdown?: () => Promise<void>;
}
/**
* `startDevServer()` may return `null` to opt-out of spawning a dev server for
* a given `entrypoint`.
*/
export type StartDevServerResult = StartDevServerSuccess | null;
/**
* Credit to Iain Reid, MIT license.
* Source: https://gist.github.com/iainreid820/5c1cc527fe6b5b7dba41fec7fe54bf6e
*/
export declare namespace PackageJson {
/**
* An author or contributor
*/
interface Author {
name: string;
email?: string;
homepage?: string;
}
/**
* A map of exposed bin commands
*/
interface BinMap {
[commandName: string]: string;
}
/**
* A bugs link
*/
interface Bugs {
email: string;
url: string;
}
interface Config {
name?: string;
config?: unknown;
}
/**
* A map of dependencies
*/
interface DependencyMap {
[dependencyName: string]: string;
}
/**
* CommonJS package structure
*/
interface Directories {
lib?: string;
bin?: string;
man?: string;
doc?: string;
example?: string;
}
interface Engines {
node?: string;
npm?: string;
pnpm?: string;
}
interface PublishConfig {
registry?: string;
}
/**
* A project repository
*/
interface Repository {
type: string;
url: string;
}
interface ScriptsMap {
[scriptName: string]: string;
}
}
export interface PackageJson {
readonly name?: string;
readonly version?: string;
readonly description?: string;
readonly keywords?: string[];
readonly homepage?: string;
readonly bugs?: string | PackageJson.Bugs;
readonly license?: string;
readonly author?: string | PackageJson.Author;
readonly contributors?: string[] | PackageJson.Author[];
readonly files?: string[];
readonly main?: string;
readonly bin?: string | PackageJson.BinMap;
readonly man?: string | string[];
readonly directories?: PackageJson.Directories;
readonly repository?: string | PackageJson.Repository;
readonly scripts?: PackageJson.ScriptsMap;
readonly config?: PackageJson.Config;
readonly dependencies?: PackageJson.DependencyMap;
readonly devDependencies?: PackageJson.DependencyMap;
readonly peerDependencies?: PackageJson.DependencyMap;
readonly optionalDependencies?: PackageJson.DependencyMap;
readonly bundledDependencies?: string[];
readonly engines?: PackageJson.Engines;
readonly os?: string[];
readonly cpu?: string[];
readonly preferGlobal?: boolean;
readonly private?: boolean;
readonly publishConfig?: PackageJson.PublishConfig;
readonly packageManager?: string;
readonly type?: string;
}
export interface ConstructorVersion {
/** major version number: 18 */
major: number;
/** minor version number: 18 */
minor?: number;
/** major version range: "18.x" */
range: string;
/** runtime descriptor: "nodejs18.x" */
runtime: string;
discontinueDate?: Date;
}
interface BaseVersion extends ConstructorVersion {
state: 'active' | 'deprecated' | 'discontinued';
}
export declare class Version implements BaseVersion {
major: number;
minor?: number;
range: string;
runtime: string;
discontinueDate?: Date;
constructor(version: ConstructorVersion);
get state(): "active" | "deprecated" | "discontinued";
get formattedDate(): string | undefined;
}
export declare class NodeVersion extends Version {
}
export declare class BunVersion extends Version {
}
export interface Builder {
use: string;
src?: string;
config?: Config;
}
export interface BuilderFunctions {
[key: string]: {
architecture?: LambdaArchitecture;
memory?: number;
maxDuration?: number;
runtime?: string;
includeFiles?: string;
excludeFiles?: string;
experimentalTriggers?: TriggerEvent[];
supportsCancellation?: boolean;
};
}
export interface ProjectSettings {
framework?: string | null;
devCommand?: string | null;
installCommand?: string | null;
buildCommand?: string | null;
outputDirectory?: string | null;
rootDirectory?: string | null;
nodeVersion?: string;
monorepoManager?: string | null;
createdAt?: number;
autoExposeSystemEnvs?: boolean;
sourceFilesOutsideRootDirectory?: boolean;
directoryListing?: boolean;
gitForkProtection?: boolean;
commandForIgnoringBuildStep?: string | null;
}
export interface BuilderV2 {
version: 2;
build: BuildV2;
diagnostics?: Diagnostics;
prepareCache?: PrepareCache;
shouldServe?: ShouldServe;
}
export interface BuilderV3 {
version: 3;
build: BuildV3;
diagnostics?: Diagnostics;
prepareCache?: PrepareCache;
shouldServe?: ShouldServe;
startDevServer?: StartDevServer;
}
type ImageFormat = 'image/avif' | 'image/webp';
type ImageContentDispositionType = 'inline' | 'attachment';
export type RemotePattern = {
/**
* Must be `http` or `https`.
*/
protocol?: 'http' | 'https';
/**
* Can be literal or wildcard.
* Single `*` matches a single subdomain.
* Double `**` matches any number of subdomains.
*/
hostname: string;
/**
* Can be literal port such as `8080` or empty string
* meaning no port.
*/
port?: string;
/**
* Can be literal or wildcard.
* Single `*` matches a single path segment.
* Double `**` matches any number of path segments.
*/
pathname?: string;
/**
* Can be literal query string such as `?v=1` or
* empty string meaning no query string.
*/
search?: string;
};
export interface LocalPattern {
/**
* Can be literal or wildcard.
* Single `*` matches a single path segment.
* Double `**` matches any number of path segments.
*/
pathname?: string;
/**
* Can be literal query string such as `?v=1` or
* empty string meaning no query string.
*/
search?: string;
}
export interface Images {
domains: string[];
remotePatterns?: RemotePattern[];
localPatterns?: LocalPattern[];
qualities?: number[];
sizes: number[];
minimumCacheTTL?: number;
formats?: ImageFormat[];
dangerouslyAllowSVG?: boolean;
contentSecurityPolicy?: string;
contentDispositionType?: ImageContentDispositionType;
}
/**
* If a Builder ends up creating filesystem outputs conforming to
* the Build Output API, then the Builder should return this type.
*/
export interface BuildResultBuildOutput {
/**
* Version number of the Build Output API that was created.
* Currently only `3` is a valid value.
* @example 3
*/
buildOutputVersion: 3;
/**
* Filesystem path to the Build Output directory.
* @example "/path/to/.vercel/output"
*/
buildOutputPath: string;
}
export interface Cron {
path: string;
schedule: string;
}
/** The framework which created the function */
export interface FunctionFramework {
slug: string;
version?: string;
}
/**
* When a Builder implements `version: 2`, the `build()` function is expected
* to return this type.
*/
export interface BuildResultV2Typical {
routes?: any[];
images?: Images;
output: {
[key: string]: File | Lambda | Prerender | EdgeFunction;
};
wildcard?: Array<{
domain: string;
value: string;
}>;
framework?: {
version: string;
};
flags?: {
definitions: FlagDefinitions;
};
/**
* User-configured deployment ID for skew protection.
* This allows users to specify a custom deployment identifier
* in their next.config.js that will be used for version skew protection
* with pre-built deployments.
* @example "abc123"
*/
deploymentId?: string;
}
export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
export interface BuildResultV3 {
routes?: any[];
output: Lambda | EdgeFunction;
}
export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
export type BuildV3 = (options: BuildOptions) => Promise<BuildResultV3>;
export type PrepareCache = (options: PrepareCacheOptions) => Promise<Files>;
export type Diagnostics = (options: BuildOptions) => Promise<Files>;
export type ShouldServe = (options: ShouldServeOptions) => boolean | Promise<boolean>;
export type StartDevServer = (options: StartDevServerOptions) => Promise<StartDevServerResult>;
/**
* TODO: The following types will eventually be exported by a more
* relevant package.
*/
type FlagJSONArray = ReadonlyArray<FlagJSONValue>;
type FlagJSONValue = string | boolean | number | null | FlagJSONArray | {
[key: string]: FlagJSONValue;
};
type FlagOption = {
value: FlagJSONValue;
label?: string;
};
export interface FlagDefinition {
options?: FlagOption[];
origin?: string;
description?: string;
}
export type FlagDefinitions = Record<string, FlagDefinition>;
export interface Chain {
/**
* The build output to use that references the lambda that will be used to
* append to the response.
*/
outputPath: string;
/**
* The headers to send when making the request to append to the response.
*/
headers: Record<string, string>;
}
/**
* Queue trigger event for Vercel's queue system.
* Handles "queue/v1beta" events with queue-specific configuration.
*/
export interface TriggerEvent {
/** Event type - must be "queue/v1beta" (REQUIRED) */
type: 'queue/v1beta';
/** Name of the queue topic to consume from (REQUIRED) */
topic: string;
/** Name of the consumer group for this trigger (REQUIRED) */
consumer: string;
/**
* Maximum number of delivery attempts for message processing (OPTIONAL)
* This represents the total number of times a message can be delivered,
* not the number of retries. Must be at least 1 if specified.
* Behavior when not specified depends on the server's default configuration.
*/
maxDeliveries?: number;
/**
* Delay in seconds before retrying failed executions (OPTIONAL)
* Behavior when not specified depends on the server's default configuration.
*/
retryAfterSeconds?: number;
/**
* Initial delay in seconds before first execution attempt (OPTIONAL)
* Must be 0 or greater. Use 0 for no initial delay.
* Behavior when not specified depends on the server's default configuration.
*/
initialDelaySeconds?: number;
/**
* Maximum number of concurrent executions for this consumer (OPTIONAL)
* Must be at least 1 if specified.
* Behavior when not specified depends on the server's default configuration.
*/
maxConcurrency?: number;
}
export type ServiceRuntime = 'node' | 'python' | 'go' | 'rust' | 'ruby';
export type ServiceType = 'web' | 'cron' | 'worker';
/**
* Configuration for a service in vercel.json.
* @experimental This feature is experimental and may change.
*/
export interface ExperimentalServiceConfig {
type?: ServiceType;
/**
* Entry file for the service, relative to the workspace directory.
* @example "src/index.ts", "main.py", "api/server.go"
*/
entrypoint?: string;
/**
* Path to the directory containing the service's manifest file
* (package.json, pyproject.toml, etc.).
* Defaults to "." (project root) if not specified.
*/
workspace?: 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;
buildCommand?: string;
installCommand?: string;
/** Lambda config */
memory?: number;
maxDuration?: number;
includeFiles?: string | string[];
excludeFiles?: string | string[];
/** URL prefix for routing */
routePrefix?: string;
/** Cron schedule expression (e.g., "0 0 * * *") */
schedule?: string;
topic?: string;
consumer?: string;
}
/**
* Map of service name to service configuration.
* @experimental This feature is experimental and may change.
*/
export type ExperimentalServices = Record<string, ExperimentalServiceConfig>;
/**
* Map of service group name to array of service names belonging to that group.
* @experimental This feature is experimental and may change.
* @example
* {
* "app": ["site", "backend"],
* "admin": ["admin", "backend"]
* }
*/
export type ExperimentalServiceGroups = Record<string, string[]>;

55
node_modules/@vercel/build-utils/dist/types.js generated vendored Normal file
View file

@ -0,0 +1,55 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var types_exports = {};
__export(types_exports, {
BunVersion: () => BunVersion,
NodeVersion: () => NodeVersion,
Version: () => Version
});
module.exports = __toCommonJS(types_exports);
class Version {
constructor(version) {
this.major = version.major;
this.minor = version.minor;
this.range = version.range;
this.runtime = version.runtime;
this.discontinueDate = version.discontinueDate;
}
get state() {
if (this.discontinueDate && this.discontinueDate.getTime() <= Date.now()) {
return "discontinued";
} else if (this.discontinueDate) {
return "deprecated";
}
return "active";
}
get formattedDate() {
return this.discontinueDate && this.discontinueDate.toISOString().split("T")[0];
}
}
class NodeVersion extends Version {
}
class BunVersion extends Version {
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BunVersion,
NodeVersion,
Version
});

View file

@ -0,0 +1,12 @@
/**
* Checks if there is a `.npmrc` in the cwd (project root) and makes sure it
* doesn't contain a `use-node-version`. This config setting is not supported
* since it causes the package manager to install the Node.js version which in
* the case of newer Node.js versions is not compatible with AWS due to
* outdated GLIBC binaries.
*
* @see https://pnpm.io/npmrc#use-node-version
*
* @param cwd The current working directory (e.g. project root);
*/
export declare function validateNpmrc(cwd: string): Promise<void>;

View file

@ -0,0 +1,41 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var validate_npmrc_exports = {};
__export(validate_npmrc_exports, {
validateNpmrc: () => validateNpmrc
});
module.exports = __toCommonJS(validate_npmrc_exports);
var import_path = require("path");
var import_promises = require("fs/promises");
async function validateNpmrc(cwd) {
const npmrc = await (0, import_promises.readFile)((0, import_path.join)(cwd, ".npmrc"), "utf-8").catch((err) => {
if (err.code !== "ENOENT")
throw err;
});
const nodeRegExp = /(?<!#.*)use-node-version/;
if (npmrc?.match(nodeRegExp)) {
throw new Error(
'Detected unsupported "use-node-version" in your ".npmrc". Please use "engines" in your "package.json" instead.'
);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
validateNpmrc
});