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, 07:15 UTC
| 1 | // Mirrors `@cloudflare/vite-plugin`'s `playground/config-changes`. |
| 2 | // @ts-expect-error -- `abortIsolate` is an internal runtime test hook. |
| 3 | import { abortIsolate } from "cloudflare:workers"; |
| 4 | |
| 5 | interface Env { |
| 6 | MY_VAR: string; |
| 7 | MY_SECRET: string; |
| 8 | } |
| 9 | |
| 10 | const runtimeId = crypto.randomUUID(); |
| 11 | |
| 12 | export default { |
| 13 | async fetch(request, env) { |
| 14 | const pathname = new URL(request.url).pathname; |
| 15 | if (pathname === "/__crash-workerd") { |
| 16 | abortIsolate("Vite runtime restart test"); |
| 17 | } |
| 18 | if (pathname === "/__runtime-id") { |
| 19 | return new Response(runtimeId); |
| 20 | } |
| 21 | return new Response( |
| 22 | `The value of MY_VAR is "${env.MY_VAR}" and the value of MY_SECRET is "${env.MY_SECRET}"`, |
| 23 | ); |
| 24 | }, |
| 25 | } satisfies ExportedHandler<Env>; |