import { MAX_BODY_SIZE } from '#adapter/servers/bun-runtime'; import type { BunRuntime } from '#adapter/servers/bun-runtime'; const baseOptions = ( fetch: (request: Request, server: BunRuntime) => Response | Promise, websocket: unknown, tls: unknown, ): Record => { const options: Record = { fetch, maxRequestBodySize: MAX_BODY_SIZE, }; if (websocket !== undefined) options.websocket = websocket; if (tls !== undefined) options.tls = tls; return options; }; const applyAddress = ( options: Record, port: string | number, hostname: string | undefined, ): string | undefined => { if (typeof port === 'string') { options.unix = port; return port; } options.port = port; if (hostname !== undefined) options.hostname = hostname; return undefined; }; export { applyAddress, baseOptions };