lody 0.41.0 → 0.41.2-next.1
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/dist/chunks/index.node-CFS71Czb.js +737 -0
- package/dist/chunks/loro_wasm_bg-D64OTSr6.js +3840 -0
- package/dist/index.js +155776 -0
- package/package.json +10 -7
- package/dist/flock_wasm_bg.wasm +0 -0
- package/dist/index.cjs +0 -1167
- package/dist/loro_wasm_bg.wasm +0 -0
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
import { g as getDefaultExportFromCjs, __tla as __tla_0 } from "../index.js";
|
|
2
|
+
import fs__default from "fs/promises";
|
|
3
|
+
import path__default from "path";
|
|
4
|
+
let index_node$1;
|
|
5
|
+
let __tla = Promise.all([
|
|
6
|
+
(() => {
|
|
7
|
+
try {
|
|
8
|
+
return __tla_0;
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
})()
|
|
12
|
+
]).then(async () => {
|
|
13
|
+
function _mergeNamespaces(n, m) {
|
|
14
|
+
for (var i = 0; i < m.length; i++) {
|
|
15
|
+
const e = m[i];
|
|
16
|
+
if (typeof e !== "string" && !Array.isArray(e)) {
|
|
17
|
+
for (const k in e) {
|
|
18
|
+
if (k !== "default" && !(k in n)) {
|
|
19
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
if (d) {
|
|
21
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: () => e[k]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, {
|
|
31
|
+
value: "Module"
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
var index_node$2 = {};
|
|
35
|
+
var module$1 = {};
|
|
36
|
+
var zstd = {};
|
|
37
|
+
var hasRequiredZstd;
|
|
38
|
+
function requireZstd() {
|
|
39
|
+
if (hasRequiredZstd) return zstd;
|
|
40
|
+
hasRequiredZstd = 1;
|
|
41
|
+
Object.defineProperty(zstd, "__esModule", {
|
|
42
|
+
value: true
|
|
43
|
+
});
|
|
44
|
+
zstd.Module = void 0;
|
|
45
|
+
var Module = typeof Module !== "undefined" ? Module : {};
|
|
46
|
+
zstd.Module = Module;
|
|
47
|
+
var moduleOverrides = {};
|
|
48
|
+
var key;
|
|
49
|
+
for (key in Module) {
|
|
50
|
+
if (Module.hasOwnProperty(key)) {
|
|
51
|
+
moduleOverrides[key] = Module[key];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var err = Module["printErr"] || console.warn.bind(console);
|
|
55
|
+
for (key in moduleOverrides) {
|
|
56
|
+
if (moduleOverrides.hasOwnProperty(key)) {
|
|
57
|
+
Module[key] = moduleOverrides[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var quit_ = (status, toThrow) => {
|
|
61
|
+
throw toThrow;
|
|
62
|
+
};
|
|
63
|
+
moduleOverrides = null;
|
|
64
|
+
if (Module["arguments"]) Module["arguments"];
|
|
65
|
+
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
|
|
66
|
+
if (Module["quit"]) quit_ = Module["quit"];
|
|
67
|
+
if (typeof WebAssembly !== "object") {
|
|
68
|
+
abort("no native wasm support detected");
|
|
69
|
+
}
|
|
70
|
+
var wasmMemory;
|
|
71
|
+
var ABORT = false;
|
|
72
|
+
var EXITSTATUS;
|
|
73
|
+
var HEAPU8;
|
|
74
|
+
function updateMemoryViews() {
|
|
75
|
+
var b = wasmMemory.buffer;
|
|
76
|
+
Module["HEAP8"] = new Int8Array(b);
|
|
77
|
+
Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
|
|
78
|
+
}
|
|
79
|
+
var __ATPRERUN__ = [];
|
|
80
|
+
var __ATINIT__ = [];
|
|
81
|
+
var __ATPOSTRUN__ = [];
|
|
82
|
+
function preRun() {
|
|
83
|
+
if (Module["preRun"]) {
|
|
84
|
+
if (typeof Module["preRun"] == "function") Module["preRun"] = [
|
|
85
|
+
Module["preRun"]
|
|
86
|
+
];
|
|
87
|
+
while (Module["preRun"].length) {
|
|
88
|
+
addOnPreRun(Module["preRun"].shift());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
callRuntimeCallbacks(__ATPRERUN__);
|
|
92
|
+
}
|
|
93
|
+
function initRuntime() {
|
|
94
|
+
callRuntimeCallbacks(__ATINIT__);
|
|
95
|
+
}
|
|
96
|
+
function postRun() {
|
|
97
|
+
if (Module["postRun"]) {
|
|
98
|
+
if (typeof Module["postRun"] == "function") Module["postRun"] = [
|
|
99
|
+
Module["postRun"]
|
|
100
|
+
];
|
|
101
|
+
while (Module["postRun"].length) {
|
|
102
|
+
addOnPostRun(Module["postRun"].shift());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
callRuntimeCallbacks(__ATPOSTRUN__);
|
|
106
|
+
}
|
|
107
|
+
function addOnPreRun(cb) {
|
|
108
|
+
__ATPRERUN__.unshift(cb);
|
|
109
|
+
}
|
|
110
|
+
function addOnInit(cb) {
|
|
111
|
+
__ATINIT__.unshift(cb);
|
|
112
|
+
}
|
|
113
|
+
function addOnPostRun(cb) {
|
|
114
|
+
__ATPOSTRUN__.unshift(cb);
|
|
115
|
+
}
|
|
116
|
+
var runDependencies = 0;
|
|
117
|
+
var dependenciesFulfilled = null;
|
|
118
|
+
function addRunDependency(id) {
|
|
119
|
+
var _a;
|
|
120
|
+
runDependencies++;
|
|
121
|
+
(_a = Module["monitorRunDependencies"]) === null || _a === void 0 ? void 0 : _a.call(Module, runDependencies);
|
|
122
|
+
}
|
|
123
|
+
function removeRunDependency(id) {
|
|
124
|
+
var _a;
|
|
125
|
+
runDependencies--;
|
|
126
|
+
(_a = Module["monitorRunDependencies"]) === null || _a === void 0 ? void 0 : _a.call(Module, runDependencies);
|
|
127
|
+
if (runDependencies == 0) {
|
|
128
|
+
if (dependenciesFulfilled) {
|
|
129
|
+
var callback = dependenciesFulfilled;
|
|
130
|
+
dependenciesFulfilled = null;
|
|
131
|
+
callback();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function abort(what) {
|
|
136
|
+
var _a;
|
|
137
|
+
(_a = Module["onAbort"]) === null || _a === void 0 ? void 0 : _a.call(Module, what);
|
|
138
|
+
what = "Aborted(" + what + ")";
|
|
139
|
+
err(what);
|
|
140
|
+
ABORT = true;
|
|
141
|
+
what += ". Build with -sASSERTIONS for more info.";
|
|
142
|
+
var e = new WebAssembly.RuntimeError(what);
|
|
143
|
+
throw e;
|
|
144
|
+
}
|
|
145
|
+
function getWasmImports() {
|
|
146
|
+
return {
|
|
147
|
+
a: wasmImports
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function getBinaryPromise(url) {
|
|
151
|
+
return fetch(url, {
|
|
152
|
+
credentials: "same-origin"
|
|
153
|
+
}).then(function(response) {
|
|
154
|
+
if (!response["ok"]) {
|
|
155
|
+
throw "failed to load wasm binary file at '" + url + "'";
|
|
156
|
+
}
|
|
157
|
+
return response["arrayBuffer"]();
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function init(filePathOrBuf) {
|
|
161
|
+
var info = getWasmImports();
|
|
162
|
+
function receiveInstance(instance, module) {
|
|
163
|
+
wasmExports = instance.exports;
|
|
164
|
+
wasmMemory = wasmExports["f"];
|
|
165
|
+
updateMemoryViews();
|
|
166
|
+
addOnInit(wasmExports["g"]);
|
|
167
|
+
removeRunDependency();
|
|
168
|
+
return wasmExports;
|
|
169
|
+
}
|
|
170
|
+
addRunDependency();
|
|
171
|
+
function receiveInstantiationResult(result) {
|
|
172
|
+
receiveInstance(result["instance"]);
|
|
173
|
+
}
|
|
174
|
+
function instantiateArrayBuffer(receiver) {
|
|
175
|
+
return getBinaryPromise(filePathOrBuf).then(function(binary) {
|
|
176
|
+
var result = WebAssembly.instantiate(binary, info);
|
|
177
|
+
return result;
|
|
178
|
+
}).then(receiver, function(reason) {
|
|
179
|
+
err("failed to asynchronously prepare wasm: " + reason);
|
|
180
|
+
abort(reason);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function instantiateAsync() {
|
|
184
|
+
if (filePathOrBuf && filePathOrBuf.byteLength > 0) {
|
|
185
|
+
return WebAssembly.instantiate(filePathOrBuf, info).then(receiveInstantiationResult, function(reason) {
|
|
186
|
+
err("wasm compile failed: " + reason);
|
|
187
|
+
});
|
|
188
|
+
} else if (typeof WebAssembly.instantiateStreaming === "function" && typeof filePathOrBuf === "string" && typeof fetch === "function") {
|
|
189
|
+
return fetch(filePathOrBuf, {
|
|
190
|
+
credentials: "same-origin"
|
|
191
|
+
}).then(function(response) {
|
|
192
|
+
var result = WebAssembly.instantiateStreaming(response, info);
|
|
193
|
+
return result.then(receiveInstantiationResult, function(reason) {
|
|
194
|
+
err("wasm streaming compile failed: " + reason);
|
|
195
|
+
err("falling back to ArrayBuffer instantiation");
|
|
196
|
+
return instantiateArrayBuffer(receiveInstantiationResult);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
} else {
|
|
200
|
+
return instantiateArrayBuffer(receiveInstantiationResult);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (Module["instantiateWasm"]) {
|
|
204
|
+
try {
|
|
205
|
+
var exports$1 = Module["instantiateWasm"](info, receiveInstance);
|
|
206
|
+
return exports$1;
|
|
207
|
+
} catch (e) {
|
|
208
|
+
err("Module.instantiateWasm callback failed with error: " + e);
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
instantiateAsync();
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
class ExitStatus {
|
|
216
|
+
constructor(status) {
|
|
217
|
+
this.name = "ExitStatus";
|
|
218
|
+
this.message = `Program terminated with exit(${status})`;
|
|
219
|
+
this.status = status;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
var callRuntimeCallbacks = (callbacks) => {
|
|
223
|
+
while (callbacks.length > 0) {
|
|
224
|
+
callbacks.shift()(Module);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
228
|
+
var __abort_js = () => abort("");
|
|
229
|
+
var runtimeKeepaliveCounter = 0;
|
|
230
|
+
var __emscripten_runtime_keepalive_clear = () => {
|
|
231
|
+
noExitRuntime = false;
|
|
232
|
+
runtimeKeepaliveCounter = 0;
|
|
233
|
+
};
|
|
234
|
+
var timers = {};
|
|
235
|
+
var handleException = (e) => {
|
|
236
|
+
if (e instanceof ExitStatus || e == "unwind") {
|
|
237
|
+
return EXITSTATUS;
|
|
238
|
+
}
|
|
239
|
+
quit_(1, e);
|
|
240
|
+
};
|
|
241
|
+
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
242
|
+
var _proc_exit = (code) => {
|
|
243
|
+
var _a;
|
|
244
|
+
EXITSTATUS = code;
|
|
245
|
+
if (!keepRuntimeAlive()) {
|
|
246
|
+
(_a = Module["onExit"]) === null || _a === void 0 ? void 0 : _a.call(Module, code);
|
|
247
|
+
ABORT = true;
|
|
248
|
+
}
|
|
249
|
+
quit_(code, new ExitStatus(code));
|
|
250
|
+
};
|
|
251
|
+
var exitJS = (status, implicit) => {
|
|
252
|
+
EXITSTATUS = status;
|
|
253
|
+
_proc_exit(status);
|
|
254
|
+
};
|
|
255
|
+
var _exit = exitJS;
|
|
256
|
+
var maybeExit = () => {
|
|
257
|
+
if (!keepRuntimeAlive()) {
|
|
258
|
+
try {
|
|
259
|
+
_exit(EXITSTATUS);
|
|
260
|
+
} catch (e) {
|
|
261
|
+
handleException(e);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var callUserCallback = (func) => {
|
|
266
|
+
if (ABORT) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
func();
|
|
271
|
+
maybeExit();
|
|
272
|
+
} catch (e) {
|
|
273
|
+
handleException(e);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
var _emscripten_get_now = () => performance.now();
|
|
277
|
+
var __setitimer_js = (which, timeout_ms) => {
|
|
278
|
+
if (timers[which]) {
|
|
279
|
+
clearTimeout(timers[which].id);
|
|
280
|
+
delete timers[which];
|
|
281
|
+
}
|
|
282
|
+
if (!timeout_ms) return 0;
|
|
283
|
+
var id = setTimeout(() => {
|
|
284
|
+
delete timers[which];
|
|
285
|
+
callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now()));
|
|
286
|
+
}, timeout_ms);
|
|
287
|
+
timers[which] = {
|
|
288
|
+
id,
|
|
289
|
+
timeout_ms
|
|
290
|
+
};
|
|
291
|
+
return 0;
|
|
292
|
+
};
|
|
293
|
+
var getHeapMax = () => 2147483648;
|
|
294
|
+
var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
|
|
295
|
+
var growMemory = (size) => {
|
|
296
|
+
var b = wasmMemory.buffer;
|
|
297
|
+
var pages = (size - b.byteLength + 65535) / 65536 | 0;
|
|
298
|
+
try {
|
|
299
|
+
wasmMemory.grow(pages);
|
|
300
|
+
updateMemoryViews();
|
|
301
|
+
return 1;
|
|
302
|
+
} catch (e) {
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
var _emscripten_resize_heap = (requestedSize) => {
|
|
306
|
+
var oldSize = HEAPU8.length;
|
|
307
|
+
requestedSize >>>= 0;
|
|
308
|
+
var maxHeapSize = getHeapMax();
|
|
309
|
+
if (requestedSize > maxHeapSize) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
|
|
313
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
314
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
315
|
+
var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
316
|
+
var replacement = growMemory(newSize);
|
|
317
|
+
if (replacement) {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return false;
|
|
322
|
+
};
|
|
323
|
+
var wasmImports = {
|
|
324
|
+
c: __abort_js,
|
|
325
|
+
b: __emscripten_runtime_keepalive_clear,
|
|
326
|
+
d: __setitimer_js,
|
|
327
|
+
e: _emscripten_resize_heap,
|
|
328
|
+
a: _proc_exit
|
|
329
|
+
};
|
|
330
|
+
var wasmExports;
|
|
331
|
+
Module["_ZSTD_isError"] = (a0) => (Module["_ZSTD_isError"] = wasmExports["h"])(a0);
|
|
332
|
+
Module["_ZSTD_compressBound"] = (a0) => (Module["_ZSTD_compressBound"] = wasmExports["i"])(a0);
|
|
333
|
+
Module["_ZSTD_createCCtx"] = () => (Module["_ZSTD_createCCtx"] = wasmExports["j"])();
|
|
334
|
+
Module["_ZSTD_freeCCtx"] = (a0) => (Module["_ZSTD_freeCCtx"] = wasmExports["k"])(a0);
|
|
335
|
+
Module["_ZSTD_compress_usingDict"] = (a0, a1, a2, a3, a4, a5, a6, a7) => (Module["_ZSTD_compress_usingDict"] = wasmExports["l"])(a0, a1, a2, a3, a4, a5, a6, a7);
|
|
336
|
+
Module["_ZSTD_compress"] = (a0, a1, a2, a3, a4) => (Module["_ZSTD_compress"] = wasmExports["m"])(a0, a1, a2, a3, a4);
|
|
337
|
+
Module["_ZSTD_createDCtx"] = () => (Module["_ZSTD_createDCtx"] = wasmExports["n"])();
|
|
338
|
+
Module["_ZSTD_freeDCtx"] = (a0) => (Module["_ZSTD_freeDCtx"] = wasmExports["o"])(a0);
|
|
339
|
+
Module["_ZSTD_getFrameContentSize"] = (a0, a1) => (Module["_ZSTD_getFrameContentSize"] = wasmExports["p"])(a0, a1);
|
|
340
|
+
Module["_ZSTD_decompress_usingDict"] = (a0, a1, a2, a3, a4, a5, a6) => (Module["_ZSTD_decompress_usingDict"] = wasmExports["q"])(a0, a1, a2, a3, a4, a5, a6);
|
|
341
|
+
Module["_ZSTD_decompress"] = (a0, a1, a2, a3) => (Module["_ZSTD_decompress"] = wasmExports["r"])(a0, a1, a2, a3);
|
|
342
|
+
Module["_malloc"] = (a0) => (Module["_malloc"] = wasmExports["s"])(a0);
|
|
343
|
+
Module["_free"] = (a0) => (Module["_free"] = wasmExports["t"])(a0);
|
|
344
|
+
var __emscripten_timeout = (a0, a1) => (__emscripten_timeout = wasmExports["v"])(a0, a1);
|
|
345
|
+
var calledRun;
|
|
346
|
+
dependenciesFulfilled = function runCaller() {
|
|
347
|
+
if (!calledRun) run();
|
|
348
|
+
if (!calledRun) dependenciesFulfilled = runCaller;
|
|
349
|
+
};
|
|
350
|
+
function run() {
|
|
351
|
+
if (runDependencies > 0) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
preRun();
|
|
355
|
+
if (runDependencies > 0) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
function doRun() {
|
|
359
|
+
var _a;
|
|
360
|
+
if (calledRun) return;
|
|
361
|
+
calledRun = true;
|
|
362
|
+
Module["calledRun"] = true;
|
|
363
|
+
if (ABORT) return;
|
|
364
|
+
initRuntime();
|
|
365
|
+
(_a = Module["onRuntimeInitialized"]) === null || _a === void 0 ? void 0 : _a.call(Module);
|
|
366
|
+
postRun();
|
|
367
|
+
}
|
|
368
|
+
if (Module["setStatus"]) {
|
|
369
|
+
Module["setStatus"]("Running...");
|
|
370
|
+
setTimeout(() => {
|
|
371
|
+
setTimeout(() => Module["setStatus"](""), 1);
|
|
372
|
+
doRun();
|
|
373
|
+
}, 1);
|
|
374
|
+
} else {
|
|
375
|
+
doRun();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
Module["run"] = run;
|
|
379
|
+
if (Module["preInit"]) {
|
|
380
|
+
if (typeof Module["preInit"] == "function") Module["preInit"] = [
|
|
381
|
+
Module["preInit"]
|
|
382
|
+
];
|
|
383
|
+
while (Module["preInit"].length > 0) {
|
|
384
|
+
Module["preInit"].pop()();
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
Module["init"] = init;
|
|
388
|
+
return zstd;
|
|
389
|
+
}
|
|
390
|
+
var hasRequiredModule;
|
|
391
|
+
function requireModule() {
|
|
392
|
+
if (hasRequiredModule) return module$1;
|
|
393
|
+
hasRequiredModule = 1;
|
|
394
|
+
(function(exports$1) {
|
|
395
|
+
var __awaiter = module$1 && module$1.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
396
|
+
function adopt(value) {
|
|
397
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
398
|
+
resolve(value);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
402
|
+
function fulfilled(value) {
|
|
403
|
+
try {
|
|
404
|
+
step(generator.next(value));
|
|
405
|
+
} catch (e) {
|
|
406
|
+
reject(e);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function rejected(value) {
|
|
410
|
+
try {
|
|
411
|
+
step(generator["throw"](value));
|
|
412
|
+
} catch (e) {
|
|
413
|
+
reject(e);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function step(result) {
|
|
417
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
418
|
+
}
|
|
419
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
423
|
+
value: true
|
|
424
|
+
});
|
|
425
|
+
exports$1.Module = exports$1.waitInitialized = void 0;
|
|
426
|
+
const zstd_1 = requireZstd();
|
|
427
|
+
Object.defineProperty(exports$1, "Module", {
|
|
428
|
+
enumerable: true,
|
|
429
|
+
get: function() {
|
|
430
|
+
return zstd_1.Module;
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
const initialized = (() => new Promise((resolve) => {
|
|
434
|
+
zstd_1.Module.onRuntimeInitialized = resolve;
|
|
435
|
+
}))();
|
|
436
|
+
const waitInitialized = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
437
|
+
yield initialized;
|
|
438
|
+
});
|
|
439
|
+
exports$1.waitInitialized = waitInitialized;
|
|
440
|
+
})(module$1);
|
|
441
|
+
return module$1;
|
|
442
|
+
}
|
|
443
|
+
var decompress = {};
|
|
444
|
+
var errors = {};
|
|
445
|
+
var hasRequiredErrors;
|
|
446
|
+
function requireErrors() {
|
|
447
|
+
if (hasRequiredErrors) return errors;
|
|
448
|
+
hasRequiredErrors = 1;
|
|
449
|
+
Object.defineProperty(errors, "__esModule", {
|
|
450
|
+
value: true
|
|
451
|
+
});
|
|
452
|
+
errors.isError = void 0;
|
|
453
|
+
const module_1 = requireModule();
|
|
454
|
+
const isError = (code) => {
|
|
455
|
+
const _isError = module_1.Module["_ZSTD_isError"];
|
|
456
|
+
return _isError(code);
|
|
457
|
+
};
|
|
458
|
+
errors.isError = isError;
|
|
459
|
+
return errors;
|
|
460
|
+
}
|
|
461
|
+
var hasRequiredDecompress;
|
|
462
|
+
function requireDecompress() {
|
|
463
|
+
if (hasRequiredDecompress) return decompress;
|
|
464
|
+
hasRequiredDecompress = 1;
|
|
465
|
+
Object.defineProperty(decompress, "__esModule", {
|
|
466
|
+
value: true
|
|
467
|
+
});
|
|
468
|
+
decompress.decompress = void 0;
|
|
469
|
+
const module_1 = requireModule();
|
|
470
|
+
const errors_1 = requireErrors();
|
|
471
|
+
const getFrameContentSize = (src, size) => {
|
|
472
|
+
const getSize = module_1.Module["_ZSTD_getFrameContentSize"];
|
|
473
|
+
return getSize(src, size);
|
|
474
|
+
};
|
|
475
|
+
const decompress$1 = (buf, opts = {
|
|
476
|
+
defaultHeapSize: 1024 * 1024
|
|
477
|
+
}) => {
|
|
478
|
+
const malloc = module_1.Module["_malloc"];
|
|
479
|
+
const src = malloc(buf.byteLength);
|
|
480
|
+
module_1.Module.HEAP8.set(buf, src);
|
|
481
|
+
const contentSize = getFrameContentSize(src, buf.byteLength);
|
|
482
|
+
const size = contentSize === -1 ? opts.defaultHeapSize : contentSize;
|
|
483
|
+
const free = module_1.Module["_free"];
|
|
484
|
+
const heap = malloc(size);
|
|
485
|
+
try {
|
|
486
|
+
const _decompress = module_1.Module["_ZSTD_decompress"];
|
|
487
|
+
const sizeOrError = _decompress(heap, size, src, buf.byteLength);
|
|
488
|
+
if ((0, errors_1.isError)(sizeOrError)) {
|
|
489
|
+
throw new Error(`Failed to compress with code ${sizeOrError}`);
|
|
490
|
+
}
|
|
491
|
+
const data = new Uint8Array(module_1.Module.HEAPU8.buffer, heap, sizeOrError).slice();
|
|
492
|
+
free(heap, size);
|
|
493
|
+
free(src, buf.byteLength);
|
|
494
|
+
return data;
|
|
495
|
+
} catch (e) {
|
|
496
|
+
free(heap, size);
|
|
497
|
+
free(src, buf.byteLength);
|
|
498
|
+
throw e;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
decompress.decompress = decompress$1;
|
|
502
|
+
return decompress;
|
|
503
|
+
}
|
|
504
|
+
var compress = {};
|
|
505
|
+
var hasRequiredCompress;
|
|
506
|
+
function requireCompress() {
|
|
507
|
+
if (hasRequiredCompress) return compress;
|
|
508
|
+
hasRequiredCompress = 1;
|
|
509
|
+
Object.defineProperty(compress, "__esModule", {
|
|
510
|
+
value: true
|
|
511
|
+
});
|
|
512
|
+
compress.compress = void 0;
|
|
513
|
+
const module_1 = requireModule();
|
|
514
|
+
const errors_1 = requireErrors();
|
|
515
|
+
const compressBound = (size) => {
|
|
516
|
+
const bound = module_1.Module["_ZSTD_compressBound"];
|
|
517
|
+
return bound(size);
|
|
518
|
+
};
|
|
519
|
+
const compress$1 = (buf, level) => {
|
|
520
|
+
const bound = compressBound(buf.byteLength);
|
|
521
|
+
const malloc = module_1.Module["_malloc"];
|
|
522
|
+
const compressed = malloc(bound);
|
|
523
|
+
const src = malloc(buf.byteLength);
|
|
524
|
+
module_1.Module.HEAP8.set(buf, src);
|
|
525
|
+
const free = module_1.Module["_free"];
|
|
526
|
+
try {
|
|
527
|
+
const _compress = module_1.Module["_ZSTD_compress"];
|
|
528
|
+
const sizeOrError = _compress(compressed, bound, src, buf.byteLength, level !== null && level !== void 0 ? level : 3);
|
|
529
|
+
if ((0, errors_1.isError)(sizeOrError)) {
|
|
530
|
+
throw new Error(`Failed to compress with code ${sizeOrError}`);
|
|
531
|
+
}
|
|
532
|
+
const data = new Uint8Array(module_1.Module.HEAPU8.buffer, compressed, sizeOrError).slice();
|
|
533
|
+
free(compressed, bound);
|
|
534
|
+
free(src, buf.byteLength);
|
|
535
|
+
return data;
|
|
536
|
+
} catch (e) {
|
|
537
|
+
free(compressed, bound);
|
|
538
|
+
free(src, buf.byteLength);
|
|
539
|
+
throw e;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
compress.compress = compress$1;
|
|
543
|
+
return compress;
|
|
544
|
+
}
|
|
545
|
+
var decompress_using_dict = {};
|
|
546
|
+
var hasRequiredDecompress_using_dict;
|
|
547
|
+
function requireDecompress_using_dict() {
|
|
548
|
+
if (hasRequiredDecompress_using_dict) return decompress_using_dict;
|
|
549
|
+
hasRequiredDecompress_using_dict = 1;
|
|
550
|
+
Object.defineProperty(decompress_using_dict, "__esModule", {
|
|
551
|
+
value: true
|
|
552
|
+
});
|
|
553
|
+
decompress_using_dict.decompressUsingDict = decompress_using_dict.freeDCtx = decompress_using_dict.createDCtx = void 0;
|
|
554
|
+
const module_1 = requireModule();
|
|
555
|
+
const errors_1 = requireErrors();
|
|
556
|
+
const getFrameContentSize = (src, size) => {
|
|
557
|
+
const getSize = module_1.Module["_ZSTD_getFrameContentSize"];
|
|
558
|
+
return getSize(src, size);
|
|
559
|
+
};
|
|
560
|
+
const createDCtx = () => {
|
|
561
|
+
return module_1.Module["_ZSTD_createDCtx"]();
|
|
562
|
+
};
|
|
563
|
+
decompress_using_dict.createDCtx = createDCtx;
|
|
564
|
+
const freeDCtx = (dctx) => {
|
|
565
|
+
return module_1.Module["_ZSTD_freeDCtx"](dctx);
|
|
566
|
+
};
|
|
567
|
+
decompress_using_dict.freeDCtx = freeDCtx;
|
|
568
|
+
const decompressUsingDict = (dctx, buf, dict, opts = {
|
|
569
|
+
defaultHeapSize: 1024 * 1024
|
|
570
|
+
}) => {
|
|
571
|
+
const malloc = module_1.Module["_malloc"];
|
|
572
|
+
const src = malloc(buf.byteLength);
|
|
573
|
+
module_1.Module.HEAP8.set(buf, src);
|
|
574
|
+
const pdict = malloc(dict.byteLength);
|
|
575
|
+
module_1.Module.HEAP8.set(dict, pdict);
|
|
576
|
+
const contentSize = getFrameContentSize(src, buf.byteLength);
|
|
577
|
+
const size = contentSize === -1 ? opts.defaultHeapSize : contentSize;
|
|
578
|
+
const free = module_1.Module["_free"];
|
|
579
|
+
const heap = malloc(size);
|
|
580
|
+
try {
|
|
581
|
+
const _decompress = module_1.Module["_ZSTD_decompress_usingDict"];
|
|
582
|
+
const sizeOrError = _decompress(dctx, heap, size, src, buf.byteLength, pdict, dict.byteLength);
|
|
583
|
+
if ((0, errors_1.isError)(sizeOrError)) {
|
|
584
|
+
throw new Error(`Failed to compress with code ${sizeOrError}`);
|
|
585
|
+
}
|
|
586
|
+
const data = new Uint8Array(module_1.Module.HEAPU8.buffer, heap, sizeOrError).slice();
|
|
587
|
+
free(heap, size);
|
|
588
|
+
free(src, buf.byteLength);
|
|
589
|
+
free(pdict, dict.byteLength);
|
|
590
|
+
return data;
|
|
591
|
+
} catch (e) {
|
|
592
|
+
free(heap, size);
|
|
593
|
+
free(src, buf.byteLength);
|
|
594
|
+
free(pdict, dict.byteLength);
|
|
595
|
+
throw e;
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
decompress_using_dict.decompressUsingDict = decompressUsingDict;
|
|
599
|
+
return decompress_using_dict;
|
|
600
|
+
}
|
|
601
|
+
var compress_using_dict = {};
|
|
602
|
+
var hasRequiredCompress_using_dict;
|
|
603
|
+
function requireCompress_using_dict() {
|
|
604
|
+
if (hasRequiredCompress_using_dict) return compress_using_dict;
|
|
605
|
+
hasRequiredCompress_using_dict = 1;
|
|
606
|
+
Object.defineProperty(compress_using_dict, "__esModule", {
|
|
607
|
+
value: true
|
|
608
|
+
});
|
|
609
|
+
compress_using_dict.compressUsingDict = compress_using_dict.freeCCtx = compress_using_dict.createCCtx = void 0;
|
|
610
|
+
const module_1 = requireModule();
|
|
611
|
+
const errors_1 = requireErrors();
|
|
612
|
+
const compressBound = (size) => {
|
|
613
|
+
const bound = module_1.Module["_ZSTD_compressBound"];
|
|
614
|
+
return bound(size);
|
|
615
|
+
};
|
|
616
|
+
const createCCtx = () => {
|
|
617
|
+
return module_1.Module["_ZSTD_createCCtx"]();
|
|
618
|
+
};
|
|
619
|
+
compress_using_dict.createCCtx = createCCtx;
|
|
620
|
+
const freeCCtx = (cctx) => {
|
|
621
|
+
return module_1.Module["_ZSTD_freeCCtx"](cctx);
|
|
622
|
+
};
|
|
623
|
+
compress_using_dict.freeCCtx = freeCCtx;
|
|
624
|
+
const compressUsingDict = (cctx, buf, dict, level) => {
|
|
625
|
+
const bound = compressBound(buf.byteLength);
|
|
626
|
+
const malloc = module_1.Module["_malloc"];
|
|
627
|
+
const compressed = malloc(bound);
|
|
628
|
+
const src = malloc(buf.byteLength);
|
|
629
|
+
module_1.Module.HEAP8.set(buf, src);
|
|
630
|
+
const pdict = malloc(dict.byteLength);
|
|
631
|
+
module_1.Module.HEAP8.set(dict, pdict);
|
|
632
|
+
const free = module_1.Module["_free"];
|
|
633
|
+
try {
|
|
634
|
+
const _compress = module_1.Module["_ZSTD_compress_usingDict"];
|
|
635
|
+
const sizeOrError = _compress(cctx, compressed, bound, src, buf.byteLength, pdict, dict.byteLength, level !== null && level !== void 0 ? level : 3);
|
|
636
|
+
if ((0, errors_1.isError)(sizeOrError)) {
|
|
637
|
+
throw new Error(`Failed to compress with code ${sizeOrError}`);
|
|
638
|
+
}
|
|
639
|
+
const data = new Uint8Array(module_1.Module.HEAPU8.buffer, compressed, sizeOrError).slice();
|
|
640
|
+
free(compressed, bound);
|
|
641
|
+
free(src, buf.byteLength);
|
|
642
|
+
free(pdict, dict.byteLength);
|
|
643
|
+
return data;
|
|
644
|
+
} catch (e) {
|
|
645
|
+
free(compressed, bound);
|
|
646
|
+
free(src, buf.byteLength);
|
|
647
|
+
free(pdict, dict.byteLength);
|
|
648
|
+
throw e;
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
compress_using_dict.compressUsingDict = compressUsingDict;
|
|
652
|
+
return compress_using_dict;
|
|
653
|
+
}
|
|
654
|
+
var hasRequiredIndex_node;
|
|
655
|
+
function requireIndex_node() {
|
|
656
|
+
if (hasRequiredIndex_node) return index_node$2;
|
|
657
|
+
hasRequiredIndex_node = 1;
|
|
658
|
+
(function(exports$1) {
|
|
659
|
+
var __createBinding = index_node$2 && index_node$2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
660
|
+
if (k2 === void 0) k2 = k;
|
|
661
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
662
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
663
|
+
desc = {
|
|
664
|
+
enumerable: true,
|
|
665
|
+
get: function() {
|
|
666
|
+
return m[k];
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
Object.defineProperty(o, k2, desc);
|
|
671
|
+
}) : (function(o, m, k, k2) {
|
|
672
|
+
if (k2 === void 0) k2 = k;
|
|
673
|
+
o[k2] = m[k];
|
|
674
|
+
}));
|
|
675
|
+
var __exportStar = index_node$2 && index_node$2.__exportStar || function(m, exports$12) {
|
|
676
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
|
|
677
|
+
};
|
|
678
|
+
var __awaiter = index_node$2 && index_node$2.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
679
|
+
function adopt(value) {
|
|
680
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
681
|
+
resolve(value);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
685
|
+
function fulfilled(value) {
|
|
686
|
+
try {
|
|
687
|
+
step(generator.next(value));
|
|
688
|
+
} catch (e) {
|
|
689
|
+
reject(e);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
function rejected(value) {
|
|
693
|
+
try {
|
|
694
|
+
step(generator["throw"](value));
|
|
695
|
+
} catch (e) {
|
|
696
|
+
reject(e);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function step(result) {
|
|
700
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
701
|
+
}
|
|
702
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
703
|
+
});
|
|
704
|
+
};
|
|
705
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
706
|
+
value: true
|
|
707
|
+
});
|
|
708
|
+
exports$1.init = void 0;
|
|
709
|
+
const module_1 = requireModule();
|
|
710
|
+
const init = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
711
|
+
const { readFile } = fs__default;
|
|
712
|
+
const { resolve } = path__default;
|
|
713
|
+
const buf = yield readFile(resolve(__dirname, "./zstd.wasm"));
|
|
714
|
+
module_1.Module["init"](buf);
|
|
715
|
+
yield (0, module_1.waitInitialized)();
|
|
716
|
+
});
|
|
717
|
+
exports$1.init = init;
|
|
718
|
+
__exportStar(requireDecompress(), exports$1);
|
|
719
|
+
__exportStar(requireCompress(), exports$1);
|
|
720
|
+
__exportStar(requireDecompress_using_dict(), exports$1);
|
|
721
|
+
__exportStar(requireCompress_using_dict(), exports$1);
|
|
722
|
+
})(index_node$2);
|
|
723
|
+
return index_node$2;
|
|
724
|
+
}
|
|
725
|
+
var index_nodeExports = requireIndex_node();
|
|
726
|
+
const index_node = getDefaultExportFromCjs(index_nodeExports);
|
|
727
|
+
index_node$1 = _mergeNamespaces({
|
|
728
|
+
__proto__: null,
|
|
729
|
+
default: index_node
|
|
730
|
+
}, [
|
|
731
|
+
index_nodeExports
|
|
732
|
+
]);
|
|
733
|
+
});
|
|
734
|
+
export {
|
|
735
|
+
__tla,
|
|
736
|
+
index_node$1 as i
|
|
737
|
+
};
|