@uniweb/build 0.16.11 → 0.16.13
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 +3 -3
- package/src/site/data-ball.js +20 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.13",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"js-yaml": "^4.1.0",
|
|
60
60
|
"sharp": "^0.35.3",
|
|
61
61
|
"yaml": "^2.5.0",
|
|
62
|
-
"@uniweb/content-writer": "0.3.3",
|
|
63
62
|
"@uniweb/theming": "0.1.15",
|
|
63
|
+
"@uniweb/content-writer": "0.3.3",
|
|
64
64
|
"@uniweb/projections": "0.2.5"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
+
"@uniweb/runtime": "0.9.6",
|
|
67
68
|
"@uniweb/content-reader": "1.2.2",
|
|
68
|
-
"@uniweb/runtime": "0.9.5",
|
|
69
69
|
"@uniweb/semantic-parser": "1.2.1",
|
|
70
70
|
"@uniweb/schemas": "0.2.5"
|
|
71
71
|
},
|
package/src/site/data-ball.js
CHANGED
|
@@ -54,8 +54,7 @@ function collectionOf(relPath) {
|
|
|
54
54
|
* @param {string} distDir - the site's built dist/ directory
|
|
55
55
|
* @param {string[]} [schemalessNames] - collection names with no data schema (from
|
|
56
56
|
* `emitSyncPackages(...).schemaless`); only these contribute `data`.
|
|
57
|
-
* @returns {Promise<{ data: Object
|
|
58
|
-
* to deliver (no schema-less data AND no search index).
|
|
57
|
+
* @returns {Promise<{ data: Object }|null>} null when there is nothing to deliver.
|
|
59
58
|
*/
|
|
60
59
|
export async function assembleDataBall(distDir, schemalessNames = []) {
|
|
61
60
|
const schemaless = new Set(schemalessNames)
|
|
@@ -94,18 +93,23 @@ export async function assembleDataBall(distDir, schemalessNames = []) {
|
|
|
94
93
|
|
|
95
94
|
if (Object.keys(data).length === 0) return null
|
|
96
95
|
|
|
97
|
-
// `search`
|
|
98
|
-
//
|
|
99
|
-
// harmless while it receives an empty map", and it retires the field as
|
|
100
|
-
// cleanup once nothing sends content. An absent key is a different shape from
|
|
101
|
-
// an empty one to a strict deserializer, and a missing required field fails
|
|
102
|
-
// exactly as loudly as an unknown one — which is how the producer half of
|
|
103
|
-
// this contract broke pushes earlier the same day, in the other direction.
|
|
96
|
+
// The `search` key is gone too, and that was the SECOND step of a two-step
|
|
97
|
+
// retirement, not an afterthought.
|
|
104
98
|
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
99
|
+
// Step one shipped `search: {}` — content removed, key kept — because an
|
|
100
|
+
// absent field and an empty one are different shapes to a strict
|
|
101
|
+
// deserializer, and a missing required field fails exactly as loudly as an
|
|
102
|
+
// unknown one. (The producer half of this same contract broke pushes earlier
|
|
103
|
+
// the same day by emitting a key the consumer had not declared. Same failure,
|
|
104
|
+
// opposite direction.) Step two is this: the consumer retired the field on
|
|
105
|
+
// 2026-08-01 and said an older CLI still sending it deploys fine, so the key
|
|
106
|
+
// now has nowhere to land and dropping it is safe in both directions.
|
|
107
|
+
//
|
|
108
|
+
// Worth keeping as a shape: **announce, then remove** — the mirror of
|
|
109
|
+
// "declare, then emit". Neither half of a wire can be changed in one step by
|
|
110
|
+
// one side, and which side moves first is decided by which direction the
|
|
111
|
+
// strictness runs.
|
|
112
|
+
return { data }
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
// --- local media in the ball -------------------------------------------------
|
|
@@ -121,7 +125,7 @@ export async function assembleDataBall(distDir, schemalessNames = []) {
|
|
|
121
125
|
* Site-root local asset refs anywhere in the ball (`/images/x.png`, `/collections/...`).
|
|
122
126
|
* Built `dist/data` refs are already site-root (the collection processor copied
|
|
123
127
|
* co-located assets to `public/collections/**`), so only `/`-prefixed refs are collected.
|
|
124
|
-
* @param {{data:object
|
|
128
|
+
* @param {{data:object}|null} ball
|
|
125
129
|
* @returns {string[]} deduped refs to upload
|
|
126
130
|
*/
|
|
127
131
|
export function collectBallAssets(ball) {
|
|
@@ -142,9 +146,9 @@ export function collectBallAssets(ball) {
|
|
|
142
146
|
* Rewrite the ball: replace every local ref the map covers with its serve URL. Pure —
|
|
143
147
|
* returns a NEW ball (the input is reused elsewhere). A ref the map omits (upload
|
|
144
148
|
* failed/skipped) is left untouched — never a broken URL.
|
|
145
|
-
* @param {{data:object
|
|
149
|
+
* @param {{data:object}|null} ball
|
|
146
150
|
* @param {Record<string,string>} map - ref → serve URL
|
|
147
|
-
* @returns {{data:object
|
|
151
|
+
* @returns {{data:object}|null} a new ball, or the input when there's nothing to do
|
|
148
152
|
*/
|
|
149
153
|
export function rewriteBallAssets(ball, map) {
|
|
150
154
|
if (!ball || !map || Object.keys(map).length === 0) return ball
|