@hono/node-server 1.3.2 → 1.3.3

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/globals.js CHANGED
@@ -45,31 +45,35 @@ var buildOutgoingHttpHeaders = (headers) => {
45
45
 
46
46
  // src/response.ts
47
47
  var responseCache = Symbol("responseCache");
48
- var newGlobalResponseKey = Symbol("newGlobalResponse");
49
48
  var cacheKey = Symbol("cache");
50
49
  var GlobalResponse = global.Response;
51
50
  var Response = class _Response {
52
51
  #body;
53
52
  #init;
54
- [newGlobalResponseKey]() {
55
- return new GlobalResponse(
56
- this.#body,
57
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
58
- );
59
- }
60
- // @ts-ignore
61
53
  get cache() {
62
54
  delete this[cacheKey];
63
- return this[responseCache] ||= this[newGlobalResponseKey]();
55
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
64
56
  }
65
57
  constructor(body, init) {
66
58
  this.#body = body;
67
- this.#init = init;
59
+ if (init instanceof _Response) {
60
+ const cachedGlobalResponse = init[responseCache];
61
+ if (cachedGlobalResponse) {
62
+ this.#init = cachedGlobalResponse;
63
+ this.cache;
64
+ return;
65
+ } else {
66
+ this.#init = init.#init;
67
+ }
68
+ } else {
69
+ this.#init = init;
70
+ }
68
71
  if (typeof body === "string" || body instanceof ReadableStream) {
69
72
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
70
73
  if (headers instanceof Headers) {
71
74
  headers = buildOutgoingHttpHeaders(headers);
72
75
  }
76
+ ;
73
77
  this[cacheKey] = [init?.status || 200, body, headers];
74
78
  }
75
79
  }
package/dist/globals.mjs CHANGED
@@ -21,31 +21,35 @@ var buildOutgoingHttpHeaders = (headers) => {
21
21
 
22
22
  // src/response.ts
23
23
  var responseCache = Symbol("responseCache");
24
- var newGlobalResponseKey = Symbol("newGlobalResponse");
25
24
  var cacheKey = Symbol("cache");
26
25
  var GlobalResponse = global.Response;
27
26
  var Response = class _Response {
28
27
  #body;
29
28
  #init;
30
- [newGlobalResponseKey]() {
31
- return new GlobalResponse(
32
- this.#body,
33
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
34
- );
35
- }
36
- // @ts-ignore
37
29
  get cache() {
38
30
  delete this[cacheKey];
39
- return this[responseCache] ||= this[newGlobalResponseKey]();
31
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
40
32
  }
41
33
  constructor(body, init) {
42
34
  this.#body = body;
43
- this.#init = init;
35
+ if (init instanceof _Response) {
36
+ const cachedGlobalResponse = init[responseCache];
37
+ if (cachedGlobalResponse) {
38
+ this.#init = cachedGlobalResponse;
39
+ this.cache;
40
+ return;
41
+ } else {
42
+ this.#init = init.#init;
43
+ }
44
+ } else {
45
+ this.#init = init;
46
+ }
44
47
  if (typeof body === "string" || body instanceof ReadableStream) {
45
48
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
46
49
  if (headers instanceof Headers) {
47
50
  headers = buildOutgoingHttpHeaders(headers);
48
51
  }
52
+ ;
49
53
  this[cacheKey] = [init?.status || 200, body, headers];
50
54
  }
51
55
  }
package/dist/index.js CHANGED
@@ -100,31 +100,35 @@ var buildOutgoingHttpHeaders = (headers) => {
100
100
 
101
101
  // src/response.ts
102
102
  var responseCache = Symbol("responseCache");
103
- var newGlobalResponseKey = Symbol("newGlobalResponse");
104
103
  var cacheKey = Symbol("cache");
105
104
  var GlobalResponse = global.Response;
106
105
  var Response2 = class _Response {
107
106
  #body;
108
107
  #init;
109
- [newGlobalResponseKey]() {
110
- return new GlobalResponse(
111
- this.#body,
112
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
113
- );
114
- }
115
- // @ts-ignore
116
108
  get cache() {
117
109
  delete this[cacheKey];
118
- return this[responseCache] ||= this[newGlobalResponseKey]();
110
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
119
111
  }
120
112
  constructor(body, init) {
121
113
  this.#body = body;
122
- this.#init = init;
114
+ if (init instanceof _Response) {
115
+ const cachedGlobalResponse = init[responseCache];
116
+ if (cachedGlobalResponse) {
117
+ this.#init = cachedGlobalResponse;
118
+ this.cache;
119
+ return;
120
+ } else {
121
+ this.#init = init.#init;
122
+ }
123
+ } else {
124
+ this.#init = init;
125
+ }
123
126
  if (typeof body === "string" || body instanceof ReadableStream) {
124
127
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
125
128
  if (headers instanceof Headers) {
126
129
  headers = buildOutgoingHttpHeaders(headers);
127
130
  }
131
+ ;
128
132
  this[cacheKey] = [init?.status || 200, body, headers];
129
133
  }
130
134
  }
package/dist/index.mjs CHANGED
@@ -62,31 +62,35 @@ var buildOutgoingHttpHeaders = (headers) => {
62
62
 
63
63
  // src/response.ts
64
64
  var responseCache = Symbol("responseCache");
65
- var newGlobalResponseKey = Symbol("newGlobalResponse");
66
65
  var cacheKey = Symbol("cache");
67
66
  var GlobalResponse = global.Response;
68
67
  var Response2 = class _Response {
69
68
  #body;
70
69
  #init;
71
- [newGlobalResponseKey]() {
72
- return new GlobalResponse(
73
- this.#body,
74
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
75
- );
76
- }
77
- // @ts-ignore
78
70
  get cache() {
79
71
  delete this[cacheKey];
80
- return this[responseCache] ||= this[newGlobalResponseKey]();
72
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
81
73
  }
82
74
  constructor(body, init) {
83
75
  this.#body = body;
84
- this.#init = init;
76
+ if (init instanceof _Response) {
77
+ const cachedGlobalResponse = init[responseCache];
78
+ if (cachedGlobalResponse) {
79
+ this.#init = cachedGlobalResponse;
80
+ this.cache;
81
+ return;
82
+ } else {
83
+ this.#init = init.#init;
84
+ }
85
+ } else {
86
+ this.#init = init;
87
+ }
85
88
  if (typeof body === "string" || body instanceof ReadableStream) {
86
89
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
87
90
  if (headers instanceof Headers) {
88
91
  headers = buildOutgoingHttpHeaders(headers);
89
92
  }
93
+ ;
90
94
  this[cacheKey] = [init?.status || 200, body, headers];
91
95
  }
92
96
  }
package/dist/listener.js CHANGED
@@ -95,31 +95,35 @@ var buildOutgoingHttpHeaders = (headers) => {
95
95
 
96
96
  // src/response.ts
97
97
  var responseCache = Symbol("responseCache");
98
- var newGlobalResponseKey = Symbol("newGlobalResponse");
99
98
  var cacheKey = Symbol("cache");
100
99
  var GlobalResponse = global.Response;
101
100
  var Response2 = class _Response {
102
101
  #body;
103
102
  #init;
104
- [newGlobalResponseKey]() {
105
- return new GlobalResponse(
106
- this.#body,
107
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
108
- );
109
- }
110
- // @ts-ignore
111
103
  get cache() {
112
104
  delete this[cacheKey];
113
- return this[responseCache] ||= this[newGlobalResponseKey]();
105
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
114
106
  }
115
107
  constructor(body, init) {
116
108
  this.#body = body;
117
- this.#init = init;
109
+ if (init instanceof _Response) {
110
+ const cachedGlobalResponse = init[responseCache];
111
+ if (cachedGlobalResponse) {
112
+ this.#init = cachedGlobalResponse;
113
+ this.cache;
114
+ return;
115
+ } else {
116
+ this.#init = init.#init;
117
+ }
118
+ } else {
119
+ this.#init = init;
120
+ }
118
121
  if (typeof body === "string" || body instanceof ReadableStream) {
119
122
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
120
123
  if (headers instanceof Headers) {
121
124
  headers = buildOutgoingHttpHeaders(headers);
122
125
  }
126
+ ;
123
127
  this[cacheKey] = [init?.status || 200, body, headers];
124
128
  }
125
129
  }
package/dist/listener.mjs CHANGED
@@ -59,31 +59,35 @@ var buildOutgoingHttpHeaders = (headers) => {
59
59
 
60
60
  // src/response.ts
61
61
  var responseCache = Symbol("responseCache");
62
- var newGlobalResponseKey = Symbol("newGlobalResponse");
63
62
  var cacheKey = Symbol("cache");
64
63
  var GlobalResponse = global.Response;
65
64
  var Response2 = class _Response {
66
65
  #body;
67
66
  #init;
68
- [newGlobalResponseKey]() {
69
- return new GlobalResponse(
70
- this.#body,
71
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
72
- );
73
- }
74
- // @ts-ignore
75
67
  get cache() {
76
68
  delete this[cacheKey];
77
- return this[responseCache] ||= this[newGlobalResponseKey]();
69
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
78
70
  }
79
71
  constructor(body, init) {
80
72
  this.#body = body;
81
- this.#init = init;
73
+ if (init instanceof _Response) {
74
+ const cachedGlobalResponse = init[responseCache];
75
+ if (cachedGlobalResponse) {
76
+ this.#init = cachedGlobalResponse;
77
+ this.cache;
78
+ return;
79
+ } else {
80
+ this.#init = init.#init;
81
+ }
82
+ } else {
83
+ this.#init = init;
84
+ }
82
85
  if (typeof body === "string" || body instanceof ReadableStream) {
83
86
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
84
87
  if (headers instanceof Headers) {
85
88
  headers = buildOutgoingHttpHeaders(headers);
86
89
  }
90
+ ;
87
91
  this[cacheKey] = [init?.status || 200, body, headers];
88
92
  }
89
93
  }
@@ -1,4 +1,3 @@
1
- declare const newGlobalResponseKey: unique symbol;
2
1
  declare const cacheKey: unique symbol;
3
2
  declare const GlobalResponse: {
4
3
  new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): globalThis.Response;
@@ -9,7 +8,6 @@ declare const GlobalResponse: {
9
8
  };
10
9
  declare class Response {
11
10
  #private;
12
- [newGlobalResponseKey](): typeof GlobalResponse;
13
11
  private get cache();
14
12
  constructor(body?: BodyInit | null, init?: ResponseInit);
15
13
  }
@@ -1,4 +1,3 @@
1
- declare const newGlobalResponseKey: unique symbol;
2
1
  declare const cacheKey: unique symbol;
3
2
  declare const GlobalResponse: {
4
3
  new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): globalThis.Response;
@@ -9,7 +8,6 @@ declare const GlobalResponse: {
9
8
  };
10
9
  declare class Response {
11
10
  #private;
12
- [newGlobalResponseKey](): typeof GlobalResponse;
13
11
  private get cache();
14
12
  constructor(body?: BodyInit | null, init?: ResponseInit);
15
13
  }
package/dist/response.js CHANGED
@@ -46,31 +46,35 @@ var buildOutgoingHttpHeaders = (headers) => {
46
46
 
47
47
  // src/response.ts
48
48
  var responseCache = Symbol("responseCache");
49
- var newGlobalResponseKey = Symbol("newGlobalResponse");
50
49
  var cacheKey = Symbol("cache");
51
50
  var GlobalResponse = global.Response;
52
51
  var Response = class _Response {
53
52
  #body;
54
53
  #init;
55
- [newGlobalResponseKey]() {
56
- return new GlobalResponse(
57
- this.#body,
58
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
59
- );
60
- }
61
- // @ts-ignore
62
54
  get cache() {
63
55
  delete this[cacheKey];
64
- return this[responseCache] ||= this[newGlobalResponseKey]();
56
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
65
57
  }
66
58
  constructor(body, init) {
67
59
  this.#body = body;
68
- this.#init = init;
60
+ if (init instanceof _Response) {
61
+ const cachedGlobalResponse = init[responseCache];
62
+ if (cachedGlobalResponse) {
63
+ this.#init = cachedGlobalResponse;
64
+ this.cache;
65
+ return;
66
+ } else {
67
+ this.#init = init.#init;
68
+ }
69
+ } else {
70
+ this.#init = init;
71
+ }
69
72
  if (typeof body === "string" || body instanceof ReadableStream) {
70
73
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
71
74
  if (headers instanceof Headers) {
72
75
  headers = buildOutgoingHttpHeaders(headers);
73
76
  }
77
+ ;
74
78
  this[cacheKey] = [init?.status || 200, body, headers];
75
79
  }
76
80
  }
package/dist/response.mjs CHANGED
@@ -18,31 +18,35 @@ var buildOutgoingHttpHeaders = (headers) => {
18
18
 
19
19
  // src/response.ts
20
20
  var responseCache = Symbol("responseCache");
21
- var newGlobalResponseKey = Symbol("newGlobalResponse");
22
21
  var cacheKey = Symbol("cache");
23
22
  var GlobalResponse = global.Response;
24
23
  var Response = class _Response {
25
24
  #body;
26
25
  #init;
27
- [newGlobalResponseKey]() {
28
- return new GlobalResponse(
29
- this.#body,
30
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
31
- );
32
- }
33
- // @ts-ignore
34
26
  get cache() {
35
27
  delete this[cacheKey];
36
- return this[responseCache] ||= this[newGlobalResponseKey]();
28
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
37
29
  }
38
30
  constructor(body, init) {
39
31
  this.#body = body;
40
- this.#init = init;
32
+ if (init instanceof _Response) {
33
+ const cachedGlobalResponse = init[responseCache];
34
+ if (cachedGlobalResponse) {
35
+ this.#init = cachedGlobalResponse;
36
+ this.cache;
37
+ return;
38
+ } else {
39
+ this.#init = init.#init;
40
+ }
41
+ } else {
42
+ this.#init = init;
43
+ }
41
44
  if (typeof body === "string" || body instanceof ReadableStream) {
42
45
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
43
46
  if (headers instanceof Headers) {
44
47
  headers = buildOutgoingHttpHeaders(headers);
45
48
  }
49
+ ;
46
50
  this[cacheKey] = [init?.status || 200, body, headers];
47
51
  }
48
52
  }
package/dist/server.js CHANGED
@@ -97,31 +97,35 @@ var buildOutgoingHttpHeaders = (headers) => {
97
97
 
98
98
  // src/response.ts
99
99
  var responseCache = Symbol("responseCache");
100
- var newGlobalResponseKey = Symbol("newGlobalResponse");
101
100
  var cacheKey = Symbol("cache");
102
101
  var GlobalResponse = global.Response;
103
102
  var Response2 = class _Response {
104
103
  #body;
105
104
  #init;
106
- [newGlobalResponseKey]() {
107
- return new GlobalResponse(
108
- this.#body,
109
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
110
- );
111
- }
112
- // @ts-ignore
113
105
  get cache() {
114
106
  delete this[cacheKey];
115
- return this[responseCache] ||= this[newGlobalResponseKey]();
107
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
116
108
  }
117
109
  constructor(body, init) {
118
110
  this.#body = body;
119
- this.#init = init;
111
+ if (init instanceof _Response) {
112
+ const cachedGlobalResponse = init[responseCache];
113
+ if (cachedGlobalResponse) {
114
+ this.#init = cachedGlobalResponse;
115
+ this.cache;
116
+ return;
117
+ } else {
118
+ this.#init = init.#init;
119
+ }
120
+ } else {
121
+ this.#init = init;
122
+ }
120
123
  if (typeof body === "string" || body instanceof ReadableStream) {
121
124
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
122
125
  if (headers instanceof Headers) {
123
126
  headers = buildOutgoingHttpHeaders(headers);
124
127
  }
128
+ ;
125
129
  this[cacheKey] = [init?.status || 200, body, headers];
126
130
  }
127
131
  }
package/dist/server.mjs CHANGED
@@ -62,31 +62,35 @@ var buildOutgoingHttpHeaders = (headers) => {
62
62
 
63
63
  // src/response.ts
64
64
  var responseCache = Symbol("responseCache");
65
- var newGlobalResponseKey = Symbol("newGlobalResponse");
66
65
  var cacheKey = Symbol("cache");
67
66
  var GlobalResponse = global.Response;
68
67
  var Response2 = class _Response {
69
68
  #body;
70
69
  #init;
71
- [newGlobalResponseKey]() {
72
- return new GlobalResponse(
73
- this.#body,
74
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
75
- );
76
- }
77
- // @ts-ignore
78
70
  get cache() {
79
71
  delete this[cacheKey];
80
- return this[responseCache] ||= this[newGlobalResponseKey]();
72
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
81
73
  }
82
74
  constructor(body, init) {
83
75
  this.#body = body;
84
- this.#init = init;
76
+ if (init instanceof _Response) {
77
+ const cachedGlobalResponse = init[responseCache];
78
+ if (cachedGlobalResponse) {
79
+ this.#init = cachedGlobalResponse;
80
+ this.cache;
81
+ return;
82
+ } else {
83
+ this.#init = init.#init;
84
+ }
85
+ } else {
86
+ this.#init = init;
87
+ }
85
88
  if (typeof body === "string" || body instanceof ReadableStream) {
86
89
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
87
90
  if (headers instanceof Headers) {
88
91
  headers = buildOutgoingHttpHeaders(headers);
89
92
  }
93
+ ;
90
94
  this[cacheKey] = [init?.status || 200, body, headers];
91
95
  }
92
96
  }
package/dist/vercel.js CHANGED
@@ -95,31 +95,35 @@ var buildOutgoingHttpHeaders = (headers) => {
95
95
 
96
96
  // src/response.ts
97
97
  var responseCache = Symbol("responseCache");
98
- var newGlobalResponseKey = Symbol("newGlobalResponse");
99
98
  var cacheKey = Symbol("cache");
100
99
  var GlobalResponse = global.Response;
101
100
  var Response2 = class _Response {
102
101
  #body;
103
102
  #init;
104
- [newGlobalResponseKey]() {
105
- return new GlobalResponse(
106
- this.#body,
107
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
108
- );
109
- }
110
- // @ts-ignore
111
103
  get cache() {
112
104
  delete this[cacheKey];
113
- return this[responseCache] ||= this[newGlobalResponseKey]();
105
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
114
106
  }
115
107
  constructor(body, init) {
116
108
  this.#body = body;
117
- this.#init = init;
109
+ if (init instanceof _Response) {
110
+ const cachedGlobalResponse = init[responseCache];
111
+ if (cachedGlobalResponse) {
112
+ this.#init = cachedGlobalResponse;
113
+ this.cache;
114
+ return;
115
+ } else {
116
+ this.#init = init.#init;
117
+ }
118
+ } else {
119
+ this.#init = init;
120
+ }
118
121
  if (typeof body === "string" || body instanceof ReadableStream) {
119
122
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
120
123
  if (headers instanceof Headers) {
121
124
  headers = buildOutgoingHttpHeaders(headers);
122
125
  }
126
+ ;
123
127
  this[cacheKey] = [init?.status || 200, body, headers];
124
128
  }
125
129
  }
package/dist/vercel.mjs CHANGED
@@ -59,31 +59,35 @@ var buildOutgoingHttpHeaders = (headers) => {
59
59
 
60
60
  // src/response.ts
61
61
  var responseCache = Symbol("responseCache");
62
- var newGlobalResponseKey = Symbol("newGlobalResponse");
63
62
  var cacheKey = Symbol("cache");
64
63
  var GlobalResponse = global.Response;
65
64
  var Response2 = class _Response {
66
65
  #body;
67
66
  #init;
68
- [newGlobalResponseKey]() {
69
- return new GlobalResponse(
70
- this.#body,
71
- this.#init instanceof _Response ? this.#init[newGlobalResponseKey]() : this.#init
72
- );
73
- }
74
- // @ts-ignore
75
67
  get cache() {
76
68
  delete this[cacheKey];
77
- return this[responseCache] ||= this[newGlobalResponseKey]();
69
+ return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
78
70
  }
79
71
  constructor(body, init) {
80
72
  this.#body = body;
81
- this.#init = init;
73
+ if (init instanceof _Response) {
74
+ const cachedGlobalResponse = init[responseCache];
75
+ if (cachedGlobalResponse) {
76
+ this.#init = cachedGlobalResponse;
77
+ this.cache;
78
+ return;
79
+ } else {
80
+ this.#init = init.#init;
81
+ }
82
+ } else {
83
+ this.#init = init;
84
+ }
82
85
  if (typeof body === "string" || body instanceof ReadableStream) {
83
86
  let headers = init?.headers || { "content-type": "text/plain;charset=UTF-8" };
84
87
  if (headers instanceof Headers) {
85
88
  headers = buildOutgoingHttpHeaders(headers);
86
89
  }
90
+ ;
87
91
  this[cacheKey] = [init?.status || 200, body, headers];
88
92
  }
89
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",