@omote/core 0.2.2 → 0.2.3

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.js CHANGED
@@ -29016,6 +29016,25 @@ async function isWebGPUAvailable() {
29016
29016
  return false;
29017
29017
  }
29018
29018
  }
29019
+ var iosWasmPatched = false;
29020
+ function applyIOSWasmMemoryPatch() {
29021
+ if (iosWasmPatched || !isIOS()) return;
29022
+ iosWasmPatched = true;
29023
+ const OrigMemory = WebAssembly.Memory;
29024
+ const MAX_IOS_PAGES = 16384;
29025
+ logger.info("Applying iOS WASM memory patch (shared\u2192false, max\u21921GB)");
29026
+ WebAssembly.Memory = function IOSPatchedMemory(descriptor) {
29027
+ const patched = { ...descriptor };
29028
+ if (patched.shared) {
29029
+ patched.shared = false;
29030
+ }
29031
+ if (patched.maximum !== void 0 && patched.maximum > MAX_IOS_PAGES) {
29032
+ patched.maximum = MAX_IOS_PAGES;
29033
+ }
29034
+ return new OrigMemory(patched);
29035
+ };
29036
+ WebAssembly.Memory.prototype = OrigMemory.prototype;
29037
+ }
29019
29038
  function configureWasm(ort) {
29020
29039
  ort.env.wasm.wasmPaths = WASM_CDN_PATH;
29021
29040
  const numThreads = getOptimalWasmThreads();
@@ -29041,6 +29060,7 @@ async function getOnnxRuntime(backend) {
29041
29060
  return ortInstance;
29042
29061
  }
29043
29062
  logger.info(`Loading ONNX Runtime with ${backend} backend...`);
29063
+ applyIOSWasmMemoryPatch();
29044
29064
  try {
29045
29065
  if (backend === "wasm") {
29046
29066
  const module2 = await import("onnxruntime-web");