hono 4.6.15 → 4.6.16

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.
@@ -332,6 +332,7 @@ const applyNodeObject = (node, container, isNew) => {
332
332
  }
333
333
  }
334
334
  };
335
+ const isSameContext = (oldContexts, newContexts) => !!(oldContexts && oldContexts.length === newContexts.length && oldContexts.every((ctx, i) => ctx[1] === newContexts[i][1]));
335
336
  const fallbackUpdateFnArrayMap = /* @__PURE__ */ new WeakMap();
336
337
  const build = (context, node, children) => {
337
338
  const buildWithPreviousChildren = !children && node.pC;
@@ -385,9 +386,10 @@ const build = (context, node, children) => {
385
386
  oldChild.props = child.props;
386
387
  oldChild.f ||= child.f || node.f;
387
388
  if (typeof child.tag === "function") {
389
+ const oldContexts = oldChild[import_constants.DOM_STASH][2];
388
390
  oldChild[import_constants.DOM_STASH][2] = child[import_constants.DOM_STASH][2] || [];
389
391
  oldChild[import_constants.DOM_STASH][3] = child[import_constants.DOM_STASH][3];
390
- if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[import_constants.DOM_MEMO]?.(pP, oldChild.props))) {
392
+ if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[import_constants.DOM_MEMO]?.(pP, oldChild.props)) && isSameContext(oldContexts, oldChild[import_constants.DOM_STASH][2])) {
391
393
  oldChild.s = true;
392
394
  }
393
395
  }
@@ -308,6 +308,7 @@ var applyNodeObject = (node, container, isNew) => {
308
308
  }
309
309
  }
310
310
  };
311
+ var isSameContext = (oldContexts, newContexts) => !!(oldContexts && oldContexts.length === newContexts.length && oldContexts.every((ctx, i) => ctx[1] === newContexts[i][1]));
311
312
  var fallbackUpdateFnArrayMap = /* @__PURE__ */ new WeakMap();
312
313
  var build = (context, node, children) => {
313
314
  const buildWithPreviousChildren = !children && node.pC;
@@ -361,9 +362,10 @@ var build = (context, node, children) => {
361
362
  oldChild.props = child.props;
362
363
  oldChild.f ||= child.f || node.f;
363
364
  if (typeof child.tag === "function") {
365
+ const oldContexts = oldChild[DOM_STASH][2];
364
366
  oldChild[DOM_STASH][2] = child[DOM_STASH][2] || [];
365
367
  oldChild[DOM_STASH][3] = child[DOM_STASH][3];
366
- if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[DOM_MEMO]?.(pP, oldChild.props))) {
368
+ if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[DOM_MEMO]?.(pP, oldChild.props)) && isSameContext(oldContexts, oldChild[DOM_STASH][2])) {
367
369
  oldChild.s = true;
368
370
  }
369
371
  }
@@ -88,10 +88,10 @@ interface NewResponse {
88
88
  * Interface for responding with a body.
89
89
  */
90
90
  interface BodyRespond {
91
- (data: Data, status?: ContentfulStatusCode, headers?: HeaderRecord): Response;
92
- (data: null, status?: StatusCode, headers?: HeaderRecord): Response;
93
- (data: Data, init?: ResponseOrInit<ContentfulStatusCode>): Response;
94
- (data: null, init?: ResponseOrInit): Response;
91
+ <U extends ContentfulStatusCode>(data: Data, status?: U, headers?: HeaderRecord): Response & TypedResponse<unknown, U, "body">;
92
+ <U extends StatusCode>(data: null, status?: U, headers?: HeaderRecord): Response & TypedResponse<null, U, "body">;
93
+ <U extends ContentfulStatusCode>(data: Data, init?: ResponseOrInit<U>): Response & TypedResponse<unknown, U, "body">;
94
+ <U extends StatusCode>(data: null, init?: ResponseOrInit<U>): Response & TypedResponse<null, U, "body">;
95
95
  }
96
96
  /**
97
97
  * Interface for responding with text.
@@ -1208,7 +1208,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1208
1208
  E11
1209
1209
  ]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I10, MergeTypedResponse<HandlerResponse<any>>>, BasePath>;
1210
1210
  <P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(methods: string[], path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): HonoBase<E, S & ToSchema<string, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
1211
- <I extends Input = BlankInput, R extends HandlerResponse<any> = any>(methods: string | string[], paths: string[], ...handlers: H<E, any, I, R>[]): HonoBase<E, S & ToSchema<string, string, I, MergeTypedResponse<R>>, BasePath>;
1211
+ <I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(methods: string | string[], paths: string[], ...handlers: H<E2, any, I, R>[]): HonoBase<E, S & ToSchema<string, string, I, MergeTypedResponse<R>>, BasePath>;
1212
1212
  }
1213
1213
  type ExtractStringKey<S> = keyof S & string;
1214
1214
  export type ToSchema<M extends string, P extends string, I extends Input | Input["in"], RorO> = Simplify<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.6.15",
3
+ "version": "4.6.16",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",