sandboxedjs 0.1.55 → 0.1.56

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/dist/index.js CHANGED
@@ -17918,7 +17918,15 @@ var bundledManifest = {
17918
17918
  persistence: "memory"
17919
17919
  }
17920
17920
  };
17921
- var config = { backend: "sbx-cpython-wasm", manifest: bundledManifest };
17921
+ var bundledWheelIndex = new URL(
17922
+ import.meta.url.includes("/src/runtime/python/") ? "../../../dist/python/wheels/" : "./python/wheels/",
17923
+ import.meta.url
17924
+ ).href;
17925
+ var config = {
17926
+ backend: "sbx-cpython-wasm",
17927
+ manifest: bundledManifest,
17928
+ wheelIndex: bundledWheelIndex
17929
+ };
17922
17930
  function setPythonBackend(options) {
17923
17931
  if (options.wheelIndex !== void 0) config.wheelIndex = options.wheelIndex;
17924
17932
  if (options.manifest !== void 0) config.manifest = validateManifest(options.manifest);
@@ -20387,6 +20395,17 @@ environments. A package with no usable wheel is an error, never a silent skip.`,
20387
20395
  }
20388
20396
  const cache = /* @__PURE__ */ new Map();
20389
20397
  const request = async (url, timeoutMs, read) => {
20398
+ if (url.startsWith("file:")) {
20399
+ try {
20400
+ const [{ readFile }, { fileURLToPath: fileURLToPath2 }] = await Promise.all([
20401
+ nodeBuiltin("fs/promises"),
20402
+ nodeBuiltin("url")
20403
+ ]);
20404
+ return await read(new Response(await readFile(fileURLToPath2(url))));
20405
+ } catch (error) {
20406
+ throw new Error(`could not read bundled wheel asset ${url}: ${error.message}`);
20407
+ }
20408
+ }
20390
20409
  const controller = new AbortController();
20391
20410
  const timer = setTimeout(() => controller.abort(), timeoutMs);
20392
20411
  try {