@vite-hub/queue 0.0.2 → 0.0.4
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/LICENSE +201 -0
- package/README.md +92 -50
- package/dist/{client-CBDT9GL9.js → client-DG9fweET.js} +2 -2
- package/dist/{cloudflare-vite-BNBVtEwG.js → cloudflare-vite-BlQfDVZD.js} +11 -6
- package/dist/{cloudflare-vite-krY8T3zM.d.ts → cloudflare-vite-nFPor46-.d.ts} +1 -1
- package/dist/{config-B7xkD1v0.js → config-CNgAeIND.js} +8 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- 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 +2 -1
- package/dist/runtime/hosted.d.ts +1 -2
- package/dist/runtime/hosted.js +1 -1
- package/dist/{state-BfUFGeC2.js → state-Cno9O7YS.js} +10 -5
- package/dist/vercel-runtime-package-copy-CEToJtCu.js +116 -0
- package/dist/vite-DOuoen0w.js +4414 -0
- package/dist/vite.d.ts +15 -2
- package/dist/vite.js +2 -2
- package/package.json +9 -6
- package/dist/runtime/cloudflare-vite.js +0 -2
- package/dist/vercel-runtime-package-copy-B8AEFWXT.js +0 -66
- package/dist/vite-C6yK76Sw.js +0 -1823
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as QueueModuleOptions } from "./types-CwvoMATy.js";
|
|
1
|
+
import { a as DiscoveredQueueDefinition, m as QueueModuleOptions } from "./types-CwvoMATy.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region ../internal/src/provision.d.ts
|
|
@@ -73,6 +73,18 @@ interface ViteHubCliContributor {
|
|
|
73
73
|
provision?: ProvisionStep[];
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
|
+
//#region src/discovery.d.ts
|
|
77
|
+
declare function discoverQueueDefinitions(options: {
|
|
78
|
+
mode?: "vite-suffix";
|
|
79
|
+
rootDir: string;
|
|
80
|
+
scanDirs?: string[];
|
|
81
|
+
serverDirs?: string[];
|
|
82
|
+
serverRootDirs?: string[];
|
|
83
|
+
} | {
|
|
84
|
+
mode: "server-queues";
|
|
85
|
+
scanDirs: string[];
|
|
86
|
+
}): DiscoveredQueueDefinition[];
|
|
87
|
+
//#endregion
|
|
76
88
|
//#region src/internal/vite-build.d.ts
|
|
77
89
|
interface CloudflareQueueConfigOptions {
|
|
78
90
|
compatibilityDate?: string;
|
|
@@ -113,6 +125,7 @@ interface QueueProvisionContributingPlugin {
|
|
|
113
125
|
}
|
|
114
126
|
type QueueVitePlugin = Plugin & QueueProvisionContributingPlugin;
|
|
115
127
|
interface QueueNitroConfigOptions {
|
|
128
|
+
development?: boolean;
|
|
116
129
|
nitro: Record<string, unknown>;
|
|
117
130
|
projectRoot: string;
|
|
118
131
|
root: string;
|
|
@@ -126,4 +139,4 @@ declare module "vite" {
|
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
//#endregion
|
|
129
|
-
export { type CloudflareQueueConfig, type CloudflareQueueConfigOptions, QueueNitroConfigOptions, QueueVitePlugin, createCloudflareQueueConfig, createQueueNitroConfig, hubQueue };
|
|
142
|
+
export { type CloudflareQueueConfig, type CloudflareQueueConfigOptions, QueueNitroConfigOptions, QueueVitePlugin, createCloudflareQueueConfig, createQueueNitroConfig, discoverQueueDefinitions, hubQueue };
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as hubQueue, r as createCloudflareQueueConfig, t as createQueueNitroConfig } from "./vite-
|
|
2
|
-
export { createCloudflareQueueConfig, createQueueNitroConfig, hubQueue };
|
|
1
|
+
import { i as discoverQueueDefinitions, n as hubQueue, r as createCloudflareQueueConfig, t as createQueueNitroConfig } from "./vite-DOuoen0w.js";
|
|
2
|
+
export { createCloudflareQueueConfig, createQueueNitroConfig, discoverQueueDefinitions, 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.4",
|
|
4
4
|
"description": "Queue primitives and Vite deployment integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -29,29 +29,32 @@
|
|
|
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
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"@types/ws": "^8.18.1",
|
|
42
43
|
"@vercel/functions": "^3.7.5",
|
|
43
44
|
"@vercel/queue": "^0.0.0-alpha.40",
|
|
45
|
+
"@vite-hub/runtime": "0.0.4",
|
|
44
46
|
"defu": "^6.1.7",
|
|
45
47
|
"esbuild": "^0.27.7",
|
|
46
48
|
"h3": "2.0.1-rc.25",
|
|
47
49
|
"pathe": "^2.0.3",
|
|
48
|
-
"
|
|
50
|
+
"ws": "^8.21.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@types/node": "^24.13.3",
|
|
52
|
-
"nuxt": "^4.
|
|
54
|
+
"nuxt": "^4.5.2",
|
|
53
55
|
"publint": "^0.3.21",
|
|
54
56
|
"typescript": "^6.0.3",
|
|
57
|
+
"valibot": "^1.4.2",
|
|
55
58
|
"vite": "^8.0.8",
|
|
56
59
|
"vite-plus": "^0.1.24",
|
|
57
60
|
"vitest": "^4.1.4",
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { i as createDefaultVercelOutputRoot } from "./vite-C6yK76Sw.js";
|
|
2
|
-
import { access, cp, mkdir, readFile, realpath, rm } from "node:fs/promises";
|
|
3
|
-
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
4
|
-
//#region ../internal/src/build/vercel-runtime-package-copy.ts
|
|
5
|
-
async function copyVercelFunctionRuntimePackageDirectories(options) {
|
|
6
|
-
if (!options.packages.length) return;
|
|
7
|
-
const outputNodeModules = resolve(resolve(options.outputRoot ?? createDefaultVercelOutputRoot(options.rootDir), "functions", options.serverFunctionName ?? "__server.func"), "node_modules");
|
|
8
|
-
const copied = /* @__PURE__ */ new Map();
|
|
9
|
-
const selected = /* @__PURE__ */ new Map();
|
|
10
|
-
for (const runtimePackage of options.packages) try {
|
|
11
|
-
selected.set(runtimePackage.name, await realpath(await resolvePackageJson(runtimePackage.name, dirname(runtimePackage.resolveFrom ?? join(options.rootDir, "package.json")))));
|
|
12
|
-
} catch (error) {
|
|
13
|
-
if (!runtimePackage.optional || error.code !== "ENOENT") throw error;
|
|
14
|
-
}
|
|
15
|
-
for (const runtimePackage of options.packages) await copyPackageDirectory(runtimePackage.name, runtimePackage.resolveFrom ?? join(options.rootDir, "package.json"), outputNodeModules, copied, selected, runtimePackage.optional);
|
|
16
|
-
}
|
|
17
|
-
async function copyPackageDirectory(name, resolveFrom, outputNodeModules, copied, selected, optional = false, conflictNodeModules) {
|
|
18
|
-
let resolvedPackageJsonPath;
|
|
19
|
-
try {
|
|
20
|
-
resolvedPackageJsonPath = await resolvePackageJson(name, dirname(resolveFrom));
|
|
21
|
-
} catch (error) {
|
|
22
|
-
if (optional && error.code === "ENOENT") return;
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
const packageJsonPath = await realpath(resolvedPackageJsonPath);
|
|
26
|
-
const packageDir = dirname(packageJsonPath);
|
|
27
|
-
let targetDir = join(outputNodeModules, ...name.split("/"));
|
|
28
|
-
const selectedPackage = selected.get(name);
|
|
29
|
-
const existingPackage = copied.get(targetDir);
|
|
30
|
-
if (selectedPackage && selectedPackage !== packageJsonPath || existingPackage && existingPackage !== packageJsonPath) {
|
|
31
|
-
if (!conflictNodeModules) return;
|
|
32
|
-
targetDir = join(conflictNodeModules, ...name.split("/"));
|
|
33
|
-
}
|
|
34
|
-
if (copied.get(targetDir) === packageJsonPath) return;
|
|
35
|
-
copied.set(targetDir, packageJsonPath);
|
|
36
|
-
await rm(targetDir, {
|
|
37
|
-
force: true,
|
|
38
|
-
recursive: true
|
|
39
|
-
});
|
|
40
|
-
await mkdir(dirname(targetDir), { recursive: true });
|
|
41
|
-
await cp(packageDir, targetDir, {
|
|
42
|
-
dereference: true,
|
|
43
|
-
filter: (source) => !relative(packageDir, source).split(sep).includes("node_modules"),
|
|
44
|
-
recursive: true
|
|
45
|
-
});
|
|
46
|
-
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
47
|
-
for (const dependency of Object.keys(packageJson.dependencies ?? {})) await copyPackageDirectory(dependency, packageJsonPath, outputNodeModules, copied, selected, false, join(targetDir, "node_modules"));
|
|
48
|
-
}
|
|
49
|
-
async function resolvePackageJson(name, fromDir) {
|
|
50
|
-
let current = await realpath(fromDir).catch(() => fromDir);
|
|
51
|
-
while (current !== dirname(current)) {
|
|
52
|
-
const candidate = join(current, "node_modules", ...name.split("/"), "package.json");
|
|
53
|
-
try {
|
|
54
|
-
await access(candidate);
|
|
55
|
-
return candidate;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
if (error.code !== "ENOENT") throw error;
|
|
58
|
-
}
|
|
59
|
-
current = dirname(current);
|
|
60
|
-
}
|
|
61
|
-
const error = /* @__PURE__ */ new Error(`Could not resolve package.json for ${name}.`);
|
|
62
|
-
error.code = "ENOENT";
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
export { copyVercelFunctionRuntimePackageDirectories };
|