clear-router 2.7.6 → 2.8.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.
Files changed (116) hide show
  1. package/dist/ClearRequest.cjs +23 -0
  2. package/dist/ClearRequest.d.cts +28 -0
  3. package/dist/ClearRequest.d.mts +28 -0
  4. package/dist/ClearRequest.mjs +22 -0
  5. package/dist/Contracts.d.cts +12 -0
  6. package/dist/Contracts.d.mts +12 -0
  7. package/dist/Controller.cjs +12 -0
  8. package/dist/Controller.d.cts +14 -0
  9. package/dist/Controller.d.mts +14 -0
  10. package/dist/Controller.mjs +11 -0
  11. package/dist/{Request-DKXwa_W0.d.mts → Request-Ci0UQ-Vl.d.mts} +32 -5
  12. package/dist/ResourceRouteSelection.cjs +26 -0
  13. package/dist/ResourceRouteSelection.d.cts +20 -0
  14. package/dist/ResourceRouteSelection.d.mts +20 -0
  15. package/dist/ResourceRouteSelection.mjs +25 -0
  16. package/dist/ResourceRoutes.cjs +60 -0
  17. package/dist/ResourceRoutes.d.cts +37 -0
  18. package/dist/ResourceRoutes.d.mts +37 -0
  19. package/dist/ResourceRoutes.mjs +60 -0
  20. package/dist/Route.cjs +90 -0
  21. package/dist/Route.d.cts +62 -0
  22. package/dist/Route.d.mts +62 -0
  23. package/dist/Route.mjs +89 -0
  24. package/dist/core/Request.cjs +35 -0
  25. package/dist/core/Request.d.cts +25 -0
  26. package/dist/core/Request.d.mts +25 -0
  27. package/dist/core/Request.mjs +35 -0
  28. package/dist/core/Response.cjs +59 -0
  29. package/dist/core/Response.d.cts +24 -0
  30. package/dist/core/Response.d.mts +24 -0
  31. package/dist/core/Response.mjs +58 -0
  32. package/dist/{bindings-CLsZjOEy.cjs → core/bindings.cjs} +10 -160
  33. package/dist/{bindings-CNL7bpz5.d.mts → core/bindings.d.cts} +1 -1
  34. package/dist/{bindings-CxvtC8XS.d.cts → core/bindings.d.mts} +1 -1
  35. package/dist/{bindings-XLDXFpHZ.mjs → core/bindings.mjs} +3 -110
  36. package/dist/core/index.cjs +7 -17
  37. package/dist/core/index.d.cts +4 -1
  38. package/dist/core/index.d.mts +4 -1
  39. package/dist/core/index.mjs +4 -14
  40. package/dist/core/plugins.cjs +14 -0
  41. package/dist/core/plugins.d.cts +109 -0
  42. package/dist/core/plugins.d.mts +109 -0
  43. package/dist/core/plugins.mjs +13 -0
  44. package/dist/{responses-Bvnk0uvc.cjs → core/responses.cjs} +5 -20
  45. package/dist/{responses-BvETUeDL.mjs → core/responses.mjs} +2 -2
  46. package/dist/{router-C6W-k6sS.cjs → core/router.cjs} +67 -72
  47. package/dist/core/router.d.cts +286 -0
  48. package/dist/core/router.d.mts +286 -0
  49. package/dist/{router-Dc9w86Wn.mjs → core/router.mjs} +62 -62
  50. package/dist/decorators/index.cjs +1 -1
  51. package/dist/decorators/index.d.cts +1 -1
  52. package/dist/decorators/index.d.mts +1 -1
  53. package/dist/decorators/index.mjs +1 -1
  54. package/dist/decorators/setup.cjs +2 -2
  55. package/dist/decorators/setup.d.cts +1 -1
  56. package/dist/decorators/setup.d.mts +1 -2
  57. package/dist/decorators/setup.mjs +2 -2
  58. package/dist/express/index.cjs +2 -265
  59. package/dist/express/index.d.cts +1 -127
  60. package/dist/express/index.d.mts +1 -127
  61. package/dist/express/index.mjs +1 -264
  62. package/dist/express/router.cjs +265 -0
  63. package/dist/express/router.d.cts +132 -0
  64. package/dist/express/router.d.mts +132 -0
  65. package/dist/express/router.mjs +265 -0
  66. package/dist/fastify/index.cjs +2 -254
  67. package/dist/fastify/index.d.cts +1 -125
  68. package/dist/fastify/index.d.mts +1 -125
  69. package/dist/fastify/index.mjs +1 -253
  70. package/dist/fastify/router.cjs +254 -0
  71. package/dist/fastify/router.d.cts +130 -0
  72. package/dist/fastify/router.d.mts +130 -0
  73. package/dist/fastify/router.mjs +254 -0
  74. package/dist/h3/index.cjs +2 -260
  75. package/dist/h3/index.d.cts +1 -128
  76. package/dist/h3/index.d.mts +1 -128
  77. package/dist/h3/index.mjs +1 -259
  78. package/dist/h3/router.cjs +260 -0
  79. package/dist/h3/router.d.cts +133 -0
  80. package/dist/h3/router.d.mts +133 -0
  81. package/dist/h3/router.mjs +260 -0
  82. package/dist/hono/index.cjs +2 -251
  83. package/dist/hono/index.d.cts +1 -130
  84. package/dist/hono/index.d.mts +1 -130
  85. package/dist/hono/index.mjs +1 -250
  86. package/dist/hono/router.cjs +251 -0
  87. package/dist/hono/router.d.cts +135 -0
  88. package/dist/hono/router.d.mts +135 -0
  89. package/dist/hono/router.mjs +251 -0
  90. package/dist/index.cjs +16 -1097
  91. package/dist/index.d.cts +9 -563
  92. package/dist/index.d.mts +9 -563
  93. package/dist/index.mjs +8 -1089
  94. package/dist/koa/index.cjs +2 -261
  95. package/dist/koa/index.d.cts +1 -131
  96. package/dist/koa/index.d.mts +1 -131
  97. package/dist/koa/index.mjs +1 -260
  98. package/dist/koa/router.cjs +261 -0
  99. package/dist/koa/router.d.cts +136 -0
  100. package/dist/koa/router.d.mts +136 -0
  101. package/dist/koa/router.mjs +261 -0
  102. package/dist/types/basic.d.cts +53 -0
  103. package/dist/types/basic.d.mts +11 -1
  104. package/dist/types/express.d.cts +48 -0
  105. package/dist/types/express.d.mts +10 -4
  106. package/dist/types/fastify.d.cts +24 -0
  107. package/dist/types/fastify.d.mts +7 -4
  108. package/dist/types/h3.d.cts +46 -0
  109. package/dist/types/h3.d.mts +10 -5
  110. package/dist/types/hono.d.cts +22 -0
  111. package/dist/types/hono.d.mts +8 -6
  112. package/dist/types/koa.d.cts +26 -0
  113. package/dist/types/koa.d.mts +7 -5
  114. package/package.json +1 -1
  115. package/dist/router-BEgAxp5A.d.cts +0 -649
  116. package/dist/router-DKKYx23P.d.mts +0 -649
@@ -1,253 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- require('../bindings-CLsZjOEy.cjs');
3
- const require_router = require('../router-C6W-k6sS.cjs');
4
- const require_responses = require('../responses-Bvnk0uvc.cjs');
2
+ const require_router = require('./router.cjs');
5
3
 
6
- //#region src/hono/router.ts
7
- /**
8
- * @class clear-router Hono Router
9
- * @description Laravel-style routing system for Hono using shared clear-router core
10
- * @author 3m1n3nc3
11
- * @repository https://github.com/arkstack-tmp/clear-router
12
- */
13
- var Router = class Router extends require_router.CoreRouter {
14
- static routerStateNamespace = "clear-router:hono";
15
- static bodyCache = /* @__PURE__ */ new WeakMap();
16
- static toResponse(ctx, value, method, path) {
17
- const meta = require_responses.resolveResponseMeta(value, {
18
- headers: ctx.req.header(),
19
- method,
20
- path
21
- });
22
- if (!meta) return void 0;
23
- if (meta.isNativeResponse) return meta.body;
24
- const headers = meta.headers ? {} : meta.contentType ? { "Content-Type": meta.contentType } : void 0;
25
- meta.headers?.forEach((headerValue, key) => {
26
- if (headers) headers[key] = headerValue;
27
- });
28
- if (meta.isEmpty) return ctx.body(null, meta.status, headers);
29
- if (meta.contentType?.startsWith("application/json")) return ctx.body(JSON.stringify(meta.body), meta.status, headers);
30
- return ctx.body(meta.body, meta.status, headers);
31
- }
32
- static getParams(ctx) {
33
- try {
34
- const raw = ctx.req.param?.();
35
- return raw && typeof raw === "object" ? raw : {};
36
- } catch {
37
- return {};
38
- }
39
- }
40
- static async readBodyCached(ctx) {
41
- if (this.bodyCache.has(ctx)) {
42
- const cached = this.bodyCache.get(ctx) || {};
43
- ctx.req.getBody = () => cached;
44
- return cached;
45
- }
46
- let body = {};
47
- const contentType = (ctx.req.header("content-type") || "").toLowerCase();
48
- if (contentType.includes("application/json")) body = await ctx.req.json().catch(() => ({}));
49
- else if (contentType.includes("multipart/form-data") || contentType.includes("application/x-www-form-urlencoded")) body = await ctx.req.parseBody().then((v) => v).catch(() => ({}));
50
- ctx.req.getBody = () => body;
51
- this.bodyCache.set(ctx, body);
52
- return body;
53
- }
54
- /**
55
- * Adds a new route to the router.
56
- *
57
- * @param methods
58
- * @param path
59
- * @param handler
60
- * @param middlewares
61
- */
62
- static add(methods, path, handler, middlewares) {
63
- return super.add(methods, path, handler, middlewares);
64
- }
65
- /**
66
- * Define a resourceful API controller with standard CRUD routes
67
- *
68
- * @param basePath
69
- * @param controller
70
- * @param options
71
- */
72
- static apiResource(basePath, controller, options) {
73
- super.apiResource(basePath, controller, options);
74
- }
75
- /**
76
- * Define a GET route
77
- *
78
- * @param path
79
- * @param handler
80
- * @param middlewares
81
- */
82
- static get(path, handler, middlewares) {
83
- return super.get(path, handler, middlewares);
84
- }
85
- /**
86
- * Define a POST route
87
- *
88
- * @param path
89
- * @param handler
90
- * @param middlewares
91
- */
92
- static post(path, handler, middlewares) {
93
- return super.post(path, handler, middlewares);
94
- }
95
- /**
96
- * Define a PUT route
97
- *
98
- * @param path
99
- * @param handler
100
- * @param middlewares
101
- */
102
- static put(path, handler, middlewares) {
103
- return super.put(path, handler, middlewares);
104
- }
105
- /**
106
- * Define a DELETE route
107
- *
108
- * @param path
109
- * @param handler
110
- * @param middlewares
111
- */
112
- static delete(path, handler, middlewares) {
113
- return super.delete(path, handler, middlewares);
114
- }
115
- /**
116
- * Define a PATCH route
117
- *
118
- * @param path
119
- * @param handler
120
- * @param middlewares
121
- */
122
- static patch(path, handler, middlewares) {
123
- return super.patch(path, handler, middlewares);
124
- }
125
- /**
126
- * Define an OPTIONS route
127
- *
128
- * @param path
129
- * @param handler
130
- * @param middlewares
131
- */
132
- static options(path, handler, middlewares) {
133
- return super.options(path, handler, middlewares);
134
- }
135
- /**
136
- * Define a HEAD route
137
- *
138
- * @param path
139
- * @param handler
140
- * @param middlewares
141
- */
142
- static head(path, handler, middlewares) {
143
- return super.head(path, handler, middlewares);
144
- }
145
- /**
146
- * Defines a group of routes with a common prefix.
147
- *
148
- * @param prefix
149
- * @param callback
150
- * @param middlewares
151
- */
152
- static async group(prefix, callback, middlewares) {
153
- await super.group(prefix, callback, middlewares);
154
- }
155
- /**
156
- * Apply middlewares to a group of routes defined within the callback
157
- *
158
- * @param middlewares - Middleware or array of middlewares to apply
159
- * @param callback - Function that defines the routes to which the middlewares will be applied
160
- */
161
- static middleware(middlewares, callback) {
162
- super.middleware(middlewares, callback);
163
- }
164
- static allRoutes(type) {
165
- return super.allRoutes(type);
166
- }
167
- static route(name) {
168
- return super.route(name);
169
- }
170
- /**
171
- * Apply the defined routes to a Hono application instance
172
- *
173
- * @param app The Hono application instance
174
- * @returns The Hono application instance with the applied routes
175
- */
176
- static apply(app) {
177
- for (const route of Array.from(this.routes)) {
178
- let handlerFunction = null;
179
- let instance = null;
180
- let bindingTarget;
181
- let bindingMethod;
182
- let bindingHandler;
183
- let bindingMetadata;
184
- try {
185
- const resolved = this.resolveHandler(route);
186
- handlerFunction = resolved.handlerFunction;
187
- instance = resolved.instance;
188
- bindingTarget = resolved.bindingTarget;
189
- bindingMethod = resolved.bindingMethod;
190
- bindingHandler = resolved.bindingHandler;
191
- bindingMetadata = resolved.bindingMetadata;
192
- } catch (error) {
193
- console.error(`[ROUTES] Error setting up route ${route.path}:`, error.message);
194
- throw error;
195
- }
196
- if (!handlerFunction) continue;
197
- for (const method of route.methods) {
198
- const allowedMethods = [
199
- "get",
200
- "post",
201
- "put",
202
- "delete",
203
- "patch",
204
- "options",
205
- "head"
206
- ];
207
- if (method === "options" && route.methods.length > 1) continue;
208
- if (!allowedMethods.includes(method)) throw new Error(`Invalid HTTP method: ${method} for route: ${route.path}`);
209
- for (const registrationPath of route.registrationPaths) app[method](registrationPath, ...route.middlewares || [], async (context) => {
210
- const ctx = context;
211
- const reqBody = await Router.readBodyCached(ctx);
212
- const override = Router.resolveMethodOverride(ctx.req.method, ctx.req.header(), reqBody);
213
- if (method === "post" && override && override !== "post") return;
214
- const inst = instance ?? route;
215
- Router.bindRequestToInstance(ctx, inst, route, {
216
- body: reqBody,
217
- query: ctx.req.query(),
218
- params: Router.getParams(ctx),
219
- method
220
- });
221
- const result = await Router.callHandler(handlerFunction, ctx, bindingTarget, bindingMethod, bindingHandler, bindingMetadata);
222
- const resolved = await Promise.resolve(result);
223
- const outgoing = typeof resolved === "undefined" && ctx.clearResponse?.sent ? ctx.clearResponse : resolved;
224
- return Router.toResponse(ctx, outgoing, method, route.path);
225
- });
226
- if ([
227
- "put",
228
- "patch",
229
- "delete"
230
- ].includes(method)) for (const registrationPath of route.registrationPaths) app.post(registrationPath, ...route.middlewares || [], async (context) => {
231
- const ctx = context;
232
- const reqBody = await Router.readBodyCached(ctx);
233
- if (Router.resolveMethodOverride(ctx.req.method, ctx.req.header(), reqBody) !== method) return;
234
- const inst = instance ?? route;
235
- Router.bindRequestToInstance(ctx, inst, route, {
236
- body: reqBody,
237
- query: ctx.req.query(),
238
- params: Router.getParams(ctx),
239
- method
240
- });
241
- const result = await Router.callHandler(handlerFunction, ctx, bindingTarget, bindingMethod, bindingHandler, bindingMetadata);
242
- const resolved = await Promise.resolve(result);
243
- const outgoing = typeof resolved === "undefined" && ctx.clearResponse?.sent ? ctx.clearResponse : resolved;
244
- return Router.toResponse(ctx, outgoing, method, route.path);
245
- });
246
- }
247
- }
248
- return app;
249
- }
250
- };
251
-
252
- //#endregion
253
- exports.Router = Router;
4
+ exports.Router = require_router;
@@ -1,131 +1,2 @@
1
- import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-BEgAxp5A.cjs";
2
-
3
- //#region src/hono/router.d.ts
4
- /**
5
- * @class clear-router Hono Router
6
- * @description Laravel-style routing system for Hono using shared clear-router core
7
- * @author 3m1n3nc3
8
- * @repository https://github.com/arkstack-tmp/clear-router
9
- */
10
- declare class Router extends CoreRouter {
11
- protected static routerStateNamespace: string;
12
- private static readonly bodyCache;
13
- private static toResponse;
14
- private static getParams;
15
- private static readBodyCached;
16
- /**
17
- * Adds a new route to the router.
18
- *
19
- * @param methods
20
- * @param path
21
- * @param handler
22
- * @param middlewares
23
- */
24
- static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
25
- /**
26
- * Define a resourceful API controller with standard CRUD routes
27
- *
28
- * @param basePath
29
- * @param controller
30
- * @param options
31
- */
32
- static apiResource(basePath: string, controller: any, options?: {
33
- only?: ControllerAction[];
34
- except?: ControllerAction[];
35
- middlewares?: ApiResourceMiddleware<Middleware>;
36
- }): void;
37
- /**
38
- * Define a GET route
39
- *
40
- * @param path
41
- * @param handler
42
- * @param middlewares
43
- */
44
- static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
45
- /**
46
- * Define a POST route
47
- *
48
- * @param path
49
- * @param handler
50
- * @param middlewares
51
- */
52
- static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
53
- /**
54
- * Define a PUT route
55
- *
56
- * @param path
57
- * @param handler
58
- * @param middlewares
59
- */
60
- static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
61
- /**
62
- * Define a DELETE route
63
- *
64
- * @param path
65
- * @param handler
66
- * @param middlewares
67
- */
68
- static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
69
- /**
70
- * Define a PATCH route
71
- *
72
- * @param path
73
- * @param handler
74
- * @param middlewares
75
- */
76
- static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
77
- /**
78
- * Define an OPTIONS route
79
- *
80
- * @param path
81
- * @param handler
82
- * @param middlewares
83
- */
84
- static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
85
- /**
86
- * Define a HEAD route
87
- *
88
- * @param path
89
- * @param handler
90
- * @param middlewares
91
- */
92
- static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
93
- /**
94
- * Defines a group of routes with a common prefix.
95
- *
96
- * @param prefix
97
- * @param callback
98
- * @param middlewares
99
- */
100
- static group(prefix: string, callback: () => void | Promise<void>, middlewares?: Middleware[]): Promise<void>;
101
- /**
102
- * Apply middlewares to a group of routes defined within the callback
103
- *
104
- * @param middlewares - Middleware or array of middlewares to apply
105
- * @param callback - Function that defines the routes to which the middlewares will be applied
106
- */
107
- static middleware(middlewares: Middleware[], callback: () => void): void;
108
- /**
109
- * Get all defined routes, optionally organized by path or method
110
- */
111
- static allRoutes(): Array<Route<HttpContext, Middleware, Handler>>;
112
- /**
113
- * @param type - 'path' to get routes organized by path
114
- */
115
- static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler>>;
116
- /**
117
- * @param type - 'method' to get routes organized by method
118
- */
119
- static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler>> };
120
- static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler>>;
121
- static route(name: string): Route<HttpContext, Middleware, Handler> | undefined;
122
- /**
123
- * Apply the defined routes to a Hono application instance
124
- *
125
- * @param app The Hono application instance
126
- * @returns The Hono application instance with the applied routes
127
- */
128
- static apply(app: HonoApp): HonoApp;
129
- }
130
- //#endregion
1
+ import { Router } from "./router.cjs";
131
2
  export { Router };
@@ -1,131 +1,2 @@
1
- import { F as ApiResourceMiddleware, I as ControllerAction, L as HttpMethod, S as Middleware, b as HonoApp, m as Route, t as CoreRouter, x as HttpContext, y as Handler } from "../router-DKKYx23P.mjs";
2
-
3
- //#region src/hono/router.d.ts
4
- /**
5
- * @class clear-router Hono Router
6
- * @description Laravel-style routing system for Hono using shared clear-router core
7
- * @author 3m1n3nc3
8
- * @repository https://github.com/arkstack-tmp/clear-router
9
- */
10
- declare class Router extends CoreRouter {
11
- protected static routerStateNamespace: string;
12
- private static readonly bodyCache;
13
- private static toResponse;
14
- private static getParams;
15
- private static readBodyCached;
16
- /**
17
- * Adds a new route to the router.
18
- *
19
- * @param methods
20
- * @param path
21
- * @param handler
22
- * @param middlewares
23
- */
24
- static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
25
- /**
26
- * Define a resourceful API controller with standard CRUD routes
27
- *
28
- * @param basePath
29
- * @param controller
30
- * @param options
31
- */
32
- static apiResource(basePath: string, controller: any, options?: {
33
- only?: ControllerAction[];
34
- except?: ControllerAction[];
35
- middlewares?: ApiResourceMiddleware<Middleware>;
36
- }): void;
37
- /**
38
- * Define a GET route
39
- *
40
- * @param path
41
- * @param handler
42
- * @param middlewares
43
- */
44
- static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
45
- /**
46
- * Define a POST route
47
- *
48
- * @param path
49
- * @param handler
50
- * @param middlewares
51
- */
52
- static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
53
- /**
54
- * Define a PUT route
55
- *
56
- * @param path
57
- * @param handler
58
- * @param middlewares
59
- */
60
- static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
61
- /**
62
- * Define a DELETE route
63
- *
64
- * @param path
65
- * @param handler
66
- * @param middlewares
67
- */
68
- static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
69
- /**
70
- * Define a PATCH route
71
- *
72
- * @param path
73
- * @param handler
74
- * @param middlewares
75
- */
76
- static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
77
- /**
78
- * Define an OPTIONS route
79
- *
80
- * @param path
81
- * @param handler
82
- * @param middlewares
83
- */
84
- static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
85
- /**
86
- * Define a HEAD route
87
- *
88
- * @param path
89
- * @param handler
90
- * @param middlewares
91
- */
92
- static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler>;
93
- /**
94
- * Defines a group of routes with a common prefix.
95
- *
96
- * @param prefix
97
- * @param callback
98
- * @param middlewares
99
- */
100
- static group(prefix: string, callback: () => void | Promise<void>, middlewares?: Middleware[]): Promise<void>;
101
- /**
102
- * Apply middlewares to a group of routes defined within the callback
103
- *
104
- * @param middlewares - Middleware or array of middlewares to apply
105
- * @param callback - Function that defines the routes to which the middlewares will be applied
106
- */
107
- static middleware(middlewares: Middleware[], callback: () => void): void;
108
- /**
109
- * Get all defined routes, optionally organized by path or method
110
- */
111
- static allRoutes(): Array<Route<HttpContext, Middleware, Handler>>;
112
- /**
113
- * @param type - 'path' to get routes organized by path
114
- */
115
- static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler>>;
116
- /**
117
- * @param type - 'method' to get routes organized by method
118
- */
119
- static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler>> };
120
- static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler>>;
121
- static route(name: string): Route<HttpContext, Middleware, Handler> | undefined;
122
- /**
123
- * Apply the defined routes to a Hono application instance
124
- *
125
- * @param app The Hono application instance
126
- * @returns The Hono application instance with the applied routes
127
- */
128
- static apply(app: HonoApp): HonoApp;
129
- }
130
- //#endregion
1
+ import { Router } from "./router.mjs";
131
2
  export { Router };