@palbase/web 4.0.0 → 4.0.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/index.d.cts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "4.0.0";
209
+ declare const VERSION = "4.0.1";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "4.0.0";
209
+ declare const VERSION = "4.0.1";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ import {
13
13
  localStorageSessionStorage,
14
14
  memorySessionStorage,
15
15
  pb
16
- } from "./chunk-NP4NIY7A.js";
17
- import "./chunk-S7NAY3MW.js";
16
+ } from "./chunk-TGDS6VMT.js";
17
+ import "./chunk-NXEPAEF5.js";
18
+ import "./chunk-PZ5AY32C.js";
18
19
  export {
19
20
  BackendError,
20
21
  PalbeAnalytics,
package/dist/internal.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/internal.ts
@@ -6457,31 +6467,29 @@ function date_now() {
6457
6467
  }
6458
6468
 
6459
6469
  // src/messaging/wasm/loader.ts
6460
- var import_meta = {};
6461
6470
  var GLUE_MODULE = "./palbe_mls_bg.js";
6462
6471
  var SNIPPET_MODULE = "./snippets/mls-rs-core-f99cdecbb456b09c/inline0.js";
6463
6472
  var inflight = null;
6464
6473
  var ready = null;
6465
- async function loadWasmModule() {
6466
- const wasmUrl = new URL("./pkg/palbe_mls_bg.wasm", import_meta.url);
6467
- if (wasmUrl.protocol === "file:") {
6468
- const fsSpecifier = ["node", "fs/promises"].join(":");
6469
- const { readFile } = await import(
6470
- /* webpackIgnore: true */
6471
- fsSpecifier
6472
- );
6473
- const bytes = await readFile(wasmUrl);
6474
- return WebAssembly.compile(bytes);
6474
+ function decodeBase64(encoded) {
6475
+ if (typeof encoded !== "string" || encoded.length === 0 || typeof globalThis.atob !== "function") {
6476
+ throw new Error("palbe-mls WASM asset is invalid");
6475
6477
  }
6476
- const response = await fetch(wasmUrl);
6477
- if (typeof WebAssembly.compileStreaming === "function") {
6478
- try {
6479
- return await WebAssembly.compileStreaming(Promise.resolve(response));
6480
- } catch {
6481
- }
6478
+ let binary;
6479
+ try {
6480
+ binary = globalThis.atob(encoded);
6481
+ } catch {
6482
+ throw new Error("palbe-mls WASM asset is invalid");
6483
+ }
6484
+ const bytes = new Uint8Array(binary.length);
6485
+ for (let index = 0; index < binary.length; index += 1) {
6486
+ bytes[index] = binary.charCodeAt(index);
6482
6487
  }
6483
- const buffer = await response.arrayBuffer();
6484
- return WebAssembly.compile(buffer);
6488
+ return bytes.buffer;
6489
+ }
6490
+ async function loadWasmModule() {
6491
+ const asset = await import("#palbase-mls-wasm");
6492
+ return WebAssembly.compile(decodeBase64(asset.default));
6485
6493
  }
6486
6494
  function buildImports() {
6487
6495
  return {
@@ -6492,7 +6500,7 @@ function buildImports() {
6492
6500
  function initMls() {
6493
6501
  if (ready) return Promise.resolve(ready);
6494
6502
  if (inflight) return inflight;
6495
- inflight = (async () => {
6503
+ const attempt = (async () => {
6496
6504
  const module2 = await loadWasmModule();
6497
6505
  const instance = await WebAssembly.instantiate(module2, buildImports());
6498
6506
  const setWasm = __wbg_set_wasm;
@@ -6511,7 +6519,11 @@ function initMls() {
6511
6519
  ready = g;
6512
6520
  return g;
6513
6521
  })();
6514
- return inflight;
6522
+ inflight = attempt;
6523
+ void attempt.catch(() => {
6524
+ if (inflight === attempt) inflight = null;
6525
+ });
6526
+ return attempt;
6515
6527
  }
6516
6528
  function requireMls() {
6517
6529
  if (!ready) {
@@ -8964,7 +8976,7 @@ function defaultSessionStorage(key) {
8964
8976
  }
8965
8977
 
8966
8978
  // src/version.ts
8967
- var VERSION = "4.0.0";
8979
+ var VERSION = "4.0.1";
8968
8980
 
8969
8981
  // src/runtime.ts
8970
8982
  function buildRuntime(config) {