@vite-hub/queue 0.5.0 → 0.6.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/dist/{client-DYE_ZV8c.js → client-CwoCdKct.js} +9 -11
- package/dist/{cloudflare-GosJefIK.js → cloudflare-BMc35cBD.js} +2 -4
- package/dist/{cloudflare-client-BasaJ68s.js → cloudflare-client-xWteD-su.js} +6 -8
- package/dist/{cloudflare-resource-name-BUNNqgkg.js → cloudflare-resource-name-Bv8Z7nDU.js} +3 -4
- package/dist/{config-YEuaeQVq.js → config-Bzp1xmdh.js} +4 -7
- package/dist/{definition-BL_3WHNu.js → definition-CIiFfst2.js} +3 -4
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{duration-CshzgSSx.js → duration-C5w_-Rf4.js} +4 -7
- package/dist/{error-diagnostics-DukggGP6.js → error-diagnostics-Dv6nKZQW.js} +1 -2
- package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
- package/dist/{handler-response-ChtAjPNo.js → handler-response-CchTXVjm.js} +3 -5
- package/dist/index.d.ts +1 -9
- package/dist/index.js +5 -6
- package/dist/{inspect-PeuckaC3.js → inspect-CwdWUhPj.js} +1 -2
- package/dist/internal/runtime/cloudflare-client.d.ts +2 -4
- package/dist/internal/runtime/cloudflare-client.js +1 -2
- package/dist/internal/runtime/cloudflare-vite.d.ts +2 -9
- package/dist/internal/runtime/cloudflare-vite.js +11 -15
- package/dist/internal/runtime/local-client.d.ts +4 -6
- package/dist/internal/runtime/local-client.js +5 -6
- package/dist/internal/runtime/postgres-client.d.ts +4 -7
- package/dist/internal/runtime/postgres-client.js +8 -10
- package/dist/internal/runtime/state.d.ts +3 -5
- package/dist/internal/runtime/state.js +1 -2
- package/dist/internal/runtime/vercel-client.d.ts +2 -4
- package/dist/internal/runtime/vercel-client.js +5 -7
- package/dist/internal/runtime/worker-client.d.ts +3 -5
- package/dist/internal/runtime/worker-client.js +2 -3
- package/dist/{invariant-D8_xBqmZ.js → invariant-CmdvZ3vp.js} +1 -2
- package/dist/{local-DAL5ZgDg.d.ts → local-B72WRWkS.d.ts} +1 -3
- package/dist/{local-CnBd5jdm.js → local-RX10a_Sq.js} +3 -4
- package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
- package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
- package/dist/{operations-BL0b9pte.js → operations-CoEXxfUW.js} +6 -7
- package/dist/operations.d.ts +3 -7
- package/dist/operations.js +9 -696
- package/dist/runtime/hosted.d.ts +2 -4
- package/dist/runtime/hosted.js +4 -5
- package/dist/{scan-module-BbqyaLl6.js → scan-module-BaqBao0J.js} +2 -4
- package/dist/{state-ER1YdCBF.js → state-DqxeV11k.js} +5 -8
- package/dist/{types-D6hDNcMY.d.ts → types-BevEYrUV.d.ts} +1 -3
- package/dist/{types-klaR79hV.d.ts → types-BzPGPV9z.d.ts} +0 -2
- package/dist/{vercel-region-DOciq2kx.js → vercel-region-DEsR1YJQ.js} +2 -3
- package/dist/{vercel-C_4vqxcl.js → vercel-sUJOxFBB.js} +2 -3
- package/dist/vite.d.ts +3 -29
- package/dist/vite.js +36 -52
- package/package.json +11 -10
package/dist/runtime/hosted.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { x as QueueDefinition } from "../types-
|
|
2
|
-
//#region src/runtime/hosted.d.ts
|
|
1
|
+
import { x as QueueDefinition } from "../types-BzPGPV9z.js";
|
|
3
2
|
export declare const hostedVercelWaitUntil: (promise: Promise<unknown>) => void | undefined;
|
|
4
3
|
/** Handle one Vercel Queue delivery. The generated consumer route is a Fetchable module that passes its Request here. */
|
|
5
|
-
export declare function handleHostedVercelQueueCallback(request: Request, name: string, definition: QueueDefinition): Promise<Response>;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function handleHostedVercelQueueCallback(request: Request, name: string, definition: QueueDefinition): Promise<Response>;
|
package/dist/runtime/hosted.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as queueErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as queueErrorDiagnostics } from "../error-diagnostics-Dv6nKZQW.js";
|
|
2
|
+
import { i as reportQueueDeliveryError, r as isNonRetryableQueueError, t as checkQueueHandlerResponse } from "../handler-response-CchTXVjm.js";
|
|
3
|
+
import { n as dynamicQueue } from "../client-CwoCdKct.js";
|
|
4
4
|
import { runInRunScopes } from "@vite-hub/runtime/internal/run-scope";
|
|
5
5
|
import { waitUntil } from "@vercel/functions";
|
|
6
|
-
|
|
6
|
+
// src/runtime/hosted.ts
|
|
7
7
|
const hostedVercelWaitUntil = waitUntil;
|
|
8
8
|
function createVercelJobHandler(definition) {
|
|
9
9
|
return async (payload, metadata) => {
|
|
@@ -47,5 +47,4 @@ async function handleHostedVercelQueueCallback(request, name, definition) {
|
|
|
47
47
|
if (result instanceof Response) return result;
|
|
48
48
|
return result === void 0 ? new Response(null, { status: 204 }) : Response.json(result);
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { handleHostedVercelQueueCallback, hostedVercelWaitUntil };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSync } from "vite";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/build/ast-walk.ts
|
|
3
3
|
/** The oxc parser grammar for a file, from its extension. Defaults to TypeScript. */
|
|
4
4
|
function moduleLanguage(file) {
|
|
5
5
|
if (/\.(?:c|m)?tsx$/i.test(file)) return "tsx";
|
|
@@ -22,8 +22,7 @@ function walk(node, visit, parent) {
|
|
|
22
22
|
} else if (isNode(child)) walk(child, visit, node);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
//#region ../internal/src/build/scan-module.ts
|
|
25
|
+
// ../internal/src/build/scan-module.ts
|
|
27
26
|
/**
|
|
28
27
|
* Reads facts from JavaScript and TypeScript modules at build and dev time. The scanner parses each module once with
|
|
29
28
|
* the oxc parser that Vite ships through Rolldown, and never runs it. Values that are not static literals read as
|
|
@@ -307,5 +306,4 @@ function templateExpressionSources(template) {
|
|
|
307
306
|
if (literal.type !== "TemplateLiteral") return [];
|
|
308
307
|
return literal.expressions.map((_node, index) => module.source.slice(literal.quasis[index]?.end ?? 0, literal.quasis[index + 1]?.start ?? 0));
|
|
309
308
|
}
|
|
310
|
-
//#endregion
|
|
311
309
|
export { argumentExpression, defaultExportExpression, dynamic, exportNames, findCalls, findDefaultExportCall, findProperty, maskLiterals, moduleTokens, nodeText, objectProperties, scanModule, staticString, staticValue, templateExpressionSources, unwrapExpression, walk };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as isRecord } from "./object-
|
|
2
|
-
import { t as queueErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { n as isRecord } from "./object-DRSmpe04.js";
|
|
2
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
|
|
4
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
5
5
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
6
6
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
7
7
|
let activeEnv;
|
|
@@ -41,8 +41,7 @@ function getCloudflareEnv(event, options = {}) {
|
|
|
41
41
|
for (const candidate of [ownValue(target, "env"), ...cloudflareOwners(target).map((owner) => ownValue(owner, "env"))]) if (candidate) return candidate;
|
|
42
42
|
return options.fallback === false ? void 0 : getActiveCloudflareEnv();
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
//#region ../internal/src/runtime/cloudflare-env.ts
|
|
44
|
+
// ../internal/src/runtime/cloudflare-env.ts
|
|
46
45
|
const runtimeGlobal = globalThis;
|
|
47
46
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
48
47
|
const globalEnvProbe = Symbol("vitehub.cloudflare.global-env-probe");
|
|
@@ -113,8 +112,7 @@ function createCloudflareRuntimeEvent(env, context) {
|
|
|
113
112
|
waitUntil
|
|
114
113
|
};
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
//#region src/internal/runtime/state.ts
|
|
115
|
+
// src/internal/runtime/state.ts
|
|
118
116
|
let runtimeConfig;
|
|
119
117
|
let runtimeClientFactory;
|
|
120
118
|
let registryOverride;
|
|
@@ -192,5 +190,4 @@ async function loadQueueDefinition(name) {
|
|
|
192
190
|
if (isQueueDefinition(loaded)) return loaded;
|
|
193
191
|
if (isRecord(loaded) && Object.hasOwn(loaded, "default") && isQueueDefinition(loaded.default)) return loaded.default;
|
|
194
192
|
}
|
|
195
|
-
//#endregion
|
|
196
193
|
export { runWithActiveCloudflareEnv as _, getQueueRuntimeEvent as a, loadQueueDefinition as c, setQueueRuntimeConfig as d, setQueueRuntimeEventDefaults as f, resolveWaitUntil as g, createCloudflareRuntimeEvent as h, getQueueRuntimeConfig as i, missingQueueDefinitionError as l, setQueueRuntimeRegistry as m, getOrCreateQueueClient as n, getQueueRuntimeJobStore as o, setQueueRuntimeJobStore as p, getQueueRuntimeClientFactory as r, listQueueDefinitionNames as s, enterQueueRuntimeEvent as t, runWithQueueRuntimeEvent as u, getCloudflareEnv as v };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { R as ResolvedQueueOptions, T as QueueDriverOptions } from "./types-
|
|
2
|
-
//#region src/internal/runtime/types.d.ts
|
|
1
|
+
import { R as ResolvedQueueOptions, T as QueueDriverOptions } from "./types-BzPGPV9z.js";
|
|
3
2
|
interface QueueDevelopmentOptions {
|
|
4
3
|
development?: boolean;
|
|
5
4
|
}
|
|
6
5
|
type QueueRuntimeOptions = ResolvedQueueOptions & QueueDevelopmentOptions;
|
|
7
6
|
type QueueRuntimeDriverOptions = QueueDriverOptions & QueueDevelopmentOptions;
|
|
8
|
-
//#endregion
|
|
9
7
|
export { QueueRuntimeOptions as n, QueueRuntimeDriverOptions as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Duration, Result } from "@vite-hub/runtime";
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
type QueueDriver = "cloudflare" | "local" | "postgres" | "vercel";
|
|
4
3
|
/** The Queue drivers that run jobs in a Node server process. */
|
|
5
4
|
type NodeQueueDriver = "local" | "postgres";
|
|
@@ -442,5 +441,4 @@ interface QueueJobStore {
|
|
|
442
441
|
readonly rules: LocalQueueDeliveryRules;
|
|
443
442
|
status: () => Promise<LocalQueueStatus>;
|
|
444
443
|
}
|
|
445
|
-
//#endregion
|
|
446
444
|
export { QueueJobStore as A, VercelQueueCallbackOptions as B, QueueDefinitionRegistry as C, QueueErrorCode as D, QueueEnqueueOptions as E, QueueRegistry as F, VercelQueueSendBatchMessage as G, VercelQueueErrorCode as H, QueueSendResult as I, VercelQueueSendBatchOptions as K, ResolvedLocalQueueOptions as L, QueueName as M, QueueOptions as N, QueueHandler as O, QueuePayload as P, ResolvedQueueOptions as R, QueueDefinitionOptions as S, QueueDriverOptions as T, VercelQueueRetryDirective as U, VercelQueueClient as V, VercelQueueRetryHandler as W, PostgresQueueClient as _, CloudflareQueueMessageBatch as a, QueueClient as b, LocalQueueClient as c, LocalQueueJob as d, LocalQueueJobDetail as f, NodeQueueDriver as g, LocalQueueStatus as h, CloudflareQueueMessage as i, QueueModuleDriverOptions as j, QueueJob as k, LocalQueueDriverOptions as l, LocalQueueSendBatchMessage as m, CloudflareQueueClient as n, CloudflareQueueSendBatchItem as o, LocalQueueRules as p, VercelQueueSendResult as q, CloudflareQueueErrorCode as r, DiscoveredQueueDefinition as s, CloudflareQueueBatchHandlerOptions as t, LocalQueueErrorCode as u, PostgresQueueDriverOptions as v, QueueDriver as w, QueueDefinition as x, PostgresQueueErrorCode as y, VercelQueueBatchSendResult as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as getQueueRuntimeEvent } from "./state-
|
|
2
|
-
|
|
1
|
+
import { a as getQueueRuntimeEvent } from "./state-DqxeV11k.js";
|
|
2
|
+
// src/internal/vercel-region.ts
|
|
3
3
|
function readHeader(headers, name) {
|
|
4
4
|
const get = headers?.get;
|
|
5
5
|
const value = typeof get === "function" ? get.call(headers, name) : headers?.[name];
|
|
@@ -22,5 +22,4 @@ function resolveVercelQueueRegion(explicitRegion) {
|
|
|
22
22
|
requestScoped: event !== void 0
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { resolveVercelQueueRegion as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { r as encodeNameHex } from "./cloudflare-
|
|
2
|
-
|
|
1
|
+
import { r as encodeNameHex } from "./cloudflare-BMc35cBD.js";
|
|
2
|
+
// src/integrations/vercel.ts
|
|
3
3
|
const vercelQueueTopicPrefix = "topic--";
|
|
4
4
|
function getVercelQueueTopicName(name) {
|
|
5
5
|
return `${vercelQueueTopicPrefix}${encodeNameHex(name)}`;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { getVercelQueueTopicName as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { N as QueueOptions, s as DiscoveredQueueDefinition } from "./types-
|
|
2
|
-
import { n as OperationContributionEntry } from "./operation-definition-
|
|
1
|
+
import { N as QueueOptions, s as DiscoveredQueueDefinition } from "./types-BzPGPV9z.js";
|
|
2
|
+
import { n as OperationContributionEntry } from "./operation-definition-CqZkx1Rm.js";
|
|
3
3
|
import "nostics";
|
|
4
4
|
import { Plugin, UserConfig } from "vite";
|
|
5
|
-
//#region ../internal/src/deployment.d.ts
|
|
6
5
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
7
6
|
type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region ../internal/src/inspect.d.ts
|
|
10
7
|
interface ViteHubDefinitionField {
|
|
11
8
|
label: string;
|
|
12
9
|
value: string;
|
|
@@ -64,8 +61,6 @@ interface ViteHubInspectionContributor {
|
|
|
64
61
|
providerOutput?: readonly ViteHubProviderOutputEntry[];
|
|
65
62
|
resources?: () => readonly ViteHubResourceSummary[] | Promise<readonly ViteHubResourceSummary[]>;
|
|
66
63
|
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region ../internal/src/build/deployment-plan-output.d.ts
|
|
69
64
|
/**
|
|
70
65
|
* One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
|
|
71
66
|
* a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
|
|
@@ -95,8 +90,6 @@ interface DeploymentEnvContext {
|
|
|
95
90
|
* Return names only, never values.
|
|
96
91
|
*/
|
|
97
92
|
type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region ../internal/src/durability.d.ts
|
|
100
93
|
/**
|
|
101
94
|
* One durability reporter that a primitive's Vite plugin contributes through `vitehub.durability`. The Node server
|
|
102
95
|
* imports `export` from `module` at boot and calls it with `input` and the server environment. It returns the
|
|
@@ -119,8 +112,6 @@ interface DurabilityPluginMetadata {
|
|
|
119
112
|
/** Called after Vite resolves the config. Return an empty list when the primitive is off. */
|
|
120
113
|
durability?: () => readonly DurabilityContribution[];
|
|
121
114
|
}
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region ../internal/src/host-credentials.d.ts
|
|
124
115
|
interface HostCliRunResult {
|
|
125
116
|
exitCode: number | null;
|
|
126
117
|
stdout: string;
|
|
@@ -132,8 +123,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
|
|
|
132
123
|
env: NodeJS.ProcessEnv;
|
|
133
124
|
signal?: AbortSignal;
|
|
134
125
|
}) => Promise<HostCliRunResult>;
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region ../internal/src/provision.d.ts
|
|
137
126
|
type ProvisionProvider = "cloudflare" | "vercel";
|
|
138
127
|
interface ProvisionLogger {
|
|
139
128
|
log: (message: string) => void;
|
|
@@ -185,8 +174,6 @@ interface ProvisionStep {
|
|
|
185
174
|
/** Describes the Provision State this step records. Runs without network access, also without credentials. */
|
|
186
175
|
recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
|
|
187
176
|
}
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region ../internal/src/cli.d.ts
|
|
190
177
|
interface ViteHubCliStreams {
|
|
191
178
|
stderr: {
|
|
192
179
|
write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
|
|
@@ -277,8 +264,6 @@ interface ViteHubCliContributor {
|
|
|
277
264
|
publicUrl?: string;
|
|
278
265
|
}
|
|
279
266
|
type StdoutWriteCallback = (error?: Error | null) => void;
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region ../internal/src/contributions.d.ts
|
|
282
267
|
/** Module and export that hold a contributed Definition. */
|
|
283
268
|
interface ContributionDefinition {
|
|
284
269
|
/**
|
|
@@ -333,8 +318,6 @@ interface CollectedContribution {
|
|
|
333
318
|
/** Name of the contributing Vite plugin. */
|
|
334
319
|
plugin: string;
|
|
335
320
|
}
|
|
336
|
-
//#endregion
|
|
337
|
-
//#region src/contributions.d.ts
|
|
338
321
|
/**
|
|
339
322
|
* A Queue Definition that another package adds from its Vite plugin. The Queue plugin merges it with the discovered
|
|
340
323
|
* files, so the registry, the generated types, Cloudflare bindings, Vercel consumers, inspection, and provisioning
|
|
@@ -356,8 +339,6 @@ type CollectedQueueContribution = CollectedContribution;
|
|
|
356
339
|
* `QUEUE_DEFINITION_DUPLICATE`. Invalid entries fail with `QUEUE_CONTRIBUTION_INVALID`.
|
|
357
340
|
*/
|
|
358
341
|
export declare function collectQueueContributions(plugins: readonly unknown[] | undefined, context: QueueContributionContext): Promise<CollectedQueueContribution[]>;
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region src/discovery.d.ts
|
|
361
342
|
/** Discovery source of Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
|
|
362
343
|
export declare const contributedQueueSource = "vite-plugin-contribution";
|
|
363
344
|
interface QueueContributionOptions {
|
|
@@ -373,8 +354,6 @@ export declare function discoverQueueDefinitions(options: QueueContributionOptio
|
|
|
373
354
|
mode: "server-queues";
|
|
374
355
|
scanDirs: string[];
|
|
375
356
|
}): DiscoveredQueueDefinition[];
|
|
376
|
-
//#endregion
|
|
377
|
-
//#region ../internal/src/console.d.ts
|
|
378
357
|
type MaybePromise<T> = T | Promise<T>;
|
|
379
358
|
/** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
|
|
380
359
|
interface ViteHubConsoleDefinitionCatalogView {
|
|
@@ -443,7 +422,7 @@ interface ViteHubConsoleOperationAction {
|
|
|
443
422
|
operation: string;
|
|
444
423
|
input: Readonly<Record<string, string>>;
|
|
445
424
|
/**
|
|
446
|
-
* The result is `{ url }`, such as a
|
|
425
|
+
* The result is `{ url }`, such as a provider sign-in: the Console opens it in a new tab, and loads
|
|
447
426
|
* the list again when the person comes back. The URL must be `https:`, or `http:` on a loopback host.
|
|
448
427
|
*/
|
|
449
428
|
tab?: true;
|
|
@@ -706,8 +685,6 @@ interface ViteHubConsoleDocumentSetup {
|
|
|
706
685
|
*/
|
|
707
686
|
schedule?: ViteHubConsoleDocumentHint;
|
|
708
687
|
}
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region src/inspect.d.ts
|
|
711
688
|
interface QueueInspectionOptions {
|
|
712
689
|
/** Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
|
|
713
690
|
contributions?: readonly CollectedQueueContribution[];
|
|
@@ -719,8 +696,6 @@ interface QueueInspectionOptions {
|
|
|
719
696
|
export declare function inspectQueueDefinitions(options: QueueInspectionOptions, definitions?: readonly DiscoveredQueueDefinition[]): ViteHubDefinitionSummary[];
|
|
720
697
|
/** Console section that lists discovered Queue Definitions. `vitehub inspect definitions` reads the same data. */
|
|
721
698
|
export declare const queueConsoleSection: ViteHubConsoleSectionContribution<QueueInspectionOptions>;
|
|
722
|
-
//#endregion
|
|
723
|
-
//#region src/vite.d.ts
|
|
724
699
|
interface QueueProvisionContributingPlugin {
|
|
725
700
|
vitehub?: {
|
|
726
701
|
cli?: () => Promise<ViteHubCliContributor>;
|
|
@@ -759,5 +734,4 @@ export interface QueueVitePluginInternalOptions {
|
|
|
759
734
|
}
|
|
760
735
|
export declare function createQueueNitroConfig(plugin: QueueVitePlugin, options: QueueNitroConfigOptions): Promise<Record<string, unknown>>;
|
|
761
736
|
export declare function hubQueue(options?: QueueOptions, internalOptions?: QueueVitePluginInternalOptions): QueueVitePlugin;
|
|
762
|
-
//#endregion
|
|
763
737
|
export type { CollectedQueueContribution, QueueContributingPlugin, QueueContribution, QueueContributionContext, QueueContributionFactory, QueueInspectionOptions };
|
package/dist/vite.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
1
|
+
import { t as invariant } from "./invariant-CmdvZ3vp.js";
|
|
2
|
+
import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
|
|
3
|
+
import { n as isRecord, r as isRecordOrFunction, t as cloneRecord } from "./object-DRSmpe04.js";
|
|
4
|
+
import { a as resolveHost, i as getHostingProvider, n as normalizeQueueOptions, o as resolveHostPreset, r as postgresQueueUrlVariable, t as defaultLocalQueueBase } from "./config-Bzp1xmdh.js";
|
|
5
|
+
import { t as queueErrorDiagnostics } from "./error-diagnostics-Dv6nKZQW.js";
|
|
6
|
+
import { n as isQueueMaxBatchSize } from "./definition-CIiFfst2.js";
|
|
7
|
+
import { t as getCloudflareQueueBindingName } from "./cloudflare-BMc35cBD.js";
|
|
8
|
+
import { t as getVercelQueueTopicName } from "./vercel-sUJOxFBB.js";
|
|
9
|
+
import { t as getCloudflareQueueName } from "./cloudflare-resource-name-Bv8Z7nDU.js";
|
|
10
|
+
import { n as summarizeDefinitions } from "./inspect-CwdWUhPj.js";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
12
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
@@ -15,7 +15,7 @@ import { basename, dirname, isAbsolute, parse, resolve } from "node:path";
|
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
17
17
|
import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, relative, resolve as resolve$1 } from "pathe";
|
|
18
|
-
|
|
18
|
+
// ../internal/src/build/vite.ts
|
|
19
19
|
const projectRootDirectoryMarkers = [
|
|
20
20
|
["server", "agents"],
|
|
21
21
|
["server", "channels"],
|
|
@@ -123,14 +123,12 @@ function isMissingProjectMarker(error) {
|
|
|
123
123
|
const code = error.code;
|
|
124
124
|
return code === "ENOENT" || code === "ENOTDIR";
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
//#region ../internal/src/durability.ts
|
|
126
|
+
// ../internal/src/durability.ts
|
|
128
127
|
/** The `durability` module next to the Vite plugin module at `importMetaUrl`, in source and in `dist`. */
|
|
129
128
|
function durabilityModuleFile(importMetaUrl) {
|
|
130
129
|
return fileURLToPath(new URL(importMetaUrl.endsWith(".ts") ? "./durability.ts" : "./durability.js", importMetaUrl));
|
|
131
130
|
}
|
|
132
|
-
|
|
133
|
-
//#region ../internal/src/build/paths.ts
|
|
131
|
+
// ../internal/src/build/paths.ts
|
|
134
132
|
function generatedDirSegments(productName) {
|
|
135
133
|
return [".vitehub", productName];
|
|
136
134
|
}
|
|
@@ -180,8 +178,7 @@ function realpathIfExists(path) {
|
|
|
180
178
|
return resolve$1(path);
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
|
-
|
|
184
|
-
//#region ../internal/src/build/provider-output-config.ts
|
|
181
|
+
// ../internal/src/build/provider-output-config.ts
|
|
185
182
|
function isProviderJsonArray(value, ancestors) {
|
|
186
183
|
if (Object.getPrototypeOf(value) !== Array.prototype || ancestors.has(value)) return false;
|
|
187
184
|
if (Reflect.ownKeys(value).length !== value.length + 1) return false;
|
|
@@ -268,19 +265,21 @@ function mergeProviderOutputConfig(existing, value, ownership = {}) {
|
|
|
268
265
|
...mergeOwnedArrays(existing, value, ownership.arrays)
|
|
269
266
|
};
|
|
270
267
|
}
|
|
271
|
-
|
|
272
|
-
//#region ../internal/src/build/bundle-options.ts
|
|
268
|
+
// ../internal/src/build/bundle-options.ts
|
|
273
269
|
/** Select the runtime constants from one resolved Vite configuration. */
|
|
274
270
|
function resolveViteHubBundleDefines(config) {
|
|
275
271
|
const defines = {};
|
|
276
|
-
for (const name of [
|
|
272
|
+
for (const name of [
|
|
273
|
+
"__VITEHUB_PUBLIC_URL__",
|
|
274
|
+
"__VITEHUB_APP_BASE_URL__",
|
|
275
|
+
"__VITEHUB_CONSOLE_URL__"
|
|
276
|
+
]) {
|
|
277
277
|
const value = config.define?.[name];
|
|
278
278
|
if (typeof value === "string") defines[name] = value;
|
|
279
279
|
}
|
|
280
280
|
return defines;
|
|
281
281
|
}
|
|
282
|
-
|
|
283
|
-
//#region ../internal/src/build/cloudflare-provider-output.ts
|
|
282
|
+
// ../internal/src/build/cloudflare-provider-output.ts
|
|
284
283
|
function isDeepStrictEqual(left, right) {
|
|
285
284
|
if (Object.is(left, right)) return true;
|
|
286
285
|
if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
|
|
@@ -459,8 +458,7 @@ function composeNitroCloudflareProviderOutput(catalog, value, inheritedValue = v
|
|
|
459
458
|
associateProviderOutputCatalog(output, catalog);
|
|
460
459
|
return output;
|
|
461
460
|
}
|
|
462
|
-
|
|
463
|
-
//#region ../internal/src/build/provider-output-catalog.ts
|
|
461
|
+
// ../internal/src/build/provider-output-catalog.ts
|
|
464
462
|
var ProviderOutputCatalog = class {
|
|
465
463
|
bundleDefines = {};
|
|
466
464
|
#appliedCloudflareContributions = /* @__PURE__ */ new Map();
|
|
@@ -729,8 +727,7 @@ function mergeNitroExternal(value, addition) {
|
|
|
729
727
|
if (typeof value === "function") return (source, importer, isResolved) => source === addition || Boolean(value(source, importer, isResolved));
|
|
730
728
|
return value;
|
|
731
729
|
}
|
|
732
|
-
|
|
733
|
-
//#region ../internal/src/contributions.ts
|
|
730
|
+
// ../internal/src/contributions.ts
|
|
734
731
|
const unnamedPlugin = "unnamed plugin";
|
|
735
732
|
function isNonEmptyString(value) {
|
|
736
733
|
return String(value) === value && value.length > 0;
|
|
@@ -835,8 +832,7 @@ function readContribution(entry, plugin, options, fail) {
|
|
|
835
832
|
...base
|
|
836
833
|
};
|
|
837
834
|
}
|
|
838
|
-
|
|
839
|
-
//#region src/contributions.ts
|
|
835
|
+
// src/contributions.ts
|
|
840
836
|
const queueNamePattern = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/i;
|
|
841
837
|
function invalid(message) {
|
|
842
838
|
return queueErrorDiagnostics.QUEUE_CONTRIBUTION_INVALID({ message });
|
|
@@ -863,8 +859,7 @@ async function collectQueueContributions(plugins, context) {
|
|
|
863
859
|
}
|
|
864
860
|
return contributions;
|
|
865
861
|
}
|
|
866
|
-
|
|
867
|
-
//#region src/deployment-env.ts
|
|
862
|
+
// src/deployment-env.ts
|
|
868
863
|
const owners = ["queue"];
|
|
869
864
|
/**
|
|
870
865
|
* The variables that Queue reads on the deployed host. The `postgres` provider reads `QUEUE_POSTGRES_URL`, which is
|
|
@@ -889,8 +884,7 @@ function queueDeploymentEnv(queue) {
|
|
|
889
884
|
}];
|
|
890
885
|
return [];
|
|
891
886
|
}
|
|
892
|
-
|
|
893
|
-
//#region ../internal/src/definition-catalog.ts
|
|
887
|
+
// ../internal/src/definition-catalog.ts
|
|
894
888
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
895
889
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
896
890
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
@@ -1040,8 +1034,7 @@ function createRuntimeRegistryContents(registryFile, definitions) {
|
|
|
1040
1034
|
""
|
|
1041
1035
|
].join("\n");
|
|
1042
1036
|
}
|
|
1043
|
-
|
|
1044
|
-
//#region src/discovery.ts
|
|
1037
|
+
// src/discovery.ts
|
|
1045
1038
|
const queueSuffixPattern = /\.queue\.(?:c|m)?[jt]s$/i;
|
|
1046
1039
|
/** Discovery source of Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
|
|
1047
1040
|
const contributedQueueSource = "vite-plugin-contribution";
|
|
@@ -1071,8 +1064,7 @@ function discoverQueueDefinitions(options) {
|
|
|
1071
1064
|
const serverScanDirs = [...new Set(options.serverDirs?.map((dir) => resolve$1(dir)) ?? (options.serverRootDirs ?? roots).map((root) => resolve$1(root, "server")))];
|
|
1072
1065
|
return mergeContributedQueueDefinitions(discoverDefinitions("queue", [createSuffixDefinitionSource("vite-suffix", roots, queueSuffixPattern, normalizeSuffixQueueName), createDirectoryDefinitionSource("server-queues", serverScanDirs, "queues")]), options.contributions);
|
|
1073
1066
|
}
|
|
1074
|
-
|
|
1075
|
-
//#region src/registry-types.ts
|
|
1067
|
+
// src/registry-types.ts
|
|
1076
1068
|
function createQueueTypes(file, definitions, importBase = "@vite-hub/queue") {
|
|
1077
1069
|
const entries = definitions.map((definition) => {
|
|
1078
1070
|
const path = relative(dirname$1(file), definition.handler);
|
|
@@ -1094,8 +1086,7 @@ async function writeQueueTypes(root, definitions, importBase = "@vite-hub/queue"
|
|
|
1094
1086
|
await mkdir(dirname$1(file), { recursive: true });
|
|
1095
1087
|
await writeFile(file, createQueueTypes(file, definitions, importBase), "utf8");
|
|
1096
1088
|
}
|
|
1097
|
-
|
|
1098
|
-
//#region src/internal/vite-build.ts
|
|
1089
|
+
// src/internal/vite-build.ts
|
|
1099
1090
|
const queuePackageName = "@vite-hub/queue";
|
|
1100
1091
|
const productName = "queue";
|
|
1101
1092
|
const generatedRegistryFileName = "registry.mjs";
|
|
@@ -1176,7 +1167,7 @@ function readQueueMaxBatchSize(file, { argumentExpression, defaultExportExpressi
|
|
|
1176
1167
|
async function createCloudflareQueueBindings(definitions, namePrefix = "") {
|
|
1177
1168
|
if (!definitions.length) return;
|
|
1178
1169
|
createCloudflareQueueDefinitionNames(definitions, namePrefix);
|
|
1179
|
-
const scanner = await import("./scan-module-
|
|
1170
|
+
const scanner = await import("./scan-module-BaqBao0J.js");
|
|
1180
1171
|
return {
|
|
1181
1172
|
consumers: definitions.map((definition) => {
|
|
1182
1173
|
const maxBatchSize = readQueueMaxBatchSize(definition.handler, scanner);
|
|
@@ -1336,8 +1327,7 @@ function renderVercelQueueConsumerHandler(file, name) {
|
|
|
1336
1327
|
""
|
|
1337
1328
|
].join("\n");
|
|
1338
1329
|
}
|
|
1339
|
-
|
|
1340
|
-
//#region src/inspect.ts
|
|
1330
|
+
// src/inspect.ts
|
|
1341
1331
|
/** Summarizes discovered Queue Definitions for the CLI and Console. */
|
|
1342
1332
|
function inspectQueueDefinitions(options, definitions = discoverQueueDefinitions(options)) {
|
|
1343
1333
|
return summarizeDefinitions(options.projectRoot, definitions, "queue").map((summary, index) => {
|
|
@@ -1379,8 +1369,7 @@ const queueConsoleSection = {
|
|
|
1379
1369
|
notice: "Cloudflare and Vercel do not expose Queue backlog or delivery history through ViteHub. The local provider reports its job directory and job counts in `vitehub queue list`."
|
|
1380
1370
|
}
|
|
1381
1371
|
};
|
|
1382
|
-
|
|
1383
|
-
//#region ../internal/src/host-credentials.ts
|
|
1372
|
+
// ../internal/src/host-credentials.ts
|
|
1384
1373
|
/** Reads host credentials from environment variables only. Returns undefined when the token is not set. */
|
|
1385
1374
|
function readHostCredentialsFromEnv(host, env) {
|
|
1386
1375
|
switch (host) {
|
|
@@ -1414,8 +1403,7 @@ function trimmed(value) {
|
|
|
1414
1403
|
const result = value?.trim();
|
|
1415
1404
|
return result ? result : void 0;
|
|
1416
1405
|
}
|
|
1417
|
-
|
|
1418
|
-
//#region ../internal/src/provider-failure.ts
|
|
1406
|
+
// ../internal/src/provider-failure.ts
|
|
1419
1407
|
const cloudflareCodes = {
|
|
1420
1408
|
d1: {},
|
|
1421
1409
|
kv: { 10014: "conflict" },
|
|
@@ -1517,8 +1505,7 @@ function readProviderErrorCodes(body) {
|
|
|
1517
1505
|
const errors = Reflect.get(body, "errors");
|
|
1518
1506
|
return [error && typeof error === "object" ? Reflect.get(error, "code") : void 0, ...Array.isArray(errors) ? errors.map((entry) => entry && typeof entry === "object" ? Reflect.get(entry, "code") : void 0) : []].filter((code) => typeof code === "number" && Number.isFinite(code) || typeof code === "string" && /^[\w.-]{1,128}$/.test(code));
|
|
1519
1507
|
}
|
|
1520
|
-
|
|
1521
|
-
//#region ../internal/src/provision.ts
|
|
1508
|
+
// ../internal/src/provision.ts
|
|
1522
1509
|
/**
|
|
1523
1510
|
* Whether a value from Provision State can appear in a copyable shell command as is.
|
|
1524
1511
|
* The file is editable, so a hint shows a command only for plain names and ids.
|
|
@@ -1636,8 +1623,7 @@ async function listCloudflarePages(request, path, options) {
|
|
|
1636
1623
|
} else if (options.perPage === void 0 || pageItems.length < options.perPage) return items;
|
|
1637
1624
|
}
|
|
1638
1625
|
}
|
|
1639
|
-
|
|
1640
|
-
//#region src/provision.ts
|
|
1626
|
+
// src/provision.ts
|
|
1641
1627
|
const QUEUE_CLOUDFLARE_PROVISION_CATEGORY = "queue";
|
|
1642
1628
|
function parseQueues(value) {
|
|
1643
1629
|
if (!Array.isArray(value) || Array.from(value).some((queue, index) => !(index in value) || queue === null || typeof queue !== "object" || Array.isArray(queue))) throw queueErrorDiagnostics.QUEUE_PROVISION_FAILED();
|
|
@@ -1688,8 +1674,7 @@ function createQueueProvisionStep(resolveDefinitions, resolveNamePrefix = () =>
|
|
|
1688
1674
|
}
|
|
1689
1675
|
};
|
|
1690
1676
|
}
|
|
1691
|
-
|
|
1692
|
-
//#region src/vite.ts
|
|
1677
|
+
// src/vite.ts
|
|
1693
1678
|
const operationsModule = ownModule(import.meta.url, "operations");
|
|
1694
1679
|
const mergeNoExternal = createNoExternalAddition(queuePackageName);
|
|
1695
1680
|
const databaseVitePluginName = "@vite-hub/database/vite";
|
|
@@ -2096,5 +2081,4 @@ function hubQueue(options, internalOptions = {}) {
|
|
|
2096
2081
|
}
|
|
2097
2082
|
};
|
|
2098
2083
|
}
|
|
2099
|
-
//#endregion
|
|
2100
2084
|
export { collectQueueContributions, contributedQueueSource, createQueueNitroConfig, discoverQueueDefinitions, hubQueue, inspectQueueDefinitions, queueConsoleSection };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/queue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Queue primitives and Vite deployment integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"background-jobs",
|
|
@@ -64,28 +64,29 @@
|
|
|
64
64
|
"./package.json": "./package.json"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@
|
|
67
|
+
"@valibot/to-json-schema": "^1.8.0",
|
|
68
|
+
"@vite-hub/runtime": "0.6.0",
|
|
68
69
|
"defu": "^6.1.7",
|
|
69
70
|
"nostics": "1.4.0",
|
|
70
71
|
"pathe": "^2.0.3"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
|
-
"@types/node": "^24.19.
|
|
74
|
-
"@vercel/functions": "^3.
|
|
74
|
+
"@types/node": "^24.19.2",
|
|
75
|
+
"@vercel/functions": "^3.11.3",
|
|
75
76
|
"@vercel/queue": "^0.11.0",
|
|
76
|
-
"@vite-hub/database": "0.
|
|
77
|
+
"@vite-hub/database": "0.6.0",
|
|
77
78
|
"@vite-hub/internal": "0.0.1",
|
|
78
79
|
"postgres": "^3.4.9",
|
|
79
80
|
"publint": "^0.3.25",
|
|
80
81
|
"typescript": "^6.0.3",
|
|
81
|
-
"undici": "8.
|
|
82
|
+
"undici": "8.13.1",
|
|
82
83
|
"valibot": "^1.5.0",
|
|
83
|
-
"vite": "^8.
|
|
84
|
-
"vite-plus": "^
|
|
85
|
-
"vitest": "
|
|
84
|
+
"vite": "^8.3.8",
|
|
85
|
+
"vite-plus": "^1.7.0",
|
|
86
|
+
"vitest": "5.1.0"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
88
|
-
"@vercel/functions": "^3.
|
|
89
|
+
"@vercel/functions": "^3.11.3",
|
|
89
90
|
"@vercel/queue": "^0.11.0",
|
|
90
91
|
"postgres": "^3.4.9",
|
|
91
92
|
"vite": ">=8.0.0"
|