@pluv/io 0.6.0 → 0.7.0

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/.eslintrc.js CHANGED
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
- root: true,
3
- extends: ["pluv"],
2
+ root: true,
3
+ extends: ["pluv"],
4
4
  };
@@ -1,17 +1,17 @@
1
1
 
2
- > @pluv/io@0.6.0 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@0.7.0 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
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v6.7.0
7
+ CLI tsup v7.0.0
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 28.98 KB
12
- ESM ⚡️ Build success in 93ms
13
- CJS dist/index.js 31.04 KB
14
- CJS ⚡️ Build success in 93ms
11
+ CJS dist/index.js 31.05 KB
12
+ CJS ⚡️ Build success in 81ms
13
+ ESM dist/index.mjs 28.99 KB
14
+ ESM ⚡️ Build success in 84ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3311ms
16
+ DTS ⚡️ Build success in 4546ms
17
17
  DTS dist/index.d.ts 17.03 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
8
+
9
+ This also introduces the first new addon `@pluv/addon-indexeddb`, which is more-or-less the equivalent to `y-indexeddb` which you can install like so:
10
+
11
+ ```
12
+ npm install @pluv/addon-indexeddb
13
+ ```
14
+
15
+ To use this new addon, simply pass it to options when creating a room:
16
+
17
+ ```ts
18
+ import { addonIndexedDB } from "@pluv/addon-indexeddb";
19
+ import { createClient } from "@pluv/client";
20
+
21
+ const client = createClient({
22
+ // ...
23
+ });
24
+
25
+ const room = client.createRoom("my-new-room", {
26
+ addons: [
27
+ // Define your addons in an array like so
28
+ addonIndexedDB(),
29
+ ],
30
+ });
31
+ ```
32
+
33
+ Or when using `@pluv/react`:
34
+
35
+ ```ts
36
+ const PluvRoom = createRoomBundle({
37
+ // ...
38
+ addons: [
39
+ // Define your addons in an array like so
40
+ addonIndexedDB(),
41
+ ],
42
+ });
43
+ ```
44
+
45
+ ### Patch Changes
46
+
47
+ - 8d11672: bumped dependencies to latest
48
+ - Updated dependencies [8d11672]
49
+ - Updated dependencies [829d31b]
50
+ - @pluv/crdt-yjs@0.4.0
51
+ - @pluv/types@0.2.1
52
+
3
53
  ## 0.6.0
4
54
 
5
55
  ### Minor Changes
package/dist/index.js CHANGED
@@ -727,7 +727,7 @@ var IORoom = class {
727
727
  };
728
728
 
729
729
  // src/PluvIO.ts
730
- var PluvIO = class {
730
+ var PluvIO = class _PluvIO {
731
731
  constructor(options) {
732
732
  this._context = {};
733
733
  this._getInitialStorage = null;
@@ -818,7 +818,7 @@ var PluvIO = class {
818
818
  },
819
819
  $UPDATE_STORAGE: {
820
820
  resolver: ({ origin, update }, { context, doc: doc2, room }) => {
821
- if (origin === "$STORAGE_RECEIVED" && Object.keys(doc2.toJSON()).length) {
821
+ if (origin === "$INITIALIZED" && Object.keys(doc2.toJSON()).length) {
822
822
  return;
823
823
  }
824
824
  const updated = doc2.applyUpdate(update);
@@ -878,9 +878,9 @@ var PluvIO = class {
878
878
  const newEvent = {
879
879
  [event]: config
880
880
  };
881
- return PluvIO.merge(
881
+ return _PluvIO.merge(
882
882
  this,
883
- new PluvIO({
883
+ new _PluvIO({
884
884
  events: newEvent,
885
885
  platform: this._platform
886
886
  })
@@ -942,7 +942,7 @@ var PluvIO = class {
942
942
  const events2 = second._events;
943
943
  const { onRoomDeleted, onStorageUpdated } = first._listeners;
944
944
  const events = Object.assign(/* @__PURE__ */ Object.create(null), events1, events2);
945
- return new PluvIO({
945
+ return new _PluvIO({
946
946
  authorize: authorize2,
947
947
  debug,
948
948
  events,
package/dist/index.mjs CHANGED
@@ -690,7 +690,7 @@ var IORoom = class {
690
690
  };
691
691
 
692
692
  // src/PluvIO.ts
693
- var PluvIO = class {
693
+ var PluvIO = class _PluvIO {
694
694
  constructor(options) {
695
695
  this._context = {};
696
696
  this._getInitialStorage = null;
@@ -781,7 +781,7 @@ var PluvIO = class {
781
781
  },
782
782
  $UPDATE_STORAGE: {
783
783
  resolver: ({ origin, update }, { context, doc: doc2, room }) => {
784
- if (origin === "$STORAGE_RECEIVED" && Object.keys(doc2.toJSON()).length) {
784
+ if (origin === "$INITIALIZED" && Object.keys(doc2.toJSON()).length) {
785
785
  return;
786
786
  }
787
787
  const updated = doc2.applyUpdate(update);
@@ -841,9 +841,9 @@ var PluvIO = class {
841
841
  const newEvent = {
842
842
  [event]: config
843
843
  };
844
- return PluvIO.merge(
844
+ return _PluvIO.merge(
845
845
  this,
846
- new PluvIO({
846
+ new _PluvIO({
847
847
  events: newEvent,
848
848
  platform: this._platform
849
849
  })
@@ -905,7 +905,7 @@ var PluvIO = class {
905
905
  const events2 = second._events;
906
906
  const { onRoomDeleted, onStorageUpdated } = first._listeners;
907
907
  const events = Object.assign(/* @__PURE__ */ Object.create(null), events1, events2);
908
- return new PluvIO({
908
+ return new _PluvIO({
909
909
  authorize: authorize2,
910
910
  debug,
911
911
  events,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,21 +18,23 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@panva/hkdf": "^1.1.1",
21
+ "@playwright/test": "^1.35.1",
22
+ "@types/react": "^18.2.13",
21
23
  "jose": "^4.14.4",
22
24
  "kleur": "^4.1.5",
23
25
  "wonka": "^6.3.2",
24
- "@pluv/crdt-yjs": "^0.3.8",
25
- "@pluv/types": "^0.2.0"
26
+ "@pluv/crdt-yjs": "^0.4.0",
27
+ "@pluv/types": "^0.2.1"
26
28
  },
27
29
  "peerDependencies": {
28
30
  "yjs": "^13.0.0"
29
31
  },
30
32
  "devDependencies": {
31
- "tsup": "^6.7.0",
32
- "typescript": "^5.0.4",
33
- "yjs": "^13.6.1",
34
- "@pluv/tsconfig": "^0.1.6",
35
- "eslint-config-pluv": "^0.1.12"
33
+ "tsup": "^7.0.0",
34
+ "typescript": "^5.1.3",
35
+ "yjs": "^13.6.4",
36
+ "@pluv/tsconfig": "^0.1.7",
37
+ "eslint-config-pluv": "^0.1.13"
36
38
  },
37
39
  "scripts": {
38
40
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvIO.ts CHANGED
@@ -244,7 +244,7 @@ export class PluvIO<
244
244
  $UPDATE_STORAGE: {
245
245
  resolver: ({ origin, update }, { context, doc, room }) => {
246
246
  if (
247
- origin === "$STORAGE_RECEIVED" &&
247
+ origin === "$INITIALIZED" &&
248
248
  Object.keys(doc.toJSON()).length
249
249
  ) {
250
250
  return;