fumadocs-core 16.19.2 → 16.19.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.
Files changed (70) 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/{code-output-CTZ8RNSo.js → code-output-BZYBFRsN.js} +20 -25
  4. package/dist/content/mdx/preset-bundler.d.ts +2 -2
  5. package/dist/content/mdx/preset-runtime.d.ts +2 -2
  6. package/dist/framework/plugin.d.ts +1 -1
  7. package/dist/framework/tanstack.js +2 -11
  8. package/dist/{heading-id-DV5jeAL8.js → heading-id-C-jg9hhz.js} +12 -4
  9. package/dist/{index-DKOSCE6a.d.ts → index-DuwVLhPl.d.ts} +1 -1
  10. package/dist/{index-F4pIhBFU.d.ts → index-Dyo_baWl.d.ts} +1 -1
  11. package/dist/mcp.d.ts +2 -2
  12. package/dist/mdx-plugins/index.d.ts +2 -2
  13. package/dist/mdx-plugins/index.js +3 -3
  14. package/dist/mdx-plugins/rehype-code.core.js +1 -1
  15. package/dist/mdx-plugins/rehype-code.js +1 -1
  16. package/dist/mdx-plugins/rehype-toc.js +3 -3
  17. package/dist/mdx-plugins/remark-admonition.js +1 -1
  18. package/dist/mdx-plugins/remark-block-id.js +1 -1
  19. package/dist/mdx-plugins/remark-code-tab.js +1 -1
  20. package/dist/mdx-plugins/remark-directive-admonition.js +1 -1
  21. package/dist/mdx-plugins/remark-feedback-block.js +1 -1
  22. package/dist/mdx-plugins/remark-heading.d.ts +1 -1
  23. package/dist/mdx-plugins/remark-heading.js +11 -4
  24. package/dist/mdx-plugins/remark-heading.runtime.d.ts +3 -3
  25. package/dist/mdx-plugins/remark-heading.runtime.js +3 -3
  26. package/dist/mdx-plugins/remark-image.js +1 -1
  27. package/dist/mdx-plugins/remark-include.js +5 -3
  28. package/dist/mdx-plugins/remark-llms.js +3 -3
  29. package/dist/mdx-plugins/remark-mdx-files.js +1 -1
  30. package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -1
  31. package/dist/mdx-plugins/remark-npm.js +1 -1
  32. package/dist/mdx-plugins/remark-show.js +2 -2
  33. package/dist/mdx-plugins/remark-steps.js +2 -2
  34. package/dist/mdx-plugins/remark-structure.js +1 -1
  35. package/dist/{meilisearch-MtURSSXp.d.ts → meilisearch-B_1NqhPM.d.ts} +1 -1
  36. package/dist/{mixedbread-CA3Xv15h.d.ts → mixedbread-TsMvtWf7.d.ts} +2 -2
  37. package/dist/{rehype-code.core-aegwEr3K.js → rehype-code.core-DNLXo8St.js} +1 -1
  38. package/dist/{remark-code-tab-CS8aN0DX.js → remark-code-tab-DOOMCbAN.js} +2 -2
  39. package/dist/{remark-heading-BfD2dpns.d.ts → remark-heading-Bvi2ERAo.d.ts} +4 -1
  40. package/dist/{remark-structure-DG_c2J4O.js → remark-structure-DUU7_xF1.js} +3 -3
  41. package/dist/search/algolia.d.ts +1 -1
  42. package/dist/search/client/algolia.d.ts +1 -1
  43. package/dist/search/client/docs-search.d.ts +1 -1
  44. package/dist/search/client/fetch.d.ts +1 -1
  45. package/dist/search/client/flexsearch-static.d.ts +1 -1
  46. package/dist/search/client/meilisearch.d.ts +1 -1
  47. package/dist/search/client/mixedbread.d.ts +2 -2
  48. package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
  49. package/dist/search/client/orama-cloud.d.ts +1 -1
  50. package/dist/search/client/orama-static.d.ts +1 -1
  51. package/dist/search/client.d.ts +1 -1
  52. package/dist/search/flexsearch.d.ts +2 -2
  53. package/dist/search/flexsearch.js +35 -38
  54. package/dist/search/index.js +1 -1
  55. package/dist/search/meilisearch.d.ts +1 -1
  56. package/dist/search/mixedbread.d.ts +2 -2
  57. package/dist/search/orama-cloud-legacy.d.ts +1 -1
  58. package/dist/search/orama-cloud.d.ts +2 -2
  59. package/dist/search/server.d.ts +1 -1
  60. package/dist/{server-D3xLyaLr.d.ts → server-CGBYXzEo.d.ts} +1 -1
  61. package/dist/server.js +20 -9
  62. package/dist/source/dynamic.d.ts +1 -1
  63. package/dist/source/index.d.ts +1 -1
  64. package/dist/source/llms.d.ts +1 -1
  65. package/dist/source/plugins/lucide-icons.d.ts +1 -1
  66. package/dist/source/plugins/slugs.d.ts +1 -1
  67. package/dist/source/plugins/status-badges.d.ts +1 -1
  68. package/dist/{steps-D4-CDiVv.js → steps-CGouhZm4.js} +1 -1
  69. package/dist/{utils-DfA1qEJN.js → utils-C7sTEOQI.js} +12 -15
  70. 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";
@@ -126,11 +126,6 @@ const staticTagRegex = /^(File|TypeTable|Callout|Card)$/;
126
126
  */
127
127
  function createCodeOutput({ target, isStatic, keep, stringifier, parse, literal = JSON.stringify }) {
128
128
  const parts = [];
129
- /** the components that the code refers to in JSX: kept elements, and the JSX in authored code */
130
- const components = /* @__PURE__ */ new Set();
131
- const readJsx = (code) => {
132
- if (code.includes("<")) jsxComponents(parse(code), components);
133
- };
134
129
  const mark = (part) => `\0${parts.push(part) - 1}\0`;
135
130
  const wrap = (part, content) => {
136
131
  const i = parts.push(part) - 1;
@@ -176,23 +171,20 @@ function createCodeOutput({ target, isStatic, keep, stringifier, parse, literal
176
171
  pushText(text.length);
177
172
  return root;
178
173
  }
179
- /** see {@link componentsCode}, of the components of the code */
180
- const declare = (scope, from) => componentsCode(components, scope, from);
174
+ /**
175
+ * See {@link componentsCode}, of the components that the parts refer to: kept elements, and the JSX in authored
176
+ * code. The parts are parsed as the JSX they are in the output, where an expression of comments is valid.
177
+ */
178
+ const declare = (scope, from) => componentsCode(jsxComponents(parts.length > 0 && parse(`<>${chunksToJsx(parts, literal)}</>`)), scope, from);
181
179
  /** the JSX element of a component, with the code of its attributes */
182
180
  function component(node) {
183
181
  const { name } = node;
184
182
  if (typeof name !== "string" || !componentNameRegex.test(name)) return;
185
- components.add(name);
186
183
  let open = `<${name}`;
187
- for (const attr of node.attributes) if (attr.type === "mdxJsxExpressionAttribute") {
188
- open += ` {${attr.value}}`;
189
- readJsx(`({${attr.value}})`);
190
- } else if (attr.value == null) open += ` ${attr.name}`;
184
+ for (const attr of node.attributes) if (attr.type === "mdxJsxExpressionAttribute") open += ` {${attr.value}}`;
185
+ else if (attr.value == null) open += ` ${attr.name}`;
191
186
  else if (typeof attr.value === "string") open += ` ${attr.name}={${JSON.stringify(attr.value)}}`;
192
- else {
193
- open += ` ${attr.name}={${attr.value.value}}`;
194
- readJsx(`(${attr.value.value}\n)`);
195
- }
187
+ else open += ` ${attr.name}={${attr.value.value}}`;
196
188
  return {
197
189
  open,
198
190
  name,
@@ -226,14 +218,12 @@ function createCodeOutput({ target, isStatic, keep, stringifier, parse, literal
226
218
  else if (type === "mdxJsxFlowElement" || type === "mdxJsxTextElement") element(node);
227
219
  else if (type === "mdxTextExpression" || type === "mdxFlowExpression") {
228
220
  if (isStatic) return;
229
- const code = node.value;
230
221
  const position = s.range(node);
231
222
  s.replace(node, mark({
232
- code,
223
+ code: node.value,
233
224
  fallback: position ? s.source.slice(position.start, position.end) : "",
234
225
  inline: type === "mdxTextExpression"
235
226
  }));
236
- readJsx(`(${code}\n)`);
237
227
  } else if (target === "search") {
238
228
  if (type === "link" || type === "linkReference") s.replace(node, (s) => s.inner(node));
239
229
  else if (type === "image" || type === "imageReference") s.replace(node, "");
@@ -307,15 +297,20 @@ function componentsCode(components, scope, from, fallback) {
307
297
  }
308
298
  return names && `const { ${names}} = ${from};`;
309
299
  }
310
- /** the components that a program refers to in JSX, like MDX: the first name of a tag that isn't an HTML element */
311
- function jsxComponents(node, out) {
312
- if (typeof node !== "object" || node === null) return;
300
+ /**
301
+ * The components that parsed code refers to in JSX, like MDX: the name of a tag that isn't an HTML element, or the
302
+ * object of a member tag like `<a.B>`.
303
+ */
304
+ function jsxComponents(node, out = /* @__PURE__ */ new Set()) {
305
+ if (typeof node !== "object" || node === null) return out;
313
306
  let { type, name } = node;
314
307
  if (type === "JSXOpeningElement") {
308
+ const member = name?.object !== void 0;
315
309
  while (name?.object) name = name.object;
316
- if (name?.type === "JSXIdentifier" && !/^[a-z]/.test(name.name)) out.add(name.name);
310
+ if (name?.type === "JSXIdentifier" && (member || !/^[a-z]/.test(name.name))) out.add(name.name);
317
311
  }
318
312
  for (const key in node) jsxComponents(node[key], out);
313
+ return out;
319
314
  }
320
315
  /** the names declared by the ESM statements of a module: imports and top-level declarations */
321
316
  function moduleScope(statements, scope = /* @__PURE__ */ new Set()) {
@@ -360,10 +355,10 @@ function chunksToJsx(chunks, literal) {
360
355
  let out = "";
361
356
  for (const chunk of chunks) if (typeof chunk === "string") out += `{${literal(chunk)}}`;
362
357
  else if ("code" in chunk) out += chunk.inline ? `<span>{${chunk.code}}</span>` : `{${chunk.code}}`;
363
- else if ("when" in chunk) out += `{(${chunk.when}) ? <>${chunksToJsx(chunk.children, literal)}</> : null}`;
358
+ else if ("when" in chunk) out += `{(${chunk.when}) ? <>${chunksToJsx(chunk.children ?? [], literal)}</> : null}`;
364
359
  else {
365
360
  const { open, name, inline, children } = chunk;
366
- const element = children.length > 0 ? `${open}>${chunksToJsx(children, literal)}</${name}>` : `${open} />`;
361
+ const element = children?.length ? `${open}>${chunksToJsx(children, literal)}</${name}>` : `${open} />`;
367
362
  out += inline ? `<span>${element}</span>` : element;
368
363
  }
369
364
  return out;
@@ -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();
@@ -1,4 +1,4 @@
1
- import { d as showCondition, t as and } from "./code-output-CTZ8RNSo.js";
1
+ import { d as showCondition, i as jsxComponents, n as componentsCode, t as and } from "./code-output-BZYBFRsN.js";
2
2
  // ../shared/heading-id.ts
3
3
  /** a custom ID at the end of heading text, like `[#id]` */
4
4
  const headingIdRegex = /\s*\[#(?<slug>[^]+?)]\s*$/;
@@ -50,9 +50,17 @@ function headingIdCode(runtime = headingRuntime) {
50
50
  entries.push(test ? `${test} ? ${id} : ""` : id);
51
51
  if (dynamic) return `_headingIds(props)[${entries.length - 1}]`;
52
52
  },
53
- /** the ESM code that the IDs from code read */
54
- get esm() {
55
- if (dynamic) return `import { createHeadingIds as _createHeadingIds } from ${JSON.stringify(runtime)};\nexport const _headingIds = _createHeadingIds((props, _slug) => [${entries.join(", ")}]);`;
53
+ /**
54
+ * The ESM code that the IDs from code read. It declares the components of authored code, see
55
+ * {@link componentsCode}: only strings and numbers are text, so the components don't have to be there.
56
+ *
57
+ * @param parse - parse a JSX expression
58
+ */
59
+ esm(parse, scope) {
60
+ if (!dynamic) return;
61
+ const list = `[${entries.join(", ")}]`;
62
+ const declaration = componentsCode(jsxComponents(parse(list)), scope, "props.components ?? {}");
63
+ return `import { createHeadingIds as _createHeadingIds } from ${JSON.stringify(runtime)};\nexport const _headingIds = _createHeadingIds((props, _slug) => {\n${declaration}\nreturn ${list};\n});`;
56
64
  }
57
65
  };
58
66
  }
@@ -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,15 +1,15 @@
1
1
  import { remarkGfm } from "./remark-gfm.js";
2
2
  import { rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
3
3
  import { remarkImage } from "./remark-image.js";
4
- import { i as transformerTab } from "../rehype-code.core-aegwEr3K.js";
4
+ import { i as transformerTab } from "../rehype-code.core-DNLXo8St.js";
5
5
  import { transformerIcon } from "./transformer-icon.js";
6
6
  import { extractCodeRegion, remarkInclude } from "./remark-include.js";
7
- import { n as remarkStructureDefaultOptions, r as structure, t as remarkStructure } from "../remark-structure-DG_c2J4O.js";
7
+ import { n as remarkStructureDefaultOptions, r as structure, t as remarkStructure } from "../remark-structure-DUU7_xF1.js";
8
8
  import { rehypeHeading, remarkHeading } from "./remark-heading.js";
9
9
  import { remarkAdmonition } from "./remark-admonition.js";
10
10
  import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
11
11
  import { rehypeToc } from "./rehype-toc.js";
12
- import { t as remarkCodeTab } from "../remark-code-tab-CS8aN0DX.js";
12
+ import { t as remarkCodeTab } from "../remark-code-tab-DOOMCbAN.js";
13
13
  import { remarkSteps } from "./remark-steps.js";
14
14
  import { remarkNpm } from "./remark-npm.js";
15
15
  import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
@@ -1,3 +1,3 @@
1
- import { i as transformerTab, n as rehypeCodeDefaultOptions, r as rehypeCodeFromHighlighter, t as createRehypeCode } from "../rehype-code.core-aegwEr3K.js";
1
+ import { i as transformerTab, n as rehypeCodeDefaultOptions, r as rehypeCodeFromHighlighter, t as createRehypeCode } from "../rehype-code.core-DNLXo8St.js";
2
2
  import { transformerIcon } from "./transformer-icon.js";
3
3
  export { createRehypeCode, rehypeCodeDefaultOptions, rehypeCodeFromHighlighter, transformerIcon, transformerTab };
@@ -1,5 +1,5 @@
1
1
  import { defaultShikiFactory, wasmShikiFactory } from "../highlight/shiki/full.js";
2
- import { i as transformerTab, n as rehypeCodeDefaultOptions$1, t as createRehypeCode } from "../rehype-code.core-aegwEr3K.js";
2
+ import { i as transformerTab, n as rehypeCodeDefaultOptions$1, t as createRehypeCode } from "../rehype-code.core-DNLXo8St.js";
3
3
  import { transformerIcon } from "./transformer-icon.js";
4
4
  // src/mdx-plugins/rehype-code.ts
5
5
  const rehypeCodeDefaultOptions = {
@@ -1,6 +1,6 @@
1
- import { a as handleTag, c as toEsm, n as esmScope } from "../utils-DfA1qEJN.js";
2
- import { a as listCode, i as jsxComponents, m as walkBranches, n as componentsCode, u as isStaticOutput } from "../code-output-CTZ8RNSo.js";
3
- import { n as stepNumberCode } from "../steps-D4-CDiVv.js";
1
+ import { a as handleTag, l as toEsm, n as esmScope } from "../utils-C7sTEOQI.js";
2
+ import { a as listCode, i as jsxComponents, m as walkBranches, n as componentsCode, u as isStaticOutput } from "../code-output-BZYBFRsN.js";
3
+ import { n as stepNumberCode } from "../steps-CGouhZm4.js";
4
4
  import { toEstree } from "hast-util-to-estree";
5
5
  // src/mdx-plugins/rehype-toc.ts
6
6
  const TocOnlyTag = "[toc]";
@@ -1,4 +1,4 @@
1
- import { r as flattenNode, u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as walk, r as flattenNode } from "../utils-C7sTEOQI.js";
2
2
  // src/mdx-plugins/remark-admonition.ts
3
3
  /**
4
4
  * Remark Plugin to support Admonition syntax
@@ -1,4 +1,4 @@
1
- import { r as flattenNode, u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as walk, r as flattenNode } from "../utils-C7sTEOQI.js";
2
2
  import Slugger from "github-slugger";
3
3
  import { createHash } from "node:crypto";
4
4
  // src/mdx-plugins/remark-block-id.ts
@@ -1 +1 @@
1
- export { t as remarkCodeTab } from "../remark-code-tab-CS8aN0DX.js";
1
+ export { t as remarkCodeTab } from "../remark-code-tab-DOOMCbAN.js";
@@ -1,4 +1,4 @@
1
- import { u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as walk } from "../utils-C7sTEOQI.js";
2
2
  // src/mdx-plugins/remark-directive-admonition.ts
3
3
  /**
4
4
  * Remark Plugin to support Admonition syntax in Docusaurus, useful for migrating from Docusaurus.
@@ -1,4 +1,4 @@
1
- import { r as flattenNode, u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as walk, r as flattenNode } from "../utils-C7sTEOQI.js";
2
2
  import { createHash } from "node:crypto";
3
3
  // src/mdx-plugins/remark-feedback-block.ts
4
4
  /**
@@ -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 };
@@ -1,6 +1,6 @@
1
- import { c as toEsm, r as flattenNode, u as walk } from "../utils-DfA1qEJN.js";
2
- import { m as walkBranches } from "../code-output-CTZ8RNSo.js";
3
- import { n as headingIdRegex, t as headingIdCode } from "../heading-id-DV5jeAL8.js";
1
+ import { d as walk, l as toEsm, n as esmScope, r as flattenNode, s as parse } from "../utils-C7sTEOQI.js";
2
+ import { m as walkBranches } from "../code-output-BZYBFRsN.js";
3
+ import { n as headingIdRegex, t as headingIdCode } from "../heading-id-C-jg9hhz.js";
4
4
  import Slugger from "github-slugger";
5
5
  import { toEstree } from "hast-util-to-estree";
6
6
  // src/mdx-plugins/remark-heading.ts
@@ -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),
@@ -47,7 +53,8 @@ function remarkHeading({ slug, slugImportSource, customId = true, generateToc =
47
53
  });
48
54
  return "skip";
49
55
  });
50
- if (ids.esm) root.children.unshift(toEsm(ids.esm));
56
+ const esm = ids.esm(parse, esmScope(root));
57
+ if (esm) root.children.unshift(toEsm(esm));
51
58
  if (generateToc) file.data.toc = toc;
52
59
  };
53
60
  }
@@ -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();
@@ -1,5 +1,5 @@
1
1
  import { replaceSource } from "./stringifier.js";
2
- import { u as walk } from "../utils-DfA1qEJN.js";
2
+ import { d as walk } from "../utils-C7sTEOQI.js";
3
3
  import * as path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  // src/mdx-plugins/remark-image.ts
@@ -1,7 +1,7 @@
1
1
  import { frontmatter } from "../content/md/frontmatter.js";
2
- import { n as headingIdRegex } from "../heading-id-DV5jeAL8.js";
2
+ import { n as headingIdRegex } from "../heading-id-C-jg9hhz.js";
3
3
  import { embedSource, replaceSource } from "./stringifier.js";
4
- import { r as flattenNode, u as walk } from "../utils-DfA1qEJN.js";
4
+ import { d as walk, r as flattenNode } from "../utils-C7sTEOQI.js";
5
5
  import Slugger from "github-slugger";
6
6
  import * as path from "node:path";
7
7
  import * as fs from "node:fs/promises";
@@ -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,6 +1,6 @@
1
- import { u as isStaticOutput } from "../code-output-CTZ8RNSo.js";
2
- import { n as esmScope, o as isJsxElement, t as createCodeOutput } from "../utils-DfA1qEJN.js";
3
- import { r as stringifyHeadingId } from "../heading-id-DV5jeAL8.js";
1
+ import { u as isStaticOutput } from "../code-output-BZYBFRsN.js";
2
+ import { n as esmScope, o as isJsxElement, t as createCodeOutput } from "../utils-C7sTEOQI.js";
3
+ import { r as stringifyHeadingId } from "../heading-id-C-jg9hhz.js";
4
4
  // src/mdx-plugins/remark-llms.ts
5
5
  /**
6
6
  * Generate Markdown for LLMs from the authored source, other plugins can edit it with
@@ -1,5 +1,5 @@
1
1
  import { replaceSource } from "./stringifier.js";
2
- import { u as walk } from "../utils-DfA1qEJN.js";
2
+ import { d as walk } from "../utils-C7sTEOQI.js";
3
3
  import path from "node:path";
4
4
  // src/mdx-plugins/remark-mdx-files.ts
5
5
  function parseFileTree(code) {
@@ -1,5 +1,5 @@
1
1
  import { replaceSource } from "./stringifier.js";
2
- import { u as walk } from "../utils-DfA1qEJN.js";
2
+ import { d as walk } from "../utils-C7sTEOQI.js";
3
3
  // src/mdx-plugins/remark-mdx-mermaid.ts
4
4
  function toMDX(code) {
5
5
  return {
@@ -1,6 +1,6 @@
1
1
  import { generateCodeBlockTabs } from "./codeblock-utils.js";
2
2
  import { replaceSource } from "./stringifier.js";
3
- import { u as walk } from "../utils-DfA1qEJN.js";
3
+ import { d as walk } from "../utils-C7sTEOQI.js";
4
4
  import convert from "npm-to-yarn";
5
5
  // src/mdx-plugins/remark-npm.ts
6
6
  function convertLines(cmd, to) {
@@ -1,5 +1,5 @@
1
- import { d as showCondition, f as showDeclaration, p as showElement } from "../code-output-CTZ8RNSo.js";
2
- import { c as toEsm, o as isJsxElement, u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as showCondition, f as showDeclaration, p as showElement } from "../code-output-BZYBFRsN.js";
2
+ import { d as walk, l as toEsm, o as isJsxElement } from "../utils-C7sTEOQI.js";
3
3
  // src/mdx-plugins/remark-show.ts
4
4
  /**
5
5
  * `<show when={...}>` renders its content when the condition holds, like `props.framework === 'next'` with the params of
@@ -1,5 +1,5 @@
1
- import { u as walk } from "../utils-DfA1qEJN.js";
2
- import { t as groupSteps } from "../steps-D4-CDiVv.js";
1
+ import { d as walk } from "../utils-C7sTEOQI.js";
2
+ import { t as groupSteps } from "../steps-CGouhZm4.js";
3
3
  import { replaceSource } from "./stringifier.js";
4
4
  // src/mdx-plugins/remark-steps.ts
5
5
  /**
@@ -1,2 +1,2 @@
1
1
  import "./remark-heading.js";
2
- export { t as remarkStructure, n as remarkStructureDefaultOptions, r as structure } from "../remark-structure-DG_c2J4O.js";
2
+ export { t as remarkStructure, n as remarkStructureDefaultOptions, r as structure } from "../remark-structure-DUU7_xF1.js";
@@ -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
  /**
@@ -1,4 +1,4 @@
1
- import { i as flattenNodeHast, u as walk } from "./utils-DfA1qEJN.js";
1
+ import { d as walk, i as flattenNodeHast } from "./utils-C7sTEOQI.js";
2
2
  import { transformerIcon } from "./mdx-plugins/transformer-icon.js";
3
3
  import { parseCodeBlockAttributes } from "./mdx-plugins/codeblock-utils.js";
4
4
  import { a as defaultThemes, n as createShikiHighlighter } from "./shiki-DL5DIaX-.js";
@@ -1,6 +1,6 @@
1
1
  import { parseCodeBlockAttributes } from "./mdx-plugins/codeblock-utils.js";
2
- import { s as toAttributeValue, u as walk } from "./utils-DfA1qEJN.js";
3
- import { a as listCode, l as groupLists, p as showElement, t as and } from "./code-output-CTZ8RNSo.js";
2
+ import { c as toAttributeValue, d as walk } from "./utils-C7sTEOQI.js";
3
+ import { a as listCode, l as groupLists, p as showElement, t as and } from "./code-output-BZYBFRsN.js";
4
4
  // ../shared/code-tab.ts
5
5
  const elements = {
6
6
  CodeBlockTabs: {
@@ -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,6 +1,6 @@
1
- import { l as toMdxExport, n as esmScope, t as createCodeOutput } from "./utils-DfA1qEJN.js";
2
- import { a as listCode, m as walkBranches, s as staticTagRegex, u as isStaticOutput } from "./code-output-CTZ8RNSo.js";
3
- import { n as headingIdRegex } from "./heading-id-DV5jeAL8.js";
1
+ import { n as esmScope, t as createCodeOutput, u as toMdxExport } from "./utils-C7sTEOQI.js";
2
+ import { a as listCode, m as walkBranches, s as staticTagRegex, u as isStaticOutput } from "./code-output-BZYBFRsN.js";
3
+ import { n as headingIdRegex } from "./heading-id-C-jg9hhz.js";
4
4
  import { remarkHeading } from "./mdx-plugins/remark-heading.js";
5
5
  import { tableRowToStructuredData } from "./search/index.js";
6
6
  import { remark } from "remark";
@@ -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,4 +1,4 @@
1
- import { u as walk } from "../utils-DfA1qEJN.js";
1
+ import { d as walk } from "../utils-C7sTEOQI.js";
2
2
  import { markdownTable } from "../mdx-plugins/stringifier.js";
3
3
  import { t as buildRegexFromQuery } from "../highlight-D_pTHg81.js";
4
4
  import { remark } from "remark";
@@ -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";
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { markdownTable } from "./mdx-plugins/stringifier.js";
2
- import { c as toHtmlTag } from "./code-output-CTZ8RNSo.js";
2
+ import { c as toHtmlTag } from "./code-output-BZYBFRsN.js";
3
3
  import { isValidElement } from "react";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  // src/server.ts
@@ -47,24 +47,35 @@ async function renderRoute(element) {
47
47
  * named after its tag, as function names are minified in production builds and a component can have several tags.
48
48
  */
49
49
  const tagged = /* @__PURE__ */ new WeakMap();
50
+ /** a missing component. Declared for its prototype: React reads it, and a proxy below would answer as a member tag */
51
+ function Missing() {
52
+ return null;
53
+ }
50
54
  /**
51
- * Resolve the MDX components of a generated Markdown component (`remarkLLMs` with `output: 'function'`):
52
- * a missing component is serialized as JSX syntax by `renderToMarkdown`.
55
+ * The element types of the tags under `prefix`, read from `target`: the type of a tag has the ones of its member tags,
56
+ * like `<Tabs.Tab>`.
53
57
  */
54
- function jsxComponents(components) {
55
- return new Proxy({}, { get(_, key) {
56
- if (typeof key !== "string") return;
57
- const type = components?.[key] ?? (() => null);
58
+ function tagTypes(target, components, prefix = "") {
59
+ return new Proxy(target, { get(target, key, receiver) {
60
+ if (typeof key !== "string" || key in target) return Reflect.get(target, key, receiver);
61
+ const type = components?.[key] ?? Missing;
58
62
  if (typeof type === "string") return type;
59
- const element = () => null;
63
+ const element = tagTypes(Missing, type, `${prefix}${key}.`);
60
64
  tagged.set(element, {
61
- tag: key,
65
+ tag: prefix + key,
62
66
  type
63
67
  });
64
68
  return element;
65
69
  } });
66
70
  }
67
71
  /**
72
+ * Resolve the MDX components of a generated Markdown component (`remarkLLMs` with `output: 'function'`):
73
+ * a missing component is serialized as JSX syntax by `renderToMarkdown`.
74
+ */
75
+ function jsxComponents(components) {
76
+ return tagTypes({}, components);
77
+ }
78
+ /**
68
79
  * Tagged template for Markdown, interpolated values can be strings, React nodes, promises, or arrays of them.
69
80
  *
70
81
  * Use `md\`${children}\`` inside a component to stringify its children before manipulating them, the result is not
@@ -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 {
@@ -1,4 +1,4 @@
1
- import { d as showCondition, l as groupLists } from "./code-output-CTZ8RNSo.js";
1
+ import { d as showCondition, l as groupLists } from "./code-output-BZYBFRsN.js";
2
2
  // ../shared/steps.ts
3
3
  /** the properties of the element of a node */
4
4
  function properties(node) {
@@ -1,5 +1,5 @@
1
1
  import { createStringifier } from "./mdx-plugins/stringifier.js";
2
- import { o as moduleScope, r as createCodeOutput$1 } from "./code-output-CTZ8RNSo.js";
2
+ import { o as moduleScope, r as createCodeOutput$1 } from "./code-output-BZYBFRsN.js";
3
3
  import { valueToEstree } from "estree-util-value-to-estree";
4
4
  import { Parser } from "acorn";
5
5
  import acornJsx from "acorn-jsx";
@@ -34,17 +34,20 @@ function handleTag(value, tag) {
34
34
  }
35
35
  const parser = Parser.extend(acornJsx());
36
36
  const placeholderRegex = /^_fumadocs(\d+)$/;
37
- /** the code of an ESM block, the identifiers `_fumadocs<index>` are the expressions */
38
- function toEsm(code, expressions = []) {
39
- const program = parser.parse(code, {
37
+ function parse(code) {
38
+ return parser.parse(code, {
40
39
  ecmaVersion: "latest",
41
40
  sourceType: "module"
42
41
  });
43
- if (expressions.length > 0) fill(program, expressions);
42
+ }
43
+ /** the code of an ESM block, the identifiers `_fumadocs<index>` are the expressions */
44
+ function toEsm(code, expressions = []) {
45
+ const estree = parse(code);
46
+ if (expressions.length > 0) fill(estree, expressions);
44
47
  return {
45
48
  type: "mdxjsEsm",
46
49
  value: "",
47
- data: { estree: program }
50
+ data: { estree }
48
51
  };
49
52
  }
50
53
  function fill(node, expressions) {
@@ -62,10 +65,7 @@ function toAttributeValue(code) {
62
65
  return {
63
66
  type: "mdxJsxAttributeValueExpression",
64
67
  value: code,
65
- data: { estree: parser.parse(code, {
66
- ecmaVersion: "latest",
67
- sourceType: "module"
68
- }) }
68
+ data: { estree: parse(code) }
69
69
  };
70
70
  }
71
71
  /** the shared code output, on the stringifier of mdast: estree expressions of replacements go in by placeholders */
@@ -74,10 +74,7 @@ function createCodeOutput(file, options) {
74
74
  const out = createCodeOutput$1({
75
75
  ...options,
76
76
  stringifier: (expression) => createStringifier(file, options.target, (value, fallback) => expression(`_fumadocs${expressions.push(value) - 1}`, fallback)),
77
- parse: (code) => parser.parse(code, {
78
- ecmaVersion: "latest",
79
- sourceType: "module"
80
- }),
77
+ parse,
81
78
  literal: (value) => `_fumadocs${expressions.push({
82
79
  type: "Literal",
83
80
  value
@@ -95,4 +92,4 @@ function esmScope(tree) {
95
92
  return scope;
96
93
  };
97
94
  }
98
- export { handleTag as a, toEsm as c, flattenNodeHast as i, toMdxExport as l, esmScope as n, isJsxElement as o, flattenNode as r, toAttributeValue as s, createCodeOutput as t, walk as u };
95
+ export { handleTag as a, toAttributeValue as c, walk as d, flattenNodeHast as i, toEsm as l, esmScope as n, isJsxElement as o, flattenNode as r, parse as s, createCodeOutput as t, toMdxExport as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.19.2",
3
+ "version": "16.19.4",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",