@uniweb/build 1.24.4 → 1.24.5
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 +5 -5
- package/src/docs.js +24 -24
- package/src/site/content-collector.js +24 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.5",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"js-yaml": "^4.3.2",
|
|
58
58
|
"sharp": "^0.35.5",
|
|
59
59
|
"yaml": "^2.5.0",
|
|
60
|
-
"@uniweb/content-writer": "~1.3.3",
|
|
61
60
|
"@uniweb/content-reader": "~1.5.12",
|
|
62
|
-
"@uniweb/
|
|
63
|
-
"@uniweb/projections": "~1.2.17",
|
|
61
|
+
"@uniweb/schemas": "~1.7.5",
|
|
64
62
|
"@uniweb/theming": "~1.3.3",
|
|
65
|
-
"@uniweb/
|
|
63
|
+
"@uniweb/content-writer": "~1.3.3",
|
|
64
|
+
"@uniweb/projections": "~1.2.17",
|
|
65
|
+
"@uniweb/semantic-parser": "~1.13.6"
|
|
66
66
|
},
|
|
67
67
|
"optionalDependencies": {
|
|
68
68
|
"@uniweb/runtime": "~1.6.6"
|
package/src/docs.js
CHANGED
|
@@ -12,6 +12,19 @@ import { describeContent } from '@uniweb/schemas/content'
|
|
|
12
12
|
import { buildSchema } from './schema.js'
|
|
13
13
|
import { resolveFoundationSrcPath } from './utils/foundation-source-root.js'
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* One option of a select, as COMPONENTS.md lists it: the value the frontmatter writes, then the
|
|
17
|
+
* label an author reads, when it says more than the value.
|
|
18
|
+
*
|
|
19
|
+
* @param {string|{ value: string, label?: string }} option
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
function optionWords(option) {
|
|
23
|
+
if (!option || typeof option !== 'object') return `\`${option}\``
|
|
24
|
+
const label = typeof option.label === 'string' && option.label && option.label !== option.value ? ` ${option.label}` : ''
|
|
25
|
+
return `\`${option.value}\`${label}`
|
|
26
|
+
}
|
|
27
|
+
|
|
15
28
|
/**
|
|
16
29
|
* Generate markdown documentation for a single component
|
|
17
30
|
*
|
|
@@ -39,37 +52,24 @@ function generateComponentDocs(name, meta) {
|
|
|
39
52
|
lines.push('')
|
|
40
53
|
}
|
|
41
54
|
|
|
42
|
-
// Parameters (shown first - most important for content authors)
|
|
55
|
+
// Parameters (shown first - most important for content authors). ⭐ Each as the editor offers it:
|
|
56
|
+
// the name and value a section's frontmatter writes, beside the words an author reads — the
|
|
57
|
+
// param's label and description, and each option's label. ⛔ Until 2026-11-21 a select showed its
|
|
58
|
+
// option values alone and no label, so a dropdown named for a page's subjects ("Entity model",
|
|
59
|
+
// "Reusable backend") read here as a list of slugs, and the catalog couldn't show what an author
|
|
60
|
+
// would be offered.
|
|
43
61
|
if (meta.params && Object.keys(meta.params).length > 0) {
|
|
44
62
|
lines.push('### Parameters')
|
|
45
63
|
lines.push('')
|
|
46
64
|
|
|
47
65
|
for (const [key, prop] of Object.entries(meta.params)) {
|
|
48
66
|
const defaultVal = prop.default !== undefined ? prop.default : ''
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
lines.push(`**${key}**`)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// For select type, show options on next line
|
|
58
|
-
if (prop.type === 'select' && prop.options) {
|
|
59
|
-
const optionValues = prop.options.map(o =>
|
|
60
|
-
typeof o === 'object' ? o.value : o
|
|
61
|
-
).join(' | ')
|
|
62
|
-
lines.push(` ${optionValues}`)
|
|
63
|
-
} else if (prop.type === 'boolean') {
|
|
64
|
-
// For boolean, show the label as description
|
|
65
|
-
if (prop.label) {
|
|
66
|
-
lines.push(` ${prop.label}`)
|
|
67
|
-
}
|
|
68
|
-
} else if (prop.label) {
|
|
69
|
-
// For other types, show label
|
|
70
|
-
lines.push(` ${prop.label}`)
|
|
67
|
+
const head = defaultVal !== '' ? `**${key}** = \`${defaultVal}\`` : `**${key}**`
|
|
68
|
+
lines.push(typeof prop.label === 'string' && prop.label ? `${head} — ${prop.label}` : head)
|
|
69
|
+
if (typeof prop.description === 'string' && prop.description) lines.push(` ${prop.description}`)
|
|
70
|
+
if (prop.type === 'select' && Array.isArray(prop.options)) {
|
|
71
|
+
lines.push(` ${prop.options.map(optionWords).join(' · ')}`)
|
|
71
72
|
}
|
|
72
|
-
|
|
73
73
|
lines.push('')
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -927,6 +927,26 @@ function resolveDisplayTitle(declaredTitle, segment, sections) {
|
|
|
927
927
|
return extractH1(first?.content) || prettifySlug(segment)
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
+
/**
|
|
931
|
+
* ⭐ A DOCUMENT FOLDER'S OWN REDIRECT OR REWRITE, from its `folder.yml`, as `processPage` reads a
|
|
932
|
+
* `page.yml`'s. A page that redirects holds no section, so in folder mode it is a directory holding
|
|
933
|
+
* only its `folder.yml`, as in page mode it is one holding only a `page.yml`. That is how a moved page
|
|
934
|
+
* keeps its old address in either mode. The push sends it (`uwx/site.js::buildPageData`), a host serves
|
|
935
|
+
* it (`resolveRoute`), and a pull writes it back (`uwx/site-project.js::pageRecordToYml`). ⛔ Until
|
|
936
|
+
* 2026-11-21 neither container below read it: a hosted site redirected, while `uniweb dev` and a static
|
|
937
|
+
* build showed an empty page there, as with a container's `fetch:` until 2026-09-11.
|
|
938
|
+
*
|
|
939
|
+
* @param {object} dirConfig - the folder's `folder.yml`
|
|
940
|
+
* @param {string} route - the folder's route
|
|
941
|
+
* @returns {object} the page fields its redirect or rewrite gives; none when it has neither
|
|
942
|
+
*/
|
|
943
|
+
function documentFolderRedirect(dirConfig, route) {
|
|
944
|
+
// A relative redirect resolves against the page's own route — core's rule, as in `processPage`.
|
|
945
|
+
if (dirConfig.redirect) return { redirect: authoredRedirectTarget(route, dirConfig.redirect), seo: { noindex: true } }
|
|
946
|
+
if (dirConfig.rewrite) return { rewrite: dirConfig.rewrite, seo: { noindex: true } }
|
|
947
|
+
return {}
|
|
948
|
+
}
|
|
949
|
+
|
|
930
950
|
/**
|
|
931
951
|
* ⭐ A PAGE'S SETTINGS, read from its config by one rule: a `page.yml` or `folder.yml`, or the
|
|
932
952
|
* frontmatter of a page that is one `.md` file (`page-settings.js`). Its title is the caller's,
|
|
@@ -2279,7 +2299,8 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
|
|
|
2279
2299
|
fetch: parseFetchConfig(...fetchIn(dirConfig, relative(siteRoot, join(entryPath, 'folder.yml')), 'page')) || null,
|
|
2280
2300
|
hasContent: false,
|
|
2281
2301
|
sections: [],
|
|
2282
|
-
order: typeof dirConfig.order === 'number' ? dirConfig.order : undefined
|
|
2302
|
+
order: typeof dirConfig.order === 'number' ? dirConfig.order : undefined,
|
|
2303
|
+
...documentFolderRedirect(dirConfig, containerRoute)
|
|
2283
2304
|
}
|
|
2284
2305
|
|
|
2285
2306
|
pages.push(containerPage)
|
|
@@ -2361,7 +2382,8 @@ async function collectPagesRecursive(dirPath, parentRoute, siteRoot, orderConfig
|
|
|
2361
2382
|
fetch: parseFetchConfig(...fetchIn(dirConfig, relative(siteRoot, join(entryPath, 'folder.yml')), 'page')) || null,
|
|
2362
2383
|
hasContent: false,
|
|
2363
2384
|
sections: [],
|
|
2364
|
-
order: typeof dirConfig.order === 'number' ? dirConfig.order : undefined
|
|
2385
|
+
order: typeof dirConfig.order === 'number' ? dirConfig.order : undefined,
|
|
2386
|
+
...documentFolderRedirect(dirConfig, containerRoute)
|
|
2365
2387
|
}
|
|
2366
2388
|
|
|
2367
2389
|
if (isSiteRoot && entry === '404') {
|