fumadocs-core 15.0.16 → 15.0.18

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.
@@ -5,7 +5,42 @@ import "./chunk-MLKGABMK.js";
5
5
 
6
6
  // src/search/client/orama-cloud.ts
7
7
  async function searchDocs(query, tag, options) {
8
- const { client, params: extraParams = {} } = options;
8
+ const list = [];
9
+ const { index = "default", client, params: extraParams = {} } = options;
10
+ if (index === "crawler") {
11
+ const result2 = await client.search({
12
+ ...extraParams,
13
+ term: query,
14
+ where: {
15
+ category: tag ? {
16
+ eq: tag.slice(0, 1).toUpperCase() + tag.slice(1)
17
+ } : void 0,
18
+ ...extraParams.where
19
+ },
20
+ limit: 10
21
+ });
22
+ if (!result2) return list;
23
+ if (index === "crawler") {
24
+ for (const hit of result2.hits) {
25
+ const doc = hit.document;
26
+ list.push(
27
+ {
28
+ id: hit.id,
29
+ type: "page",
30
+ content: doc.title,
31
+ url: doc.path
32
+ },
33
+ {
34
+ id: "page" + hit.id,
35
+ type: "text",
36
+ content: doc.content,
37
+ url: doc.path
38
+ }
39
+ );
40
+ }
41
+ return list;
42
+ }
43
+ }
9
44
  const params = {
10
45
  ...extraParams,
11
46
  term: query,
@@ -20,9 +55,8 @@ async function searchDocs(query, tag, options) {
20
55
  }
21
56
  };
22
57
  const result = await client.search(params);
23
- if (!result) return [];
24
- const list = [];
25
- for (const item of result.groups ?? []) {
58
+ if (!result || !result.groups) return list;
59
+ for (const item of result.groups) {
26
60
  let addedHead = false;
27
61
  for (const hit of item.result) {
28
62
  const doc = hit.document;
@@ -28,6 +28,12 @@ interface AlgoliaOptions extends SearchOptions {
28
28
 
29
29
  interface OramaCloudOptions {
30
30
  client: OramaClient;
31
+ /**
32
+ * The type of your index.
33
+ *
34
+ * You can set it to `crawler` if you use crawler instead of the JSON index with schema provided by Fumadocs
35
+ */
36
+ index?: 'default' | 'crawler';
31
37
  params?: ClientSearchParams;
32
38
  }
33
39
 
@@ -53,7 +53,7 @@ function useDocsSearch(client, locale, tag, delayMs = 100, allowEmpty = false, k
53
53
  return searchDocs(index, debouncedValue, tag, rest);
54
54
  }
55
55
  if (client.type === "orama-cloud") {
56
- const { searchDocs } = await import("../orama-cloud-NHMXDFR2.js");
56
+ const { searchDocs } = await import("../orama-cloud-USLSOSXS.js");
57
57
  return searchDocs(debouncedValue, tag, client);
58
58
  }
59
59
  const { createStaticClient } = await import("../static-VESU2S64.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.0.16",
3
+ "version": "15.0.18",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -90,19 +90,19 @@
90
90
  ],
91
91
  "dependencies": {
92
92
  "@formatjs/intl-localematcher": "^0.6.0",
93
- "@orama/orama": "^3.1.2",
94
- "@shikijs/rehype": "^3.1.0",
95
- "@shikijs/transformers": "^3.1.0",
93
+ "@orama/orama": "^3.1.3",
94
+ "@shikijs/rehype": "^3.2.1",
95
+ "@shikijs/transformers": "^3.2.1",
96
96
  "github-slugger": "^2.0.0",
97
97
  "hast-util-to-estree": "^3.1.3",
98
98
  "hast-util-to-jsx-runtime": "^2.3.6",
99
- "image-size": "^2.0.0",
99
+ "image-size": "^2.0.1",
100
100
  "negotiator": "^1.0.0",
101
101
  "react-remove-scroll": "^2.6.3",
102
102
  "remark": "^15.0.0",
103
103
  "remark-gfm": "^4.0.1",
104
104
  "scroll-into-view-if-needed": "^3.1.0",
105
- "shiki": "^3.1.0",
105
+ "shiki": "^3.2.1",
106
106
  "unist-util-visit": "^5.0.0"
107
107
  },
108
108
  "devDependencies": {
@@ -119,7 +119,7 @@
119
119
  "algoliasearch": "4.24.0",
120
120
  "mdast-util-mdx-jsx": "^3.2.0",
121
121
  "mdast-util-mdxjs-esm": "^2.0.1",
122
- "next": "^15.2.1",
122
+ "next": "^15.2.2",
123
123
  "remark-mdx": "^3.1.0",
124
124
  "remark-rehype": "^11.1.1",
125
125
  "typescript": "^5.8.2",