@pluv/io 0.3.8 → 0.3.9

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/io@0.3.8 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@0.3.9 build /home/runner/work/pluv/pluv/packages/io
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,10 +8,10 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 29.51 KB
12
- CJS ⚡️ Build success in 109ms
13
- ESM dist/index.mjs 27.45 KB
14
- ESM ⚡️ Build success in 118ms
11
+ CJS dist/index.js 29.45 KB
12
+ CJS ⚡️ Build success in 105ms
13
+ ESM dist/index.mjs 27.39 KB
14
+ ESM ⚡️ Build success in 107ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 2905ms
16
+ DTS ⚡️ Build success in 2633ms
17
17
  DTS dist/index.d.ts 12.84 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.3.9
4
+
5
+ ### Patch Changes
6
+
7
+ - abb3622: fixed @pluv/io yjs doc becoming unresponsive when the last user leaves on a cloudflare worker
8
+
3
9
  ## 0.3.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -323,7 +323,9 @@ var IORoom = class {
323
323
  this._platform = platform;
324
324
  this.id = id;
325
325
  this._listeners = {
326
- onDestroy: (encodedState) => onDestroy == null ? void 0 : onDestroy(encodedState)
326
+ onDestroy: (encodedState) => {
327
+ onDestroy == null ? void 0 : onDestroy(encodedState);
328
+ }
327
329
  };
328
330
  if (authorize2)
329
331
  this._authorize = authorize2;
@@ -626,6 +628,7 @@ var IORoom = class {
626
628
  this._doc.destroy();
627
629
  this._doc = (0, import_crdt_yjs.doc)();
628
630
  this._listeners.onDestroy(encodedState);
631
+ this._uninitialize = null;
629
632
  });
630
633
  });
631
634
  }
@@ -886,6 +889,7 @@ var PluvIO = class {
886
889
  `${import_kleur2.default.blue("Deleting empty room:")} ${room}`
887
890
  );
888
891
  this._rooms.delete(room);
892
+ this._listeners.onRoomDeleted(room, encodedState);
889
893
  if (this._debug) {
890
894
  const rooms = Array.from(this._rooms.keys());
891
895
  this._logDebug(`${import_kleur2.default.blue("Deleted room:")} ${room}`);
@@ -893,11 +897,6 @@ var PluvIO = class {
893
897
  `${import_kleur2.default.blue("Rooms available:")} ${rooms.join(", ")}`
894
898
  );
895
899
  }
896
- this._platform.persistance.getSize(room).then((size) => {
897
- if (size)
898
- return;
899
- this._listeners.onRoomDeleted(room, encodedState);
900
- });
901
900
  },
902
901
  platform
903
902
  });
package/dist/index.mjs CHANGED
@@ -286,7 +286,9 @@ var IORoom = class {
286
286
  this._platform = platform;
287
287
  this.id = id;
288
288
  this._listeners = {
289
- onDestroy: (encodedState) => onDestroy == null ? void 0 : onDestroy(encodedState)
289
+ onDestroy: (encodedState) => {
290
+ onDestroy == null ? void 0 : onDestroy(encodedState);
291
+ }
290
292
  };
291
293
  if (authorize2)
292
294
  this._authorize = authorize2;
@@ -589,6 +591,7 @@ var IORoom = class {
589
591
  this._doc.destroy();
590
592
  this._doc = doc();
591
593
  this._listeners.onDestroy(encodedState);
594
+ this._uninitialize = null;
592
595
  });
593
596
  });
594
597
  }
@@ -849,6 +852,7 @@ var PluvIO = class {
849
852
  `${colors2.blue("Deleting empty room:")} ${room}`
850
853
  );
851
854
  this._rooms.delete(room);
855
+ this._listeners.onRoomDeleted(room, encodedState);
852
856
  if (this._debug) {
853
857
  const rooms = Array.from(this._rooms.keys());
854
858
  this._logDebug(`${colors2.blue("Deleted room:")} ${room}`);
@@ -856,11 +860,6 @@ var PluvIO = class {
856
860
  `${colors2.blue("Rooms available:")} ${rooms.join(", ")}`
857
861
  );
858
862
  }
859
- this._platform.persistance.getSize(room).then((size) => {
860
- if (size)
861
- return;
862
- this._listeners.onRoomDeleted(room, encodedState);
863
- });
864
863
  },
865
864
  platform
866
865
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
package/src/IORoom.ts CHANGED
@@ -110,7 +110,9 @@ export class IORoom<
110
110
  this.id = id;
111
111
 
112
112
  this._listeners = {
113
- onDestroy: (encodedState) => onDestroy?.(encodedState),
113
+ onDestroy: (encodedState) => {
114
+ onDestroy?.(encodedState);
115
+ },
114
116
  };
115
117
 
116
118
  if (authorize) this._authorize = authorize;
@@ -493,6 +495,8 @@ export class IORoom<
493
495
  this._doc = doc();
494
496
 
495
497
  this._listeners.onDestroy(encodedState);
498
+
499
+ this._uninitialize = null;
496
500
  };
497
501
  }
498
502
 
package/src/PluvIO.ts CHANGED
@@ -291,6 +291,7 @@ export class PluvIO<
291
291
  );
292
292
 
293
293
  this._rooms.delete(room);
294
+ this._listeners.onRoomDeleted(room, encodedState);
294
295
 
295
296
  if (this._debug) {
296
297
  const rooms = Array.from(this._rooms.keys());
@@ -300,12 +301,6 @@ export class PluvIO<
300
301
  `${colors.blue("Rooms available:")} ${rooms.join(", ")}`
301
302
  );
302
303
  }
303
-
304
- this._platform.persistance.getSize(room).then((size) => {
305
- if (size) return;
306
-
307
- this._listeners.onRoomDeleted(room, encodedState);
308
- });
309
304
  },
310
305
  platform,
311
306
  });