@depup/fumadocs-core 16.6.17-depup.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/LICENSE +21 -0
- package/README.md +31 -0
- package/changes.json +10 -0
- package/dist/advanced-BZKQwtss.js +72 -0
- package/dist/algolia-BcNfAtYC.d.ts +67 -0
- package/dist/breadcrumb.d.ts +47 -0
- package/dist/breadcrumb.js +61 -0
- package/dist/build-doc-BotvE-sS.js +81 -0
- package/dist/chunk-BoAXSpZd.js +33 -0
- package/dist/client-9fKBmECY.d.ts +218 -0
- package/dist/codeblock-utils-DBm7VMdU.d.ts +36 -0
- package/dist/config-CsHj5oV8.d.ts +16 -0
- package/dist/content/github.d.ts +50 -0
- package/dist/content/github.js +28 -0
- package/dist/content/md.d.ts +30 -0
- package/dist/content/md.js +45 -0
- package/dist/content/mdx/preset-bundler.d.ts +28 -0
- package/dist/content/mdx/preset-bundler.js +39 -0
- package/dist/content/mdx/preset-runtime.d.ts +26 -0
- package/dist/content/mdx/preset-runtime.js +36 -0
- package/dist/content/toc.d.ts +20 -0
- package/dist/content/toc.js +15 -0
- package/dist/definitions-AAtMxt2w.d.ts +61 -0
- package/dist/dynamic-link.d.ts +14 -0
- package/dist/dynamic-link.js +31 -0
- package/dist/endpoint-8Kwx_qOv.js +28 -0
- package/dist/framework/index.d.ts +49 -0
- package/dist/framework/index.js +65 -0
- package/dist/framework/next.d.ts +16 -0
- package/dist/framework/next.js +19 -0
- package/dist/framework/react-router.d.ts +16 -0
- package/dist/framework/react-router.js +43 -0
- package/dist/framework/tanstack.d.ts +19 -0
- package/dist/framework/tanstack.js +54 -0
- package/dist/framework/waku.d.ts +16 -0
- package/dist/framework/waku.js +48 -0
- package/dist/highlight/client.d.ts +12 -0
- package/dist/highlight/client.js +17 -0
- package/dist/highlight/config.d.ts +2 -0
- package/dist/highlight/config.js +27 -0
- package/dist/highlight/core/client.d.ts +31 -0
- package/dist/highlight/core/client.js +65 -0
- package/dist/highlight/core/index.d.ts +2 -0
- package/dist/highlight/core/index.js +62 -0
- package/dist/highlight/index.d.ts +34 -0
- package/dist/highlight/index.js +56 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +6 -0
- package/dist/i18n/middleware.d.ts +41 -0
- package/dist/i18n/middleware.js +55 -0
- package/dist/icon-DphlWQaF.js +17 -0
- package/dist/index-BDymJpj4.d.ts +45 -0
- package/dist/index-C5QIKZDy.d.ts +418 -0
- package/dist/index-Ch9QIdT6.d.ts +37 -0
- package/dist/index-Cq7hKKw4.d.ts +18 -0
- package/dist/index-CsYVANvj.d.ts +40 -0
- package/dist/index-DSpA1JO4.d.ts +27 -0
- package/dist/link.d.ts +19 -0
- package/dist/link.js +25 -0
- package/dist/mdast-utils-9tJwoVTq.js +39 -0
- package/dist/mdx-plugins/codeblock-utils.d.ts +2 -0
- package/dist/mdx-plugins/codeblock-utils.js +69 -0
- package/dist/mdx-plugins/index.d.ts +17 -0
- package/dist/mdx-plugins/index.js +18 -0
- package/dist/mdx-plugins/rehype-code.core.d.ts +2 -0
- package/dist/mdx-plugins/rehype-code.core.js +2 -0
- package/dist/mdx-plugins/rehype-code.d.ts +3 -0
- package/dist/mdx-plugins/rehype-code.js +23 -0
- package/dist/mdx-plugins/rehype-toc.d.ts +2 -0
- package/dist/mdx-plugins/rehype-toc.js +118 -0
- package/dist/mdx-plugins/remark-admonition.d.ts +2 -0
- package/dist/mdx-plugins/remark-admonition.js +71 -0
- package/dist/mdx-plugins/remark-code-tab.d.ts +2 -0
- package/dist/mdx-plugins/remark-code-tab.js +181 -0
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +2 -0
- package/dist/mdx-plugins/remark-directive-admonition.js +57 -0
- package/dist/mdx-plugins/remark-feedback-block.d.ts +2 -0
- package/dist/mdx-plugins/remark-feedback-block.js +54 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -0
- package/dist/mdx-plugins/remark-gfm.js +2 -0
- package/dist/mdx-plugins/remark-heading.d.ts +2 -0
- package/dist/mdx-plugins/remark-heading.js +46 -0
- package/dist/mdx-plugins/remark-image.d.ts +2 -0
- package/dist/mdx-plugins/remark-image.js +189 -0
- package/dist/mdx-plugins/remark-llms.d.ts +50 -0
- package/dist/mdx-plugins/remark-llms.js +30 -0
- package/dist/mdx-plugins/remark-mdx-files.d.ts +2 -0
- package/dist/mdx-plugins/remark-mdx-files.js +184 -0
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +2 -0
- package/dist/mdx-plugins/remark-mdx-mermaid.js +28 -0
- package/dist/mdx-plugins/remark-npm.d.ts +2 -0
- package/dist/mdx-plugins/remark-npm.js +65 -0
- package/dist/mdx-plugins/remark-steps.d.ts +2 -0
- package/dist/mdx-plugins/remark-steps.js +74 -0
- package/dist/mdx-plugins/remark-structure.d.ts +2 -0
- package/dist/mdx-plugins/remark-structure.js +118 -0
- package/dist/mdx-plugins/stringifier.d.ts +2 -0
- package/dist/mdx-plugins/stringifier.js +86 -0
- package/dist/negotiation/index.d.ts +20 -0
- package/dist/negotiation/index.js +38 -0
- package/dist/normalize-url-J3kqKlu4.js +14 -0
- package/dist/page-tree/index.d.ts +3 -0
- package/dist/page-tree/index.js +2 -0
- package/dist/path-CYZclEPY.js +57 -0
- package/dist/rehype-code-B-bxz1EN.d.ts +17 -0
- package/dist/rehype-code.core-AzcK6-sL.js +245 -0
- package/dist/rehype-code.core-Ck9MowQQ.d.ts +52 -0
- package/dist/rehype-toc-BLsqqf_o.d.ts +45 -0
- package/dist/remark-admonition-DNKm8XsG.d.ts +21 -0
- package/dist/remark-code-tab-G7U6TydN.d.ts +31 -0
- package/dist/remark-directive-admonition-gkHghBYa.d.ts +35 -0
- package/dist/remark-feedback-block-90yTnyTC.d.ts +51 -0
- package/dist/remark-gfm-C2GLsTxH.d.ts +2 -0
- package/dist/remark-heading-DR_pmcPV.d.ts +45 -0
- package/dist/remark-image-CP5w6VTd.d.ts +64 -0
- package/dist/remark-mdx-files-C7gYD1Bn.d.ts +55 -0
- package/dist/remark-mdx-mermaid-CeZ2Fepw.d.ts +16 -0
- package/dist/remark-npm-BMre-WzD.d.ts +35 -0
- package/dist/remark-steps-9ooYFxUA.d.ts +27 -0
- package/dist/remark-structure-CILz6H_T.d.ts +94 -0
- package/dist/remove-markdown-C5S415Dz.js +38 -0
- package/dist/remove-undefined-Bfj4SlGF.js +17 -0
- package/dist/search/algolia.d.ts +2 -0
- package/dist/search/algolia.js +75 -0
- package/dist/search/client/algolia.d.ts +2 -0
- package/dist/search/client/algolia.js +57 -0
- package/dist/search/client/fetch.d.ts +2 -0
- package/dist/search/client/fetch.js +27 -0
- package/dist/search/client/flexsearch-static.d.ts +2 -0
- package/dist/search/client/flexsearch-static.js +41 -0
- package/dist/search/client/mixedbread.d.ts +2 -0
- package/dist/search/client/mixedbread.js +65 -0
- package/dist/search/client/orama-cloud-legacy.d.ts +2 -0
- package/dist/search/client/orama-cloud-legacy.js +84 -0
- package/dist/search/client/orama-cloud.d.ts +2 -0
- package/dist/search/client/orama-cloud.js +86 -0
- package/dist/search/client/orama-static.d.ts +2 -0
- package/dist/search/client/orama-static.js +53 -0
- package/dist/search/client.d.ts +2 -0
- package/dist/search/client.js +102 -0
- package/dist/search/flexsearch.d.ts +52 -0
- package/dist/search/flexsearch.js +104 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +68 -0
- package/dist/search/mixedbread.d.ts +50 -0
- package/dist/search/mixedbread.js +77 -0
- package/dist/search/orama-cloud-legacy.d.ts +75 -0
- package/dist/search/orama-cloud-legacy.js +48 -0
- package/dist/search/orama-cloud.d.ts +75 -0
- package/dist/search/orama-cloud.js +50 -0
- package/dist/search/server.d.ts +2 -0
- package/dist/search/server.js +232 -0
- package/dist/server-BVKBFI75.d.ts +138 -0
- package/dist/source/client/index.d.ts +2 -0
- package/dist/source/client/index.js +37 -0
- package/dist/source/index.d.ts +2 -0
- package/dist/source/index.js +786 -0
- package/dist/source/plugins/lucide-icons.d.ts +12 -0
- package/dist/source/plugins/lucide-icons.js +21 -0
- package/dist/source/plugins/slugs.d.ts +2 -0
- package/dist/source/plugins/slugs.js +62 -0
- package/dist/source/plugins/status-badges.d.ts +51 -0
- package/dist/source/plugins/status-badges.js +52 -0
- package/dist/source/schema.d.ts +27 -0
- package/dist/source/schema.js +26 -0
- package/dist/stringifier-CugaOXsb.d.ts +64 -0
- package/dist/toc-DmllTzmG.d.ts +55 -0
- package/dist/toc.d.ts +2 -0
- package/dist/toc.js +133 -0
- package/dist/types-3ccArm6T.d.ts +6 -0
- package/dist/util-CT8y1EgJ.js +8 -0
- package/dist/util-D_kBfbUQ.d.ts +7 -0
- package/dist/utils/use-media-query.d.ts +4 -0
- package/dist/utils/use-media-query.js +20 -0
- package/dist/utils/use-on-change.d.ts +9 -0
- package/dist/utils/use-on-change.js +20 -0
- package/dist/utils-6GexS7iX.js +134 -0
- package/dist/utils-ktUGajEb.js +59 -0
- package/package.json +272 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Fuma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @depup/fumadocs-core
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [fumadocs-core](https://www.npmjs.com/package/fumadocs-core)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/fumadocs-core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [fumadocs-core](https://www.npmjs.com/package/fumadocs-core) @ 16.6.17 |
|
|
17
|
+
| Processed | 2026-03-18 |
|
|
18
|
+
| Smoke test | failed |
|
|
19
|
+
| Deps updated | 1 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| @formatjs/intl-localematcher | ^0.8.1 | ^0.8.2 |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/fumadocs-core
|
|
30
|
+
|
|
31
|
+
License inherited from the original package.
|
package/changes.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-Bfj4SlGF.js";
|
|
3
|
+
import { getByID, search } from "@orama/orama";
|
|
4
|
+
//#region src/search/orama/search/simple.ts
|
|
5
|
+
async function searchSimple(db, query, params = {}) {
|
|
6
|
+
const highlighter = createContentHighlighter(query);
|
|
7
|
+
return (await search(db, {
|
|
8
|
+
term: query,
|
|
9
|
+
tolerance: 1,
|
|
10
|
+
...params,
|
|
11
|
+
boost: {
|
|
12
|
+
title: 2,
|
|
13
|
+
..."boost" in params ? params.boost : void 0
|
|
14
|
+
}
|
|
15
|
+
})).hits.map((hit) => ({
|
|
16
|
+
type: "page",
|
|
17
|
+
content: highlighter.highlightMarkdown(hit.document.title),
|
|
18
|
+
breadcrumbs: hit.document.breadcrumbs,
|
|
19
|
+
id: hit.document.url,
|
|
20
|
+
url: hit.document.url
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/search/orama/search/advanced.ts
|
|
25
|
+
async function searchAdvanced(db, query, tag = [], { mode = "fulltext", ...override } = {}) {
|
|
26
|
+
if (typeof tag === "string") tag = [tag];
|
|
27
|
+
const params = {
|
|
28
|
+
limit: 60,
|
|
29
|
+
mode,
|
|
30
|
+
...override,
|
|
31
|
+
where: removeUndefined({
|
|
32
|
+
tags: tag.length > 0 ? { containsAll: tag } : void 0,
|
|
33
|
+
...override.where
|
|
34
|
+
}),
|
|
35
|
+
groupBy: {
|
|
36
|
+
properties: ["page_id"],
|
|
37
|
+
maxResult: 8,
|
|
38
|
+
...override.groupBy
|
|
39
|
+
},
|
|
40
|
+
properties: mode === "fulltext" ? ["content"] : ["content", "embeddings"]
|
|
41
|
+
};
|
|
42
|
+
if (query.length > 0) params.term = query;
|
|
43
|
+
const highlighter = createContentHighlighter(query);
|
|
44
|
+
const result = await search(db, params);
|
|
45
|
+
const list = [];
|
|
46
|
+
for (const item of result.groups ?? []) {
|
|
47
|
+
const pageId = item.values[0];
|
|
48
|
+
const page = getByID(db, pageId);
|
|
49
|
+
if (!page) continue;
|
|
50
|
+
list.push({
|
|
51
|
+
id: pageId,
|
|
52
|
+
type: "page",
|
|
53
|
+
content: highlighter.highlightMarkdown(page.content),
|
|
54
|
+
breadcrumbs: page.breadcrumbs,
|
|
55
|
+
url: page.url
|
|
56
|
+
});
|
|
57
|
+
for (const hit of item.result) {
|
|
58
|
+
if (hit.document.type === "page") continue;
|
|
59
|
+
list.push({
|
|
60
|
+
id: hit.document.id.toString(),
|
|
61
|
+
content: highlighter.highlightMarkdown(hit.document.content),
|
|
62
|
+
breadcrumbs: hit.document.breadcrumbs,
|
|
63
|
+
type: hit.document.type,
|
|
64
|
+
url: hit.document.url
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (typeof params.limit === "number" && list.length > params.limit) return list.slice(0, params.limit);
|
|
69
|
+
return list;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { searchSimple as n, searchAdvanced as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { i as StructuredData } from "./remark-structure-CILz6H_T.js";
|
|
2
|
+
import { Algoliasearch } from "algoliasearch";
|
|
3
|
+
|
|
4
|
+
//#region src/search/algolia.d.ts
|
|
5
|
+
interface DocumentRecord {
|
|
6
|
+
/**
|
|
7
|
+
* The ID of document, must be unique
|
|
8
|
+
*/
|
|
9
|
+
_id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
breadcrumbs?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* URL to the page
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
17
|
+
structured: StructuredData;
|
|
18
|
+
/**
|
|
19
|
+
* Tag to filter results
|
|
20
|
+
*/
|
|
21
|
+
tag?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Data to be added to each section index
|
|
24
|
+
*/
|
|
25
|
+
extra_data?: object;
|
|
26
|
+
}
|
|
27
|
+
interface SyncOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Index Name for documents.
|
|
30
|
+
*/
|
|
31
|
+
indexName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Search indexes
|
|
34
|
+
*/
|
|
35
|
+
documents: DocumentRecord[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Update index settings and replace all objects
|
|
39
|
+
*
|
|
40
|
+
* @param client - Algolia Admin Client
|
|
41
|
+
* @param options - Index Options
|
|
42
|
+
*/
|
|
43
|
+
declare function sync(client: Algoliasearch, options: SyncOptions): Promise<void>;
|
|
44
|
+
declare function setIndexSettings(client: Algoliasearch, indexName: string): Promise<void>;
|
|
45
|
+
declare function updateDocuments(client: Algoliasearch, indexName: string, documents: DocumentRecord[]): Promise<void>;
|
|
46
|
+
interface BaseIndex {
|
|
47
|
+
objectID: string;
|
|
48
|
+
title: string;
|
|
49
|
+
url: string;
|
|
50
|
+
tag?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The id of page, used for distinct
|
|
53
|
+
*/
|
|
54
|
+
page_id: string;
|
|
55
|
+
/**
|
|
56
|
+
* Heading content
|
|
57
|
+
*/
|
|
58
|
+
section?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Heading (anchor) id
|
|
61
|
+
*/
|
|
62
|
+
section_id?: string;
|
|
63
|
+
breadcrumbs?: string[];
|
|
64
|
+
content: string;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { sync as a, setIndexSettings as i, DocumentRecord as n, updateDocuments as o, SyncOptions as r, BaseIndex as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { i as Root, r as Node } from "./definitions-AAtMxt2w.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/breadcrumb.d.ts
|
|
5
|
+
interface BreadcrumbItem {
|
|
6
|
+
name: ReactNode;
|
|
7
|
+
url?: string;
|
|
8
|
+
}
|
|
9
|
+
interface BreadcrumbOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Include the root folders in the breadcrumb items array.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue false
|
|
14
|
+
*/
|
|
15
|
+
includeRoot?: boolean | {
|
|
16
|
+
/**
|
|
17
|
+
* Specify the url of root
|
|
18
|
+
*/
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Include the page itself in the breadcrumb items array
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue false
|
|
25
|
+
*/
|
|
26
|
+
includePage?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Count separator as an item
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue false
|
|
31
|
+
*/
|
|
32
|
+
includeSeparator?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare function useBreadcrumb(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
|
|
35
|
+
declare function getBreadcrumbItems(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
|
|
36
|
+
declare function getBreadcrumbItemsFromPath(tree: Root, path: Node[], options: BreadcrumbOptions): BreadcrumbItem[];
|
|
37
|
+
/**
|
|
38
|
+
* Search the path of a node in the tree by a specified url
|
|
39
|
+
*
|
|
40
|
+
* - When the page doesn't exist, return null
|
|
41
|
+
*
|
|
42
|
+
* @returns The path to the target node from root
|
|
43
|
+
* @internal Don't use this on your own
|
|
44
|
+
*/
|
|
45
|
+
declare function searchPath(nodes: Node[], url: string): Node[] | null;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { BreadcrumbItem, BreadcrumbOptions, getBreadcrumbItems, getBreadcrumbItemsFromPath, searchPath, useBreadcrumb };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { t as normalizeUrl } from "./normalize-url-J3kqKlu4.js";
|
|
2
|
+
import { r as findPath } from "./utils-6GexS7iX.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
//#region src/breadcrumb.tsx
|
|
5
|
+
function useBreadcrumb(url, tree, options) {
|
|
6
|
+
return useMemo(() => getBreadcrumbItems(url, tree, options), [
|
|
7
|
+
tree,
|
|
8
|
+
url,
|
|
9
|
+
options
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
function getBreadcrumbItems(url, tree, options = {}) {
|
|
13
|
+
return getBreadcrumbItemsFromPath(tree, searchPath(tree.children, url) ?? [], options);
|
|
14
|
+
}
|
|
15
|
+
function getBreadcrumbItemsFromPath(tree, path, options) {
|
|
16
|
+
const { includePage = false, includeSeparator = false, includeRoot = false } = options;
|
|
17
|
+
let items = [];
|
|
18
|
+
for (let i = 0; i < path.length; i++) {
|
|
19
|
+
const item = path[i];
|
|
20
|
+
switch (item.type) {
|
|
21
|
+
case "page":
|
|
22
|
+
if (includePage) items.push({
|
|
23
|
+
name: item.name,
|
|
24
|
+
url: item.url
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
case "folder":
|
|
28
|
+
if (item.root) {
|
|
29
|
+
items = [];
|
|
30
|
+
if (includeRoot) items.push({
|
|
31
|
+
name: tree.name,
|
|
32
|
+
url: typeof includeRoot === "object" ? includeRoot.url : item.index?.url
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (i === path.length - 1 || item.index !== path[i + 1]) items.push({
|
|
37
|
+
name: item.name,
|
|
38
|
+
url: item.index?.url
|
|
39
|
+
});
|
|
40
|
+
break;
|
|
41
|
+
case "separator":
|
|
42
|
+
if (item.name && includeSeparator) items.push({ name: item.name });
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return items;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Search the path of a node in the tree by a specified url
|
|
50
|
+
*
|
|
51
|
+
* - When the page doesn't exist, return null
|
|
52
|
+
*
|
|
53
|
+
* @returns The path to the target node from root
|
|
54
|
+
* @internal Don't use this on your own
|
|
55
|
+
*/
|
|
56
|
+
function searchPath(nodes, url) {
|
|
57
|
+
const normalizedUrl = normalizeUrl(url);
|
|
58
|
+
return findPath(nodes, (node) => node.type === "page" && node.url === normalizedUrl);
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { getBreadcrumbItems, getBreadcrumbItemsFromPath, searchPath, useBreadcrumb };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { r as findPath } from "./utils-6GexS7iX.js";
|
|
2
|
+
import { r as extname, t as basename } from "./path-CYZclEPY.js";
|
|
3
|
+
//#region src/search/server/build-index.ts
|
|
4
|
+
async function buildIndexDefault(page) {
|
|
5
|
+
let structuredData;
|
|
6
|
+
if ("structuredData" in page.data) structuredData = typeof page.data.structuredData === "function" ? await page.data.structuredData() : page.data.structuredData;
|
|
7
|
+
else if ("load" in page.data && typeof page.data.load === "function") structuredData = (await page.data.load()).structuredData;
|
|
8
|
+
if (!structuredData) throw new Error("Cannot find structured data from page, please define the page to index function.");
|
|
9
|
+
return {
|
|
10
|
+
title: page.data.title ?? basename(page.path, extname(page.path)),
|
|
11
|
+
description: page.data.description,
|
|
12
|
+
url: page.url,
|
|
13
|
+
id: page.url,
|
|
14
|
+
structuredData
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function isBreadcrumbItem(item) {
|
|
18
|
+
return typeof item === "string" && item.length > 0;
|
|
19
|
+
}
|
|
20
|
+
function buildBreadcrumbs(source, page) {
|
|
21
|
+
const pageTree = source.getPageTree(page.locale);
|
|
22
|
+
const path = findPath(pageTree.children, (node) => node.type === "page" && node.url === page.url);
|
|
23
|
+
if (path) {
|
|
24
|
+
const breadcrumbs = [];
|
|
25
|
+
path.pop();
|
|
26
|
+
if (isBreadcrumbItem(pageTree.name)) breadcrumbs.push(pageTree.name);
|
|
27
|
+
for (const segment of path) {
|
|
28
|
+
if (!isBreadcrumbItem(segment.name)) continue;
|
|
29
|
+
breadcrumbs.push(segment.name);
|
|
30
|
+
}
|
|
31
|
+
return breadcrumbs;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/search/server/build-doc.ts
|
|
36
|
+
function buildDocuments(indexes) {
|
|
37
|
+
const docs = [];
|
|
38
|
+
for (const page of indexes) {
|
|
39
|
+
const pageTag = page.tag ?? [];
|
|
40
|
+
const tags = Array.isArray(pageTag) ? pageTag : [pageTag];
|
|
41
|
+
const data = page.structuredData;
|
|
42
|
+
let id = 0;
|
|
43
|
+
docs.push({
|
|
44
|
+
id: page.id,
|
|
45
|
+
page_id: page.id,
|
|
46
|
+
type: "page",
|
|
47
|
+
content: page.title,
|
|
48
|
+
breadcrumbs: page.breadcrumbs,
|
|
49
|
+
tags,
|
|
50
|
+
url: page.url
|
|
51
|
+
});
|
|
52
|
+
const nextId = () => `${page.id}-${id++}`;
|
|
53
|
+
if (page.description) docs.push({
|
|
54
|
+
id: nextId(),
|
|
55
|
+
page_id: page.id,
|
|
56
|
+
tags,
|
|
57
|
+
type: "text",
|
|
58
|
+
url: page.url,
|
|
59
|
+
content: page.description
|
|
60
|
+
});
|
|
61
|
+
for (const heading of data.headings) docs.push({
|
|
62
|
+
id: nextId(),
|
|
63
|
+
page_id: page.id,
|
|
64
|
+
type: "heading",
|
|
65
|
+
tags,
|
|
66
|
+
url: `${page.url}#${heading.id}`,
|
|
67
|
+
content: heading.content
|
|
68
|
+
});
|
|
69
|
+
for (const content of data.contents) docs.push({
|
|
70
|
+
id: nextId(),
|
|
71
|
+
page_id: page.id,
|
|
72
|
+
tags,
|
|
73
|
+
type: "text",
|
|
74
|
+
url: content.heading ? `${page.url}#${content.heading}` : page.url,
|
|
75
|
+
content: content.content
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return docs;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { buildBreadcrumbs as n, buildIndexDefault as r, buildDocuments as t };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __exportAll = (all, no_symbols) => {
|
|
10
|
+
let target = {};
|
|
11
|
+
for (var name in all) __defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
20
|
+
key = keys[i];
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
22
|
+
get: ((k) => from[k]).bind(null, key),
|
|
23
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: true
|
|
31
|
+
}) : target, mod));
|
|
32
|
+
//#endregion
|
|
33
|
+
export { __exportAll as n, __toESM as r, __commonJSMin as t };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { t as Awaitable } from "./types-3ccArm6T.js";
|
|
2
|
+
import { t as BaseIndex } from "./algolia-BcNfAtYC.js";
|
|
3
|
+
import { r as SortedResult } from "./index-Ch9QIdT6.js";
|
|
4
|
+
import { DependencyList } from "react";
|
|
5
|
+
import { AnyOrama } from "@orama/orama";
|
|
6
|
+
import { LiteClient, SearchResponse } from "algoliasearch/lite";
|
|
7
|
+
import { OramaCloud, OramaCloudSearchParams } from "@orama/core";
|
|
8
|
+
import { ClientSearchParams, OramaClient } from "@oramacloud/client";
|
|
9
|
+
import Mixedbread from "@mixedbread/sdk";
|
|
10
|
+
|
|
11
|
+
//#region src/search/client/fetch.d.ts
|
|
12
|
+
interface FetchOptions {
|
|
13
|
+
/**
|
|
14
|
+
* API route for search endpoint, support absolute URLs.
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue '/api/search'
|
|
17
|
+
*/
|
|
18
|
+
api?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Filter results with specific tag(s).
|
|
21
|
+
*/
|
|
22
|
+
tag?: string | string[];
|
|
23
|
+
/**
|
|
24
|
+
* Filter by locale
|
|
25
|
+
*/
|
|
26
|
+
locale?: string;
|
|
27
|
+
cache?: Map<string, SortedResult[]>;
|
|
28
|
+
}
|
|
29
|
+
declare function fetchClient({
|
|
30
|
+
api,
|
|
31
|
+
locale,
|
|
32
|
+
tag,
|
|
33
|
+
cache
|
|
34
|
+
}?: FetchOptions): SearchClient;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/search/client/orama-static.d.ts
|
|
37
|
+
interface StaticOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Where to download exported search indexes (URL)
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue '/api/search'
|
|
42
|
+
*/
|
|
43
|
+
from?: string;
|
|
44
|
+
initOrama?: (locale?: string) => AnyOrama | Promise<AnyOrama>;
|
|
45
|
+
/**
|
|
46
|
+
* Filter results with specific tag(s).
|
|
47
|
+
*/
|
|
48
|
+
tag?: string | string[];
|
|
49
|
+
/**
|
|
50
|
+
* Filter by locale (unsupported at the moment)
|
|
51
|
+
*/
|
|
52
|
+
locale?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function oramaStaticClient(options: StaticOptions): SearchClient;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/search/client/algolia.d.ts
|
|
57
|
+
interface AlgoliaOptions {
|
|
58
|
+
indexName: string;
|
|
59
|
+
client: LiteClient;
|
|
60
|
+
/**
|
|
61
|
+
* Filter results with specific tag.
|
|
62
|
+
*/
|
|
63
|
+
tag?: string;
|
|
64
|
+
locale?: string;
|
|
65
|
+
onSearch?: (query: string, tag?: string, locale?: string) => Promise<{
|
|
66
|
+
results: SearchResponse<BaseIndex>[];
|
|
67
|
+
}>;
|
|
68
|
+
}
|
|
69
|
+
declare function algoliaClient(options: AlgoliaOptions): SearchClient;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/search/client/orama-cloud.d.ts
|
|
72
|
+
interface OramaCloudOptions {
|
|
73
|
+
client: OramaCloud;
|
|
74
|
+
/**
|
|
75
|
+
* The type of your index.
|
|
76
|
+
*
|
|
77
|
+
* You can set it to `crawler` if you use crawler instead of the JSON index with schema provided by Fumadocs
|
|
78
|
+
*/
|
|
79
|
+
index?: 'default' | 'crawler';
|
|
80
|
+
/**
|
|
81
|
+
* Note: not included in dependency list.
|
|
82
|
+
*/
|
|
83
|
+
params?: Partial<OramaCloudSearchParams>;
|
|
84
|
+
/**
|
|
85
|
+
* Filter results with specific tag.
|
|
86
|
+
*/
|
|
87
|
+
tag?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Filter by locale (unsupported at the moment)
|
|
90
|
+
*/
|
|
91
|
+
locale?: string;
|
|
92
|
+
}
|
|
93
|
+
declare function oramaCloudClient(options: OramaCloudOptions): SearchClient;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/search/client/orama-cloud-legacy.d.ts
|
|
96
|
+
interface OramaCloudLegacyOptions {
|
|
97
|
+
client: OramaClient;
|
|
98
|
+
/**
|
|
99
|
+
* The type of your index.
|
|
100
|
+
*
|
|
101
|
+
* You can set it to `crawler` if you use crawler instead of the JSON index with schema provided by Fumadocs.
|
|
102
|
+
*/
|
|
103
|
+
index?: 'default' | 'crawler';
|
|
104
|
+
/**
|
|
105
|
+
* Note: not included into dependency list.
|
|
106
|
+
*/
|
|
107
|
+
params?: ClientSearchParams;
|
|
108
|
+
/**
|
|
109
|
+
* Filter results with specific tag.
|
|
110
|
+
*/
|
|
111
|
+
tag?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Filter by locale (unsupported at the moment)
|
|
114
|
+
*/
|
|
115
|
+
locale?: string;
|
|
116
|
+
}
|
|
117
|
+
declare function oramaCloudLegacyClient(options: OramaCloudLegacyOptions): SearchClient;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/search/client/mixedbread.d.ts
|
|
120
|
+
interface MixedbreadOptions {
|
|
121
|
+
/**
|
|
122
|
+
* The identifier of the store to search in
|
|
123
|
+
*/
|
|
124
|
+
storeIdentifier: string;
|
|
125
|
+
/**
|
|
126
|
+
* The Mixedbread SDK client instance
|
|
127
|
+
*/
|
|
128
|
+
client: Mixedbread;
|
|
129
|
+
/**
|
|
130
|
+
* Filter results with specific tag.
|
|
131
|
+
*/
|
|
132
|
+
tag?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Filter by locale (unsupported at the moment)
|
|
135
|
+
*/
|
|
136
|
+
locale?: string;
|
|
137
|
+
}
|
|
138
|
+
interface SearchMetadata {
|
|
139
|
+
title?: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
url?: string;
|
|
142
|
+
tag?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
|
|
146
|
+
* This client-side approach exposes your API key in the browser.
|
|
147
|
+
* The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
|
|
148
|
+
*/
|
|
149
|
+
declare function mixedbreadClient(options: MixedbreadOptions): SearchClient;
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/search/client/flexsearch-static.d.ts
|
|
152
|
+
interface FlexsearchStaticOptions {
|
|
153
|
+
/**
|
|
154
|
+
* @defaultValue `/api/search`
|
|
155
|
+
*/
|
|
156
|
+
from?: string;
|
|
157
|
+
locale?: string;
|
|
158
|
+
tag?: string | string[];
|
|
159
|
+
}
|
|
160
|
+
declare function flexsearchStaticClient(options?: FlexsearchStaticOptions): SearchClient;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/search/client.d.ts
|
|
163
|
+
interface UseDocsSearch {
|
|
164
|
+
search: string;
|
|
165
|
+
setSearch: (v: string) => void;
|
|
166
|
+
query: {
|
|
167
|
+
isLoading: boolean;
|
|
168
|
+
data?: SortedResult[] | 'empty';
|
|
169
|
+
error?: Error;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
type ClientPreset = ({
|
|
173
|
+
type: 'fetch';
|
|
174
|
+
} & FetchOptions) | ({
|
|
175
|
+
type: 'static';
|
|
176
|
+
} & StaticOptions) | ({
|
|
177
|
+
type: 'algolia';
|
|
178
|
+
} & AlgoliaOptions) | ({
|
|
179
|
+
type: 'orama-cloud';
|
|
180
|
+
} & OramaCloudOptions) | ({
|
|
181
|
+
type: 'orama-cloud-legacy';
|
|
182
|
+
} & OramaCloudLegacyOptions) | ({
|
|
183
|
+
type: 'flexsearch-static';
|
|
184
|
+
} & FlexsearchStaticOptions) | ({
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated Use `createMixedbreadSearchAPI` from `fumadocs-core/search/mixedbread` instead.
|
|
187
|
+
* This client-side approach exposes your API key in the browser.
|
|
188
|
+
* The server-side approach keeps the key secure and uses `type: 'fetch'` on the client.
|
|
189
|
+
*/
|
|
190
|
+
type: 'mixedbread';
|
|
191
|
+
} & MixedbreadOptions) | {
|
|
192
|
+
client: SearchClient;
|
|
193
|
+
};
|
|
194
|
+
interface SearchClient {
|
|
195
|
+
search: (query: string) => Awaitable<SortedResult[]>;
|
|
196
|
+
deps?: DependencyList;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Provide a hook to query different official search clients.
|
|
200
|
+
*
|
|
201
|
+
* Note: it will re-query when its parameters changed, make sure to define `deps` array if you encounter rendering issues.
|
|
202
|
+
*/
|
|
203
|
+
declare function useDocsSearch(clientOptions: ClientPreset & {
|
|
204
|
+
/**
|
|
205
|
+
* The debounced delay for performing a search (in ms).
|
|
206
|
+
* .
|
|
207
|
+
* @defaultValue 100
|
|
208
|
+
*/
|
|
209
|
+
delayMs?: number;
|
|
210
|
+
/**
|
|
211
|
+
* still perform search even if query is empty.
|
|
212
|
+
*
|
|
213
|
+
* @defaultValue false
|
|
214
|
+
*/
|
|
215
|
+
allowEmpty?: boolean;
|
|
216
|
+
}, deps?: DependencyList): UseDocsSearch;
|
|
217
|
+
//#endregion
|
|
218
|
+
export { FetchOptions as _, flexsearchStaticClient as a, mixedbreadClient as c, OramaCloudOptions as d, oramaCloudClient as f, oramaStaticClient as g, StaticOptions as h, FlexsearchStaticOptions as i, OramaCloudLegacyOptions as l, algoliaClient as m, SearchClient as n, MixedbreadOptions as o, AlgoliaOptions as p, useDocsSearch as r, SearchMetadata as s, ClientPreset as t, oramaCloudLegacyClient as u, fetchClient as v };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MdxJsxAttribute, MdxJsxFlowElement } from "mdast-util-mdx";
|
|
2
|
+
import { BlockContent, Text } from "mdast";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/codeblock-utils.d.ts
|
|
5
|
+
interface CodeBlockTabsOptions {
|
|
6
|
+
attributes?: MdxJsxAttribute[];
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
persist?: {
|
|
9
|
+
id: string;
|
|
10
|
+
} | false;
|
|
11
|
+
triggers: {
|
|
12
|
+
value: string;
|
|
13
|
+
children: (BlockContent | Text)[];
|
|
14
|
+
}[];
|
|
15
|
+
tabs: {
|
|
16
|
+
value: string;
|
|
17
|
+
children: BlockContent[];
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
declare function generateCodeBlockTabs({
|
|
21
|
+
persist,
|
|
22
|
+
defaultValue,
|
|
23
|
+
triggers,
|
|
24
|
+
tabs,
|
|
25
|
+
...options
|
|
26
|
+
}: CodeBlockTabsOptions): MdxJsxFlowElement;
|
|
27
|
+
interface CodeBlockAttributes<Name extends string = string> {
|
|
28
|
+
attributes: Partial<Record<Name, string | null>>;
|
|
29
|
+
rest: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse Fumadocs-style code block attributes from meta string, like `title="hello world"`
|
|
33
|
+
*/
|
|
34
|
+
declare function parseCodeBlockAttributes<Name extends string = string>(meta: string, allowedNames?: Name[]): CodeBlockAttributes<Name>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { parseCodeBlockAttributes as i, CodeBlockTabsOptions as n, generateCodeBlockTabs as r, CodeBlockAttributes as t };
|