fumadocs-core 16.19.2 → 16.19.3

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.
Files changed (44) hide show
  1. package/dist/{algolia-DpOwaSi1.d.ts → algolia-Dge_7SWa.d.ts} +1 -1
  2. package/dist/{client-Di7LtHdh.d.ts → client--MDSaH5X.d.ts} +2 -2
  3. package/dist/content/mdx/preset-bundler.d.ts +2 -2
  4. package/dist/content/mdx/preset-runtime.d.ts +2 -2
  5. package/dist/framework/plugin.d.ts +1 -1
  6. package/dist/framework/tanstack.js +2 -11
  7. package/dist/{index-DKOSCE6a.d.ts → index-DuwVLhPl.d.ts} +1 -1
  8. package/dist/{index-F4pIhBFU.d.ts → index-Dyo_baWl.d.ts} +1 -1
  9. package/dist/mcp.d.ts +2 -2
  10. package/dist/mdx-plugins/index.d.ts +2 -2
  11. package/dist/mdx-plugins/remark-heading.d.ts +1 -1
  12. package/dist/mdx-plugins/remark-heading.js +6 -0
  13. package/dist/mdx-plugins/remark-heading.runtime.d.ts +3 -3
  14. package/dist/mdx-plugins/remark-heading.runtime.js +3 -3
  15. package/dist/mdx-plugins/remark-include.js +3 -1
  16. package/dist/{meilisearch-MtURSSXp.d.ts → meilisearch-B_1NqhPM.d.ts} +1 -1
  17. package/dist/{mixedbread-CA3Xv15h.d.ts → mixedbread-TsMvtWf7.d.ts} +2 -2
  18. package/dist/{remark-heading-BfD2dpns.d.ts → remark-heading-Bvi2ERAo.d.ts} +4 -1
  19. package/dist/search/algolia.d.ts +1 -1
  20. package/dist/search/client/algolia.d.ts +1 -1
  21. package/dist/search/client/docs-search.d.ts +1 -1
  22. package/dist/search/client/fetch.d.ts +1 -1
  23. package/dist/search/client/flexsearch-static.d.ts +1 -1
  24. package/dist/search/client/meilisearch.d.ts +1 -1
  25. package/dist/search/client/mixedbread.d.ts +2 -2
  26. package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
  27. package/dist/search/client/orama-cloud.d.ts +1 -1
  28. package/dist/search/client/orama-static.d.ts +1 -1
  29. package/dist/search/client.d.ts +1 -1
  30. package/dist/search/flexsearch.d.ts +2 -2
  31. package/dist/search/flexsearch.js +35 -38
  32. package/dist/search/meilisearch.d.ts +1 -1
  33. package/dist/search/mixedbread.d.ts +2 -2
  34. package/dist/search/orama-cloud-legacy.d.ts +1 -1
  35. package/dist/search/orama-cloud.d.ts +2 -2
  36. package/dist/search/server.d.ts +1 -1
  37. package/dist/{server-D3xLyaLr.d.ts → server-CGBYXzEo.d.ts} +1 -1
  38. package/dist/source/dynamic.d.ts +1 -1
  39. package/dist/source/index.d.ts +1 -1
  40. package/dist/source/llms.d.ts +1 -1
  41. package/dist/source/plugins/lucide-icons.d.ts +1 -1
  42. package/dist/source/plugins/slugs.d.ts +1 -1
  43. package/dist/source/plugins/status-badges.d.ts +1 -1
  44. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { n as StructuredData } from "./remark-structure-CV606E7e.js";
2
- import { D as LoaderOutput, T as LoaderConfig } from "./index-F4pIhBFU.js";
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 { Algoliasearch } from "algoliasearch";
5
5
  interface DocumentRecord {
@@ -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
- import { t as BaseIndex } from "./algolia-DpOwaSi1.js";
4
- import "./mixedbread-CA3Xv15h.js";
3
+ import { t as BaseIndex } from "./algolia-Dge_7SWa.js";
4
+ import "./mixedbread-TsMvtWf7.js";
5
5
  import { DependencyList } from "react";
6
6
  import { AnyZBSearch, SearchParams } from "zbsearch";
7
7
  import { Root } from "hast";
@@ -1,10 +1,10 @@
1
1
  import { t as RehypeCodeOptions } from "../../rehype-code-Czh_8L5z.js";
2
2
  import { t as RemarkImageOptions } from "../../remark-image-BwyGdFld.js";
3
3
  import { t as StructureOptions } from "../../remark-structure-CV606E7e.js";
4
- import { t as RemarkHeadingOptions } from "../../remark-heading-BfD2dpns.js";
4
+ import { t as RemarkHeadingOptions } from "../../remark-heading-Bvi2ERAo.js";
5
5
  import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bp3EItqr.js";
6
6
  import { t as RemarkNpmOptions } from "../../remark-npm-IH35Vls_.js";
7
- import "../../index-DKOSCE6a.js";
7
+ import "../../index-DuwVLhPl.js";
8
8
  import { t as ResolvePlugins } from "../../util-YfkucgkA.js";
9
9
  import { Pluggable } from "unified";
10
10
  import { ProcessorOptions } from "@mdx-js/mdx";
@@ -1,10 +1,10 @@
1
1
  import { t as RehypeCodeOptions } from "../../rehype-code-Czh_8L5z.js";
2
2
  import { t as RemarkImageOptions } from "../../remark-image-BwyGdFld.js";
3
3
  import { t as StructureOptions } from "../../remark-structure-CV606E7e.js";
4
- import { t as RemarkHeadingOptions } from "../../remark-heading-BfD2dpns.js";
4
+ import { t as RemarkHeadingOptions } from "../../remark-heading-Bvi2ERAo.js";
5
5
  import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Bp3EItqr.js";
6
6
  import { t as RemarkNpmOptions } from "../../remark-npm-IH35Vls_.js";
7
- import "../../index-DKOSCE6a.js";
7
+ import "../../index-DuwVLhPl.js";
8
8
  import { t as ResolvePlugins } from "../../util-YfkucgkA.js";
9
9
  import { ProcessorOptions } from "@mdx-js/mdx";
10
10
  export type MDXRuntimePresetOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins'> & {
@@ -1,6 +1,6 @@
1
1
  import { i as TranslationExtension } from "../index-DFrWGSeW.js";
2
2
  import { n as StructuredData } from "../remark-structure-CV606E7e.js";
3
- import { D as LoaderOutput, E as LoaderOptions, T as LoaderConfig, k as LoaderPluginOption } from "../index-F4pIhBFU.js";
3
+ import { D as LoaderOutput, E as LoaderOptions, T as LoaderConfig, k as LoaderPluginOption } from "../index-Dyo_baWl.js";
4
4
  import { c as TOCItemType } from "../toc-BuHOTlzj.js";
5
5
  import { ReactNode } from "react";
6
6
  type Awaitable<T> = T | Promise<T>;
@@ -1,5 +1,5 @@
1
1
  import { FrameworkProvider } from "./index.js";
2
- import { useMemo, useRef } from "react";
2
+ import { useMemo } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { Link, useParams, useRouter, useRouterState } from "@tanstack/react-router";
5
5
  // src/framework/tanstack.tsx
@@ -23,16 +23,7 @@ const framework = {
23
23
  });
24
24
  },
25
25
  usePathname() {
26
- const { isLoading, pathname } = useRouterState({ select: (state) => ({
27
- isLoading: state.isLoading,
28
- pathname: state.location.pathname
29
- }) });
30
- const activePathname = useRef(pathname);
31
- return useMemo(() => {
32
- if (isLoading) return activePathname.current;
33
- activePathname.current = pathname;
34
- return pathname;
35
- }, [isLoading, pathname]);
26
+ return useRouterState({ select: (state) => (state.isLoading && state.resolvedLocation || state.location).pathname });
36
27
  },
37
28
  useRouter() {
38
29
  const router = useRouter();
@@ -3,7 +3,7 @@ import "./rehype-code-Czh_8L5z.js";
3
3
  import "./remark-image-BwyGdFld.js";
4
4
  import "./remark-include-D_FmDdtI.js";
5
5
  import "./remark-structure-CV606E7e.js";
6
- import "./remark-heading-BfD2dpns.js";
6
+ import "./remark-heading-Bvi2ERAo.js";
7
7
  import "./remark-admonition-BxacgP6i.js";
8
8
  import "./remark-directive-admonition-BT_PH6hL.js";
9
9
  import "./rehype-toc-B0HyD0yu.js";
@@ -3,7 +3,7 @@ import { n as I18nConfig } from "./index-DFrWGSeW.js";
3
3
  import { n as StructuredData } from "./remark-structure-CV606E7e.js";
4
4
  import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-BQVehOBz.js";
5
5
  import { n as SerializedPageTree } from "./index-B2EN5xn0.js";
6
- import "./index-DKOSCE6a.js";
6
+ import "./index-DuwVLhPl.js";
7
7
  import "./index-DMxrC6WS.js";
8
8
  import { ReactNode } from "react";
9
9
  /**
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { r as SearchServer } from "./server-D3xLyaLr.js";
2
- import { D as LoaderOutput, T as LoaderConfig, r as LLMsWithPages } from "./index-F4pIhBFU.js";
1
+ import { r as SearchServer } from "./server-CGBYXzEo.js";
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";
5
5
  /**
@@ -5,7 +5,7 @@ import { n as rehypeCode, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions
5
5
  import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-BwyGdFld.js";
6
6
  import { n as extractCodeRegion, r as remarkInclude, t as RemarkIncludeOptions } from "../remark-include-D_FmDdtI.js";
7
7
  import { a as remarkStructureDefaultOptions, i as remarkStructure, n as StructuredData, o as structure, r as StructuredDataContent, t as StructureOptions } from "../remark-structure-CV606E7e.js";
8
- import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-BfD2dpns.js";
8
+ import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Bvi2ERAo.js";
9
9
  import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-BxacgP6i.js";
10
10
  import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BT_PH6hL.js";
11
11
  import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-B0HyD0yu.js";
@@ -18,5 +18,5 @@ import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-m
18
18
  import { n as RemarkFeedbackBlockOptions, r as remarkFeedbackBlock, t as FeedbackBlockProps } from "../remark-feedback-block-2Ei4IDr4.js";
19
19
  import { t as remarkShow } from "../remark-show-uR9rtiVe.js";
20
20
  import { t as LLMsOptions } from "../remark-llms-BCyfmS02.js";
21
- import "../index-DKOSCE6a.js";
21
+ import "../index-DuwVLhPl.js";
22
22
  export { CodeBlockAttributes, type CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, type LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, type RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, RemarkIncludeOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, StructuredDataContent, extractCodeRegion, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeHeading, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkInclude, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkShow, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
@@ -1,2 +1,2 @@
1
- import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-BfD2dpns.js";
1
+ import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-Bvi2ERAo.js";
2
2
  export { RemarkHeadingOptions, rehypeHeading, remarkHeading };
@@ -39,6 +39,12 @@ function remarkHeading({ slug, slugImportSource, customId = true, generateToc =
39
39
  props.id = slug(root, heading, text);
40
40
  const code = fromCode && ids.next(heading.children, when);
41
41
  if (code) (file.data._headingIds ??= {})[props.id] = code;
42
+ } else {
43
+ slug(root, heading, props.id);
44
+ if (fromCode) ids.next([{
45
+ type: "text",
46
+ value: props.id
47
+ }], when);
42
48
  }
43
49
  if (generateToc) toc.push({
44
50
  title: text ?? flattenNode(heading),
@@ -3,9 +3,9 @@ declare function createSlugger(): (text: string) => string;
3
3
  * The IDs of the headings of a page for its props.
4
4
  *
5
5
  * @param ids - list the ID of each heading in document order: `slug` takes the parts of the text of a heading that
6
- * shows, a hidden heading has an empty ID
7
- * @param slugger - create the slug function of a page, called with the text of each heading that shows in document
8
- * order, so it can count duplicates
6
+ * shows, or its custom ID, a hidden heading has an empty ID
7
+ * @param slugger - create the slug function of a page, called with the text or custom ID of each heading that shows in
8
+ * document order, so it can count duplicates
9
9
  */
10
10
  export declare function createHeadingIds(ids: (props: object, slug: (parts: unknown[]) => string) => string[], slugger?: typeof createSlugger): (props: object) => string[];
11
11
  export {};
@@ -8,9 +8,9 @@ function createSlugger() {
8
8
  * The IDs of the headings of a page for its props.
9
9
  *
10
10
  * @param ids - list the ID of each heading in document order: `slug` takes the parts of the text of a heading that
11
- * shows, a hidden heading has an empty ID
12
- * @param slugger - create the slug function of a page, called with the text of each heading that shows in document
13
- * order, so it can count duplicates
11
+ * shows, or its custom ID, a hidden heading has an empty ID
12
+ * @param slugger - create the slug function of a page, called with the text or custom ID of each heading that shows in
13
+ * document order, so it can count duplicates
14
14
  */
15
15
  function createHeadingIds(ids, slugger = createSlugger) {
16
16
  const cache = /* @__PURE__ */ new WeakMap();
@@ -138,7 +138,9 @@ function extractSection(tree, section) {
138
138
  /** the ID `remark-heading` gives a heading */
139
139
  function headingId(heading, slugger) {
140
140
  const last = heading.children.at(-1);
141
- return (last?.type === "text" ? headingIdRegex.exec(last.value)?.[1] : void 0) ?? slugger.slug(flattenNode(heading));
141
+ const custom = last?.type === "text" ? headingIdRegex.exec(last.value)?.[1] : void 0;
142
+ const id = slugger.slug(custom ?? flattenNode(heading));
143
+ return custom ?? id;
142
144
  }
143
145
  const regionMarkers = [
144
146
  {
@@ -1,5 +1,5 @@
1
1
  import { n as StructuredData } from "./remark-structure-CV606E7e.js";
2
- import { D as LoaderOutput, T as LoaderConfig } from "./index-F4pIhBFU.js";
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 { Meilisearch } from "meilisearch";
5
5
  interface DocumentRecord {
@@ -1,6 +1,6 @@
1
1
  import { r as SortedResult } from "./index-BlFx9iJj.js";
2
- import { n as SearchAPI } from "./server-D3xLyaLr.js";
3
- import { t as DocumentRecord } from "./meilisearch-MtURSSXp.js";
2
+ import { n as SearchAPI } from "./server-CGBYXzEo.js";
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";
6
6
  /**
@@ -3,7 +3,10 @@ import * as Hast from "hast";
3
3
  import { Transformer } from "unified";
4
4
  import { Heading, Root as Root$1 } from "mdast";
5
5
  interface RemarkHeadingOptions {
6
- /** slug the IDs of headings, the IDs slugged when rendering come from `slugImportSource` */
6
+ /**
7
+ * slug the IDs of headings, the IDs slugged when rendering come from `slugImportSource`. Custom IDs are slugged too,
8
+ * so a slugger can count them as duplicates.
9
+ */
7
10
  slug?: (root: Root$1, heading: Heading, text: string) => string;
8
11
  /**
9
12
  * The module that slugs IDs when rendering, compiled pages import `createHeadingIds()` from it like the JSX runtime
@@ -1,2 +1,2 @@
1
- import { a as sync, i as setIndexSettings, n as DocumentRecord, o as toDocuments, r as SyncOptions, s as updateDocuments, t as BaseIndex } from "../algolia-DpOwaSi1.js";
1
+ import { a as sync, i as setIndexSettings, n as DocumentRecord, o as toDocuments, r as SyncOptions, s as updateDocuments, t as BaseIndex } from "../algolia-Dge_7SWa.js";
2
2
  export { BaseIndex, DocumentRecord, SyncOptions, setIndexSettings, sync, toDocuments, updateDocuments };
@@ -1,2 +1,2 @@
1
- import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client-Di7LtHdh.js";
1
+ import { b as useAlgoliaSearch, v as AlgoliaOptions, y as algoliaClient } from "../../client--MDSaH5X.js";
2
2
  export { AlgoliaOptions, algoliaClient, useAlgoliaSearch };
@@ -1,2 +1,2 @@
1
- import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client-Di7LtHdh.js";
1
+ import { n as SearchClient, r as useDocsSearch, t as ClientPreset } from "../../client--MDSaH5X.js";
2
2
  export { ClientPreset, SearchClient, useDocsSearch };
@@ -1,2 +1,2 @@
1
- import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client-Di7LtHdh.js";
1
+ import { D as useFetchSearch, E as fetchClient, T as FetchOptions } from "../../client--MDSaH5X.js";
2
2
  export { FetchOptions, fetchClient, useFetchSearch };
@@ -1,2 +1,2 @@
1
- import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client-Di7LtHdh.js";
1
+ import { a as flexsearchStaticClient, i as FlexsearchStaticOptions, o as useFlexsearchStatic } from "../../client--MDSaH5X.js";
2
2
  export { FlexsearchStaticOptions, flexsearchStaticClient, useFlexsearchStatic };
@@ -1,2 +1,2 @@
1
- import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client-Di7LtHdh.js";
1
+ import { f as MeilisearchOptions, m as useMeilisearch, p as meilisearchClient } from "../../client--MDSaH5X.js";
2
2
  export { MeilisearchOptions, meilisearchClient, useMeilisearch };
@@ -1,3 +1,3 @@
1
- import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client-Di7LtHdh.js";
2
- import { n as SearchMetadata } from "../../mixedbread-CA3Xv15h.js";
1
+ import { c as mixedbreadClient, s as MixedbreadOptions } from "../../client--MDSaH5X.js";
2
+ import { n as SearchMetadata } from "../../mixedbread-TsMvtWf7.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-Di7LtHdh.js";
1
+ import { d as useOramaCloudLegacySearch, l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client--MDSaH5X.js";
2
2
  export { OramaCloudLegacyOptions, oramaCloudLegacyClient, useOramaCloudLegacySearch };
@@ -1,2 +1,2 @@
1
- import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client-Di7LtHdh.js";
1
+ import { _ as useOramaCloudSearch, g as oramaCloudClient, h as OramaCloudOptions } from "../../client--MDSaH5X.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-Di7LtHdh.js";
1
+ import { C as staticClient, S as oramaStaticClient, w as useStaticSearch, x as StaticOptions } from "../../client--MDSaH5X.js";
2
2
  export { StaticOptions, oramaStaticClient, staticClient, useStaticSearch };
@@ -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-Di7LtHdh.js";
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--MDSaH5X.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,5 +1,5 @@
1
- import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-D3xLyaLr.js";
2
- import { D as LoaderOutput, T as LoaderConfig } from "../index-F4pIhBFU.js";
1
+ import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-CGBYXzEo.js";
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";
5
5
  import "../index-BlFx9iJj.js";
@@ -29,41 +29,31 @@ function server(options) {
29
29
  }
30
30
  };
31
31
  }
32
- function serverI18n(options) {
33
- const { indexes: inputIndexes, localeMap } = options;
34
- async function initSearchServers() {
35
- const map = /* @__PURE__ */ new Map();
36
- const indexMap = /* @__PURE__ */ new Map();
37
- const indexes = typeof inputIndexes === "function" ? await inputIndexes() : inputIndexes;
38
- for (const index of indexes) {
39
- let list = indexMap.get(index.locale);
40
- if (!list) {
41
- list = [];
42
- indexMap.set(index.locale, list);
43
- }
44
- list.push(index);
45
- }
46
- for (const [locale, list] of indexMap) {
32
+ /** a server for each locale, built on its first use */
33
+ function localeServers(i18n, getIndexes, { localeMap, document }) {
34
+ const servers = /* @__PURE__ */ new Map();
35
+ function get(locale) {
36
+ let localeServer = servers.get(locale);
37
+ if (!localeServer) {
47
38
  const override = localeMap?.[locale];
48
- map.set(locale, server({
49
- indexes: list,
39
+ localeServer = server({
40
+ indexes: () => getIndexes(locale),
50
41
  document: override === "cjk" ? {
51
- ...options.document,
42
+ ...document,
52
43
  encoder: Search.Charset.CJK
53
44
  } : {
54
- ...options.document,
45
+ ...document,
55
46
  ...override
56
47
  }
57
- }));
48
+ });
49
+ servers.set(locale, localeServer);
58
50
  }
59
- return map;
51
+ return localeServer;
60
52
  }
61
- const get = initSearchServers();
62
53
  return {
63
54
  async export() {
64
- const map = await get;
65
- const entries = Array.from(map.entries()).map(async ([k, v]) => {
66
- return [k, (await v.export()).raw];
55
+ const entries = i18n.languages.map(async (locale) => {
56
+ return [locale, (await get(locale).export()).raw];
67
57
  });
68
58
  return {
69
59
  type: "i18n",
@@ -71,12 +61,24 @@ function serverI18n(options) {
71
61
  };
72
62
  },
73
63
  async search(query, searchOptions) {
74
- const handler = (await get).get(searchOptions?.locale ?? options.i18n.defaultLanguage);
75
- if (handler) return handler.search(query, searchOptions);
76
- return [];
64
+ const locale = searchOptions?.locale ?? i18n.defaultLanguage;
65
+ if (!i18n.languages.includes(locale)) return [];
66
+ return get(locale).search(query, searchOptions);
77
67
  }
78
68
  };
79
69
  }
70
+ function serverI18n({ i18n, indexes, ...options }) {
71
+ const indexMap = Promise.resolve(typeof indexes === "function" ? indexes() : indexes).then((list) => {
72
+ const map = /* @__PURE__ */ new Map();
73
+ for (const index of list) {
74
+ const items = map.get(index.locale);
75
+ if (items) items.push(index);
76
+ else map.set(index.locale, [index]);
77
+ }
78
+ return map;
79
+ });
80
+ return localeServers(i18n, async (locale) => (await indexMap).get(locale) ?? [], options);
81
+ }
80
82
  function flexsearch(options) {
81
83
  return createEndpoint(server(options));
82
84
  }
@@ -89,23 +91,18 @@ function flexsearchI18n(options) {
89
91
  function flexsearchFromSource(loader, options = {}) {
90
92
  const cache = /* @__PURE__ */ new WeakMap();
91
93
  const { buildIndex = buildIndexDefault, ...rest } = options;
92
- async function initServer(loader) {
94
+ function initServer(loader) {
93
95
  const getBreadcrumbs = createBreadcrumbs(loader);
94
- const indexes = await Promise.all(loader.getPages().map(async (page) => {
96
+ const getIndexes = (locale) => Promise.all(loader.getPages(locale).map(async (page) => {
95
97
  const index = await buildIndex(page);
96
98
  return {
97
99
  ...index,
98
- locale: page.locale,
99
100
  breadcrumbs: index.breadcrumbs ?? getBreadcrumbs(page)
100
101
  };
101
102
  }));
102
- if (loader._i18n) return serverI18n({
103
- indexes,
104
- i18n: loader._i18n,
105
- ...rest
106
- });
103
+ if (loader._i18n) return localeServers(loader._i18n, getIndexes, rest);
107
104
  return server({
108
- indexes,
105
+ indexes: () => getIndexes(),
109
106
  ...rest
110
107
  });
111
108
  }
@@ -116,7 +113,7 @@ function flexsearchFromSource(loader, options = {}) {
116
113
  server = initServer(l);
117
114
  cache.set(l, server);
118
115
  }
119
- return await server;
116
+ return server;
120
117
  }
121
118
  return createEndpoint({
122
119
  async export() {
@@ -1,2 +1,2 @@
1
- import { a as toDocuments, i as sync, n as MeilisearchDocument, r as SyncOptions, t as DocumentRecord } from "../meilisearch-MtURSSXp.js";
1
+ import { a as toDocuments, i as sync, n as MeilisearchDocument, r as SyncOptions, t as DocumentRecord } from "../meilisearch-B_1NqhPM.js";
2
2
  export { DocumentRecord, MeilisearchDocument, SyncOptions, sync, toDocuments };
@@ -1,3 +1,3 @@
1
- import { a as toDocuments, t as DocumentRecord } from "../meilisearch-MtURSSXp.js";
2
- import { a as sync, i as createMixedbreadSearchAPI, n as SearchMetadata, r as SyncOptions, t as MixedbreadSearchOptions } from "../mixedbread-CA3Xv15h.js";
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-TsMvtWf7.js";
3
3
  export { type DocumentRecord, MixedbreadSearchOptions, SearchMetadata, SyncOptions, createMixedbreadSearchAPI, sync, toDocuments };
@@ -1,5 +1,5 @@
1
1
  import { n as StructuredData } from "../remark-structure-CV606E7e.js";
2
- import "../index-DKOSCE6a.js";
2
+ import "../index-DuwVLhPl.js";
3
3
  import { CloudManager } from "@oramacloud/client";
4
4
  export interface SyncOptions {
5
5
  /**
@@ -1,6 +1,6 @@
1
- import "../index-DKOSCE6a.js";
1
+ import "../index-DuwVLhPl.js";
2
2
  import { n as StructuredData } from "../remark-structure-CV606E7e.js";
3
- import { D as LoaderOutput, T as LoaderConfig } from "../index-F4pIhBFU.js";
3
+ import { D as LoaderOutput, T as LoaderConfig } from "../index-Dyo_baWl.js";
4
4
  import { t as Awaitable } from "../types-Dvkw0Kd0.js";
5
5
  import { OramaCloud } from "@orama/core";
6
6
  export interface SyncOptions {
@@ -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-D3xLyaLr.js";
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-CGBYXzEo.js";
2
2
  export { AdvancedIndex, AdvancedOptions, ExportedData, Index, QueryOptions, SearchAPI, SearchServer, SimpleOptions, createFromSource, createI18nSearchAPI, createSearchAPI, initAdvancedSearch, initSimpleSearch };
@@ -1,5 +1,5 @@
1
1
  import { n as I18nConfig } from "./index-DFrWGSeW.js";
2
- import { D as LoaderOutput, T as LoaderConfig } from "./index-F4pIhBFU.js";
2
+ import { D as LoaderOutput, T as LoaderConfig } from "./index-Dyo_baWl.js";
3
3
  import { n as StructuredData } from "./remark-structure-CV606E7e.js";
4
4
  import { t as Awaitable } from "./types-Dvkw0Kd0.js";
5
5
  import { r as SortedResult } from "./index-BlFx9iJj.js";
@@ -1,2 +1,2 @@
1
- import { b as DynamicLoaderConfig, x as dynamicLoader, y as DynamicLoader } from "../index-F4pIhBFU.js";
1
+ import { b as DynamicLoaderConfig, x as dynamicLoader, y as DynamicLoader } from "../index-Dyo_baWl.js";
2
2
  export { DynamicLoader, DynamicLoaderConfig, dynamicLoader };
@@ -1,2 +1,2 @@
1
- import { A as Meta, C as InferMetaType, D as LoaderOutput, E as LoaderOptions, F as types_d_exports, G as ContentStorage, H as PageTreeBuilderContext, J as FileSystem, K as ContentStorageMetaFile, M as ResolvedLoaderConfig, N as createGetUrl, O as LoaderPlugin, P as loader, R as getSlugs, S as GetPageOptions, T as LoaderConfig, U as PageTreeOptions, V as PageTreeBuilder, W as PageTreeTransformer, _ as multiple, a as StaticParamsOptions, b as DynamicLoaderConfig, c as path_d_exports, d as PageData, f as Params, g as VirtualFile, h as StaticSource, i as llms, j as Page, k as LoaderPluginOption, l as DynamicSource, m as SourceUnion, n as LLMsConfig, o as getStaticParams, p as Source, q as ContentStoragePageFile, r as LLMsWithPages, s as isDynamicPath, t as LLMs, u as MetaData, v as update, w as InferPageType, x as dynamicLoader, y as DynamicLoader } from "../index-F4pIhBFU.js";
1
+ import { A as Meta, C as InferMetaType, D as LoaderOutput, E as LoaderOptions, F as types_d_exports, G as ContentStorage, H as PageTreeBuilderContext, J as FileSystem, K as ContentStorageMetaFile, M as ResolvedLoaderConfig, N as createGetUrl, O as LoaderPlugin, P as loader, R as getSlugs, S as GetPageOptions, T as LoaderConfig, U as PageTreeOptions, V as PageTreeBuilder, W as PageTreeTransformer, _ as multiple, a as StaticParamsOptions, b as DynamicLoaderConfig, c as path_d_exports, d as PageData, f as Params, g as VirtualFile, h as StaticSource, i as llms, j as Page, k as LoaderPluginOption, l as DynamicSource, m as SourceUnion, n as LLMsConfig, o as getStaticParams, p as Source, q as ContentStoragePageFile, r as LLMsWithPages, s as isDynamicPath, t as LLMs, u as MetaData, v as update, w as InferPageType, x as dynamicLoader, y as DynamicLoader } from "../index-Dyo_baWl.js";
2
2
  export { type ContentStorage, type ContentStorageMetaFile, type ContentStoragePageFile, type DynamicLoader, type DynamicLoaderConfig, type DynamicSource, FileSystem, GetPageOptions, InferMetaType, InferPageType, LLMs, LLMsConfig, LLMsWithPages, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, type MetaData, Page, type PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, type Params, path_d_exports as PathUtils, ResolvedLoaderConfig, type Source, type SourceUnion, type StaticParamsOptions, type StaticSource, type VirtualFile, type types_d_exports as _Internal, createGetUrl, dynamicLoader, getSlugs, getStaticParams, isDynamicPath, llms, loader, multiple, update };
@@ -1,2 +1,2 @@
1
- import { i as llms, n as LLMsConfig, r as LLMsWithPages, t as LLMs } from "../index-F4pIhBFU.js";
1
+ import { i as llms, n as LLMsConfig, r as LLMsWithPages, t as LLMs } from "../index-Dyo_baWl.js";
2
2
  export { LLMs, LLMsConfig, LLMsWithPages, llms };
@@ -1,4 +1,4 @@
1
- import { O as LoaderPlugin } from "../../index-F4pIhBFU.js";
1
+ import { O as LoaderPlugin } from "../../index-Dyo_baWl.js";
2
2
  import { icons } from "lucide-react";
3
3
  /**
4
4
  * Convert icon names into Lucide Icons, requires `lucide-react` to be installed.
@@ -1,2 +1,2 @@
1
- import { B as slugsPlugin, I as SlugFn, L as SlugsPluginOptions, R as getSlugs, z as slugsFromData } from "../../index-F4pIhBFU.js";
1
+ import { B as slugsPlugin, I as SlugFn, L as SlugsPluginOptions, R as getSlugs, z as slugsFromData } from "../../index-Dyo_baWl.js";
2
2
  export { SlugFn, SlugsPluginOptions, getSlugs, slugsFromData, slugsPlugin };
@@ -1,4 +1,4 @@
1
- import { O as LoaderPlugin } from "../../index-F4pIhBFU.js";
1
+ import { O as LoaderPlugin } from "../../index-Dyo_baWl.js";
2
2
  import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-BQVehOBz.js";
3
3
  import { ReactNode } from "react";
4
4
  export interface Item extends Item$1 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.19.2",
3
+ "version": "16.19.3",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",