@vite-hub/schedule 0.7.0 → 0.9.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/README.md +3 -3
- package/dist/{cron-D0mqg3ql.js → cron-eNXDzpau.js} +1 -1
- package/dist/definition.js +3 -3
- package/dist/{due-DXgXKgzg.js → due-DuZmGuB7.js} +1 -1
- package/dist/{error-diagnostics-KvK9MX6w.js → error-diagnostics-D9ul4bWA.js} +1 -1
- package/dist/{execute-DoQC2i_V.js → execute-DPaz2CIY.js} +3 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/{object-CAK6UYR5.js → object-DNOrQSl5.js} +5 -1
- package/dist/{operations-CEZCefAG.js → operations-Vmqf3UFQ.js} +13 -6
- package/dist/operations.js +2 -2
- package/dist/os.js +2 -7
- package/dist/runtime/console.js +3 -2
- package/dist/runtime/process.js +34 -13
- package/dist/runtime/state.d.ts +2 -2
- package/dist/runtime/state.js +1 -1
- package/dist/runtime/static.js +2 -2
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +4 -4
- package/dist/{started-yb49f37g.js → started-BP-J5a0z.js} +6 -6
- package/dist/{started-ClJ5XOWH.js → started-Bie-z1Ij.js} +11 -5
- package/dist/{started-errors-DVw5cYHR.js → started-errors-D6CnKMqD.js} +11 -7
- package/dist/{state-LuEgYpwR.d.ts → state-CRQQfd8h.d.ts} +23 -4
- package/dist/{state-CcVY3UzB.js → state-ClfTAWZO.js} +19 -3
- package/dist/{static--wi-oIIb.js → static-0MMhvv-6.js} +3 -3
- package/dist/vite.js +192 -115
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -196,11 +196,11 @@ Its defaults are prefix `vitehub:schedule`, scan interval `60_000` milliseconds,
|
|
|
196
196
|
|
|
197
197
|
Every server checks every Schedule. Before a server runs an occurrence, it takes a lease on the key `<prefix>/schedule/<run id>`, such as `vitehub:schedule/schedule/srun_static_daily_2026-11-09T08:00:00.000Z`. The prefix is `runtime.prefix`, which defaults to `vitehub:schedule`. Use a different prefix for each app that shares a Database, and the same prefix on every server of one app. One server gets the lease and runs the occurrence while it holds that lease. The others skip it and try again at their next scan. Started Schedules use the same lease for each occurrence. Manual runs have their own run id, so the server that gets the request runs them once.
|
|
198
198
|
|
|
199
|
-
- The server that holds the lease renews it every third of `leaseTtlMs
|
|
200
|
-
- If the server loses the Database, or its event loop pauses, for
|
|
199
|
+
- The server that holds the lease renews it every third of `leaseTtlMs`, from the time it gets the lease until the run ends. When the run ends, it writes a done marker (`<prefix>/schedule/<run id>/done`) and frees the lease. The marker lasts for `catchUpMs` plus `leaseTtlMs` plus two minutes, so a server that starts later does not run the occurrence again. If the marker write fails, the server reports the error and tries to extend its claim for the same time, without releasing it. If that also fails, another server can run the occurrence after the claim expires. A server that reads the done marker at or after `catchUpMs` plus `leaseTtlMs` plus two minutes after the scheduled minute does not run the occurrence, because a missing marker no longer proves that it did not run.
|
|
200
|
+
- If the server loses the Database, or its event loop pauses, for two thirds of `leaseTtlMs` or longer, its lease can expire while its handler still runs. A renewal starts a third of `leaseTtlMs` after the previous one, so a renewal that waits for the rest of the TTL comes too late. Another server can run the same occurrence at the same time. The runtime reports renewal failures, but cannot stop the handler or undo its effects. Choose a TTL longer than one and a half times the longest expected pause, and make external effects idempotent.
|
|
201
201
|
- If the lease store fails before a run starts, the server reports the error and retries at its next scan while the occurrence is inside `catchUpMs`.
|
|
202
202
|
- A failed run is final, as on one server. It is not retried.
|
|
203
|
-
- When a server stops during a run, for example after a crash, its lease ends after `leaseTtlMs`. Then another server runs the occurrence, unless it has a done marker. A server that found the lease held tries the occurrence again until `catchUpMs` plus `leaseTtlMs` plus one minute after its scheduled minute, also with `catchUpMs: 0`. With shared run history, the run gets a new attempt, and the stopped attempt is marked as failed. This also works when every server restarts: at start, a server reads the runs inside `catchUpMs` that are still pending or running, and tries them again.
|
|
203
|
+
- When a server stops during a run, for example after a crash, its lease ends after `leaseTtlMs`. Then another server runs the occurrence, unless it has a done marker. A server that found the lease held tries the occurrence again until `catchUpMs` plus `leaseTtlMs` plus one minute after its scheduled minute, also with `catchUpMs: 0`. With shared run history, the run gets a new attempt, and the stopped attempt is marked as failed. So a handler that started before the stop runs again: a Schedule occurrence runs at least once, not exactly once, when a server stops after its handler starts and before it saves the end of the run. This also works when every server restarts: at start, a server reads the runs inside `catchUpMs` that are still pending or running, and tries them again.
|
|
204
204
|
|
|
205
205
|
The generated runtime keeps the leases in the `vitehub_leases` table of the Default Database, through `useLeases()` from `@vite-hub/database`. That works on Postgres, with postgres.js or node-postgres, remote libSQL, and D1. With `VITEHUB_INSTANCES` greater than 1, a Node server with a Postgres or remote libSQL Default Database reports Schedule as `shared` at boot. A local libSQL file is safe for one server process only, because `@libsql/client` can lose writes when several processes write to one file. The server prints a warning at the first lease in that case. Without a Database, the leases stay in memory and the build reports the hint `SCHEDULE_PROCESS_CLAIMS_IN_MEMORY` in its output and in `.vitehub/hints.json`: each server then runs every occurrence, so run one server only. The run history stays in KV. Use a KV store that all servers share, such as Upstash, so catch-up and the Console see the runs of every server.
|
|
206
206
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
2
2
|
import { parseCronExpression } from "cron-schedule";
|
|
3
3
|
// src/cron.ts
|
|
4
4
|
const cronFieldPattern = /^[^\s]+$/;
|
package/dist/definition.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as assertScheduleCronFields } from "./cron-
|
|
4
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
3
|
+
import { t as assertScheduleCronFields } from "./cron-eNXDzpau.js";
|
|
4
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
5
5
|
// src/definition.ts
|
|
6
6
|
const scheduleDefinitionKeys = /* @__PURE__ */ new Set([
|
|
7
7
|
"manual",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
2
2
|
import { parseCronExpression } from "cron-schedule";
|
|
3
3
|
// src/runtime/due.ts
|
|
4
4
|
const weekdayIndexes = /* @__PURE__ */ new Map([
|
|
@@ -42,7 +42,7 @@ const scheduleErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
42
42
|
},
|
|
43
43
|
SCHEDULE_C0007: {
|
|
44
44
|
...dynamicError,
|
|
45
|
-
fix: "Write `defineSchedule({ cron, handler })`.
|
|
45
|
+
fix: "Write `defineSchedule({ cron, handler })`."
|
|
46
46
|
},
|
|
47
47
|
SCHEDULE_R0003: {
|
|
48
48
|
...dynamicError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as createScheduleError, S as validateScheduledAt, _ as emitLogEvent, b as parseScheduledAt, c as markLoggedScheduleError, d as normalizeScheduleRuntimeError, g as logScheduleRun, h as runWithScheduleWaitUntil, v as errorCode, x as scheduleIdempotencyKey } from "./static
|
|
2
|
-
import {
|
|
3
|
-
import { i as getScheduleRunStore } from "./state-
|
|
1
|
+
import { C as createScheduleError, S as validateScheduledAt, _ as emitLogEvent, b as parseScheduledAt, c as markLoggedScheduleError, d as normalizeScheduleRuntimeError, g as logScheduleRun, h as runWithScheduleWaitUntil, v as errorCode, x as scheduleIdempotencyKey } from "./static-0MMhvv-6.js";
|
|
2
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
3
|
+
import { i as getScheduleRunStore } from "./state-ClfTAWZO.js";
|
|
4
4
|
import { serializeResponse, toResponse } from "@vite-hub/runtime/internal/response";
|
|
5
5
|
import { emitRunFailed, toRunFailedError } from "@vite-hub/runtime/internal/run-failed";
|
|
6
6
|
import { runInRunScopes } from "@vite-hub/runtime/internal/run-scope";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { defineSchedule } from "./definition.js";
|
|
2
|
-
import { i as startSchedule, n as getSchedule, o as runSchedule, r as listSchedules, t as cancelSchedule } from "./started-
|
|
2
|
+
import { i as startSchedule, n as getSchedule, o as runSchedule, r as listSchedules, t as cancelSchedule } from "./started-Bie-z1Ij.js";
|
|
3
3
|
export { cancelSchedule, defineSchedule, getSchedule, listSchedules, runSchedule, startSchedule };
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
|
+
/** A non-null object. Arrays pass. Functions do not. */
|
|
7
|
+
function isObject(value) {
|
|
8
|
+
return typeof value === "object" && value !== null;
|
|
9
|
+
}
|
|
6
10
|
/** A non-null object or a function that is not an array. */
|
|
7
11
|
function isRecordOrFunction(value) {
|
|
8
12
|
return Object(value) === value && !Array.isArray(value);
|
|
9
13
|
}
|
|
10
|
-
export {
|
|
14
|
+
export { isRecord as n, isRecordOrFunction as r, isObject as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as redactInspectionText } from "./inspect-CW0qwt9p.js";
|
|
2
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
-
import { C as createScheduleError } from "./static
|
|
4
|
-
import { a as loadScheduleRegistry, i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-
|
|
5
|
-
import { a as loadStaticScheduleDefinition, s as runScheduleFrom } from "./execute-
|
|
6
|
-
import { i as getScheduleRunStore, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, t as getHostScheduleInventory } from "./state-
|
|
2
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
3
|
+
import { C as createScheduleError } from "./static-0MMhvv-6.js";
|
|
4
|
+
import { a as loadScheduleRegistry, i as startSchedule, r as listSchedules, t as cancelSchedule } from "./started-Bie-z1Ij.js";
|
|
5
|
+
import { a as loadStaticScheduleDefinition, s as runScheduleFrom } from "./execute-DPaz2CIY.js";
|
|
6
|
+
import { g as waitForProcessScheduleRuntime, i as getScheduleRunStore, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime, t as getHostScheduleInventory } from "./state-ClfTAWZO.js";
|
|
7
7
|
// src/runtime/operations.ts
|
|
8
8
|
function isoDate(value) {
|
|
9
9
|
if (value === void 0) return;
|
|
@@ -122,10 +122,14 @@ async function attempt(work) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
async function runScheduleRuns(input) {
|
|
125
|
-
return await attempt(async () =>
|
|
125
|
+
return await attempt(async () => {
|
|
126
|
+
await waitForProcessScheduleRuntime();
|
|
127
|
+
return { runs: await listScheduleRuns(input.id, { limit: input.limit ?? 100 }) };
|
|
128
|
+
});
|
|
126
129
|
}
|
|
127
130
|
async function runScheduleAttempts(input) {
|
|
128
131
|
return await attempt(async () => {
|
|
132
|
+
await waitForProcessScheduleRuntime();
|
|
129
133
|
const run = await getScheduleRunStore().getRun(input.id);
|
|
130
134
|
if (!run) throw scheduleErrorDiagnostics.SCHEDULE_RUN_NOT_FOUND();
|
|
131
135
|
return {
|
|
@@ -141,6 +145,7 @@ const consoleSchedulesKey = Symbol.for("vitehub.console.schedules");
|
|
|
141
145
|
*/
|
|
142
146
|
async function runScheduleNow(input, registry = Reflect.get(globalThis, consoleSchedulesKey) ?? {}) {
|
|
143
147
|
return await attempt(async () => {
|
|
148
|
+
await waitForProcessScheduleRuntime();
|
|
144
149
|
if (!Object.hasOwn(registry, input.name)) {
|
|
145
150
|
const definitions = await loadScheduleRegistry().catch((cause) => {
|
|
146
151
|
throw scheduleErrorDiagnostics.SCHEDULE_DEFINITION_NOT_FOUND({ cause });
|
|
@@ -167,6 +172,7 @@ const startedErrorStatus = {
|
|
|
167
172
|
SCHEDULE_INVALID_OPTIONS: 400,
|
|
168
173
|
SCHEDULE_NOT_FOUND: 404,
|
|
169
174
|
SCHEDULE_NOT_STARTABLE: 404,
|
|
175
|
+
SCHEDULE_RUNTIME_INSTALL_FAILED: 503,
|
|
170
176
|
SCHEDULE_STORE_FAILED: 503,
|
|
171
177
|
SCHEDULE_STORE_MISSING: 503
|
|
172
178
|
};
|
|
@@ -189,6 +195,7 @@ async function listStaticSchedules(filter) {
|
|
|
189
195
|
* for started Schedules, so it lists only its Definitions.
|
|
190
196
|
*/
|
|
191
197
|
async function runScheduleList(input) {
|
|
198
|
+
await waitForProcessScheduleRuntime();
|
|
192
199
|
const definitions = await listStaticSchedules(input.name);
|
|
193
200
|
if (!getStartedScheduleRuntime()) return {
|
|
194
201
|
definitions,
|
package/dist/operations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
2
2
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
3
3
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
4
4
|
import * as v from "valibot";
|
|
@@ -139,7 +139,7 @@ function table(rows) {
|
|
|
139
139
|
return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
|
|
140
140
|
}
|
|
141
141
|
// src/operations.ts
|
|
142
|
-
const runtime = () => import("./operations-
|
|
142
|
+
const runtime = () => import("./operations-Vmqf3UFQ.js");
|
|
143
143
|
const id = v.pipe(v.string(), v.minLength(1));
|
|
144
144
|
function formatRuns({ runs }) {
|
|
145
145
|
if (runs.length === 0) return "No runs.\n";
|
package/dist/os.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as isRecord } from "./object-DNOrQSl5.js";
|
|
2
2
|
import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
|
|
3
3
|
import { a as parseCronFields, c as timesOfDay, i as isWeekdayRestricted, n as isDayRestricted, o as range, r as isMonthRestricted, s as runsEveryDay, t as arithmeticStep, u as invariantError } from "./cron-imqlBgO-.js";
|
|
4
|
-
import { i as timeZoneOffsetMinutes } from "./due-
|
|
4
|
+
import { i as timeZoneOffsetMinutes } from "./due-DuZmGuB7.js";
|
|
5
5
|
import { defineErrors } from "@vite-hub/runtime";
|
|
6
6
|
import { homedir, userInfo } from "node:os";
|
|
7
7
|
import { basename, dirname, join, posix, win32 } from "node:path";
|
|
@@ -1127,11 +1127,6 @@ function renderTaskWrapper(spec, logFile) {
|
|
|
1127
1127
|
function parseTaskWrapperLog(wrapper) {
|
|
1128
1128
|
return wrapper.match(/^\$log = '((?:[^']|'')*)'\r?$/m)?.[1]?.replaceAll("''", "'");
|
|
1129
1129
|
}
|
|
1130
|
-
/**
|
|
1131
|
-
* The base64 PowerShell command that runs the wrapper and exits with its exit code. Task Scheduler expands `%NAME%` in
|
|
1132
|
-
* the arguments of a task and has no escape for `%`, so a wrapper path in the arguments breaks under a folder such as
|
|
1133
|
-
* `C:\Users\pct %PATH%`. Base64 has no `%`.
|
|
1134
|
-
*/
|
|
1135
1130
|
function runWrapperCommand(wrapper) {
|
|
1136
1131
|
const script = `$global:LASTEXITCODE = 1\n& ${powerShellString(wrapper)}\nexit $global:LASTEXITCODE`;
|
|
1137
1132
|
return Buffer.from(script, "utf16le").toString("base64");
|
package/dist/runtime/console.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime } from "../state-
|
|
2
|
-
import { o as resolveManualSchedule } from "../execute-
|
|
1
|
+
import { g as waitForProcessScheduleRuntime, n as getProcessScheduleDefinitions, o as getStartedScheduleRuntime } from "../state-ClfTAWZO.js";
|
|
2
|
+
import { o as resolveManualSchedule } from "../execute-DPaz2CIY.js";
|
|
3
3
|
// src/runtime/console.ts
|
|
4
4
|
const consoleSchedulesKey = Symbol.for("vitehub.console.schedules");
|
|
5
5
|
/** The Cron column of the Console: the cron, with the time zone when it is not UTC. */
|
|
@@ -61,6 +61,7 @@ function startedScheduleRecord(schedule) {
|
|
|
61
61
|
* build checked.
|
|
62
62
|
*/
|
|
63
63
|
async function readScheduleConsoleRecords() {
|
|
64
|
+
await waitForProcessScheduleRuntime();
|
|
64
65
|
const registry = Reflect.get(globalThis, consoleSchedulesKey) ?? {};
|
|
65
66
|
const definitions = getProcessScheduleDefinitions();
|
|
66
67
|
const candidates = await Promise.all(Object.keys(registry).map((name) => resolveManualSchedule(registry, name).then(() => name, () => void 0)));
|
package/dist/runtime/process.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as toRunId, i as executeStaticSchedule } from "../execute-
|
|
7
|
-
import { i as runStartedSchedules } from "../started-
|
|
8
|
-
import { a as getScheduleRuntimeRegistry, c as registerProcessScheduleDefinitions, d as
|
|
1
|
+
import { r as isRecordOrFunction } from "../object-DNOrQSl5.js";
|
|
2
|
+
import { C as createScheduleError, _ as emitLogEvent, c as markLoggedScheduleError, x as scheduleIdempotencyKey } from "../static-0MMhvv-6.js";
|
|
3
|
+
import { n as parseScheduleCronExpression } from "../cron-eNXDzpau.js";
|
|
4
|
+
import { n as isScheduleDue } from "../due-DuZmGuB7.js";
|
|
5
|
+
import { t as scheduleErrorDiagnostics } from "../error-diagnostics-D9ul4bWA.js";
|
|
6
|
+
import { c as toRunId, i as executeStaticSchedule } from "../execute-DPaz2CIY.js";
|
|
7
|
+
import { i as runStartedSchedules } from "../started-BP-J5a0z.js";
|
|
8
|
+
import { a as getScheduleRuntimeRegistry, c as registerProcessScheduleDefinitions, d as setProcessScheduleRuntimeInstallation, f as setScheduleOccurrenceClaims, i as getScheduleRunStore, m as setScheduleRuntimeRegistry, p as setScheduleRunStore, r as getScheduleOccurrenceClaims } from "../state-ClfTAWZO.js";
|
|
9
9
|
import { createMemoryLeaseStore, getInstanceId } from "@vite-hub/runtime";
|
|
10
10
|
import { onShutdown } from "@vite-hub/runtime/internal/shutdown";
|
|
11
11
|
// src/internal/process-wake-runtime.ts
|
|
@@ -241,26 +241,26 @@ function createOccurrenceClaims(options) {
|
|
|
241
241
|
const ttl = options.ttlMs / 1e3;
|
|
242
242
|
const doneTtl = options.doneTtlMs / 1e3;
|
|
243
243
|
const owner = options.owner === void 0 ? {} : { owner: options.owner };
|
|
244
|
-
return { async run(runId, run) {
|
|
244
|
+
return { async run(runId, run, runOptions) {
|
|
245
245
|
const [acquireError, lease] = await options.leases.acquire(occurrenceLeaseKey(runId, options.prefix), {
|
|
246
246
|
ttl,
|
|
247
247
|
...owner
|
|
248
248
|
});
|
|
249
249
|
if (acquireError) throw acquireError;
|
|
250
250
|
if (!lease) return "held";
|
|
251
|
+
const stop = keepAlive(lease, options.ttlMs, options.reportError);
|
|
251
252
|
let release = true;
|
|
252
253
|
try {
|
|
253
254
|
const [doneError, done] = await options.leases.get(occurrenceDoneKey(runId, options.prefix));
|
|
254
255
|
if (doneError) throw doneError;
|
|
255
256
|
if (done) return "done";
|
|
256
|
-
|
|
257
|
+
if (runOptions?.scheduledAt && (options.now?.() ?? /* @__PURE__ */ new Date()).getTime() >= runOptions.scheduledAt.getTime() + options.doneTtlMs) return "late";
|
|
257
258
|
let final = false;
|
|
258
259
|
try {
|
|
259
260
|
await run(() => {
|
|
260
261
|
final = true;
|
|
261
262
|
});
|
|
262
263
|
} finally {
|
|
263
|
-
await stop();
|
|
264
264
|
if (final) {
|
|
265
265
|
const [markError, marked] = await options.leases.acquire(occurrenceDoneKey(runId, options.prefix), {
|
|
266
266
|
ttl: doneTtl,
|
|
@@ -268,6 +268,7 @@ function createOccurrenceClaims(options) {
|
|
|
268
268
|
});
|
|
269
269
|
if (markError) {
|
|
270
270
|
release = false;
|
|
271
|
+
await stop();
|
|
271
272
|
options.reportError(markError);
|
|
272
273
|
const [renewError, renewed] = await lease.renew({ ttl: doneTtl });
|
|
273
274
|
if (renewError) options.reportError(renewError);
|
|
@@ -277,6 +278,7 @@ function createOccurrenceClaims(options) {
|
|
|
277
278
|
}
|
|
278
279
|
return "ran";
|
|
279
280
|
} finally {
|
|
281
|
+
await stop();
|
|
280
282
|
if (release) {
|
|
281
283
|
const [releaseError] = await lease.release();
|
|
282
284
|
if (releaseError) options.reportError(releaseError);
|
|
@@ -355,7 +357,25 @@ function resolveLeaseTtlMs(value) {
|
|
|
355
357
|
* checked, within `catchUpMs`, for Schedules with a prior cron-triggered run or indeterminate legacy history.
|
|
356
358
|
* Processes that share `leases` run each occurrence once between them. Call `close()` during host shutdown.
|
|
357
359
|
*/
|
|
358
|
-
|
|
360
|
+
function installProcessScheduleRuntime(options) {
|
|
361
|
+
const startedAt = performance.now();
|
|
362
|
+
const installation = installRuntime(options);
|
|
363
|
+
setProcessScheduleRuntimeInstallation(installation);
|
|
364
|
+
installation.then(() => {
|
|
365
|
+
const ms = Math.round(performance.now() - startedAt);
|
|
366
|
+
if (!emitLogEvent({
|
|
367
|
+
field: "schedule",
|
|
368
|
+
fields: {
|
|
369
|
+
op: "install",
|
|
370
|
+
ms
|
|
371
|
+
},
|
|
372
|
+
level: "info",
|
|
373
|
+
message: "Schedule runtime installed"
|
|
374
|
+
})) console.info(`[vitehub:schedule] runtime installed in ${ms} ms`);
|
|
375
|
+
}, () => {});
|
|
376
|
+
return installation;
|
|
377
|
+
}
|
|
378
|
+
async function installRuntime(options) {
|
|
359
379
|
const previousRegistry = getScheduleRuntimeRegistry();
|
|
360
380
|
const previousScheduleRunStore = getScheduleRunStore();
|
|
361
381
|
const previousClaims = getScheduleOccurrenceClaims();
|
|
@@ -365,6 +385,7 @@ async function installProcessScheduleRuntime(options) {
|
|
|
365
385
|
const claims = createOccurrenceClaims({
|
|
366
386
|
doneTtlMs: catchUpMs + leaseTtlMs + 2 * minuteMs,
|
|
367
387
|
leases: options.leases ?? createMemoryLeaseStore(),
|
|
388
|
+
now: options.now,
|
|
368
389
|
owner: getInstanceId(),
|
|
369
390
|
prefix: options.prefix,
|
|
370
391
|
reportError,
|
|
@@ -429,7 +450,7 @@ async function installProcessScheduleRuntime(options) {
|
|
|
429
450
|
},
|
|
430
451
|
scheduledAt: input.scheduledAt,
|
|
431
452
|
waitUntil
|
|
432
|
-
})) === "held") held.set(runId, {
|
|
453
|
+
}), { scheduledAt: input.scheduledAt }) === "held") held.set(runId, {
|
|
433
454
|
scheduleId: input.scheduleId,
|
|
434
455
|
scheduledAt: input.scheduledAt,
|
|
435
456
|
startBy: input.scheduledAt.getTime() + catchUpMs + leaseTtlMs + minuteMs
|
package/dist/runtime/state.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getScheduleRunStore, c as loadScheduleDefinition, d as setHostScheduleInventory, f as
|
|
2
|
-
export { StartedScheduleRuntime, getHostScheduleInventory, getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setHostScheduleInventory, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime };
|
|
1
|
+
import { _ as waitForProcessScheduleRuntime, a as getScheduleRunStore, c as loadScheduleDefinition, d as setHostScheduleInventory, f as setProcessScheduleRuntimeInstallation, g as setStartedScheduleRuntime, h as setScheduleRuntimeRegistry, i as getScheduleOccurrenceClaims, l as registerProcessScheduleDefinitions, m as setScheduleRunStore, n as getHostScheduleInventory, o as getScheduleRuntimeRegistry, p as setScheduleOccurrenceClaims, r as getProcessScheduleDefinitions, s as getStartedScheduleRuntime, t as StartedScheduleRuntime, u as resetScheduleRuntime } from "../state-CRQQfd8h.js";
|
|
2
|
+
export { StartedScheduleRuntime, getHostScheduleInventory, getProcessScheduleDefinitions, getScheduleOccurrenceClaims, getScheduleRunStore, getScheduleRuntimeRegistry, getStartedScheduleRuntime, loadScheduleDefinition, registerProcessScheduleDefinitions, resetScheduleRuntime, setHostScheduleInventory, setProcessScheduleRuntimeInstallation, setScheduleOccurrenceClaims, setScheduleRunStore, setScheduleRuntimeRegistry, setStartedScheduleRuntime, waitForProcessScheduleRuntime };
|
package/dist/runtime/state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as getHostScheduleInventory, n as getProcessScheduleDefinitions, r as getScheduleOccurrenceClaims, i as getScheduleRunStore, a as getScheduleRuntimeRegistry, o as getStartedScheduleRuntime, s as loadScheduleDefinition, c as registerProcessScheduleDefinitions, l as resetScheduleRuntime, u as setHostScheduleInventory, d as
|
|
1
|
+
export { t as getHostScheduleInventory, n as getProcessScheduleDefinitions, r as getScheduleOccurrenceClaims, i as getScheduleRunStore, a as getScheduleRuntimeRegistry, o as getStartedScheduleRuntime, s as loadScheduleDefinition, c as registerProcessScheduleDefinitions, l as resetScheduleRuntime, u as setHostScheduleInventory, d as setProcessScheduleRuntimeInstallation, f as setScheduleOccurrenceClaims, p as setScheduleRunStore, m as setScheduleRuntimeRegistry, h as setStartedScheduleRuntime, g as waitForProcessScheduleRuntime } from "../state-ClfTAWZO.js";
|
package/dist/runtime/static.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as isScheduleCronAuthorized, c as markLoggedScheduleError, d as normalizeScheduleRuntimeError, f as scheduledWakeTime, i as executeStaticSchedule, l as missingScheduleDefinitionError, n as executeCloudflareStaticSchedules, o as isTimeZoneWakeDue, p as unwrapScheduleDefinition, r as executeMatchingStaticSchedules, s as logScheduleRuntimeError, t as createStaticScheduleRun, u as normalizeCron } from "../static
|
|
2
|
-
import { t as cronWithWeekdayNames } from "../due-
|
|
1
|
+
import { a as isScheduleCronAuthorized, c as markLoggedScheduleError, d as normalizeScheduleRuntimeError, f as scheduledWakeTime, i as executeStaticSchedule, l as missingScheduleDefinitionError, n as executeCloudflareStaticSchedules, o as isTimeZoneWakeDue, p as unwrapScheduleDefinition, r as executeMatchingStaticSchedules, s as logScheduleRuntimeError, t as createStaticScheduleRun, u as normalizeCron } from "../static-0MMhvv-6.js";
|
|
2
|
+
import { t as cronWithWeekdayNames } from "../due-DuZmGuB7.js";
|
|
3
3
|
export { createStaticScheduleRun, cronWithWeekdayNames, executeCloudflareStaticSchedules, executeMatchingStaticSchedules, executeStaticSchedule, isScheduleCronAuthorized, isTimeZoneWakeDue, logScheduleRuntimeError, markLoggedScheduleError, missingScheduleDefinitionError, normalizeCron, normalizeScheduleRuntimeError, scheduledWakeTime, unwrapScheduleDefinition };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { a as createScheduleRun, c as runScheduleFrom, n as createKVScheduleRunS
|
|
|
3
3
|
import { _ as unwrapScheduleDefinition, m as normalizeCron } from "./static-BFV4x94g.js";
|
|
4
4
|
import { n as ScheduleKVStorage, r as createScheduleKVStorage, t as ScheduleKVSetOptions } from "./kv-storage-CKSSQ6Fk.js";
|
|
5
5
|
import { E as StartedScheduleStore, _ as ScheduleRunRecord, a as ScheduleDefinitionOptions, b as ScheduleRunStore, f as ScheduleRunAttemptRecord, g as ScheduleRunListOptions, m as ScheduleRunContext, o as ScheduleDefinitionRegistry, r as ScheduleDefinition, s as ScheduleHandler, u as ScheduleRegistryDefinition } from "./types-Wllh0U8N.js";
|
|
6
|
-
import { a as getScheduleRunStore,
|
|
6
|
+
import { a as getScheduleRunStore, m as setScheduleRunStore, u as resetScheduleRuntime } from "./state-CRQQfd8h.js";
|
|
7
7
|
interface InstallStartedSchedulesOptions {
|
|
8
8
|
/**
|
|
9
9
|
* How far back, in milliseconds, the first tick after a start runs cron minutes that no tick checked. Use it only with
|
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as executeStaticSchedule, r as executeSchedule, s as runScheduleFrom, t as createScheduleRun } from "./execute-
|
|
2
|
-
import { p as unwrapScheduleDefinition, u as normalizeCron } from "./static
|
|
1
|
+
import { i as executeStaticSchedule, r as executeSchedule, s as runScheduleFrom, t as createScheduleRun } from "./execute-DPaz2CIY.js";
|
|
2
|
+
import { p as unwrapScheduleDefinition, u as normalizeCron } from "./static-0MMhvv-6.js";
|
|
3
3
|
import { t as createScheduleKVStorage } from "./kv-storage-CszEkof6.js";
|
|
4
|
-
import {
|
|
5
|
-
import { i as runStartedSchedules, n as createMemoryStartedScheduleStore, r as installStartedSchedules, t as createKVStartedScheduleStore } from "./started-
|
|
4
|
+
import { i as getScheduleRunStore, l as resetScheduleRuntime, p as setScheduleRunStore, v as createKVScheduleRunStore, y as createMemoryScheduleRunStore } from "./state-ClfTAWZO.js";
|
|
5
|
+
import { i as runStartedSchedules, n as createMemoryStartedScheduleStore, r as installStartedSchedules, t as createKVStartedScheduleStore } from "./started-BP-J5a0z.js";
|
|
6
6
|
export { createKVScheduleRunStore, createKVStartedScheduleStore, createMemoryScheduleRunStore, createMemoryStartedScheduleStore, createScheduleKVStorage, createScheduleRun, executeSchedule, executeStaticSchedule, getScheduleRunStore, installStartedSchedules, normalizeCron, resetScheduleRuntime, runScheduleFrom, runStartedSchedules, setScheduleRunStore, unwrapScheduleDefinition };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as isScheduleDue } from "./due-
|
|
2
|
-
import { c as toRunId, r as executeSchedule } from "./execute-
|
|
3
|
-
import {
|
|
4
|
-
import { t as startedScheduleErrors } from "./started-errors-
|
|
5
|
-
import {
|
|
6
|
-
import { v as errorCode, y as logFailure } from "./static
|
|
1
|
+
import { n as isScheduleDue } from "./due-DuZmGuB7.js";
|
|
2
|
+
import { c as toRunId, r as executeSchedule } from "./execute-DPaz2CIY.js";
|
|
3
|
+
import { b as joinKey, h as setStartedScheduleRuntime, o as getStartedScheduleRuntime, r as getScheduleOccurrenceClaims, x as keySegments } from "./state-ClfTAWZO.js";
|
|
4
|
+
import { t as startedScheduleErrors } from "./started-errors-D6CnKMqD.js";
|
|
5
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
6
|
+
import { v as errorCode, y as logFailure } from "./static-0MMhvv-6.js";
|
|
7
7
|
import { normalizeRuntimeDiagnosticError } from "@vite-hub/runtime";
|
|
8
8
|
// src/runtime/started.ts
|
|
9
9
|
const minuteMs = 6e4;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
|
|
2
|
-
import {
|
|
3
|
-
import { C as createScheduleError, b as parseScheduledAt } from "./static
|
|
4
|
-
import { l as randomId, n as executeManualSchedule, o as resolveManualSchedule } from "./execute-
|
|
5
|
-
import { o as getStartedScheduleRuntime } from "./state-
|
|
6
|
-
import { t as startedScheduleErrors } from "./started-errors-
|
|
2
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
3
|
+
import { C as createScheduleError, b as parseScheduledAt } from "./static-0MMhvv-6.js";
|
|
4
|
+
import { l as randomId, n as executeManualSchedule, o as resolveManualSchedule } from "./execute-DPaz2CIY.js";
|
|
5
|
+
import { g as waitForProcessScheduleRuntime, o as getStartedScheduleRuntime } from "./state-ClfTAWZO.js";
|
|
6
|
+
import { t as startedScheduleErrors } from "./started-errors-D6CnKMqD.js";
|
|
7
7
|
import { parseCronExpression } from "cron-schedule";
|
|
8
8
|
import { defineErrors } from "@vite-hub/runtime";
|
|
9
9
|
// src/run-errors.ts
|
|
@@ -34,6 +34,7 @@ async function loadScheduleRegistry() {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async function runSchedule(name, options = {}) {
|
|
37
|
+
await waitForProcessScheduleRuntime();
|
|
37
38
|
const registry = await loadScheduleRegistry();
|
|
38
39
|
const definition = await resolveManualSchedule(registry, name);
|
|
39
40
|
let scheduledAt;
|
|
@@ -146,6 +147,11 @@ async function fromStore(work) {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
async function startSchedule(name, options) {
|
|
150
|
+
try {
|
|
151
|
+
await waitForProcessScheduleRuntime();
|
|
152
|
+
} catch (cause) {
|
|
153
|
+
return [startedScheduleErrors.SCHEDULE_RUNTIME_INSTALL_FAILED({ cause }), void 0];
|
|
154
|
+
}
|
|
149
155
|
const [missing, runtime] = requireRuntime();
|
|
150
156
|
if (missing) return [missing, void 0];
|
|
151
157
|
if (!isString(name) || !Object.hasOwn(runtime.registry, name)) return [startedScheduleErrors.SCHEDULE_NOT_STARTABLE({ name: String(name) }), void 0];
|
|
@@ -3,10 +3,6 @@ import { defineErrors } from "@vite-hub/runtime";
|
|
|
3
3
|
const startedScheduleErrors = /*#__PURE__*/ defineErrors({
|
|
4
4
|
docs: "https://vitehub.dev/docs/schedule/diagnostics",
|
|
5
5
|
codes: {
|
|
6
|
-
SCHEDULE_NOT_STARTABLE: {
|
|
7
|
-
why: ({ name }) => `No Schedule Definition without \`cron\` is named "${name}", so \`startSchedule()\` cannot start it.`,
|
|
8
|
-
fix: "Add `server/schedules/<name>.ts` with `export default defineSchedule({ handler })` and no `cron`. A Definition with its own `cron` runs only on that cron."
|
|
9
|
-
},
|
|
10
6
|
SCHEDULE_INVALID_OPTIONS: {
|
|
11
7
|
why: ({ problem }) => `\`startSchedule()\` options are invalid: ${problem}`,
|
|
12
8
|
fix: "Pass `{ at }` for one run, or `{ cron, timeZone }` for a repeating Schedule, and a JSON `payload`."
|
|
@@ -15,13 +11,21 @@ const startedScheduleErrors = /*#__PURE__*/ defineErrors({
|
|
|
15
11
|
why: ({ id }) => `No started Schedule has the id "${id}". It ran its last time, was cancelled, or never existed.`,
|
|
16
12
|
fix: "List the started Schedules with `listSchedules()` or `vitehub schedule list`."
|
|
17
13
|
},
|
|
18
|
-
|
|
19
|
-
why:
|
|
20
|
-
fix: "Add
|
|
14
|
+
SCHEDULE_NOT_STARTABLE: {
|
|
15
|
+
why: ({ name }) => `No Schedule Definition without \`cron\` is named "${name}", so \`startSchedule()\` cannot start it.`,
|
|
16
|
+
fix: "Add `server/schedules/<name>.ts` with `export default defineSchedule({ handler })` and no `cron`. A Definition with its own `cron` runs only on that cron."
|
|
17
|
+
},
|
|
18
|
+
SCHEDULE_RUNTIME_INSTALL_FAILED: {
|
|
19
|
+
why: "The Process Runtime did not install. The server cannot deliver started Schedules.",
|
|
20
|
+
fix: "Read `error.cause` or the server startup log, fix the install error, then restart the server."
|
|
21
21
|
},
|
|
22
22
|
SCHEDULE_STORE_FAILED: {
|
|
23
23
|
why: "The store of started Schedules failed. `error.cause` has the store error.",
|
|
24
24
|
fix: "Check that KV is enabled and reachable from this server, then try again."
|
|
25
|
+
},
|
|
26
|
+
SCHEDULE_STORE_MISSING: {
|
|
27
|
+
why: "This server has no store for started Schedules.",
|
|
28
|
+
fix: "Add a Schedule Definition without `cron` in `server/schedules/`, enable `kv`, and build with Nitro. On Node, also set `schedule: { runtime: { driver: \"process\" } }`."
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
});
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { E as StartedScheduleStore, b as ScheduleRunStore, o as ScheduleDefinitionRegistry, r as ScheduleDefinition, u as ScheduleRegistryDefinition } from "./types-Wllh0U8N.js";
|
|
2
2
|
import { LeaseStore } from "@vite-hub/runtime";
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `held` when another process holds the occurrence now, `done` when a process finished it, `late` when the call came
|
|
5
|
+
* after the done marker window of `scheduledAt`, and `ran` when this call ran it.
|
|
6
|
+
*/
|
|
7
|
+
type OccurrenceClaimResult = "done" | "held" | "late" | "ran";
|
|
8
|
+
interface OccurrenceClaimRunOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The scheduled time of the occurrence. A done marker is written after this time and lasts `doneTtlMs`, so a missing
|
|
11
|
+
* marker proves nothing from `scheduledAt` plus `doneTtlMs` on. A call that finds no marker then returns `late` and
|
|
12
|
+
* does not run.
|
|
13
|
+
*/
|
|
14
|
+
scheduledAt?: Date;
|
|
15
|
+
}
|
|
5
16
|
/** Runs each Schedule occurrence in one process of all the processes that share `leases`. */
|
|
6
17
|
interface OccurrenceClaims {
|
|
7
18
|
/**
|
|
@@ -9,7 +20,7 @@ interface OccurrenceClaims {
|
|
|
9
20
|
* renewed. Call `markFinal` before invoking the handler or when an existing run is final. Then a done marker stays
|
|
10
21
|
* for `doneTtlMs`, also when the handler throws. Errors before `markFinal` leave the occurrence retryable.
|
|
11
22
|
*/
|
|
12
|
-
run(runId: string, run: (markFinal: () => void) => Promise<unknown
|
|
23
|
+
run(runId: string, run: (markFinal: () => void) => Promise<unknown>, options?: OccurrenceClaimRunOptions): Promise<OccurrenceClaimResult>;
|
|
13
24
|
}
|
|
14
25
|
type ProcessScheduleTimingRecord = Pick<ScheduleDefinition, "cron" | "timeZone">;
|
|
15
26
|
interface HostScheduleInventory {
|
|
@@ -41,6 +52,14 @@ declare function getScheduleRuntimeRegistry(): ScheduleDefinitionRegistry | unde
|
|
|
41
52
|
/** Publish only ready runtimes, retaining earlier snapshots until their controllers close. */
|
|
42
53
|
declare function registerProcessScheduleDefinitions(definitions: ReadonlyMap<string, ProcessScheduleTimingRecord>): () => void;
|
|
43
54
|
declare function getProcessScheduleDefinitions(): ReadonlyMap<string, ProcessScheduleTimingRecord> | undefined;
|
|
55
|
+
/** Records the installation that `waitForProcessScheduleRuntime()` waits for. */
|
|
56
|
+
declare function setProcessScheduleRuntimeInstallation(installation: Promise<unknown>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Waits until the first Process Runtime has installed, and throws its failure. Code that reads what the installation
|
|
59
|
+
* publishes calls it. It returns at once when no Process Runtime installs, or when one is ready: a replacement that
|
|
60
|
+
* installs later does not hold it.
|
|
61
|
+
*/
|
|
62
|
+
declare function waitForProcessScheduleRuntime(): Promise<void>;
|
|
44
63
|
declare function setHostScheduleInventory(inventory: HostScheduleInventory): void;
|
|
45
64
|
declare function getHostScheduleInventory(): HostScheduleInventory | undefined;
|
|
46
65
|
declare function setScheduleRunStore(store: ScheduleRunStore | undefined): void;
|
|
@@ -52,4 +71,4 @@ declare function setStartedScheduleRuntime(runtime: StartedScheduleRuntime | und
|
|
|
52
71
|
declare function getStartedScheduleRuntime(): StartedScheduleRuntime | undefined;
|
|
53
72
|
declare function loadScheduleDefinition(name: string): Promise<ScheduleRegistryDefinition | undefined>;
|
|
54
73
|
declare function resetScheduleRuntime(): void;
|
|
55
|
-
export { getScheduleRunStore as a, loadScheduleDefinition as c, setHostScheduleInventory as d,
|
|
74
|
+
export { waitForProcessScheduleRuntime as _, getScheduleRunStore as a, loadScheduleDefinition as c, setHostScheduleInventory as d, setProcessScheduleRuntimeInstallation as f, setStartedScheduleRuntime as g, setScheduleRuntimeRegistry as h, getScheduleOccurrenceClaims as i, registerProcessScheduleDefinitions as l, setScheduleRunStore as m, getHostScheduleInventory as n, getScheduleRuntimeRegistry as o, setScheduleOccurrenceClaims as p, getProcessScheduleDefinitions as r, getStartedScheduleRuntime as s, StartedScheduleRuntime as t, resetScheduleRuntime as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import {
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
2
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
3
3
|
import { parseDuration } from "@vite-hub/runtime";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
// src/runtime/store.ts
|
|
@@ -468,6 +468,7 @@ const processDefinitions = /* @__PURE__ */ new Set();
|
|
|
468
468
|
let runtimeRegistryVersion = 0;
|
|
469
469
|
let runStore;
|
|
470
470
|
let startedRuntime;
|
|
471
|
+
let processRuntimeInstallation;
|
|
471
472
|
let occurrenceClaims;
|
|
472
473
|
const loadedRegistryEntries = /* @__PURE__ */ new Map();
|
|
473
474
|
const loadingRegistryEntries = /* @__PURE__ */ new Map();
|
|
@@ -494,6 +495,20 @@ function registerProcessScheduleDefinitions(definitions) {
|
|
|
494
495
|
function getProcessScheduleDefinitions() {
|
|
495
496
|
return [...processDefinitions].at(-1);
|
|
496
497
|
}
|
|
498
|
+
/** Records the installation that `waitForProcessScheduleRuntime()` waits for. */
|
|
499
|
+
function setProcessScheduleRuntimeInstallation(installation) {
|
|
500
|
+
processRuntimeInstallation = installation.then(() => void 0, (error) => ({ error }));
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Waits until the first Process Runtime has installed, and throws its failure. Code that reads what the installation
|
|
504
|
+
* publishes calls it. It returns at once when no Process Runtime installs, or when one is ready: a replacement that
|
|
505
|
+
* installs later does not hold it.
|
|
506
|
+
*/
|
|
507
|
+
async function waitForProcessScheduleRuntime() {
|
|
508
|
+
if (processDefinitions.size > 0) return;
|
|
509
|
+
const failed = await processRuntimeInstallation;
|
|
510
|
+
if (failed) throw failed.error;
|
|
511
|
+
}
|
|
497
512
|
function setHostScheduleInventory(inventory) {
|
|
498
513
|
hostInventory = inventory;
|
|
499
514
|
}
|
|
@@ -563,8 +578,9 @@ function resetScheduleRuntime() {
|
|
|
563
578
|
runtimeRegistryVersion++;
|
|
564
579
|
runStore = void 0;
|
|
565
580
|
startedRuntime = void 0;
|
|
581
|
+
processRuntimeInstallation = void 0;
|
|
566
582
|
occurrenceClaims = void 0;
|
|
567
583
|
loadedRegistryEntries.clear();
|
|
568
584
|
loadingRegistryEntries.clear();
|
|
569
585
|
}
|
|
570
|
-
export {
|
|
586
|
+
export { DEFAULT_SCHEDULE_RETENTION as _, getScheduleRuntimeRegistry as a, joinKey as b, registerProcessScheduleDefinitions as c, setProcessScheduleRuntimeInstallation as d, setScheduleOccurrenceClaims as f, waitForProcessScheduleRuntime as g, setStartedScheduleRuntime as h, getScheduleRunStore as i, resetScheduleRuntime as l, setScheduleRuntimeRegistry as m, getProcessScheduleDefinitions as n, getStartedScheduleRuntime as o, setScheduleRunStore as p, getScheduleOccurrenceClaims as r, loadScheduleDefinition as s, getHostScheduleInventory as t, setHostScheduleInventory as u, createKVScheduleRunStore as v, keySegments as x, createMemoryScheduleRunStore as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import {
|
|
3
|
-
import { n as isScheduleDue, r as latestCronMinute, t as cronWithWeekdayNames } from "./due-
|
|
1
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
2
|
+
import { r as isRecordOrFunction } from "./object-DNOrQSl5.js";
|
|
3
|
+
import { n as isScheduleDue, r as latestCronMinute, t as cronWithWeekdayNames } from "./due-DuZmGuB7.js";
|
|
4
4
|
import { ViteHubError, normalizeRuntimeDiagnosticError } from "@vite-hub/runtime";
|
|
5
5
|
import { emitRunFailed, toRunFailedError } from "@vite-hub/runtime/internal/run-failed";
|
|
6
6
|
import { runInRunScopes } from "@vite-hub/runtime/internal/run-scope";
|
package/dist/vite.js
CHANGED
|
@@ -2,14 +2,14 @@ import { r as __toESM } from "./rolldown-runtime-DegdyBIC.js";
|
|
|
2
2
|
import { a as parseCronFields, l as invariant, u as invariantError } from "./cron-imqlBgO-.js";
|
|
3
3
|
import { a as relative$1, i as isAbsolute$1, n as relativeDefinitionFile, o as resolve$1, r as dirname$1 } from "./inspect-CW0qwt9p.js";
|
|
4
4
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
5
|
-
import { n as isRecordOrFunction, t as
|
|
6
|
-
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-
|
|
7
|
-
import { n as parseScheduleCronExpression, t as assertScheduleCronFields } from "./cron-
|
|
8
|
-
import { m as startedSchedulesTickName } from "./static
|
|
5
|
+
import { n as isRecord, r as isRecordOrFunction, t as isObject } from "./object-DNOrQSl5.js";
|
|
6
|
+
import { t as scheduleErrorDiagnostics } from "./error-diagnostics-D9ul4bWA.js";
|
|
7
|
+
import { n as parseScheduleCronExpression, t as assertScheduleCronFields } from "./cron-eNXDzpau.js";
|
|
8
|
+
import { m as startedSchedulesTickName } from "./static-0MMhvv-6.js";
|
|
9
9
|
import { t as isIanaTimeZone } from "./time-zone-pMp_g8Uu.js";
|
|
10
|
-
import { i as timeZoneOffsetMinutes, t as cronWithWeekdayNames } from "./due-
|
|
10
|
+
import { i as timeZoneOffsetMinutes, t as cronWithWeekdayNames } from "./due-DuZmGuB7.js";
|
|
11
11
|
import { scheduleConsoleTiming } from "./runtime/console.js";
|
|
12
|
-
import "./state-
|
|
12
|
+
import "./state-ClfTAWZO.js";
|
|
13
13
|
import { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
14
14
|
import { formatDiagnostic } from "nostics";
|
|
15
15
|
import { parseDuration } from "@vite-hub/runtime";
|
|
@@ -521,11 +521,9 @@ function isRelativeSpecifier(path) {
|
|
|
521
521
|
function isBareSpecifier(id) {
|
|
522
522
|
return !/^(?:\.{1,2}(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/]|\0|#|[a-z][a-z0-9+.-]*:)/i.test(id);
|
|
523
523
|
}
|
|
524
|
-
/** The folder that a relative import of `importer` resolves from, as esbuild's `resolveDir`. */
|
|
525
524
|
function importerDir(importer, workingDir) {
|
|
526
525
|
return importer && isAbsolute(importer) ? dirname(importer) : workingDir;
|
|
527
526
|
}
|
|
528
|
-
/** Rolldown resolves a specifier from an importer file. A bundle entry has none, so use a file in the working folder. */
|
|
529
527
|
function importerFor(importer, workingDir) {
|
|
530
528
|
return importer ?? join(workingDir, "__vitehub_entry__.js");
|
|
531
529
|
}
|
|
@@ -534,9 +532,9 @@ function isFileResolution(resolved) {
|
|
|
534
532
|
}
|
|
535
533
|
function collectPackageExportCandidates(packageName, exportsValue, packageRelativePath) {
|
|
536
534
|
if (typeof exportsValue === "string") return normalizePathSeparators(exportsValue).replace(/^\.\//, "") === packageRelativePath ? [packageName] : [];
|
|
537
|
-
if (!Array.isArray(exportsValue) && !isRecord
|
|
535
|
+
if (!Array.isArray(exportsValue) && !isRecord(exportsValue)) return [];
|
|
538
536
|
const candidates = [];
|
|
539
|
-
const exportEntries = isRecord
|
|
537
|
+
const exportEntries = isRecord(exportsValue) && Object.keys(exportsValue).some((exportKey) => exportKey.startsWith(".")) ? Object.entries(exportsValue) : [[".", exportsValue]];
|
|
540
538
|
for (const [exportKey, target] of exportEntries) {
|
|
541
539
|
const targets = [target];
|
|
542
540
|
while (targets.length) {
|
|
@@ -553,16 +551,11 @@ function collectPackageExportCandidates(packageName, exportsValue, packageRelati
|
|
|
553
551
|
if (wildcard === void 0) continue;
|
|
554
552
|
candidates.push(`${packageName}${exportKey.slice(1).replace("*", wildcard)}`);
|
|
555
553
|
} else if (Array.isArray(value)) targets.push(...value);
|
|
556
|
-
else if (isRecord
|
|
554
|
+
else if (isRecord(value)) targets.push(...Object.values(value));
|
|
557
555
|
}
|
|
558
556
|
}
|
|
559
557
|
return candidates;
|
|
560
558
|
}
|
|
561
|
-
/**
|
|
562
|
-
* Resolves `specifier` from a resolveId hook without running that hook again. `flag` in `custom` also skips the hook in
|
|
563
|
-
* resolutions that other plugins start from this one. `skipSelf` is still needed: when two equal resolutions run at the
|
|
564
|
-
* same time, Rolldown 1.2 can give one of them no `custom`, and the hook would then wait on its own resolution.
|
|
565
|
-
*/
|
|
566
559
|
function resolveFrom(context, specifier, request, workingDir, flag) {
|
|
567
560
|
return context.resolve(specifier, importerFor(request.importer, workingDir), {
|
|
568
561
|
custom: {
|
|
@@ -659,7 +652,7 @@ function createResolvedAliasPlugin(aliases, aliasResolveDir, workingDir, resolve
|
|
|
659
652
|
else if (resolutionScope) {
|
|
660
653
|
const packageRelativePath = normalizedSpecifier.slice(resolutionScope.length);
|
|
661
654
|
const parsedPackageJson = JSON.parse(await readFile(resolve(resolutionScope, "package.json"), "utf8"));
|
|
662
|
-
if (!isRecord
|
|
655
|
+
if (!isRecord(parsedPackageJson)) return;
|
|
663
656
|
const packageJson = parsedPackageJson;
|
|
664
657
|
if (packageJson.exports === void 0 && !alias.prefix) {
|
|
665
658
|
const resolvedCandidate = await resolveWithContext(alias.specifier);
|
|
@@ -879,9 +872,6 @@ function createWasmModulePlugin(outdir, workingDir, copy) {
|
|
|
879
872
|
}
|
|
880
873
|
};
|
|
881
874
|
}
|
|
882
|
-
/**
|
|
883
|
-
* Leaves package imports external. Resolve package.json import mappings first, and preserve unmapped host imports.
|
|
884
|
-
*/
|
|
885
875
|
function createExternalPackagesPlugin() {
|
|
886
876
|
return {
|
|
887
877
|
name: "vitehub-external-packages",
|
|
@@ -967,7 +957,6 @@ function createOptionalImportPlugin() {
|
|
|
967
957
|
}
|
|
968
958
|
};
|
|
969
959
|
}
|
|
970
|
-
/** Matches import paths as esbuild's `external` does: `*` is a wildcard, and a package name also matches its subpaths. */
|
|
971
960
|
function createExternalMatcher(patterns) {
|
|
972
961
|
if (!patterns?.length) return;
|
|
973
962
|
const matchers = patterns.map((pattern) => {
|
|
@@ -979,7 +968,6 @@ function createExternalMatcher(patterns) {
|
|
|
979
968
|
});
|
|
980
969
|
return (id) => matchers.some((matches) => matches(id));
|
|
981
970
|
}
|
|
982
|
-
/** Returns the modules of the chunks that no chunk loaded from the entry chunk imports. */
|
|
983
971
|
function findUnusedChunkModules(chunks) {
|
|
984
972
|
const used = new Set(chunks.filter((chunk) => chunk.isEntry));
|
|
985
973
|
for (const chunk of used) for (const other of chunks) if (!used.has(other) && chunk.code.includes(other.fileName)) used.add(other);
|
|
@@ -3332,7 +3320,6 @@ async function copyRetainedSourceTree(source, target, filter) {
|
|
|
3332
3320
|
}
|
|
3333
3321
|
await copyEntry(source, target, false);
|
|
3334
3322
|
}
|
|
3335
|
-
/** Copies a file or folder and follows links. `node_modules` folders and paths that disappear during the copy are skipped. */
|
|
3336
3323
|
async function copyTree(source, target) {
|
|
3337
3324
|
const info = await unlessGone(() => stat(source));
|
|
3338
3325
|
if (!info) return;
|
|
@@ -3366,6 +3353,150 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
|
|
|
3366
3353
|
await unlessGone(() => copyFile(join(packageDir, path), target));
|
|
3367
3354
|
}
|
|
3368
3355
|
}
|
|
3356
|
+
// ../internal/src/source-files.ts
|
|
3357
|
+
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
3358
|
+
"node_modules",
|
|
3359
|
+
"dist",
|
|
3360
|
+
".output",
|
|
3361
|
+
".nuxt",
|
|
3362
|
+
".vercel",
|
|
3363
|
+
".git",
|
|
3364
|
+
".vitehub"
|
|
3365
|
+
]);
|
|
3366
|
+
const racyWindowNs = 2000000000n;
|
|
3367
|
+
const storeKey = Symbol.for("vite-hub.source-files.v1");
|
|
3368
|
+
function store() {
|
|
3369
|
+
const existing = Reflect.get(globalThis, storeKey);
|
|
3370
|
+
if (isStore(existing)) return existing;
|
|
3371
|
+
const created = {
|
|
3372
|
+
derived: /* @__PURE__ */ new Map(),
|
|
3373
|
+
texts: /* @__PURE__ */ new Map(),
|
|
3374
|
+
trees: /* @__PURE__ */ new Map()
|
|
3375
|
+
};
|
|
3376
|
+
Reflect.set(globalThis, storeKey, created);
|
|
3377
|
+
return created;
|
|
3378
|
+
}
|
|
3379
|
+
function isStore(value) {
|
|
3380
|
+
return typeof value === "object" && value !== null && "texts" in value && "trees" in value && "derived" in value;
|
|
3381
|
+
}
|
|
3382
|
+
function errorCode(error) {
|
|
3383
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
3384
|
+
}
|
|
3385
|
+
function statOrMissing(path) {
|
|
3386
|
+
try {
|
|
3387
|
+
return statSync(path, { bigint: true });
|
|
3388
|
+
} catch (error) {
|
|
3389
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR") return;
|
|
3390
|
+
throw error;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
function signature(stats) {
|
|
3394
|
+
return `${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`;
|
|
3395
|
+
}
|
|
3396
|
+
function isSettled(stats) {
|
|
3397
|
+
const changed = stats.mtimeNs > stats.ctimeNs ? stats.mtimeNs : stats.ctimeNs;
|
|
3398
|
+
return BigInt(Date.now()) * 1000000n - changed > racyWindowNs;
|
|
3399
|
+
}
|
|
3400
|
+
function readDirEntries(root) {
|
|
3401
|
+
try {
|
|
3402
|
+
return readdirSync(root, { withFileTypes: true });
|
|
3403
|
+
} catch (error) {
|
|
3404
|
+
if (errorCode(error) === "ENOENT") return [];
|
|
3405
|
+
throw error;
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
function walkTree(root, directories, files, nested = false) {
|
|
3409
|
+
const before = statOrMissing(root);
|
|
3410
|
+
let trusted = before !== void 0 && isSettled(before);
|
|
3411
|
+
if (before) directories.set(root, signature(before));
|
|
3412
|
+
if (nested && existsSync(resolve$1(root, ".git"))) return trusted;
|
|
3413
|
+
for (const entry of readDirEntries(root)) {
|
|
3414
|
+
const path = resolve$1(root, entry.name);
|
|
3415
|
+
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
3416
|
+
if (entry.name.startsWith(".") || ignoredDirs.has(entry.name)) continue;
|
|
3417
|
+
if (!walkTree(path, directories, files, true)) trusted = false;
|
|
3418
|
+
continue;
|
|
3419
|
+
}
|
|
3420
|
+
if (entry.isFile()) files.push({
|
|
3421
|
+
hidden: entry.name.startsWith("."),
|
|
3422
|
+
name: entry.name,
|
|
3423
|
+
path
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
return trusted;
|
|
3427
|
+
}
|
|
3428
|
+
function isCurrent(tree) {
|
|
3429
|
+
for (const [directory, stored] of tree.directories) {
|
|
3430
|
+
const stats = statOrMissing(directory);
|
|
3431
|
+
if (!stats || signature(stats) !== stored) return false;
|
|
3432
|
+
}
|
|
3433
|
+
return true;
|
|
3434
|
+
}
|
|
3435
|
+
function sourceTree(root) {
|
|
3436
|
+
const trees = store().trees;
|
|
3437
|
+
const cached = trees.get(root);
|
|
3438
|
+
if (cached && isCurrent(cached)) return cached;
|
|
3439
|
+
const directories = /* @__PURE__ */ new Map();
|
|
3440
|
+
const files = [];
|
|
3441
|
+
const trusted = walkTree(root, directories, files);
|
|
3442
|
+
files.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
|
|
3443
|
+
const tree = {
|
|
3444
|
+
directories,
|
|
3445
|
+
files
|
|
3446
|
+
};
|
|
3447
|
+
if (trusted) trees.set(root, tree);
|
|
3448
|
+
else trees.delete(root);
|
|
3449
|
+
return tree;
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* The files below `root` whose name matches `predicate`, sorted by path. The walk skips hidden folders, Git
|
|
3453
|
+
* repositories, and build output folders such as `node_modules`, `dist`, and `.vitehub`. Hidden files need
|
|
3454
|
+
* `includeHidden`. Symbolic links are skipped.
|
|
3455
|
+
*/
|
|
3456
|
+
function listSourceTreeFiles(root, predicate, options = {}) {
|
|
3457
|
+
const files = [];
|
|
3458
|
+
for (const file of sourceTree(resolve$1(root)).files) {
|
|
3459
|
+
if (file.hidden && !options.includeHidden) continue;
|
|
3460
|
+
if (predicate(file.name)) files.push(file.path);
|
|
3461
|
+
}
|
|
3462
|
+
return files;
|
|
3463
|
+
}
|
|
3464
|
+
/** The UTF-8 text of a source file. A file that did not change since the last read is not read again. */
|
|
3465
|
+
function readSourceText(file) {
|
|
3466
|
+
const path = resolve$1(file);
|
|
3467
|
+
const texts = store().texts;
|
|
3468
|
+
const stats = statOrMissing(path);
|
|
3469
|
+
if (!stats) return readFileSync(path, "utf8");
|
|
3470
|
+
const current = signature(stats);
|
|
3471
|
+
const cached = texts.get(path);
|
|
3472
|
+
if (cached?.trusted && cached.signature === current) return cached.text;
|
|
3473
|
+
const read = readFileSync(path, "utf8");
|
|
3474
|
+
const text = cached?.text === read ? cached.text : read;
|
|
3475
|
+
texts.set(path, {
|
|
3476
|
+
signature: current,
|
|
3477
|
+
text,
|
|
3478
|
+
trusted: isSettled(stats)
|
|
3479
|
+
});
|
|
3480
|
+
return text;
|
|
3481
|
+
}
|
|
3482
|
+
/**
|
|
3483
|
+
* A value that `compute` derives from the text of a source file, such as its syntax tree. The value is computed again
|
|
3484
|
+
* only when the text changes. `kind` separates the values of different callers for one file. The last two texts of a
|
|
3485
|
+
* file are kept, because some callers read both the file and its transformed code.
|
|
3486
|
+
*/
|
|
3487
|
+
function deriveFromSource(kind, file, source, compute) {
|
|
3488
|
+
const derived = store().derived;
|
|
3489
|
+
const key = `${kind}\0${file}`;
|
|
3490
|
+
const entries = derived.get(key) ?? [];
|
|
3491
|
+
const cached = entries.find((entry) => entry.source === source);
|
|
3492
|
+
if (cached) return cached.value;
|
|
3493
|
+
const value = compute();
|
|
3494
|
+
derived.set(key, [{
|
|
3495
|
+
source,
|
|
3496
|
+
value
|
|
3497
|
+
}, ...entries.slice(0, 1)]);
|
|
3498
|
+
return value;
|
|
3499
|
+
}
|
|
3369
3500
|
// ../internal/src/build/scan-module.ts
|
|
3370
3501
|
/**
|
|
3371
3502
|
* Reads facts from JavaScript and TypeScript modules at build and dev time. The scanner parses each module once with
|
|
@@ -3389,6 +3520,17 @@ function scanModule(source, file = "module.ts") {
|
|
|
3389
3520
|
source
|
|
3390
3521
|
};
|
|
3391
3522
|
}
|
|
3523
|
+
/**
|
|
3524
|
+
* Reads and parses a source file once for each change of its text. Callers share the result, so they must not change
|
|
3525
|
+
* the syntax tree.
|
|
3526
|
+
*/
|
|
3527
|
+
function scanSourceFile(file) {
|
|
3528
|
+
return scanModuleText(readSourceText(file), file);
|
|
3529
|
+
}
|
|
3530
|
+
/** `scanModule` with a result that is shared while `source` stays the same for `file`. */
|
|
3531
|
+
function scanModuleText(source, file) {
|
|
3532
|
+
return deriveFromSource("scan-module", file, source, () => scanModule(source, file));
|
|
3533
|
+
}
|
|
3392
3534
|
/** Removes parentheses, `as`, `satisfies`, `!`, and `<T>` assertions around an expression. */
|
|
3393
3535
|
function unwrapExpression(node) {
|
|
3394
3536
|
while (node.type === "ParenthesizedExpression" || node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" || node.type === "TSNonNullExpression" || node.type === "TSTypeAssertion") node = node.expression;
|
|
@@ -3469,16 +3611,11 @@ function objectProperties(object) {
|
|
|
3469
3611
|
function findProperty(object, name) {
|
|
3470
3612
|
return objectProperties(object).findLast((property) => property.key === name);
|
|
3471
3613
|
}
|
|
3472
|
-
/** The value of a template literal without substitutions. */
|
|
3473
3614
|
function staticTemplate(node) {
|
|
3474
3615
|
if (node.expressions.length) return dynamic;
|
|
3475
3616
|
return node.quasis[0]?.value.cooked ?? dynamic;
|
|
3476
3617
|
}
|
|
3477
3618
|
const escapePattern = /\\(u\{[^}]*\}?|u[\s\S]{0,4}|x[\s\S]{0,2}|0\d|[\s\S])/g;
|
|
3478
|
-
/**
|
|
3479
|
-
* True when a string literal has an escape that strict mode code rejects. The parser recovers from some bad escapes
|
|
3480
|
-
* and accepts legacy octal escapes, so the scanner checks them again.
|
|
3481
|
-
*/
|
|
3482
3619
|
function hasInvalidEscape(raw) {
|
|
3483
3620
|
for (const [, escape = ""] of raw.matchAll(escapePattern)) if (escape.startsWith("u{")) {
|
|
3484
3621
|
const code = escape.slice(2, -1);
|
|
@@ -3545,7 +3682,6 @@ function staticString(node) {
|
|
|
3545
3682
|
function isLineTerminator(char) {
|
|
3546
3683
|
return char === "\n" || char === "\r" || char === "\u2028" || char === "\u2029";
|
|
3547
3684
|
}
|
|
3548
|
-
/** Comments, JSX text, and string, template, and regular expression literals, sorted by position. Templates are not split. */
|
|
3549
3685
|
function literalSpans(module) {
|
|
3550
3686
|
const spans = module.comments.map((comment) => ({
|
|
3551
3687
|
end: comment.end,
|
|
@@ -3635,7 +3771,6 @@ async function rebasePublishedProviderSourceLinks(stagedSourcesDir, retainedSour
|
|
|
3635
3771
|
};
|
|
3636
3772
|
await visit(stagedSourcesDir);
|
|
3637
3773
|
}
|
|
3638
|
-
/** Lists the existing published source paths that `contents` names, in every form that the rewrite reads. */
|
|
3639
3774
|
function referencedProviderSourcePaths(contents, publishedSourcesDir) {
|
|
3640
3775
|
const prefixes = [{
|
|
3641
3776
|
decode: (path) => path,
|
|
@@ -3661,9 +3796,7 @@ function referencedProviderSourcePaths(contents, publishedSourcesDir) {
|
|
|
3661
3796
|
}
|
|
3662
3797
|
return [...references].filter((reference) => ![...references].some((parent) => parent !== reference && pathContains$1(parent, reference)));
|
|
3663
3798
|
}
|
|
3664
|
-
/** Dotenv files (`.env*`, Wrangler `.dev.vars*`), registry credentials, and Wrangler state hold local secrets. */
|
|
3665
3799
|
const localSecretFile = /^(?:\.env|\.dev\.vars)(?:\..*)?$|^\.(?:netrc|npmrc|wrangler)$/;
|
|
3666
|
-
/** A retained snapshot and a deployment never receive local secret files, even inside a directory that the code names. */
|
|
3667
3800
|
function isLocalSecretFile(path) {
|
|
3668
3801
|
return localSecretFile.test(basename(path));
|
|
3669
3802
|
}
|
|
@@ -3771,10 +3904,6 @@ function pathContains$1(parent, child) {
|
|
|
3771
3904
|
const nested = relative(parent, child);
|
|
3772
3905
|
return !nested || !nested.startsWith(`..${sep}`) && nested !== ".." && !isAbsolute(nested);
|
|
3773
3906
|
}
|
|
3774
|
-
/**
|
|
3775
|
-
* Creates a check that tells whether a path belongs to a dependency: a named package installed under `node_modules`,
|
|
3776
|
-
* or a named package outside the configured roots, such as a linked workspace package.
|
|
3777
|
-
*/
|
|
3778
3907
|
function createDependencySourceCheck(roots) {
|
|
3779
3908
|
const namedPackages = /* @__PURE__ */ new Map();
|
|
3780
3909
|
const isNamedPackage = (directory) => {
|
|
@@ -3922,7 +4051,6 @@ function resolveComputedModuleSource(file, specifier, resolveFrom = file) {
|
|
|
3922
4051
|
return;
|
|
3923
4052
|
}
|
|
3924
4053
|
}
|
|
3925
|
-
/** The index of the delimiter that closes the one at `open`. `masked` has no literals or comments. */
|
|
3926
4054
|
function matchingDelimiter(masked, open) {
|
|
3927
4055
|
let depth = 0;
|
|
3928
4056
|
for (let index = open; index < masked.length; index++) {
|
|
@@ -3931,7 +4059,6 @@ function matchingDelimiter(masked, open) {
|
|
|
3931
4059
|
else if ((char === ")" || char === "]" || char === "}") && --depth === 0) return index;
|
|
3932
4060
|
}
|
|
3933
4061
|
}
|
|
3934
|
-
/** Splits `source.slice(start, end)` at top-level commas. */
|
|
3935
4062
|
function splitTopLevel(source, masked, start, end) {
|
|
3936
4063
|
const parts = [];
|
|
3937
4064
|
let depth = 0;
|
|
@@ -4335,12 +4462,6 @@ function packageMetadataSourcesForPath(root, path) {
|
|
|
4335
4462
|
}
|
|
4336
4463
|
return sources;
|
|
4337
4464
|
}
|
|
4338
|
-
/**
|
|
4339
|
-
* Generated Provider Output can import a package by the physical pnpm store path
|
|
4340
|
-
* that Vite resolved during the source build. Retained source trees do not copy
|
|
4341
|
-
* `node_modules/.pnpm`, so keep only the store package directories that the
|
|
4342
|
-
* traced source graph actually references.
|
|
4343
|
-
*/
|
|
4344
4465
|
function pnpmStorePackageRoot(root, source) {
|
|
4345
4466
|
const segments = relative(root, source).split(sep);
|
|
4346
4467
|
let nodeModulesIndex = -1;
|
|
@@ -6258,15 +6379,6 @@ function durabilityModuleFile(importMetaUrl) {
|
|
|
6258
6379
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
6259
6380
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
6260
6381
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
6261
|
-
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
6262
|
-
"node_modules",
|
|
6263
|
-
"dist",
|
|
6264
|
-
".output",
|
|
6265
|
-
".nuxt",
|
|
6266
|
-
".vercel",
|
|
6267
|
-
".git",
|
|
6268
|
-
".vitehub"
|
|
6269
|
-
]);
|
|
6270
6382
|
function resolveDefinitionScanRoots(rootDir, scanDirs = []) {
|
|
6271
6383
|
return [...new Set([rootDir, ...scanDirs].filter(Boolean))];
|
|
6272
6384
|
}
|
|
@@ -6289,32 +6401,8 @@ function createSuffixDefinitionSource(source, roots, pattern, normalizeName, opt
|
|
|
6289
6401
|
source
|
|
6290
6402
|
};
|
|
6291
6403
|
}
|
|
6292
|
-
function readDirEntries(root) {
|
|
6293
|
-
try {
|
|
6294
|
-
return readdirSync(root, { withFileTypes: true });
|
|
6295
|
-
} catch (error) {
|
|
6296
|
-
if (error.code === "ENOENT") return [];
|
|
6297
|
-
throw error;
|
|
6298
|
-
}
|
|
6299
|
-
}
|
|
6300
|
-
function isGitRepositoryDirectory(directory) {
|
|
6301
|
-
return existsSync(resolve$1(directory, ".git"));
|
|
6302
|
-
}
|
|
6303
6404
|
function listMatchingFiles(root, predicate, options = {}) {
|
|
6304
|
-
|
|
6305
|
-
for (const entry of readDirEntries(root)) {
|
|
6306
|
-
const absolute = resolve$1(root, entry.name);
|
|
6307
|
-
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
6308
|
-
if (isGitRepositoryDirectory(absolute)) continue;
|
|
6309
|
-
if (entry.name.startsWith(".")) continue;
|
|
6310
|
-
if (ignoredDirs.has(entry.name)) continue;
|
|
6311
|
-
files.push(...listMatchingFiles(absolute, predicate, options));
|
|
6312
|
-
continue;
|
|
6313
|
-
}
|
|
6314
|
-
if (entry.name.startsWith(".") && !options.includeHidden) continue;
|
|
6315
|
-
if (entry.isFile() && predicate(entry.name)) files.push(absolute);
|
|
6316
|
-
}
|
|
6317
|
-
return files.sort();
|
|
6405
|
+
return listSourceTreeFiles(root, predicate, options);
|
|
6318
6406
|
}
|
|
6319
6407
|
/** A module that a Definitions folder can hold: JavaScript or TypeScript, and not a declaration, test, or spec file. */
|
|
6320
6408
|
function isDefinitionSourceFile(name) {
|
|
@@ -6427,10 +6515,6 @@ const runs = shared[runsKey] ??= /* @__PURE__ */ new Map();
|
|
|
6427
6515
|
const startedKey = Symbol.for("vitehub.hints.started");
|
|
6428
6516
|
const startedShared = globalThis;
|
|
6429
6517
|
const started = startedShared[startedKey] ??= /* @__PURE__ */ new WeakSet();
|
|
6430
|
-
/**
|
|
6431
|
-
* The report of the ViteHub project root, where the other generated files go. A Nuxt app with `srcDir: "app"` has its
|
|
6432
|
-
* Vite root in `app/`, one folder below.
|
|
6433
|
-
*/
|
|
6434
6518
|
function hintsFile(config) {
|
|
6435
6519
|
const projectRoot = Reflect.get(config, VITEHUB_PROJECT_ROOT);
|
|
6436
6520
|
return resolve(typeof projectRoot === "string" ? projectRoot : resolveViteHubProjectRoot(config.root), viteHubHintsFile);
|
|
@@ -6579,7 +6663,7 @@ async function flattenPlugins(value, plugins, seen) {
|
|
|
6579
6663
|
for (const item of value) await flattenPlugins(item, plugins, seen);
|
|
6580
6664
|
return;
|
|
6581
6665
|
}
|
|
6582
|
-
if (!isRecord
|
|
6666
|
+
if (!isRecord(value) || seen.has(value)) return;
|
|
6583
6667
|
seen.add(value);
|
|
6584
6668
|
if (isThenable(value)) {
|
|
6585
6669
|
await flattenPlugins(await value, plugins, seen);
|
|
@@ -6611,7 +6695,7 @@ async function collectContributions(plugins, options) {
|
|
|
6611
6695
|
for (const plugin of candidates) {
|
|
6612
6696
|
if (!Object.hasOwn(plugin, "vitehub")) continue;
|
|
6613
6697
|
const metadata = Reflect.get(plugin, "vitehub");
|
|
6614
|
-
if (!isRecord
|
|
6698
|
+
if (!isRecord(metadata) || !Object.hasOwn(metadata, options.key)) continue;
|
|
6615
6699
|
const source = metadata[options.key];
|
|
6616
6700
|
const pluginName = Reflect.get(plugin, "name");
|
|
6617
6701
|
const contributor = isNonEmptyString(pluginName) ? pluginName : unnamedPlugin;
|
|
@@ -6639,12 +6723,12 @@ async function collectContributions(plugins, options) {
|
|
|
6639
6723
|
return [...collected.values()].map(({ contribution }) => contribution).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
6640
6724
|
}
|
|
6641
6725
|
function readContribution(entry, plugin, options, fail) {
|
|
6642
|
-
if (!isRecord
|
|
6726
|
+
if (!isRecord(entry)) return fail("expected { name, definition: { module, export? }, reason? }.");
|
|
6643
6727
|
const { definition, name, reason } = entry;
|
|
6644
6728
|
if (!isNonEmptyString(name) || name.trim() !== name) return fail("`name` must be a non-empty string without surrounding whitespace.");
|
|
6645
6729
|
const nameProblem = options.checkName?.(name);
|
|
6646
6730
|
if (nameProblem) return fail(`${options.kind} ${JSON.stringify(name)}: ${nameProblem}`);
|
|
6647
|
-
if (!isRecord
|
|
6731
|
+
if (!isRecord(definition)) return fail(`${options.kind} ${JSON.stringify(name)} needs \`definition: { module, export? }\`.`);
|
|
6648
6732
|
if (!isNonEmptyString(definition.module)) return fail(`\`definition.module\` of ${options.kind} ${JSON.stringify(name)} must be a non-empty string.`);
|
|
6649
6733
|
let module;
|
|
6650
6734
|
try {
|
|
@@ -6715,16 +6799,16 @@ function cronLocation(file, source, offset) {
|
|
|
6715
6799
|
return `[vitehub] ${file}:${source.slice(0, offset).split("\n").length}: \`defineSchedule()\``;
|
|
6716
6800
|
}
|
|
6717
6801
|
function assertStaticScheduleCron(file) {
|
|
6718
|
-
const source =
|
|
6719
|
-
const definition = findDefaultExportCall(
|
|
6802
|
+
const source = readSourceText(file);
|
|
6803
|
+
const definition = findDefaultExportCall(scanModuleText(source, file), ["defineSchedule"]);
|
|
6720
6804
|
const property = definition?.options && findProperty(definition.options, "cron");
|
|
6721
6805
|
if (!property) return;
|
|
6722
6806
|
const cron = staticString(property.value);
|
|
6723
6807
|
if (cron !== void 0) parseScheduleCronExpression(cron, cronLocation(file, source, property.node.start));
|
|
6724
6808
|
}
|
|
6725
6809
|
function readScheduleDiscoveryMetadata(file, contribution) {
|
|
6726
|
-
const source =
|
|
6727
|
-
const module =
|
|
6810
|
+
const source = readSourceText(file);
|
|
6811
|
+
const module = scanModuleText(source, file);
|
|
6728
6812
|
const definition = findDefaultExportCall(module, ["defineSchedule"]);
|
|
6729
6813
|
const unsupported = (offset, message) => {
|
|
6730
6814
|
const line = source.slice(0, offset).split("\n").length;
|
|
@@ -6982,7 +7066,7 @@ function readStringArray(value) {
|
|
|
6982
7066
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
6983
7067
|
}
|
|
6984
7068
|
function isVercelCron(value) {
|
|
6985
|
-
return isRecord
|
|
7069
|
+
return isRecord(value) && typeof value.path === "string" && typeof value.schedule === "string";
|
|
6986
7070
|
}
|
|
6987
7071
|
function resolveSchedulePublicEntry(resolveImport = (specifier) => import.meta.resolve(specifier)) {
|
|
6988
7072
|
const packageRoot = dirname(fileURLToPath(resolveImport(`${schedulePackageName}/package.json`)));
|
|
@@ -7078,7 +7162,7 @@ function validateDefinitionProviderCron(cron, definition, overrides) {
|
|
|
7078
7162
|
}
|
|
7079
7163
|
/** Reads the `cron` option of a `defineSchedule()` call. Returns `undefined` when it is missing or not a static string. */
|
|
7080
7164
|
function readStaticScheduleCronOption(file) {
|
|
7081
|
-
const definition = findDefaultExportCall(
|
|
7165
|
+
const definition = findDefaultExportCall(scanSourceFile(file), ["defineSchedule"]);
|
|
7082
7166
|
return definition?.options && staticString(findProperty(definition.options, "cron")?.value) || void 0;
|
|
7083
7167
|
}
|
|
7084
7168
|
function readStaticScheduleCron(file, scheduleName) {
|
|
@@ -7092,7 +7176,7 @@ function readStaticScheduleCron(file, scheduleName) {
|
|
|
7092
7176
|
* when it is present but dynamic.
|
|
7093
7177
|
*/
|
|
7094
7178
|
function readStaticScheduleTimeZone(file) {
|
|
7095
|
-
const definition = findDefaultExportCall(
|
|
7179
|
+
const definition = findDefaultExportCall(scanSourceFile(file), ["defineSchedule"]);
|
|
7096
7180
|
const property = definition?.options && findProperty(definition.options, "timeZone");
|
|
7097
7181
|
if (!property) return void 0;
|
|
7098
7182
|
return property.value ? staticString(property.value) ?? null : null;
|
|
@@ -7103,7 +7187,7 @@ function readStaticScheduleTimeZone(file) {
|
|
|
7103
7187
|
*/
|
|
7104
7188
|
function readStaticScheduleTiming(file) {
|
|
7105
7189
|
if (!existsSync(file)) return void 0;
|
|
7106
|
-
const definition = findDefaultExportCall(
|
|
7190
|
+
const definition = findDefaultExportCall(scanSourceFile(file), ["defineSchedule"]);
|
|
7107
7191
|
if (!definition) return void 0;
|
|
7108
7192
|
const cron = staticString(definition.options && findProperty(definition.options, "cron")?.value);
|
|
7109
7193
|
const timeZone = definition.options && findProperty(definition.options, "timeZone");
|
|
@@ -7677,7 +7761,7 @@ async function writeCloudflareScheduleOutput(options) {
|
|
|
7677
7761
|
} catch (error) {
|
|
7678
7762
|
if (error.code !== "ENOENT") throw error;
|
|
7679
7763
|
}
|
|
7680
|
-
const existingTriggers = isRecord
|
|
7764
|
+
const existingTriggers = isRecord(wranglerConfig.triggers) ? wranglerConfig.triggers : {};
|
|
7681
7765
|
const previousState = await readCloudflareOutputState(options.previousStateFile ?? options.stateFile);
|
|
7682
7766
|
options.signal?.throwIfAborted();
|
|
7683
7767
|
const externalCrons = readStringArray(existingTriggers.crons).filter((cron) => !previousState?.crons.includes(cron));
|
|
@@ -8093,12 +8177,9 @@ function resolveSchedulePluginRoots(root, options = {}) {
|
|
|
8093
8177
|
viteRoot: resolvedViteRoot
|
|
8094
8178
|
};
|
|
8095
8179
|
}
|
|
8096
|
-
function isRecord(value) {
|
|
8097
|
-
return typeof value === "object" && value !== null;
|
|
8098
|
-
}
|
|
8099
8180
|
function resolveProcessRuntimeOptions(value) {
|
|
8100
8181
|
if (value === void 0) return;
|
|
8101
|
-
if (!
|
|
8182
|
+
if (!isObject(value) || value.driver !== "process") throw scheduleErrorDiagnostics.SCHEDULE_B0001({ message: "Schedule Process Runtime driver must be \"process\"." });
|
|
8102
8183
|
if (value.prefix !== void 0 && typeof value.prefix !== "string") throw scheduleErrorDiagnostics.SCHEDULE_B0002({ message: "Schedule Process Runtime prefix must be a string." });
|
|
8103
8184
|
if (value.catchUpMs !== void 0 && (typeof value.catchUpMs !== "number" || !Number.isFinite(value.catchUpMs) || value.catchUpMs < 0)) throw scheduleErrorDiagnostics.SCHEDULE_RUNTIME_CATCH_UP_INVALID();
|
|
8104
8185
|
if (value.intervalMs !== void 0 && (typeof value.intervalMs !== "number" || !Number.isFinite(value.intervalMs) || value.intervalMs <= 0 || value.intervalMs > 6e4)) throw scheduleErrorDiagnostics.SCHEDULE_B0003({ message: "Schedule Process Runtime intervalMs must be a positive number no greater than 60000." });
|
|
@@ -8126,11 +8207,11 @@ function resolveScheduleRetention(value, processRuntime) {
|
|
|
8126
8207
|
}
|
|
8127
8208
|
const databaseVitePluginName = "@vite-hub/database/vite";
|
|
8128
8209
|
function hasVitePlugin(plugins, name) {
|
|
8129
|
-
return (plugins ?? []).some((plugin) => Array.isArray(plugin) ? hasVitePlugin(plugin, name) :
|
|
8210
|
+
return (plugins ?? []).some((plugin) => Array.isArray(plugin) ? hasVitePlugin(plugin, name) : isObject(plugin) && plugin.name === name);
|
|
8130
8211
|
}
|
|
8131
8212
|
function resolveCronOverrides(value, definitions, options) {
|
|
8132
8213
|
if (value === void 0) return;
|
|
8133
|
-
if (!
|
|
8214
|
+
if (!isObject(value) || Array.isArray(value)) throw scheduleErrorDiagnostics.SCHEDULE_B0008({ message: "Schedule `cron` must map Schedule names to cron strings, such as `{ cleanup: \"0 0 * * *\" }`." });
|
|
8134
8215
|
const names = definitions && new Set(definitions.map((definition) => definition.name));
|
|
8135
8216
|
const overrides = {};
|
|
8136
8217
|
for (const [name, cron] of Object.entries(value)) {
|
|
@@ -8149,13 +8230,13 @@ function moduleImportSpecifier(fromFile, targetFile) {
|
|
|
8149
8230
|
return specifier.startsWith(".") ? specifier : `./${specifier}`;
|
|
8150
8231
|
}
|
|
8151
8232
|
function cloneNitroConfig(value) {
|
|
8152
|
-
const nitro =
|
|
8233
|
+
const nitro = isObject(value) ? { ...value } : {};
|
|
8153
8234
|
if (Array.isArray(nitro.plugins)) nitro.plugins = [...nitro.plugins];
|
|
8154
|
-
if (
|
|
8235
|
+
if (isObject(nitro.cloudflare)) {
|
|
8155
8236
|
const cloudflare = { ...nitro.cloudflare };
|
|
8156
|
-
if (
|
|
8237
|
+
if (isObject(cloudflare.wrangler)) {
|
|
8157
8238
|
const wrangler = { ...cloudflare.wrangler };
|
|
8158
|
-
if (
|
|
8239
|
+
if (isObject(wrangler.triggers)) {
|
|
8159
8240
|
const triggers = { ...wrangler.triggers };
|
|
8160
8241
|
if (Array.isArray(triggers.crons)) triggers.crons = triggers.crons.filter((cron) => typeof cron === "string");
|
|
8161
8242
|
wrangler.triggers = triggers;
|
|
@@ -8181,7 +8262,7 @@ function mergeNitroScheduleConfig(value, options) {
|
|
|
8181
8262
|
configured.cloudflare ||= {};
|
|
8182
8263
|
configured.cloudflare.wrangler ||= {};
|
|
8183
8264
|
const wrangler = configured.cloudflare.wrangler;
|
|
8184
|
-
const existingTriggers =
|
|
8265
|
+
const existingTriggers = isObject(wrangler.triggers) ? wrangler.triggers : {};
|
|
8185
8266
|
const existingCrons = Array.isArray(existingTriggers.crons) ? existingTriggers.crons.filter((cron) => typeof cron === "string") : [];
|
|
8186
8267
|
wrangler.triggers = {
|
|
8187
8268
|
...existingTriggers,
|
|
@@ -8191,10 +8272,10 @@ function mergeNitroScheduleConfig(value, options) {
|
|
|
8191
8272
|
}
|
|
8192
8273
|
function mergeNitroVercelCrons(value, definitions, crons) {
|
|
8193
8274
|
const nitro = cloneNitroConfig(value);
|
|
8194
|
-
const vercel =
|
|
8195
|
-
const config =
|
|
8275
|
+
const vercel = isObject(nitro.vercel) ? { ...nitro.vercel } : {};
|
|
8276
|
+
const config = isObject(vercel.config) ? { ...vercel.config } : {};
|
|
8196
8277
|
const generatedPaths = new Set(definitions.map((definition) => getVercelSchedulePath(definition.name)));
|
|
8197
|
-
config.crons = [...Array.isArray(config.crons) ? config.crons.filter((cron) =>
|
|
8278
|
+
config.crons = [...Array.isArray(config.crons) ? config.crons.filter((cron) => isObject(cron) && typeof cron.path === "string" && !generatedPaths.has(cron.path)) : [], ...definitions.map((definition) => ({
|
|
8198
8279
|
path: getVercelSchedulePath(definition.name),
|
|
8199
8280
|
schedule: crons.get(definition.name)
|
|
8200
8281
|
}))];
|
|
@@ -8309,11 +8390,7 @@ function renderNitroSchedulePlugin(options) {
|
|
|
8309
8390
|
" // ViteHub runs this drain on a stop signal, before the server closes HTTP, or when Nitro closes.",
|
|
8310
8391
|
" onShutdown(nitroApp, 'schedule', () => runtimeInstallation.then(async (result) => {",
|
|
8311
8392
|
" if ('controller' in result) await result.controller.close()",
|
|
8312
|
-
" }).catch(captureRuntimeError))"
|
|
8313
|
-
" nitroApp.hooks.hook('request', async () => {",
|
|
8314
|
-
" const result = await runtimeInstallation",
|
|
8315
|
-
" if ('error' in result) throw result.error",
|
|
8316
|
-
" })"
|
|
8393
|
+
" }).catch(captureRuntimeError))"
|
|
8317
8394
|
] : [],
|
|
8318
8395
|
"})",
|
|
8319
8396
|
"",
|
|
@@ -8612,7 +8689,7 @@ function shouldEmitStandaloneProviderOutput(definitions, options) {
|
|
|
8612
8689
|
return definitions.length > 0;
|
|
8613
8690
|
}
|
|
8614
8691
|
function readNitroPreset(nitro) {
|
|
8615
|
-
return
|
|
8692
|
+
return isObject(nitro) && typeof nitro.preset === "string" ? nitro.preset : process.env.NITRO_PRESET || process.env.SERVER_PRESET || process.env.VITEHUB_HOST || "";
|
|
8616
8693
|
}
|
|
8617
8694
|
function keepsScheduleRunsInWorkerMemory(nitroPreset, processRuntime, schedules) {
|
|
8618
8695
|
return !processRuntime && schedules > 0 && nitroPreset.startsWith("cloudflare");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/schedule",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Schedule primitives and definition discovery for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@valibot/to-json-schema": "^1.8.0",
|
|
78
|
-
"@vite-hub/runtime": "0.
|
|
78
|
+
"@vite-hub/runtime": "0.9.0",
|
|
79
79
|
"cron-schedule": "^8.0.1",
|
|
80
80
|
"magic-string": "^1.4.5",
|
|
81
81
|
"nostics": "1.4.0",
|
|
@@ -84,8 +84,9 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/node": "^24.19.2",
|
|
86
86
|
"@vite-hub/internal": "0.0.1",
|
|
87
|
-
"@vite-hub/kv": "0.
|
|
87
|
+
"@vite-hub/kv": "0.9.0",
|
|
88
88
|
"esbuild": "^0.28.2",
|
|
89
|
+
"fast-check": "^4.11.0",
|
|
89
90
|
"nitro": "^3.0.261103-rc",
|
|
90
91
|
"postgres": "^3.4.9",
|
|
91
92
|
"publint": "^0.3.25",
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
"vitest": "5.1.0"
|
|
96
97
|
},
|
|
97
98
|
"peerDependencies": {
|
|
98
|
-
"@vite-hub/kv": "0.
|
|
99
|
+
"@vite-hub/kv": "0.9.0",
|
|
99
100
|
"nitro": "3.0.261102-rc || ^3.0.261103-rc",
|
|
100
101
|
"vite": ">=8.0.0"
|
|
101
102
|
},
|