@uniweb/build 1.17.1 → 1.17.2

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.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,15 +56,15 @@
56
56
  "js-yaml": "^4.3.2",
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
- "@uniweb/content-writer": "~1.3.1",
60
59
  "@uniweb/content-reader": "~1.5.9",
61
60
  "@uniweb/semantic-parser": "~1.13.2",
62
61
  "@uniweb/schemas": "~1.6.10",
63
- "@uniweb/projections": "~1.2.11",
64
- "@uniweb/theming": "~1.2.1"
62
+ "@uniweb/theming": "~1.2.1",
63
+ "@uniweb/content-writer": "~1.3.1",
64
+ "@uniweb/projections": "~1.2.12"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "~1.4.5"
67
+ "@uniweb/runtime": "~1.4.6"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -73,8 +73,8 @@
73
73
  "@tailwindcss/vite": "^4.0.0",
74
74
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
75
75
  "vite-plugin-svgr": "^4.0.0",
76
- "@uniweb/core": "~1.6.4",
77
- "@uniweb/runtime": "~1.4.5"
76
+ "@uniweb/core": "~1.6.5",
77
+ "@uniweb/runtime": "~1.4.6"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {
@@ -131,6 +131,30 @@ const SETS_ITS_ROOT = /@import\s+["']tailwindcss[^"']*["'][^;]*\bsource\(/
131
131
  // with that name (`className: { type: 'string' }`).
132
132
  const WRITES_CLASSES = /\bclassName\s*(?:=\s*\{[^}]*["'`]|[=:]\s*["'`])|\bcn\(|\bclass=["']/
133
133
 
134
+ // Or classes kept in a string, for code that hands them out: a colour's classes in a map,
135
+ // `{ amber: 'text-amber-600 bg-amber-50' }`, which a component in another folder then writes.
136
+ // ⚖️ A string counts when a class in it has a shade (`text-amber-600`) or an arbitrary value
137
+ // (`w-[42px]`), or when two of its words are classes and one has a number in it (`rounded-xl p-6`) —
138
+ // not a word with hyphens, an icon's name (`lu-house`) or a status (`to-verify`).
139
+ // ⛔ Until 2026-11-06 only a class written in place counted, so a `utils/` folder holding such a map
140
+ // was never named, and a site's CSS was missing its classes: an amber icon came out grey.
141
+ const STRING = /(["'`])((?:\\.|(?!\1)[^\\\n])*)\1/g
142
+ const SHADE = /^!?(?:[\w-]+:)*-?(?:bg|text|border|ring|fill|stroke|from|via|to|outline|divide|accent|caret|decoration|shadow|placeholder)-[a-z]+-(?:50|[1-9]00|950)(?:\/\d+)?$/
143
+ const ARBITRARY = /^!?(?:[\w-]+:)*-?[a-z]+(?:-[a-z]+)*-\[[^\]\s]+\]$/
144
+ const UTILITY = /^!?(?:[\w-]+:)*-?[a-z]+(?:-[\w./[\]#%]+)+$/
145
+
146
+ /** Whether code writes a class, or keeps one in a string. */
147
+ function writesClasses(code) {
148
+ if (WRITES_CLASSES.test(code)) return true
149
+ for (const [, , text] of code.matchAll(STRING)) {
150
+ const words = text.trim().split(/\s+/)
151
+ if (words.some((word) => SHADE.test(word) || ARBITRARY.test(word))) return true
152
+ const classes = words.filter((word) => UTILITY.test(word))
153
+ if (classes.length >= 2 && classes.some((word) => /\d/.test(word))) return true
154
+ }
155
+ return false
156
+ }
157
+
134
158
  const NOT_THE_FOUNDATIONS_CODE = new Set(['node_modules', 'dist', 'public', 'test', 'tests', '__tests__'])
135
159
 
136
160
  function codeFiles(dir, found = []) {
@@ -205,7 +229,7 @@ export function unreadFolders(stylesPath) {
205
229
  const unread = new Map()
206
230
  for (const file of codeFiles(dir)) {
207
231
  if (read.some((path) => file === path || file.startsWith(path + sep))) continue
208
- if (!WRITES_CLASSES.test(withoutComments(readFileSync(file, 'utf8')))) continue
232
+ if (!writesClasses(withoutComments(readFileSync(file, 'utf8')))) continue
209
233
  const [top, ...below] = relative(dir, file).split(sep)
210
234
  const entry = unread.get(top) ?? { path: top, files: 0, isFolder: below.length > 0, typed: false }
211
235
  entry.files++
package/src/prerender.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  deriveCacheKey,
24
24
  evaluateQuery,
25
25
  } from '@uniweb/core'
26
- import { isDynamicRoute, recordTitle, recordImage, routePatternToRegex, routeFieldOf } from '@uniweb/core/route-match'
26
+ import { isDynamicRoute, recordTitle, recordImage, recordDescription, routePatternToRegex, routeFieldOf } from '@uniweb/core/route-match'
27
27
  import DataStore from '@uniweb/core/datastore'
28
28
  import { DEFAULT_ICON_BASE } from '@uniweb/core/icon-corpus'
29
29
  import { executeFetch, mergeDataIntoContent, toFetchList } from './site/data-fetcher.js'
@@ -483,7 +483,11 @@ export function expandDynamicPages(pages, fetched, onProgress = () => {}, stats
483
483
  // `title` alone, so a person record's page kept the template's own title.
484
484
  const title = recordTitle(item)
485
485
  if (title) concretePage.title = title
486
- if (item.description || item.excerpt) concretePage.description = item.description || item.excerpt
486
+ // Described by the SPA's rule too (`recordDescription`): text only. ⛔ Until 2026-11-06 a
487
+ // rich-text `description` was taken as it came, and the page's meta description read
488
+ // `[object Object]`.
489
+ const description = recordDescription(item)
490
+ if (description) concretePage.description = description
487
491
  // ⭐ And its picture is what a link to the page shows (`recordImage`) — the SPA's rule.
488
492
  const image = recordImage(item)
489
493
  if (image) concretePage.seo = { ...(concretePage.seo || {}), image }