1import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options";
2import path from "node:path";
3
4// Target-scoped config carriage (the canonical form): `target.cloudflare`
5// carries the worker config (dev/build) and the miniflare preview config.
6// The deprecated top-level `vite`/`miniflare` aliases keep working for
7// fixtures that still use them.
8//
9// Static site WITH a worker in front: `main` builds `src/server.ts` as the
10// user worker. Assets are matched first (`runWorkerFirst` unset), so the
11// worker only sees requests no static asset answers — the `/api/hello`
12// route plus everything unmatched (`not_found_handling: "none"` means the
13// asset layer never falls back; the worker owns the 404).
14export default Options.make({
15 target: {
16 cloudflare: {
17 worker: {
18 main: path.resolve(import.meta.dirname, "src/server.ts"),
19 compatibilityDate: "2026-03-10",
20 compatibilityFlags: ["nodejs_compat"],
21 worker: {
22 name: "fixtures-static-website",
23 bindings: [],
24 assets: {
25 htmlHandling: "auto-trailing-slash",
26 notFoundHandling: "none",
27 },
28 },
29 },
30 preview: {
31 assets: {
32 routerConfig: {
33 has_user_worker: true,
34 invoke_user_worker_ahead_of_assets: false,
35 debug: true,
36 },
37 assetConfig: {
38 html_handling: "auto-trailing-slash",
39 not_found_handling: "none",
40 debug: true,
41 has_static_routing: false,
42 },
43 },
44 },
45 },
46 },
47});