Skip to content

Commit

Permalink
feat(dev-server): Add Initial bun adapter (#166)
Browse files Browse the repository at this point in the history
* Initial bun adapter

* format

* add changeset
  • Loading branch information
arisris authored Aug 28, 2024
1 parent 0a59fdd commit 714951c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-trains-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/vite-dev-server': minor
---

Add Initial bun adapter
20 changes: 20 additions & 0 deletions packages/dev-server/src/adapter/bun.ts
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 714951c

Please sign in to comment.