@pluv/crdt-loro 0.32.8 → 0.32.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/crdt-loro@0.32.8 build /home/runner/work/pluv/pluv/packages/crdt-loro
2
+ > @pluv/crdt-loro@0.32.9 build /home/runner/work/pluv/pluv/packages/crdt-loro
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 9.45 KB
12
- CJS ⚡️ Build success in 94ms
13
- ESM dist/index.mjs 8.39 KB
14
- ESM ⚡️ Build success in 95ms
11
+ CJS dist/index.js 9.16 KB
12
+ CJS ⚡️ Build success in 67ms
13
+ ESM dist/index.mjs 8.10 KB
14
+ ESM ⚡️ Build success in 67ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 2041ms
16
+ DTS ⚡️ Build success in 1913ms
17
17
  DTS dist/index.d.mts 3.51 KB
18
18
  DTS dist/index.d.ts 3.51 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/crdt-loro
2
2
 
3
+ ## 0.32.9
4
+
5
+ ### Patch Changes
6
+
7
+ - cef5911: Bump `loro-crdt` from `0.16.12` to `1.0.8`.
8
+ - @pluv/crdt@0.32.9
9
+ - @pluv/types@0.32.9
10
+
3
11
  ## 0.32.8
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -172,21 +172,18 @@ var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
172
172
  update
173
173
  });
174
174
  };
175
- const subscriptionIds = Object.entries(this._storage).reduce((map2, [key, crdtType]) => {
176
- const container = crdtType;
177
- const subscriptionId = container.subscribe(fn);
178
- return map2.set(key, subscriptionId);
179
- }, /* @__PURE__ */ new Map());
180
- return () => {
181
- Array.from(subscriptionIds.entries()).forEach(([key, subscriptionId]) => {
182
- var _a;
183
- const container = (_a = this._storage[key]) != null ? _a : null;
184
- if (!container) {
185
- throw new Error("Storage could not be found");
186
- }
187
- container.unsubscribe(subscriptionId);
188
- });
189
- };
175
+ const unsubcribeAll = Object.values(this._storage).reduce(
176
+ (acc, crdtType) => {
177
+ const container = crdtType;
178
+ const unsubscribe = container.subscribe(fn);
179
+ return () => {
180
+ acc();
181
+ unsubscribe();
182
+ };
183
+ },
184
+ () => void 0
185
+ );
186
+ return unsubcribeAll;
190
187
  }
191
188
  /**
192
189
  * TODO
package/dist/index.mjs CHANGED
@@ -153,21 +153,18 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
153
153
  update
154
154
  });
155
155
  };
156
- const subscriptionIds = Object.entries(this._storage).reduce((map2, [key, crdtType]) => {
157
- const container = crdtType;
158
- const subscriptionId = container.subscribe(fn);
159
- return map2.set(key, subscriptionId);
160
- }, /* @__PURE__ */ new Map());
161
- return () => {
162
- Array.from(subscriptionIds.entries()).forEach(([key, subscriptionId]) => {
163
- var _a;
164
- const container = (_a = this._storage[key]) != null ? _a : null;
165
- if (!container) {
166
- throw new Error("Storage could not be found");
167
- }
168
- container.unsubscribe(subscriptionId);
169
- });
170
- };
156
+ const unsubcribeAll = Object.values(this._storage).reduce(
157
+ (acc, crdtType) => {
158
+ const container = crdtType;
159
+ const unsubscribe = container.subscribe(fn);
160
+ return () => {
161
+ acc();
162
+ unsubscribe();
163
+ };
164
+ },
165
+ () => void 0
166
+ );
167
+ return unsubcribeAll;
171
168
  }
172
169
  /**
173
170
  * TODO
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/crdt-loro",
3
- "version": "0.32.8",
3
+ "version": "0.32.9",
4
4
  "description": "loro for @pluv/io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,19 +18,19 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "js-base64": "^3.7.7",
21
- "@pluv/crdt": "^0.32.8",
22
- "@pluv/types": "^0.32.8"
21
+ "@pluv/crdt": "^0.32.9",
22
+ "@pluv/types": "^0.32.9"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "loro-crdt": "^0.16.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.0",
29
- "loro-crdt": "^0.16.12",
29
+ "loro-crdt": "^1.0.8",
30
30
  "tsup": "^8.3.5",
31
31
  "typescript": "^5.6.3",
32
- "@pluv/tsconfig": "^0.32.8",
33
- "eslint-config-pluv": "^0.32.8"
32
+ "@pluv/tsconfig": "^0.32.9",
33
+ "eslint-config-pluv": "^0.32.9"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -170,24 +170,20 @@ export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> ex
170
170
  });
171
171
  };
172
172
 
173
- const subscriptionIds = Object.entries(this._storage).reduce((map, [key, crdtType]) => {
174
- const container = crdtType as unknown as Container;
175
- const subscriptionId = container.subscribe(fn);
176
-
177
- return map.set(key, subscriptionId);
178
- }, new Map<string, number>());
179
-
180
- return () => {
181
- Array.from(subscriptionIds.entries()).forEach(([key, subscriptionId]) => {
182
- const container = (this._storage[key] ?? null) as unknown as Container | null;
183
-
184
- if (!container) {
185
- throw new Error("Storage could not be found");
186
- }
173
+ const unsubcribeAll = Object.values(this._storage).reduce<() => void>(
174
+ (acc, crdtType) => {
175
+ const container = crdtType as unknown as Container;
176
+ const unsubscribe = container.subscribe(fn);
177
+
178
+ return () => {
179
+ acc();
180
+ unsubscribe();
181
+ };
182
+ },
183
+ () => undefined,
184
+ );
187
185
 
188
- container.unsubscribe(subscriptionId);
189
- });
190
- };
186
+ return unsubcribeAll;
191
187
  }
192
188
 
193
189
  /**