@uniweb/build 0.15.7 → 0.15.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.15.7",
3
+ "version": "0.15.9",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,13 +59,13 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.33.2",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/theming": "0.1.14",
63
- "@uniweb/projections": "0.1.2",
64
- "@uniweb/content-writer": "0.2.9"
62
+ "@uniweb/projections": "0.1.3",
63
+ "@uniweb/content-writer": "0.2.9",
64
+ "@uniweb/theming": "0.1.14"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "0.8.38",
68
67
  "@uniweb/content-reader": "1.1.17",
68
+ "@uniweb/runtime": "0.8.39",
69
69
  "@uniweb/schemas": "0.2.4"
70
70
  },
71
71
  "peerDependencies": {
@@ -75,7 +75,7 @@
75
75
  "@tailwindcss/vite": "^4.0.0",
76
76
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
77
77
  "vite-plugin-svgr": "^4.0.0",
78
- "@uniweb/core": "0.7.31"
78
+ "@uniweb/core": "0.7.32"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
81
  "vite": {
@@ -527,6 +527,38 @@ function prettifySlug(slug) {
527
527
  .join(' ')
528
528
  }
529
529
 
530
+ /**
531
+ * Resolve a page's display title when the author declared none.
532
+ *
533
+ * Keys on whether the node has content of its own — the property the page
534
+ * payload already carries as `hasContent` — and deliberately NOT on which
535
+ * config file declared the folder. `folder.yml` vs `page.yml` decides how a
536
+ * directory's markdown is read; it says nothing about what the node IS, and
537
+ * keying on it made a content-less group node's name depend on how it happened
538
+ * to be declared. A `page.yml` folder with no markdown is the same group node
539
+ * as a `folder.yml` one and renders identically in nav.
540
+ *
541
+ * A node with no sections of its own (a group/container node, a redirect stub)
542
+ * has nothing to humanize from, so it shows the identifier the author actually
543
+ * wrote — `v1` stays `v1`. A node with content falls back to its opening H1,
544
+ * and only then to a prettified slug.
545
+ *
546
+ * The runtime has no fallback of its own: an empty title renders empty. The
547
+ * fill belongs here, at the producer, because `title` also feeds `<title>`,
548
+ * `og:title`, `llms.txt` and the search index — a fix applied at render would
549
+ * repair the nav row and leave the rest blank.
550
+ *
551
+ * @param {string|undefined} declaredTitle - Author-supplied title, if any
552
+ * @param {string} segment - Route segment (directory or file name)
553
+ * @param {Array|null} sections - The node's own sections, if any
554
+ * @returns {string}
555
+ */
556
+ function resolveDisplayTitle(declaredTitle, segment, sections) {
557
+ if (declaredTitle) return declaredTitle
558
+ if (!sections?.length) return segment
559
+ return extractH1(sections[0]?.content) || prettifySlug(segment)
560
+ }
561
+
530
562
  function parseNumericPrefix(filename) {
531
563
  const match = filename.match(/^(\d+(?:\.\d+)*)-?(.*)$/)
532
564
  if (match) {
@@ -1031,7 +1063,7 @@ async function processPage(pagePath, pageName, siteRoot, { isIndex = false, pare
1031
1063
  sourcePath: parentRoute === '/' ? `/${pageName}` : `${parentRoute}/${pageName}`,
1032
1064
  id: pageConfig.id || null,
1033
1065
  isIndex,
1034
- title: pageConfig.title || prettifySlug(pageName),
1066
+ title: resolveDisplayTitle(pageConfig.title, pageName, null),
1035
1067
  description: pageConfig.description || '',
1036
1068
  label: pageConfig.label || null,
1037
1069
  hidden: pageConfig.hidden || false,
@@ -1057,7 +1089,7 @@ async function processPage(pagePath, pageName, siteRoot, { isIndex = false, pare
1057
1089
  sourcePath: parentRoute === '/' ? `/${pageName}` : `${parentRoute}/${pageName}`,
1058
1090
  id: pageConfig.id || null,
1059
1091
  isIndex,
1060
- title: pageConfig.title || prettifySlug(pageName),
1092
+ title: resolveDisplayTitle(pageConfig.title, pageName, null),
1061
1093
  description: pageConfig.description || '',
1062
1094
  label: pageConfig.label || null,
1063
1095
  hidden: pageConfig.hidden || false,
@@ -1318,7 +1350,7 @@ async function processPage(pagePath, pageName, siteRoot, { isIndex = false, pare
1318
1350
  sourcePath, // Original folder-based path (for ancestor checking in navigation)
1319
1351
  id: pageConfig.id || null, // Stable page ID for page: links (survives reorganization)
1320
1352
  isIndex, // Marks this page as the index for its parent route
1321
- title: pageConfig.title || extractH1(hierarchicalSections[0]?.content) || prettifySlug(pageName),
1353
+ title: resolveDisplayTitle(pageConfig.title, pageName, hierarchicalSections),
1322
1354
  description: pageConfig.description || '',
1323
1355
  label: pageConfig.label || null, // Short label for navigation (defaults to title)
1324
1356
  // Localized URL slug overrides: { <locale>: <segment> }. Compiled into
@@ -1705,7 +1737,7 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
1705
1737
  sourcePath: isIndex ? (parentRoute === '/' ? `/${entry}` : `${parentRoute}/${entry}`) : null,
1706
1738
  id: dirConfig.id || null,
1707
1739
  isIndex,
1708
- title: dirConfig.title || entry,
1740
+ title: resolveDisplayTitle(dirConfig.title, entry, null),
1709
1741
  description: dirConfig.description || '',
1710
1742
  label: dirConfig.label || null,
1711
1743
  lastModified: null,
@@ -1801,7 +1833,7 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
1801
1833
  sourcePath: isIndex ? (parentRoute === '/' ? `/${entry}` : `${parentRoute}/${entry}`) : null,
1802
1834
  id: dirConfig.id || null,
1803
1835
  isIndex,
1804
- title: dirConfig.title || entry,
1836
+ title: resolveDisplayTitle(dirConfig.title, entry, null),
1805
1837
  description: dirConfig.description || '',
1806
1838
  label: dirConfig.label || null,
1807
1839
  lastModified: null,