@uniweb/projections 0.3.6 → 0.4.0
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/projections",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Projections of a Uniweb site's content — agent index, per-page markdown, search index. Pure JS, runs anywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@uniweb/content-writer": "^0.3.4",
|
|
35
|
-
"@uniweb/core": "^0.
|
|
35
|
+
"@uniweb/core": "^0.13.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"vitest": "^4.1.7",
|
package/src/index.js
CHANGED
package/src/search/generate.js
CHANGED
|
@@ -85,7 +85,7 @@ export function generateSearchIndex(siteContent, options = {}) {
|
|
|
85
85
|
* describe *where the index lives* — only whether it serves queries.
|
|
86
86
|
*
|
|
87
87
|
* @param {Object} pagesIndex - Result of {@link generateSearchIndex}
|
|
88
|
-
* @param {Object[]} [collectionIndexes] - Results of `
|
|
88
|
+
* @param {Object[]} [collectionIndexes] - Results of `generateRecordSearchIndex`
|
|
89
89
|
* @returns {Object} One index carrying every entry
|
|
90
90
|
*/
|
|
91
91
|
export function mergeSearchIndexes(pagesIndex, collectionIndexes = []) {
|
package/src/search/index.js
CHANGED
|
@@ -63,7 +63,29 @@ const isPrimitive = (v) =>
|
|
|
63
63
|
*/
|
|
64
64
|
const DISPLAY_VALUE_MAX = 200
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Search-index entries for one named group of records.
|
|
68
|
+
*
|
|
69
|
+
* ⛔ RENAMED from `generateCollectionIndex` — 2026-08-27, and the old name was
|
|
70
|
+
* wrong in two ways that mattered.
|
|
71
|
+
*
|
|
72
|
+
* 1. **"Collection" is FRAMEWORK'S build concept** — a named set our build
|
|
73
|
+
* compiles to one file. The live lane has no such thing: a host calls this
|
|
74
|
+
* with records it fetched from a folder, so the name put our build
|
|
75
|
+
* vocabulary into a function whose main caller is a host. `record` is true on
|
|
76
|
+
* both lanes and is what the argument actually holds.
|
|
77
|
+
* 2. **It never said `search`** — every sibling here does (`generateSearchIndex`,
|
|
78
|
+
* `mergeSearchIndexes`, `extractSearchContent`), and "collection index" reads
|
|
79
|
+
* as an index OF collections or a collection's own listing. It is neither: it
|
|
80
|
+
* is a search index derived FROM records.
|
|
81
|
+
*
|
|
82
|
+
* ⚠️ The RESULT still carries the old vocabulary — `type: 'collection'`,
|
|
83
|
+
* `collection: name`, and `id: "collection:<name>:<slug>"`. That is a data shape
|
|
84
|
+
* with live consumers (`kit`'s endpoint search provider and hosting's search both
|
|
85
|
+
* read `entry.collection`), so it is a separate, larger decision than this rename
|
|
86
|
+
* and is deliberately NOT bundled into it.
|
|
87
|
+
*/
|
|
88
|
+
export function generateRecordSearchIndex(name, config, collectionData, locale) {
|
|
67
89
|
// ⛔ NO DEFAULT FIELD LIST. This was `|| ['title']` — a claim about someone
|
|
68
90
|
// else's schema, and wrong for any collection without a `title` (a `people`
|
|
69
91
|
// collection has `name`, a `products` one has `label`). The failure was
|