@stainless-api/docs-search 0.1.0-beta.35 → 0.1.0-beta.36
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/dist/providers/pagefind.js +11 -6
- package/package.json +2 -2
|
@@ -3,12 +3,17 @@ async function loadPagefind(path) {
|
|
|
3
3
|
return await import(new URL(path, import.meta.url).href);
|
|
4
4
|
}
|
|
5
5
|
async function guideSearch(loadPath, query, limit) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
try {
|
|
7
|
+
const response = await (await loadPagefind(loadPath)).search(query);
|
|
8
|
+
const items = limit ? response.results.slice(0, limit) : response.results;
|
|
9
|
+
return Promise.all(items.map((result) => result.data().then((data) => ({
|
|
10
|
+
...result,
|
|
11
|
+
data
|
|
12
|
+
}))));
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error(error);
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs-search",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.36",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"fuse.js": "^7.1.0",
|
|
20
20
|
"htmlparser2": "^10.1.0",
|
|
21
21
|
"lucide-react": "^0.574.0",
|
|
22
|
-
"@stainless-api/docs-ui": "0.1.0-beta.
|
|
22
|
+
"@stainless-api/docs-ui": "0.1.0-beta.83",
|
|
23
23
|
"@stainless-api/ui-primitives": "0.1.0-beta.49"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|