fumadocs-core 16.6.0 → 16.6.1

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.
@@ -8,6 +8,7 @@ interface ShikiConfig {
8
8
  }
9
9
  interface ResolvedShikiConfig extends ShikiConfig {
10
10
  id: symbol;
11
+ resolveThemes: (options?: CodeOptionsThemes<BundledTheme> | Record<never, never>) => CodeOptionsThemes<BundledTheme>;
11
12
  }
12
13
  /** define shared configurations for Shiki */
13
14
  declare function defineShikiConfig(config: ShikiConfig): ResolvedShikiConfig;
@@ -5,6 +5,16 @@ function defineShikiConfig(config) {
5
5
  return {
6
6
  id: Symbol(),
7
7
  defaultThemes: config.defaultThemes,
8
+ resolveThemes(options = {}) {
9
+ let out;
10
+ if (!("theme" in options) && !("themes" in options)) out = config.defaultThemes;
11
+ else out = options;
12
+ if ("themes" in out && out.defaultColor === void 0) return {
13
+ ...out,
14
+ defaultColor: false
15
+ };
16
+ return out;
17
+ },
8
18
  createHighlighter() {
9
19
  if (created) return created;
10
20
  created = config.createHighlighter();
@@ -5,13 +5,11 @@ import { toJsxRuntime } from "hast-util-to-jsx-runtime";
5
5
  //#region src/highlight/core/index.ts
6
6
  async function highlightHast(code, options) {
7
7
  const { fallbackLanguage = "text", config, ...resolved } = options;
8
+ Object.assign(resolved, config.resolveThemes(resolved));
8
9
  let themesToLoad;
9
- if (!("theme" in resolved) && !("themes" in resolved)) Object.assign(resolved, config.defaultThemes);
10
10
  if ("theme" in resolved) themesToLoad = [resolved.theme];
11
- else if ("themes" in resolved) {
12
- themesToLoad = Object.values(resolved.themes).filter((v) => v !== void 0);
13
- resolved.defaultColor ??= false;
14
- } else throw new Error("impossible");
11
+ else if ("themes" in resolved) themesToLoad = Object.values(resolved.themes).filter((v) => v !== void 0);
12
+ else throw new Error("impossible");
15
13
  const { isSpecialLang } = await import("shiki/core");
16
14
  const highlighter = await config.createHighlighter();
17
15
  if (!isSpecialLang(resolved.lang) && !(resolved.lang in highlighter.getBundledLanguages()) && !highlighter.getLoadedLanguages().includes(resolved.lang)) resolved.lang = fallbackLanguage;
@@ -15,7 +15,7 @@ const remarkStructureDefaultOptions = {
15
15
  "mdxJsxFlowElement"
16
16
  ],
17
17
  mdxTypes(node) {
18
- return node.children.length === 0;
18
+ return !node.children || node.children.length === 0;
19
19
  },
20
20
  exportAs: false
21
21
  };
@@ -40,7 +40,7 @@ async function search(query, options) {
40
40
  content: title,
41
41
  url
42
42
  }];
43
- const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
43
+ const headingTitle = item.type === "text" && item.text ? extractHeadingTitle(item.text) : "";
44
44
  if (headingTitle) {
45
45
  slugger.reset();
46
46
  chunkResults.push({
@@ -70,7 +70,7 @@ function useDocsSearch(clientOptions, deps) {
70
70
  return searchDocs(debouncedValue, client);
71
71
  }
72
72
  case "mixedbread": {
73
- const { search } = await import("../mixedbread-RiA_24CE.js");
73
+ const { search } = await import("../mixedbread-TBJmV3co.js");
74
74
  return search(debouncedValue, client);
75
75
  }
76
76
  case "static": {
@@ -33,13 +33,11 @@ interface MixedbreadSearchOptions {
33
33
  */
34
34
  topK?: number;
35
35
  /**
36
- * Re-rank search results for improved relevance
37
- *
38
- * @defaultValue true
36
+ * Re-rank search results for improved relevance (this adds latency to the search)
39
37
  */
40
38
  rerank?: boolean;
41
39
  /**
42
- * Rewrite the query for better search results
40
+ * Rewrite the query for better search results (this adds latency to the search)
43
41
  */
44
42
  rewriteQuery?: boolean;
45
43
  /**
@@ -24,7 +24,7 @@ function defaultTransform(results) {
24
24
  content: title,
25
25
  url
26
26
  }];
27
- const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
27
+ const headingTitle = item.type === "text" && item.text ? extractHeadingTitle(item.text) : "";
28
28
  if (headingTitle) {
29
29
  slugger.reset();
30
30
  chunkResults.push({
@@ -38,7 +38,7 @@ function defaultTransform(results) {
38
38
  });
39
39
  }
40
40
  function createMixedbreadSearchAPI(options) {
41
- const { client, storeIdentifier, topK = 10, rerank = true, rewriteQuery, scoreThreshold, transform } = options;
41
+ const { client, storeIdentifier, topK = 10, rerank, rewriteQuery, scoreThreshold, transform } = options;
42
42
  return createEndpoint({
43
43
  async search(query, searchOptions) {
44
44
  if (!query.trim()) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.6.0",
3
+ "version": "16.6.1",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",
@@ -142,18 +142,18 @@
142
142
  },
143
143
  "devDependencies": {
144
144
  "@mdx-js/mdx": "^3.1.1",
145
- "@mixedbread/sdk": "^0.50.1",
146
- "@orama/core": "^1.2.17",
145
+ "@mixedbread/sdk": "^0.51.0",
146
+ "@orama/core": "^1.2.18",
147
147
  "@oramacloud/client": "^2.1.4",
148
- "@tanstack/react-router": "1.158.4",
148
+ "@tanstack/react-router": "1.159.5",
149
149
  "@types/estree-jsx": "^1.0.5",
150
150
  "@types/hast": "^3.0.4",
151
151
  "@types/mdast": "^4.0.4",
152
152
  "@types/negotiator": "^0.6.4",
153
- "@types/node": "25.2.1",
154
- "@types/react": "^19.2.13",
153
+ "@types/node": "25.2.3",
154
+ "@types/react": "^19.2.14",
155
155
  "@types/react-dom": "^19.2.3",
156
- "algoliasearch": "5.48.0",
156
+ "algoliasearch": "5.48.1",
157
157
  "lucide-react": "^0.563.0",
158
158
  "next": "16.1.6",
159
159
  "react-router": "^7.13.0",