@vyckr/tachyon 1.1.7 → 1.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyckr/tachyon",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "author": "Chidelma",
5
5
  "repository": {
6
6
  "type": "git",
package/src/serve.ts CHANGED
@@ -87,6 +87,8 @@ const server = Bun.serve({
87
87
 
88
88
  if(server.development) {
89
89
 
90
+ let timeout: Timer
91
+
90
92
  let websocket: ServerWebSocket<unknown>;
91
93
 
92
94
  const socket = Bun.serve({
@@ -112,23 +114,30 @@ if(server.development) {
112
114
  if(await exists(Router.routesPath)) {
113
115
 
114
116
  watcher(Router.routesPath, { recursive: true }, () => {
115
- queueMicrotask(async () => {
117
+
118
+ if(timeout) clearTimeout(timeout)
119
+
120
+ timeout = setTimeout(async () => {
116
121
  console.info("HMR Update")
117
122
  await configureRoutes()
118
123
  server.reload({ routes: Router.reqRoutes })
119
124
  if(websocket) websocket.send('')
120
- })
125
+ }, 1500)
121
126
  })
122
127
  }
123
128
 
124
129
  if(await exists(Router.componentsPath)) {
125
130
 
126
131
  watcher(Router.componentsPath, { recursive: true }, () => {
127
- queueMicrotask(async () => {
132
+
133
+ if(timeout) clearTimeout(timeout)
134
+
135
+ timeout = setTimeout(async () => {
136
+ console.info("HMR Update")
128
137
  await configureRoutes()
129
138
  server.reload({ routes: Router.reqRoutes })
130
139
  if(websocket) websocket.send('')
131
- })
140
+ }, 1500)
132
141
  })
133
142
  }
134
143
  }
@@ -222,7 +222,7 @@ export default class Tach {
222
222
 
223
223
  if(method !== 'HTML' && method !== 'SOCKET') {
224
224
 
225
- if(!Router.reqRoutes[route]) {
225
+ if(!Router.reqRoutes[route] || !Router.reqRoutes[`${route}/*`]) {
226
226
  Router.reqRoutes[route] = {}
227
227
  Router.reqRoutes[`${route}/*`] = {}
228
228
  }