sandboxedjs 0.1.56 → 0.1.57
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/README.md +17 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -729,6 +729,23 @@ await box.exec("python3 -c 'import sqlite3; print(sqlite3.sqlite_version)'");
|
|
|
729
729
|
Python never falls back to a host interpreter. When selecting the optional
|
|
730
730
|
Pyodide backend, its module and asset directory must use the same version.
|
|
731
731
|
|
|
732
|
+
### Python wheels with Vite
|
|
733
|
+
|
|
734
|
+
Vite prebundles JavaScript dependencies into `.vite/deps`, but it does not
|
|
735
|
+
serve binary package assets next to that optimized module. Copy
|
|
736
|
+
`node_modules/sandboxedjs/dist/python/wheels` to your app's public directory
|
|
737
|
+
at build time, then configure the public URL before creating a container:
|
|
738
|
+
|
|
739
|
+
```ts
|
|
740
|
+
import { configurePython } from "sandboxedjs";
|
|
741
|
+
|
|
742
|
+
configurePython({ wheelIndex: "/python/wheels" });
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
The directory must contain `index.json` and every wheel named by it. Once this
|
|
746
|
+
is configured, `pip install fastapi` resolves Pydantic 2 and the bundled
|
|
747
|
+
WASM-compatible `pydantic-core` rather than falling back to Pydantic 1.
|
|
748
|
+
|
|
732
749
|
## Uploading files
|
|
733
750
|
|
|
734
751
|
A file picker in a browser never hands over a path — it hands over the file's bytes. So getting a
|
package/dist/index.cjs
CHANGED
|
@@ -17935,10 +17935,10 @@ var bundledManifest = {
|
|
|
17935
17935
|
persistence: "memory"
|
|
17936
17936
|
}
|
|
17937
17937
|
};
|
|
17938
|
-
var bundledWheelIndex = new URL(
|
|
17938
|
+
var bundledWheelIndex = (typeof process !== "undefined" && process.versions?.node ? new URL(
|
|
17939
17939
|
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)).includes("/src/runtime/python/") ? "../../../dist/python/wheels/" : "./python/wheels/",
|
|
17940
17940
|
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
17941
|
-
).href;
|
|
17941
|
+
) : new URL("/python/wheels/", globalThis.location?.href ?? (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))).href;
|
|
17942
17942
|
var config = {
|
|
17943
17943
|
backend: "sbx-cpython-wasm",
|
|
17944
17944
|
manifest: bundledManifest,
|
|
@@ -20459,7 +20459,9 @@ environments. A package with no usable wheel is an error, never a silent skip.`,
|
|
|
20459
20459
|
const loaded = await client.json(`${url}/index.json`);
|
|
20460
20460
|
index = { baseUrl: url, wheels: loaded.wheels ?? [] };
|
|
20461
20461
|
} catch (error) {
|
|
20462
|
-
return ctx.fail(
|
|
20462
|
+
return ctx.fail(
|
|
20463
|
+
`could not read the wheel index at ${configured}: ${error.message}. When running under a bundler such as Vite, publish dist/python/wheels as a static asset and configurePython({ wheelIndex: '/python/wheels' }) before creating the container.`
|
|
20464
|
+
);
|
|
20463
20465
|
}
|
|
20464
20466
|
} else if (configured) {
|
|
20465
20467
|
index = configured;
|