@vite-hub/queue 0.5.0 → 0.5.1
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 -15
- 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 +2 -28
- package/dist/vite.js +31 -51
- package/package.json +10 -10
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,8 +265,7 @@ 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 = {};
|
|
@@ -279,8 +275,7 @@ function resolveViteHubBundleDefines(config) {
|
|
|
279
275
|
}
|
|
280
276
|
return defines;
|
|
281
277
|
}
|
|
282
|
-
|
|
283
|
-
//#region ../internal/src/build/cloudflare-provider-output.ts
|
|
278
|
+
// ../internal/src/build/cloudflare-provider-output.ts
|
|
284
279
|
function isDeepStrictEqual(left, right) {
|
|
285
280
|
if (Object.is(left, right)) return true;
|
|
286
281
|
if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
|
|
@@ -459,8 +454,7 @@ function composeNitroCloudflareProviderOutput(catalog, value, inheritedValue = v
|
|
|
459
454
|
associateProviderOutputCatalog(output, catalog);
|
|
460
455
|
return output;
|
|
461
456
|
}
|
|
462
|
-
|
|
463
|
-
//#region ../internal/src/build/provider-output-catalog.ts
|
|
457
|
+
// ../internal/src/build/provider-output-catalog.ts
|
|
464
458
|
var ProviderOutputCatalog = class {
|
|
465
459
|
bundleDefines = {};
|
|
466
460
|
#appliedCloudflareContributions = /* @__PURE__ */ new Map();
|
|
@@ -729,8 +723,7 @@ function mergeNitroExternal(value, addition) {
|
|
|
729
723
|
if (typeof value === "function") return (source, importer, isResolved) => source === addition || Boolean(value(source, importer, isResolved));
|
|
730
724
|
return value;
|
|
731
725
|
}
|
|
732
|
-
|
|
733
|
-
//#region ../internal/src/contributions.ts
|
|
726
|
+
// ../internal/src/contributions.ts
|
|
734
727
|
const unnamedPlugin = "unnamed plugin";
|
|
735
728
|
function isNonEmptyString(value) {
|
|
736
729
|
return String(value) === value && value.length > 0;
|
|
@@ -835,8 +828,7 @@ function readContribution(entry, plugin, options, fail) {
|
|
|
835
828
|
...base
|
|
836
829
|
};
|
|
837
830
|
}
|
|
838
|
-
|
|
839
|
-
//#region src/contributions.ts
|
|
831
|
+
// src/contributions.ts
|
|
840
832
|
const queueNamePattern = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*$/i;
|
|
841
833
|
function invalid(message) {
|
|
842
834
|
return queueErrorDiagnostics.QUEUE_CONTRIBUTION_INVALID({ message });
|
|
@@ -863,8 +855,7 @@ async function collectQueueContributions(plugins, context) {
|
|
|
863
855
|
}
|
|
864
856
|
return contributions;
|
|
865
857
|
}
|
|
866
|
-
|
|
867
|
-
//#region src/deployment-env.ts
|
|
858
|
+
// src/deployment-env.ts
|
|
868
859
|
const owners = ["queue"];
|
|
869
860
|
/**
|
|
870
861
|
* The variables that Queue reads on the deployed host. The `postgres` provider reads `QUEUE_POSTGRES_URL`, which is
|
|
@@ -889,8 +880,7 @@ function queueDeploymentEnv(queue) {
|
|
|
889
880
|
}];
|
|
890
881
|
return [];
|
|
891
882
|
}
|
|
892
|
-
|
|
893
|
-
//#region ../internal/src/definition-catalog.ts
|
|
883
|
+
// ../internal/src/definition-catalog.ts
|
|
894
884
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
895
885
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
896
886
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
@@ -1040,8 +1030,7 @@ function createRuntimeRegistryContents(registryFile, definitions) {
|
|
|
1040
1030
|
""
|
|
1041
1031
|
].join("\n");
|
|
1042
1032
|
}
|
|
1043
|
-
|
|
1044
|
-
//#region src/discovery.ts
|
|
1033
|
+
// src/discovery.ts
|
|
1045
1034
|
const queueSuffixPattern = /\.queue\.(?:c|m)?[jt]s$/i;
|
|
1046
1035
|
/** Discovery source of Queue Definitions that Vite plugins contribute through `vitehub.queues`. */
|
|
1047
1036
|
const contributedQueueSource = "vite-plugin-contribution";
|
|
@@ -1071,8 +1060,7 @@ function discoverQueueDefinitions(options) {
|
|
|
1071
1060
|
const serverScanDirs = [...new Set(options.serverDirs?.map((dir) => resolve$1(dir)) ?? (options.serverRootDirs ?? roots).map((root) => resolve$1(root, "server")))];
|
|
1072
1061
|
return mergeContributedQueueDefinitions(discoverDefinitions("queue", [createSuffixDefinitionSource("vite-suffix", roots, queueSuffixPattern, normalizeSuffixQueueName), createDirectoryDefinitionSource("server-queues", serverScanDirs, "queues")]), options.contributions);
|
|
1073
1062
|
}
|
|
1074
|
-
|
|
1075
|
-
//#region src/registry-types.ts
|
|
1063
|
+
// src/registry-types.ts
|
|
1076
1064
|
function createQueueTypes(file, definitions, importBase = "@vite-hub/queue") {
|
|
1077
1065
|
const entries = definitions.map((definition) => {
|
|
1078
1066
|
const path = relative(dirname$1(file), definition.handler);
|
|
@@ -1094,8 +1082,7 @@ async function writeQueueTypes(root, definitions, importBase = "@vite-hub/queue"
|
|
|
1094
1082
|
await mkdir(dirname$1(file), { recursive: true });
|
|
1095
1083
|
await writeFile(file, createQueueTypes(file, definitions, importBase), "utf8");
|
|
1096
1084
|
}
|
|
1097
|
-
|
|
1098
|
-
//#region src/internal/vite-build.ts
|
|
1085
|
+
// src/internal/vite-build.ts
|
|
1099
1086
|
const queuePackageName = "@vite-hub/queue";
|
|
1100
1087
|
const productName = "queue";
|
|
1101
1088
|
const generatedRegistryFileName = "registry.mjs";
|
|
@@ -1176,7 +1163,7 @@ function readQueueMaxBatchSize(file, { argumentExpression, defaultExportExpressi
|
|
|
1176
1163
|
async function createCloudflareQueueBindings(definitions, namePrefix = "") {
|
|
1177
1164
|
if (!definitions.length) return;
|
|
1178
1165
|
createCloudflareQueueDefinitionNames(definitions, namePrefix);
|
|
1179
|
-
const scanner = await import("./scan-module-
|
|
1166
|
+
const scanner = await import("./scan-module-BaqBao0J.js");
|
|
1180
1167
|
return {
|
|
1181
1168
|
consumers: definitions.map((definition) => {
|
|
1182
1169
|
const maxBatchSize = readQueueMaxBatchSize(definition.handler, scanner);
|
|
@@ -1336,8 +1323,7 @@ function renderVercelQueueConsumerHandler(file, name) {
|
|
|
1336
1323
|
""
|
|
1337
1324
|
].join("\n");
|
|
1338
1325
|
}
|
|
1339
|
-
|
|
1340
|
-
//#region src/inspect.ts
|
|
1326
|
+
// src/inspect.ts
|
|
1341
1327
|
/** Summarizes discovered Queue Definitions for the CLI and Console. */
|
|
1342
1328
|
function inspectQueueDefinitions(options, definitions = discoverQueueDefinitions(options)) {
|
|
1343
1329
|
return summarizeDefinitions(options.projectRoot, definitions, "queue").map((summary, index) => {
|
|
@@ -1379,8 +1365,7 @@ const queueConsoleSection = {
|
|
|
1379
1365
|
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
1366
|
}
|
|
1381
1367
|
};
|
|
1382
|
-
|
|
1383
|
-
//#region ../internal/src/host-credentials.ts
|
|
1368
|
+
// ../internal/src/host-credentials.ts
|
|
1384
1369
|
/** Reads host credentials from environment variables only. Returns undefined when the token is not set. */
|
|
1385
1370
|
function readHostCredentialsFromEnv(host, env) {
|
|
1386
1371
|
switch (host) {
|
|
@@ -1414,8 +1399,7 @@ function trimmed(value) {
|
|
|
1414
1399
|
const result = value?.trim();
|
|
1415
1400
|
return result ? result : void 0;
|
|
1416
1401
|
}
|
|
1417
|
-
|
|
1418
|
-
//#region ../internal/src/provider-failure.ts
|
|
1402
|
+
// ../internal/src/provider-failure.ts
|
|
1419
1403
|
const cloudflareCodes = {
|
|
1420
1404
|
d1: {},
|
|
1421
1405
|
kv: { 10014: "conflict" },
|
|
@@ -1517,8 +1501,7 @@ function readProviderErrorCodes(body) {
|
|
|
1517
1501
|
const errors = Reflect.get(body, "errors");
|
|
1518
1502
|
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
1503
|
}
|
|
1520
|
-
|
|
1521
|
-
//#region ../internal/src/provision.ts
|
|
1504
|
+
// ../internal/src/provision.ts
|
|
1522
1505
|
/**
|
|
1523
1506
|
* Whether a value from Provision State can appear in a copyable shell command as is.
|
|
1524
1507
|
* The file is editable, so a hint shows a command only for plain names and ids.
|
|
@@ -1636,8 +1619,7 @@ async function listCloudflarePages(request, path, options) {
|
|
|
1636
1619
|
} else if (options.perPage === void 0 || pageItems.length < options.perPage) return items;
|
|
1637
1620
|
}
|
|
1638
1621
|
}
|
|
1639
|
-
|
|
1640
|
-
//#region src/provision.ts
|
|
1622
|
+
// src/provision.ts
|
|
1641
1623
|
const QUEUE_CLOUDFLARE_PROVISION_CATEGORY = "queue";
|
|
1642
1624
|
function parseQueues(value) {
|
|
1643
1625
|
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 +1670,7 @@ function createQueueProvisionStep(resolveDefinitions, resolveNamePrefix = () =>
|
|
|
1688
1670
|
}
|
|
1689
1671
|
};
|
|
1690
1672
|
}
|
|
1691
|
-
|
|
1692
|
-
//#region src/vite.ts
|
|
1673
|
+
// src/vite.ts
|
|
1693
1674
|
const operationsModule = ownModule(import.meta.url, "operations");
|
|
1694
1675
|
const mergeNoExternal = createNoExternalAddition(queuePackageName);
|
|
1695
1676
|
const databaseVitePluginName = "@vite-hub/database/vite";
|
|
@@ -2096,5 +2077,4 @@ function hubQueue(options, internalOptions = {}) {
|
|
|
2096
2077
|
}
|
|
2097
2078
|
};
|
|
2098
2079
|
}
|
|
2099
|
-
//#endregion
|
|
2100
2080
|
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.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Queue primitives and Vite deployment integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"background-jobs",
|
|
@@ -64,28 +64,28 @@
|
|
|
64
64
|
"./package.json": "./package.json"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@vite-hub/runtime": "0.5.
|
|
67
|
+
"@vite-hub/runtime": "0.5.1",
|
|
68
68
|
"defu": "^6.1.7",
|
|
69
69
|
"nostics": "1.4.0",
|
|
70
70
|
"pathe": "^2.0.3"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@types/node": "^24.19.
|
|
74
|
-
"@vercel/functions": "^3.
|
|
73
|
+
"@types/node": "^24.19.2",
|
|
74
|
+
"@vercel/functions": "^3.11.3",
|
|
75
75
|
"@vercel/queue": "^0.11.0",
|
|
76
|
-
"@vite-hub/database": "0.5.
|
|
76
|
+
"@vite-hub/database": "0.5.1",
|
|
77
77
|
"@vite-hub/internal": "0.0.1",
|
|
78
78
|
"postgres": "^3.4.9",
|
|
79
79
|
"publint": "^0.3.25",
|
|
80
80
|
"typescript": "^6.0.3",
|
|
81
|
-
"undici": "8.
|
|
81
|
+
"undici": "8.13.1",
|
|
82
82
|
"valibot": "^1.5.0",
|
|
83
|
-
"vite": "^8.
|
|
84
|
-
"vite-plus": "^
|
|
85
|
-
"vitest": "
|
|
83
|
+
"vite": "^8.3.8",
|
|
84
|
+
"vite-plus": "^1.7.0",
|
|
85
|
+
"vitest": "5.1.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@vercel/functions": "^3.
|
|
88
|
+
"@vercel/functions": "^3.11.3",
|
|
89
89
|
"@vercel/queue": "^0.11.0",
|
|
90
90
|
"postgres": "^3.4.9",
|
|
91
91
|
"vite": ">=8.0.0"
|