void 0.9.1 → 0.9.3
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/README.md +1 -0
- package/dist/{better-auth-shared-ChVbrq52.mjs → better-auth-shared-QAfk8CAS.mjs} +1 -1
- package/dist/cli/cli.mjs +14 -14
- package/dist/{config-BVEC0lti.mjs → config-8dLIngKW.mjs} +1 -1
- package/dist/{db-DiddQC2v.mjs → db-UW4IYQFw.mjs} +4 -4
- package/dist/{deploy-CRU9fGjE.mjs → deploy-RQXpVBL-.mjs} +27 -10
- package/dist/{domain-DxTc6HDn.mjs → domain-B7RntQ1r.mjs} +12 -27
- package/dist/{drizzle-2fs1qTgy.mjs → drizzle-DYstYz0j.mjs} +1 -1
- package/dist/{env-Bvw0wMTI.mjs → env-C_ZcxxED.mjs} +2 -2
- package/dist/{env-types-D6qI1ThV.mjs → env-types-CaJaIRXU.mjs} +1 -1
- package/dist/{env-validation-DBJsxZLz.mjs → env-validation-LH6eoyW-.mjs} +3 -3
- package/dist/{gen-CZdNWIaA.mjs → gen-O5mXZ76K.mjs} +2 -2
- package/dist/{handler-xflsMwWM.d.mts → handler-hm9KldPP.d.mts} +21 -1
- package/dist/{headers-Y0jshugF.mjs → headers-VkAnACKX.mjs} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +48 -43
- package/dist/{init-BHupO7Fm.mjs → init-DGrLx2ls.mjs} +5 -5
- package/dist/{node-CHWVVjO6.mjs → node-Df8UjQ2H.mjs} +2 -2
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/index.d.mts +7 -5
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +29 -11
- package/dist/{plugin-inference-BUBhHt_1.mjs → plugin-inference--7geW5Z2.mjs} +1 -1
- package/dist/{prepare-CrlAVbWS.mjs → prepare-DT-7QII_.mjs} +14 -19
- package/dist/{preset-CIJG2O7a.mjs → preset-2aBxMfY1.mjs} +1 -1
- package/dist/{project-tsconfig-HAGjfY6w.mjs → project-tsconfig-BTNuNoJ0.mjs} +18 -4
- package/dist/{protocol-DYca39yJ.d.mts → protocol-B9GZA4Bn.d.mts} +7 -4
- package/dist/{route-types-jxRfWuCb.mjs → route-types-D03ryMXz.mjs} +3 -2
- package/dist/runtime/ai.d.mts +20 -100
- package/dist/runtime/ai.mjs +101 -54
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/handler.d.mts +2 -2
- package/dist/runtime/handler.mjs +67 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{scan-BNC_1OsY.mjs → scan-B2H1Vo2C.mjs} +3 -3
- package/dist/{scan-2YmJkYAf.mjs → scan-VCAM1oh3.mjs} +55 -29
- package/dist/{types-Dm9kep2X.d.mts → types-DEWCqHtl.d.mts} +12 -3
- package/package.json +2 -2
- package/skills/void/docs/guide/ai.md +109 -51
- package/skills/void/docs/guide/pages-routing/layouts.md +8 -7
- package/skills/void/docs/guide/pages-routing/loaders.md +1 -1
- package/skills/void/docs/guide/pages-routing/overview.md +32 -5
- package/skills/void/docs/guide/server-routing.md +28 -0
- package/skills/void/docs/node_modules/void/AGENTS.md +15 -14
- package/skills/void/docs/node_modules/void/README.md +1 -0
- package/skills/void/docs/reference/api.md +53 -3
- package/skills/void/docs/reference/cli.md +4 -2
- package/skills/void/docs/reference/config.md +1 -1
- /package/dist/{dist-DR9sIMbM.mjs → dist-5cGIJHQQ.mjs} +0 -0
- /package/dist/{dotenv-Bkoqyq9r.mjs → dotenv-lS94ymhM.mjs} +0 -0
- /package/dist/{log-CWWZV4V1.mjs → log-BdD_Fpms.mjs} +0 -0
- /package/dist/{providers-uC0PJg1c.mjs → providers-BwPbdHdi.mjs} +0 -0
|
@@ -23,6 +23,7 @@ Non-CF targets disable CF-only bindings (`void/db`, `void/kv`, `void/auth`, `voi
|
|
|
23
23
|
- `defineHandler(fn)` — wraps a route handler `(c: CloudContext) => R`, returns `TypedHandler<{}, R>`
|
|
24
24
|
- `defineHandler.withValidator(validators)(fn)` — validates body/query/params via Standard Schema before calling handler, returns `TypedHandler<V, R>` with phantom types for codegen
|
|
25
25
|
- `defineMiddleware(fn)` — wraps Hono middleware `(c, next) => void`
|
|
26
|
+
- `basicAuth(options)` — built-in Basic Auth middleware for temporary site gates; excludes Void internals under `/__void`
|
|
26
27
|
- Handlers can return plain objects/strings (auto-converted via `convertReturnValue`) or use Hono's `c.json()` / `c.text()` directly.
|
|
27
28
|
- Route files use **named HTTP method exports** (`export const GET`, `export const POST`, etc.) — one file per path, multiple methods per file.
|
|
28
29
|
|
|
@@ -90,20 +91,20 @@ src/
|
|
|
90
91
|
|
|
91
92
|
### Package Exports
|
|
92
93
|
|
|
93
|
-
| Subpath | What
|
|
94
|
-
| ---------------- |
|
|
95
|
-
| `void` | `voidPlugin()` named export + `defineHandler` + `defineMiddleware` + `defineHead` + `defineQueue` + `CloudContext` type |
|
|
96
|
-
| `void/handler` | `defineHandler()`, `defineHandler.withValidator()`, `defineMiddleware()`, `defineHead()`, types
|
|
97
|
-
| `void/response` | `convertReturnValue()`
|
|
98
|
-
| `void/validator` | `runValidation()`, `ValidatorSlots`, `HandlerInput` types
|
|
99
|
-
| `void/routes` | Empty `RouteMap` + `WebSocketRouteMap` stubs (augmented by generated `routes.d.ts`)
|
|
100
|
-
| `void/client` | Typed `fetch()` client + `fetchStream()` SSE consumer + `FetchError`
|
|
101
|
-
| `void/ws` | `defineRoom()`, `defineWebSocket()`, typed `connect()`, and WebSocket context types
|
|
102
|
-
| `void/db` | `db` Drizzle D1 instance (auto-wired with user schema) + `createDb()` for custom D1 bindings
|
|
103
|
-
| `void/queues` | `queues` typed proxy + `QueueMap` stub interface (augmented by generated `queues.d.ts`)
|
|
104
|
-
| `void/ai` | `ai` proxy — `ai.run()`, `ai.stream()`, `ai.models()` with auto-detected backend (service binding / HTTPS / direct)
|
|
105
|
-
| `void/log` | `logger.error/warn/info(msg, fields?)` — emits stringified JSON to `console.*` so Cloudflare Tail captures level + msg
|
|
106
|
-
| `void/env` | `defineEnv()`, typed `env` proxy, built-in schema helpers (`string`, `number`, `oneOf`, …) + global Cloudflare types
|
|
94
|
+
| Subpath | What |
|
|
95
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `void` | `voidPlugin()` named export + `defineHandler` + `defineMiddleware` + `basicAuth` + `defineHead` + `defineQueue` + `CloudContext` type |
|
|
97
|
+
| `void/handler` | `defineHandler()`, `defineHandler.withValidator()`, `defineMiddleware()`, `basicAuth()`, `defineHead()`, types |
|
|
98
|
+
| `void/response` | `convertReturnValue()` |
|
|
99
|
+
| `void/validator` | `runValidation()`, `ValidatorSlots`, `HandlerInput` types |
|
|
100
|
+
| `void/routes` | Empty `RouteMap` + `WebSocketRouteMap` stubs (augmented by generated `routes.d.ts`) |
|
|
101
|
+
| `void/client` | Typed `fetch()` client + `fetchStream()` SSE consumer + `FetchError` |
|
|
102
|
+
| `void/ws` | `defineRoom()`, `defineWebSocket()`, typed `connect()`, and WebSocket context types |
|
|
103
|
+
| `void/db` | `db` Drizzle D1 instance (auto-wired with user schema) + `createDb()` for custom D1 bindings |
|
|
104
|
+
| `void/queues` | `queues` typed proxy + `QueueMap` stub interface (augmented by generated `queues.d.ts`) |
|
|
105
|
+
| `void/ai` | `ai` proxy — `ai.run()`, `ai.stream()`, `ai.models()` with auto-detected backend (service binding / HTTPS / direct) |
|
|
106
|
+
| `void/log` | `logger.error/warn/info(msg, fields?)` — emits stringified JSON to `console.*` so Cloudflare Tail captures level + msg |
|
|
107
|
+
| `void/env` | `defineEnv()`, typed `env` proxy, built-in schema helpers (`string`, `number`, `oneOf`, …) + global Cloudflare types |
|
|
107
108
|
|
|
108
109
|
The CLI binary is at `dist/cli/cli.mjs` (declared in `bin` field of package.json).
|
|
109
110
|
|
|
@@ -118,6 +118,49 @@ export default defineMiddleware(async (c, next) => {
|
|
|
118
118
|
function defineMiddleware(handler: MiddlewareHandler<CloudEnv>): MiddlewareHandler<CloudEnv>;
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### `basicAuth(options)`
|
|
122
|
+
|
|
123
|
+
Built-in Basic authentication middleware for temporary site gates and pre-launch protection. Use it from `middleware/` with credentials from `void/env` to protect the whole app, or pass it to `defineHandler()` for a single route.
|
|
124
|
+
|
|
125
|
+
Void internal endpoints under `/__void` are always excluded so deploy-time migrations, prerendering, cron/queue dispatch, and remote binding helpers still reach Void's own internal-token checks.
|
|
126
|
+
|
|
127
|
+
When credentials come from `void/env`, wrap the reads in functions so they are resolved per request after Void has bound the runtime env.
|
|
128
|
+
|
|
129
|
+
For app-specific bypasses such as health checks or public webhooks, compose that logic in your own middleware before calling `basicAuth()`.
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
// env.ts
|
|
133
|
+
import { defineEnv, string } from 'void/env';
|
|
134
|
+
|
|
135
|
+
export default defineEnv({
|
|
136
|
+
BASIC_AUTH_USERNAME: string(),
|
|
137
|
+
BASIC_AUTH_PASSWORD: string(),
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
// middleware/01.basic-auth.ts
|
|
143
|
+
import { basicAuth } from 'void';
|
|
144
|
+
import { env } from 'void/env';
|
|
145
|
+
|
|
146
|
+
export default basicAuth({
|
|
147
|
+
username: () => env.BASIC_AUTH_USERNAME,
|
|
148
|
+
password: () => env.BASIC_AUTH_PASSWORD,
|
|
149
|
+
realm: 'Preview',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Signature:**
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
function basicAuth(options: {
|
|
157
|
+
username: string | (() => string);
|
|
158
|
+
password: string | (() => string);
|
|
159
|
+
realm?: string | (() => string);
|
|
160
|
+
message?: string | (() => string);
|
|
161
|
+
}): MiddlewareHandler<CloudEnv>;
|
|
162
|
+
```
|
|
163
|
+
|
|
121
164
|
### `defineScheduled(handler)`
|
|
122
165
|
|
|
123
166
|
Wraps a Cloudflare [Scheduled handler](https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/) with type inference.
|
|
@@ -675,7 +718,7 @@ Imported from `"void/ai"`.
|
|
|
675
718
|
|
|
676
719
|
### `ai`
|
|
677
720
|
|
|
678
|
-
Typed AI client for
|
|
721
|
+
Typed AI client for Cloudflare AI models and provider-native AI Gateway requests.
|
|
679
722
|
|
|
680
723
|
```ts
|
|
681
724
|
import { ai } from 'void/ai';
|
|
@@ -683,9 +726,16 @@ import { ai } from 'void/ai';
|
|
|
683
726
|
const result = await ai.run('@cf/meta/llama-3.1-8b-instruct', {
|
|
684
727
|
messages: [{ role: 'user', content: 'Summarize this release note.' }],
|
|
685
728
|
});
|
|
729
|
+
|
|
730
|
+
const response = await ai.provider('openai').fetch('/chat/completions', {
|
|
731
|
+
body: {
|
|
732
|
+
model: 'gpt-4o',
|
|
733
|
+
messages: [{ role: 'user', content: 'Summarize this release note.' }],
|
|
734
|
+
},
|
|
735
|
+
});
|
|
686
736
|
```
|
|
687
737
|
|
|
688
|
-
**Key exports:** `ai`, `VoidAi`,
|
|
738
|
+
**Key exports:** `ai`, `VoidAi`, provider request types. See [AI](../guide/ai.md) for provider setup and streaming examples.
|
|
689
739
|
|
|
690
740
|
## ISR
|
|
691
741
|
|
|
@@ -1098,7 +1148,7 @@ This table lists app-facing imports. Exported implementation subpaths such as `v
|
|
|
1098
1148
|
| Import path | Contents |
|
|
1099
1149
|
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1100
1150
|
| `void` | `voidPlugin`, handler/type re-exports, `defer`, `Deferred`, `DeferredState`, `InferProps`, `HeadDescriptor` |
|
|
1101
|
-
| `void/handler` | `defineHandler`, `defineMiddleware`, `defineScheduled`, `defineQueue`, `defineRender`, `defineHead`, types
|
|
1151
|
+
| `void/handler` | `defineHandler`, `defineMiddleware`, `basicAuth`, `defineScheduled`, `defineQueue`, `defineRender`, `defineHead`, types |
|
|
1102
1152
|
| `void/auth` | `defineAuth`, `getUser`, `getSession`, `requireAuth`, `AuthUser`, `AuthSession`, `AuthState` |
|
|
1103
1153
|
| `void/client` | `fetch`, `fetchStream`, `FetchError`, `auth`, `createAuthClient`, `AuthUser`, `AuthSession`, `AuthState` |
|
|
1104
1154
|
| `void/client/{framework}` | Same as `void/client`, with framework-specific Better Auth clients for `react`, `vue`, `svelte`, and `solid` |
|
|
@@ -572,7 +572,9 @@ See [Environment Variables](../guide/env-vars.md) for the full guide.
|
|
|
572
572
|
void domain add <hostname> [--project <name>]
|
|
573
573
|
```
|
|
574
574
|
|
|
575
|
-
Add a custom domain to a project. Prints the
|
|
575
|
+
Add a custom domain to a project. Prints the two DNS records to add at your DNS provider: a traffic **CNAME** pointing `<hostname>` at the CNAME target shown in the command output, and a non-rotating `_cf-custom-hostname` ownership **TXT**. Certificates are validated over HTTP at Cloudflare's edge and renew automatically — there are no `_acme-challenge` records to publish, at first issuance or ever. After adding the records the domain activates automatically (no polling required); run `void domain status <hostname>` to check progress.
|
|
576
|
+
|
|
577
|
+
> Wildcard custom hostnames (`*.example.com`) are not supported — register each subdomain individually.
|
|
576
578
|
|
|
577
579
|
### `void domain delete`
|
|
578
580
|
|
|
@@ -596,7 +598,7 @@ List all custom domains and their status (active/pending).
|
|
|
596
598
|
void domain status <hostname> [--project <name>] [--verbose]
|
|
597
599
|
```
|
|
598
600
|
|
|
599
|
-
Check verification and SSL status for a specific domain. Prints a rolled-up state (`awaiting_dns`, `verifying_dns`, `issuing_cert`, `deploying_cert`, `awaiting_deployment`, `active`, `error`, or `pending`) with a one-line diagnostic explaining what Cloudflare is doing and any user action required.
|
|
601
|
+
Check verification and SSL status for a specific domain. Prints a rolled-up state (`awaiting_dns`, `verifying_dns`, `issuing_cert`, `deploying_cert`, `awaiting_deployment`, `active`, `error`, or `pending`) with a one-line diagnostic explaining what Cloudflare is doing and any user action required. While the certificate is not yet active, the command also surfaces the records to configure — the traffic **CNAME** and the `_cf-custom-hostname` ownership **TXT** — so you can verify them. Activation is automatic: a background job reconciles pending domains (about every 2 minutes for the first 30 minutes after adding, then hourly), so this command is for instant feedback rather than required polling.
|
|
600
602
|
|
|
601
603
|
Pass `--verbose` to additionally print the raw multi-line status breakdown (DB status, SSL status, ownership state, verification errors) underneath the rollup.
|
|
602
604
|
|
|
@@ -172,7 +172,7 @@ Output mode. Controls the default rendering strategy for pages.
|
|
|
172
172
|
|
|
173
173
|
When set to `"static"`, all pages are prerendered at build time as static HTML files written to `dist/client/`. Individual pages can opt out with `export const prerender = false`. Dynamic pages (with route params) without a `getPrerenderPaths()` export are implicitly not prerendered.
|
|
174
174
|
|
|
175
|
-
When omitted or set to `"server"`, pages are server-rendered on request. Individual pages can opt into deploy-time prerendering with `export const prerender = true`.
|
|
175
|
+
When omitted or set to `"server"`, pages are server-rendered on request. Individual pages can opt into deploy-time prerendering with `export const prerender = true`, or opt out of server-rendered component HTML with `export const ssr = false`.
|
|
176
176
|
|
|
177
177
|
```json
|
|
178
178
|
{ "output": "static" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|