diff --git a/.changeset/moody-trains-drive.md b/.changeset/moody-trains-drive.md new file mode 100644 index 0000000..55862b5 --- /dev/null +++ b/.changeset/moody-trains-drive.md @@ -0,0 +1,5 @@ +--- +'@hono/vite-dev-server': minor +--- + +Add Initial bun adapter diff --git a/packages/dev-server/src/adapter/bun.ts b/packages/dev-server/src/adapter/bun.ts new file mode 100644 index 0000000..d386f74 --- /dev/null +++ b/packages/dev-server/src/adapter/bun.ts @@ -0,0 +1,20 @@ +import type { Adapter } from '../types' + +export const bunAdapter = (): Adapter => { + if (typeof globalThis.navigator === 'undefined') { + // @ts-expect-error not typed well + globalThis.navigator = { + userAgent: 'Bun', + } + } else { + Object.defineProperty(globalThis.navigator, 'userAgent', { + value: 'Bun', + writable: false, + }) + } + return { + env: process.env, + } +} + +export default bunAdapter