Bun platform adapter for Shovel with hot reloading and built-in TypeScript/JSX support
npm install @b9g/platform-bunBun platform adapter for Shovel. Runs ServiceWorker applications on Bun with native HTTP server integration and fast hot reloading.
- Bun HTTP server integration
- Fast hot module reloading
- Worker thread support for concurrency
- Memory and filesystem cache backends
- File System Access API implementation via BunBucket
``bash`
bun install @b9g/platform-bun
`javascript
import BunPlatform from '@b9g/platform-bun';
const platform = new BunPlatform({
cache: { type: 'memory' },
filesystem: { type: 'local', directory: './dist' }
});
const server = platform.createServer(async (request) => {
return new Response('Hello from Bun');
}, { port: 7777, host: 'localhost' });
await server.listen();
`
- BunPlatform - Bun platform implementation (extends BasePlatform)
- BunPlatformOptions - Configuration options for BunPlatform
- Platform, CacheConfig, StaticConfig, Handler, Server, ServerOptions
- BunPlatform - The platform class
Creates a new Bun platform instance.
Options:
- cache: Cache configuration (memory, filesystem)filesystem
- : Filesystem configuration (local directory)port
- : Default port (default: 7777)host
- : Default host (default: localhost)cwd
- : Working directory for file resolution
Creates a Bun HTTP server with the given request handler.
Options:
- port: Port to listen onhost
- : Host to bind to
Returns a Server instance with listen() and close() methods.
- memory: In-memory caching using MemoryCachefilesystem`: Filesystem-based caching using BunBucket
-
MIT