@uniweb/build 1.24.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "1.24.3",
3
+ "version": "1.24.5",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,15 +57,15 @@
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.2",
61
- "@uniweb/content-reader": "~1.5.11",
60
+ "@uniweb/content-reader": "~1.5.12",
61
+ "@uniweb/schemas": "~1.7.5",
62
+ "@uniweb/theming": "~1.3.3",
63
+ "@uniweb/content-writer": "~1.3.3",
62
64
  "@uniweb/projections": "~1.2.17",
63
- "@uniweb/semantic-parser": "~1.13.5",
64
- "@uniweb/theming": "~1.3.2",
65
- "@uniweb/schemas": "~1.7.4"
65
+ "@uniweb/semantic-parser": "~1.13.6"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@uniweb/runtime": "~1.6.5"
68
+ "@uniweb/runtime": "~1.6.6"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -74,7 +74,7 @@
74
74
  "@tailwindcss/vite": "^4.0.0",
75
75
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
76
76
  "vite-plugin-svgr": "^4.0.0",
77
- "@uniweb/runtime": "~1.6.5",
77
+ "@uniweb/runtime": "~1.6.6",
78
78
  "@uniweb/core": "~1.6.13"
79
79
  },
80
80
  "peerDependenciesMeta": {
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
- // Parameter name with default
51
- if (defaultVal !== '') {
52
- lines.push(`**${key}** = \`${defaultVal}\``)
53
- } else {
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') {
@@ -33,6 +33,7 @@ import { parentRouteOf } from '@uniweb/core/route-match'
33
33
 
34
34
  import { validateItem, validateRecordFile, validateBound, validateKeyValue, contentBodyField, rootListSection, referencesOf, undeclaredFields } from '@uniweb/schemas/conform'
35
35
  import { normalizeData } from '@uniweb/schemas/foundation'
36
+ import { markdownToProseMirror } from '@uniweb/content-reader'
36
37
  import { isUuid } from './uwx/uuid.js'
37
38
  import { validateAndNormalizeSchema, buildDataSchemaMap } from './resolve-data-schema.js'
38
39
 
@@ -326,7 +327,7 @@ export async function validateDataInputs({ siteRoot, foundationPath }) {
326
327
  recordCount++
327
328
  // A delivered record is named by `$name` — the handle its file's pool entry is keyed by.
328
329
  if (item && typeof item.$name === 'string') checkedRecords.add(recordKey(entry.ref, item.$name))
329
- for (const finding of validateItem(entry.schema, item)) {
330
+ for (const finding of validateItem(entry.schema, item, READ_RICH_TEXT)) {
330
331
  violations.push({
331
332
  file: entry.path,
332
333
  schema: entry.ref,
@@ -389,6 +390,12 @@ function listViolation(finding, label, base) {
389
390
  return { ...base, item: label(idx), ...finding, field: finding.field.slice(m[0].length) || finding.field }
390
391
  }
391
392
 
393
+ /**
394
+ * A rich-text field written as markdown, read into the document a push sends, so its `max_length`
395
+ * counts the characters a reader sees (`@uniweb/schemas/rich-text-length`, 2026-11-17).
396
+ */
397
+ const READ_RICH_TEXT = { readRichText: (markdown) => markdownToProseMirror(markdown) }
398
+
392
399
  /**
393
400
  * Check the records in the records directory that pass 2 did not, each against the
394
401
  * data schema its folder names (`records/member/` → `@/member`).
@@ -465,7 +472,7 @@ async function validateRecordFiles(siteRoot, { srcDir, dataSchemas, keyTypes = n
465
472
  if (!checked.has(recordKey(ref, r.slug))) {
466
473
  out.checked++
467
474
  out.schemas.add(ref)
468
- for (const finding of validateRecordFile(schema, record)) {
475
+ for (const finding of validateRecordFile(schema, record, READ_RICH_TEXT)) {
469
476
  out.violations.push({ file: pooled.relPath, schema: ref, item: r.slug, users: [], ...finding })
470
477
  }
471
478
  }