fumadocs-mdx 11.6.0 → 11.6.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.
@@ -1,12 +1,18 @@
1
1
  // src/runtime/index.ts
2
+ import fs from "node:fs";
2
3
  var _runtime = {
3
4
  doc(files) {
4
5
  return files.map((file) => {
5
6
  const { default: body, frontmatter, ...exports } = file.data;
7
+ let cachedContent;
6
8
  return {
7
9
  body,
8
10
  ...exports,
9
11
  ...frontmatter,
12
+ get content() {
13
+ cachedContent ??= fs.readFileSync(file.info.absolutePath).toString();
14
+ return cachedContent;
15
+ },
10
16
  _exports: file.data,
11
17
  _file: file.info
12
18
  };
@@ -86,6 +86,7 @@ function defineDocs(options) {
86
86
  // @ts-expect-error -- internal type inferring
87
87
  meta: defineCollections({
88
88
  type: "meta",
89
+ files: ["**/meta.{json,yaml}"],
89
90
  dir,
90
91
  schema: metaSchema,
91
92
  ...options?.meta
@@ -1,4 +1,4 @@
1
- export { c as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, a as DocsCollection, F as FileInfo, G as GlobalConfig, b as MarkdownProps, M as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-BaW0PQDJ.cjs';
1
+ export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-Cbpc-b73.cjs';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
4
  import '@mdx-js/mdx';
@@ -1,4 +1,4 @@
1
- export { c as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, a as DocsCollection, F as FileInfo, G as GlobalConfig, b as MarkdownProps, M as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-BaW0PQDJ.js';
1
+ export { a as BaseCollection, B as BaseCollectionEntry, C as CollectionSchema, h as DefaultMDXOptions, D as DocCollection, c as DocsCollection, F as FileInfo, G as GlobalConfig, M as MarkdownProps, b as MetaCollection, d as defineCollections, g as defineConfig, e as defineDocs, f as frontmatterSchema, i as getDefaultMDXOptions, m as metaSchema } from '../define-Cbpc-b73.js';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
4
  import '@mdx-js/mdx';
@@ -35,6 +35,7 @@ function defineDocs(options) {
35
35
  // @ts-expect-error -- internal type inferring
36
36
  meta: defineCollections({
37
37
  type: "meta",
38
+ files: ["**/meta.{json,yaml}"],
38
39
  dir,
39
40
  schema: metaSchema,
40
41
  ...options?.meta
@@ -50,6 +50,9 @@ interface MarkdownProps {
50
50
  lastModified?: Date;
51
51
  }
52
52
  interface BaseCollectionEntry {
53
+ /**
54
+ * Raw file path of collection entry, including absolute path (not normalized).
55
+ */
53
56
  _file: FileInfo;
54
57
  }
55
58
 
@@ -198,4 +201,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
198
201
  };
199
202
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
200
203
 
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 };
204
+ export { type BaseCollectionEntry as B, type CollectionSchema as C, type DocCollection as D, type FileInfo as F, type GlobalConfig as G, type MarkdownProps as M, type BaseCollection as a, type MetaCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, frontmatterSchema as f, defineConfig as g, type DefaultMDXOptions as h, getDefaultMDXOptions as i, metaSchema as m };
@@ -50,6 +50,9 @@ interface MarkdownProps {
50
50
  lastModified?: Date;
51
51
  }
52
52
  interface BaseCollectionEntry {
53
+ /**
54
+ * Raw file path of collection entry, including absolute path (not normalized).
55
+ */
53
56
  _file: FileInfo;
54
57
  }
55
58
 
@@ -198,4 +201,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
198
201
  };
199
202
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
200
203
 
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 };
204
+ export { type BaseCollectionEntry as B, type CollectionSchema as C, type DocCollection as D, type FileInfo as F, type GlobalConfig as G, type MarkdownProps as M, type BaseCollection as a, type MetaCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, frontmatterSchema as f, defineConfig as g, type DefaultMDXOptions as h, getDefaultMDXOptions as i, metaSchema as m };
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
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
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -27,14 +37,20 @@ __export(index_exports, {
27
37
  module.exports = __toCommonJS(index_exports);
28
38
 
29
39
  // src/runtime/index.ts
40
+ var import_node_fs = __toESM(require("fs"), 1);
30
41
  var _runtime = {
31
42
  doc(files) {
32
43
  return files.map((file) => {
33
44
  const { default: body, frontmatter, ...exports2 } = file.data;
45
+ let cachedContent;
34
46
  return {
35
47
  body,
36
48
  ...exports2,
37
49
  ...frontmatter,
50
+ get content() {
51
+ cachedContent ??= import_node_fs.default.readFileSync(file.info.absolutePath).toString();
52
+ return cachedContent;
53
+ },
38
54
  _exports: file.data,
39
55
  _file: file.info
40
56
  };
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { B as BaseCollectionEntry } from './define-BaW0PQDJ.cjs';
3
- import { R as Runtime } from './types-BNrQHCj5.cjs';
2
+ import { B as BaseCollectionEntry } from './define-Cbpc-b73.cjs';
3
+ import { R as Runtime } from './types-CY4MX9if.cjs';
4
4
  import '@mdx-js/mdx';
5
5
  import 'mdx/types';
6
6
  import 'fumadocs-core/mdx-plugins';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { B as BaseCollectionEntry } from './define-BaW0PQDJ.js';
3
- import { R as Runtime } from './types-DEduCvIT.js';
2
+ import { B as BaseCollectionEntry } from './define-Cbpc-b73.js';
3
+ import { R as Runtime } from './types-DeEXKgfl.js';
4
4
  import '@mdx-js/mdx';
5
5
  import 'mdx/types';
6
6
  import 'fumadocs-core/mdx-plugins';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  _runtime,
3
3
  createMDXSource,
4
4
  resolveFiles
5
- } from "./chunk-VFALQK6O.js";
5
+ } from "./chunk-4LSNX4UE.js";
6
6
  export {
7
7
  _runtime,
8
8
  createMDXSource,
@@ -2,13 +2,13 @@ import {
2
2
  getConfigHash,
3
3
  loadConfig
4
4
  } from "./chunk-HFLDWPJA.js";
5
- import "./chunk-DRVUBK5B.js";
6
5
  import {
7
6
  validate
8
7
  } from "./chunk-2ZOW45YZ.js";
9
8
  import {
10
9
  remarkInclude
11
10
  } from "./chunk-MK7EXW7O.js";
11
+ import "./chunk-DRVUBK5B.js";
12
12
 
13
13
  // src/loader-mdx.ts
14
14
  import * as path2 from "node:path";
@@ -35,7 +35,7 @@ var watcher_exports = {};
35
35
  __export(watcher_exports, {
36
36
  watcher: () => watcher
37
37
  });
38
- function watcher(configPath, config) {
38
+ function watcher(configPath, config, ignored) {
39
39
  const deps = [configPath];
40
40
  function add(dir) {
41
41
  if (Array.isArray(dir)) deps.push(...dir);
@@ -51,6 +51,7 @@ function watcher(configPath, config) {
51
51
  }
52
52
  return (0, import_chokidar.watch)(deps, {
53
53
  ignoreInitial: true,
54
+ ignored,
54
55
  persistent: true
55
56
  });
56
57
  }
@@ -263,6 +264,7 @@ var fileCache = {
263
264
 
264
265
  // src/map/generate.ts
265
266
  var import_gray_matter = __toESM(require("gray-matter"), 1);
267
+ var import_js_yaml = require("js-yaml");
266
268
  async function readFileWithCache(file) {
267
269
  const cached = fileCache.read("read-file", file);
268
270
  if (cached) return cached;
@@ -301,7 +303,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
301
303
  async function getMetaEntries(collection, files) {
302
304
  const items = files.map(async (file) => {
303
305
  const source = await readFileWithCache(file.absolutePath).catch(() => "");
304
- let data = source.length === 0 ? {} : JSON.parse(source);
306
+ let data = source.length === 0 ? {} : parseMetaEntry(file.absolutePath, source);
305
307
  if (collection?.schema) {
306
308
  data = await validate(
307
309
  collection.schema,
@@ -426,17 +428,26 @@ function toImportPath(file, dir) {
426
428
  }
427
429
  return importPath.replaceAll(path2.sep, "/");
428
430
  }
431
+ function parseMetaEntry(file, content) {
432
+ const extname3 = path2.extname(file);
433
+ try {
434
+ if (extname3 === ".json") return JSON.parse(content);
435
+ if (extname3 === ".yaml") return (0, import_js_yaml.load)(content);
436
+ } catch (e) {
437
+ throw new Error(`Failed to parse meta file: ${file}.`, {
438
+ cause: e
439
+ });
440
+ }
441
+ throw new Error(`Unknown meta file format: ${extname3}, in ${file}.`);
442
+ }
429
443
 
430
444
  // src/map/index.ts
431
445
  async function start(dev, configPath, outDir2) {
432
- void fs3.rm(path3.resolve(outDir2, `index.js`), { force: true });
433
- void fs3.rm(path3.resolve(outDir2, `index.d.ts`), { force: true });
434
- await fs3.mkdir(outDir2, { recursive: true });
435
446
  let configHash = await getConfigHash(configPath);
436
447
  let config = await loadConfig(configPath, configHash, true);
437
448
  const outPath = path3.resolve(outDir2, `index.ts`);
438
449
  async function updateMapFile() {
439
- console.time(`[MDX] update map file`);
450
+ const start2 = performance.now();
440
451
  try {
441
452
  await fs3.writeFile(
442
453
  outPath,
@@ -449,12 +460,12 @@ async function start(dev, configPath, outDir2) {
449
460
  console.error(err);
450
461
  }
451
462
  }
452
- console.timeEnd(`[MDX] update map file`);
463
+ console.log(`[MDX] updated map file in ${performance.now() - start2}ms`);
453
464
  }
454
465
  await updateMapFile();
455
466
  if (dev) {
456
467
  const { watcher: watcher2 } = await Promise.resolve().then(() => (init_watcher(), watcher_exports));
457
- const instance = watcher2(configPath, config);
468
+ const instance = watcher2(configPath, config, [outPath]);
458
469
  instance.on("ready", () => {
459
470
  console.log("[MDX] started dev server");
460
471
  });
@@ -539,21 +550,14 @@ function createMDX({
539
550
 
540
551
  // src/postinstall.ts
541
552
  var path5 = __toESM(require("path"), 1);
542
- var fs4 = __toESM(require("fs"), 1);
553
+ var fs4 = __toESM(require("fs/promises"), 1);
543
554
  async function postInstall(configPath = findConfigFile()) {
544
555
  const jsOut = path5.resolve(".source/index.ts");
545
556
  const hash = await getConfigHash(configPath);
546
557
  const config = await loadConfig(configPath, hash, true);
547
- fs4.mkdirSync(path5.dirname(jsOut), { recursive: true });
548
- fs4.writeFileSync(
549
- jsOut,
550
- await generateJS(
551
- configPath,
552
- config,
553
- path5.resolve(".source/index.ts"),
554
- hash
555
- )
556
- );
558
+ await fs4.rm(path5.dirname(jsOut), { recursive: true });
559
+ await fs4.mkdir(path5.dirname(jsOut), { recursive: true });
560
+ await fs4.writeFile(jsOut, await generateJS(configPath, config, jsOut, hash));
557
561
  console.log("[MDX] types generated");
558
562
  }
559
563
  // Annotate the CommonJS export names for ESM import in node:
@@ -3,11 +3,11 @@ import {
3
3
  getConfigHash,
4
4
  loadConfig
5
5
  } from "../chunk-HFLDWPJA.js";
6
- import "../chunk-DRVUBK5B.js";
7
6
  import {
8
7
  ValidationError,
9
8
  validate
10
9
  } from "../chunk-2ZOW45YZ.js";
10
+ import "../chunk-DRVUBK5B.js";
11
11
 
12
12
  // src/next/create.ts
13
13
  import path3 from "node:path";
@@ -53,6 +53,7 @@ var fileCache = {
53
53
 
54
54
  // src/map/generate.ts
55
55
  import matter from "gray-matter";
56
+ import { load } from "js-yaml";
56
57
  async function readFileWithCache(file) {
57
58
  const cached = fileCache.read("read-file", file);
58
59
  if (cached) return cached;
@@ -91,7 +92,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
91
92
  async function getMetaEntries(collection, files) {
92
93
  const items = files.map(async (file) => {
93
94
  const source = await readFileWithCache(file.absolutePath).catch(() => "");
94
- let data = source.length === 0 ? {} : JSON.parse(source);
95
+ let data = source.length === 0 ? {} : parseMetaEntry(file.absolutePath, source);
95
96
  if (collection?.schema) {
96
97
  data = await validate(
97
98
  collection.schema,
@@ -216,17 +217,26 @@ function toImportPath(file, dir) {
216
217
  }
217
218
  return importPath.replaceAll(path.sep, "/");
218
219
  }
220
+ function parseMetaEntry(file, content) {
221
+ const extname3 = path.extname(file);
222
+ try {
223
+ if (extname3 === ".json") return JSON.parse(content);
224
+ if (extname3 === ".yaml") return load(content);
225
+ } catch (e) {
226
+ throw new Error(`Failed to parse meta file: ${file}.`, {
227
+ cause: e
228
+ });
229
+ }
230
+ throw new Error(`Unknown meta file format: ${extname3}, in ${file}.`);
231
+ }
219
232
 
220
233
  // src/map/index.ts
221
234
  async function start(dev, configPath, outDir2) {
222
- void fs2.rm(path2.resolve(outDir2, `index.js`), { force: true });
223
- void fs2.rm(path2.resolve(outDir2, `index.d.ts`), { force: true });
224
- await fs2.mkdir(outDir2, { recursive: true });
225
235
  let configHash = await getConfigHash(configPath);
226
236
  let config = await loadConfig(configPath, configHash, true);
227
237
  const outPath = path2.resolve(outDir2, `index.ts`);
228
238
  async function updateMapFile() {
229
- console.time(`[MDX] update map file`);
239
+ const start2 = performance.now();
230
240
  try {
231
241
  await fs2.writeFile(
232
242
  outPath,
@@ -239,12 +249,12 @@ async function start(dev, configPath, outDir2) {
239
249
  console.error(err);
240
250
  }
241
251
  }
242
- console.timeEnd(`[MDX] update map file`);
252
+ console.log(`[MDX] updated map file in ${performance.now() - start2}ms`);
243
253
  }
244
254
  await updateMapFile();
245
255
  if (dev) {
246
- const { watcher } = await import("../watcher-IAZDSTU7.js");
247
- const instance = watcher(configPath, config);
256
+ const { watcher } = await import("../watcher-7O2HAQ63.js");
257
+ const instance = watcher(configPath, config, [outPath]);
248
258
  instance.on("ready", () => {
249
259
  console.log("[MDX] started dev server");
250
260
  });
@@ -329,21 +339,14 @@ function createMDX({
329
339
 
330
340
  // src/postinstall.ts
331
341
  import * as path4 from "node:path";
332
- import * as fs3 from "node:fs";
342
+ import * as fs3 from "node:fs/promises";
333
343
  async function postInstall(configPath = findConfigFile()) {
334
344
  const jsOut = path4.resolve(".source/index.ts");
335
345
  const hash = await getConfigHash(configPath);
336
346
  const config = await loadConfig(configPath, hash, true);
337
- fs3.mkdirSync(path4.dirname(jsOut), { recursive: true });
338
- fs3.writeFileSync(
339
- jsOut,
340
- await generateJS(
341
- configPath,
342
- config,
343
- path4.resolve(".source/index.ts"),
344
- hash
345
- )
346
- );
347
+ await fs3.rm(path4.dirname(jsOut), { recursive: true });
348
+ await fs3.mkdir(path4.dirname(jsOut), { recursive: true });
349
+ await fs3.writeFile(jsOut, await generateJS(configPath, config, jsOut, hash));
347
350
  console.log("[MDX] types generated");
348
351
  }
349
352
  export {
@@ -112,14 +112,20 @@ function remarkInclude() {
112
112
  var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
113
113
 
114
114
  // src/runtime/index.ts
115
+ var import_node_fs = __toESM(require("fs"), 1);
115
116
  var _runtime = {
116
117
  doc(files) {
117
118
  return files.map((file) => {
118
119
  const { default: body, frontmatter, ...exports2 } = file.data;
120
+ let cachedContent;
119
121
  return {
120
122
  body,
121
123
  ...exports2,
122
124
  ...frontmatter,
125
+ get content() {
126
+ cachedContent ??= import_node_fs.default.readFileSync(file.info.absolutePath).toString();
127
+ return cachedContent;
128
+ },
123
129
  _exports: file.data,
124
130
  _file: file.info
125
131
  };
@@ -1,5 +1,5 @@
1
- import { L as LoadedConfig, a as RuntimeAsync } from '../types-BNrQHCj5.cjs';
2
- import '../define-BaW0PQDJ.cjs';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-CY4MX9if.cjs';
2
+ import '../define-Cbpc-b73.cjs';
3
3
  import '@mdx-js/mdx';
4
4
  import 'mdx/types';
5
5
  import 'fumadocs-core/mdx-plugins';
@@ -1,5 +1,5 @@
1
- import { L as LoadedConfig, a as RuntimeAsync } from '../types-DEduCvIT.js';
2
- import '../define-BaW0PQDJ.js';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-DeEXKgfl.js';
2
+ import '../define-Cbpc-b73.js';
3
3
  import '@mdx-js/mdx';
4
4
  import 'mdx/types';
5
5
  import 'fumadocs-core/mdx-plugins';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  _runtime,
3
3
  createMDXSource
4
- } from "../chunk-VFALQK6O.js";
5
- import {
6
- buildConfig
7
- } from "../chunk-DRVUBK5B.js";
4
+ } from "../chunk-4LSNX4UE.js";
8
5
  import {
9
6
  remarkInclude
10
7
  } from "../chunk-MK7EXW7O.js";
8
+ import {
9
+ buildConfig
10
+ } from "../chunk-DRVUBK5B.js";
11
11
 
12
12
  // src/runtime/async.ts
13
13
  import { createCompiler } from "@fumadocs/mdx-remote";
@@ -1,4 +1,4 @@
1
- import { D as DocCollection, M as MetaCollection, a as DocsCollection, G as GlobalConfig, F as FileInfo, b as MarkdownProps, B as BaseCollectionEntry } from './define-BaW0PQDJ.cjs';
1
+ import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-Cbpc-b73.cjs';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import { Source, PageData, MetaData } from 'fumadocs-core/source';
4
4
  import { ProcessorOptions } from '@mdx-js/mdx';
@@ -24,7 +24,13 @@ interface AsyncRuntimeFile {
24
24
  data: Record<string, unknown>;
25
25
  content: string;
26
26
  }
27
- type DocOut<Schema extends StandardSchemaV1> = Omit<MarkdownProps, keyof StandardSchemaV1.InferOutput<Schema>> & StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
27
+ type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
28
+ /**
29
+ * Read the original content of file from file system.
30
+ */
31
+ get content(): string;
32
+ }, StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry>;
33
+ type Override<A, B> = Omit<A, keyof B> & B;
28
34
  type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
29
35
  interface Runtime {
30
36
  doc: <C>(files: RuntimeFile[]) => C extends {
@@ -1,4 +1,4 @@
1
- import { D as DocCollection, M as MetaCollection, a as DocsCollection, G as GlobalConfig, F as FileInfo, b as MarkdownProps, B as BaseCollectionEntry } from './define-BaW0PQDJ.js';
1
+ import { D as DocCollection, b as MetaCollection, c as DocsCollection, G as GlobalConfig, F as FileInfo, M as MarkdownProps, B as BaseCollectionEntry } from './define-Cbpc-b73.js';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import { Source, PageData, MetaData } from 'fumadocs-core/source';
4
4
  import { ProcessorOptions } from '@mdx-js/mdx';
@@ -24,7 +24,13 @@ interface AsyncRuntimeFile {
24
24
  data: Record<string, unknown>;
25
25
  content: string;
26
26
  }
27
- type DocOut<Schema extends StandardSchemaV1> = Omit<MarkdownProps, keyof StandardSchemaV1.InferOutput<Schema>> & StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
27
+ type DocOut<Schema extends StandardSchemaV1> = Override<MarkdownProps & {
28
+ /**
29
+ * Read the original content of file from file system.
30
+ */
31
+ get content(): string;
32
+ }, StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry>;
33
+ type Override<A, B> = Omit<A, keyof B> & B;
28
34
  type MetaOut<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema> & BaseCollectionEntry;
29
35
  interface Runtime {
30
36
  doc: <C>(files: RuntimeFile[]) => C extends {
@@ -1,6 +1,6 @@
1
1
  // src/map/watcher.ts
2
2
  import { watch } from "chokidar";
3
- function watcher(configPath, config) {
3
+ function watcher(configPath, config, ignored) {
4
4
  const deps = [configPath];
5
5
  function add(dir) {
6
6
  if (Array.isArray(dir)) deps.push(...dir);
@@ -16,6 +16,7 @@ function watcher(configPath, config) {
16
16
  }
17
17
  return watch(deps, {
18
18
  ignoreInitial: true,
19
+ ignored,
19
20
  persistent: true
20
21
  });
21
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "11.6.0",
3
+ "version": "11.6.2",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -46,28 +46,30 @@
46
46
  "@standard-schema/spec": "^1.0.0",
47
47
  "chokidar": "^4.0.3",
48
48
  "cross-spawn": "^7.0.6",
49
- "esbuild": "^0.25.2",
49
+ "esbuild": "^0.25.3",
50
50
  "estree-util-value-to-estree": "^3.3.3",
51
51
  "fast-glob": "^3.3.3",
52
52
  "gray-matter": "^4.0.3",
53
+ "js-yaml": "^4.1.0",
53
54
  "lru-cache": "^11.1.0",
54
55
  "picocolors": "^1.1.1",
55
56
  "unist-util-visit": "^5.0.0",
56
- "zod": "^3.24.2"
57
+ "zod": "^3.24.3"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@types/cross-spawn": "^6.0.6",
61
+ "@types/js-yaml": "^4.0.9",
60
62
  "@types/mdast": "^4.0.3",
61
63
  "@types/mdx": "^2.0.13",
62
- "@types/react": "^19.1.0",
64
+ "@types/react": "^19.1.2",
63
65
  "mdast-util-mdx-jsx": "^3.2.0",
64
- "next": "^15.3.0",
66
+ "next": "^15.3.1",
65
67
  "unified": "^11.0.5",
66
68
  "vfile": "^6.0.3",
67
- "webpack": "^5.99.5",
69
+ "webpack": "^5.99.7",
68
70
  "@fumadocs/mdx-remote": "1.3.0",
69
71
  "eslint-config-custom": "0.0.0",
70
- "fumadocs-core": "15.2.7",
72
+ "fumadocs-core": "15.2.13",
71
73
  "tsconfig": "0.0.0"
72
74
  },
73
75
  "peerDependencies": {