hyperdb-wasm 0.0.26313-dev.wasm.g630768ec → 0.0.26314-dev.wasm.g698c9427
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/browser.d.ts +14 -0
- package/dist/browser.js +32 -1
- package/dist/node.js +32 -1
- package/dist/raw.browser.js +30 -0
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -13,6 +13,20 @@ export interface BrowserClientOptions {
|
|
|
13
13
|
readonly wasmUrl?: string | URL;
|
|
14
14
|
readonly onSetupProgress?: (progress: SetupProgress) => void;
|
|
15
15
|
}
|
|
16
|
+
type BrowserEnvironment = {
|
|
17
|
+
readonly WebAssembly?: typeof WebAssembly;
|
|
18
|
+
readonly Worker?: unknown;
|
|
19
|
+
readonly SharedArrayBuffer?: unknown;
|
|
20
|
+
readonly Atomics?: unknown;
|
|
21
|
+
readonly BigInt?: unknown;
|
|
22
|
+
readonly crossOriginIsolated?: boolean;
|
|
23
|
+
readonly navigator?: {
|
|
24
|
+
readonly storage?: {
|
|
25
|
+
readonly getDirectory?: unknown;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function assertBrowserSupport(environment?: BrowserEnvironment): void;
|
|
16
30
|
export declare class BrowserWorker implements WorkerTransport {
|
|
17
31
|
private readonly worker;
|
|
18
32
|
constructor(worker: BrowserWorkerLike);
|
package/dist/browser.js
CHANGED
|
@@ -200,9 +200,36 @@ var init_client = __esm({
|
|
|
200
200
|
var browser_exports = {};
|
|
201
201
|
__export(browser_exports, {
|
|
202
202
|
BrowserWorker: () => BrowserWorker,
|
|
203
|
+
assertBrowserSupport: () => assertBrowserSupport,
|
|
203
204
|
createBrowserClient: () => createBrowserClient,
|
|
204
205
|
resolveBrowserWorkerUrl: () => resolveBrowserWorkerUrl
|
|
205
206
|
});
|
|
207
|
+
function assertBrowserSupport(environment = globalThis) {
|
|
208
|
+
if (typeof environment.WebAssembly?.validate !== "function") {
|
|
209
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly");
|
|
210
|
+
}
|
|
211
|
+
if (!environment.WebAssembly.validate(memory64Probe)) {
|
|
212
|
+
throw new Error("HyperDB cannot initialize because this browser does not yet support WebAssembly memory64. Support for platforms such as iOS is coming soon.");
|
|
213
|
+
}
|
|
214
|
+
if (typeof environment.BigInt !== "function") {
|
|
215
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly BigInt integration");
|
|
216
|
+
}
|
|
217
|
+
if (!environment.WebAssembly.validate(threadsProbe) || typeof environment.SharedArrayBuffer !== "function" || typeof environment.Atomics !== "object") {
|
|
218
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly threads");
|
|
219
|
+
}
|
|
220
|
+
if (!environment.WebAssembly.validate(exceptionsProbe)) {
|
|
221
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly exception handling");
|
|
222
|
+
}
|
|
223
|
+
if (typeof environment.Worker !== "function") {
|
|
224
|
+
throw new Error("HyperDB cannot initialize because this browser does not support Web Workers");
|
|
225
|
+
}
|
|
226
|
+
if (environment.crossOriginIsolated !== true) {
|
|
227
|
+
throw new Error("HyperDB cannot initialize because this page is not cross-origin isolated");
|
|
228
|
+
}
|
|
229
|
+
if (typeof environment.navigator?.storage?.getDirectory !== "function") {
|
|
230
|
+
throw new Error("HyperDB cannot initialize because this browser does not support the origin-private file system");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
206
233
|
function resolveBrowserWorkerUrl(workerUrl, engineUrl, wasmUrl) {
|
|
207
234
|
const resolved = new URL(workerUrl);
|
|
208
235
|
resolved.searchParams.set("engineUrl", new URL(engineUrl).href);
|
|
@@ -210,6 +237,7 @@ function resolveBrowserWorkerUrl(workerUrl, engineUrl, wasmUrl) {
|
|
|
210
237
|
return resolved;
|
|
211
238
|
}
|
|
212
239
|
function createBrowserClient(options = {}) {
|
|
240
|
+
assertBrowserSupport();
|
|
213
241
|
const workerUrl = options.workerUrl ?? new URL("./browser_worker.js", import.meta.url);
|
|
214
242
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
215
243
|
return new HyperDBEngineClient(
|
|
@@ -217,11 +245,14 @@ function createBrowserClient(options = {}) {
|
|
|
217
245
|
options.onSetupProgress
|
|
218
246
|
);
|
|
219
247
|
}
|
|
220
|
-
var BrowserWorker;
|
|
248
|
+
var memory64Probe, threadsProbe, exceptionsProbe, BrowserWorker;
|
|
221
249
|
var init_browser = __esm({
|
|
222
250
|
"src/browser.ts"() {
|
|
223
251
|
"use strict";
|
|
224
252
|
init_client();
|
|
253
|
+
memory64Probe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 4, 1]);
|
|
254
|
+
threadsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 4, 1, 3, 1, 1]);
|
|
255
|
+
exceptionsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 13, 3, 1, 0, 0]);
|
|
225
256
|
BrowserWorker = class {
|
|
226
257
|
constructor(worker) {
|
|
227
258
|
this.worker = worker;
|
package/dist/node.js
CHANGED
|
@@ -200,9 +200,36 @@ var init_client = __esm({
|
|
|
200
200
|
var browser_exports = {};
|
|
201
201
|
__export(browser_exports, {
|
|
202
202
|
BrowserWorker: () => BrowserWorker,
|
|
203
|
+
assertBrowserSupport: () => assertBrowserSupport,
|
|
203
204
|
createBrowserClient: () => createBrowserClient,
|
|
204
205
|
resolveBrowserWorkerUrl: () => resolveBrowserWorkerUrl
|
|
205
206
|
});
|
|
207
|
+
function assertBrowserSupport(environment = globalThis) {
|
|
208
|
+
if (typeof environment.WebAssembly?.validate !== "function") {
|
|
209
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly");
|
|
210
|
+
}
|
|
211
|
+
if (!environment.WebAssembly.validate(memory64Probe)) {
|
|
212
|
+
throw new Error("HyperDB cannot initialize because this browser does not yet support WebAssembly memory64. Support for platforms such as iOS is coming soon.");
|
|
213
|
+
}
|
|
214
|
+
if (typeof environment.BigInt !== "function") {
|
|
215
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly BigInt integration");
|
|
216
|
+
}
|
|
217
|
+
if (!environment.WebAssembly.validate(threadsProbe) || typeof environment.SharedArrayBuffer !== "function" || typeof environment.Atomics !== "object") {
|
|
218
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly threads");
|
|
219
|
+
}
|
|
220
|
+
if (!environment.WebAssembly.validate(exceptionsProbe)) {
|
|
221
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly exception handling");
|
|
222
|
+
}
|
|
223
|
+
if (typeof environment.Worker !== "function") {
|
|
224
|
+
throw new Error("HyperDB cannot initialize because this browser does not support Web Workers");
|
|
225
|
+
}
|
|
226
|
+
if (environment.crossOriginIsolated !== true) {
|
|
227
|
+
throw new Error("HyperDB cannot initialize because this page is not cross-origin isolated");
|
|
228
|
+
}
|
|
229
|
+
if (typeof environment.navigator?.storage?.getDirectory !== "function") {
|
|
230
|
+
throw new Error("HyperDB cannot initialize because this browser does not support the origin-private file system");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
206
233
|
function resolveBrowserWorkerUrl(workerUrl, engineUrl, wasmUrl) {
|
|
207
234
|
const resolved = new URL(workerUrl);
|
|
208
235
|
resolved.searchParams.set("engineUrl", new URL(engineUrl).href);
|
|
@@ -210,6 +237,7 @@ function resolveBrowserWorkerUrl(workerUrl, engineUrl, wasmUrl) {
|
|
|
210
237
|
return resolved;
|
|
211
238
|
}
|
|
212
239
|
function createBrowserClient(options = {}) {
|
|
240
|
+
assertBrowserSupport();
|
|
213
241
|
const workerUrl = options.workerUrl ?? new URL("./browser_worker.js", import.meta.url);
|
|
214
242
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
215
243
|
return new HyperDBEngineClient(
|
|
@@ -217,11 +245,14 @@ function createBrowserClient(options = {}) {
|
|
|
217
245
|
options.onSetupProgress
|
|
218
246
|
);
|
|
219
247
|
}
|
|
220
|
-
var BrowserWorker;
|
|
248
|
+
var memory64Probe, threadsProbe, exceptionsProbe, BrowserWorker;
|
|
221
249
|
var init_browser = __esm({
|
|
222
250
|
"src/browser.ts"() {
|
|
223
251
|
"use strict";
|
|
224
252
|
init_client();
|
|
253
|
+
memory64Probe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 4, 1]);
|
|
254
|
+
threadsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 4, 1, 3, 1, 1]);
|
|
255
|
+
exceptionsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 13, 3, 1, 0, 0]);
|
|
225
256
|
BrowserWorker = class {
|
|
226
257
|
constructor(worker) {
|
|
227
258
|
this.worker = worker;
|
package/dist/raw.browser.js
CHANGED
|
@@ -319,6 +319,35 @@ var HyperDBBindings = class {
|
|
|
319
319
|
};
|
|
320
320
|
|
|
321
321
|
// src/browser.ts
|
|
322
|
+
var memory64Probe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 3, 1, 4, 1]);
|
|
323
|
+
var threadsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 5, 4, 1, 3, 1, 1]);
|
|
324
|
+
var exceptionsProbe = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 13, 3, 1, 0, 0]);
|
|
325
|
+
function assertBrowserSupport(environment = globalThis) {
|
|
326
|
+
if (typeof environment.WebAssembly?.validate !== "function") {
|
|
327
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly");
|
|
328
|
+
}
|
|
329
|
+
if (!environment.WebAssembly.validate(memory64Probe)) {
|
|
330
|
+
throw new Error("HyperDB cannot initialize because this browser does not yet support WebAssembly memory64. Support for platforms such as iOS is coming soon.");
|
|
331
|
+
}
|
|
332
|
+
if (typeof environment.BigInt !== "function") {
|
|
333
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly BigInt integration");
|
|
334
|
+
}
|
|
335
|
+
if (!environment.WebAssembly.validate(threadsProbe) || typeof environment.SharedArrayBuffer !== "function" || typeof environment.Atomics !== "object") {
|
|
336
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly threads");
|
|
337
|
+
}
|
|
338
|
+
if (!environment.WebAssembly.validate(exceptionsProbe)) {
|
|
339
|
+
throw new Error("HyperDB cannot initialize because this browser does not support WebAssembly exception handling");
|
|
340
|
+
}
|
|
341
|
+
if (typeof environment.Worker !== "function") {
|
|
342
|
+
throw new Error("HyperDB cannot initialize because this browser does not support Web Workers");
|
|
343
|
+
}
|
|
344
|
+
if (environment.crossOriginIsolated !== true) {
|
|
345
|
+
throw new Error("HyperDB cannot initialize because this page is not cross-origin isolated");
|
|
346
|
+
}
|
|
347
|
+
if (typeof environment.navigator?.storage?.getDirectory !== "function") {
|
|
348
|
+
throw new Error("HyperDB cannot initialize because this browser does not support the origin-private file system");
|
|
349
|
+
}
|
|
350
|
+
}
|
|
322
351
|
var BrowserWorker = class {
|
|
323
352
|
constructor(worker) {
|
|
324
353
|
this.worker = worker;
|
|
@@ -351,6 +380,7 @@ function resolveBrowserWorkerUrl(workerUrl, engineUrl, wasmUrl) {
|
|
|
351
380
|
return resolved;
|
|
352
381
|
}
|
|
353
382
|
function createBrowserClient(options = {}) {
|
|
383
|
+
assertBrowserSupport();
|
|
354
384
|
const workerUrl = options.workerUrl ?? new URL("./browser_worker.js", import.meta.url);
|
|
355
385
|
const engineUrl = options.engineUrl ?? new URL("./hyperdb-wasm.js", import.meta.url);
|
|
356
386
|
return new HyperDBEngineClient(
|