Socket
Book a DemoSign in
Socket

@vercel/static-config

Package Overview
Dependencies
Maintainers
8
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/static-config - npm Package Compare versions

Comparing version
3.0.0
to
3.1.0
+4
-0
dist/index.d.ts

@@ -6,2 +6,6 @@ import { Project } from 'ts-morph';

readonly properties: {
readonly architecture: {
readonly type: "string";
readonly enum: readonly ["x86_64", "arm64"];
};
readonly runtime: {

@@ -8,0 +12,0 @@ readonly type: "string";

+109
-90
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfig = exports.BaseFunctionConfigSchema = void 0;
const ts_morph_1 = require("ts-morph");
const validation_1 = require("./validation");
exports.BaseFunctionConfigSchema = {
type: 'object',
properties: {
runtime: { type: 'string' },
memory: { type: 'number' },
maxDuration: { type: 'number' },
regions: {
oneOf: [
{
type: 'array',
items: { type: 'string' },
},
{
enum: ['all', 'default', 'auto'],
},
],
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" },
regions: {
oneOf: [
{
type: "array",
items: { type: "string" }
},
},
{
enum: ["all", "default", "auto"]
}
]
}
}
};
function getConfig(project, sourcePath, schema) {
const sourceFile = project.addSourceFileAtPath(sourcePath);
const configNode = getConfigNode(sourceFile);
if (!configNode)
return null;
const config = getValue(configNode);
// @ts-ignore
return (0, validation_1.validate)(schema || exports.BaseFunctionConfigSchema, config);
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);
}
exports.getConfig = getConfig;
function getConfigNode(sourceFile) {
return sourceFile
.getDescendantsOfKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression)
.find(objectLiteral => {
// Make sure the object is assigned to "config"
const varDec = objectLiteral.getParentIfKind(ts_morph_1.SyntaxKind.VariableDeclaration);
if (varDec?.getName() !== 'config')
return false;
// Make sure assigned with `const`
const varDecList = varDec.getParentIfKind(ts_morph_1.SyntaxKind.VariableDeclarationList);
const isConst = (varDecList?.getFlags() ?? 0) & ts_morph_1.NodeFlags.Const;
if (!isConst)
return false;
// Make sure it is exported
const exp = varDecList?.getParentIfKind(ts_morph_1.SyntaxKind.VariableStatement);
if (!exp?.isExported())
return false;
return true;
});
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 (ts_morph_1.Node.isStringLiteral(valueNode)) {
return eval(valueNode.getText());
}
else if (ts_morph_1.Node.isNumericLiteral(valueNode)) {
return Number(valueNode.getText());
}
else if (ts_morph_1.Node.isTrueLiteral(valueNode)) {
return true;
}
else if (ts_morph_1.Node.isFalseLiteral(valueNode)) {
return false;
}
else if (ts_morph_1.Node.isNullLiteral(valueNode)) {
return null;
}
else if (ts_morph_1.Node.isArrayLiteralExpression(valueNode)) {
return getArray(valueNode);
}
else if (ts_morph_1.Node.isObjectLiteralExpression(valueNode)) {
return getObject(valueNode);
}
else if (ts_morph_1.Node.isIdentifier(valueNode) &&
valueNode.getText() === 'undefined') {
return undefined;
}
throw new Error(`Unhandled type: "${valueNode.getKindName()}" ${valueNode.getText()}`);
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 (!ts_morph_1.Node.isPropertyAssignment(prop))
continue;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [nameNode, _colon, valueNode] = prop.getChildren();
const name = nameNode.getText();
rtn[name] = getValue(valueNode);
}
return rtn;
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;
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;
}
//# sourceMappingURL=index.js.map
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BaseFunctionConfigSchema,
getConfig
});
+100
-119
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConfig = exports.extractExportedConstValue = exports.UnsupportedValueError = void 0;
const validation_1 = require("./validation");
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 {
}
exports.UnsupportedValueError = UnsupportedValueError;
function extractValue(node) {
if (node.type === 'NullLiteral') {
return null;
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 === 'BooleanLiteral') {
// e.g. true / false
return node.value;
} 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);
}
}
else if (node.type === 'StringLiteral') {
// e.g. "abc"
return node.value;
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);
}
else if (node.type === 'NumericLiteral') {
// e.g. 123
return node.value;
return obj;
} else {
throw new UnsupportedValueError();
}
}
function extractExportedConstValue(module2, exportedName) {
for (const moduleItem of module2.body) {
if (moduleItem.type !== "ExportDeclaration") {
continue;
}
else if (node.type === 'Identifier') {
switch (node.value) {
case 'undefined':
return undefined;
default:
throw new UnsupportedValueError();
}
const { declaration } = moduleItem;
if (declaration.type !== "VariableDeclaration") {
continue;
}
else if (node.type === 'ArrayExpression') {
// e.g. [1, 2, 3]
const arr = [];
for (const elem of node.elements) {
if (elem) {
if (elem.spread) {
// e.g. [ ...a ]
throw new UnsupportedValueError();
}
arr.push(extractValue(elem.expression));
}
else {
// e.g. [1, , 2]
// ^^
arr.push(undefined);
}
}
return arr;
if (declaration.kind !== "const") {
continue;
}
else if (node.type === 'ObjectExpression') {
// e.g. { a: 1, b: 2 }
const obj = {};
for (const prop of node.properties) {
if (prop.type !== 'KeyValueProperty') {
// e.g. { ...a }
throw new UnsupportedValueError();
}
let key;
if (prop.key.type === 'Identifier') {
// e.g. { a: 1, b: 2 }
key = prop.key.value;
}
else if (prop.key.type === 'StringLiteral') {
// e.g. { "a": 1, "b": 2 }
key = prop.key.value;
}
else {
throw new UnsupportedValueError();
}
obj[key] = extractValue(prop.value);
}
return obj;
for (const decl of declaration.declarations) {
if (decl.id.type === "Identifier" && decl.id.value === exportedName && decl.init) {
return extractValue(decl.init);
}
}
else {
throw new UnsupportedValueError();
}
}
return null;
}
// Extracts the value of an exported const variable named `exportedName`
// (e.g. "export const config = { runtime: 'edge' }") from swc's AST.
//
// The value must be one of (or throws UnsupportedValueError):
//
// - string
// - boolean
// - number
// - null
// - undefined
// - array containing values listed in this list
// - object containing values listed in this list
//
function extractExportedConstValue(module, exportedName) {
for (const moduleItem of module.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);
}
}
}
function getConfig(module2, schema) {
const data = extractExportedConstValue(module2, "config");
if (!data) {
return null;
}
if (schema) {
(0, import_validation.validate)(schema, data);
}
return data;
}
exports.extractExportedConstValue = extractExportedConstValue;
// Extracts the value of `export const config` in the given swc AST (`module`).
//
// Returns null if the declaration is not found.
//
// Throws exceptions if it contains a syntax node which're not literal or
// the validation fails.
function getConfig(module, schema) {
const data = extractExportedConstValue(module, 'config');
if (!data) {
return null;
}
if (schema) {
(0, validation_1.validate)(schema, data);
}
// @ts-expect-error - this seems to work just fine, but TS complains it could be infinite nesting
return data;
}
exports.getConfig = getConfig;
//# sourceMappingURL=swc.js.map
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
UnsupportedValueError,
extractExportedConstValue,
getConfig
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
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 });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.validate = void 0;
const ajv_1 = __importDefault(require("ajv"));
const ajv = new ajv_1.default();
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)) {
// TODO: better error message
throw new Error('Invalid data');
}
// @ts-expect-error - this seems to work just fine, but TS complains it could be infinite nesting
return data;
const isValid = ajv.compile(schema);
if (!isValid(data)) {
throw new Error("Invalid data");
}
return data;
}
exports.validate = validate;
//# sourceMappingURL=validation.js.map
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
validate
});
{
"name": "@vercel/static-config",
"version": "3.0.0",
"version": "3.1.0",
"license": "Apache-2.0",

@@ -27,6 +27,7 @@ "main": "./dist/index",

"scripts": {
"build": "tsc",
"build": "node ../../utils/build.mjs",
"test-unit": "pnpm test",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail"
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
"type-check": "tsc --noEmit"
}
}
{"version":3,"file":"index.js","sourceRoot":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