@cfasim-ui/pyodide 0.1.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfasim-ui/pyodide",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Pyodide (Python-in-browser) integration for cfasim-ui",
6
6
  "license": "Apache-2.0",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "pyodide": "^0.29.3",
20
- "@cfasim-ui/shared": "0.1.1"
20
+ "@cfasim-ui/shared": "0.1.2"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "vue": "^3.5.0"
@@ -16,6 +16,8 @@ interface WorkerMessage {
16
16
  let wheelMap: Record<string, string> = {};
17
17
  const loadedModules = new Set<string>();
18
18
 
19
+ const baseUrl = import.meta.env.BASE_URL ?? "/";
20
+
19
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
22
  let micropip: any;
21
23
 
@@ -32,7 +34,7 @@ const pyodideReadyPromise = (async () => {
32
34
  micropip = pyodide.pyimport("micropip");
33
35
 
34
36
  // Build module→wheel lookup but don't install yet
35
- const res = await fetch(`${self.location.origin}/wheels.json`);
37
+ const res = await fetch(`${self.location.origin}${baseUrl}wheels.json`);
36
38
  const wheelFiles: string[] = await res.json();
37
39
  for (const filename of wheelFiles) {
38
40
  const moduleName = filename.split("-")[0];
@@ -49,7 +51,7 @@ async function ensureModule(
49
51
  if (loadedModules.has(moduleName)) return;
50
52
  const filename = wheelMap[moduleName];
51
53
  if (!filename) throw new Error(`Unknown module: ${moduleName}`);
52
- await micropip.install(`${self.location.origin}/${filename}`);
54
+ await micropip.install(`${self.location.origin}${baseUrl}${filename}`);
53
55
  pyodide.pyimport(moduleName);
54
56
  loadedModules.add(moduleName);
55
57
  }