@uniweb/build 0.15.6 → 0.15.7
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 +6 -6
- package/src/site/data-ball.js +15 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.7",
|
|
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.33.2",
|
|
61
61
|
"yaml": "^2.5.0",
|
|
62
|
-
"@uniweb/projections": "0.1.1",
|
|
63
62
|
"@uniweb/theming": "0.1.14",
|
|
64
|
-
"@uniweb/
|
|
63
|
+
"@uniweb/projections": "0.1.2",
|
|
64
|
+
"@uniweb/content-writer": "0.2.9"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@uniweb/
|
|
68
|
-
"@uniweb/
|
|
67
|
+
"@uniweb/runtime": "0.8.38",
|
|
68
|
+
"@uniweb/content-reader": "1.1.17",
|
|
69
69
|
"@uniweb/schemas": "0.2.4"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@tailwindcss/vite": "^4.0.0",
|
|
76
76
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
77
77
|
"vite-plugin-svgr": "^4.0.0",
|
|
78
|
-
"@uniweb/core": "0.7.
|
|
78
|
+
"@uniweb/core": "0.7.31"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"vite": {
|
package/src/site/data-ball.js
CHANGED
|
@@ -56,7 +56,7 @@ function collectionOf(relPath) {
|
|
|
56
56
|
* @returns {Promise<{ data: Object, search: Object }|null>} null when there is nothing
|
|
57
57
|
* to deliver (no schema-less data AND no search index).
|
|
58
58
|
*/
|
|
59
|
-
export async function assembleDataBall(distDir, schemalessNames = []
|
|
59
|
+
export async function assembleDataBall(distDir, schemalessNames = []) {
|
|
60
60
|
const schemaless = new Set(schemalessNames)
|
|
61
61
|
const allData = await readJsonTree(join(distDir, 'data'))
|
|
62
62
|
const data = {}
|
|
@@ -65,47 +65,22 @@ export async function assembleDataBall(distDir, schemalessNames = [], { projecti
|
|
|
65
65
|
}
|
|
66
66
|
const search = await readJsonTree(join(distDir, '_search'))
|
|
67
67
|
|
|
68
|
-
// Agent projections ride the
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
68
|
+
// Agent projections deliberately do NOT ride the ball.
|
|
69
|
+
//
|
|
70
|
+
// A backend that stores the site's content derives them itself at publish —
|
|
71
|
+
// one producer, so shipping ours would upload an artifact to the one host
|
|
72
|
+
// that does not need it, and invite two answers for one site. The projections
|
|
73
|
+
// this build emits into `dist/` are for hosts with no backend to derive them:
|
|
74
|
+
// static hosts and foreign backends. That is `@uniweb/projections`' scope and
|
|
75
|
+
// it is unchanged.
|
|
76
|
+
//
|
|
77
|
+
// (An opt-in `projections` bucket lived here while the delivery contract was
|
|
78
|
+
// open. It never shipped enabled, and the one-producer ruling closed the
|
|
79
|
+
// question — removed rather than left as a flag nobody may turn on.)
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
Object.keys(data).length === 0 &&
|
|
78
|
-
Object.keys(search).length === 0 &&
|
|
79
|
-
Object.keys(projectionFiles).length === 0
|
|
80
|
-
if (empty) return null
|
|
81
|
+
if (Object.keys(data).length === 0 && Object.keys(search).length === 0) return null
|
|
81
82
|
|
|
82
|
-
return
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Collect the agent projections from a built dist/ — `llms.txt` plus every
|
|
87
|
-
* `.md` page projection, keyed by their served path.
|
|
88
|
-
*
|
|
89
|
-
* Deliberately excludes `node_modules`-shaped noise and anything under the
|
|
90
|
-
* bundle's own asset directories; a site's `dist/` at this point holds only
|
|
91
|
-
* what the link lane emitted.
|
|
92
|
-
*
|
|
93
|
-
* @param {string} distDir
|
|
94
|
-
* @returns {Promise<Object<string, string>>}
|
|
95
|
-
*/
|
|
96
|
-
async function readTextTree(distDir) {
|
|
97
|
-
if (!existsSync(distDir)) return {}
|
|
98
|
-
const out = {}
|
|
99
|
-
const entries = await readdir(distDir, { withFileTypes: true, recursive: true })
|
|
100
|
-
for (const entry of entries) {
|
|
101
|
-
if (!entry.isFile()) continue
|
|
102
|
-
const isProjection = entry.name === 'llms.txt' || entry.name.endsWith('.md')
|
|
103
|
-
if (!isProjection) continue
|
|
104
|
-
const full = join(entry.parentPath || entry.path, entry.name)
|
|
105
|
-
const rel = relative(distDir, full).split(sep).join('/')
|
|
106
|
-
out[rel] = await readFile(full, 'utf8')
|
|
107
|
-
}
|
|
108
|
-
return out
|
|
83
|
+
return { data, search }
|
|
109
84
|
}
|
|
110
85
|
|
|
111
86
|
// --- local media in the ball -------------------------------------------------
|