void 1.2.0 → 1.3.0
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/{account-cmd-CdUll_35.mjs → account-cmd-B4i71m7k.mjs} +3 -3
- package/dist/{application-analysis-fEqoSeMp.mjs → application-analysis-DYdVoMAY.mjs} +8 -6
- package/dist/{application-routing-DAhNP4u3.mjs → application-routing-C8EqRDfv.mjs} +3 -1
- package/dist/{auth-link-C87vGXM-.mjs → auth-link-BKwHPbdv.mjs} +3 -3
- package/dist/{auth-router-6I81r-ix.mjs → auth-router-DqLx8E0F.mjs} +2 -2
- package/dist/{better-auth-shared-D-6z0q0f.mjs → better-auth-shared-7FM3Uk2N.mjs} +48 -2
- package/dist/{build-cmd-ex1g-j_e.mjs → build-cmd-Dy4psnt1.mjs} +1 -1
- package/dist/{cache-oHzrnY3z.mjs → cache-DV37S6dl.mjs} +1 -1
- package/dist/{cancel-deploy-viAMD0Q_.mjs → cancel-deploy-DMPyu1Vt.mjs} +1 -1
- package/dist/{cf-build-output-BhVxldCw.mjs → cf-build-output-Bapzc_8Z.mjs} +102 -1
- package/dist/cf-build-output-DlBkWdNU.mjs +1 -0
- package/dist/cli/cli.mjs +41 -32
- package/dist/cli/cloudflare-operation-process.mjs +27 -6
- package/dist/cli/env-schema-probe.mjs +2 -2
- package/dist/{client-BEkdj1kx.mjs → client-BEMtySaV.mjs} +8 -1
- package/dist/client-DyxPQnF_.mjs +1 -0
- package/dist/{cloudflare-cmd-DMzCv12s.mjs → cloudflare-cmd-BaqIigwI.mjs} +1 -1
- package/dist/{cloudflare-connect-CCRTVg-I.mjs → cloudflare-connect-pNLQmr_e.mjs} +1 -1
- package/dist/{cloudflare-operations-DsSaw2BT.mjs → cloudflare-operations-PCM4wucv.mjs} +1 -1
- package/dist/{cloudflare-operations-Dh9dEHJj.mjs → cloudflare-operations-vP3b5CQf.mjs} +3 -3
- package/dist/config-BTu1o3Dc.mjs +49 -0
- package/dist/{config-DQfHOKh9.d.mts → config-Du88-7Y8.d.mts} +2 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-k7R2rPVA.mjs → connect-DwVsBvVh.mjs} +4 -4
- package/dist/{create-project-DTuy-l0z.mjs → create-project-CgrnvzyA.mjs} +1 -1
- package/dist/{create-project-DV71ol5d.mjs → create-project-CjzbBlTv.mjs} +1 -1
- package/dist/{db-DVOkLH5X.mjs → db-rvo64snS.mjs} +13 -13
- package/dist/{delete-BbP5eopu.mjs → delete-DWX6dP4M.mjs} +1 -1
- package/dist/deploy-CtHE2A3R.mjs +2 -0
- package/dist/{deploy-7H32EnUs.mjs → deploy-hRPvw8ci.mjs} +229 -69
- package/dist/{deploy-managed-static-DlvcvnQT.mjs → deploy-managed-static-CDYA2p3L.mjs} +30 -14
- package/dist/{deploy-transport-BzGEj0Ge.mjs → deploy-transport-JCxw7QDi.mjs} +3 -3
- package/dist/deploy.mjs +4 -3
- package/dist/{dispatch-DoUnxTNo.mjs → dispatch-OVLeWW8K.mjs} +71 -2
- package/dist/{domain-CA2wBgra.mjs → domain-CH5iBD9Y.mjs} +2 -2
- package/dist/{email-DXpCc77w.mjs → email-CbTO1l78.mjs} +58 -9
- package/dist/{email-cloudflare-D03g2TkS.mjs → email-cloudflare-B8-pq_-W.mjs} +106 -5
- package/dist/{env-DgOQ9_8S.mjs → env-BBdw236G.mjs} +3 -3
- package/dist/{env-BJjULvL0.mjs → env-BaMz0j7H.mjs} +6 -1
- package/dist/{env-validation-BmsdCZEk.mjs → env-validation-BfBVvBNe.mjs} +1 -1
- package/dist/{env-validation-Dwq3PJzK.mjs → env-validation-XcukUlFM.mjs} +1 -1
- package/dist/{gen-BfmcIi2g.mjs → gen-CCx3t2Ju.mjs} +1 -1
- package/dist/gen-TgXy93Rr.mjs +1 -0
- package/dist/{github-cmd-CY9LUqLh.mjs → github-cmd-BzkRLkbg.mjs} +1 -1
- package/dist/{handler-BbkSPzGF.d.mts → handler-CQv5YDS0.d.mts} +1 -1
- package/dist/{help-CxSlPpzJ.mjs → help-CKbrhZha.mjs} +16 -1
- package/dist/help-qOZr3wng.mjs +1 -0
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +317 -122
- package/dist/{info-7VDlhtyy.mjs → info-oBm8yK8J.mjs} +2 -2
- package/dist/{init-DxYyOs4-.mjs → init-CBp_uMve.mjs} +217 -197
- package/dist/{link-Ddmod1dZ.mjs → link-Dt_QXmM4.mjs} +2 -2
- package/dist/{list-MogaugiO.mjs → list-DF6asTdt.mjs} +2 -2
- package/dist/{live-Bt8Y_0bg.d.mts → live-CXJ9yC98.d.mts} +1 -1
- package/dist/{local-d1-BHBnKWRb.mjs → local-d1-CUhH3qtj.mjs} +1 -1
- package/dist/{login-Cttnagmm.mjs → login-BjSyhXlT.mjs} +2 -2
- package/dist/login-Cdo8Aco1.mjs +1 -0
- package/dist/{logs-CAszUWZI.mjs → logs-DmvBl6xA.mjs} +2 -2
- package/dist/{migrate-DyT2jJ8y.mjs → migrate-BXRHpYwR.mjs} +1 -1
- package/dist/migrate-COPncCGx.mjs +1 -0
- package/dist/nitro.mjs +2 -2
- package/dist/{node-WB7c2N4L.mjs → node-DtD7ZiPf.mjs} +4 -4
- package/dist/{operator-args-UnE8Y2eK.mjs → operator-args-BsJIYXaT.mjs} +8 -1
- package/dist/operator-cmd-DDiX7Y3f.mjs +1 -0
- package/dist/{operator-cmd-skshjMGl.mjs → operator-cmd-DjZKGGgN.mjs} +4 -3
- package/dist/pages/client.d.mts +21 -4
- package/dist/pages/client.mjs +174 -35
- package/dist/pages/index.d.mts +18 -2
- package/dist/pages/index.mjs +2 -52
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +9 -3
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/platform-args-BC8_hsDj.mjs +1 -0
- package/dist/{platform-args-DVbVClZl.mjs → platform-args-BMD2gjc_.mjs} +1 -1
- package/dist/{platform-auth-config-C-pm5Qzx.mjs → platform-auth-config-BgnuMbml.mjs} +3 -3
- package/dist/{platform-auth-protection-SHhvim1L.mjs → platform-auth-protection-NjRejttU.mjs} +2 -2
- package/dist/{platform-auth-recovery-DXVWs-wA.mjs → platform-auth-recovery-Ug12d9W5.mjs} +2 -2
- package/dist/{platform-cmd-PiNRkopU.mjs → platform-cmd-BYKLMPCn.mjs} +1 -1
- package/dist/{platform-cmd-D5I1beUX.mjs → platform-cmd-HByuZAO7.mjs} +4 -4
- package/dist/{platform-domain-jpmBfZeb.mjs → platform-domain-DLSQ8GF8.mjs} +2 -2
- package/dist/{platform-lifecycle-DyKmuNY6.mjs → platform-lifecycle-3dwFJmnq.mjs} +102 -40
- package/dist/{platform-lifecycle-DH3Yr1qQ.mjs → platform-lifecycle-BRqcxerG.mjs} +1 -1
- package/dist/{platform-management-7m-PLaPJ.mjs → platform-management-ZK6XcbCo.mjs} +1 -1
- package/dist/{platform-management--vDwSn35.mjs → platform-management-ZZ6bQM5j.mjs} +1 -1
- package/dist/{platform-recovery-BiNpZZab.mjs → platform-recovery-8vNE5dNN.mjs} +2 -2
- package/dist/{plugin-inference-DUjCd55H.mjs → plugin-inference-CeiB6BG5.mjs} +53 -18
- package/dist/{prepare-BcAE5Sdj.mjs → prepare-5BR7Splm.mjs} +1 -1
- package/dist/prepare-B3VrSF1Z.mjs +1 -0
- package/dist/{prepare-DA-17DhO.mjs → prepare-Dseww74N.mjs} +4 -4
- package/dist/{prerender-render-Cijv7UFo.mjs → prerender-render-CaShbHJ3.mjs} +13 -1
- package/dist/prerender-render.d.mts +1 -0
- package/dist/prerender-render.mjs +1 -1
- package/dist/{project-cmd-DA4K5faU.mjs → project-cmd-CjLNNxwe.mjs} +15 -15
- package/dist/{project-team-CQBNveX3.mjs → project-team-DE5drjcl.mjs} +1 -1
- package/dist/{project-token-CCalFyQf.mjs → project-token-XEYEXfiJ.mjs} +1 -1
- package/dist/{project-zero-trust-DPnkiEuT.mjs → project-zero-trust-6VPU8zmV.mjs} +1 -1
- package/dist/{protocol-BBDpJz3G.d.mts → protocol-BekmFxCI.d.mts} +2 -2
- package/dist/{provision-DtROpNNI.mjs → provision-B7UFrBH7.mjs} +1 -1
- package/dist/{provision-BFLCrnUp.mjs → provision-Chq0NRAV.mjs} +1 -1
- package/dist/{requests-BpH0kImL.mjs → requests-CG-Pj8ze.mjs} +1 -1
- package/dist/{rollback-CXS1tAa-.mjs → rollback-CIrm2txZ.mjs} +2 -2
- package/dist/{route-types-BZi26DVS.mjs → route-types--PAOzHlH.mjs} +49 -28
- package/dist/routes-stub.d.mts +22 -13
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/log.mjs +19 -1
- package/dist/runtime/routing.d.mts +2 -2
- package/dist/runtime/routing.mjs +4 -3
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{scan-8IzYXiU_.mjs → scan-N9WzdcAl.mjs} +302 -23
- package/dist/{secret-BbXHfLAt.mjs → secret-BL6g7mF5.mjs} +3 -3
- package/dist/static-asset-marker-Btf-6oCD.mjs +32 -0
- package/dist/{types-7AIz0OZu.d.mts → types-w72dljaA.d.mts} +6 -1
- package/dist/{version-metadata-tS39iW09.mjs → version-metadata-DmaZNTYW.mjs} +1 -1
- package/dist/worker-conditions-AWFRcFxR.mjs +11 -0
- package/dist/{wrangler-F96NnLyb.mjs → wrangler-CDiEBCdS.mjs} +2 -1
- package/dist/wrangler-DOPr4jyI.mjs +1 -0
- package/dist/{wrapper-D3sZyh2C.mjs → wrapper-CEiDeCqD.mjs} +6 -10
- package/dist/{ws-BH-im_tX.d.mts → ws-D1zWiB_P.d.mts} +1 -1
- package/docs/guide/auth.md +3 -1
- package/docs/guide/edge/static-assets.md +10 -0
- package/docs/guide/email/domains.md +1 -1
- package/docs/guide/email/receiving.md +2 -0
- package/docs/guide/email/sending.md +1 -1
- package/docs/guide/pages-routing/actions-and-forms.md +19 -13
- package/docs/guide/pages-routing/markdown.md +2 -0
- package/docs/guide/pages-routing/overview.md +34 -3
- package/docs/guide/platform/administration/email.md +18 -0
- package/docs/guide/platform/installation/prerequisites.md +9 -4
- package/docs/guide/platform/installation/uninstall.md +2 -0
- package/docs/guide/queues.md +13 -1
- package/docs/guide/quickstart.md +26 -1
- package/docs/guide/sandboxes.md +2 -2
- package/docs/guide/server-routing.md +38 -2
- package/docs/guide/type-safety.md +7 -7
- package/docs/guide/websockets.md +4 -2
- package/docs/reference/api/pages.md +4 -4
- package/docs/reference/cli/email.md +13 -0
- package/docs/reference/cli/platform-email.md +2 -2
- package/docs/reference/cli.md +2 -1
- package/docs/reference/structure.md +3 -1
- package/package.json +8 -7
- package/sandbox.Dockerfile +1 -1
- package/templates/assets/icons.svg +49 -0
- package/templates/assets/react.svg +1 -0
- package/templates/assets/solid.svg +1 -0
- package/templates/assets/stack.svg +35 -0
- package/templates/assets/svelte.svg +1 -0
- package/templates/assets/void.svg +5 -0
- package/templates/assets/vue.svg +1 -0
- package/dist/cf-build-output-BJHuSsVN.mjs +0 -1
- package/dist/client-BiRDZTSd.mjs +0 -1
- package/dist/config-CyUJzi3q.mjs +0 -32
- package/dist/deploy-CE0Ev0Ob.mjs +0 -2
- package/dist/gen-NrOlWZaG.mjs +0 -1
- package/dist/help-BeAFFE5C.mjs +0 -1
- package/dist/login-DgDwlKc_.mjs +0 -1
- package/dist/migrate-n49ZeS1X.mjs +0 -1
- package/dist/operator-cmd-d2MvJOrl.mjs +0 -1
- package/dist/parse-filename-DioPHiR9.mjs +0 -77
- package/dist/platform-args-kQrgxScY.mjs +0 -1
- package/dist/prepare-C4I0f--h.mjs +0 -1
- package/dist/wrangler-BLb3_luP.mjs +0 -1
|
@@ -3,7 +3,8 @@ import { n as readProjectPaths } from "./project-paths-DGu_QZ_Q.mjs";
|
|
|
3
3
|
import { l as getDatabaseDialect, p as readConfig } from "./config-DHgSEWT7.mjs";
|
|
4
4
|
import { n as isIdentifier, r as isLiteral } from "./ast-CsZ_q_gc.mjs";
|
|
5
5
|
import { t as MagicString } from "./dist-Cegxq8gs.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { c as voidDbBundlerPlugin, r as cloudflareQueueName, t as generateQueueResolverSource } from "./dispatch-OVLeWW8K.mjs";
|
|
7
|
+
import { t as WORKER_CONDITIONS } from "./worker-conditions-AWFRcFxR.mjs";
|
|
7
8
|
import { createRequire } from "node:module";
|
|
8
9
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -237,14 +238,6 @@ async function bundleMigrationHandler(root, workerDir, handlerPath, dialect) {
|
|
|
237
238
|
if (isPostgresql || isMysql) patchWorkerRequireBundle(outDir, isPostgresql ? "PostgreSQL" : "MySQL", "migration bundle");
|
|
238
239
|
for (const file of readdirSync(outDir)) copyFileSync(join(outDir, file), join(workerDir, file));
|
|
239
240
|
}
|
|
240
|
-
const WORKER_CONDITIONS = [
|
|
241
|
-
"workerd",
|
|
242
|
-
"worker",
|
|
243
|
-
"browser",
|
|
244
|
-
"module",
|
|
245
|
-
"import",
|
|
246
|
-
"default"
|
|
247
|
-
];
|
|
248
241
|
const SQL_WORKER_EXTERNAL = [
|
|
249
242
|
/^cloudflare:/,
|
|
250
243
|
/^node:/,
|
|
@@ -414,6 +407,7 @@ async function bundleEntry(root, entry) {
|
|
|
414
407
|
await build({
|
|
415
408
|
root: tmpDir,
|
|
416
409
|
logLevel: "silent",
|
|
410
|
+
resolve: { conditions: [...WORKER_CONDITIONS, "production"] },
|
|
417
411
|
build: {
|
|
418
412
|
outDir,
|
|
419
413
|
emptyOutDir: true,
|
|
@@ -608,7 +602,9 @@ function generateHandlersSource(root, features, dialect) {
|
|
|
608
602
|
lines.push(`import queueHandler${i} from "${absPath}";`);
|
|
609
603
|
}
|
|
610
604
|
lines.push("");
|
|
611
|
-
|
|
605
|
+
const queueNames = features.queues.map((queue) => queue.name);
|
|
606
|
+
const cloudflareNames = features.cloudflareQueueNames;
|
|
607
|
+
lines.push(generateQueueResolverSource(queueNames, cloudflareNames && queueNames.map((name) => cloudflareQueueName(name, cloudflareNames))));
|
|
612
608
|
lines.push("");
|
|
613
609
|
lines.push(scoped ? "async function __runQueue(batch, env, ctx) {" : "export async function handleQueue(batch, env, ctx) {");
|
|
614
610
|
lines.push(" const queueSuffix = batch.queue;");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as StandardSchemaV1 } from "./standard-schema-Fo_vCAZh.mjs";
|
|
2
2
|
import { r as AuthUser } from "./auth-DkcFflXV.mjs";
|
|
3
|
-
import { a as CloudEnv } from "./handler-
|
|
3
|
+
import { a as CloudEnv } from "./handler-CQv5YDS0.mjs";
|
|
4
4
|
import { WebSocketRouteMap } from "void/routes";
|
|
5
5
|
//#region src/runtime/ws.d.ts
|
|
6
6
|
type MaybePromise<T> = T | Promise<T>;
|
package/docs/guide/auth.md
CHANGED
|
@@ -129,6 +129,8 @@ Local development needs no secret setup. To preview a production build locally,
|
|
|
129
129
|
|
|
130
130
|
Responses to signed-in requests get `Cache-Control: no-store`, so neither the browser cache nor a shared cache keeps a user's data. A route keeps its own policy when it sets `no-store`, or `private` together with `no-cache`. To answer repeat requests with `304`, use `private, no-cache` with Hono's [`etag()`](https://hono.dev/docs/middleware/builtin/etag) middleware. If you set the `ETag` yourself, make it differ per user, so the `304` doesn't reuse another account's page. The browser cache keeps a copy of a `private, no-cache` page, so the Back button can show it again after the user signs out. Keep the default `no-store` for pages that must not stay in the browser cache.
|
|
131
131
|
|
|
132
|
+
Static files from your build and `public/` keep their own cache policy for signed-in requests, so the browser reuses cached JavaScript and CSS. When your app handles the request, the policy is marked `private`, and a request that refreshes the session cookie gets `no-store`.
|
|
133
|
+
|
|
132
134
|
`POST`, `PUT`, `PATCH` and `DELETE` requests and WebSocket connections from another origin don't use the signed-in session unless that origin is in `trustedOrigins`. If a separate frontend calls your app, add its origin there (see [Customization](#customization)). If your routes use their own cookies, check the request `Origin` yourself, for example with Hono's [`csrf()`](https://hono.dev/docs/middleware/builtin/csrf) middleware.
|
|
133
135
|
|
|
134
136
|
Deployed apps on Cloudflare limit auth requests per client IP with Better Auth's defaults, for example 3 sign-in attempts per 10 seconds. Each Worker instance keeps its own count. Change or turn off the limits with `rateLimit` in `auth.ts`. To share one count across instances, set `rateLimit: { storage: 'database' }`, then run `void db generate` for a direct Cloudflare deploy.
|
|
@@ -184,7 +186,7 @@ For the full set of available options, see the official [Better Auth options ref
|
|
|
184
186
|
|
|
185
187
|
## Database and Migrations
|
|
186
188
|
|
|
187
|
-
Auth tables live alongside your app's tables. During local development, Void creates them automatically.
|
|
189
|
+
Auth tables live alongside your app's tables. During local development, Void creates them automatically. While the dev server runs, saving `auth.ts`, or a local file it imports, updates the auth schema Void generates for your app. New auth tables and columns are created in the local database the next time the dev server starts.
|
|
188
190
|
|
|
189
191
|
Void platforms create auth tables automatically. For a direct Cloudflare deploy, include them in your checked-in migrations:
|
|
190
192
|
|
|
@@ -37,6 +37,16 @@ With `void deploy --platform cloudflare`, generated JavaScript bundles with cont
|
|
|
37
37
|
|
|
38
38
|
Use [Custom Headers](./headers) to choose a cache policy for other files. Apply immutable caching only to URLs that change whenever their content changes.
|
|
39
39
|
|
|
40
|
+
Cloudflare serves these fingerprinted JavaScript bundles without starting your Worker, so they do not count as Worker requests, when your app:
|
|
41
|
+
|
|
42
|
+
- has no global middleware
|
|
43
|
+
- has no header, redirect, rewrite or fallback rules, and no `routing.notFound` setting
|
|
44
|
+
- uses the default `base` of `/`
|
|
45
|
+
- has no route or page that matches paths in the assets directory (`assets/` by default)
|
|
46
|
+
- builds at most 99 fingerprinted bundles
|
|
47
|
+
|
|
48
|
+
Otherwise these bundles go through your Worker and keep the same caching.
|
|
49
|
+
|
|
40
50
|
## Non-hashed assets
|
|
41
51
|
|
|
42
52
|
Other static files, such as `index.html` and `favicon.ico`, are cached until the next deploy. You do not need to purge them manually.
|
|
@@ -16,7 +16,7 @@ void email domain add acme.com
|
|
|
16
16
|
|
|
17
17
|
`add` opens a Cloudflare API-token template. Restrict the token to the selected account and mail zone before creating it; Workers Scripts permission applies across that account. The CLI accepts a masked paste or a newly copied token and asks you to confirm those restrictions. The platform encrypts the credential for the zone connection, so projects sharing that zone do not need separate ingress Workers.
|
|
18
18
|
|
|
19
|
-
Platform-managed custom inbound email requires the apex of a Cloudflare zone. Cloudflare’s catch-all only covers that apex, so a subdomain of the selected zone cannot receive arbitrary addresses. `add` refuses to register a new apex that already has MX records, or whose catch-all already routes elsewhere, so it never takes over mail hosted with another provider such as Microsoft 365 or Google Workspace. Use an apex that has no mail yet, or the platform’s shared mail address. Running `add` again for a registered apex, for example to renew its token, keeps working. Each custom apex belongs to one project; a project can register more than one apex.
|
|
19
|
+
Platform-managed custom inbound email requires the apex of a Cloudflare zone. Cloudflare’s catch-all only covers that apex, so a subdomain of the selected zone cannot receive arbitrary addresses. `add` refuses to register a new apex that already has MX records, or whose catch-all already routes elsewhere, so it never takes over mail hosted with another provider such as Microsoft 365 or Google Workspace. Use an apex that has no mail yet, or the platform’s shared mail address. To only send from an apex that keeps its current mail provider, ask your platform administrator to register it as [outbound-only](../platform/administration/email.md#sending-from-a-domain-that-already-receives-mail). Running `add` again for a registered apex, for example to renew its token, keeps working. Each custom apex belongs to one project; a project can register more than one apex.
|
|
20
20
|
|
|
21
21
|
If setup is interrupted, use `void email domain status <domain>` to inspect the saved operation before retrying.
|
|
22
22
|
|
|
@@ -94,6 +94,8 @@ deployed `email/` handlers without per-project DNS setup once the platform has v
|
|
|
94
94
|
handlers once its inbound readiness is `ready`. Use `void email domain status`
|
|
95
95
|
to check current provider routing and any remaining setup steps.
|
|
96
96
|
|
|
97
|
+
A project with an [email alias](../../reference/cli/email.md#void-email-alias) also receives at `<alias>+anything@<mail domain>`. Routing ignores which prefix was used: with the slug `acme-store` and the alias `acme`, both `acme-store+support@…` and `acme+support@…` reach `email/support.ts`.
|
|
98
|
+
|
|
97
99
|
For direct deployments, follow [Your own Cloudflare account](./domains.md#your-own-cloudflare-account) to configure inbound addresses.
|
|
98
100
|
|
|
99
101
|
The local dev server provides the outbound email inbox but has no inbound email trigger. Test inbound handlers with `createInboundTestHarness` below.
|
|
@@ -84,7 +84,7 @@ You can send to at most 50 recipients across `to`, `cc`, and `bcc`. Use standard
|
|
|
84
84
|
|
|
85
85
|
`Address` accepts either a string (`"hello@acme.dev"` or `"Name <hello@acme.dev>"`) or an object (`{ email, name? }`). Unicode display names are supported.
|
|
86
86
|
|
|
87
|
-
On the platform the sender is pinned to your project. `from` must be your project's own platform address — `<project-slug>@<mail-domain>` or `<project-slug>+<tag>@<mail-domain>`, optionally with a display name — or any address on a domain registered with `void email domain add` (see [Your own domain on the platform](./domains.md#your-own-domain-on-the-platform)). For example, if your platform's mail domain is `mail.example.com`, you can use `Acme <acme+noreply@mail.example.com>`. Anything else is rejected with `INVALID_FROM`. Omit `from` and Void fills in `<project-slug>+noreply@<mail-domain>` for you.
|
|
87
|
+
On the platform the sender is pinned to your project. `from` must be your project's own platform address — `<project-slug>@<mail-domain>` or `<project-slug>+<tag>@<mail-domain>`, optionally with a display name — or any address on a domain registered with `void email domain add` (see [Your own domain on the platform](./domains.md#your-own-domain-on-the-platform)). For example, if your platform's mail domain is `mail.example.com`, you can use `Acme <acme+noreply@mail.example.com>`. Anything else is rejected with `INVALID_FROM`. Omit `from` and Void fills in `<project-slug>+noreply@<mail-domain>` for you. If the project owner set an [email alias](../../reference/cli/email.md#void-email-alias), `<alias>@<mail-domain>` and `<alias>+<tag>@<mail-domain>` are accepted too; the default stays the slug address.
|
|
88
88
|
|
|
89
89
|
On your own Cloudflare account, `from` defaults to `email.from` from `void.config.ts` and must be on a domain your account can send from; Cloudflare rejects any other sender and `sendEmail` reports it as `INVALID_FROM`.
|
|
90
90
|
|
|
@@ -147,19 +147,23 @@ The types are inferred from your action's `withValidator()` schema in the compan
|
|
|
147
147
|
|
|
148
148
|
`useForm` returns a reactive object with:
|
|
149
149
|
|
|
150
|
-
| Property / Method | Purpose
|
|
151
|
-
| -------------------------------- |
|
|
152
|
-
| `data` / `setData` | Current form values, typed to match the action's body schema.
|
|
153
|
-
| `errors` | Field-level validation errors, keys typed to body field names.
|
|
154
|
-
| `error` | Action error, or `null`.
|
|
155
|
-
| `post`, `put`, `patch`, `delete` | Submit the form with that method. In React these are native form action callbacks.
|
|
156
|
-
| `pending` | `true` while the submission is in flight.
|
|
157
|
-
| `hasChanges` | `true` if form data differs from
|
|
158
|
-
| `wasSuccessful` | `true` after a successful submission. Stays `true` until the next submission.
|
|
159
|
-
| `recentlySuccessful` | `true` for 2 seconds after a successful submission. Useful for flash messages.
|
|
160
|
-
| `reset(...fields)` | Reset form data to
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
150
|
+
| Property / Method | Purpose |
|
|
151
|
+
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `data` / `setData` | Current form values, typed to match the action's body schema. |
|
|
153
|
+
| `errors` | Field-level validation errors, keys typed to body field names. |
|
|
154
|
+
| `error` | Action error, or `null`. |
|
|
155
|
+
| `post`, `put`, `patch`, `delete` | Submit the form with that method. In React these are native form action callbacks. |
|
|
156
|
+
| `pending` | `true` while the submission is in flight. |
|
|
157
|
+
| `hasChanges` | `true` if form data differs from the current defaults. After a successful submit, defaults update to the submitted values so `hasChanges` becomes `false`. |
|
|
158
|
+
| `wasSuccessful` | `true` after a successful submission. Stays `true` until the next submission. |
|
|
159
|
+
| `recentlySuccessful` | `true` for 2 seconds after a successful submission. Useful for flash messages. |
|
|
160
|
+
| `reset(...fields)` | Reset form data to the current defaults (last submitted values after success). Field names autocomplete. Pass `{ initial: true }` first to reset to the values passed to `useForm`. |
|
|
161
|
+
| `resetOnSuccess` (option) | When `true`, a successful submit resets both form data and defaults to the mount-time values. Useful for create forms that should clear after save. |
|
|
162
|
+
| `setError(field, message)` | Set a client-side validation error on a field. |
|
|
163
|
+
| `clearErrors(...fields)` | Clear validation errors. Field names autocomplete. |
|
|
164
|
+
| `clearError()` | Clear `error`. |
|
|
165
|
+
|
|
166
|
+
Use `setError()` to display errors from your own client-side validation. Setting an error preserves errors on other fields. Changing a field clears that field's validation error automatically (`setData` in React and Solid, or assigning to `data` in Vue and Svelte).
|
|
163
167
|
|
|
164
168
|
For a native React form, use `form.post`, `form.put`, `form.patch`, or `form.delete` as a native form action. For an awaitable mutation, use `action()`. In Vue, Svelte, and Solid, form submissions return `Promise<void>`; catch thrown errors or use your framework's error handling.
|
|
165
169
|
|
|
@@ -171,6 +175,8 @@ const form = useForm('/users/:id', { name: '' }, { params: { id: '42' } });
|
|
|
171
175
|
<Form form={form} method="put">{/* submits to /users/42 */}</Form>
|
|
172
176
|
```
|
|
173
177
|
|
|
178
|
+
Create forms often need empty fields again after a successful save. Either pass `resetOnSuccess: true` in the third argument, or call `form.reset({ initial: true })` when `form.wasSuccessful` becomes `true`.
|
|
179
|
+
|
|
174
180
|
## Named Actions
|
|
175
181
|
|
|
176
182
|
When a page needs multiple mutations, such as updating and deleting a user on the same page, export `actions` (plural) instead of `action`:
|
|
@@ -241,6 +241,8 @@ import pages from '@void/md/pages';
|
|
|
241
241
|
// [{ path: "/docs/getting-started", title: "Getting Started", frontmatter: {...}, headings: [...] }, ...]
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
+
The list holds only the pages for the current [environment](./overview.md#environment-only-pages): `.dev` pages on the dev server, `.prod` pages in builds. The suffix is dropped from `path`: `debug.dev.md` is listed as `/debug`.
|
|
245
|
+
|
|
244
246
|
Each entry has this shape:
|
|
245
247
|
|
|
246
248
|
```ts
|
|
@@ -94,13 +94,44 @@ Pages can be flat files such as `about.vue` or directory-based routes such as `a
|
|
|
94
94
|
|
|
95
95
|
<PagesFileTree />
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Keep one file per route. Void reports an error when two page files resolve to the same path, such as `about.vue` and `about/index.vue`, or the same page in two route groups.
|
|
98
|
+
|
|
99
|
+
Each page can have a companion `.server.ts`, `.server.tsx`, `.server.js`, `.server.jsx`, `.server.mts`, or `.server.mjs` file that runs exclusively on the server. Use `.server.tsx` or `.server.jsx` when the companion contains JSX (see [JSX handlers](../server-routing.md#jsx-handlers) for the JSX runtime). A companion belongs to its matching page and does not create a separate route:
|
|
100
|
+
|
|
101
|
+
| File | Role |
|
|
102
|
+
| ---------------------- | ------------------------------ |
|
|
103
|
+
| `pages/foo.tsx` | Page component at `/foo` |
|
|
104
|
+
| `pages/foo.server.tsx` | Server companion for that page |
|
|
105
|
+
|
|
106
|
+
A companion can export:
|
|
98
107
|
|
|
99
108
|
- A [**loader**](./loaders), which runs on `GET` and returns the data that becomes the page component's props
|
|
100
109
|
- [**Actions**](./actions-and-forms), which handle mutations from forms and programmatic calls. Export a single `action` or multiple [named actions](./actions-and-forms#named-actions) when a page has several mutations
|
|
101
110
|
- `ssr = false` to opt a route out of server-rendered component HTML while keeping server loaders and client-side routing
|
|
102
111
|
|
|
103
|
-
File-based routing rules are the same as [server routing](../server-routing.md): `[param]` for dynamic segments, `[...param]` for catch-all, `(group)/` for route groups.
|
|
112
|
+
File-based routing rules are the same as [server routing](../server-routing.md): `[param]` for dynamic segments, `[...param]` for catch-all, `(group)/` for route groups, and a `.dev` or `.prod` suffix for [environment-only pages](#environment-only-pages).
|
|
113
|
+
|
|
114
|
+
### Environment-only pages
|
|
115
|
+
|
|
116
|
+
Add a `.dev` or `.prod` suffix before the extension to include a page in only one environment. The suffix is not part of the URL:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
pages/
|
|
120
|
+
about.tsx → /about, always
|
|
121
|
+
debug.dev.tsx → /debug, development only
|
|
122
|
+
stats.prod.tsx → /stats, production only
|
|
123
|
+
home.dev.tsx → /home in development
|
|
124
|
+
home.prod.tsx → /home in production
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`.dev` pages run only on the dev server; `.prod` pages run in builds, deployments, and production previews.
|
|
128
|
+
|
|
129
|
+
- A `.dev` page and a `.prod` page can share a URL. A plain page and a suffixed page for the same URL is an error wherever both run: `home.tsx` with `home.dev.tsx` fails on the dev server, and `home.tsx` with `home.prod.tsx` fails the build.
|
|
130
|
+
- The suffix goes **before** `.island`: `chart.dev.island.tsx` is a development-only island page. `chart.island.dev.tsx` is not an island page.
|
|
131
|
+
- A companion repeats the suffix: `home.dev.server.ts` belongs to `home.dev.tsx`.
|
|
132
|
+
- Suffixes apply to page files only. Layouts take no suffix.
|
|
133
|
+
- A resource used only by `.dev` pages and their companions is not provisioned for production.
|
|
134
|
+
- The dev server and builds generate types for their own environment. `void prepare` generates types for both.
|
|
104
135
|
|
|
105
136
|
## How Navigation Works
|
|
106
137
|
|
|
@@ -208,7 +239,7 @@ import { useRouter } from '@void/vue'; // or "@void/react", "@void/svelte", "@vo
|
|
|
208
239
|
|
|
209
240
|
const router = useRouter();
|
|
210
241
|
router.visit('/users');
|
|
211
|
-
router.refresh(); // re-fetch current page props
|
|
242
|
+
router.refresh(); // re-fetch current page props, keeping the same history entry
|
|
212
243
|
router.visit('/logout', { method: 'POST' }); // non-GET navigation
|
|
213
244
|
```
|
|
214
245
|
|
|
@@ -10,6 +10,8 @@ These commands apply to a platform that enables email. Every project can send fr
|
|
|
10
10
|
|
|
11
11
|
Shared inbound mail uses one exact routing rule per receiving project and enables Cloudflare’s per-zone plus addressing. Creating a project or deploying an app that only sends mail consumes no inbound rule. Existing rules and the apex catch-all remain in place. Cloudflare normally allows [200 routing rules per domain](https://developers.cloudflare.com/email-service/platform/limits/); remove unused rules or request a higher limit if the shared domain reaches capacity. An unrelated rule for a project’s base address or a plus address blocks its setup until that conflict is removed.
|
|
12
12
|
|
|
13
|
+
A project owner can give the shared address one permanent, shorter name with `void email alias <name>`. A receiving project with an alias uses two rules, one for the slug and one for the alias, because the slug address keeps working. Setting an alias is refused while a conflicting rule exists or the domain is at its rule limit, and the alias is released only when the project is deleted.
|
|
14
|
+
|
|
13
15
|
If recipient creation is interrupted, inspect its retained intent:
|
|
14
16
|
|
|
15
17
|
```sh
|
|
@@ -150,3 +152,19 @@ Run recovery with the same platform version that created the persisted intent.
|
|
|
150
152
|
`applied` continues without replaying the write; `not-applied` permits that exact
|
|
151
153
|
step to retry. Secret rotation keeps its staged generation, and removal resumes
|
|
152
154
|
from the unresolved cleanup step. Age alone never authorizes a retry.
|
|
155
|
+
|
|
156
|
+
### Sending from a domain that already receives mail
|
|
157
|
+
|
|
158
|
+
If an apex already receives mail with another provider, such as Microsoft 365 or Google Workspace, register it for sending only:
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
void platform email domain-add brand.example --project hr-portal --outbound-only
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The project can then send from any address on the apex, such as `support@brand.example`. It cannot receive mail there: the MX records, the apex SPF record, and incoming mail stay with the current provider.
|
|
165
|
+
|
|
166
|
+
- Cloudflare Email Sending must be available, which needs Workers Paid. Without it, setup is blocked instead of falling back to verified destinations only. Upgrade, then run `domain-sync`.
|
|
167
|
+
- Email Sending adds its own records on `cf-bounce.<domain>` and `_dmarc.<domain>`. If Cloudflare reports that existing records conflict with them, for example several DMARC records, setup is blocked and the error lists each record. Fix them, then run `domain-sync`.
|
|
168
|
+
- Only administrators can register an outbound-only domain, and it must be a zone apex. The platform's shared mail zone cannot be outbound-only.
|
|
169
|
+
- `domain-rotate-secret` does not apply. `domain-remove` stops sending through the platform and leaves the MX records alone.
|
|
170
|
+
- To switch an outbound-only domain to platform-managed inbound mail, or back, remove it first and add it again.
|
|
@@ -13,16 +13,17 @@ To run a Void platform, you need:
|
|
|
13
13
|
|
|
14
14
|
Void creates the Workers, storage, queues, routing, and database tables through the CLI.
|
|
15
15
|
|
|
16
|
-
Workers for Platforms requires
|
|
16
|
+
Workers for Platforms requires its own paid plan. Analytics Engine is available on Workers Free, but you must enable it for the account. Review [Analytics Engine pricing and allowances](https://developers.cloudflare.com/analytics/analytics-engine/pricing/). Your database and Cloudflare usage are billed separately.
|
|
17
17
|
|
|
18
18
|
## Prepare Your Cloudflare Account and Domain
|
|
19
19
|
|
|
20
20
|
In the [Cloudflare dashboard](https://dash.cloudflare.com/), select the account where you want the platform to live:
|
|
21
21
|
|
|
22
22
|
1. Open **Workers & Pages** once to let Cloudflare provision Workers for the account.
|
|
23
|
-
2. Open **Workers for Platforms** and enable its plan. Review [Workers for Platforms pricing](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
|
|
23
|
+
2. Open **Workers for Platforms** and enable its plan. Review [Workers for Platforms pricing](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/pricing/) before confirming.
|
|
24
24
|
3. Open **R2 Object Storage** and complete its activation. Void creates the bucket later.
|
|
25
|
-
4.
|
|
25
|
+
4. Open **Analytics Engine** and select **Enable** if prompted. You do not need to create a dataset manually. If the page has no **Enable** action and installation reports code 10089, follow the [steps below](#if-cloudflare-rejects-analytics-engine).
|
|
26
|
+
5. For a domain installation, choose a domain you own, such as `example.app`. If you need one, register it with your preferred registrar. Use a spare domain's root: apps will be served at `my-app.example.app`. For workers.dev testing, skip this step and the DNS setup below.
|
|
26
27
|
|
|
27
28
|
If that domain is already in this Cloudflare account, use its existing zone. Otherwise, [add the domain to Cloudflare](https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/) and follow the nameserver instructions until the zone is active. A zone is Cloudflare's DNS configuration for a domain; creating one does not buy the domain.
|
|
28
29
|
|
|
@@ -30,7 +31,9 @@ You can also let Void create the zone during installation. Setting it up now let
|
|
|
30
31
|
|
|
31
32
|
### If Cloudflare rejects Analytics Engine
|
|
32
33
|
|
|
33
|
-
The platform stores request metrics and logs in Analytics Engine. If installation stops with "You need to enable Analytics Engine" (code 10089),
|
|
34
|
+
The platform stores request metrics and logs in Analytics Engine. If installation stops with "You need to enable Analytics Engine" (code 10089), open the Analytics Engine dashboard link in the error and select **Enable** for that account. Activation is available on Workers Free; this error does not require a Workers plan upgrade or a replacement API token. Then run the printed `void platform install --resume` command.
|
|
35
|
+
|
|
36
|
+
If your account's dashboard has no **Enable** action, create a disposable Hello World Worker, add an Analytics Engine binding under **Settings** > **Bindings**, and deploy it once from the dashboard. Then resume installation. Use a separate Worker for this step; leave the platform's own Workers unchanged.
|
|
34
37
|
|
|
35
38
|
## Install the CLI and Preview
|
|
36
39
|
|
|
@@ -82,6 +85,8 @@ Use any PostgreSQL provider that accepts connections from your computer and Clou
|
|
|
82
85
|
| [PlanetScale Postgres](https://planetscale.com/docs/postgres/connecting) | Choose **Postgres**, not Vitess/MySQL. Open **Connect**, create role credentials, and use the direct primary connection on port `5432`, not PgBouncer on `6432`. |
|
|
83
86
|
| [Neon](https://neon.com/docs/get-started-with-neon/connect-neon) | Open **Connect**, select the database and owner role, and turn **connection pooling off**. |
|
|
84
87
|
|
|
88
|
+
When sizing your database, include the connection pools for every platform installation and application sharing that server. Adjust each Hyperdrive's [origin connection limit](https://developers.cloudflare.com/hyperdrive/configuration/tune-connection-pool/) to fit the server's capacity, leaving room for migrations, administration, provider-reserved connections, and temporary bursts.
|
|
89
|
+
|
|
85
90
|
Once installation claims the database, continue using that same database for resume and maintenance commands. If installation stops because it cannot use the database, for example because the database is not empty, set `VOID_PLATFORM_DATABASE_URL` to another database's URL before you resume. Uninstall never deletes external PostgreSQL.
|
|
86
91
|
|
|
87
92
|
### Use a provider CLI
|
|
@@ -91,6 +91,8 @@ If installation configured Cloudflare Access, the uninstall plan lists its recor
|
|
|
91
91
|
|
|
92
92
|
Uninstall does not remove the applications created for [project Zero Trust](/guide/platform/administration/zero-trust). While Zero Trust is enabled or still has Access applications, uninstall and `--plan` stop before any change and list those applications. Run `void platform zero-trust disable` first. Uninstall reads this from the installation database, so it also stops when the database cannot be reached.
|
|
93
93
|
|
|
94
|
+
If the installation database is permanently gone and cannot be restored, there is no uninstall command that can clear the local installation record or list its Cloudflare resources. Once you have decided not to recover that installation, delete `~/.void/platforms/<account-id>/<installation-id>.json` and any sibling `<installation-id>.recovery.enc` or `<installation-id>.secrets.enc` files. This removes only local state and encrypted credentials; it does not delete Cloudflare resources. Review and remove those resources manually using [Remove retained resources](#remove-retained-resources).
|
|
95
|
+
|
|
94
96
|
If no platform user exists yet, for example because first administrator setup did
|
|
95
97
|
not finish, nobody can run `zero-trust disable`. Uninstall then turns off project
|
|
96
98
|
Zero Trust and deletes its applications itself. Run it on the computer that installed
|
package/docs/guide/queues.md
CHANGED
|
@@ -10,7 +10,7 @@ Use queues to process work asynchronously, such as sending emails or handling up
|
|
|
10
10
|
|
|
11
11
|
Create a consumer in `queues/`. TypeScript and JavaScript files are supported (`.ts`, `.mts`, `.js`, `.mjs`). Its path determines the queue name: `queues/emails.ts` creates `emails`, and `queues/order/notifications.ts` creates `order-notifications`. Each queue must have a unique name.
|
|
12
12
|
|
|
13
|
-
The resulting name must follow Cloudflare's queue naming rules: 1–63 characters, only letters, digits, and `-`, beginning and ending with a letter or digit.
|
|
13
|
+
The resulting name must follow Cloudflare's queue naming rules: 1–63 characters, only letters, digits, and `-`, beginning and ending with a letter or digit. On `void deploy --platform cloudflare`, the Cloudflare queue also carries the Worker name, so the limit applies to that full name; see [Cloudflare queue names](#cloudflare-queue-names).
|
|
14
14
|
|
|
15
15
|
Export a default handler wrapped with [`defineQueue<T>`](../reference/api/handlers.md#definequeue-t-handler). `T` defines the message body for both the consumer and calls to `send()`:
|
|
16
16
|
|
|
@@ -116,6 +116,18 @@ deletes messages that exhaust their retries without one; see
|
|
|
116
116
|
|
|
117
117
|
Void provisions queues and connects their producers and consumers when you deploy.
|
|
118
118
|
|
|
119
|
+
### Cloudflare queue names
|
|
120
|
+
|
|
121
|
+
Queue names are unique per Cloudflare account. So `void deploy --platform cloudflare` names each queue after the Worker: in a Worker named `app-staging`, `queues/jobs.ts` uses the Cloudflare queue `app-staging-jobs` (a `_` in the Worker name becomes `-`). Two Workers in one account, such as `app-staging` and `app-production`, get separate queues. Your code keeps using the name from `queues/` (`queues.jobs.send()`), and `vp dev` uses that name too.
|
|
122
|
+
|
|
123
|
+
The deploy stops before creating anything when:
|
|
124
|
+
|
|
125
|
+
- a new queue's full name is longer than 63 characters. Shorten the Worker name or the file name.
|
|
126
|
+
- one queue's full name is the name of another file in `queues/`, such as `queues/jobs.ts` and `queues/app-jobs.ts` in Worker `app`. Rename one of the files.
|
|
127
|
+
- another Worker already consumes the Cloudflare queue the deploy would use. A Cloudflare queue has one consumer.
|
|
128
|
+
|
|
129
|
+
A queue that the Worker already consumes keeps its name, so an app deployed before Worker-named queues keeps its queue (for example `jobs`) and the messages in it. The deploy prints a note when it keeps a name. To move to the Worker-named queue, remove the Worker's consumer from the old queue in the Cloudflare dashboard, then deploy again. Messages that reach the old queue before that deploy finishes stay there, so do this when the app is not sending messages, and check that the old queue is empty before you delete it.
|
|
130
|
+
|
|
119
131
|
## Local development
|
|
120
132
|
|
|
121
133
|
In native Void apps, sending a message through a queue binding automatically invokes the consumer in Miniflare. Local delivery uses the same handler as production.
|
package/docs/guide/quickstart.md
CHANGED
|
@@ -32,6 +32,11 @@ bun add -D void
|
|
|
32
32
|
bunx void init
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
```sh [vite+]
|
|
36
|
+
vp add -D void
|
|
37
|
+
vpx void init
|
|
38
|
+
```
|
|
39
|
+
|
|
35
40
|
:::
|
|
36
41
|
|
|
37
42
|
Choose your UI framework, a starter, and a deployment target. Vite+ is the default build tool. D1 is a good first database: it runs locally without a separate database server. Choose Cloudflare to deploy to your own account, or skip deployment setup for now.
|
|
@@ -42,10 +47,30 @@ With pnpm, `pnpm create void my-app` also creates the project directory and conf
|
|
|
42
47
|
|
|
43
48
|
## Run locally
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
::: code-group
|
|
51
|
+
|
|
52
|
+
```sh [npm]
|
|
46
53
|
npm run dev
|
|
47
54
|
```
|
|
48
55
|
|
|
56
|
+
```sh [pnpm]
|
|
57
|
+
pnpm run dev
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```sh [yarn]
|
|
61
|
+
yarn run dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```sh [bun]
|
|
65
|
+
bun run dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```sh [vite+]
|
|
69
|
+
vpr dev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
:::
|
|
73
|
+
|
|
49
74
|
Open `http://localhost:5173`. In a Pages starter, `pages/` contains your UI and companion `.server.ts` files contain its server loaders and actions. Loaders return data to page components as typed props.
|
|
50
75
|
|
|
51
76
|
## Call a server route
|
package/docs/guide/sandboxes.md
CHANGED
|
@@ -120,8 +120,8 @@ See the [configuration reference](../reference/config.md#sandbox) for binding na
|
|
|
120
120
|
Custom images must include the helper matching Void's installed Sandbox SDK version. The SDK image supplies this binary, but is not a runnable environment itself:
|
|
121
121
|
|
|
122
122
|
```dockerfile
|
|
123
|
-
FROM node:26.
|
|
124
|
-
COPY --from=docker.io/cloudflare/sandbox:1.0.
|
|
123
|
+
FROM node:26.12.1-trixie-slim
|
|
124
|
+
COPY --from=docker.io/cloudflare/sandbox:1.0.2 /usr/local/bin/sandbox-shim /usr/local/bin/sandbox-shim
|
|
125
125
|
WORKDIR /workspace
|
|
126
126
|
CMD ["sleep", "infinity"]
|
|
127
127
|
```
|
|
@@ -8,7 +8,7 @@ Create a file in `routes/` to add an endpoint, and export a handler for each HTT
|
|
|
8
8
|
|
|
9
9
|
## Route Files
|
|
10
10
|
|
|
11
|
-
Create route handlers in `routes
|
|
11
|
+
Create route handlers in `routes/` using `.ts`, `.tsx`, `.js`, `.jsx`, `.mts`, or `.mjs`. Each file maps to a URL path based on its location in the filesystem:
|
|
12
12
|
|
|
13
13
|
<RoutesFileTree />
|
|
14
14
|
|
|
@@ -23,11 +23,13 @@ routes/
|
|
|
23
23
|
api/health.ts → always
|
|
24
24
|
api/debug.dev.ts → development only
|
|
25
25
|
api/metrics.prod.ts → production only
|
|
26
|
+
preview.dev.tsx → development only, with JSX
|
|
27
|
+
report.prod.jsx → production only, with JSX
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
`.dev` routes run only in development; `.prod` routes run in builds, deployments, and production previews. A resource used only by `.dev` routes is not provisioned for production.
|
|
29
31
|
|
|
30
|
-
Suffixes apply
|
|
32
|
+
Suffixes apply in `routes/` and [`pages/`](./pages-routing/overview.md#environment-only-pages), not in `middleware/`, `crons/`, or `queues/`. `void prepare` generates types for both environments.
|
|
31
33
|
|
|
32
34
|
Each file exports named HTTP method constants to handle specific methods:
|
|
33
35
|
|
|
@@ -61,6 +63,40 @@ export const POST = defineHandler(async (c) => {
|
|
|
61
63
|
|
|
62
64
|
See [Database](./database.md) for queries with D1, PostgreSQL, or MySQL.
|
|
63
65
|
|
|
66
|
+
### JSX handlers
|
|
67
|
+
|
|
68
|
+
Use `.tsx` or `.jsx` when a server handler contains JSX. Void doesn't choose a JSX runtime: route files compile with the same JSX settings as the rest of your Vite app. In a React or Solid app, that is the framework's JSX, so render it with the framework's server renderer and return HTML. For example, in a React app:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
// routes/hello.tsx → GET /hello
|
|
72
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
73
|
+
import { defineHandler } from 'void';
|
|
74
|
+
|
|
75
|
+
export const GET = defineHandler((c) => c.html(renderToStaticMarkup(<h1>Hello!</h1>)));
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
In an app without a JSX framework (API only, Vue, or Svelte), use [Hono's JSX](https://hono.dev/docs/guides/jsx). Your app needs `hono` in its own dependencies (new Void apps have it). Set the runtime in `vite.config.ts`, so it applies to `.tsx` and `.jsx` files alike:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
// vite.config.ts
|
|
82
|
+
import { defineConfig } from 'vite-plus';
|
|
83
|
+
import { voidPlugin } from 'void';
|
|
84
|
+
|
|
85
|
+
export default defineConfig({
|
|
86
|
+
oxc: { jsx: { runtime: 'automatic', importSource: 'hono/jsx' } },
|
|
87
|
+
plugins: [voidPlugin()],
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`c.html()` then takes the JSX directly:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
// routes/hello.tsx → GET /hello
|
|
95
|
+
import { defineHandler } from 'void';
|
|
96
|
+
|
|
97
|
+
export const GET = defineHandler((c) => c.html(<h1>Hello!</h1>));
|
|
98
|
+
```
|
|
99
|
+
|
|
64
100
|
## `defineHandler`
|
|
65
101
|
|
|
66
102
|
The handler receives a Hono `Context` with typed Cloudflare bindings on `c.env` (see [Cloudflare](../integrations/cloudflare.md)). You can use the full Hono API (`c.json()`, `c.text()`, `c.header()`, etc.).
|
|
@@ -104,13 +104,13 @@ The `action()` helper gets the same type checking. See [Actions & Forms](./pages
|
|
|
104
104
|
|
|
105
105
|
## What Gets Checked
|
|
106
106
|
|
|
107
|
-
| Layer | What's type-checked
|
|
108
|
-
| ------------ |
|
|
109
|
-
| Database | Table columns, value types, insert/update shapes from Drizzle schema
|
|
110
|
-
| Handlers | `c.env` bindings, validator input, return type
|
|
111
|
-
| Fetch client | Route paths, HTTP methods, `body`/`query`/`params`, response type
|
|
112
|
-
| `useForm` | Action URLs, `data` fields, `errors` keys, `reset()` args, `params`
|
|
113
|
-
| `action()` | Action URLs, `data` payload, `params`
|
|
107
|
+
| Layer | What's type-checked |
|
|
108
|
+
| ------------ | --------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| Database | Table columns, value types, insert/update shapes from Drizzle schema |
|
|
110
|
+
| Handlers | `c.env` bindings, validator input, return type |
|
|
111
|
+
| Fetch client | Route paths, HTTP methods, `body`/`query`/`params`, response type |
|
|
112
|
+
| `useForm` | Action URLs, `data` fields, `errors` keys, `reset()` args (including `{ initial: true }`), `params`, `resetOnSuccess` |
|
|
113
|
+
| `action()` | Action URLs, `data` payload, `params` |
|
|
114
114
|
|
|
115
115
|
## Serialization
|
|
116
116
|
|
package/docs/guide/websockets.md
CHANGED
|
@@ -14,7 +14,7 @@ For example, `/rooms/[id]` gives each chat room its own instance. Use it for cha
|
|
|
14
14
|
|
|
15
15
|
## Route files
|
|
16
16
|
|
|
17
|
-
Create WebSocket routes in `routes/`
|
|
17
|
+
Create WebSocket routes in `routes/` using `.ws.ts`, `.ws.tsx`, `.ws.js`, `.ws.jsx`, `.ws.mts`, or `.ws.mjs`:
|
|
18
18
|
|
|
19
19
|
```text
|
|
20
20
|
routes/
|
|
@@ -22,6 +22,8 @@ routes/
|
|
|
22
22
|
notifications.ws.ts
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
Use `.ws.tsx` or `.ws.jsx` when a handler contains JSX, such as rendering HTML fragments to send to connected clients. See [JSX handlers](./server-routing.md#jsx-handlers) for the JSX runtime.
|
|
26
|
+
|
|
25
27
|
Filename rules match regular server routes:
|
|
26
28
|
|
|
27
29
|
- `index.ws.ts` becomes the parent path
|
|
@@ -30,7 +32,7 @@ Filename rules match regular server routes:
|
|
|
30
32
|
- route groups like `(marketing)/chat.ws.ts` are ignored in the URL
|
|
31
33
|
- `chat.dev.ws.ts` / `chat.prod.ws.ts` restrict the route to one environment
|
|
32
34
|
|
|
33
|
-
The environment suffix goes **before** `.ws`. `chat.ws.dev.ts` is not
|
|
35
|
+
The environment suffix goes **before** `.ws`. `chat.ws.dev.ts` is not a WebSocket route.
|
|
34
36
|
|
|
35
37
|
## `defineRoom()`
|
|
36
38
|
|
|
@@ -49,7 +49,7 @@ Imported from `"@void/vue"`.
|
|
|
49
49
|
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
50
50
|
| `useParams()` | Returns dynamic route params for the page currently being rendered. |
|
|
51
51
|
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
52
|
-
| `useForm(url, defaults, options?)` | Typed reactive form helper bound to a page action URL. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, clearErrors, clearError }`.
|
|
52
|
+
| `useForm(url, defaults, options?)` | Typed reactive form helper bound to a page action URL. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
53
53
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
54
54
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
55
55
|
| `useShared()` | Returns shared data injected by middleware via `c.set("shared", {...})`. |
|
|
@@ -101,7 +101,7 @@ Imported from `"@void/react"`.
|
|
|
101
101
|
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. React navigations are scheduled as transitions. |
|
|
102
102
|
| `useParams()` | Returns dynamic route params for the page currently being rendered. |
|
|
103
103
|
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
104
|
-
| `useForm(url, defaults, options?)` | Form helper hook. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, clearErrors, clearError }`.
|
|
104
|
+
| `useForm(url, defaults, options?)` | Form helper hook. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
105
105
|
| `useIslandForm(defaults)` | Form helper hook for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
106
106
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
107
107
|
| `useShared()` | Returns shared data injected by middleware via `c.set("shared", {...})`. |
|
|
@@ -158,7 +158,7 @@ Imported from `"@void/svelte"`.
|
|
|
158
158
|
| Export | Description |
|
|
159
159
|
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
160
160
|
| `Link` | Svelte component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `onNavigate`. |
|
|
161
|
-
| `useForm(url, defaults, options?)` | Form helper using Svelte 5 runes. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, clearErrors, clearError }`.
|
|
161
|
+
| `useForm(url, defaults, options?)` | Form helper using Svelte 5 runes. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
162
162
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
163
163
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
164
164
|
| `useShared()` | Returns shared data injected by middleware via `c.set("shared", {...})`. |
|
|
@@ -208,7 +208,7 @@ Imported from `"@void/solid"`.
|
|
|
208
208
|
| Export | Description |
|
|
209
209
|
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
210
210
|
| `Link` | Solid component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `onNavigate`. |
|
|
211
|
-
| `useForm(url, defaults, options?)` | Form helper using Solid stores. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, clearErrors, clearError }`.
|
|
211
|
+
| `useForm(url, defaults, options?)` | Form helper using Solid stores. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
212
212
|
| `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. |
|
|
213
213
|
| `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an `ActionResult`. |
|
|
214
214
|
| `useShared()` | Returns shared data injected by middleware via `c.set("shared", {...})`. |
|
|
@@ -50,6 +50,19 @@ void email disallow <address> [--project <name>]
|
|
|
50
50
|
|
|
51
51
|
Remove one recipient from the project's destination list. New sends to that address are refused immediately; previously admitted attempts may finish. No deploy is involved.
|
|
52
52
|
|
|
53
|
+
## `void email alias` {#void-email-alias}
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
void email alias [--project <name>]
|
|
57
|
+
void email alias <name> [--yes] [--project <name>]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
With no name, show the project's address on the platform's shared mail domain and whether inbound mail reaches it.
|
|
61
|
+
|
|
62
|
+
With a name, give that address a shorter name: `void email alias acme` makes `acme@<mail domain>` and `acme+<tag>@<mail domain>` reach the project and lets it send from them. Only the project owner can set it. The name follows the same rules as a project slug, must not be used by any other project's slug or alias, and names of five characters or fewer need a plan that allows short names.
|
|
63
|
+
|
|
64
|
+
The alias is permanent: it cannot be changed or removed, and it is freed only when the project is deleted. The slug address keeps working for sending and receiving, so nothing that already uses it breaks. The CLI asks for confirmation; pass `--yes` to skip the prompt, which is required outside an interactive terminal. Inbound mail at the alias starts once the project has `email/` handlers deployed and its recipient rule is ready; run `void email alias` to check. Redeploy with the current `void` before you share the alias: an app built with an older version sees `message.to` with the alias still in front (`acme+support@…` instead of `support@…`).
|
|
65
|
+
|
|
53
66
|
## `void email domain` {#void-email-domain}
|
|
54
67
|
|
|
55
68
|
```
|