| 1 | import worker from "./worker.ts"; |
| 2 | |
| 3 | export { Counter } from "./worker.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Alternate Worker entry used by the `main` override test. It hosts the |
| 7 | * same Durable Object but additionally answers `/api/entry`, so the test |
| 8 | * can prove the deployed entry came from the `main` option — not from the |
| 9 | * entry configured in `vite.config.ts` (which points at `worker.ts`). |
| 10 | */ |
| 11 | export default { |
| 12 | async fetch( |
| 13 | request: Request, |
| 14 | env: Parameters<typeof worker.fetch>[1], |
| 15 | ): Promise<Response> { |
| 16 | const url = new URL(request.url); |
| 17 | |
| 18 | if (url.pathname === "/api/entry") { |
| 19 | return Response.json({ entry: "worker-main" }); |
| 20 | } |
| 21 | |
| 22 | return worker.fetch(request, env); |
| 23 | }, |
| 24 | }; |