hono 4.13.11 → 4.13.13
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/cjs/hono-base.js +2 -0
- package/dist/cjs/jsx/utils.js +1 -1
- package/dist/cjs/middleware/combine/index.js +3 -1
- package/dist/cjs/middleware/etag/index.js +2 -2
- package/dist/cjs/middleware/language/language.js +1 -1
- package/dist/cjs/middleware/mount/index.js +71 -0
- package/dist/cjs/request.js +4 -4
- package/dist/hono-base.js +2 -0
- package/dist/jsx/utils.js +1 -1
- package/dist/middleware/combine/index.js +3 -1
- package/dist/middleware/etag/index.js +2 -2
- package/dist/middleware/language/language.js +1 -1
- package/dist/middleware/mount/index.js +70 -0
- package/dist/request.js +4 -4
- package/dist/types/adapter/aws-lambda/handler.d.ts +2 -1
- package/dist/types/adapter/aws-lambda/types.d.ts +2 -1
- package/dist/types/adapter/bun/websocket.d.ts +2 -1
- package/dist/types/adapter/cloudflare-pages/handler.d.ts +2 -1
- package/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +2 -1
- package/dist/types/adapter/lambda-edge/handler.d.ts +2 -1
- package/dist/types/adapter/service-worker/handler.d.ts +2 -1
- package/dist/types/adapter/service-worker/index.d.ts +2 -1
- package/dist/types/adapter/service-worker/types.d.ts +2 -1
- package/dist/types/client/types.d.ts +2 -1
- package/dist/types/context.d.ts +2 -1
- package/dist/types/helper/cookie/index.d.ts +2 -1
- package/dist/types/helper/css/common.d.ts +2 -1
- package/dist/types/helper/css/index.d.ts +2 -1
- package/dist/types/helper/dev/index.d.ts +2 -1
- package/dist/types/helper/factory/index.d.ts +2 -1
- package/dist/types/helper/proxy/index.d.ts +2 -1
- package/dist/types/helper/ssg/middleware.d.ts +2 -1
- package/dist/types/helper/ssg/utils.d.ts +2 -1
- package/dist/types/helper/testing/index.d.ts +2 -1
- package/dist/types/hono-base.d.ts +4 -1
- package/dist/types/http-exception.d.ts +2 -1
- package/dist/types/jsx/base.d.ts +5 -4
- package/dist/types/jsx/context.d.ts +2 -1
- package/dist/types/jsx/dom/client.d.ts +2 -1
- package/dist/types/jsx/dom/css.d.ts +2 -1
- package/dist/types/jsx/dom/hooks/index.d.ts +2 -1
- package/dist/types/jsx/dom/index.d.ts +2 -1
- package/dist/types/jsx/dom/render.d.ts +2 -1
- package/dist/types/jsx/dom/server.d.ts +2 -1
- package/dist/types/jsx/hooks/index.d.ts +2 -1
- package/dist/types/jsx/index.d.ts +2 -1
- package/dist/types/jsx/types.d.ts +2 -1
- package/dist/types/middleware/basic-auth/index.d.ts +2 -1
- package/dist/types/middleware/bearer-auth/index.d.ts +2 -1
- package/dist/types/middleware/body-limit/index.d.ts +2 -1
- package/dist/types/middleware/combine/index.d.ts +2 -1
- package/dist/types/middleware/compress/index.d.ts +2 -1
- package/dist/types/middleware/cors/index.d.ts +2 -1
- package/dist/types/middleware/csrf/index.d.ts +2 -1
- package/dist/types/middleware/etag/index.d.ts +2 -1
- package/dist/types/middleware/ip-restriction/index.d.ts +2 -1
- package/dist/types/middleware/jsx-renderer/index.d.ts +2 -1
- package/dist/types/middleware/jwt/index.d.ts +2 -1
- package/dist/types/middleware/language/index.d.ts +2 -1
- package/dist/types/middleware/logger/index.d.ts +2 -1
- package/dist/types/middleware/method-not-allowed/index.d.ts +2 -1
- package/dist/types/middleware/method-override/index.d.ts +2 -1
- package/dist/types/middleware/mount/index.d.ts +46 -0
- package/dist/types/middleware/powered-by/index.d.ts +2 -1
- package/dist/types/middleware/pretty-json/index.d.ts +2 -1
- package/dist/types/middleware/request-id/index.d.ts +2 -1
- package/dist/types/middleware/secure-headers/index.d.ts +2 -1
- package/dist/types/middleware/secure-headers/permissions-policy.d.ts +2 -1
- package/dist/types/middleware/secure-headers/secure-headers.d.ts +2 -1
- package/dist/types/middleware/timing/index.d.ts +2 -1
- package/dist/types/middleware/timing/timing.d.ts +2 -1
- package/dist/types/middleware/trailing-slash/index.d.ts +2 -1
- package/dist/types/request.d.ts +6 -5
- package/dist/types/router/reg-exp-router/prepared-router.d.ts +2 -1
- package/dist/types/types.d.ts +2 -1
- package/dist/types/utils/body.d.ts +2 -1
- package/dist/types/utils/buffer.d.ts +2 -1
- package/dist/types/utils/cookie.d.ts +2 -1
- package/dist/types/utils/crypto.d.ts +2 -1
- package/dist/types/utils/filepath.d.ts +2 -1
- package/dist/types/utils/html.d.ts +2 -1
- package/dist/types/utils/mime.d.ts +2 -1
- package/dist/types/utils/types.d.ts +2 -1
- package/dist/types/utils/url.d.ts +2 -1
- package/dist/types/validator/utils.d.ts +2 -1
- package/dist/types/validator/validator.d.ts +2 -1
- package/package.json +10 -2
package/dist/cjs/hono-base.js
CHANGED
|
@@ -176,6 +176,8 @@ var Hono = class Hono {
|
|
|
176
176
|
/**
|
|
177
177
|
* `.mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
178
178
|
*
|
|
179
|
+
* @deprecated Use `mount()` from `hono/mount` instead. `.mount()` will be removed in v5.
|
|
180
|
+
*
|
|
179
181
|
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
180
182
|
*
|
|
181
183
|
* @param {string} path - base Path
|
package/dist/cjs/jsx/utils.js
CHANGED
|
@@ -101,7 +101,7 @@ const styleObjectForEach = (style, fn) => {
|
|
|
101
101
|
continue;
|
|
102
102
|
}
|
|
103
103
|
let value;
|
|
104
|
-
if (typeof v === "number") value = !key.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
|
|
104
|
+
if (typeof v === "number") value = !key.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?!.*gap)(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
|
|
105
105
|
else if (typeof v === "string") {
|
|
106
106
|
if (hasUnsafeStyleValue(v)) continue;
|
|
107
107
|
value = v;
|
|
@@ -40,13 +40,14 @@ const some = (...middleware) => {
|
|
|
40
40
|
return next();
|
|
41
41
|
};
|
|
42
42
|
let lastError;
|
|
43
|
+
let response;
|
|
43
44
|
for (const handler of middleware) try {
|
|
44
45
|
const result = await handler(c, wrappedNext);
|
|
45
46
|
if (result === true && !c.finalized) await wrappedNext();
|
|
46
47
|
else if (result === false) {
|
|
47
48
|
lastError = /* @__PURE__ */ new Error("No successful middleware found");
|
|
48
49
|
continue;
|
|
49
|
-
}
|
|
50
|
+
} else if (result && result !== true) response = result;
|
|
50
51
|
lastError = void 0;
|
|
51
52
|
break;
|
|
52
53
|
} catch (error) {
|
|
@@ -54,6 +55,7 @@ const some = (...middleware) => {
|
|
|
54
55
|
if (isNextCalled) break;
|
|
55
56
|
}
|
|
56
57
|
if (lastError) throw lastError;
|
|
58
|
+
return response;
|
|
57
59
|
};
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
@@ -49,7 +49,7 @@ function initializeGenerator(generator) {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
const etag = (options) => {
|
|
52
|
-
const retainedHeaders = options?.retainedHeaders ?? RETAINED_304_HEADERS;
|
|
52
|
+
const retainedHeaders = new Set((options?.retainedHeaders ?? RETAINED_304_HEADERS).map((header) => header.toLowerCase()));
|
|
53
53
|
const weak = options?.weak ?? false;
|
|
54
54
|
const generator = initializeGenerator(options?.generateDigest);
|
|
55
55
|
return async function etag(c, next) {
|
|
@@ -70,7 +70,7 @@ const etag = (options) => {
|
|
|
70
70
|
statusText: "Not Modified",
|
|
71
71
|
headers: { ETag: etag }
|
|
72
72
|
});
|
|
73
|
-
for (const key of Array.from(c.res.headers.keys())) if (retainedHeaders.
|
|
73
|
+
for (const key of Array.from(c.res.headers.keys())) if (!retainedHeaders.has(key.toLowerCase())) c.res.headers.delete(key);
|
|
74
74
|
} else c.res.headers.set("ETag", etag);
|
|
75
75
|
};
|
|
76
76
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_helper_cookie_index = require("../../helper/cookie/index.js");
|
|
3
2
|
const require_utils_accept = require("../../utils/accept.js");
|
|
3
|
+
const require_helper_cookie_index = require("../../helper/cookie/index.js");
|
|
4
4
|
//#region src/middleware/language/language.ts
|
|
5
5
|
const DEFAULT_OPTIONS = {
|
|
6
6
|
order: [
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_helper_route_index = require("../../helper/route/index.js");
|
|
3
|
+
//#region src/middleware/mount/index.ts
|
|
4
|
+
const defaultReplaceRequest = (c) => {
|
|
5
|
+
const pathPrefix = require_helper_route_index.routePath(c).replace(/\/\*$/, "");
|
|
6
|
+
const url = new URL(c.req.raw.url);
|
|
7
|
+
url.pathname = c.req.path.slice(pathPrefix.length) || "/";
|
|
8
|
+
return new Request(url, c.req.raw);
|
|
9
|
+
};
|
|
10
|
+
const defaultGetOptions = (c) => {
|
|
11
|
+
let executionContext = void 0;
|
|
12
|
+
try {
|
|
13
|
+
executionContext = c.executionCtx;
|
|
14
|
+
} catch {}
|
|
15
|
+
return [c.env, executionContext];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* `mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
21
|
+
*
|
|
22
|
+
* @param {Function} applicationHandler - other Request Handler
|
|
23
|
+
* @param {MountOptions} [options] - options of `mount()`
|
|
24
|
+
* @returns {MiddlewareHandler} handler to register with `app.all()`
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { Router as IttyRouter } from 'itty-router'
|
|
29
|
+
* import { Hono } from 'hono'
|
|
30
|
+
* import { mount } from 'hono/mount'
|
|
31
|
+
* // Create itty-router application
|
|
32
|
+
* const ittyRouter = IttyRouter()
|
|
33
|
+
* // GET /itty-router/hello
|
|
34
|
+
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
35
|
+
*
|
|
36
|
+
* const app = new Hono()
|
|
37
|
+
* app.all('/itty-router/*', mount(ittyRouter.handle))
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const app = new Hono()
|
|
43
|
+
* // Send the request to another application without modification.
|
|
44
|
+
* app.all('/app/*', mount(anotherApp, {
|
|
45
|
+
* replaceRequest: (req) => req,
|
|
46
|
+
* }))
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
const mount = (applicationHandler, options) => {
|
|
50
|
+
let replaceRequest;
|
|
51
|
+
let optionHandler;
|
|
52
|
+
if (options) {
|
|
53
|
+
if (typeof options === "function") optionHandler = options;
|
|
54
|
+
else {
|
|
55
|
+
optionHandler = options.optionHandler;
|
|
56
|
+
if (options.replaceRequest === false) replaceRequest = (request) => request;
|
|
57
|
+
else replaceRequest = options.replaceRequest;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const getOptions = optionHandler ? (c) => {
|
|
61
|
+
const options = optionHandler(c);
|
|
62
|
+
return Array.isArray(options) ? options : [options];
|
|
63
|
+
} : defaultGetOptions;
|
|
64
|
+
return async (c, next) => {
|
|
65
|
+
const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
|
|
66
|
+
if (res) return res;
|
|
67
|
+
await next();
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.mount = mount;
|
package/dist/cjs/request.js
CHANGED
|
@@ -189,7 +189,7 @@ var HonoRequest = class {
|
|
|
189
189
|
return this.#validatedData?.[target];
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* `.url
|
|
192
|
+
* `.url` can get the request url strings.
|
|
193
193
|
*
|
|
194
194
|
* @see {@link https://hono.dev/docs/api/request#url}
|
|
195
195
|
*
|
|
@@ -205,7 +205,7 @@ var HonoRequest = class {
|
|
|
205
205
|
return this.raw.url;
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
|
-
* `.method
|
|
208
|
+
* `.method` can get the method name of the request.
|
|
209
209
|
*
|
|
210
210
|
* @see {@link https://hono.dev/docs/api/request#method}
|
|
211
211
|
*
|
|
@@ -223,7 +223,7 @@ var HonoRequest = class {
|
|
|
223
223
|
return this.#matchResult;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
|
-
* `.matchedRoutes
|
|
226
|
+
* `.matchedRoutes` can return a matched route in the handler
|
|
227
227
|
*
|
|
228
228
|
* @deprecated
|
|
229
229
|
*
|
|
@@ -253,7 +253,7 @@ var HonoRequest = class {
|
|
|
253
253
|
return this.#matchResult[0].map(([[, route]]) => route);
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
*
|
|
256
|
+
* `.routePath` can retrieve the path registered within the handler
|
|
257
257
|
*
|
|
258
258
|
* @deprecated
|
|
259
259
|
*
|
package/dist/hono-base.js
CHANGED
|
@@ -175,6 +175,8 @@ var Hono = class Hono {
|
|
|
175
175
|
/**
|
|
176
176
|
* `.mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
177
177
|
*
|
|
178
|
+
* @deprecated Use `mount()` from `hono/mount` instead. `.mount()` will be removed in v5.
|
|
179
|
+
*
|
|
178
180
|
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
179
181
|
*
|
|
180
182
|
* @param {string} path - base Path
|
package/dist/jsx/utils.js
CHANGED
|
@@ -100,7 +100,7 @@ const styleObjectForEach = (style, fn) => {
|
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
102
|
let value;
|
|
103
|
-
if (typeof v === "number") value = !key.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
|
|
103
|
+
if (typeof v === "number") value = !key.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?!.*gap)(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
|
|
104
104
|
else if (typeof v === "string") {
|
|
105
105
|
if (hasUnsafeStyleValue(v)) continue;
|
|
106
106
|
value = v;
|
|
@@ -39,13 +39,14 @@ const some = (...middleware) => {
|
|
|
39
39
|
return next();
|
|
40
40
|
};
|
|
41
41
|
let lastError;
|
|
42
|
+
let response;
|
|
42
43
|
for (const handler of middleware) try {
|
|
43
44
|
const result = await handler(c, wrappedNext);
|
|
44
45
|
if (result === true && !c.finalized) await wrappedNext();
|
|
45
46
|
else if (result === false) {
|
|
46
47
|
lastError = /* @__PURE__ */ new Error("No successful middleware found");
|
|
47
48
|
continue;
|
|
48
|
-
}
|
|
49
|
+
} else if (result && result !== true) response = result;
|
|
49
50
|
lastError = void 0;
|
|
50
51
|
break;
|
|
51
52
|
} catch (error) {
|
|
@@ -53,6 +54,7 @@ const some = (...middleware) => {
|
|
|
53
54
|
if (isNextCalled) break;
|
|
54
55
|
}
|
|
55
56
|
if (lastError) throw lastError;
|
|
57
|
+
return response;
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
/**
|
|
@@ -48,7 +48,7 @@ function initializeGenerator(generator) {
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
const etag = (options) => {
|
|
51
|
-
const retainedHeaders = options?.retainedHeaders ?? RETAINED_304_HEADERS;
|
|
51
|
+
const retainedHeaders = new Set((options?.retainedHeaders ?? RETAINED_304_HEADERS).map((header) => header.toLowerCase()));
|
|
52
52
|
const weak = options?.weak ?? false;
|
|
53
53
|
const generator = initializeGenerator(options?.generateDigest);
|
|
54
54
|
return async function etag(c, next) {
|
|
@@ -69,7 +69,7 @@ const etag = (options) => {
|
|
|
69
69
|
statusText: "Not Modified",
|
|
70
70
|
headers: { ETag: etag }
|
|
71
71
|
});
|
|
72
|
-
for (const key of Array.from(c.res.headers.keys())) if (retainedHeaders.
|
|
72
|
+
for (const key of Array.from(c.res.headers.keys())) if (!retainedHeaders.has(key.toLowerCase())) c.res.headers.delete(key);
|
|
73
73
|
} else c.res.headers.set("ETag", etag);
|
|
74
74
|
};
|
|
75
75
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { routePath } from "../../helper/route/index.js";
|
|
2
|
+
//#region src/middleware/mount/index.ts
|
|
3
|
+
const defaultReplaceRequest = (c) => {
|
|
4
|
+
const pathPrefix = routePath(c).replace(/\/\*$/, "");
|
|
5
|
+
const url = new URL(c.req.raw.url);
|
|
6
|
+
url.pathname = c.req.path.slice(pathPrefix.length) || "/";
|
|
7
|
+
return new Request(url, c.req.raw);
|
|
8
|
+
};
|
|
9
|
+
const defaultGetOptions = (c) => {
|
|
10
|
+
let executionContext = void 0;
|
|
11
|
+
try {
|
|
12
|
+
executionContext = c.executionCtx;
|
|
13
|
+
} catch {}
|
|
14
|
+
return [c.env, executionContext];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* `mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
20
|
+
*
|
|
21
|
+
* @param {Function} applicationHandler - other Request Handler
|
|
22
|
+
* @param {MountOptions} [options] - options of `mount()`
|
|
23
|
+
* @returns {MiddlewareHandler} handler to register with `app.all()`
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { Router as IttyRouter } from 'itty-router'
|
|
28
|
+
* import { Hono } from 'hono'
|
|
29
|
+
* import { mount } from 'hono/mount'
|
|
30
|
+
* // Create itty-router application
|
|
31
|
+
* const ittyRouter = IttyRouter()
|
|
32
|
+
* // GET /itty-router/hello
|
|
33
|
+
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
34
|
+
*
|
|
35
|
+
* const app = new Hono()
|
|
36
|
+
* app.all('/itty-router/*', mount(ittyRouter.handle))
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const app = new Hono()
|
|
42
|
+
* // Send the request to another application without modification.
|
|
43
|
+
* app.all('/app/*', mount(anotherApp, {
|
|
44
|
+
* replaceRequest: (req) => req,
|
|
45
|
+
* }))
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
const mount = (applicationHandler, options) => {
|
|
49
|
+
let replaceRequest;
|
|
50
|
+
let optionHandler;
|
|
51
|
+
if (options) {
|
|
52
|
+
if (typeof options === "function") optionHandler = options;
|
|
53
|
+
else {
|
|
54
|
+
optionHandler = options.optionHandler;
|
|
55
|
+
if (options.replaceRequest === false) replaceRequest = (request) => request;
|
|
56
|
+
else replaceRequest = options.replaceRequest;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const getOptions = optionHandler ? (c) => {
|
|
60
|
+
const options = optionHandler(c);
|
|
61
|
+
return Array.isArray(options) ? options : [options];
|
|
62
|
+
} : defaultGetOptions;
|
|
63
|
+
return async (c, next) => {
|
|
64
|
+
const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
|
|
65
|
+
if (res) return res;
|
|
66
|
+
await next();
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { mount };
|
package/dist/request.js
CHANGED
|
@@ -188,7 +188,7 @@ var HonoRequest = class {
|
|
|
188
188
|
return this.#validatedData?.[target];
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* `.url
|
|
191
|
+
* `.url` can get the request url strings.
|
|
192
192
|
*
|
|
193
193
|
* @see {@link https://hono.dev/docs/api/request#url}
|
|
194
194
|
*
|
|
@@ -204,7 +204,7 @@ var HonoRequest = class {
|
|
|
204
204
|
return this.raw.url;
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
|
-
* `.method
|
|
207
|
+
* `.method` can get the method name of the request.
|
|
208
208
|
*
|
|
209
209
|
* @see {@link https://hono.dev/docs/api/request#method}
|
|
210
210
|
*
|
|
@@ -222,7 +222,7 @@ var HonoRequest = class {
|
|
|
222
222
|
return this.#matchResult;
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
|
-
* `.matchedRoutes
|
|
225
|
+
* `.matchedRoutes` can return a matched route in the handler
|
|
226
226
|
*
|
|
227
227
|
* @deprecated
|
|
228
228
|
*
|
|
@@ -252,7 +252,7 @@ var HonoRequest = class {
|
|
|
252
252
|
return this.#matchResult[0].map(([[, route]]) => route);
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
255
|
+
* `.routePath` can retrieve the path registered within the handler
|
|
256
256
|
*
|
|
257
257
|
* @deprecated
|
|
258
258
|
*
|
|
@@ -226,4 +226,5 @@ export declare const defaultIsContentTypeBinary: (contentType: string) => boolea
|
|
|
226
226
|
* @deprecated `hono/aws-lambda` will be removed in v5. Install `@hono/aws-lambda` and import from there instead.
|
|
227
227
|
*/
|
|
228
228
|
export declare const isContentEncodingBinary: (contentEncoding: string | null) => boolean;
|
|
229
|
-
//#endregion
|
|
229
|
+
//#endregion
|
|
230
|
+
export {};
|
|
@@ -41,4 +41,5 @@ export declare function handleMiddleware<E extends Env = {}, P extends string =
|
|
|
41
41
|
* @deprecated `hono/cloudflare-pages` will be removed in v5. Cloudflare recommends Workers with static assets; use `hono` on Workers instead.
|
|
42
42
|
*/
|
|
43
43
|
export declare const serveStatic: () => MiddlewareHandler;
|
|
44
|
-
//#endregion
|
|
44
|
+
//#endregion
|
|
45
|
+
export {};
|
|
@@ -3,4 +3,5 @@ import { ServeStaticOptions } from "./serve-static.js";
|
|
|
3
3
|
//#region src/adapter/cloudflare-workers/serve-static-module.d.ts
|
|
4
4
|
declare const module: <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">) => MiddlewareHandler;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { module as serveStatic };
|
|
6
|
+
export { module as serveStatic };
|
|
7
|
+
export {};
|
|
@@ -109,4 +109,5 @@ export declare const createBody: (method: string, requestBody: CloudFrontRequest
|
|
|
109
109
|
* @deprecated `hono/lambda-edge` will be removed in v5. Install `@hono/lambda-edge` and import from there instead.
|
|
110
110
|
*/
|
|
111
111
|
export declare const isContentTypeBinary: (contentType: string) => boolean;
|
|
112
|
-
//#endregion
|
|
112
|
+
//#endregion
|
|
113
|
+
export {};
|
|
@@ -14,4 +14,5 @@ export type HandleOptions = {
|
|
|
14
14
|
* @deprecated `hono/service-worker` will be removed in v5. Install `@hono/service-worker` and import from there instead.
|
|
15
15
|
*/
|
|
16
16
|
export declare const handle: <E extends Env, S extends Schema, BasePath extends string>(app: Hono<E, S, BasePath>, opts?: HandleOptions) => Handler;
|
|
17
|
-
//#endregion
|
|
17
|
+
//#endregion
|
|
18
|
+
export {};
|
|
@@ -22,4 +22,5 @@ import { HandleOptions, handle } from "./handler.js";
|
|
|
22
22
|
*/
|
|
23
23
|
declare const fire: <E extends Env, S extends Schema, BasePath extends string>(app: Hono<E, S, BasePath>, options?: HandleOptions) => void;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { fire, handle };
|
|
25
|
+
export { fire, handle };
|
|
26
|
+
export {};
|
|
@@ -200,4 +200,5 @@ type PickSchema<D, U extends StatusCode> = { [K in keyof D]: { [M in keyof D[K]]
|
|
|
200
200
|
* ```
|
|
201
201
|
*/
|
|
202
202
|
export type PickResponseByStatusCode<App, U extends StatusCode> = App extends Hono<infer E, infer _ extends Schema, infer B> ? PickSchema<ExtractSchema<App>, U> extends (infer S extends Schema) ? Hono$1<E, S, B> : never : never;
|
|
203
|
-
//#endregion
|
|
203
|
+
//#endregion
|
|
204
|
+
export {};
|
package/dist/types/context.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare const setCookie: (c: Context, name: string, value: string, opt?:
|
|
|
18
18
|
export declare const generateSignedCookie: (name: string, value: string, secret: string | BufferSource, opt?: CookieOptions) => Promise<string>;
|
|
19
19
|
export declare const setSignedCookie: (c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions) => Promise<void>;
|
|
20
20
|
export declare const deleteCookie: (c: Context, name: string, opt?: CookieOptions) => string | undefined;
|
|
21
|
-
//#endregion
|
|
21
|
+
//#endregion
|
|
22
|
+
export {};
|
|
@@ -74,4 +74,5 @@ export declare const viewTransition: ViewTransitionType;
|
|
|
74
74
|
*/
|
|
75
75
|
export declare const Style: StyleType;
|
|
76
76
|
//#endregion
|
|
77
|
-
export { type ClassNameSlug, type OnInvalidSlug, rawCssString };
|
|
77
|
+
export { type ClassNameSlug, type OnInvalidSlug, rawCssString };
|
|
78
|
+
export {};
|
|
@@ -14,4 +14,5 @@ interface RouteData {
|
|
|
14
14
|
export declare const inspectRoutes: <E extends Env>(hono: Hono<E>) => RouteData[];
|
|
15
15
|
export declare const showRoutes: <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions) => void;
|
|
16
16
|
export declare const getRouterName: <E extends Env>(app: Hono<E>) => string;
|
|
17
|
-
//#endregion
|
|
17
|
+
//#endregion
|
|
18
|
+
export {};
|
|
@@ -31,4 +31,5 @@ export declare const createFactory: <E extends Env = Env, P extends string = str
|
|
|
31
31
|
defaultAppOptions?: HonoOptions<E>;
|
|
32
32
|
}) => Factory<E, P>;
|
|
33
33
|
export declare const createMiddleware: <E extends Env = any, P extends string = string, I extends Input = {}, R extends HandlerResponse<any> | void = void>(middleware: MiddlewareHandler<E, P, I, R extends void ? Response : R>) => MiddlewareHandler<E, P, I, R extends void ? Response : R>;
|
|
34
|
-
//#endregion
|
|
34
|
+
//#endregion
|
|
35
|
+
export {};
|
|
@@ -14,4 +14,5 @@ interface FilterStaticGenerateRouteData {
|
|
|
14
14
|
export declare const filterStaticGenerateRoutes: <E extends Env>(hono: Hono<E>) => FilterStaticGenerateRouteData[];
|
|
15
15
|
export declare const isDynamicRoute: (path: string) => boolean;
|
|
16
16
|
export declare const ensureWithinOutDir: (outDir: string, filePath: string) => void;
|
|
17
|
-
//#endregion
|
|
17
|
+
//#endregion
|
|
18
|
+
export {};
|
|
@@ -6,4 +6,5 @@ import { Client, ClientRequestOptions } from "../../client/types.js";
|
|
|
6
6
|
//#region src/helper/testing/index.d.ts
|
|
7
7
|
type ExtractEnv<T> = T extends Hono<infer E, Schema, string> ? E : never;
|
|
8
8
|
export declare const testClient: <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext, options?: Omit<ClientRequestOptions, "fetch">) => UnionToIntersection<Client<T, "http://localhost">>;
|
|
9
|
-
//#endregion
|
|
9
|
+
//#endregion
|
|
10
|
+
export {};
|
|
@@ -140,6 +140,8 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
|
|
|
140
140
|
/**
|
|
141
141
|
* `.mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
142
142
|
*
|
|
143
|
+
* @deprecated Use `mount()` from `hono/mount` instead. `.mount()` will be removed in v5.
|
|
144
|
+
*
|
|
143
145
|
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
144
146
|
*
|
|
145
147
|
* @param {string} path - base Path
|
|
@@ -215,4 +217,5 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
|
|
|
215
217
|
fire: () => void;
|
|
216
218
|
}
|
|
217
219
|
//#endregion
|
|
218
|
-
export { Hono as HonoBase };
|
|
220
|
+
export { Hono as HonoBase };
|
|
221
|
+
export {};
|
package/dist/types/jsx/base.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HtmlEscaped, HtmlEscapedString, StringBufferWithCallbacks } from "../utils/html.js";
|
|
2
2
|
import { DOM_MEMO } from "./constants.js";
|
|
3
|
-
import {
|
|
3
|
+
import { JSX as JSX$1 } from "./intrinsic-elements.js";
|
|
4
4
|
import { Context } from "./context.js";
|
|
5
5
|
//#region src/jsx/base.d.ts
|
|
6
6
|
export type Props = Record<string, any>;
|
|
7
|
-
type FunctionComponentResult = HtmlEscapedString | Child[] | Promise<HtmlEscapedString | Child[]> | null;
|
|
7
|
+
type FunctionComponentResult = HtmlEscapedString | JSXNode | Child[] | Promise<HtmlEscapedString | JSXNode | Child[]> | null;
|
|
8
8
|
export type FC<P = Props> = {
|
|
9
9
|
(props: P): FunctionComponentResult;
|
|
10
10
|
defaultProps?: Partial<P> | undefined;
|
|
@@ -17,7 +17,7 @@ export declare namespace JSX {
|
|
|
17
17
|
interface ElementChildrenAttribute {
|
|
18
18
|
children: Child;
|
|
19
19
|
}
|
|
20
|
-
interface IntrinsicElements extends IntrinsicElements {
|
|
20
|
+
interface IntrinsicElements extends JSX$1.IntrinsicElements {
|
|
21
21
|
[tagName: string]: Props;
|
|
22
22
|
}
|
|
23
23
|
interface IntrinsicAttributes {
|
|
@@ -59,4 +59,5 @@ export declare const Fragment: ({ children }: {
|
|
|
59
59
|
export declare const isValidElement: (element: unknown) => element is JSXNode;
|
|
60
60
|
export declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]) => T;
|
|
61
61
|
export declare const reactAPICompatVersion = "19.0.0-hono-jsx";
|
|
62
|
-
//#endregion
|
|
62
|
+
//#endregion
|
|
63
|
+
export {};
|
|
@@ -34,4 +34,5 @@ export declare const useOptimistic: <T, N>(state: T, updateState: (currentState:
|
|
|
34
34
|
* @returns [T, (data: FormData) => void]
|
|
35
35
|
*/
|
|
36
36
|
export declare const useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
|
|
37
|
-
//#endregion
|
|
37
|
+
//#endregion
|
|
38
|
+
export {};
|
|
@@ -80,4 +80,5 @@ declare const _default: {
|
|
|
80
80
|
createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
81
81
|
};
|
|
82
82
|
//#endregion
|
|
83
|
-
export { type AnimationEvent, type CSSProperties, type Child, Children, type ClipboardEvent, type ComponentClass, type Context, type DOMAttributes, type DragEvent, ErrorBoundary, type Event, type FC, type FocusEvent, Fragment, Fragment as StrictMode, type InputEvent, type JSXNode, type KeyboardEvent, type MouseEvent, type PointerEvent, type PropsWithChildren, type ReactElement, type ReactNode, type RefObject, Suspense, type TouchEvent, type TransitionEvent, type WheelEvent, cloneElement, createContext, createElement, createElement as jsx, createPortal, createRef, _default as default, flushSync, forwardRef, isValidElement, memo, render, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
83
|
+
export { type AnimationEvent, type CSSProperties, type Child, Children, type ClipboardEvent, type ComponentClass, type Context, type DOMAttributes, type DragEvent, ErrorBoundary, type Event, type FC, type FocusEvent, Fragment, Fragment as StrictMode, type InputEvent, type JSXNode, type KeyboardEvent, type MouseEvent, type PointerEvent, type PropsWithChildren, type ReactElement, type ReactNode, type RefObject, Suspense, type TouchEvent, type TransitionEvent, type WheelEvent, cloneElement, createContext, createElement, createElement as jsx, createPortal, createRef, _default as default, flushSync, forwardRef, isValidElement, memo, render, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
84
|
+
export {};
|
|
@@ -51,4 +51,5 @@ export declare const renderNode: (node: NodeObject, container: Container) => voi
|
|
|
51
51
|
export declare const render: (jsxNode: Child, container: Container) => void;
|
|
52
52
|
export declare const flushSync: (callback: () => void) => void;
|
|
53
53
|
export declare const createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
54
|
-
//#endregion
|
|
54
|
+
//#endregion
|
|
55
|
+
export {};
|
|
@@ -104,4 +104,5 @@ declare const _default: {
|
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
106
|
//#endregion
|
|
107
|
-
export { _default as default, renderToReadableStream, renderToString, _default$1 as version };
|
|
107
|
+
export { _default as default, renderToReadableStream, renderToString, _default$1 as version };
|
|
108
|
+
export {};
|
|
@@ -43,4 +43,5 @@ export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObje
|
|
|
43
43
|
}) => JSX.Element);
|
|
44
44
|
export declare const useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
|
|
45
45
|
export declare const useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
|
|
46
|
-
//#endregion
|
|
46
|
+
//#endregion
|
|
47
|
+
export {};
|
|
@@ -69,4 +69,5 @@ declare const _default: {
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
//#endregion
|
|
72
|
-
export { type AnimationEvent, type CSSProperties, type Child, Children, type ClipboardEvent, type ComponentClass, type Context, type DOMAttributes, type DragEvent, ErrorBoundary, type Event, type FC, type FocusEvent, Fragment, Fragment as StrictMode, type InputEvent, type JSX, type JSXNode, type KeyboardEvent, type MouseEvent, type PointerEvent, type PropsWithChildren, type ReactElement, type ReactNode, type RefObject, Suspense, type TouchEvent, type TransitionEvent, type WheelEvent, cloneElement, createContext, jsx as createElement, jsx, createRef, _default as default, forwardRef, isValidElement, memo, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
72
|
+
export { type AnimationEvent, type CSSProperties, type Child, Children, type ClipboardEvent, type ComponentClass, type Context, type DOMAttributes, type DragEvent, ErrorBoundary, type Event, type FC, type FocusEvent, Fragment, Fragment as StrictMode, type InputEvent, type JSX, type JSXNode, type KeyboardEvent, type MouseEvent, type PointerEvent, type PropsWithChildren, type ReactElement, type ReactNode, type RefObject, Suspense, type TouchEvent, type TransitionEvent, type WheelEvent, cloneElement, createContext, jsx as createElement, jsx, createRef, _default as default, forwardRef, isValidElement, memo, startTransition, startViewTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition, reactAPICompatVersion as version };
|
|
73
|
+
export {};
|
|
@@ -30,4 +30,5 @@ export type AnimationEvent = globalThis.AnimationEvent;
|
|
|
30
30
|
export type TransitionEvent = globalThis.TransitionEvent;
|
|
31
31
|
export type DragEvent = globalThis.DragEvent;
|
|
32
32
|
//#endregion
|
|
33
|
-
export type { Child, ComponentClass, Context, FC, JSXNode, ReactElement, ReactNode, RefObject };
|
|
33
|
+
export type { Child, ComponentClass, Context, FC, JSXNode, ReactElement, ReactNode, RefObject };
|
|
34
|
+
export {};
|
|
@@ -81,4 +81,5 @@ export declare const every: (...middleware: (MiddlewareHandler | Condition)[]) =
|
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
export declare const except: (condition: string | Condition | (string | Condition)[], ...middleware: MiddlewareHandler[]) => MiddlewareHandler;
|
|
84
|
-
//#endregion
|
|
84
|
+
//#endregion
|
|
85
|
+
export {};
|
|
@@ -73,4 +73,5 @@ export declare const jsxRenderer: <E extends Env = Env>(component?: ComponentWit
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
export declare const useRequestContext: <E extends Env = any, P extends string = any, I extends Input = {}>() => Context<E, P, I>;
|
|
76
|
-
//#endregion
|
|
76
|
+
//#endregion
|
|
77
|
+
export {};
|
|
@@ -5,4 +5,5 @@ declare module '../..' {
|
|
|
5
5
|
interface ContextVariableMap extends JwtVariables<unknown> {}
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
|
-
export { AlgorithmTypes, type JwtVariables, decode, jwt, sign, verify, verifyWithJwks };
|
|
8
|
+
export { AlgorithmTypes, type JwtVariables, decode, jwt, sign, verify, verifyWithJwks };
|
|
9
|
+
export {};
|
|
@@ -4,4 +4,5 @@ declare module '../..' {
|
|
|
4
4
|
interface ContextVariableMap extends LanguageVariables {}
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
export { type CacheType, type DetectorOptions, type DetectorType, type LanguageVariables, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector };
|
|
7
|
+
export { type CacheType, type DetectorOptions, type DetectorType, type LanguageVariables, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector };
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MiddlewareHandler } from "../../types.js";
|
|
2
|
+
import { Context } from "../../context.js";
|
|
3
|
+
//#region src/middleware/mount/index.d.ts
|
|
4
|
+
type ApplicationHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
5
|
+
type MountOptionHandler = (c: Context) => unknown;
|
|
6
|
+
type MountReplaceRequest = (originalRequest: Request) => Request;
|
|
7
|
+
type MountOptions = MountOptionHandler | {
|
|
8
|
+
optionHandler?: MountOptionHandler;
|
|
9
|
+
replaceRequest?: MountReplaceRequest | false;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* `mount()` allows you to mount applications built with other frameworks into your Hono application.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://hono.dev/docs/api/hono#mount}
|
|
15
|
+
*
|
|
16
|
+
* @param {Function} applicationHandler - other Request Handler
|
|
17
|
+
* @param {MountOptions} [options] - options of `mount()`
|
|
18
|
+
* @returns {MiddlewareHandler} handler to register with `app.all()`
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { Router as IttyRouter } from 'itty-router'
|
|
23
|
+
* import { Hono } from 'hono'
|
|
24
|
+
* import { mount } from 'hono/mount'
|
|
25
|
+
* // Create itty-router application
|
|
26
|
+
* const ittyRouter = IttyRouter()
|
|
27
|
+
* // GET /itty-router/hello
|
|
28
|
+
* ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
|
|
29
|
+
*
|
|
30
|
+
* const app = new Hono()
|
|
31
|
+
* app.all('/itty-router/*', mount(ittyRouter.handle))
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const app = new Hono()
|
|
37
|
+
* // Send the request to another application without modification.
|
|
38
|
+
* app.all('/app/*', mount(anotherApp, {
|
|
39
|
+
* replaceRequest: (req) => req,
|
|
40
|
+
* }))
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const mount: (applicationHandler: ApplicationHandler, options?: MountOptions) => MiddlewareHandler;
|
|
44
|
+
//#endregion
|
|
45
|
+
export type { ApplicationHandler, MountOptionHandler, MountOptions, MountReplaceRequest };
|
|
46
|
+
export {};
|
|
@@ -4,4 +4,5 @@ declare module '../..' {
|
|
|
4
4
|
interface ContextVariableMap extends SecureHeadersVariables {}
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
export { type ContentSecurityPolicyOptionHandler, NONCE, type SecureHeadersVariables, secureHeaders };
|
|
7
|
+
export { type ContentSecurityPolicyOptionHandler, NONCE, type SecureHeadersVariables, secureHeaders };
|
|
8
|
+
export {};
|
|
@@ -12,4 +12,5 @@ type ProposedFeatures = 'autofill' | 'clipboardRead' | 'clipboardWrite' | 'defer
|
|
|
12
12
|
* These features generally have an explainer only, but may be available for experimentation by web developers.
|
|
13
13
|
*/
|
|
14
14
|
type ExperimentalFeatures = 'allScreensCapture' | 'browsingTopics' | 'capturedSurfaceControl' | 'conversionMeasurement' | 'digitalCredentialsCreate' | 'digitalCredentialsGet' | 'focusWithoutUserActivation' | 'joinAdInterestGroup' | 'localFonts' | 'monetization' | 'runAdAuction' | 'smartCard' | 'syncScript' | 'trustTokenRedemption' | 'unload' | 'verticalScroll';
|
|
15
|
-
//#endregion
|
|
15
|
+
//#endregion
|
|
16
|
+
export {};
|
|
@@ -4,4 +4,5 @@ declare module '../..' {
|
|
|
4
4
|
interface ContextVariableMap extends TimingVariables {}
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
export { type TimingVariables, endTime, setMetric, startTime, timing, wrapTime };
|
|
7
|
+
export { type TimingVariables, endTime, setMetric, startTime, timing, wrapTime };
|
|
8
|
+
export {};
|
|
@@ -122,4 +122,5 @@ export declare const endTime: (c: Context, name: string, precision?: number) =>
|
|
|
122
122
|
* ```
|
|
123
123
|
* */
|
|
124
124
|
export declare function wrapTime<T>(c: Context, name: string, callable: Promise<T>, description?: string, precision?: number): Promise<T>;
|
|
125
|
-
//#endregion
|
|
125
|
+
//#endregion
|
|
126
|
+
export {};
|
package/dist/types/request.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
217
217
|
*/
|
|
218
218
|
valid<T extends keyof I & keyof ValidationTargets>(target: T): InputToDataByTarget<I, T>;
|
|
219
219
|
/**
|
|
220
|
-
* `.url
|
|
220
|
+
* `.url` can get the request url strings.
|
|
221
221
|
*
|
|
222
222
|
* @see {@link https://hono.dev/docs/api/request#url}
|
|
223
223
|
*
|
|
@@ -231,7 +231,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
231
231
|
*/
|
|
232
232
|
get url(): string;
|
|
233
233
|
/**
|
|
234
|
-
* `.method
|
|
234
|
+
* `.method` can get the method name of the request.
|
|
235
235
|
*
|
|
236
236
|
* @see {@link https://hono.dev/docs/api/request#method}
|
|
237
237
|
*
|
|
@@ -245,7 +245,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
245
245
|
get method(): string;
|
|
246
246
|
get [GET_MATCH_RESULT](): Result<[unknown, RouterRoute]>;
|
|
247
247
|
/**
|
|
248
|
-
* `.matchedRoutes
|
|
248
|
+
* `.matchedRoutes` can return a matched route in the handler
|
|
249
249
|
*
|
|
250
250
|
* @deprecated
|
|
251
251
|
*
|
|
@@ -273,7 +273,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
273
273
|
*/
|
|
274
274
|
get matchedRoutes(): RouterRoute[];
|
|
275
275
|
/**
|
|
276
|
-
*
|
|
276
|
+
* `.routePath` can retrieve the path registered within the handler
|
|
277
277
|
*
|
|
278
278
|
* @deprecated
|
|
279
279
|
*
|
|
@@ -322,4 +322,5 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
322
322
|
* ```
|
|
323
323
|
*/
|
|
324
324
|
export declare const cloneRawRequest: (req: HonoRequest) => Promise<Request>;
|
|
325
|
-
//#endregion
|
|
325
|
+
//#endregion
|
|
326
|
+
export {};
|
|
@@ -14,4 +14,5 @@ export declare const buildInitParams: (params: {
|
|
|
14
14
|
paths: string[];
|
|
15
15
|
}) => ConstructorParameters<typeof PreparedRegExpRouter>;
|
|
16
16
|
export declare const serializeInitParams: (params: ConstructorParameters<typeof PreparedRegExpRouter>) => string;
|
|
17
|
-
//#endregion
|
|
17
|
+
//#endregion
|
|
18
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ type TimingSafeEqual = {
|
|
|
15
15
|
export declare const timingSafeEqual: TimingSafeEqual;
|
|
16
16
|
export declare const bufferToString: (buffer: ArrayBuffer) => string;
|
|
17
17
|
export declare const bufferToFormData: (arrayBuffer: ArrayBuffer, contentType: string) => Promise<FormData>;
|
|
18
|
-
//#endregion
|
|
18
|
+
//#endregion
|
|
19
|
+
export {};
|
|
@@ -38,4 +38,5 @@ export declare const parse: (cookie: string, name?: string) => Cookie;
|
|
|
38
38
|
export declare const parseSigned: (cookie: string, secret: string | BufferSource, name?: string) => Promise<SignedCookie>;
|
|
39
39
|
export declare const serialize: <Name extends string>(name: Name, value: string, opt?: CookieConstraint<Name>) => string;
|
|
40
40
|
export declare const serializeSigned: (name: string, value: string, secret: string | BufferSource, opt?: CookieOptions) => Promise<string>;
|
|
41
|
-
//#endregion
|
|
41
|
+
//#endregion
|
|
42
|
+
export {};
|
|
@@ -9,4 +9,5 @@ export declare const sha256: (data: Data) => Promise<string | null>;
|
|
|
9
9
|
export declare const sha1: (data: Data) => Promise<string | null>;
|
|
10
10
|
export declare const md5: (data: Data) => Promise<string | null>;
|
|
11
11
|
export declare const createHash: (data: Data, algorithm: Algorithm) => Promise<string | null>;
|
|
12
|
-
//#endregion
|
|
12
|
+
//#endregion
|
|
13
|
+
export {};
|
|
@@ -10,4 +10,5 @@ type FilePathOptions = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const getFilePath: (options: FilePathOptions) => string | undefined;
|
|
12
12
|
export declare const getFilePathWithoutDefaultDocument: (options: Omit<FilePathOptions, "defaultDocument">) => string | undefined;
|
|
13
|
-
//#endregion
|
|
13
|
+
//#endregion
|
|
14
|
+
export {};
|
|
@@ -42,4 +42,5 @@ export declare const stringBufferToString: (buffer: StringBuffer, callbacks: Htm
|
|
|
42
42
|
export declare const escapeToBuffer: (str: string, buffer: StringBuffer) => void;
|
|
43
43
|
export declare const resolveCallbackSync: (str: string | HtmlEscapedString) => string;
|
|
44
44
|
export declare const resolveCallback: (str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]) => Promise<string>;
|
|
45
|
-
//#endregion
|
|
45
|
+
//#endregion
|
|
46
|
+
export {};
|
|
@@ -58,4 +58,5 @@ export type IsAny<T> = boolean extends (T extends never ? true : false) ? true :
|
|
|
58
58
|
* @see https://github.com/Microsoft/TypeScript/issues/29729
|
|
59
59
|
*/
|
|
60
60
|
export type StringLiteralUnion<T> = T | (string & Record<never, never>);
|
|
61
|
-
//#endregion
|
|
61
|
+
//#endregion
|
|
62
|
+
export {};
|
|
@@ -42,4 +42,5 @@ export declare const tryDecodeURIComponent: (str: string) => string;
|
|
|
42
42
|
export declare const getQueryParam: (url: string, key?: string) => string | undefined | Record<string, string>;
|
|
43
43
|
export declare const getQueryParams: (url: string, key?: string) => string[] | undefined | Record<string, string[]>;
|
|
44
44
|
export declare const decodeURIComponent_: typeof decodeURIComponent;
|
|
45
|
-
//#endregion
|
|
45
|
+
//#endregion
|
|
46
|
+
export {};
|
|
@@ -23,4 +23,5 @@ type InferInputInner<Output, Target extends keyof ValidationTargets, T extends F
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export type InferInput<Output, Target extends keyof ValidationTargets, T extends FormValue = ParsedFormValue> = [Exclude<Output, undefined>] extends [never] ? {} : [Exclude<Output, undefined>] extends [object] ? undefined extends Output ? SimplifyDeep<InferInputInner<Exclude<Output, undefined>, Target, T>> | undefined : SimplifyDeep<InferInputInner<Output, Target, T>> : {};
|
|
26
|
-
//#endregion
|
|
26
|
+
//#endregion
|
|
27
|
+
export {};
|
|
@@ -14,4 +14,5 @@ export declare const validator: <InputType, P extends string, M extends string,
|
|
|
14
14
|
out: { [K in U]: ExtractValidatorOutput<VF>; };
|
|
15
15
|
}, E extends Env = any>(target: U, validationFunc: VF) => MiddlewareHandler<E, P, V, ExtractValidationResponse<VF>>;
|
|
16
16
|
export type ExtractValidatorOutput<VF> = VF extends ((value: any, c: any) => infer R) ? R extends Promise<infer PR> ? PR extends Response | TypedResponse<any, any, any> ? never : PR : R extends Response | TypedResponse<any, any, any> ? never : R : never;
|
|
17
|
-
//#endregion
|
|
17
|
+
//#endregion
|
|
18
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.13",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -103,6 +103,11 @@
|
|
|
103
103
|
"import": "./dist/helper/route/index.js",
|
|
104
104
|
"require": "./dist/cjs/helper/route/index.js"
|
|
105
105
|
},
|
|
106
|
+
"./mount": {
|
|
107
|
+
"types": "./dist/types/middleware/mount/index.d.ts",
|
|
108
|
+
"import": "./dist/middleware/mount/index.js",
|
|
109
|
+
"require": "./dist/cjs/middleware/mount/index.js"
|
|
110
|
+
},
|
|
106
111
|
"./cookie": {
|
|
107
112
|
"types": "./dist/types/helper/cookie/index.d.ts",
|
|
108
113
|
"import": "./dist/helper/cookie/index.js",
|
|
@@ -457,6 +462,9 @@
|
|
|
457
462
|
"route": [
|
|
458
463
|
"./dist/types/helper/route"
|
|
459
464
|
],
|
|
465
|
+
"mount": [
|
|
466
|
+
"./dist/types/middleware/mount"
|
|
467
|
+
],
|
|
460
468
|
"cookie": [
|
|
461
469
|
"./dist/types/helper/cookie"
|
|
462
470
|
],
|
|
@@ -693,7 +701,7 @@
|
|
|
693
701
|
"rolldown": "^1.2.10",
|
|
694
702
|
"typescript": "^6.0.3",
|
|
695
703
|
"vite-plugin-fastly-js-compute": "^0.4.2",
|
|
696
|
-
"vite-plus": "1.0.0
|
|
704
|
+
"vite-plus": "1.0.0",
|
|
697
705
|
"vitest": "5.0.1",
|
|
698
706
|
"wrangler": "4.107.0",
|
|
699
707
|
"ws": "^8.21.0",
|