@docmentis/udoc-viewer 0.7.13 → 0.7.15

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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Diagnostics for WASM engine initialization failures.
3
+ */
4
+ /**
5
+ * Turn a WASM link failure into an actionable message.
6
+ *
7
+ * A LinkError on instantiate means udoc_bg.wasm expects imports this build of
8
+ * the JS glue doesn't provide — the two files came from different releases.
9
+ * The raw message names an internal wasm-bindgen symbol, which tells the
10
+ * integrator nothing, so state the actual cause instead.
11
+ *
12
+ * @param error - The error thrown by the wasm-bindgen init function
13
+ * @param wasmUrl - URL the engine was loaded from, if not bundler-resolved
14
+ * @param version - SDK version of the worker attempting the load
15
+ */
16
+ export declare function describeInitError(error: unknown, wasmUrl: string | undefined, version: string): Error;
17
+ //# sourceMappingURL=wasmError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasmError.d.ts","sourceRoot":"","sources":["../../../src/worker/wasmError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAgBrG"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Diagnostics for WASM engine initialization failures.
3
+ */
4
+ /**
5
+ * Turn a WASM link failure into an actionable message.
6
+ *
7
+ * A LinkError on instantiate means udoc_bg.wasm expects imports this build of
8
+ * the JS glue doesn't provide — the two files came from different releases.
9
+ * The raw message names an internal wasm-bindgen symbol, which tells the
10
+ * integrator nothing, so state the actual cause instead.
11
+ *
12
+ * @param error - The error thrown by the wasm-bindgen init function
13
+ * @param wasmUrl - URL the engine was loaded from, if not bundler-resolved
14
+ * @param version - SDK version of the worker attempting the load
15
+ */
16
+ export function describeInitError(error, wasmUrl, version) {
17
+ const message = error instanceof Error ? error.message : String(error);
18
+ const mismatch = (typeof WebAssembly.LinkError === "function" && error instanceof WebAssembly.LinkError) ||
19
+ (/\bimport\b/i.test(message) && /callable|not a function/i.test(message));
20
+ if (!mismatch) {
21
+ return error instanceof Error ? error : new Error(message);
22
+ }
23
+ const source = wasmUrl ? `at ${wasmUrl}` : "bundled with this app";
24
+ return new Error(`WASM engine version mismatch: udoc_bg.wasm ${source} was built for a different release ` +
25
+ `than this worker (SDK ${version}). Serve worker.js and udoc_bg.wasm from the same ` +
26
+ `@docmentis/udoc-viewer version, then clear any CDN or browser cache. (${message})`);
27
+ }
28
+ //# sourceMappingURL=wasmError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasmError.js","sourceRoot":"","sources":["../../../src/worker/wasmError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,OAA2B,EAAE,OAAe;IAC1F,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,QAAQ,GACV,CAAC,OAAO,WAAW,CAAC,SAAS,KAAK,UAAU,IAAI,KAAK,YAAY,WAAW,CAAC,SAAS,CAAC;QACvF,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC;IACnE,OAAO,IAAI,KAAK,CACZ,8CAA8C,MAAM,qCAAqC;QACrF,yBAAyB,OAAO,oDAAoD;QACpF,yEAAyE,OAAO,GAAG,CAC1F,CAAC;AACN,CAAC"}