@rive-app/webgl 2.23.1 → 2.23.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl",
3
- "version": "2.23.1",
3
+ "version": "2.23.2",
4
4
  "description": "Rive's webgl based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -73,6 +73,7 @@ export declare class RuntimeLoader {
73
73
  static getInstance(callback: RuntimeCallback): void;
74
74
  static awaitInstance(): Promise<rc.RiveCanvas>;
75
75
  static setWasmUrl(url: string): void;
76
+ static getWasmUrl(): string;
76
77
  }
77
78
  export declare enum StateMachineInputType {
78
79
  Number = 56,
package/rive.js CHANGED
@@ -4061,7 +4061,7 @@ Je();
4061
4061
  /* 2 */
4062
4062
  /***/ ((module) => {
4063
4063
 
4064
- module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.23.1","description":"Rive\'s webgl based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4064
+ module.exports = JSON.parse('{"name":"@rive-app/webgl","version":"2.23.2","description":"Rive\'s webgl based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4065
4065
 
4066
4066
  /***/ }),
4067
4067
  /* 3 */
@@ -4726,20 +4726,44 @@ var RuntimeLoader = /** @class */ (function () {
4726
4726
  (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
4727
4727
  }
4728
4728
  })
4729
- .catch(function () {
4729
+ .catch(function (error) {
4730
+ // Capture specific error details
4731
+ var errorDetails = {
4732
+ message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
4733
+ type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
4734
+ // Some browsers may provide additional WebAssembly-specific details
4735
+ wasmError: error instanceof WebAssembly.CompileError ||
4736
+ error instanceof WebAssembly.RuntimeError,
4737
+ originalError: error,
4738
+ };
4739
+ // Log detailed error for debugging
4740
+ console.debug("Rive WASM load error details:", errorDetails);
4730
4741
  // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
4731
4742
  // This `rive_fallback.wasm` is compiled to support older architecture.
4732
4743
  // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
4733
4744
  var backupJsdelivrUrl = "https://cdn.jsdelivr.net/npm/".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, "/rive_fallback.wasm");
4734
4745
  if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
4735
- console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
4746
+ console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
4736
4747
  RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
4737
4748
  RuntimeLoader.loadRuntime();
4738
4749
  }
4739
4750
  else {
4740
- console.error("Could not load Rive WASM file from unpkg or jsdelivr, network connection may be down, or \
4741
- you may need to call set a new WASM source via RuntimeLoader.setWasmUrl() and call \
4742
- RuntimeLoader.loadRuntime() again");
4751
+ var errorMessage = [
4752
+ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
4753
+ "Possible reasons:",
4754
+ "- Network connection is down",
4755
+ "- WebAssembly is not supported in this environment",
4756
+ "- The WASM file is corrupted or incompatible",
4757
+ "\nError details:",
4758
+ "- Type: ".concat(errorDetails.type),
4759
+ "- Message: ".concat(errorDetails.message),
4760
+ "- WebAssembly-specific error: ".concat(errorDetails.wasmError),
4761
+ "\nTo resolve, you may need to:",
4762
+ "1. Check your network connection",
4763
+ "2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
4764
+ "3. Call RuntimeLoader.loadRuntime() again",
4765
+ ].join("\n");
4766
+ console.error(errorMessage);
4743
4767
  }
4744
4768
  });
4745
4769
  };
@@ -4767,6 +4791,10 @@ var RuntimeLoader = /** @class */ (function () {
4767
4791
  RuntimeLoader.setWasmUrl = function (url) {
4768
4792
  RuntimeLoader.wasmURL = url;
4769
4793
  };
4794
+ // Gets the current wasm url
4795
+ RuntimeLoader.getWasmUrl = function () {
4796
+ return RuntimeLoader.wasmURL;
4797
+ };
4770
4798
  // Flag to indicate that loading has started/completed
4771
4799
  RuntimeLoader.isLoading = false;
4772
4800
  // List of callbacks for the runtime that come in while loading