sandboxedjs 0.1.38 → 0.1.40

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.
@@ -21729,6 +21729,9 @@ var CommonJsEngine = class {
21729
21729
  return target.exports;
21730
21730
  }
21731
21731
  resolve(specifier, importer, kind = "require") {
21732
+ if (specifier.startsWith("file://")) {
21733
+ specifier = pathFromFileUrl(specifier);
21734
+ }
21732
21735
  const builtin = this.builtin(specifier);
21733
21736
  if (builtin.found) return specifier.replace(/^node:/, "");
21734
21737
  if (specifier.startsWith("#")) {
@@ -22093,6 +22096,11 @@ function ownKeys(target) {
22093
22096
  }
22094
22097
  return keys;
22095
22098
  }
22099
+ function pathFromFileUrl(url) {
22100
+ const withoutScheme = url.slice("file://".length).replace(/^localhost/, "");
22101
+ const path = withoutScheme.split(/[?#]/, 1)[0];
22102
+ return decodeURIComponent(path) || "/";
22103
+ }
22096
22104
  function fileUrl(path) {
22097
22105
  return `file://${path.split("/").map(encodeURIComponent).join("/")}`;
22098
22106
  }
@@ -28771,13 +28779,19 @@ function createChildProcessModule(spawnChild, defaultCwd, syncSpawn, defaultEnv
28771
28779
  const shell = typeof options.shell === "string" ? options.shell : "/bin/sh";
28772
28780
  return { file: shell, args: ["-c", command] };
28773
28781
  };
28782
+ const stdinIgnored = (options) => {
28783
+ const stdio = options.stdio;
28784
+ if (stdio === "ignore") return true;
28785
+ return Array.isArray(stdio) && stdio[0] === "ignore";
28786
+ };
28774
28787
  const start = (file, args, options) => {
28775
28788
  const resolved = options.shell ? throughShell([file, ...args].join(" "), options) : { file, args };
28776
28789
  const handle = spawnChild({
28777
28790
  command: resolved.file,
28778
28791
  args: resolved.args,
28779
28792
  cwd: options.cwd ?? defaultCwd(),
28780
- env: environmentFor(options)
28793
+ env: environmentFor(options),
28794
+ ...stdinIgnored(options) ? { stdinIgnored: true } : {}
28781
28795
  });
28782
28796
  return new ChildProcess(handle, resolved.file, resolved.args);
28783
28797
  };