bxo 0.0.5-dev.12 → 0.0.5-dev.14

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 (2) hide show
  1. package/index.ts +23 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -231,9 +231,28 @@ export default class BXO {
231
231
  return this;
232
232
  }
233
233
 
234
+ // Helper methods to get all routes including plugin routes
235
+ private getAllRoutes(): Route[] {
236
+ const allRoutes = [...this._routes];
237
+ for (const plugin of this.plugins) {
238
+ allRoutes.push(...plugin._routes);
239
+ }
240
+ return allRoutes;
241
+ }
242
+
243
+ private getAllWSRoutes(): WSRoute[] {
244
+ const allWSRoutes = [...this._wsRoutes];
245
+ for (const plugin of this.plugins) {
246
+ allWSRoutes.push(...plugin._wsRoutes);
247
+ }
248
+ return allWSRoutes;
249
+ }
250
+
234
251
  // Route matching utility
235
252
  private matchRoute(method: string, pathname: string): { route: Route; params: Record<string, string> } | null {
236
- for (const route of this._routes) {
253
+ const allRoutes = this.getAllRoutes();
254
+
255
+ for (const route of allRoutes) {
237
256
  if (route.method !== method) continue;
238
257
 
239
258
  const routeSegments = route.path.split('/').filter(Boolean);
@@ -297,7 +316,9 @@ export default class BXO {
297
316
 
298
317
  // WebSocket route matching utility
299
318
  private matchWSRoute(pathname: string): { route: WSRoute; params: Record<string, string> } | null {
300
- for (const route of this._wsRoutes) {
319
+ const allWSRoutes = this.getAllWSRoutes();
320
+
321
+ for (const route of allWSRoutes) {
301
322
  const routeSegments = route.path.split('/').filter(Boolean);
302
323
  const pathSegments = pathname.split('/').filter(Boolean);
303
324
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bxo",
3
3
  "module": "index.ts",
4
- "version": "0.0.5-dev.12",
4
+ "version": "0.0.5-dev.14",
5
5
  "description": "A simple and lightweight web framework for Bun",
6
6
  "type": "module",
7
7
  "devDependencies": {