@hono/node-server 2.0.0-rc.1 → 2.0.0-rc.2
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/README.md +55 -11
- package/dist/{listener-Brd4yZ5d.js → index.cjs} +388 -108
- package/dist/{index.d.ts → index.d.cts} +12 -1
- package/dist/index.d.mts +12 -1
- package/dist/index.mjs +981 -4
- package/dist/{serve-static.js → serve-static.cjs} +1 -1
- package/dist/serve-static.mjs +1 -1
- package/dist/utils/{response.js → response.cjs} +1 -1
- package/dist/utils/response.mjs +1 -1
- package/package.json +44 -29
- package/dist/index.js +0 -28
- package/dist/listener-RIBxK9_x.mjs +0 -715
- package/dist/vercel.d.mts +0 -8
- package/dist/vercel.d.ts +0 -8
- package/dist/vercel.js +0 -10
- package/dist/vercel.mjs +0 -9
- /package/dist/{conninfo.js → conninfo.cjs} +0 -0
- /package/dist/{conninfo.d.ts → conninfo.d.cts} +0 -0
- /package/dist/{constants-DEKKqoym.mjs → constants-BLSFu_RU.mjs} +0 -0
- /package/dist/{constants-B7DBcQew.js → constants-BXAKTxRC.cjs} +0 -0
- /package/dist/{serve-static.d.ts → serve-static.d.cts} +0 -0
- /package/dist/utils/{response.d.ts → response.d.cts} +0 -0
|
@@ -68,7 +68,7 @@ const serveStatic = (options = { root: "" }) => {
|
|
|
68
68
|
if (optionPath) filename = optionPath;
|
|
69
69
|
else try {
|
|
70
70
|
filename = tryDecodeURI(c.req.path);
|
|
71
|
-
if (/(?:^|[\/\\])
|
|
71
|
+
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) throw new Error();
|
|
72
72
|
} catch {
|
|
73
73
|
await options.onNotFound?.(c.req.path, c);
|
|
74
74
|
return next();
|
package/dist/serve-static.mjs
CHANGED
|
@@ -67,7 +67,7 @@ const serveStatic = (options = { root: "" }) => {
|
|
|
67
67
|
if (optionPath) filename = optionPath;
|
|
68
68
|
else try {
|
|
69
69
|
filename = tryDecodeURI(c.req.path);
|
|
70
|
-
if (/(?:^|[\/\\])
|
|
70
|
+
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) throw new Error();
|
|
71
71
|
} catch {
|
|
72
72
|
await options.onNotFound?.(c.req.path, c);
|
|
73
73
|
return next();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_constants = require('../constants-
|
|
2
|
+
const require_constants = require('../constants-BXAKTxRC.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/utils/response.ts
|
|
5
5
|
const RESPONSE_ALREADY_SENT = new Response(null, { headers: { [require_constants.X_ALREADY_SENT]: "true" } });
|
package/dist/utils/response.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,55 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hono/node-server",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
4
|
"description": "Node.js Adapter for Hono",
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "dist/index.d.mts",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist"
|
|
9
10
|
],
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
|
+
"default": "./dist/index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/index.d.cts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
15
21
|
},
|
|
16
22
|
"./serve-static": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/serve-static.d.mts",
|
|
25
|
+
"default": "./dist/serve-static.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/serve-static.d.cts",
|
|
29
|
+
"default": "./dist/serve-static.cjs"
|
|
30
|
+
}
|
|
25
31
|
},
|
|
26
32
|
"./utils/*": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/utils/*.d.mts",
|
|
35
|
+
"default": "./dist/utils/*.mjs"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/utils/*.d.cts",
|
|
39
|
+
"default": "./dist/utils/*.cjs"
|
|
40
|
+
}
|
|
30
41
|
},
|
|
31
42
|
"./conninfo": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/conninfo.d.mts",
|
|
45
|
+
"default": "./dist/conninfo.mjs"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/conninfo.d.cts",
|
|
49
|
+
"default": "./dist/conninfo.cjs"
|
|
50
|
+
}
|
|
35
51
|
}
|
|
36
52
|
},
|
|
37
53
|
"typesVersions": {
|
|
38
54
|
"*": {
|
|
39
55
|
".": [
|
|
40
|
-
"./dist/index.d.
|
|
56
|
+
"./dist/index.d.mts"
|
|
41
57
|
],
|
|
42
58
|
"serve-static": [
|
|
43
|
-
"./dist/serve-static.d.
|
|
44
|
-
],
|
|
45
|
-
"vercel": [
|
|
46
|
-
"./dist/vercel.d.ts"
|
|
59
|
+
"./dist/serve-static.d.mts"
|
|
47
60
|
],
|
|
48
61
|
"utils/*": [
|
|
49
|
-
"./dist/utils/*.d.
|
|
62
|
+
"./dist/utils/*.d.mts"
|
|
50
63
|
],
|
|
51
64
|
"conninfo": [
|
|
52
|
-
"./dist/conninfo.d.
|
|
65
|
+
"./dist/conninfo.d.mts"
|
|
53
66
|
]
|
|
54
67
|
}
|
|
55
68
|
},
|
|
@@ -68,7 +81,7 @@
|
|
|
68
81
|
"license": "MIT",
|
|
69
82
|
"repository": {
|
|
70
83
|
"type": "git",
|
|
71
|
-
"url": "https://github.com/honojs/node-server.git"
|
|
84
|
+
"url": "git+https://github.com/honojs/node-server.git"
|
|
72
85
|
},
|
|
73
86
|
"homepage": "https://github.com/honojs/node-server",
|
|
74
87
|
"author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)",
|
|
@@ -83,6 +96,7 @@
|
|
|
83
96
|
"@hono/eslint-config": "^1.0.1",
|
|
84
97
|
"@types/node": "^20.10.0",
|
|
85
98
|
"@types/supertest": "^2.0.12",
|
|
99
|
+
"@types/ws": "^8.18.1",
|
|
86
100
|
"@whatwg-node/fetch": "^0.9.14",
|
|
87
101
|
"eslint": "^9.10.0",
|
|
88
102
|
"hono": "^4.12.8",
|
|
@@ -92,7 +106,8 @@
|
|
|
92
106
|
"supertest": "^6.3.3",
|
|
93
107
|
"tsdown": "^0.20.3",
|
|
94
108
|
"typescript": "^5.3.2",
|
|
95
|
-
"vitest": "^4.0.18"
|
|
109
|
+
"vitest": "^4.0.18",
|
|
110
|
+
"ws": "^8.19.0"
|
|
96
111
|
},
|
|
97
112
|
"peerDependencies": {
|
|
98
113
|
"hono": "^4"
|
package/dist/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_listener = require('./listener-Brd4yZ5d.js');
|
|
3
|
-
let node_http = require("node:http");
|
|
4
|
-
|
|
5
|
-
//#region src/server.ts
|
|
6
|
-
const createAdaptorServer = (options) => {
|
|
7
|
-
const fetchCallback = options.fetch;
|
|
8
|
-
const requestListener = require_listener.getRequestListener(fetchCallback, {
|
|
9
|
-
hostname: options.hostname,
|
|
10
|
-
overrideGlobalObjects: options.overrideGlobalObjects,
|
|
11
|
-
autoCleanupIncoming: options.autoCleanupIncoming
|
|
12
|
-
});
|
|
13
|
-
return (options.createServer || node_http.createServer)(options.serverOptions || {}, requestListener);
|
|
14
|
-
};
|
|
15
|
-
const serve = (options, listeningListener) => {
|
|
16
|
-
const server = createAdaptorServer(options);
|
|
17
|
-
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
|
18
|
-
const serverInfo = server.address();
|
|
19
|
-
listeningListener && listeningListener(serverInfo);
|
|
20
|
-
});
|
|
21
|
-
return server;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.RequestError = require_listener.RequestError;
|
|
26
|
-
exports.createAdaptorServer = createAdaptorServer;
|
|
27
|
-
exports.getRequestListener = require_listener.getRequestListener;
|
|
28
|
-
exports.serve = serve;
|