@rive-app/webgl2 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 +1 -1
- package/rive.d.ts +1 -0
- package/rive.js +34 -6
- package/rive.js.map +1 -1
- package/rive_advanced.mjs.d.ts +2 -2
package/package.json
CHANGED
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
|
@@ -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.
|
|
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
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
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
|