@hono/node-server 1.3.0 → 1.3.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 CHANGED
@@ -1,12 +1,42 @@
1
1
  # Node.js Adapter for Hono
2
2
 
3
- This adapter allows you to run your Hono application on Node.js. Initially, Hono wasn't designed for Node.js, but with this adapter, it can now be used with Node.js. It utilizes web standard APIs implemented in Node.js version 18 or higher.
3
+ This adapter `@hono/node-server` allows you to run your Hono application on Node.js.
4
+ Initially, Hono wasn't designed for Node.js, but with this adapter, you can now use Hono on Node.js.
5
+ It utilizes web standard APIs implemented in Node.js version 18 or higher.
4
6
 
5
- While Hono is ultra-fast, it may not be as fast on Node.js due to the overhead involved in adapting Hono's API to Node.js.
7
+ ## Benchmarks
6
8
 
7
- However, it's worth noting that it is still faster than Express.
9
+ Hono is 3.5 times faster than Express.
8
10
 
9
- ## Requirement
11
+ Express:
12
+
13
+ ```txt
14
+ $ bombardier -d 10s --fasthttp http://localhost:3000/
15
+
16
+ Statistics Avg Stdev Max
17
+ Reqs/sec 16438.94 1603.39 19155.47
18
+ Latency 7.60ms 7.51ms 559.89ms
19
+ HTTP codes:
20
+ 1xx - 0, 2xx - 164494, 3xx - 0, 4xx - 0, 5xx - 0
21
+ others - 0
22
+ Throughput: 4.55MB/s
23
+ ```
24
+
25
+ Hono + `@hono/node-server`:
26
+
27
+ ```txt
28
+ $ bombardier -d 10s --fasthttp http://localhost:3000/
29
+
30
+ Statistics Avg Stdev Max
31
+ Reqs/sec 58296.56 5512.74 74403.56
32
+ Latency 2.14ms 1.46ms 190.92ms
33
+ HTTP codes:
34
+ 1xx - 0, 2xx - 583059, 3xx - 0, 4xx - 0, 5xx - 0
35
+ others - 0
36
+ Throughput: 12.56MB/s
37
+ ```
38
+
39
+ ## Requirements
10
40
 
11
41
  It works on Node.js versions greater than 18.x. The specific required Node.js versions are as follows:
12
42
 
@@ -16,7 +46,7 @@ It works on Node.js versions greater than 18.x. The specific required Node.js ve
16
46
 
17
47
  Essentially, you can simply use the latest version of each major release.
18
48
 
19
- ## Install
49
+ ## Installation
20
50
 
21
51
  You can install from npm registry with `npm` command:
22
52
 
package/dist/globals.js CHANGED
@@ -45,15 +45,22 @@ var buildOutgoingHttpHeaders = (headers) => {
45
45
 
46
46
  // src/response.ts
47
47
  var responseCache = Symbol("responseCache");
48
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
48
49
  var cacheKey = Symbol("cache");
49
- var globalResponse = global.Response;
50
- var Response = class {
50
+ var GlobalResponse = global.Response;
51
+ var Response = class _Response {
51
52
  #body;
52
53
  #init;
54
+ [newGlobalResponseKey]() {
55
+ return new GlobalResponse(
56
+ this.#body,
57
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
58
+ );
59
+ }
53
60
  // @ts-ignore
54
61
  get cache() {
55
62
  delete this[cacheKey];
56
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
63
+ return this[responseCache] ||= this[newGlobalResponseKey]();
57
64
  }
58
65
  constructor(body, init) {
59
66
  this.#body = body;
@@ -92,8 +99,8 @@ var Response = class {
92
99
  }
93
100
  });
94
101
  });
95
- Object.setPrototypeOf(Response, globalResponse);
96
- Object.setPrototypeOf(Response.prototype, globalResponse.prototype);
102
+ Object.setPrototypeOf(Response, GlobalResponse);
103
+ Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
97
104
  Object.defineProperty(global, "Response", {
98
105
  value: Response
99
106
  });
package/dist/globals.mjs CHANGED
@@ -21,15 +21,22 @@ var buildOutgoingHttpHeaders = (headers) => {
21
21
 
22
22
  // src/response.ts
23
23
  var responseCache = Symbol("responseCache");
24
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
24
25
  var cacheKey = Symbol("cache");
25
- var globalResponse = global.Response;
26
- var Response = class {
26
+ var GlobalResponse = global.Response;
27
+ var Response = class _Response {
27
28
  #body;
28
29
  #init;
30
+ [newGlobalResponseKey]() {
31
+ return new GlobalResponse(
32
+ this.#body,
33
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
34
+ );
35
+ }
29
36
  // @ts-ignore
30
37
  get cache() {
31
38
  delete this[cacheKey];
32
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
39
+ return this[responseCache] ||= this[newGlobalResponseKey]();
33
40
  }
34
41
  constructor(body, init) {
35
42
  this.#body = body;
@@ -68,8 +75,8 @@ var Response = class {
68
75
  }
69
76
  });
70
77
  });
71
- Object.setPrototypeOf(Response, globalResponse);
72
- Object.setPrototypeOf(Response.prototype, globalResponse.prototype);
78
+ Object.setPrototypeOf(Response, GlobalResponse);
79
+ Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
73
80
  Object.defineProperty(global, "Response", {
74
81
  value: Response
75
82
  });
package/dist/index.js CHANGED
@@ -100,15 +100,22 @@ var buildOutgoingHttpHeaders = (headers) => {
100
100
 
101
101
  // src/response.ts
102
102
  var responseCache = Symbol("responseCache");
103
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
103
104
  var cacheKey = Symbol("cache");
104
- var globalResponse = global.Response;
105
- var Response2 = class {
105
+ var GlobalResponse = global.Response;
106
+ var Response2 = class _Response {
106
107
  #body;
107
108
  #init;
109
+ [newGlobalResponseKey]() {
110
+ return new GlobalResponse(
111
+ this.#body,
112
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
113
+ );
114
+ }
108
115
  // @ts-ignore
109
116
  get cache() {
110
117
  delete this[cacheKey];
111
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
118
+ return this[responseCache] ||= this[newGlobalResponseKey]();
112
119
  }
113
120
  constructor(body, init) {
114
121
  this.#body = body;
@@ -147,8 +154,8 @@ var Response2 = class {
147
154
  }
148
155
  });
149
156
  });
150
- Object.setPrototypeOf(Response2, globalResponse);
151
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
157
+ Object.setPrototypeOf(Response2, GlobalResponse);
158
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
152
159
  Object.defineProperty(global, "Response", {
153
160
  value: Response2
154
161
  });
@@ -255,7 +262,7 @@ var handleResponseError = (e, outgoing) => {
255
262
  var responseViaCache = (res, outgoing) => {
256
263
  const [status, body, header] = res[cacheKey];
257
264
  if (typeof body === "string") {
258
- header["content-length"] ||= "" + Buffer.byteLength(body);
265
+ header["Content-Length"] = Buffer.byteLength(body);
259
266
  outgoing.writeHead(status, header);
260
267
  outgoing.end(body);
261
268
  } else {
package/dist/index.mjs CHANGED
@@ -62,15 +62,22 @@ var buildOutgoingHttpHeaders = (headers) => {
62
62
 
63
63
  // src/response.ts
64
64
  var responseCache = Symbol("responseCache");
65
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
65
66
  var cacheKey = Symbol("cache");
66
- var globalResponse = global.Response;
67
- var Response2 = class {
67
+ var GlobalResponse = global.Response;
68
+ var Response2 = class _Response {
68
69
  #body;
69
70
  #init;
71
+ [newGlobalResponseKey]() {
72
+ return new GlobalResponse(
73
+ this.#body,
74
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
75
+ );
76
+ }
70
77
  // @ts-ignore
71
78
  get cache() {
72
79
  delete this[cacheKey];
73
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
80
+ return this[responseCache] ||= this[newGlobalResponseKey]();
74
81
  }
75
82
  constructor(body, init) {
76
83
  this.#body = body;
@@ -109,8 +116,8 @@ var Response2 = class {
109
116
  }
110
117
  });
111
118
  });
112
- Object.setPrototypeOf(Response2, globalResponse);
113
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
119
+ Object.setPrototypeOf(Response2, GlobalResponse);
120
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
114
121
  Object.defineProperty(global, "Response", {
115
122
  value: Response2
116
123
  });
@@ -217,7 +224,7 @@ var handleResponseError = (e, outgoing) => {
217
224
  var responseViaCache = (res, outgoing) => {
218
225
  const [status, body, header] = res[cacheKey];
219
226
  if (typeof body === "string") {
220
- header["content-length"] ||= "" + Buffer.byteLength(body);
227
+ header["Content-Length"] = Buffer.byteLength(body);
221
228
  outgoing.writeHead(status, header);
222
229
  outgoing.end(body);
223
230
  } else {
package/dist/listener.js CHANGED
@@ -95,15 +95,22 @@ var buildOutgoingHttpHeaders = (headers) => {
95
95
 
96
96
  // src/response.ts
97
97
  var responseCache = Symbol("responseCache");
98
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
98
99
  var cacheKey = Symbol("cache");
99
- var globalResponse = global.Response;
100
- var Response2 = class {
100
+ var GlobalResponse = global.Response;
101
+ var Response2 = class _Response {
101
102
  #body;
102
103
  #init;
104
+ [newGlobalResponseKey]() {
105
+ return new GlobalResponse(
106
+ this.#body,
107
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
108
+ );
109
+ }
103
110
  // @ts-ignore
104
111
  get cache() {
105
112
  delete this[cacheKey];
106
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
113
+ return this[responseCache] ||= this[newGlobalResponseKey]();
107
114
  }
108
115
  constructor(body, init) {
109
116
  this.#body = body;
@@ -142,8 +149,8 @@ var Response2 = class {
142
149
  }
143
150
  });
144
151
  });
145
- Object.setPrototypeOf(Response2, globalResponse);
146
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
152
+ Object.setPrototypeOf(Response2, GlobalResponse);
153
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
147
154
  Object.defineProperty(global, "Response", {
148
155
  value: Response2
149
156
  });
@@ -250,7 +257,7 @@ var handleResponseError = (e, outgoing) => {
250
257
  var responseViaCache = (res, outgoing) => {
251
258
  const [status, body, header] = res[cacheKey];
252
259
  if (typeof body === "string") {
253
- header["content-length"] ||= "" + Buffer.byteLength(body);
260
+ header["Content-Length"] = Buffer.byteLength(body);
254
261
  outgoing.writeHead(status, header);
255
262
  outgoing.end(body);
256
263
  } else {
package/dist/listener.mjs CHANGED
@@ -59,15 +59,22 @@ var buildOutgoingHttpHeaders = (headers) => {
59
59
 
60
60
  // src/response.ts
61
61
  var responseCache = Symbol("responseCache");
62
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
62
63
  var cacheKey = Symbol("cache");
63
- var globalResponse = global.Response;
64
- var Response2 = class {
64
+ var GlobalResponse = global.Response;
65
+ var Response2 = class _Response {
65
66
  #body;
66
67
  #init;
68
+ [newGlobalResponseKey]() {
69
+ return new GlobalResponse(
70
+ this.#body,
71
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
72
+ );
73
+ }
67
74
  // @ts-ignore
68
75
  get cache() {
69
76
  delete this[cacheKey];
70
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
77
+ return this[responseCache] ||= this[newGlobalResponseKey]();
71
78
  }
72
79
  constructor(body, init) {
73
80
  this.#body = body;
@@ -106,8 +113,8 @@ var Response2 = class {
106
113
  }
107
114
  });
108
115
  });
109
- Object.setPrototypeOf(Response2, globalResponse);
110
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
116
+ Object.setPrototypeOf(Response2, GlobalResponse);
117
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
111
118
  Object.defineProperty(global, "Response", {
112
119
  value: Response2
113
120
  });
@@ -214,7 +221,7 @@ var handleResponseError = (e, outgoing) => {
214
221
  var responseViaCache = (res, outgoing) => {
215
222
  const [status, body, header] = res[cacheKey];
216
223
  if (typeof body === "string") {
217
- header["content-length"] ||= "" + Buffer.byteLength(body);
224
+ header["Content-Length"] = Buffer.byteLength(body);
218
225
  outgoing.writeHead(status, header);
219
226
  outgoing.end(body);
220
227
  } else {
@@ -1,5 +1,6 @@
1
+ declare const newGlobalResponseKey: unique symbol;
1
2
  declare const cacheKey: unique symbol;
2
- declare const globalResponse: {
3
+ declare const GlobalResponse: {
3
4
  new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): globalThis.Response;
4
5
  prototype: globalThis.Response;
5
6
  error(): globalThis.Response;
@@ -8,8 +9,9 @@ declare const globalResponse: {
8
9
  };
9
10
  declare class Response {
10
11
  #private;
12
+ [newGlobalResponseKey](): typeof GlobalResponse;
11
13
  private get cache();
12
14
  constructor(body?: BodyInit | null, init?: ResponseInit);
13
15
  }
14
16
 
15
- export { Response, cacheKey, globalResponse };
17
+ export { GlobalResponse, Response, cacheKey };
@@ -1,5 +1,6 @@
1
+ declare const newGlobalResponseKey: unique symbol;
1
2
  declare const cacheKey: unique symbol;
2
- declare const globalResponse: {
3
+ declare const GlobalResponse: {
3
4
  new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): globalThis.Response;
4
5
  prototype: globalThis.Response;
5
6
  error(): globalThis.Response;
@@ -8,8 +9,9 @@ declare const globalResponse: {
8
9
  };
9
10
  declare class Response {
10
11
  #private;
12
+ [newGlobalResponseKey](): typeof GlobalResponse;
11
13
  private get cache();
12
14
  constructor(body?: BodyInit | null, init?: ResponseInit);
13
15
  }
14
16
 
15
- export { Response, cacheKey, globalResponse };
17
+ export { GlobalResponse, Response, cacheKey };
package/dist/response.js CHANGED
@@ -20,9 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/response.ts
21
21
  var response_exports = {};
22
22
  __export(response_exports, {
23
+ GlobalResponse: () => GlobalResponse,
23
24
  Response: () => Response,
24
- cacheKey: () => cacheKey,
25
- globalResponse: () => globalResponse
25
+ cacheKey: () => cacheKey
26
26
  });
27
27
  module.exports = __toCommonJS(response_exports);
28
28
 
@@ -46,15 +46,22 @@ var buildOutgoingHttpHeaders = (headers) => {
46
46
 
47
47
  // src/response.ts
48
48
  var responseCache = Symbol("responseCache");
49
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
49
50
  var cacheKey = Symbol("cache");
50
- var globalResponse = global.Response;
51
- var Response = class {
51
+ var GlobalResponse = global.Response;
52
+ var Response = class _Response {
52
53
  #body;
53
54
  #init;
55
+ [newGlobalResponseKey]() {
56
+ return new GlobalResponse(
57
+ this.#body,
58
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
59
+ );
60
+ }
54
61
  // @ts-ignore
55
62
  get cache() {
56
63
  delete this[cacheKey];
57
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
64
+ return this[responseCache] ||= this[newGlobalResponseKey]();
58
65
  }
59
66
  constructor(body, init) {
60
67
  this.#body = body;
@@ -93,14 +100,14 @@ var Response = class {
93
100
  }
94
101
  });
95
102
  });
96
- Object.setPrototypeOf(Response, globalResponse);
97
- Object.setPrototypeOf(Response.prototype, globalResponse.prototype);
103
+ Object.setPrototypeOf(Response, GlobalResponse);
104
+ Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
98
105
  Object.defineProperty(global, "Response", {
99
106
  value: Response
100
107
  });
101
108
  // Annotate the CommonJS export names for ESM import in node:
102
109
  0 && (module.exports = {
110
+ GlobalResponse,
103
111
  Response,
104
- cacheKey,
105
- globalResponse
112
+ cacheKey
106
113
  });
package/dist/response.mjs CHANGED
@@ -18,15 +18,22 @@ var buildOutgoingHttpHeaders = (headers) => {
18
18
 
19
19
  // src/response.ts
20
20
  var responseCache = Symbol("responseCache");
21
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
21
22
  var cacheKey = Symbol("cache");
22
- var globalResponse = global.Response;
23
- var Response = class {
23
+ var GlobalResponse = global.Response;
24
+ var Response = class _Response {
24
25
  #body;
25
26
  #init;
27
+ [newGlobalResponseKey]() {
28
+ return new GlobalResponse(
29
+ this.#body,
30
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
31
+ );
32
+ }
26
33
  // @ts-ignore
27
34
  get cache() {
28
35
  delete this[cacheKey];
29
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
36
+ return this[responseCache] ||= this[newGlobalResponseKey]();
30
37
  }
31
38
  constructor(body, init) {
32
39
  this.#body = body;
@@ -65,13 +72,13 @@ var Response = class {
65
72
  }
66
73
  });
67
74
  });
68
- Object.setPrototypeOf(Response, globalResponse);
69
- Object.setPrototypeOf(Response.prototype, globalResponse.prototype);
75
+ Object.setPrototypeOf(Response, GlobalResponse);
76
+ Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
70
77
  Object.defineProperty(global, "Response", {
71
78
  value: Response
72
79
  });
73
80
  export {
81
+ GlobalResponse,
74
82
  Response,
75
- cacheKey,
76
- globalResponse
83
+ cacheKey
77
84
  };
package/dist/server.js CHANGED
@@ -97,15 +97,22 @@ var buildOutgoingHttpHeaders = (headers) => {
97
97
 
98
98
  // src/response.ts
99
99
  var responseCache = Symbol("responseCache");
100
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
100
101
  var cacheKey = Symbol("cache");
101
- var globalResponse = global.Response;
102
- var Response2 = class {
102
+ var GlobalResponse = global.Response;
103
+ var Response2 = class _Response {
103
104
  #body;
104
105
  #init;
106
+ [newGlobalResponseKey]() {
107
+ return new GlobalResponse(
108
+ this.#body,
109
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
110
+ );
111
+ }
105
112
  // @ts-ignore
106
113
  get cache() {
107
114
  delete this[cacheKey];
108
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
115
+ return this[responseCache] ||= this[newGlobalResponseKey]();
109
116
  }
110
117
  constructor(body, init) {
111
118
  this.#body = body;
@@ -144,8 +151,8 @@ var Response2 = class {
144
151
  }
145
152
  });
146
153
  });
147
- Object.setPrototypeOf(Response2, globalResponse);
148
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
154
+ Object.setPrototypeOf(Response2, GlobalResponse);
155
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
149
156
  Object.defineProperty(global, "Response", {
150
157
  value: Response2
151
158
  });
@@ -252,7 +259,7 @@ var handleResponseError = (e, outgoing) => {
252
259
  var responseViaCache = (res, outgoing) => {
253
260
  const [status, body, header] = res[cacheKey];
254
261
  if (typeof body === "string") {
255
- header["content-length"] ||= "" + Buffer.byteLength(body);
262
+ header["Content-Length"] = Buffer.byteLength(body);
256
263
  outgoing.writeHead(status, header);
257
264
  outgoing.end(body);
258
265
  } else {
package/dist/server.mjs CHANGED
@@ -62,15 +62,22 @@ var buildOutgoingHttpHeaders = (headers) => {
62
62
 
63
63
  // src/response.ts
64
64
  var responseCache = Symbol("responseCache");
65
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
65
66
  var cacheKey = Symbol("cache");
66
- var globalResponse = global.Response;
67
- var Response2 = class {
67
+ var GlobalResponse = global.Response;
68
+ var Response2 = class _Response {
68
69
  #body;
69
70
  #init;
71
+ [newGlobalResponseKey]() {
72
+ return new GlobalResponse(
73
+ this.#body,
74
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
75
+ );
76
+ }
70
77
  // @ts-ignore
71
78
  get cache() {
72
79
  delete this[cacheKey];
73
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
80
+ return this[responseCache] ||= this[newGlobalResponseKey]();
74
81
  }
75
82
  constructor(body, init) {
76
83
  this.#body = body;
@@ -109,8 +116,8 @@ var Response2 = class {
109
116
  }
110
117
  });
111
118
  });
112
- Object.setPrototypeOf(Response2, globalResponse);
113
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
119
+ Object.setPrototypeOf(Response2, GlobalResponse);
120
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
114
121
  Object.defineProperty(global, "Response", {
115
122
  value: Response2
116
123
  });
@@ -217,7 +224,7 @@ var handleResponseError = (e, outgoing) => {
217
224
  var responseViaCache = (res, outgoing) => {
218
225
  const [status, body, header] = res[cacheKey];
219
226
  if (typeof body === "string") {
220
- header["content-length"] ||= "" + Buffer.byteLength(body);
227
+ header["Content-Length"] = Buffer.byteLength(body);
221
228
  outgoing.writeHead(status, header);
222
229
  outgoing.end(body);
223
230
  } else {
package/dist/vercel.js CHANGED
@@ -95,15 +95,22 @@ var buildOutgoingHttpHeaders = (headers) => {
95
95
 
96
96
  // src/response.ts
97
97
  var responseCache = Symbol("responseCache");
98
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
98
99
  var cacheKey = Symbol("cache");
99
- var globalResponse = global.Response;
100
- var Response2 = class {
100
+ var GlobalResponse = global.Response;
101
+ var Response2 = class _Response {
101
102
  #body;
102
103
  #init;
104
+ [newGlobalResponseKey]() {
105
+ return new GlobalResponse(
106
+ this.#body,
107
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
108
+ );
109
+ }
103
110
  // @ts-ignore
104
111
  get cache() {
105
112
  delete this[cacheKey];
106
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
113
+ return this[responseCache] ||= this[newGlobalResponseKey]();
107
114
  }
108
115
  constructor(body, init) {
109
116
  this.#body = body;
@@ -142,8 +149,8 @@ var Response2 = class {
142
149
  }
143
150
  });
144
151
  });
145
- Object.setPrototypeOf(Response2, globalResponse);
146
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
152
+ Object.setPrototypeOf(Response2, GlobalResponse);
153
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
147
154
  Object.defineProperty(global, "Response", {
148
155
  value: Response2
149
156
  });
@@ -250,7 +257,7 @@ var handleResponseError = (e, outgoing) => {
250
257
  var responseViaCache = (res, outgoing) => {
251
258
  const [status, body, header] = res[cacheKey];
252
259
  if (typeof body === "string") {
253
- header["content-length"] ||= "" + Buffer.byteLength(body);
260
+ header["Content-Length"] = Buffer.byteLength(body);
254
261
  outgoing.writeHead(status, header);
255
262
  outgoing.end(body);
256
263
  } else {
package/dist/vercel.mjs CHANGED
@@ -59,15 +59,22 @@ var buildOutgoingHttpHeaders = (headers) => {
59
59
 
60
60
  // src/response.ts
61
61
  var responseCache = Symbol("responseCache");
62
+ var newGlobalResponseKey = Symbol("newGlobalResponse");
62
63
  var cacheKey = Symbol("cache");
63
- var globalResponse = global.Response;
64
- var Response2 = class {
64
+ var GlobalResponse = global.Response;
65
+ var Response2 = class _Response {
65
66
  #body;
66
67
  #init;
68
+ [newGlobalResponseKey]() {
69
+ return new GlobalResponse(
70
+ this.#body,
71
+ this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
72
+ );
73
+ }
67
74
  // @ts-ignore
68
75
  get cache() {
69
76
  delete this[cacheKey];
70
- return this[responseCache] ||= new globalResponse(this.#body, this.#init);
77
+ return this[responseCache] ||= this[newGlobalResponseKey]();
71
78
  }
72
79
  constructor(body, init) {
73
80
  this.#body = body;
@@ -106,8 +113,8 @@ var Response2 = class {
106
113
  }
107
114
  });
108
115
  });
109
- Object.setPrototypeOf(Response2, globalResponse);
110
- Object.setPrototypeOf(Response2.prototype, globalResponse.prototype);
116
+ Object.setPrototypeOf(Response2, GlobalResponse);
117
+ Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
111
118
  Object.defineProperty(global, "Response", {
112
119
  value: Response2
113
120
  });
@@ -214,7 +221,7 @@ var handleResponseError = (e, outgoing) => {
214
221
  var responseViaCache = (res, outgoing) => {
215
222
  const [status, body, header] = res[cacheKey];
216
223
  if (typeof body === "string") {
217
- header["content-length"] ||= "" + Buffer.byteLength(body);
224
+ header["Content-Length"] = Buffer.byteLength(body);
218
225
  outgoing.writeHead(status, header);
219
226
  outgoing.end(body);
220
227
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",