void 0.1.6 → 0.7.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/AGENT_PROMPT.md +15 -0
- package/README.md +62 -123
- package/dist/auth-BdsJ0Aff.d.mts +43 -0
- package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
- package/dist/auth-migrations-BAtAck2g.mjs +117 -0
- package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
- package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
- package/dist/cache-W82I8ihI.mjs +47 -0
- package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
- package/dist/cf-access-Dee5cXxL.mjs +22 -0
- package/dist/chunk-DJd-R1mw.mjs +34 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +1807 -0
- package/dist/client-snXOjrp1.mjs +565 -0
- package/dist/collect-CjeZgz5D.mjs +55 -0
- package/dist/config-BIa9HwVX.mjs +573 -0
- package/dist/config-BzM9Dy7T.mjs +37 -0
- package/dist/config-CvHtTM0q.mjs +30 -0
- package/dist/create-project-BIA15W7z.mjs +90 -0
- package/dist/db-DsRoMcfN.mjs +895 -0
- package/dist/defer-DcxEsVH1.mjs +49 -0
- package/dist/delete-DAP6yDc7.mjs +64 -0
- package/dist/deploy-BPKblFx6.mjs +2424 -0
- package/dist/discover-B7FkXBLB.mjs +40 -0
- package/dist/dist-DUyXJLkq.mjs +2667 -0
- package/dist/dist-Dayj3gCK.mjs +1287 -0
- package/dist/domain-BGofcQ6I.mjs +79 -0
- package/dist/dotenv-DwO4ti0Z.mjs +173 -0
- package/dist/drizzle-NnudE_UN.mjs +232 -0
- package/dist/env-CyG3tvU0.mjs +301 -0
- package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
- package/dist/env-raw-BDL4TvdN.mjs +32 -0
- package/dist/env-types-DknSA4SO.mjs +64 -0
- package/dist/env-validation-DJKjR_8q.mjs +163 -0
- package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
- package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
- package/dist/gen-U0Ktr4Zd.mjs +761 -0
- package/dist/handler-B0ds0OHJ.d.mts +269 -0
- package/dist/head-P-egrtFE.d.mts +45 -0
- package/dist/headers-DCXc7mDs.mjs +279 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +4695 -0
- package/dist/init-C7wS5iGP.mjs +2625 -0
- package/dist/link-p2R6NbgN.mjs +49 -0
- package/dist/list-Bfel-QLc.mjs +113 -0
- package/dist/log-DXdqnmhF.mjs +26 -0
- package/dist/login-CkcXUiIu.mjs +72 -0
- package/dist/logs-DmkrRvx6.mjs +98 -0
- package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
- package/dist/mcp-CaQzfeUi.mjs +373 -0
- package/dist/node-DDfXj10V.mjs +54 -0
- package/dist/output-BwlcIYSR.mjs +139 -0
- package/dist/pages/client.d.mts +198 -0
- package/dist/pages/client.mjs +980 -0
- package/dist/pages/head-client.d.mts +15 -0
- package/dist/pages/head-client.mjs +90 -0
- package/dist/pages/head.d.mts +2 -0
- package/dist/pages/head.mjs +112 -0
- package/dist/pages/index.d.mts +38 -0
- package/dist/pages/index.mjs +76 -0
- package/dist/pages/islands-plugin.d.mts +50 -0
- package/dist/pages/islands-plugin.mjs +195 -0
- package/dist/pages/prefetch.d.mts +31 -0
- package/dist/pages/prefetch.mjs +90 -0
- package/dist/pages/protocol.d.mts +3 -0
- package/dist/pages/protocol.mjs +193 -0
- package/dist/pages/serialize.d.mts +10 -0
- package/dist/pages/serialize.mjs +14 -0
- package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
- package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
- package/dist/prepare-BAtWufvm.mjs +99 -0
- package/dist/preset-D4I73kT4.mjs +221 -0
- package/dist/project-TqORyHn8.mjs +72 -0
- package/dist/project-cmd-B7lQp3F3.mjs +67 -0
- package/dist/project-slug-CKam8lF9.mjs +11 -0
- package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
- package/dist/protocol-BWzXs2A2.d.mts +34 -0
- package/dist/providers-B3aMxWzP.mjs +67 -0
- package/dist/resolve-project-Br5BR03U.mjs +29 -0
- package/dist/rollback-gyC59l7U.mjs +92 -0
- package/dist/route-types-DReF1gUY.mjs +255 -0
- package/dist/routes-stub.d.mts +55 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/runner-6Ep3fNQu.mjs +123 -0
- package/dist/runner-pg-D0wWHYnr.mjs +57 -0
- package/dist/runtime/ai.d.mts +127 -0
- package/dist/runtime/ai.mjs +348 -0
- package/dist/runtime/auth-client-react.d.mts +8 -0
- package/dist/runtime/auth-client-react.mjs +6 -0
- package/dist/runtime/auth-client-solid.d.mts +8 -0
- package/dist/runtime/auth-client-solid.mjs +6 -0
- package/dist/runtime/auth-client-svelte.d.mts +8 -0
- package/dist/runtime/auth-client-svelte.mjs +6 -0
- package/dist/runtime/auth-client-vue.d.mts +8 -0
- package/dist/runtime/auth-client-vue.mjs +6 -0
- package/dist/runtime/auth-client.d.mts +8 -0
- package/dist/runtime/auth-client.mjs +6 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +22 -0
- package/dist/runtime/better-auth-pg.d.mts +11 -0
- package/dist/runtime/better-auth-pg.mjs +51 -0
- package/dist/runtime/better-auth.d.mts +11 -0
- package/dist/runtime/better-auth.mjs +33 -0
- package/dist/runtime/client.d.mts +6 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +30 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/env-helpers.d.mts +2 -0
- package/dist/runtime/env-helpers.mjs +173 -0
- package/dist/runtime/env-public-client.d.mts +22 -0
- package/dist/runtime/env-public-client.mjs +54 -0
- package/dist/runtime/env-public.d.mts +143 -0
- package/dist/runtime/env-public.mjs +366 -0
- package/dist/runtime/env.d.mts +13 -0
- package/dist/runtime/env.mjs +51 -0
- package/dist/runtime/fetch-stream.d.mts +51 -0
- package/dist/runtime/fetch-stream.mjs +81 -0
- package/dist/runtime/fetch.d.mts +59 -0
- package/dist/runtime/fetch.mjs +18 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +85 -0
- package/dist/runtime/isr.d.mts +26 -0
- package/dist/runtime/isr.mjs +43 -0
- package/dist/runtime/kv.d.mts +48 -0
- package/dist/runtime/kv.mjs +106 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +31 -0
- package/dist/runtime/migration-handler-pg.d.mts +6 -0
- package/dist/runtime/migration-handler-pg.mjs +85 -0
- package/dist/runtime/migration-handler.d.mts +19 -0
- package/dist/runtime/migration-handler.mjs +92 -0
- package/dist/runtime/queues.d.mts +7 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +15 -0
- package/dist/runtime/remote/binding-handler.mjs +208 -0
- package/dist/runtime/remote/index.d.mts +8 -0
- package/dist/runtime/remote/index.mjs +461 -0
- package/dist/runtime/response.d.mts +14 -0
- package/dist/runtime/response.mjs +30 -0
- package/dist/runtime/sandbox.d.mts +17 -0
- package/dist/runtime/sandbox.mjs +19 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +30 -0
- package/dist/runtime/seed.mjs +6 -0
- package/dist/runtime/storage.d.mts +7 -0
- package/dist/runtime/storage.mjs +14 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +72 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +296 -0
- package/dist/runtime/ws.d.mts +123 -0
- package/dist/runtime/ws.mjs +103 -0
- package/dist/scan-Ba4hFwlH.mjs +324 -0
- package/dist/scan-C6HMEIdW.mjs +318 -0
- package/dist/secret-CeRSukgM.mjs +109 -0
- package/dist/skills-ipldjlKE.mjs +62 -0
- package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
- package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
- package/dist/sveltekit.d.mts +20 -0
- package/dist/sveltekit.mjs +61 -0
- package/dist/types-mHOEwpW4.d.mts +57 -0
- package/dist/validate-CaMavMxu.mjs +146 -0
- package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
- package/getting-started-prompt.txt +26 -0
- package/package.json +322 -30
- package/schema.json +364 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/SKILL.md +75 -0
- package/skills/void/command/void.md +7 -0
- package/skills/void/docs/guide/ai.md +235 -0
- package/skills/void/docs/guide/app-types.md +103 -0
- package/skills/void/docs/guide/auth.md +257 -0
- package/skills/void/docs/guide/database/d1.md +106 -0
- package/skills/void/docs/guide/database/postgresql.md +106 -0
- package/skills/void/docs/guide/database.md +418 -0
- package/skills/void/docs/guide/deployment.md +98 -0
- package/skills/void/docs/guide/edge/headers.md +79 -0
- package/skills/void/docs/guide/edge/prerendering.md +83 -0
- package/skills/void/docs/guide/edge/redirects.md +116 -0
- package/skills/void/docs/guide/edge/revalidation.md +131 -0
- package/skills/void/docs/guide/edge/rewrites.md +354 -0
- package/skills/void/docs/guide/edge/static-assets.md +72 -0
- package/skills/void/docs/guide/env-vars.md +298 -0
- package/skills/void/docs/guide/index.md +80 -0
- package/skills/void/docs/guide/jobs.md +91 -0
- package/skills/void/docs/guide/kv.md +107 -0
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
- package/skills/void/docs/guide/pages-routing/head.md +130 -0
- package/skills/void/docs/guide/pages-routing/islands.md +405 -0
- package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
- package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
- package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
- package/skills/void/docs/guide/pages-routing/overview.md +236 -0
- package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
- package/skills/void/docs/guide/queues.md +140 -0
- package/skills/void/docs/guide/quickstart.md +233 -0
- package/skills/void/docs/guide/remote-dev.md +67 -0
- package/skills/void/docs/guide/sandboxes.md +82 -0
- package/skills/void/docs/guide/server-routing.md +246 -0
- package/skills/void/docs/guide/ssg.md +74 -0
- package/skills/void/docs/guide/ssr.md +105 -0
- package/skills/void/docs/guide/storage.md +67 -0
- package/skills/void/docs/guide/type-safety.md +179 -0
- package/skills/void/docs/guide/typed-fetch.md +113 -0
- package/skills/void/docs/guide/websockets.md +190 -0
- package/skills/void/docs/index.md +48 -0
- package/skills/void/docs/integrations/agents.md +84 -0
- package/skills/void/docs/integrations/cloudflare.md +284 -0
- package/skills/void/docs/integrations/frameworks/analog.md +182 -0
- package/skills/void/docs/integrations/frameworks/astro.md +197 -0
- package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
- package/skills/void/docs/integrations/frameworks/overview.md +136 -0
- package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
- package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
- package/skills/void/docs/integrations/hono.md +97 -0
- package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
- package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
- package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
- package/skills/void/docs/node_modules/vitepress/README.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
- package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
- package/skills/void/docs/node_modules/void/README.md +89 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
- package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
- package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
- package/skills/void/docs/reference/api.md +917 -0
- package/skills/void/docs/reference/cli.md +561 -0
- package/skills/void/docs/reference/config.md +408 -0
- package/skills/void/docs/reference/resource-inference.md +149 -0
- package/skills/void/docs/reference/structure.md +176 -0
- package/.npmignore +0 -29
- package/.travis.yml +0 -9
- package/favicon.ico +0 -0
- package/index.js +0 -14
- package/lib/Job.js +0 -150
- package/lib/Void.js +0 -99
- package/lib/scan.js +0 -19
- package/test/credentials.js +0 -20
- package/test/job.js +0 -64
- package/test/static/dir1/test6.html +0 -0
- package/test/static/dir2/test7.html +0 -0
- package/test/static/dir2/test8.html +0 -0
- package/test/static/dir2/test9.html +0 -0
- package/test/static/test1.html +0 -0
- package/test/static/test2.html +0 -0
- package/test/static/test3.html +0 -0
- package/test/void.js +0 -31
- /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
- /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Pages Routing
|
|
6
|
+
|
|
7
|
+
Pages routing provides the server-rendered, components-as-pages, collocated-data-loading routing system that is seen in many existing JavaScript meta frameworks. However, pages routing in Void is different from most in that it is **rendering framework agnostic.** It is built on patterns inspired by [Inertia.js](https://inertiajs.com/): The server returns the data, and the component receives it as props. The client-side routing logic is minimal, allowing Void to support any rendering framework Vite can support. Today, React, Vue, Svelte, and Solid have first-party adapters.
|
|
8
|
+
|
|
9
|
+
Pages mode activates when a `pages/` directory exists. It coexists with `routes/`. Use `pages/` for UI pages and `routes/` for APIs. Components in `pages/` are server-rendered, which means **they run in both Cloudflare Workers and browsers**.
|
|
10
|
+
|
|
11
|
+
Pages mode is also entirely optional - you can use any client-side router to build a pure client-side SPA that interacts with the backend API via the [typed fetch](../typed-fetch.md) utility.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
If you start in a scaffoldable empty directory, `void init` can generate this setup for you: it asks whether you want React, Vue, Svelte, or Solid Pages mode, then lets you pick a D1 starter, a PostgreSQL starter, or Static Pages. The database-backed starters write the adapter-aware `vite.config.ts`, `pages/`, and `db/` starter files; Static Pages writes just the basic `pages/` setup so you can grow into server features later.
|
|
16
|
+
|
|
17
|
+
If you're adding Pages mode manually, install a framework adapter alongside `void`:
|
|
18
|
+
|
|
19
|
+
::: code-group
|
|
20
|
+
|
|
21
|
+
```sh [React]
|
|
22
|
+
npm install @void/react
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```sh [Vue]
|
|
26
|
+
npm install @void/vue
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```sh [Svelte]
|
|
30
|
+
npm install @void/svelte
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```sh [Solid]
|
|
34
|
+
npm install @void/solid
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
Add both plugins to your Vite config:
|
|
40
|
+
|
|
41
|
+
::: code-group
|
|
42
|
+
|
|
43
|
+
```ts [React]
|
|
44
|
+
// vite.config.ts
|
|
45
|
+
import { defineConfig } from 'vite';
|
|
46
|
+
import { voidPlugin } from 'void';
|
|
47
|
+
import { voidReact } from '@void/react/plugin';
|
|
48
|
+
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
plugins: [voidPlugin(), voidReact()],
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```ts [Vue]
|
|
55
|
+
// vite.config.ts
|
|
56
|
+
import { defineConfig } from 'vite';
|
|
57
|
+
import { voidPlugin } from 'void';
|
|
58
|
+
import { voidVue } from '@void/vue/plugin';
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
plugins: [voidPlugin(), voidVue()],
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ts [Svelte]
|
|
66
|
+
// vite.config.ts
|
|
67
|
+
import { defineConfig } from 'vite';
|
|
68
|
+
import { voidPlugin } from 'void';
|
|
69
|
+
import { voidSvelte } from '@void/svelte/plugin';
|
|
70
|
+
|
|
71
|
+
export default defineConfig({
|
|
72
|
+
plugins: [voidPlugin(), voidSvelte()],
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```ts [Solid]
|
|
77
|
+
// vite.config.ts
|
|
78
|
+
import { defineConfig } from 'vite';
|
|
79
|
+
import { voidPlugin } from 'void';
|
|
80
|
+
import { voidSolid } from '@void/solid/plugin';
|
|
81
|
+
|
|
82
|
+
export default defineConfig({
|
|
83
|
+
plugins: [voidPlugin(), voidSolid()],
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
:::
|
|
88
|
+
|
|
89
|
+
That is the full setup. You do not need an SSR entry, a client entry, or hydration boilerplate because the adapter generates them for you.
|
|
90
|
+
|
|
91
|
+
Each adapter plugin includes the framework's Vite plugin (`@vitejs/plugin-react`, `@vitejs/plugin-vue`, `@sveltejs/vite-plugin-svelte`, `vite-plugin-solid`) so you don't need to install or configure it separately. Pass framework plugin options via `voidReact({ react: { ... } })`, `voidVue({ vue: { ... } })`, `voidSvelte({ svelte: { ... } })`, or `voidSolid({ solid: { ... } })` if needed.
|
|
92
|
+
|
|
93
|
+
## Directory Structure
|
|
94
|
+
|
|
95
|
+
Pages can be flat files such as `about.vue` or directory-based routes such as `about/index.vue`. Both map to the same route:
|
|
96
|
+
|
|
97
|
+
<PagesFileTree />
|
|
98
|
+
|
|
99
|
+
Each page can have a companion `.server.ts` file that runs exclusively on the server. It can export:
|
|
100
|
+
|
|
101
|
+
- A [**loader**](./loaders), which runs on `GET` and returns the data that becomes the page component's props
|
|
102
|
+
- [**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
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
## How Navigation Works
|
|
107
|
+
|
|
108
|
+
Pages uses an Inertia-style protocol under the hood:
|
|
109
|
+
|
|
110
|
+
| Request | Response |
|
|
111
|
+
| --------------------- | --------------------------------------------------------------------- |
|
|
112
|
+
| Initial page load | Full SSR HTML. Client hydrates automatically. |
|
|
113
|
+
| Subsequent navigation | JSON with component name + props. Client component swap or re-render. |
|
|
114
|
+
| Form submission | Runs action, then returns fresh props or a redirect. |
|
|
115
|
+
|
|
116
|
+
This means the first page load is server-rendered for SEO and performance, while later navigations stay fast without full page reloads.
|
|
117
|
+
|
|
118
|
+
Use the `Link` component for SPA navigation between pages. It renders an `<a>` tag that intercepts clicks and navigates without a full page reload:
|
|
119
|
+
|
|
120
|
+
::: code-group
|
|
121
|
+
|
|
122
|
+
```tsx [React]
|
|
123
|
+
import { Link } from "@void/react";
|
|
124
|
+
|
|
125
|
+
<Link href="/users">Users</Link>
|
|
126
|
+
<Link href={`/users/${id}`}>View</Link>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```vue [Vue]
|
|
130
|
+
<script setup lang="ts">
|
|
131
|
+
import { Link } from '@void/vue';
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<template>
|
|
135
|
+
<Link href="/users">Users</Link>
|
|
136
|
+
<Link :href="`/users/${id}`">View</Link>
|
|
137
|
+
</template>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```svelte [Svelte]
|
|
141
|
+
<script>
|
|
142
|
+
import { Link } from "@void/svelte";
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<Link href="/users">Users</Link>
|
|
146
|
+
<Link href={`/users/${id}`}>View</Link>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```tsx [Solid]
|
|
150
|
+
import { Link } from "@void/solid";
|
|
151
|
+
|
|
152
|
+
<Link href="/users">Users</Link>
|
|
153
|
+
<Link href={`/users/${id}`}>View</Link>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
:::
|
|
157
|
+
|
|
158
|
+
The `Link` components also support query data, history replacement, document navigation, and cancellable client-side navigation:
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
<Link href="/users" data={{ page: 2, tag: ['active', 'new'] }}>
|
|
162
|
+
Filtered users
|
|
163
|
+
</Link>
|
|
164
|
+
|
|
165
|
+
<Link href="/users" replace>
|
|
166
|
+
Users
|
|
167
|
+
</Link>
|
|
168
|
+
|
|
169
|
+
<Link href="/logout" reloadDocument>
|
|
170
|
+
Sign out
|
|
171
|
+
</Link>
|
|
172
|
+
|
|
173
|
+
<Link
|
|
174
|
+
href="/settings"
|
|
175
|
+
onNavigate={(event) => {
|
|
176
|
+
if (!confirm('Leave this page?')) {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
}
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
Settings
|
|
182
|
+
</Link>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`prefetch` and `reloadDocument` are GET-only. Passing either prop to a mutation link throws. GET `data` is merged into the rendered `href` query string; arrays become repeated keys, `null` and `undefined` are omitted, and nested objects throw.
|
|
186
|
+
|
|
187
|
+
For programmatic navigation, use `useRouter()`:
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
import { useRouter } from '@void/vue'; // or "@void/react", "@void/svelte", "@void/solid"
|
|
191
|
+
|
|
192
|
+
const router = useRouter();
|
|
193
|
+
router.visit('/users');
|
|
194
|
+
router.refresh(); // re-fetch current page props
|
|
195
|
+
router.visit('/logout', { method: 'POST' }); // non-GET navigation
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Scroll Restoration
|
|
199
|
+
|
|
200
|
+
The Void Router automatically saves and restores scroll position during client-side navigation:
|
|
201
|
+
|
|
202
|
+
- **Back/forward navigation** restores the exact scroll position you were at before navigating away.
|
|
203
|
+
- **Forward navigation** scrolls to the top of the page.
|
|
204
|
+
- **Hash links** (`/docs#api`) scroll to the target element. Same-page hash links (`#section`) skip the server fetch entirely.
|
|
205
|
+
|
|
206
|
+
This works out of the box with no configuration. If you need to opt out for a specific navigation, pass `preserveScroll: true`:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
router.visit('/users', { preserveScroll: true });
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
`Link` also accepts `preserveScroll`:
|
|
213
|
+
|
|
214
|
+
::: code-group
|
|
215
|
+
|
|
216
|
+
```tsx [React]
|
|
217
|
+
<Link href="/users" preserveScroll>
|
|
218
|
+
Users
|
|
219
|
+
</Link>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
```vue [Vue]
|
|
223
|
+
<Link href="/users" preserve-scroll>Users</Link>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
```svelte [Svelte]
|
|
227
|
+
<Link href="/users" preserveScroll>Users</Link>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
```tsx [Solid]
|
|
231
|
+
<Link href="/users" preserveScroll>
|
|
232
|
+
Users
|
|
233
|
+
</Link>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
:::
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# View Transitions
|
|
6
|
+
|
|
7
|
+
Pages mode supports the browser's native [View Transition API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API) for animated page transitions. When enabled, navigations are wrapped in `document.startViewTransition()`, which gives you a smooth cross-fade between pages by default. You can customize the effect entirely with CSS.
|
|
8
|
+
|
|
9
|
+
## Enabling View Transitions
|
|
10
|
+
|
|
11
|
+
Pass `viewTransitions: true` to the adapter plugin:
|
|
12
|
+
|
|
13
|
+
::: code-group
|
|
14
|
+
|
|
15
|
+
```ts [React]
|
|
16
|
+
// vite.config.ts
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [voidPlugin(), voidReact({ viewTransitions: true })],
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```ts [Vue]
|
|
23
|
+
// vite.config.ts
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
plugins: [voidPlugin(), voidVue({ viewTransitions: true })],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```ts [Svelte]
|
|
30
|
+
// vite.config.ts
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
plugins: [voidPlugin(), voidSvelte({ viewTransitions: true })],
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```ts [Solid]
|
|
37
|
+
// vite.config.ts
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
plugins: [voidPlugin(), voidSolid({ viewTransitions: true })],
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
This enables view transitions for all navigations, including `Link` clicks, programmatic `router.visit()` calls, and browser back or forward.
|
|
46
|
+
|
|
47
|
+
## Per-Link Override
|
|
48
|
+
|
|
49
|
+
Override the global setting on individual links:
|
|
50
|
+
|
|
51
|
+
::: code-group
|
|
52
|
+
|
|
53
|
+
```tsx [React]
|
|
54
|
+
{
|
|
55
|
+
/* Disable transition for this link */
|
|
56
|
+
}
|
|
57
|
+
<Link href="/settings" viewTransition={false}>
|
|
58
|
+
Settings
|
|
59
|
+
</Link>;
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
/* Enable for just this link (even if globally disabled) */
|
|
63
|
+
}
|
|
64
|
+
<Link href="/about" viewTransition>
|
|
65
|
+
About
|
|
66
|
+
</Link>;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```vue [Vue]
|
|
70
|
+
<!-- Disable transition for this link -->
|
|
71
|
+
<Link href="/settings" :view-transition="false">Settings</Link>
|
|
72
|
+
|
|
73
|
+
<!-- Enable for just this link (even if globally disabled) -->
|
|
74
|
+
<Link href="/about" view-transition>About</Link>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```svelte [Svelte]
|
|
78
|
+
<!-- Disable transition for this link -->
|
|
79
|
+
<Link href="/settings" viewTransition={false}>Settings</Link>
|
|
80
|
+
|
|
81
|
+
<!-- Enable for just this link (even if globally disabled) -->
|
|
82
|
+
<Link href="/about" viewTransition>About</Link>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```tsx [Solid]
|
|
86
|
+
{
|
|
87
|
+
/* Disable transition for this link */
|
|
88
|
+
}
|
|
89
|
+
<Link href="/settings" viewTransition={false}>
|
|
90
|
+
Settings
|
|
91
|
+
</Link>;
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
/* Enable for just this link (even if globally disabled) */
|
|
95
|
+
}
|
|
96
|
+
<Link href="/about" viewTransition>
|
|
97
|
+
About
|
|
98
|
+
</Link>;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
:::
|
|
102
|
+
|
|
103
|
+
Or programmatically:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
router.visit('/about', { viewTransition: true });
|
|
107
|
+
router.visit('/settings', { viewTransition: false });
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Customizing with CSS
|
|
111
|
+
|
|
112
|
+
The default transition is a cross-fade. Customize it using the `::view-transition-old` and `::view-transition-new` pseudo-elements:
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
/* Faster transition */
|
|
116
|
+
::view-transition-old(root),
|
|
117
|
+
::view-transition-new(root) {
|
|
118
|
+
animation-duration: 0.2s;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Slide instead of fade */
|
|
122
|
+
::view-transition-old(root) {
|
|
123
|
+
animation: slide-out 0.3s ease-in;
|
|
124
|
+
}
|
|
125
|
+
::view-transition-new(root) {
|
|
126
|
+
animation: slide-in 0.3s ease-out;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Assign `view-transition-name` to elements that should animate independently (e.g., a hero image that morphs between pages):
|
|
131
|
+
|
|
132
|
+
```css
|
|
133
|
+
.hero-image {
|
|
134
|
+
view-transition-name: hero;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
::: tip
|
|
139
|
+
View transitions are progressive enhancement. Browsers that do not support the API fall back to instant navigation with no errors.
|
|
140
|
+
:::
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
outline: deep
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Queues
|
|
6
|
+
|
|
7
|
+
Void supports Cloudflare Queues for asynchronous message processing from a top-level `queues/` directory.
|
|
8
|
+
|
|
9
|
+
## Defining queues
|
|
10
|
+
|
|
11
|
+
Create files in `queues/**/*.ts`; `.mts`, `.js`, and `.mjs` also work. The queue name is inferred from the filename. For example, `queues/emails.ts` creates a queue named `"emails"`, and `queues/order/notifications.ts` creates `"order/notifications"`.
|
|
12
|
+
|
|
13
|
+
Each queue file should export a default handler wrapped with [`defineQueue`](../reference/api.md#definequeuet-handler). The generic `<T>` parameter defines the message body type. That is the type of each `msg.body` in the batch, and it is also used by the typed `queues` proxy for `send()` calls.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// queues/emails.ts
|
|
17
|
+
import { defineQueue } from 'void';
|
|
18
|
+
|
|
19
|
+
interface Message {
|
|
20
|
+
to: string;
|
|
21
|
+
subject: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default defineQueue<Message>(async (batch, env) => {
|
|
25
|
+
for (const msg of batch.messages) {
|
|
26
|
+
console.log(`Send to ${msg.body.to}: ${msg.body.subject}`);
|
|
27
|
+
msg.ack(); // Acknowledge successful processing
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Files or directories starting with `_` are ignored.
|
|
33
|
+
|
|
34
|
+
## Sending messages
|
|
35
|
+
|
|
36
|
+
Import the typed `queues` proxy from `void/queues` to send messages. Each queue is available as a property matching its name, with full type safety from the consumer's `defineQueue<T>` generic.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// routes/api/orders.ts
|
|
40
|
+
import { defineHandler } from 'void';
|
|
41
|
+
import { queues } from 'void/queues';
|
|
42
|
+
|
|
43
|
+
export const POST = defineHandler(async (c) => {
|
|
44
|
+
const order = await c.req.json();
|
|
45
|
+
// Fully typed: body must match the
|
|
46
|
+
// Message interface from queues/emails.ts
|
|
47
|
+
await queues.emails.send({
|
|
48
|
+
to: order.email,
|
|
49
|
+
subject: 'Order confirmed',
|
|
50
|
+
});
|
|
51
|
+
return c.json({ ok: true });
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The binding name is derived automatically: `QUEUE_` + queue name uppercased with non-alphanumeric characters replaced by `_`. For example, `queues/emails.ts` creates binding `QUEUE_EMAILS`.
|
|
56
|
+
|
|
57
|
+
## Per-message acknowledgment
|
|
58
|
+
|
|
59
|
+
Each message in the batch has `ack()` and `retry()` methods matching the [Cloudflare Queues API](https://developers.cloudflare.com/queues/configuration/consumer-concurrency/):
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
export default defineQueue<Message>(async (batch, env) => {
|
|
63
|
+
for (const msg of batch.messages) {
|
|
64
|
+
try {
|
|
65
|
+
await processMessage(msg.body);
|
|
66
|
+
msg.ack(); // Remove from queue
|
|
67
|
+
} catch {
|
|
68
|
+
msg.retry({ delaySeconds: 30 }); // Re-deliver after 30s
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- `msg.ack()`: acknowledge the message and remove it from the queue
|
|
75
|
+
- `msg.retry(options?)`: retry the message, optionally with a `{ delaySeconds }` delay
|
|
76
|
+
- `batch.ackAll()`: acknowledge all messages in the batch
|
|
77
|
+
- `batch.retryAll(options?)`: retry all messages in the batch
|
|
78
|
+
|
|
79
|
+
The first call wins for each message. Calling `ack()` after `retry()`, or the reverse, does nothing. Messages with no explicit decision are acknowledged if the handler succeeds, or retried if it throws.
|
|
80
|
+
|
|
81
|
+
The `timestamp` field on each message is a `Date` object.
|
|
82
|
+
|
|
83
|
+
## Consumer options
|
|
84
|
+
|
|
85
|
+
Export named constants to configure how Cloudflare delivers batches to your consumer:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// queues/emails.ts
|
|
89
|
+
import { defineQueue } from 'void';
|
|
90
|
+
|
|
91
|
+
interface Message {
|
|
92
|
+
to: string;
|
|
93
|
+
subject: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const maxBatchSize = 50;
|
|
97
|
+
export const maxBatchTimeout = 10; // seconds
|
|
98
|
+
export const maxRetries = 5;
|
|
99
|
+
export const retryDelay = 30; // seconds
|
|
100
|
+
|
|
101
|
+
export default defineQueue<Message>(async (batch, env) => {
|
|
102
|
+
for (const msg of batch.messages) {
|
|
103
|
+
console.log(`Send to ${msg.body.to}: ${msg.body.subject}`);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- `maxBatchSize`: maximum number of messages per batch (default `10`)
|
|
109
|
+
- `maxBatchTimeout`: maximum seconds to wait before delivering an incomplete batch (default `5`)
|
|
110
|
+
- `maxRetries`: maximum number of retries before a message is dead-lettered (default `3`)
|
|
111
|
+
- `retryDelay`: seconds to wait between retries (default `0`)
|
|
112
|
+
|
|
113
|
+
## Deployment behavior
|
|
114
|
+
|
|
115
|
+
On deploy, Void includes all discovered queues in the deploy manifest. The platform provisions Cloudflare Queues, configures producer bindings on the user worker, and registers the dispatch worker as the queue consumer for relay delivery.
|
|
116
|
+
|
|
117
|
+
## Local development
|
|
118
|
+
|
|
119
|
+
In **default Void mode**, Miniflare delivers queue batches natively — produce a message via the binding and the consumer fires automatically. The worker's `queue()` export serializes the batch and routes it to the same internal `/__queue` handler used in production, so behavior is consistent across environments.
|
|
120
|
+
|
|
121
|
+
You can also manually dispatch a batch by POSTing to the dev endpoint Void exposes:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
POST /__void/queue
|
|
125
|
+
Content-Type: application/json
|
|
126
|
+
{ "queue": "<queue-name>", "messages": [{ "id": "1", "timestamp": <unix_ms>, "body": <any>, "attempts": 1 }] }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The endpoint requires a local dev trigger token. Void prints a paste-ready curl command with the current token when the dev server starts.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
curl -X POST http://localhost:5173/__void/queue \
|
|
133
|
+
-H "Content-Type: application/json" \
|
|
134
|
+
-H "x-void-dev-trigger: <printed-token>" \
|
|
135
|
+
-d '{"queue":"my-queue","messages":[{"id":"1","timestamp":'"$(date +%s000)"',"body":{"hello":"world"},"attempts":1}]}'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If you set `__VOID_PROXY_TOKEN` in `.dev.vars`, that explicit token takes precedence and the printed curl command uses `x-void-internal: <your-token>` instead.
|
|
139
|
+
|
|
140
|
+
In **framework mode** (SvelteKit, Nuxt, Analog, Astro, TanStack Start, React Router, vinext), the `/__void/queue` endpoint runs inside the framework adapter's request pipeline (or the dev miniflare for Class A frameworks), so the consumer sees whatever bindings the adapter exposes (D1, KV, R2, queue producers, etc.). Native Miniflare queue delivery is not wired up in framework mode — use the manual dispatch endpoint to exercise a consumer.
|