Files
imagen/package.json
T
imbytecat 600f574b5c refactor: replace hand-rolled SSE with Hono + fetch-event-source
Server (index.ts):
- migrate to Hono streamSSE, mounted under Bun.serve fetch handler
- idleTimeout: 255 fixes the silent Bun 10s timeout that killed SSE
  responses before the first keepalive could fire (root cause of the
  empty EventStream tab)
- stream.onAbort wires an AbortController into upstream fetch signal
- 15s : keepalive raw SSE comments for Cloudflare 120s headroom
- decodeDataUrl returns Uint8Array<ArrayBuffer> for DOM Blob types
- chromeDevToolsAutomaticWorkspaceFolders: false silences the
  'Unable to add filesystem' warning in sandboxed browsers

Client (client.ts new):
- extracted from inline <script> — Bun only bundles external script src,
  not inline module imports, so node_modules bare specifiers must live
  in their own file
- @microsoft/fetch-event-source replaces hand-rolled fetch +
  ReadableStream parsing; supports POST + body + signal natively
- client aborts the loop on event:done so fetchEventSource doesn't retry

Build:
- drop unused react/react-dom/@types/react* deps (KISS)
- add 'DOM', 'DOM.Iterable' to tsconfig lib for client.ts
2026-05-18 23:13:06 +08:00

19 lines
335 B
JSON

{
"name": "ai-playground",
"module": "index.ts",
"type": "module",
"private": true,
"scripts": {
"dev": "bun --hot ./index.ts",
"start": "bun ./index.ts"
},
"devDependencies": {
"@types/bun": "^1.3.14",
"typescript": "^6.0.3"
},
"dependencies": {
"@microsoft/fetch-event-source": "^2.0.1",
"hono": "^4.12.19"
}
}