The best way to control Claude Code, Codex and more from any computer or phone

main
ts 63 lines 2.28 KB
Raw
1 import { Assets, Text } from "@alchemy.run/cloudflare-runtime/core/bindings";
2 import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options";
3 import * as Astro from "@alchemy.run/frontend-frameworks/astro";
4 import cloudflare from "@alchemy.run/frontend-frameworks/astro/cloudflare";
5
6 export const FIXTURE_VALUE = "hello-from-astro-binding";
7
8 export default Options.make({
9 // Target-scoped config carriage (the canonical form): `target.cloudflare`
10 // carries the worker config (dev/build) and the miniflare preview config.
11 target: {
12 cloudflare: {
13 worker: {
14 compatibilityDate: "2026-03-10",
15 compatibilityFlags: ["nodejs_compat"],
16 worker: {
17 name: "fixtures-astro",
18 bindings: [Assets.local("ASSETS"), Text.local("FIXTURE_VALUE", FIXTURE_VALUE)],
19 assets: {
20 htmlHandling: "auto-trailing-slash",
21 notFoundHandling: "none",
22 },
23 },
24 },
25 preview: {
26 compatibilityDate: "2026-03-10",
27 compatibilityFlags: ["nodejs_compat"],
28 bindings: { FIXTURE_VALUE },
29 // Zero-config sessions: the built app reads the SESSION KV binding.
30 kvNamespaces: ["SESSION"],
31 assets: {
32 binding: "ASSETS",
33 routerConfig: {
34 has_user_worker: true,
35 invoke_user_worker_ahead_of_assets: false,
36 },
37 assetConfig: {
38 html_handling: "auto-trailing-slash",
39 not_found_handling: "none",
40 },
41 },
42 },
43 },
44 },
45 // The typed form: build the Cloudflare deploy target as a *value* from the
46 // shared worker options and pass it to the framework (`target:`). Astro
47 // config rides alongside (the dev toolbar would differ between dev and the
48 // built output, breaking the shared screenshots).
49 framework: (options) =>
50 Astro.layer({
51 target: cloudflare({
52 worker: Options.resolveCloudflareOptions(options).worker,
53 }),
54 astro: {
55 devToolbar: { enabled: false },
56 redirects: { "/old-about": "/about/" },
57 // Emit stylesheets as hashed /_astro/ assets (instead of inlining)
58 // so the generated _headers immutable Cache-Control rule is
59 // observable end-to-end in live mode.
60 build: { inlineStylesheets: "never" },
61 },
62 }),
63 });