1import { Text } from "@alchemy.run/cloudflare-runtime/core/bindings";
2import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options";
3import * as Config from "effect/Config";
4import * as Effect from "effect/Effect";
5
6export default Config.String("TEST_POSTGRES_URL").pipe(
7 Config.orElse(() => Config.succeed("")),
8 Effect.map((url) =>
9 Options.make({
10 vite: {
11 compatibilityDate: "2026-03-10",
12 compatibilityFlags: ["nodejs_compat"],
13 worker: {
14 name: "fixtures-tanstack-start",
15 bindings: [Text.local("TEST_POSTGRES_URL", url)],
16 assets: {
17 // Assets are matched ahead of the worker (`runWorkerFirst`
18 // deliberately unset): the TanStack worker has no ASSETS-binding
19 // fallback, so `runWorkerFirst: true` would 404 every static
20 // asset (verified against miniflare with
21 // `invoke_user_worker_ahead_of_assets: true`). This now matches
22 // the preview router config below — the two used to disagree.
23 htmlHandling: "auto-trailing-slash",
24 notFoundHandling: "none",
25 },
26 },
27 },
28 miniflare: {
29 compatibilityDate: "2026-03-10",
30 compatibilityFlags: ["nodejs_compat"],
31 bindings: { TEST_POSTGRES_URL: url },
32 assets: {
33 routerConfig: {
34 has_user_worker: true,
35 // Parity with the worker config above: assets first, worker for
36 // everything unmatched.
37 invoke_user_worker_ahead_of_assets: false,
38 debug: true,
39 },
40 assetConfig: {
41 html_handling: "auto-trailing-slash",
42 not_found_handling: "none",
43 debug: true,
44 has_static_routing: false,
45 },
46 },
47 },
48 }),
49 ),
50);