@rive-app/webgl2 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/webgl2",
3
- "version": "2.23.0",
3
+ "version": "2.23.2",
4
4
  "description": "Rive's webgl2 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
@@ -423,7 +423,7 @@ function Oa(a, b) {
423
423
  return Na(c, a, b);
424
424
  }));
425
425
  }
426
- var Pa, Qa, Ua = {485221:(a, b, c, d, e) => {
426
+ var Pa, Qa, Ua = {488133:(a, b, c, d, e) => {
427
427
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
428
428
  return 0;
429
429
  }
@@ -486,9 +486,9 @@ var Pa, Qa, Ua = {485221:(a, b, c, d, e) => {
486
486
  }
487
487
  window.h.Da += 1;
488
488
  return 1;
489
- }, 487399:() => {
489
+ }, 490311:() => {
490
490
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
491
- }, 487563:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 487667:() => {
491
+ }, 490475:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 490579:() => {
492
492
  try {
493
493
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
494
494
  a.close();
@@ -496,7 +496,7 @@ var Pa, Qa, Ua = {485221:(a, b, c, d, e) => {
496
496
  } catch (c) {
497
497
  return 0;
498
498
  }
499
- }, 487838:(a, b, c, d, e, f) => {
499
+ }, 490750:(a, b, c, d, e, f) => {
500
500
  if ("undefined" === typeof window.h) {
501
501
  return -1;
502
502
  }
@@ -542,7 +542,7 @@ var Pa, Qa, Ua = {485221:(a, b, c, d, e) => {
542
542
  a == window.h.I.Ba && g.Y.connect(g.J.destination);
543
543
  g.jb = f;
544
544
  return window.h.lc(g);
545
- }, 490715:a => window.h.va(a).J.sampleRate, 490788:a => {
545
+ }, 493627:a => window.h.va(a).J.sampleRate, 493700:a => {
546
546
  a = window.h.va(a);
547
547
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
548
548
  }, a.Y.disconnect(), a.Y = void 0);
@@ -550,13 +550,13 @@ var Pa, Qa, Ua = {485221:(a, b, c, d, e) => {
550
550
  a.J.close();
551
551
  a.J = void 0;
552
552
  a.jb = void 0;
553
- }, 491188:a => {
553
+ }, 494100:a => {
554
554
  window.h.wb(a);
555
- }, 491238:a => {
555
+ }, 494150:a => {
556
556
  a = window.h.va(a);
557
557
  a.J.resume();
558
558
  a.state = window.h.ha.rb;
559
- }, 491377:a => {
559
+ }, 494289:a => {
560
560
  a = window.h.va(a);
561
561
  a.J.suspend();
562
562
  a.state = window.h.ha.stopped;
@@ -3467,8 +3467,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = z.dynCall_viijii
3467
3467
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = z.dynCall_iiiiij)(a, b, c, d, e, f, g);
3468
3468
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = z.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3469
3469
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = z.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3470
- n.___start_em_js = 482596;
3471
- n.___stop_em_js = 485221;
3470
+ n.___start_em_js = 485508;
3471
+ n.___stop_em_js = 488133;
3472
3472
  var Xd;
3473
3473
  Ha = function Yd() {
3474
3474
  Xd || Zd();
@@ -3528,7 +3528,7 @@ Zd();
3528
3528
  /* 2 */
3529
3529
  /***/ ((module) => {
3530
3530
 
3531
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.23.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3531
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.23.2","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3532
3532
 
3533
3533
  /***/ }),
3534
3534
  /* 3 */
@@ -4193,20 +4193,44 @@ var RuntimeLoader = /** @class */ (function () {
4193
4193
  (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
4194
4194
  }
4195
4195
  })
4196
- .catch(function () {
4196
+ .catch(function (error) {
4197
+ // Capture specific error details
4198
+ var errorDetails = {
4199
+ message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
4200
+ type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
4201
+ // Some browsers may provide additional WebAssembly-specific details
4202
+ wasmError: error instanceof WebAssembly.CompileError ||
4203
+ error instanceof WebAssembly.RuntimeError,
4204
+ originalError: error,
4205
+ };
4206
+ // Log detailed error for debugging
4207
+ console.debug("Rive WASM load error details:", errorDetails);
4197
4208
  // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
4198
4209
  // This `rive_fallback.wasm` is compiled to support older architecture.
4199
4210
  // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
4200
4211
  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");
4201
4212
  if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
4202
- console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
4213
+ console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
4203
4214
  RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
4204
4215
  RuntimeLoader.loadRuntime();
4205
4216
  }
4206
4217
  else {
4207
- console.error("Could not load Rive WASM file from unpkg or jsdelivr, network connection may be down, or \
4208
- you may need to call set a new WASM source via RuntimeLoader.setWasmUrl() and call \
4209
- RuntimeLoader.loadRuntime() again");
4218
+ var errorMessage = [
4219
+ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
4220
+ "Possible reasons:",
4221
+ "- Network connection is down",
4222
+ "- WebAssembly is not supported in this environment",
4223
+ "- The WASM file is corrupted or incompatible",
4224
+ "\nError details:",
4225
+ "- Type: ".concat(errorDetails.type),
4226
+ "- Message: ".concat(errorDetails.message),
4227
+ "- WebAssembly-specific error: ".concat(errorDetails.wasmError),
4228
+ "\nTo resolve, you may need to:",
4229
+ "1. Check your network connection",
4230
+ "2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
4231
+ "3. Call RuntimeLoader.loadRuntime() again",
4232
+ ].join("\n");
4233
+ console.error(errorMessage);
4210
4234
  }
4211
4235
  });
4212
4236
  };
@@ -4234,6 +4258,10 @@ var RuntimeLoader = /** @class */ (function () {
4234
4258
  RuntimeLoader.setWasmUrl = function (url) {
4235
4259
  RuntimeLoader.wasmURL = url;
4236
4260
  };
4261
+ // Gets the current wasm url
4262
+ RuntimeLoader.getWasmUrl = function () {
4263
+ return RuntimeLoader.wasmURL;
4264
+ };
4237
4265
  // Flag to indicate that loading has started/completed
4238
4266
  RuntimeLoader.isLoading = false;
4239
4267
  // List of callbacks for the runtime that come in while loading