@cfasim-ui/wasm 0.1.0 → 0.1.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 +2 -2
- package/src/wasm.worker.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfasim-ui/wasm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "WebAssembly integration for cfasim-ui",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
".": "./src/index.ts"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@cfasim-ui/shared": "0.1.
|
|
19
|
+
"@cfasim-ui/shared": "0.1.2"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"vue": "^3.5.0"
|
package/src/wasm.worker.ts
CHANGED
|
@@ -14,12 +14,14 @@ interface WorkerMessage {
|
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
15
|
const loadedModules = new Map<string, Record<string, any>>();
|
|
16
16
|
|
|
17
|
+
const baseUrl = import.meta.env.BASE_URL ?? "/";
|
|
18
|
+
|
|
17
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
20
|
async function ensureModule(model: string): Promise<Record<string, any>> {
|
|
19
21
|
const cached = loadedModules.get(model);
|
|
20
22
|
if (cached) return cached;
|
|
21
23
|
|
|
22
|
-
const url = `${self.location.origin}
|
|
24
|
+
const url = `${self.location.origin}${baseUrl}wasm/${model}/${model}.js`;
|
|
23
25
|
const mod = await import(/* @vite-ignore */ url);
|
|
24
26
|
await mod.default();
|
|
25
27
|
loadedModules.set(model, mod);
|