@cfasim-ui/pyodide 0.3.2 → 0.3.4
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.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pyodide (Python-in-browser) integration for cfasim-ui",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
],
|
|
18
18
|
"exports": {
|
|
19
19
|
".": "./src/index.ts",
|
|
20
|
-
"./vite": "./src/vitePlugin.
|
|
20
|
+
"./vite": "./src/vitePlugin.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"pyodide": "^0.29.3",
|
|
24
|
-
"@cfasim-ui/shared": "0.3.
|
|
24
|
+
"@cfasim-ui/shared": "0.3.4"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": "^3.5.0"
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import { readdirSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import type { Plugin } from "vite";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} CfasimPyodideOptions
|
|
7
|
+
* @property {string} [model] Path to the Python model directory (default: "model")
|
|
8
|
+
* @property {string[]} [pypiDeps] PyPI packages to download at build time and serve locally
|
|
9
|
+
*/
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Vite plugin that builds a Python wheel from a local model directory
|
|
@@ -16,11 +14,14 @@ interface CfasimPyodideOptions {
|
|
|
16
14
|
*
|
|
17
15
|
* Use `pypiDeps` to prebuild PyPI packages (like cfasim-model) as local
|
|
18
16
|
* wheels for faster browser runtime — avoids PyPI round-trips on page load.
|
|
17
|
+
*
|
|
18
|
+
* @param {CfasimPyodideOptions} [options]
|
|
19
|
+
* @returns {import("vite").Plugin}
|
|
19
20
|
*/
|
|
20
|
-
export function cfasimPyodide(options
|
|
21
|
+
export function cfasimPyodide(options) {
|
|
21
22
|
const modelDir = options?.model ?? "model";
|
|
22
23
|
|
|
23
|
-
function build(root
|
|
24
|
+
function build(root) {
|
|
24
25
|
const publicDir = resolve(root, "public");
|
|
25
26
|
mkdirSync(publicDir, { recursive: true });
|
|
26
27
|
for (const dep of options?.pypiDeps ?? []) {
|