@hono/node-server 1.11.2 → 1.11.4

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
@@ -155,7 +155,28 @@ import { serveStatic } from '@hono/node-server/serve-static'
155
155
  app.use('/static/*', serveStatic({ root: './' }))
156
156
  ```
157
157
 
158
- Note that `root` must be _relative_ to the current working directory - absolute paths are not supported.
158
+ Note that `root` must be _relative_ to the current working directory from which the app was started. Absolute paths are not supported.
159
+
160
+ This can cause confusion when running your application locally.
161
+
162
+ Imagine your project structure is:
163
+
164
+ ```
165
+ my-hono-project/
166
+ src/
167
+ index.ts
168
+ static/
169
+ index.html
170
+ ```
171
+
172
+ Typically, you would run your app from the project's root directory (`my-hono-project`),
173
+ so you would need the following code to serve the `static` folder:
174
+
175
+ ```ts
176
+ app.use('/static/*', serveStatic({ root: './static' }))
177
+ ```
178
+
179
+ Notice that `root` here is not relative to `src/index.ts`, rather to `my-hono-project`.
159
180
 
160
181
  ### Options
161
182
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createAdaptorServer, serve } from './server.mjs';
2
2
  export { getRequestListener } from './listener.mjs';
3
3
  export { RequestError } from './request.mjs';
4
- export { Http2Bindings, HttpBindings } from './types.mjs';
4
+ export { Http2Bindings, HttpBindings, ServerType } from './types.mjs';
5
5
  import 'node:net';
6
6
  import 'node:http';
7
7
  import 'node:http2';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createAdaptorServer, serve } from './server.js';
2
2
  export { getRequestListener } from './listener.js';
3
3
  export { RequestError } from './request.js';
4
- export { Http2Bindings, HttpBindings } from './types.js';
4
+ export { Http2Bindings, HttpBindings, ServerType } from './types.js';
5
5
  import 'node:net';
6
6
  import 'node:http';
7
7
  import 'node:http2';
package/dist/index.js CHANGED
@@ -83,6 +83,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
83
83
  headers: headerRecord,
84
84
  signal: abortController.signal
85
85
  };
86
+ if (method === "TRACE") {
87
+ init.method = "GET";
88
+ const req = new Request(url, init);
89
+ Object.defineProperty(req, "method", {
90
+ get() {
91
+ return "TRACE";
92
+ }
93
+ });
94
+ return req;
95
+ }
86
96
  if (!(method === "GET" || method === "HEAD")) {
87
97
  init.body = import_node_stream.Readable.toWeb(incoming);
88
98
  }
package/dist/index.mjs CHANGED
@@ -44,6 +44,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
44
44
  headers: headerRecord,
45
45
  signal: abortController.signal
46
46
  };
47
+ if (method === "TRACE") {
48
+ init.method = "GET";
49
+ const req = new Request(url, init);
50
+ Object.defineProperty(req, "method", {
51
+ get() {
52
+ return "TRACE";
53
+ }
54
+ });
55
+ return req;
56
+ }
47
57
  if (!(method === "GET" || method === "HEAD")) {
48
58
  init.body = Readable.toWeb(incoming);
49
59
  }
package/dist/listener.js CHANGED
@@ -77,6 +77,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
77
77
  headers: headerRecord,
78
78
  signal: abortController.signal
79
79
  };
80
+ if (method === "TRACE") {
81
+ init.method = "GET";
82
+ const req = new Request(url, init);
83
+ Object.defineProperty(req, "method", {
84
+ get() {
85
+ return "TRACE";
86
+ }
87
+ });
88
+ return req;
89
+ }
80
90
  if (!(method === "GET" || method === "HEAD")) {
81
91
  init.body = import_node_stream.Readable.toWeb(incoming);
82
92
  }
package/dist/listener.mjs CHANGED
@@ -41,6 +41,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
41
41
  headers: headerRecord,
42
42
  signal: abortController.signal
43
43
  };
44
+ if (method === "TRACE") {
45
+ init.method = "GET";
46
+ const req = new Request(url, init);
47
+ Object.defineProperty(req, "method", {
48
+ get() {
49
+ return "TRACE";
50
+ }
51
+ });
52
+ return req;
53
+ }
44
54
  if (!(method === "GET" || method === "HEAD")) {
45
55
  init.body = Readable.toWeb(incoming);
46
56
  }
package/dist/request.js CHANGED
@@ -70,6 +70,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
70
70
  headers: headerRecord,
71
71
  signal: abortController.signal
72
72
  };
73
+ if (method === "TRACE") {
74
+ init.method = "GET";
75
+ const req = new Request(url, init);
76
+ Object.defineProperty(req, "method", {
77
+ get() {
78
+ return "TRACE";
79
+ }
80
+ });
81
+ return req;
82
+ }
73
83
  if (!(method === "GET" || method === "HEAD")) {
74
84
  init.body = import_node_stream.Readable.toWeb(incoming);
75
85
  }
package/dist/request.mjs CHANGED
@@ -41,6 +41,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
41
41
  headers: headerRecord,
42
42
  signal: abortController.signal
43
43
  };
44
+ if (method === "TRACE") {
45
+ init.method = "GET";
46
+ const req = new Request(url, init);
47
+ Object.defineProperty(req, "method", {
48
+ get() {
49
+ return "TRACE";
50
+ }
51
+ });
52
+ return req;
53
+ }
44
54
  if (!(method === "GET" || method === "HEAD")) {
45
55
  init.body = Readable.toWeb(incoming);
46
56
  }
@@ -2,7 +2,7 @@ import { Context, MiddlewareHandler } from 'hono';
2
2
 
3
3
  type ServeStaticOptions = {
4
4
  /**
5
- * Root path, relative to current working directory. (absolute paths are not supported)
5
+ * Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
6
6
  */
7
7
  root?: string;
8
8
  path?: string;
@@ -2,7 +2,7 @@ import { Context, MiddlewareHandler } from 'hono';
2
2
 
3
3
  type ServeStaticOptions = {
4
4
  /**
5
- * Root path, relative to current working directory. (absolute paths are not supported)
5
+ * Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
6
6
  */
7
7
  root?: string;
8
8
  path?: string;
package/dist/server.js CHANGED
@@ -79,6 +79,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
79
79
  headers: headerRecord,
80
80
  signal: abortController.signal
81
81
  };
82
+ if (method === "TRACE") {
83
+ init.method = "GET";
84
+ const req = new Request(url, init);
85
+ Object.defineProperty(req, "method", {
86
+ get() {
87
+ return "TRACE";
88
+ }
89
+ });
90
+ return req;
91
+ }
82
92
  if (!(method === "GET" || method === "HEAD")) {
83
93
  init.body = import_node_stream.Readable.toWeb(incoming);
84
94
  }
package/dist/server.mjs CHANGED
@@ -44,6 +44,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
44
44
  headers: headerRecord,
45
45
  signal: abortController.signal
46
46
  };
47
+ if (method === "TRACE") {
48
+ init.method = "GET";
49
+ const req = new Request(url, init);
50
+ Object.defineProperty(req, "method", {
51
+ get() {
52
+ return "TRACE";
53
+ }
54
+ });
55
+ return req;
56
+ }
47
57
  if (!(method === "GET" || method === "HEAD")) {
48
58
  init.body = Readable.toWeb(incoming);
49
59
  }
package/dist/vercel.js CHANGED
@@ -77,6 +77,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
77
77
  headers: headerRecord,
78
78
  signal: abortController.signal
79
79
  };
80
+ if (method === "TRACE") {
81
+ init.method = "GET";
82
+ const req = new Request(url, init);
83
+ Object.defineProperty(req, "method", {
84
+ get() {
85
+ return "TRACE";
86
+ }
87
+ });
88
+ return req;
89
+ }
80
90
  if (!(method === "GET" || method === "HEAD")) {
81
91
  init.body = import_node_stream.Readable.toWeb(incoming);
82
92
  }
package/dist/vercel.mjs CHANGED
@@ -41,6 +41,16 @@ var newRequestFromIncoming = (method, url, incoming, abortController) => {
41
41
  headers: headerRecord,
42
42
  signal: abortController.signal
43
43
  };
44
+ if (method === "TRACE") {
45
+ init.method = "GET";
46
+ const req = new Request(url, init);
47
+ Object.defineProperty(req, "method", {
48
+ get() {
49
+ return "TRACE";
50
+ }
51
+ });
52
+ return req;
53
+ }
44
54
  if (!(method === "GET" || method === "HEAD")) {
45
55
  init.body = Readable.toWeb(incoming);
46
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",