fumadocs-mdx 14.0.0 → 14.0.2

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 (77) hide show
  1. package/dist/{build-mdx-6UAK5FF5.js → build-mdx-W3233QBZ.js} +1 -1
  2. package/dist/bun/index.d.ts +7 -1
  3. package/dist/bun/index.js +9 -8
  4. package/dist/{chunk-5YXP7JLN.js → chunk-5OBUOALK.js} +8 -5
  5. package/dist/{chunk-ZY6UZ7NH.js → chunk-6RPNS75C.js} +1 -1
  6. package/dist/{chunk-XHJCLBZ4.js → chunk-ED3ON275.js} +86 -162
  7. package/dist/{chunk-7L2KNF6B.js → chunk-GB4W3YCZ.js} +51 -7
  8. package/dist/{chunk-SLY7WXTX.js → chunk-KOPLIEVQ.js} +5 -6
  9. package/dist/{chunk-OXSRIWQW.js → chunk-LPX7ZO66.js} +4 -3
  10. package/dist/{chunk-SRSRFOVI.js → chunk-OLL7FM7W.js} +3 -3
  11. package/dist/{chunk-5UMZCWKV.js → chunk-Q5OSGLJL.js} +1 -1
  12. package/dist/{chunk-E5DJTSIM.js → chunk-S7KOJHHO.js} +4 -1
  13. package/dist/{chunk-6NISOLQ6.js → chunk-USWQVJWR.js} +1 -1
  14. package/dist/chunk-WBIHDYMN.js +126 -0
  15. package/dist/config/index.d.ts +6 -1
  16. package/dist/config/index.js +1 -1
  17. package/dist/{index-D7JdSMpp.d.cts → core-C3QZSdEx.d.ts} +73 -4
  18. package/dist/{index-BlVBvy-z.d.ts → index-RVIZxMZG.d.ts} +1 -1
  19. package/dist/index.d.ts +56 -3
  20. package/dist/load-from-file-OZ5N7DXU.js +8 -0
  21. package/dist/next/index.cjs +263 -193
  22. package/dist/next/index.d.ts +7 -2
  23. package/dist/next/index.js +12 -10
  24. package/dist/node/loader.js +4 -4
  25. package/dist/plugins/index-file.d.ts +7 -22
  26. package/dist/plugins/index-file.js +2 -2
  27. package/dist/plugins/json-schema.d.ts +7 -1
  28. package/dist/plugins/last-modified.d.ts +15 -2
  29. package/dist/plugins/last-modified.js +43 -6
  30. package/dist/runtime/browser.d.ts +22 -19
  31. package/dist/runtime/browser.js +5 -6
  32. package/dist/runtime/dynamic.d.ts +12 -12
  33. package/dist/runtime/dynamic.js +12 -11
  34. package/dist/runtime/server.d.ts +10 -157
  35. package/dist/runtime/server.js +3 -3
  36. package/dist/runtime/types.d.ts +61 -0
  37. package/dist/runtime/types.js +0 -0
  38. package/dist/vite/index.d.ts +7 -2
  39. package/dist/vite/index.js +10 -9
  40. package/dist/webpack/mdx.d.ts +8 -2
  41. package/dist/webpack/mdx.js +5 -5
  42. package/dist/webpack/meta.d.ts +8 -2
  43. package/dist/webpack/meta.js +4 -4
  44. package/package.json +4 -6
  45. package/dist/bin.cjs +0 -1889
  46. package/dist/bin.d.cts +0 -1
  47. package/dist/bun/index.cjs +0 -1112
  48. package/dist/bun/index.d.cts +0 -19
  49. package/dist/chunk-PKI7ZDA5.js +0 -29
  50. package/dist/config/index.cjs +0 -400
  51. package/dist/config/index.d.cts +0 -13
  52. package/dist/index-D7JdSMpp.d.ts +0 -272
  53. package/dist/index-P2NNUkHn.d.cts +0 -8
  54. package/dist/index.cjs +0 -18
  55. package/dist/index.d.cts +0 -8
  56. package/dist/load-from-file-I3ALLIVB.js +0 -8
  57. package/dist/next/index.d.cts +0 -28
  58. package/dist/node/loader.cjs +0 -1165
  59. package/dist/node/loader.d.cts +0 -5
  60. package/dist/plugins/index-file.cjs +0 -471
  61. package/dist/plugins/index-file.d.cts +0 -29
  62. package/dist/plugins/json-schema.cjs +0 -114
  63. package/dist/plugins/json-schema.d.cts +0 -25
  64. package/dist/plugins/last-modified.cjs +0 -75
  65. package/dist/plugins/last-modified.d.cts +0 -27
  66. package/dist/runtime/browser.cjs +0 -94
  67. package/dist/runtime/browser.d.cts +0 -50
  68. package/dist/runtime/dynamic.cjs +0 -985
  69. package/dist/runtime/dynamic.d.cts +0 -27
  70. package/dist/runtime/server.cjs +0 -173
  71. package/dist/runtime/server.d.cts +0 -161
  72. package/dist/vite/index.cjs +0 -1620
  73. package/dist/vite/index.d.cts +0 -39
  74. package/dist/webpack/mdx.cjs +0 -1089
  75. package/dist/webpack/mdx.d.cts +0 -14
  76. package/dist/webpack/meta.cjs +0 -649
  77. package/dist/webpack/meta.d.cts +0 -14
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  loadConfig
3
- } from "../chunk-OXSRIWQW.js";
4
- import "../chunk-ZY6UZ7NH.js";
5
- import "../chunk-E5DJTSIM.js";
3
+ } from "../chunk-LPX7ZO66.js";
4
+ import "../chunk-6RPNS75C.js";
5
+ import "../chunk-S7KOJHHO.js";
6
6
  import {
7
7
  mdxLoaderGlob,
8
8
  metaLoaderGlob
@@ -11,11 +11,11 @@ import {
11
11
  ValidationError,
12
12
  _Defaults,
13
13
  createCore
14
- } from "../chunk-7L2KNF6B.js";
14
+ } from "../chunk-GB4W3YCZ.js";
15
15
  import {
16
16
  indexFile
17
- } from "../chunk-XHJCLBZ4.js";
18
- import "../chunk-PKI7ZDA5.js";
17
+ } from "../chunk-ED3ON275.js";
18
+ import "../chunk-WBIHDYMN.js";
19
19
  import "../chunk-VWJKRQZR.js";
20
20
 
21
21
  // src/next/index.ts
@@ -30,7 +30,7 @@ function createMDX(createOptions = {}) {
30
30
  }
31
31
  return (nextConfig = {}) => {
32
32
  const loaderOptions = {
33
- ...core._options,
33
+ ...core.getOptions(),
34
34
  compiledConfigPath: core.getCompiledConfigPath(),
35
35
  isDev
36
36
  };
@@ -112,12 +112,13 @@ async function init(dev, core) {
112
112
  }
113
113
  async function devServer() {
114
114
  const { FSWatcher } = await import("chokidar");
115
+ const { configPath, outDir } = core.getOptions();
115
116
  const watcher = new FSWatcher({
116
117
  ignoreInitial: true,
117
118
  persistent: true,
118
- ignored: [core._options.outDir]
119
+ ignored: [outDir]
119
120
  });
120
- watcher.add(core._options.configPath);
121
+ watcher.add(configPath);
121
122
  for (const collection of core.getConfig().collectionList) {
122
123
  if (collection.type === "docs") {
123
124
  watcher.add(collection.docs.dir);
@@ -129,8 +130,9 @@ async function init(dev, core) {
129
130
  watcher.on("ready", () => {
130
131
  console.log("[MDX] started dev server");
131
132
  });
133
+ const absoluteConfigPath = path.resolve(configPath);
132
134
  watcher.on("all", async (_event, file) => {
133
- if (path.resolve(file) === path.resolve(core._options.configPath)) {
135
+ if (path.resolve(file) === absoluteConfigPath) {
134
136
  watcher.removeAllListeners();
135
137
  await watcher.close();
136
138
  await initOrReload();
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createMdxLoader
3
- } from "../chunk-6NISOLQ6.js";
3
+ } from "../chunk-USWQVJWR.js";
4
4
  import {
5
5
  createMetaLoader
6
6
  } from "../chunk-TYJDYTKH.js";
7
7
  import {
8
8
  createStandaloneConfigLoader,
9
9
  toNode
10
- } from "../chunk-SRSRFOVI.js";
10
+ } from "../chunk-OLL7FM7W.js";
11
11
  import "../chunk-4JSFLXXT.js";
12
12
  import {
13
13
  _Defaults,
14
14
  createCore
15
- } from "../chunk-7L2KNF6B.js";
16
- import "../chunk-PKI7ZDA5.js";
15
+ } from "../chunk-GB4W3YCZ.js";
16
+ import "../chunk-WBIHDYMN.js";
17
17
  import "../chunk-VWJKRQZR.js";
18
18
 
19
19
  // src/node/loader.ts
@@ -1,4 +1,4 @@
1
- import { j as Plugin } from '../index-D7JdSMpp.js';
1
+ export { J as IndexFilePlugin, I as IndexFilePluginOptions, H as default } from '../core-C3QZSdEx.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -6,24 +6,9 @@ import 'fumadocs-core/mdx-plugins';
6
6
  import 'zod';
7
7
  import 'chokidar';
8
8
  import 'vfile';
9
-
10
- interface IndexFilePluginOptions {
11
- target?: 'default' | 'vite';
12
- /**
13
- * add `.js` extensions to imports, needed for ESM without bundler resolution
14
- */
15
- addJsExtension?: boolean;
16
- /**
17
- * Generate entry point for browser
18
- * @defaultValue true
19
- */
20
- browser?: boolean;
21
- /**
22
- * Generate entry point for dynamic compilation
23
- * @defaultValue true
24
- */
25
- dynamic?: boolean;
26
- }
27
- declare function indexFile(options?: IndexFilePluginOptions): Plugin;
28
-
29
- export { type IndexFilePluginOptions, indexFile as default };
9
+ import 'fumadocs-core/source';
10
+ import '../runtime/types.js';
11
+ import 'fumadocs-core/mdx-plugins/remark-structure';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdast';
14
+ import 'mdx/types';
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  indexFile
3
- } from "../chunk-XHJCLBZ4.js";
4
- import "../chunk-PKI7ZDA5.js";
3
+ } from "../chunk-ED3ON275.js";
4
+ import "../chunk-WBIHDYMN.js";
5
5
  import "../chunk-VWJKRQZR.js";
6
6
  export {
7
7
  indexFile as default
@@ -1,4 +1,4 @@
1
- import { j as Plugin } from '../index-D7JdSMpp.js';
1
+ import { j as Plugin } from '../core-C3QZSdEx.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -6,6 +6,12 @@ import 'fumadocs-core/mdx-plugins';
6
6
  import 'zod';
7
7
  import 'chokidar';
8
8
  import 'vfile';
9
+ import 'fumadocs-core/source';
10
+ import '../runtime/types.js';
11
+ import 'fumadocs-core/mdx-plugins/remark-structure';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdast';
14
+ import 'mdx/types';
9
15
 
10
16
  interface JSONSchemaOptions {
11
17
  /**
@@ -1,4 +1,4 @@
1
- import { j as Plugin } from '../index-D7JdSMpp.js';
1
+ import { j as Plugin } from '../core-C3QZSdEx.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -6,7 +6,14 @@ import 'fumadocs-core/mdx-plugins';
6
6
  import 'zod';
7
7
  import 'chokidar';
8
8
  import 'vfile';
9
+ import 'fumadocs-core/source';
10
+ import '../runtime/types.js';
11
+ import 'fumadocs-core/mdx-plugins/remark-structure';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdast';
14
+ import 'mdx/types';
9
15
 
16
+ type VersionControlFn = (filePath: string) => Promise<Date | undefined>;
10
17
  interface LastModifiedPluginOptions {
11
18
  /**
12
19
  * Version control to obtain the last modified time.
@@ -15,9 +22,15 @@ interface LastModifiedPluginOptions {
15
22
  *
16
23
  * If you are using Vercel, please set `VERCEL_DEEP_CLONE` environment variable to `true`.
17
24
  *
25
+ * - A function: return the last modified time for given file path.
26
+ *
18
27
  * @defaultValue 'git'
19
28
  */
20
- versionControl?: 'git';
29
+ versionControl?: 'git' | VersionControlFn;
30
+ /**
31
+ * Filter the collections to include by names
32
+ */
33
+ filter?: (collection: string) => boolean;
21
34
  }
22
35
  /**
23
36
  * Injects `lastModified` property to page exports.
@@ -1,18 +1,55 @@
1
+ import {
2
+ ident
3
+ } from "../chunk-WBIHDYMN.js";
4
+
1
5
  // src/plugins/last-modified.ts
2
6
  import path from "path";
3
7
  import { x } from "tinyexec";
4
8
  var cache = /* @__PURE__ */ new Map();
9
+ var ExtendTypes = `{
10
+ /**
11
+ * Last modified date of document file, obtained from version control.
12
+ *
13
+ */
14
+ lastModified?: Date;
15
+ }`;
5
16
  function lastModified(options = {}) {
6
- const { versionControl = "git" } = options;
17
+ const { versionControl = "git", filter = () => true } = options;
18
+ let fn;
19
+ switch (versionControl) {
20
+ case "git":
21
+ fn = getGitTimestamp;
22
+ break;
23
+ default:
24
+ fn = versionControl;
25
+ }
7
26
  return {
8
27
  name: "last-modified",
28
+ "index-file": {
29
+ generateTypeConfig() {
30
+ const lines = [];
31
+ lines.push("{");
32
+ lines.push(" DocData: {");
33
+ for (const collection of this.core.getConfig().collectionList) {
34
+ if (filter(collection.name)) {
35
+ lines.push(ident(`${collection.name}: ${ExtendTypes},`, 2));
36
+ }
37
+ }
38
+ lines.push(" }");
39
+ lines.push("}");
40
+ return lines.join("\n");
41
+ },
42
+ serverOptions(options2) {
43
+ options2.doc ??= {};
44
+ options2.doc.passthroughs ??= [];
45
+ options2.doc.passthroughs.push("lastModified");
46
+ }
47
+ },
9
48
  doc: {
10
49
  async vfile(file) {
11
- if (versionControl === "git") {
12
- const timestamp = await getGitTimestamp(this.filePath).then(
13
- (v) => v?.getTime()
14
- );
15
- if (timestamp === void 0) return;
50
+ if (!filter(this.collection.name)) return;
51
+ const timestamp = await fn(this.filePath);
52
+ if (timestamp !== void 0) {
16
53
  file.data["mdx-export"] ??= [];
17
54
  file.data["mdx-export"].push({
18
55
  name: "lastModified",
@@ -1,19 +1,22 @@
1
1
  import { ReactNode, FC } from 'react';
2
- import { CompiledMDXFile } from './server.js';
3
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
- import { D as DocCollection, b as DocsCollection } from '../index-D7JdSMpp.js';
5
- import 'fumadocs-core/source';
6
- import 'fumadocs-core/mdx-plugins';
7
- import 'fumadocs-core/toc';
8
- import 'mdx/types';
9
- import 'mdast';
3
+ import { D as DocCollection, b as DocsCollection } from '../core-C3QZSdEx.js';
4
+ import { CompiledMDXProperties } from '../index.js';
5
+ import { InternalTypeConfig } from './types.js';
10
6
  import '@mdx-js/mdx';
11
7
  import 'unified';
8
+ import 'fumadocs-core/mdx-plugins';
12
9
  import 'zod';
13
10
  import 'chokidar';
14
11
  import 'vfile';
12
+ import 'fumadocs-core/source';
13
+ import 'fumadocs-core/toc';
14
+ import 'mdx/types';
15
+ import 'fumadocs-core/mdx-plugins/remark-structure';
16
+ import 'mdast';
15
17
 
16
- interface ClientLoaderOptions<Frontmatter, Props> {
18
+ type CompiledMDXFile<Name extends string, Frontmatter, TC extends InternalTypeConfig> = CompiledMDXProperties<Frontmatter> & TC['DocData'][Name] & Record<string, unknown>;
19
+ interface ClientLoaderOptions<Doc, Props> {
17
20
  /**
18
21
  * Loader ID (usually your collection name)
19
22
  *
@@ -24,10 +27,10 @@ interface ClientLoaderOptions<Frontmatter, Props> {
24
27
  * @defaultValue ''
25
28
  */
26
29
  id?: string;
27
- component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
30
+ component: (loaded: Doc, props: Props) => ReactNode;
28
31
  }
29
- interface ClientLoader<Frontmatter, Props> {
30
- preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
32
+ interface ClientLoader<Doc, Props> {
33
+ preload: (path: string) => Promise<Doc>;
31
34
  /**
32
35
  * Get a component that renders content with `React.lazy`.
33
36
  */
@@ -37,14 +40,14 @@ interface ClientLoader<Frontmatter, Props> {
37
40
  */
38
41
  useContent: (path: string, props: Props) => ReactNode;
39
42
  }
40
- type BrowserCreate<Config> = ReturnType<typeof fromConfig<Config>>;
41
- interface DocCollectionEntry<Frontmatter> {
42
- raw: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
43
- createClientLoader: <Props extends object>(options: ClientLoaderOptions<Frontmatter, Props>) => ClientLoader<Frontmatter, Props>;
43
+ type BrowserCreate<Config, TC extends InternalTypeConfig> = ReturnType<typeof browser<Config, TC>>;
44
+ interface DocCollectionEntry<Name extends string = string, Frontmatter = unknown, TC extends InternalTypeConfig = InternalTypeConfig> {
45
+ raw: Record<string, () => Promise<CompiledMDXFile<Name, Frontmatter, TC>>>;
46
+ createClientLoader: <Props extends object>(options: ClientLoaderOptions<CompiledMDXFile<Name, Frontmatter, TC>, Props>) => ClientLoader<CompiledMDXFile<Name, Frontmatter, TC>, Props>;
44
47
  }
45
- declare function fromConfig<Config>(): {
46
- doc<Name extends keyof Config>(_name: Name, glob: Record<string, () => Promise<unknown>>): Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocCollectionEntry<StandardSchemaV1.InferOutput<Schema>> : never;
48
+ declare function browser<Config, TC extends InternalTypeConfig>(): {
49
+ doc<Name extends keyof Config & string>(_name: Name, glob: Record<string, () => Promise<unknown>>): Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocCollectionEntry<Name, StandardSchemaV1.InferOutput<Schema>, TC> : never;
47
50
  };
48
- declare function createClientLoader<Frontmatter, Props extends object = object>(globEntries: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
51
+ declare function createClientLoader<Doc = CompiledMDXProperties, Props extends object = object>(globEntries: Record<string, () => Promise<Doc>>, options: ClientLoaderOptions<Doc, Props>): ClientLoader<Doc, Props>;
49
52
 
50
- export { type BrowserCreate, type ClientLoader, type ClientLoaderOptions, type DocCollectionEntry, createClientLoader, fromConfig };
53
+ export { type BrowserCreate, type ClientLoader, type ClientLoaderOptions, type DocCollectionEntry, browser, createClientLoader };
@@ -1,13 +1,12 @@
1
1
  // src/runtime/browser.ts
2
2
  import { lazy, createElement } from "react";
3
- function fromConfig() {
3
+ function browser() {
4
4
  return {
5
5
  doc(_name, glob) {
6
- const raw = glob;
7
6
  const out = {
8
- raw,
7
+ raw: glob,
9
8
  createClientLoader({ id = _name, ...options }) {
10
- return createClientLoader(raw, { id, ...options });
9
+ return createClientLoader(this.raw, { id, ...options });
11
10
  }
12
11
  };
13
12
  return out;
@@ -63,6 +62,6 @@ function createClientLoader(globEntries, options) {
63
62
  };
64
63
  }
65
64
  export {
66
- createClientLoader,
67
- fromConfig
65
+ browser,
66
+ createClientLoader
68
67
  };
@@ -1,27 +1,27 @@
1
1
  import * as fumadocs_core_source from 'fumadocs-core/source';
2
- import { FileInfo, AsyncDocCollectionEntry, AsyncDocsCollectionEntry } from './server.js';
3
- import { C as CoreOptions, D as DocCollection, b as DocsCollection } from '../index-D7JdSMpp.js';
2
+ import { C as CoreOptions, S as ServerOptions, D as DocCollection, b as DocsCollection, k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry } from '../core-C3QZSdEx.js';
4
3
  import * as _standard_schema_spec from '@standard-schema/spec';
5
- import 'fumadocs-core/mdx-plugins';
6
- import 'fumadocs-core/toc';
7
- import 'mdx/types';
8
- import 'mdast';
4
+ import { FileInfo, InternalTypeConfig } from './types.js';
9
5
  import '@mdx-js/mdx';
10
- import 'react';
11
6
  import 'unified';
7
+ import 'fumadocs-core/mdx-plugins';
12
8
  import 'zod';
13
9
  import 'chokidar';
14
10
  import 'vfile';
11
+ import 'fumadocs-core/mdx-plugins/remark-structure';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdast';
14
+ import 'mdx/types';
15
15
 
16
16
  interface LazyEntry<Data = unknown> {
17
17
  info: FileInfo;
18
18
  data: Data;
19
19
  hash?: string;
20
20
  }
21
- type CreateDynamic<Config> = ReturnType<typeof fromConfigDynamic<Config>>;
22
- declare function fromConfigDynamic<Config>(configExports: Config, coreOptions: CoreOptions): Promise<{
23
- doc<Name extends keyof Config>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<_standard_schema_spec.StandardSchemaV1.InferOutput<Schema>>[] : never>;
24
- docs<Name extends keyof Config>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<_standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
21
+ type CreateDynamic<Config, TC extends InternalTypeConfig = InternalTypeConfig> = ReturnType<typeof dynamic<Config, TC>>;
22
+ declare function dynamic<Config, TC extends InternalTypeConfig>(configExports: Config, coreOptions: CoreOptions, serverOptions?: ServerOptions): Promise<{
23
+ doc<Name extends keyof Config & string>(name: Name, base: string, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Schema>, TC>[] : never>;
24
+ docs<Name extends keyof Config & string>(name: Name, base: string, meta: Record<string, unknown>, entries: LazyEntry<unknown>[]): Promise<Config[Name] extends DocsCollection<infer Page extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>, infer Meta extends _standard_schema_spec.StandardSchemaV1<unknown, unknown>> ? _standard_schema_spec.StandardSchemaV1.InferOutput<Page> extends fumadocs_core_source.PageData ? _standard_schema_spec.StandardSchemaV1.InferOutput<Meta> extends fumadocs_core_source.MetaData ? AsyncDocsCollectionEntry<Name, _standard_schema_spec.StandardSchemaV1.InferOutput<Page>, _standard_schema_spec.StandardSchemaV1.InferOutput<Meta>, TC> : never : never : never>;
25
25
  }>;
26
26
 
27
- export { type CreateDynamic, type LazyEntry, fromConfigDynamic };
27
+ export { type CreateDynamic, type LazyEntry, dynamic };
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  buildMDX
3
- } from "../chunk-SLY7WXTX.js";
3
+ } from "../chunk-KOPLIEVQ.js";
4
4
  import {
5
- fromConfig
6
- } from "../chunk-5YXP7JLN.js";
5
+ server
6
+ } from "../chunk-5OBUOALK.js";
7
7
  import "../chunk-FBLMK4RS.js";
8
8
  import {
9
9
  buildConfig
10
- } from "../chunk-ZY6UZ7NH.js";
11
- import "../chunk-E5DJTSIM.js";
10
+ } from "../chunk-6RPNS75C.js";
11
+ import "../chunk-S7KOJHHO.js";
12
12
  import {
13
13
  createCore
14
- } from "../chunk-7L2KNF6B.js";
15
- import "../chunk-PKI7ZDA5.js";
14
+ } from "../chunk-GB4W3YCZ.js";
15
+ import "../chunk-WBIHDYMN.js";
16
16
  import {
17
17
  fumaMatter
18
18
  } from "../chunk-VWJKRQZR.js";
@@ -21,11 +21,12 @@ import {
21
21
  import { executeMdx } from "@fumadocs/mdx-remote/client";
22
22
  import { pathToFileURL } from "url";
23
23
  import fs from "fs/promises";
24
- async function fromConfigDynamic(configExports, coreOptions) {
25
- const core = await createCore(coreOptions).init({
24
+ async function dynamic(configExports, coreOptions, serverOptions) {
25
+ const core = createCore(coreOptions);
26
+ await core.init({
26
27
  config: buildConfig(configExports)
27
28
  });
28
- const create = fromConfig();
29
+ const create = server(serverOptions);
29
30
  function getDocCollection(name) {
30
31
  const collection = core.getConfig().getCollection(name);
31
32
  if (!collection) return;
@@ -74,5 +75,5 @@ async function fromConfigDynamic(configExports, coreOptions) {
74
75
  };
75
76
  }
76
77
  export {
77
- fromConfigDynamic
78
+ dynamic
78
79
  };
@@ -1,161 +1,14 @@
1
- import { PageData, MetaData, Source } from 'fumadocs-core/source';
2
- import { StructuredData } from 'fumadocs-core/mdx-plugins';
3
- import { TOCItemType } from 'fumadocs-core/toc';
4
- import { MDXProps, MDXContent } from 'mdx/types';
5
- import { E as ExtractedReference, D as DocCollection, b as DocsCollection, M as MetaCollection } from '../index-D7JdSMpp.js';
6
- import { Root } from 'mdast';
7
- import { StandardSchemaV1 } from '@standard-schema/spec';
8
- import { createProcessor } from '@mdx-js/mdx';
9
- import { FC } from 'react';
1
+ import 'fumadocs-core/source';
2
+ export { k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry, w as DocCollectionEntry, x as DocsCollectionEntry, v as MetaCollectionEntry, y as ServerCreate, S as ServerOptions, z as server, F as toFumadocsSource } from '../core-C3QZSdEx.js';
3
+ import '@standard-schema/spec';
4
+ import './types.js';
5
+ import '@mdx-js/mdx';
10
6
  import 'unified';
7
+ import 'fumadocs-core/mdx-plugins';
11
8
  import 'zod';
12
9
  import 'chokidar';
13
10
  import 'vfile';
14
-
15
- type Processor = ReturnType<typeof createProcessor>;
16
- interface CompilerOptions {
17
- addDependency: (file: string) => void;
18
- }
19
- interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
20
- frontmatter: Frontmatter;
21
- structuredData: StructuredData;
22
- toc: TOCItemType[];
23
- default: FC<MDXProps>;
24
- /**
25
- * Added by the `last-modified` plugin.
26
- */
27
- lastModified?: Date;
28
- /**
29
- * Enable from `postprocess` option.
30
- */
31
- extractedReferences?: ExtractedReference[];
32
- /**
33
- * Enable from `postprocess` option.
34
- */
35
- _markdown?: string;
36
- /**
37
- * Enable from `postprocess` option.
38
- */
39
- _mdast?: string;
40
- }
41
- interface FumadocsDataMap {
42
- /**
43
- * [Fumadocs MDX] raw frontmatter, you can modify it
44
- */
45
- frontmatter?: Record<string, unknown>;
46
- /**
47
- * [Fumadocs MDX] additional ESM exports to write
48
- */
49
- 'mdx-export'?: {
50
- name: string;
51
- value: unknown;
52
- }[];
53
- /**
54
- * [Fumadocs MDX] The compiler object from loader
55
- */
56
- _compiler?: CompilerOptions;
57
- /**
58
- * [Fumadocs MDX] get internal processor, do not use this on user land.
59
- */
60
- _getProcessor?: (format: 'md' | 'mdx') => Processor;
61
- }
62
- declare module 'vfile' {
63
- interface DataMap extends FumadocsDataMap {
64
- }
65
- }
66
-
67
- interface FileInfo {
68
- /**
69
- * virtualized path for Source API
70
- */
71
- path: string;
72
- /**
73
- * the file path in file system
74
- */
75
- fullPath: string;
76
- }
77
- interface DocData {
78
- /**
79
- * Compiled MDX content (as component)
80
- */
81
- body: MDXContent;
82
- /**
83
- * table of contents generated from content.
84
- */
85
- toc: TOCItemType[];
86
- /**
87
- * structured data for document search indexing.
88
- */
89
- structuredData: StructuredData;
90
- /**
91
- * Raw exports from the compiled MDX file.
92
- */
93
- _exports: Record<string, unknown>;
94
- /**
95
- * Last modified date of document file, obtained from version control.
96
- *
97
- * Added by the `last-modified` plugin.
98
- */
99
- lastModified?: Date;
100
- /**
101
- * extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
102
- */
103
- extractedReferences?: ExtractedReference[];
104
- }
105
- interface DocMethods {
106
- /**
107
- * file info
108
- */
109
- info: FileInfo;
110
- /**
111
- * get document as text.
112
- *
113
- * - `type: raw` - read the original content from file system.
114
- * - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
115
- */
116
- getText: (type: 'raw' | 'processed') => Promise<string>;
117
- getMDAST: () => Promise<Root>;
118
- }
119
- interface MetaMethods {
120
- /**
121
- * file info
122
- */
123
- info: FileInfo;
124
- }
125
- type MetaCollectionEntry<Data> = Data & MetaMethods;
126
- type DocCollectionEntry<Frontmatter> = DocData & DocMethods & Frontmatter;
127
- type AsyncDocCollectionEntry<Frontmatter> = DocMethods & {
128
- load: () => Promise<DocData>;
129
- } & Frontmatter;
130
- type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
131
- interface DocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
132
- docs: DocCollectionEntry<Frontmatter>[];
133
- meta: MetaCollectionEntry<Meta>[];
134
- toFumadocsSource: () => Source<{
135
- pageData: DocCollectionEntry<Frontmatter>;
136
- metaData: MetaCollectionEntry<Meta>;
137
- }>;
138
- }
139
- interface AsyncDocsCollectionEntry<Frontmatter extends PageData, Meta extends MetaData> {
140
- docs: AsyncDocCollectionEntry<Frontmatter>[];
141
- meta: MetaCollectionEntry<Meta>[];
142
- toFumadocsSource: () => Source<{
143
- pageData: AsyncDocCollectionEntry<Frontmatter>;
144
- metaData: MetaCollectionEntry<Meta>;
145
- }>;
146
- }
147
- type AwaitableGlobEntries<T> = Record<string, T | (() => Promise<T>)>;
148
- type ServerCreate<Config> = ReturnType<typeof fromConfig<Config>>;
149
- declare function fromConfig<Config>(): {
150
- doc<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? DocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
151
- docLazy<Name extends keyof Config>(_name: Name, base: string, head: AwaitableGlobEntries<unknown>, body: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<infer Schema extends StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>> ? AsyncDocCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
152
- meta<Name extends keyof Config>(_name: Name, base: string, glob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends MetaCollection<infer Schema extends StandardSchemaV1<unknown, unknown>> | DocsCollection<StandardSchemaV1<unknown, unknown>, infer Schema extends StandardSchemaV1<unknown, unknown>> ? MetaCollectionEntry<StandardSchemaV1.InferOutput<Schema>>[] : never>;
153
- docs<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docGlob: AwaitableGlobEntries<unknown>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? DocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
154
- docsLazy<Name extends keyof Config>(name: Name, base: string, metaGlob: AwaitableGlobEntries<unknown>, docHeadGlob: AwaitableGlobEntries<unknown>, docBodyGlob: Record<string, () => Promise<unknown>>): Promise<Config[Name] extends DocsCollection<infer Page extends StandardSchemaV1<unknown, unknown>, infer Meta extends StandardSchemaV1<unknown, unknown>> ? StandardSchemaV1.InferOutput<Page> extends PageData ? StandardSchemaV1.InferOutput<Meta> extends MetaData ? AsyncDocsCollectionEntry<StandardSchemaV1.InferOutput<Page>, StandardSchemaV1.InferOutput<Meta>> : never : never : never>;
155
- };
156
- declare function toFumadocsSource<Page extends DocMethods & PageData, Meta extends MetaMethods & MetaData>(pages: Page[], metas: Meta[]): Source<{
157
- pageData: Page;
158
- metaData: Meta;
159
- }>;
160
-
161
- export { type AsyncDocCollectionEntry, type AsyncDocsCollectionEntry, type CompiledMDXFile, type DocCollectionEntry, type DocData, type DocMethods, type DocsCollectionEntry, type FileInfo, type MetaCollectionEntry, type MetaMethods, type ServerCreate, fromConfig, toFumadocsSource };
11
+ import 'fumadocs-core/mdx-plugins/remark-structure';
12
+ import 'fumadocs-core/toc';
13
+ import 'mdast';
14
+ import 'mdx/types';
@@ -1,8 +1,8 @@
1
1
  import {
2
- fromConfig,
2
+ server,
3
3
  toFumadocsSource
4
- } from "../chunk-5YXP7JLN.js";
4
+ } from "../chunk-5OBUOALK.js";
5
5
  export {
6
- fromConfig,
6
+ server,
7
7
  toFumadocsSource
8
8
  };