@rive-app/canvas 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
|
@@ -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.
|
|
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
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
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
|