@hono/node-server 1.14.4 → 1.15.0

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.
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
package/dist/globals.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
@@ -23,4 +23,4 @@ declare class Response {
23
23
  get ok(): boolean;
24
24
  }
25
25
 
26
- export { GlobalResponse, InternalCache, Response, cacheKey };
26
+ export { GlobalResponse, type InternalCache, Response, cacheKey };
@@ -23,4 +23,4 @@ declare class Response {
23
23
  get ok(): boolean;
24
24
  }
25
25
 
26
- export { GlobalResponse, InternalCache, Response, cacheKey };
26
+ export { GlobalResponse, type InternalCache, Response, cacheKey };
@@ -8,10 +8,10 @@ type ServeStaticOptions<E extends Env = Env> = {
8
8
  path?: string;
9
9
  index?: string;
10
10
  precompressed?: boolean;
11
- rewriteRequestPath?: (path: string) => string;
11
+ rewriteRequestPath?: (path: string, c: Context<E>) => string;
12
12
  onFound?: (path: string, c: Context<E>) => void | Promise<void>;
13
13
  onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
14
14
  };
15
- declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler;
15
+ declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
16
16
 
17
- export { ServeStaticOptions, serveStatic };
17
+ export { type ServeStaticOptions, serveStatic };
@@ -8,10 +8,10 @@ type ServeStaticOptions<E extends Env = Env> = {
8
8
  path?: string;
9
9
  index?: string;
10
10
  precompressed?: boolean;
11
- rewriteRequestPath?: (path: string) => string;
11
+ rewriteRequestPath?: (path: string, c: Context<E>) => string;
12
12
  onFound?: (path: string, c: Context<E>) => void | Promise<void>;
13
13
  onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
14
14
  };
15
- declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler;
15
+ declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
16
16
 
17
- export { ServeStaticOptions, serveStatic };
17
+ export { type ServeStaticOptions, serveStatic };
@@ -73,7 +73,7 @@ var serveStatic = (options = { root: "" }) => {
73
73
  return next();
74
74
  }
75
75
  let path = (0, import_filepath.getFilePathWithoutDefaultDocument)({
76
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
76
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
77
77
  root: options.root
78
78
  });
79
79
  if (path) {
@@ -84,7 +84,7 @@ var serveStatic = (options = { root: "" }) => {
84
84
  let stats = getStats(path);
85
85
  if (stats && stats.isDirectory()) {
86
86
  path = (0, import_filepath.getFilePath)({
87
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
87
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
88
88
  root: options.root,
89
89
  defaultDocument: options.index ?? "index.html"
90
90
  });
@@ -49,7 +49,7 @@ var serveStatic = (options = { root: "" }) => {
49
49
  return next();
50
50
  }
51
51
  let path = getFilePathWithoutDefaultDocument({
52
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
52
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
53
53
  root: options.root
54
54
  });
55
55
  if (path) {
@@ -60,7 +60,7 @@ var serveStatic = (options = { root: "" }) => {
60
60
  let stats = getStats(path);
61
61
  if (stats && stats.isDirectory()) {
62
62
  path = getFilePath({
63
- filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
63
+ filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
64
64
  root: options.root,
65
65
  defaultDocument: options.index ?? "index.html"
66
66
  });
package/dist/types.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { IncomingMessage, ServerResponse, Server, ServerOptions as ServerOptions$1, createServer } from 'node:http';
2
- import { Http2ServerRequest, Http2ServerResponse, Http2Server, Http2SecureServer, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer } from 'node:http2';
1
+ import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
2
+ import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
3
3
  import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
4
4
 
5
5
  type HttpBindings = {
@@ -40,4 +40,4 @@ type Options = {
40
40
  } & ServerOptions;
41
41
  type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
42
42
 
43
- export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
43
+ export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { IncomingMessage, ServerResponse, Server, ServerOptions as ServerOptions$1, createServer } from 'node:http';
2
- import { Http2ServerRequest, Http2ServerResponse, Http2Server, Http2SecureServer, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer } from 'node:http2';
1
+ import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
2
+ import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
3
3
  import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
4
4
 
5
5
  type HttpBindings = {
@@ -40,4 +40,4 @@ type Options = {
40
40
  } & ServerOptions;
41
41
  type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
42
42
 
43
- export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
43
+ export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
package/dist/utils.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { OutgoingHttpHeaders } from 'node:http';
2
2
  import { Writable } from 'node:stream';
3
3
 
4
- declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<void> | undefined;
4
+ declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
5
5
  declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
6
6
 
7
7
  export { buildOutgoingHttpHeaders, writeFromReadableStream };
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { OutgoingHttpHeaders } from 'node:http';
2
2
  import { Writable } from 'node:stream';
3
3
 
4
- declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<void> | undefined;
4
+ declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
5
5
  declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
6
6
 
7
7
  export { buildOutgoingHttpHeaders, writeFromReadableStream };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.14.4",
3
+ "version": "1.15.0",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",