void 0.10.7 → 0.10.10
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/{auth-cmd-DlgNwByu.mjs → auth-cmd-Cw1edJdZ.mjs} +2 -2
- package/dist/{build-cmd-Br8qL0rA.mjs → build-cmd-C6kNDJBv.mjs} +1 -1
- package/dist/{cache-wH-mP8UE.mjs → cache-DIUSnIjJ.mjs} +1 -1
- package/dist/{cancel-deploy-BEBOEgtu.mjs → cancel-deploy-BosnzEHC.mjs} +1 -1
- package/dist/cli/cli.mjs +77 -28
- package/dist/{client-Cj96iiBH.mjs → client-C9FG6Vzc.mjs} +8 -0
- package/dist/{config-1twldYCW.mjs → config-BcAeIPe3.mjs} +6 -0
- package/dist/{create-project-DD9n8Ho-.mjs → create-project-CjYX23M_.mjs} +1 -1
- package/dist/{db-DjKE2-A-.mjs → db-BvKV34IK.mjs} +4 -4
- package/dist/{delete-D2kr3Kmk.mjs → delete-CThKLXfi.mjs} +1 -1
- package/dist/{deploy-C4PbkFyE.mjs → deploy-B02JyKP9.mjs} +59 -16
- package/dist/{domain-_luIsM_B.mjs → domain-DMrBabBQ.mjs} +1 -1
- package/dist/{env-CO5XAS9t.mjs → env-BfG7O71F.mjs} +1 -1
- package/dist/env-raw-Cx8ElDdj.mjs +58 -0
- package/dist/{gen-Cf79J4aw.mjs → gen-Bee261SV.mjs} +1 -1
- package/dist/{github-cmd-DnqxyOsb.mjs → github-cmd-DfeFEasr.mjs} +178 -45
- package/dist/{headers-BwvFGhkx.mjs → headers-CTAjX-UO.mjs} +1 -1
- package/dist/index.d.mts +13 -1
- package/dist/index.mjs +70 -31
- package/dist/{init-KirOzVDs.mjs → init-xfwW7cLp.mjs} +4 -4
- package/dist/{link-CUmiosyb.mjs → link-Co136MEs.mjs} +2 -2
- package/dist/{list-3GEw7b6m.mjs → list-BKDjA3M5.mjs} +1 -1
- package/dist/{login-DJReaT_Q.mjs → login-CrOTnR_6.mjs} +1 -1
- package/dist/{logs-D-rQ56Lq.mjs → logs-DlAg25ww.mjs} +1 -1
- package/dist/{mcp-D7yc0dXY.mjs → mcp-BNjMGMB0.mjs} +1 -1
- package/dist/{node-yFFk626c.mjs → node-CnE-SZCk.mjs} +1 -1
- package/dist/pages/index.mjs +2 -2
- package/dist/{prepare-C_cVurhP.mjs → prepare-BRyC4TCC.mjs} +1 -1
- package/dist/{project-cmd-DnU7u9QF.mjs → project-cmd-B2bcKefD.mjs} +8 -8
- package/dist/{rollback-Yh7bCKob.mjs → rollback-9dfmB-YZ.mjs} +1 -1
- package/dist/runtime/ai.mjs +113 -15
- package/dist/runtime/env-public.mjs +9 -4
- package/dist/runtime/env.d.mts +14 -1
- package/dist/runtime/env.mjs +24 -10
- package/dist/runtime/isr-cache.d.mts +207 -0
- package/dist/runtime/isr-cache.mjs +523 -0
- package/dist/runtime/isr.d.mts +4 -3
- package/dist/runtime/isr.mjs +44 -5
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/{secret-u7FRvg8d.mjs → secret-DeMnMcV0.mjs} +1 -1
- package/package.json +3 -2
- package/schema.json +11 -0
- package/skills/void/docs/integrations/cloudflare.md +107 -0
- package/skills/void/docs/node_modules/void/{AGENTS.md → CLAUDE.md} +14 -0
- package/skills/void/docs/reference/cli.md +29 -2
- package/dist/env-raw-CoS20LHP.mjs +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as text, T as log, j as isCancel, k as select, u as import_picocolors, x as cancel } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
-
import { b as readProjectConfig, c as createCodeChallenge, f as getToken, h as openBrowser, l as createCodeVerifier, n as PlatformClient, o as parsePlatformErrorBody, s as awaitBrowserCallback, t as PlatformApiError } from "./client-
|
|
1
|
+
import { A as text, S as confirm, T as log, j as isCancel, k as select, u as import_picocolors, x as cancel } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
+
import { b as readProjectConfig, c as createCodeChallenge, f as getToken, h as openBrowser, l as createCodeVerifier, n as PlatformClient, o as parsePlatformErrorBody, s as awaitBrowserCallback, t as PlatformApiError } from "./client-C9FG6Vzc.mjs";
|
|
3
3
|
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-D2HI3TrG.mjs";
|
|
4
4
|
import { t as collectGitDeployMetadata } from "./git-metadata-CBKaL0v5.mjs";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
@@ -103,6 +103,7 @@ async function runGithubCommand(root, args) {
|
|
|
103
103
|
case "connect": return runConnect(root, client, args);
|
|
104
104
|
case "update": return runGithubUpdate(root, client, args);
|
|
105
105
|
case "status": return runStatus(root, client, args);
|
|
106
|
+
case "disconnect": return runGithubDisconnect(root, client, args);
|
|
106
107
|
case "link": return runGithubLink(root, client);
|
|
107
108
|
case "join": return runGithubJoin(root, client);
|
|
108
109
|
}
|
|
@@ -187,35 +188,38 @@ async function runGithubLink(root, client) {
|
|
|
187
188
|
else log.success("GitHub account linked.");
|
|
188
189
|
}
|
|
189
190
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* instance.
|
|
191
|
+
* Browser round-trip (localhost + PKCE) that joins the caller to their
|
|
192
|
+
* organization's shared GitHub App installations. Returns the number of
|
|
193
|
+
* installations joined. Throws PlatformApiError — including the 503
|
|
194
|
+
* `github_oauth_not_configured` — so callers own the user-facing handling
|
|
195
|
+
* (`runGithubJoin` prints and exits; the connect auto-join fallback falls
|
|
196
|
+
* through to its install-first error).
|
|
197
197
|
*/
|
|
198
|
-
async function
|
|
198
|
+
async function performGithubJoin(client) {
|
|
199
199
|
const verifier = createCodeVerifier();
|
|
200
200
|
const challenge = createCodeChallenge(verifier);
|
|
201
201
|
const state = randomBytes(32).toString("hex");
|
|
202
|
+
const { count } = await awaitBrowserCallback({
|
|
203
|
+
state,
|
|
204
|
+
buildAuthUrl: async (callback) => {
|
|
205
|
+
callback.searchParams.set("state", state);
|
|
206
|
+
const { url } = await client.getGithubJoinUrl(callback.href, challenge);
|
|
207
|
+
return url;
|
|
208
|
+
},
|
|
209
|
+
describeError: (p) => p.get("error") ? "GitHub authorization failed." : null,
|
|
210
|
+
onUrl: (url) => log.message(`Open this URL to join your organization's shared GitHub App installations:\n${import_picocolors.default.cyan(url)}`),
|
|
211
|
+
finalize: async (params) => {
|
|
212
|
+
const joinCode = params.get("join_code");
|
|
213
|
+
if (!joinCode) throw new Error("github: join callback did not return a join code.");
|
|
214
|
+
return client.completeGithubJoin(joinCode, verifier);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
return count;
|
|
218
|
+
}
|
|
219
|
+
async function runGithubJoin(root, client) {
|
|
202
220
|
let count;
|
|
203
221
|
try {
|
|
204
|
-
|
|
205
|
-
state,
|
|
206
|
-
buildAuthUrl: async (callback) => {
|
|
207
|
-
callback.searchParams.set("state", state);
|
|
208
|
-
const { url } = await client.getGithubJoinUrl(callback.href, challenge);
|
|
209
|
-
return url;
|
|
210
|
-
},
|
|
211
|
-
describeError: (p) => p.get("error") ? "GitHub authorization failed." : null,
|
|
212
|
-
onUrl: (url) => log.message(`Open this URL to join your organization's shared GitHub App installations:\n${import_picocolors.default.cyan(url)}`),
|
|
213
|
-
finalize: async (params) => {
|
|
214
|
-
const joinCode = params.get("join_code");
|
|
215
|
-
if (!joinCode) throw new Error("github: join callback did not return a join code.");
|
|
216
|
-
return client.completeGithubJoin(joinCode, verifier);
|
|
217
|
-
}
|
|
218
|
-
}));
|
|
222
|
+
count = await performGithubJoin(client);
|
|
219
223
|
} catch (err) {
|
|
220
224
|
if (err instanceof PlatformApiError && err.status === 503 && err.code === "github_oauth_not_configured") {
|
|
221
225
|
log.error("Organization installation sharing is not enabled on this Void instance.");
|
|
@@ -281,6 +285,26 @@ async function runGithubConnectAuthorize(client, installationId, repoFullName) {
|
|
|
281
285
|
codeVerifier: verifier
|
|
282
286
|
};
|
|
283
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Free-text repository prompt used when the installation's repository list is
|
|
290
|
+
* not enumerable client-side: `repository_selection === 'all'`, or a shared
|
|
291
|
+
* org installation whose list the server redacts for non-owner members. The
|
|
292
|
+
* server re-verifies actual access on connect, so this is DX, not security.
|
|
293
|
+
*/
|
|
294
|
+
async function promptRepoFullName(root) {
|
|
295
|
+
const gitDefault = parseGithubRepoFullName(collectGitDeployMetadata(root, null).repositoryUrl);
|
|
296
|
+
const input = await text({
|
|
297
|
+
message: "Repository (owner/repo):",
|
|
298
|
+
placeholder: gitDefault ?? "owner/repo",
|
|
299
|
+
initialValue: gitDefault ?? "",
|
|
300
|
+
validate: (value) => /^[^/\s]+\/[^/\s]+$/.test((value ?? "").trim()) ? void 0 : "Enter the repository as owner/repo."
|
|
301
|
+
});
|
|
302
|
+
if (isCancel(input)) {
|
|
303
|
+
cancel("Cancelled.");
|
|
304
|
+
process.exit(0);
|
|
305
|
+
}
|
|
306
|
+
return input.trim();
|
|
307
|
+
}
|
|
284
308
|
async function runConnect(root, client, args) {
|
|
285
309
|
const isTTY = process.stdin.isTTY === true;
|
|
286
310
|
let projectId;
|
|
@@ -318,14 +342,36 @@ async function runConnect(root, client, args) {
|
|
|
318
342
|
projectId = picked;
|
|
319
343
|
}
|
|
320
344
|
}
|
|
321
|
-
const
|
|
345
|
+
const listActiveInstallations = async () => (await client.listGithubInstallations()).filter((i) => i.status === "active");
|
|
346
|
+
let autoJoinAttempted = false;
|
|
347
|
+
const attemptAutoJoin = async () => {
|
|
348
|
+
autoJoinAttempted = true;
|
|
349
|
+
try {
|
|
350
|
+
return await performGithubJoin(client);
|
|
351
|
+
} catch (err) {
|
|
352
|
+
if (err instanceof PlatformApiError && err.status === 503 && err.code === "github_oauth_not_configured") return 0;
|
|
353
|
+
throw err;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
let installations = await listActiveInstallations();
|
|
357
|
+
if (installations.length === 0 && isTTY) {
|
|
358
|
+
log.info("No GitHub App installation is linked to your account yet — checking whether your organization already installed the Void GitHub App…");
|
|
359
|
+
if (await attemptAutoJoin() > 0) installations = await listActiveInstallations();
|
|
360
|
+
}
|
|
322
361
|
if (installations.length === 0) {
|
|
323
|
-
log.error("No active GitHub App installation. Run `void github install` first.");
|
|
362
|
+
log.error(isTTY ? "No GitHub App installation found for your account or your organizations. Run `void github install` first." : "No active GitHub App installation. Run `void github install` first, or `void github join` if your organization already installed the Void GitHub App.");
|
|
324
363
|
process.exit(1);
|
|
325
364
|
}
|
|
326
365
|
let installation;
|
|
327
366
|
if (args.installationId) {
|
|
328
|
-
|
|
367
|
+
let found = installations.find((i) => i.installation_id === args.installationId);
|
|
368
|
+
if (!found && isTTY && !autoJoinAttempted) {
|
|
369
|
+
log.info(`Installation '${args.installationId}' is not linked to your account yet — checking whether your organization shares it…`);
|
|
370
|
+
if (await attemptAutoJoin() > 0) {
|
|
371
|
+
installations = await listActiveInstallations();
|
|
372
|
+
found = installations.find((i) => i.installation_id === args.installationId);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
329
375
|
if (!found) {
|
|
330
376
|
log.error(`connect: No active installation found with id '${args.installationId}'.`);
|
|
331
377
|
process.exit(1);
|
|
@@ -352,8 +398,11 @@ async function runConnect(root, client, args) {
|
|
|
352
398
|
let repoFullName;
|
|
353
399
|
if (args.repo) repoFullName = args.repo;
|
|
354
400
|
else if (installation.repository_selection === "selected") if (installation.repositories.length === 0) {
|
|
355
|
-
|
|
356
|
-
|
|
401
|
+
if (!isTTY) {
|
|
402
|
+
log.error("connect: --repo <owner/repo> is required — this installation does not expose a repository list to your account.");
|
|
403
|
+
process.exit(1);
|
|
404
|
+
}
|
|
405
|
+
repoFullName = await promptRepoFullName(root);
|
|
357
406
|
} else if (installation.repositories.length === 1) repoFullName = installation.repositories[0].full_name;
|
|
358
407
|
else if (!isTTY) {
|
|
359
408
|
log.error("connect: Multiple repositories available. Pass --repo <owner/repo>.");
|
|
@@ -377,21 +426,7 @@ async function runConnect(root, client, args) {
|
|
|
377
426
|
log.error("connect: --repo <owner/repo> is required in non-interactive mode for an all-repositories installation.");
|
|
378
427
|
process.exit(1);
|
|
379
428
|
}
|
|
380
|
-
|
|
381
|
-
const input = await text({
|
|
382
|
-
message: "Repository (owner/repo):",
|
|
383
|
-
placeholder: gitDefault ?? "owner/repo",
|
|
384
|
-
initialValue: gitDefault ?? ""
|
|
385
|
-
});
|
|
386
|
-
if (isCancel(input)) {
|
|
387
|
-
cancel("Cancelled.");
|
|
388
|
-
process.exit(0);
|
|
389
|
-
}
|
|
390
|
-
repoFullName = input.trim();
|
|
391
|
-
if (!repoFullName) {
|
|
392
|
-
log.error("connect: Repository is required.");
|
|
393
|
-
process.exit(1);
|
|
394
|
-
}
|
|
429
|
+
repoFullName = await promptRepoFullName(root);
|
|
395
430
|
}
|
|
396
431
|
const branchDefault = args.branch ?? collectGitDeployMetadata(root, null).gitRef ?? "main";
|
|
397
432
|
let branch;
|
|
@@ -704,5 +739,103 @@ async function runStatus(root, client, args) {
|
|
|
704
739
|
}
|
|
705
740
|
log.message(formatConnection(connection));
|
|
706
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* `void github disconnect [project]` — remove a project's GitHub connection so
|
|
744
|
+
* pushes no longer auto-deploy. The server (DELETE /projects/:id/github)
|
|
745
|
+
* terminalizes any in-flight builds (revoking their deploy tokens) before
|
|
746
|
+
* dropping the connection row. Destructive, so a TTY run confirms first; --yes
|
|
747
|
+
* skips the prompt and is REQUIRED in a non-interactive shell. A project with no
|
|
748
|
+
* connection is already in the goal state — report it and exit 0.
|
|
749
|
+
*/
|
|
750
|
+
async function runGithubDisconnect(root, client, args) {
|
|
751
|
+
const isTTY = process.stdin.isTTY === true;
|
|
752
|
+
let projectId;
|
|
753
|
+
const requestedSlug = getRequestedProjectSlug({ projectSlug: args.projectName || void 0 });
|
|
754
|
+
if (requestedSlug) {
|
|
755
|
+
const resolved = resolveProjectBySlug(await client.listProjects(), requestedSlug);
|
|
756
|
+
if (!resolved) {
|
|
757
|
+
log.error(`disconnect: No project found with slug '${requestedSlug}'.`);
|
|
758
|
+
process.exit(1);
|
|
759
|
+
}
|
|
760
|
+
projectId = resolved.projectId;
|
|
761
|
+
} else {
|
|
762
|
+
const linked = readProjectConfig(root);
|
|
763
|
+
if (linked) projectId = linked.projectId;
|
|
764
|
+
else if (!isTTY) {
|
|
765
|
+
log.error("disconnect: No project specified. Pass a project name or --project <name>, set VOID_PROJECT, or link one with `void project link`.");
|
|
766
|
+
process.exit(1);
|
|
767
|
+
} else {
|
|
768
|
+
const projects = await client.listProjects();
|
|
769
|
+
if (projects.length === 0) {
|
|
770
|
+
log.error("No projects found. Create one first with `void deploy`.");
|
|
771
|
+
process.exit(1);
|
|
772
|
+
}
|
|
773
|
+
const picked = await select({
|
|
774
|
+
message: "Select a project:",
|
|
775
|
+
options: projects.map((p) => ({
|
|
776
|
+
value: p.id,
|
|
777
|
+
label: p.slug
|
|
778
|
+
}))
|
|
779
|
+
});
|
|
780
|
+
if (isCancel(picked)) {
|
|
781
|
+
cancel("Cancelled.");
|
|
782
|
+
process.exit(0);
|
|
783
|
+
}
|
|
784
|
+
projectId = picked;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
let connection;
|
|
788
|
+
try {
|
|
789
|
+
connection = await client.getGithubConnection(projectId);
|
|
790
|
+
} catch (err) {
|
|
791
|
+
if (err instanceof PlatformApiError) {
|
|
792
|
+
const body = parsePlatformErrorBody(err.body);
|
|
793
|
+
const code = body?.error ?? body?.message ?? "";
|
|
794
|
+
if (err.status === 404 && code.includes("connection not found")) {
|
|
795
|
+
log.info("This project is not connected to a GitHub repository. Nothing to disconnect.");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const message = describeConnectError(err.status, code);
|
|
799
|
+
if (message !== null) {
|
|
800
|
+
log.error(`disconnect: ${message}`);
|
|
801
|
+
process.exit(1);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
throw err;
|
|
805
|
+
}
|
|
806
|
+
if (!args.yes) {
|
|
807
|
+
if (!isTTY) {
|
|
808
|
+
log.error("disconnect: Refusing to disconnect without confirmation in a non-interactive shell. Re-run with --yes.");
|
|
809
|
+
process.exit(1);
|
|
810
|
+
}
|
|
811
|
+
const ok = await confirm({
|
|
812
|
+
message: `Disconnect ${connection.repo_full_name} from this project? This cancels any in-flight builds.`,
|
|
813
|
+
initialValue: false
|
|
814
|
+
});
|
|
815
|
+
if (isCancel(ok)) {
|
|
816
|
+
cancel("Cancelled.");
|
|
817
|
+
process.exit(0);
|
|
818
|
+
}
|
|
819
|
+
if (!ok) {
|
|
820
|
+
log.info("Disconnect cancelled.");
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
try {
|
|
825
|
+
await client.deleteGithubConnection(projectId);
|
|
826
|
+
} catch (err) {
|
|
827
|
+
if (err instanceof PlatformApiError) {
|
|
828
|
+
const body = parsePlatformErrorBody(err.body);
|
|
829
|
+
const code = body?.error ?? body?.message ?? "";
|
|
830
|
+
const message = describeConnectError(err.status, code);
|
|
831
|
+
if (message !== null) {
|
|
832
|
+
log.error(`disconnect: ${message}`);
|
|
833
|
+
process.exit(1);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
throw err;
|
|
837
|
+
}
|
|
838
|
+
log.success(`Disconnected ${connection.repo_full_name}.`);
|
|
839
|
+
}
|
|
707
840
|
//#endregion
|
|
708
841
|
export { runGithubCommand };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as join } from "./pathe.M-eThtNZ-CQzLbt4c.mjs";
|
|
2
|
-
import { a as convertRedirectsConfig, d as parseHostPrefixedSource, i as convertHeadersConfig, o as convertRewritesConfig, r as convertFallbacksConfig, s as countSplats, t as VALID_REDIRECT_STATUSES, u as isProtocolRelative } from "./config-
|
|
2
|
+
import { a as convertRedirectsConfig, d as parseHostPrefixedSource, i as convertHeadersConfig, o as convertRewritesConfig, r as convertFallbacksConfig, s as countSplats, t as VALID_REDIRECT_STATUSES, u as isProtocolRelative } from "./config-BcAeIPe3.mjs";
|
|
3
3
|
import { i as voidWarn } from "./log-ChfPKsVd.mjs";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/cli/headers.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,18 @@ import { Plugin } from "vite";
|
|
|
7
7
|
|
|
8
8
|
//#region src/index.d.ts
|
|
9
9
|
/**
|
|
10
|
+
* Decide whether to inject a Workers AI binding into the built wrangler config.
|
|
11
|
+
*
|
|
12
|
+
* Build-only: dev/miniflare has no local Workers AI, so serve must never bind
|
|
13
|
+
* `env.AI` (dev uses the P2 `__VOID_TOKEN` proxy path instead).
|
|
14
|
+
*
|
|
15
|
+
* `!resolvedAi` is load-bearing: mergeBindings' return is defu-merged over the
|
|
16
|
+
* resolved root-wrangler config and wins, so skipping when the user already
|
|
17
|
+
* declared an `ai` binding avoids clobbering theirs. `!resultAi` is harmless
|
|
18
|
+
* defense-in-depth (nothing else in mergeBindings sets `result.ai`).
|
|
19
|
+
*/
|
|
20
|
+
declare function shouldBindWorkersAi(command: string, needsAI: boolean, resolvedAi: unknown, resultAi: unknown): boolean;
|
|
21
|
+
/**
|
|
10
22
|
* Void plugin — the main entry point.
|
|
11
23
|
*
|
|
12
24
|
* Composes:
|
|
@@ -29,4 +41,4 @@ declare function voidPlugin(options?: {
|
|
|
29
41
|
auxiliaryWorkers?: PluginConfig["auxiliaryWorkers"];
|
|
30
42
|
}): Array<Plugin>;
|
|
31
43
|
//#endregion
|
|
32
|
-
export { type AuthUser, type BasicAuthOptions, type CloudContext, type CloudContextVariables, type CloudEnv, type Deferred, type DeferredState, type HandlerInput, type HeadDescriptor, type InferProps, type QueueBatch, type QueueMap, type QueueMessage, type QueueRetryOptions, type RenderAssetTags, type TypedHandler, type TypedQueueHandler, type ValidatorSlots, VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, voidPlugin };
|
|
44
|
+
export { type AuthUser, type BasicAuthOptions, type CloudContext, type CloudContextVariables, type CloudEnv, type Deferred, type DeferredState, type HandlerInput, type HeadDescriptor, type InferProps, type QueueBatch, type QueueMap, type QueueMessage, type QueueRetryOptions, type RenderAssetTags, type TypedHandler, type TypedQueueHandler, type ValidatorSlots, VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, shouldBindWorkersAi, voidPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as __toESM } from "./rolldown-runtime-DJK8HYOj.mjs";
|
|
2
2
|
import { a as join, n as dirname, s as relative } from "./pathe.M-eThtNZ-CQzLbt4c.mjs";
|
|
3
3
|
import { M as require_picocolors } from "./agents-Bmr5tFFb.mjs";
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as isSandboxEnabled, D as resolveAssetRoutingPolicy, E as hasDocumentRoutes, S as SANDBOX_MIGRATION_TAG, T as hasApiRoutes, _ as normalizeWranglerCompatibilityFlags, a as prerenderPagesNode, b as resolveLiveBindingConfig, c as filterLoadedEnv, d as LIVE_MIGRATION_TAG, f as ensureWranglerCompat, g as nextDurableObjectMigrationTag, h as hasDurableObjectSqliteMigration, i as prerenderPages, l as resolveRemoteMode, m as ensureWranglerNodejsAlsFlag, n as resolveDistDir, o as collectRevalidate, p as ensureWranglerCompatibilityDate, r as resolveWorkerDirName, s as hasRevalidate, u as stripInternalEnvKeys, v as readExistingLiveBindingConfig, w as resolveSandboxConfig, x as syncWranglerBindings, y as readWranglerCompat } from "./deploy-B02JyKP9.mjs";
|
|
5
5
|
import { i as resolveProjectPaths, n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-tpdR1mJR.mjs";
|
|
6
6
|
import { a as scanQueuesSync, c as loadVoidAuthConfig, i as scanWebSocketRoutesSync, n as scanRoutePatternsSync, o as scanJobsSync, r as scanRoutes, s as findVoidAuthConfig, t as scanMiddlewareSync } from "./scan-i7Yz54fv.mjs";
|
|
7
|
-
import { b as readProjectConfig, f as getToken, m as isStagingMode } from "./client-
|
|
7
|
+
import { b as readProjectConfig, f as getToken, m as isStagingMode } from "./client-C9FG6Vzc.mjs";
|
|
8
8
|
import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-D9uSVVpA.mjs";
|
|
9
|
-
import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-
|
|
9
|
+
import { c as getDatabaseDialect, f as readConfig, l as isNodeTarget, p as resolveBindingNames } from "./config-BcAeIPe3.mjs";
|
|
10
10
|
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-CJxi_fWI.mjs";
|
|
11
11
|
import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-ChfPKsVd.mjs";
|
|
12
12
|
import { r as parseDotenvFile } from "./dotenv-D_UbC_vc.mjs";
|
|
@@ -17,8 +17,8 @@ import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } fro
|
|
|
17
17
|
import { a as loadUserEnvFile } from "./env-validation-CeC2FL66.mjs";
|
|
18
18
|
import { i as resolveLayoutIds } from "./scan-Dp_Gyzs3.mjs";
|
|
19
19
|
import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-D-3_D-Gl.mjs";
|
|
20
|
-
import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-
|
|
21
|
-
import {
|
|
20
|
+
import { n as lintDuplicateSources, r as mergeRoutingRules, t as lintDestinationSplats } from "./headers-CTAjX-UO.mjs";
|
|
21
|
+
import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-Cx8ElDdj.mjs";
|
|
22
22
|
import { n as defer } from "./defer-YsYDUoii.mjs";
|
|
23
23
|
import { VoidAssetRewriteError, basicAuth, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled } from "./runtime/handler.mjs";
|
|
24
24
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, writeFileSync, writeSync } from "node:fs";
|
|
@@ -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-
|
|
1689
|
+
const { runLocalVoidAuthMigrations } = await import("./node-CnE-SZCk.mjs");
|
|
1690
1690
|
await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth.configPath);
|
|
1691
1691
|
voidLog("Applied Better Auth migrations");
|
|
1692
1692
|
}
|
|
@@ -2534,7 +2534,7 @@ function pushDefaultErrorPageHelpers(lines, options) {
|
|
|
2534
2534
|
* - Middleware registered via app.use()
|
|
2535
2535
|
* - Routes registered with lazy-loaded handlers and auto-conversion
|
|
2536
2536
|
*/
|
|
2537
|
-
function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, options, pages = null) {
|
|
2537
|
+
function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, options, pages = null, mergedRevalidate) {
|
|
2538
2538
|
const lines = [];
|
|
2539
2539
|
const auth = options.auth;
|
|
2540
2540
|
const webSockets = scan.websockets ?? [];
|
|
@@ -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("
|
|
2624
|
+
lines.push(" headers.set(\"X-Void-Routing\", trace);");
|
|
2625
2625
|
lines.push(" return new Response(response.body, { status: response.status, statusText: response.statusText, headers });");
|
|
2626
2626
|
lines.push("}");
|
|
2627
2627
|
lines.push("");
|
|
@@ -3134,6 +3134,8 @@ window.__vite_plugin_react_preamble_installed__ = true;
|
|
|
3134
3134
|
lines.push("function __getRawEnv() { return __rawEnvStore.getStore(); }");
|
|
3135
3135
|
lines.push(`export const __VOID_BUILD_KEY = ${JSON.stringify(crypto.randomUUID())};`);
|
|
3136
3136
|
lines.push(`export const __VOID_DEV_TRIGGER_TOKEN = ${JSON.stringify(options.devTriggerToken ?? crypto.randomUUID())};`);
|
|
3137
|
+
lines.push(`export const __VOID_ISR_REVALIDATE = ${JSON.stringify(mergedRevalidate)};`);
|
|
3138
|
+
lines.push(`export const __VOID_ISR_DEPLOYMENT_ID = ${JSON.stringify(crypto.randomUUID())};`);
|
|
3137
3139
|
lines.push("");
|
|
3138
3140
|
lines.push(`export default app;`);
|
|
3139
3141
|
return lines.join("\n");
|
|
@@ -3613,7 +3615,7 @@ ${spaFallbackCode}
|
|
|
3613
3615
|
* remote mode (`__VOID_REMOTE`) and replace local bindings with
|
|
3614
3616
|
* proxy-backed versions.
|
|
3615
3617
|
*/
|
|
3616
|
-
function compileWorkerEntry(hasQueues = false, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", envSchemaModule, sandbox, serveSpaFallback = false, live) {
|
|
3618
|
+
function compileWorkerEntry(hasQueues = false, remote, assetsDir = "assets", webSocketClasses = [], runtimeEnvPath = "void/_env", envSchemaModule, sandbox, serveSpaFallback = false, live, isr) {
|
|
3617
3619
|
const remotePath = remote?.remotePath;
|
|
3618
3620
|
const remoteBindingNames = JSON.stringify(remote?.bindingNames);
|
|
3619
3621
|
const createRemoteEnvCall = `createRemoteEnv(env${remote?.bindingNames ? `, ${remoteBindingNames}` : ""})`;
|
|
@@ -3633,7 +3635,8 @@ function compileWorkerEntry(hasQueues = false, remote, assetsDir = "assets", web
|
|
|
3633
3635
|
const remoteImport = remote ? `import { createRemoteEnv } from ${JSON.stringify(remote.remotePath)};\n` : "";
|
|
3634
3636
|
const envSchemaImport = envSchemaModule ? `import ${JSON.stringify(envSchemaModule.importPath)};\nimport { _validateEnvOnce } from ${JSON.stringify(envSchemaModule.helperPath)};\n` : "";
|
|
3635
3637
|
const envValidateCall = envSchemaModule ? " await _validateEnvOnce(env);\n" : "";
|
|
3636
|
-
const
|
|
3638
|
+
const exactNames = isr ? INTERNAL_BINDING_EXACT_NAMES : [];
|
|
3639
|
+
const prefixCheck = [...INTERNAL_BINDING_PREFIXES.map((p) => `prop.startsWith(${JSON.stringify(p)})`), ...exactNames.map((n) => `prop === ${JSON.stringify(n)}`)].join(" || ");
|
|
3637
3640
|
const filterBindingsHelper = `
|
|
3638
3641
|
function __filterInternalBindings(env) {
|
|
3639
3642
|
return new Proxy(env, {
|
|
@@ -3647,7 +3650,7 @@ function __filterInternalBindings(env) {
|
|
|
3647
3650
|
},
|
|
3648
3651
|
ownKeys(target) {
|
|
3649
3652
|
return Reflect.ownKeys(target).filter(
|
|
3650
|
-
(key) => typeof key !== "string" || (${INTERNAL_BINDING_PREFIXES.map((p) => `!key.startsWith(${JSON.stringify(p)})`).join(" && ")})
|
|
3653
|
+
(key) => typeof key !== "string" || (${[...INTERNAL_BINDING_PREFIXES.map((p) => `!key.startsWith(${JSON.stringify(p)})`), ...exactNames.map((n) => `key !== ${JSON.stringify(n)}`)].join(" && ")})
|
|
3651
3654
|
);
|
|
3652
3655
|
},
|
|
3653
3656
|
getOwnPropertyDescriptor(target, prop) {
|
|
@@ -3658,27 +3661,36 @@ function __filterInternalBindings(env) {
|
|
|
3658
3661
|
}
|
|
3659
3662
|
`;
|
|
3660
3663
|
const assetHelper = compileAssetFallbackHelper(assetsDir, serveSpaFallback);
|
|
3664
|
+
const isrImport = isr ? `import { handleIsr } from ${JSON.stringify(isr.runtimePath)};\nimport { __VOID_ISR_REVALIDATE, __VOID_ISR_DEPLOYMENT_ID } from 'virtual:void-routes';\n` : "";
|
|
3665
|
+
const isrEnvCapture = isr ? ` env.__VOID_ISR_DEPLOYMENT_ID ??= __VOID_ISR_DEPLOYMENT_ID;\n env.__VOID_ISR_HOST = new URL(request.url).hostname;\n` : "";
|
|
3666
|
+
const isrDeploymentStamp = isr ? ` env.__VOID_ISR_DEPLOYMENT_ID ??= __VOID_ISR_DEPLOYMENT_ID;\n` : "";
|
|
3667
|
+
const renderBlock = isr ? ` const __render = async (req) => serveWithAssets(req, env, await app.fetch(req, userEnv, ctx));
|
|
3668
|
+
if (env.ISR_CACHE) {
|
|
3669
|
+
const __isr = await handleIsr(request, env, ctx, { revalidate: __VOID_ISR_REVALIDATE, deploymentId: __VOID_ISR_DEPLOYMENT_ID }, __render);
|
|
3670
|
+
if (__isr) return __isr;
|
|
3671
|
+
}
|
|
3672
|
+
return __render(request);` : ` return serveWithAssets(request, env, await app.fetch(request, userEnv, ctx));`;
|
|
3661
3673
|
const fetchHandler = remotePath ? `async (request, env, ctx) => {
|
|
3662
3674
|
${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
|
|
3663
3675
|
if (ws) return ws;
|
|
3664
3676
|
if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
|
|
3665
|
-
return __withRawEnv(env, () => {
|
|
3677
|
+
${isrEnvCapture} return __withRawEnv(env, () => {
|
|
3666
3678
|
const userEnv = __filterInternalBindings(env);
|
|
3667
3679
|
return withRuntimeEnv(env, async () => {
|
|
3668
3680
|
const internal = await __handleInternal(request, env, ctx);
|
|
3669
3681
|
if (internal) return internal;
|
|
3670
|
-
|
|
3682
|
+
${renderBlock}
|
|
3671
3683
|
});
|
|
3672
3684
|
});
|
|
3673
3685
|
}` : `async (request, env, ctx) => {
|
|
3674
3686
|
${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
|
|
3675
3687
|
if (ws) return ws;
|
|
3676
|
-
return __withRawEnv(env, () => {
|
|
3688
|
+
${isrEnvCapture} return __withRawEnv(env, () => {
|
|
3677
3689
|
const userEnv = __filterInternalBindings(env);
|
|
3678
3690
|
return withRuntimeEnv(env, async () => {
|
|
3679
3691
|
const internal = await __handleInternal(request, env, ctx);
|
|
3680
3692
|
if (internal) return internal;
|
|
3681
|
-
|
|
3693
|
+
${renderBlock}
|
|
3682
3694
|
});
|
|
3683
3695
|
});
|
|
3684
3696
|
}`;
|
|
@@ -3704,18 +3716,18 @@ ${envValidateCall} const ws = await __voidHandleWebSocket(request, env);
|
|
|
3704
3716
|
}`;
|
|
3705
3717
|
const scheduledHandler = remotePath ? `async function handleScheduled(controller, env, ctx) {
|
|
3706
3718
|
${envValidateCall} if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};
|
|
3707
|
-
const userEnv = __filterInternalBindings(env);
|
|
3719
|
+
${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
|
|
3708
3720
|
return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
|
|
3709
3721
|
}` : `async function handleScheduled(controller, env, ctx) {
|
|
3710
|
-
${envValidateCall} const userEnv = __filterInternalBindings(env);
|
|
3722
|
+
${envValidateCall}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
|
|
3711
3723
|
return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
|
|
3712
3724
|
}`;
|
|
3713
3725
|
if (hasQueues) return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __voidHandleWebSocket, __withRawEnv, __processQueue${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
|
|
3714
|
-
${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${assetHelper}
|
|
3726
|
+
${runtimeEnvImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
|
|
3715
3727
|
${internalRouteHelper}
|
|
3716
3728
|
${scheduledHandler}
|
|
3717
3729
|
async function queue(batch, env, ctx) {
|
|
3718
|
-
${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : ""} const userEnv = __filterInternalBindings(env);
|
|
3730
|
+
${envValidateCall}${remotePath ? ` if (env.__VOID_REMOTE === "1") env = ${createRemoteEnvCall};\n` : ""}${isrDeploymentStamp} const userEnv = __filterInternalBindings(env);
|
|
3719
3731
|
const messages = [...batch.messages].map(m => ({
|
|
3720
3732
|
id: m.id, timestamp: m.timestamp.toISOString(),
|
|
3721
3733
|
body: m.body, attempts: m.attempts,
|
|
@@ -3740,7 +3752,7 @@ ${liveExport}
|
|
|
3740
3752
|
${sandboxExport}
|
|
3741
3753
|
export default { fetch: ${fetchHandler}, scheduled: handleScheduled, queue };`;
|
|
3742
3754
|
return `${sandboxImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __voidHandleWebSocket, __withRawEnv${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
|
|
3743
|
-
${runtimeEnvImport}${envSchemaImport}${remoteImport}${filterBindingsHelper}${assetHelper}
|
|
3755
|
+
${runtimeEnvImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
|
|
3744
3756
|
${internalRouteHelper}
|
|
3745
3757
|
${scheduledHandler}
|
|
3746
3758
|
${webSocketClasses.map((name) => `export { ${name} };`).join("\n")}
|
|
@@ -4362,6 +4374,7 @@ function routingPlugin(root, options) {
|
|
|
4362
4374
|
compileOptions.auth.authDatabasePath = databasePath;
|
|
4363
4375
|
}
|
|
4364
4376
|
let resolvedConfig = null;
|
|
4377
|
+
let isrRevalidate;
|
|
4365
4378
|
function resolveAuthClientPath(config) {
|
|
4366
4379
|
if (config.plugins.some((plugin) => plugin.name === "void-react:pages")) return explicitAuthClientPaths.react;
|
|
4367
4380
|
if (config.plugins.some((plugin) => plugin.name === "void-vue:pages")) return explicitAuthClientPaths.vue;
|
|
@@ -4497,11 +4510,17 @@ function routingPlugin(root, options) {
|
|
|
4497
4510
|
if (options.target) {
|
|
4498
4511
|
writeFileIfChanged(join(outDir, "app.ts"), compileNodeApp(options.target, compileOptions.honoPath, getEnvSchemaModule()));
|
|
4499
4512
|
writeFileIfChanged(join(outDir, "index.ts"), compileNodeServer(options.target));
|
|
4500
|
-
} else
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4513
|
+
} else {
|
|
4514
|
+
const merged = collectRevalidate(readConfig(root), scan.pages);
|
|
4515
|
+
const emitIsr = !options.target && resolvedConfig?.command === "build" && !process.env.VOID_DEPLOY_PROJECT_ID && hasRevalidate(merged);
|
|
4516
|
+
isrRevalidate = emitIsr ? merged : void 0;
|
|
4517
|
+
const isr = emitIsr ? { runtimePath: resolveFile("#self/runtime/isr-cache") } : void 0;
|
|
4518
|
+
writeFileIfChanged(join(outDir, "entry.ts"), compileWorkerEntry(scan.queues.length > 0, remote, resolvedConfig?.build.assetsDir, (scan.websockets ?? []).map((route) => route.className), compileOptions.runtimeEnvPath, getEnvSchemaModule(), options.hasSandbox ? {
|
|
4519
|
+
bindingName: options.sandboxBindingName,
|
|
4520
|
+
className: options.sandboxClassName,
|
|
4521
|
+
runtimePath: sandboxRuntimePath
|
|
4522
|
+
} : false, shouldServeSpaFallback(), options.live, isr));
|
|
4523
|
+
}
|
|
4505
4524
|
},
|
|
4506
4525
|
resolveId: {
|
|
4507
4526
|
filter: { id: RESOLVE_ID_FILTER },
|
|
@@ -4525,7 +4544,7 @@ function routingPlugin(root, options) {
|
|
|
4525
4544
|
}
|
|
4526
4545
|
if (id !== VIRTUAL_ROUTES_ID) return;
|
|
4527
4546
|
if (!scan) await rescan();
|
|
4528
|
-
return compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, compileOptions, getPagesCompileOptions());
|
|
4547
|
+
return compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, ssr, compileOptions, getPagesCompileOptions(), isrRevalidate);
|
|
4529
4548
|
}
|
|
4530
4549
|
},
|
|
4531
4550
|
configureServer(devServer) {
|
|
@@ -4799,6 +4818,20 @@ export default {
|
|
|
4799
4818
|
function hasBinding(list, name) {
|
|
4800
4819
|
return Array.isArray(list) && list.some((b) => b.binding === name);
|
|
4801
4820
|
}
|
|
4821
|
+
/**
|
|
4822
|
+
* Decide whether to inject a Workers AI binding into the built wrangler config.
|
|
4823
|
+
*
|
|
4824
|
+
* Build-only: dev/miniflare has no local Workers AI, so serve must never bind
|
|
4825
|
+
* `env.AI` (dev uses the P2 `__VOID_TOKEN` proxy path instead).
|
|
4826
|
+
*
|
|
4827
|
+
* `!resolvedAi` is load-bearing: mergeBindings' return is defu-merged over the
|
|
4828
|
+
* resolved root-wrangler config and wins, so skipping when the user already
|
|
4829
|
+
* declared an `ai` binding avoids clobbering theirs. `!resultAi` is harmless
|
|
4830
|
+
* defense-in-depth (nothing else in mergeBindings sets `result.ai`).
|
|
4831
|
+
*/
|
|
4832
|
+
function shouldBindWorkersAi(command, needsAI, resolvedAi, resultAi) {
|
|
4833
|
+
return needsAI && command === "build" && !resultAi && !resolvedAi;
|
|
4834
|
+
}
|
|
4802
4835
|
const CLOUDFLARE_BUILTIN_IMPORT = /^cloudflare:/;
|
|
4803
4836
|
const SANDBOX_SDK_IMPORT = "@cloudflare/sandbox";
|
|
4804
4837
|
const SANDBOX_SDK_IMPORT_FILTER = /^@cloudflare\/sandbox$/;
|
|
@@ -4916,8 +4949,8 @@ const STAGING_API_URL = "https://api.staging.void.cloud";
|
|
|
4916
4949
|
*/
|
|
4917
4950
|
async function runAiSetupPrompt(root, token, staging, server) {
|
|
4918
4951
|
const { select, text, isCancel, log } = await import("./agents-Bmr5tFFb.mjs").then((n) => n.C);
|
|
4919
|
-
const { PlatformClient } = await import("./client-
|
|
4920
|
-
const { writeProjectConfig } = await import("./client-
|
|
4952
|
+
const { PlatformClient } = await import("./client-C9FG6Vzc.mjs").then((n) => n.r);
|
|
4953
|
+
const { writeProjectConfig } = await import("./client-C9FG6Vzc.mjs").then((n) => n.y);
|
|
4921
4954
|
const { inferDefaultSlug } = await import("./resolve-project-D2HI3TrG.mjs").then((n) => n.i);
|
|
4922
4955
|
const client = new PlatformClient(token, staging ? STAGING_API_URL : DEFAULT_API_URL);
|
|
4923
4956
|
let projects;
|
|
@@ -4944,8 +4977,8 @@ async function runAiSetupPrompt(root, token, staging, server) {
|
|
|
4944
4977
|
let projectId;
|
|
4945
4978
|
let slug;
|
|
4946
4979
|
if (result === "__create__") {
|
|
4947
|
-
const { validateProjectSlug } = await import("./create-project-
|
|
4948
|
-
const { createProjectWithSlugRetry } = await import("./create-project-
|
|
4980
|
+
const { validateProjectSlug } = await import("./create-project-CjYX23M_.mjs").then((n) => n.a);
|
|
4981
|
+
const { createProjectWithSlugRetry } = await import("./create-project-CjYX23M_.mjs").then((n) => n.t);
|
|
4949
4982
|
let created;
|
|
4950
4983
|
try {
|
|
4951
4984
|
created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
|
|
@@ -5200,6 +5233,12 @@ function voidPlugin(options) {
|
|
|
5200
5233
|
binding: r2Name,
|
|
5201
5234
|
bucket_name: "default"
|
|
5202
5235
|
}];
|
|
5236
|
+
if (shouldBindWorkersAi(viteCommand, bindings.needsAI, resolved.ai, result.ai)) result.ai = { binding: "AI" };
|
|
5237
|
+
if (config.ai?.gateway) {
|
|
5238
|
+
const vars = result.vars ?? {};
|
|
5239
|
+
vars.__VOID_AI_GATEWAY = config.ai.gateway;
|
|
5240
|
+
result.vars = vars;
|
|
5241
|
+
}
|
|
5203
5242
|
if (queues.length > 0) result.queues = {
|
|
5204
5243
|
producers: queues.map((q) => ({
|
|
5205
5244
|
queue: q.name,
|
|
@@ -5579,4 +5618,4 @@ function voidPlugin(options) {
|
|
|
5579
5618
|
];
|
|
5580
5619
|
}
|
|
5581
5620
|
//#endregion
|
|
5582
|
-
export { VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, voidPlugin };
|
|
5621
|
+
export { VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled, shouldBindWorkersAi, voidPlugin };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { a as join, c as resolve, i as isAbsolute, n as dirname, s as relative, t as basename } from "./pathe.M-eThtNZ-CQzLbt4c.mjs";
|
|
2
2
|
import { A as text, D as outro, E as note, S as confirm, T as log, a as cliTitle, j as isCancel, k as select, n as getAgentById, r as getPackageDir, t as detectAgents, w as intro, x as cancel } from "./agents-Bmr5tFFb.mjs";
|
|
3
3
|
import { n as readProjectPaths } from "./project-paths-tpdR1mJR.mjs";
|
|
4
|
-
import { S as writeProjectConfig, b as readProjectConfig, f as getToken, m as isStagingMode, n as PlatformClient } from "./client-
|
|
4
|
+
import { S as writeProjectConfig, b as readProjectConfig, f as getToken, m as isStagingMode, n as PlatformClient } from "./client-C9FG6Vzc.mjs";
|
|
5
5
|
import { n as ensureProjectTsconfig, t as createProjectTsconfig } from "./project-tsconfig-D9uSVVpA.mjs";
|
|
6
|
-
import { c as getDatabaseDialect, f as readConfig } from "./config-
|
|
6
|
+
import { c as getDatabaseDialect, f as readConfig } from "./config-BcAeIPe3.mjs";
|
|
7
7
|
import { r as detectFramework } from "./plugin-inference-CJxi_fWI.mjs";
|
|
8
8
|
import { r as parseDotenvFile, t as expandDotenv } from "./dotenv-D_UbC_vc.mjs";
|
|
9
9
|
import { t as MagicString } from "./magic-string.es-ZQjdJFFn.mjs";
|
|
10
10
|
import { n as writeDrizzleConfig } from "./config-BdUctCZD.mjs";
|
|
11
|
-
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-
|
|
12
|
-
import { t as promptForLoginToken } from "./login-
|
|
11
|
+
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-CjYX23M_.mjs";
|
|
12
|
+
import { t as promptForLoginToken } from "./login-CrOTnR_6.mjs";
|
|
13
13
|
import { r as formatProjectCommand } from "./preset-CVvwCeIy.mjs";
|
|
14
14
|
import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-CW8LB6g_.mjs";
|
|
15
15
|
import { createRequire } from "node:module";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D as outro, T as log, a as cliTitle, u as import_picocolors, w as intro, x as cancel } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
-
import { S as writeProjectConfig, b as readProjectConfig, d as getSiteDomain, f as getToken, n as PlatformClient } from "./client-
|
|
3
|
-
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-
|
|
2
|
+
import { S as writeProjectConfig, b as readProjectConfig, d as getSiteDomain, f as getToken, n as PlatformClient } from "./client-C9FG6Vzc.mjs";
|
|
3
|
+
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-CjYX23M_.mjs";
|
|
4
4
|
import { r as resolveProjectBySlug } from "./resolve-project-D2HI3TrG.mjs";
|
|
5
5
|
//#region src/cli/link.ts
|
|
6
6
|
async function runLink(root, slug) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as outro, T as log, a as cliTitle, c as ensureUtc, f as tablePrefix, s as dim, u as import_picocolors, w as intro } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
-
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-
|
|
2
|
+
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-C9FG6Vzc.mjs";
|
|
3
3
|
import { r as resolveProjectBySlug } from "./resolve-project-D2HI3TrG.mjs";
|
|
4
4
|
//#region src/cli/list.ts
|
|
5
5
|
async function runListCommand(root, slug) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as outro, T as log, a as cliTitle, j as isCancel, k as select, o as createSpinner, u as import_picocolors, w as intro, x as cancel } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
-
import { _ as runLogin, a as isExpiredTokenError, f as getToken, g as removeToken, m as isStagingMode, n as PlatformClient, p as getTokenSource, v as saveToken } from "./client-
|
|
2
|
+
import { _ as runLogin, a as isExpiredTokenError, f as getToken, g as removeToken, m as isStagingMode, n as PlatformClient, p as getTokenSource, v as saveToken } from "./client-C9FG6Vzc.mjs";
|
|
3
3
|
//#region src/cli/login.ts
|
|
4
4
|
async function promptForLoginToken(root = process.cwd()) {
|
|
5
5
|
const provider = await select({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as outro, T as log, a as cliTitle, s as dim, u as import_picocolors, w as intro } from "./agents-Bmr5tFFb.mjs";
|
|
2
|
-
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-
|
|
2
|
+
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-C9FG6Vzc.mjs";
|
|
3
3
|
//#region src/cli/logs.ts
|
|
4
4
|
async function runLogsCommand(root, filter, range, deployment, level) {
|
|
5
5
|
console.log();
|