fumadocs-core 16.8.11 → 16.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{build-doc-8RxTPr1J.js → build-doc-CqRdmOMh.js} +2 -2
  2. package/dist/{client-Dyup8E6r.d.ts → client-D6TKpTxv.d.ts} +2 -2
  3. package/dist/content/mdx/preset-bundler.d.ts +1 -1
  4. package/dist/content/mdx/preset-runtime.d.ts +1 -1
  5. package/dist/i18n/index.d.ts +2 -2
  6. package/dist/i18n/index.js +55 -2
  7. package/dist/i18n/middleware.d.ts +1 -1
  8. package/dist/i18n/middleware.js +2 -2
  9. package/dist/{index-DvNKidQF.d.ts → index-CKvjS08M2.d.ts} +21 -33
  10. package/dist/index-YTOeewZk.d.ts +85 -0
  11. package/dist/index-qM4PwHTs.d.ts +1 -0
  12. package/dist/{loader-CeIUqWDI.js → loader-DWaWaGZg.js} +152 -136
  13. package/dist/mdx-plugins/index.d.ts +1 -1
  14. package/dist/page-tree/index.d.ts +1 -1
  15. package/dist/{path-B4h_WlT8.js → path-CPgAF5cw.js} +15 -3
  16. package/dist/search/algolia.d.ts +1 -1
  17. package/dist/search/client/algolia.d.ts +1 -1
  18. package/dist/search/client/fetch.d.ts +1 -1
  19. package/dist/search/client/flexsearch-static.d.ts +1 -1
  20. package/dist/search/client/mixedbread.d.ts +1 -1
  21. package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
  22. package/dist/search/client/orama-cloud.d.ts +1 -1
  23. package/dist/search/client/orama-static.d.ts +1 -1
  24. package/dist/search/client.d.ts +1 -1
  25. package/dist/search/flexsearch.d.ts +3 -3
  26. package/dist/search/flexsearch.js +1 -1
  27. package/dist/search/index.d.ts +1 -1
  28. package/dist/search/mixedbread.d.ts +2 -2
  29. package/dist/search/server.d.ts +1 -1
  30. package/dist/search/server.js +1 -1
  31. package/dist/{server-DZLj6URC.d.ts → server-BmBBtKX6.d.ts} +3 -3
  32. package/dist/source/client/index.d.ts +1 -1
  33. package/dist/source/dynamic.d.ts +1 -1
  34. package/dist/source/dynamic.js +1 -1
  35. package/dist/source/index.d.ts +1 -1
  36. package/dist/source/index.js +2 -2
  37. package/dist/source/llms.d.ts +1 -1
  38. package/dist/source/plugins/lucide-icons.d.ts +1 -1
  39. package/dist/source/plugins/slugs.d.ts +1 -1
  40. package/dist/source/plugins/slugs.js +1 -1
  41. package/dist/source/plugins/status-badges.d.ts +1 -1
  42. package/package.json +10 -10
  43. package/dist/index-DaiDEfiL.d.ts +0 -40
  44. /package/dist/{algolia-BvGetcJs.d.ts → algolia-D56Eex2h.d.ts} +0 -0
  45. /package/dist/{index-CnkxgKNd.d.ts → index-Bcms_L7o.d.ts} +0 -0
  46. /package/dist/{index-5SWg3Kgu2.d.ts → index-D2f_P1Zo.d.ts} +0 -0
  47. /package/dist/{index-nW94Fpi3.d.ts → index-DRvW7IXg.d.ts} +0 -0
  48. /package/dist/{util-D7vTp-Ia.d.ts → util-CaBjK5m2.d.ts} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { r as findPath } from "./utils-BFW0mEx9.js";
2
- import { r as extname, t as basename } from "./path-B4h_WlT8.js";
2
+ import { r as extname, t as basename } from "./path-CPgAF5cw.js";
3
3
  //#region src/search/server/build-index.ts
4
4
  async function buildIndexDefault(page) {
5
5
  let structuredData;
6
- if ("structuredData" in page.data) structuredData = typeof page.data.structuredData === "function" ? await page.data.structuredData() : page.data.structuredData;
6
+ if (page.data.structuredData) structuredData = typeof page.data.structuredData === "function" ? await page.data.structuredData() : page.data.structuredData;
7
7
  else if ("load" in page.data && typeof page.data.load === "function") structuredData = (await page.data.load()).structuredData;
8
8
  if (!structuredData) throw new Error("Cannot find structured data from page, please define the page to index function.");
9
9
  return {
@@ -1,6 +1,6 @@
1
1
  import { t as Awaitable } from "./types-DpbpliNk.js";
2
- import { t as BaseIndex } from "./algolia-BvGetcJs.js";
3
- import { r as SortedResult } from "./index-CnkxgKNd.js";
2
+ import { t as BaseIndex } from "./algolia-D56Eex2h.js";
3
+ import { r as SortedResult } from "./index-Bcms_L7o.js";
4
4
  import { DependencyList } from "react";
5
5
  import { AnyOrama, Orama, SearchParams } from "@orama/orama";
6
6
  import { LiteClient, SearchResponse } from "algoliasearch/lite";
@@ -4,7 +4,7 @@ import { r as StructureOptions } from "../../remark-structure-C2-K9_ko.js";
4
4
  import { t as RemarkHeadingOptions } from "../../remark-heading-BkmtL7mJ.js";
5
5
  import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Ct56s_uQ.js";
6
6
  import { t as RemarkNpmOptions } from "../../remark-npm-BZsXR24w.js";
7
- import { t as ResolvePlugins } from "../../util-D7vTp-Ia.js";
7
+ import { t as ResolvePlugins } from "../../util-CaBjK5m2.js";
8
8
  import { Pluggable } from "unified";
9
9
  import { ProcessorOptions } from "@mdx-js/mdx";
10
10
 
@@ -4,7 +4,7 @@ import { r as StructureOptions } from "../../remark-structure-C2-K9_ko.js";
4
4
  import { t as RemarkHeadingOptions } from "../../remark-heading-BkmtL7mJ.js";
5
5
  import { t as RemarkCodeTabOptions } from "../../remark-code-tab-Ct56s_uQ.js";
6
6
  import { t as RemarkNpmOptions } from "../../remark-npm-BZsXR24w.js";
7
- import { t as ResolvePlugins } from "../../util-D7vTp-Ia.js";
7
+ import { t as ResolvePlugins } from "../../util-CaBjK5m2.js";
8
8
  import { ProcessorOptions } from "@mdx-js/mdx";
9
9
 
10
10
  //#region src/content/mdx/preset-runtime.d.ts
@@ -1,2 +1,2 @@
1
- import { n as defineI18n, t as I18nConfig } from "../index-DaiDEfiL.js";
2
- export { I18nConfig, defineI18n };
1
+ import { a as TranslationPreset, c as TranslationsAPIExtension, d as renderTranslation, i as TranslationObject, l as defineI18n, n as I18nConfig, o as TranslationValue, r as SingularTranslationsAPI, s as TranslationsAPI, t as I18nAPI, u as defineTranslations } from "../index-YTOeewZk.js";
2
+ export { I18nAPI, I18nConfig, SingularTranslationsAPI, TranslationObject, TranslationPreset, TranslationValue, TranslationsAPI, TranslationsAPIExtension, defineI18n, defineTranslations, renderTranslation };
@@ -1,6 +1,59 @@
1
1
  //#region src/i18n/index.ts
2
2
  function defineI18n(config) {
3
- return config;
3
+ return {
4
+ ...config,
5
+ translations() {
6
+ const translations = {};
7
+ for (const lang of config.languages) translations[lang] = {};
8
+ return {
9
+ config,
10
+ $inferLanguages: void 0,
11
+ $inferNamespaces: void 0,
12
+ get(lang) {
13
+ return translations[lang];
14
+ },
15
+ preset(lang, preset) {
16
+ const t = translations[lang];
17
+ for (const [namespace, obj] of Object.entries(preset.value)) if (t[namespace]) Object.assign(t[namespace], obj);
18
+ return this;
19
+ },
20
+ add(namespace, overrides) {
21
+ for (const [lang, values] of Object.entries(overrides)) Object.assign(translations[lang][namespace], values);
22
+ return this;
23
+ },
24
+ extend({ namespace, defaultValue }) {
25
+ for (const lang of config.languages) translations[lang][namespace] = { ...defaultValue };
26
+ return this;
27
+ }
28
+ };
29
+ }
30
+ };
31
+ }
32
+ /** create translations API without i18n */
33
+ function defineTranslations() {
34
+ const translations = {};
35
+ return {
36
+ $inferNamespaces: void 0,
37
+ get() {
38
+ return translations;
39
+ },
40
+ preset(preset) {
41
+ for (const [namespace, obj] of Object.entries(preset.value)) if (translations[namespace]) Object.assign(translations[namespace], obj);
42
+ return this;
43
+ },
44
+ add(namespace, overrides) {
45
+ Object.assign(translations[namespace], overrides);
46
+ return this;
47
+ },
48
+ extend({ namespace, defaultValue }) {
49
+ translations[namespace] = { ...defaultValue };
50
+ return this;
51
+ }
52
+ };
53
+ }
54
+ function renderTranslation(label, params) {
55
+ if (params) for (const k in params) label = label.replaceAll(`{${k}}`, params[k]);
56
+ return label;
4
57
  }
5
58
  //#endregion
6
- export { defineI18n };
59
+ export { defineI18n, defineTranslations, renderTranslation };
@@ -1,4 +1,4 @@
1
- import { t as I18nConfig } from "../index-DaiDEfiL.js";
1
+ import { n as I18nConfig } from "../index-YTOeewZk.js";
2
2
  import { NextProxy } from "next/server.js";
3
3
  import { NextURL } from "next/dist/server/web/next-url.js";
4
4
 
@@ -1,6 +1,6 @@
1
1
  import { t as getNegotiator } from "../negotiation-CvOwibYZ.js";
2
2
  import { NextResponse } from "next/server.js";
3
- //#region ../../node_modules/.pnpm/@formatjs+fast-memoize@3.1.4/node_modules/@formatjs/fast-memoize/index.js
3
+ //#region ../../node_modules/.pnpm/@formatjs+fast-memoize@3.1.5/node_modules/@formatjs/fast-memoize/index.js
4
4
  function memoize(fn, options) {
5
5
  const cache = options && options.cache ? options.cache : cacheDefault;
6
6
  const serializer = options && options.serializer ? options.serializer : serializerDefault;
@@ -56,7 +56,7 @@ const cacheDefault = { create: function create() {
56
56
  return new ObjectWithoutPrototypeCache();
57
57
  } };
58
58
  //#endregion
59
- //#region ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.8.6/node_modules/@formatjs/intl-localematcher/index.js
59
+ //#region ../../node_modules/.pnpm/@formatjs+intl-localematcher@0.8.8/node_modules/@formatjs/intl-localematcher/index.js
60
60
  /**
61
61
  * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
62
62
  * @param locales
@@ -1,7 +1,8 @@
1
1
  import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-Cob-Q8-8.js";
2
2
  import { t as Awaitable } from "./types-DpbpliNk.js";
3
- import { t as I18nConfig } from "./index-DaiDEfiL.js";
4
- import { n as SerializedPageTree } from "./index-5SWg3Kgu2.js";
3
+ import { i as StructuredData } from "./remark-structure-C2-K9_ko.js";
4
+ import { n as I18nConfig } from "./index-YTOeewZk.js";
5
+ import { n as SerializedPageTree } from "./index-D2f_P1Zo.js";
5
6
  import { ReactNode } from "react";
6
7
 
7
8
  //#region src/source/storage/file-system.d.ts
@@ -54,15 +55,13 @@ interface ContentStoragePageFile<Type extends string | undefined = string | unde
54
55
  //#endregion
55
56
  //#region src/source/page-tree/builder.d.ts
56
57
  interface PageTreeBuilderContext<S extends ContentStorage = ContentStorage> {
57
- idPrefix: string;
58
- noRef: boolean;
59
58
  transformers: PageTreeTransformer<S>[];
60
59
  builder: PageTreeBuilder;
61
60
  storage: S;
62
- getUrl: ResolvedLoaderConfig['url'];
63
61
  storages?: Record<string, S>;
64
62
  locale?: string;
65
63
  custom?: Record<string, unknown>;
64
+ options: PageTreeOptions<S>;
66
65
  }
67
66
  interface PageTreeTransformer<S extends ContentStorage = ContentStorage> {
68
67
  file?: (this: PageTreeBuilderContext<S>, node: Item, filePath?: string) => Item;
@@ -92,35 +91,15 @@ interface PageTreeOptions<S extends ContentStorage = ContentStorage> {
92
91
  transformers?: PageTreeTransformer<S>[];
93
92
  /** custom context */
94
93
  context?: Record<string, unknown>;
94
+ /** customize the default sorting behaviour (`localeCompare`) */
95
+ sort?: {
96
+ /** @default 'path' */by?: 'name' | 'path';
97
+ locales?: Intl.LocalesArgument;
98
+ options?: Intl.CollatorOptions;
99
+ };
95
100
  }
96
- declare class PageTreeBuilder {
97
- private readonly flattenPathToFullPath;
98
- private readonly transformers;
99
- /** virtual file path -> output page tree node (if cached) */
100
- private readonly pathToNode;
101
- /** unfinished nodes */
102
- private readonly unfinished;
103
- private readonly ownerMap;
104
- private _nextId;
105
- /** passed as additional information to transformers */
106
- private readonly ctx;
107
- private readonly storage;
108
- constructor(input: ContentStorage | [locale: string, storages: Record<string, ContentStorage>], options: PageTreeOptions);
101
+ interface PageTreeBuilder {
109
102
  resolveFlattenPath(name: string, format: string): string;
110
- /**
111
- * try to register as the owner of `node`.
112
- *
113
- * when a node is referenced by multiple folders, this determines which folder they should belong to.
114
- *
115
- * @returns whether the owner owns the node.
116
- */
117
- private own;
118
- private transferOwner;
119
- private generateId;
120
- buildPaths(paths: string[], filter?: (file: string) => boolean, reversed?: boolean): Node[];
121
- private resolveFolderItem;
122
- folder(folderPath: string): Folder | undefined;
123
- file(path: string): Item | undefined;
124
103
  root(id?: string, path?: string): Root;
125
104
  }
126
105
  //#endregion
@@ -358,6 +337,7 @@ interface PageData {
358
337
  icon?: string | undefined;
359
338
  title?: string;
360
339
  description?: string | undefined;
340
+ structuredData?: StructuredData | (() => Awaitable<StructuredData>);
361
341
  }
362
342
  type VirtualFile<Config extends SourceConfig = SourceConfig> = VirtualPage<Config['pageData']> | VirtualMeta<Config['metaData']>;
363
343
  interface BaseVirtualFile {
@@ -424,7 +404,7 @@ declare function update<Config extends SourceConfig>(source: StaticSource<Config
424
404
  declare function isStaticSource(s: object): s is StaticSource;
425
405
  declare function isDynamicSource(s: object): s is DynamicSource;
426
406
  declare namespace path_d_exports {
427
- export { basename, dirname, extname, joinPath, slash, splitPath };
407
+ export { basename, dirname, extname, joinPath, normalize, slash, splitPath };
428
408
  }
429
409
  declare function basename(path: string, ext?: string): string;
430
410
  declare function extname(path: string): string;
@@ -446,6 +426,14 @@ declare function splitPath(path: string): string[];
446
426
  */
447
427
  declare function joinPath(...paths: string[]): string;
448
428
  declare function slash(path: string): string;
429
+ /**
430
+ * Convert (relative) file path to virtual file path.
431
+ *
432
+ * @param path - Relative path
433
+ * @returns Normalized path, with no trailing/leading slashes
434
+ * @throws Throws error if path starts with `./` or `../`
435
+ */
436
+ declare function normalize(path: string): string;
449
437
  //#endregion
450
438
  //#region src/source/llms.d.ts
451
439
  interface Context {
@@ -0,0 +1,85 @@
1
+ //#region src/i18n/index.d.ts
2
+ interface I18nConfig<Languages extends string = string> {
3
+ /**
4
+ * Supported locale codes.
5
+ *
6
+ * A page tree will be built for each language.
7
+ */
8
+ languages: Languages[];
9
+ /**
10
+ * Default locale if not specified
11
+ */
12
+ defaultLanguage: NoInfer<Languages>;
13
+ /**
14
+ * Don't show the locale prefix on URL.
15
+ *
16
+ * - `always`: Always hide the prefix
17
+ * - `default-locale`: Only hide the default locale
18
+ * - `never`: Never hide the prefix
19
+ *
20
+ * This API uses `NextResponse.rewrite`.
21
+ *
22
+ * @defaultValue 'never'
23
+ */
24
+ hideLocale?: 'always' | 'default-locale' | 'never';
25
+ /**
26
+ * Used by `loader()`, specify the way to parse i18n file structure.
27
+ *
28
+ * @defaultValue 'dot'
29
+ */
30
+ parser?: 'dot' | 'dir' | 'none';
31
+ /**
32
+ * the fallback language when the page has no translations available for a given locale.
33
+ *
34
+ * Default to `defaultLanguage`, no fallback when set to `null`.
35
+ */
36
+ fallbackLanguage?: NoInfer<Languages> | null;
37
+ }
38
+ interface I18nAPI<Languages extends string = string> extends I18nConfig<Languages> {
39
+ translations: () => TranslationsAPI<Languages, Record<never, TranslationObject>>;
40
+ }
41
+ declare function defineI18n<const Languages extends string>(config: I18nConfig<Languages>): I18nAPI<Languages>;
42
+ type TranslationObject = Record<string, TranslationValue>;
43
+ type TranslationValue<Params extends string = string> = string & {
44
+ _params?: Params;
45
+ };
46
+ type TranslationPreset<Namespaces extends Record<string, TranslationObject> = Record<string, TranslationObject>> = {
47
+ name: string;
48
+ value: Partial<Namespaces>;
49
+ };
50
+ interface TranslationsAPIExtension<Namespace extends string = string, Obj extends TranslationObject = TranslationObject> {
51
+ namespace: Namespace;
52
+ defaultValue: Obj;
53
+ }
54
+ interface TranslationsAPI<Languages extends string = string, Namespaces extends Record<string, TranslationObject> = Record<string, TranslationObject>> {
55
+ /** for type inference only, always `undefined` in runtime */
56
+ $inferLanguages: Languages;
57
+ /** for type inference only, always `undefined` in runtime */
58
+ $inferNamespaces: Namespaces;
59
+ config: I18nConfig<Languages>;
60
+ get: {
61
+ (lang: Languages): Namespaces;
62
+ (lang: string): Namespaces | undefined;
63
+ };
64
+ extend: <N extends string, Obj extends TranslationObject>(extension: TranslationsAPIExtension<N, Obj>) => TranslationsAPI<Languages, Namespaces & { [K in N]: Obj }>;
65
+ /** add translations */
66
+ add: <N extends keyof Namespaces>(namespace: N, overrides: { [Lang in Languages]?: Partial<Namespaces[N]> }) => TranslationsAPI<Languages, Namespaces>;
67
+ /** add language pack, you should call `extend()` first before adding a language preset */
68
+ preset: (lang: Languages, preset: TranslationPreset<Namespaces>) => TranslationsAPI<Languages, Namespaces>;
69
+ }
70
+ interface SingularTranslationsAPI<Namespaces extends Record<string, TranslationObject> = Record<string, TranslationObject>> {
71
+ /** for type inference only, always `undefined` in runtime */
72
+ $inferNamespaces: Namespaces;
73
+ get: () => Namespaces;
74
+ extend: <N extends string, Obj extends TranslationObject>(extension: TranslationsAPIExtension<N, Obj>) => SingularTranslationsAPI<Namespaces & { [K in N]: Obj }>;
75
+ /** add translations */
76
+ add: <N extends keyof Namespaces>(namespace: N, overrides: Partial<Namespaces[N]>) => SingularTranslationsAPI<Namespaces>;
77
+ /** add language pack, you should call `extend()` first before adding a language preset */
78
+ preset: (preset: TranslationPreset<Namespaces>) => SingularTranslationsAPI<Namespaces>;
79
+ }
80
+ /** create translations API without i18n */
81
+ declare function defineTranslations(): SingularTranslationsAPI<Record<never, TranslationObject>>;
82
+ declare function renderTranslation(v: TranslationValue<never>): string;
83
+ declare function renderTranslation<Params extends string>(v: TranslationValue<Params>, params: Record<Params, string>): string;
84
+ //#endregion
85
+ export { TranslationPreset as a, TranslationsAPIExtension as c, renderTranslation as d, TranslationObject as i, defineI18n as l, I18nConfig as n, TranslationValue as o, SingularTranslationsAPI as r, TranslationsAPI as s, I18nAPI as t, defineTranslations as u };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,6 +1,6 @@
1
1
  import { t as normalizeUrl } from "./normalize-url-J3kqKlu4.js";
2
2
  import { c as visit } from "./utils-BFW0mEx9.js";
3
- import { i as joinPath, n as dirname, o as slash, r as extname, s as splitPath, t as basename } from "./path-B4h_WlT8.js";
3
+ import { a as normalize, i as joinPath, n as dirname, r as extname, t as basename } from "./path-CPgAF5cw.js";
4
4
  import { slugsPlugin } from "./source/plugins/slugs.js";
5
5
  import { t as iconPlugin } from "./icon-BbWo08Fw.js";
6
6
  import path from "node:path";
@@ -164,7 +164,7 @@ function createContentStorageBuilder(loaderConfig) {
164
164
  if (inputFile.type === "page") file = {
165
165
  format: "page",
166
166
  type,
167
- path: normalizePath(inputFile.path),
167
+ path: normalize(inputFile.path),
168
168
  slugs: inputFile.slugs,
169
169
  data: inputFile.data,
170
170
  absolutePath: inputFile.absolutePath
@@ -172,7 +172,7 @@ function createContentStorageBuilder(loaderConfig) {
172
172
  else file = {
173
173
  format: "meta",
174
174
  type,
175
- path: normalizePath(inputFile.path),
175
+ path: normalize(inputFile.path),
176
176
  absolutePath: inputFile.absolutePath,
177
177
  data: inputFile.data
178
178
  };
@@ -208,16 +208,6 @@ function createContentStorageBuilder(loaderConfig) {
208
208
  }
209
209
  };
210
210
  }
211
- /**
212
- * @param path - Relative path
213
- * @returns Normalized path, with no trailing/leading slashes
214
- * @throws Throws error if path starts with `./` or `../`
215
- */
216
- function normalizePath(path) {
217
- const segments = splitPath(slash(path));
218
- if (segments[0] === "." || segments[0] === "..") throw new Error("It must not start with './' or '../'");
219
- return segments.join("/");
220
- }
221
211
  function pushMapList(map, k, v) {
222
212
  let list = map.get(k);
223
213
  if (!list) {
@@ -242,11 +232,9 @@ function transformerFallback() {
242
232
  if (addedFiles.has(file)) continue;
243
233
  isolatedStorage.write(file, this.storage.read(file));
244
234
  }
245
- root.fallback = new PageTreeBuilder(isolatedStorage, {
246
- idPrefix: this.idPrefix ? `fallback:${this.idPrefix}` : "fallback",
247
- url: this.getUrl,
248
- noRef: this.noRef,
249
- transformers: this.transformers,
235
+ root.fallback = createPageTreeBuilder(isolatedStorage, {
236
+ ...this.options,
237
+ idPrefix: this.options.idPrefix ? `fallback:${this.options.idPrefix}` : "fallback",
250
238
  generateFallback: false,
251
239
  context: {
252
240
  ...this.custom,
@@ -277,40 +265,50 @@ const rest = "...";
277
265
  const restReversed = "z...a";
278
266
  const extractPrefix = "...";
279
267
  const excludePrefix = "!";
280
- var PageTreeBuilder = class {
281
- constructor(input, options) {
282
- this.flattenPathToFullPath = /* @__PURE__ */ new Map();
283
- this.transformers = [];
284
- this.pathToNode = /* @__PURE__ */ new Map();
285
- this.unfinished = /* @__PURE__ */ new WeakSet();
286
- this.ownerMap = /* @__PURE__ */ new Map();
287
- this._nextId = 0;
288
- const { transformers, url, context, generateFallback = true, idPrefix = "", noRef = false } = options;
289
- if (transformers) this.transformers.push(...transformers);
290
- if (generateFallback) this.transformers.push(transformerFallback());
291
- this.ctx = {
292
- builder: this,
293
- idPrefix,
294
- getUrl: url,
295
- storage: void 0,
296
- noRef,
297
- transformers: this.transformers,
298
- custom: context
268
+ const SymbolUnfinished = Symbol("unfinished");
269
+ const SymbolName = Symbol("name");
270
+ const SymbolOwner = Symbol("owner");
271
+ function createPageTreeBuilder(input, options) {
272
+ const flattenPathToFullPath = /* @__PURE__ */ new Map();
273
+ const transformers = [];
274
+ /** virtual file path -> output page tree node (if cached) */
275
+ const pathToNode = /* @__PURE__ */ new Map();
276
+ let _nextId = 0;
277
+ const { noRef = false, idPrefix, url: getUrl, generateFallback = true, sort: { by: sortBy = "path", locales: sortLocales, options: sortOptions } = {} } = options;
278
+ /** passed as additional information to transformers */
279
+ let ctx;
280
+ if (options.transformers) transformers.push(...options.transformers);
281
+ if (generateFallback) transformers.push(transformerFallback());
282
+ if (Array.isArray(input)) {
283
+ const [locale, storages] = input;
284
+ ctx = {
285
+ get builder() {
286
+ return builder;
287
+ },
288
+ storage: storages[locale],
289
+ storages,
290
+ locale,
291
+ transformers,
292
+ custom: options.context,
293
+ options
299
294
  };
300
- if (Array.isArray(input)) {
301
- const [locale, storages] = input;
302
- this.ctx.storage = this.storage = storages[locale];
303
- this.ctx.locale = locale;
304
- this.ctx.storages = storages;
305
- } else this.ctx.storage = this.storage = input;
306
- for (const file of this.storage.getFiles()) {
307
- const content = this.storage.read(file);
308
- const flattenPath = file.substring(0, file.length - extname(file).length);
309
- this.flattenPathToFullPath.set(flattenPath + "." + content.format, file);
310
- }
295
+ } else ctx = {
296
+ get builder() {
297
+ return builder;
298
+ },
299
+ storage: input,
300
+ transformers,
301
+ custom: options.context,
302
+ options
303
+ };
304
+ const { storage, locale } = ctx;
305
+ for (const file of storage.getFiles()) {
306
+ const content = storage.read(file);
307
+ const flattenPath = file.substring(0, file.length - extname(file).length);
308
+ flattenPathToFullPath.set(flattenPath + "." + content.format, file);
311
309
  }
312
- resolveFlattenPath(name, format) {
313
- return this.flattenPathToFullPath.get(name + "." + format) ?? name;
310
+ function resolveFlattenPath(name, format) {
311
+ return flattenPathToFullPath.get(name + "." + format) ?? name;
314
312
  }
315
313
  /**
316
314
  * try to register as the owner of `node`.
@@ -319,14 +317,14 @@ var PageTreeBuilder = class {
319
317
  *
320
318
  * @returns whether the owner owns the node.
321
319
  */
322
- own(ownerPath, node, priority) {
323
- if (this.unfinished.has(node)) return false;
324
- const existing = this.ownerMap.get(node);
320
+ function own(ownerPath, node, priority) {
321
+ if (node[SymbolUnfinished]) return false;
322
+ const existing = node[SymbolOwner];
325
323
  if (!existing) {
326
- this.ownerMap.set(node, {
324
+ node[SymbolOwner] = {
327
325
  owner: ownerPath,
328
326
  priority
329
- });
327
+ };
330
328
  return true;
331
329
  }
332
330
  if (existing.owner === ownerPath) {
@@ -334,7 +332,7 @@ var PageTreeBuilder = class {
334
332
  return true;
335
333
  }
336
334
  if (existing.priority >= priority) return false;
337
- const folder = this.pathToNode.get(existing.owner);
335
+ const folder = pathToNode.get(existing.owner);
338
336
  if (folder && folder.type === "folder") if (folder.index === node) delete folder.index;
339
337
  else {
340
338
  const idx = folder.children.indexOf(node);
@@ -344,35 +342,43 @@ var PageTreeBuilder = class {
344
342
  existing.priority = priority;
345
343
  return true;
346
344
  }
347
- transferOwner(ownerPath, node) {
348
- const existing = this.ownerMap.get(node);
345
+ function transferOwner(ownerPath, node) {
346
+ const existing = node[SymbolOwner];
349
347
  if (existing) existing.owner = ownerPath;
350
348
  }
351
- generateId(localId = `_${this._nextId++}`) {
349
+ function generateId(localId = `_${_nextId++}`) {
352
350
  let id = localId;
353
- if (this.ctx.locale) id = `${this.ctx.locale}:${id}`;
354
- if (this.ctx.idPrefix) id = `${this.ctx.idPrefix}:${id}`;
351
+ if (locale) id = `${locale}:${id}`;
352
+ if (idPrefix) id = `${idPrefix}:${id}`;
355
353
  return id;
356
354
  }
357
- buildPaths(paths, filter, reversed = false) {
358
- const items = [];
359
- const folders = [];
360
- const sortedPaths = paths.sort((a, b) => reversed ? b.localeCompare(a) : a.localeCompare(b));
361
- for (const path of sortedPaths) {
355
+ function buildPaths(paths, filter, reversed = false) {
356
+ const nodeToPath = /* @__PURE__ */ new Map();
357
+ let indexNode;
358
+ for (const path of paths) {
362
359
  if (filter && !filter(path)) continue;
363
- const fileNode = this.file(path);
360
+ const fileNode = buildFile(path);
364
361
  if (fileNode) {
365
- if (basename(path, extname(path)) === "index") items.unshift(fileNode);
366
- else items.push(fileNode);
362
+ nodeToPath.set(fileNode, path);
363
+ if (!indexNode && basename(path, extname(path)) === "index") indexNode = fileNode;
367
364
  continue;
368
365
  }
369
- const dirNode = this.folder(path);
370
- if (dirNode) folders.push(dirNode);
366
+ const dirNode = buildFolder(path);
367
+ if (dirNode) nodeToPath.set(dirNode, path);
371
368
  }
372
- items.push(...folders);
373
- return items;
369
+ const factor = reversed ? -1 : 1;
370
+ const useName = sortBy === "name";
371
+ return Array.from(nodeToPath.keys()).sort((a, b) => {
372
+ if (a === indexNode) return -100;
373
+ if (b === indexNode) return 100;
374
+ const aT = useName && a[SymbolName] || nodeToPath.get(a);
375
+ const bT = useName && b[SymbolName] || nodeToPath.get(b);
376
+ const aK = a.type === "folder" ? 10 : 0;
377
+ const bK = b.type === "folder" ? 10 : 0;
378
+ return factor * (aT.localeCompare(bT, sortLocales, sortOptions) + (aK - bK));
379
+ });
374
380
  }
375
- resolveFolderItem(folderPath, item, outputArray, excludedPaths) {
381
+ function resolveFolderItem(folderPath, item, outputArray, excludedPaths) {
376
382
  if (item === rest || item === restReversed) {
377
383
  outputArray.push(item);
378
384
  return;
@@ -380,14 +386,14 @@ var PageTreeBuilder = class {
380
386
  let match = separator.exec(item);
381
387
  if (match?.groups) {
382
388
  let node = {
383
- $id: this.generateId(),
389
+ $id: generateId(),
384
390
  type: "separator",
385
391
  icon: match.groups.icon,
386
392
  name: match.groups.name
387
393
  };
388
- for (const transformer of this.transformers) {
394
+ for (const transformer of transformers) {
389
395
  if (!transformer.separator) continue;
390
- node = transformer.separator.call(this.ctx, node);
396
+ node = transformer.separator.call(ctx, node);
391
397
  }
392
398
  outputArray.push(node);
393
399
  return;
@@ -396,16 +402,16 @@ var PageTreeBuilder = class {
396
402
  if (match?.groups) {
397
403
  const { icon, url, name, external } = match.groups;
398
404
  let node = {
399
- $id: this.generateId(),
405
+ $id: generateId(),
400
406
  type: "page",
401
407
  icon,
402
408
  name,
403
409
  url
404
410
  };
405
411
  if (external) node.external = true;
406
- for (const transformer of this.transformers) {
412
+ for (const transformer of transformers) {
407
413
  if (!transformer.file) continue;
408
- node = transformer.file.call(this.ctx, node);
414
+ node = transformer.file.call(ctx, node);
409
415
  }
410
416
  outputArray.push(node);
411
417
  return;
@@ -413,42 +419,42 @@ var PageTreeBuilder = class {
413
419
  if (item.startsWith(excludePrefix)) {
414
420
  const path = joinPath(folderPath, item.slice(1));
415
421
  excludedPaths.add(path);
416
- excludedPaths.add(this.resolveFlattenPath(path, "page"));
422
+ excludedPaths.add(resolveFlattenPath(path, "page"));
417
423
  return;
418
424
  }
419
425
  if (item.startsWith(extractPrefix)) {
420
426
  const path = joinPath(folderPath, item.slice(3));
421
- const node = this.folder(path);
427
+ const node = buildFolder(path);
422
428
  if (!node) return;
423
429
  const children = node.index ? [node.index, ...node.children] : node.children;
424
- if (this.own(folderPath, node, 2)) {
430
+ if (own(folderPath, node, 2)) {
425
431
  for (const child of children) {
426
- this.transferOwner(folderPath, child);
432
+ transferOwner(folderPath, child);
427
433
  outputArray.push(child);
428
434
  }
429
435
  excludedPaths.add(path);
430
- } else for (const child of children) if (this.own(folderPath, child, 2)) outputArray.push(child);
436
+ } else for (const child of children) if (own(folderPath, child, 2)) outputArray.push(child);
431
437
  return;
432
438
  }
433
439
  let path = joinPath(folderPath, item);
434
- let node = this.folder(path);
440
+ let node = buildFolder(path);
435
441
  if (!node) {
436
- path = this.resolveFlattenPath(path, "page");
437
- node = this.file(path);
442
+ path = resolveFlattenPath(path, "page");
443
+ node = buildFile(path);
438
444
  }
439
- if (!node || !this.own(folderPath, node, 2)) return;
445
+ if (!node || !own(folderPath, node, 2)) return;
440
446
  outputArray.push(node);
441
447
  excludedPaths.add(path);
442
448
  }
443
- folder(folderPath) {
444
- const cached = this.pathToNode.get(folderPath);
449
+ function buildFolder(folderPath) {
450
+ const cached = pathToNode.get(folderPath);
445
451
  if (cached) return cached;
446
- const files = this.storage.readDir(folderPath);
452
+ const files = storage.readDir(folderPath);
447
453
  if (!files) return;
448
454
  const isGlobalRoot = folderPath === "";
449
- const metaPath = this.resolveFlattenPath(joinPath(folderPath, "meta"), "meta");
450
- const indexPath = this.resolveFlattenPath(joinPath(folderPath, "index"), "page");
451
- let meta = this.storage.read(metaPath);
455
+ const metaPath = resolveFlattenPath(joinPath(folderPath, "meta"), "meta");
456
+ const indexPath = resolveFlattenPath(joinPath(folderPath, "index"), "page");
457
+ let meta = storage.read(metaPath);
452
458
  if (meta && meta.format !== "meta") meta = void 0;
453
459
  const metadata = meta?.data ?? {};
454
460
  let node = {
@@ -459,19 +465,19 @@ var PageTreeBuilder = class {
459
465
  description: metadata.description,
460
466
  collapsible: metadata.collapsible,
461
467
  children: [],
462
- $id: this.generateId(folderPath),
463
- $ref: !this.ctx.noRef && meta ? metaPath : void 0
468
+ $id: generateId(folderPath),
469
+ $ref: !noRef && meta ? metaPath : void 0,
470
+ [SymbolUnfinished]: true
464
471
  };
465
- this.pathToNode.set(folderPath, node);
466
- this.unfinished.add(node);
472
+ pathToNode.set(folderPath, node);
467
473
  if (!(metadata.root ?? isGlobalRoot)) {
468
- const file = this.file(indexPath);
469
- if (file && this.own(folderPath, file, 0)) node.index = file;
474
+ const fileNode = buildFile(indexPath);
475
+ if (fileNode && own(folderPath, fileNode, 0)) node.index = fileNode;
470
476
  }
471
477
  if (metadata.pages) {
472
478
  const outputArray = [];
473
479
  const excludedPaths = /* @__PURE__ */ new Set();
474
- for (const item of metadata.pages) this.resolveFolderItem(folderPath, item, outputArray, excludedPaths);
480
+ for (const item of metadata.pages) resolveFolderItem(folderPath, item, outputArray, excludedPaths);
475
481
  if (excludedPaths.has(indexPath)) delete node.index;
476
482
  else if (node.index) excludedPaths.add(indexPath);
477
483
  for (const item of outputArray) {
@@ -479,63 +485,73 @@ var PageTreeBuilder = class {
479
485
  node.children.push(item);
480
486
  continue;
481
487
  }
482
- const resolvedItem = this.buildPaths(files, (file) => !excludedPaths.has(file), item === restReversed);
483
- for (const child of resolvedItem) if (this.own(folderPath, child, 0)) node.children.push(child);
488
+ const resolvedItem = buildPaths(files, (file) => !excludedPaths.has(file), item === restReversed);
489
+ for (const child of resolvedItem) if (own(folderPath, child, 0)) node.children.push(child);
484
490
  }
485
- } else for (const item of this.buildPaths(files, node.index ? (file) => file !== indexPath : void 0)) if (this.own(folderPath, item, 0)) node.children.push(item);
491
+ } else for (const item of buildPaths(files, node.index ? (file) => file !== indexPath : void 0)) if (own(folderPath, item, 0)) node.children.push(item);
486
492
  node.icon = metadata.icon ?? node.index?.icon;
487
493
  node.name = metadata.title ?? node.index?.name;
488
- this.unfinished.delete(node);
494
+ node[SymbolName] = metadata.title ?? node.index?.[SymbolName];
489
495
  if (!node.name) {
490
496
  const folderName = basename(folderPath);
491
497
  node.name = pathToName(group.exec(folderName)?.[1] ?? folderName);
492
498
  }
493
- for (const transformer of this.transformers) {
499
+ for (const transformer of transformers) {
494
500
  if (!transformer.folder) continue;
495
- node = transformer.folder.call(this.ctx, node, folderPath, meta ? metaPath : void 0);
501
+ node = transformer.folder.call(ctx, node, folderPath, meta ? metaPath : void 0);
496
502
  }
497
- this.pathToNode.set(folderPath, node);
503
+ pathToNode.set(folderPath, node);
504
+ delete node[SymbolUnfinished];
498
505
  return node;
499
506
  }
500
- file(path) {
501
- const cached = this.pathToNode.get(path);
507
+ function buildFile(path) {
508
+ const cached = pathToNode.get(path);
502
509
  if (cached) return cached;
503
- const page = this.storage.read(path);
510
+ const page = storage.read(path);
504
511
  if (!page || page.format !== "page") return;
505
512
  const { title, description, icon } = page.data;
506
513
  let item = {
507
- $id: this.generateId(path),
514
+ $id: generateId(path),
508
515
  type: "page",
509
516
  name: title ?? pathToName(basename(path, extname(path))),
510
517
  description,
511
518
  icon,
512
- url: this.ctx.getUrl(page.slugs, this.ctx.locale),
513
- $ref: !this.ctx.noRef ? path : void 0
519
+ url: getUrl(page.slugs, ctx.locale),
520
+ $ref: !noRef ? path : void 0,
521
+ [SymbolName]: title
514
522
  };
515
- for (const transformer of this.transformers) {
523
+ for (const transformer of transformers) {
516
524
  if (!transformer.file) continue;
517
- item = transformer.file.call(this.ctx, item, path);
525
+ item = transformer.file.call(ctx, item, path);
518
526
  }
519
- this.pathToNode.set(path, item);
527
+ pathToNode.set(path, item);
520
528
  return item;
521
529
  }
522
- root(id = "root", path = "") {
523
- const folder = this.folder(path);
524
- let root = {
525
- type: "root",
526
- $ref: folder?.$ref,
527
- $id: this.generateId(id),
528
- name: folder?.name || "Docs",
529
- description: folder?.description,
530
- children: folder ? folder.children : []
531
- };
532
- for (const transformer of this.transformers) {
533
- if (!transformer.root) continue;
534
- root = transformer.root.call(this.ctx, root);
530
+ const builder = {
531
+ resolveFlattenPath,
532
+ root(id = "root", path = "") {
533
+ const node = buildFolder(path);
534
+ let root = {
535
+ type: "root",
536
+ $ref: node?.$ref,
537
+ $id: generateId(id),
538
+ name: node?.name || "Docs",
539
+ description: node?.description,
540
+ children: node ? node.children : []
541
+ };
542
+ for (const transformer of transformers) {
543
+ if (!transformer.root) continue;
544
+ root = transformer.root.call(ctx, root);
545
+ }
546
+ for (const node of pathToNode.values()) {
547
+ delete node[SymbolName];
548
+ delete node[SymbolOwner];
549
+ }
550
+ return root;
535
551
  }
536
- return root;
537
- }
538
- };
552
+ };
553
+ return builder;
554
+ }
539
555
  /**
540
556
  * Get item name from file name
541
557
  *
@@ -633,10 +649,10 @@ function loader(...args) {
633
649
  ...pageTreeConfig,
634
650
  transformers
635
651
  };
636
- if (storage instanceof FileSystem) return pageTrees = new PageTreeBuilder(storage, options).root();
652
+ if (storage instanceof FileSystem) return pageTrees = createPageTreeBuilder(storage, options).root();
637
653
  else {
638
654
  const out = {};
639
- for (const locale in storage) out[locale] = new PageTreeBuilder([locale, storage], options).root();
655
+ for (const locale in storage) out[locale] = createPageTreeBuilder([locale, storage], options).root();
640
656
  return pageTrees = out;
641
657
  }
642
658
  }
@@ -15,4 +15,4 @@ import { a as remarkMdxFiles, r as RemarkMdxFilesOptions } from "../remark-mdx-f
15
15
  import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-CQU6XhYd.js";
16
16
  import { n as RemarkFeedbackBlockOptions, r as remarkFeedbackBlock, t as FeedbackBlockProps } from "../remark-feedback-block-CF-ABTc-.js";
17
17
  import { t as LLMsOptions } from "../remark-llms-CC6AjEDH.js";
18
- export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, type LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, Stringifier, StringifyOptions, StructureOptions, StructuredData, defaultStringifier, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
18
+ export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, Stringifier, StringifyOptions, StructureOptions, StructuredData, defaultStringifier, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
@@ -1,3 +1,3 @@
1
1
  import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-Cob-Q8-8.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-nW94Fpi3.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-DRvW7IXg.js";
3
3
  export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -5,6 +5,7 @@ var path_exports = /* @__PURE__ */ __exportAll({
5
5
  dirname: () => dirname,
6
6
  extname: () => extname,
7
7
  joinPath: () => joinPath,
8
+ normalize: () => normalize,
8
9
  slash: () => slash,
9
10
  splitPath: () => splitPath
10
11
  });
@@ -44,8 +45,7 @@ function splitPath(path) {
44
45
  */
45
46
  function joinPath(...paths) {
46
47
  const out = [];
47
- const parsed = paths.flatMap((path) => path.split("/"));
48
- for (const seg of parsed) switch (seg) {
48
+ for (const path of paths) for (const seg of path.split("/")) switch (seg) {
49
49
  case "..":
50
50
  out.pop();
51
51
  break;
@@ -59,5 +59,17 @@ function slash(path) {
59
59
  if (path.startsWith("\\\\?\\")) return path;
60
60
  return path.replaceAll("\\", "/");
61
61
  }
62
+ /**
63
+ * Convert (relative) file path to virtual file path.
64
+ *
65
+ * @param path - Relative path
66
+ * @returns Normalized path, with no trailing/leading slashes
67
+ * @throws Throws error if path starts with `./` or `../`
68
+ */
69
+ function normalize(path) {
70
+ const segments = path.split(/\/|\\/).filter((v) => v.length > 0);
71
+ if (segments[0] === "." || segments[0] === "..") throw new Error("It must not start with './' or '../'");
72
+ return segments.join("/");
73
+ }
62
74
  //#endregion
63
- export { path_exports as a, joinPath as i, dirname as n, slash as o, extname as r, splitPath as s, basename as t };
75
+ export { normalize as a, joinPath as i, dirname as n, path_exports as o, extname as r, basename as t };
@@ -1,2 +1,2 @@
1
- import { a as sync, i as setIndexSettings, n as DocumentRecord, o as updateDocuments, r as SyncOptions, t as BaseIndex } from "../algolia-BvGetcJs.js";
1
+ import { a as sync, i as setIndexSettings, n as DocumentRecord, o as updateDocuments, r as SyncOptions, t as BaseIndex } from "../algolia-D56Eex2h.js";
2
2
  export { BaseIndex, DocumentRecord, SyncOptions, setIndexSettings, sync, updateDocuments };
@@ -1,2 +1,2 @@
1
- import { m as algoliaClient, p as AlgoliaOptions } from "../../client-Dyup8E6r.js";
1
+ import { m as algoliaClient, p as AlgoliaOptions } from "../../client-D6TKpTxv.js";
2
2
  export { AlgoliaOptions, algoliaClient };
@@ -1,2 +1,2 @@
1
- import { _ as FetchOptions, v as fetchClient } from "../../client-Dyup8E6r.js";
1
+ import { _ as FetchOptions, v as fetchClient } from "../../client-D6TKpTxv.js";
2
2
  export { FetchOptions, fetchClient };
@@ -1,2 +1,2 @@
1
- import { a as flexsearchStaticClient, i as FlexsearchStaticOptions } from "../../client-Dyup8E6r.js";
1
+ import { a as flexsearchStaticClient, i as FlexsearchStaticOptions } from "../../client-D6TKpTxv.js";
2
2
  export { FlexsearchStaticOptions, flexsearchStaticClient };
@@ -1,2 +1,2 @@
1
- import { c as mixedbreadClient, o as MixedbreadOptions, s as SearchMetadata } from "../../client-Dyup8E6r.js";
1
+ import { c as mixedbreadClient, o as MixedbreadOptions, s as SearchMetadata } from "../../client-D6TKpTxv.js";
2
2
  export { MixedbreadOptions, SearchMetadata, mixedbreadClient };
@@ -1,2 +1,2 @@
1
- import { l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client-Dyup8E6r.js";
1
+ import { l as OramaCloudLegacyOptions, u as oramaCloudLegacyClient } from "../../client-D6TKpTxv.js";
2
2
  export { OramaCloudLegacyOptions, oramaCloudLegacyClient };
@@ -1,2 +1,2 @@
1
- import { d as OramaCloudOptions, f as oramaCloudClient } from "../../client-Dyup8E6r.js";
1
+ import { d as OramaCloudOptions, f as oramaCloudClient } from "../../client-D6TKpTxv.js";
2
2
  export { OramaCloudOptions, oramaCloudClient };
@@ -1,2 +1,2 @@
1
- import { g as oramaStaticClient, h as StaticOptions } from "../../client-Dyup8E6r.js";
1
+ import { g as oramaStaticClient, h as StaticOptions } from "../../client-D6TKpTxv.js";
2
2
  export { StaticOptions, oramaStaticClient };
@@ -1,2 +1,2 @@
1
- import { _ as FetchOptions, d as OramaCloudOptions, h as StaticOptions, n as SearchClient, p as AlgoliaOptions, r as useDocsSearch, t as ClientPreset } from "../client-Dyup8E6r.js";
1
+ import { _ as FetchOptions, d as OramaCloudOptions, h as StaticOptions, n as SearchClient, p as AlgoliaOptions, r as useDocsSearch, t as ClientPreset } from "../client-D6TKpTxv.js";
2
2
  export { AlgoliaOptions, ClientPreset, FetchOptions, OramaCloudOptions, SearchClient, StaticOptions, useDocsSearch };
@@ -1,7 +1,7 @@
1
1
  import { t as Awaitable } from "../types-DpbpliNk.js";
2
- import { t as I18nConfig } from "../index-DaiDEfiL.js";
3
- import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-DZLj6URC.js";
4
- import { C as LoaderConfig, T as LoaderOutput } from "../index-DvNKidQF.js";
2
+ import { n as I18nConfig } from "../index-YTOeewZk.js";
3
+ import { m as SharedIndex, n as SearchAPI, t as QueryOptions } from "../server-BmBBtKX6.js";
4
+ import { C as LoaderConfig, T as LoaderOutput } from "../index-CKvjS08M2.js";
5
5
  import { DocumentData, DocumentOptions } from "flexsearch";
6
6
 
7
7
  //#region src/search/server/build-doc.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as createEndpoint } from "../endpoint-CAUHRXte.js";
2
- import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-8RxTPr1J.js";
2
+ import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-CqRdmOMh.js";
3
3
  import { n as search, t as createDocument } from "../utils-CkDkYuX8.js";
4
4
  import Search from "flexsearch";
5
5
  //#region src/search/flexsearch.ts
@@ -1,2 +1,2 @@
1
- import { i as createContentHighlighter, n as ReactSortedResult, r as SortedResult, t as HighlightedText } from "../index-CnkxgKNd.js";
1
+ import { i as createContentHighlighter, n as ReactSortedResult, r as SortedResult, t as HighlightedText } from "../index-Bcms_L7o.js";
2
2
  export { HighlightedText, ReactSortedResult, SortedResult, createContentHighlighter };
@@ -1,5 +1,5 @@
1
- import { r as SortedResult } from "../index-CnkxgKNd.js";
2
- import { n as SearchAPI } from "../server-DZLj6URC.js";
1
+ import { r as SortedResult } from "../index-Bcms_L7o.js";
2
+ import { n as SearchAPI } from "../server-BmBBtKX6.js";
3
3
  import Mixedbread from "@mixedbread/sdk";
4
4
  import { StoreSearchResponse } from "@mixedbread/sdk/resources/stores";
5
5
 
@@ -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-DZLj6URC.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-BmBBtKX6.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-CAUHRXte.js";
2
- import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-8RxTPr1J.js";
2
+ import { n as buildBreadcrumbs, r as buildIndexDefault, t as buildDocuments } from "../build-doc-CqRdmOMh.js";
3
3
  import { n as searchSimple, t as searchAdvanced } from "../advanced-BCAHgGV0.js";
4
4
  import { create, insertMultiple, save } from "@orama/orama";
5
5
  //#region src/search/orama/_stemmers.ts
@@ -1,8 +1,8 @@
1
1
  import { t as Awaitable } from "./types-DpbpliNk.js";
2
2
  import { i as StructuredData } from "./remark-structure-C2-K9_ko.js";
3
- import { t as I18nConfig } from "./index-DaiDEfiL.js";
4
- import { r as SortedResult } from "./index-CnkxgKNd.js";
5
- import { C as LoaderConfig, T as LoaderOutput } from "./index-DvNKidQF.js";
3
+ import { n as I18nConfig } from "./index-YTOeewZk.js";
4
+ import { r as SortedResult } from "./index-Bcms_L7o.js";
5
+ import { C as LoaderConfig, T as LoaderOutput } from "./index-CKvjS08M2.js";
6
6
  import { Language, Orama, RawData, SearchParams, TypedDocument, create } from "@orama/orama";
7
7
 
8
8
  //#region src/search/orama/create-db.d.ts
@@ -1,2 +1,2 @@
1
- import { i as useFumadocsLoader, n as SerializedPageTree, r as deserializePageTree, t as Serialized } from "../../index-5SWg3Kgu2.js";
1
+ import { i as useFumadocsLoader, n as SerializedPageTree, r as deserializePageTree, t as Serialized } from "../../index-D2f_P1Zo.js";
2
2
  export { Serialized, SerializedPageTree, deserializePageTree, useFumadocsLoader };
@@ -1,2 +1,2 @@
1
- import { b as dynamicLoader, v as DynamicLoader, y as DynamicLoaderConfig } from "../index-DvNKidQF.js";
1
+ import { b as dynamicLoader, v as DynamicLoader, y as DynamicLoaderConfig } from "../index-CKvjS08M2.js";
2
2
  export { DynamicLoader, DynamicLoaderConfig, dynamicLoader };
@@ -1,4 +1,4 @@
1
- import { i as isStaticSource, n as loader, r as isDynamicSource } from "../loader-CeIUqWDI.js";
1
+ import { i as isStaticSource, n as loader, r as isDynamicSource } from "../loader-DWaWaGZg.js";
2
2
  import { cache } from "react";
3
3
  //#region src/source/dynamic.ts
4
4
  function dynamicLoader(input, options) {
@@ -1,2 +1,2 @@
1
- import { A as ResolvedLoaderConfig, B as PageTreeTransformer, C as LoaderConfig, D as LoaderPluginOption, E as LoaderPlugin, H as ContentStorageMetaFile, L as PageTreeBuilder, M as loader, O as Meta, P as getSlugs, R as PageTreeBuilderContext, S as InferPageType, T as LoaderOutput, U as ContentStoragePageFile, V as ContentStorage, W as FileSystem, _ as update, a as MetaData, c as SourceConfig, d as VirtualFile, f as _SourceUpdate_, g as source, h as multiple, i as DynamicSource, j as createGetUrl, k as Page, l as SourceUnion, m as isStaticSource, n as llms, o as PageData, p as isDynamicSource, r as path_d_exports, s as Source, t as LLMsConfig, u as StaticSource, w as LoaderOptions, x as InferMetaType, z as PageTreeOptions } from "../index-DvNKidQF.js";
1
+ import { A as ResolvedLoaderConfig, B as PageTreeTransformer, C as LoaderConfig, D as LoaderPluginOption, E as LoaderPlugin, H as ContentStorageMetaFile, L as PageTreeBuilder, M as loader, O as Meta, P as getSlugs, R as PageTreeBuilderContext, S as InferPageType, T as LoaderOutput, U as ContentStoragePageFile, V as ContentStorage, W as FileSystem, _ as update, a as MetaData, c as SourceConfig, d as VirtualFile, f as _SourceUpdate_, g as source, h as multiple, i as DynamicSource, j as createGetUrl, k as Page, l as SourceUnion, m as isStaticSource, n as llms, o as PageData, p as isDynamicSource, r as path_d_exports, s as Source, t as LLMsConfig, u as StaticSource, w as LoaderOptions, x as InferMetaType, z as PageTreeOptions } from "../index-CKvjS08M2.js";
2
2
  export { ContentStorage, ContentStorageMetaFile, ContentStoragePageFile, DynamicSource, FileSystem, InferMetaType, InferPageType, LLMsConfig, LoaderConfig, LoaderOptions, LoaderOutput, LoaderPlugin, LoaderPluginOption, Meta, MetaData, Page, PageData, PageTreeBuilder, PageTreeBuilderContext, PageTreeOptions, PageTreeTransformer, path_d_exports as PathUtils, ResolvedLoaderConfig, Source, SourceConfig, SourceUnion, StaticSource, VirtualFile, _SourceUpdate_, createGetUrl, getSlugs, isDynamicSource, isStaticSource, llms, loader, multiple, source, update };
@@ -1,5 +1,5 @@
1
- import { a as path_exports } from "../path-B4h_WlT8.js";
2
- import { a as multiple, c as FileSystem, i as isStaticSource, n as loader, o as source, r as isDynamicSource, s as update, t as createGetUrl } from "../loader-CeIUqWDI.js";
1
+ import { o as path_exports } from "../path-CPgAF5cw.js";
2
+ import { a as multiple, c as FileSystem, i as isStaticSource, n as loader, o as source, r as isDynamicSource, s as update, t as createGetUrl } from "../loader-DWaWaGZg.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, getSlugs, isDynamicSource, isStaticSource, llms, loader, multiple, source, update };
@@ -1,2 +1,2 @@
1
- import { n as llms, t as LLMsConfig } from "../index-DvNKidQF.js";
1
+ import { n as llms, t as LLMsConfig } from "../index-CKvjS08M2.js";
2
2
  export { LLMsConfig, llms };
@@ -1,4 +1,4 @@
1
- import { E as LoaderPlugin } from "../../index-DvNKidQF.js";
1
+ import { E as LoaderPlugin } from "../../index-CKvjS08M2.js";
2
2
  import { icons } from "lucide-react";
3
3
 
4
4
  //#region src/source/plugins/lucide-icons.d.ts
@@ -1,2 +1,2 @@
1
- import { F as slugsFromData, I as slugsPlugin, N as SlugFn, P as getSlugs } from "../../index-DvNKidQF.js";
1
+ import { F as slugsFromData, I as slugsPlugin, N as SlugFn, P as getSlugs } from "../../index-CKvjS08M2.js";
2
2
  export { SlugFn, getSlugs, slugsFromData, slugsPlugin };
@@ -1,4 +1,4 @@
1
- import { n as dirname, r as extname, t as basename } from "../../path-B4h_WlT8.js";
1
+ import { n as dirname, r as extname, t as basename } from "../../path-CPgAF5cw.js";
2
2
  //#region src/source/plugins/slugs.ts
3
3
  /**
4
4
  * Generate slugs for pages if missing
@@ -1,5 +1,5 @@
1
1
  import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-Cob-Q8-8.js";
2
- import { E as LoaderPlugin } from "../../index-DvNKidQF.js";
2
+ import { E as LoaderPlugin } from "../../index-CKvjS08M2.js";
3
3
  import { ReactNode } from "react";
4
4
 
5
5
  //#region src/source/plugins/status-badges.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.8.11",
3
+ "version": "16.9.0",
4
4
  "description": "The React.js library for building a documentation website",
5
5
  "keywords": [
6
6
  "Docs",
@@ -114,36 +114,36 @@
114
114
  "vfile": "^6.0.3"
115
115
  },
116
116
  "devDependencies": {
117
- "@formatjs/intl-localematcher": "^0.8.6",
117
+ "@formatjs/intl-localematcher": "^0.8.8",
118
118
  "@mdx-js/mdx": "^3.1.1",
119
- "@mixedbread/sdk": "^0.65.0",
119
+ "@mixedbread/sdk": "0.68.0",
120
120
  "@orama/core": "^1.2.19",
121
121
  "@oramacloud/client": "^2.1.4",
122
122
  "@shikijs/transformers": "^4.0.2",
123
- "@tanstack/react-router": "1.169.2",
123
+ "@tanstack/react-router": "1.170.4",
124
124
  "@types/estree-jsx": "^1.0.5",
125
125
  "@types/hast": "^3.0.4",
126
126
  "@types/js-yaml": "^4.0.9",
127
127
  "@types/mdast": "^4.0.4",
128
128
  "@types/negotiator": "^0.6.4",
129
- "@types/node": "25.6.2",
129
+ "@types/node": "25.8.0",
130
130
  "@types/react": "^19.2.14",
131
131
  "@types/react-dom": "^19.2.3",
132
132
  "algoliasearch": "5.52.1",
133
133
  "flexsearch": "^0.8.212",
134
134
  "image-size": "^2.0.2",
135
- "lucide-react": "^1.14.0",
135
+ "lucide-react": "^1.16.0",
136
136
  "negotiator": "^1.0.0",
137
137
  "next": "16.2.6",
138
138
  "npm-to-yarn": "^3.0.1",
139
139
  "path-to-regexp": "^8.4.2",
140
- "react-router": "^7.15.0",
140
+ "react-router": "7.15.1",
141
141
  "remark-directive": "^4.0.0",
142
142
  "remark-mdx": "^3.1.1",
143
143
  "remove-markdown": "^0.6.4",
144
144
  "tsdown": "0.22.0",
145
145
  "typescript": "^6.0.3",
146
- "waku": "1.0.0-alpha.10",
146
+ "waku": "1.0.0-beta.0",
147
147
  "zod": "^4.4.3",
148
148
  "tsconfig": "0.0.0"
149
149
  },
@@ -224,8 +224,8 @@
224
224
  }
225
225
  },
226
226
  "inlinedDependencies": {
227
- "@formatjs/fast-memoize": "3.1.4",
228
- "@formatjs/intl-localematcher": "0.8.6",
227
+ "@formatjs/fast-memoize": "3.1.5",
228
+ "@formatjs/intl-localematcher": "0.8.8",
229
229
  "@shikijs/transformers": "4.0.2",
230
230
  "image-size": "2.0.2",
231
231
  "negotiator": "1.0.0",
@@ -1,40 +0,0 @@
1
- //#region src/i18n/index.d.ts
2
- interface I18nConfig<Languages extends string = string> {
3
- /**
4
- * Supported locale codes.
5
- *
6
- * A page tree will be built for each language.
7
- */
8
- languages: Languages[];
9
- /**
10
- * Default locale if not specified
11
- */
12
- defaultLanguage: Languages;
13
- /**
14
- * Don't show the locale prefix on URL.
15
- *
16
- * - `always`: Always hide the prefix
17
- * - `default-locale`: Only hide the default locale
18
- * - `never`: Never hide the prefix
19
- *
20
- * This API uses `NextResponse.rewrite`.
21
- *
22
- * @defaultValue 'never'
23
- */
24
- hideLocale?: 'always' | 'default-locale' | 'never';
25
- /**
26
- * Used by `loader()`, specify the way to parse i18n file structure.
27
- *
28
- * @defaultValue 'dot'
29
- */
30
- parser?: 'dot' | 'dir' | 'none';
31
- /**
32
- * the fallback language when the page has no translations available for a given locale.
33
- *
34
- * Default to `defaultLanguage`, no fallback when set to `null`.
35
- */
36
- fallbackLanguage?: Languages | null;
37
- }
38
- declare function defineI18n<Languages extends string>(config: I18nConfig<Languages>): I18nConfig<Languages>;
39
- //#endregion
40
- export { defineI18n as n, I18nConfig as t };
File without changes