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,272 +0,0 @@
1
- import { ProcessorOptions } from '@mdx-js/mdx';
2
- import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { Pluggable } from 'unified';
4
- import * as Plugins from 'fumadocs-core/mdx-plugins';
5
- import { z } from 'zod';
6
- import { FSWatcher } from 'chokidar';
7
- import { VFile } from 'vfile';
8
-
9
- type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
10
- type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
11
- rehypePlugins?: ResolvePlugins;
12
- remarkPlugins?: ResolvePlugins;
13
- /**
14
- * Properties to export from `vfile.data`
15
- */
16
- valueToExport?: string[];
17
- remarkStructureOptions?: Plugins.StructureOptions | false;
18
- remarkHeadingOptions?: Plugins.RemarkHeadingOptions;
19
- remarkImageOptions?: Plugins.RemarkImageOptions | false;
20
- remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | false;
21
- remarkNpmOptions?: Plugins.RemarkNpmOptions | false;
22
- rehypeCodeOptions?: Plugins.RehypeCodeOptions | false;
23
- };
24
- type MDXPresetOptions = ({
25
- preset?: 'fumadocs';
26
- } & DefaultMDXOptions) | ({
27
- preset: 'minimal';
28
- } & ProcessorOptions);
29
- /**
30
- * apply MDX processor presets
31
- */
32
- declare function applyMdxPreset(options?: MDXPresetOptions): (environment: BuildEnvironment) => Promise<ProcessorOptions>;
33
-
34
- /**
35
- * Zod 4 schema
36
- */
37
- declare const metaSchema: z.ZodObject<{
38
- title: z.ZodOptional<z.ZodString>;
39
- pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
- description: z.ZodOptional<z.ZodString>;
41
- root: z.ZodOptional<z.ZodBoolean>;
42
- defaultOpen: z.ZodOptional<z.ZodBoolean>;
43
- icon: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>;
45
- /**
46
- * Zod 4 schema
47
- */
48
- declare const frontmatterSchema: z.ZodObject<{
49
- title: z.ZodString;
50
- description: z.ZodOptional<z.ZodString>;
51
- icon: z.ZodOptional<z.ZodString>;
52
- full: z.ZodOptional<z.ZodBoolean>;
53
- _openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
54
- }, z.core.$strip>;
55
-
56
- interface ExtractedReference {
57
- href: string;
58
- }
59
- interface PostprocessOptions {
60
- _format: 'md' | 'mdx';
61
- /**
62
- * Properties to export from `vfile.data`
63
- */
64
- valueToExport?: string[];
65
- /**
66
- * stringify MDAST and export via `_markdown`.
67
- */
68
- includeProcessedMarkdown?: boolean;
69
- /**
70
- * extract link references, export via `extractedReferences`.
71
- */
72
- extractLinkReferences?: boolean;
73
- /**
74
- * store MDAST and export via `_mdast`.
75
- */
76
- includeMDAST?: boolean | {
77
- removePosition?: boolean;
78
- };
79
- }
80
-
81
- type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
82
- type AnyCollection = DocsCollection | DocCollection | MetaCollection;
83
- interface BaseCollection {
84
- /**
85
- * Directory to scan
86
- */
87
- dir: string;
88
- /**
89
- * what files to include/exclude (glob patterns)
90
- *
91
- * Include all files if not specified
92
- */
93
- files?: string[];
94
- }
95
- interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
96
- type: 'meta';
97
- schema?: CollectionSchema<Schema, {
98
- path: string;
99
- source: string;
100
- }>;
101
- }
102
- interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
103
- type: 'doc';
104
- postprocess?: Partial<PostprocessOptions>;
105
- mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);
106
- /**
107
- * Load files with async
108
- */
109
- async?: boolean;
110
- /**
111
- * Compile files on-demand
112
- */
113
- dynamic?: boolean;
114
- schema?: CollectionSchema<Schema, {
115
- path: string;
116
- source: string;
117
- }>;
118
- }
119
- interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1> {
120
- type: 'docs';
121
- dir: string;
122
- docs: DocCollection<DocSchema>;
123
- meta: MetaCollection<MetaSchema>;
124
- }
125
- interface GlobalConfig {
126
- plugins?: PluginOption[];
127
- /**
128
- * Configure global MDX options
129
- *
130
- * @remarks `MDXPresetOptions`
131
- */
132
- mdxOptions?: MDXPresetOptions | (() => Promise<MDXPresetOptions>);
133
- /**
134
- * specify a directory to access & store cache (disabled during development mode).
135
- *
136
- * The cache will never be updated, delete the cache folder to clean.
137
- */
138
- experimentalBuildCache?: string;
139
- }
140
- declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollection<Schema>): DocCollection<Schema>;
141
- declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
142
- declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema>(options: {
143
- /**
144
- * The content directory to scan files
145
- *
146
- * @defaultValue 'content/docs'
147
- */
148
- dir?: string;
149
- docs?: Omit<DocCollection<DocSchema>, 'dir' | 'type'>;
150
- meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
151
- }): DocsCollection<DocSchema, MetaSchema>;
152
- declare function defineConfig(config?: GlobalConfig): GlobalConfig;
153
-
154
- type BuildEnvironment = 'bundler' | 'runtime';
155
- interface LoadedConfig {
156
- collectionList: CollectionItem[];
157
- getCollection(name: string): CollectionItem | undefined;
158
- global: GlobalConfig;
159
- getMDXOptions(collection?: DocCollectionItem, environment?: BuildEnvironment): ProcessorOptions | Promise<ProcessorOptions>;
160
- }
161
- type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;
162
- type PrimitiveCollectionItem<T extends DocCollection | MetaCollection> = Omit<T, 'files'> & {
163
- name: string;
164
- hasFile: (filePath: string) => boolean;
165
- isFileSupported: (filePath: string) => boolean;
166
- patterns: string[];
167
- };
168
- type MetaCollectionItem = PrimitiveCollectionItem<MetaCollection>;
169
- type DocCollectionItem = PrimitiveCollectionItem<DocCollection>;
170
- interface DocsCollectionItem extends DocsCollection {
171
- name: string;
172
- meta: MetaCollectionItem;
173
- docs: DocCollectionItem;
174
- hasFile: (filePath: string) => boolean;
175
- }
176
-
177
- type Awaitable<T> = T | Promise<T>;
178
- interface EmitEntry {
179
- /**
180
- * path relative to output directory
181
- */
182
- path: string;
183
- content: string;
184
- }
185
- interface PluginContext extends CoreOptions {
186
- core: Core;
187
- }
188
- type CompilationContext<Collection> = PluginContext & TransformOptions<Collection>;
189
- interface TransformOptions<Collection> {
190
- collection: Collection;
191
- filePath: string;
192
- source: string;
193
- }
194
- interface Plugin {
195
- name?: string;
196
- /**
197
- * on config loaded/updated
198
- */
199
- config?: (this: PluginContext, config: LoadedConfig) => Awaitable<void | LoadedConfig>;
200
- /**
201
- * Generate files (e.g. types, index file, or JSON schemas)
202
- */
203
- emit?: (this: PluginContext) => Awaitable<EmitEntry[]>;
204
- /**
205
- * Configure Fumadocs dev server
206
- */
207
- configureServer?: (this: PluginContext, server: ServerContext) => Awaitable<void>;
208
- meta?: {
209
- /**
210
- * Transform metadata
211
- */
212
- transform?: (this: CompilationContext<MetaCollectionItem>, data: unknown) => Awaitable<unknown | void>;
213
- };
214
- doc?: {
215
- /**
216
- * Transform frontmatter
217
- */
218
- frontmatter?: (this: CompilationContext<DocCollectionItem>, data: Record<string, unknown>) => Awaitable<Record<string, unknown> | void>;
219
- /**
220
- * Transform `vfile` on compilation stage
221
- */
222
- vfile?: (this: CompilationContext<DocCollectionItem>, file: VFile) => Awaitable<VFile | void>;
223
- };
224
- }
225
- type PluginOption = Awaitable<Plugin | PluginOption[] | false>;
226
- interface ServerContext {
227
- /**
228
- * the file watcher, by default all content files are watched, along with other files.
229
- *
230
- * make sure to filter when listening to events
231
- */
232
- watcher?: FSWatcher;
233
- }
234
- interface CoreOptions {
235
- environment: string;
236
- configPath: string;
237
- outDir: string;
238
- }
239
- interface EmitOptions {
240
- /**
241
- * filter the plugins to run emit
242
- */
243
- filterPlugin?: (plugin: Plugin) => boolean;
244
- }
245
- declare const _Defaults: {
246
- configPath: string;
247
- outDir: string;
248
- };
249
- declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[]): {
250
- _options: CoreOptions;
251
- /**
252
- * Convenient cache store, reset when config changes
253
- */
254
- cache: Map<string, unknown>;
255
- init({ config: newConfig }: {
256
- config: Awaitable<LoadedConfig>;
257
- }): Promise</*elided*/ any>;
258
- getConfig(): LoadedConfig;
259
- /**
260
- * The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling)
261
- */
262
- getCompiledConfigPath(): string;
263
- initServer(server: ServerContext): Promise<void>;
264
- emit({ filterPlugin }?: EmitOptions): Promise<EmitEntry[]>;
265
- emitAndWrite(emitOptions?: EmitOptions): Promise<void>;
266
- transformMeta(options: TransformOptions<MetaCollectionItem>, data: unknown): Promise<unknown>;
267
- transformFrontmatter(options: TransformOptions<DocCollectionItem>, data: Record<string, unknown>): Promise<Record<string, unknown>>;
268
- transformVFile(options: TransformOptions<DocCollectionItem>, file: VFile): Promise<VFile>;
269
- };
270
- type Core = ReturnType<typeof createCore>;
271
-
272
- export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DocCollection as D, type ExtractedReference as E, type GlobalConfig as G, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type TransformOptions as T, _Defaults as _, type CollectionSchema as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, type DefaultMDXOptions as f, type MDXPresetOptions as g, applyMdxPreset as h, frontmatterSchema as i, type Plugin as j, type EmitEntry as k, type PluginContext as l, metaSchema as m, type CompilationContext as n, type PluginOption as o, type EmitOptions as p, createCore as q, type Core as r };
@@ -1,8 +0,0 @@
1
- import { C as CoreOptions } from './index-D7JdSMpp.cjs';
2
-
3
- interface WebpackLoaderOptions extends CoreOptions {
4
- compiledConfigPath: string;
5
- isDev: boolean;
6
- }
7
-
8
- export type { WebpackLoaderOptions as W };
package/dist/index.cjs DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/index.ts
17
- var index_exports = {};
18
- module.exports = __toCommonJS(index_exports);
package/dist/index.d.cts DELETED
@@ -1,8 +0,0 @@
1
- export { n as CompilationContext, r as Core, C as CoreOptions, k as EmitEntry, p as EmitOptions, E as ExtractedReference, j as Plugin, l as PluginContext, o as PluginOption, S as ServerContext, T as TransformOptions, _ as _Defaults, q as createCore } from './index-D7JdSMpp.cjs';
2
- import '@mdx-js/mdx';
3
- import '@standard-schema/spec';
4
- import 'unified';
5
- import 'fumadocs-core/mdx-plugins';
6
- import 'zod';
7
- import 'chokidar';
8
- import 'vfile';
@@ -1,8 +0,0 @@
1
- import {
2
- loadConfig
3
- } from "./chunk-OXSRIWQW.js";
4
- import "./chunk-ZY6UZ7NH.js";
5
- import "./chunk-E5DJTSIM.js";
6
- export {
7
- loadConfig
8
- };
@@ -1,28 +0,0 @@
1
- import { NextConfig } from 'next';
2
- import { IndexFilePluginOptions } from '../plugins/index-file.cjs';
3
- import '../index-D7JdSMpp.cjs';
4
- import '@mdx-js/mdx';
5
- import '@standard-schema/spec';
6
- import 'unified';
7
- import 'fumadocs-core/mdx-plugins';
8
- import 'zod';
9
- import 'chokidar';
10
- import 'vfile';
11
-
12
- interface CreateMDXOptions {
13
- /**
14
- * Path to source configuration file
15
- */
16
- configPath?: string;
17
- /**
18
- * Directory for output files
19
- *
20
- * @defaultValue '.source'
21
- */
22
- outDir?: string;
23
- index?: IndexFilePluginOptions | false;
24
- }
25
- declare function createMDX(createOptions?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
26
- declare function postInstall(options: CreateMDXOptions): Promise<void>;
27
-
28
- export { type CreateMDXOptions, createMDX, postInstall };