@loro-dev/streams-crdt 0.3.0 → 0.4.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/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@loro-dev/streams-crdt",
3
3
  "description": "Transport/runtime layer for synchronizing CRDT state over Durable Streams.",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "license": "MIT",
6
6
  "author": "Loro Team",
7
7
  "homepage": "https://streams.loro.dev",
8
8
  "bugs": {
9
- "url": "https://github.com/loro-dev/streams/issues"
9
+ "url": "https://github.com/loro-dev/loro-streams/issues"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/loro-dev/streams.git"
13
+ "url": "git+https://github.com/loro-dev/loro-streams.git"
14
14
  },
15
15
  "keywords": [
16
16
  "loro",
@@ -24,7 +24,8 @@
24
24
  "sideEffects": false,
25
25
  "files": [
26
26
  "dist",
27
- "README.md"
27
+ "README.md",
28
+ "LICENSE"
28
29
  ],
29
30
  "publishConfig": {
30
31
  "access": "public"
@@ -52,14 +53,10 @@
52
53
  "@loro-dev/streams-client": "workspace:*"
53
54
  },
54
55
  "peerDependencies": {
55
- "@bokuweb/zstd-wasm": "^0.0.27",
56
56
  "@loro-dev/flock-wasm": "^0.2.0",
57
57
  "loro-crdt": "^1.10.3"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
- "@bokuweb/zstd-wasm": {
61
- "optional": true
62
- },
63
60
  "@loro-dev/flock-wasm": {
64
61
  "optional": true
65
62
  },
@@ -76,7 +73,7 @@
76
73
  "tsdown": "^0.21.4"
77
74
  },
78
75
  "scripts": {
79
- "build": "tsdown",
76
+ "build": "tsdown && node scripts/copy-zstd-wasm.mjs",
80
77
  "prepack": "pnpm run build",
81
78
  "typecheck": "tsgo --project tsconfig.json",
82
79
  "test": "vitest run",
@@ -1,24 +0,0 @@
1
- //#region src/zstd-core.ts
2
- let modulePromise;
3
- async function loadZstdModule() {
4
- try {
5
- const mod = await import("@bokuweb/zstd-wasm");
6
- await mod.init();
7
- return mod;
8
- } catch (error) {
9
- throw new Error("Install \"@bokuweb/zstd-wasm\" to use \"@loro-dev/streams-crdt/zstd\".", { cause: error });
10
- }
11
- }
12
- async function getZstdModule() {
13
- return await (modulePromise ??= loadZstdModule());
14
- }
15
- async function compressInCurrentThread(snapshot) {
16
- return (await getZstdModule()).compress(snapshot);
17
- }
18
- async function decompressInCurrentThread(snapshot) {
19
- return (await getZstdModule()).decompress(snapshot);
20
- }
21
- //#endregion
22
- export { decompressInCurrentThread as n, compressInCurrentThread as t };
23
-
24
- //# sourceMappingURL=zstd-core-l_BzmODD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zstd-core-l_BzmODD.js","names":[],"sources":["../src/zstd-core.ts"],"sourcesContent":["type ZstdModule = {\n readonly init: (path?: string) => Promise<void>;\n readonly compress: (\n buffer: Uint8Array,\n compressionLevel?: number,\n ) => Uint8Array;\n readonly decompress: (buffer: Uint8Array) => Uint8Array;\n};\n\nlet modulePromise: Promise<ZstdModule> | undefined;\n\nasync function loadZstdModule(): Promise<ZstdModule> {\n try {\n const mod = (await import(\"@bokuweb/zstd-wasm\")) as ZstdModule;\n await mod.init();\n return mod;\n } catch (error) {\n throw new Error(\n 'Install \"@bokuweb/zstd-wasm\" to use \"@loro-dev/streams-crdt/zstd\".',\n { cause: error },\n );\n }\n}\n\nasync function getZstdModule(): Promise<ZstdModule> {\n return await (modulePromise ??= loadZstdModule());\n}\n\nexport async function compressInCurrentThread(\n snapshot: Uint8Array,\n): Promise<Uint8Array> {\n const zstd = await getZstdModule();\n return zstd.compress(snapshot);\n}\n\nexport async function decompressInCurrentThread(\n snapshot: Uint8Array,\n): Promise<Uint8Array> {\n const zstd = await getZstdModule();\n return zstd.decompress(snapshot);\n}\n"],"mappings":";AASA,IAAI;AAEJ,eAAe,iBAAsC;AACnD,KAAI;EACF,MAAM,MAAO,MAAM,OAAO;AAC1B,QAAM,IAAI,MAAM;AAChB,SAAO;UACA,OAAO;AACd,QAAM,IAAI,MACR,0EACA,EAAE,OAAO,OAAO,CACjB;;;AAIL,eAAe,gBAAqC;AAClD,QAAO,OAAO,kBAAkB,gBAAgB;;AAGlD,eAAsB,wBACpB,UACqB;AAErB,SADa,MAAM,eAAe,EACtB,SAAS,SAAS;;AAGhC,eAAsB,0BACpB,UACqB;AAErB,SADa,MAAM,eAAe,EACtB,WAAW,SAAS"}