@uniweb/build 0.8.27 → 0.8.28
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 +4 -4
- package/src/site/content-collector.js +23 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.28",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@uniweb/theming": "0.1.3"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@uniweb/runtime": "0.6.23",
|
|
58
57
|
"@uniweb/content-reader": "1.1.4",
|
|
59
|
-
"@uniweb/schemas": "0.2.1"
|
|
58
|
+
"@uniweb/schemas": "0.2.1",
|
|
59
|
+
"@uniweb/runtime": "0.6.24"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@tailwindcss/vite": "^4.0.0",
|
|
66
66
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
67
67
|
"vite-plugin-svgr": "^4.0.0",
|
|
68
|
-
"@uniweb/core": "0.5.
|
|
68
|
+
"@uniweb/core": "0.5.18"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"vite": {
|
|
@@ -1466,12 +1466,16 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
|
|
|
1466
1466
|
orderedMdPages = mdPageItems
|
|
1467
1467
|
}
|
|
1468
1468
|
|
|
1469
|
-
// In folder mode, determine index
|
|
1469
|
+
// In folder mode, determine index page (homepage only).
|
|
1470
|
+
// Index promotion only happens at the site root — at deeper levels,
|
|
1471
|
+
// pages: controls order only and every folder keeps its natural route.
|
|
1470
1472
|
let indexName = null
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1473
|
+
if (parentRoute === '/') {
|
|
1474
|
+
if (pagesParsedFM && pagesParsedFM.before.length > 0) {
|
|
1475
|
+
indexName = extractItemName(pagesParsedFM.before[0])
|
|
1476
|
+
} else {
|
|
1477
|
+
indexName = orderConfig?.index || null
|
|
1478
|
+
}
|
|
1475
1479
|
}
|
|
1476
1480
|
|
|
1477
1481
|
// Add md-file-pages
|
|
@@ -1608,12 +1612,16 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
|
|
|
1608
1612
|
|
|
1609
1613
|
// --- Sections mode (default): existing behavior ---
|
|
1610
1614
|
|
|
1611
|
-
// Determine which page is the index for this level
|
|
1612
|
-
//
|
|
1613
|
-
//
|
|
1615
|
+
// Determine which page is the index for this level.
|
|
1616
|
+
// Index promotion only happens at the site root (parentRoute === '/') — the
|
|
1617
|
+
// homepage needs to live at '/'. At all other levels, folders keep their
|
|
1618
|
+
// natural route (1:1 folder-to-route mapping). Content-less containers
|
|
1619
|
+
// exist in the hierarchy with hasContent: false and auto-redirect at runtime.
|
|
1614
1620
|
const hasExplicitOrder = orderConfig?.index || (Array.isArray(orderConfig?.pages) && orderConfig.pages.length > 0)
|
|
1615
1621
|
const hasMdContent = entries.some(e => isMarkdownFile(e))
|
|
1616
|
-
const indexPageName =
|
|
1622
|
+
const indexPageName = parentRoute === '/' && !hasMdContent
|
|
1623
|
+
? determineIndexPage(orderConfig, orderedFolders)
|
|
1624
|
+
: null
|
|
1617
1625
|
|
|
1618
1626
|
// Second pass: process each page folder
|
|
1619
1627
|
for (const folder of orderedFolders) {
|
|
@@ -1972,8 +1980,9 @@ export async function collectSiteContent(sitePath, options = {}) {
|
|
|
1972
1980
|
const { pages, assetCollection, iconCollection, notFound, versionedScopes } =
|
|
1973
1981
|
await collectPagesRecursive(pagesPath, '/', sitePath, siteOrderConfig, null, null, rootContentMode, mounts, siteLayoutName)
|
|
1974
1982
|
|
|
1975
|
-
// Deduplicate:
|
|
1976
|
-
//
|
|
1983
|
+
// Deduplicate: at the root level, homepage promotion can create a route
|
|
1984
|
+
// collision between the promoted page and a content-less container.
|
|
1985
|
+
// At deeper levels, 1:1 mapping means collisions shouldn't happen — warn.
|
|
1977
1986
|
const routeCounts = new Map()
|
|
1978
1987
|
for (const page of pages) {
|
|
1979
1988
|
const existing = routeCounts.get(page.route)
|
|
@@ -1985,6 +1994,9 @@ export async function collectSiteContent(sitePath, options = {}) {
|
|
|
1985
1994
|
}
|
|
1986
1995
|
for (const [route, group] of routeCounts) {
|
|
1987
1996
|
if (group.length > 1) {
|
|
1997
|
+
if (route !== '/') {
|
|
1998
|
+
console.warn(`[content-collector] Unexpected route collision at '${route}' — ${group.length} pages share this route`)
|
|
1999
|
+
}
|
|
1988
2000
|
// Keep the page with content, remove content-less duplicates
|
|
1989
2001
|
const withContent = group.filter(p => p.sections && p.sections.length > 0)
|
|
1990
2002
|
const toRemove = withContent.length > 0
|