void 0.9.3 → 0.10.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.
Files changed (104) hide show
  1. package/dist/{auth-cmd-CPkWrQR9.mjs → auth-cmd-DBnbrX9Y.mjs} +2 -2
  2. package/dist/{better-auth-shared-CmEQZs1T.d.mts → better-auth-shared-a7H3wk9J.d.mts} +2 -2
  3. package/dist/{cache-1SVxZ7BK.mjs → cache-DNX0hLsO.mjs} +1 -1
  4. package/dist/{cancel-deploy-JaFClLr7.mjs → cancel-deploy-CDzkVaYZ.mjs} +1 -1
  5. package/dist/cli/cli.mjs +205 -36
  6. package/dist/{client-DIfOFf1W.mjs → client-D4awzTnj.mjs} +149 -45
  7. package/dist/{create-project-DCUrFJxa.mjs → create-project-CGodxfzH.mjs} +1 -1
  8. package/dist/{db-UW4IYQFw.mjs → db-ERzz4oly.mjs} +14 -14
  9. package/dist/{delete-CYknzwXU.mjs → delete-CJZGDLBR.mjs} +1 -1
  10. package/dist/{deploy-RQXpVBL-.mjs → deploy-Cwa5sooV.mjs} +74 -102
  11. package/dist/{domain-B7RntQ1r.mjs → domain-WvoAHE6w.mjs} +1 -1
  12. package/dist/{env-C_ZcxxED.mjs → env-Cx4czPsR.mjs} +1 -1
  13. package/dist/{env-helpers-Bd2wVdxz.d.mts → env-helpers-ZatKyjen.d.mts} +1 -1
  14. package/dist/{gen-O5mXZ76K.mjs → gen-Dgi4D7GC.mjs} +1 -1
  15. package/dist/git-metadata-Ce0AtSZL.mjs +82 -0
  16. package/dist/github-cmd-CUB041gj.mjs +308 -0
  17. package/dist/{handler-hm9KldPP.d.mts → handler-DczZlaXR.d.mts} +3 -3
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.mjs +18 -18
  20. package/dist/{init-DGrLx2ls.mjs → init-DvaRDMIc.mjs} +122 -77
  21. package/dist/{link-7MoXUMaI.mjs → link-CpbWJY3P.mjs} +2 -2
  22. package/dist/{list-N2mCHv8q.mjs → list-BkwE5vH4.mjs} +1 -1
  23. package/dist/{login-tt1OmNVg.mjs → login-Ca6mhQVI.mjs} +1 -1
  24. package/dist/{logs-Cl7q2CjZ.mjs → logs-ArQzZquo.mjs} +1 -1
  25. package/dist/{mcp-BXD35N2J.mjs → mcp-Cc2MMXdQ.mjs} +1 -1
  26. package/dist/{node-Df8UjQ2H.mjs → node-B07cZs0d.mjs} +3 -3
  27. package/dist/pages/client.d.mts +1 -1
  28. package/dist/pages/client.mjs +1 -0
  29. package/dist/pages/head-client.d.mts +1 -1
  30. package/dist/pages/head.d.mts +1 -1
  31. package/dist/pages/index.d.mts +2 -2
  32. package/dist/pages/index.mjs +1 -1
  33. package/dist/pages/islands-plugin.d.mts +1 -1
  34. package/dist/pages/protocol.d.mts +2 -2
  35. package/dist/pages/protocol.mjs +1 -1
  36. package/dist/{plugin-inference--7geW5Z2.mjs → plugin-inference-C3fLzFvP.mjs} +2 -0
  37. package/dist/{prepare-DT-7QII_.mjs → prepare-DH2WnEpD.mjs} +3 -3
  38. package/dist/{preset-2aBxMfY1.mjs → preset-B7ZQZn0u.mjs} +2 -2
  39. package/dist/{project-cmd-CLrqSbqj.mjs → project-cmd-CWZeawuN.mjs} +8 -8
  40. package/dist/{protocol-B9GZA4Bn.d.mts → protocol-63PHtCHS.d.mts} +3 -3
  41. package/dist/{rollback-CEbAwbHK.mjs → rollback-BJ60ktsW.mjs} +1 -1
  42. package/dist/{runner-DLZ9E_cX.mjs → runner-BQyKUqAL.mjs} +1 -1
  43. package/dist/runtime/ai.mjs +1 -1
  44. package/dist/runtime/auth.d.mts +1 -1
  45. package/dist/runtime/better-auth-pg.d.mts +1 -1
  46. package/dist/runtime/better-auth-pg.mjs +3 -3
  47. package/dist/runtime/better-auth.d.mts +1 -1
  48. package/dist/runtime/better-auth.mjs +2 -2
  49. package/dist/runtime/client-react.d.mts +2 -2
  50. package/dist/runtime/client-react.mjs +1 -1
  51. package/dist/runtime/client-solid.d.mts +2 -2
  52. package/dist/runtime/client-solid.mjs +1 -1
  53. package/dist/runtime/client-svelte.d.mts +2 -2
  54. package/dist/runtime/client-svelte.mjs +1 -1
  55. package/dist/runtime/client-vue.d.mts +2 -2
  56. package/dist/runtime/client-vue.mjs +1 -1
  57. package/dist/runtime/client.d.mts +2 -2
  58. package/dist/runtime/client.mjs +1 -1
  59. package/dist/runtime/env-helpers.d.mts +1 -1
  60. package/dist/runtime/env-public-client.d.mts +1 -1
  61. package/dist/runtime/env-public.d.mts +2 -2
  62. package/dist/runtime/env-public.mjs +1 -1
  63. package/dist/runtime/env.mjs +1 -1
  64. package/dist/runtime/fetch-stream.d.mts +1 -1
  65. package/dist/runtime/fetch-stream.mjs +1 -1
  66. package/dist/runtime/fetch.d.mts +1 -1
  67. package/dist/runtime/fetch.mjs +1 -1
  68. package/dist/runtime/handler.d.mts +1 -1
  69. package/dist/runtime/handler.mjs +1 -1
  70. package/dist/runtime/isr.mjs +1 -1
  71. package/dist/runtime/live.d.mts +2 -2
  72. package/dist/runtime/live.mjs +1 -1
  73. package/dist/runtime/migration-handler-pg.mjs +1 -1
  74. package/dist/runtime/sandbox.mjs +1 -1
  75. package/dist/runtime/validator.d.mts +1 -1
  76. package/dist/runtime/ws-server.d.mts +2 -2
  77. package/dist/runtime/ws.d.mts +3 -3
  78. package/dist/{scan-B2H1Vo2C.mjs → scan-DGEp1-1Q.mjs} +17 -9
  79. package/dist/{secret-C_uTY7xx.mjs → secret-BRbXyu7E.mjs} +1 -1
  80. package/package.json +2 -2
  81. package/schema.json +3 -3
  82. package/skills/void/docs/guide/deployment.md +37 -11
  83. package/skills/void/docs/guide/edge/headers.md +10 -3
  84. package/skills/void/docs/guide/edge/rewrites.md +5 -5
  85. package/skills/void/docs/reference/cli.md +65 -2
  86. /package/dist/{auth-migrations-CuQkjjWE.mjs → auth-migrations-BP-hMzYl.mjs} +0 -0
  87. /package/dist/{auth-CDeb2XAl.d.mts → auth-nEUVHuFI.d.mts} +0 -0
  88. /package/dist/{better-auth-shared-QAfk8CAS.mjs → better-auth-shared-D0Mbmx5V.mjs} +0 -0
  89. /package/dist/{defer-CouVukrf.mjs → defer-C-bdSM_b.mjs} +0 -0
  90. /package/dist/{drizzle-DYstYz0j.mjs → drizzle-DqstQTGq.mjs} +0 -0
  91. /package/dist/{env-raw-RDkMnSTC.mjs → env-raw-Dtj1UAoK.mjs} +0 -0
  92. /package/dist/{fetch-error-CimrygMq.d.mts → fetch-error-BQMdPvge.d.mts} +0 -0
  93. /package/dist/{fetch-error-BFIoojjf.mjs → fetch-error-C6qffTl2.mjs} +0 -0
  94. /package/dist/{head-BsSTGnIe.d.mts → head-JAH2l3fg.d.mts} +0 -0
  95. /package/dist/{headers-VkAnACKX.mjs → headers-BNWymgnH.mjs} +0 -0
  96. /package/dist/{package-json-B2TD0JLu.mjs → package-json-Bg_GJdJB.mjs} +0 -0
  97. /package/dist/{pg-CMZ_5wsC.mjs → pg-CempqvEJ.mjs} +0 -0
  98. /package/dist/{providers-3Kkv63Ha.d.mts → providers-BkiAlEad.d.mts} +0 -0
  99. /package/dist/{runner-pg-Cv9V7ydr.mjs → runner-pg-BAheiT6v.mjs} +0 -0
  100. /package/dist/{skills-BRKc--As.mjs → skills--OMgLmXW.mjs} +0 -0
  101. /package/dist/{standard-schema-Dnsh2vnl.d.mts → standard-schema-BCBv-QaP.d.mts} +0 -0
  102. /package/dist/{subcommand-prompt-OD-x_Tsm.mjs → subcommand-prompt-ClwpLlKD.mjs} +0 -0
  103. /package/dist/{types-DEWCqHtl.d.mts → types-BnHMXezo.d.mts} +0 -0
  104. /package/dist/{yarn-pnp-0SwYgQxx.mjs → yarn-pnp-DhCHHLAz.mjs} +0 -0
@@ -0,0 +1,308 @@
1
+ import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
2
+ import { c as createCodeChallenge, d as getToken, l as createCodeVerifier, m as openBrowser, n as PlatformClient, o as parsePlatformErrorBody, s as awaitBrowserCallback, t as PlatformApiError } from "./client-D4awzTnj.mjs";
3
+ import { _ as me, c as R, i as Ee, l as Re, x as q } from "./dist-abzUneor.mjs";
4
+ import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
5
+ import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-D4O1_fZz.mjs";
6
+ import { t as collectGitDeployMetadata } from "./git-metadata-Ce0AtSZL.mjs";
7
+ import { randomBytes } from "node:crypto";
8
+ //#region src/cli/github-cmd.ts
9
+ /**
10
+ * Map a PlatformApiError status + error code string to a friendly user message.
11
+ * Returns null for unrecognised cases (caller should re-throw).
12
+ */
13
+ function describeConnectError(status, errorCode) {
14
+ const code = errorCode ?? "";
15
+ if (status === 409) {
16
+ if (code.includes("already connected")) return "This project is already connected to a GitHub repository.";
17
+ if (code.includes("not active")) return "Installation is not active. Re-install the GitHub App and try again.";
18
+ }
19
+ if (status === 400 && code.includes("not accessible")) return "Repository not accessible by this installation. Check the App has access to it.";
20
+ if (status === 403) return "You don't have access to this project.";
21
+ if (status === 404) return "Project or installation not found.";
22
+ return null;
23
+ }
24
+ /**
25
+ * Extract `owner/repo` from a `https://github.com/owner/repo(.git)?` URL.
26
+ * Returns null for non-GitHub URLs or null input.
27
+ */
28
+ function parseGithubRepoFullName(repositoryUrl) {
29
+ if (!repositoryUrl) return null;
30
+ try {
31
+ const url = new URL(repositoryUrl);
32
+ if (url.hostname !== "github.com") return null;
33
+ const parts = url.pathname.replace(/^\//, "").replace(/\.git$/, "").split("/");
34
+ if (parts.length < 2 || !parts[0] || !parts[1]) return null;
35
+ return `${parts[0]}/${parts[1]}`;
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+ /**
41
+ * Format a list of GitHub App installations into a human-readable string.
42
+ * One block per installation:
43
+ * account_login (account_type) — selection, N repos, status
44
+ * [repo list for 'selected' installs]
45
+ */
46
+ function formatInstallations(installations) {
47
+ return installations.map((inst) => {
48
+ const header = `${inst.account_login} (${inst.account_type}) [id: ${inst.installation_id}] — ${inst.repository_selection}, ${inst.repositories.length} repos, ${inst.status}`;
49
+ if (inst.repository_selection === "selected" && inst.repositories.length > 0) return `${header}\n${inst.repositories.map((r) => ` • ${r.full_name}`).join("\n")}`;
50
+ return header;
51
+ }).join("\n\n");
52
+ }
53
+ async function runGithubCommand(root, args) {
54
+ const token = getToken(root);
55
+ if (!token) {
56
+ R.error("Not logged in. Run `void auth login` first.");
57
+ process.exit(1);
58
+ }
59
+ const client = new PlatformClient(token, { root });
60
+ switch (args.subcommand) {
61
+ case "install": return runInstall(root, client);
62
+ case "installations": return runInstallations(client);
63
+ case "connect": return runConnect(root, client, args);
64
+ case "link": return runGithubLink(root, client);
65
+ }
66
+ }
67
+ /**
68
+ * `void github install` — print the GitHub App install URL and open it.
69
+ *
70
+ * If the account has no linked GitHub identity, the server returns a 403 with
71
+ * the stable code `github_identity_required` (Task 3). Rather than telling the
72
+ * user to `void auth login` (which risks forking into a second account), we run
73
+ * the link flow inline and retry the install URL exactly once.
74
+ *
75
+ * `linkIdentity` is injectable so tests can supply a fake linker instead of
76
+ * starting a real localhost callback server / browser.
77
+ */
78
+ async function runInstall(root, client, linkIdentity = runGithubLink) {
79
+ let url;
80
+ try {
81
+ ({url} = await client.getGithubInstallUrl());
82
+ } catch (err) {
83
+ if (err instanceof PlatformApiError && err.status === 403 && err.code === "github_identity_required") {
84
+ R.message("Your Void account needs a linked GitHub identity. Starting the GitHub link…");
85
+ await linkIdentity(root, client);
86
+ try {
87
+ ({url} = await client.getGithubInstallUrl());
88
+ } catch (retryErr) {
89
+ if (retryErr instanceof PlatformApiError && retryErr.status === 403 && retryErr.code === "github_identity_required") {
90
+ R.error("Could not start the GitHub App install after linking. Try `void github link`, then `void github install` again.");
91
+ process.exit(1);
92
+ }
93
+ throw retryErr;
94
+ }
95
+ } else throw err;
96
+ }
97
+ R.message(`Open this URL to install the Void GitHub App:\n${import_picocolors.default.cyan(url)}`);
98
+ const { execFile } = await import("node:child_process");
99
+ openBrowser(url, execFile);
100
+ R.message("After installing, run `void github connect` to link a repository to your project.");
101
+ }
102
+ /**
103
+ * Link the current Void account (the logged-in CLI token holder) to a GitHub
104
+ * identity. Drives the platform's 3-endpoint link flow with a localhost +
105
+ * PKCE handshake, mirroring `void auth login`.
106
+ *
107
+ * Exported so Task 5 can call it (e.g. when `github install` returns 403 for a
108
+ * GitHub-less account, prompt to link and retry). The success path is
109
+ * non-exiting so a caller can continue; only error paths exit/throw.
110
+ */
111
+ async function runGithubLink(root, client) {
112
+ const verifier = createCodeVerifier();
113
+ const challenge = createCodeChallenge(verifier);
114
+ const state = randomBytes(32).toString("hex");
115
+ let status;
116
+ try {
117
+ ({status} = await awaitBrowserCallback({
118
+ state,
119
+ buildAuthUrl: async (callback) => {
120
+ callback.searchParams.set("state", state);
121
+ const { url } = await client.getGithubLinkUrl(callback.href, challenge);
122
+ return url;
123
+ },
124
+ describeError: (p) => p.get("error") ? "GitHub authorization failed." : null,
125
+ onUrl: (url) => R.message(`Open this URL to link your GitHub account:\n${import_picocolors.default.cyan(url)}`),
126
+ finalize: async (params) => {
127
+ const linkCode = params.get("link_code");
128
+ if (!linkCode) throw new Error("github: link callback did not return a link code.");
129
+ return client.completeGithubLink(linkCode, verifier);
130
+ }
131
+ }));
132
+ } catch (err) {
133
+ if (err instanceof PlatformApiError && err.code === "github_already_linked") {
134
+ R.error("Your Void account is already linked to a different GitHub account.");
135
+ process.exit(1);
136
+ }
137
+ if (err instanceof PlatformApiError && (err.status === 409 || err.code === "github_identity_conflict")) {
138
+ R.error("This GitHub account is already linked to another Void account.");
139
+ process.exit(1);
140
+ }
141
+ throw err;
142
+ }
143
+ if (status === "already_linked") R.success("GitHub account already linked.");
144
+ else R.success("GitHub account linked.");
145
+ }
146
+ async function runInstallations(client) {
147
+ const installations = await client.listGithubInstallations();
148
+ if (installations.length === 0) {
149
+ R.info("No GitHub App installations. Run `void github install` first.");
150
+ return;
151
+ }
152
+ R.message(formatInstallations(installations));
153
+ }
154
+ async function runConnect(root, client, args) {
155
+ const isTTY = process.stdin.isTTY === true;
156
+ let projectId;
157
+ const requestedSlug = getRequestedProjectSlug({ projectSlug: args.projectName || void 0 });
158
+ if (requestedSlug) {
159
+ const resolved = resolveProjectBySlug(await client.listProjects(), requestedSlug);
160
+ if (!resolved) {
161
+ R.error(`connect: No project found with slug '${requestedSlug}'.`);
162
+ process.exit(1);
163
+ }
164
+ projectId = resolved.projectId;
165
+ } else {
166
+ const linked = readProjectConfig(root);
167
+ if (linked) projectId = linked.projectId;
168
+ else if (!isTTY) {
169
+ R.error("connect: No project specified. Pass a project name or --project <name>, set VOID_PROJECT, or link one with `void project link`.");
170
+ process.exit(1);
171
+ } else {
172
+ const projects = await client.listProjects();
173
+ if (projects.length === 0) {
174
+ R.error("No projects found. Create one first with `void deploy`.");
175
+ process.exit(1);
176
+ }
177
+ const picked = await Ee({
178
+ message: "Select a project:",
179
+ options: projects.map((p) => ({
180
+ value: p.id,
181
+ label: p.slug
182
+ }))
183
+ });
184
+ if (q(picked)) {
185
+ me("Cancelled.");
186
+ process.exit(0);
187
+ }
188
+ projectId = picked;
189
+ }
190
+ }
191
+ const installations = (await client.listGithubInstallations()).filter((i) => i.status === "active");
192
+ if (installations.length === 0) {
193
+ R.error("No active GitHub App installation. Run `void github install` first.");
194
+ process.exit(1);
195
+ }
196
+ let installation;
197
+ if (args.installationId) {
198
+ const found = installations.find((i) => i.installation_id === args.installationId);
199
+ if (!found) {
200
+ R.error(`connect: No active installation found with id '${args.installationId}'.`);
201
+ process.exit(1);
202
+ }
203
+ installation = found;
204
+ } else if (installations.length === 1) installation = installations[0];
205
+ else if (!isTTY) {
206
+ R.error("connect: Multiple installations found. Pass --installation <id>.");
207
+ process.exit(1);
208
+ } else {
209
+ const picked = await Ee({
210
+ message: "Select a GitHub App installation:",
211
+ options: installations.map((i) => ({
212
+ value: i.installation_id,
213
+ label: `${i.account_login} (${i.account_type}) [id: ${i.installation_id}]`
214
+ }))
215
+ });
216
+ if (q(picked)) {
217
+ me("Cancelled.");
218
+ process.exit(0);
219
+ }
220
+ installation = installations.find((i) => i.installation_id === picked);
221
+ }
222
+ let repoFullName;
223
+ if (args.repo) repoFullName = args.repo;
224
+ else if (installation.repository_selection === "selected") if (installation.repositories.length === 0) {
225
+ R.error("connect: The installation has no accessible repositories. Update the GitHub App install to grant access.");
226
+ process.exit(1);
227
+ } else if (installation.repositories.length === 1) repoFullName = installation.repositories[0].full_name;
228
+ else if (!isTTY) {
229
+ R.error("connect: Multiple repositories available. Pass --repo <owner/repo>.");
230
+ process.exit(1);
231
+ } else {
232
+ const picked = await Ee({
233
+ message: "Select a repository:",
234
+ options: installation.repositories.map((r) => ({
235
+ value: r.full_name,
236
+ label: r.full_name
237
+ }))
238
+ });
239
+ if (q(picked)) {
240
+ me("Cancelled.");
241
+ process.exit(0);
242
+ }
243
+ repoFullName = picked;
244
+ }
245
+ else {
246
+ if (!isTTY) {
247
+ R.error("connect: --repo <owner/repo> is required in non-interactive mode for an all-repositories installation.");
248
+ process.exit(1);
249
+ }
250
+ const gitDefault = parseGithubRepoFullName(collectGitDeployMetadata(root, null).repositoryUrl);
251
+ const input = await Re({
252
+ message: "Repository (owner/repo):",
253
+ placeholder: gitDefault ?? "owner/repo",
254
+ initialValue: gitDefault ?? ""
255
+ });
256
+ if (q(input)) {
257
+ me("Cancelled.");
258
+ process.exit(0);
259
+ }
260
+ repoFullName = input.trim();
261
+ if (!repoFullName) {
262
+ R.error("connect: Repository is required.");
263
+ process.exit(1);
264
+ }
265
+ }
266
+ const branchDefault = args.branch ?? collectGitDeployMetadata(root, null).gitRef ?? "main";
267
+ let branch;
268
+ if (args.branch) branch = args.branch;
269
+ else if (!isTTY) {
270
+ R.error("connect: --branch is required in non-interactive mode. Pass --branch <name>.");
271
+ process.exit(1);
272
+ } else {
273
+ const input = await Re({
274
+ message: "Branch to deploy from:",
275
+ placeholder: branchDefault,
276
+ initialValue: branchDefault
277
+ });
278
+ if (q(input)) {
279
+ me("Cancelled.");
280
+ process.exit(0);
281
+ }
282
+ branch = input.trim() || branchDefault;
283
+ }
284
+ const executor = args.executor ?? "container";
285
+ try {
286
+ await client.connectGithub(projectId, {
287
+ installationId: installation.installation_id,
288
+ repoFullName,
289
+ branch,
290
+ buildExecutor: executor
291
+ });
292
+ } catch (err) {
293
+ if (err instanceof PlatformApiError) {
294
+ const body = parsePlatformErrorBody(err.body);
295
+ const code = body?.error ?? body?.message ?? "";
296
+ const message = describeConnectError(err.status, code);
297
+ if (message !== null) {
298
+ R.error(`connect: ${message}`);
299
+ process.exit(1);
300
+ }
301
+ throw err;
302
+ }
303
+ throw err;
304
+ }
305
+ R.success(`Connected ${repoFullName} (${branch}) → project. Push to ${branch} to deploy.`);
306
+ }
307
+ //#endregion
308
+ export { runGithubCommand };
@@ -1,6 +1,6 @@
1
- import { n as HeadDescriptor } from "./head-BsSTGnIe.mjs";
2
- import { r as AuthUser, t as AuthSession } from "./auth-CDeb2XAl.mjs";
3
- import { t as StandardSchemaV1 } from "./standard-schema-Dnsh2vnl.mjs";
1
+ import { n as HeadDescriptor } from "./head-JAH2l3fg.mjs";
2
+ import { r as AuthUser, t as AuthSession } from "./auth-nEUVHuFI.mjs";
3
+ import { t as StandardSchemaV1 } from "./standard-schema-BCBv-QaP.mjs";
4
4
  import * as _$_cloudflare_sandbox0 from "@cloudflare/sandbox";
5
5
  import { Context, Env, MiddlewareHandler } from "hono";
6
6
  import { RewriteDestination } from "void/routes";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { n as HeadDescriptor } from "./head-BsSTGnIe.mjs";
2
- import { r as AuthUser } from "./auth-CDeb2XAl.mjs";
3
- import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, x as DeferredState, y as defineScheduled } from "./handler-hm9KldPP.mjs";
1
+ import { n as HeadDescriptor } from "./head-JAH2l3fg.mjs";
2
+ import { r as AuthUser } from "./auth-nEUVHuFI.mjs";
3
+ import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, x as DeferredState, y as defineScheduled } from "./handler-DczZlaXR.mjs";
4
4
  import { QueueMap } from "./runtime/queues.mjs";
5
5
  import { PluginConfig } from "@cloudflare/vite-plugin";
6
6
  import { Plugin } from "vite";
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import { r as __toESM } from "./chunk-DJd-R1mw.mjs";
2
2
  import { a as join, n as dirname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
3
3
  import { u as require_picocolors } from "./output-DeiS4oEX.mjs";
4
- import { C as hasApiRoutes, S as resolveSandboxConfig, T as resolveAssetRoutingPolicy, _ as readWranglerCompat, a as prerenderPagesNode, b as SANDBOX_MIGRATION_TAG, c as stripInternalEnvKeys, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as readExistingLiveBindingConfig, h as normalizeWranglerCompatibilityFlags, i as prerenderPages, l as LIVE_MIGRATION_TAG, m as nextDurableObjectMigrationTag, n as resolveDistDir, o as filterLoadedEnv, p as hasDurableObjectSqliteMigration, r as resolveWorkerDirName, s as resolveRemoteMode, u as ensureWranglerCompat, v as resolveLiveBindingConfig, w as hasDocumentRoutes, x as isSandboxEnabled, y as syncWranglerBindings } from "./deploy-RQXpVBL-.mjs";
4
+ import { C as hasApiRoutes, S as resolveSandboxConfig, T as resolveAssetRoutingPolicy, _ as readWranglerCompat, a as prerenderPagesNode, b as SANDBOX_MIGRATION_TAG, c as stripInternalEnvKeys, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as readExistingLiveBindingConfig, h as normalizeWranglerCompatibilityFlags, i as prerenderPages, l as LIVE_MIGRATION_TAG, m as nextDurableObjectMigrationTag, n as resolveDistDir, o as filterLoadedEnv, p as hasDurableObjectSqliteMigration, r as resolveWorkerDirName, s as resolveRemoteMode, u as ensureWranglerCompat, v as resolveLiveBindingConfig, w as hasDocumentRoutes, x as isSandboxEnabled, y as syncWranglerBindings } from "./deploy-Cwa5sooV.mjs";
5
5
  import { i as resolveProjectPaths, n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-CCMrHYQm.mjs";
6
6
  import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-hhMYPVRT.mjs";
7
- import { c as getToken, u as isStagingMode } from "./client-DIfOFf1W.mjs";
7
+ import { d as getToken, p as isStagingMode } from "./client-D4awzTnj.mjs";
8
8
  import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
9
9
  import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-BTNuNoJ0.mjs";
10
10
  import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-8dLIngKW.mjs";
11
- import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-B2H1Vo2C.mjs";
12
- import { a as SSR_CLIENT_ENTRY_RELATIVE_PATHS, c as validateSsrEntries, f as isIdentifier, g as walk, i as inferProjectBindings, l as validateSsrEntry, m as isMemberExpression, n as FRAMEWORK_SCAN_DIRS, o as SSR_SERVER_ENTRY_RELATIVE_PATHS, p as isLiteral, r as detectFramework, t as DEFAULT_SCAN_DIRS, u as inferBindingsFromSource } from "./plugin-inference--7geW5Z2.mjs";
11
+ import { a as scanQueuesSync, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, t as scanMiddlewareSync } from "./scan-DGEp1-1Q.mjs";
12
+ import { a as SSR_CLIENT_ENTRY_RELATIVE_PATHS, c as validateSsrEntries, f as isIdentifier, g as walk, i as inferProjectBindings, l as validateSsrEntry, m as isMemberExpression, n as FRAMEWORK_SCAN_DIRS, o as SSR_SERVER_ENTRY_RELATIVE_PATHS, p as isLiteral, r as detectFramework, t as DEFAULT_SCAN_DIRS, u as inferBindingsFromSource } from "./plugin-inference-C3fLzFvP.mjs";
13
13
  import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-BdD_Fpms.mjs";
14
14
  import { r as parseDotenvFile } from "./dotenv-lS94ymhM.mjs";
15
15
  import { i as generateDbDts, n as generateQueueTypes, r as DRIZZLE_OPERATORS, t as generateRouteTypes } from "./route-types-D03ryMXz.mjs";
@@ -19,10 +19,10 @@ import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } fro
19
19
  import { a as loadUserEnvFile } from "./env-validation-LH6eoyW-.mjs";
20
20
  import { i as resolveLayoutIds } from "./scan-VCAM1oh3.mjs";
21
21
  import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-M3pxItg2.mjs";
22
- import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-VkAnACKX.mjs";
23
- import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-DYstYz0j.mjs";
24
- import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-RDkMnSTC.mjs";
25
- import { n as defer } from "./defer-CouVukrf.mjs";
22
+ import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-BNWymgnH.mjs";
23
+ import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-DqstQTGq.mjs";
24
+ import { t as INTERNAL_BINDING_PREFIXES } from "./env-raw-Dtj1UAoK.mjs";
25
+ import { n as defer } from "./defer-C-bdSM_b.mjs";
26
26
  import { VoidAssetRewriteError, basicAuth, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
27
27
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, writeFileSync, writeSync } from "node:fs";
28
28
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -654,7 +654,7 @@ export function createDb(d1) {
654
654
  const migrationsDir = paths.migrationsDir;
655
655
  if (!(existsSync(migrationsDir) && readdirSync(migrationsDir).some((f) => f.endsWith(".sql")))) {
656
656
  if (dialect === "sqlite") {
657
- const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-DLZ9E_cX.mjs");
657
+ const { getApplicationTables, getMiniflareDatabasePath } = await import("./runner-BQyKUqAL.mjs");
658
658
  if ((await getApplicationTables(getMiniflareDatabasePath(options.localD1PersistRoot ?? join(root, ".void"), options.localD1DatabaseId ?? "local")).catch(() => [])).length > 0) return;
659
659
  }
660
660
  voidWarn(`Schema found but no migrations in ${paths.sourceRelative("db/migrations")}/.\n \`void db push\` syncs the schema to your local DB without creating migration files.
@@ -1654,7 +1654,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1654
1654
  else warn();
1655
1655
  return;
1656
1656
  }
1657
- const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-Cv9V7ydr.mjs");
1657
+ const { runPgMigrations, getPgAppliedMigrations } = await import("./runner-pg-BAheiT6v.mjs");
1658
1658
  const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
1659
1659
  const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
1660
1660
  const allMigrations = collectMigrations(migrationsDir);
@@ -1669,7 +1669,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1669
1669
  const applied = await runPgMigrations(migrationsDir, url);
1670
1670
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
1671
1671
  } else if (hasSqlMigrations) {
1672
- const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-DLZ9E_cX.mjs");
1672
+ const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-BQyKUqAL.mjs");
1673
1673
  const { collectMigrations } = await import("./collect-9rO3JFNM.mjs").then((n) => n.n);
1674
1674
  const { validateMigrations } = await import("./validate-CNWm-PsL.mjs").then((n) => n.i);
1675
1675
  const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
@@ -1686,7 +1686,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
1686
1686
  if (applied.length > 0) voidLog(`Applied ${applied.length} migration(s): ${applied.join(", ")}`);
1687
1687
  }
1688
1688
  if (auth?.enabled) {
1689
- const { runLocalVoidAuthMigrations } = await import("./node-Df8UjQ2H.mjs");
1689
+ const { runLocalVoidAuthMigrations } = await import("./node-B07cZs0d.mjs");
1690
1690
  await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
1691
1691
  voidLog("Applied Better Auth migrations");
1692
1692
  }
@@ -2621,7 +2621,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2621
2621
  lines.push("function __voidAnnotateRouting(response, trace) {");
2622
2622
  lines.push(" if (!__VOID_DEV_ROUTING || !response) return response;");
2623
2623
  lines.push(" const headers = new Headers(response.headers);");
2624
- lines.push(" headers.set(\"X-Void-Routing\", trace);");
2624
+ lines.push(" try { headers.set(\"X-Void-Routing\", trace); } catch { return response; }");
2625
2625
  lines.push(" return new Response(response.body, { status: response.status, statusText: response.statusText, headers });");
2626
2626
  lines.push("}");
2627
2627
  lines.push("");
@@ -2671,7 +2671,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
2671
2671
  if (options.nodeTarget) lines.push(" const __rewritePromise = app.fetch(rewriteReq, c.env);");
2672
2672
  else lines.push(" const __rewritePromise = app.fetch(rewriteReq, c.env, c.executionCtx);");
2673
2673
  lines.push(" if (!__VOID_DEV_ROUTING) return __rewritePromise;");
2674
- lines.push(" return __rewritePromise.then((res) => __voidAnnotateRouting(res, \"c.rewrite \\u2192 \" + path + \" (middleware)\"));");
2674
+ lines.push(" return __rewritePromise.then((res) => __voidAnnotateRouting(res, \"c.rewrite -> \" + path + \" (middleware)\"));");
2675
2675
  lines.push(" };");
2676
2676
  lines.push(" const __origRedirect = c.redirect.bind(c);");
2677
2677
  lines.push(" c.redirect = (location, status) => {");
@@ -4023,13 +4023,13 @@ function emitApplyRoutingRules(lines, rulesVar, indent, nodeTarget, markFallback
4023
4023
  else lines.push(`${indent} const __r = await app.fetch(rewriteReq, c.env, c.executionCtx);`);
4024
4024
  lines.push(`${indent} if (!__VOID_DEV_ROUTING) return __r;`);
4025
4025
  lines.push(`${indent} const __kind = matched.rule.force === true ? "rewrite" : "fallback";`);
4026
- lines.push(`${indent} const __trace = __kind + "[" + matched.rule.source + "] \\u2192 " + dest + " (" + (matched.rule.origin || "unknown") + ")";`);
4026
+ lines.push(`${indent} const __trace = __kind + "[" + matched.rule.source + "] -> " + dest + " (" + (matched.rule.origin || "unknown") + ")";`);
4027
4027
  lines.push(`${indent} return __voidAnnotateRouting(__r, __trace);`);
4028
4028
  lines.push(`${indent} }`);
4029
4029
  lines.push(`${indent} const location = __mergeQueryIntoLocation(dest, new URL(c.req.url).search);`);
4030
4030
  lines.push(`${indent} const __redir = c.redirect(location, matched.rule.status);`);
4031
4031
  lines.push(`${indent} if (!__VOID_DEV_ROUTING) return __redir;`);
4032
- lines.push(`${indent} const __rtrace = "redirect[" + matched.rule.source + "] \\u2192 " + dest + " " + matched.rule.status + " (" + (matched.rule.origin || "unknown") + ")";`);
4032
+ lines.push(`${indent} const __rtrace = "redirect[" + matched.rule.source + "] -> " + dest + " " + matched.rule.status + " (" + (matched.rule.origin || "unknown") + ")";`);
4033
4033
  lines.push(`${indent} return __voidAnnotateRouting(__redir, __rtrace);`);
4034
4034
  lines.push(`${indent}}`);
4035
4035
  }
@@ -4916,7 +4916,7 @@ const STAGING_API_URL = "https://api.staging.void.cloud";
4916
4916
  */
4917
4917
  async function runAiSetupPrompt(root, token, staging, server) {
4918
4918
  const { select, text, isCancel, log } = await import("./dist-abzUneor.mjs").then((n) => n.p);
4919
- const { PlatformClient } = await import("./client-DIfOFf1W.mjs").then((n) => n.r);
4919
+ const { PlatformClient } = await import("./client-D4awzTnj.mjs").then((n) => n.r);
4920
4920
  const { writeProjectConfig } = await import("./project-CH9pdo16.mjs").then((n) => n.n);
4921
4921
  const { inferDefaultSlug } = await import("./resolve-project-D4O1_fZz.mjs").then((n) => n.i);
4922
4922
  const client = new PlatformClient(token, staging ? STAGING_API_URL : DEFAULT_API_URL);
@@ -4945,7 +4945,7 @@ async function runAiSetupPrompt(root, token, staging, server) {
4945
4945
  let slug;
4946
4946
  if (result === "__create__") {
4947
4947
  const { validateProjectSlug } = await import("./project-slug-rX3kTOfY.mjs").then((n) => n.t);
4948
- const { createProjectWithSlugRetry } = await import("./create-project-DCUrFJxa.mjs").then((n) => n.t);
4948
+ const { createProjectWithSlugRetry } = await import("./create-project-CGodxfzH.mjs").then((n) => n.t);
4949
4949
  let created;
4950
4950
  try {
4951
4951
  created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {