mnfst-render 0.5.47 → 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
  /**
@@ -3523,13 +3538,20 @@ const COPY_EXCLUDE = new Set([
3523
3538
  'CLAUDE.md', 'AGENTS.md', 'manifest.schema.json',
3524
3539
  ]);
3525
3540
 
3541
+ // Capacitor-wrapped projects: native projects and config stay out of the web
3542
+ // output, else each `cap sync` nests ios/App/App/public/ios/… deeper.
3543
+ const CAPACITOR_CONFIGS = ['capacitor.config.json', 'capacitor.config.ts', 'capacitor.config.js'];
3544
+ const CAPACITOR_EXCLUDE = new Set(['ios', 'android', ...CAPACITOR_CONFIGS]);
3545
+
3526
3546
  function copyProjectIntoDist(rootResolved, outputResolved) {
3527
3547
  const outputDirName = basename(outputResolved);
3528
3548
  COPY_EXCLUDE.add(outputDirName);
3549
+ const wrapped = CAPACITOR_CONFIGS.some((f) => existsSync(join(rootResolved, f)));
3529
3550
  const entries = readdirSync(rootResolved, { withFileTypes: true });
3530
3551
  for (const ent of entries) {
3531
3552
  const name = ent.name;
3532
3553
  if (COPY_EXCLUDE.has(name) || name.startsWith('.')) continue;
3554
+ if (wrapped && CAPACITOR_EXCLUDE.has(name)) continue;
3533
3555
  const src = join(rootResolved, name);
3534
3556
  const dest = join(outputResolved, name);
3535
3557
  cpSync(src, dest, {
@@ -3727,11 +3749,19 @@ async function runPrerender(config) {
3727
3749
  const lockBasename = basename(outputLockPath(finalOutput));
3728
3750
  COPY_EXCLUDE.add(finalBasename);
3729
3751
  COPY_EXCLUDE.add(lockBasename);
3752
+ // An --out render (e.g. a Capacitor webDir) also skips the configured web output.
3753
+ const renderBlock = config.manifest?.render ?? config.manifest?.prerender ?? {};
3754
+ const configuredOutput = resolve(rootResolved, renderBlock.output ?? 'website');
3755
+ const configuredBasename = dirname(configuredOutput) === rootResolved && !COPY_EXCLUDE.has(basename(configuredOutput))
3756
+ ? basename(configuredOutput)
3757
+ : null;
3758
+ if (configuredBasename) COPY_EXCLUDE.add(configuredBasename);
3730
3759
  try {
3731
3760
  copyProjectIntoDist(rootResolved, outputResolved);
3732
3761
  } finally {
3733
3762
  COPY_EXCLUDE.delete(finalBasename);
3734
3763
  COPY_EXCLUDE.delete(lockBasename);
3764
+ if (configuredBasename) COPY_EXCLUDE.delete(configuredBasename);
3735
3765
  }
3736
3766
  // Env placeholders (${VAR}) only resolve at runtime via window.env (populated
3737
3767
  // by the mnfst-run dev server from .env). A static prod build has no
@@ -5545,6 +5575,7 @@ export {
5545
5575
  groupLlmsSections,
5546
5576
  acquireOutputLock,
5547
5577
  outputLockPath,
5578
+ copyProjectIntoDist,
5548
5579
  markPrerenderedManifestComponents,
5549
5580
  normalizeLocaleRouteExclude,
5550
5581
  isLocaleRouteExcluded,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-render",
3
- "version": "0.5.47",
3
+ "version": "0.5.49",
4
4
  "description": "Render Manifest sites to static HTML for SEO",
5
5
  "type": "module",
6
6
  "bin": {