@rive-app/canvas-single 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
|
@@ -3354,7 +3354,7 @@ Xd();
|
|
|
3354
3354
|
/* 2 */
|
|
3355
3355
|
/***/ ((module) => {
|
|
3356
3356
|
|
|
3357
|
-
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.23.
|
|
3357
|
+
module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.23.2","description":"Rive\'s high-level canvas based web api all in one js file.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
3358
3358
|
|
|
3359
3359
|
/***/ }),
|
|
3360
3360
|
/* 3 */
|
|
@@ -4019,20 +4019,44 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
4019
4019
|
(_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime);
|
|
4020
4020
|
}
|
|
4021
4021
|
})
|
|
4022
|
-
.catch(function () {
|
|
4022
|
+
.catch(function (error) {
|
|
4023
|
+
// Capture specific error details
|
|
4024
|
+
var errorDetails = {
|
|
4025
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error",
|
|
4026
|
+
type: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
4027
|
+
// Some browsers may provide additional WebAssembly-specific details
|
|
4028
|
+
wasmError: error instanceof WebAssembly.CompileError ||
|
|
4029
|
+
error instanceof WebAssembly.RuntimeError,
|
|
4030
|
+
originalError: error,
|
|
4031
|
+
};
|
|
4032
|
+
// Log detailed error for debugging
|
|
4033
|
+
console.debug("Rive WASM load error details:", errorDetails);
|
|
4023
4034
|
// In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr.
|
|
4024
4035
|
// This `rive_fallback.wasm` is compiled to support older architecture.
|
|
4025
4036
|
// TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails.
|
|
4026
4037
|
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");
|
|
4027
4038
|
if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) {
|
|
4028
|
-
console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, ", trying jsdelivr as a backup"));
|
|
4039
|
+
console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup"));
|
|
4029
4040
|
RuntimeLoader.setWasmUrl(backupJsdelivrUrl);
|
|
4030
4041
|
RuntimeLoader.loadRuntime();
|
|
4031
4042
|
}
|
|
4032
4043
|
else {
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4044
|
+
var errorMessage = [
|
|
4045
|
+
"Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."),
|
|
4046
|
+
"Possible reasons:",
|
|
4047
|
+
"- Network connection is down",
|
|
4048
|
+
"- WebAssembly is not supported in this environment",
|
|
4049
|
+
"- The WASM file is corrupted or incompatible",
|
|
4050
|
+
"\nError details:",
|
|
4051
|
+
"- Type: ".concat(errorDetails.type),
|
|
4052
|
+
"- Message: ".concat(errorDetails.message),
|
|
4053
|
+
"- WebAssembly-specific error: ".concat(errorDetails.wasmError),
|
|
4054
|
+
"\nTo resolve, you may need to:",
|
|
4055
|
+
"1. Check your network connection",
|
|
4056
|
+
"2. Set a new WASM source via RuntimeLoader.setWasmUrl()",
|
|
4057
|
+
"3. Call RuntimeLoader.loadRuntime() again",
|
|
4058
|
+
].join("\n");
|
|
4059
|
+
console.error(errorMessage);
|
|
4036
4060
|
}
|
|
4037
4061
|
});
|
|
4038
4062
|
};
|
|
@@ -4060,6 +4084,10 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
4060
4084
|
RuntimeLoader.setWasmUrl = function (url) {
|
|
4061
4085
|
RuntimeLoader.wasmURL = url;
|
|
4062
4086
|
};
|
|
4087
|
+
// Gets the current wasm url
|
|
4088
|
+
RuntimeLoader.getWasmUrl = function () {
|
|
4089
|
+
return RuntimeLoader.wasmURL;
|
|
4090
|
+
};
|
|
4063
4091
|
// Flag to indicate that loading has started/completed
|
|
4064
4092
|
RuntimeLoader.isLoading = false;
|
|
4065
4093
|
// List of callbacks for the runtime that come in while loading
|