fumadocs-core 16.19.5 → 16.19.6
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/{build-doc-CHLmZvHA.js → build-doc-DuN5O6YG.js} +8 -2
- package/dist/{client--MDSaH5X.d.ts → client-Ch8dfy5P.d.ts} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mdx-plugins/remark-directive-admonition.js +12 -6
- package/dist/{mixedbread-TsMvtWf7.d.ts → mixedbread-B4z7NUWP.d.ts} +1 -1
- package/dist/search/algolia.js +2 -1
- package/dist/search/client/algolia.d.ts +1 -1
- package/dist/search/client/docs-search.d.ts +1 -1
- package/dist/search/client/fetch.d.ts +1 -1
- package/dist/search/client/flexsearch-static.d.ts +1 -1
- package/dist/search/client/meilisearch.d.ts +1 -1
- package/dist/search/client/mixedbread.d.ts +2 -2
- package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/client/orama-cloud.d.ts +1 -1
- package/dist/search/client/orama-static.d.ts +1 -1
- package/dist/search/client.d.ts +1 -1
- package/dist/search/flexsearch.d.ts +1 -1
- package/dist/search/flexsearch.js +1 -1
- package/dist/search/mixedbread.d.ts +1 -1
- package/dist/search/orama-cloud-legacy.js +2 -1
- package/dist/search/orama-cloud.d.ts +14 -4
- package/dist/search/orama-cloud.js +27 -14
- package/dist/search/server.d.ts +1 -1
- package/dist/search/server.js +1 -1
- package/dist/{server-CGBYXzEo.d.ts → server-CYiYlUy_.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// src/search/server/build-doc.ts
|
|
2
|
+
/**
|
|
3
|
+
* The id of a page's n-th record after its own. Page URLs never contain a raw `#`, so it can't be another page's id.
|
|
4
|
+
*/
|
|
5
|
+
function recordId(pageId, n) {
|
|
6
|
+
return `${pageId}#${n}`;
|
|
7
|
+
}
|
|
2
8
|
function buildDocuments(indexes) {
|
|
3
9
|
const docs = [];
|
|
4
10
|
for (const page of indexes) {
|
|
@@ -16,7 +22,7 @@ function buildDocuments(indexes) {
|
|
|
16
22
|
url: page.url,
|
|
17
23
|
locale: page.locale
|
|
18
24
|
});
|
|
19
|
-
const nextId = () =>
|
|
25
|
+
const nextId = () => recordId(page.id, id++);
|
|
20
26
|
if (page.description && !data.contents.some((item) => item.content === page.description)) docs.push({
|
|
21
27
|
id: nextId(),
|
|
22
28
|
page_id: page.id,
|
|
@@ -48,4 +54,4 @@ function buildDocuments(indexes) {
|
|
|
48
54
|
}
|
|
49
55
|
return docs;
|
|
50
56
|
}
|
|
51
|
-
export { buildDocuments as t };
|
|
57
|
+
export { recordId as n, buildDocuments as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as SortedResult } from "./index-BlFx9iJj.js";
|
|
2
2
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
3
3
|
import { t as BaseIndex } from "./algolia-Dge_7SWa.js";
|
|
4
|
-
import "./mixedbread-
|
|
4
|
+
import "./mixedbread-B4z7NUWP.js";
|
|
5
5
|
import { DependencyList } from "react";
|
|
6
6
|
import { AnyZBSearch, SearchParams } from "zbsearch";
|
|
7
7
|
import { Root } from "hast";
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as SearchServer } from "./server-
|
|
1
|
+
import { r as SearchServer } from "./server-CYiYlUy_.js";
|
|
2
2
|
import { D as LoaderOutput, T as LoaderConfig, r as LLMsWithPages } from "./index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { replaceSource } from "./stringifier.js";
|
|
1
2
|
import { d as walk } from "../utils-C7sTEOQI.js";
|
|
2
3
|
// src/mdx-plugins/remark-directive-admonition.ts
|
|
3
4
|
/**
|
|
@@ -14,9 +15,9 @@ function remarkDirectiveAdmonition({ tags: { CalloutContainer = "CalloutContaine
|
|
|
14
15
|
danger: "error",
|
|
15
16
|
success: "success"
|
|
16
17
|
} } = {}) {
|
|
17
|
-
return (tree) => {
|
|
18
|
-
|
|
19
|
-
if (node.type !== "containerDirective" || !(node.name in types)) return;
|
|
18
|
+
return (tree, file) => {
|
|
19
|
+
const visitor = (node, idx, parent) => {
|
|
20
|
+
if (node.type !== "containerDirective" || !(node.name in types) || !parent) return;
|
|
20
21
|
const attributes = [{
|
|
21
22
|
type: "mdxJsxAttribute",
|
|
22
23
|
name: "type",
|
|
@@ -44,13 +45,18 @@ function remarkDirectiveAdmonition({ tags: { CalloutContainer = "CalloutContaine
|
|
|
44
45
|
attributes: [],
|
|
45
46
|
children: descriptionNodes
|
|
46
47
|
});
|
|
47
|
-
|
|
48
|
+
const element = {
|
|
48
49
|
type: "mdxJsxFlowElement",
|
|
49
50
|
attributes,
|
|
50
51
|
name: CalloutContainer,
|
|
51
52
|
children
|
|
52
|
-
}
|
|
53
|
-
|
|
53
|
+
};
|
|
54
|
+
replaceSource(file, node, (s) => s.stringify(node));
|
|
55
|
+
parent.children[idx] = element;
|
|
56
|
+
walk(element, visitor);
|
|
57
|
+
return "skip";
|
|
58
|
+
};
|
|
59
|
+
walk(tree, visitor);
|
|
54
60
|
};
|
|
55
61
|
}
|
|
56
62
|
export { remarkDirectiveAdmonition };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as SortedResult } from "./index-BlFx9iJj.js";
|
|
2
|
-
import { n as SearchAPI } from "./server-
|
|
2
|
+
import { n as SearchAPI } from "./server-CYiYlUy_.js";
|
|
3
3
|
import { t as DocumentRecord } from "./meilisearch-B_1NqhPM.js";
|
|
4
4
|
import Mixedbread from "@mixedbread/sdk";
|
|
5
5
|
import { ScoredTextInputChunk } from "@mixedbread/sdk/resources/stores";
|
package/dist/search/algolia.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as buildDocuments } from "../build-index-8ryBfL45.js";
|
|
2
|
+
import { n as recordId } from "../build-doc-DuN5O6YG.js";
|
|
2
3
|
// src/search/algolia.ts
|
|
3
4
|
/**
|
|
4
5
|
* Build the search indexes of every page in a source.
|
|
@@ -54,7 +55,7 @@ function toIndex(page) {
|
|
|
54
55
|
const scannedHeadings = /* @__PURE__ */ new Set();
|
|
55
56
|
function createIndex(section, sectionId, content, table) {
|
|
56
57
|
return {
|
|
57
|
-
objectID:
|
|
58
|
+
objectID: recordId(page._id, id++),
|
|
58
59
|
breadcrumbs: page.breadcrumbs,
|
|
59
60
|
title: page.title,
|
|
60
61
|
url: page.url,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client
|
|
1
|
+
import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { AlgoliaOptions, algoliaClient, useAlgoliaSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client
|
|
1
|
+
import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { ClientPreset, SearchClient, useDocsSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client
|
|
1
|
+
import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { FetchOptions, fetchClient, useFetchSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client
|
|
1
|
+
import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { FlexsearchStaticOptions, flexsearchStaticClient, useFlexsearchStatic };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client
|
|
1
|
+
import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { MeilisearchOptions, meilisearchClient, useMeilisearch };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client
|
|
2
|
-
import { n as SearchMetadata } from "../../mixedbread-
|
|
1
|
+
import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client-Ch8dfy5P.js";
|
|
2
|
+
import { n as SearchMetadata } from "../../mixedbread-B4z7NUWP.js";
|
|
3
3
|
export { MixedbreadOptions, type SearchMetadata, mixedbreadClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as useOramaCloudLegacySearch, l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client
|
|
1
|
+
import { d as useOramaCloudLegacySearch, l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { OramaCloudLegacyOptions, oramaCloudLegacyClient, useOramaCloudLegacySearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client
|
|
1
|
+
import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { OramaCloudOptions, oramaCloudClient, useOramaCloudSearch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as staticClient, S as oramaStaticClient, w as useStaticSearch, x as StaticOptions } from "../../client
|
|
1
|
+
import { C as staticClient, S as oramaStaticClient, w as useStaticSearch, x as StaticOptions } from "../../client-Ch8dfy5P.js";
|
|
2
2
|
export { StaticOptions, oramaStaticClient, staticClient, useStaticSearch };
|
package/dist/search/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SearchResultRecord, D as useFetchSearch, F as useSearch, M as UseSearchOptions, N as UseSearchReturn, O as SearchResult, P as useHighlightQuery, T as FetchOptions, _ as useOramaCloudSearch, b as useAlgoliaSearch, f as MeilisearchOptions, h as OramaCloudOptions, j as SearchResultTable, k as SearchResultItem, m as useMeilisearch, n as SearchClient, r as useDocsSearch, t as ClientPreset, v as AlgoliaOptions, w as useStaticSearch, x as StaticOptions } from "../client
|
|
1
|
+
import { A as SearchResultRecord, D as useFetchSearch, F as useSearch, M as UseSearchOptions, N as UseSearchReturn, O as SearchResult, P as useHighlightQuery, T as FetchOptions, _ as useOramaCloudSearch, b as useAlgoliaSearch, f as MeilisearchOptions, h as OramaCloudOptions, j as SearchResultTable, k as SearchResultItem, m as useMeilisearch, n as SearchClient, r as useDocsSearch, t as ClientPreset, v as AlgoliaOptions, w as useStaticSearch, x as StaticOptions } from "../client-Ch8dfy5P.js";
|
|
2
2
|
export { type AlgoliaOptions, type ClientPreset, type FetchOptions, type MeilisearchOptions, type OramaCloudOptions, type SearchClient, type SearchResult, type SearchResultItem, type SearchResultRecord, type SearchResultTable, type StaticOptions, type UseSearchOptions, type UseSearchReturn, useSearch as experimental_useSearch, useAlgoliaSearch, useDocsSearch, useFetchSearch, useHighlightQuery, useMeilisearch, useOramaCloudSearch, useStaticSearch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-
|
|
1
|
+
import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-CYiYlUy_.js";
|
|
2
2
|
import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
|
|
3
3
|
import { t as Awaitable } from "../types-Dvkw0Kd0.js";
|
|
4
4
|
import { n as I18nConfig } from "../index-DFrWGSeW.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createEndpoint } from "../endpoint-H7rb4eeq.js";
|
|
2
2
|
import { n as buildIndexDefault, r as createBreadcrumbs } from "../build-index-8ryBfL45.js";
|
|
3
|
-
import { t as buildDocuments } from "../build-doc-
|
|
3
|
+
import { t as buildDocuments } from "../build-doc-DuN5O6YG.js";
|
|
4
4
|
import { n as search, r as toSearchIndex, t as createDocument } from "../utils-BQW8csGG.js";
|
|
5
5
|
import Search from "flexsearch";
|
|
6
6
|
// src/search/flexsearch.ts
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as toDocuments, t as DocumentRecord } from "../meilisearch-B_1NqhPM.js";
|
|
2
|
-
import { a as sync, i as createMixedbreadSearchAPI, n as SearchMetadata, r as SyncOptions, t as MixedbreadSearchOptions } from "../mixedbread-
|
|
2
|
+
import { a as sync, i as createMixedbreadSearchAPI, n as SearchMetadata, r as SyncOptions, t as MixedbreadSearchOptions } from "../mixedbread-B4z7NUWP.js";
|
|
3
3
|
export { type DocumentRecord, MixedbreadSearchOptions, SearchMetadata, SyncOptions, createMixedbreadSearchAPI, sync, toDocuments };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as recordId } from "../build-doc-DuN5O6YG.js";
|
|
1
2
|
// src/search/orama-cloud-legacy.ts
|
|
2
3
|
async function sync(cloudManager, options) {
|
|
3
4
|
const { autoDeploy = true } = options;
|
|
@@ -20,7 +21,7 @@ function toIndex(page) {
|
|
|
20
21
|
const scannedHeadings = /* @__PURE__ */ new Set();
|
|
21
22
|
function createIndex(section, sectionId, content, table) {
|
|
22
23
|
return {
|
|
23
|
-
id:
|
|
24
|
+
id: recordId(page.id, id++),
|
|
24
25
|
title: page.title,
|
|
25
26
|
url: page.url,
|
|
26
27
|
page_id: page.id,
|
|
@@ -2,7 +2,7 @@ import "../index-DuwVLhPl.js";
|
|
|
2
2
|
import { n as StructuredData } from "../remark-structure-CV606E7e.js";
|
|
3
3
|
import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
|
|
4
4
|
import { t as Awaitable } from "../types-Dvkw0Kd0.js";
|
|
5
|
-
import { OramaCloud } from "@orama/core";
|
|
5
|
+
import { OramaCloud, Transaction } from "@orama/core";
|
|
6
6
|
export interface SyncOptions {
|
|
7
7
|
/**
|
|
8
8
|
* Index name to sync
|
|
@@ -10,7 +10,7 @@ export interface SyncOptions {
|
|
|
10
10
|
index: string;
|
|
11
11
|
documents: OramaDocument[];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Commit the transaction, which replaces the live index. When `false`, commit or roll back the transaction that `sync()` returns.
|
|
14
14
|
*
|
|
15
15
|
* @defaultValue true
|
|
16
16
|
*/
|
|
@@ -78,5 +78,15 @@ export declare function toDocuments<C extends LoaderConfig>(source: LoaderOutput
|
|
|
78
78
|
/** Tag to filter results by. */
|
|
79
79
|
tag?: (page: C['page']) => string;
|
|
80
80
|
}): Promise<OramaDocument[]>;
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Replace the documents of an index in a transaction.
|
|
83
|
+
*
|
|
84
|
+
* @returns the transaction, commit it to deploy the documents when `autoDeploy` is `false`
|
|
85
|
+
*/
|
|
86
|
+
export declare function sync(orama: OramaCloud, options: SyncOptions): Promise<Transaction>;
|
|
87
|
+
/**
|
|
88
|
+
* Like `sync()`, for the index of each locale.
|
|
89
|
+
*
|
|
90
|
+
* @returns the transaction of each locale
|
|
91
|
+
*/
|
|
92
|
+
export declare function syncI18n(orama: OramaCloud, { indexes, documents, ...options }: I18nSyncOptions): Promise<Record<string, Transaction>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as buildDocuments } from "../build-index-8ryBfL45.js";
|
|
2
|
+
import { n as recordId } from "../build-doc-DuN5O6YG.js";
|
|
2
3
|
// src/search/orama-cloud.ts
|
|
3
4
|
/**
|
|
4
5
|
* Build the search indexes of every page in a source.
|
|
@@ -13,22 +14,34 @@ function toDocuments(source, options = {}) {
|
|
|
13
14
|
tag: options.tag?.(page)
|
|
14
15
|
}));
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Replace the documents of an index in a transaction.
|
|
19
|
+
*
|
|
20
|
+
* @returns the transaction, commit it to deploy the documents when `autoDeploy` is `false`
|
|
21
|
+
*/
|
|
16
22
|
async function sync(orama, options) {
|
|
17
23
|
const { autoDeploy = true } = options;
|
|
18
|
-
const
|
|
19
|
-
await
|
|
20
|
-
await
|
|
21
|
-
if (autoDeploy) await
|
|
24
|
+
const { transaction } = orama.index.set(options.index);
|
|
25
|
+
await transaction.open();
|
|
26
|
+
await transaction.insertDocuments(options.documents.flatMap(toIndex));
|
|
27
|
+
if (autoDeploy) await transaction.commit();
|
|
28
|
+
return transaction;
|
|
22
29
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Like `sync()`, for the index of each locale.
|
|
32
|
+
*
|
|
33
|
+
* @returns the transaction of each locale
|
|
34
|
+
*/
|
|
35
|
+
async function syncI18n(orama, { indexes, documents, ...options }) {
|
|
36
|
+
const transactions = {};
|
|
37
|
+
await Promise.all(documents.map(async ({ locale, items }) => {
|
|
38
|
+
transactions[locale] = await sync(orama, {
|
|
39
|
+
...options,
|
|
40
|
+
index: indexes[locale],
|
|
41
|
+
documents: items
|
|
42
|
+
});
|
|
43
|
+
}));
|
|
44
|
+
return transactions;
|
|
32
45
|
}
|
|
33
46
|
function toIndex(page) {
|
|
34
47
|
let id = 0;
|
|
@@ -36,7 +49,7 @@ function toIndex(page) {
|
|
|
36
49
|
const scannedHeadings = /* @__PURE__ */ new Set();
|
|
37
50
|
function createIndex(section, sectionId, content, table) {
|
|
38
51
|
return {
|
|
39
|
-
id:
|
|
52
|
+
id: recordId(page.id, id++),
|
|
40
53
|
title: page.title,
|
|
41
54
|
url: page.url,
|
|
42
55
|
page_id: page.id,
|
package/dist/search/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-
|
|
1
|
+
import { a as AdvancedOptions, c as SimpleOptions, d as createSearchAPI, f as initAdvancedSearch, i as AdvancedIndex, l as createFromSource, n as SearchAPI, o as ExportedData, p as initSimpleSearch, r as SearchServer, s as Index, t as QueryOptions, u as createI18nSearchAPI } from "../server-CYiYlUy_.js";
|
|
2
2
|
export { AdvancedIndex, AdvancedOptions, ExportedData, Index, QueryOptions, SearchAPI, SearchServer, SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
|
package/dist/search/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as defaultReadOptions, t as createEndpoint } from "../endpoint-H7rb4eeq.js";
|
|
2
|
-
import { t as buildDocuments } from "../build-doc-
|
|
2
|
+
import { t as buildDocuments } from "../build-doc-DuN5O6YG.js";
|
|
3
3
|
import { n as searchSimple, t as searchAdvanced } from "../advanced-8SKrWgR9.js";
|
|
4
4
|
import { n as buildIndexDefault, r as createBreadcrumbs } from "../build-index-8ryBfL45.js";
|
|
5
5
|
import { create, insertMultipleAsync, save } from "zbsearch";
|