fumadocs-mdx 14.0.1 → 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 (72) hide show
  1. package/dist/{build-mdx-6UAK5FF5.js → build-mdx-W3233QBZ.js} +1 -1
  2. package/dist/bun/index.d.ts +1 -1
  3. package/dist/bun/index.js +5 -5
  4. package/dist/{chunk-ZY6UZ7NH.js → chunk-6RPNS75C.js} +1 -1
  5. package/dist/{chunk-7UKSZSPY.js → chunk-ED3ON275.js} +3 -4
  6. package/dist/{chunk-BEBCWQC7.js → chunk-GB4W3YCZ.js} +1 -1
  7. package/dist/{chunk-SLY7WXTX.js → chunk-KOPLIEVQ.js} +5 -6
  8. package/dist/{chunk-MTTISKQJ.js → chunk-LPX7ZO66.js} +1 -1
  9. package/dist/{chunk-K6HCOGOX.js → chunk-OLL7FM7W.js} +2 -2
  10. package/dist/{chunk-IQGEFL2B.js → chunk-Q5OSGLJL.js} +1 -1
  11. package/dist/{chunk-E5DJTSIM.js → chunk-S7KOJHHO.js} +4 -1
  12. package/dist/{chunk-6NISOLQ6.js → chunk-USWQVJWR.js} +1 -1
  13. package/dist/config/index.d.ts +1 -1
  14. package/dist/config/index.js +1 -1
  15. package/dist/{core-B9ZoS6sA.d.ts → core-C3QZSdEx.d.ts} +1 -1
  16. package/dist/{index-CNOvhtOn.d.ts → index-RVIZxMZG.d.ts} +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/load-from-file-OZ5N7DXU.js +8 -0
  19. package/dist/next/index.cjs +8 -6
  20. package/dist/next/index.d.ts +1 -1
  21. package/dist/next/index.js +5 -5
  22. package/dist/node/loader.js +3 -3
  23. package/dist/plugins/index-file.d.ts +1 -1
  24. package/dist/plugins/index-file.js +1 -1
  25. package/dist/plugins/json-schema.d.ts +1 -1
  26. package/dist/plugins/last-modified.d.ts +5 -2
  27. package/dist/plugins/last-modified.js +10 -3
  28. package/dist/runtime/browser.d.ts +1 -1
  29. package/dist/runtime/dynamic.d.ts +1 -1
  30. package/dist/runtime/dynamic.js +4 -4
  31. package/dist/runtime/server.d.ts +1 -1
  32. package/dist/vite/index.d.ts +1 -1
  33. package/dist/vite/index.js +7 -7
  34. package/dist/webpack/mdx.d.ts +2 -2
  35. package/dist/webpack/mdx.js +4 -4
  36. package/dist/webpack/meta.d.ts +2 -2
  37. package/dist/webpack/meta.js +3 -3
  38. package/package.json +4 -6
  39. package/dist/bin.cjs +0 -1958
  40. package/dist/bin.d.cts +0 -1
  41. package/dist/bun/index.cjs +0 -1147
  42. package/dist/bun/index.d.cts +0 -25
  43. package/dist/config/index.cjs +0 -400
  44. package/dist/config/index.d.cts +0 -18
  45. package/dist/core-DTuP23zu.d.cts +0 -341
  46. package/dist/index-BD8Woo4m.d.cts +0 -8
  47. package/dist/index.cjs +0 -18
  48. package/dist/index.d.cts +0 -61
  49. package/dist/load-from-file-5HUQN36V.js +0 -8
  50. package/dist/next/index.d.cts +0 -33
  51. package/dist/node/loader.cjs +0 -1200
  52. package/dist/node/loader.d.cts +0 -5
  53. package/dist/plugins/index-file.cjs +0 -495
  54. package/dist/plugins/index-file.d.cts +0 -14
  55. package/dist/plugins/json-schema.cjs +0 -114
  56. package/dist/plugins/json-schema.d.cts +0 -31
  57. package/dist/plugins/last-modified.cjs +0 -110
  58. package/dist/plugins/last-modified.d.cts +0 -37
  59. package/dist/runtime/browser.cjs +0 -93
  60. package/dist/runtime/browser.d.cts +0 -53
  61. package/dist/runtime/dynamic.cjs +0 -1023
  62. package/dist/runtime/dynamic.d.cts +0 -27
  63. package/dist/runtime/server.cjs +0 -176
  64. package/dist/runtime/server.d.cts +0 -14
  65. package/dist/runtime/types.cjs +0 -18
  66. package/dist/runtime/types.d.cts +0 -61
  67. package/dist/vite/index.cjs +0 -1687
  68. package/dist/vite/index.d.cts +0 -44
  69. package/dist/webpack/mdx.cjs +0 -1124
  70. package/dist/webpack/mdx.d.cts +0 -20
  71. package/dist/webpack/meta.cjs +0 -684
  72. package/dist/webpack/meta.d.cts +0 -20
@@ -1,27 +0,0 @@
1
- import * as fumadocs_core_source from 'fumadocs-core/source';
2
- import { i as CoreOptions, S as ServerOptions, D as DocCollection, a as DocsCollection, k as AsyncDocCollectionEntry, l as AsyncDocsCollectionEntry } from '../core-DTuP23zu.cjs';
3
- import * as _standard_schema_spec from '@standard-schema/spec';
4
- import { FileInfo, InternalTypeConfig } from './types.cjs';
5
- import '@mdx-js/mdx';
6
- import 'unified';
7
- import 'fumadocs-core/mdx-plugins';
8
- import 'zod';
9
- import 'chokidar';
10
- import 'vfile';
11
- import 'fumadocs-core/mdx-plugins/remark-structure';
12
- import 'fumadocs-core/toc';
13
- import 'mdast';
14
- import 'mdx/types';
15
-
16
- interface LazyEntry<Data = unknown> {
17
- info: FileInfo;
18
- data: Data;
19
- hash?: string;
20
- }
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
- }>;
26
-
27
- export { type CreateDynamic, type LazyEntry, dynamic };
@@ -1,176 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/runtime/server.ts
31
- var server_exports = {};
32
- __export(server_exports, {
33
- server: () => server,
34
- toFumadocsSource: () => toFumadocsSource
35
- });
36
- module.exports = __toCommonJS(server_exports);
37
- var path = __toESM(require("path"), 1);
38
- function server(options = {}) {
39
- const { doc: { passthroughs: docPassthroughs = [] } = {} } = options;
40
- function fileInfo(file, base) {
41
- if (file.startsWith("./")) {
42
- file = file.slice(2);
43
- }
44
- return {
45
- path: file,
46
- fullPath: path.join(base, file)
47
- };
48
- }
49
- function mapDocData(entry) {
50
- const data = {
51
- body: entry.default,
52
- toc: entry.toc,
53
- structuredData: entry.structuredData,
54
- _exports: entry
55
- };
56
- for (const key of docPassthroughs) {
57
- data[key] = entry[key];
58
- }
59
- return data;
60
- }
61
- return {
62
- async doc(_name, base, glob) {
63
- const out = await Promise.all(
64
- Object.entries(glob).map(async ([k, v]) => {
65
- const data = typeof v === "function" ? await v() : v;
66
- return {
67
- ...mapDocData(data),
68
- ...data.frontmatter,
69
- ...createDocMethods(fileInfo(k, base), () => data)
70
- };
71
- })
72
- );
73
- return out;
74
- },
75
- async docLazy(_name, base, head, body) {
76
- const out = await Promise.all(
77
- Object.entries(head).map(async ([k, v]) => {
78
- const data = typeof v === "function" ? await v() : v;
79
- const content = body[k];
80
- return {
81
- ...data,
82
- ...createDocMethods(fileInfo(k, base), content),
83
- async load() {
84
- return mapDocData(await content());
85
- }
86
- };
87
- })
88
- );
89
- return out;
90
- },
91
- async meta(_name, base, glob) {
92
- const out = await Promise.all(
93
- Object.entries(glob).map(async ([k, v]) => {
94
- const data = typeof v === "function" ? await v() : v;
95
- return {
96
- info: fileInfo(k, base),
97
- ...data
98
- };
99
- })
100
- );
101
- return out;
102
- },
103
- async docs(name, base, metaGlob, docGlob) {
104
- const entry = {
105
- docs: await this.doc(name, base, docGlob),
106
- meta: await this.meta(name, base, metaGlob),
107
- toFumadocsSource() {
108
- return toFumadocsSource(this.docs, this.meta);
109
- }
110
- };
111
- return entry;
112
- },
113
- async docsLazy(name, base, metaGlob, docHeadGlob, docBodyGlob) {
114
- const entry = {
115
- docs: await this.docLazy(name, base, docHeadGlob, docBodyGlob),
116
- meta: await this.meta(name, base, metaGlob),
117
- toFumadocsSource() {
118
- return toFumadocsSource(this.docs, this.meta);
119
- }
120
- };
121
- return entry;
122
- }
123
- };
124
- }
125
- function toFumadocsSource(pages, metas) {
126
- const files = [];
127
- for (const entry of pages) {
128
- files.push({
129
- type: "page",
130
- path: entry.info.path,
131
- absolutePath: entry.info.fullPath,
132
- data: entry
133
- });
134
- }
135
- for (const entry of metas) {
136
- files.push({
137
- type: "meta",
138
- path: entry.info.path,
139
- absolutePath: entry.info.fullPath,
140
- data: entry
141
- });
142
- }
143
- return {
144
- files
145
- };
146
- }
147
- function createDocMethods(info, load) {
148
- return {
149
- info,
150
- async getText(type) {
151
- if (type === "raw") {
152
- const fs = await import("fs/promises");
153
- return (await fs.readFile(info.fullPath)).toString();
154
- }
155
- const data = await load();
156
- if (typeof data._markdown !== "string")
157
- throw new Error(
158
- "getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
159
- );
160
- return data._markdown;
161
- },
162
- async getMDAST() {
163
- const data = await load();
164
- if (!data._mdast)
165
- throw new Error(
166
- "getMDAST() requires `includeMDAST` to be enabled in your collection config."
167
- );
168
- return JSON.parse(data._mdast);
169
- }
170
- };
171
- }
172
- // Annotate the CommonJS export names for ESM import in node:
173
- 0 && (module.exports = {
174
- server,
175
- toFumadocsSource
176
- });
@@ -1,14 +0,0 @@
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-DTuP23zu.cjs';
3
- import '@standard-schema/spec';
4
- import './types.cjs';
5
- import '@mdx-js/mdx';
6
- import 'unified';
7
- import 'fumadocs-core/mdx-plugins';
8
- import 'zod';
9
- import 'chokidar';
10
- import 'vfile';
11
- import 'fumadocs-core/mdx-plugins/remark-structure';
12
- import 'fumadocs-core/toc';
13
- import 'mdast';
14
- import 'mdx/types';
@@ -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/runtime/types.ts
17
- var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
@@ -1,61 +0,0 @@
1
- import { StructuredData } from 'fumadocs-core/mdx-plugins/remark-structure';
2
- import { TOCItemType } from 'fumadocs-core/toc';
3
- import { Root } from 'mdast';
4
- import { MDXContent } from 'mdx/types';
5
-
6
- interface DocData {
7
- /**
8
- * Compiled MDX content (as component)
9
- */
10
- body: MDXContent;
11
- /**
12
- * table of contents generated from content.
13
- */
14
- toc: TOCItemType[];
15
- /**
16
- * structured data for document search indexing.
17
- */
18
- structuredData: StructuredData;
19
- /**
20
- * Raw exports from the compiled MDX file.
21
- */
22
- _exports: Record<string, unknown>;
23
- }
24
- interface FileInfo {
25
- /**
26
- * virtualized path for Source API
27
- */
28
- path: string;
29
- /**
30
- * the file path in file system
31
- */
32
- fullPath: string;
33
- }
34
- interface DocMethods {
35
- /**
36
- * file info
37
- */
38
- info: FileInfo;
39
- /**
40
- * get document as text.
41
- *
42
- * - `type: raw` - read the original content from file system.
43
- * - `type: processed` - get the processed Markdown content, only available when `includeProcessedMarkdown` is enabled on collection config.
44
- */
45
- getText: (type: 'raw' | 'processed') => Promise<string>;
46
- getMDAST: () => Promise<Root>;
47
- }
48
- interface MetaMethods {
49
- /**
50
- * file info
51
- */
52
- info: FileInfo;
53
- }
54
- interface InternalTypeConfig {
55
- /**
56
- * collection name -> collection properties
57
- */
58
- DocData: Record<string, unknown>;
59
- }
60
-
61
- export type { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };