@rive-app/canvas 2.23.0 → 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/canvas",
3
- "version": "2.23.0",
3
+ "version": "2.23.2",
4
4
  "description": "Rive's canvas 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
@@ -746,7 +746,7 @@ function Ya(a, b) {
746
746
  return Xa(c, a, b);
747
747
  }));
748
748
  }
749
- var Za, $a, db = {438828:(a, b, c, d, e) => {
749
+ var Za, $a, db = {441740:(a, b, c, d, e) => {
750
750
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
751
751
  return 0;
752
752
  }
@@ -809,9 +809,9 @@ var Za, $a, db = {438828:(a, b, c, d, e) => {
809
809
  }
810
810
  window.h.Aa += 1;
811
811
  return 1;
812
- }, 441006:() => {
812
+ }, 443918:() => {
813
813
  "undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
814
- }, 441170:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 441274:() => {
814
+ }, 444082:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 444186:() => {
815
815
  try {
816
816
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
817
817
  a.close();
@@ -819,7 +819,7 @@ var Za, $a, db = {438828:(a, b, c, d, e) => {
819
819
  } catch (c) {
820
820
  return 0;
821
821
  }
822
- }, 441445:(a, b, c, d, e, f) => {
822
+ }, 444357:(a, b, c, d, e, f) => {
823
823
  if ("undefined" === typeof window.h) {
824
824
  return -1;
825
825
  }
@@ -865,7 +865,7 @@ var Za, $a, db = {438828:(a, b, c, d, e) => {
865
865
  a == window.h.I.ya && g.Z.connect(g.J.destination);
866
866
  g.pb = f;
867
867
  return window.h.yc(g);
868
- }, 444322:a => window.h.ra(a).J.sampleRate, 444395:a => {
868
+ }, 447234:a => window.h.ra(a).J.sampleRate, 447307:a => {
869
869
  a = window.h.ra(a);
870
870
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
871
871
  }, a.Z.disconnect(), a.Z = void 0);
@@ -873,13 +873,13 @@ var Za, $a, db = {438828:(a, b, c, d, e) => {
873
873
  a.J.close();
874
874
  a.J = void 0;
875
875
  a.pb = void 0;
876
- }, 444795:a => {
876
+ }, 447707:a => {
877
877
  window.h.Cb(a);
878
- }, 444845:a => {
878
+ }, 447757:a => {
879
879
  a = window.h.ra(a);
880
880
  a.J.resume();
881
881
  a.state = window.h.ga.xb;
882
- }, 444984:a => {
882
+ }, 447896:a => {
883
883
  a = window.h.ra(a);
884
884
  a.J.suspend();
885
885
  a.state = window.h.ga.stopped;
@@ -3365,7 +3365,7 @@ $d();
3365
3365
  /* 2 */
3366
3366
  /***/ ((module) => {
3367
3367
 
3368
- module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.23.0","description":"Rive\'s canvas 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.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3368
+ module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.23.2","description":"Rive\'s canvas 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.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3369
3369
 
3370
3370
  /***/ }),
3371
3371
  /* 3 */
@@ -4030,20 +4030,44 @@ var RuntimeLoader = /** @class */ (function () {
4030
4030
  (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
4031
4031
  }
4032
4032
  })
4033
- .catch(function () {
4033
+ .catch(function (error) {
4034
+ // Capture specific error details
4035
+ var errorDetails = {
4036
+ message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
4037
+ type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
4038
+ // Some browsers may provide additional WebAssembly-specific details
4039
+ wasmError: error instanceof WebAssembly.CompileError ||
4040
+ error instanceof WebAssembly.RuntimeError,
4041
+ originalError: error,
4042
+ };
4043
+ // Log detailed error for debugging
4044
+ console.debug("Rive WASM load error details:", errorDetails);
4034
4045
  // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
4035
4046
  // This `rive_fallback.wasm` is compiled to support older architecture.
4036
4047
  // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
4037
4048
  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");
4038
4049
  if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
4039
- console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
4050
+ console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
4040
4051
  RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
4041
4052
  RuntimeLoader.loadRuntime();
4042
4053
  }
4043
4054
  else {
4044
- console.error("Could not load Rive WASM file from unpkg or jsdelivr, network connection may be down, or \
4045
- you may need to call set a new WASM source via RuntimeLoader.setWasmUrl() and call \
4046
- RuntimeLoader.loadRuntime() again");
4055
+ var errorMessage = [
4056
+ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
4057
+ "Possible reasons:",
4058
+ "- Network connection is down",
4059
+ "- WebAssembly is not supported in this environment",
4060
+ "- The WASM file is corrupted or incompatible",
4061
+ "\nError details:",
4062
+ "- Type: ".concat(errorDetails.type),
4063
+ "- Message: ".concat(errorDetails.message),
4064
+ "- WebAssembly-specific error: ".concat(errorDetails.wasmError),
4065
+ "\nTo resolve, you may need to:",
4066
+ "1. Check your network connection",
4067
+ "2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
4068
+ "3. Call RuntimeLoader.loadRuntime() again",
4069
+ ].join("\n");
4070
+ console.error(errorMessage);
4047
4071
  }
4048
4072
  });
4049
4073
  };
@@ -4071,6 +4095,10 @@ var RuntimeLoader = /** @class */ (function () {
4071
4095
  RuntimeLoader.setWasmUrl = function (url) {
4072
4096
  RuntimeLoader.wasmURL = url;
4073
4097
  };
4098
+ // Gets the current wasm url
4099
+ RuntimeLoader.getWasmUrl = function () {
4100
+ return RuntimeLoader.wasmURL;
4101
+ };
4074
4102
  // Flag to indicate that loading has started/completed
4075
4103
  RuntimeLoader.isLoading = false;
4076
4104
  // List of callbacks for the runtime that come in while loading