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 { KvNamespace, Text } from "@alchemy.run/cloudflare-runtime/core/bindings"; |
| 2 | import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options"; |
| 3 | import * as SvelteKit from "@alchemy.run/frontend-frameworks/sveltekit"; |
| 4 | |
| 5 | const SECRET = "s3cret-from-binding"; |
| 6 | // FIXTURE_OVERRIDE exists as a real Text binding ("proxied-value") AND as a |
| 7 | // framework-level `dev.env` literal ("literal-override"): in dev the literal |
| 8 | // must win over the value served through the platform proxy (back-compat with |
| 9 | // the phase-1 stub platform); live serves the binding value. |
| 10 | const OVERRIDE_BINDING_VALUE = "proxied-value"; |
| 11 | const OVERRIDE_LITERAL_VALUE = "literal-override"; |
| 12 | |
| 13 | export default Options.make({ |
| 14 | // The typed factory form (harness contract form 3): map the harness |
| 15 | // options onto SvelteKit options, then pin the dev port so parallel fixture |
| 16 | // runs don't collide. `framework: "@alchemy.run/frontend-frameworks/sveltekit"` (the string |
| 17 | // form) works identically when no framework-specific options are needed. |
| 18 | // The deploy target defaults to `@alchemy.run/frontend-frameworks/sveltekit/cloudflare`. |
| 19 | framework: (options) => { |
| 20 | const base = SvelteKit.fromHarnessOptions(options as SvelteKit.HarnessOptions); |
| 21 | return SvelteKit.layer({ |
| 22 | ...base, |
| 23 | dev: { |
| 24 | ...base.dev, |
| 25 | port: 3103, |
| 26 | env: { FIXTURE_OVERRIDE: OVERRIDE_LITERAL_VALUE }, |
| 27 | }, |
| 28 | }); |
| 29 | }, |
| 30 | // Target-scoped config carriage: `target.cloudflare.worker` is what the |
| 31 | // framework package reads (compat date/flags, bindings, assets behavior); |
| 32 | // `target.cloudflare.preview` configures the miniflare preview server the |
| 33 | // harness's cloudflare target serves built output with. |
| 34 | target: { |
| 35 | cloudflare: { |
| 36 | worker: { |
| 37 | compatibilityDate: "2026-03-10", |
| 38 | compatibilityFlags: ["nodejs_compat"], |
| 39 | worker: { |
| 40 | name: "fixtures-sveltekit", |
| 41 | bindings: [ |
| 42 | Text.local("FIXTURE_SECRET", SECRET), |
| 43 | Text.local("FIXTURE_OVERRIDE", OVERRIDE_BINDING_VALUE), |
| 44 | // a real (non-literal) resource binding: served in dev through |
| 45 | // cloudflare-runtime's platform proxy |
| 46 | KvNamespace.local({ binding: "FIXTURE_KV" }), |
| 47 | ], |
| 48 | assets: { |
| 49 | htmlHandling: "auto-trailing-slash", |
| 50 | notFoundHandling: "none", |
| 51 | runWorkerFirst: false, |
| 52 | }, |
| 53 | }, |
| 54 | }, |
| 55 | preview: { |
| 56 | compatibilityDate: "2026-03-10", |
| 57 | compatibilityFlags: ["nodejs_compat"], |
| 58 | bindings: { |
| 59 | FIXTURE_SECRET: SECRET, |
| 60 | FIXTURE_OVERRIDE: OVERRIDE_BINDING_VALUE, |
| 61 | }, |
| 62 | kvNamespaces: ["FIXTURE_KV"], |
| 63 | assets: { |
| 64 | binding: "ASSETS", |
| 65 | routerConfig: { |
| 66 | has_user_worker: true, |
| 67 | invoke_user_worker_ahead_of_assets: false, |
| 68 | }, |
| 69 | assetConfig: { |
| 70 | html_handling: "auto-trailing-slash", |
| 71 | not_found_handling: "none", |
| 72 | }, |
| 73 | }, |
| 74 | }, |
| 75 | }, |
| 76 | }, |
| 77 | }); |