@pluv/io 3.2.2 → 4.0.1

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,22 +1,20 @@
1
1
 
2
- > @pluv/io@3.2.2 build /home/runner/work/pluv/pluv/packages/io
3
- > pnpm run version && tsup src/index.ts --format esm,cjs --dts
2
+ > @pluv/io@4.0.1 build /home/runner/work/pluv/pluv/packages/io
3
+ > pnpm run version && tsdown
4
4
 
5
5
 
6
- > @pluv/io@3.2.2 version /home/runner/work/pluv/pluv/packages/io
6
+ > @pluv/io@4.0.1 version /home/runner/work/pluv/pluv/packages/io
7
7
  > genversion ./src/version.generated.ts --esm
8
8
 
9
- CLI Building entry: src/index.ts
10
- CLI Using tsconfig: tsconfig.json
11
- CLI tsup v8.5.0
12
- CLI Target: es6
13
- ESM Build start
14
- CJS Build start
15
- ESM dist/index.mjs 53.72 KB
16
- ESM ⚡️ Build success in 142ms
17
- CJS dist/index.js 55.90 KB
18
- CJS ⚡️ Build success in 144ms
19
- DTS Build start
20
- DTS ⚡️ Build success in 4218ms
21
- DTS dist/index.d.mts 34.33 KB
22
- DTS dist/index.d.ts 34.33 KB
9
+ ℹ tsdown v0.20.0-beta.4 powered by rolldown v1.0.0-beta.60
10
+ ℹ config file: /home/runner/work/pluv/pluv/packages/io/tsdown.config.ts
11
+ ℹ entry: src/index.ts
12
+ ℹ target: esnext
13
+ ℹ tsconfig: tsconfig.json
14
+ ℹ Build start
15
+ ℹ dist/index.mjs  45.06 kB │ gzip: 10.66 kB
16
+ ℹ dist/index.mjs.map 131.03 kB │ gzip: 26.80 kB
17
+ ℹ dist/index.d.mts.map  18.91 kB │ gzip: 4.07 kB
18
+ ℹ dist/index.d.mts  35.53 kB │ gzip: 5.97 kB
19
+ ℹ 4 files, total: 230.54 kB
20
+ ✔ Build complete in 2803ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@4.0.1
8
+ - @pluv/types@4.0.1
9
+
10
+ ## 4.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - df5c39c: Update all packages to be ESM only.
15
+ - c142910: ### Breaking Changes
16
+
17
+ Updated jose from jose@^5 to jose@^6.
18
+
19
+ - 07e2a1e: ### Breaking Changes
20
+
21
+ This release includes the following breaking changes:
22
+ 1. **Removed `onDestroy` handler** (room-level only) - replaced with `onRoomDestroyed` and `onStorageDestroyed`
23
+ 2. **Removed `onRoomDeleted` handler** (server-level) - replaced with `onRoomDestroyed` and `onStorageDestroyed`
24
+ 3. **Listeners can no longer be configured at room-level** - all listeners must be configured at server-level via `io.server()`
25
+ 4. **Event type changes** - `IORoomDestroyedEvent` no longer includes `encodedState`
26
+
27
+ #### Remove `onDestroy` and `onRoomDeleted` in favor of `onRoomDestroyed` and `onStorageDestroyed`
28
+
29
+ **BREAKING**: Two event handlers have been **removed** in favor of two separate handlers that provide better control over when storage is saved. This is a breaking change that requires code updates.
30
+
31
+ **New Handlers:**
32
+ - **`onRoomDestroyed`**: Fires whenever a room is destroyed. This event does NOT include `encodedState` to prevent accidentally saving empty or uninitialized storage data. **Available only at server-level** via `io.server()`.
33
+ - **`onStorageDestroyed`**: Only fires when the storage document is about to be destroyed after it has been initialized via `initializeSession`. This event includes `encodedState` and should be used for saving storage to your database. **Available only at server-level** via `io.server()`.
34
+
35
+ **Removed Handlers:**
36
+ - **`onDestroy`** (room-level only, via `createRoom`): **REMOVED**. Use `onRoomDestroyed` and `onStorageDestroyed` instead.
37
+ - **`onRoomDeleted`** (server-level): **REMOVED**. Use `onRoomDestroyed` and `onStorageDestroyed` instead.
38
+
39
+ **Migration Guide:**
40
+
41
+ **Old (no longer works):**
42
+
43
+ ```typescript
44
+ // Room-level onDestroy (removed)
45
+ const room = io.createRoom("room-id", {
46
+ onDestroy: async ({ encodedState, room }) => {
47
+ // This no longer works
48
+ await saveToDatabase(room, encodedState);
49
+ },
50
+ });
51
+
52
+ // Server-level onRoomDeleted (removed)
53
+ io.server({
54
+ onRoomDeleted: async ({ encodedState, room }) => {
55
+ // This no longer works
56
+ await saveToDatabase(room, encodedState);
57
+ },
58
+ });
59
+ ```
60
+
61
+ **New (recommended approach):**
62
+
63
+ ```typescript
64
+ // Server-level handlers (recommended - all listeners are now server-level)
65
+ io.server({
66
+ onRoomDestroyed: async ({ room }) => {
67
+ // Room destroyed - use for cleanup if needed
68
+ await cleanupRoom(room);
69
+ },
70
+ onStorageDestroyed: async ({ encodedState, room }) => {
71
+ // Only fires when storage was initialized via initializeSession
72
+ // Safe to save to database
73
+ await saveToDatabase(room, encodedState);
74
+ },
75
+ });
76
+
77
+ // Rooms are created without listener options
78
+ const room = io.createRoom("room-id");
79
+ ```
80
+
81
+ #### Type Changes
82
+
83
+ **BREAKING**: The following type changes may require TypeScript code updates:
84
+ - **`IORoomDestroyedEvent`** no longer includes `encodedState` (breaking change if you were accessing `encodedState` from this event)
85
+ - **`IORoomListenerEvent`** includes `encodedState: string | null` (used by `onStorageDestroyed`)
86
+ - **All listeners must be configured at the server level** via `io.server()`, not at the room level via `createRoom()` (breaking change - room-level listener configuration is no longer supported)
87
+ - **`CreateRoomOptions`** now correctly requires platform-specific room context properties (e.g., `env` and `state` for Cloudflare) when they are required by the platform, while properly handling optional properties like `meta` (breaking change - TypeScript will now correctly enforce required properties)
88
+
89
+ ### Minor Changes
90
+
91
+ - 037074e: Migrated build process from tsup to tsdown.
92
+
93
+ ### Patch Changes
94
+
95
+ - 2eb5def: Bumped dependencies.
96
+ - Updated dependencies [2eb5def]
97
+ - Updated dependencies [df5c39c]
98
+ - Updated dependencies [037074e]
99
+ - @pluv/types@4.0.0
100
+ - @pluv/crdt@4.0.0
101
+
3
102
  ## 3.2.2
4
103
 
5
104
  ### Patch Changes