@vercel/build-utils 14.22.0 → 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 +12 -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/types.d.ts +16 -8
- package/package.json +3 -3
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/types.d.ts
CHANGED
|
@@ -535,8 +535,11 @@ export interface GetDevManifestOptions {
|
|
|
535
535
|
export interface DevManifest {
|
|
536
536
|
/** Complete replacement snapshot for the invoking builder scope. */
|
|
537
537
|
functions: DevFunction[];
|
|
538
|
-
/**
|
|
539
|
-
|
|
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[];
|
|
540
543
|
/** Authored functions keys resolved by this provider, for unmatched diagnostics. */
|
|
541
544
|
matchedFunctionPatterns: string[];
|
|
542
545
|
}
|
|
@@ -668,12 +671,10 @@ export interface Cron {
|
|
|
668
671
|
schedule: string;
|
|
669
672
|
}
|
|
670
673
|
export type ScheduleRequestMethod = 'GET' | 'POST';
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
*/
|
|
676
|
-
name?: string;
|
|
674
|
+
/**
|
|
675
|
+
* A schedule without its name, which is its key in `schedules`.
|
|
676
|
+
*/
|
|
677
|
+
export type ScheduleDefinition = {
|
|
677
678
|
/** Cron expression describing when the schedule fires (REQUIRED) */
|
|
678
679
|
schedule: string;
|
|
679
680
|
/** IANA timezone for cron evaluation, e.g. "America/New_York". Defaults to UTC. */
|
|
@@ -697,6 +698,13 @@ export type Schedule = {
|
|
|
697
698
|
/** Name of the queue topic to publish to */
|
|
698
699
|
topic: string;
|
|
699
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;
|
|
700
708
|
export interface ServiceQueueTopic {
|
|
701
709
|
topic: string;
|
|
702
710
|
retryAfterSeconds?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.23.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vitest": "4.1.10",
|
|
53
53
|
"typescript": "4.9.5",
|
|
54
54
|
"yazl": "2.5.1",
|
|
55
|
-
"@vercel/
|
|
56
|
-
"@vercel/
|
|
55
|
+
"@vercel/routing-utils": "6.6.0",
|
|
56
|
+
"@vercel/error-utils": "2.2.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "node build.mjs",
|