sandboxedjs 0.1.50 → 0.1.51

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
@@ -19090,7 +19090,7 @@ async function startNodeWorker(url, workerData) {
19090
19090
  /* webpackIgnore: true */
19091
19091
  specifier
19092
19092
  );
19093
- const worker = new NodeWorker(url, { workerData });
19093
+ const worker = new NodeWorker(url, { workerData, execArgv: [] });
19094
19094
  return {
19095
19095
  postMessage: (message) => worker.postMessage(message),
19096
19096
  onMessage: (listener) => worker.on("message", listener),
@@ -19363,7 +19363,17 @@ async function resolvePackageCandidates(client, requirement, environment) {
19363
19363
  const index = await client.json(`https://pypi.org/pypi/${requirement.name}/json`);
19364
19364
  const candidates = Object.keys(index.releases).filter((version) => requirement.specifiers.every((s) => compareVersions(version, s.version, s.op))).sort((a, b) => compareRelease(releaseOf(a), releaseOf(b)));
19365
19365
  const stable = candidates.filter((version) => !isPreRelease(version));
19366
- const ordered = (stable.length > 0 ? stable : candidates).reverse();
19366
+ const newestFirst = (stable.length > 0 ? stable : candidates).reverse();
19367
+ const probeIndexes = [
19368
+ 0,
19369
+ Math.floor(newestFirst.length / 2),
19370
+ Math.floor(newestFirst.length / 4),
19371
+ Math.floor(newestFirst.length * 3 / 4),
19372
+ newestFirst.length - 1
19373
+ ];
19374
+ const probes = [...new Set(probeIndexes)].map((index2) => newestFirst[index2]).filter((v) => Boolean(v));
19375
+ const probeVersions = new Set(probes);
19376
+ const ordered = [...probes, ...newestFirst.filter((version) => !probeVersions.has(version))];
19367
19377
  let sawSourceOnly = false;
19368
19378
  const resolved = [];
19369
19379
  for (const version of ordered) {
@@ -19433,7 +19443,10 @@ async function installRequirements(options) {
19433
19443
  }
19434
19444
  const archives = /* @__PURE__ */ new Map();
19435
19445
  const unavailable2 = /* @__PURE__ */ new Set();
19446
+ const unsatisfiable = /* @__PURE__ */ new Map();
19436
19447
  const candidateCache = /* @__PURE__ */ new Map();
19448
+ let candidateAttempts = 0;
19449
+ const MAX_CANDIDATE_ATTEMPTS = 96;
19437
19450
  const solve = async (pending, state) => {
19438
19451
  if (pending.length === 0) return state;
19439
19452
  const [first, ...tail2] = pending;
@@ -19457,6 +19470,9 @@ async function installRequirements(options) {
19457
19470
  skipped: [...state.skipped, { name: requirement.name, marker: requirement.marker ?? "" }]
19458
19471
  });
19459
19472
  }
19473
+ const solveKey = `${requirement.name}:${requirement.specifiers.map((s) => `${s.op}${s.version}`).sort().join(",")}:${[...extras].sort().join(",")}`;
19474
+ const knownFailure = unsatisfiable.get(solveKey);
19475
+ if (knownFailure) throw knownFailure;
19460
19476
  const already = state.chosen.get(requirement.name);
19461
19477
  if (already) {
19462
19478
  const satisfied = requirement.specifiers.every(
@@ -19501,6 +19517,12 @@ async function installRequirements(options) {
19501
19517
  let failure2;
19502
19518
  for (const resolved of candidates) {
19503
19519
  try {
19520
+ candidateAttempts += 1;
19521
+ if (candidateAttempts > MAX_CANDIDATE_ATTEMPTS) {
19522
+ throw new Error(
19523
+ "dependency resolution exceeded 96 wheel candidates; add version constraints for packages whose newest generation requires unavailable native WASM extensions"
19524
+ );
19525
+ }
19504
19526
  let entries = archives.get(resolved.url);
19505
19527
  if (!entries) {
19506
19528
  options.progress.downloading(resolved.name, resolved.version);
@@ -19527,10 +19549,13 @@ async function installRequirements(options) {
19527
19549
  skipped: state.skipped
19528
19550
  });
19529
19551
  } catch (error) {
19552
+ if (error?.message?.startsWith("dependency resolution exceeded")) throw error;
19530
19553
  failure2 = error;
19531
19554
  }
19532
19555
  }
19533
- throw failure2 instanceof Error ? failure2 : new Error(`could not resolve ${requirement.name}`);
19556
+ const resolutionError = failure2 instanceof Error ? failure2 : new Error(`could not resolve ${requirement.name}`);
19557
+ unsatisfiable.set(solveKey, resolutionError);
19558
+ throw resolutionError;
19534
19559
  };
19535
19560
  const solved = await solve(queue, {
19536
19561
  chosen: /* @__PURE__ */ new Map(),