| 1 | import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options"; |
| 2 | import * as Octane from "@alchemy.run/frontend-frameworks/octane"; |
| 3 | |
| 4 | const SECRET = "s3cret-from-binding"; |
| 5 | |
| 6 | /** |
| 7 | * An OctaneJS fullstack app (SSR + server route) built through the project's |
| 8 | * own `vite build`: `@octanejs/vite-plugin` produces `dist/client` + |
| 9 | * `dist/server/entry.js`, and `@octanejs/adapter-cloudflare` emits the module |
| 10 | * Worker entry at `dist/server/worker.js` — wrangler-free. |
| 11 | * |
| 12 | * Octane's intended asset routing is asset-first with SSR on miss: exact |
| 13 | * files in `dist/client` are served without invoking the Worker, and every |
| 14 | * miss reaches Octane SSR (`not_found_handling: "none"`). |
| 15 | * |
| 16 | * Dev note: Octane's dev middleware supplies no `context.platform`, so the |
| 17 | * FIXTURE_SECRET binding is observable in live/preview mode only. |
| 18 | */ |
| 19 | export default Options.make({ |
| 20 | // The typed factory form (harness contract form 3): map the harness |
| 21 | // options onto Octane options, then pin the dev port so parallel fixture |
| 22 | // runs don't collide. `framework: "@alchemy.run/frontend-frameworks/octane"` (the string |
| 23 | // form) works identically when no framework-specific options are needed. |
| 24 | // The deploy target defaults to `@alchemy.run/frontend-frameworks/octane/cloudflare`. |
| 25 | framework: (options) => { |
| 26 | const base = Octane.fromHarnessOptions(options as Octane.HarnessOptions); |
| 27 | return Octane.layer({ |
| 28 | ...base, |
| 29 | dev: { port: 3112 }, |
| 30 | }); |
| 31 | }, |
| 32 | target: { |
| 33 | cloudflare: { |
| 34 | worker: { |
| 35 | compatibilityDate: "2026-03-10", |
| 36 | compatibilityFlags: ["nodejs_compat"], |
| 37 | worker: { |
| 38 | name: "fixtures-octane", |
| 39 | }, |
| 40 | }, |
| 41 | preview: { |
| 42 | compatibilityDate: "2026-03-10", |
| 43 | compatibilityFlags: ["nodejs_compat"], |
| 44 | bindings: { FIXTURE_SECRET: SECRET }, |
| 45 | assets: { |
| 46 | binding: "ASSETS", |
| 47 | routerConfig: { |
| 48 | has_user_worker: true, |
| 49 | invoke_user_worker_ahead_of_assets: false, |
| 50 | }, |
| 51 | assetConfig: { |
| 52 | html_handling: "auto-trailing-slash", |
| 53 | not_found_handling: "none", |
| 54 | }, |
| 55 | }, |
| 56 | }, |
| 57 | }, |
| 58 | }, |
| 59 | }); |