@vercel/build-utils
Advanced tools
| import type { Diagnostics } from './types'; | ||
| export interface PackageManifestDependency { | ||
| name: string; | ||
| type: 'direct' | 'transitive' | 'peer'; | ||
| scopes: string[]; | ||
| requested?: string; | ||
| resolved: string; | ||
| source?: string; | ||
| sourceUrl?: string; | ||
| } | ||
| export interface PackageManifest { | ||
| version?: string; | ||
| runtime: string; | ||
| runtimeVersion?: { | ||
| requested?: string; | ||
| requestedSource?: string; | ||
| resolved: string; | ||
| }; | ||
| dependencies: PackageManifestDependency[]; | ||
| } | ||
| export declare const MANIFEST_VERSION = "20260304"; | ||
| export declare const MANIFEST_FILENAME = "package-manifest.json"; | ||
| export declare function manifestPath(runtime: string): string; | ||
| export declare function writeProjectManifest(manifest: PackageManifest, workPath: string, runtime: string): Promise<void>; | ||
| export declare function createDiagnostics(runtime: string): Diagnostics; |
| "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 package_manifest_exports = {}; | ||
| __export(package_manifest_exports, { | ||
| MANIFEST_FILENAME: () => MANIFEST_FILENAME, | ||
| MANIFEST_VERSION: () => MANIFEST_VERSION, | ||
| createDiagnostics: () => createDiagnostics, | ||
| manifestPath: () => manifestPath, | ||
| writeProjectManifest: () => writeProjectManifest | ||
| }); | ||
| module.exports = __toCommonJS(package_manifest_exports); | ||
| var import_fs = __toESM(require("fs")); | ||
| var import_path = require("path"); | ||
| var import_file_blob = __toESM(require("./file-blob")); | ||
| const MANIFEST_VERSION = "20260304"; | ||
| const MANIFEST_FILENAME = "package-manifest.json"; | ||
| function manifestPath(runtime) { | ||
| return (0, import_path.join)(".vercel", runtime, MANIFEST_FILENAME); | ||
| } | ||
| async function writeProjectManifest(manifest, workPath, runtime) { | ||
| const outPath = (0, import_path.join)(workPath, manifestPath(runtime)); | ||
| await import_fs.default.promises.mkdir((0, import_path.dirname)(outPath), { recursive: true }); | ||
| await import_fs.default.promises.writeFile(outPath, JSON.stringify(manifest, null, 2)); | ||
| } | ||
| function createDiagnostics(runtime) { | ||
| return async ({ workPath }) => { | ||
| try { | ||
| const filePath = (0, import_path.join)(workPath, manifestPath(runtime)); | ||
| const data = await import_fs.default.promises.readFile(filePath, "utf-8"); | ||
| return { | ||
| [MANIFEST_FILENAME]: new import_file_blob.default({ data }) | ||
| }; | ||
| } catch { | ||
| return {}; | ||
| } | ||
| }; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| MANIFEST_FILENAME, | ||
| MANIFEST_VERSION, | ||
| createDiagnostics, | ||
| manifestPath, | ||
| writeProjectManifest | ||
| }); |
+12
-0
| # @vercel/build-utils | ||
| ## 13.18.0 | ||
| ### Minor Changes | ||
| - Generate PROJECTMANIFEST in @vercel/backends for Node deployments. ([#15991](https://github.com/vercel/vercel/pull/15991)) | ||
| ## 13.17.2 | ||
| ### Patch Changes | ||
| - [experimental-services] add new job service type support ([#15944](https://github.com/vercel/vercel/pull/15944)) | ||
| ## 13.17.1 | ||
@@ -4,0 +16,0 @@ |
+1
-0
@@ -30,2 +30,3 @@ import FileBlob from './file-blob'; | ||
| export * from './schemas'; | ||
| export * from './package-manifest'; | ||
| export * from './types'; | ||
@@ -32,0 +33,0 @@ export * from './errors'; |
+33
-11
@@ -113,4 +113,6 @@ /// <reference types="node" /> | ||
| name?: string; | ||
| /** The service type (e.g., "web", "cron", "worker"). */ | ||
| /** The service type (e.g., "web", "worker", "job"). */ | ||
| type?: ServiceType; | ||
| /** The job trigger type (e.g., "queue", "schedule", "workflow"). */ | ||
| trigger?: JobTrigger; | ||
| /** URL path prefix where the service is mounted (e.g., "/api"). */ | ||
@@ -496,5 +498,14 @@ routePrefix?: string; | ||
| } | ||
| export interface ServiceQueueTopic { | ||
| topic: string; | ||
| retryAfterSeconds?: number; | ||
| initialDelaySeconds?: number; | ||
| } | ||
| export type ServiceTopics = string[] | ServiceQueueTopic[]; | ||
| export declare const JOB_TRIGGERS: readonly ["queue", "schedule", "workflow"]; | ||
| export type JobTrigger = (typeof JOB_TRIGGERS)[number]; | ||
| export interface Service { | ||
| name: string; | ||
| type: ServiceType; | ||
| trigger?: JobTrigger; | ||
| group?: string; | ||
@@ -513,3 +524,3 @@ workspace: string; | ||
| handlerFunction?: string; | ||
| topics?: string[]; | ||
| topics?: ServiceTopics; | ||
| consumer?: string; | ||
@@ -519,8 +530,18 @@ /** custom prefix to inject service URL env vars */ | ||
| } | ||
| /** | ||
| * Returns the topics a worker service subscribes to, defaulting to ['default']. | ||
| */ | ||
| export declare function getWorkerTopics(config: { | ||
| topics?: string[]; | ||
| }): [string, ...string[]]; | ||
| export declare function getServiceQueueTopicConfigs(config: { | ||
| type?: ServiceType; | ||
| topics?: ServiceTopics; | ||
| }): ServiceQueueTopic[]; | ||
| export declare function getServiceQueueTopics(config: { | ||
| type?: ServiceType; | ||
| topics?: ServiceTopics; | ||
| }): string[]; | ||
| export declare function isQueueTriggeredService(service: { | ||
| type?: ServiceType; | ||
| trigger?: JobTrigger; | ||
| }): boolean; | ||
| export declare function isScheduleTriggeredService(service: { | ||
| type?: ServiceType; | ||
| trigger?: JobTrigger; | ||
| }): boolean; | ||
| /** The framework which created the function */ | ||
@@ -673,3 +694,3 @@ export interface FunctionFramework { | ||
| export type ServiceRuntime = 'node' | 'python' | 'go' | 'rust' | 'ruby'; | ||
| export type ServiceType = 'web' | 'cron' | 'worker'; | ||
| export type ServiceType = 'web' | 'cron' | 'worker' | 'job'; | ||
| export interface ServiceMount { | ||
@@ -687,2 +708,3 @@ /** URL path prefix where the service is mounted. */ | ||
| type?: ServiceType; | ||
| trigger?: JobTrigger; | ||
| /** | ||
@@ -720,5 +742,5 @@ * Path to the service's root directory relative to the project root. | ||
| subdomain?: string; | ||
| /** Cron schedule expression (e.g., "0 0 * * *") */ | ||
| /** Cron schedule expression(s) (e.g., "0 0 * * *") */ | ||
| schedule?: string; | ||
| topics?: string[]; | ||
| topics?: ServiceTopics; | ||
| consumer?: string; | ||
@@ -725,0 +747,0 @@ /** Custom prefix to use to inject service URL env vars */ |
+25
-4
@@ -22,5 +22,9 @@ "use strict"; | ||
| BunVersion: () => BunVersion, | ||
| JOB_TRIGGERS: () => JOB_TRIGGERS, | ||
| NodeVersion: () => NodeVersion, | ||
| Version: () => Version, | ||
| getWorkerTopics: () => getWorkerTopics | ||
| getServiceQueueTopicConfigs: () => getServiceQueueTopicConfigs, | ||
| getServiceQueueTopics: () => getServiceQueueTopics, | ||
| isQueueTriggeredService: () => isQueueTriggeredService, | ||
| isScheduleTriggeredService: () => isScheduleTriggeredService | ||
| }); | ||
@@ -52,11 +56,28 @@ module.exports = __toCommonJS(types_exports); | ||
| } | ||
| function getWorkerTopics(config) { | ||
| return config.topics?.length ? config.topics : ["default"]; | ||
| const JOB_TRIGGERS = ["queue", "schedule", "workflow"]; | ||
| function getServiceQueueTopicConfigs(config) { | ||
| if (Array.isArray(config.topics) && config.topics.length > 0) { | ||
| return typeof config.topics[0] === "string" ? config.topics.map((topic) => ({ topic })) : config.topics; | ||
| } | ||
| return config.type === "worker" ? [{ topic: "default" }] : []; | ||
| } | ||
| function getServiceQueueTopics(config) { | ||
| return getServiceQueueTopicConfigs(config).map((topic) => topic.topic); | ||
| } | ||
| function isQueueTriggeredService(service) { | ||
| return service.type === "worker" || service.type === "job" && service.trigger === "queue"; | ||
| } | ||
| function isScheduleTriggeredService(service) { | ||
| return service.type === "cron" || service.type === "job" && service.trigger === "schedule"; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| BunVersion, | ||
| JOB_TRIGGERS, | ||
| NodeVersion, | ||
| Version, | ||
| getWorkerTopics | ||
| getServiceQueueTopicConfigs, | ||
| getServiceQueueTopics, | ||
| isQueueTriggeredService, | ||
| isScheduleTriggeredService | ||
| }); |
+1
-1
| { | ||
| "name": "@vercel/build-utils", | ||
| "version": "13.17.1", | ||
| "version": "13.18.0", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 11 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 3 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 11 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 3 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1768222
0.48%146
1.39%43360
0.46%52
1.96%