mnfst-render 0.5.48 → 0.5.49

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.
@@ -3116,7 +3116,8 @@ ${urlEntries.join('\n')}
3116
3116
 
3117
3117
  /**
3118
3118
  * Group llms entries into sections by first URL segment ("Blog" for /blog/*),
3119
- * root page as "Overview", in first-encounter order. Wherever a path holds two
3119
+ * root page as "Overview", in first-encounter order with each split section
3120
+ * placed directly after its parent. Wherever a path holds two
3120
3121
  * or more sub-areas that each have their own page and children, each sub-area
3121
3122
  * becomes its own section labelled by its page title, recursively: /docs/ai/*
3122
3123
  * and /docs/framework/* split into "AI Plugins" and "Framework", and groups
@@ -3180,7 +3181,21 @@ function groupLlmsSections(entries, siteName = '') {
3180
3181
  if (!sections.has(key)) sections.set(key, { label, entries: [] });
3181
3182
  sections.get(key).entries.push(entry);
3182
3183
  }
3183
- return sections;
3184
+ const keys = [...sections.keys()];
3185
+ const parentOf = (key) => keys.filter((k) => key.startsWith(k + '/')).sort((a, b) => b.length - a.length)[0];
3186
+ const kids = new Map();
3187
+ for (const key of keys) {
3188
+ const parent = parentOf(key) ?? '';
3189
+ if (!kids.has(parent)) kids.set(parent, []);
3190
+ kids.get(parent).push(key);
3191
+ }
3192
+ const ordered = new Map();
3193
+ const visit = (key) => {
3194
+ ordered.set(key, sections.get(key));
3195
+ for (const child of kids.get(key) || []) visit(child);
3196
+ };
3197
+ for (const key of kids.get('') || []) visit(key);
3198
+ return ordered;
3184
3199
  }
3185
3200
 
3186
3201
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.48",
3
+ "version": "0.5.49",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {