fumadocs-mdx 11.6.0 → 13.0.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.
Files changed (93) hide show
  1. package/dist/bin.cjs +1728 -0
  2. package/dist/bin.d.cts +1 -0
  3. package/dist/bin.d.ts +1 -0
  4. package/dist/bin.js +16 -0
  5. package/dist/build-mdx-CCNr86q6.d.ts +53 -0
  6. package/dist/build-mdx-D-r3_eQL.d.cts +53 -0
  7. package/dist/bun/index.cjs +857 -0
  8. package/dist/bun/index.d.cts +13 -0
  9. package/dist/bun/index.d.ts +13 -0
  10. package/dist/bun/index.js +62 -0
  11. package/dist/chunk-3J3WL7WN.js +160 -0
  12. package/dist/chunk-CXA4JO4Z.js +45 -0
  13. package/dist/chunk-EELYB2XC.js +207 -0
  14. package/dist/chunk-FSZMKRVH.js +80 -0
  15. package/dist/chunk-II3H5ZVZ.js +77 -0
  16. package/dist/chunk-JVZFH6ND.js +40 -0
  17. package/dist/chunk-K5ZLPEIQ.js +207 -0
  18. package/dist/{chunk-VFALQK6O.js → chunk-KILFIBVW.js} +21 -12
  19. package/dist/chunk-NVRDCY6Z.js +30 -0
  20. package/dist/chunk-U4MQ44TS.js +53 -0
  21. package/dist/chunk-VWJKRQZR.js +19 -0
  22. package/dist/chunk-XQ5O7IPO.js +128 -0
  23. package/dist/chunk-XZY2AWJI.js +81 -0
  24. package/dist/chunk-YVCR6FUH.js +82 -0
  25. package/dist/config/index.cjs +232 -128
  26. package/dist/config/index.d.cts +4 -6
  27. package/dist/config/index.d.ts +4 -6
  28. package/dist/config/index.js +26 -19
  29. package/dist/core-B6j6Fxse.d.cts +218 -0
  30. package/dist/core-B6j6Fxse.d.ts +218 -0
  31. package/dist/index.cjs +0 -76
  32. package/dist/index.d.cts +73 -20
  33. package/dist/index.d.ts +73 -20
  34. package/dist/index.js +0 -10
  35. package/dist/load-MNG3CLET.js +7 -0
  36. package/dist/next/index.cjs +567 -314
  37. package/dist/next/index.d.cts +9 -12
  38. package/dist/next/index.d.ts +9 -12
  39. package/dist/next/index.js +238 -211
  40. package/dist/node/loader.cjs +922 -0
  41. package/dist/node/loader.d.cts +5 -0
  42. package/dist/node/loader.d.ts +5 -0
  43. package/dist/node/loader.js +33 -0
  44. package/dist/plugins/json-schema.cjs +162 -0
  45. package/dist/plugins/json-schema.d.cts +24 -0
  46. package/dist/plugins/json-schema.d.ts +24 -0
  47. package/dist/plugins/json-schema.js +78 -0
  48. package/dist/{mdx-options-CAU273O3.js → preset-ZMP6U62C.js} +1 -1
  49. package/dist/runtime/next/async.cjs +715 -0
  50. package/dist/runtime/next/async.d.cts +21 -0
  51. package/dist/runtime/next/async.d.ts +21 -0
  52. package/dist/runtime/next/async.js +89 -0
  53. package/dist/runtime/next/index.cjs +136 -0
  54. package/dist/runtime/next/index.d.cts +33 -0
  55. package/dist/runtime/next/index.d.ts +33 -0
  56. package/dist/runtime/next/index.js +11 -0
  57. package/dist/runtime/vite/browser.cjs +107 -0
  58. package/dist/runtime/vite/browser.d.cts +59 -0
  59. package/dist/runtime/vite/browser.d.ts +59 -0
  60. package/dist/runtime/vite/browser.js +11 -0
  61. package/dist/runtime/vite/server.cjs +243 -0
  62. package/dist/runtime/vite/server.d.cts +30 -0
  63. package/dist/runtime/vite/server.d.ts +30 -0
  64. package/dist/runtime/vite/server.js +111 -0
  65. package/dist/types-AGzTfBmf.d.ts +45 -0
  66. package/dist/types-DKGMoay5.d.cts +45 -0
  67. package/dist/vite/index.cjs +1185 -0
  68. package/dist/vite/index.d.cts +45 -0
  69. package/dist/vite/index.d.ts +45 -0
  70. package/dist/vite/index.js +297 -0
  71. package/dist/webpack/index.cjs +957 -0
  72. package/dist/{loader-mdx.d.cts → webpack/index.d.cts} +3 -6
  73. package/dist/{loader-mdx.d.ts → webpack/index.d.ts} +3 -6
  74. package/dist/webpack/index.js +44 -0
  75. package/loader-mdx.cjs +1 -1
  76. package/package.json +86 -29
  77. package/bin.js +0 -5
  78. package/dist/chunk-2ZOW45YZ.js +0 -63
  79. package/dist/chunk-DRVUBK5B.js +0 -39
  80. package/dist/chunk-HFLDWPJA.js +0 -62
  81. package/dist/chunk-IOENRFUX.js +0 -112
  82. package/dist/chunk-MK7EXW7O.js +0 -75
  83. package/dist/define-BaW0PQDJ.d.cts +0 -201
  84. package/dist/define-BaW0PQDJ.d.ts +0 -201
  85. package/dist/loader-mdx.cjs +0 -527
  86. package/dist/loader-mdx.js +0 -162
  87. package/dist/runtime/async.cjs +0 -269
  88. package/dist/runtime/async.d.cts +0 -18
  89. package/dist/runtime/async.d.ts +0 -18
  90. package/dist/runtime/async.js +0 -73
  91. package/dist/types-BNrQHCj5.d.cts +0 -100
  92. package/dist/types-DEduCvIT.d.ts +0 -100
  93. package/dist/watcher-IAZDSTU7.js +0 -24
@@ -1,201 +0,0 @@
1
- import { ProcessorOptions } from '@mdx-js/mdx';
2
- import { MDXProps } from 'mdx/types';
3
- import * as plugins from 'fumadocs-core/mdx-plugins';
4
- import { StructuredData } from 'fumadocs-core/mdx-plugins';
5
- import { TableOfContents } from 'fumadocs-core/server';
6
- import { Pluggable } from 'unified';
7
- import { FC } from 'react';
8
- import { z } from 'zod';
9
- import { StandardSchemaV1 } from '@standard-schema/spec';
10
-
11
- type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
12
- type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
13
- rehypePlugins?: ResolvePlugins;
14
- remarkPlugins?: ResolvePlugins;
15
- /**
16
- * Properties to export from `vfile.data`
17
- */
18
- valueToExport?: string[];
19
- remarkStructureOptions?: plugins.StructureOptions | false;
20
- remarkHeadingOptions?: plugins.RemarkHeadingOptions;
21
- remarkImageOptions?: plugins.RemarkImageOptions | false;
22
- remarkCodeTabOptions?: false;
23
- rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
24
- };
25
- declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
26
-
27
- interface GlobalConfig {
28
- /**
29
- * Configure global MDX options
30
- */
31
- mdxOptions?: DefaultMDXOptions | (() => DefaultMDXOptions | Promise<DefaultMDXOptions>);
32
- /**
33
- * Fetch last modified time with specified version control
34
- * @defaultValue 'none'
35
- */
36
- lastModifiedTime?: 'git' | 'none';
37
- }
38
- interface FileInfo {
39
- path: string;
40
- absolutePath: string;
41
- }
42
- interface MarkdownProps {
43
- body: FC<MDXProps>;
44
- structuredData: StructuredData;
45
- toc: TableOfContents;
46
- _exports: Record<string, unknown>;
47
- /**
48
- * Only available when `lastModifiedTime` is enabled on MDX loader
49
- */
50
- lastModified?: Date;
51
- }
52
- interface BaseCollectionEntry {
53
- _file: FileInfo;
54
- }
55
-
56
- interface MDXOptions extends ProcessorOptions {
57
- /**
58
- * Name of collection
59
- */
60
- collection?: string;
61
- /**
62
- * Specify a file path for source
63
- */
64
- filePath?: string;
65
- frontmatter?: Record<string, unknown>;
66
- /**
67
- * Custom Vfile data
68
- */
69
- data?: Record<string, unknown>;
70
- _compiler?: CompilerOptions;
71
- }
72
- interface CompilerOptions {
73
- addDependency: (file: string) => void;
74
- }
75
- declare module 'vfile' {
76
- interface DataMap {
77
- /**
78
- * The compiler object from loader
79
- */
80
- _compiler?: CompilerOptions;
81
- }
82
- }
83
-
84
- declare const metaSchema: z.ZodObject<{
85
- title: z.ZodOptional<z.ZodString>;
86
- pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
87
- description: z.ZodOptional<z.ZodString>;
88
- root: z.ZodOptional<z.ZodBoolean>;
89
- defaultOpen: z.ZodOptional<z.ZodBoolean>;
90
- icon: z.ZodOptional<z.ZodString>;
91
- }, "strip", z.ZodTypeAny, {
92
- root?: boolean | undefined;
93
- title?: string | undefined;
94
- icon?: string | undefined;
95
- pages?: string[] | undefined;
96
- description?: string | undefined;
97
- defaultOpen?: boolean | undefined;
98
- }, {
99
- root?: boolean | undefined;
100
- title?: string | undefined;
101
- icon?: string | undefined;
102
- pages?: string[] | undefined;
103
- description?: string | undefined;
104
- defaultOpen?: boolean | undefined;
105
- }>;
106
- declare const frontmatterSchema: z.ZodObject<{
107
- title: z.ZodString;
108
- description: z.ZodOptional<z.ZodString>;
109
- icon: z.ZodOptional<z.ZodString>;
110
- full: z.ZodOptional<z.ZodBoolean>;
111
- _openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
112
- }, "strip", z.ZodTypeAny, {
113
- title: string;
114
- icon?: string | undefined;
115
- description?: string | undefined;
116
- full?: boolean | undefined;
117
- _openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
118
- }, {
119
- title: string;
120
- icon?: string | undefined;
121
- description?: string | undefined;
122
- full?: boolean | undefined;
123
- _openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
124
- }>;
125
-
126
- type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
127
- interface BaseCollection {
128
- /**
129
- * Directories to scan
130
- */
131
- dir: string | string[];
132
- /**
133
- * what files to include/exclude (glob patterns)
134
- *
135
- * Include all files if not specified
136
- */
137
- files?: string[];
138
- }
139
- interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
140
- type: 'meta';
141
- schema?: CollectionSchema<Schema, {
142
- path: string;
143
- source: string;
144
- }>;
145
- }
146
- interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
147
- type: 'doc';
148
- mdxOptions?: MDXOptions;
149
- /**
150
- * Load files with async
151
- */
152
- async?: Async;
153
- schema?: CollectionSchema<Schema, {
154
- path: string;
155
- source: string;
156
- }>;
157
- }
158
- interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
159
- type: 'docs';
160
- dir: string | string[];
161
- docs: DocCollection<DocSchema, Async>;
162
- meta: MetaCollection<MetaSchema>;
163
- }
164
- declare function defineCollections<T extends 'doc' | 'meta', Schema extends StandardSchemaV1 = StandardSchemaV1<unknown, any>, Async extends boolean = false>(options: {
165
- type: T;
166
- } & (T extends 'doc' ? DocCollection<Schema, Async> : MetaCollection<Schema>)): {
167
- type: T;
168
- _type: {
169
- async: Async;
170
- schema: Schema;
171
- };
172
- };
173
- declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options?: {
174
- /**
175
- * The directory to scan files
176
- *
177
- * @defaultValue 'content/docs'
178
- */
179
- dir?: string | string[];
180
- docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
181
- meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
182
- }): {
183
- type: 'docs';
184
- docs: {
185
- type: 'doc';
186
- _type: {
187
- schema: DocSchema;
188
- async: Async;
189
- };
190
- };
191
- meta: {
192
- type: 'meta';
193
- _type: {
194
- schema: MetaSchema;
195
- async: false;
196
- };
197
- };
198
- };
199
- declare function defineConfig(config?: GlobalConfig): GlobalConfig;
200
-
201
- export { type BaseCollectionEntry as B, type CollectionSchema as C, type DocCollection as D, type FileInfo as F, type GlobalConfig as G, type MetaCollection as M, type DocsCollection as a, type MarkdownProps as b, type BaseCollection as c, defineCollections as d, defineDocs as e, frontmatterSchema as f, defineConfig as g, type DefaultMDXOptions as h, getDefaultMDXOptions as i, metaSchema as m };
@@ -1,201 +0,0 @@
1
- import { ProcessorOptions } from '@mdx-js/mdx';
2
- import { MDXProps } from 'mdx/types';
3
- import * as plugins from 'fumadocs-core/mdx-plugins';
4
- import { StructuredData } from 'fumadocs-core/mdx-plugins';
5
- import { TableOfContents } from 'fumadocs-core/server';
6
- import { Pluggable } from 'unified';
7
- import { FC } from 'react';
8
- import { z } from 'zod';
9
- import { StandardSchemaV1 } from '@standard-schema/spec';
10
-
11
- type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
12
- type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
13
- rehypePlugins?: ResolvePlugins;
14
- remarkPlugins?: ResolvePlugins;
15
- /**
16
- * Properties to export from `vfile.data`
17
- */
18
- valueToExport?: string[];
19
- remarkStructureOptions?: plugins.StructureOptions | false;
20
- remarkHeadingOptions?: plugins.RemarkHeadingOptions;
21
- remarkImageOptions?: plugins.RemarkImageOptions | false;
22
- remarkCodeTabOptions?: false;
23
- rehypeCodeOptions?: plugins.RehypeCodeOptions | false;
24
- };
25
- declare function getDefaultMDXOptions({ valueToExport, rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, ...mdxOptions }: DefaultMDXOptions): ProcessorOptions;
26
-
27
- interface GlobalConfig {
28
- /**
29
- * Configure global MDX options
30
- */
31
- mdxOptions?: DefaultMDXOptions | (() => DefaultMDXOptions | Promise<DefaultMDXOptions>);
32
- /**
33
- * Fetch last modified time with specified version control
34
- * @defaultValue 'none'
35
- */
36
- lastModifiedTime?: 'git' | 'none';
37
- }
38
- interface FileInfo {
39
- path: string;
40
- absolutePath: string;
41
- }
42
- interface MarkdownProps {
43
- body: FC<MDXProps>;
44
- structuredData: StructuredData;
45
- toc: TableOfContents;
46
- _exports: Record<string, unknown>;
47
- /**
48
- * Only available when `lastModifiedTime` is enabled on MDX loader
49
- */
50
- lastModified?: Date;
51
- }
52
- interface BaseCollectionEntry {
53
- _file: FileInfo;
54
- }
55
-
56
- interface MDXOptions extends ProcessorOptions {
57
- /**
58
- * Name of collection
59
- */
60
- collection?: string;
61
- /**
62
- * Specify a file path for source
63
- */
64
- filePath?: string;
65
- frontmatter?: Record<string, unknown>;
66
- /**
67
- * Custom Vfile data
68
- */
69
- data?: Record<string, unknown>;
70
- _compiler?: CompilerOptions;
71
- }
72
- interface CompilerOptions {
73
- addDependency: (file: string) => void;
74
- }
75
- declare module 'vfile' {
76
- interface DataMap {
77
- /**
78
- * The compiler object from loader
79
- */
80
- _compiler?: CompilerOptions;
81
- }
82
- }
83
-
84
- declare const metaSchema: z.ZodObject<{
85
- title: z.ZodOptional<z.ZodString>;
86
- pages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
87
- description: z.ZodOptional<z.ZodString>;
88
- root: z.ZodOptional<z.ZodBoolean>;
89
- defaultOpen: z.ZodOptional<z.ZodBoolean>;
90
- icon: z.ZodOptional<z.ZodString>;
91
- }, "strip", z.ZodTypeAny, {
92
- root?: boolean | undefined;
93
- title?: string | undefined;
94
- icon?: string | undefined;
95
- pages?: string[] | undefined;
96
- description?: string | undefined;
97
- defaultOpen?: boolean | undefined;
98
- }, {
99
- root?: boolean | undefined;
100
- title?: string | undefined;
101
- icon?: string | undefined;
102
- pages?: string[] | undefined;
103
- description?: string | undefined;
104
- defaultOpen?: boolean | undefined;
105
- }>;
106
- declare const frontmatterSchema: z.ZodObject<{
107
- title: z.ZodString;
108
- description: z.ZodOptional<z.ZodString>;
109
- icon: z.ZodOptional<z.ZodString>;
110
- full: z.ZodOptional<z.ZodBoolean>;
111
- _openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
112
- }, "strip", z.ZodTypeAny, {
113
- title: string;
114
- icon?: string | undefined;
115
- description?: string | undefined;
116
- full?: boolean | undefined;
117
- _openapi?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
118
- }, {
119
- title: string;
120
- icon?: string | undefined;
121
- description?: string | undefined;
122
- full?: boolean | undefined;
123
- _openapi?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
124
- }>;
125
-
126
- type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
127
- interface BaseCollection {
128
- /**
129
- * Directories to scan
130
- */
131
- dir: string | string[];
132
- /**
133
- * what files to include/exclude (glob patterns)
134
- *
135
- * Include all files if not specified
136
- */
137
- files?: string[];
138
- }
139
- interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
140
- type: 'meta';
141
- schema?: CollectionSchema<Schema, {
142
- path: string;
143
- source: string;
144
- }>;
145
- }
146
- interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
147
- type: 'doc';
148
- mdxOptions?: MDXOptions;
149
- /**
150
- * Load files with async
151
- */
152
- async?: Async;
153
- schema?: CollectionSchema<Schema, {
154
- path: string;
155
- source: string;
156
- }>;
157
- }
158
- interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> {
159
- type: 'docs';
160
- dir: string | string[];
161
- docs: DocCollection<DocSchema, Async>;
162
- meta: MetaCollection<MetaSchema>;
163
- }
164
- declare function defineCollections<T extends 'doc' | 'meta', Schema extends StandardSchemaV1 = StandardSchemaV1<unknown, any>, Async extends boolean = false>(options: {
165
- type: T;
166
- } & (T extends 'doc' ? DocCollection<Schema, Async> : MetaCollection<Schema>)): {
167
- type: T;
168
- _type: {
169
- async: Async;
170
- schema: Schema;
171
- };
172
- };
173
- declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options?: {
174
- /**
175
- * The directory to scan files
176
- *
177
- * @defaultValue 'content/docs'
178
- */
179
- dir?: string | string[];
180
- docs?: Omit<DocCollection<DocSchema, Async>, 'dir' | 'type'>;
181
- meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
182
- }): {
183
- type: 'docs';
184
- docs: {
185
- type: 'doc';
186
- _type: {
187
- schema: DocSchema;
188
- async: Async;
189
- };
190
- };
191
- meta: {
192
- type: 'meta';
193
- _type: {
194
- schema: MetaSchema;
195
- async: false;
196
- };
197
- };
198
- };
199
- declare function defineConfig(config?: GlobalConfig): GlobalConfig;
200
-
201
- export { type BaseCollectionEntry as B, type CollectionSchema as C, type DocCollection as D, type FileInfo as F, type GlobalConfig as G, type MetaCollection as M, type DocsCollection as a, type MarkdownProps as b, type BaseCollection as c, defineCollections as d, defineDocs as e, frontmatterSchema as f, defineConfig as g, type DefaultMDXOptions as h, getDefaultMDXOptions as i, metaSchema as m };