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

45
node_modules/@vercel/static-config/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,45 @@
import { Project } from 'ts-morph';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
export declare const BaseFunctionConfigSchema: {
readonly type: "object";
readonly properties: {
readonly architecture: {
readonly type: "string";
readonly enum: readonly ["x86_64", "arm64"];
};
readonly runtime: {
readonly type: "string";
};
readonly memory: {
readonly type: "number";
};
readonly maxDuration: {
readonly type: "number";
};
readonly supportsCancellation: {
readonly type: "boolean";
};
readonly regions: {
readonly oneOf: readonly [{
readonly type: "array";
readonly items: {
readonly type: "string";
};
}, {
readonly enum: readonly ["all", "default", "auto"];
}];
};
readonly preferredRegion: {
readonly oneOf: readonly [{
readonly type: "string";
}, {
readonly type: "array";
readonly items: {
readonly type: "string";
};
}];
};
};
};
export type BaseFunctionConfig = FromSchema<typeof BaseFunctionConfigSchema>;
export declare function getConfig<T extends JSONSchema = typeof BaseFunctionConfigSchema>(project: Project, sourcePath: string, schema?: T): FromSchema<T> | null;

128
node_modules/@vercel/static-config/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,128 @@
"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 src_exports = {};
__export(src_exports, {
BaseFunctionConfigSchema: () => BaseFunctionConfigSchema,
getConfig: () => getConfig
});
module.exports = __toCommonJS(src_exports);
var import_ts_morph = require("ts-morph");
var import_validation = require("./validation");
const BaseFunctionConfigSchema = {
type: "object",
properties: {
architecture: {
type: "string",
enum: ["x86_64", "arm64"]
},
runtime: { type: "string" },
memory: { type: "number" },
maxDuration: { type: "number" },
supportsCancellation: {
type: "boolean"
},
regions: {
oneOf: [
{
type: "array",
items: { type: "string" }
},
{
enum: ["all", "default", "auto"]
}
]
},
preferredRegion: {
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
}
}
};
function getConfig(project, sourcePath, schema) {
const sourceFile = project.addSourceFileAtPath(sourcePath);
const configNode = getConfigNode(sourceFile);
if (!configNode)
return null;
const config = getValue(configNode);
return (0, import_validation.validate)(schema || BaseFunctionConfigSchema, config);
}
function getConfigNode(sourceFile) {
return sourceFile.getDescendantsOfKind(import_ts_morph.SyntaxKind.ObjectLiteralExpression).find((objectLiteral) => {
const varDec = objectLiteral.getParentIfKind(
import_ts_morph.SyntaxKind.VariableDeclaration
);
if (varDec?.getName() !== "config")
return false;
const varDecList = varDec.getParentIfKind(
import_ts_morph.SyntaxKind.VariableDeclarationList
);
const isConst = (varDecList?.getFlags() ?? 0) & import_ts_morph.NodeFlags.Const;
if (!isConst)
return false;
const exp = varDecList?.getParentIfKind(import_ts_morph.SyntaxKind.VariableStatement);
if (!exp?.isExported())
return false;
return true;
});
}
function getValue(valueNode) {
if (import_ts_morph.Node.isStringLiteral(valueNode)) {
return eval(valueNode.getText());
} else if (import_ts_morph.Node.isNumericLiteral(valueNode)) {
return Number(valueNode.getText());
} else if (import_ts_morph.Node.isTrueLiteral(valueNode)) {
return true;
} else if (import_ts_morph.Node.isFalseLiteral(valueNode)) {
return false;
} else if (import_ts_morph.Node.isNullLiteral(valueNode)) {
return null;
} else if (import_ts_morph.Node.isArrayLiteralExpression(valueNode)) {
return getArray(valueNode);
} else if (import_ts_morph.Node.isObjectLiteralExpression(valueNode)) {
return getObject(valueNode);
} else if (import_ts_morph.Node.isIdentifier(valueNode) && valueNode.getText() === "undefined") {
return void 0;
}
throw new Error(
`Unhandled type: "${valueNode.getKindName()}" ${valueNode.getText()}`
);
}
function getObject(obj) {
const rtn = {};
for (const prop of obj.getProperties()) {
if (!import_ts_morph.Node.isPropertyAssignment(prop))
continue;
const [nameNode, _colon, valueNode2] = prop.getChildren();
const name = nameNode.getText();
rtn[name] = getValue(valueNode2);
}
return rtn;
}
function getArray(arr) {
const elementNodes = arr.getElements();
const rtn = new Array(elementNodes.length);
for (let i = 0; i < elementNodes.length; i++) {
rtn[i] = getValue(elementNodes[i]);
}
return rtn;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BaseFunctionConfigSchema,
getConfig
});

7
node_modules/@vercel/static-config/dist/swc.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
import type { Module } from '@swc/core';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
export type Value = undefined | null | boolean | string | number | any[] | Record<string, any>;
export declare class UnsupportedValueError extends Error {
}
export declare function extractExportedConstValue(module: Module, exportedName: string): Value | null;
export declare function getConfig<T extends JSONSchema>(module: Module, schema?: T): FromSchema<T> | null;

114
node_modules/@vercel/static-config/dist/swc.js generated vendored Normal file
View file

@ -0,0 +1,114 @@
"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 swc_exports = {};
__export(swc_exports, {
UnsupportedValueError: () => UnsupportedValueError,
extractExportedConstValue: () => extractExportedConstValue,
getConfig: () => getConfig
});
module.exports = __toCommonJS(swc_exports);
var import_validation = require("./validation");
class UnsupportedValueError extends Error {
}
function extractValue(node) {
if (node.type === "NullLiteral") {
return null;
} else if (node.type === "BooleanLiteral") {
return node.value;
} else if (node.type === "StringLiteral") {
return node.value;
} else if (node.type === "NumericLiteral") {
return node.value;
} else if (node.type === "Identifier") {
switch (node.value) {
case "undefined":
return void 0;
default:
throw new UnsupportedValueError();
}
} else if (node.type === "ArrayExpression") {
const arr = [];
for (const elem of node.elements) {
if (elem) {
if (elem.spread) {
throw new UnsupportedValueError();
}
arr.push(extractValue(elem.expression));
} else {
arr.push(void 0);
}
}
return arr;
} else if (node.type === "ObjectExpression") {
const obj = {};
for (const prop of node.properties) {
if (prop.type !== "KeyValueProperty") {
throw new UnsupportedValueError();
}
let key;
if (prop.key.type === "Identifier") {
key = prop.key.value;
} else if (prop.key.type === "StringLiteral") {
key = prop.key.value;
} else {
throw new UnsupportedValueError();
}
obj[key] = extractValue(prop.value);
}
return obj;
} else {
throw new UnsupportedValueError();
}
}
function extractExportedConstValue(module2, exportedName) {
for (const moduleItem of module2.body) {
if (moduleItem.type !== "ExportDeclaration") {
continue;
}
const { declaration } = moduleItem;
if (declaration.type !== "VariableDeclaration") {
continue;
}
if (declaration.kind !== "const") {
continue;
}
for (const decl of declaration.declarations) {
if (decl.id.type === "Identifier" && decl.id.value === exportedName && decl.init) {
return extractValue(decl.init);
}
}
}
return null;
}
function getConfig(module2, schema) {
const data = extractExportedConstValue(module2, "config");
if (!data) {
return null;
}
if (schema) {
(0, import_validation.validate)(schema, data);
}
return data;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
UnsupportedValueError,
extractExportedConstValue,
getConfig
});

View file

@ -0,0 +1,2 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
export declare function validate<T extends JSONSchema>(schema: T, data: any): FromSchema<T>;

46
node_modules/@vercel/static-config/dist/validation.js generated vendored Normal file
View file

@ -0,0 +1,46 @@
"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 validation_exports = {};
__export(validation_exports, {
validate: () => validate
});
module.exports = __toCommonJS(validation_exports);
var import_ajv = __toESM(require("ajv"));
const ajv = new import_ajv.default();
function validate(schema, data) {
const isValid = ajv.compile(schema);
if (!isValid(data)) {
throw new Error("Invalid data");
}
return data;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
validate
});