@uniweb/build 1.13.5 → 1.13.6
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/content/index.js +1 -1
- package/src/prerender.js +3 -2
- package/src/site/content-collector.js +25 -0
- package/src/site/plugin.js +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.6",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"@uniweb/content-reader": "~1.5.7",
|
|
60
60
|
"@uniweb/content-writer": "~1.3.1",
|
|
61
61
|
"@uniweb/schemas": "~1.6.7",
|
|
62
|
-
"@uniweb/projections": "~1.2.8",
|
|
63
62
|
"@uniweb/semantic-parser": "~1.13.0",
|
|
63
|
+
"@uniweb/projections": "~1.2.9",
|
|
64
64
|
"@uniweb/theming": "~1.2.1"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@uniweb/runtime": "~1.3.
|
|
67
|
+
"@uniweb/runtime": "~1.3.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
75
75
|
"vite-plugin-svgr": "^4.0.0",
|
|
76
76
|
"@uniweb/core": "~1.5.1",
|
|
77
|
-
"@uniweb/runtime": "~1.3.
|
|
77
|
+
"@uniweb/runtime": "~1.3.4"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"vite": {
|
package/src/content/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module @uniweb/build/content
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export { collectSiteContent } from '../site/content-collector.js'
|
|
13
|
+
export { collectSiteContent, pageSectionFiles } from '../site/content-collector.js'
|
|
14
14
|
|
|
15
15
|
// Query + fetch resolution. Pure functions on the clean dep
|
|
16
16
|
// chain — re-exported here so headless callers (unipress, sidecars)
|
package/src/prerender.js
CHANGED
|
@@ -1246,7 +1246,8 @@ export async function prerenderSite(siteDir, options = {}) {
|
|
|
1246
1246
|
// 1) CLI --host flag (hostOverride)
|
|
1247
1247
|
// 2) CI host detected from env vars (Vercel, CF Pages, Netlify)
|
|
1248
1248
|
// 3) 'cloudflare-pages' default (preserves the historical
|
|
1249
|
-
// `_redirects` output; same format also works on Netlify)
|
|
1249
|
+
// `_redirects` output; same format also works on Netlify). This is a
|
|
1250
|
+
// file format, not a host anyone chose, so the build names no adapter for it.
|
|
1250
1251
|
//
|
|
1251
1252
|
// The build does not read deploy.yml. When the orchestrator
|
|
1252
1253
|
// (uniweb deploy) needs adapter-specific config (bucket,
|
|
@@ -1259,7 +1260,7 @@ export async function prerenderSite(siteDir, options = {}) {
|
|
|
1259
1260
|
if (ciContext?.runner) {
|
|
1260
1261
|
onProgress(`CI runner: ${ciContext.runner}${ciContext.host ? '' : ' (host not implied)'}`)
|
|
1261
1262
|
}
|
|
1262
|
-
onProgress(`Host adapter: ${adapter.name}`)
|
|
1263
|
+
if (hostOverride || ciContext?.host) onProgress(`Host adapter: ${adapter.name}`)
|
|
1263
1264
|
await adapter.postBuild({
|
|
1264
1265
|
distDir,
|
|
1265
1266
|
siteContent: defaultSiteContent,
|
|
@@ -1814,6 +1814,31 @@ async function processPage(pagePath, pageName, siteRoot, { isIndex = false, pare
|
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
1816
|
|
|
1817
|
+
/**
|
|
1818
|
+
* A page folder's markdown files in the order the page has them, each child after its parent. A
|
|
1819
|
+
* file the page leaves out, as a `sections:` list not naming it does, is not among them.
|
|
1820
|
+
*
|
|
1821
|
+
* The page's own walk (`processPage`), so a tool that shows a page (`uniweb inspect`) has no second
|
|
1822
|
+
* rule for what is on it or in what order.
|
|
1823
|
+
*
|
|
1824
|
+
* @param {string} pagePath - The page's folder
|
|
1825
|
+
* @param {string} siteRoot - The site's folder
|
|
1826
|
+
* @returns {Promise<string[]>} File names
|
|
1827
|
+
*/
|
|
1828
|
+
export async function pageSectionFiles(pagePath, siteRoot) {
|
|
1829
|
+
const { page } = await processPage(pagePath, parse(pagePath).base, siteRoot)
|
|
1830
|
+
const filesOf = new Map()
|
|
1831
|
+
const files = (await readdir(pagePath)).filter(isMarkdownFile).sort(compareFilenames)
|
|
1832
|
+
for (const file of files) {
|
|
1833
|
+
const name = stripAtPrefix(parse(file).name)
|
|
1834
|
+
const key = parseNumericPrefix(name).name || name
|
|
1835
|
+
filesOf.set(key, [...(filesOf.get(key) || []), file])
|
|
1836
|
+
}
|
|
1837
|
+
const walk = (sections) =>
|
|
1838
|
+
sections.flatMap((section) => [filesOf.get(section.stableId)?.shift(), ...walk(section.subsections || [])])
|
|
1839
|
+
return walk(page.sections).filter(Boolean)
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1817
1842
|
/**
|
|
1818
1843
|
* The homepage ONE config declares: the first named `pages:` entry, else `index:`.
|
|
1819
1844
|
* `undefined` when it declares none; `null` when its first `pages:` entry names
|
package/src/site/plugin.js
CHANGED
|
@@ -42,7 +42,7 @@ import { executeFetch, mergeDataIntoContent, toFetchList } from './data-fetcher.
|
|
|
42
42
|
import { shouldSplitContent } from './split-content.js'
|
|
43
43
|
import { jsonForScript } from '@uniweb/core/data-script'
|
|
44
44
|
// A favicon's MIME type by its extension — the rule a host's page shell types it by too.
|
|
45
|
-
import { faviconType } from '@uniweb/core/page-shell'
|
|
45
|
+
import { escapeHtml, faviconType } from '@uniweb/core/page-shell'
|
|
46
46
|
import { FONT_LINKS_MARKER } from './head-markers.js'
|
|
47
47
|
import { effectiveSeo, resolveSiteAddress } from './site-address.js'
|
|
48
48
|
import { collectExtensionAssets, isBrowserAsset } from './emit-extensions.js'
|
|
@@ -1177,6 +1177,15 @@ export function siteContentPlugin(options = {}) {
|
|
|
1177
1177
|
result = result.replace(/<html([^>]*)\slang="[^"]*"/, `<html$1 lang="${lang}"`)
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
|
+
// The shell's title is the site's name, as a hosted page's is (`@uniweb/core/page-shell`). A
|
|
1181
|
+
// page writes its own over it, so this is what shows where no page does: a static host's
|
|
1182
|
+
// 404.html, a site that does not prerender, a tab before the bundle runs. ⛔ Until 2026-10-31 it
|
|
1183
|
+
// stayed what the scaffold's `index.html` says, the project folder's name.
|
|
1184
|
+
const siteName = contentToInject?.config?.name
|
|
1185
|
+
if (siteName) {
|
|
1186
|
+
result = result.replace(/<title>[\s\S]*?<\/title>/, () => `<title>${escapeHtml(siteName)}</title>`)
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1180
1189
|
if (!headInjection) return result
|
|
1181
1190
|
|
|
1182
1191
|
// Insert before </head>
|