@rive-app/canvas-lite 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/canvas-lite",
3
- "version": "2.23.1",
3
+ "version": "2.23.2",
4
4
  "description": "A lite version of 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
@@ -2269,7 +2269,7 @@ Qc();
2269
2269
  /* 2 */
2270
2270
  /***/ ((module) => {
2271
2271
 
2272
- module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.23.1","description":"A lite version of 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}}');
2272
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.23.2","description":"A lite version of 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}}');
2273
2273
 
2274
2274
  /***/ }),
2275
2275
  /* 3 */
@@ -2934,20 +2934,44 @@ var RuntimeLoader = /** @class */ (function () {
2934
2934
  (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
2935
2935
  }
2936
2936
  })
2937
- .catch(function () {
2937
+ .catch(function (error) {
2938
+ // Capture specific error details
2939
+ var errorDetails = {
2940
+ message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
2941
+ type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
2942
+ // Some browsers may provide additional WebAssembly-specific details
2943
+ wasmError: error instanceof WebAssembly.CompileError ||
2944
+ error instanceof WebAssembly.RuntimeError,
2945
+ originalError: error,
2946
+ };
2947
+ // Log detailed error for debugging
2948
+ console.debug("Rive WASM load error details:", errorDetails);
2938
2949
  // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
2939
2950
  // This `rive_fallback.wasm` is compiled to support older architecture.
2940
2951
  // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
2941
2952
  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");
2942
2953
  if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
2943
- console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
2954
+ console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
2944
2955
  RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
2945
2956
  RuntimeLoader.loadRuntime();
2946
2957
  }
2947
2958
  else {
2948
- console.error("Could not load Rive WASM file from unpkg or jsdelivr, network connection may be down, or \
2949
- you may need to call set a new WASM source via RuntimeLoader.setWasmUrl() and call \
2950
- RuntimeLoader.loadRuntime() again");
2959
+ var errorMessage = [
2960
+ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
2961
+ "Possible reasons:",
2962
+ "- Network connection is down",
2963
+ "- WebAssembly is not supported in this environment",
2964
+ "- The WASM file is corrupted or incompatible",
2965
+ "\nError details:",
2966
+ "- Type: ".concat(errorDetails.type),
2967
+ "- Message: ".concat(errorDetails.message),
2968
+ "- WebAssembly-specific error: ".concat(errorDetails.wasmError),
2969
+ "\nTo resolve, you may need to:",
2970
+ "1. Check your network connection",
2971
+ "2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
2972
+ "3. Call RuntimeLoader.loadRuntime() again",
2973
+ ].join("\n");
2974
+ console.error(errorMessage);
2951
2975
  }
2952
2976
  });
2953
2977
  };
@@ -2975,6 +2999,10 @@ var RuntimeLoader = /** @class */ (function () {
2975
2999
  RuntimeLoader.setWasmUrl = function (url) {
2976
3000
  RuntimeLoader.wasmURL = url;
2977
3001
  };
3002
+ // Gets the current wasm url
3003
+ RuntimeLoader.getWasmUrl = function () {
3004
+ return RuntimeLoader.wasmURL;
3005
+ };
2978
3006
  // Flag to indicate that loading has started/completed
2979
3007
  RuntimeLoader.isLoading = false;
2980
3008
  // List of callbacks for the runtime that come in while loading