@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 58 lines 2.15 KB
Raw
1 import { 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 // Read by the /api/widgets endpoint via `platform.env` — the point of this
6 // fixture: even with `ssr = false` (pure SPA), +server.ts endpoints still run
7 // server-side in the worker, with real bindings.
8 export const FIXTURE_MESSAGE = "hello-from-sveltekit-spa-binding";
9
10 export default Options.make({
11 // Typed factory form: map harness options onto SvelteKit options, then pin
12 // the dev port so parallel fixture runs don't collide.
13 framework: (options) => {
14 const base = SvelteKit.fromHarnessOptions(options as SvelteKit.HarnessOptions);
15 return SvelteKit.layer({
16 ...base,
17 dev: { ...base.dev, port: 3108 },
18 });
19 },
20 target: {
21 cloudflare: {
22 worker: {
23 compatibilityDate: "2026-03-10",
24 compatibilityFlags: ["nodejs_compat"],
25 worker: {
26 name: "fixtures-sveltekit-spa",
27 bindings: [Text.local("FIXTURE_MESSAGE", FIXTURE_MESSAGE)],
28 assets: {
29 htmlHandling: "auto-trailing-slash",
30 // The SPA mode under test: drives the adapter's fallback-page
31 // generation (`builder.generateFallback` -> index.html) and must
32 // flow through to the deployed assets' not_found_handling.
33 notFoundHandling: "single-page-application",
34 runWorkerFirst: false,
35 },
36 },
37 },
38 preview: {
39 compatibilityDate: "2026-03-10",
40 compatibilityFlags: ["nodejs_compat"],
41 bindings: { FIXTURE_MESSAGE },
42 assets: {
43 binding: "ASSETS",
44 routerConfig: {
45 has_user_worker: true,
46 invoke_user_worker_ahead_of_assets: false,
47 },
48 assetConfig: {
49 html_handling: "auto-trailing-slash",
50 // The preview must honor the SPA fallback the adapter emitted:
51 // unmatched paths serve the generated index.html app shell.
52 not_found_handling: "single-page-application",
53 },
54 },
55 },
56 },
57 },
58 });