fumadocs-core 15.5.4 → 15.6.0
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-WFUH5VBX.js → chunk-62HKBTBF.js} +7 -6
- package/dist/{fetch-ZSD7GUCX.js → fetch-YKY7NMVE.js} +1 -1
- package/dist/mdx-plugins/index.d.ts +36 -3
- package/dist/mdx-plugins/index.js +290 -106
- package/dist/search/client.d.ts +4 -4
- package/dist/search/client.js +2 -2
- package/dist/search/server.d.ts +6 -4
- package/dist/search/server.js +8 -9
- package/dist/source/index.js +1 -1
- package/dist/{static-QTPM5MZT.js → static-5YPNWD5F.js} +1 -1
- package/package.json +6 -5
|
@@ -24,10 +24,14 @@ async function searchSimple(db, query, params = {}) {
|
|
|
24
24
|
|
|
25
25
|
// src/search/orama/search/advanced.ts
|
|
26
26
|
import { getByID, search as search2 } from "@orama/orama";
|
|
27
|
-
async function searchAdvanced(db, query, tag, extraParams = {}) {
|
|
27
|
+
async function searchAdvanced(db, query, tag = [], extraParams = {}) {
|
|
28
|
+
if (typeof tag === "string") tag = [tag];
|
|
28
29
|
let params = {
|
|
30
|
+
...extraParams,
|
|
29
31
|
where: removeUndefined({
|
|
30
|
-
tag
|
|
32
|
+
tags: tag.length > 0 ? {
|
|
33
|
+
containsAll: tag
|
|
34
|
+
} : void 0,
|
|
31
35
|
...extraParams.where
|
|
32
36
|
}),
|
|
33
37
|
groupBy: {
|
|
@@ -40,10 +44,7 @@ async function searchAdvanced(db, query, tag, extraParams = {}) {
|
|
|
40
44
|
params = {
|
|
41
45
|
...params,
|
|
42
46
|
term: query,
|
|
43
|
-
properties: ["content"
|
|
44
|
-
...extraParams,
|
|
45
|
-
where: params.where,
|
|
46
|
-
groupBy: params.groupBy
|
|
47
|
+
properties: ["content"]
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
const result = await search2(db, params);
|
|
@@ -4,7 +4,7 @@ async function fetchDocs(query, { api = "/api/search", locale, tag }) {
|
|
|
4
4
|
const params = new URLSearchParams();
|
|
5
5
|
params.set("query", query);
|
|
6
6
|
if (locale) params.set("locale", locale);
|
|
7
|
-
if (tag) params.set("tag", tag);
|
|
7
|
+
if (tag) params.set("tag", Array.isArray(tag) ? tag.join(",") : tag);
|
|
8
8
|
const key = `${api}?${params}`;
|
|
9
9
|
const cached = cache.get(key);
|
|
10
10
|
if (cached) return cached;
|
|
@@ -3,10 +3,10 @@ import { Root } from 'hast';
|
|
|
3
3
|
import { RehypeShikiOptions } from '@shikijs/rehype';
|
|
4
4
|
import { Processor, Transformer } from 'unified';
|
|
5
5
|
import { ShikiTransformer } from 'shiki';
|
|
6
|
-
import { Root as Root$1 } from 'mdast';
|
|
6
|
+
import { Root as Root$1, Code } from 'mdast';
|
|
7
7
|
export { a as StructureOptions, S as StructuredData, r as remarkStructure, s as structure } from '../remark-structure-DVje0Sib.js';
|
|
8
8
|
export { R as RemarkHeadingOptions, r as remarkHeading } from '../remark-heading-BPCoYwjn.js';
|
|
9
|
-
import 'mdast-util-mdx-jsx';
|
|
9
|
+
import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
10
10
|
|
|
11
11
|
interface CodeBlockIcon {
|
|
12
12
|
viewBox: string;
|
|
@@ -112,7 +112,9 @@ interface RehypeTocOptions {
|
|
|
112
112
|
}
|
|
113
113
|
declare function rehypeToc(this: Processor, { exportToc }?: RehypeTocOptions): Transformer<Root, Root>;
|
|
114
114
|
|
|
115
|
+
type TabType = keyof typeof Types;
|
|
115
116
|
interface RemarkCodeTabOptions {
|
|
117
|
+
Tabs?: TabType;
|
|
116
118
|
/**
|
|
117
119
|
* Parse MDX in tab values
|
|
118
120
|
*
|
|
@@ -120,6 +122,14 @@ interface RemarkCodeTabOptions {
|
|
|
120
122
|
*/
|
|
121
123
|
parseMdx?: boolean;
|
|
122
124
|
}
|
|
125
|
+
declare const Types: {
|
|
126
|
+
CodeBlockTabs: {
|
|
127
|
+
convert(processor: Processor, nodes: Code[], withMdx?: boolean, withParent?: boolean): MdxJsxFlowElement;
|
|
128
|
+
};
|
|
129
|
+
Tabs: {
|
|
130
|
+
convert(processor: Processor, nodes: Code[], withMdx?: boolean, withParent?: boolean): MdxJsxFlowElement;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
123
133
|
declare function remarkCodeTab(this: Processor, options?: RemarkCodeTabOptions): Transformer<Root$1, Root$1>;
|
|
124
134
|
|
|
125
135
|
interface RemarkStepsOptions {
|
|
@@ -141,4 +151,27 @@ interface RemarkStepsOptions {
|
|
|
141
151
|
*/
|
|
142
152
|
declare function remarkSteps({ steps, step, }?: RemarkStepsOptions): Transformer<Root$1, Root$1>;
|
|
143
153
|
|
|
144
|
-
|
|
154
|
+
interface PackageManager {
|
|
155
|
+
name: string;
|
|
156
|
+
/**
|
|
157
|
+
* Convert from npm to another package manager
|
|
158
|
+
*/
|
|
159
|
+
command: (command: string) => string;
|
|
160
|
+
}
|
|
161
|
+
interface RemarkNpmOptions {
|
|
162
|
+
/**
|
|
163
|
+
* Persist Tab value (Fumadocs UI only)
|
|
164
|
+
*
|
|
165
|
+
* @defaultValue false
|
|
166
|
+
*/
|
|
167
|
+
persist?: {
|
|
168
|
+
id: string;
|
|
169
|
+
} | false;
|
|
170
|
+
packageManagers?: PackageManager[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
|
|
174
|
+
*/
|
|
175
|
+
declare function remarkNpm({ persist, packageManagers, }?: RemarkNpmOptions): Transformer<Root$1, Root$1>;
|
|
176
|
+
|
|
177
|
+
export { type CodeBlockIcon, type RehypeCodeOptions, type RehypeTocOptions, type RemarkAdmonitionOptions, type RemarkCodeTabOptions, type RemarkImageOptions, type RemarkNpmOptions, type RemarkStepsOptions, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkImage, remarkNpm, remarkSteps, transformerIcon, transformerTab };
|
|
@@ -281,6 +281,9 @@ function transformerTab() {
|
|
|
281
281
|
root(root) {
|
|
282
282
|
const value = this.options.meta?.tab;
|
|
283
283
|
if (typeof value !== "string") return root;
|
|
284
|
+
console.warn(
|
|
285
|
+
'[Fumadocs] For `tab="value" in codeblocks, please use `remarkCodeTab` plugin instead.'
|
|
286
|
+
);
|
|
284
287
|
return {
|
|
285
288
|
type: "root",
|
|
286
289
|
children: [
|
|
@@ -760,120 +763,61 @@ function rehypeToc({ exportToc = true } = {}) {
|
|
|
760
763
|
// src/mdx-plugins/remark-code-tab.ts
|
|
761
764
|
import { visit as visit5 } from "unist-util-visit";
|
|
762
765
|
var TabRegex = /tab="(.+?)"/;
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
const isLast = i === node.children.length - 1;
|
|
777
|
-
if (start !== -1 && (isLast || !isSwitcher)) {
|
|
778
|
-
const end = isSwitcher ? i + 1 : i;
|
|
779
|
-
const targets = node.children.slice(start, end);
|
|
780
|
-
node.children.splice(
|
|
781
|
-
start,
|
|
782
|
-
end - start,
|
|
783
|
-
options.parseMdx ? toTabMdx(this, targets) : toTab(targets)
|
|
784
|
-
);
|
|
785
|
-
if (isLast) break;
|
|
786
|
-
i = start + 1;
|
|
787
|
-
start = -1;
|
|
788
|
-
} else {
|
|
789
|
-
i++;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function processTabValue(nodes) {
|
|
796
|
-
return nodes.map((node, i) => {
|
|
797
|
-
let title = `Tab ${i + 1}`;
|
|
798
|
-
node.meta = node.meta?.replace(TabRegex, (_, value) => {
|
|
799
|
-
title = value;
|
|
800
|
-
return "";
|
|
801
|
-
});
|
|
802
|
-
return title;
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
function toTab(nodes) {
|
|
806
|
-
const names = processTabValue(nodes);
|
|
807
|
-
return {
|
|
808
|
-
type: "mdxJsxFlowElement",
|
|
809
|
-
name: "Tabs",
|
|
810
|
-
attributes: [
|
|
811
|
-
{
|
|
812
|
-
type: "mdxJsxAttribute",
|
|
813
|
-
name: "items",
|
|
814
|
-
value: {
|
|
815
|
-
type: "mdxJsxAttributeValueExpression",
|
|
816
|
-
value: names.join(", "),
|
|
817
|
-
data: {
|
|
818
|
-
estree: {
|
|
819
|
-
type: "Program",
|
|
820
|
-
sourceType: "module",
|
|
821
|
-
comments: [],
|
|
822
|
-
body: [
|
|
823
|
-
{
|
|
824
|
-
type: "ExpressionStatement",
|
|
825
|
-
expression: {
|
|
826
|
-
type: "ArrayExpression",
|
|
827
|
-
elements: names.map((name) => ({
|
|
828
|
-
type: "Literal",
|
|
829
|
-
value: name
|
|
830
|
-
}))
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
]
|
|
766
|
+
var Tabs = {
|
|
767
|
+
convert(processor, nodes, withMdx = false, withParent = true) {
|
|
768
|
+
const names = processTabValue(nodes);
|
|
769
|
+
if (!withMdx) {
|
|
770
|
+
const children2 = nodes.map((node, i) => {
|
|
771
|
+
return {
|
|
772
|
+
type: "mdxJsxFlowElement",
|
|
773
|
+
name: "Tab",
|
|
774
|
+
attributes: [
|
|
775
|
+
{
|
|
776
|
+
type: "mdxJsxAttribute",
|
|
777
|
+
name: "value",
|
|
778
|
+
value: names[i]
|
|
834
779
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
780
|
+
],
|
|
781
|
+
children: [node]
|
|
782
|
+
};
|
|
783
|
+
});
|
|
784
|
+
if (!withParent) return createFragment(children2);
|
|
840
785
|
return {
|
|
841
786
|
type: "mdxJsxFlowElement",
|
|
842
|
-
name: "
|
|
787
|
+
name: "Tabs",
|
|
843
788
|
attributes: [
|
|
844
789
|
{
|
|
845
790
|
type: "mdxJsxAttribute",
|
|
846
|
-
name: "
|
|
847
|
-
value:
|
|
791
|
+
name: "items",
|
|
792
|
+
value: {
|
|
793
|
+
type: "mdxJsxAttributeValueExpression",
|
|
794
|
+
value: names.join(", "),
|
|
795
|
+
data: {
|
|
796
|
+
estree: {
|
|
797
|
+
type: "Program",
|
|
798
|
+
sourceType: "module",
|
|
799
|
+
comments: [],
|
|
800
|
+
body: [
|
|
801
|
+
{
|
|
802
|
+
type: "ExpressionStatement",
|
|
803
|
+
expression: {
|
|
804
|
+
type: "ArrayExpression",
|
|
805
|
+
elements: names.map((name) => ({
|
|
806
|
+
type: "Literal",
|
|
807
|
+
value: name
|
|
808
|
+
}))
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
848
815
|
}
|
|
849
816
|
],
|
|
850
|
-
children:
|
|
817
|
+
children: children2
|
|
851
818
|
};
|
|
852
|
-
})
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
function toTabMdx(processor, nodes) {
|
|
856
|
-
const names = processTabValue(nodes);
|
|
857
|
-
function inline(node) {
|
|
858
|
-
if (node.type === "root") {
|
|
859
|
-
node.children = node.children.flatMap((child) => {
|
|
860
|
-
if (child.type === "paragraph") return child.children;
|
|
861
|
-
return child;
|
|
862
|
-
});
|
|
863
819
|
}
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
return {
|
|
867
|
-
type: "mdxJsxFlowElement",
|
|
868
|
-
name: "Tabs",
|
|
869
|
-
attributes: [
|
|
870
|
-
{
|
|
871
|
-
type: "mdxJsxAttribute",
|
|
872
|
-
name: "defaultValue",
|
|
873
|
-
value: names[0]
|
|
874
|
-
}
|
|
875
|
-
],
|
|
876
|
-
children: [
|
|
820
|
+
const children = [
|
|
877
821
|
{
|
|
878
822
|
type: "mdxJsxFlowElement",
|
|
879
823
|
name: "TabsList",
|
|
@@ -890,7 +834,7 @@ function toTabMdx(processor, nodes) {
|
|
|
890
834
|
],
|
|
891
835
|
children: [
|
|
892
836
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed
|
|
893
|
-
|
|
837
|
+
mdxToAst(processor, name)
|
|
894
838
|
]
|
|
895
839
|
}))
|
|
896
840
|
},
|
|
@@ -908,7 +852,159 @@ function toTabMdx(processor, nodes) {
|
|
|
908
852
|
children: [node]
|
|
909
853
|
})
|
|
910
854
|
)
|
|
911
|
-
]
|
|
855
|
+
];
|
|
856
|
+
if (!withParent) return createFragment(children);
|
|
857
|
+
return {
|
|
858
|
+
type: "mdxJsxFlowElement",
|
|
859
|
+
name: "Tabs",
|
|
860
|
+
attributes: [
|
|
861
|
+
{
|
|
862
|
+
type: "mdxJsxAttribute",
|
|
863
|
+
name: "defaultValue",
|
|
864
|
+
value: names[0]
|
|
865
|
+
}
|
|
866
|
+
],
|
|
867
|
+
children
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
var CodeBlockTabs = {
|
|
872
|
+
convert(processor, nodes, withMdx = false, withParent = true) {
|
|
873
|
+
const names = processTabValue(nodes);
|
|
874
|
+
const children = [
|
|
875
|
+
{
|
|
876
|
+
type: "mdxJsxFlowElement",
|
|
877
|
+
name: "CodeBlockTabsList",
|
|
878
|
+
attributes: [],
|
|
879
|
+
children: names.map((name) => {
|
|
880
|
+
return {
|
|
881
|
+
type: "mdxJsxFlowElement",
|
|
882
|
+
name: "CodeBlockTabsTrigger",
|
|
883
|
+
attributes: [
|
|
884
|
+
{
|
|
885
|
+
type: "mdxJsxAttribute",
|
|
886
|
+
name: "value",
|
|
887
|
+
value: name
|
|
888
|
+
}
|
|
889
|
+
],
|
|
890
|
+
children: [
|
|
891
|
+
withMdx ? (
|
|
892
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- needed
|
|
893
|
+
mdxToAst(processor, name)
|
|
894
|
+
) : {
|
|
895
|
+
type: "text",
|
|
896
|
+
value: name
|
|
897
|
+
}
|
|
898
|
+
]
|
|
899
|
+
};
|
|
900
|
+
})
|
|
901
|
+
},
|
|
902
|
+
...nodes.map((node, i) => {
|
|
903
|
+
return {
|
|
904
|
+
type: "mdxJsxFlowElement",
|
|
905
|
+
name: "CodeBlockTab",
|
|
906
|
+
attributes: [
|
|
907
|
+
{
|
|
908
|
+
type: "mdxJsxAttribute",
|
|
909
|
+
name: "value",
|
|
910
|
+
value: names[i]
|
|
911
|
+
}
|
|
912
|
+
],
|
|
913
|
+
children: [node]
|
|
914
|
+
};
|
|
915
|
+
})
|
|
916
|
+
];
|
|
917
|
+
if (!withParent) return createFragment(children);
|
|
918
|
+
return {
|
|
919
|
+
type: "mdxJsxFlowElement",
|
|
920
|
+
name: "CodeBlockTabs",
|
|
921
|
+
attributes: [
|
|
922
|
+
{
|
|
923
|
+
type: "mdxJsxAttribute",
|
|
924
|
+
name: "defaultValue",
|
|
925
|
+
value: names[0]
|
|
926
|
+
}
|
|
927
|
+
],
|
|
928
|
+
children
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
var Types = {
|
|
933
|
+
CodeBlockTabs,
|
|
934
|
+
Tabs
|
|
935
|
+
};
|
|
936
|
+
function remarkCodeTab(options = {}) {
|
|
937
|
+
const { parseMdx = false, Tabs: Tabs2 = "CodeBlockTabs" } = options;
|
|
938
|
+
return (tree) => {
|
|
939
|
+
visit5(tree, (node) => {
|
|
940
|
+
if (!("children" in node)) return;
|
|
941
|
+
let start = -1;
|
|
942
|
+
let i = 0;
|
|
943
|
+
let localTabs = Tabs2;
|
|
944
|
+
let localParseMdx = parseMdx;
|
|
945
|
+
let withParent = true;
|
|
946
|
+
if (node.type === "mdxJsxFlowElement" && node.name && node.name in Types) {
|
|
947
|
+
withParent = false;
|
|
948
|
+
localTabs = node.name;
|
|
949
|
+
if (node.name === "Tabs") {
|
|
950
|
+
localParseMdx = node.attributes.every(
|
|
951
|
+
(attribute) => attribute.type !== "mdxJsxAttribute" || attribute.name !== "items"
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
while (i < node.children.length) {
|
|
956
|
+
const child = node.children[i];
|
|
957
|
+
const isSwitcher = child.type === "code" && child.meta && child.meta.match(TabRegex);
|
|
958
|
+
if (isSwitcher && start === -1) {
|
|
959
|
+
start = i;
|
|
960
|
+
}
|
|
961
|
+
const isLast = i === node.children.length - 1;
|
|
962
|
+
if (start !== -1 && (isLast || !isSwitcher)) {
|
|
963
|
+
const end = isSwitcher ? i + 1 : i;
|
|
964
|
+
const targets = node.children.slice(start, end);
|
|
965
|
+
const replacement = Types[localTabs].convert(
|
|
966
|
+
this,
|
|
967
|
+
targets,
|
|
968
|
+
localParseMdx,
|
|
969
|
+
withParent
|
|
970
|
+
);
|
|
971
|
+
node.children.splice(start, end - start, replacement);
|
|
972
|
+
if (isLast) break;
|
|
973
|
+
i = start + 1;
|
|
974
|
+
start = -1;
|
|
975
|
+
} else {
|
|
976
|
+
i++;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
function processTabValue(nodes) {
|
|
983
|
+
return nodes.map((node, i) => {
|
|
984
|
+
let title = `Tab ${i + 1}`;
|
|
985
|
+
node.meta = node.meta?.replace(TabRegex, (_, value) => {
|
|
986
|
+
title = value;
|
|
987
|
+
return "";
|
|
988
|
+
});
|
|
989
|
+
return title;
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function mdxToAst(processor, name) {
|
|
993
|
+
const node = processor.parse(name);
|
|
994
|
+
if (node.type === "root") {
|
|
995
|
+
node.children = node.children.flatMap((child) => {
|
|
996
|
+
if (child.type === "paragraph") return child.children;
|
|
997
|
+
return child;
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
return node;
|
|
1001
|
+
}
|
|
1002
|
+
function createFragment(children) {
|
|
1003
|
+
return {
|
|
1004
|
+
type: "mdxJsxFlowElement",
|
|
1005
|
+
name: null,
|
|
1006
|
+
attributes: [],
|
|
1007
|
+
children
|
|
912
1008
|
};
|
|
913
1009
|
}
|
|
914
1010
|
|
|
@@ -999,6 +1095,93 @@ function remarkSteps({
|
|
|
999
1095
|
});
|
|
1000
1096
|
};
|
|
1001
1097
|
}
|
|
1098
|
+
|
|
1099
|
+
// src/mdx-plugins/remark-npm.ts
|
|
1100
|
+
import { visit as visit7 } from "unist-util-visit";
|
|
1101
|
+
import convert from "npm-to-yarn";
|
|
1102
|
+
var aliases = ["npm", "package-install"];
|
|
1103
|
+
function remarkNpm({
|
|
1104
|
+
persist = false,
|
|
1105
|
+
packageManagers = [
|
|
1106
|
+
{ command: (cmd) => convert(cmd, "npm"), name: "npm" },
|
|
1107
|
+
{ command: (cmd) => convert(cmd, "pnpm"), name: "pnpm" },
|
|
1108
|
+
{ command: (cmd) => convert(cmd, "yarn"), name: "yarn" },
|
|
1109
|
+
{ command: (cmd) => convert(cmd, "bun"), name: "bun" }
|
|
1110
|
+
]
|
|
1111
|
+
} = {}) {
|
|
1112
|
+
return (tree) => {
|
|
1113
|
+
visit7(tree, "code", (node) => {
|
|
1114
|
+
if (!node.lang || !aliases.includes(node.lang)) return "skip";
|
|
1115
|
+
const value = node.value.startsWith("npm") || node.value.startsWith("npx") ? node.value : `npm install ${node.value}`;
|
|
1116
|
+
const attributes = [
|
|
1117
|
+
{
|
|
1118
|
+
type: "mdxJsxAttribute",
|
|
1119
|
+
name: "defaultValue",
|
|
1120
|
+
value: packageManagers[0].name
|
|
1121
|
+
}
|
|
1122
|
+
];
|
|
1123
|
+
if (typeof persist === "object") {
|
|
1124
|
+
attributes.push(
|
|
1125
|
+
{
|
|
1126
|
+
type: "mdxJsxAttribute",
|
|
1127
|
+
name: "groupId",
|
|
1128
|
+
value: persist.id
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
type: "mdxJsxAttribute",
|
|
1132
|
+
name: "persist",
|
|
1133
|
+
value: null
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
const children = [
|
|
1138
|
+
{
|
|
1139
|
+
type: "mdxJsxFlowElement",
|
|
1140
|
+
name: "CodeBlockTabsList",
|
|
1141
|
+
attributes: [],
|
|
1142
|
+
children: packageManagers.map(
|
|
1143
|
+
({ name }) => ({
|
|
1144
|
+
type: "mdxJsxFlowElement",
|
|
1145
|
+
attributes: [
|
|
1146
|
+
{ type: "mdxJsxAttribute", name: "value", value: name }
|
|
1147
|
+
],
|
|
1148
|
+
name: "CodeBlockTabsTrigger",
|
|
1149
|
+
children: [
|
|
1150
|
+
{
|
|
1151
|
+
type: "text",
|
|
1152
|
+
value: name
|
|
1153
|
+
}
|
|
1154
|
+
]
|
|
1155
|
+
})
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
];
|
|
1159
|
+
for (const { name, command } of packageManagers) {
|
|
1160
|
+
children.push({
|
|
1161
|
+
type: "mdxJsxFlowElement",
|
|
1162
|
+
name: "CodeBlockTab",
|
|
1163
|
+
attributes: [{ type: "mdxJsxAttribute", name: "value", value: name }],
|
|
1164
|
+
children: [
|
|
1165
|
+
{
|
|
1166
|
+
type: "code",
|
|
1167
|
+
lang: "bash",
|
|
1168
|
+
meta: node.meta,
|
|
1169
|
+
value: command(value)
|
|
1170
|
+
}
|
|
1171
|
+
]
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
const tab = {
|
|
1175
|
+
type: "mdxJsxFlowElement",
|
|
1176
|
+
name: "CodeBlockTabs",
|
|
1177
|
+
attributes,
|
|
1178
|
+
children
|
|
1179
|
+
};
|
|
1180
|
+
Object.assign(node, tab);
|
|
1181
|
+
return;
|
|
1182
|
+
});
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1002
1185
|
export {
|
|
1003
1186
|
rehypeCode,
|
|
1004
1187
|
rehypeCodeDefaultOptions,
|
|
@@ -1008,6 +1191,7 @@ export {
|
|
|
1008
1191
|
default2 as remarkGfm,
|
|
1009
1192
|
remarkHeading,
|
|
1010
1193
|
remarkImage,
|
|
1194
|
+
remarkNpm,
|
|
1011
1195
|
remarkSteps,
|
|
1012
1196
|
remarkStructure,
|
|
1013
1197
|
structure,
|
package/dist/search/client.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ interface FetchOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
api?: string;
|
|
19
19
|
/**
|
|
20
|
-
* Filter results with specific tag.
|
|
20
|
+
* Filter results with specific tag(s).
|
|
21
21
|
*/
|
|
22
|
-
tag?: string;
|
|
22
|
+
tag?: string | string[];
|
|
23
23
|
/**
|
|
24
24
|
* Filter by locale
|
|
25
25
|
*/
|
|
@@ -35,9 +35,9 @@ interface StaticOptions {
|
|
|
35
35
|
from?: string;
|
|
36
36
|
initOrama?: (locale?: string) => AnyOrama | Promise<AnyOrama>;
|
|
37
37
|
/**
|
|
38
|
-
* Filter results with specific tag.
|
|
38
|
+
* Filter results with specific tag(s).
|
|
39
39
|
*/
|
|
40
|
-
tag?: string;
|
|
40
|
+
tag?: string | string[];
|
|
41
41
|
/**
|
|
42
42
|
* Filter by locale (unsupported at the moment)
|
|
43
43
|
*/
|
package/dist/search/client.js
CHANGED
|
@@ -64,7 +64,7 @@ function useDocsSearch(clientOptions, _locale, _tag, _delayMs = 100, _allowEmpty
|
|
|
64
64
|
async function run() {
|
|
65
65
|
if (debouncedValue.length === 0 && !allowEmpty) return "empty";
|
|
66
66
|
if (client.type === "fetch") {
|
|
67
|
-
const { fetchDocs } = await import("../fetch-
|
|
67
|
+
const { fetchDocs } = await import("../fetch-YKY7NMVE.js");
|
|
68
68
|
return fetchDocs(debouncedValue, client);
|
|
69
69
|
}
|
|
70
70
|
if (client.type === "algolia") {
|
|
@@ -76,7 +76,7 @@ function useDocsSearch(clientOptions, _locale, _tag, _delayMs = 100, _allowEmpty
|
|
|
76
76
|
return searchDocs(debouncedValue, client);
|
|
77
77
|
}
|
|
78
78
|
if (client.type === "static") {
|
|
79
|
-
const { search: search2 } = await import("../static-
|
|
79
|
+
const { search: search2 } = await import("../static-5YPNWD5F.js");
|
|
80
80
|
return search2(debouncedValue, client);
|
|
81
81
|
}
|
|
82
82
|
throw new Error("unknown search client");
|
package/dist/search/server.d.ts
CHANGED
|
@@ -15,8 +15,7 @@ declare const advancedSchema: {
|
|
|
15
15
|
readonly content: "string";
|
|
16
16
|
readonly page_id: "string";
|
|
17
17
|
readonly type: "string";
|
|
18
|
-
readonly
|
|
19
|
-
readonly tag: "string";
|
|
18
|
+
readonly tags: "enum[]";
|
|
20
19
|
readonly url: "string";
|
|
21
20
|
};
|
|
22
21
|
type SimpleDocument = TypedDocument<Orama<typeof simpleSchema>>;
|
|
@@ -66,7 +65,7 @@ type ExportedData = (RawData & {
|
|
|
66
65
|
interface SearchServer {
|
|
67
66
|
search: (query: string, options?: {
|
|
68
67
|
locale?: string;
|
|
69
|
-
tag?: string;
|
|
68
|
+
tag?: string | string[];
|
|
70
69
|
}) => Promise<SortedResult[]>;
|
|
71
70
|
/**
|
|
72
71
|
* Export the database
|
|
@@ -118,11 +117,14 @@ interface AdvancedIndex {
|
|
|
118
117
|
id: string;
|
|
119
118
|
title: string;
|
|
120
119
|
description?: string;
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated No longer used
|
|
122
|
+
*/
|
|
121
123
|
keywords?: string;
|
|
122
124
|
/**
|
|
123
125
|
* Required if tag filter is enabled
|
|
124
126
|
*/
|
|
125
|
-
tag?: string;
|
|
127
|
+
tag?: string | string[];
|
|
126
128
|
/**
|
|
127
129
|
* preprocess mdx content with `structure`
|
|
128
130
|
*/
|
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-62HKBTBF.js";
|
|
5
5
|
import "../chunk-KAOEMCTI.js";
|
|
6
6
|
import {
|
|
7
7
|
basename,
|
|
@@ -27,7 +27,7 @@ function createEndpoint(server) {
|
|
|
27
27
|
if (!query) return Response.json([]);
|
|
28
28
|
return Response.json(
|
|
29
29
|
await search(query, {
|
|
30
|
-
tag: url.searchParams.get("tag") ?? void 0,
|
|
30
|
+
tag: url.searchParams.get("tag")?.split(",") ?? void 0,
|
|
31
31
|
locale: url.searchParams.get("locale") ?? void 0
|
|
32
32
|
})
|
|
33
33
|
);
|
|
@@ -44,8 +44,7 @@ var advancedSchema = {
|
|
|
44
44
|
content: "string",
|
|
45
45
|
page_id: "string",
|
|
46
46
|
type: "string",
|
|
47
|
-
|
|
48
|
-
tag: "string",
|
|
47
|
+
tags: "enum[]",
|
|
49
48
|
url: "string"
|
|
50
49
|
};
|
|
51
50
|
async function createDB({
|
|
@@ -65,6 +64,7 @@ async function createDB({
|
|
|
65
64
|
});
|
|
66
65
|
const mapTo = [];
|
|
67
66
|
items.forEach((page) => {
|
|
67
|
+
const tags = Array.isArray(page.tag) ? page.tag : page.tag ? [page.tag] : [];
|
|
68
68
|
const data = page.structuredData;
|
|
69
69
|
let id = 0;
|
|
70
70
|
mapTo.push({
|
|
@@ -72,15 +72,14 @@ async function createDB({
|
|
|
72
72
|
page_id: page.id,
|
|
73
73
|
type: "page",
|
|
74
74
|
content: page.title,
|
|
75
|
-
|
|
76
|
-
tag: page.tag,
|
|
75
|
+
tags,
|
|
77
76
|
url: page.url
|
|
78
77
|
});
|
|
79
78
|
if (page.description) {
|
|
80
79
|
mapTo.push({
|
|
81
80
|
id: `${page.id}-${(id++).toString()}`,
|
|
82
81
|
page_id: page.id,
|
|
83
|
-
|
|
82
|
+
tags,
|
|
84
83
|
type: "text",
|
|
85
84
|
url: page.url,
|
|
86
85
|
content: page.description
|
|
@@ -91,7 +90,7 @@ async function createDB({
|
|
|
91
90
|
id: `${page.id}-${(id++).toString()}`,
|
|
92
91
|
page_id: page.id,
|
|
93
92
|
type: "heading",
|
|
94
|
-
|
|
93
|
+
tags,
|
|
95
94
|
url: `${page.url}#${heading.id}`,
|
|
96
95
|
content: heading.content
|
|
97
96
|
});
|
|
@@ -100,7 +99,7 @@ async function createDB({
|
|
|
100
99
|
mapTo.push({
|
|
101
100
|
id: `${page.id}-${(id++).toString()}`,
|
|
102
101
|
page_id: page.id,
|
|
103
|
-
|
|
102
|
+
tags,
|
|
104
103
|
type: "text",
|
|
105
104
|
url: content.heading ? `${page.url}#${content.heading}` : page.url,
|
|
106
105
|
content: content.content
|
package/dist/source/index.js
CHANGED
|
@@ -259,7 +259,7 @@ var FileSystem = class {
|
|
|
259
259
|
const segment = segments.slice(0, i + 1).join("/");
|
|
260
260
|
if (this.folders.has(segment)) continue;
|
|
261
261
|
this.folders.set(segment, []);
|
|
262
|
-
this.
|
|
262
|
+
this.folders.get(dirname(segment)).push(segment);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.6.0",
|
|
4
4
|
"description": "The library for building a documentation website in Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
],
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@formatjs/intl-localematcher": "^0.6.1",
|
|
89
|
-
"@orama/orama": "^3.1.
|
|
89
|
+
"@orama/orama": "^3.1.9",
|
|
90
90
|
"@shikijs/rehype": "^3.7.0",
|
|
91
91
|
"@shikijs/transformers": "^3.7.0",
|
|
92
92
|
"github-slugger": "^2.0.0",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
95
95
|
"image-size": "^2.0.2",
|
|
96
96
|
"negotiator": "^1.0.0",
|
|
97
|
+
"npm-to-yarn": "^3.0.1",
|
|
97
98
|
"react-remove-scroll": "^2.7.1",
|
|
98
99
|
"remark": "^15.0.0",
|
|
99
100
|
"remark-gfm": "^4.0.1",
|
|
@@ -105,19 +106,19 @@
|
|
|
105
106
|
"devDependencies": {
|
|
106
107
|
"@mdx-js/mdx": "^3.1.0",
|
|
107
108
|
"@oramacloud/client": "^2.1.4",
|
|
108
|
-
"@tanstack/react-router": "^1.
|
|
109
|
+
"@tanstack/react-router": "^1.123.0",
|
|
109
110
|
"@types/estree-jsx": "^1.0.5",
|
|
110
111
|
"@types/hast": "^3.0.4",
|
|
111
112
|
"@types/mdast": "^4.0.3",
|
|
112
113
|
"@types/negotiator": "^0.6.4",
|
|
113
|
-
"@types/node": "24.0.
|
|
114
|
+
"@types/node": "24.0.7",
|
|
114
115
|
"@types/react": "^19.1.8",
|
|
115
116
|
"@types/react-dom": "^19.1.6",
|
|
116
117
|
"algoliasearch": "5.29.0",
|
|
117
118
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
118
119
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
119
120
|
"next": "^15.3.4",
|
|
120
|
-
"react-router": "^7.6.
|
|
121
|
+
"react-router": "^7.6.3",
|
|
121
122
|
"remark-mdx": "^3.1.0",
|
|
122
123
|
"typescript": "^5.8.3",
|
|
123
124
|
"unified": "^11.0.5",
|