scribe-cms 0.0.9 → 0.0.10

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
@@ -1771,7 +1771,7 @@ function validateTypeRedirects(project) {
1771
1771
  }
1772
1772
  for (const entry of loaded.entries) {
1773
1773
  for (const from of entry.fromSlugs) {
1774
- if (from === entry.toSlug) {
1774
+ if (entry.kind === "same-type" && from === entry.toSlug) {
1775
1775
  issues.push({
1776
1776
  level: "error",
1777
1777
  contentType: type.id,
@@ -1865,16 +1865,17 @@ function validateTypeRedirects(project) {
1865
1865
  if (!targetType?.path) continue;
1866
1866
  for (const from of entry.fromSlugs) {
1867
1867
  if (globalFrom.get(from)?.typeId !== file.contentTypeId) continue;
1868
- const chainTarget = globalFrom.get(entry.toSlug);
1869
- if (chainTarget) {
1870
- issues.push({
1871
- level: "error",
1872
- contentType: file.contentTypeId,
1873
- enSlug: from,
1874
- field: TYPE_REDIRECTS_FILENAME,
1875
- message: `Redirect chain detected: "${from}" \u2192 "${entry.toSlug}" \u2192 existing redirect source`
1876
- });
1877
- }
1868
+ const targetAsSource = globalFrom.get(entry.toSlug);
1869
+ if (!targetAsSource) continue;
1870
+ const sameSlugCrossType = entry.kind === "cross-type" && entry.fromSlugs.includes(entry.toSlug) && targetAsSource.typeId === file.contentTypeId;
1871
+ if (sameSlugCrossType) continue;
1872
+ issues.push({
1873
+ level: "error",
1874
+ contentType: file.contentTypeId,
1875
+ enSlug: from,
1876
+ field: TYPE_REDIRECTS_FILENAME,
1877
+ message: `Redirect chain detected: "${from}" \u2192 "${entry.toSlug}" \u2192 existing redirect source`
1878
+ });
1878
1879
  }
1879
1880
  }
1880
1881
  }