| 1 | import { durableObjectName } from "@fixtures/cloudflare-builtins"; |
| 2 | import { connect } from "cloudflare:sockets"; |
| 3 | import { DurableObject, WorkerEntrypoint } from "cloudflare:workers"; |
| 4 | |
| 5 | export default { |
| 6 | async fetch(request: Request) { |
| 7 | const pathname = new URL(request.url).pathname; |
| 8 | |
| 9 | if (pathname === "/external") { |
| 10 | return Response.json({ |
| 11 | "(EXTERNAL) (cloudflare:workers) DurableObject.name": durableObjectName, |
| 12 | }); |
| 13 | } |
| 14 | |
| 15 | return Response.json({ |
| 16 | "(cloudflare:workers) WorkerEntrypoint.name": WorkerEntrypoint.name, |
| 17 | "(cloudflare:workers) DurableObject.name": DurableObject.name, |
| 18 | "(cloudflare:sockets) typeof connect": typeof connect, |
| 19 | }); |
| 20 | }, |
| 21 | } satisfies ExportedHandler; |