@pluv/crdt-loro 0.32.9 → 0.33.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/crdt-loro@0.32.9 build /home/runner/work/pluv/pluv/packages/crdt-loro
2
+ > @pluv/crdt-loro@0.33.0 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.16 KB
12
- CJS ⚡️ Build success in 67ms
13
- ESM dist/index.mjs 8.10 KB
14
- ESM ⚡️ Build success in 67ms
11
+ ESM dist/index.mjs 8.13 KB
12
+ ESM ⚡️ Build success in 46ms
13
+ CJS dist/index.js 9.19 KB
14
+ CJS ⚡️ Build success in 49ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1913ms
17
- DTS dist/index.d.mts 3.51 KB
18
- DTS dist/index.d.ts 3.51 KB
16
+ DTS ⚡️ Build success in 2009ms
17
+ DTS dist/index.d.mts 3.52 KB
18
+ DTS dist/index.d.ts 3.52 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pluv/crdt-loro
2
2
 
3
+ ## 0.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d99ac96: Require peer dependency loro-crdt@^1.0.0.
8
+
9
+ ### Patch Changes
10
+
11
+ - f54d8ce: Update internal, deprecated `loro-crdt` methods.
12
+ - @pluv/crdt@0.33.0
13
+ - @pluv/types@0.33.0
14
+
3
15
  ## 0.32.9
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CrdtType, AbstractCrdtDoc, DocApplyEncodedStateParams, InferCrdtJson, DocSubscribeCallbackParams, AbstractCrdtDocFactory } from '@pluv/crdt';
2
- import { Loro, LoroList, LoroMap, LoroText } from 'loro-crdt';
2
+ import { LoroDoc, LoroList, LoroMap, LoroText } from 'loro-crdt';
3
3
 
4
4
  type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & CrdtType<TValue, TJson> & {
5
5
  toJSON?: () => any;
@@ -7,7 +7,7 @@ type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & Cr
7
7
  };
8
8
 
9
9
  declare class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
10
- value: Loro;
10
+ value: LoroDoc;
11
11
  private _storage;
12
12
  constructor(value?: TStorage);
13
13
  applyEncodedState(params: DocApplyEncodedStateParams): this;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CrdtType, AbstractCrdtDoc, DocApplyEncodedStateParams, InferCrdtJson, DocSubscribeCallbackParams, AbstractCrdtDocFactory } from '@pluv/crdt';
2
- import { Loro, LoroList, LoroMap, LoroText } from 'loro-crdt';
2
+ import { LoroDoc, LoroList, LoroMap, LoroText } from 'loro-crdt';
3
3
 
4
4
  type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & CrdtType<TValue, TJson> & {
5
5
  toJSON?: () => any;
@@ -7,7 +7,7 @@ type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & Cr
7
7
  };
8
8
 
9
9
  declare class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
10
- value: Loro;
10
+ value: LoroDoc;
11
11
  private _storage;
12
12
  constructor(value?: TStorage);
13
13
  applyEncodedState(params: DocApplyEncodedStateParams): this;
package/dist/index.js CHANGED
@@ -60,7 +60,7 @@ var import_loro_crdt = require("loro-crdt");
60
60
  var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
61
61
  constructor(value = {}) {
62
62
  super();
63
- this.value = new import_loro_crdt.Loro();
63
+ this.value = new import_loro_crdt.LoroDoc();
64
64
  this._storage = Object.entries(value).reduce((acc, [key, node]) => {
65
65
  if (node instanceof import_loro_crdt.LoroList) {
66
66
  const container = this.value.getList(key);
@@ -137,7 +137,7 @@ var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
137
137
  return this._storage[key];
138
138
  }
139
139
  getEncodedState() {
140
- return (0, import_js_base64.fromUint8Array)(this.value.exportSnapshot());
140
+ return (0, import_js_base64.fromUint8Array)(this.value.export({ mode: "snapshot" }));
141
141
  }
142
142
  toJson(type) {
143
143
  if (typeof type === "string") {
@@ -164,7 +164,7 @@ var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
164
164
  }
165
165
  subscribe(listener) {
166
166
  const fn = (event) => {
167
- const update = (0, import_js_base64.fromUint8Array)(this.value.exportFrom());
167
+ const update = (0, import_js_base64.fromUint8Array)(this.value.export({ mode: "update" }));
168
168
  listener({
169
169
  doc: this,
170
170
  local: event.by === "local",
package/dist/index.mjs CHANGED
@@ -37,11 +37,11 @@ __export(loro_exports, {
37
37
  // src/doc/CrdtLoroDoc.ts
38
38
  import { AbstractCrdtDoc } from "@pluv/crdt";
39
39
  import { fromUint8Array, toUint8Array } from "js-base64";
40
- import { Loro, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
40
+ import { LoroDoc, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
41
41
  var CrdtLoroDoc = class extends AbstractCrdtDoc {
42
42
  constructor(value = {}) {
43
43
  super();
44
- this.value = new Loro();
44
+ this.value = new LoroDoc();
45
45
  this._storage = Object.entries(value).reduce((acc, [key, node]) => {
46
46
  if (node instanceof LoroList) {
47
47
  const container = this.value.getList(key);
@@ -118,7 +118,7 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
118
118
  return this._storage[key];
119
119
  }
120
120
  getEncodedState() {
121
- return fromUint8Array(this.value.exportSnapshot());
121
+ return fromUint8Array(this.value.export({ mode: "snapshot" }));
122
122
  }
123
123
  toJson(type) {
124
124
  if (typeof type === "string") {
@@ -145,7 +145,7 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
145
145
  }
146
146
  subscribe(listener) {
147
147
  const fn = (event) => {
148
- const update = fromUint8Array(this.value.exportFrom());
148
+ const update = fromUint8Array(this.value.export({ mode: "update" }));
149
149
  listener({
150
150
  doc: this,
151
151
  local: event.by === "local",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/crdt-loro",
3
- "version": "0.32.9",
3
+ "version": "0.33.0",
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.9",
22
- "@pluv/types": "^0.32.9"
21
+ "@pluv/crdt": "^0.33.0",
22
+ "@pluv/types": "^0.33.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "loro-crdt": "^0.16.0"
25
+ "loro-crdt": "^1.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "eslint": "^8.57.0",
29
- "loro-crdt": "^1.0.8",
28
+ "eslint": "^8.57.1",
29
+ "loro-crdt": "^1.1.4",
30
30
  "tsup": "^8.3.5",
31
- "typescript": "^5.6.3",
32
- "@pluv/tsconfig": "^0.32.9",
33
- "eslint-config-pluv": "^0.32.9"
31
+ "typescript": "^5.7.2",
32
+ "@pluv/tsconfig": "^0.33.0",
33
+ "eslint-config-pluv": "^0.33.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -2,11 +2,11 @@ import type { DocApplyEncodedStateParams, DocSubscribeCallbackParams, InferCrdtJ
2
2
  import { AbstractCrdtDoc } from "@pluv/crdt";
3
3
  import { fromUint8Array, toUint8Array } from "js-base64";
4
4
  import type { Container, LoroEventBatch } from "loro-crdt";
5
- import { Loro, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
6
- import { LoroType } from "../types";
5
+ import { LoroDoc, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
6
+ import type { LoroType } from "../types";
7
7
 
8
8
  export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
9
- public value: Loro = new Loro();
9
+ public value: LoroDoc = new LoroDoc();
10
10
 
11
11
  private _storage: TStorage;
12
12
 
@@ -123,7 +123,7 @@ export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> ex
123
123
  }
124
124
 
125
125
  public getEncodedState(): string {
126
- return fromUint8Array(this.value.exportSnapshot());
126
+ return fromUint8Array(this.value.export({ mode: "snapshot" }));
127
127
  }
128
128
 
129
129
  public toJson(): InferCrdtJson<TStorage>;
@@ -160,7 +160,7 @@ export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> ex
160
160
 
161
161
  public subscribe(listener: (params: DocSubscribeCallbackParams<TStorage>) => void): () => void {
162
162
  const fn = (event: LoroEventBatch) => {
163
- const update = fromUint8Array(this.value.exportFrom());
163
+ const update = fromUint8Array(this.value.export({ mode: "update" }));
164
164
 
165
165
  listener({
166
166
  doc: this,