fumadocs-mdx 11.2.3 → 11.3.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,9 @@
1
1
  import {
2
2
  remarkInclude
3
- } from "../chunk-GUHWD47S.js";
3
+ } from "../chunk-PY2KKTR2.js";
4
4
  import {
5
5
  getDefaultMDXOptions
6
- } from "../chunk-MKWJLEE7.js";
6
+ } from "../chunk-6LEQ23AC.js";
7
7
 
8
8
  // src/utils/schema.ts
9
9
  import { z } from "zod";
package/dist/index.cjs ADDED
@@ -0,0 +1,98 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ createMDXSource: () => createMDXSource,
24
+ toRuntime: () => toRuntime,
25
+ toRuntimeAsync: () => toRuntimeAsync
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+
29
+ // src/runtime/resolve-files.ts
30
+ function resolveFiles({
31
+ docs,
32
+ meta,
33
+ rootDir = ""
34
+ }) {
35
+ const outputs = [];
36
+ for (const entry of docs) {
37
+ if (!entry._file.path.startsWith(rootDir)) continue;
38
+ outputs.push({
39
+ type: "page",
40
+ path: entry._file.path,
41
+ data: entry
42
+ });
43
+ }
44
+ for (const entry of meta) {
45
+ outputs.push({
46
+ type: "meta",
47
+ path: entry._file.path,
48
+ data: entry
49
+ });
50
+ }
51
+ return outputs;
52
+ }
53
+
54
+ // src/runtime/index.ts
55
+ function toRuntime(type, file, info) {
56
+ if (type === "doc") {
57
+ const { default: body, frontmatter, ...exports2 } = file;
58
+ return {
59
+ body,
60
+ ...exports2,
61
+ ...frontmatter,
62
+ _exports: file,
63
+ _file: info
64
+ };
65
+ }
66
+ return {
67
+ ...file.default,
68
+ _file: info
69
+ };
70
+ }
71
+ function toRuntimeAsync(frontmatter, load, info) {
72
+ return {
73
+ async load() {
74
+ const { default: body, ...res } = await load();
75
+ return {
76
+ body,
77
+ ...res
78
+ };
79
+ },
80
+ ...frontmatter,
81
+ _file: info
82
+ };
83
+ }
84
+ function createMDXSource(docs, meta = []) {
85
+ return {
86
+ files: (rootDir) => resolveFiles({
87
+ docs,
88
+ meta,
89
+ rootDir
90
+ })
91
+ };
92
+ }
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ createMDXSource,
96
+ toRuntime,
97
+ toRuntimeAsync
98
+ });
@@ -0,0 +1,17 @@
1
+ import { PageData, MetaData, Source } from 'fumadocs-core/source';
2
+ import { F as FileInfo, B as BaseCollectionEntry } from './build-mdx-C2hor32E.cjs';
3
+ import 'zod';
4
+ import 'mdx/types';
5
+ import 'fumadocs-core/mdx-plugins';
6
+ import 'fumadocs-core/server';
7
+ import '@mdx-js/mdx';
8
+ import 'unified';
9
+
10
+ declare function toRuntime(type: 'doc' | 'meta', file: Record<string, unknown>, info: FileInfo): unknown;
11
+ declare function toRuntimeAsync(frontmatter: Record<string, unknown>, load: () => Promise<Record<string, unknown>>, info: FileInfo): unknown;
12
+ declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
13
+ pageData: Doc;
14
+ metaData: Meta;
15
+ }>;
16
+
17
+ export { createMDXSource, toRuntime, toRuntimeAsync };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import { PageData, MetaData, Source } from 'fumadocs-core/source';
2
- import { F as FileInfo, B as BaseCollectionEntry } from './build-mdx-SZwWfZMp.js';
3
- import { MetaFile } from './loader-mdx.js';
2
+ import { F as FileInfo, B as BaseCollectionEntry } from './build-mdx-C2hor32E.js';
4
3
  import 'zod';
5
4
  import 'mdx/types';
6
5
  import 'fumadocs-core/mdx-plugins';
7
6
  import 'fumadocs-core/server';
8
7
  import '@mdx-js/mdx';
9
8
  import 'unified';
10
- import 'webpack';
11
9
 
12
10
  declare function toRuntime(type: 'doc' | 'meta', file: Record<string, unknown>, info: FileInfo): unknown;
13
11
  declare function toRuntimeAsync(frontmatter: Record<string, unknown>, load: () => Promise<Record<string, unknown>>, info: FileInfo): unknown;
@@ -16,10 +14,4 @@ declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Met
16
14
  metaData: Meta;
17
15
  }>;
18
16
 
19
- interface Manifest {
20
- files: (MetaFile & {
21
- collection: string;
22
- })[];
23
- }
24
-
25
- export { type Manifest, createMDXSource, toRuntime, toRuntimeAsync };
17
+ export { createMDXSource, toRuntime, toRuntimeAsync };
@@ -0,0 +1,484 @@
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 __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // src/mdx-plugins/remark-exports.ts
34
+ function remarkMdxExport({ values }) {
35
+ return (tree, vfile) => {
36
+ for (const name of values) {
37
+ if (!(name in vfile.data)) return;
38
+ tree.children.unshift(getMdastExport(name, vfile.data[name]));
39
+ }
40
+ };
41
+ }
42
+ function getMdastExport(name, value) {
43
+ return {
44
+ type: "mdxjsEsm",
45
+ value: "",
46
+ data: {
47
+ estree: {
48
+ type: "Program",
49
+ sourceType: "module",
50
+ body: [
51
+ {
52
+ type: "ExportNamedDeclaration",
53
+ specifiers: [],
54
+ source: null,
55
+ declaration: {
56
+ type: "VariableDeclaration",
57
+ kind: "let",
58
+ declarations: [
59
+ {
60
+ type: "VariableDeclarator",
61
+ id: {
62
+ type: "Identifier",
63
+ name
64
+ },
65
+ init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
66
+ }
67
+ ]
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ };
74
+ }
75
+ var import_estree_util_value_to_estree;
76
+ var init_remark_exports = __esm({
77
+ "src/mdx-plugins/remark-exports.ts"() {
78
+ "use strict";
79
+ import_estree_util_value_to_estree = require("estree-util-value-to-estree");
80
+ }
81
+ });
82
+
83
+ // src/utils/mdx-options.ts
84
+ var mdx_options_exports = {};
85
+ __export(mdx_options_exports, {
86
+ getDefaultMDXOptions: () => getDefaultMDXOptions
87
+ });
88
+ function pluginOption(def, options = []) {
89
+ const list = def(Array.isArray(options) ? options : []).filter(
90
+ Boolean
91
+ );
92
+ if (typeof options === "function") {
93
+ return options(list);
94
+ }
95
+ return list;
96
+ }
97
+ function getDefaultMDXOptions({
98
+ valueToExport = [],
99
+ rehypeCodeOptions,
100
+ remarkImageOptions,
101
+ remarkHeadingOptions,
102
+ remarkStructureOptions,
103
+ ...mdxOptions
104
+ }) {
105
+ const mdxExports = [
106
+ "structuredData",
107
+ "frontmatter",
108
+ "lastModified",
109
+ ...valueToExport
110
+ ];
111
+ const remarkPlugins = pluginOption(
112
+ (v) => [
113
+ import_mdx_plugins.remarkGfm,
114
+ [
115
+ import_mdx_plugins.remarkHeading,
116
+ {
117
+ generateToc: false,
118
+ ...remarkHeadingOptions
119
+ }
120
+ ],
121
+ remarkImageOptions !== false && [import_mdx_plugins.remarkImage, remarkImageOptions],
122
+ ...v,
123
+ remarkStructureOptions !== false && [
124
+ import_mdx_plugins.remarkStructure,
125
+ remarkStructureOptions
126
+ ],
127
+ [remarkMdxExport, { values: mdxExports }]
128
+ ],
129
+ mdxOptions.remarkPlugins
130
+ );
131
+ const rehypePlugins = pluginOption(
132
+ (v) => [
133
+ rehypeCodeOptions !== false && [import_mdx_plugins.rehypeCode, rehypeCodeOptions],
134
+ ...v,
135
+ [import_mdx_plugins.rehypeToc]
136
+ ],
137
+ mdxOptions.rehypePlugins
138
+ );
139
+ return {
140
+ ...mdxOptions,
141
+ remarkPlugins,
142
+ rehypePlugins
143
+ };
144
+ }
145
+ var import_mdx_plugins;
146
+ var init_mdx_options = __esm({
147
+ "src/utils/mdx-options.ts"() {
148
+ "use strict";
149
+ import_mdx_plugins = require("fumadocs-core/mdx-plugins");
150
+ init_remark_exports();
151
+ }
152
+ });
153
+
154
+ // src/loader-mdx.ts
155
+ var loader_mdx_exports = {};
156
+ __export(loader_mdx_exports, {
157
+ default: () => loader
158
+ });
159
+ module.exports = __toCommonJS(loader_mdx_exports);
160
+ var path4 = __toESM(require("path"), 1);
161
+ var import_node_querystring = require("querystring");
162
+ var import_gray_matter2 = __toESM(require("gray-matter"), 1);
163
+
164
+ // src/config/cached.ts
165
+ var import_node_crypto = require("crypto");
166
+ var fs = __toESM(require("fs"), 1);
167
+
168
+ // src/config/load.ts
169
+ var path = __toESM(require("path"), 1);
170
+ var import_node_url = require("url");
171
+ async function loadConfig(configPath) {
172
+ const { build } = await import("esbuild");
173
+ const url = (0, import_node_url.pathToFileURL)(path.resolve(".source/source.config.mjs"));
174
+ const transformed = await build({
175
+ entryPoints: [{ in: configPath, out: "source.config" }],
176
+ bundle: true,
177
+ outdir: ".source",
178
+ target: "node18",
179
+ write: true,
180
+ platform: "node",
181
+ format: "esm",
182
+ packages: "external",
183
+ outExtension: {
184
+ ".js": ".mjs"
185
+ },
186
+ allowOverwrite: true
187
+ });
188
+ if (transformed.errors.length > 0) {
189
+ throw new Error("failed to compile configuration file");
190
+ }
191
+ const loaded = await import(`${url.href}?hash=${Date.now().toString()}`);
192
+ const [err, config] = buildConfig(
193
+ // every call to `loadConfig` will cause the previous cache to be ignored
194
+ loaded
195
+ );
196
+ if (err !== null) throw new Error(err);
197
+ return config;
198
+ }
199
+ function buildConfig(config) {
200
+ const collections = /* @__PURE__ */ new Map();
201
+ let globalConfig;
202
+ for (const [k, v] of Object.entries(config)) {
203
+ if (!v) {
204
+ continue;
205
+ }
206
+ if (typeof v === "object" && "_doc" in v && v._doc === "collections") {
207
+ collections.set(
208
+ k,
209
+ v
210
+ );
211
+ continue;
212
+ }
213
+ if (k === "default") {
214
+ globalConfig = v;
215
+ continue;
216
+ }
217
+ return [
218
+ `Unknown export "${k}", you can only export collections from source configuration file.`,
219
+ null
220
+ ];
221
+ }
222
+ let cachedMdxOptions;
223
+ return [
224
+ null,
225
+ {
226
+ global: globalConfig,
227
+ collections,
228
+ async getDefaultMDXOptions() {
229
+ if (cachedMdxOptions) return cachedMdxOptions;
230
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
231
+ const mdxOptions = globalConfig?.mdxOptions ?? {};
232
+ if (typeof mdxOptions === "function") {
233
+ cachedMdxOptions = getDefaultMDXOptions2(await mdxOptions());
234
+ } else {
235
+ cachedMdxOptions = getDefaultMDXOptions2(mdxOptions);
236
+ }
237
+ return cachedMdxOptions;
238
+ },
239
+ _runtime: {
240
+ files: /* @__PURE__ */ new Map()
241
+ }
242
+ }
243
+ ];
244
+ }
245
+
246
+ // src/config/cached.ts
247
+ var cache = /* @__PURE__ */ new Map();
248
+ async function loadConfigCached(configPath, hash) {
249
+ const cached = cache.get(configPath);
250
+ if (cached && cached.hash === hash) {
251
+ return await cached.config;
252
+ }
253
+ const config = loadConfig(configPath);
254
+ cache.set(configPath, { config, hash });
255
+ return await config;
256
+ }
257
+ async function getConfigHash(configPath) {
258
+ const hash = (0, import_node_crypto.createHash)("md5");
259
+ const rs = fs.createReadStream(configPath);
260
+ for await (const chunk of rs) {
261
+ hash.update(chunk);
262
+ }
263
+ return hash.digest("hex");
264
+ }
265
+
266
+ // src/utils/build-mdx.ts
267
+ var import_mdx = require("@mdx-js/mdx");
268
+
269
+ // src/mdx-plugins/remark-include.ts
270
+ var import_unist_util_visit = require("unist-util-visit");
271
+ var path2 = __toESM(require("path"), 1);
272
+ var fs2 = __toESM(require("fs/promises"), 1);
273
+ var import_gray_matter = __toESM(require("gray-matter"), 1);
274
+ function remarkInclude() {
275
+ const TagName = "include";
276
+ async function update(tree, file, processor, compiler) {
277
+ const queue = [];
278
+ (0, import_unist_util_visit.visit)(tree, ["mdxJsxFlowElement", "paragraph"], (node) => {
279
+ let specifier;
280
+ if (node.type === "paragraph" && node.children.length === 3) {
281
+ const [open, content, closure] = node.children;
282
+ if (open.type === "html" && open.value === `<${TagName}>` && content.type === "text" && closure.type === "html" && closure.value === `</${TagName}>`) {
283
+ specifier = content.value.trim();
284
+ }
285
+ } else if (node.type === "paragraph" && node.children.length === 1) {
286
+ const child = node.children[0];
287
+ if (child.type === "mdxJsxTextElement" && child.name === TagName) {
288
+ const text = child.children.at(0);
289
+ if (text && text.type === "text") {
290
+ specifier = text.value;
291
+ }
292
+ }
293
+ }
294
+ if (node.type === "mdxJsxFlowElement" && node.name === TagName) {
295
+ const child = node.children.at(0);
296
+ if (child && child.type === "text") {
297
+ specifier = child.value;
298
+ }
299
+ }
300
+ if (!specifier) return;
301
+ const targetPath = path2.resolve(path2.dirname(file), specifier);
302
+ queue.push(
303
+ fs2.readFile(targetPath).then(async (content) => {
304
+ const parsed = processor.parse((0, import_gray_matter.default)(content).content);
305
+ compiler?.addDependency(targetPath);
306
+ await update(parsed, targetPath, processor, compiler);
307
+ Object.assign(node, parsed);
308
+ })
309
+ );
310
+ return "skip";
311
+ });
312
+ await Promise.all(queue);
313
+ }
314
+ return async (tree, file) => {
315
+ await update(tree, file.path, this, file.data._compiler);
316
+ };
317
+ }
318
+
319
+ // src/utils/build-mdx.ts
320
+ var cache2 = /* @__PURE__ */ new Map();
321
+ function cacheKey(group, format) {
322
+ return `${group}:${format}`;
323
+ }
324
+ function buildMDX(group, configHash, source, options = {}) {
325
+ const { filePath, frontmatter, data, ...rest } = options;
326
+ let format = options.format;
327
+ if (!format && filePath) {
328
+ format = filePath.endsWith(".mdx") ? "mdx" : "md";
329
+ }
330
+ format ??= "mdx";
331
+ const key = cacheKey(group, format);
332
+ let cached = cache2.get(key);
333
+ if (cached === void 0 || cached.configHash !== configHash) {
334
+ cached = {
335
+ processor: (0, import_mdx.createProcessor)({
336
+ outputFormat: "program",
337
+ development: process.env.NODE_ENV === "development",
338
+ ...rest,
339
+ remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
340
+ format
341
+ }),
342
+ configHash
343
+ };
344
+ cache2.set(key, cached);
345
+ }
346
+ return cached.processor.process({
347
+ value: source,
348
+ path: filePath,
349
+ data: {
350
+ ...data,
351
+ frontmatter,
352
+ _compiler: options._compiler
353
+ }
354
+ });
355
+ }
356
+
357
+ // src/utils/format-error.ts
358
+ function formatError(message, error) {
359
+ const lines = [];
360
+ function walk(key, { _errors, ...rest }, padStart = 0) {
361
+ if (key !== void 0 || _errors.length > 0) {
362
+ const text = key ? `${key}: ${_errors.join("\n ")}` : _errors.join("\n");
363
+ lines.push(
364
+ text.split("\n").map((line) => `${" ".repeat(padStart)}${line}`).join("\n")
365
+ );
366
+ }
367
+ for (const [k, v] of Object.entries(rest)) {
368
+ walk(key ? `${key}.${k}` : k, v, padStart + 2);
369
+ }
370
+ }
371
+ walk(void 0, error.format());
372
+ return [message, ...lines].join("\n");
373
+ }
374
+
375
+ // src/utils/git-timestamp.ts
376
+ var import_node_path = __toESM(require("path"), 1);
377
+ var import_node_fs = __toESM(require("fs"), 1);
378
+ var import_cross_spawn = require("cross-spawn");
379
+ var cache3 = /* @__PURE__ */ new Map();
380
+ function getGitTimestamp(file) {
381
+ const cachedTimestamp = cache3.get(file);
382
+ if (cachedTimestamp) return Promise.resolve(cachedTimestamp);
383
+ return new Promise((resolve3, reject) => {
384
+ const cwd = import_node_path.default.dirname(file);
385
+ if (!import_node_fs.default.existsSync(cwd)) {
386
+ resolve3(void 0);
387
+ return;
388
+ }
389
+ const fileName = import_node_path.default.basename(file);
390
+ const child = (0, import_cross_spawn.spawn)("git", ["log", "-1", '--pretty="%ai"', fileName], {
391
+ cwd
392
+ });
393
+ let output;
394
+ child.stdout.on("data", (d) => output = new Date(String(d)));
395
+ child.on("close", () => {
396
+ if (output) cache3.set(file, output);
397
+ resolve3(output);
398
+ });
399
+ child.on("error", reject);
400
+ });
401
+ }
402
+
403
+ // src/loader-mdx.ts
404
+ function parseQuery(query) {
405
+ let collection;
406
+ let hash;
407
+ const parsed = (0, import_node_querystring.parse)(query.slice(1));
408
+ if (parsed.collection && typeof parsed.collection === "string")
409
+ collection = parsed.collection;
410
+ if (parsed.hash && typeof parsed.hash === "string") hash = parsed.hash;
411
+ return { collection, hash };
412
+ }
413
+ async function loader(source, callback) {
414
+ this.cacheable(true);
415
+ const context = this.context;
416
+ const filePath = this.resourcePath;
417
+ const { _ctx } = this.getOptions();
418
+ const matter2 = (0, import_gray_matter2.default)(source);
419
+ const {
420
+ hash: configHash = await getConfigHash(_ctx.configPath),
421
+ collection: collectionId
422
+ } = parseQuery(this.resourceQuery);
423
+ const config = await loadConfigCached(_ctx.configPath, configHash);
424
+ let collection = collectionId !== void 0 ? config.collections.get(collectionId) : void 0;
425
+ if (collection && collection.type !== "doc") {
426
+ collection = void 0;
427
+ }
428
+ const mdxOptions = collection?.mdxOptions ?? await config.getDefaultMDXOptions();
429
+ let frontmatter = matter2.data;
430
+ if (collection?.schema) {
431
+ let schema = collection.schema;
432
+ if (typeof schema === "function") {
433
+ schema = schema({
434
+ async buildMDX(v, options = mdxOptions) {
435
+ const res = await buildMDX(
436
+ collectionId ?? "global",
437
+ configHash,
438
+ v,
439
+ options
440
+ );
441
+ return String(res.value);
442
+ },
443
+ source,
444
+ path: filePath
445
+ });
446
+ }
447
+ const result = await schema.safeParseAsync(frontmatter);
448
+ if (result.error) {
449
+ callback(
450
+ new Error(
451
+ formatError(`invalid frontmatter in ${filePath}:`, result.error)
452
+ )
453
+ );
454
+ return;
455
+ }
456
+ frontmatter = result.data;
457
+ }
458
+ let timestamp;
459
+ if (config.global?.lastModifiedTime === "git")
460
+ timestamp = (await getGitTimestamp(filePath))?.getTime();
461
+ try {
462
+ const file = await buildMDX(
463
+ collectionId ?? "global",
464
+ configHash,
465
+ matter2.content,
466
+ {
467
+ development: this.mode === "development",
468
+ ...mdxOptions,
469
+ filePath,
470
+ frontmatter,
471
+ data: {
472
+ lastModified: timestamp
473
+ },
474
+ _compiler: this
475
+ }
476
+ );
477
+ callback(void 0, String(file.value), file.map ?? void 0);
478
+ } catch (error) {
479
+ if (!(error instanceof Error)) throw error;
480
+ const fpath = path4.relative(context, filePath);
481
+ error.message = `${fpath}:${error.name}: ${error.message}`;
482
+ callback(error);
483
+ }
484
+ }
@@ -0,0 +1,18 @@
1
+ import { LoaderContext } from 'webpack';
2
+
3
+ interface Options {
4
+ /**
5
+ * @internal
6
+ */
7
+ _ctx: {
8
+ configPath: string;
9
+ };
10
+ }
11
+ /**
12
+ * Load MDX/markdown files
13
+ *
14
+ * it supports frontmatter by parsing and injecting the data in `vfile.data.frontmatter`
15
+ */
16
+ declare function loader(this: LoaderContext<Options>, source: string, callback: LoaderContext<Options>['callback']): Promise<void>;
17
+
18
+ export { type Options, loader as default };
@@ -1,5 +1,4 @@
1
1
  import { LoaderContext } from 'webpack';
2
- import { StructuredData } from 'fumadocs-core/mdx-plugins';
3
2
 
4
3
  interface Options {
5
4
  /**
@@ -9,14 +8,6 @@ interface Options {
9
8
  configPath: string;
10
9
  };
11
10
  }
12
- interface MetaFile {
13
- path: string;
14
- data: {
15
- frontmatter: Record<string, unknown>;
16
- structuredData?: StructuredData;
17
- [key: string]: unknown;
18
- };
19
- }
20
11
  /**
21
12
  * Load MDX/markdown files
22
13
  *
@@ -24,4 +15,4 @@ interface MetaFile {
24
15
  */
25
16
  declare function loader(this: LoaderContext<Options>, source: string, callback: LoaderContext<Options>['callback']): Promise<void>;
26
17
 
27
- export { type MetaFile, type Options, loader as default };
18
+ export { type Options, loader as default };