@buntal/http 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.ts +7 -4
  2. package/package.json +4 -4
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { WebSocketHandler } from 'bun'
1
+ import type { Server, WebSocketHandler } from 'bun'
2
2
  import { Req, Res } from './app'
3
3
  import { h, type AtomicHandler } from './handler'
4
4
  import type { ALLOWED_METHODS } from './lib/const'
@@ -7,12 +7,13 @@ import { buildRouter } from './router'
7
7
  type Config = {
8
8
  port: number
9
9
  appDir?: string
10
- websocket?: WebSocketHandler
10
+ websocket?: WebSocketHandler<any>,
11
11
  injectHandler?: (payload: {
12
12
  req: Req
13
13
  match: Bun.MatchedRoute
14
14
  handler: any
15
15
  }) => Promise<Response | void>
16
+ options?: any
16
17
  }
17
18
 
18
19
  type ExtractRouteParams<Path extends string> =
@@ -40,10 +41,11 @@ export class Http {
40
41
 
41
42
  constructor(private config: Config) {}
42
43
 
43
- start(cb?: (server: Bun.Server) => void) {
44
+ start(cb?: (server: Server<any>) => void) {
44
45
  const middlewares = this.middlewares
45
46
 
46
47
  const server = Bun.serve({
48
+ ...this.config.options,
47
49
  port: this.config.port,
48
50
  reusePort: true,
49
51
  routes: this.routes,
@@ -183,5 +185,6 @@ export class Http {
183
185
  }
184
186
 
185
187
  export * from './app'
186
- export * from './router'
187
188
  export * from './handler'
189
+ export * from './router'
190
+
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@buntal/http",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {
7
- "@types/bun": "latest"
7
+ "@types/bun": "1.3.14"
8
8
  },
9
9
  "peerDependencies": {
10
- "typescript": "^5"
10
+ "typescript": "^6"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/mgilangjanuar/buntal.git"
14
+ "url": "git+https://github.com/mgilangjanuar/buntal.git"
15
15
  },
16
16
  "description": "HTTP client framework for Bun",
17
17
  "homepage": "https://buntaljs.org",