@vercel/build-utils 14.21.3 → 14.23.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 +22 -0
- package/dist/daemon-static-publishing.js +7 -1
- package/dist/daemons.d.ts +4 -0
- package/dist/index.js +5 -5
- package/dist/schedules.d.ts +20 -15
- package/dist/schedules.js +22 -27
- package/dist/schemas.d.ts +8 -0
- package/dist/schemas.js +4 -0
- package/dist/types.d.ts +24 -8
- package/package.json +1 -1
package/dist/schedules.d.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import type { Schedule } from './types';
|
|
1
|
+
import type { Schedule, ScheduleDefinition, Schedules } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* A `vercel.json` schedule
|
|
4
|
-
* before the schedule reaches
|
|
3
|
+
* A `vercel.json` schedule without its name, which is its key in `schedules`.
|
|
4
|
+
* `entrypoint` targets are resolved to `function` before the schedule reaches
|
|
5
|
+
* Build Output.
|
|
5
6
|
*/
|
|
6
|
-
export type
|
|
7
|
+
export type VercelJsonScheduleDefinition = ScheduleDefinition | (Pick<ScheduleDefinition, 'schedule' | 'timezone' | 'jitter'> & {
|
|
7
8
|
entrypoint: string;
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
-
export type
|
|
10
|
+
/** `vercel.json#schedules`: schedules keyed by name. */
|
|
11
|
+
export type VercelJsonSchedules = Record<string, VercelJsonScheduleDefinition>;
|
|
12
|
+
/** A `vercel.json` schedule with its name. */
|
|
13
|
+
export type VercelJsonSchedule = {
|
|
14
|
+
name: string;
|
|
15
|
+
} & VercelJsonScheduleDefinition;
|
|
11
16
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* (except for entrypoint schedules) and the API derives its own; using the
|
|
15
|
-
* same hash keeps `vercel dev` names the same as deployed ones. A function
|
|
16
|
-
* target's service is appended as `|service`, matching the API.
|
|
17
|
+
* The schedules in `schedules` with their names, in key order. Accepts the
|
|
18
|
+
* deprecated array format, which already names each schedule.
|
|
17
19
|
*/
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
20
|
+
export declare function getNamedSchedules(schedules: Schedules | readonly Schedule[] | undefined): Schedule[];
|
|
21
|
+
export declare function getNamedSchedules(schedules: VercelJsonSchedules | readonly VercelJsonSchedule[] | undefined): VercelJsonSchedule[];
|
|
22
|
+
/** Named schedules keyed by name, for `schedules` in Build Output. */
|
|
23
|
+
export declare function toScheduleRecord(schedules: readonly Schedule[]): Schedules;
|
|
24
|
+
export declare function toScheduleRecord(schedules: readonly VercelJsonSchedule[]): VercelJsonSchedules;
|
|
25
|
+
/** Warning for `schedules` in the deprecated array format. */
|
|
26
|
+
export declare function getSchedulesArrayDeprecationWarning(source: string): string;
|
package/dist/schedules.js
CHANGED
|
@@ -18,37 +18,32 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var schedules_exports = {};
|
|
20
20
|
__export(schedules_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
getNamedSchedules: () => getNamedSchedules,
|
|
22
|
+
getSchedulesArrayDeprecationWarning: () => getSchedulesArrayDeprecationWarning,
|
|
23
|
+
toScheduleRecord: () => toScheduleRecord
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(schedules_exports);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const input = `${type}|${ref}|${expression}`;
|
|
35
|
-
return (0, import_crypto.createHash)("sha1").update(service === void 0 ? input : `${input}|${service}`).digest("hex").slice(0, DEFAULT_NAME_HASH_LENGTH);
|
|
26
|
+
function getNamedSchedules(schedules) {
|
|
27
|
+
if (schedules === void 0)
|
|
28
|
+
return [];
|
|
29
|
+
if (Array.isArray(schedules))
|
|
30
|
+
return [...schedules];
|
|
31
|
+
return Object.entries(schedules).map(([name, schedule]) => ({
|
|
32
|
+
name,
|
|
33
|
+
...schedule
|
|
34
|
+
}));
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
const ref = schedule[type];
|
|
47
|
-
const service = type === "function" && "service" in schedule ? schedule.service : void 0;
|
|
48
|
-
return defaultScheduleName(type, ref ?? "", schedule.schedule, service);
|
|
36
|
+
function toScheduleRecord(schedules) {
|
|
37
|
+
return Object.fromEntries(
|
|
38
|
+
schedules.map(({ name, ...schedule }) => [name, schedule])
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function getSchedulesArrayDeprecationWarning(source) {
|
|
42
|
+
return `Listing \`schedules\` as an array in ${source} is deprecated. Key each schedule by its name instead, like \`"schedules": { "nightly": { "schedule": "0 0 * * *", "path": "/api/cron" } }\`.`;
|
|
49
43
|
}
|
|
50
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
45
|
0 && (module.exports = {
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
getNamedSchedules,
|
|
47
|
+
getSchedulesArrayDeprecationWarning,
|
|
48
|
+
toScheduleRecord
|
|
54
49
|
});
|
package/dist/schemas.d.ts
CHANGED
|
@@ -67,6 +67,10 @@ export declare const getFunctionsSchema: () => {
|
|
|
67
67
|
type: string;
|
|
68
68
|
maxLength: number;
|
|
69
69
|
};
|
|
70
|
+
installCommand: {
|
|
71
|
+
type: string;
|
|
72
|
+
maxLength: number;
|
|
73
|
+
};
|
|
70
74
|
experimentalTriggers: {
|
|
71
75
|
type: string;
|
|
72
76
|
items: {
|
|
@@ -165,6 +169,10 @@ export declare const functionsSchema: {
|
|
|
165
169
|
type: string;
|
|
166
170
|
maxLength: number;
|
|
167
171
|
};
|
|
172
|
+
installCommand: {
|
|
173
|
+
type: string;
|
|
174
|
+
maxLength: number;
|
|
175
|
+
};
|
|
168
176
|
experimentalTriggers: {
|
|
169
177
|
type: string;
|
|
170
178
|
items: {
|
package/dist/schemas.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -454,11 +454,19 @@ export interface BuilderFunctions {
|
|
|
454
454
|
runtime?: string;
|
|
455
455
|
includeFiles?: string;
|
|
456
456
|
excludeFiles?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Overrides how dependencies are installed for this function. An empty
|
|
459
|
+
* string skips the install. Only honored by `@vercel/node`.
|
|
460
|
+
*/
|
|
461
|
+
installCommand?: string;
|
|
457
462
|
experimentalTriggers?: TriggerEventInput[];
|
|
458
463
|
supportsCancellation?: boolean;
|
|
459
464
|
};
|
|
460
465
|
}
|
|
461
466
|
export interface ProjectSettings {
|
|
467
|
+
vercelFlags?: {
|
|
468
|
+
enabledAt?: number;
|
|
469
|
+
};
|
|
462
470
|
framework?: string | null;
|
|
463
471
|
devCommand?: string | null;
|
|
464
472
|
installCommand?: string | null;
|
|
@@ -527,8 +535,11 @@ export interface GetDevManifestOptions {
|
|
|
527
535
|
export interface DevManifest {
|
|
528
536
|
/** Complete replacement snapshot for the invoking builder scope. */
|
|
529
537
|
functions: DevFunction[];
|
|
530
|
-
/**
|
|
531
|
-
|
|
538
|
+
/**
|
|
539
|
+
* Native framework schedules keyed by name, using the static Build Output
|
|
540
|
+
* API schema. The array format is deprecated.
|
|
541
|
+
*/
|
|
542
|
+
schedules?: Schedules | Schedule[];
|
|
532
543
|
/** Authored functions keys resolved by this provider, for unmatched diagnostics. */
|
|
533
544
|
matchedFunctionPatterns: string[];
|
|
534
545
|
}
|
|
@@ -660,12 +671,10 @@ export interface Cron {
|
|
|
660
671
|
schedule: string;
|
|
661
672
|
}
|
|
662
673
|
export type ScheduleRequestMethod = 'GET' | 'POST';
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
*/
|
|
668
|
-
name?: string;
|
|
674
|
+
/**
|
|
675
|
+
* A schedule without its name, which is its key in `schedules`.
|
|
676
|
+
*/
|
|
677
|
+
export type ScheduleDefinition = {
|
|
669
678
|
/** Cron expression describing when the schedule fires (REQUIRED) */
|
|
670
679
|
schedule: string;
|
|
671
680
|
/** IANA timezone for cron evaluation, e.g. "America/New_York". Defaults to UTC. */
|
|
@@ -689,6 +698,13 @@ export type Schedule = {
|
|
|
689
698
|
/** Name of the queue topic to publish to */
|
|
690
699
|
topic: string;
|
|
691
700
|
});
|
|
701
|
+
/** Schedules keyed by name, as in Build Output `config.json#schedules`. */
|
|
702
|
+
export type Schedules = Record<string, ScheduleDefinition>;
|
|
703
|
+
/** A schedule with its name. */
|
|
704
|
+
export type Schedule = {
|
|
705
|
+
/** Unique name of the schedule within the deployment (REQUIRED) */
|
|
706
|
+
name: string;
|
|
707
|
+
} & ScheduleDefinition;
|
|
692
708
|
export interface ServiceQueueTopic {
|
|
693
709
|
topic: string;
|
|
694
710
|
retryAfterSeconds?: number;
|