@classic-homes/slides 0.5.7 → 0.5.8

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.
@@ -3757,7 +3757,7 @@ function validateDeck(input, options = {}) {
3757
3757
  if (slide.success) issues2.push(...slideIssues(slide.data, i));
3758
3758
  });
3759
3759
  }
3760
- return { ok: false, issues: issues2 };
3760
+ return { ok: false, issues: byPath(issues2) };
3761
3761
  }
3762
3762
  const deck = parsed.data;
3763
3763
  const issues = [];
@@ -3812,7 +3812,22 @@ function validateDeck(input, options = {}) {
3812
3812
  message: 'Decks usually open with a "title" slide.'
3813
3813
  });
3814
3814
  }
3815
- return { ok: !issues.some((i) => i.level === "error"), deck, issues };
3815
+ return { ok: !issues.some((i) => i.level === "error"), deck, issues: byPath(issues) };
3816
+ }
3817
+ function comparePath(a, b) {
3818
+ for (let k = 0; k < Math.min(a.length, b.length); k++) {
3819
+ const x = a[k];
3820
+ const y = b[k];
3821
+ if (x === y) continue;
3822
+ if (typeof x === "number" && typeof y === "number") return x - y;
3823
+ if (typeof x === "number") return 1;
3824
+ if (typeof y === "number") return -1;
3825
+ return x < y ? -1 : 1;
3826
+ }
3827
+ return a.length - b.length;
3828
+ }
3829
+ function byPath(issues) {
3830
+ return [...issues].sort((a, b) => comparePath(a.path, b.path));
3816
3831
  }
3817
3832
  function formatPath(path) {
3818
3833
  if (!path.length) return "deck";
@@ -3978,4 +3993,4 @@ export {
3978
3993
  inlineDeckImages,
3979
3994
  externalizeDeckImages
3980
3995
  };
3981
- //# sourceMappingURL=chunk-ILE46F7Y.js.map
3996
+ //# sourceMappingURL=chunk-AOOBBLKE.js.map