fumadocs-core 15.7.11 → 15.7.13
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/{chunk-R7I54YHO.js → chunk-XMAVUWLD.js} +9 -5
- package/dist/mdx-plugins/index.js +29 -27
- package/dist/search/client.js +1 -1
- package/dist/search/server.d.ts +2 -0
- package/dist/search/server.js +20 -4
- package/dist/source/index.js +1 -1
- package/dist/{static-K5IAOO6T.js → static-PIZYNE45.js} +1 -1
- package/package.json +7 -7
|
@@ -29,27 +29,31 @@ async function searchSimple(db, query, params = {}) {
|
|
|
29
29
|
|
|
30
30
|
// src/search/orama/search/advanced.ts
|
|
31
31
|
import { getByID, search as search2 } from "@orama/orama";
|
|
32
|
-
async function searchAdvanced(db, query, tag = [],
|
|
32
|
+
async function searchAdvanced(db, query, tag = [], {
|
|
33
|
+
mode = "fulltext",
|
|
34
|
+
...override
|
|
35
|
+
} = {}) {
|
|
33
36
|
if (typeof tag === "string") tag = [tag];
|
|
34
37
|
let params = {
|
|
35
|
-
...
|
|
38
|
+
...override,
|
|
39
|
+
mode,
|
|
36
40
|
where: removeUndefined({
|
|
37
41
|
tags: tag.length > 0 ? {
|
|
38
42
|
containsAll: tag
|
|
39
43
|
} : void 0,
|
|
40
|
-
...
|
|
44
|
+
...override.where
|
|
41
45
|
}),
|
|
42
46
|
groupBy: {
|
|
43
47
|
properties: ["page_id"],
|
|
44
48
|
maxResult: 8,
|
|
45
|
-
...
|
|
49
|
+
...override.groupBy
|
|
46
50
|
}
|
|
47
51
|
};
|
|
48
52
|
if (query.length > 0) {
|
|
49
53
|
params = {
|
|
50
54
|
...params,
|
|
51
55
|
term: query,
|
|
52
|
-
properties: ["content"]
|
|
56
|
+
properties: mode === "fulltext" ? ["content"] : ["content", "embeddings"]
|
|
53
57
|
};
|
|
54
58
|
}
|
|
55
59
|
const highlighter = createContentHighlighter(query);
|
|
@@ -869,9 +869,9 @@ function rehypeToc({ exportToc = true } = {}) {
|
|
|
869
869
|
import { visit as visit5 } from "unist-util-visit";
|
|
870
870
|
var Tabs = {
|
|
871
871
|
convert(processor, nodes, withMdx = false, withParent = true) {
|
|
872
|
-
const
|
|
872
|
+
const tabs = Array.from(processTabValue(nodes).entries());
|
|
873
873
|
if (!withMdx) {
|
|
874
|
-
const children2 =
|
|
874
|
+
const children2 = tabs.map(([name, codes]) => {
|
|
875
875
|
return {
|
|
876
876
|
type: "mdxJsxFlowElement",
|
|
877
877
|
name: "Tab",
|
|
@@ -879,10 +879,10 @@ var Tabs = {
|
|
|
879
879
|
{
|
|
880
880
|
type: "mdxJsxAttribute",
|
|
881
881
|
name: "value",
|
|
882
|
-
value:
|
|
882
|
+
value: name
|
|
883
883
|
}
|
|
884
884
|
],
|
|
885
|
-
children:
|
|
885
|
+
children: codes
|
|
886
886
|
};
|
|
887
887
|
});
|
|
888
888
|
if (!withParent) return createFragment(children2);
|
|
@@ -895,7 +895,7 @@ var Tabs = {
|
|
|
895
895
|
name: "items",
|
|
896
896
|
value: {
|
|
897
897
|
type: "mdxJsxAttributeValueExpression",
|
|
898
|
-
value:
|
|
898
|
+
value: tabs.map(([name]) => name).join(", "),
|
|
899
899
|
data: {
|
|
900
900
|
estree: {
|
|
901
901
|
type: "Program",
|
|
@@ -906,7 +906,7 @@ var Tabs = {
|
|
|
906
906
|
type: "ExpressionStatement",
|
|
907
907
|
expression: {
|
|
908
908
|
type: "ArrayExpression",
|
|
909
|
-
elements:
|
|
909
|
+
elements: tabs.map(([name]) => ({
|
|
910
910
|
type: "Literal",
|
|
911
911
|
value: name
|
|
912
912
|
}))
|
|
@@ -926,7 +926,7 @@ var Tabs = {
|
|
|
926
926
|
type: "mdxJsxFlowElement",
|
|
927
927
|
name: "TabsList",
|
|
928
928
|
attributes: [],
|
|
929
|
-
children:
|
|
929
|
+
children: tabs.map(([name]) => ({
|
|
930
930
|
type: "mdxJsxFlowElement",
|
|
931
931
|
name: "TabsTrigger",
|
|
932
932
|
attributes: [
|
|
@@ -936,24 +936,21 @@ var Tabs = {
|
|
|
936
936
|
value: name
|
|
937
937
|
}
|
|
938
938
|
],
|
|
939
|
-
children: [
|
|
940
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed
|
|
941
|
-
mdxToAst(processor, name)
|
|
942
|
-
]
|
|
939
|
+
children: [mdxToAst(processor, name)]
|
|
943
940
|
}))
|
|
944
941
|
},
|
|
945
|
-
...
|
|
946
|
-
(
|
|
942
|
+
...tabs.map(
|
|
943
|
+
([name, codes]) => ({
|
|
947
944
|
type: "mdxJsxFlowElement",
|
|
948
945
|
name: "TabsContent",
|
|
949
946
|
attributes: [
|
|
950
947
|
{
|
|
951
948
|
type: "mdxJsxAttribute",
|
|
952
949
|
name: "value",
|
|
953
|
-
value:
|
|
950
|
+
value: name
|
|
954
951
|
}
|
|
955
952
|
],
|
|
956
|
-
children:
|
|
953
|
+
children: codes
|
|
957
954
|
})
|
|
958
955
|
)
|
|
959
956
|
];
|
|
@@ -965,7 +962,7 @@ var Tabs = {
|
|
|
965
962
|
{
|
|
966
963
|
type: "mdxJsxAttribute",
|
|
967
964
|
name: "defaultValue",
|
|
968
|
-
value:
|
|
965
|
+
value: tabs[0][0]
|
|
969
966
|
}
|
|
970
967
|
],
|
|
971
968
|
children
|
|
@@ -974,24 +971,21 @@ var Tabs = {
|
|
|
974
971
|
};
|
|
975
972
|
var CodeBlockTabs = {
|
|
976
973
|
convert(processor, nodes, withMdx = false, withParent = true) {
|
|
977
|
-
const
|
|
974
|
+
const tabs = Array.from(processTabValue(nodes).entries());
|
|
978
975
|
const node = generateCodeBlockTabs({
|
|
979
|
-
defaultValue:
|
|
980
|
-
triggers:
|
|
976
|
+
defaultValue: tabs[0][0],
|
|
977
|
+
triggers: tabs.map(([name]) => ({
|
|
981
978
|
value: name,
|
|
982
979
|
children: [
|
|
983
|
-
withMdx ? (
|
|
984
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed
|
|
985
|
-
mdxToAst(processor, name)
|
|
986
|
-
) : {
|
|
980
|
+
withMdx ? mdxToAst(processor, name) : {
|
|
987
981
|
type: "text",
|
|
988
982
|
value: name
|
|
989
983
|
}
|
|
990
984
|
]
|
|
991
985
|
})),
|
|
992
|
-
tabs:
|
|
993
|
-
value:
|
|
994
|
-
children:
|
|
986
|
+
tabs: tabs.map(([name, codes]) => ({
|
|
987
|
+
value: name,
|
|
988
|
+
children: codes
|
|
995
989
|
}))
|
|
996
990
|
});
|
|
997
991
|
if (!withParent) return createFragment(node.children);
|
|
@@ -1056,7 +1050,15 @@ function remarkCodeTab(options = {}) {
|
|
|
1056
1050
|
};
|
|
1057
1051
|
}
|
|
1058
1052
|
function processTabValue(nodes) {
|
|
1059
|
-
|
|
1053
|
+
const out = /* @__PURE__ */ new Map();
|
|
1054
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
1055
|
+
const node = nodes[i];
|
|
1056
|
+
const name = node.data?.tab ?? `Tab ${i + 1}`;
|
|
1057
|
+
const li = out.get(name) ?? [];
|
|
1058
|
+
li.push(node);
|
|
1059
|
+
out.set(name, li);
|
|
1060
|
+
}
|
|
1061
|
+
return out;
|
|
1060
1062
|
}
|
|
1061
1063
|
function mdxToAst(processor, name) {
|
|
1062
1064
|
const node = processor.parse(name);
|
package/dist/search/client.js
CHANGED
|
@@ -77,7 +77,7 @@ function useDocsSearch(clientOptions, _locale, _tag, _delayMs = 100, _allowEmpty
|
|
|
77
77
|
return searchDocs(debouncedValue, client);
|
|
78
78
|
}
|
|
79
79
|
if (client.type === "static") {
|
|
80
|
-
const { search: search2 } = await import("../static-
|
|
80
|
+
const { search: search2 } = await import("../static-PIZYNE45.js");
|
|
81
81
|
return search2(debouncedValue, client);
|
|
82
82
|
}
|
|
83
83
|
if (client.type === "mixedbread") {
|
package/dist/search/server.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare const advancedSchema: {
|
|
|
17
17
|
readonly type: "string";
|
|
18
18
|
readonly tags: "enum[]";
|
|
19
19
|
readonly url: "string";
|
|
20
|
+
readonly embeddings: "vector[512]";
|
|
20
21
|
};
|
|
21
22
|
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
|
22
23
|
declare const simpleSchema: {
|
|
@@ -68,6 +69,7 @@ interface SearchServer {
|
|
|
68
69
|
search: (query: string, options?: {
|
|
69
70
|
locale?: string;
|
|
70
71
|
tag?: string | string[];
|
|
72
|
+
mode?: 'vector' | 'full';
|
|
71
73
|
}) => Promise<SortedResult[]>;
|
|
72
74
|
/**
|
|
73
75
|
* Export the database
|
package/dist/search/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchAdvanced,
|
|
3
3
|
searchSimple
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-XMAVUWLD.js";
|
|
5
5
|
import "../chunk-ZMWYLUDP.js";
|
|
6
6
|
import {
|
|
7
7
|
createContentHighlighter
|
|
@@ -32,7 +32,8 @@ function createEndpoint(server) {
|
|
|
32
32
|
return Response.json(
|
|
33
33
|
await search(query, {
|
|
34
34
|
tag: url.searchParams.get("tag")?.split(",") ?? void 0,
|
|
35
|
-
locale: url.searchParams.get("locale") ?? void 0
|
|
35
|
+
locale: url.searchParams.get("locale") ?? void 0,
|
|
36
|
+
mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
|
|
36
37
|
})
|
|
37
38
|
);
|
|
38
39
|
}
|
|
@@ -49,7 +50,8 @@ var advancedSchema = {
|
|
|
49
50
|
page_id: "string",
|
|
50
51
|
type: "string",
|
|
51
52
|
tags: "enum[]",
|
|
52
|
-
url: "string"
|
|
53
|
+
url: "string",
|
|
54
|
+
embeddings: "vector[512]"
|
|
53
55
|
};
|
|
54
56
|
async function createDB({
|
|
55
57
|
indexes,
|
|
@@ -362,7 +364,21 @@ function initAdvancedSearch(options) {
|
|
|
362
364
|
},
|
|
363
365
|
async search(query, searchOptions) {
|
|
364
366
|
const db = await get;
|
|
365
|
-
|
|
367
|
+
const mode = searchOptions?.mode;
|
|
368
|
+
return searchAdvanced(db, query, searchOptions?.tag, {
|
|
369
|
+
...options.search,
|
|
370
|
+
mode: mode === "vector" ? "vector" : "fulltext"
|
|
371
|
+
}).catch((err) => {
|
|
372
|
+
if (mode === "vector") {
|
|
373
|
+
throw new Error(
|
|
374
|
+
"failed to search, make sure you have installed `@orama/plugin-embeddings` according to their docs.",
|
|
375
|
+
{
|
|
376
|
+
cause: err
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
throw err;
|
|
381
|
+
});
|
|
366
382
|
}
|
|
367
383
|
};
|
|
368
384
|
}
|
package/dist/source/index.js
CHANGED
|
@@ -584,7 +584,7 @@ function createOutput(options) {
|
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
},
|
|
587
|
-
getPageByHref(href, { dir = "", language } = {}) {
|
|
587
|
+
getPageByHref(href, { dir = "", language = defaultLanguage } = {}) {
|
|
588
588
|
const [value, hash] = href.split("#", 2);
|
|
589
589
|
let target;
|
|
590
590
|
if (value.startsWith(".") && (value.endsWith(".md") || value.endsWith(".mdx"))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.7.
|
|
3
|
+
"version": "15.7.13",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -112,25 +112,25 @@
|
|
|
112
112
|
"@mdx-js/mdx": "^3.1.1",
|
|
113
113
|
"@mixedbread/sdk": "^0.28.1",
|
|
114
114
|
"@oramacloud/client": "^2.1.4",
|
|
115
|
-
"@tanstack/react-router": "^1.131.
|
|
115
|
+
"@tanstack/react-router": "^1.131.41",
|
|
116
116
|
"@types/estree-jsx": "^1.0.5",
|
|
117
117
|
"@types/hast": "^3.0.4",
|
|
118
118
|
"@types/mdast": "^4.0.3",
|
|
119
119
|
"@types/negotiator": "^0.6.4",
|
|
120
|
-
"@types/node": "24.3.
|
|
121
|
-
"@types/react": "^19.1.
|
|
120
|
+
"@types/node": "24.3.3",
|
|
121
|
+
"@types/react": "^19.1.13",
|
|
122
122
|
"@types/react-dom": "^19.1.9",
|
|
123
123
|
"algoliasearch": "5.37.0",
|
|
124
124
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
125
125
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
126
|
-
"next": "^15.5.
|
|
127
|
-
"react-router": "^7.
|
|
126
|
+
"next": "^15.5.3",
|
|
127
|
+
"react-router": "^7.9.1",
|
|
128
128
|
"remark-mdx": "^3.1.1",
|
|
129
129
|
"remove-markdown": "^0.6.2",
|
|
130
130
|
"typescript": "^5.9.2",
|
|
131
131
|
"unified": "^11.0.5",
|
|
132
132
|
"vfile": "^6.0.3",
|
|
133
|
-
"waku": "^0.26.
|
|
133
|
+
"waku": "^0.26.1",
|
|
134
134
|
"eslint-config-custom": "0.0.0",
|
|
135
135
|
"tsconfig": "0.0.0"
|
|
136
136
|
},
|