mnfst 0.5.321 → 0.5.322

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.
@@ -647,16 +647,18 @@
647
647
  // evidence of a move only. Same size: another member whose own content changed holds it (a
648
648
  // permutation). Members added or removed: everything recorded from i on found again, in order,
649
649
  // shifted. In place, not found, or shared with another recorded member: null or [] (positional).
650
+ // A recorded id that is null (unknown) is a wildcard: only known members are compared, and
651
+ // the content is found only where a known member sits.
650
652
  function movedIn(R, F, i) {
651
653
  const v = R[i];
652
654
  if (v == null || F[i] == null || F[i] === v || R.some((x, j) => j !== i && x === v)) return null;
653
- if (F.length === R.length) return F.map((x, j) => j).filter(j => j !== i && F[j] === v && F[j] !== R[j]);
655
+ if (F.length === R.length) return F.map((x, j) => j).filter(j => j !== i && R[j] != null && F[j] === v && F[j] !== R[j]);
654
656
  const to = [];
655
657
  for (let d = -i; d < F.length - i; d++) {
656
658
  if (!d) continue;
657
659
  let ok = true;
658
- for (let t = i; t < R.length && ok; t++) ok = t + d >= 0 && t + d < F.length && F[t + d] === R[t];
659
- if (ok) to.push(i + d);
660
+ for (let t = i; t < R.length && ok; t++) ok = t + d >= 0 && t + d < F.length && (R[t] == null || F[t + d] === R[t]);
661
+ if (ok && (!R.includes(null) || (i + d < R.length && R[i + d] != null))) to.push(i + d);
660
662
  }
661
663
  return to;
662
664
  }
@@ -2996,7 +2998,7 @@
2996
2998
  const ks = Object.keys(now).filter(k => familyOf(k) === fam).sort(byOrd);
2997
2999
  const pk = [...live.keys()].filter(k => familyOf(k) === fam && (() => { const a = regionOf(live.get(k)); return a && sourceFile(a) === f; })()).sort(byOrd);
2998
3000
  const R = pk.map(k => shown.has(live.get(k)) ? shown.get(live.get(k)) : null), F = ks.map(k => now[k]);
2999
- if (!R.includes(null) && R.some((x, i) => (movedIn(R, F, i) || []).length)) cidsUnsure.add(fam);
3001
+ if (R.some((x, i) => (movedIn(R, F, i) || []).length)) cidsUnsure.add(fam);
3000
3002
  else ks.forEach(k => { kept[k] = now[k]; });
3001
3003
  });
3002
3004
  baseCids[f] = kept;