@vite-hub/queue 0.0.2 → 0.0.3
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-CBDT9GL9.js → client-CPQ-iyXS.js} +1 -1
- package/dist/{cloudflare-vite-BNBVtEwG.js → cloudflare-vite-bA1eLf46.js} +2 -2
- package/dist/{cloudflare-vite-krY8T3zM.d.ts → cloudflare-vite-nFPor46-.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{runtime → internal/runtime}/cloudflare-vite.d.ts +1 -1
- package/dist/internal/runtime/cloudflare-vite.js +2 -0
- package/dist/{runtime → internal/runtime}/state.d.ts +2 -2
- package/dist/{runtime → internal/runtime}/state.js +1 -1
- package/dist/internal/runtime/vercel-client.js +1 -1
- package/dist/{runtime → internal/runtime}/vercel-vite.d.ts +3 -3
- package/dist/{runtime → internal/runtime}/vercel-vite.js +3 -3
- package/dist/nuxt.js +1 -1
- package/dist/runtime/hosted.js +1 -1
- package/dist/{state-BfUFGeC2.js → state-Bo8CLZ_k.js} +1 -1
- package/dist/{vercel-runtime-package-copy-B8AEFWXT.js → vercel-runtime-package-copy-CKimoFJ5.js} +1 -1
- package/dist/{vite-C6yK76Sw.js → vite-BcMpQk_n.js} +33 -14
- package/dist/vite.js +1 -1
- package/package.json +5 -5
- package/dist/runtime/cloudflare-vite.js +0 -2
|
@@ -2,7 +2,7 @@ import { t as normalizeQueueOptions } from "./config-B7xkD1v0.js";
|
|
|
2
2
|
import { i as isQueueBoundaryIdentity, l as normalizeQueueEnqueueInput, n as createQueueError, o as normalizePublicQueueIdentifier, s as runQueueProviderOperation } from "./errors-CjuG_qr-.js";
|
|
3
3
|
import { t as getCloudflareQueueBindingName } from "./cloudflare-GosJefIK.js";
|
|
4
4
|
import { t as getVercelQueueTopicName } from "./vercel-C_4vqxcl.js";
|
|
5
|
-
import { a as getQueueRuntimeEvent, f as getCloudflareEnv, i as getQueueRuntimeConfig, n as getQueueClientCache, o as loadQueueDefinition, p as resolveWaitUntil, r as getQueueRuntimeClientFactory, s as runWithQueueRuntimeEvent } from "./state-
|
|
5
|
+
import { a as getQueueRuntimeEvent, f as getCloudflareEnv, i as getQueueRuntimeConfig, n as getQueueClientCache, o as loadQueueDefinition, p as resolveWaitUntil, r as getQueueRuntimeClientFactory, s as runWithQueueRuntimeEvent } from "./state-Bo8CLZ_k.js";
|
|
6
6
|
//#region src/runtime/client.ts
|
|
7
7
|
function createQueueDefinitionNotFoundError(name) {
|
|
8
8
|
const queue = normalizePublicQueueIdentifier(name);
|
|
@@ -2,7 +2,7 @@ import { t as normalizeQueueOptions } from "./config-B7xkD1v0.js";
|
|
|
2
2
|
import { n as getCloudflareQueueDefinitionName } from "./cloudflare-GosJefIK.js";
|
|
3
3
|
import { n as createCloudflareQueueBatchHandler, t as createCloudflareQueueRuntimeClient } from "./cloudflare-client-w5vphoNn.js";
|
|
4
4
|
import { t as getCloudflareQueueName } from "./cloudflare-resource-name-R8zYQiZb.js";
|
|
5
|
-
import { c as setQueueRuntimeConfig, d as createCloudflareRuntimeEvent, m as runWithActiveCloudflareEnv, o as loadQueueDefinition, s as runWithQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "./state-
|
|
5
|
+
import { c as setQueueRuntimeConfig, d as createCloudflareRuntimeEvent, m as runWithActiveCloudflareEnv, o as loadQueueDefinition, s as runWithQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "./state-Bo8CLZ_k.js";
|
|
6
6
|
import { t as resolveAppFetch } from "./app-BZpq2cwC.js";
|
|
7
7
|
import { H3, toWebHandler } from "h3/cloudflare";
|
|
8
8
|
//#region ../internal/src/runtime/cloudflare-hosted.ts
|
|
@@ -36,7 +36,7 @@ function createQueueJob(message, batch) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
|
-
//#region src/runtime/cloudflare-vite.ts
|
|
39
|
+
//#region src/internal/runtime/cloudflare-vite.ts
|
|
40
40
|
function createRegistryDefinitionNames(registry, namePrefix) {
|
|
41
41
|
if (!registry) return void 0;
|
|
42
42
|
const definitions = {};
|
|
@@ -7,7 +7,7 @@ interface CloudflareWorkerExecutionContext {
|
|
|
7
7
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
|
-
//#region src/runtime/cloudflare-vite.d.ts
|
|
10
|
+
//#region src/internal/runtime/cloudflare-vite.d.ts
|
|
11
11
|
type CloudflareWorkerApp = QueueApp;
|
|
12
12
|
interface QueueCloudflareWorkerOptions {
|
|
13
13
|
app?: CloudflareWorkerApp;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as VercelQueueRetryHandler, S as VercelQueueRetryDirective, _ as QueueProviderOptions, a as DiscoveredQueueDefinition, b as VercelQueueCallbackOptions, c as QueueDefinitionOptions, d as QueueEnqueueOptions, f as QueueHandler, g as QueueProvider, h as QueueModuleProviderOptions, i as CloudflareQueueMessageBatch, l as QueueDefinitionRegistry, m as QueueModuleOptions, n as CloudflareQueueClient, o as QueueClient, p as QueueJob, r as CloudflareQueueMessage, s as QueueDefinition, t as CloudflareQueueBatchHandlerOptions, u as QueueEnqueueInput, v as QueueSendResult, w as VercelQueueSendResult, x as VercelQueueClient, y as ResolvedQueueOptions } from "./types-CwvoMATy.js";
|
|
2
|
-
import { i as createQueueCloudflareWorker } from "./cloudflare-vite-
|
|
2
|
+
import { i as createQueueCloudflareWorker } from "./cloudflare-vite-nFPor46-.js";
|
|
3
3
|
import { ViteHubError, ViteHubErrorDetails } from "@vite-hub/runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/config.d.ts
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { n as getCloudflareQueueDefinitionName, t as getCloudflareQueueBindingNa
|
|
|
4
4
|
import { n as createCloudflareQueueBatchHandler } from "./cloudflare-client-w5vphoNn.js";
|
|
5
5
|
import { t as getCloudflareQueueName } from "./cloudflare-resource-name-R8zYQiZb.js";
|
|
6
6
|
import { t as getVercelQueueTopicName } from "./vercel-C_4vqxcl.js";
|
|
7
|
-
import { n as getQueue, r as runQueue, t as deferQueue } from "./client-
|
|
8
|
-
import { t as createQueueCloudflareWorker } from "./cloudflare-vite-
|
|
7
|
+
import { n as getQueue, r as runQueue, t as deferQueue } from "./client-CPQ-iyXS.js";
|
|
8
|
+
import { t as createQueueCloudflareWorker } from "./cloudflare-vite-bA1eLf46.js";
|
|
9
9
|
//#region src/definition.ts
|
|
10
10
|
function defineQueue(handler, options) {
|
|
11
11
|
if (typeof handler !== "function") throw new TypeError("`defineQueue()` requires a queue handler.");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createQueueCloudflareWorker, n as QueueCloudflareWorker, r as QueueCloudflareWorkerOptions, t as CloudflareWorkerApp } from "
|
|
1
|
+
import { i as createQueueCloudflareWorker, n as QueueCloudflareWorker, r as QueueCloudflareWorkerOptions, t as CloudflareWorkerApp } from "../../cloudflare-vite-nFPor46-.js";
|
|
2
2
|
export { CloudflareWorkerApp, QueueCloudflareWorker, QueueCloudflareWorkerOptions, createQueueCloudflareWorker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as QueueProviderOptions, l as QueueDefinitionRegistry, o as QueueClient, s as QueueDefinition, y as ResolvedQueueOptions } from "
|
|
1
|
+
import { _ as QueueProviderOptions, l as QueueDefinitionRegistry, o as QueueClient, s as QueueDefinition, y as ResolvedQueueOptions } from "../../types-CwvoMATy.js";
|
|
2
2
|
|
|
3
|
-
//#region src/runtime/state.d.ts
|
|
3
|
+
//#region src/internal/runtime/state.d.ts
|
|
4
4
|
type QueueRuntimeClientFactory = (options: QueueProviderOptions) => QueueClient | Promise<QueueClient>;
|
|
5
5
|
declare function setQueueRuntimeConfig(config: false | ResolvedQueueOptions | undefined, createClient?: QueueRuntimeClientFactory): void;
|
|
6
6
|
declare function getQueueRuntimeConfig(): false | ResolvedQueueOptions | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getQueueRuntimeEvent, c as setQueueRuntimeConfig, i as getQueueRuntimeConfig, l as setQueueRuntimeEventDefaults, n as getQueueClientCache, o as loadQueueDefinition, r as getQueueRuntimeClientFactory, s as runWithQueueRuntimeEvent, t as enterQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "
|
|
1
|
+
import { a as getQueueRuntimeEvent, c as setQueueRuntimeConfig, i as getQueueRuntimeConfig, l as setQueueRuntimeEventDefaults, n as getQueueClientCache, o as loadQueueDefinition, r as getQueueRuntimeClientFactory, s as runWithQueueRuntimeEvent, t as enterQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "../../state-Bo8CLZ_k.js";
|
|
2
2
|
export { enterQueueRuntimeEvent, getQueueClientCache, getQueueRuntimeClientFactory, getQueueRuntimeConfig, getQueueRuntimeEvent, loadQueueDefinition, runWithQueueRuntimeEvent, setQueueRuntimeConfig, setQueueRuntimeEventDefaults, setQueueRuntimeRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as isQueueBoundaryIdentity, l as normalizeQueueEnqueueInput, n as createQueueError, s as runQueueProviderOperation } from "../../errors-CjuG_qr-.js";
|
|
2
|
-
import { a as getQueueRuntimeEvent } from "../../state-
|
|
2
|
+
import { a as getQueueRuntimeEvent } from "../../state-Bo8CLZ_k.js";
|
|
3
3
|
//#region src/providers/vercel.ts
|
|
4
4
|
function readHeader(headers, name) {
|
|
5
5
|
if (!headers) return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as QueueDefinitionRegistry, y as ResolvedQueueOptions } from "
|
|
2
|
-
import { t as QueueApp } from "
|
|
1
|
+
import { l as QueueDefinitionRegistry, y as ResolvedQueueOptions } from "../../types-CwvoMATy.js";
|
|
2
|
+
import { t as QueueApp } from "../../_app-D29AwUdD.js";
|
|
3
3
|
import { QueueRuntimeClientFactory } from "./state.js";
|
|
4
4
|
|
|
5
|
-
//#region src/runtime/vercel-vite.d.ts
|
|
5
|
+
//#region src/internal/runtime/vercel-vite.d.ts
|
|
6
6
|
interface QueueVercelServerBaseOptions {
|
|
7
7
|
app?: QueueApp;
|
|
8
8
|
registry?: QueueDefinitionRegistry;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as setQueueRuntimeConfig, s as runWithQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "
|
|
2
|
-
import { t as resolveAppFetch } from "
|
|
1
|
+
import { c as setQueueRuntimeConfig, s as runWithQueueRuntimeEvent, u as setQueueRuntimeRegistry } from "../../state-Bo8CLZ_k.js";
|
|
2
|
+
import { t as resolveAppFetch } from "../../app-BZpq2cwC.js";
|
|
3
3
|
import { waitUntil } from "@vercel/functions";
|
|
4
4
|
import { H3 } from "h3";
|
|
5
5
|
//#region ../internal/src/runtime/vercel-hosted.ts
|
|
@@ -28,7 +28,7 @@ function createVercelHostedServer(adapter) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region src/runtime/vercel-vite.ts
|
|
31
|
+
//#region src/internal/runtime/vercel-vite.ts
|
|
32
32
|
function createQueueVercelServer(options) {
|
|
33
33
|
if (options.queue !== false && !options.createClient) throw new TypeError("[vitehub] Enabled Vercel Queue output requires its generated client factory.");
|
|
34
34
|
return createVercelHostedServer({
|
package/dist/nuxt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as hubQueue, t as createQueueNitroConfig } from "./vite-
|
|
1
|
+
import { n as hubQueue, t as createQueueNitroConfig } from "./vite-BcMpQk_n.js";
|
|
2
2
|
//#region src/nuxt.ts
|
|
3
3
|
function isQueueVitePlugin(value) {
|
|
4
4
|
return Boolean(value && typeof value === "object" && value.name === "@vite-hub/queue/vite");
|
package/dist/runtime/hosted.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as createQueueError } from "../errors-CjuG_qr-.js";
|
|
2
2
|
import { n as reportQueueDeliveryError, t as isNonRetryableQueueError } from "../delivery-error-glgYWC9g.js";
|
|
3
|
-
import { n as getQueue } from "../client-
|
|
3
|
+
import { n as getQueue } from "../client-CPQ-iyXS.js";
|
|
4
4
|
import { waitUntil } from "@vercel/functions";
|
|
5
5
|
import { getRequestHeaders, getRequestURL, readRawBody } from "h3";
|
|
6
6
|
//#region src/runtime/hosted.ts
|
package/dist/{vercel-runtime-package-copy-B8AEFWXT.js → vercel-runtime-package-copy-CKimoFJ5.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createDefaultVercelOutputRoot } from "./vite-
|
|
1
|
+
import { i as createDefaultVercelOutputRoot } from "./vite-BcMpQk_n.js";
|
|
2
2
|
import { access, cp, mkdir, readFile, realpath, rm } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
//#region ../internal/src/build/vercel-runtime-package-copy.ts
|
|
@@ -4,7 +4,7 @@ import { t as getCloudflareQueueName } from "./cloudflare-resource-name-R8zYQiZb
|
|
|
4
4
|
import { t as getVercelQueueTopicName } from "./vercel-C_4vqxcl.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { cp, mkdir, readFile, readdir, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
7
|
-
import { basename, dirname, relative, resolve } from "node:path";
|
|
7
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
8
8
|
import { existsSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
9
9
|
import { basename as basename$1, dirname as dirname$1, relative as relative$1, resolve as resolve$1 } from "pathe";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -128,6 +128,7 @@ function deleteOwnedFields(value, ownership) {
|
|
|
128
128
|
return next;
|
|
129
129
|
}
|
|
130
130
|
function getKeyedArrayEntryValue(value, key) {
|
|
131
|
+
if (key === void 0) return value === null || typeof value === "boolean" || typeof value === "number" || typeof value === "string" ? value : void 0;
|
|
131
132
|
if (!isProviderJsonRecord(value)) return;
|
|
132
133
|
const entryValue = value[key];
|
|
133
134
|
return entryValue === null || typeof entryValue === "boolean" || typeof entryValue === "number" || typeof entryValue === "string" ? entryValue : void 0;
|
|
@@ -232,6 +233,7 @@ async function writeCloudflareWranglerConfig(options) {
|
|
|
232
233
|
//#region ../internal/src/build/vite.ts
|
|
233
234
|
const projectRootDirectoryMarkers = [
|
|
234
235
|
["server", "agents"],
|
|
236
|
+
["server", "browsers"],
|
|
235
237
|
["server", "schedules"],
|
|
236
238
|
["server", "templates"],
|
|
237
239
|
["server", "workspaces"]
|
|
@@ -261,12 +263,12 @@ function includesNitroVitePlugin(value) {
|
|
|
261
263
|
if (!value || typeof value !== "object") return false;
|
|
262
264
|
return "name" in value && value.name === "nitro:main";
|
|
263
265
|
}
|
|
264
|
-
function
|
|
265
|
-
return includesNitroVitePlugin(config.plugins);
|
|
266
|
+
function hasNitroConfigContext(config) {
|
|
267
|
+
return config["__vitehubNitroConfigContext"] === true || includesNitroVitePlugin(config.plugins);
|
|
266
268
|
}
|
|
267
269
|
function resolveNitroVercelFunctionName(config, product, env = process.env) {
|
|
268
270
|
const preset = config.nitro?.preset || env.NITRO_PRESET || env.SERVER_PRESET;
|
|
269
|
-
const nitro = Boolean(preset) ||
|
|
271
|
+
const nitro = Boolean(preset) || hasNitroConfigContext(config);
|
|
270
272
|
const clientOutDir = config.environments?.client?.build?.outDir;
|
|
271
273
|
const vercel = preset ? preset.startsWith("vercel") : env.VITEHUB_HOSTING === "vercel" || Boolean(env.VERCEL) || Boolean(clientOutDir && /(^|[/\\])\.vercel[/\\]output([/\\]|$)/.test(clientOutDir));
|
|
272
274
|
return nitro && vercel ? `__${product}.func` : void 0;
|
|
@@ -767,6 +769,23 @@ async function writeCloudflareDeploymentOutput(options) {
|
|
|
767
769
|
}
|
|
768
770
|
await Promise.all(writes);
|
|
769
771
|
}
|
|
772
|
+
async function copyVercelClientOutput(rootDir, clientDir, staticOutputDir) {
|
|
773
|
+
const cloudflareOutputRoot = createDefaultCloudflareOutputRoot(rootDir);
|
|
774
|
+
const outputRelativePath = relative(clientDir, cloudflareOutputRoot);
|
|
775
|
+
const excludesCloudflareOutput = outputRelativePath && outputRelativePath !== ".." && !outputRelativePath.startsWith(`..${sep}`) && !isAbsolute(outputRelativePath);
|
|
776
|
+
await copyClientOutput(clientDir, staticOutputDir);
|
|
777
|
+
if (resolve(clientDir) === resolve(staticOutputDir) || !excludesCloudflareOutput) return;
|
|
778
|
+
try {
|
|
779
|
+
await readFile(resolve(cloudflareOutputRoot, "wrangler.json"));
|
|
780
|
+
} catch (error) {
|
|
781
|
+
if (error.code === "ENOENT") return;
|
|
782
|
+
throw error;
|
|
783
|
+
}
|
|
784
|
+
await rm(resolve(staticOutputDir, outputRelativePath), {
|
|
785
|
+
force: true,
|
|
786
|
+
recursive: true
|
|
787
|
+
});
|
|
788
|
+
}
|
|
770
789
|
async function writeVercelDeploymentOutput(options) {
|
|
771
790
|
const { clientDir, staticIndex } = resolveClientOutput(options.rootDir, options.clientOutDir);
|
|
772
791
|
const outputRoot = options.outputRoot ?? createDefaultVercelOutputRoot(options.rootDir);
|
|
@@ -788,7 +807,7 @@ async function writeVercelDeploymentOutput(options) {
|
|
|
788
807
|
}),
|
|
789
808
|
writeFile(resolve(serverDir, ".vc-config.json"), `${stringifyProviderOutputConfig(options.functionConfig ?? createNodeFunctionConfig())}\n`, "utf8"),
|
|
790
809
|
writeProviderOutputConfig(resolve(outputRoot, "config.json"), config, { keys: options.configKeys }),
|
|
791
|
-
staticIndex ?
|
|
810
|
+
staticIndex ? copyVercelClientOutput(options.rootDir, clientDir, options.staticOutputDir ?? resolve(outputRoot, "static")) : Promise.resolve()
|
|
792
811
|
]);
|
|
793
812
|
}
|
|
794
813
|
async function writeNetlifyDeploymentOutput(options) {
|
|
@@ -1123,13 +1142,13 @@ const resolveRuntimeModule = (modulePath) => resolveRuntimeModule$1(packageDir,
|
|
|
1123
1142
|
const providerEntrySpecs = [{
|
|
1124
1143
|
name: "cloudflare",
|
|
1125
1144
|
entryFile: "cloudflare-worker.mjs",
|
|
1126
|
-
runtimeModule: "runtime/cloudflare-vite",
|
|
1145
|
+
runtimeModule: "internal/runtime/cloudflare-vite",
|
|
1127
1146
|
factory: "createQueueCloudflareWorker",
|
|
1128
1147
|
hosting: "cloudflare"
|
|
1129
1148
|
}, {
|
|
1130
1149
|
name: "vercel",
|
|
1131
1150
|
entryFile: "vercel-server.mjs",
|
|
1132
|
-
runtimeModule: "runtime/vercel-vite",
|
|
1151
|
+
runtimeModule: "internal/runtime/vercel-vite",
|
|
1133
1152
|
factory: "createQueueVercelServer",
|
|
1134
1153
|
hosting: "vercel"
|
|
1135
1154
|
}];
|
|
@@ -1226,10 +1245,10 @@ function renderNitroPlugin(pluginFile, registryFile, queueConfig, cloudflareQueu
|
|
|
1226
1245
|
"import { definePlugin } from 'nitro'",
|
|
1227
1246
|
...vercelRuntime ? [`import * as __vitehubVercelQueue from ${JSON.stringify(createImportPath(pluginFile, resolvePackageDependency("@vercel/queue")))}`] : [],
|
|
1228
1247
|
...cloudflareRuntime ? ["import { env as vitehubEnv, waitUntil as vitehubWaitUntil } from 'cloudflare:workers'"] : [],
|
|
1229
|
-
...cloudflare ? [`import { createQueueCloudflareWorker } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("runtime/cloudflare-vite")))}`] : [],
|
|
1248
|
+
...cloudflare ? [`import { createQueueCloudflareWorker } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("internal/runtime/cloudflare-vite")))}`] : [],
|
|
1230
1249
|
...cloudflareRuntime ? [`import { createCloudflareQueueRuntimeClient } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("internal/runtime/cloudflare-client")))}`] : [],
|
|
1231
1250
|
...vercelRuntime ? [`import { createVercelQueueRuntimeClient } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("internal/runtime/vercel-client")))}`] : [],
|
|
1232
|
-
`import { setQueueRuntimeConfig, setQueueRuntimeEventDefaults, setQueueRuntimeRegistry } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("runtime/state")))}`,
|
|
1251
|
+
`import { setQueueRuntimeConfig, setQueueRuntimeEventDefaults, setQueueRuntimeRegistry } from ${JSON.stringify(createImportPath(pluginFile, resolveRuntimeModule("internal/runtime/state")))}`,
|
|
1233
1252
|
`import queueRegistry from ${JSON.stringify(createImportPath(pluginFile, registryFile))}`,
|
|
1234
1253
|
"",
|
|
1235
1254
|
...vercelRuntime ? ["globalThis.__vitehubVercelQueue = __vitehubVercelQueue", ""] : [],
|
|
@@ -1252,7 +1271,7 @@ function renderNitroMiddleware(middlewareFile, queueConfig, hasDefinitions) {
|
|
|
1252
1271
|
"import { defineMiddleware } from 'nitro'",
|
|
1253
1272
|
...vercel ? [`import { waitUntil as vitehubWaitUntil } from ${JSON.stringify(createImportPath(middlewareFile, resolvePackageDependency("@vercel/functions")))}`] : [],
|
|
1254
1273
|
...cloudflare ? ["import { env as vitehubEnv, waitUntil as vitehubWaitUntil } from 'cloudflare:workers'"] : [],
|
|
1255
|
-
`import { enterQueueRuntimeEvent } from ${JSON.stringify(createImportPath(middlewareFile, resolveRuntimeModule("runtime/state")))}`,
|
|
1274
|
+
`import { enterQueueRuntimeEvent } from ${JSON.stringify(createImportPath(middlewareFile, resolveRuntimeModule("internal/runtime/state")))}`,
|
|
1256
1275
|
"",
|
|
1257
1276
|
"export default defineMiddleware((event) => {",
|
|
1258
1277
|
...cloudflare ? [" const runtimeEvent = event as any"] : [],
|
|
@@ -1297,7 +1316,7 @@ function createProviderRuntimeAliases(providerOutput, provider, providerImportAl
|
|
|
1297
1316
|
};
|
|
1298
1317
|
}
|
|
1299
1318
|
async function copyVercelRuntimePackages(options) {
|
|
1300
|
-
const { copyVercelFunctionRuntimePackageDirectories } = await import("./vercel-runtime-package-copy-
|
|
1319
|
+
const { copyVercelFunctionRuntimePackageDirectories } = await import("./vercel-runtime-package-copy-CKimoFJ5.js");
|
|
1301
1320
|
await copyVercelFunctionRuntimePackageDirectories(options);
|
|
1302
1321
|
}
|
|
1303
1322
|
function createCloudflareOutput(artifacts, providerOutput, providerImportAliases, namePrefix = "") {
|
|
@@ -1388,7 +1407,7 @@ function createVercelQueueWrapperContents(file, registryFile, name, queueConfig)
|
|
|
1388
1407
|
`import { toNodeHandler } from ${JSON.stringify(createImportPath(file, resolvePackageDependency("h3/node")))}`,
|
|
1389
1408
|
`import { createVercelQueueRuntimeClient } from ${JSON.stringify(createImportPath(file, resolveRuntimeModule("internal/runtime/vercel-client")))}`,
|
|
1390
1409
|
`import { handleHostedVercelQueueCallback, hostedVercelWaitUntil } from ${JSON.stringify(createImportPath(file, resolveRuntimeModule("runtime/hosted")))}`,
|
|
1391
|
-
`import { loadQueueDefinition, runWithQueueRuntimeEvent, setQueueRuntimeConfig, setQueueRuntimeRegistry } from ${JSON.stringify(createImportPath(file, resolveRuntimeModule("runtime/state")))}`,
|
|
1410
|
+
`import { loadQueueDefinition, runWithQueueRuntimeEvent, setQueueRuntimeConfig, setQueueRuntimeRegistry } from ${JSON.stringify(createImportPath(file, resolveRuntimeModule("internal/runtime/state")))}`,
|
|
1392
1411
|
`import queueRegistry from ${JSON.stringify(createImportPath(file, registryFile))}`,
|
|
1393
1412
|
"",
|
|
1394
1413
|
"globalThis.__vitehubVercelQueue = __vitehubVercelQueue",
|
|
@@ -1778,7 +1797,7 @@ function hubQueue(options) {
|
|
|
1778
1797
|
queue = config.queue ?? queue;
|
|
1779
1798
|
const configuredNitro = config.nitro;
|
|
1780
1799
|
const configuredNitroConfig = cloneNitroConfig(configuredNitro);
|
|
1781
|
-
nitroOwnsCloudflareWorker =
|
|
1800
|
+
nitroOwnsCloudflareWorker = hasNitroConfigContext(config) && resolveNitroHosting(configuredNitroConfig) === "cloudflare" && supportsCloudflareQueues(configuredNitroConfig);
|
|
1782
1801
|
configuredDefinitions = discoverQueueDefinitions({ rootDir: config.root });
|
|
1783
1802
|
const nitro = mergeNitroConfig(config, configuredNitro, queue, config.root, configuredDefinitions);
|
|
1784
1803
|
config.nitro = nitro;
|
|
@@ -1787,7 +1806,7 @@ function hubQueue(options) {
|
|
|
1787
1806
|
cloudflareQueues = supportsCloudflareQueues(nitro);
|
|
1788
1807
|
const nitroHosting = resolveNitroHosting(nitro);
|
|
1789
1808
|
nitroQueue = queue !== false && queue?.provider && nitroHosting && queue.provider !== nitroHosting ? false : queue;
|
|
1790
|
-
validatesNitroDefinitions =
|
|
1809
|
+
validatesNitroDefinitions = hasNitroConfigContext(config) && nitroQueue !== false;
|
|
1791
1810
|
await writeQueueNitroIntegration(config.root, nitroQueue, hosting, cloudflareQueues, configuredDefinitions);
|
|
1792
1811
|
},
|
|
1793
1812
|
configEnvironment(name, config) {
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as hubQueue, r as createCloudflareQueueConfig, t as createQueueNitroConfig } from "./vite-
|
|
1
|
+
import { n as hubQueue, r as createCloudflareQueueConfig, t as createQueueNitroConfig } from "./vite-BcMpQk_n.js";
|
|
2
2
|
export { createCloudflareQueueConfig, createQueueNitroConfig, hubQueue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/queue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Queue primitives and Vite deployment integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": "./dist/index.js",
|
|
31
31
|
"./internal/runtime/cloudflare-client": "./dist/internal/runtime/cloudflare-client.js",
|
|
32
|
+
"./internal/runtime/cloudflare-vite": "./dist/internal/runtime/cloudflare-vite.js",
|
|
33
|
+
"./internal/runtime/state": "./dist/internal/runtime/state.js",
|
|
32
34
|
"./internal/runtime/vercel-client": "./dist/internal/runtime/vercel-client.js",
|
|
35
|
+
"./internal/runtime/vercel-vite": "./dist/internal/runtime/vercel-vite.js",
|
|
33
36
|
"./nuxt": "./dist/nuxt.js",
|
|
34
|
-
"./runtime/cloudflare-vite": "./dist/runtime/cloudflare-vite.js",
|
|
35
37
|
"./runtime/hosted": "./dist/runtime/hosted.js",
|
|
36
|
-
"./runtime/state": "./dist/runtime/state.js",
|
|
37
|
-
"./runtime/vercel-vite": "./dist/runtime/vercel-vite.js",
|
|
38
38
|
"./vite": "./dist/vite.js",
|
|
39
39
|
"./package.json": "./package.json"
|
|
40
40
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"esbuild": "^0.27.7",
|
|
46
46
|
"h3": "2.0.1-rc.25",
|
|
47
47
|
"pathe": "^2.0.3",
|
|
48
|
-
"@vite-hub/runtime": "0.0.
|
|
48
|
+
"@vite-hub/runtime": "0.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^24.13.3",
|