fumadocs-mdx 11.7.1 → 11.7.3

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,6 +1,6 @@
1
1
  import {
2
2
  buildConfig
3
- } from "./chunk-GWR7KMRU.js";
3
+ } from "./chunk-JFNBRKRV.js";
4
4
 
5
5
  // src/utils/config.ts
6
6
  import * as fs from "fs/promises";
@@ -37,12 +37,10 @@ async function loadConfig(configPath, outDir, hash, build = false) {
37
37
  if (build) await compileConfig(configPath, outDir);
38
38
  const url = pathToFileURL(path.resolve(outDir, "source.config.mjs"));
39
39
  const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
40
- const [err, config2] = buildConfig(
40
+ return buildConfig(
41
41
  // every call to `loadConfig` will cause the previous cache to be ignored
42
42
  loaded
43
43
  );
44
- if (err !== null) throw new Error(err);
45
- return config2;
46
44
  });
47
45
  cache = { config, hash };
48
46
  return await config;
@@ -55,32 +53,8 @@ async function getConfigHash(configPath) {
55
53
  throw new Error("Cannot find config file");
56
54
  }
57
55
 
58
- // src/utils/git-timestamp.ts
59
- import path2 from "path";
60
- import { x } from "tinyexec";
61
- var cache2 = /* @__PURE__ */ new Map();
62
- async function getGitTimestamp(file) {
63
- const cached = cache2.get(file);
64
- if (cached) return cached;
65
- try {
66
- const out = await x(
67
- "git",
68
- ["log", "-1", '--pretty="%ai"', path2.relative(process.cwd(), file)],
69
- {
70
- throwOnError: true
71
- }
72
- );
73
- const time = new Date(out.stdout);
74
- cache2.set(file, time);
75
- return time;
76
- } catch {
77
- return;
78
- }
79
- }
80
-
81
56
  export {
82
57
  findConfigFile,
83
58
  loadConfig,
84
- getConfigHash,
85
- getGitTimestamp
59
+ getConfigHash
86
60
  };
@@ -0,0 +1,47 @@
1
+ // src/config/build.ts
2
+ function buildConfig(config) {
3
+ const collections = /* @__PURE__ */ new Map();
4
+ let globalConfig = {};
5
+ for (const [k, v] of Object.entries(config)) {
6
+ if (!v) {
7
+ continue;
8
+ }
9
+ if (typeof v === "object" && "type" in v) {
10
+ if (v.type === "docs") {
11
+ collections.set(k, v);
12
+ continue;
13
+ }
14
+ if (v.type === "doc" || v.type === "meta") {
15
+ collections.set(k, v);
16
+ continue;
17
+ }
18
+ }
19
+ if (k === "default" && v) {
20
+ globalConfig = v;
21
+ continue;
22
+ }
23
+ throw new Error(
24
+ `Unknown export "${k}", you can only export collections from source configuration file.`
25
+ );
26
+ }
27
+ let cachedMdxOptions;
28
+ return {
29
+ global: globalConfig,
30
+ collections,
31
+ async getDefaultMDXOptions() {
32
+ if (cachedMdxOptions) return cachedMdxOptions;
33
+ const input = this.global.mdxOptions;
34
+ async function uncached() {
35
+ const options = typeof input === "function" ? await input() : input;
36
+ const { getDefaultMDXOptions } = await import("./mdx-options-UDV5WEFU.js");
37
+ if (options?.preset === "minimal") return options;
38
+ return getDefaultMDXOptions(options ?? {});
39
+ }
40
+ return cachedMdxOptions = uncached();
41
+ }
42
+ };
43
+ }
44
+
45
+ export {
46
+ buildConfig
47
+ };
@@ -0,0 +1,26 @@
1
+ // src/utils/git-timestamp.ts
2
+ import path from "path";
3
+ import { x } from "tinyexec";
4
+ var cache = /* @__PURE__ */ new Map();
5
+ async function getGitTimestamp(file) {
6
+ const cached = cache.get(file);
7
+ if (cached) return cached;
8
+ try {
9
+ const out = await x(
10
+ "git",
11
+ ["log", "-1", '--pretty="%ai"', path.relative(process.cwd(), file)],
12
+ {
13
+ throwOnError: true
14
+ }
15
+ );
16
+ const time = new Date(out.stdout);
17
+ cache.set(file, time);
18
+ return time;
19
+ } catch {
20
+ return;
21
+ }
22
+ }
23
+
24
+ export {
25
+ getGitTimestamp
26
+ };
@@ -1,4 +1,4 @@
1
- export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, b as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-CCrinVBZ.cjs';
1
+ export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-E6TRBwBQ.cjs';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, b as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-CCrinVBZ.js';
1
+ export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define-E6TRBwBQ.js';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
4
  import 'zod';
@@ -106,4 +106,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
106
106
  }): DocsCollection<DocSchema, MetaSchema, Async>;
107
107
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
108
108
 
109
- export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DocCollection as D, type GlobalConfig as G, type MetaCollection as M, type DocsCollection as a, type DefaultMDXOptions as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
109
+ export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
@@ -106,4 +106,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
106
106
  }): DocsCollection<DocSchema, MetaSchema, Async>;
107
107
  declare function defineConfig(config?: GlobalConfig): GlobalConfig;
108
108
 
109
- export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DocCollection as D, type GlobalConfig as G, type MetaCollection as M, type DocsCollection as a, type DefaultMDXOptions as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
109
+ export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { R as Runtime, B as BaseCollectionEntry } from './types-CnslxmoO.cjs';
2
+ import { R as Runtime, B as BaseCollectionEntry } from './types-Lh_-Uuix.cjs';
3
3
  import '@standard-schema/spec';
4
- import './define-CCrinVBZ.cjs';
4
+ import './define-E6TRBwBQ.cjs';
5
5
  import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
7
  import '@mdx-js/mdx';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { R as Runtime, B as BaseCollectionEntry } from './types-C0bKwtAx.js';
2
+ import { R as Runtime, B as BaseCollectionEntry } from './types-DiL328cG.js';
3
3
  import '@standard-schema/spec';
4
- import './define-CCrinVBZ.js';
4
+ import './define-E6TRBwBQ.js';
5
5
  import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
7
  import '@mdx-js/mdx';
@@ -175,7 +175,7 @@ var import_node_url = require("url");
175
175
  // src/config/build.ts
176
176
  function buildConfig(config) {
177
177
  const collections = /* @__PURE__ */ new Map();
178
- let globalConfig;
178
+ let globalConfig = {};
179
179
  for (const [k, v] of Object.entries(config)) {
180
180
  if (!v) {
181
181
  continue;
@@ -190,34 +190,30 @@ function buildConfig(config) {
190
190
  continue;
191
191
  }
192
192
  }
193
- if (k === "default") {
193
+ if (k === "default" && v) {
194
194
  globalConfig = v;
195
195
  continue;
196
196
  }
197
- return [
198
- `Unknown export "${k}", you can only export collections from source configuration file.`,
199
- null
200
- ];
197
+ throw new Error(
198
+ `Unknown export "${k}", you can only export collections from source configuration file.`
199
+ );
201
200
  }
202
201
  let cachedMdxOptions;
203
- return [
204
- null,
205
- {
206
- global: globalConfig,
207
- collections,
208
- async getDefaultMDXOptions() {
209
- if (cachedMdxOptions) return cachedMdxOptions;
210
- const input = this.global?.mdxOptions;
211
- async function uncached() {
212
- const options = typeof input === "function" ? await input() : input;
213
- const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
214
- if (options?.preset === "minimal") return options;
215
- return getDefaultMDXOptions2(options ?? {});
216
- }
217
- return cachedMdxOptions = uncached();
202
+ return {
203
+ global: globalConfig,
204
+ collections,
205
+ async getDefaultMDXOptions() {
206
+ if (cachedMdxOptions) return cachedMdxOptions;
207
+ const input = this.global.mdxOptions;
208
+ async function uncached() {
209
+ const options = typeof input === "function" ? await input() : input;
210
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
211
+ if (options?.preset === "minimal") return options;
212
+ return getDefaultMDXOptions2(options ?? {});
218
213
  }
214
+ return cachedMdxOptions = uncached();
219
215
  }
220
- ];
216
+ };
221
217
  }
222
218
 
223
219
  // src/utils/config.ts
@@ -249,12 +245,10 @@ async function loadConfig(configPath, outDir, hash, build = false) {
249
245
  if (build) await compileConfig(configPath, outDir);
250
246
  const url = (0, import_node_url.pathToFileURL)(path.resolve(outDir, "source.config.mjs"));
251
247
  const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
252
- const [err, config2] = buildConfig(
248
+ return buildConfig(
253
249
  // every call to `loadConfig` will cause the previous cache to be ignored
254
250
  loaded
255
251
  );
256
- if (err !== null) throw new Error(err);
257
- return config2;
258
252
  });
259
253
  cache = { config, hash };
260
254
  return await config;
@@ -1,18 +1,20 @@
1
1
  import {
2
2
  getConfigHash,
3
- getGitTimestamp,
4
3
  loadConfig
5
- } from "./chunk-2KBRPMAM.js";
4
+ } from "./chunk-4CGSOZUZ.js";
6
5
  import {
7
6
  buildMDX,
8
7
  countLines
9
8
  } from "./chunk-C5INPAZJ.js";
10
- import "./chunk-GWR7KMRU.js";
9
+ import {
10
+ getGitTimestamp
11
+ } from "./chunk-VUEZTR2H.js";
11
12
  import {
12
13
  ValidationError,
13
14
  validate
14
15
  } from "./chunk-ZOWJF3OH.js";
15
16
  import "./chunk-AVMO2SRO.js";
17
+ import "./chunk-JFNBRKRV.js";
16
18
  import {
17
19
  fumaMatter
18
20
  } from "./chunk-KVWX6THC.js";
@@ -205,7 +205,7 @@ var import_node_url = require("url");
205
205
  // src/config/build.ts
206
206
  function buildConfig(config) {
207
207
  const collections = /* @__PURE__ */ new Map();
208
- let globalConfig;
208
+ let globalConfig = {};
209
209
  for (const [k, v] of Object.entries(config)) {
210
210
  if (!v) {
211
211
  continue;
@@ -220,34 +220,30 @@ function buildConfig(config) {
220
220
  continue;
221
221
  }
222
222
  }
223
- if (k === "default") {
223
+ if (k === "default" && v) {
224
224
  globalConfig = v;
225
225
  continue;
226
226
  }
227
- return [
228
- `Unknown export "${k}", you can only export collections from source configuration file.`,
229
- null
230
- ];
227
+ throw new Error(
228
+ `Unknown export "${k}", you can only export collections from source configuration file.`
229
+ );
231
230
  }
232
231
  let cachedMdxOptions;
233
- return [
234
- null,
235
- {
236
- global: globalConfig,
237
- collections,
238
- async getDefaultMDXOptions() {
239
- if (cachedMdxOptions) return cachedMdxOptions;
240
- const input = this.global?.mdxOptions;
241
- async function uncached() {
242
- const options = typeof input === "function" ? await input() : input;
243
- const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
244
- if (options?.preset === "minimal") return options;
245
- return getDefaultMDXOptions2(options ?? {});
246
- }
247
- return cachedMdxOptions = uncached();
232
+ return {
233
+ global: globalConfig,
234
+ collections,
235
+ async getDefaultMDXOptions() {
236
+ if (cachedMdxOptions) return cachedMdxOptions;
237
+ const input = this.global.mdxOptions;
238
+ async function uncached() {
239
+ const options = typeof input === "function" ? await input() : input;
240
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
241
+ if (options?.preset === "minimal") return options;
242
+ return getDefaultMDXOptions2(options ?? {});
248
243
  }
244
+ return cachedMdxOptions = uncached();
249
245
  }
250
- ];
246
+ };
251
247
  }
252
248
 
253
249
  // src/utils/config.ts
@@ -282,12 +278,10 @@ async function loadConfig(configPath, outDir, hash, build = false) {
282
278
  if (build) await compileConfig(configPath, outDir);
283
279
  const url = (0, import_node_url.pathToFileURL)(path.resolve(outDir, "source.config.mjs"));
284
280
  const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
285
- const [err, config2] = buildConfig(
281
+ return buildConfig(
286
282
  // every call to `loadConfig` will cause the previous cache to be ignored
287
283
  loaded
288
284
  );
289
- if (err !== null) throw new Error(err);
290
- return config2;
291
285
  });
292
286
  cache = { config, hash };
293
287
  return await config;
@@ -543,8 +537,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
543
537
  specifier: "fumadocs-mdx/runtime/async",
544
538
  names: ["_runtimeAsync", "buildConfig"]
545
539
  }),
546
- "const [err, _sourceConfig] = buildConfig(_source)",
547
- "if (!_sourceConfig) throw new Error(err)"
540
+ "const _sourceConfig = buildConfig(_source)"
548
541
  );
549
542
  asyncInit = true;
550
543
  }
@@ -1,20 +1,22 @@
1
1
  import {
2
2
  findConfigFile,
3
3
  getConfigHash,
4
- getGitTimestamp,
5
4
  loadConfig
6
- } from "../chunk-2KBRPMAM.js";
5
+ } from "../chunk-4CGSOZUZ.js";
7
6
  import {
8
7
  getGlobPatterns,
9
8
  getImportCode,
10
9
  isFileSupported,
11
10
  toImportPath
12
11
  } from "../chunk-OWZSTKKX.js";
13
- import "../chunk-GWR7KMRU.js";
12
+ import {
13
+ getGitTimestamp
14
+ } from "../chunk-VUEZTR2H.js";
14
15
  import {
15
16
  ValidationError,
16
17
  validate
17
18
  } from "../chunk-ZOWJF3OH.js";
19
+ import "../chunk-JFNBRKRV.js";
18
20
  import {
19
21
  fumaMatter
20
22
  } from "../chunk-KVWX6THC.js";
@@ -118,8 +120,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
118
120
  specifier: "fumadocs-mdx/runtime/async",
119
121
  names: ["_runtimeAsync", "buildConfig"]
120
122
  }),
121
- "const [err, _sourceConfig] = buildConfig(_source)",
122
- "if (!_sourceConfig) throw new Error(err)"
123
+ "const _sourceConfig = buildConfig(_source)"
123
124
  );
124
125
  asyncInit = true;
125
126
  }
@@ -338,7 +338,7 @@ function resolveFiles({ docs, meta }) {
338
338
  // src/config/build.ts
339
339
  function buildConfig(config) {
340
340
  const collections = /* @__PURE__ */ new Map();
341
- let globalConfig;
341
+ let globalConfig = {};
342
342
  for (const [k, v] of Object.entries(config)) {
343
343
  if (!v) {
344
344
  continue;
@@ -353,34 +353,30 @@ function buildConfig(config) {
353
353
  continue;
354
354
  }
355
355
  }
356
- if (k === "default") {
356
+ if (k === "default" && v) {
357
357
  globalConfig = v;
358
358
  continue;
359
359
  }
360
- return [
361
- `Unknown export "${k}", you can only export collections from source configuration file.`,
362
- null
363
- ];
360
+ throw new Error(
361
+ `Unknown export "${k}", you can only export collections from source configuration file.`
362
+ );
364
363
  }
365
364
  let cachedMdxOptions;
366
- return [
367
- null,
368
- {
369
- global: globalConfig,
370
- collections,
371
- async getDefaultMDXOptions() {
372
- if (cachedMdxOptions) return cachedMdxOptions;
373
- const input = this.global?.mdxOptions;
374
- async function uncached() {
375
- const options = typeof input === "function" ? await input() : input;
376
- const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
377
- if (options?.preset === "minimal") return options;
378
- return getDefaultMDXOptions2(options ?? {});
379
- }
380
- return cachedMdxOptions = uncached();
365
+ return {
366
+ global: globalConfig,
367
+ collections,
368
+ async getDefaultMDXOptions() {
369
+ if (cachedMdxOptions) return cachedMdxOptions;
370
+ const input = this.global.mdxOptions;
371
+ async function uncached() {
372
+ const options = typeof input === "function" ? await input() : input;
373
+ const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
374
+ if (options?.preset === "minimal") return options;
375
+ return getDefaultMDXOptions2(options ?? {});
381
376
  }
377
+ return cachedMdxOptions = uncached();
382
378
  }
383
- ];
379
+ };
384
380
  }
385
381
 
386
382
  // src/runtime/async.ts
@@ -1,7 +1,7 @@
1
- import { L as LoadedConfig, a as RuntimeAsync } from '../types-CnslxmoO.cjs';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-Lh_-Uuix.cjs';
2
2
  import '@standard-schema/spec';
3
3
  import 'fumadocs-core/source';
4
- import '../define-CCrinVBZ.cjs';
4
+ import '../define-E6TRBwBQ.cjs';
5
5
  import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
7
  import '@mdx-js/mdx';
@@ -10,7 +10,7 @@ import 'react';
10
10
  import 'mdx/types';
11
11
  import 'fumadocs-core/server';
12
12
 
13
- declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
13
+ declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
14
14
 
15
15
  declare const _runtimeAsync: RuntimeAsync;
16
16
 
@@ -1,7 +1,7 @@
1
- import { L as LoadedConfig, a as RuntimeAsync } from '../types-C0bKwtAx.js';
1
+ import { L as LoadedConfig, a as RuntimeAsync } from '../types-DiL328cG.js';
2
2
  import '@standard-schema/spec';
3
3
  import 'fumadocs-core/source';
4
- import '../define-CCrinVBZ.js';
4
+ import '../define-E6TRBwBQ.js';
5
5
  import 'zod';
6
6
  import 'fumadocs-core/mdx-plugins';
7
7
  import '@mdx-js/mdx';
@@ -10,7 +10,7 @@ import 'react';
10
10
  import 'mdx/types';
11
11
  import 'fumadocs-core/server';
12
12
 
13
- declare function buildConfig(config: Record<string, unknown>): [err: string, value: null] | [err: null, value: LoadedConfig];
13
+ declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
14
14
 
15
15
  declare const _runtimeAsync: RuntimeAsync;
16
16
 
@@ -2,12 +2,12 @@ import {
2
2
  _runtime,
3
3
  createMDXSource
4
4
  } from "../chunk-NUDEC6C5.js";
5
- import {
6
- buildConfig
7
- } from "../chunk-GWR7KMRU.js";
8
5
  import {
9
6
  remarkInclude
10
7
  } from "../chunk-AVMO2SRO.js";
8
+ import {
9
+ buildConfig
10
+ } from "../chunk-JFNBRKRV.js";
11
11
  import "../chunk-KVWX6THC.js";
12
12
 
13
13
  // src/runtime/async.ts
@@ -36,12 +36,13 @@ function fromConfig() {
36
36
  return out;
37
37
  }
38
38
  function mapPageData(entry) {
39
- const { toc, structuredData } = entry;
39
+ const { toc, structuredData, lastModified, frontmatter } = entry;
40
40
  return {
41
- ...entry.frontmatter,
41
+ ...frontmatter,
42
42
  default: entry.default,
43
43
  toc,
44
44
  structuredData,
45
+ lastModified,
45
46
  _exports: entry
46
47
  };
47
48
  }
@@ -2,23 +2,25 @@ import { TableOfContents } from 'fumadocs-core/server';
2
2
  import { FC, ReactNode } from 'react';
3
3
  import { MDXProps } from 'mdx/types';
4
4
  import { StructuredData } from 'fumadocs-core/mdx-plugins';
5
- import { D as DocCollection, M as MetaCollection, a as DocsCollection } from '../define-CCrinVBZ.cjs';
5
+ import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-E6TRBwBQ.cjs';
6
6
  import { StandardSchemaV1 } from '@standard-schema/spec';
7
7
  import { PageData, MetaData, Source } from 'fumadocs-core/source';
8
8
  import 'zod';
9
9
  import '@mdx-js/mdx';
10
10
  import 'unified';
11
11
 
12
- type CompiledMDXFile<Frontmatter> = {
12
+ interface CompiledMDXProperties<Frontmatter> {
13
13
  frontmatter: Frontmatter;
14
- toc: TableOfContents;
15
- default: FC<MDXProps>;
16
14
  structuredData: StructuredData;
17
- } & Record<string, unknown>;
18
- type MDXFileToPageData<Frontmatter> = Frontmatter & {
19
15
  toc: TableOfContents;
20
16
  default: FC<MDXProps>;
21
- structuredData: StructuredData;
17
+ /**
18
+ * Only available when `lastModifiedTime` is enabled on MDX loader
19
+ */
20
+ lastModified?: Date;
21
+ }
22
+ type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
23
+ type MDXFileToPageData<Frontmatter> = Frontmatter & Omit<CompiledMDXProperties<Frontmatter>, 'frontmatter'> & {
22
24
  _exports: Record<string, unknown>;
23
25
  };
24
26
  type AttachGlobValue<GlobValue, Attach> = GlobValue extends () => Promise<unknown> ? () => Promise<Attach> : Attach;
@@ -2,23 +2,25 @@ import { TableOfContents } from 'fumadocs-core/server';
2
2
  import { FC, ReactNode } from 'react';
3
3
  import { MDXProps } from 'mdx/types';
4
4
  import { StructuredData } from 'fumadocs-core/mdx-plugins';
5
- import { D as DocCollection, M as MetaCollection, a as DocsCollection } from '../define-CCrinVBZ.js';
5
+ import { a as DocCollection, M as MetaCollection, b as DocsCollection } from '../define-E6TRBwBQ.js';
6
6
  import { StandardSchemaV1 } from '@standard-schema/spec';
7
7
  import { PageData, MetaData, Source } from 'fumadocs-core/source';
8
8
  import 'zod';
9
9
  import '@mdx-js/mdx';
10
10
  import 'unified';
11
11
 
12
- type CompiledMDXFile<Frontmatter> = {
12
+ interface CompiledMDXProperties<Frontmatter> {
13
13
  frontmatter: Frontmatter;
14
- toc: TableOfContents;
15
- default: FC<MDXProps>;
16
14
  structuredData: StructuredData;
17
- } & Record<string, unknown>;
18
- type MDXFileToPageData<Frontmatter> = Frontmatter & {
19
15
  toc: TableOfContents;
20
16
  default: FC<MDXProps>;
21
- structuredData: StructuredData;
17
+ /**
18
+ * Only available when `lastModifiedTime` is enabled on MDX loader
19
+ */
20
+ lastModified?: Date;
21
+ }
22
+ type CompiledMDXFile<Frontmatter> = CompiledMDXProperties<Frontmatter> & Record<string, unknown>;
23
+ type MDXFileToPageData<Frontmatter> = Frontmatter & Omit<CompiledMDXProperties<Frontmatter>, 'frontmatter'> & {
22
24
  _exports: Record<string, unknown>;
23
25
  };
24
26
  type AttachGlobValue<GlobValue, Attach> = GlobValue extends () => Promise<unknown> ? () => Promise<Attach> : Attach;
@@ -10,12 +10,13 @@ function fromConfig() {
10
10
  return out;
11
11
  }
12
12
  function mapPageData(entry) {
13
- const { toc, structuredData } = entry;
13
+ const { toc, structuredData, lastModified, frontmatter } = entry;
14
14
  return {
15
- ...entry.frontmatter,
15
+ ...frontmatter,
16
16
  default: entry.default,
17
17
  toc,
18
18
  structuredData,
19
+ lastModified,
19
20
  _exports: entry
20
21
  };
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import { Source, PageData, MetaData } from 'fumadocs-core/source';
3
- import { D as DocCollection, M as MetaCollection, a as DocsCollection, G as GlobalConfig } from './define-CCrinVBZ.js';
3
+ import { a as DocCollection, M as MetaCollection, b as DocsCollection, G as GlobalConfig } from './define-E6TRBwBQ.js';
4
4
  import { ProcessorOptions } from '@mdx-js/mdx';
5
5
  import { FC } from 'react';
6
6
  import { MDXProps } from 'mdx/types';
@@ -9,7 +9,7 @@ import { TableOfContents } from 'fumadocs-core/server';
9
9
 
10
10
  interface LoadedConfig {
11
11
  collections: Map<string, DocCollection | MetaCollection | DocsCollection>;
12
- global?: GlobalConfig;
12
+ global: GlobalConfig;
13
13
  getDefaultMDXOptions(): Promise<ProcessorOptions>;
14
14
  }
15
15