@uniweb/build 0.6.7 → 0.6.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 +2 -2
- package/src/prerender.js +16 -0
- package/src/site/content-collector.js +33 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
53
|
"@uniweb/schemas": "0.2.1",
|
|
54
|
-
"@uniweb/runtime": "0.5.
|
|
54
|
+
"@uniweb/runtime": "0.5.17",
|
|
55
55
|
"@uniweb/content-reader": "1.1.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
package/src/prerender.js
CHANGED
|
@@ -502,6 +502,22 @@ function renderBlock(block) {
|
|
|
502
502
|
...block.properties,
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
// Resolve inherited entity data (mirrors BlockRenderer.jsx)
|
|
506
|
+
// EntityStore walks page/site hierarchy to find data matching meta.inheritData
|
|
507
|
+
const entityStore = block.website?.entityStore
|
|
508
|
+
if (entityStore) {
|
|
509
|
+
const resolved = entityStore.resolve(block, meta)
|
|
510
|
+
if (resolved.status === 'ready' && resolved.data) {
|
|
511
|
+
const merged = { ...content.data }
|
|
512
|
+
for (const key of Object.keys(resolved.data)) {
|
|
513
|
+
if (merged[key] === undefined) {
|
|
514
|
+
merged[key] = resolved.data[key]
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
content.data = merged
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
505
521
|
// Background handling (mirrors BlockRenderer.jsx)
|
|
506
522
|
const { background, ...wrapperProps } = getWrapperProps(block)
|
|
507
523
|
|
|
@@ -1113,6 +1113,11 @@ async function loadFoundationVars(foundationPath) {
|
|
|
1113
1113
|
* Layout panels (header, footer, left, right) are persistent regions
|
|
1114
1114
|
* that appear on every page. They live in layout/ parallel to pages/.
|
|
1115
1115
|
*
|
|
1116
|
+
* Supports two forms:
|
|
1117
|
+
* - Folder: layout/header/ (directory with .md files, like a page)
|
|
1118
|
+
* - File shorthand: layout/header.md (single markdown file)
|
|
1119
|
+
* Folder takes priority when both exist.
|
|
1120
|
+
*
|
|
1116
1121
|
* @param {string} layoutDir - Path to layout directory
|
|
1117
1122
|
* @param {string} siteRoot - Path to site root
|
|
1118
1123
|
* @returns {Promise<Object>} { header, footer, left, right }
|
|
@@ -1125,19 +1130,35 @@ async function collectLayoutPanels(layoutDir, siteRoot) {
|
|
|
1125
1130
|
const knownPanels = ['header', 'footer', 'left', 'right']
|
|
1126
1131
|
const entries = await readdir(layoutDir)
|
|
1127
1132
|
|
|
1128
|
-
for (const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1133
|
+
for (const panel of knownPanels) {
|
|
1134
|
+
// Folder form (higher priority)
|
|
1135
|
+
if (entries.includes(panel)) {
|
|
1136
|
+
const entryPath = join(layoutDir, panel)
|
|
1137
|
+
const stats = await stat(entryPath)
|
|
1138
|
+
if (stats.isDirectory()) {
|
|
1139
|
+
const pageResult = await processPage(entryPath, panel, siteRoot, {
|
|
1140
|
+
isIndex: false,
|
|
1141
|
+
parentRoute: '/layout'
|
|
1142
|
+
})
|
|
1143
|
+
if (pageResult) {
|
|
1144
|
+
result[panel] = pageResult.page
|
|
1145
|
+
}
|
|
1146
|
+
continue
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1138
1149
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1150
|
+
// File shorthand: layout/header.md
|
|
1151
|
+
const mdFile = `${panel}.md`
|
|
1152
|
+
if (entries.includes(mdFile)) {
|
|
1153
|
+
const filePath = join(layoutDir, mdFile)
|
|
1154
|
+
const { section } = await processMarkdownFile(filePath, '1', siteRoot, panel)
|
|
1155
|
+
result[panel] = {
|
|
1156
|
+
route: `/layout/${panel}`,
|
|
1157
|
+
title: panel.charAt(0).toUpperCase() + panel.slice(1),
|
|
1158
|
+
description: '',
|
|
1159
|
+
layout: { header: true, footer: true, leftPanel: true, rightPanel: true },
|
|
1160
|
+
sections: [section]
|
|
1161
|
+
}
|
|
1141
1162
|
}
|
|
1142
1163
|
}
|
|
1143
1164
|
|