fumadocs-mdx 13.0.2 → 13.0.4

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 (67) hide show
  1. package/dist/bin.cjs +381 -279
  2. package/dist/{build-mdx-D-r3_eQL.d.cts → build-mdx-BjXOmv0b.d.cts} +1 -1
  3. package/dist/{build-mdx-CCNr86q6.d.ts → build-mdx-CY5UldCO.d.ts} +1 -1
  4. package/dist/bun/index.cjs +177 -57
  5. package/dist/bun/index.d.cts +2 -2
  6. package/dist/bun/index.d.ts +2 -2
  7. package/dist/bun/index.js +26 -34
  8. package/dist/chunk-2HXTGJBI.js +101 -0
  9. package/dist/chunk-4JSFLXXT.js +8 -0
  10. package/dist/{chunk-JVZFH6ND.js → chunk-QXHN25N3.js} +2 -2
  11. package/dist/{chunk-EELYB2XC.js → chunk-TZ5EQBFW.js} +9 -103
  12. package/dist/chunk-VUEZTR2H.js +26 -0
  13. package/dist/{chunk-XQ5O7IPO.js → chunk-XYGORKQA.js} +5 -3
  14. package/dist/chunk-YAIPHUCZ.js +56 -0
  15. package/dist/chunk-ZNVPB2IR.js +170 -0
  16. package/dist/config/index.d.cts +2 -2
  17. package/dist/config/index.d.ts +2 -2
  18. package/dist/{core-B6j6Fxse.d.cts → core-DB7TdlyC.d.cts} +23 -7
  19. package/dist/{core-B6j6Fxse.d.ts → core-DB7TdlyC.d.ts} +23 -7
  20. package/dist/index-D7s7kCc2.d.cts +7 -0
  21. package/dist/index-D7s7kCc2.d.ts +7 -0
  22. package/dist/index.d.cts +4 -4
  23. package/dist/index.d.ts +4 -4
  24. package/dist/load-from-file-AVYOFOI7.js +7 -0
  25. package/dist/next/index.cjs +147 -142
  26. package/dist/next/index.js +58 -39
  27. package/dist/node/loader.cjs +242 -128
  28. package/dist/node/loader.d.cts +2 -2
  29. package/dist/node/loader.d.ts +2 -2
  30. package/dist/node/loader.js +29 -16
  31. package/dist/plugins/json-schema.cjs +22 -70
  32. package/dist/plugins/json-schema.d.cts +2 -2
  33. package/dist/plugins/json-schema.d.ts +2 -2
  34. package/dist/plugins/json-schema.js +19 -14
  35. package/dist/runtime/next/async.cjs +56 -11
  36. package/dist/runtime/next/async.d.cts +4 -6
  37. package/dist/runtime/next/async.d.ts +4 -6
  38. package/dist/runtime/next/async.js +3 -6
  39. package/dist/runtime/next/index.d.cts +5 -5
  40. package/dist/runtime/next/index.d.ts +5 -5
  41. package/dist/runtime/vite/browser.d.cts +3 -3
  42. package/dist/runtime/vite/browser.d.ts +3 -3
  43. package/dist/runtime/vite/server.d.cts +3 -3
  44. package/dist/runtime/vite/server.d.ts +3 -3
  45. package/dist/{types-DKGMoay5.d.cts → types-Bnh9n7mj.d.cts} +2 -2
  46. package/dist/{types-AGzTfBmf.d.ts → types-ey1AZqrg.d.ts} +2 -2
  47. package/dist/vite/index.cjs +265 -163
  48. package/dist/vite/index.d.cts +4 -0
  49. package/dist/vite/index.d.ts +4 -0
  50. package/dist/vite/index.js +140 -122
  51. package/dist/webpack/{index.cjs → mdx.cjs} +126 -104
  52. package/dist/webpack/mdx.d.cts +6 -0
  53. package/dist/webpack/mdx.d.ts +6 -0
  54. package/dist/webpack/{index.js → mdx.js} +12 -14
  55. package/dist/webpack/meta.cjs +528 -0
  56. package/dist/webpack/meta.d.cts +6 -0
  57. package/dist/webpack/meta.d.ts +6 -0
  58. package/dist/webpack/meta.js +42 -0
  59. package/loader-mdx.cjs +1 -1
  60. package/loader-meta.cjs +7 -0
  61. package/package.json +11 -8
  62. package/dist/chunk-U4MQ44TS.js +0 -53
  63. package/dist/chunk-XZY2AWJI.js +0 -81
  64. package/dist/chunk-YVCR6FUH.js +0 -82
  65. package/dist/load-MNG3CLET.js +0 -7
  66. package/dist/webpack/index.d.cts +0 -15
  67. package/dist/webpack/index.d.ts +0 -15
@@ -0,0 +1,528 @@
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/loaders/mdx/preset.ts
34
+ var preset_exports = {};
35
+ __export(preset_exports, {
36
+ getDefaultMDXOptions: () => getDefaultMDXOptions
37
+ });
38
+ function pluginOption(def, options = []) {
39
+ const list = def(Array.isArray(options) ? options : []).filter(
40
+ Boolean
41
+ );
42
+ if (typeof options === "function") {
43
+ return options(list);
44
+ }
45
+ return list;
46
+ }
47
+ function getDefaultMDXOptions({
48
+ valueToExport = [],
49
+ rehypeCodeOptions,
50
+ remarkImageOptions,
51
+ remarkHeadingOptions,
52
+ remarkStructureOptions,
53
+ remarkCodeTabOptions,
54
+ remarkNpmOptions,
55
+ _withoutBundler = false,
56
+ ...mdxOptions
57
+ }) {
58
+ const remarkPlugins = pluginOption(
59
+ (v) => [
60
+ plugins.remarkGfm,
61
+ [
62
+ plugins.remarkHeading,
63
+ {
64
+ generateToc: false,
65
+ ...remarkHeadingOptions
66
+ }
67
+ ],
68
+ remarkImageOptions !== false && [
69
+ plugins.remarkImage,
70
+ {
71
+ ...remarkImageOptions,
72
+ useImport: _withoutBundler ? false : remarkImageOptions?.useImport
73
+ }
74
+ ],
75
+ "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
76
+ plugins.remarkCodeTab,
77
+ remarkCodeTabOptions
78
+ ],
79
+ "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
80
+ ...v,
81
+ remarkStructureOptions !== false && [
82
+ plugins.remarkStructure,
83
+ remarkStructureOptions
84
+ ],
85
+ () => {
86
+ return (_, file) => {
87
+ file.data["mdx-export"] ??= [];
88
+ for (const name of valueToExport) {
89
+ if (name in file.data)
90
+ file.data["mdx-export"].push({ name, value: file.data[name] });
91
+ }
92
+ };
93
+ }
94
+ ],
95
+ mdxOptions.remarkPlugins
96
+ );
97
+ const rehypePlugins = pluginOption(
98
+ (v) => [
99
+ rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
100
+ ...v,
101
+ plugins.rehypeToc
102
+ ],
103
+ mdxOptions.rehypePlugins
104
+ );
105
+ return {
106
+ ...mdxOptions,
107
+ outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
108
+ remarkPlugins,
109
+ rehypePlugins
110
+ };
111
+ }
112
+ var plugins;
113
+ var init_preset = __esm({
114
+ "src/loaders/mdx/preset.ts"() {
115
+ "use strict";
116
+ plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
117
+ }
118
+ });
119
+
120
+ // src/config/build.ts
121
+ function buildCollection(name, config) {
122
+ if (config.type === "docs") {
123
+ return {
124
+ ...config,
125
+ name,
126
+ meta: buildPrimitiveCollection(name, config.meta),
127
+ docs: buildPrimitiveCollection(name, config.docs)
128
+ };
129
+ }
130
+ return buildPrimitiveCollection(name, config);
131
+ }
132
+ function buildPrimitiveCollection(name, { files, ...config }) {
133
+ const supportedFormats = SupportedFormats[config.type];
134
+ const patterns = files ?? [`**/*.{${supportedFormats.join(",")}}`];
135
+ let matchers;
136
+ return {
137
+ ...config,
138
+ name,
139
+ patterns,
140
+ isFileSupported(filePath) {
141
+ return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
142
+ },
143
+ hasFile(filePath) {
144
+ matchers ??= (Array.isArray(config.dir) ? config.dir : [config.dir]).map(
145
+ (dir) => (0, import_picomatch.default)(patterns, {
146
+ cwd: dir
147
+ })
148
+ );
149
+ return this.isFileSupported(filePath) && matchers.some((matcher) => matcher(filePath));
150
+ }
151
+ };
152
+ }
153
+ function buildConfig(config) {
154
+ const collections = /* @__PURE__ */ new Map();
155
+ const loaded = {};
156
+ for (const [k, v] of Object.entries(config)) {
157
+ if (!v) {
158
+ continue;
159
+ }
160
+ if (typeof v === "object" && "type" in v) {
161
+ if (v.type === "docs") {
162
+ collections.set(k, buildCollection(k, v));
163
+ continue;
164
+ }
165
+ if (v.type === "doc" || v.type === "meta") {
166
+ collections.set(
167
+ k,
168
+ buildCollection(k, v)
169
+ );
170
+ continue;
171
+ }
172
+ }
173
+ if (k === "default" && v) {
174
+ Object.assign(loaded, v);
175
+ continue;
176
+ }
177
+ throw new Error(
178
+ `Unknown export "${k}", you can only export collections from source configuration file.`
179
+ );
180
+ }
181
+ if (loaded.collections) {
182
+ for (const [k, v] of Object.entries(loaded.collections)) {
183
+ collections.set(k, buildCollection(k, v));
184
+ }
185
+ }
186
+ const mdxOptionsCache = /* @__PURE__ */ new Map();
187
+ return {
188
+ global: loaded,
189
+ collectionList: Array.from(collections.values()),
190
+ getCollection(name) {
191
+ return collections.get(name);
192
+ },
193
+ async getDefaultMDXOptions(mode = "default") {
194
+ const cached = mdxOptionsCache.get(mode);
195
+ if (cached) return cached;
196
+ const input = this.global.mdxOptions;
197
+ async function uncached() {
198
+ const options = typeof input === "function" ? await input() : input;
199
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_preset(), preset_exports));
200
+ if (options?.preset === "minimal") return options;
201
+ return getDefaultMDXOptions2({
202
+ ...options,
203
+ _withoutBundler: mode === "remote"
204
+ });
205
+ }
206
+ const result = uncached();
207
+ mdxOptionsCache.set(mode, result);
208
+ return result;
209
+ }
210
+ };
211
+ }
212
+ var import_picomatch, SupportedFormats;
213
+ var init_build = __esm({
214
+ "src/config/build.ts"() {
215
+ "use strict";
216
+ import_picomatch = __toESM(require("picomatch"), 1);
217
+ SupportedFormats = {
218
+ doc: ["mdx", "md"],
219
+ meta: ["json", "yaml"]
220
+ };
221
+ }
222
+ });
223
+
224
+ // src/config/load-from-file.ts
225
+ var load_from_file_exports = {};
226
+ __export(load_from_file_exports, {
227
+ loadConfig: () => loadConfig
228
+ });
229
+ async function compileConfig(configPath, outDir) {
230
+ const { build } = await import("esbuild");
231
+ const transformed = await build({
232
+ entryPoints: [{ in: configPath, out: "source.config" }],
233
+ bundle: true,
234
+ outdir: outDir,
235
+ target: "node20",
236
+ write: true,
237
+ platform: "node",
238
+ format: "esm",
239
+ packages: "external",
240
+ outExtension: {
241
+ ".js": ".mjs"
242
+ },
243
+ allowOverwrite: true
244
+ });
245
+ if (transformed.errors.length > 0) {
246
+ throw new Error("failed to compile configuration file");
247
+ }
248
+ }
249
+ async function loadConfig(configPath, outDir, build = false) {
250
+ if (build) await compileConfig(configPath, outDir);
251
+ const url = (0, import_node_url2.pathToFileURL)(path3.resolve(outDir, "source.config.mjs"));
252
+ url.searchParams.set("hash", Date.now().toString());
253
+ const config = import(url.href).then(
254
+ (loaded) => buildConfig(loaded)
255
+ );
256
+ return await config;
257
+ }
258
+ var path3, import_node_url2;
259
+ var init_load_from_file = __esm({
260
+ "src/config/load-from-file.ts"() {
261
+ "use strict";
262
+ path3 = __toESM(require("path"), 1);
263
+ import_node_url2 = require("url");
264
+ init_build();
265
+ }
266
+ });
267
+
268
+ // src/webpack/meta.ts
269
+ var meta_exports = {};
270
+ __export(meta_exports, {
271
+ default: () => loader
272
+ });
273
+ module.exports = __toCommonJS(meta_exports);
274
+
275
+ // src/loaders/adapter.ts
276
+ var import_node_url = require("url");
277
+ var import_promises = __toESM(require("fs/promises"), 1);
278
+ var import_node_querystring = require("querystring");
279
+
280
+ // src/utils/validation.ts
281
+ var import_picocolors = __toESM(require("picocolors"), 1);
282
+ var ValidationError = class extends Error {
283
+ constructor(message, issues) {
284
+ super(
285
+ `${message}:
286
+ ${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`
287
+ );
288
+ this.title = message;
289
+ this.issues = issues;
290
+ }
291
+ toStringFormatted() {
292
+ return [
293
+ import_picocolors.default.bold(`[MDX] ${this.title}:`),
294
+ ...this.issues.map(
295
+ (issue) => import_picocolors.default.redBright(
296
+ `- ${import_picocolors.default.bold(issue.path?.join(".") ?? "*")}: ${issue.message}`
297
+ )
298
+ )
299
+ ].join("\n");
300
+ }
301
+ };
302
+ async function validate(schema, data, context, errorMessage) {
303
+ if (typeof schema === "function" && !("~standard" in schema)) {
304
+ schema = schema(context);
305
+ }
306
+ if ("~standard" in schema) {
307
+ const result = await schema["~standard"].validate(
308
+ data
309
+ );
310
+ if (result.issues) {
311
+ throw new ValidationError(errorMessage, result.issues);
312
+ }
313
+ return result.value;
314
+ }
315
+ return data;
316
+ }
317
+
318
+ // src/loaders/adapter.ts
319
+ var import_node_path = __toESM(require("path"), 1);
320
+ function toWebpack(loader2) {
321
+ return async function(source, callback) {
322
+ try {
323
+ const result = await loader2({
324
+ filePath: this.resourcePath,
325
+ query: (0, import_node_querystring.parse)(this.resourceQuery.slice(1)),
326
+ source,
327
+ development: this.mode === "development",
328
+ compiler: this
329
+ });
330
+ if (result === null) {
331
+ callback(void 0, source);
332
+ } else {
333
+ callback(void 0, result.code, result.map);
334
+ }
335
+ } catch (error) {
336
+ if (error instanceof ValidationError) {
337
+ return callback(new Error(error.toStringFormatted()));
338
+ }
339
+ if (!(error instanceof Error)) throw error;
340
+ const fpath = import_node_path.default.relative(this.context, this.resourcePath);
341
+ error.message = `${fpath}:${error.name}: ${error.message}`;
342
+ callback(error);
343
+ }
344
+ };
345
+ }
346
+
347
+ // src/core.ts
348
+ var import_node_path2 = __toESM(require("path"), 1);
349
+ var import_promises2 = __toESM(require("fs/promises"), 1);
350
+ function createCore(options, defaultPlugins = []) {
351
+ let config;
352
+ let plugins2;
353
+ return {
354
+ _options: options,
355
+ getPluginContext() {
356
+ return {
357
+ core: this,
358
+ ...options
359
+ };
360
+ },
361
+ /**
362
+ * Convenient cache store, reset when config changes
363
+ */
364
+ cache: /* @__PURE__ */ new Map(),
365
+ async init({ config: newConfig }) {
366
+ config = await newConfig;
367
+ this.cache.clear();
368
+ plugins2 = [];
369
+ for await (const option of [
370
+ ...defaultPlugins,
371
+ ...config.global.plugins ?? []
372
+ ]) {
373
+ if (!option) continue;
374
+ if (Array.isArray(option)) plugins2.push(...option);
375
+ else plugins2.push(option);
376
+ }
377
+ for (const plugin of plugins2) {
378
+ const out = await plugin.config?.call(this.getPluginContext(), config);
379
+ if (out) config = out;
380
+ }
381
+ return this;
382
+ },
383
+ getConfig() {
384
+ return config;
385
+ },
386
+ async initServer(server) {
387
+ for (const plugin of plugins2) {
388
+ await plugin.configureServer?.call(this.getPluginContext(), server);
389
+ }
390
+ },
391
+ async emitAndWrite({
392
+ filterPlugin = () => true
393
+ } = {}) {
394
+ const start = performance.now();
395
+ const out = await Promise.all(
396
+ plugins2.map((plugin) => {
397
+ if (!filterPlugin(plugin) || !plugin.emit) return [];
398
+ return plugin.emit.call(this.getPluginContext());
399
+ })
400
+ );
401
+ await Promise.all(
402
+ out.flat().map(async (entry) => {
403
+ const file = import_node_path2.default.join(options.outDir, entry.path);
404
+ await import_promises2.default.mkdir(import_node_path2.default.dirname(file), { recursive: true });
405
+ await import_promises2.default.writeFile(file, entry.content);
406
+ })
407
+ );
408
+ console.log(`[MDX] generated files in ${performance.now() - start}ms`);
409
+ }
410
+ };
411
+ }
412
+
413
+ // src/loaders/config.ts
414
+ var import_promises3 = __toESM(require("fs/promises"), 1);
415
+ function createStandaloneConfigLoader({
416
+ core,
417
+ buildConfig: buildConfig2,
418
+ mode
419
+ }) {
420
+ let loaded;
421
+ async function getConfigHash() {
422
+ if (mode === "production") return "static";
423
+ const stats = await import_promises3.default.stat(core._options.configPath).catch(() => {
424
+ throw new Error("Cannot find config file");
425
+ });
426
+ return stats.mtime.getTime().toString();
427
+ }
428
+ async function newConfig() {
429
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_load_from_file(), load_from_file_exports));
430
+ await core.init({
431
+ config: loadConfig2(
432
+ core._options.configPath,
433
+ core._options.outDir,
434
+ buildConfig2
435
+ )
436
+ });
437
+ return core.getConfig();
438
+ }
439
+ return {
440
+ async getConfig() {
441
+ const hash = await getConfigHash();
442
+ if (loaded && loaded.hash === hash) return loaded.config;
443
+ loaded = {
444
+ hash,
445
+ config: newConfig()
446
+ };
447
+ return loaded.config;
448
+ }
449
+ };
450
+ }
451
+
452
+ // src/loaders/meta.ts
453
+ var import_js_yaml = require("js-yaml");
454
+ var import_zod = require("zod");
455
+ var querySchema = import_zod.z.object({
456
+ collection: import_zod.z.string().optional()
457
+ }).loose();
458
+ function createMetaLoader(configLoader, resolve2 = {}) {
459
+ const { json: resolveJson = "js", yaml: resolveYaml = "js" } = resolve2;
460
+ return async ({ filePath, query, source }) => {
461
+ const isJson = filePath.endsWith(".json");
462
+ const parsed = querySchema.parse(query);
463
+ const collection = parsed.collection ? (await configLoader.getConfig()).getCollection(parsed.collection) : void 0;
464
+ if (!collection) return null;
465
+ let data;
466
+ try {
467
+ data = isJson ? JSON.parse(source) : (0, import_js_yaml.load)(source);
468
+ } catch (e) {
469
+ throw new Error(`invalid data in ${filePath}`, { cause: e });
470
+ }
471
+ let schema;
472
+ switch (collection?.type) {
473
+ case "meta":
474
+ schema = collection.schema;
475
+ break;
476
+ case "docs":
477
+ schema = collection.meta.schema;
478
+ break;
479
+ }
480
+ if (schema) {
481
+ data = await validate(
482
+ schema,
483
+ data,
484
+ { path: filePath, source },
485
+ `invalid data in ${filePath}`
486
+ );
487
+ }
488
+ let code;
489
+ if (isJson) {
490
+ code = resolveJson === "json" ? JSON.stringify(data) : `export default ${JSON.stringify(data)}`;
491
+ } else {
492
+ code = resolveYaml === "yaml" ? (0, import_js_yaml.dump)(data) : `export default ${JSON.stringify(data)}`;
493
+ }
494
+ return {
495
+ code,
496
+ map: null
497
+ };
498
+ };
499
+ }
500
+
501
+ // src/webpack/meta.ts
502
+ var instance;
503
+ async function loader(source, callback) {
504
+ const { isDev, outDir, configPath } = this.getOptions();
505
+ this.cacheable(true);
506
+ this.addDependency(configPath);
507
+ if (!instance) {
508
+ const core = createCore({
509
+ environment: "webpack",
510
+ outDir,
511
+ configPath
512
+ });
513
+ instance = toWebpack(
514
+ createMetaLoader(
515
+ createStandaloneConfigLoader({
516
+ core,
517
+ buildConfig: false,
518
+ mode: isDev ? "dev" : "production"
519
+ }),
520
+ {
521
+ json: "json",
522
+ yaml: "yaml"
523
+ }
524
+ )
525
+ );
526
+ }
527
+ await instance.call(this, source, callback);
528
+ }
@@ -0,0 +1,6 @@
1
+ import { LoaderContext } from 'webpack';
2
+ import { W as WebpackLoaderOptions } from '../index-D7s7kCc2.cjs';
3
+
4
+ declare function loader(this: LoaderContext<WebpackLoaderOptions>, source: string, callback: LoaderContext<WebpackLoaderOptions>['callback']): Promise<void>;
5
+
6
+ export { loader as default };
@@ -0,0 +1,6 @@
1
+ import { LoaderContext } from 'webpack';
2
+ import { W as WebpackLoaderOptions } from '../index-D7s7kCc2.js';
3
+
4
+ declare function loader(this: LoaderContext<WebpackLoaderOptions>, source: string, callback: LoaderContext<WebpackLoaderOptions>['callback']): Promise<void>;
5
+
6
+ export { loader as default };
@@ -0,0 +1,42 @@
1
+ import {
2
+ createMetaLoader
3
+ } from "../chunk-YAIPHUCZ.js";
4
+ import {
5
+ createStandaloneConfigLoader,
6
+ toWebpack
7
+ } from "../chunk-ZNVPB2IR.js";
8
+ import {
9
+ createCore
10
+ } from "../chunk-TZ5EQBFW.js";
11
+
12
+ // src/webpack/meta.ts
13
+ var instance;
14
+ async function loader(source, callback) {
15
+ const { isDev, outDir, configPath } = this.getOptions();
16
+ this.cacheable(true);
17
+ this.addDependency(configPath);
18
+ if (!instance) {
19
+ const core = createCore({
20
+ environment: "webpack",
21
+ outDir,
22
+ configPath
23
+ });
24
+ instance = toWebpack(
25
+ createMetaLoader(
26
+ createStandaloneConfigLoader({
27
+ core,
28
+ buildConfig: false,
29
+ mode: isDev ? "dev" : "production"
30
+ }),
31
+ {
32
+ json: "json",
33
+ yaml: "yaml"
34
+ }
35
+ )
36
+ );
37
+ }
38
+ await instance.call(this, source, callback);
39
+ }
40
+ export {
41
+ loader as default
42
+ };
package/loader-mdx.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = function loader(code) {
2
2
  const callback = this.async();
3
3
 
4
- import('./dist/webpack/index.js').then((mod) =>
4
+ import('./dist/webpack/mdx.js').then((mod) =>
5
5
  mod.default.call(this, code, callback),
6
6
  );
7
7
  };
@@ -0,0 +1,7 @@
1
+ module.exports = function loader(code) {
2
+ const callback = this.async();
3
+
4
+ import('./dist/webpack/meta.js').then((mod) =>
5
+ mod.default.call(this, code, callback),
6
+ );
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "13.0.2",
3
+ "version": "13.0.4",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -13,6 +13,7 @@
13
13
  "type": "module",
14
14
  "exports": {
15
15
  "./loader-mdx": "./loader-mdx.cjs",
16
+ "./loader-meta": "./loader-meta.cjs",
16
17
  "./config": {
17
18
  "import": "./dist/config/index.js",
18
19
  "types": "./dist/config/index.d.ts",
@@ -71,14 +72,15 @@
71
72
  "bin": "./dist/bin.js",
72
73
  "files": [
73
74
  "dist/*",
74
- "loader-mdx.cjs"
75
+ "loader-mdx.cjs",
76
+ "loader-meta.cjs"
75
77
  ],
76
78
  "dependencies": {
77
79
  "@mdx-js/mdx": "^3.1.1",
78
80
  "@standard-schema/spec": "^1.0.0",
79
81
  "chokidar": "^4.0.3",
80
82
  "esbuild": "^0.25.11",
81
- "estree-util-value-to-estree": "^3.4.1",
83
+ "estree-util-value-to-estree": "^3.5.0",
82
84
  "js-yaml": "^4.1.0",
83
85
  "lru-cache": "^11.2.2",
84
86
  "mdast-util-to-markdown": "^2.1.2",
@@ -93,27 +95,28 @@
93
95
  "zod": "^4.1.12"
94
96
  },
95
97
  "devDependencies": {
96
- "@types/bun": "^1.3.0",
98
+ "@types/bun": "^1.3.1",
97
99
  "@types/js-yaml": "^4.0.9",
98
100
  "@types/mdast": "^4.0.4",
99
101
  "@types/mdx": "^2.0.13",
100
- "@types/node": "^24.9.1",
102
+ "@types/node": "^24.9.2",
101
103
  "@types/picomatch": "^4.0.2",
102
104
  "@types/react": "^19.2.2",
105
+ "astro": "^5.6.1",
103
106
  "mdast-util-directive": "^3.1.0",
104
107
  "mdast-util-mdx-jsx": "^3.2.0",
105
- "next": "16.0.0",
108
+ "next": "16.0.1",
106
109
  "react": "^19.2.0",
107
110
  "remark": "^15.0.1",
108
111
  "remark-directive": "^4.0.0",
109
112
  "remark-stringify": "^11.0.0",
110
113
  "rollup": "^4.52.5",
111
114
  "vfile": "^6.0.3",
112
- "vite": "^7.1.11",
115
+ "vite": "^7.1.12",
113
116
  "webpack": "^5.102.1",
114
117
  "@fumadocs/mdx-remote": "1.4.3",
115
118
  "eslint-config-custom": "0.0.0",
116
- "fumadocs-core": "16.0.3",
119
+ "fumadocs-core": "16.0.7",
117
120
  "tsconfig": "0.0.0"
118
121
  },
119
122
  "peerDependencies": {