@vercel/build-utils 13.15.0 → 13.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shared utilities for generating internal service paths.
3
+ *
4
+ * These are used by builders (e.g. @vercel/python) to produce cron entries
5
+ * and rewrite routes for service builds.
6
+ */
7
+ /**
8
+ * Reserved internal namespace used by services routing/runtime plumbing.
9
+ */
10
+ export declare const INTERNAL_SERVICE_PREFIX = "/_svc";
11
+ export declare function getInternalServiceFunctionPath(serviceName: string): string;
12
+ export declare function getInternalServiceCronPathPrefix(serviceName: string): string;
13
+ export declare function getInternalServiceCronPath(serviceName: string, entrypoint: string, handler?: string): string;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var service_path_utils_exports = {};
20
+ __export(service_path_utils_exports, {
21
+ INTERNAL_SERVICE_PREFIX: () => INTERNAL_SERVICE_PREFIX,
22
+ getInternalServiceCronPath: () => getInternalServiceCronPath,
23
+ getInternalServiceCronPathPrefix: () => getInternalServiceCronPathPrefix,
24
+ getInternalServiceFunctionPath: () => getInternalServiceFunctionPath
25
+ });
26
+ module.exports = __toCommonJS(service_path_utils_exports);
27
+ const INTERNAL_SERVICE_PREFIX = "/_svc";
28
+ function normalizeInternalServiceEntrypoint(entrypoint) {
29
+ const normalized = entrypoint.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.[^/.]+$/, "");
30
+ return normalized || "index";
31
+ }
32
+ function getInternalServiceFunctionPath(serviceName) {
33
+ return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/index`;
34
+ }
35
+ function getInternalServiceCronPathPrefix(serviceName) {
36
+ return `${INTERNAL_SERVICE_PREFIX}/${serviceName}/crons`;
37
+ }
38
+ function getInternalServiceCronPath(serviceName, entrypoint, handler = "cron") {
39
+ const normalizedEntrypoint = normalizeInternalServiceEntrypoint(entrypoint);
40
+ return `${getInternalServiceCronPathPrefix(serviceName)}/${normalizedEntrypoint}/${handler}`;
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ INTERNAL_SERVICE_PREFIX,
45
+ getInternalServiceCronPath,
46
+ getInternalServiceCronPathPrefix,
47
+ getInternalServiceFunctionPath
48
+ });
package/dist/types.d.ts CHANGED
@@ -118,6 +118,8 @@ export interface BuildOptions {
118
118
  subdomain?: string;
119
119
  /** Workspace directory for this service, relative to the project root. */
120
120
  workspace?: string;
121
+ /** Cron schedule expression (e.g., "0 0 * * *"). Only present for cron services. */
122
+ schedule?: string;
121
123
  };
122
124
  }
123
125
  export interface PrepareCacheOptions {
@@ -219,6 +221,11 @@ export interface StartDevServerSuccess {
219
221
  * dev server will forcefully be killed.
220
222
  */
221
223
  shutdown?: () => Promise<void>;
224
+ /**
225
+ * Cron entries produced by the builder for this service.
226
+ * Used by the dev orchestrator to schedule cron triggers.
227
+ */
228
+ crons?: Cron[];
222
229
  }
223
230
  /**
224
231
  * `startDevServer()` may return `null` to opt-out of spawning a dev server for
@@ -545,6 +552,7 @@ export interface BuildResultV2Typical {
545
552
  * @example "abc123"
546
553
  */
547
554
  deploymentId?: string;
555
+ crons?: Cron[];
548
556
  }
549
557
  export type BuildResultVX = {
550
558
  resultVersion: 2;
@@ -557,6 +565,7 @@ export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
557
565
  export interface BuildResultV3 {
558
566
  routes?: any[];
559
567
  output: Lambda | EdgeFunction;
568
+ crons?: Cron[];
560
569
  }
561
570
  export type BuildVX = (options: BuildOptions) => Promise<BuildResultVX>;
562
571
  export type BuildV2 = (options: BuildOptions) => Promise<BuildResultV2>;
@@ -671,7 +680,13 @@ export interface ServiceMount {
671
680
  export interface ExperimentalServiceConfig {
672
681
  type?: ServiceType;
673
682
  /**
674
- * Service entrypoint, relative to the project root.
683
+ * Path to the service's root directory relative to the project root.
684
+ * Should contain a manifest file (package.json, pyproject.toml, etc.).
685
+ * Defaults to ".".
686
+ */
687
+ root?: string;
688
+ /**
689
+ * Service entrypoint, relative to the service root directory.
675
690
  * Can be either a file path (runtime entrypoint) or a directory path
676
691
  * (service workspace for framework-based services).
677
692
  * @example "apps/web", "services/api/src/index.ts", "services/fastapi/main.py"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.15.0",
3
+ "version": "13.17.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -26,6 +26,7 @@
26
26
  "@types/glob": "7.2.0",
27
27
  "@types/jest": "27.4.1",
28
28
  "@types/js-yaml": "3.12.1",
29
+ "@types/mime-types": "2.1.0",
29
30
  "@types/minimatch": "^5.1.2",
30
31
  "@types/ms": "0.7.31",
31
32
  "@types/multistream": "2.1.1",
@@ -45,6 +46,7 @@
45
46
  "into-stream": "5.0.0",
46
47
  "jest-junit": "16.0.0",
47
48
  "js-yaml": "3.13.1",
49
+ "mime-types": "2.1.28",
48
50
  "minimatch": "3.1.2",
49
51
  "ms": "2.1.3",
50
52
  "multistream": "2.1.1",