@uniweb/build 1.7.0 → 1.7.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 +7 -7
- package/src/runtime-schema.js +7 -30
- package/src/schema.js +5 -5
- package/src/site/content-collector.js +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.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.1.0",
|
|
57
57
|
"sharp": "^0.35.3",
|
|
58
58
|
"yaml": "^2.5.0",
|
|
59
|
+
"@uniweb/semantic-parser": "~1.12.2",
|
|
60
|
+
"@uniweb/schemas": "~1.6.1",
|
|
61
|
+
"@uniweb/theming": "~1.2.1",
|
|
59
62
|
"@uniweb/content-reader": "~1.5.4",
|
|
60
63
|
"@uniweb/content-writer": "~1.3.0",
|
|
61
|
-
"@uniweb/projections": "~1.1.6"
|
|
62
|
-
"@uniweb/schemas": "~1.6.0",
|
|
63
|
-
"@uniweb/semantic-parser": "~1.12.2",
|
|
64
|
-
"@uniweb/theming": "~1.2.0"
|
|
64
|
+
"@uniweb/projections": "~1.1.6"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@uniweb/runtime": "~1.1.
|
|
67
|
+
"@uniweb/runtime": "~1.1.15"
|
|
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.4.0",
|
|
77
|
-
"@uniweb/runtime": "~1.1.
|
|
77
|
+
"@uniweb/runtime": "~1.1.15"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"vite": {
|
package/src/runtime-schema.js
CHANGED
|
@@ -37,35 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
import { lowerData } from '@uniweb/schemas/content'
|
|
39
39
|
import { schemaDeclarationOf } from '@uniweb/schemas/foundation'
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A section type's `sticky`, checked: `true` or `false`, or `{ default, top }`. `top` is how far
|
|
43
|
-
* below the top the section stays — one CSS value, `4rem` or `var(--header-height)` — and is
|
|
44
|
-
* written into the style of the box that sticks, so a declaration (`;`, a brace) is refused.
|
|
45
|
-
*
|
|
46
|
-
* @param {*} declared - `meta.js`'s `sticky`
|
|
47
|
-
* @returns {{ default: boolean, top?: string }}
|
|
48
|
-
* @throws {Error} for any other shape
|
|
49
|
-
*/
|
|
50
|
-
export function stickyDeclaration(declared) {
|
|
51
|
-
if (typeof declared === 'boolean') return { default: declared }
|
|
52
|
-
if (!declared || typeof declared !== 'object' || Array.isArray(declared)) {
|
|
53
|
-
throw new Error(`[uniweb] Invalid 'sticky': write true, false or { default, top } — got ${JSON.stringify(declared)}`)
|
|
54
|
-
}
|
|
55
|
-
const unknown = Object.keys(declared).filter((key) => key !== 'default' && key !== 'top')
|
|
56
|
-
if (unknown.length) throw new Error(`[uniweb] Invalid 'sticky': ${unknown.join(', ')} — it takes default and top`)
|
|
57
|
-
if (declared.default !== undefined && typeof declared.default !== 'boolean') {
|
|
58
|
-
throw new Error(`[uniweb] Invalid 'sticky.default': write true or false`)
|
|
59
|
-
}
|
|
60
|
-
const out = { default: declared.default === true }
|
|
61
|
-
if (declared.top !== undefined) {
|
|
62
|
-
if (typeof declared.top !== 'string' || !declared.top.trim() || /[;{}]/.test(declared.top)) {
|
|
63
|
-
throw new Error(`[uniweb] Invalid 'sticky.top': one CSS length, such as '4rem' or 'var(--header-height)'`)
|
|
64
|
-
}
|
|
65
|
-
out.top = declared.top.trim()
|
|
66
|
-
}
|
|
67
|
-
return out
|
|
68
|
-
}
|
|
40
|
+
import { stickyDeclaration } from '@uniweb/schemas/section'
|
|
69
41
|
|
|
70
42
|
/**
|
|
71
43
|
* A `data:` entry as the runtime reads it: its schema ref, with the flags set on it — or null for an
|
|
@@ -164,8 +136,13 @@ export function extractRuntimeSchema(fullMeta) {
|
|
|
164
136
|
|
|
165
137
|
// Whether the section stays in view by default: core reads it, and the author's
|
|
166
138
|
// `sticky:` wins (`Block#initComponent`). The runtime makes sticky the box that can.
|
|
139
|
+
// `{ default }`, with `top` when the type has one — the shape a registered entry holds too.
|
|
167
140
|
if (fullMeta.sticky !== undefined) {
|
|
168
|
-
|
|
141
|
+
try {
|
|
142
|
+
runtime.sticky = stickyDeclaration(fullMeta.sticky)
|
|
143
|
+
} catch (err) {
|
|
144
|
+
throw new Error(`[uniweb] ${err.message}`)
|
|
145
|
+
}
|
|
169
146
|
}
|
|
170
147
|
|
|
171
148
|
// Data. `data:` is the single declaration surface for a section's structured
|
package/src/schema.js
CHANGED
|
@@ -21,8 +21,7 @@ import { describeChildren, describeVisuals, lowerChildren } from '@uniweb/schema
|
|
|
21
21
|
import { describeContent, lowerData } from '@uniweb/schemas/content'
|
|
22
22
|
import { normalizeData, schemaDeclarationOf } from '@uniweb/schemas/foundation'
|
|
23
23
|
import { rootListSection } from '@uniweb/schemas/conform'
|
|
24
|
-
import { SECTION_PARAMS, SECTION_KEYS } from '@uniweb/schemas/section'
|
|
25
|
-
import { stickyDeclaration } from './runtime-schema.js'
|
|
24
|
+
import { SECTION_PARAMS, SECTION_KEYS, stickyDeclaration } from '@uniweb/schemas/section'
|
|
26
25
|
import { collectSchemaRefs, buildDataSchemaMap, ownSchemaRefs } from './resolve-data-schema.js'
|
|
27
26
|
import {
|
|
28
27
|
composeSupports,
|
|
@@ -661,8 +660,9 @@ function buildComponentEntry(name, relativePath, meta) {
|
|
|
661
660
|
}
|
|
662
661
|
|
|
663
662
|
/**
|
|
664
|
-
* Refuse a `sticky` that is not `true`, `false` or `{ default, top }` (`stickyDeclaration
|
|
665
|
-
* the component — the lean runtime schema checks it too,
|
|
663
|
+
* Refuse a `sticky` that is not `true`, `false` or `{ default, top }` (`stickyDeclaration`,
|
|
664
|
+
* `@uniweb/schemas/section`), naming the component — the lean runtime schema checks it too,
|
|
665
|
+
* without the name. The entry keeps it as written; `register` writes it in one shape (format 3).
|
|
666
666
|
*
|
|
667
667
|
* @param {string} owner - who declares it, for the message
|
|
668
668
|
* @param {*} sticky - `meta.js`'s `sticky`
|
|
@@ -672,7 +672,7 @@ function refuseStickyDeclaration(owner, sticky) {
|
|
|
672
672
|
try {
|
|
673
673
|
stickyDeclaration(sticky)
|
|
674
674
|
} catch (err) {
|
|
675
|
-
throw new Error(`[uniweb] ${owner}: ${err.message
|
|
675
|
+
throw new Error(`[uniweb] ${owner}: ${err.message}`)
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
|
|
@@ -2622,11 +2622,15 @@ export async function collectSiteContent(sitePath, options = {}) {
|
|
|
2622
2622
|
// `base` reaches the theme because self-hosted font faces are authored
|
|
2623
2623
|
// root-relative (`/fonts/x.woff2`) and the emitted @font-face lives in an
|
|
2624
2624
|
// inline <style> — under a subdirectory deployment it must carry the base.
|
|
2625
|
-
const { config: processedTheme, css: themeCSS, links: themeLinks, warnings } = buildTheme(rawThemeConfig, { foundationVars, base })
|
|
2626
|
-
|
|
2627
|
-
// Log theme
|
|
2628
|
-
|
|
2629
|
-
|
|
2625
|
+
const { config: processedTheme, css: themeCSS, links: themeLinks, warnings, errors } = buildTheme(rawThemeConfig, { foundationVars, base })
|
|
2626
|
+
|
|
2627
|
+
// Log what theme.yml gets wrong — the check's findings (`errors`: a colour that
|
|
2628
|
+
// is not one, a key nothing reads) and what processing left out (`warnings`).
|
|
2629
|
+
// Neither stops the build: the theme renders with what could be used. ⛔ Until
|
|
2630
|
+
// 2026-10-19 the findings were dropped here, so a misspelled `code:` key or an
|
|
2631
|
+
// invalid colour reached no one.
|
|
2632
|
+
for (const message of [...(errors || []), ...(warnings || [])]) {
|
|
2633
|
+
console.warn(`[theme] ${message}`)
|
|
2630
2634
|
}
|
|
2631
2635
|
|
|
2632
2636
|
// Check if pages directory exists
|