@kanjijs/platform-bun 0.2.0-beta.55 → 0.2.0-beta.57
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 +1 -1
- package/dist/index.js +15 -8
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ declare global {
|
|
|
6
6
|
var __kanjijs_server: ReturnType<typeof Bun.serve> | undefined;
|
|
7
7
|
}
|
|
8
8
|
export declare class KanjijsServer {
|
|
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
|
|
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> | undefined;
|
|
10
10
|
}
|
package/dist/index.js
CHANGED
|
@@ -6,14 +6,21 @@ class KanjijsServer {
|
|
|
6
6
|
return globalThis.__kanjijs_server;
|
|
7
7
|
}
|
|
8
8
|
const port = options.port || 3000;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
try {
|
|
10
|
+
console.log(`\uD83D\uDE80 Kanjijs server running on http://localhost:${port}`);
|
|
11
|
+
const server = Bun.serve({
|
|
12
|
+
port,
|
|
13
|
+
hostname: "0.0.0.0",
|
|
14
|
+
fetch: (req) => app.fetch(req)
|
|
15
|
+
});
|
|
16
|
+
globalThis.__kanjijs_server = server;
|
|
17
|
+
return server;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error?.code === "EADDRINUSE") {
|
|
20
|
+
return globalThis.__kanjijs_server;
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
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.57",
|
|
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.57",
|
|
17
17
|
"hono": "^4.0.0"
|
|
18
18
|
}
|
|
19
19
|
}
|