loro-crdt 1.4.3 → 1.4.4
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/CHANGELOG.md +9 -0
- package/base64/index.js +19 -3
- package/base64/loro_wasm.d.ts +5 -0
- package/base64/loro_wasm_bg-ec1c7122.js +64 -0
- package/bundler/index.js +10 -2
- package/bundler/index.js.map +1 -1
- package/bundler/loro_wasm.d.ts +5 -0
- package/bundler/loro_wasm_bg.js +8 -0
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +1 -0
- package/nodejs/index.js +10 -2
- package/nodejs/index.js.map +1 -1
- package/nodejs/loro_wasm.d.ts +5 -0
- package/nodejs/loro_wasm.js +8 -0
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
- package/web/index.js +10 -2
- package/web/index.js.map +1 -1
- package/web/loro_wasm.d.ts +6 -0
- package/web/loro_wasm.js +8 -0
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +1 -0
- package/base64/loro_wasm_bg-231c2a2e.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 28d1264: feat(wasm): enhance toJsonWithReplacer to handle nested containers in replacer returned value
|
|
8
|
+
- 28d1264: fix(wasm): add toJSON to LoroText
|
|
9
|
+
|
|
10
|
+
Now all containers have toJSON method.
|
|
11
|
+
|
|
3
12
|
## 1.4.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/base64/index.js
CHANGED
|
@@ -4910,6 +4910,14 @@ class LoroText {
|
|
|
4910
4910
|
wasm.__wbindgen_export_5(deferred1_0, deferred1_1, 1);
|
|
4911
4911
|
}
|
|
4912
4912
|
}
|
|
4913
|
+
/**
|
|
4914
|
+
* Get the JSON representation of the text.
|
|
4915
|
+
* @returns {any}
|
|
4916
|
+
*/
|
|
4917
|
+
toJSON() {
|
|
4918
|
+
const ret = wasm.lorotext_toJSON(this.__wbg_ptr);
|
|
4919
|
+
return takeObject(ret);
|
|
4920
|
+
}
|
|
4913
4921
|
}
|
|
4914
4922
|
|
|
4915
4923
|
const LoroTreeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -6750,7 +6758,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6750
6758
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6751
6759
|
|
|
6752
6760
|
|
|
6753
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6761
|
+
import loro_wasm_bg_js from './loro_wasm_bg-ec1c7122.js';
|
|
6754
6762
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6755
6763
|
"./loro_wasm_bg.js": imports,
|
|
6756
6764
|
});
|
|
@@ -6908,10 +6916,12 @@ class Awareness {
|
|
|
6908
6916
|
}
|
|
6909
6917
|
}
|
|
6910
6918
|
LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
6919
|
+
const processed = new Set();
|
|
6911
6920
|
const doc = this;
|
|
6912
6921
|
const m = (key, value) => {
|
|
6913
6922
|
if (typeof value === "string") {
|
|
6914
|
-
if (isContainerId(value)) {
|
|
6923
|
+
if (isContainerId(value) && !processed.has(value)) {
|
|
6924
|
+
processed.add(value);
|
|
6915
6925
|
const container = doc.getContainerById(value);
|
|
6916
6926
|
if (container == null) {
|
|
6917
6927
|
throw new Error(`ContainerID not found: ${value}`);
|
|
@@ -6927,9 +6937,15 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6927
6937
|
if (isContainer(ans)) {
|
|
6928
6938
|
throw new Error("Using new container is not allowed in toJsonWithReplacer");
|
|
6929
6939
|
}
|
|
6940
|
+
if (typeof ans === "object" && ans != null) {
|
|
6941
|
+
return run(ans);
|
|
6942
|
+
}
|
|
6930
6943
|
return ans;
|
|
6931
6944
|
}
|
|
6932
6945
|
}
|
|
6946
|
+
if (typeof value === "object" && value != null) {
|
|
6947
|
+
return run(value);
|
|
6948
|
+
}
|
|
6933
6949
|
const ans = replacer(key, value);
|
|
6934
6950
|
if (isContainer(ans)) {
|
|
6935
6951
|
throw new Error("Using new container is not allowed in toJsonWithReplacer");
|
|
@@ -6951,7 +6967,7 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6951
6967
|
}
|
|
6952
6968
|
return result;
|
|
6953
6969
|
};
|
|
6954
|
-
const layer =
|
|
6970
|
+
const layer = doc.getShallowValue();
|
|
6955
6971
|
return run(layer);
|
|
6956
6972
|
};
|
|
6957
6973
|
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -3232,6 +3232,11 @@ export class LoroText {
|
|
|
3232
3232
|
*/
|
|
3233
3233
|
getShallowValue(): string;
|
|
3234
3234
|
/**
|
|
3235
|
+
* Get the JSON representation of the text.
|
|
3236
|
+
* @returns {any}
|
|
3237
|
+
*/
|
|
3238
|
+
toJSON(): any;
|
|
3239
|
+
/**
|
|
3235
3240
|
* Get the container id of the text.
|
|
3236
3241
|
*/
|
|
3237
3242
|
readonly id: ContainerID;
|