@hono/node-server 2.0.2 → 2.0.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/index.cjs CHANGED
@@ -400,8 +400,13 @@ var Response$1 = class Response$1 {
400
400
  #body;
401
401
  #init;
402
402
  [getResponseCache]() {
403
+ const cache = this[cacheKey];
404
+ const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
403
405
  delete this[cacheKey];
404
- return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
406
+ return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
407
+ ...this.#init,
408
+ headers: liveHeaders
409
+ } : this.#init);
405
410
  }
406
411
  constructor(body, init) {
407
412
  let headers;
@@ -414,7 +419,7 @@ var Response$1 = class Response$1 {
414
419
  return;
415
420
  } else {
416
421
  this.#init = init.#init;
417
- headers = new Headers(init.#init.headers);
422
+ headers = new Headers(init.headers);
418
423
  }
419
424
  } else this.#init = init;
420
425
  if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
package/dist/index.mjs CHANGED
@@ -399,8 +399,13 @@ var Response$1 = class Response$1 {
399
399
  #body;
400
400
  #init;
401
401
  [getResponseCache]() {
402
+ const cache = this[cacheKey];
403
+ const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
402
404
  delete this[cacheKey];
403
- return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
405
+ return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
406
+ ...this.#init,
407
+ headers: liveHeaders
408
+ } : this.#init);
404
409
  }
405
410
  constructor(body, init) {
406
411
  let headers;
@@ -413,7 +418,7 @@ var Response$1 = class Response$1 {
413
418
  return;
414
419
  } else {
415
420
  this.#init = init.#init;
416
- headers = new Headers(init.#init.headers);
421
+ headers = new Headers(init.headers);
417
422
  }
418
423
  } else this.#init = init;
419
424
  if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
@@ -3,7 +3,7 @@ import { Context, Env, MiddlewareHandler } from "hono";
3
3
  //#region src/serve-static.d.ts
4
4
  type ServeStaticOptions<E extends Env = Env> = {
5
5
  /**
6
- * Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
6
+ * Root path. Relative path is based on current working directory from which the app was started.
7
7
  */
8
8
  root?: string;
9
9
  path?: string;
@@ -3,7 +3,7 @@ import { Context, Env, MiddlewareHandler } from "hono";
3
3
  //#region src/serve-static.d.ts
4
4
  type ServeStaticOptions<E extends Env = Env> = {
5
5
  /**
6
- * Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
6
+ * Root path. Relative path is based on current working directory from which the app was started.
7
7
  */
8
8
  root?: string;
9
9
  path?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",