The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import { DurableObjectNamespace, Text } from "@alchemy.run/cloudflare-runtime/core/bindings"; |
| 2 | import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options"; |
| 3 | import wakuFramework from "@alchemy.run/frontend-frameworks/waku"; |
| 4 | |
| 5 | export const FIXTURE_MESSAGE = "hello-from-waku-do-binding"; |
| 6 | |
| 7 | /** |
| 8 | * A waku app plus the user's own Durable Object hosted on the SAME worker. |
| 9 | * The user's `main` module (src/worker-entry.ts) wraps waku's emitted fetch |
| 10 | * handler (via `virtual:waku/server-entry`) and additionally exports |
| 11 | * `class Counter` (a SQLite DO). See README for how the user-entry seam |
| 12 | * threads through the waku cloudflare target. |
| 13 | */ |
| 14 | export default Options.make({ |
| 15 | target: { |
| 16 | cloudflare: { |
| 17 | worker: { |
| 18 | // The user-entry seam: takes precedence over waku's pinned rsc |
| 19 | // entry, mirroring Website.Vite's `main` ("Custom Worker Entry" |
| 20 | // JSDoc in packages/alchemy/src/Cloudflare/Website/Vite.ts). The |
| 21 | // module wraps waku's server entry and re-exports the Counter DO |
| 22 | // class. |
| 23 | main: "./src/worker-entry.ts", |
| 24 | compatibilityDate: "2026-03-10", |
| 25 | compatibilityFlags: ["nodejs_als"], |
| 26 | worker: { |
| 27 | name: "fixtures-waku-durable-objects", |
| 28 | bindings: [ |
| 29 | Text.local("MESSAGE", FIXTURE_MESSAGE), |
| 30 | // Bind the namespace for a DO class exported by THIS worker. |
| 31 | DurableObjectNamespace.local({ |
| 32 | binding: "COUNTER", |
| 33 | className: "Counter", |
| 34 | }), |
| 35 | ], |
| 36 | // The dev runtime's DO declaration (workerd durableObjectNamespaces). |
| 37 | durableObjectNamespaces: [{ className: "Counter", sql: true }], |
| 38 | assets: { |
| 39 | htmlHandling: "drop-trailing-slash", |
| 40 | notFoundHandling: "none", |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | preview: { |
| 45 | compatibilityDate: "2026-03-10", |
| 46 | compatibilityFlags: ["nodejs_als"], |
| 47 | bindings: { MESSAGE: FIXTURE_MESSAGE }, |
| 48 | // Miniflare's DO declaration for the preview server: binding name -> |
| 49 | // class exported by the built worker bundle. |
| 50 | durableObjects: { COUNTER: { className: "Counter", useSQLite: true } }, |
| 51 | assets: { |
| 52 | routerConfig: { |
| 53 | has_user_worker: true, |
| 54 | invoke_user_worker_ahead_of_assets: false, |
| 55 | }, |
| 56 | assetConfig: { |
| 57 | html_handling: "drop-trailing-slash", |
| 58 | not_found_handling: "none", |
| 59 | has_static_routing: false, |
| 60 | }, |
| 61 | }, |
| 62 | }, |
| 63 | }, |
| 64 | }, |
| 65 | framework: (options) => wakuFramework({ ...options, port: 3110 }), |
| 66 | }); |