@vercel/build-utils 14.10.2 → 14.12.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.
- package/CHANGELOG.md +26 -0
- package/DEV_MANIFEST.md +84 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/lambda.d.ts +2 -1
- package/dist/lambda.js +9 -3
- package/dist/prerender.d.ts +5 -1
- package/dist/prerender.js +3 -1
- package/dist/schedule-path-utils.d.ts +3 -0
- package/dist/schedule-path-utils.js +38 -0
- package/dist/types.d.ts +74 -0
- package/package.json +1 -1
package/dist/lambda.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export interface LambdaOptionsWithZipBuffer extends LambdaOptionsBase {
|
|
|
87
87
|
interface GetLambdaOptionsFromFunctionOptions {
|
|
88
88
|
sourceFile: string;
|
|
89
89
|
config?: Pick<Config, 'functions' | 'serviceName'>;
|
|
90
|
+
isScheduleEntrypoint?: boolean;
|
|
90
91
|
}
|
|
91
92
|
export declare class Lambda {
|
|
92
93
|
type: 'Lambda';
|
|
@@ -161,4 +162,4 @@ export declare class Lambda {
|
|
|
161
162
|
*/
|
|
162
163
|
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
|
163
164
|
export declare function createZip(files: Files): Promise<Buffer>;
|
|
164
|
-
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'affinity' | 'maxConcurrency' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
|
|
165
|
+
export declare function getLambdaOptionsFromFunction({ sourceFile, config, isScheduleEntrypoint, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'affinity' | 'maxConcurrency' | 'regions' | 'functionFailoverRegions' | 'experimentalTriggers' | 'supportsCancellation'>>;
|
package/dist/lambda.js
CHANGED
|
@@ -360,7 +360,8 @@ async function createZip(files) {
|
|
|
360
360
|
}
|
|
361
361
|
async function getLambdaOptionsFromFunction({
|
|
362
362
|
sourceFile,
|
|
363
|
-
config
|
|
363
|
+
config,
|
|
364
|
+
isScheduleEntrypoint = false
|
|
364
365
|
}) {
|
|
365
366
|
if (config?.functions) {
|
|
366
367
|
const serviceName = typeof config.serviceName === "string" && config.serviceName !== "" ? config.serviceName : void 0;
|
|
@@ -385,6 +386,11 @@ async function getLambdaOptionsFromFunction({
|
|
|
385
386
|
`functions["${pattern}"].experimentalTriggers can only have one item for queue/v2beta`
|
|
386
387
|
);
|
|
387
388
|
}
|
|
389
|
+
if (isScheduleEntrypoint && experimentalTriggers !== void 0 && !(experimentalTriggers.length === 1 && experimentalTriggers[0]?.type === "schedule/v1beta")) {
|
|
390
|
+
throw new Error(
|
|
391
|
+
`functions["${pattern}"].experimentalTriggers conflicts with the schedule entrypoint trigger`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
388
394
|
return {
|
|
389
395
|
architecture: fn.architecture,
|
|
390
396
|
memory: fn.memory,
|
|
@@ -393,13 +399,13 @@ async function getLambdaOptionsFromFunction({
|
|
|
393
399
|
maxConcurrency: fn.maxConcurrency,
|
|
394
400
|
regions: fn.regions,
|
|
395
401
|
functionFailoverRegions: fn.functionFailoverRegions,
|
|
396
|
-
experimentalTriggers,
|
|
402
|
+
experimentalTriggers: isScheduleEntrypoint ? [{ type: "schedule/v1beta" }] : experimentalTriggers,
|
|
397
403
|
supportsCancellation: fn.supportsCancellation
|
|
398
404
|
};
|
|
399
405
|
}
|
|
400
406
|
}
|
|
401
407
|
}
|
|
402
|
-
return {};
|
|
408
|
+
return isScheduleEntrypoint ? { experimentalTriggers: [{ type: "schedule/v1beta" }] } : {};
|
|
403
409
|
}
|
|
404
410
|
// Annotate the CommonJS export names for ESM import in node:
|
|
405
411
|
0 && (module.exports = {
|
package/dist/prerender.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface PrerenderInitialMetadata {
|
|
|
22
22
|
*/
|
|
23
23
|
htmlSize?: number;
|
|
24
24
|
}
|
|
25
|
+
export type PrerenderOnMiss = 'sync' | 'dynamic';
|
|
25
26
|
interface PrerenderOptions {
|
|
26
27
|
expiration: number | false;
|
|
27
28
|
staleExpiration?: number;
|
|
@@ -41,6 +42,7 @@ interface PrerenderOptions {
|
|
|
41
42
|
exposeErrBody?: boolean;
|
|
42
43
|
partialFallback?: boolean;
|
|
43
44
|
initialMetadata?: PrerenderInitialMetadata;
|
|
45
|
+
onMiss?: PrerenderOnMiss;
|
|
44
46
|
}
|
|
45
47
|
export declare class Prerender {
|
|
46
48
|
type: 'Prerender';
|
|
@@ -77,6 +79,8 @@ export declare class Prerender {
|
|
|
77
79
|
* from frameworks that predate the field carry none.
|
|
78
80
|
*/
|
|
79
81
|
initialMetadata?: PrerenderInitialMetadata;
|
|
80
|
-
|
|
82
|
+
/** Serving mode when no prerendered output exists yet. Absent means `sync`. Interpreted by the proxy; carried unvalidated. */
|
|
83
|
+
onMiss?: PrerenderOnMiss;
|
|
84
|
+
constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, initialMetadata, onMiss, }: PrerenderOptions);
|
|
81
85
|
}
|
|
82
86
|
export {};
|
package/dist/prerender.js
CHANGED
|
@@ -40,13 +40,15 @@ class Prerender {
|
|
|
40
40
|
chain,
|
|
41
41
|
exposeErrBody,
|
|
42
42
|
partialFallback,
|
|
43
|
-
initialMetadata
|
|
43
|
+
initialMetadata,
|
|
44
|
+
onMiss
|
|
44
45
|
}) {
|
|
45
46
|
this.type = "Prerender";
|
|
46
47
|
this.expiration = expiration;
|
|
47
48
|
this.staleExpiration = staleExpiration;
|
|
48
49
|
this.sourcePath = sourcePath;
|
|
49
50
|
this.initialMetadata = initialMetadata;
|
|
51
|
+
this.onMiss = onMiss;
|
|
50
52
|
this.lambda = lambda;
|
|
51
53
|
if (this.lambda) {
|
|
52
54
|
this.lambda.operationType = this.lambda.operationType || "ISR";
|
|
@@ -0,0 +1,38 @@
|
|
|
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 schedule_path_utils_exports = {};
|
|
20
|
+
__export(schedule_path_utils_exports, {
|
|
21
|
+
SCHEDULE_FUNCTION_PREFIX: () => SCHEDULE_FUNCTION_PREFIX,
|
|
22
|
+
getScheduleFunctionPath: () => getScheduleFunctionPath
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(schedule_path_utils_exports);
|
|
25
|
+
const SCHEDULE_FUNCTION_PREFIX = "_vercel/schedules";
|
|
26
|
+
function getScheduleFunctionPath(entrypointSegments) {
|
|
27
|
+
if (entrypointSegments.length === 0 || entrypointSegments.some(
|
|
28
|
+
(segment) => !segment || segment === "." || segment === ".." || segment.includes("/") || segment.includes("\\")
|
|
29
|
+
)) {
|
|
30
|
+
throw new Error("Schedule function paths require safe, non-empty segments");
|
|
31
|
+
}
|
|
32
|
+
return [SCHEDULE_FUNCTION_PREFIX, ...entrypointSegments].join("/");
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
SCHEDULE_FUNCTION_PREFIX,
|
|
37
|
+
getScheduleFunctionPath
|
|
38
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,25 @@ export interface FileBase {
|
|
|
21
21
|
export interface Files {
|
|
22
22
|
[filePath: string]: File;
|
|
23
23
|
}
|
|
24
|
+
export interface ScheduleFunctionEntrypoint {
|
|
25
|
+
/** Runtime-specific entrypoint locator from `vercel.json`. */
|
|
26
|
+
entrypoint: string;
|
|
27
|
+
/** Project-relative source file that contains the entrypoint. */
|
|
28
|
+
sourceFile: string;
|
|
29
|
+
/** Names of the schedules that dispatch to this entrypoint, in config order. */
|
|
30
|
+
scheduleNames: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One function built from schedule entrypoints. Runtimes that pack several
|
|
34
|
+
* entrypoints into a single function receive them all here and dispatch on
|
|
35
|
+
* the schedule name at runtime; runtimes that build one function per
|
|
36
|
+
* entrypoint receive exactly one.
|
|
37
|
+
*/
|
|
38
|
+
export interface ScheduleFunctionBuildConfig {
|
|
39
|
+
/** Function output path every schedule in this build targets. */
|
|
40
|
+
outputPath: string;
|
|
41
|
+
entrypoints: [ScheduleFunctionEntrypoint, ...ScheduleFunctionEntrypoint[]];
|
|
42
|
+
}
|
|
24
43
|
export interface Config {
|
|
25
44
|
bunVersion?: string;
|
|
26
45
|
maxLambdaSize?: string;
|
|
@@ -52,6 +71,8 @@ export interface Config {
|
|
|
52
71
|
serviceName?: string;
|
|
53
72
|
/** Buildpack runtime slug (e.g. "ruby"). */
|
|
54
73
|
buildpack?: string;
|
|
74
|
+
/** Set when this build produces a function for schedule entrypoints. */
|
|
75
|
+
scheduleFunction?: ScheduleFunctionBuildConfig;
|
|
55
76
|
[key: string]: unknown;
|
|
56
77
|
}
|
|
57
78
|
export type { HasField };
|
|
@@ -464,6 +485,56 @@ export interface DevSubscriber {
|
|
|
464
485
|
export type DevSidecar = DevSubscriber;
|
|
465
486
|
/** Returns additional processes that a builder needs alongside its primary dev server. */
|
|
466
487
|
export type GetDevSidecars = (options: GetDevSidecarsOptions) => Promise<DevSidecar[]>;
|
|
488
|
+
/** A deployment function identity and its local execution target. */
|
|
489
|
+
export interface DevFunction {
|
|
490
|
+
/** Build output function path, without a leading slash or .func suffix. */
|
|
491
|
+
outputPath: string;
|
|
492
|
+
/** Source path relative to workPath, when this is a source-backed function. */
|
|
493
|
+
sourceFile?: string;
|
|
494
|
+
invocation: {
|
|
495
|
+
type: 'http';
|
|
496
|
+
/** Root-relative pathname within the owning dev server, including basePath. */
|
|
497
|
+
pathname: string;
|
|
498
|
+
} | {
|
|
499
|
+
type: 'entrypoint';
|
|
500
|
+
/** Select this builder entrypoint directly, without public URL routing. */
|
|
501
|
+
entrypoint: string;
|
|
502
|
+
};
|
|
503
|
+
/** Normalized deployment trigger metadata, including Queue consumer identity. */
|
|
504
|
+
experimentalTriggers?: TriggerEvent[];
|
|
505
|
+
}
|
|
506
|
+
export interface GetDevManifestOptions {
|
|
507
|
+
/** Absolute project or service root. */
|
|
508
|
+
workPath: string;
|
|
509
|
+
/** Original builder entry, before source expansion or dev-command filtering. */
|
|
510
|
+
build: Builder;
|
|
511
|
+
/** Real source paths relative to workPath, using forward slashes. No aliases. */
|
|
512
|
+
files: string[];
|
|
513
|
+
/** Resolved authored configuration for this scope, including functions. */
|
|
514
|
+
config: Config;
|
|
515
|
+
/** Effective development environment. Do not mutate this object. */
|
|
516
|
+
env: Env;
|
|
517
|
+
}
|
|
518
|
+
export interface DevManifest {
|
|
519
|
+
/** Complete replacement snapshot for the invoking builder scope. */
|
|
520
|
+
functions: DevFunction[];
|
|
521
|
+
/** Native framework schedules, using the static Build Output API schema. */
|
|
522
|
+
schedules?: Schedule[];
|
|
523
|
+
/** Authored functions keys resolved by this provider, for unmatched diagnostics. */
|
|
524
|
+
matchedFunctionPatterns: string[];
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Discover deployment function identities and optional native schedules without
|
|
528
|
+
* starting an application server, scheduler, or delivery loop. The host owns
|
|
529
|
+
* runtime origins, readiness, and trigger registration. Functions do not need a
|
|
530
|
+
* Queue trigger to be discoverable; direct Schedule targets use outputPath.
|
|
531
|
+
* Called before framework builders are filtered for a native dev command, and
|
|
532
|
+
* again on source/config/environment changes. An empty snapshot removes this
|
|
533
|
+
* owner's registrations. Errors must leave the last valid snapshot in place.
|
|
534
|
+
* An absent hook permits the host's conventional per-entrypoint fallback; an
|
|
535
|
+
* explicitly empty manifest is authoritative and must not enable that fallback.
|
|
536
|
+
*/
|
|
537
|
+
export type GetDevManifest = (options: GetDevManifestOptions) => Promise<DevManifest>;
|
|
467
538
|
export interface BuilderVX {
|
|
468
539
|
version: -1;
|
|
469
540
|
build: BuildVX;
|
|
@@ -472,6 +543,7 @@ export interface BuilderVX {
|
|
|
472
543
|
shouldServe?: ShouldServe;
|
|
473
544
|
startDevServer?: StartDevServer;
|
|
474
545
|
getDevSidecars?: GetDevSidecars;
|
|
546
|
+
getDevManifest?: GetDevManifest;
|
|
475
547
|
}
|
|
476
548
|
export interface BuilderV2 {
|
|
477
549
|
version: 2;
|
|
@@ -481,6 +553,7 @@ export interface BuilderV2 {
|
|
|
481
553
|
shouldServe?: ShouldServe;
|
|
482
554
|
startDevServer?: StartDevServer;
|
|
483
555
|
getDevSidecars?: GetDevSidecars;
|
|
556
|
+
getDevManifest?: GetDevManifest;
|
|
484
557
|
}
|
|
485
558
|
export interface BuilderV3 {
|
|
486
559
|
version: 3;
|
|
@@ -490,6 +563,7 @@ export interface BuilderV3 {
|
|
|
490
563
|
shouldServe?: ShouldServe;
|
|
491
564
|
startDevServer?: StartDevServer;
|
|
492
565
|
getDevSidecars?: GetDevSidecars;
|
|
566
|
+
getDevManifest?: GetDevManifest;
|
|
493
567
|
}
|
|
494
568
|
type ImageFormat = 'image/avif' | 'image/webp';
|
|
495
569
|
type ImageContentDispositionType = 'inline' | 'attachment';
|