| 1 | import * as Astro from "@alchemy.run/frontend-frameworks/astro"; |
| 2 | import cloudflare from "@alchemy.run/frontend-frameworks/astro/cloudflare"; |
| 3 | import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options"; |
| 4 | |
| 5 | export default Options.make({ |
| 6 | // Target-scoped config carriage: `target.cloudflare` carries the worker |
| 7 | // config (dev/build) and the miniflare preview config. |
| 8 | target: { |
| 9 | cloudflare: { |
| 10 | worker: { |
| 11 | compatibilityDate: "2026-03-10", |
| 12 | compatibilityFlags: ["nodejs_compat"], |
| 13 | worker: { |
| 14 | name: "fixtures-astro-static", |
| 15 | bindings: [], |
| 16 | assets: { |
| 17 | htmlHandling: "auto-trailing-slash", |
| 18 | notFoundHandling: "404-page", |
| 19 | }, |
| 20 | }, |
| 21 | }, |
| 22 | // ASSETS-ONLY preview: a fully-static Astro build must deploy with no |
| 23 | // user worker. The harness (CloudflareTarget.serve) detects the |
| 24 | // module-less BuildOutput, synthesizes the stub script miniflare |
| 25 | // requires, and forces `has_user_worker: false` itself — the fixture |
| 26 | // declares only the asset semantics (the built 404.html serves via |
| 27 | // `not_found_handling: "404-page"`). |
| 28 | preview: { |
| 29 | compatibilityDate: "2026-03-10", |
| 30 | compatibilityFlags: ["nodejs_compat"], |
| 31 | assets: { |
| 32 | binding: "ASSETS", |
| 33 | routerConfig: { |
| 34 | invoke_user_worker_ahead_of_assets: false, |
| 35 | }, |
| 36 | assetConfig: { |
| 37 | html_handling: "auto-trailing-slash", |
| 38 | not_found_handling: "404-page", |
| 39 | }, |
| 40 | }, |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | // Deliberately NO `astro:` overrides — this fixture's Astro configuration |
| 45 | // lives in its real `astro.config.mjs` (`output: "static"`), which the |
| 46 | // integration must load and honor (the user-config principle). |
| 47 | framework: (options) => |
| 48 | Astro.layer({ |
| 49 | target: cloudflare({ |
| 50 | worker: Options.resolveCloudflareOptions(options).worker, |
| 51 | }), |
| 52 | }), |
| 53 | }); |