@getvision/server 0.3.1-9c3a582-develop → 0.3.2-90d1d3a-develop

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @getvision/server
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9c3a582: Improve hot-reload cleanup and prevent memory leaks during development
8
+ - 3b055ce: clean events and workers to avoid memory leaks
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getvision/server",
3
- "version": "0.3.1-9c3a582-develop",
3
+ "version": "0.3.2-90d1d3a-develop",
4
4
  "type": "module",
5
5
  "description": "Vision Server - Meta-framework with built-in observability, pub/sub, and type-safe APIs",
6
6
  "exports": {
package/src/service.ts CHANGED
@@ -38,15 +38,31 @@ function getClientKey(c: Context, method: string, path: string): string {
38
38
  */
39
39
  function createEventContext<E extends Env = any, I extends Input = {}>(): Context<E, any, I> {
40
40
  const store: Record<string, any> = {}
41
+ const mockRequest = new Request('http://localhost/event-trigger')
42
+ const resHeaders = new Headers()
43
+
41
44
  const fake: Partial<Context<E, any, I>> = {
42
45
  get: (key: string) => store[key],
43
46
  set: (key: string, value: any) => { store[key] = value },
47
+ header: (key: string, value: string | undefined) => {
48
+ if (value === undefined) {
49
+ resHeaders.delete(key)
50
+ } else {
51
+ resHeaders.set(key, value)
52
+ }
53
+ },
54
+ status: (code: number) => {},
44
55
  req: {
45
- header: () => undefined,
56
+ header: ((name?: string) => name ? undefined : {}) as any,
46
57
  param: () => ({}),
47
58
  query: () => ({}),
48
59
  json: async () => ({}),
49
- raw: {} as any,
60
+ raw: mockRequest,
61
+ url: 'http://localhost/event-trigger',
62
+ method: 'POST',
63
+ } as any,
64
+ res: {
65
+ headers: resHeaders,
50
66
  } as any,
51
67
  }
52
68
  return fake as Context<E, any, I>
package/src/vision-app.ts CHANGED
@@ -57,7 +57,6 @@ async function cleanupVisionInstance(instance: Vision<any, any, any>): Promise<v
57
57
 
58
58
  try { stopDrizzleStudio({ log: false }) } catch {}
59
59
  try { await (instance as any).eventBus?.close() } catch {}
60
- try { eventRegistry.clear() } catch {}
61
60
  })()
62
61
 
63
62
  return (instance as any)._cleanupPromise