sandboxedjs 0.1.37 → 0.1.39

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
@@ -22276,6 +22276,9 @@ var CommonJsEngine = class {
22276
22276
  return target.exports;
22277
22277
  }
22278
22278
  resolve(specifier, importer, kind = "require") {
22279
+ if (specifier.startsWith("file://")) {
22280
+ specifier = pathFromFileUrl(specifier);
22281
+ }
22279
22282
  const builtin = this.builtin(specifier);
22280
22283
  if (builtin.found) return specifier.replace(/^node:/, "");
22281
22284
  if (specifier.startsWith("#")) {
@@ -22640,6 +22643,11 @@ function ownKeys(target) {
22640
22643
  }
22641
22644
  return keys;
22642
22645
  }
22646
+ function pathFromFileUrl(url) {
22647
+ const withoutScheme = url.slice("file://".length).replace(/^localhost/, "");
22648
+ const path = withoutScheme.split(/[?#]/, 1)[0];
22649
+ return decodeURIComponent(path) || "/";
22650
+ }
22643
22651
  function fileUrl(path) {
22644
22652
  return `file://${path.split("/").map(encodeURIComponent).join("/")}`;
22645
22653
  }
@@ -24944,6 +24952,7 @@ function createCoreModules(options) {
24944
24952
  }
24945
24953
  });
24946
24954
  processObject.stdin = stdin;
24955
+ Reflect.deleteProperty(processObject, "browser");
24947
24956
  const fs = createFsModule(volume, () => cwd, options.stdinPath);
24948
24957
  const path = createPathModule(() => cwd);
24949
24958
  const consoleObject = new Console(stdoutWrite, stderrWrite);