bxo 0.0.5-dev.5 → 0.0.5-dev.6

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 +15 -15
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -360,7 +360,7 @@ export default class BXO {
360
360
  pathname
361
361
  }
362
362
  });
363
-
363
+
364
364
  if (success) {
365
365
  return; // undefined response means upgrade was successful
366
366
  }
@@ -515,14 +515,14 @@ export default class BXO {
515
515
  if (pattern === filename) {
516
516
  return true;
517
517
  }
518
-
518
+
519
519
  // Handle directory patterns (e.g., "node_modules/", "dist/")
520
520
  if (pattern.endsWith('/')) {
521
521
  if (filename.startsWith(pattern) || filename.includes(`/${pattern}`)) {
522
522
  return true;
523
523
  }
524
524
  }
525
-
525
+
526
526
  // Handle wildcard patterns (e.g., "*.log", "temp*")
527
527
  if (pattern.includes('*')) {
528
528
  const regex = new RegExp(pattern.replace(/\*/g, '.*'));
@@ -530,18 +530,18 @@ export default class BXO {
530
530
  return true;
531
531
  }
532
532
  }
533
-
533
+
534
534
  // Handle file extension patterns (e.g., ".log", ".tmp")
535
535
  if (pattern.startsWith('.') && filename.endsWith(pattern)) {
536
536
  return true;
537
537
  }
538
-
538
+
539
539
  // Handle substring matches for directories
540
540
  if (filename.includes(pattern)) {
541
541
  return true;
542
542
  }
543
543
  }
544
-
544
+
545
545
  return false;
546
546
  }
547
547
 
@@ -558,7 +558,7 @@ export default class BXO {
558
558
  if (this.shouldExcludeFile(filename)) {
559
559
  return;
560
560
  }
561
-
561
+
562
562
  console.log(`🔄 File changed: ${filename}, restarting server...`);
563
563
  await this.restart(port, hostname);
564
564
  }
@@ -727,24 +727,24 @@ export default class BXO {
727
727
  // Server status
728
728
  running: this.isRunning,
729
729
  server: this.server ? 'Bun' : null,
730
-
730
+
731
731
  // Connection details
732
732
  hostname: this.serverHostname,
733
733
  port: this.serverPort,
734
- url: this.isRunning && this.serverHostname && this.serverPort
735
- ? `http://${this.serverHostname}:${this.serverPort}`
734
+ url: this.isRunning && this.serverHostname && this.serverPort
735
+ ? `http://${this.serverHostname}:${this.serverPort}`
736
736
  : null,
737
-
737
+
738
738
  // Application statistics
739
739
  totalRoutes: this._routes.length,
740
740
  totalWsRoutes: this._wsRoutes.length,
741
741
  totalPlugins: this.plugins.length,
742
-
742
+
743
743
  // Hot reload configuration
744
744
  hotReload: this.hotReloadEnabled,
745
745
  watchedFiles: Array.from(this.watchedFiles),
746
746
  excludePatterns: Array.from(this.watchedExclude),
747
-
747
+
748
748
  // System information
749
749
  runtime: 'Bun',
750
750
  version: typeof Bun !== 'undefined' ? Bun.version : 'unknown',
@@ -777,8 +777,8 @@ export default class BXO {
777
777
  }
778
778
  }
779
779
 
780
- const error = (error: Error, status: number = 500) => {
781
- return new Response(JSON.stringify({ error: error.message }), { status });
780
+ const error = (error: Error | string, status: number = 500) => {
781
+ return new Response(JSON.stringify({ error: error instanceof Error ? error.message : error }), { status });
782
782
  }
783
783
 
784
784
  // Export Zod for convenience
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.5",
4
+ "version": "0.0.5-dev.6",
5
5
  "description": "A simple and lightweight web framework for Bun",
6
6
  "type": "module",
7
7
  "devDependencies": {