fumadocs-mdx 11.3.2 → 11.4.1

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,9 +1,11 @@
1
1
  import { AnyZodObject, z } from 'zod';
2
2
  import { MDXProps } from 'mdx/types';
3
- import { StructureOptions, RemarkHeadingOptions, RemarkImageOptions, RehypeCodeOptions, StructuredData } from 'fumadocs-core/mdx-plugins';
3
+ import * as plugins from 'fumadocs-core/mdx-plugins';
4
+ import { StructuredData } from 'fumadocs-core/mdx-plugins';
4
5
  import { TableOfContents } from 'fumadocs-core/server';
5
6
  import { ProcessorOptions } from '@mdx-js/mdx';
6
7
  import { Pluggable } from 'unified';
8
+ import { FC } from 'react';
7
9
 
8
10
  type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
9
11
  type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
@@ -13,11 +15,11 @@ type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | '
13
15
  * Properties to export from `vfile.data`
14
16
  */
15
17
  valueToExport?: string[];
16
- remarkStructureOptions?: StructureOptions | false;
17
- remarkHeadingOptions?: RemarkHeadingOptions;
18
- remarkImageOptions?: RemarkImageOptions | false;
18
+ remarkStructureOptions?: plugins.StructureOptions | false;
19
+ remarkHeadingOptions?: plugins.RemarkHeadingOptions;
20
+ remarkImageOptions?: plugins.RemarkImageOptions | false;
19
21
  remarkCodeTabOptions?: false;
20
- rehypeCodeOptions?: Partial<RehypeCodeOptions> | false;
22
+ rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
21
23
  };
22
24
  declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
23
25
 
@@ -50,7 +52,7 @@ interface FileInfo {
50
52
  absolutePath: string;
51
53
  }
52
54
  interface MarkdownProps {
53
- body: (props: MDXProps) => React.ReactElement;
55
+ body: FC<MDXProps>;
54
56
  structuredData: StructuredData;
55
57
  toc: TableOfContents;
56
58
  _exports: Record<string, unknown>;
@@ -104,4 +106,4 @@ declare module 'vfile' {
104
106
  }
105
107
  }
106
108
 
107
- export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type MDXOptions as a, type InferSchemaType as b, type GetOutput as c, getDefaultMDXOptions as g };
109
+ export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type InferSchemaType as a, type GetOutput as b, type MDXOptions as c, getDefaultMDXOptions as g };
@@ -1,9 +1,11 @@
1
1
  import { AnyZodObject, z } from 'zod';
2
2
  import { MDXProps } from 'mdx/types';
3
- import { StructureOptions, RemarkHeadingOptions, RemarkImageOptions, RehypeCodeOptions, StructuredData } from 'fumadocs-core/mdx-plugins';
3
+ import * as plugins from 'fumadocs-core/mdx-plugins';
4
+ import { StructuredData } from 'fumadocs-core/mdx-plugins';
4
5
  import { TableOfContents } from 'fumadocs-core/server';
5
6
  import { ProcessorOptions } from '@mdx-js/mdx';
6
7
  import { Pluggable } from 'unified';
8
+ import { FC } from 'react';
7
9
 
8
10
  type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
9
11
  type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
@@ -13,11 +15,11 @@ type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | '
13
15
  * Properties to export from `vfile.data`
14
16
  */
15
17
  valueToExport?: string[];
16
- remarkStructureOptions?: StructureOptions | false;
17
- remarkHeadingOptions?: RemarkHeadingOptions;
18
- remarkImageOptions?: RemarkImageOptions | false;
18
+ remarkStructureOptions?: plugins.StructureOptions | false;
19
+ remarkHeadingOptions?: plugins.RemarkHeadingOptions;
20
+ remarkImageOptions?: plugins.RemarkImageOptions | false;
19
21
  remarkCodeTabOptions?: false;
20
- rehypeCodeOptions?: Partial<RehypeCodeOptions> | false;
22
+ rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
21
23
  };
22
24
  declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
23
25
 
@@ -50,7 +52,7 @@ interface FileInfo {
50
52
  absolutePath: string;
51
53
  }
52
54
  interface MarkdownProps {
53
- body: (props: MDXProps) => React.ReactElement;
55
+ body: FC<MDXProps>;
54
56
  structuredData: StructuredData;
55
57
  toc: TableOfContents;
56
58
  _exports: Record<string, unknown>;
@@ -104,4 +106,4 @@ declare module 'vfile' {
104
106
  }
105
107
  }
106
108
 
107
- export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type MDXOptions as a, type InferSchemaType as b, type GetOutput as c, getDefaultMDXOptions as g };
109
+ export { type BaseCollectionEntry as B, type CollectionEntry as C, type DefaultMDXOptions as D, type FileInfo as F, type GlobalConfig as G, type InferSchema as I, type MarkdownProps as M, type InferSchemaType as a, type GetOutput as b, type MDXOptions as c, getDefaultMDXOptions as g };
@@ -0,0 +1,51 @@
1
+ // src/config/build.ts
2
+ function buildConfig(config) {
3
+ const collections = /* @__PURE__ */ new Map();
4
+ let globalConfig;
5
+ for (const [k, v] of Object.entries(config)) {
6
+ if (!v) {
7
+ continue;
8
+ }
9
+ if (typeof v === "object" && "_doc" in v && v._doc === "collections") {
10
+ collections.set(
11
+ k,
12
+ v
13
+ );
14
+ continue;
15
+ }
16
+ if (k === "default") {
17
+ globalConfig = v;
18
+ continue;
19
+ }
20
+ return [
21
+ `Unknown export "${k}", you can only export collections from source configuration file.`,
22
+ null
23
+ ];
24
+ }
25
+ let cachedMdxOptions;
26
+ return [
27
+ null,
28
+ {
29
+ global: globalConfig,
30
+ collections,
31
+ async getDefaultMDXOptions() {
32
+ if (cachedMdxOptions) return cachedMdxOptions;
33
+ const { getDefaultMDXOptions } = await import("./mdx-options-CAU273O3.js");
34
+ const mdxOptions = globalConfig?.mdxOptions ?? {};
35
+ if (typeof mdxOptions === "function") {
36
+ cachedMdxOptions = getDefaultMDXOptions(await mdxOptions());
37
+ } else {
38
+ cachedMdxOptions = getDefaultMDXOptions(mdxOptions);
39
+ }
40
+ return cachedMdxOptions;
41
+ },
42
+ _runtime: {
43
+ files: /* @__PURE__ */ new Map()
44
+ }
45
+ }
46
+ ];
47
+ }
48
+
49
+ export {
50
+ buildConfig
51
+ };
@@ -1,13 +1,5 @@
1
1
  // src/utils/mdx-options.ts
2
- import {
3
- rehypeCode,
4
- rehypeToc,
5
- remarkCodeTab,
6
- remarkGfm,
7
- remarkHeading,
8
- remarkImage,
9
- remarkStructure
10
- } from "fumadocs-core/mdx-plugins";
2
+ import * as plugins from "fumadocs-core/mdx-plugins";
11
3
 
12
4
  // src/mdx-plugins/remark-exports.ts
13
5
  import { valueToEstree } from "estree-util-value-to-estree";
@@ -80,19 +72,20 @@ function getDefaultMDXOptions({
80
72
  ];
81
73
  const remarkPlugins = pluginOption(
82
74
  (v) => [
83
- remarkGfm,
75
+ plugins.remarkGfm,
84
76
  [
85
- remarkHeading,
77
+ plugins.remarkHeading,
86
78
  {
87
79
  generateToc: false,
88
80
  ...remarkHeadingOptions
89
81
  }
90
82
  ],
91
- remarkImageOptions !== false && [remarkImage, remarkImageOptions],
92
- remarkCodeTabOptions !== false && remarkCodeTab,
83
+ remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
84
+ // Fumadocs 14 compatibility
85
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
93
86
  ...v,
94
87
  remarkStructureOptions !== false && [
95
- remarkStructure,
88
+ plugins.remarkStructure,
96
89
  remarkStructureOptions
97
90
  ],
98
91
  [remarkMdxExport, { values: mdxExports }]
@@ -101,9 +94,9 @@ function getDefaultMDXOptions({
101
94
  );
102
95
  const rehypePlugins = pluginOption(
103
96
  (v) => [
104
- rehypeCodeOptions !== false && [rehypeCode, rehypeCodeOptions],
97
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
105
98
  ...v,
106
- [rehypeToc]
99
+ [plugins.rehypeToc]
107
100
  ],
108
101
  mdxOptions.rehypePlugins
109
102
  );
@@ -1,8 +1,12 @@
1
- // src/config/cached.ts
1
+ import {
2
+ buildConfig
3
+ } from "./chunk-2DJQ3DOD.js";
4
+
5
+ // src/utils/config-cache.ts
2
6
  import { createHash } from "node:crypto";
3
7
  import * as fs from "node:fs";
4
8
 
5
- // src/config/load.ts
9
+ // src/utils/load-config.ts
6
10
  import * as path from "node:path";
7
11
  import { pathToFileURL } from "node:url";
8
12
  function findConfigFile() {
@@ -36,54 +40,8 @@ async function loadConfig(configPath) {
36
40
  if (err !== null) throw new Error(err);
37
41
  return config;
38
42
  }
39
- function buildConfig(config) {
40
- const collections = /* @__PURE__ */ new Map();
41
- let globalConfig;
42
- for (const [k, v] of Object.entries(config)) {
43
- if (!v) {
44
- continue;
45
- }
46
- if (typeof v === "object" && "_doc" in v && v._doc === "collections") {
47
- collections.set(
48
- k,
49
- v
50
- );
51
- continue;
52
- }
53
- if (k === "default") {
54
- globalConfig = v;
55
- continue;
56
- }
57
- return [
58
- `Unknown export "${k}", you can only export collections from source configuration file.`,
59
- null
60
- ];
61
- }
62
- let cachedMdxOptions;
63
- return [
64
- null,
65
- {
66
- global: globalConfig,
67
- collections,
68
- async getDefaultMDXOptions() {
69
- if (cachedMdxOptions) return cachedMdxOptions;
70
- const { getDefaultMDXOptions } = await import("./mdx-options-2H42TB7P.js");
71
- const mdxOptions = globalConfig?.mdxOptions ?? {};
72
- if (typeof mdxOptions === "function") {
73
- cachedMdxOptions = getDefaultMDXOptions(await mdxOptions());
74
- } else {
75
- cachedMdxOptions = getDefaultMDXOptions(mdxOptions);
76
- }
77
- return cachedMdxOptions;
78
- },
79
- _runtime: {
80
- files: /* @__PURE__ */ new Map()
81
- }
82
- }
83
- ];
84
- }
85
43
 
86
- // src/config/cached.ts
44
+ // src/utils/config-cache.ts
87
45
  var cache = /* @__PURE__ */ new Map();
88
46
  async function loadConfigCached(configPath, hash) {
89
47
  const cached = cache.get(configPath);
@@ -90,7 +90,7 @@ function defineConfig(config = {}) {
90
90
  }
91
91
 
92
92
  // src/utils/mdx-options.ts
93
- var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
93
+ var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
94
94
 
95
95
  // src/mdx-plugins/remark-exports.ts
96
96
  var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
@@ -163,19 +163,20 @@ function getDefaultMDXOptions({
163
163
  ];
164
164
  const remarkPlugins = pluginOption(
165
165
  (v) => [
166
- import_mdx_plugins.remarkGfm,
166
+ plugins.remarkGfm,
167
167
  [
168
- import_mdx_plugins.remarkHeading,
168
+ plugins.remarkHeading,
169
169
  {
170
170
  generateToc: false,
171
171
  ...remarkHeadingOptions
172
172
  }
173
173
  ],
174
- remarkImageOptions !== false && [import_mdx_plugins.remarkImage, remarkImageOptions],
175
- remarkCodeTabOptions !== false && import_mdx_plugins.remarkCodeTab,
174
+ remarkImageOptions !== false && [plugins.remarkImage, remarkImageOptions],
175
+ // Fumadocs 14 compatibility
176
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && plugins.remarkCodeTab,
176
177
  ...v,
177
178
  remarkStructureOptions !== false && [
178
- import_mdx_plugins.remarkStructure,
179
+ plugins.remarkStructure,
179
180
  remarkStructureOptions
180
181
  ],
181
182
  [remarkMdxExport, { values: mdxExports }]
@@ -184,9 +185,9 @@ function getDefaultMDXOptions({
184
185
  );
185
186
  const rehypePlugins = pluginOption(
186
187
  (v) => [
187
- rehypeCodeOptions !== false && [import_mdx_plugins.rehypeCode, rehypeCodeOptions],
188
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
188
189
  ...v,
189
- [import_mdx_plugins.rehypeToc]
190
+ [plugins.rehypeToc]
190
191
  ],
191
192
  mdxOptions.rehypePlugins
192
193
  );
@@ -1,134 +1,14 @@
1
- import { F as FileInfo, G as GlobalConfig, M as MarkdownProps, a as MDXOptions, B as BaseCollectionEntry } from '../build-mdx-TJcSpR7K.cjs';
2
- export { C as CollectionEntry, D as DefaultMDXOptions, c as GetOutput, I as InferSchema, b as InferSchemaType, g as getDefaultMDXOptions } from '../build-mdx-TJcSpR7K.cjs';
3
- import { z, ZodTypeAny } from 'zod';
4
- import { ProcessorOptions } from '@mdx-js/mdx';
1
+ export { B as BaseCollectionEntry, C as CollectionEntry, D as DefaultMDXOptions, F as FileInfo, b as GetOutput, G as GlobalConfig, I as InferSchema, a as InferSchemaType, M as MarkdownProps, g as getDefaultMDXOptions } from '../build-mdx-o0kbHSlp.cjs';
2
+ export { B as BaseCollection, D as DocCollection, M as MetaCollection, T as TransformContext, d as defineCollections, b as defineConfig, a as defineDocs, f as frontmatterSchema, m as metaSchema } from '../define-BB9hRiTI.cjs';
5
3
  import { Processor, Transformer } from 'unified';
6
4
  import { Root } from 'mdast';
5
+ import 'zod';
7
6
  import 'mdx/types';
8
7
  import 'fumadocs-core/mdx-plugins';
9
8
  import 'fumadocs-core/server';
10
-
11
- declare const metaSchema: z.ZodObject<{
12
- title: z.ZodOptional<z.ZodString>;
13
- pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
- description: z.ZodOptional<z.ZodString>;
15
- root: z.ZodOptional<z.ZodBoolean>;
16
- defaultOpen: z.ZodOptional<z.ZodBoolean>;
17
- icon: z.ZodOptional<z.ZodString>;
18
- }, "strip", z.ZodTypeAny, {
19
- root?: boolean | undefined;
20
- title?: string | undefined;
21
- icon?: string | undefined;
22
- pages?: string[] | undefined;
23
- description?: string | undefined;
24
- defaultOpen?: boolean | undefined;
25
- }, {
26
- root?: boolean | undefined;
27
- title?: string | undefined;
28
- icon?: string | undefined;
29
- pages?: string[] | undefined;
30
- description?: string | undefined;
31
- defaultOpen?: boolean | undefined;
32
- }>;
33
- declare const frontmatterSchema: z.ZodObject<{
34
- title: z.ZodString;
35
- description: z.ZodOptional<z.ZodString>;
36
- icon: z.ZodOptional<z.ZodString>;
37
- full: z.ZodOptional<z.ZodBoolean>;
38
- _openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
39
- }, "strip", z.ZodTypeAny, {
40
- title: string;
41
- icon?: string | undefined;
42
- description?: string | undefined;
43
- full?: boolean | undefined;
44
- _openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
45
- }, {
46
- title: string;
47
- icon?: string | undefined;
48
- description?: string | undefined;
49
- full?: boolean | undefined;
50
- _openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
51
- }>;
52
-
53
- interface TransformContext {
54
- path: string;
55
- source: string;
56
- /**
57
- * Compile MDX to JavaScript
58
- */
59
- buildMDX: (source: string, options?: ProcessorOptions) => Promise<string>;
60
- }
61
- interface BaseCollection<Schema> {
62
- /**
63
- * Directories to scan
64
- */
65
- dir: string | string[];
66
- /**
67
- * what files to include/exclude (glob patterns)
68
- *
69
- * Include all files if not specified
70
- */
71
- files?: string[];
72
- schema?: Schema | ((ctx: TransformContext) => Schema);
73
- }
74
- interface MetaCollection<Schema extends ZodTypeAny = ZodTypeAny, TransformOutput = unknown> extends BaseCollection<Schema> {
75
- type: 'meta';
76
- /**
77
- * Do transformation in runtime.
78
- *
79
- * This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
80
- */
81
- transform?: (entry: {
82
- data: z.output<Schema>;
83
- file: FileInfo;
84
- }, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
85
- }
86
- interface DocCollection<Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = boolean, TransformOutput = unknown> extends BaseCollection<Schema> {
87
- type: 'doc';
88
- /**
89
- * Do transformation in runtime.
90
- *
91
- * This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
92
- */
93
- transform?: (entry: {
94
- data: z.output<Schema>;
95
- file: FileInfo;
96
- mdx: Async extends true ? MarkdownProps : never;
97
- }, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
98
- mdxOptions?: MDXOptions;
99
- /**
100
- * Load files with async
101
- */
102
- async?: Async;
103
- }
104
- declare function defineCollections<T extends 'doc' | 'meta', Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = false, TransformOutput = unknown>(options: {
105
- type: T;
106
- } & (T extends 'doc' ? DocCollection<Schema, Async, TransformOutput> : MetaCollection<Schema, TransformOutput>)): {
107
- _doc: 'collections';
108
- type: T;
109
- _type: {
110
- async: Async;
111
- transform: TransformOutput;
112
- runtime: T extends 'doc' ? Async extends true ? z.infer<Schema> & BaseCollectionEntry & {
113
- load: () => Promise<MarkdownProps>;
114
- } : Omit<MarkdownProps, keyof z.infer<Schema>> & z.infer<Schema> & BaseCollectionEntry : typeof options extends MetaCollection ? z.infer<Schema> & BaseCollectionEntry : never;
115
- };
116
- };
117
- declare function defineDocs<DocData extends ZodTypeAny = typeof frontmatterSchema, MetaData extends ZodTypeAny = typeof metaSchema, DocAsync extends boolean = false, DocOut = unknown, MetaOut = unknown>(options?: {
118
- /**
119
- * The directory to scan files
120
- *
121
- * @defaultValue 'content/docs'
122
- */
123
- dir?: string | string[];
124
- docs?: Partial<DocCollection<DocData, DocAsync, DocOut>>;
125
- meta?: Partial<MetaCollection<MetaData, MetaOut>>;
126
- }): {
127
- docs: ReturnType<typeof defineCollections<'doc', DocData, DocAsync, DocOut>>;
128
- meta: ReturnType<typeof defineCollections<'meta', MetaData, false, MetaOut>>;
129
- };
130
- declare function defineConfig(config?: GlobalConfig): GlobalConfig;
9
+ import '@mdx-js/mdx';
10
+ import 'react';
131
11
 
132
12
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
133
13
 
134
- export { type BaseCollection, BaseCollectionEntry, type DocCollection, FileInfo, GlobalConfig, MarkdownProps, type MetaCollection, type TransformContext, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
14
+ export { remarkInclude };
@@ -1,134 +1,14 @@
1
- import { F as FileInfo, G as GlobalConfig, M as MarkdownProps, a as MDXOptions, B as BaseCollectionEntry } from '../build-mdx-TJcSpR7K.js';
2
- export { C as CollectionEntry, D as DefaultMDXOptions, c as GetOutput, I as InferSchema, b as InferSchemaType, g as getDefaultMDXOptions } from '../build-mdx-TJcSpR7K.js';
3
- import { z, ZodTypeAny } from 'zod';
4
- import { ProcessorOptions } from '@mdx-js/mdx';
1
+ export { B as BaseCollectionEntry, C as CollectionEntry, D as DefaultMDXOptions, F as FileInfo, b as GetOutput, G as GlobalConfig, I as InferSchema, a as InferSchemaType, M as MarkdownProps, g as getDefaultMDXOptions } from '../build-mdx-o0kbHSlp.js';
2
+ export { B as BaseCollection, D as DocCollection, M as MetaCollection, T as TransformContext, d as defineCollections, b as defineConfig, a as defineDocs, f as frontmatterSchema, m as metaSchema } from '../define-D3l733EX.js';
5
3
  import { Processor, Transformer } from 'unified';
6
4
  import { Root } from 'mdast';
5
+ import 'zod';
7
6
  import 'mdx/types';
8
7
  import 'fumadocs-core/mdx-plugins';
9
8
  import 'fumadocs-core/server';
10
-
11
- declare const metaSchema: z.ZodObject<{
12
- title: z.ZodOptional<z.ZodString>;
13
- pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
- description: z.ZodOptional<z.ZodString>;
15
- root: z.ZodOptional<z.ZodBoolean>;
16
- defaultOpen: z.ZodOptional<z.ZodBoolean>;
17
- icon: z.ZodOptional<z.ZodString>;
18
- }, "strip", z.ZodTypeAny, {
19
- root?: boolean | undefined;
20
- title?: string | undefined;
21
- icon?: string | undefined;
22
- pages?: string[] | undefined;
23
- description?: string | undefined;
24
- defaultOpen?: boolean | undefined;
25
- }, {
26
- root?: boolean | undefined;
27
- title?: string | undefined;
28
- icon?: string | undefined;
29
- pages?: string[] | undefined;
30
- description?: string | undefined;
31
- defaultOpen?: boolean | undefined;
32
- }>;
33
- declare const frontmatterSchema: z.ZodObject<{
34
- title: z.ZodString;
35
- description: z.ZodOptional<z.ZodString>;
36
- icon: z.ZodOptional<z.ZodString>;
37
- full: z.ZodOptional<z.ZodBoolean>;
38
- _openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
39
- }, "strip", z.ZodTypeAny, {
40
- title: string;
41
- icon?: string | undefined;
42
- description?: string | undefined;
43
- full?: boolean | undefined;
44
- _openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
45
- }, {
46
- title: string;
47
- icon?: string | undefined;
48
- description?: string | undefined;
49
- full?: boolean | undefined;
50
- _openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
51
- }>;
52
-
53
- interface TransformContext {
54
- path: string;
55
- source: string;
56
- /**
57
- * Compile MDX to JavaScript
58
- */
59
- buildMDX: (source: string, options?: ProcessorOptions) => Promise<string>;
60
- }
61
- interface BaseCollection<Schema> {
62
- /**
63
- * Directories to scan
64
- */
65
- dir: string | string[];
66
- /**
67
- * what files to include/exclude (glob patterns)
68
- *
69
- * Include all files if not specified
70
- */
71
- files?: string[];
72
- schema?: Schema | ((ctx: TransformContext) => Schema);
73
- }
74
- interface MetaCollection<Schema extends ZodTypeAny = ZodTypeAny, TransformOutput = unknown> extends BaseCollection<Schema> {
75
- type: 'meta';
76
- /**
77
- * Do transformation in runtime.
78
- *
79
- * This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
80
- */
81
- transform?: (entry: {
82
- data: z.output<Schema>;
83
- file: FileInfo;
84
- }, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
85
- }
86
- interface DocCollection<Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = boolean, TransformOutput = unknown> extends BaseCollection<Schema> {
87
- type: 'doc';
88
- /**
89
- * Do transformation in runtime.
90
- *
91
- * This cannot be optimized by bundlers/loaders, avoid expensive calculations here.
92
- */
93
- transform?: (entry: {
94
- data: z.output<Schema>;
95
- file: FileInfo;
96
- mdx: Async extends true ? MarkdownProps : never;
97
- }, globalConfig?: GlobalConfig) => TransformOutput | Promise<TransformOutput>;
98
- mdxOptions?: MDXOptions;
99
- /**
100
- * Load files with async
101
- */
102
- async?: Async;
103
- }
104
- declare function defineCollections<T extends 'doc' | 'meta', Schema extends ZodTypeAny = ZodTypeAny, Async extends boolean = false, TransformOutput = unknown>(options: {
105
- type: T;
106
- } & (T extends 'doc' ? DocCollection<Schema, Async, TransformOutput> : MetaCollection<Schema, TransformOutput>)): {
107
- _doc: 'collections';
108
- type: T;
109
- _type: {
110
- async: Async;
111
- transform: TransformOutput;
112
- runtime: T extends 'doc' ? Async extends true ? z.infer<Schema> & BaseCollectionEntry & {
113
- load: () => Promise<MarkdownProps>;
114
- } : Omit<MarkdownProps, keyof z.infer<Schema>> & z.infer<Schema> & BaseCollectionEntry : typeof options extends MetaCollection ? z.infer<Schema> & BaseCollectionEntry : never;
115
- };
116
- };
117
- declare function defineDocs<DocData extends ZodTypeAny = typeof frontmatterSchema, MetaData extends ZodTypeAny = typeof metaSchema, DocAsync extends boolean = false, DocOut = unknown, MetaOut = unknown>(options?: {
118
- /**
119
- * The directory to scan files
120
- *
121
- * @defaultValue 'content/docs'
122
- */
123
- dir?: string | string[];
124
- docs?: Partial<DocCollection<DocData, DocAsync, DocOut>>;
125
- meta?: Partial<MetaCollection<MetaData, MetaOut>>;
126
- }): {
127
- docs: ReturnType<typeof defineCollections<'doc', DocData, DocAsync, DocOut>>;
128
- meta: ReturnType<typeof defineCollections<'meta', MetaData, false, MetaOut>>;
129
- };
130
- declare function defineConfig(config?: GlobalConfig): GlobalConfig;
9
+ import '@mdx-js/mdx';
10
+ import 'react';
131
11
 
132
12
  declare function remarkInclude(this: Processor): Transformer<Root, Root>;
133
13
 
134
- export { type BaseCollection, BaseCollectionEntry, type DocCollection, FileInfo, GlobalConfig, MarkdownProps, type MetaCollection, type TransformContext, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
14
+ export { remarkInclude };
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-PY2KKTR2.js";
4
4
  import {
5
5
  getDefaultMDXOptions
6
- } from "../chunk-CQAAQB5I.js";
6
+ } from "../chunk-IOENRFUX.js";
7
7
 
8
8
  // src/utils/schema.ts
9
9
  import { z } from "zod";