Doc: loro-crdt documents in comments (#165)

* doc: wasm

* doc: add wasm example

* doc: typedoc

* fix: merge

* fix: dep

* fix

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
This commit is contained in:
Leon zhao 2023-11-10 20:30:54 +08:00 committed by GitHub
parent 90079b2f1c
commit 7d2826cfe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1671 additions and 1022 deletions

View file

@ -3,3 +3,4 @@ npm/
nodejs/
bundler/
web/
docs/

79
crates/loro-wasm/package-lock.json generated Normal file
View file

@ -0,0 +1,79 @@
{
"name": "loro-wasm",
"version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "loro-wasm",
"version": "0.3.0",
"license": "ISC",
"devDependencies": {
"vite-plugin-top-level-await": "^1.2.2",
"vite-plugin-wasm": "^3.1.0"
}
},
"../../node_modules/.pnpm/vite-plugin-top-level-await@1.3.0_vite@4.5.0/node_modules/vite-plugin-top-level-await": {
"version": "1.3.0",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/plugin-virtual": "^3.0.1",
"@swc/core": "^1.3.10",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"@types/uuid": "^9.0.0",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.15.12",
"jest": "^29.2.1",
"jest-extended": "^3.1.0",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4",
"vite": "^3.1.8"
},
"peerDependencies": {
"vite": ">=2.8"
}
},
"../../node_modules/.pnpm/vite-plugin-wasm@3.2.2_vite@4.5.0/node_modules/vite-plugin-wasm": {
"version": "3.2.2",
"dev": true,
"license": "MIT",
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@jest/types": "^28.1.3",
"@jsona/openapi": "^0.2.5",
"@syntect/wasm": "^0.0.4",
"@types/express": "^4.17.13",
"@types/jest": "^28.1.5",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.15.12",
"express": "^4.18.1",
"jest": "^28.1.3",
"jest-extended": "^3.0.1",
"playwright": "^1.23.3",
"prettier": "^2.7.1",
"terser": "^5.14.2",
"ts-jest": "^28.0.7",
"typescript": "^4.7.4",
"vite": "^4.1.4",
"wait-port": "^1.0.4"
},
"peerDependencies": {
"vite": "^2 || ^3 || ^4"
}
},
"node_modules/vite-plugin-top-level-await": {
"resolved": "../../node_modules/.pnpm/vite-plugin-top-level-await@1.3.0_vite@4.5.0/node_modules/vite-plugin-top-level-await",
"link": true
},
"node_modules/vite-plugin-wasm": {
"resolved": "../../node_modules/.pnpm/vite-plugin-wasm@3.2.2_vite@4.5.0/node_modules/vite-plugin-wasm",
"link": true
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -2,306 +2,14 @@
# yarn lockfile v1
"@esbuild/android-arm@0.15.18":
version "0.15.18"
resolved "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.15.18.tgz#266d40b8fdcf87962df8af05b76219bc786b4f80"
integrity sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==
"@esbuild/linux-loong64@0.15.18":
version "0.15.18"
resolved "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz#128b76ecb9be48b60cf5cfc1c63a4f00691a3239"
integrity sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==
"@swc/core-darwin-arm64@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.22.tgz#296db00b567d7fab0fc438eccc7334b53d54e2f2"
integrity sha512-MMhtPsuXp8gpUgr9bs+RZQ2IyFGiUNDG93usCDAFgAF+6VVp+YaAVjET/3/Bx5Lk2WAt0RxT62C9KTEw1YMo3w==
"@swc/core-darwin-x64@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.22.tgz#3922972fccaa8c42e5bb1ec3f784e88b884bc3c7"
integrity sha512-SG6QbNat4GZ5VJU3Zo6a54oQOtbhJVE6BCQw4JjOCZJmAeBzNebGy9wsT4+fCJNHC3C5qtaRw7ToXJvLniXwfg==
"@swc/core-linux-arm-gnueabihf@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.22.tgz#5484415986e6c498f295b73c0d9dffb777237ca6"
integrity sha512-4E+TdQT1oHnHjDaPs/DyrRy9lOuFd6ncEd67yYA4j9lFqt6nuz/jnXss45k8KU7wR5kOTtdW73xPwkU4NbOWdw==
"@swc/core-linux-arm64-gnu@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.22.tgz#951406151966225e4082cc643aa202f18f6d0bcf"
integrity sha512-6VcynOMbOBcbLutIPENI3Ejvg5LGz/Pwvzm25hM0FoiEtPxHA+tawQUwLx8Alk1Yr+Rnqid06UEZ0veJOGn2pQ==
"@swc/core-linux-arm64-musl@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.22.tgz#1f63fa7e3e61b00f9102e49f60520377491b61d6"
integrity sha512-86RxGy0L3qa4De3xWHx8vL2caTxvSLSWTlgUW/Yd4l1pvrCFibMjhkImGu5ViKiReX9DlBtJ7CBs4dln2kHidw==
"@swc/core-linux-x64-gnu@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.22.tgz#64a38d253c7cdc8944980fa1f8cb3b6fc260afd1"
integrity sha512-FLkbiqsdXsVIFZi6iedx4rSBGX8x0vo/5aDlklSxJAAYOcQpO0QADKP5Yr65iMT1d6ABCt2d+/StpGLF7GWOcA==
"@swc/core-linux-x64-musl@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.22.tgz#33f6abf28cc26eba1979e488776e006a09285463"
integrity sha512-giBuw+Z0Bq6fpZ0Y5TcfpcQwf9p/cE1fOQyO/K1XSTn/haQOqFi7421Jq/dFThSARZiXw1u9Om9VFbwxr8VI+A==
"@swc/core-win32-arm64-msvc@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.22.tgz#4b5a05157d5d442866d543090a52b2a9624766bc"
integrity sha512-loKGO+ZM2By6VdrmVJk1G79jVgDPaee93qLFuis5KyeoLLb4m1MlNMc/6SIDZUSuYg6NqaGP1spFeiFetMQ4Zg==
"@swc/core-win32-ia32-msvc@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.22.tgz#ec067667b7a665ef3b4fe97c3aa4c1d15e3a496d"
integrity sha512-lvNWAZ3QjXMsrsch6oLLQVikT/hC/4ZcLrTBXa14HwQylaYigkGElgp3ekJr78HjWDPwB46GXwBbNMG0VNAfvA==
"@swc/core-win32-x64-msvc@1.3.22":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.22.tgz#fb820b1aa03605363d141c9656d966a25000790f"
integrity sha512-ESyn4lZXAKEE3mcTaDfXatsolCiEfVGstsXdgBmZYa6o1IE1bDW8FE7Ob/Y+82WTpm9+A9ZYXYjZ62t67POHZg==
"@swc/core@^1.3.10":
version "1.3.22"
resolved "https://registry.npmmirror.com/@swc/core/-/core-1.3.22.tgz#2b631f7b54d6e11eb2e8ae505bca1dbbc6fb7160"
integrity sha512-oQ9EPEb7NgWcGIDoVfLCuffvtC4MzVtrwjqwKzFHP8FUh1fn8+2wraOjkkDXW74BB4Hgve5ykkaHix9bebB9Ww==
optionalDependencies:
"@swc/core-darwin-arm64" "1.3.22"
"@swc/core-darwin-x64" "1.3.22"
"@swc/core-linux-arm-gnueabihf" "1.3.22"
"@swc/core-linux-arm64-gnu" "1.3.22"
"@swc/core-linux-arm64-musl" "1.3.22"
"@swc/core-linux-x64-gnu" "1.3.22"
"@swc/core-linux-x64-musl" "1.3.22"
"@swc/core-win32-arm64-msvc" "1.3.22"
"@swc/core-win32-ia32-msvc" "1.3.22"
"@swc/core-win32-x64-msvc" "1.3.22"
esbuild-android-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz#20a7ae1416c8eaade917fb2453c1259302c637a5"
integrity sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==
esbuild-android-arm64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz#9cc0ec60581d6ad267568f29cf4895ffdd9f2f04"
integrity sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==
esbuild-darwin-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz#428e1730ea819d500808f220fbc5207aea6d4410"
integrity sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==
esbuild-darwin-arm64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz#b6dfc7799115a2917f35970bfbc93ae50256b337"
integrity sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==
esbuild-freebsd-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz#4e190d9c2d1e67164619ae30a438be87d5eedaf2"
integrity sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==
esbuild-freebsd-arm64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz#18a4c0344ee23bd5a6d06d18c76e2fd6d3f91635"
integrity sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==
esbuild-linux-32@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz#9a329731ee079b12262b793fb84eea762e82e0ce"
integrity sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==
esbuild-linux-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz#532738075397b994467b514e524aeb520c191b6c"
integrity sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==
esbuild-linux-arm64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz#5372e7993ac2da8f06b2ba313710d722b7a86e5d"
integrity sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==
esbuild-linux-arm@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz#e734aaf259a2e3d109d4886c9e81ec0f2fd9a9cc"
integrity sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==
esbuild-linux-mips64le@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz#c0487c14a9371a84eb08fab0e1d7b045a77105eb"
integrity sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==
esbuild-linux-ppc64le@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz#af048ad94eed0ce32f6d5a873f7abe9115012507"
integrity sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==
esbuild-linux-riscv64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz#423ed4e5927bd77f842bd566972178f424d455e6"
integrity sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==
esbuild-linux-s390x@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz#21d21eaa962a183bfb76312e5a01cc5ae48ce8eb"
integrity sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==
esbuild-netbsd-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz#ae75682f60d08560b1fe9482bfe0173e5110b998"
integrity sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==
esbuild-openbsd-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz#79591a90aa3b03e4863f93beec0d2bab2853d0a8"
integrity sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==
esbuild-sunos-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz#fd528aa5da5374b7e1e93d36ef9b07c3dfed2971"
integrity sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==
esbuild-windows-32@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz#0e92b66ecdf5435a76813c4bc5ccda0696f4efc3"
integrity sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==
esbuild-windows-64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz#0fc761d785414284fc408e7914226d33f82420d0"
integrity sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==
esbuild-windows-arm64@0.15.18:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz#5b5bdc56d341d0922ee94965c89ee120a6a86eb7"
integrity sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==
esbuild@^0.15.9:
version "0.15.18"
resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.15.18.tgz#ea894adaf3fbc036d32320a00d4d6e4978a2f36d"
integrity sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==
optionalDependencies:
"@esbuild/android-arm" "0.15.18"
"@esbuild/linux-loong64" "0.15.18"
esbuild-android-64 "0.15.18"
esbuild-android-arm64 "0.15.18"
esbuild-darwin-64 "0.15.18"
esbuild-darwin-arm64 "0.15.18"
esbuild-freebsd-64 "0.15.18"
esbuild-freebsd-arm64 "0.15.18"
esbuild-linux-32 "0.15.18"
esbuild-linux-64 "0.15.18"
esbuild-linux-arm "0.15.18"
esbuild-linux-arm64 "0.15.18"
esbuild-linux-mips64le "0.15.18"
esbuild-linux-ppc64le "0.15.18"
esbuild-linux-riscv64 "0.15.18"
esbuild-linux-s390x "0.15.18"
esbuild-netbsd-64 "0.15.18"
esbuild-openbsd-64 "0.15.18"
esbuild-sunos-64 "0.15.18"
esbuild-windows-32 "0.15.18"
esbuild-windows-64 "0.15.18"
esbuild-windows-arm64 "0.15.18"
fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
has@^1.0.3:
version "1.0.3"
resolved "https://registry.npmmirror.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
dependencies:
function-bind "^1.1.1"
is-core-module@^2.9.0:
version "2.11.0"
resolved "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==
dependencies:
has "^1.0.3"
nanoid@^3.3.4:
version "3.3.4"
resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
path-parse@^1.0.7:
version "1.0.7"
resolved "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
postcss@^8.4.18:
version "8.4.20"
resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56"
integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==
dependencies:
nanoid "^3.3.4"
picocolors "^1.0.0"
source-map-js "^1.0.2"
resolve@^1.22.1:
version "1.22.1"
resolved "https://registry.npmmirror.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==
dependencies:
is-core-module "^2.9.0"
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"
rollup@^2.79.1:
version "2.79.1"
resolved "https://registry.npmmirror.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7"
integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==
optionalDependencies:
fsevents "~2.3.2"
source-map-js@^1.0.2:
version "1.0.2"
resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
supports-preserve-symlinks-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
vite-plugin-top-level-await@^1.2.2:
version "1.2.2"
resolved "https://registry.npmmirror.com/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.2.2.tgz#11d33d3423ce9d5aebdedf62a9033cb0c91cfd85"
integrity sha512-JBuY9X5KCxZyzwQUOIBpgX0Jbe2BECxwElWPeyrdRC5xaWzDibTG65QBW25COmwqHBeVlV04u8GTlJkuOWhfgw==
version "1.3.0"
resolved "file:../../node_modules/.pnpm/vite-plugin-top-level-await@1.3.0_vite@4.5.0/node_modules/vite-plugin-top-level-await"
dependencies:
"@rollup/plugin-virtual" "^3.0.1"
"@swc/core" "^1.3.10"
uuid "^9.0.0"
vite-plugin-wasm@^3.1.0:
version "3.1.0"
resolved "https://registry.npmmirror.com/vite-plugin-wasm/-/vite-plugin-wasm-3.1.0.tgz#44095059f3c7137b7babe6afc2f96eb4d6d6e950"
integrity sha512-RzqOR+zMqqNZOhplq7XM9bkFNfW/Cs1VVj7p+aAdOznCBGwxYLqqzLGxuRwTV31HOGtDGjA8nvgcZG3GwmeVZQ==
dependencies:
vite "^3"
vite@^3:
version "3.2.5"
resolved "https://registry.npmmirror.com/vite/-/vite-3.2.5.tgz#dee5678172a8a0ab3e547ad4148c3d547f90e86a"
integrity sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==
dependencies:
esbuild "^0.15.9"
postcss "^8.4.18"
resolve "^1.22.1"
rollup "^2.79.1"
optionalDependencies:
fsevents "~2.3.2"
version "3.2.2"
resolved "file:../../node_modules/.pnpm/vite-plugin-wasm@3.2.2_vite@4.5.0/node_modules/vite-plugin-wasm"

1
loro-js/.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules/
dist/
docs/

View file

@ -1,8 +1,7 @@
export * from "loro-wasm";
import { Delta, PrelimMap } from "loro-wasm";
import { PrelimText } from "loro-wasm";
import { PrelimList } from "loro-wasm";
import { ContainerID, Loro, LoroList, LoroMap, LoroText } from "loro-wasm";
import { Delta } from "loro-wasm";
import { PrelimText,PrelimList,PrelimMap } from "loro-wasm";
import { ContainerID, Loro, LoroList, LoroMap, LoroText , LoroTree, TreeID} from "loro-wasm";
Loro.prototype.getTypedMap = function (...args) {
return this.getMap(...args);
@ -33,22 +32,39 @@ LoroMap.prototype.setTyped = function (...args) {
return this.set(...args);
};
/**
* Data types supported by loro
*/
export type Value =
| ContainerID
| string
| number
| boolean
| null
| { [key: string]: Value }
| Uint8Array
| Value[];
export type Prelim = PrelimList | PrelimMap | PrelimText;
/**
* Represents a path to identify the exact location of an event's target.
* The path is composed of numbers (e.g., indices of a list container) and strings
* (e.g., keys of a map container), indicating the absolute position of the event's source
* within a loro document.
*/
export type Path = (number | string)[];
/**
* The event of Loro.
* @prop local - Indicates whether the event is local.
* @prop origin - (Optional) Provides information about the origin of the event.
* @prop diff - Contains the differential information related to the event.
* @prop target - Identifies the container ID of the event's target.
* @prop path - Specifies the absolute path of the event's emitter, which can be an index of a list container or a key of a map container.
*/
export interface LoroEvent {
/**
* If true, this event was triggered by a local change.
*/
local: boolean;
origin?: string;
/**
@ -64,10 +80,6 @@ export interface LoroEvent {
path: Path;
}
export type Path = (number | string)[];
export type Diff = ListDiff | TextDiff | MapDiff;
export type ListDiff = {
type: "list";
diff: Delta<Value[]>[];
@ -83,11 +95,18 @@ export type MapDiff = {
updated: Record<string, Value | undefined>;
};
export type TreeDiff = {
type: "tree";
diff: {target: TreeID, action: "create"|"delete" } | {target: TreeID; action:"move"; parent: TreeID};
}
export type Diff = ListDiff | TextDiff | MapDiff | TreeDiff;
interface Listener {
(event: LoroEvent): void;
}
const CONTAINER_TYPES = ["Map", "Text", "List"];
const CONTAINER_TYPES = ["Map", "Text", "List", "Tree"];
export function isContainerId(s: string): s is ContainerID {
return s.startsWith("cid:");
@ -113,6 +132,7 @@ declare module "loro-wasm" {
insertContainer(pos: number, container: "Map"): LoroMap;
insertContainer(pos: number, container: "List"): LoroList;
insertContainer(pos: number, container: "Text"): LoroText;
insertContainer(pos: number, container: "Tree"): LoroTree;
insertContainer(pos: number, container: string): never;
get(index: number): Value;
@ -127,6 +147,7 @@ declare module "loro-wasm" {
setContainer(key: string, container_type: "Map"): LoroMap;
setContainer(key: string, container_type: "List"): LoroList;
setContainer(key: string, container_type: "Text"): LoroText;
setContainer(key: string, container_type: "Tree"): LoroTree;
setContainer(key: string, container_type: string): never;
get(key: string): Value;

View file

@ -4,5 +4,5 @@ import { defineConfig } from "vite";
export default defineConfig({
plugins: [wasm()],
test: {},
// test: {},
});

File diff suppressed because it is too large Load diff