fumadocs-core 15.5.0 → 15.5.2

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.
Files changed (43) hide show
  1. package/dist/{algolia-RQ5VQJAB.js → algolia-NXNLN7TR.js} +1 -3
  2. package/dist/breadcrumb.js +0 -2
  3. package/dist/{chunk-XMCPKVJQ.js → chunk-3JSIVMCJ.js} +3 -4
  4. package/dist/{chunk-NNKVN7WA.js → chunk-5SU2O5AS.js} +1 -1
  5. package/dist/chunk-7GNSIKII.js +47 -0
  6. package/dist/{chunk-FVY6EZ3N.js → chunk-BBP7MIO4.js} +12 -14
  7. package/dist/content/index.js +0 -2
  8. package/dist/dynamic-link.js +2 -3
  9. package/dist/{fetch-W5EHIBOE.js → fetch-ZSD7GUCX.js} +2 -4
  10. package/dist/framework/index.d.ts +1 -1
  11. package/dist/framework/index.js +1 -2
  12. package/dist/framework/next.js +1 -2
  13. package/dist/framework/react-router.js +1 -2
  14. package/dist/framework/tanstack.js +1 -2
  15. package/dist/hide-if-empty.d.ts +14 -0
  16. package/dist/hide-if-empty.js +63 -0
  17. package/dist/highlight/client.js +0 -1
  18. package/dist/highlight/index.js +0 -1
  19. package/dist/i18n/index.d.ts +32 -2
  20. package/dist/i18n/index.js +0 -2
  21. package/dist/link.js +2 -3
  22. package/dist/mdx-plugins/index.js +1 -2
  23. package/dist/{orama-cloud-USLSOSXS.js → orama-cloud-I4WBDIAI.js} +2 -3
  24. package/dist/search/algolia.js +0 -2
  25. package/dist/search/client.d.ts +70 -7
  26. package/dist/search/client.js +20 -13
  27. package/dist/search/orama-cloud.js +0 -2
  28. package/dist/search/server.d.ts +2 -1
  29. package/dist/search/server.js +5 -2
  30. package/dist/server/index.d.ts +2 -1
  31. package/dist/server/index.js +0 -1
  32. package/dist/sidebar.js +0 -1
  33. package/dist/source/index.d.ts +96 -96
  34. package/dist/source/index.js +214 -224
  35. package/dist/static-QTPM5MZT.js +60 -0
  36. package/dist/toc.js +0 -1
  37. package/dist/utils/use-effect-event.js +0 -1
  38. package/dist/utils/use-media-query.js +0 -1
  39. package/dist/utils/use-on-change.js +0 -1
  40. package/package.json +21 -13
  41. package/dist/chunk-MLKGABMK.js +0 -9
  42. package/dist/config-Cm58P4fz.d.ts +0 -32
  43. package/dist/static-VESU2S64.js +0 -61
@@ -0,0 +1,60 @@
1
+ import {
2
+ searchAdvanced,
3
+ searchSimple
4
+ } from "./chunk-WFUH5VBX.js";
5
+ import "./chunk-KAOEMCTI.js";
6
+
7
+ // src/search/client/static.ts
8
+ import { create, load } from "@orama/orama";
9
+ var cache = /* @__PURE__ */ new Map();
10
+ async function loadDB({
11
+ from = "/api/search",
12
+ initOrama = (locale) => create({ schema: { _: "string" }, language: locale })
13
+ }) {
14
+ const cacheKey = from;
15
+ const cached = cache.get(cacheKey);
16
+ if (cached) return cached;
17
+ async function init() {
18
+ const res = await fetch(from);
19
+ if (!res.ok)
20
+ throw new Error(
21
+ `failed to fetch exported search indexes from ${from}, make sure the search database is exported and available for client.`
22
+ );
23
+ const data = await res.json();
24
+ const dbs = /* @__PURE__ */ new Map();
25
+ if (data.type === "i18n") {
26
+ await Promise.all(
27
+ Object.entries(data.data).map(async ([k, v]) => {
28
+ const db2 = await initOrama(k);
29
+ load(db2, v);
30
+ dbs.set(k, {
31
+ type: v.type,
32
+ db: db2
33
+ });
34
+ })
35
+ );
36
+ return dbs;
37
+ }
38
+ const db = await initOrama();
39
+ load(db, data);
40
+ dbs.set("", {
41
+ type: data.type,
42
+ db
43
+ });
44
+ return dbs;
45
+ }
46
+ const result = init();
47
+ cache.set(cacheKey, result);
48
+ return result;
49
+ }
50
+ async function search(query, options) {
51
+ const { tag, locale } = options;
52
+ const db = (await loadDB(options)).get(locale ?? "");
53
+ if (!db) return [];
54
+ if (db.type === "simple")
55
+ return searchSimple(db, query);
56
+ return searchAdvanced(db.db, query, tag);
57
+ }
58
+ export {
59
+ search
60
+ };
package/dist/toc.js CHANGED
@@ -2,7 +2,6 @@
2
2
  import {
3
3
  useOnChange
4
4
  } from "./chunk-EMWGTXSW.js";
5
- import "./chunk-MLKGABMK.js";
6
5
 
7
6
  // src/toc.tsx
8
7
  import { createContext, forwardRef, useContext, useMemo, useRef } from "react";
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import "../chunk-MLKGABMK.js";
3
2
 
4
3
  // src/utils/use-effect-event.ts
5
4
  import { useCallback, useRef } from "react";
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  useMediaQuery
3
3
  } from "../chunk-EP5LHGDZ.js";
4
- import "../chunk-MLKGABMK.js";
5
4
  export {
6
5
  useMediaQuery
7
6
  };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  useOnChange
3
3
  } from "../chunk-EMWGTXSW.js";
4
- import "../chunk-MLKGABMK.js";
5
4
  export {
6
5
  useOnChange
7
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.5.0",
3
+ "version": "15.5.2",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -28,6 +28,10 @@
28
28
  "import": "./dist/content/index.js",
29
29
  "types": "./dist/content/index.d.ts"
30
30
  },
31
+ "./hide-if-empty": {
32
+ "import": "./dist/hide-if-empty.js",
33
+ "types": "./dist/hide-if-empty.d.ts"
34
+ },
31
35
  "./search/*": {
32
36
  "import": "./dist/search/*.js",
33
37
  "types": "./dist/search/*.d.ts"
@@ -83,37 +87,37 @@
83
87
  "dependencies": {
84
88
  "@formatjs/intl-localematcher": "^0.6.1",
85
89
  "@orama/orama": "^3.1.6",
86
- "@shikijs/rehype": "^3.4.2",
87
- "@shikijs/transformers": "^3.4.2",
90
+ "@shikijs/rehype": "^3.6.0",
91
+ "@shikijs/transformers": "^3.6.0",
88
92
  "github-slugger": "^2.0.0",
89
93
  "hast-util-to-estree": "^3.1.3",
90
94
  "hast-util-to-jsx-runtime": "^2.3.6",
91
95
  "image-size": "^2.0.2",
92
96
  "negotiator": "^1.0.0",
93
- "react-remove-scroll": "^2.6.3",
97
+ "react-remove-scroll": "^2.7.1",
94
98
  "remark": "^15.0.0",
95
99
  "remark-gfm": "^4.0.1",
96
100
  "remark-rehype": "^11.1.2",
97
101
  "scroll-into-view-if-needed": "^3.1.0",
98
- "shiki": "^3.4.2",
102
+ "shiki": "^3.6.0",
99
103
  "unist-util-visit": "^5.0.0"
100
104
  },
101
105
  "devDependencies": {
102
106
  "@mdx-js/mdx": "^3.1.0",
103
107
  "@oramacloud/client": "^2.1.4",
104
- "@tanstack/react-router": "^1.120.12",
108
+ "@tanstack/react-router": "^1.121.2",
105
109
  "@types/estree-jsx": "^1.0.5",
106
110
  "@types/hast": "^3.0.4",
107
111
  "@types/mdast": "^4.0.3",
108
- "@types/negotiator": "^0.6.3",
109
- "@types/node": "22.15.28",
110
- "@types/react": "^19.1.6",
111
- "@types/react-dom": "^19.1.5",
112
- "algoliasearch": "5.25.0",
112
+ "@types/negotiator": "^0.6.4",
113
+ "@types/node": "24.0.1",
114
+ "@types/react": "^19.1.8",
115
+ "@types/react-dom": "^19.1.6",
116
+ "algoliasearch": "5.27.0",
113
117
  "mdast-util-mdx-jsx": "^3.2.0",
114
118
  "mdast-util-mdxjs-esm": "^2.0.1",
115
119
  "next": "^15.3.3",
116
- "react-router": "^7.6.1",
120
+ "react-router": "^7.6.2",
117
121
  "remark-mdx": "^3.1.0",
118
122
  "typescript": "^5.8.3",
119
123
  "unified": "^11.0.5",
@@ -126,9 +130,13 @@
126
130
  "algoliasearch": "5.x.x",
127
131
  "next": "14.x.x || 15.x.x",
128
132
  "react": "18.x.x || 19.x.x",
129
- "react-dom": "18.x.x || 19.x.x"
133
+ "react-dom": "18.x.x || 19.x.x",
134
+ "@types/react": "*"
130
135
  },
131
136
  "peerDependenciesMeta": {
137
+ "@types/react": {
138
+ "optional": true
139
+ },
132
140
  "@oramacloud/client": {
133
141
  "optional": true
134
142
  },
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };
@@ -1,32 +0,0 @@
1
- interface I18nConfig {
2
- /**
3
- * Supported locale codes.
4
- *
5
- * A page tree will be built for each language.
6
- */
7
- languages: string[];
8
- /**
9
- * Default locale if not specified
10
- */
11
- defaultLanguage: string;
12
- /**
13
- * Don't show the locale prefix on URL.
14
- *
15
- * - `always`: Always hide the prefix
16
- * - `default-locale`: Only hide the default locale
17
- * - `never`: Never hide the prefix
18
- *
19
- * This API uses `NextResponse.rewrite`.
20
- *
21
- * @defaultValue 'never'
22
- */
23
- hideLocale?: 'always' | 'default-locale' | 'never';
24
- /**
25
- * Used by `loader()`, specify the way to parse i18n file structure.
26
- *
27
- * @defaultValue 'dot'
28
- */
29
- parser?: 'dot' | 'dir';
30
- }
31
-
32
- export type { I18nConfig as I };
@@ -1,61 +0,0 @@
1
- import {
2
- searchAdvanced,
3
- searchSimple
4
- } from "./chunk-WFUH5VBX.js";
5
- import "./chunk-KAOEMCTI.js";
6
- import "./chunk-MLKGABMK.js";
7
-
8
- // src/search/client/static.ts
9
- import { create, load } from "@orama/orama";
10
- function createStaticClient({
11
- from = "/api/search",
12
- initOrama = (locale) => create({ schema: { _: "string" }, language: locale })
13
- }) {
14
- const dbs = /* @__PURE__ */ new Map();
15
- async function init() {
16
- const res = await fetch(from);
17
- if (!res.ok)
18
- throw new Error(
19
- `failed to fetch exported search indexes from ${from}, make sure the search database is exported and available for client.`
20
- );
21
- const data = await res.json();
22
- if (data.type === "i18n") {
23
- for (const [k, v] of Object.entries(data.data)) {
24
- const db = await initOrama(k);
25
- load(db, v);
26
- dbs.set(k, {
27
- type: v.type,
28
- db
29
- });
30
- }
31
- } else {
32
- const db = await initOrama();
33
- load(db, data);
34
- dbs.set("", {
35
- type: data.type,
36
- db
37
- });
38
- }
39
- }
40
- const get = init();
41
- return {
42
- async search(query, locale, tag) {
43
- await get;
44
- const cached = dbs.get(locale ?? "");
45
- if (!cached) return [];
46
- if (cached.type === "simple")
47
- return searchSimple(
48
- cached,
49
- query
50
- );
51
- return searchAdvanced(
52
- cached.db,
53
- query,
54
- tag
55
- );
56
- }
57
- };
58
- }
59
- export {
60
- createStaticClient
61
- };