fumadocs-mdx 11.7.5 → 11.8.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.
Files changed (35) hide show
  1. package/dist/build-mdx-DMe0r3s_.d.cts +44 -0
  2. package/dist/build-mdx-DMe0r3s_.d.ts +44 -0
  3. package/dist/{chunk-OWZSTKKX.js → chunk-6Y5JDZHD.js} +8 -1
  4. package/dist/{chunk-HWSF4OGZ.js → chunk-7JFPDRW7.js} +1 -1
  5. package/dist/{chunk-XZR5QXVY.js → chunk-BCOXAJMC.js} +1 -1
  6. package/dist/{chunk-GYWPPGFD.js → chunk-DJNS22RO.js} +18 -1
  7. package/dist/{chunk-3XN4P23K.js → chunk-IGXZS2W6.js} +1 -1
  8. package/dist/{chunk-XVL4ZQFK.js → chunk-S73DGUHI.js} +1 -1
  9. package/dist/{chunk-KVWX6THC.js → chunk-VWJKRQZR.js} +2 -2
  10. package/dist/config/index.cjs +22 -5
  11. package/dist/config/index.js +3 -3
  12. package/dist/config/zod-3.cjs +22 -5
  13. package/dist/config/zod-3.js +3 -3
  14. package/dist/index.d.cts +3 -2
  15. package/dist/index.d.ts +3 -2
  16. package/dist/loader-mdx.cjs +29 -5
  17. package/dist/loader-mdx.js +7 -7
  18. package/dist/{mdx-options-3NB74EMB.js → mdx-options-ILHLYYTL.js} +1 -1
  19. package/dist/next/index.cjs +36 -5
  20. package/dist/next/index.js +5 -5
  21. package/dist/runtime/async.cjs +35 -10
  22. package/dist/runtime/async.d.cts +3 -2
  23. package/dist/runtime/async.d.ts +3 -2
  24. package/dist/runtime/async.js +12 -11
  25. package/dist/runtime/vite.cjs +49 -41
  26. package/dist/runtime/vite.d.cts +27 -28
  27. package/dist/runtime/vite.d.ts +27 -28
  28. package/dist/runtime/vite.js +49 -41
  29. package/dist/{types-C-WXTx1W.d.cts → types-DvnkeVI3.d.cts} +12 -15
  30. package/dist/{types-CU9nn_je.d.ts → types-zBRxlyaM.d.ts} +12 -15
  31. package/dist/vite/index.cjs +101 -54
  32. package/dist/vite/index.d.cts +6 -1
  33. package/dist/vite/index.d.ts +6 -1
  34. package/dist/vite/index.js +51 -35
  35. package/package.json +11 -11
@@ -0,0 +1,44 @@
1
+ import { createProcessor } from '@mdx-js/mdx';
2
+ import { StructuredData } from 'fumadocs-core/mdx-plugins';
3
+ import { TableOfContents } from 'fumadocs-core/server';
4
+ import { FC } from 'react';
5
+ import { MDXProps } from 'mdx/types';
6
+
7
+ declare module 'vfile' {
8
+ interface DataMap {
9
+ extractedReferences: ExtractedReference[];
10
+ }
11
+ }
12
+ interface ExtractedReference {
13
+ href: string;
14
+ }
15
+
16
+ type Processor = ReturnType<typeof createProcessor>;
17
+ interface CompilerOptions {
18
+ addDependency: (file: string) => void;
19
+ }
20
+ interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
21
+ frontmatter: Frontmatter;
22
+ structuredData: StructuredData;
23
+ toc: TableOfContents;
24
+ default: FC<MDXProps>;
25
+ /**
26
+ * Only available when `lastModifiedTime` is enabled on MDX loader
27
+ */
28
+ lastModified?: Date;
29
+ extractedReferences?: ExtractedReference[];
30
+ }
31
+
32
+ declare module 'vfile' {
33
+ interface DataMap {
34
+ /**
35
+ * The compiler object from loader
36
+ */
37
+ _compiler?: CompilerOptions;
38
+ _processor?: {
39
+ getProcessor: (format: 'md' | 'mdx') => Processor;
40
+ };
41
+ }
42
+ }
43
+
44
+ export type { CompiledMDXProperties as C };
@@ -0,0 +1,44 @@
1
+ import { createProcessor } from '@mdx-js/mdx';
2
+ import { StructuredData } from 'fumadocs-core/mdx-plugins';
3
+ import { TableOfContents } from 'fumadocs-core/server';
4
+ import { FC } from 'react';
5
+ import { MDXProps } from 'mdx/types';
6
+
7
+ declare module 'vfile' {
8
+ interface DataMap {
9
+ extractedReferences: ExtractedReference[];
10
+ }
11
+ }
12
+ interface ExtractedReference {
13
+ href: string;
14
+ }
15
+
16
+ type Processor = ReturnType<typeof createProcessor>;
17
+ interface CompilerOptions {
18
+ addDependency: (file: string) => void;
19
+ }
20
+ interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
21
+ frontmatter: Frontmatter;
22
+ structuredData: StructuredData;
23
+ toc: TableOfContents;
24
+ default: FC<MDXProps>;
25
+ /**
26
+ * Only available when `lastModifiedTime` is enabled on MDX loader
27
+ */
28
+ lastModified?: Date;
29
+ extractedReferences?: ExtractedReference[];
30
+ }
31
+
32
+ declare module 'vfile' {
33
+ interface DataMap {
34
+ /**
35
+ * The compiler object from loader
36
+ */
37
+ _compiler?: CompilerOptions;
38
+ _processor?: {
39
+ getProcessor: (format: 'md' | 'mdx') => Processor;
40
+ };
41
+ }
42
+ }
43
+
44
+ export type { CompiledMDXProperties as C };
@@ -15,7 +15,14 @@ function getImportCode(info) {
15
15
  }
16
16
  function toImportPath(file, config) {
17
17
  const ext = path.extname(file);
18
- const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
18
+ let filename;
19
+ if (ext === ".ts" && config.jsExtension) {
20
+ filename = file.substring(0, file.length - ext.length) + ".js";
21
+ } else if (ext === ".ts") {
22
+ filename = file.substring(0, file.length - ext.length);
23
+ } else {
24
+ filename = file;
25
+ }
19
26
  let importPath;
20
27
  if ("relativeTo" in config) {
21
28
  importPath = path.relative(config.relativeTo, filename);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  remarkInclude
3
- } from "./chunk-3XN4P23K.js";
3
+ } from "./chunk-IGXZS2W6.js";
4
4
 
5
5
  // src/utils/build-mdx.ts
6
6
  import { createProcessor } from "@mdx-js/mdx";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildConfig
3
- } from "./chunk-XVL4ZQFK.js";
3
+ } from "./chunk-S73DGUHI.js";
4
4
 
5
5
  // src/utils/config.ts
6
6
  import * as fs from "fs/promises";
@@ -6,7 +6,7 @@ import { valueToEstree } from "estree-util-value-to-estree";
6
6
  function remarkMdxExport({ values }) {
7
7
  return (tree, vfile) => {
8
8
  for (const name of values) {
9
- if (!(name in vfile.data)) return;
9
+ if (!(name in vfile.data)) continue;
10
10
  tree.children.unshift(getMdastExport(name, vfile.data[name]));
11
11
  }
12
12
  };
@@ -45,6 +45,21 @@ function getMdastExport(name, value) {
45
45
  };
46
46
  }
47
47
 
48
+ // src/mdx-plugins/remark-extract.ts
49
+ import { visit } from "unist-util-visit";
50
+ function remarkExtract() {
51
+ return (tree, file) => {
52
+ const urls = [];
53
+ visit(tree, "link", (node) => {
54
+ urls.push({
55
+ href: node.url
56
+ });
57
+ return "skip";
58
+ });
59
+ file.data.extractedReferences = urls;
60
+ };
61
+ }
62
+
48
63
  // src/utils/mdx-options.ts
49
64
  function pluginOption(def, options = []) {
50
65
  const list = def(Array.isArray(options) ? options : []).filter(
@@ -68,6 +83,7 @@ function getDefaultMDXOptions({
68
83
  }) {
69
84
  const mdxExports = [
70
85
  "structuredData",
86
+ "extractedReferences",
71
87
  "frontmatter",
72
88
  "lastModified",
73
89
  ...valueToExport
@@ -95,6 +111,7 @@ function getDefaultMDXOptions({
95
111
  ],
96
112
  "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
97
113
  ...v,
114
+ remarkExtract,
98
115
  remarkStructureOptions !== false && [
99
116
  plugins.remarkStructure,
100
117
  remarkStructureOptions
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fumaMatter
3
- } from "./chunk-KVWX6THC.js";
3
+ } from "./chunk-VWJKRQZR.js";
4
4
 
5
5
  // src/mdx-plugins/remark-include.ts
6
6
  import { visit } from "unist-util-visit";
@@ -34,7 +34,7 @@ function buildConfig(config) {
34
34
  const input = this.global.mdxOptions;
35
35
  async function uncached() {
36
36
  const options = typeof input === "function" ? await input() : input;
37
- const { getDefaultMDXOptions } = await import("./mdx-options-3NB74EMB.js");
37
+ const { getDefaultMDXOptions } = await import("./mdx-options-ILHLYYTL.js");
38
38
  if (options?.preset === "minimal") return options;
39
39
  return getDefaultMDXOptions({
40
40
  ...options,
@@ -7,9 +7,9 @@ function fumaMatter(input) {
7
7
  if (!match) {
8
8
  return output;
9
9
  }
10
- output.matter = match[1];
10
+ output.matter = match[0];
11
11
  output.content = input.slice(match[0].length);
12
- const loaded = load(output.matter);
12
+ const loaded = load(match[1]);
13
13
  output.data = loaded ?? {};
14
14
  return output;
15
15
  }
@@ -98,7 +98,7 @@ var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
98
98
  function remarkMdxExport({ values }) {
99
99
  return (tree, vfile) => {
100
100
  for (const name of values) {
101
- if (!(name in vfile.data)) return;
101
+ if (!(name in vfile.data)) continue;
102
102
  tree.children.unshift(getMdastExport(name, vfile.data[name]));
103
103
  }
104
104
  };
@@ -137,6 +137,21 @@ function getMdastExport(name, value) {
137
137
  };
138
138
  }
139
139
 
140
+ // src/mdx-plugins/remark-extract.ts
141
+ var import_unist_util_visit = require("unist-util-visit");
142
+ function remarkExtract() {
143
+ return (tree, file) => {
144
+ const urls = [];
145
+ (0, import_unist_util_visit.visit)(tree, "link", (node) => {
146
+ urls.push({
147
+ href: node.url
148
+ });
149
+ return "skip";
150
+ });
151
+ file.data.extractedReferences = urls;
152
+ };
153
+ }
154
+
140
155
  // src/utils/mdx-options.ts
141
156
  function pluginOption(def, options = []) {
142
157
  const list = def(Array.isArray(options) ? options : []).filter(
@@ -160,6 +175,7 @@ function getDefaultMDXOptions({
160
175
  }) {
161
176
  const mdxExports = [
162
177
  "structuredData",
178
+ "extractedReferences",
163
179
  "frontmatter",
164
180
  "lastModified",
165
181
  ...valueToExport
@@ -187,6 +203,7 @@ function getDefaultMDXOptions({
187
203
  ],
188
204
  "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
189
205
  ...v,
206
+ remarkExtract,
190
207
  remarkStructureOptions !== false && [
191
208
  plugins.remarkStructure,
192
209
  remarkStructureOptions
@@ -212,7 +229,7 @@ function getDefaultMDXOptions({
212
229
  }
213
230
 
214
231
  // src/mdx-plugins/remark-include.ts
215
- var import_unist_util_visit = require("unist-util-visit");
232
+ var import_unist_util_visit2 = require("unist-util-visit");
216
233
  var path = __toESM(require("path"), 1);
217
234
  var fs = __toESM(require("fs/promises"), 1);
218
235
 
@@ -225,9 +242,9 @@ function fumaMatter(input) {
225
242
  if (!match) {
226
243
  return output;
227
244
  }
228
- output.matter = match[1];
245
+ output.matter = match[0];
229
246
  output.content = input.slice(match[0].length);
230
- const loaded = (0, import_js_yaml.load)(output.matter);
247
+ const loaded = (0, import_js_yaml.load)(match[1]);
231
248
  output.data = loaded ?? {};
232
249
  return output;
233
250
  }
@@ -263,7 +280,7 @@ function remarkInclude() {
263
280
  const TagName = "include";
264
281
  async function update(tree, directory, data) {
265
282
  const queue = [];
266
- (0, import_unist_util_visit.visit)(
283
+ (0, import_unist_util_visit2.visit)(
267
284
  tree,
268
285
  ["mdxJsxFlowElement", "mdxJsxTextElement"],
269
286
  (node, _, parent) => {
@@ -7,11 +7,11 @@ import {
7
7
  } from "../chunk-GBMFGEC7.js";
8
8
  import {
9
9
  getDefaultMDXOptions
10
- } from "../chunk-GYWPPGFD.js";
10
+ } from "../chunk-DJNS22RO.js";
11
11
  import {
12
12
  remarkInclude
13
- } from "../chunk-3XN4P23K.js";
14
- import "../chunk-KVWX6THC.js";
13
+ } from "../chunk-IGXZS2W6.js";
14
+ import "../chunk-VWJKRQZR.js";
15
15
  export {
16
16
  defineCollections,
17
17
  defineConfig,
@@ -99,7 +99,7 @@ var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
99
99
  function remarkMdxExport({ values }) {
100
100
  return (tree, vfile) => {
101
101
  for (const name of values) {
102
- if (!(name in vfile.data)) return;
102
+ if (!(name in vfile.data)) continue;
103
103
  tree.children.unshift(getMdastExport(name, vfile.data[name]));
104
104
  }
105
105
  };
@@ -138,6 +138,21 @@ function getMdastExport(name, value) {
138
138
  };
139
139
  }
140
140
 
141
+ // src/mdx-plugins/remark-extract.ts
142
+ var import_unist_util_visit = require("unist-util-visit");
143
+ function remarkExtract() {
144
+ return (tree, file) => {
145
+ const urls = [];
146
+ (0, import_unist_util_visit.visit)(tree, "link", (node) => {
147
+ urls.push({
148
+ href: node.url
149
+ });
150
+ return "skip";
151
+ });
152
+ file.data.extractedReferences = urls;
153
+ };
154
+ }
155
+
141
156
  // src/utils/mdx-options.ts
142
157
  function pluginOption(def, options = []) {
143
158
  const list = def(Array.isArray(options) ? options : []).filter(
@@ -161,6 +176,7 @@ function getDefaultMDXOptions({
161
176
  }) {
162
177
  const mdxExports = [
163
178
  "structuredData",
179
+ "extractedReferences",
164
180
  "frontmatter",
165
181
  "lastModified",
166
182
  ...valueToExport
@@ -188,6 +204,7 @@ function getDefaultMDXOptions({
188
204
  ],
189
205
  "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
190
206
  ...v,
207
+ remarkExtract,
191
208
  remarkStructureOptions !== false && [
192
209
  plugins.remarkStructure,
193
210
  remarkStructureOptions
@@ -213,7 +230,7 @@ function getDefaultMDXOptions({
213
230
  }
214
231
 
215
232
  // src/mdx-plugins/remark-include.ts
216
- var import_unist_util_visit = require("unist-util-visit");
233
+ var import_unist_util_visit2 = require("unist-util-visit");
217
234
  var path = __toESM(require("path"), 1);
218
235
  var fs = __toESM(require("fs/promises"), 1);
219
236
 
@@ -226,9 +243,9 @@ function fumaMatter(input) {
226
243
  if (!match) {
227
244
  return output;
228
245
  }
229
- output.matter = match[1];
246
+ output.matter = match[0];
230
247
  output.content = input.slice(match[0].length);
231
- const loaded = (0, import_js_yaml.load)(output.matter);
248
+ const loaded = (0, import_js_yaml.load)(match[1]);
232
249
  output.data = loaded ?? {};
233
250
  return output;
234
251
  }
@@ -264,7 +281,7 @@ function remarkInclude() {
264
281
  const TagName = "include";
265
282
  async function update(tree, directory, data) {
266
283
  const queue = [];
267
- (0, import_unist_util_visit.visit)(
284
+ (0, import_unist_util_visit2.visit)(
268
285
  tree,
269
286
  ["mdxJsxFlowElement", "mdxJsxTextElement"],
270
287
  (node, _, parent) => {
@@ -5,11 +5,11 @@ import {
5
5
  } from "../chunk-GBMFGEC7.js";
6
6
  import {
7
7
  getDefaultMDXOptions
8
- } from "../chunk-GYWPPGFD.js";
8
+ } from "../chunk-DJNS22RO.js";
9
9
  import {
10
10
  remarkInclude
11
- } from "../chunk-3XN4P23K.js";
12
- import "../chunk-KVWX6THC.js";
11
+ } from "../chunk-IGXZS2W6.js";
12
+ import "../chunk-VWJKRQZR.js";
13
13
 
14
14
  // src/config/zod-3.ts
15
15
  import { z } from "zod/v3";
package/dist/index.d.cts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { R as Runtime, B as BaseCollectionEntry } from './types-C-WXTx1W.cjs';
2
+ import { R as Runtime, B as BaseCollectionEntry } from './types-DvnkeVI3.cjs';
3
3
  import '@standard-schema/spec';
4
4
  import './define-DnJzAZrj.cjs';
5
5
  import 'fumadocs-core/mdx-plugins';
6
6
  import '@mdx-js/mdx';
7
7
  import 'unified';
8
8
  import 'zod';
9
+ import './build-mdx-DMe0r3s_.cjs';
10
+ import 'fumadocs-core/server';
9
11
  import 'react';
10
12
  import 'mdx/types';
11
- import 'fumadocs-core/server';
12
13
 
13
14
  declare const _runtime: Runtime;
14
15
  declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { PageData, MetaData, Source, VirtualFile } from 'fumadocs-core/source';
2
- import { R as Runtime, B as BaseCollectionEntry } from './types-CU9nn_je.js';
2
+ import { R as Runtime, B as BaseCollectionEntry } from './types-zBRxlyaM.js';
3
3
  import '@standard-schema/spec';
4
4
  import './define-DnJzAZrj.js';
5
5
  import 'fumadocs-core/mdx-plugins';
6
6
  import '@mdx-js/mdx';
7
7
  import 'unified';
8
8
  import 'zod';
9
+ import './build-mdx-DMe0r3s_.js';
10
+ import 'fumadocs-core/server';
9
11
  import 'react';
10
12
  import 'mdx/types';
11
- import 'fumadocs-core/server';
12
13
 
13
14
  declare const _runtime: Runtime;
14
15
  declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
@@ -34,7 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  function remarkMdxExport({ values }) {
35
35
  return (tree, vfile) => {
36
36
  for (const name of values) {
37
- if (!(name in vfile.data)) return;
37
+ if (!(name in vfile.data)) continue;
38
38
  tree.children.unshift(getMdastExport(name, vfile.data[name]));
39
39
  }
40
40
  };
@@ -80,6 +80,27 @@ var init_remark_exports = __esm({
80
80
  }
81
81
  });
82
82
 
83
+ // src/mdx-plugins/remark-extract.ts
84
+ function remarkExtract() {
85
+ return (tree, file) => {
86
+ const urls = [];
87
+ (0, import_unist_util_visit.visit)(tree, "link", (node) => {
88
+ urls.push({
89
+ href: node.url
90
+ });
91
+ return "skip";
92
+ });
93
+ file.data.extractedReferences = urls;
94
+ };
95
+ }
96
+ var import_unist_util_visit;
97
+ var init_remark_extract = __esm({
98
+ "src/mdx-plugins/remark-extract.ts"() {
99
+ "use strict";
100
+ import_unist_util_visit = require("unist-util-visit");
101
+ }
102
+ });
103
+
83
104
  // src/utils/mdx-options.ts
84
105
  var mdx_options_exports = {};
85
106
  __export(mdx_options_exports, {
@@ -107,6 +128,7 @@ function getDefaultMDXOptions({
107
128
  }) {
108
129
  const mdxExports = [
109
130
  "structuredData",
131
+ "extractedReferences",
110
132
  "frontmatter",
111
133
  "lastModified",
112
134
  ...valueToExport
@@ -134,6 +156,7 @@ function getDefaultMDXOptions({
134
156
  ],
135
157
  "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
136
158
  ...v,
159
+ remarkExtract,
137
160
  remarkStructureOptions !== false && [
138
161
  plugins.remarkStructure,
139
162
  remarkStructureOptions
@@ -163,6 +186,7 @@ var init_mdx_options = __esm({
163
186
  "use strict";
164
187
  plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
165
188
  init_remark_exports();
189
+ init_remark_extract();
166
190
  }
167
191
  });
168
192
 
@@ -309,7 +333,7 @@ async function getConfigHash(configPath) {
309
333
  var import_mdx = require("@mdx-js/mdx");
310
334
 
311
335
  // src/mdx-plugins/remark-include.ts
312
- var import_unist_util_visit = require("unist-util-visit");
336
+ var import_unist_util_visit2 = require("unist-util-visit");
313
337
  var path2 = __toESM(require("path"), 1);
314
338
  var fs2 = __toESM(require("fs/promises"), 1);
315
339
 
@@ -322,9 +346,9 @@ function fumaMatter(input) {
322
346
  if (!match) {
323
347
  return output;
324
348
  }
325
- output.matter = match[1];
349
+ output.matter = match[0];
326
350
  output.content = input.slice(match[0].length);
327
- const loaded = (0, import_js_yaml.load)(output.matter);
351
+ const loaded = (0, import_js_yaml.load)(match[1]);
328
352
  output.data = loaded ?? {};
329
353
  return output;
330
354
  }
@@ -360,7 +384,7 @@ function remarkInclude() {
360
384
  const TagName = "include";
361
385
  async function update(tree, directory, data) {
362
386
  const queue = [];
363
- (0, import_unist_util_visit.visit)(
387
+ (0, import_unist_util_visit2.visit)(
364
388
  tree,
365
389
  ["mdxJsxFlowElement", "mdxJsxTextElement"],
366
390
  (node, _, parent) => {
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  getConfigHash,
3
3
  loadConfig
4
- } from "./chunk-XZR5QXVY.js";
4
+ } from "./chunk-BCOXAJMC.js";
5
5
  import {
6
6
  countLines
7
7
  } from "./chunk-UCY7OBZG.js";
8
- import {
9
- buildMDX
10
- } from "./chunk-HWSF4OGZ.js";
11
- import "./chunk-3XN4P23K.js";
12
8
  import {
13
9
  ValidationError,
14
10
  getGitTimestamp,
15
11
  validate
16
12
  } from "./chunk-GX3THK2Q.js";
17
- import "./chunk-XVL4ZQFK.js";
13
+ import {
14
+ buildMDX
15
+ } from "./chunk-7JFPDRW7.js";
16
+ import "./chunk-IGXZS2W6.js";
17
+ import "./chunk-S73DGUHI.js";
18
18
  import {
19
19
  fumaMatter
20
- } from "./chunk-KVWX6THC.js";
20
+ } from "./chunk-VWJKRQZR.js";
21
21
 
22
22
  // src/loader-mdx.ts
23
23
  import * as path from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDefaultMDXOptions
3
- } from "./chunk-GYWPPGFD.js";
3
+ } from "./chunk-DJNS22RO.js";
4
4
  export {
5
5
  getDefaultMDXOptions
6
6
  };
@@ -34,7 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  function remarkMdxExport({ values }) {
35
35
  return (tree, vfile) => {
36
36
  for (const name of values) {
37
- if (!(name in vfile.data)) return;
37
+ if (!(name in vfile.data)) continue;
38
38
  tree.children.unshift(getMdastExport(name, vfile.data[name]));
39
39
  }
40
40
  };
@@ -80,6 +80,27 @@ var init_remark_exports = __esm({
80
80
  }
81
81
  });
82
82
 
83
+ // src/mdx-plugins/remark-extract.ts
84
+ function remarkExtract() {
85
+ return (tree, file) => {
86
+ const urls = [];
87
+ (0, import_unist_util_visit.visit)(tree, "link", (node) => {
88
+ urls.push({
89
+ href: node.url
90
+ });
91
+ return "skip";
92
+ });
93
+ file.data.extractedReferences = urls;
94
+ };
95
+ }
96
+ var import_unist_util_visit;
97
+ var init_remark_extract = __esm({
98
+ "src/mdx-plugins/remark-extract.ts"() {
99
+ "use strict";
100
+ import_unist_util_visit = require("unist-util-visit");
101
+ }
102
+ });
103
+
83
104
  // src/utils/mdx-options.ts
84
105
  var mdx_options_exports = {};
85
106
  __export(mdx_options_exports, {
@@ -107,6 +128,7 @@ function getDefaultMDXOptions({
107
128
  }) {
108
129
  const mdxExports = [
109
130
  "structuredData",
131
+ "extractedReferences",
110
132
  "frontmatter",
111
133
  "lastModified",
112
134
  ...valueToExport
@@ -134,6 +156,7 @@ function getDefaultMDXOptions({
134
156
  ],
135
157
  "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
136
158
  ...v,
159
+ remarkExtract,
137
160
  remarkStructureOptions !== false && [
138
161
  plugins.remarkStructure,
139
162
  remarkStructureOptions
@@ -163,6 +186,7 @@ var init_mdx_options = __esm({
163
186
  "use strict";
164
187
  plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
165
188
  init_remark_exports();
189
+ init_remark_extract();
166
190
  }
167
191
  });
168
192
 
@@ -440,9 +464,9 @@ function fumaMatter(input) {
440
464
  if (!match) {
441
465
  return output;
442
466
  }
443
- output.matter = match[1];
467
+ output.matter = match[0];
444
468
  output.content = input.slice(match[0].length);
445
- const loaded = (0, import_js_yaml.load)(output.matter);
469
+ const loaded = (0, import_js_yaml.load)(match[1]);
446
470
  output.data = loaded ?? {};
447
471
  return output;
448
472
  }
@@ -464,7 +488,14 @@ function getImportCode(info) {
464
488
  }
465
489
  function toImportPath(file, config) {
466
490
  const ext = import_node_path2.default.extname(file);
467
- const filename = ext === ".ts" ? file.substring(0, file.length - ext.length) : file;
491
+ let filename;
492
+ if (ext === ".ts" && config.jsExtension) {
493
+ filename = file.substring(0, file.length - ext.length) + ".js";
494
+ } else if (ext === ".ts") {
495
+ filename = file.substring(0, file.length - ext.length);
496
+ } else {
497
+ filename = file;
498
+ }
468
499
  let importPath;
469
500
  if ("relativeTo" in config) {
470
501
  importPath = import_node_path2.default.relative(config.relativeTo, filename);
@@ -589,7 +620,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
589
620
  info: file,
590
621
  lastModified,
591
622
  data,
592
- content: parsed.content
623
+ content: { body: parsed.content, matter: parsed.matter }
593
624
  });
594
625
  });
595
626
  return Promise.all(entries2);