fumadocs-core 16.15.3 → 16.15.5

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.
@@ -1,4 +1,4 @@
1
- import { i as Root, r as Node, t as Folder } from "./definitions-D8-KI7Uy.js";
1
+ import { i as Root, r as Node, t as Folder } from "./definitions-CFOhwE1k.js";
2
2
  import { ReactNode } from "react";
3
3
  //#region src/breadcrumb.d.ts
4
4
  interface BreadcrumbItem {
@@ -1,5 +1,5 @@
1
1
  import { r as normalizeUrl } from "./url-BVHvi3_K.js";
2
- import { r as findPath } from "./utils-Dn9VIXRN.js";
2
+ import { r as findPath } from "./utils-DEVq3cEC.js";
3
3
  import { useMemo } from "react";
4
4
  //#region src/breadcrumb.tsx
5
5
  function useBreadcrumb(url, tree, options) {
@@ -1,4 +1,4 @@
1
- import { r as findPath } from "./utils-Dn9VIXRN.js";
1
+ import { r as findPath } from "./utils-DEVq3cEC.js";
2
2
  import { r as extname, t as basename } from "./path-1H5VzYiT.js";
3
3
  //#region src/search/server/build-index.ts
4
4
  async function buildIndexDefault(page) {
@@ -54,7 +54,14 @@ interface Folder extends ID {
54
54
  type: 'folder';
55
55
  name: ReactNode;
56
56
  description?: ReactNode;
57
- root?: boolean;
57
+ /**
58
+ * Mark as a root folder, `true` for the default type.
59
+ *
60
+ * A string value specifies its **root type**: root folders of the same type
61
+ * under the same parent scope are interchangeable (e.g. versions), and pages
62
+ * can map to their structural projection in another root.
63
+ */
64
+ root?: boolean | string;
58
65
  defaultOpen?: boolean;
59
66
  collapsible?: boolean;
60
67
  index?: Item;
@@ -1,5 +1,5 @@
1
1
  import { r as normalizeUrl } from "./url-BVHvi3_K.js";
2
- import { c as visit } from "./utils-Dn9VIXRN.js";
2
+ import { l as visit } from "./utils-DEVq3cEC.js";
3
3
  import { t as isEqualShallow } from "./is-equal-LdLqRs0o.js";
4
4
  import { a as normalize, i as joinPath, n as dirname, r as extname, t as basename } from "./path-1H5VzYiT.js";
5
5
  import { slugsPlugin } from "./source/plugins/slugs.js";
@@ -1,5 +1,5 @@
1
- import { i as Root } from "./definitions-D8-KI7Uy.js";
2
- import "./index-DZN5OrTa.js";
1
+ import { i as Root } from "./definitions-CFOhwE1k.js";
2
+ import "./index-E8Qh_yQs.js";
3
3
  //#region src/source/client/index.d.ts
4
4
  interface SerializedPageTree {
5
5
  $fumadocs_loader: 'page-tree';
@@ -1,10 +1,10 @@
1
- import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-D8-KI7Uy.js";
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-CFOhwE1k.js";
2
2
  import { t as Awaitable } from "./types-D89QoQR-.js";
3
3
  import { i as StructuredData } from "./remark-structure-CnHwvNZr.js";
4
4
  import "./index-BhgPrb5p.js";
5
5
  import { n as I18nConfig } from "./index-DydiXvgS.js";
6
- import "./index-DZN5OrTa.js";
7
- import { n as SerializedPageTree } from "./index-CdZGMKDG.js";
6
+ import "./index-E8Qh_yQs.js";
7
+ import { n as SerializedPageTree } from "./index-B-0R0VbS.js";
8
8
  import { ReactNode } from "react";
9
9
  //#region src/source/storage/file-system.d.ts
10
10
  /**
@@ -388,7 +388,7 @@ type SourceConfig = {
388
388
  interface MetaData {
389
389
  icon?: string | undefined;
390
390
  title?: string | undefined;
391
- root?: boolean | undefined;
391
+ root?: boolean | string | undefined;
392
392
  pages?: string[] | undefined;
393
393
  pagesIndex?: string | undefined;
394
394
  defaultOpen?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-D8-KI7Uy.js";
1
+ import { i as Root, n as Item, r as Node, t as Folder } from "./definitions-CFOhwE1k.js";
2
2
  //#region src/page-tree/utils.d.ts
3
3
  /**
4
4
  * Flatten tree to an array of page nodes
@@ -33,6 +33,11 @@ declare function findParent(from: Root | Folder, url: string): Root | Folder | u
33
33
  declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
34
34
  includeSeparator?: boolean;
35
35
  }): Node[] | null;
36
+ /**
37
+ * Find the structural projection of `page` (under the root folder `from`) in `to`:
38
+ * the page at the same file path relative to the root folder.
39
+ */
40
+ declare function findProjection(from: Folder, to: Folder, page: Item): Item | undefined;
36
41
  /**
37
42
  * Perform a depth-first search on page tree visiting every node.
38
43
  *
@@ -41,4 +46,4 @@ declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, optio
41
46
  */
42
47
  declare function visit<Root$1 extends Node | Root>(root: Root$1, visitor: <T extends Node | Root>(node: T, parent?: Root | Folder) => 'skip' | 'break' | T | void): Root$1;
43
48
  //#endregion
44
- export { flattenTree as a, visit as c, findSiblings as i, findParent as n, getPageTreePeers as o, findPath as r, getPageTreeRoots as s, findNeighbour as t };
49
+ export { findSiblings as a, getPageTreeRoots as c, findProjection as i, visit as l, findParent as n, flattenTree as o, findPath as r, getPageTreePeers as s, findNeighbour as t };
@@ -1,3 +1,3 @@
1
- import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-D8-KI7Uy.js";
2
- import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../index-DZN5OrTa.js";
3
- export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
1
+ import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-CFOhwE1k.js";
2
+ import { a as findSiblings, c as getPageTreeRoots, i as findProjection, l as visit, n as findParent, o as flattenTree, r as findPath, s as getPageTreePeers, t as findNeighbour } from "../index-E8Qh_yQs.js";
3
+ export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findProjection, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -1,2 +1,2 @@
1
- import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-Dn9VIXRN.js";
2
- export { findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
1
+ import { a as findSiblings, c as getPageTreeRoots, i as findProjection, l as visit, n as findParent, o as flattenTree, r as findPath, s as getPageTreePeers, t as findNeighbour } from "../utils-DEVq3cEC.js";
2
+ export { findNeighbour, findParent, findPath, findProjection, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -1,8 +1,8 @@
1
1
  import { t as Awaitable } from "../types-D89QoQR-.js";
2
2
  import { n as I18nConfig } from "../index-DydiXvgS.js";
3
3
  import "../index-BM36H-xw.js";
4
- import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-C8FDQbVc.js";
5
- import { b as LoaderOutput, v as LoaderConfig } from "../index-19nHQs6M.js";
4
+ import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-k_q58LOn.js";
5
+ import { b as LoaderOutput, v as LoaderConfig } from "../index-BL0I0wLZ.js";
6
6
  import { DocumentData, DocumentOptions } from "flexsearch";
7
7
  //#region src/search/server/build-doc.d.ts
8
8
  interface SharedDocument {
@@ -1,5 +1,5 @@
1
1
  import { t as createEndpoint } from "../endpoint-MyoBU5IC.js";
2
- import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-CX-PNB-q.js";
2
+ import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-4OvfjVN2.js";
3
3
  import { n as search, t as createDocument } from "../utils-Bvy3V-fv.js";
4
4
  import Search from "flexsearch";
5
5
  //#region src/search/flexsearch.ts
@@ -1,5 +1,5 @@
1
1
  import { r as SortedResult } from "../index-BM36H-xw.js";
2
- import { n as SearchAPI } from "../server-C8FDQbVc.js";
2
+ import { n as SearchAPI } from "../server-k_q58LOn.js";
3
3
  import Mixedbread from "@mixedbread/sdk";
4
4
  import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
5
5
  //#region src/search/mixedbread.d.ts
@@ -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-C8FDQbVc.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-k_q58LOn.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 defaultReadOptions, t as createEndpoint } from "../endpoint-MyoBU5IC.js";
2
- import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-CX-PNB-q.js";
2
+ import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-4OvfjVN2.js";
3
3
  import { n as searchSimple, t as searchAdvanced } from "../advanced-Ct13khZr.js";
4
4
  import { create, insertMultipleAsync, save } from "zbsearch";
5
5
  //#region src/search/zbsearch/create-db.ts
@@ -2,7 +2,7 @@ import { t as Awaitable } from "./types-D89QoQR-.js";
2
2
  import { i as StructuredData } from "./remark-structure-CnHwvNZr.js";
3
3
  import { n as I18nConfig } from "./index-DydiXvgS.js";
4
4
  import { r as SortedResult } from "./index-BM36H-xw.js";
5
- import { b as LoaderOutput, v as LoaderConfig } from "./index-19nHQs6M.js";
5
+ import { b as LoaderOutput, v as LoaderConfig } from "./index-BL0I0wLZ.js";
6
6
  import { Language, RawData, SearchParams, TypedDocument, ZBSearch, create } from "zbsearch";
7
7
  //#region src/search/zbsearch/create-db.d.ts
8
8
  type SimpleDocument = TypedDocument<ZBSearch<typeof simpleSchema>>;
@@ -1,2 +1,2 @@
1
- import { i as useFumadocsLoader, n as SerializedPageTree, r as deserializePageTree, t as Serialized } from "../../index-CdZGMKDG.js";
1
+ import { i as useFumadocsLoader, n as SerializedPageTree, r as deserializePageTree, t as Serialized } from "../../index-B-0R0VbS.js";
2
2
  export { Serialized, SerializedPageTree, deserializePageTree, useFumadocsLoader };
@@ -1,4 +1,4 @@
1
- import { c as visit } from "../../utils-Dn9VIXRN.js";
1
+ import { l as visit } from "../../utils-DEVq3cEC.js";
2
2
  import { useMemo } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/source/client/index.tsx
@@ -1,2 +1,2 @@
1
- import { h as dynamicLoader, m as DynamicLoaderConfig, p as DynamicLoader } from "../index-19nHQs6M.js";
1
+ import { h as dynamicLoader, m as DynamicLoaderConfig, p as DynamicLoader } from "../index-BL0I0wLZ.js";
2
2
  export { DynamicLoader, DynamicLoaderConfig, dynamicLoader };
@@ -1,2 +1,2 @@
1
- import { t as dynamicLoader } from "../dynamic-Dgf8t2t2.js";
1
+ import { t as dynamicLoader } from "../dynamic-CTsodhTH.js";
2
2
  export { dynamicLoader };
@@ -1,2 +1,2 @@
1
- import { B as ContentStoragePageFile, C as Meta, D as loader, E as createGetUrl, F as PageTreeBuilderContext, I as PageTreeOptions, L as PageTreeTransformer, O as types_d_exports, P as PageTreeBuilder, R as ContentStorage, S as LoaderPluginOption, T as ResolvedLoaderConfig, V as FileSystem, _ as InferPageType, a as MetaData, b as LoaderOutput, c as SourceUnion, d as multiple, f as update, g as InferMetaType, h as dynamicLoader, i as DynamicSource, j as getSlugs, l as StaticSource, m as DynamicLoaderConfig, n as llms, o as PageData, p as DynamicLoader, r as path_d_exports, s as Source, t as LLMsConfig, u as VirtualFile, v as LoaderConfig, w as Page, x as LoaderPlugin, y as LoaderOptions, z as ContentStorageMetaFile } from "../index-19nHQs6M.js";
1
+ import { B as ContentStoragePageFile, C as Meta, D as loader, E as createGetUrl, F as PageTreeBuilderContext, I as PageTreeOptions, L as PageTreeTransformer, O as types_d_exports, P as PageTreeBuilder, R as ContentStorage, S as LoaderPluginOption, T as ResolvedLoaderConfig, V as FileSystem, _ as InferPageType, a as MetaData, b as LoaderOutput, c as SourceUnion, d as multiple, f as update, g as InferMetaType, h as dynamicLoader, i as DynamicSource, j as getSlugs, l as StaticSource, m as DynamicLoaderConfig, n as llms, o as PageData, p as DynamicLoader, r as path_d_exports, s as Source, t as LLMsConfig, u as VirtualFile, v as LoaderConfig, w as Page, x as LoaderPlugin, y as LoaderOptions, z as ContentStorageMetaFile } from "../index-BL0I0wLZ.js";
2
2
  export { type ContentStorage, type ContentStorageMetaFile, type ContentStoragePageFile, type DynamicLoader, type DynamicLoaderConfig, type DynamicSource, FileSystem, InferMetaType, InferPageType, LLMsConfig, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, type MetaData, Page, type PageData, type PageTreeBuilder, type PageTreeBuilderContext, type PageTreeOptions, type PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, type Source, type SourceUnion, type StaticSource, type VirtualFile, type types_d_exports as _Internal, createGetUrl, dynamicLoader, getSlugs, llms, loader, multiple, update };
@@ -1,5 +1,5 @@
1
1
  import { o as path_exports } from "../path-1H5VzYiT.js";
2
- import { a as update, i as multiple, n as createGetUrl, o as FileSystem, r as loader, t as dynamicLoader } from "../dynamic-Dgf8t2t2.js";
2
+ import { a as update, i as multiple, n as createGetUrl, o as FileSystem, r as loader, t as dynamicLoader } from "../dynamic-CTsodhTH.js";
3
3
  import { getSlugs } from "./plugins/slugs.js";
4
4
  import { llms } from "./llms.js";
5
5
  export { FileSystem, path_exports as PathUtils, createGetUrl, dynamicLoader, getSlugs, llms, loader, multiple, update };
@@ -1,2 +1,2 @@
1
- import { n as llms, t as LLMsConfig } from "../index-19nHQs6M.js";
1
+ import { n as llms, t as LLMsConfig } from "../index-BL0I0wLZ.js";
2
2
  export { LLMsConfig, llms };
@@ -1,4 +1,4 @@
1
- import { x as LoaderPlugin } from "../../index-19nHQs6M.js";
1
+ import { x as LoaderPlugin } from "../../index-BL0I0wLZ.js";
2
2
  import { icons } from "lucide-react";
3
3
  //#region src/source/plugins/lucide-icons.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { A as SlugsPluginOptions, M as slugsFromData, N as slugsPlugin, j as getSlugs, k as SlugFn } from "../../index-19nHQs6M.js";
1
+ import { A as SlugsPluginOptions, M as slugsFromData, N as slugsPlugin, j as getSlugs, k as SlugFn } from "../../index-BL0I0wLZ.js";
2
2
  export { SlugFn, SlugsPluginOptions, getSlugs, slugsFromData, slugsPlugin };
@@ -1,5 +1,5 @@
1
- import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-D8-KI7Uy.js";
2
- import { x as LoaderPlugin } from "../../index-19nHQs6M.js";
1
+ import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-CFOhwE1k.js";
2
+ import { x as LoaderPlugin } from "../../index-BL0I0wLZ.js";
3
3
  import { ReactNode } from "react";
4
4
  //#region src/source/plugins/status-badges.d.ts
5
5
  interface Item extends Item$1 {
@@ -8,7 +8,7 @@ declare const metaSchema: z.ZodObject<{
8
8
  pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
9
  pagesIndex: z.ZodOptional<z.ZodString>;
10
10
  description: z.ZodOptional<z.ZodString>;
11
- root: z.ZodOptional<z.ZodBoolean>;
11
+ root: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
12
12
  defaultOpen: z.ZodOptional<z.ZodBoolean>;
13
13
  collapsible: z.ZodOptional<z.ZodBoolean>;
14
14
  icon: z.ZodOptional<z.ZodString>;
@@ -9,7 +9,7 @@ const metaSchema = z.object({
9
9
  /** specify a index page for folder */
10
10
  pagesIndex: z.string().optional(),
11
11
  description: z.string().optional(),
12
- root: z.boolean().optional(),
12
+ root: z.union([z.boolean(), z.string()]).optional(),
13
13
  defaultOpen: z.boolean().optional(),
14
14
  collapsible: z.boolean().optional(),
15
15
  icon: z.string().optional()
@@ -103,6 +103,23 @@ function findPath(nodes, matcher, options = {}) {
103
103
  }
104
104
  return run(nodes) ?? null;
105
105
  }
106
+ /**
107
+ * Find the structural projection of `page` (under the root folder `from`) in `to`:
108
+ * the page at the same file path relative to the root folder.
109
+ */
110
+ function findProjection(from, to, page) {
111
+ const prefix = from.$ref && `${from.$ref.folder}/`;
112
+ if (!prefix || !to.$ref || !page.$ref?.startsWith(prefix)) return;
113
+ const target = `${to.$ref.folder}/${page.$ref.slice(prefix.length)}`;
114
+ let result;
115
+ visit(to, (node) => {
116
+ if (node.type === "page" && node.$ref === target) {
117
+ result = node;
118
+ return "break";
119
+ }
120
+ });
121
+ return result;
122
+ }
106
123
  const VisitBreak = Symbol("VisitBreak");
107
124
  /**
108
125
  * Perform a depth-first search on page tree visiting every node.
@@ -131,4 +148,4 @@ function visit(root, visitor) {
131
148
  }
132
149
  }
133
150
  //#endregion
134
- export { flattenTree as a, visit as c, findSiblings as i, findParent as n, getPageTreePeers as o, findPath as r, getPageTreeRoots as s, findNeighbour as t };
151
+ export { findSiblings as a, getPageTreeRoots as c, findProjection as i, visit as l, findParent as n, flattenTree as o, findPath as r, getPageTreePeers as s, findNeighbour as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.15.3",
3
+ "version": "16.15.5",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",
@@ -145,7 +145,7 @@
145
145
  "algoliasearch": "5.57.0",
146
146
  "flexsearch": "^0.8.212",
147
147
  "lucide-react": "^1.34.0",
148
- "next": "16.3.2",
148
+ "next": "16.3.3",
149
149
  "path-to-regexp": "^8.4.2",
150
150
  "react-router": "^8.3.0",
151
151
  "remark-directive": "^4.0.0",