sandboxedjs 0.1.38 → 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.cjs CHANGED
@@ -22293,6 +22293,9 @@ var CommonJsEngine = class {
22293
22293
  return target.exports;
22294
22294
  }
22295
22295
  resolve(specifier, importer, kind = "require") {
22296
+ if (specifier.startsWith("file://")) {
22297
+ specifier = pathFromFileUrl(specifier);
22298
+ }
22296
22299
  const builtin = this.builtin(specifier);
22297
22300
  if (builtin.found) return specifier.replace(/^node:/, "");
22298
22301
  if (specifier.startsWith("#")) {
@@ -22657,6 +22660,11 @@ function ownKeys(target) {
22657
22660
  }
22658
22661
  return keys;
22659
22662
  }
22663
+ function pathFromFileUrl(url) {
22664
+ const withoutScheme = url.slice("file://".length).replace(/^localhost/, "");
22665
+ const path = withoutScheme.split(/[?#]/, 1)[0];
22666
+ return decodeURIComponent(path) || "/";
22667
+ }
22660
22668
  function fileUrl(path) {
22661
22669
  return `file://${path.split("/").map(encodeURIComponent).join("/")}`;
22662
22670
  }