@kanjijs/platform-bun 0.2.0-beta.53 → 0.2.0-beta.55
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.
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { type Hono } from "hono";
|
|
|
2
2
|
export interface KanjijsServerOptions {
|
|
3
3
|
port?: number;
|
|
4
4
|
}
|
|
5
|
+
declare global {
|
|
6
|
+
var __kanjijs_server: ReturnType<typeof Bun.serve> | undefined;
|
|
7
|
+
}
|
|
5
8
|
export declare class KanjijsServer {
|
|
6
|
-
static listen<E extends import("hono").Env, S extends import("hono").Schema, B extends string>(app: Hono<E, S, B>, options?: KanjijsServerOptions): Bun.Server<
|
|
9
|
+
static listen<E extends import("hono").Env, S extends import("hono").Schema, B extends string>(app: Hono<E, S, B>, options?: KanjijsServerOptions): Bun.Server<unknown>;
|
|
7
10
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
// src/index.ts
|
|
3
3
|
class KanjijsServer {
|
|
4
4
|
static listen(app, options = {}) {
|
|
5
|
+
if (globalThis.__kanjijs_server) {
|
|
6
|
+
return globalThis.__kanjijs_server;
|
|
7
|
+
}
|
|
5
8
|
const port = options.port || 3000;
|
|
6
9
|
console.log(`\uD83D\uDE80 Kanjijs server running on http://localhost:${port}`);
|
|
7
|
-
|
|
10
|
+
const server = Bun.serve({
|
|
8
11
|
port,
|
|
9
12
|
hostname: "0.0.0.0",
|
|
10
13
|
fetch: (req) => app.fetch(req)
|
|
11
14
|
});
|
|
15
|
+
globalThis.__kanjijs_server = server;
|
|
16
|
+
return server;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/platform-bun",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.55",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "bun build src/index.ts --outdir dist --target bun && bunx tsc --emitDeclarationOnly --declaration --outDir dist -p tsconfig.build.json"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@kanjijs/platform-hono": "^0.2.0-beta.
|
|
16
|
+
"@kanjijs/platform-hono": "^0.2.0-beta.55",
|
|
17
17
|
"hono": "^4.0.0"
|
|
18
18
|
}
|
|
19
19
|
}
|