-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dev-server): Add Initial bun adapter (#166)
* Initial bun adapter * format * add changeset
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hono/vite-dev-server': minor | ||
--- | ||
|
||
Add Initial bun adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |