fumadocs-core 16.5.2 → 16.5.4
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/{advanced-BH0syJ-M.js → advanced-3GdE_Q4d.js} +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/content/mdx/preset-bundler.d.ts +2 -2
- package/dist/content/mdx/preset-bundler.js +1 -1
- package/dist/content/mdx/preset-runtime.d.ts +2 -2
- package/dist/content/mdx/preset-runtime.js +1 -1
- package/dist/create-endpoint-9PZc4Cmz.js +23 -0
- package/dist/{create-i18n-Cv3Cocbs.d.ts → create-i18n-DxSvCSv-.d.ts} +2 -2
- package/dist/highlight/config.d.ts +1 -1
- package/dist/highlight/core/client.d.ts +1 -1
- package/dist/highlight/core/index.d.ts +1 -1
- package/dist/highlight/index.d.ts +1 -1
- package/dist/mdx-plugins/codeblock-utils.d.ts +1 -1
- package/dist/mdx-plugins/index.d.ts +3 -3
- package/dist/mdx-plugins/index.js +2 -2
- package/dist/mdx-plugins/rehype-code.core.d.ts +2 -2
- package/dist/mdx-plugins/rehype-code.d.ts +1 -1
- package/dist/mdx-plugins/remark-code-tab.d.ts +1 -1
- package/dist/mdx-plugins/remark-mdx-files.d.ts +1 -1
- package/dist/mdx-plugins/remark-structure.d.ts +30 -12
- package/dist/mdx-plugins/remark-structure.js +76 -36
- package/dist/mixedbread-RiA_24CE.js +58 -0
- package/dist/{orama-cloud-ByznDyOk.js → orama-cloud-CmYuZkvC.js} +1 -1
- package/dist/{orama-cloud-legacy-BbgJnf5f.js → orama-cloud-legacy-D-cNaYCM.js} +1 -1
- package/dist/page-tree/index.d.ts +2 -2
- package/dist/{path-B77y3W0_.d.ts → path-CDjb5iUO.d.ts} +1 -1
- package/dist/{mixedbread-Bx9drx9S.js → remove-markdown-CnXcUR-e.js} +2 -51
- package/dist/search/client.d.ts +9 -4
- package/dist/search/client.js +6 -6
- package/dist/search/mixedbread.d.ts +56 -0
- package/dist/search/mixedbread.js +79 -0
- package/dist/search/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/orama-cloud.d.ts +1 -1
- package/dist/search/server.d.ts +4 -4
- package/dist/search/server.js +3 -24
- package/dist/source/client/index.d.ts +2 -2
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js +2 -2
- package/dist/source/plugins/lucide-icons.d.ts +3 -3
- package/dist/source/plugins/lucide-icons.js +1 -1
- package/dist/source/plugins/slugs.d.ts +3 -3
- package/dist/source/plugins/slugs.js +1 -1
- package/dist/source/plugins/status-badges.d.ts +3 -3
- package/dist/{static-DTxK4eHk.js → static-BQOJvapl.js} +1 -1
- package/dist/{utils-IgHyYnrz.d.ts → utils-5HX-8dF3.d.ts} +1 -1
- package/package.json +3 -7
- /package/dist/{algolia-C7Crg8-5.js → algolia-Cx9CqUgE.js} +0 -0
- /package/dist/{definitions-DSNTbAwC.d.ts → definitions-Cw2aM1Af.d.ts} +0 -0
- /package/dist/{fetch-HotVeLLF.js → fetch-D_OY-eAB.js} +0 -0
- /package/dist/{icon-BcFuYa-b.js → icon-CGDZIqYj.js} +0 -0
- /package/dist/{path-D0Bwm6Fs.js → path-CfJghBXy.js} +0 -0
- /package/dist/{remove-undefined-CJm9cyrC.js → remove-undefined-B_oBVupY.js} +0 -0
- /package/dist/{transformer-icon-D7-6aFzt.d.ts → transformer-icon-C8MUuI2T.d.ts} +0 -0
- /package/dist/{types-BSnJn7kF.d.ts → types-Bt4vrwsT.d.ts} +0 -0
- /package/dist/{util-C60LmklF.d.ts → util-C7X6g0ql.d.ts} +0 -0
- /package/dist/{util-De0ALHOx.js → util-bgCahl6-.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
|
|
3
3
|
import { getByID, search } from "@orama/orama";
|
|
4
4
|
|
|
5
5
|
//#region src/search/orama/search/simple.ts
|
package/dist/breadcrumb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformer-icon-
|
|
1
|
+
import "../../transformer-icon-C8MUuI2T.js";
|
|
2
2
|
import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
|
|
3
3
|
import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
|
|
4
4
|
import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
|
|
@@ -6,7 +6,7 @@ import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
|
|
|
6
6
|
import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
|
|
7
7
|
import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
|
|
8
8
|
import "../../mdx-plugins/index.js";
|
|
9
|
-
import { t as ResolvePlugins } from "../../util-
|
|
9
|
+
import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
11
11
|
|
|
12
12
|
//#region src/content/mdx/preset-bundler.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformer-icon-
|
|
1
|
+
import "../../transformer-icon-C8MUuI2T.js";
|
|
2
2
|
import { RehypeCodeOptions } from "../../mdx-plugins/rehype-code.js";
|
|
3
3
|
import { RemarkImageOptions } from "../../mdx-plugins/remark-image.js";
|
|
4
4
|
import { StructureOptions } from "../../mdx-plugins/remark-structure.js";
|
|
@@ -6,7 +6,7 @@ import { RemarkHeadingOptions } from "../../mdx-plugins/remark-heading.js";
|
|
|
6
6
|
import { RemarkCodeTabOptions } from "../../mdx-plugins/remark-code-tab.js";
|
|
7
7
|
import { RemarkNpmOptions } from "../../mdx-plugins/remark-npm.js";
|
|
8
8
|
import "../../mdx-plugins/index.js";
|
|
9
|
-
import { t as ResolvePlugins } from "../../util-
|
|
9
|
+
import { t as ResolvePlugins } from "../../util-C7X6g0ql.js";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
11
11
|
|
|
12
12
|
//#region src/content/mdx/preset-runtime.d.ts
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/search/orama/create-endpoint.ts
|
|
2
|
+
function createEndpoint(server) {
|
|
3
|
+
const { search } = server;
|
|
4
|
+
return {
|
|
5
|
+
...server,
|
|
6
|
+
async staticGET() {
|
|
7
|
+
return Response.json(await server.export());
|
|
8
|
+
},
|
|
9
|
+
async GET(request) {
|
|
10
|
+
const url = new URL(request.url);
|
|
11
|
+
const query = url.searchParams.get("query");
|
|
12
|
+
if (!query) return Response.json([]);
|
|
13
|
+
return Response.json(await search(query, {
|
|
14
|
+
tag: url.searchParams.get("tag")?.split(",") ?? void 0,
|
|
15
|
+
locale: url.searchParams.get("locale") ?? void 0,
|
|
16
|
+
mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { createEndpoint as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as Awaitable } from "./types-
|
|
1
|
+
import { t as Awaitable } from "./types-Bt4vrwsT.js";
|
|
2
2
|
import { I18nConfig } from "./i18n/index.js";
|
|
3
|
-
import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-
|
|
3
|
+
import { i as LoaderConfig, o as LoaderOutput, u as Page } from "./path-CDjb5iUO.js";
|
|
4
4
|
import { AdvancedIndex, AdvancedOptions, Dynamic, Index, SearchAPI, SimpleOptions } from "./search/server.js";
|
|
5
5
|
import { Language, Orama, TypedDocument } from "@orama/orama";
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as MakeOptional } from "../../types-
|
|
1
|
+
import { r as MakeOptional } from "../../types-Bt4vrwsT.js";
|
|
2
2
|
import { ResolvedShikiConfig } from "../config.js";
|
|
3
3
|
import { CoreHighlightOptions } from "./index.js";
|
|
4
4
|
import { DependencyList, ReactNode } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DistributiveOmit } from "../../types-
|
|
1
|
+
import { n as DistributiveOmit } from "../../types-Bt4vrwsT.js";
|
|
2
2
|
import { ResolvedShikiConfig } from "../config.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { Components } from "hast-util-to-jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DistributiveOmit } from "../types-
|
|
1
|
+
import { n as DistributiveOmit } from "../types-Bt4vrwsT.js";
|
|
2
2
|
import { ResolvedShikiConfig } from "./config.js";
|
|
3
3
|
import { CoreHighlightOptions } from "./core/index.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockContent, Text } from "mdast";
|
|
2
|
-
import { MdxJsxAttribute, MdxJsxFlowElement } from "mdast-util-mdx
|
|
2
|
+
import { MdxJsxAttribute, MdxJsxFlowElement } from "mdast-util-mdx";
|
|
3
3
|
|
|
4
4
|
//#region src/mdx-plugins/codeblock-utils.d.ts
|
|
5
5
|
interface CodeBlockTabsOptions {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RemarkGfmOptions, remarkGfm } from "./remark-gfm.js";
|
|
2
|
-
import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-
|
|
2
|
+
import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
|
|
3
3
|
import { transformerTab } from "./rehype-code.core.js";
|
|
4
4
|
import { RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
|
|
5
5
|
import { RemarkImageOptions, remarkImage } from "./remark-image.js";
|
|
6
|
-
import { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
6
|
+
import { StructureOptions, StructuredData, defaultStringify, remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
7
7
|
import { RemarkHeadingOptions, remarkHeading } from "./remark-heading.js";
|
|
8
8
|
import { RemarkAdmonitionOptions, remarkAdmonition } from "./remark-admonition.js";
|
|
9
9
|
import { RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
@@ -15,4 +15,4 @@ import { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parse
|
|
|
15
15
|
import { RemarkMdxFilesOptions, remarkMdxFiles } from "./remark-mdx-files.js";
|
|
16
16
|
import { RemarkMdxMermaidOptions, remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
17
17
|
import { FeedbackBlockProps, RemarkFeedbackBlockOptions, remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
18
|
-
export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
18
|
+
export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, defaultStringify, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -6,7 +6,7 @@ import { t as transformerIcon } from "../transformer-icon-BYedaeE8.js";
|
|
|
6
6
|
import { transformerTab } from "./rehype-code.core.js";
|
|
7
7
|
import { rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
|
|
8
8
|
import { remarkImage } from "./remark-image.js";
|
|
9
|
-
import { remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
9
|
+
import { defaultStringify, remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
10
10
|
import { remarkAdmonition } from "./remark-admonition.js";
|
|
11
11
|
import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
12
12
|
import { rehypeToc } from "./rehype-toc.js";
|
|
@@ -17,4 +17,4 @@ import { remarkMdxFiles } from "./remark-mdx-files.js";
|
|
|
17
17
|
import { remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
18
18
|
import { remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
19
19
|
|
|
20
|
-
export { generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
20
|
+
export { defaultStringify, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-
|
|
2
|
-
import { n as DistributiveOmit } from "../types-
|
|
1
|
+
import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
|
|
2
|
+
import { n as DistributiveOmit } from "../types-Bt4vrwsT.js";
|
|
3
3
|
import { ResolvedShikiConfig } from "../highlight/config.js";
|
|
4
4
|
import { ShikiTransformer } from "shiki";
|
|
5
5
|
import { Processor, Transformer } from "unified";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-
|
|
1
|
+
import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-C8MUuI2T.js";
|
|
2
2
|
import { RehypeCodeOptionsCommon, transformerTab } from "./rehype-code.core.js";
|
|
3
3
|
import * as unified from "unified";
|
|
4
4
|
import * as hast from "hast";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Processor, Transformer } from "unified";
|
|
2
2
|
import { Code, Root } from "mdast";
|
|
3
|
-
import { MdxJsxFlowElement } from "mdast-util-mdx
|
|
3
|
+
import { MdxJsxFlowElement } from "mdast-util-mdx";
|
|
4
4
|
|
|
5
5
|
//#region src/mdx-plugins/remark-code-tab.d.ts
|
|
6
6
|
type TabType = keyof typeof Types;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Options } from "mdast-util-to-markdown";
|
|
2
|
+
import { PluggableList, Processor, Transformer } from "unified";
|
|
2
3
|
import { Nodes, Root } from "mdast";
|
|
3
|
-
import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from "mdast-util-mdx
|
|
4
|
+
import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement, MdxJsxTextElement } from "mdast-util-mdx";
|
|
4
5
|
|
|
5
6
|
//#region src/mdx-plugins/remark-structure.d.ts
|
|
6
7
|
interface Heading$1 {
|
|
@@ -18,29 +19,44 @@ interface StructuredData {
|
|
|
18
19
|
*/
|
|
19
20
|
contents: Content[];
|
|
20
21
|
}
|
|
21
|
-
interface
|
|
22
|
+
interface StringifyOptions {
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Determine whether the element itself should be stringified in content block, only stringify its attributes & children if `false`.
|
|
25
|
+
*
|
|
26
|
+
* Always return `false` by default.
|
|
27
|
+
*/
|
|
28
|
+
filterMdxElements?: (node: MdxJsxFlowElement | MdxJsxTextElement) => boolean;
|
|
29
|
+
filterMdxAttributes?: (node: MdxJsxFlowElement | MdxJsxTextElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean;
|
|
30
|
+
}
|
|
31
|
+
interface StructureOptions extends Omit<StringifyOptions, 'filterMdxAttributes'> {
|
|
32
|
+
/**
|
|
33
|
+
* MDAST node types to be scanned as a content block.
|
|
34
|
+
*
|
|
35
|
+
* If a node's type represents in this array, it will be converted into a single content block.
|
|
24
36
|
*
|
|
25
37
|
* @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
|
|
26
38
|
*/
|
|
27
39
|
types?: string[] | ((node: Nodes) => boolean);
|
|
28
40
|
/**
|
|
29
|
-
*
|
|
41
|
+
* stringify a given node & its children, you can use something like `mdast-util-to-markdown`.
|
|
42
|
+
*/
|
|
43
|
+
stringify?: (this: Processor, node: Nodes) => string;
|
|
44
|
+
/**
|
|
45
|
+
* By default, it will not index MDX attributes. You can define a list of MDX attributes to index, either:
|
|
30
46
|
*
|
|
31
47
|
* - an array of attribute names.
|
|
32
48
|
* - a function that determines if attribute should be indexed.
|
|
33
49
|
*/
|
|
34
|
-
allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
|
|
50
|
+
allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement | MdxJsxTextElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
|
|
35
51
|
/**
|
|
36
|
-
* export as `structuredData` or specified variable name.
|
|
52
|
+
* export as `structuredData` (if true) or specified variable name.
|
|
37
53
|
*/
|
|
38
54
|
exportAs?: string | boolean;
|
|
39
55
|
}
|
|
40
56
|
declare module 'mdast' {
|
|
41
57
|
interface Data {
|
|
42
58
|
/**
|
|
43
|
-
* [Fumadocs]
|
|
59
|
+
* [Fumadocs] Stringified form of node, `remarkStructure` uses it to generate search index.
|
|
44
60
|
*/
|
|
45
61
|
_string?: string[];
|
|
46
62
|
}
|
|
@@ -55,7 +71,6 @@ declare module 'vfile' {
|
|
|
55
71
|
}
|
|
56
72
|
declare const remarkStructureDefaultOptions: {
|
|
57
73
|
types: string[];
|
|
58
|
-
allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
|
|
59
74
|
exportAs: false;
|
|
60
75
|
};
|
|
61
76
|
/**
|
|
@@ -63,14 +78,17 @@ declare const remarkStructureDefaultOptions: {
|
|
|
63
78
|
*
|
|
64
79
|
* By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
|
|
65
80
|
*/
|
|
66
|
-
declare function remarkStructure({
|
|
81
|
+
declare function remarkStructure(this: Processor, {
|
|
67
82
|
types,
|
|
83
|
+
stringify,
|
|
68
84
|
allowedMdxAttributes,
|
|
69
|
-
exportAs
|
|
85
|
+
exportAs,
|
|
86
|
+
...stringifyOptions
|
|
70
87
|
}?: StructureOptions): Transformer<Root, Root>;
|
|
71
88
|
/**
|
|
72
89
|
* Extract data from markdown/mdx content
|
|
73
90
|
*/
|
|
74
91
|
declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
|
|
92
|
+
declare function defaultStringify(config?: Options & StringifyOptions): (this: Processor, node: Nodes) => string;
|
|
75
93
|
//#endregion
|
|
76
|
-
export { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
94
|
+
export { StructureOptions, StructuredData, defaultStringify, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { n as toMdxExport, t as flattenNode } from "../mdast-utils-gJMY143g.js";
|
|
2
|
+
import { remarkHeading } from "./remark-heading.js";
|
|
2
3
|
import { remark } from "remark";
|
|
3
4
|
import remarkGfm from "remark-gfm";
|
|
4
|
-
import Slugger from "github-slugger";
|
|
5
5
|
import { visit } from "unist-util-visit";
|
|
6
|
+
import { toMarkdown } from "mdast-util-to-markdown";
|
|
6
7
|
|
|
7
8
|
//#region src/mdx-plugins/remark-structure.ts
|
|
8
9
|
const remarkStructureDefaultOptions = {
|
|
@@ -13,10 +14,6 @@ const remarkStructureDefaultOptions = {
|
|
|
13
14
|
"tableCell",
|
|
14
15
|
"mdxJsxFlowElement"
|
|
15
16
|
],
|
|
16
|
-
allowedMdxAttributes: (node) => {
|
|
17
|
-
if (!node.name) return false;
|
|
18
|
-
return ["TypeTable", "Callout"].includes(node.name);
|
|
19
|
-
},
|
|
20
17
|
exportAs: false
|
|
21
18
|
};
|
|
22
19
|
/**
|
|
@@ -24,8 +21,7 @@ const remarkStructureDefaultOptions = {
|
|
|
24
21
|
*
|
|
25
22
|
* By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
|
|
26
23
|
*/
|
|
27
|
-
function remarkStructure({ types = remarkStructureDefaultOptions.types,
|
|
28
|
-
const slugger = new Slugger();
|
|
24
|
+
function remarkStructure({ types = remarkStructureDefaultOptions.types, stringify, allowedMdxAttributes, exportAs = remarkStructureDefaultOptions.exportAs, ...stringifyOptions } = {}) {
|
|
29
25
|
if (Array.isArray(allowedMdxAttributes)) {
|
|
30
26
|
const arr = allowedMdxAttributes;
|
|
31
27
|
allowedMdxAttributes = (_node, attribute) => attribute.type === "mdxJsxAttribute" && arr.includes(attribute.name);
|
|
@@ -34,8 +30,11 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, allowedM
|
|
|
34
30
|
const arr = types;
|
|
35
31
|
types = (node) => arr.includes(node.type);
|
|
36
32
|
}
|
|
33
|
+
stringify ??= defaultStringify({
|
|
34
|
+
filterMdxAttributes: allowedMdxAttributes,
|
|
35
|
+
...stringifyOptions
|
|
36
|
+
});
|
|
37
37
|
return (tree, file) => {
|
|
38
|
-
slugger.reset();
|
|
39
38
|
const data = {
|
|
40
39
|
contents: [],
|
|
41
40
|
headings: []
|
|
@@ -53,38 +52,20 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, allowedM
|
|
|
53
52
|
if (element.type === "heading") {
|
|
54
53
|
element.data ||= {};
|
|
55
54
|
element.data.hProperties ||= {};
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const id = element.data.hProperties.id;
|
|
56
|
+
if (typeof id !== "string") {
|
|
57
|
+
console.warn("[remark-structure] hProperties.id is missing in heading node, it is required to generate heading data. You can add remark-heading prior to remark-structure to generate heading IDs.");
|
|
58
|
+
return "skip";
|
|
59
|
+
}
|
|
59
60
|
data.headings.push({
|
|
60
61
|
id,
|
|
61
|
-
content
|
|
62
|
+
content: flattenNode(element).trim()
|
|
62
63
|
});
|
|
63
64
|
lastHeading = id;
|
|
64
65
|
return "skip";
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
heading: lastHeading,
|
|
69
|
-
content
|
|
70
|
-
});
|
|
71
|
-
return "skip";
|
|
72
|
-
}
|
|
73
|
-
if (element.type === "mdxJsxFlowElement" && element.name) {
|
|
74
|
-
data.contents.push(...element.attributes.flatMap((attribute) => {
|
|
75
|
-
const value = typeof attribute.value === "string" ? attribute.value : attribute.value?.value;
|
|
76
|
-
if (!value || value.length === 0) return [];
|
|
77
|
-
if (allowedMdxAttributes && !allowedMdxAttributes(element, attribute)) return [];
|
|
78
|
-
return {
|
|
79
|
-
heading: lastHeading,
|
|
80
|
-
content: attribute.type === "mdxJsxAttribute" ? `${attribute.name}: ${value}` : value
|
|
81
|
-
};
|
|
82
|
-
}));
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const content = flattenNode(element).trim();
|
|
86
|
-
if (content.length === 0) return;
|
|
87
|
-
data.contents.push({
|
|
67
|
+
const content = stringify.call(this, element).trim();
|
|
68
|
+
if (content.length > 0) data.contents.push({
|
|
88
69
|
heading: lastHeading,
|
|
89
70
|
content
|
|
90
71
|
});
|
|
@@ -98,8 +79,67 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, allowedM
|
|
|
98
79
|
* Extract data from markdown/mdx content
|
|
99
80
|
*/
|
|
100
81
|
function structure(content, remarkPlugins = [], options = {}) {
|
|
101
|
-
return remark().use(remarkGfm).use(remarkPlugins).use(remarkStructure, options).processSync(content).data.structuredData;
|
|
82
|
+
return remark().use(remarkGfm).use(remarkPlugins).use(remarkHeading).use(remarkStructure, options).processSync(content).data.structuredData;
|
|
83
|
+
}
|
|
84
|
+
function defaultStringify(config = {}) {
|
|
85
|
+
const { filterMdxAttributes = (node) => {
|
|
86
|
+
switch (node.name) {
|
|
87
|
+
case "TypeTable":
|
|
88
|
+
case "Callout": return true;
|
|
89
|
+
default: return false;
|
|
90
|
+
}
|
|
91
|
+
}, filterMdxElements = () => false } = config;
|
|
92
|
+
function modHandler(handler) {
|
|
93
|
+
return function(node, ...rest) {
|
|
94
|
+
if (node.data?._string) return node.data._string.join("\n");
|
|
95
|
+
switch (node.type) {
|
|
96
|
+
case "mdxJsxFlowElement":
|
|
97
|
+
case "mdxJsxTextElement": {
|
|
98
|
+
const filteredAttributes = node.attributes.filter((attr) => filterMdxAttributes(node, attr));
|
|
99
|
+
if (!filterMdxElements(node)) {
|
|
100
|
+
let attrStr = "";
|
|
101
|
+
for (const attr of filteredAttributes) {
|
|
102
|
+
const str = typeof attr.value === "string" ? attr.value : attr.value?.value;
|
|
103
|
+
if (!str) continue;
|
|
104
|
+
attrStr += attr.type === "mdxJsxAttribute" ? `(${attr.name}=${str}) ` : `(${str}) `;
|
|
105
|
+
}
|
|
106
|
+
if (node.children.length === 0) return attrStr.trimEnd();
|
|
107
|
+
return attrStr + rest[1].handle({
|
|
108
|
+
type: "root",
|
|
109
|
+
children: node.children
|
|
110
|
+
}, ...rest);
|
|
111
|
+
}
|
|
112
|
+
const temp = node.attributes;
|
|
113
|
+
node.attributes = filteredAttributes;
|
|
114
|
+
const s = handler(node, ...rest);
|
|
115
|
+
node.attributes = temp;
|
|
116
|
+
return s;
|
|
117
|
+
}
|
|
118
|
+
default: return handler(node, ...rest);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const handlers = {
|
|
123
|
+
...config.handlers,
|
|
124
|
+
_custom(node, _, state, info) {
|
|
125
|
+
const handlers = state.handlers;
|
|
126
|
+
for (const k in handlers) handlers[k] = modHandler(handlers[k]);
|
|
127
|
+
return state.handle(node.root, void 0, state, info);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return function(root) {
|
|
131
|
+
const defaultExtensions = this.data("toMarkdownExtensions") ?? [];
|
|
132
|
+
return toMarkdown({
|
|
133
|
+
type: "_custom",
|
|
134
|
+
root
|
|
135
|
+
}, {
|
|
136
|
+
...this.data("settings"),
|
|
137
|
+
...config,
|
|
138
|
+
extensions: config.extensions ? [...defaultExtensions, ...config.extensions] : defaultExtensions,
|
|
139
|
+
handlers
|
|
140
|
+
});
|
|
141
|
+
};
|
|
102
142
|
}
|
|
103
143
|
|
|
104
144
|
//#endregion
|
|
105
|
-
export { remarkStructure, remarkStructureDefaultOptions, structure };
|
|
145
|
+
export { defaultStringify, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { r as __toESM } from "./chunk-CaR5F9JI.js";
|
|
2
|
+
import { t as require_remove_markdown } from "./remove-markdown-CnXcUR-e.js";
|
|
3
|
+
import Slugger from "github-slugger";
|
|
4
|
+
|
|
5
|
+
//#region src/search/client/mixedbread.ts
|
|
6
|
+
var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
|
|
7
|
+
const slugger = new Slugger();
|
|
8
|
+
function extractHeadingTitle(text) {
|
|
9
|
+
const trimmedText = text.trim();
|
|
10
|
+
if (!trimmedText.startsWith("#")) return "";
|
|
11
|
+
const firstLine = trimmedText.split("\n")[0]?.trim();
|
|
12
|
+
if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
|
|
17
|
+
* This client-side approach exposes your API key in the browser.
|
|
18
|
+
* The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
|
|
19
|
+
*/
|
|
20
|
+
async function search(query, options) {
|
|
21
|
+
const { client, storeIdentifier, tag } = options;
|
|
22
|
+
if (!query.trim()) return [];
|
|
23
|
+
return (await client.stores.search({
|
|
24
|
+
query,
|
|
25
|
+
store_identifiers: [storeIdentifier],
|
|
26
|
+
top_k: 10,
|
|
27
|
+
filters: {
|
|
28
|
+
key: "generated_metadata.tag",
|
|
29
|
+
operator: "eq",
|
|
30
|
+
value: tag
|
|
31
|
+
},
|
|
32
|
+
search_options: { return_metadata: true }
|
|
33
|
+
})).data.flatMap((item) => {
|
|
34
|
+
const metadata = item.generated_metadata;
|
|
35
|
+
const url = metadata.url || "#";
|
|
36
|
+
const title = metadata.title || "Untitled";
|
|
37
|
+
const chunkResults = [{
|
|
38
|
+
id: `${item.file_id}-${item.chunk_index}-page`,
|
|
39
|
+
type: "page",
|
|
40
|
+
content: title,
|
|
41
|
+
url
|
|
42
|
+
}];
|
|
43
|
+
const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
|
|
44
|
+
if (headingTitle) {
|
|
45
|
+
slugger.reset();
|
|
46
|
+
chunkResults.push({
|
|
47
|
+
id: `${item.file_id}-${item.chunk_index}-heading`,
|
|
48
|
+
type: "heading",
|
|
49
|
+
content: headingTitle,
|
|
50
|
+
url: `${url}#${slugger.slug(headingTitle)}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return chunkResults;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { search };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
|
|
3
3
|
|
|
4
4
|
//#region src/search/client/orama-cloud.ts
|
|
5
5
|
async function searchDocs(query, options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-B_oBVupY.js";
|
|
3
3
|
|
|
4
4
|
//#region src/search/client/orama-cloud-legacy.ts
|
|
5
5
|
async function searchDocs(query, options) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-
|
|
2
|
-
import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-
|
|
1
|
+
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-Cw2aM1Af.js";
|
|
2
|
+
import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-5HX-8dF3.js";
|
|
3
3
|
export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-
|
|
1
|
+
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cw2aM1Af.js";
|
|
2
2
|
import { I18nConfig } from "./i18n/index.js";
|
|
3
3
|
import { SlugFn } from "./source/plugins/slugs.js";
|
|
4
4
|
import { SerializedPageTree } from "./source/client/index.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Slugger from "github-slugger";
|
|
1
|
+
import { t as __commonJSMin } from "./chunk-CaR5F9JI.js";
|
|
3
2
|
|
|
4
3
|
//#region ../../node_modules/.pnpm/remove-markdown@0.6.3/node_modules/remove-markdown/index.js
|
|
5
4
|
var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -38,52 +37,4 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
38
37
|
}));
|
|
39
38
|
|
|
40
39
|
//#endregion
|
|
41
|
-
|
|
42
|
-
var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
|
|
43
|
-
const slugger = new Slugger();
|
|
44
|
-
function extractHeadingTitle(text) {
|
|
45
|
-
const trimmedText = text.trim();
|
|
46
|
-
if (!trimmedText.startsWith("#")) return "";
|
|
47
|
-
const firstLine = trimmedText.split("\n")[0]?.trim();
|
|
48
|
-
if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
async function search(query, options) {
|
|
52
|
-
const { client, storeIdentifier, tag } = options;
|
|
53
|
-
if (!query.trim()) return [];
|
|
54
|
-
return (await client.stores.search({
|
|
55
|
-
query,
|
|
56
|
-
store_identifiers: [storeIdentifier],
|
|
57
|
-
top_k: 10,
|
|
58
|
-
filters: {
|
|
59
|
-
key: "generated_metadata.tag",
|
|
60
|
-
operator: "eq",
|
|
61
|
-
value: tag
|
|
62
|
-
},
|
|
63
|
-
search_options: { return_metadata: true }
|
|
64
|
-
})).data.flatMap((item) => {
|
|
65
|
-
const metadata = item.generated_metadata;
|
|
66
|
-
const url = metadata.url || "#";
|
|
67
|
-
const title = metadata.title || "Untitled";
|
|
68
|
-
const chunkResults = [{
|
|
69
|
-
id: `${item.file_id}-${item.chunk_index}-page`,
|
|
70
|
-
type: "page",
|
|
71
|
-
content: title,
|
|
72
|
-
url
|
|
73
|
-
}];
|
|
74
|
-
const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
|
|
75
|
-
if (headingTitle) {
|
|
76
|
-
slugger.reset();
|
|
77
|
-
chunkResults.push({
|
|
78
|
-
id: `${item.file_id}-${item.chunk_index}-heading`,
|
|
79
|
-
type: "heading",
|
|
80
|
-
content: headingTitle,
|
|
81
|
-
url: `${url}#${slugger.slug(headingTitle)}`
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return chunkResults;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
export { search };
|
|
40
|
+
export { require_remove_markdown as t };
|
package/dist/search/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../definitions-
|
|
2
|
-
import "../utils-
|
|
1
|
+
import "../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../utils-5HX-8dF3.js";
|
|
3
3
|
import { BaseIndex } from "./algolia.js";
|
|
4
4
|
import { SortedResult } from "./index.js";
|
|
5
|
-
import "../create-i18n-
|
|
6
|
-
import "../path-
|
|
5
|
+
import "../create-i18n-DxSvCSv-.js";
|
|
6
|
+
import "../path-CDjb5iUO.js";
|
|
7
7
|
import "./server.js";
|
|
8
8
|
import { DependencyList } from "react";
|
|
9
9
|
import { AnyOrama } from "@orama/orama";
|
|
@@ -104,6 +104,11 @@ interface OramaCloudLegacyOptions {
|
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/search/client/mixedbread.d.ts
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
|
|
109
|
+
* This client-side approach exposes your API key in the browser.
|
|
110
|
+
* The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
|
|
111
|
+
*/
|
|
107
112
|
interface MixedbreadOptions {
|
|
108
113
|
/**
|
|
109
114
|
* The identifier of the store to search in
|
package/dist/search/client.js
CHANGED
|
@@ -54,27 +54,27 @@ function useDocsSearch(clientOptions, deps) {
|
|
|
54
54
|
if (debouncedValue.length === 0 && !allowEmpty) return "empty";
|
|
55
55
|
switch (client.type) {
|
|
56
56
|
case "fetch": {
|
|
57
|
-
const { fetchDocs } = await import("../fetch-
|
|
57
|
+
const { fetchDocs } = await import("../fetch-D_OY-eAB.js");
|
|
58
58
|
return fetchDocs(debouncedValue, client);
|
|
59
59
|
}
|
|
60
60
|
case "algolia": {
|
|
61
|
-
const { searchDocs } = await import("../algolia-
|
|
61
|
+
const { searchDocs } = await import("../algolia-Cx9CqUgE.js");
|
|
62
62
|
return searchDocs(debouncedValue, client);
|
|
63
63
|
}
|
|
64
64
|
case "orama-cloud": {
|
|
65
|
-
const { searchDocs } = await import("../orama-cloud-
|
|
65
|
+
const { searchDocs } = await import("../orama-cloud-CmYuZkvC.js");
|
|
66
66
|
return searchDocs(debouncedValue, client);
|
|
67
67
|
}
|
|
68
68
|
case "orama-cloud-legacy": {
|
|
69
|
-
const { searchDocs } = await import("../orama-cloud-legacy-
|
|
69
|
+
const { searchDocs } = await import("../orama-cloud-legacy-D-cNaYCM.js");
|
|
70
70
|
return searchDocs(debouncedValue, client);
|
|
71
71
|
}
|
|
72
72
|
case "mixedbread": {
|
|
73
|
-
const { search } = await import("../mixedbread-
|
|
73
|
+
const { search } = await import("../mixedbread-RiA_24CE.js");
|
|
74
74
|
return search(debouncedValue, client);
|
|
75
75
|
}
|
|
76
76
|
case "static": {
|
|
77
|
-
const { search } = await import("../static-
|
|
77
|
+
const { search } = await import("../static-BQOJvapl.js");
|
|
78
78
|
return search(debouncedValue, client);
|
|
79
79
|
}
|
|
80
80
|
default: throw new Error("unknown search client");
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../utils-5HX-8dF3.js";
|
|
3
|
+
import { SortedResult } from "./index.js";
|
|
4
|
+
import "../create-i18n-DxSvCSv-.js";
|
|
5
|
+
import "../path-CDjb5iUO.js";
|
|
6
|
+
import { SearchAPI } from "./server.js";
|
|
7
|
+
import Mixedbread from "@mixedbread/sdk";
|
|
8
|
+
import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
|
|
9
|
+
|
|
10
|
+
//#region src/search/mixedbread.d.ts
|
|
11
|
+
interface SearchMetadata {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
tag?: string;
|
|
16
|
+
}
|
|
17
|
+
type StoreSearchResult = StoreSearchResponse['data'][number] & {
|
|
18
|
+
generated_metadata: SearchMetadata;
|
|
19
|
+
};
|
|
20
|
+
interface MixedbreadSearchOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The Mixedbread SDK client instance
|
|
23
|
+
*/
|
|
24
|
+
client: Mixedbread;
|
|
25
|
+
/**
|
|
26
|
+
* The identifier of the store to search in
|
|
27
|
+
*/
|
|
28
|
+
storeIdentifier: string;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum number of results to return
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue 10
|
|
33
|
+
*/
|
|
34
|
+
topK?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Re-rank search results for improved relevance
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue true
|
|
39
|
+
*/
|
|
40
|
+
rerank?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Rewrite the query for better search results
|
|
43
|
+
*/
|
|
44
|
+
rewriteQuery?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Minimum score threshold for results
|
|
47
|
+
*/
|
|
48
|
+
scoreThreshold?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Custom transform function for search results
|
|
51
|
+
*/
|
|
52
|
+
transform?: (results: StoreSearchResult[], query: string) => SortedResult[];
|
|
53
|
+
}
|
|
54
|
+
declare function createMixedbreadSearchAPI(options: MixedbreadSearchOptions): SearchAPI;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { MixedbreadSearchOptions, SearchMetadata, createMixedbreadSearchAPI };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { r as __toESM } from "../chunk-CaR5F9JI.js";
|
|
2
|
+
import { t as require_remove_markdown } from "../remove-markdown-CnXcUR-e.js";
|
|
3
|
+
import { t as createEndpoint } from "../create-endpoint-9PZc4Cmz.js";
|
|
4
|
+
import Slugger from "github-slugger";
|
|
5
|
+
|
|
6
|
+
//#region src/search/mixedbread.ts
|
|
7
|
+
var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
|
|
8
|
+
const slugger = new Slugger();
|
|
9
|
+
function extractHeadingTitle(text) {
|
|
10
|
+
const trimmedText = text.trim();
|
|
11
|
+
if (!trimmedText.startsWith("#")) return "";
|
|
12
|
+
const firstLine = trimmedText.split("\n")[0]?.trim();
|
|
13
|
+
if (firstLine) return (0, import_remove_markdown.default)(firstLine, { useImgAltText: false });
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
function defaultTransform(results) {
|
|
17
|
+
return results.flatMap((item) => {
|
|
18
|
+
const metadata = item.generated_metadata;
|
|
19
|
+
const url = metadata.url || "#";
|
|
20
|
+
const title = metadata.title || "Untitled";
|
|
21
|
+
const chunkResults = [{
|
|
22
|
+
id: `${item.file_id}-${item.chunk_index}-page`,
|
|
23
|
+
type: "page",
|
|
24
|
+
content: title,
|
|
25
|
+
url
|
|
26
|
+
}];
|
|
27
|
+
const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
|
|
28
|
+
if (headingTitle) {
|
|
29
|
+
slugger.reset();
|
|
30
|
+
chunkResults.push({
|
|
31
|
+
id: `${item.file_id}-${item.chunk_index}-heading`,
|
|
32
|
+
type: "heading",
|
|
33
|
+
content: headingTitle,
|
|
34
|
+
url: `${url}#${slugger.slug(headingTitle)}`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return chunkResults;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function createMixedbreadSearchAPI(options) {
|
|
41
|
+
const { client, storeIdentifier, topK = 10, rerank = true, rewriteQuery, scoreThreshold, transform } = options;
|
|
42
|
+
return createEndpoint({
|
|
43
|
+
async search(query, searchOptions) {
|
|
44
|
+
if (!query.trim()) return [];
|
|
45
|
+
const tag = searchOptions?.tag;
|
|
46
|
+
let filters;
|
|
47
|
+
if (Array.isArray(tag) && tag.length > 0) filters = {
|
|
48
|
+
key: "generated_metadata.tag",
|
|
49
|
+
operator: "in",
|
|
50
|
+
value: tag
|
|
51
|
+
};
|
|
52
|
+
else if (typeof tag === "string") filters = {
|
|
53
|
+
key: "generated_metadata.tag",
|
|
54
|
+
operator: "eq",
|
|
55
|
+
value: tag
|
|
56
|
+
};
|
|
57
|
+
const results = (await client.stores.search({
|
|
58
|
+
query,
|
|
59
|
+
store_identifiers: [storeIdentifier],
|
|
60
|
+
top_k: topK,
|
|
61
|
+
filters,
|
|
62
|
+
search_options: {
|
|
63
|
+
return_metadata: true,
|
|
64
|
+
rerank,
|
|
65
|
+
rewrite_query: rewriteQuery,
|
|
66
|
+
score_threshold: scoreThreshold
|
|
67
|
+
}
|
|
68
|
+
})).data;
|
|
69
|
+
if (transform) return transform(results, query);
|
|
70
|
+
return defaultTransform(results);
|
|
71
|
+
},
|
|
72
|
+
async export() {
|
|
73
|
+
throw new Error("Mixedbread search does not support exporting indexes. Use the Mixedbread dashboard to manage your store.");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { createMixedbreadSearchAPI };
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../definitions-
|
|
1
|
+
import "../definitions-Cw2aM1Af.js";
|
|
2
2
|
import { StructuredData } from "../mdx-plugins/remark-structure.js";
|
|
3
|
-
import "../utils-
|
|
3
|
+
import "../utils-5HX-8dF3.js";
|
|
4
4
|
import { HighlightedText, ReactSortedResult, SortedResult, createContentHighlighter } from "./index.js";
|
|
5
|
-
import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-
|
|
6
|
-
import "../path-
|
|
5
|
+
import { a as advancedSchema, i as SimpleDocument, n as createFromSource, o as simpleSchema, r as AdvancedDocument, t as createI18nSearchAPI } from "../create-i18n-DxSvCSv-.js";
|
|
6
|
+
import "../path-CDjb5iUO.js";
|
|
7
7
|
import { Orama, RawData, SearchParams, create } from "@orama/orama";
|
|
8
8
|
|
|
9
9
|
//#region src/search/server.d.ts
|
package/dist/search/server.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
1
|
import { r as findPath } from "../utils-Bc53B3CJ.js";
|
|
2
2
|
import { createContentHighlighter } from "./index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { t as createEndpoint } from "../create-endpoint-9PZc4Cmz.js";
|
|
4
|
+
import { n as searchSimple, t as searchAdvanced } from "../advanced-3GdE_Q4d.js";
|
|
5
|
+
import { r as extname, t as basename } from "../path-CfJghBXy.js";
|
|
5
6
|
import { create, insertMultiple, save } from "@orama/orama";
|
|
6
7
|
|
|
7
|
-
//#region src/search/orama/create-endpoint.ts
|
|
8
|
-
function createEndpoint(server) {
|
|
9
|
-
const { search } = server;
|
|
10
|
-
return {
|
|
11
|
-
...server,
|
|
12
|
-
async staticGET() {
|
|
13
|
-
return Response.json(await server.export());
|
|
14
|
-
},
|
|
15
|
-
async GET(request) {
|
|
16
|
-
const url = new URL(request.url);
|
|
17
|
-
const query = url.searchParams.get("query");
|
|
18
|
-
if (!query) return Response.json([]);
|
|
19
|
-
return Response.json(await search(query, {
|
|
20
|
-
tag: url.searchParams.get("tag")?.split(",") ?? void 0,
|
|
21
|
-
locale: url.searchParams.get("locale") ?? void 0,
|
|
22
|
-
mode: url.searchParams.get("mode") === "vector" ? "vector" : "full"
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
8
|
//#region src/search/orama/create-db.ts
|
|
30
9
|
const simpleSchema = {
|
|
31
10
|
url: "string",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as Root } from "../../definitions-
|
|
2
|
-
import "../../utils-
|
|
1
|
+
import { i as Root } from "../../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../../utils-5HX-8dF3.js";
|
|
3
3
|
import "../../page-tree/index.js";
|
|
4
4
|
|
|
5
5
|
//#region src/source/client/index.d.ts
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../definitions-
|
|
2
|
-
import "../utils-
|
|
3
|
-
import { A as _SourceUpdate_, C as FileSystem, D as SourceConfig, E as Source, M as source, N as update, O as VirtualFile, S as createContentStorageBuilder, T as PageData, _ as PageTreeTransformer, a as LoaderOptions, b as ContentStorageMetaFile, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeOptions, h as PageTreeBuilderContext, i as LoaderConfig, j as multiple, k as _ConfigUnion_, l as Meta, m as PageTreeBuilder, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as ContentStorage, w as MetaData, x as ContentStoragePageFile, y as ContentStorageFile } from "../path-
|
|
1
|
+
import "../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../utils-5HX-8dF3.js";
|
|
3
|
+
import { A as _SourceUpdate_, C as FileSystem, D as SourceConfig, E as Source, M as source, N as update, O as VirtualFile, S as createContentStorageBuilder, T as PageData, _ as PageTreeTransformer, a as LoaderOptions, b as ContentStorageMetaFile, c as LoaderPluginOption, d as ResolvedLoaderConfig, f as createGetUrl, g as PageTreeOptions, h as PageTreeBuilderContext, i as LoaderConfig, j as multiple, k as _ConfigUnion_, l as Meta, m as PageTreeBuilder, n as InferMetaType, o as LoaderOutput, p as loader, r as InferPageType, s as LoaderPlugin, t as path_d_exports, u as Page, v as ContentStorage, w as MetaData, x as ContentStoragePageFile, y as ContentStorageFile } from "../path-CDjb5iUO.js";
|
|
4
4
|
import { getSlugs } from "./plugins/slugs.js";
|
|
5
5
|
export { ContentStorage, ContentStorageFile, ContentStorageMetaFile, ContentStoragePageFile, FileSystem, InferMetaType, InferPageType, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, VirtualFile, _ConfigUnion_, _SourceUpdate_, createContentStorageBuilder, createGetUrl, getSlugs, loader, multiple, source, update };
|
package/dist/source/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as normalizeUrl } from "../normalize-url-DKBxIxO0.js";
|
|
2
2
|
import { c as visit } from "../utils-Bc53B3CJ.js";
|
|
3
|
-
import { a as path_exports, i as joinPath, n as dirname, o as slash, r as extname, s as splitPath, t as basename } from "../path-
|
|
3
|
+
import { a as path_exports, i as joinPath, n as dirname, o as slash, r as extname, s as splitPath, t as basename } from "../path-CfJghBXy.js";
|
|
4
4
|
import { getSlugs, slugsPlugin } from "./plugins/slugs.js";
|
|
5
|
-
import { t as iconPlugin } from "../icon-
|
|
5
|
+
import { t as iconPlugin } from "../icon-CGDZIqYj.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
//#region src/source/source.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../definitions-
|
|
2
|
-
import "../../utils-
|
|
3
|
-
import { s as LoaderPlugin } from "../../path-
|
|
1
|
+
import "../../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../../utils-5HX-8dF3.js";
|
|
3
|
+
import { s as LoaderPlugin } from "../../path-CDjb5iUO.js";
|
|
4
4
|
import "../index.js";
|
|
5
5
|
import { icons } from "lucide-react";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../definitions-
|
|
2
|
-
import "../../utils-
|
|
3
|
-
import { i as LoaderConfig, s as LoaderPlugin, x as ContentStoragePageFile } from "../../path-
|
|
1
|
+
import "../../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../../utils-5HX-8dF3.js";
|
|
3
|
+
import { i as LoaderConfig, s as LoaderPlugin, x as ContentStoragePageFile } from "../../path-CDjb5iUO.js";
|
|
4
4
|
|
|
5
5
|
//#region src/source/plugins/slugs.d.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-
|
|
2
|
-
import "../../utils-
|
|
3
|
-
import { s as LoaderPlugin } from "../../path-
|
|
1
|
+
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-Cw2aM1Af.js";
|
|
2
|
+
import "../../utils-5HX-8dF3.js";
|
|
3
|
+
import { s as LoaderPlugin } from "../../path-CDjb5iUO.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/source/plugins/status-badges.d.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-core",
|
|
3
|
-
"version": "16.5.
|
|
3
|
+
"version": "16.5.4",
|
|
4
4
|
"description": "The React.js library for building a documentation website",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
"hast-util-to-estree": "^3.1.3",
|
|
126
126
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
127
127
|
"image-size": "^2.0.2",
|
|
128
|
+
"mdast-util-mdx": "^3.0.0",
|
|
129
|
+
"mdast-util-to-markdown": "^2.1.2",
|
|
128
130
|
"negotiator": "^1.0.0",
|
|
129
131
|
"npm-to-yarn": "^3.0.1",
|
|
130
132
|
"path-to-regexp": "^8.3.0",
|
|
@@ -153,8 +155,6 @@
|
|
|
153
155
|
"@types/react-dom": "^19.2.3",
|
|
154
156
|
"algoliasearch": "5.48.0",
|
|
155
157
|
"lucide-react": "^0.563.0",
|
|
156
|
-
"mdast-util-mdx-jsx": "^3.2.0",
|
|
157
|
-
"mdast-util-mdxjs-esm": "^2.0.1",
|
|
158
158
|
"next": "16.1.6",
|
|
159
159
|
"react-router": "^7.13.0",
|
|
160
160
|
"remark-directive": "^4.0.0",
|
|
@@ -179,7 +179,6 @@
|
|
|
179
179
|
"@types/react": "*",
|
|
180
180
|
"algoliasearch": "5.x.x",
|
|
181
181
|
"lucide-react": "*",
|
|
182
|
-
"mdast-util-mdx-jsx": "*",
|
|
183
182
|
"next": "16.x.x",
|
|
184
183
|
"react": "^19.2.0",
|
|
185
184
|
"react-dom": "^19.2.0",
|
|
@@ -188,9 +187,6 @@
|
|
|
188
187
|
"zod": "4.x.x"
|
|
189
188
|
},
|
|
190
189
|
"peerDependenciesMeta": {
|
|
191
|
-
"mdast-util-mdx-jsx": {
|
|
192
|
-
"optional": true
|
|
193
|
-
},
|
|
194
190
|
"@mdx-js/mdx": {
|
|
195
191
|
"optional": true
|
|
196
192
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|