hono 4.5.3 → 4.5.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.
@@ -167,7 +167,13 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
167
167
  }
168
168
  });
169
169
  }
170
- return new WebSocket(targetUrl.toString());
170
+ const establishWebSocket = (...args) => {
171
+ if (options?.webSocket !== void 0 && typeof options.webSocket === "function") {
172
+ return options.webSocket(...args);
173
+ }
174
+ return new WebSocket(...args);
175
+ };
176
+ return establishWebSocket(targetUrl.toString());
171
177
  }
172
178
  const req = new ClientRequestImpl(url, method);
173
179
  if (method) {
@@ -151,7 +151,13 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
151
151
  }
152
152
  });
153
153
  }
154
- return new WebSocket(targetUrl.toString());
154
+ const establishWebSocket = (...args) => {
155
+ if (options?.webSocket !== void 0 && typeof options.webSocket === "function") {
156
+ return options.webSocket(...args);
157
+ }
158
+ return new WebSocket(...args);
159
+ };
160
+ return establishWebSocket(targetUrl.toString());
155
161
  }
156
162
  const req = new ClientRequestImpl(url, method);
157
163
  if (method) {
@@ -5,6 +5,7 @@ import type { HasRequiredKeys } from '../utils/types';
5
5
  type HonoRequest = (typeof Hono.prototype)['request'];
6
6
  export type ClientRequestOptions<T = unknown> = {
7
7
  fetch?: typeof fetch | HonoRequest;
8
+ webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket;
8
9
  /**
9
10
  * Standard `RequestInit`, caution that this take highest priority
10
11
  * and could be used to overwrite things that Hono sets for you, like `body | method | headers`.
@@ -6,7 +6,9 @@
6
6
  */
7
7
  export declare namespace JSX {
8
8
  export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
9
- export type CSSProperties = {};
9
+ export interface CSSProperties {
10
+ [propertyKey: string]: unknown;
11
+ }
10
12
  type AnyAttributes = {
11
13
  [attributeName: string]: any;
12
14
  };
@@ -147,7 +149,7 @@ export declare namespace JSX {
147
149
  contenteditable?: boolean | 'inherit' | undefined;
148
150
  contextmenu?: string | undefined;
149
151
  dir?: string | undefined;
150
- draggable?: boolean | undefined;
152
+ draggable?: 'true' | 'false' | undefined;
151
153
  enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
152
154
  hidden?: boolean | undefined;
153
155
  id?: string | undefined;
@@ -165,7 +167,7 @@ export declare namespace JSX {
165
167
  popover?: string | undefined;
166
168
  slot?: string | undefined;
167
169
  spellcheck?: boolean | undefined;
168
- style?: CSSProperties | undefined;
170
+ style?: CSSProperties | string | undefined;
169
171
  tabindex?: number | undefined;
170
172
  title?: string | undefined;
171
173
  translate?: 'yes' | 'no' | undefined;
@@ -458,7 +458,7 @@ type ChangePathOfSchema<S extends Schema, Path extends string> = keyof S extends
458
458
  [K in keyof S as Path]: S[K];
459
459
  };
460
460
  export type Endpoint = {
461
- input: Partial<ValidationTargets>;
461
+ input: any;
462
462
  output: any;
463
463
  outputFormat: ResponseFormat;
464
464
  status: StatusCode;
@@ -514,11 +514,11 @@ export type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F exte
514
514
  type MergeTypedResponse<T> = T extends Promise<infer T2> ? T2 extends TypedResponse ? T2 : TypedResponse : T extends TypedResponse ? T : TypedResponse;
515
515
  export type FormValue = string | Blob;
516
516
  export type ParsedFormValue = string | File;
517
- export type ValidationTargets<T extends FormValue = ParsedFormValue> = {
517
+ export type ValidationTargets<T extends FormValue = ParsedFormValue, P extends string = string> = {
518
518
  json: any;
519
519
  form: Record<string, T | T[]>;
520
520
  query: Record<string, string | string[]>;
521
- param: Record<string, string> | Record<string, string | undefined>;
521
+ param: Record<P, P extends `${infer _}?` ? string | undefined : string>;
522
522
  header: Record<string, string>;
523
523
  cookie: Record<string, string>;
524
524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.5.3",
3
+ "version": "4.5.4",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",