@uniweb/build 0.6.8 → 0.6.10
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/site/config.js +6 -1
- 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.10",
|
|
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/site/config.js
CHANGED
|
@@ -185,6 +185,11 @@ export async function defineSiteConfig(options = {}) {
|
|
|
185
185
|
const isRuntimeMode =
|
|
186
186
|
isShellMode || process.env.VITE_FOUNDATION_MODE === 'runtime' || foundationInfo.type === 'url'
|
|
187
187
|
|
|
188
|
+
// Extensions are always runtime-loaded via import(), so they need import maps
|
|
189
|
+
// to resolve bare specifiers (react, @uniweb/core) even in bundled mode
|
|
190
|
+
const hasExtensions = siteConfig.extensions?.length > 0
|
|
191
|
+
const needsImportMap = isRuntimeMode || hasExtensions
|
|
192
|
+
|
|
188
193
|
// Dynamic imports for optional peer dependencies
|
|
189
194
|
// These are imported dynamically to avoid requiring them when not needed
|
|
190
195
|
const imports = [
|
|
@@ -333,7 +338,7 @@ export async function defineSiteConfig(options = {}) {
|
|
|
333
338
|
]
|
|
334
339
|
const IMPORT_MAP_PREFIX = '\0importmap:'
|
|
335
340
|
|
|
336
|
-
const importMapPlugin =
|
|
341
|
+
const importMapPlugin = needsImportMap ? (() => {
|
|
337
342
|
let isBuild = false
|
|
338
343
|
|
|
339
344
|
return {
|
|
@@ -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
|
|