fumadocs-mdx 14.1.0 → 14.2.0

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,7 +1,7 @@
1
1
  import {
2
2
  buildMDX
3
- } from "./chunk-7W73RILB.js";
4
- import "./chunk-Y7ISNZ7X.js";
3
+ } from "./chunk-4EUH5CD2.js";
4
+ import "./chunk-WFDF56IJ.js";
5
5
  import "./chunk-VWJKRQZR.js";
6
6
  export {
7
7
  buildMDX
package/dist/bun/index.js CHANGED
@@ -4,20 +4,20 @@ import {
4
4
  import "../chunk-S7KOJHHO.js";
5
5
  import {
6
6
  createMdxLoader
7
- } from "../chunk-T6G5VOED.js";
7
+ } from "../chunk-USQZ5OLE.js";
8
8
  import {
9
9
  createMetaLoader
10
10
  } from "../chunk-ZAYZWFWP.js";
11
11
  import {
12
12
  createIntegratedConfigLoader,
13
13
  toBun
14
- } from "../chunk-WAAWFNDX.js";
14
+ } from "../chunk-WSQ23PNV.js";
15
15
  import "../chunk-4JSFLXXT.js";
16
16
  import {
17
17
  _Defaults,
18
18
  createCore
19
- } from "../chunk-VKSHE52K.js";
20
- import "../chunk-PW2AZGGD.js";
19
+ } from "../chunk-KWSETXYC.js";
20
+ import "../chunk-2PY3JUIC.js";
21
21
  import "../chunk-VWJKRQZR.js";
22
22
 
23
23
  // src/bun/index.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCore
3
- } from "./chunk-VKSHE52K.js";
3
+ } from "./chunk-KWSETXYC.js";
4
4
 
5
5
  // src/webpack/index.ts
6
6
  var core;
@@ -121,5 +121,6 @@ function ident(code, tab = 1) {
121
121
 
122
122
  export {
123
123
  createCodegen,
124
+ slash,
124
125
  ident
125
126
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  flattenNode,
3
3
  remarkInclude
4
- } from "./chunk-Y7ISNZ7X.js";
4
+ } from "./chunk-WFDF56IJ.js";
5
5
 
6
6
  // src/loaders/mdx/build-mdx.ts
7
7
  import { createProcessor } from "@mdx-js/mdx";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ident
3
- } from "./chunk-PW2AZGGD.js";
3
+ } from "./chunk-2PY3JUIC.js";
4
4
 
5
5
  // src/utils/validation.ts
6
6
  var ValidationError = class extends Error {
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  createCodegen,
3
- ident
4
- } from "./chunk-PW2AZGGD.js";
3
+ ident,
4
+ slash
5
+ } from "./chunk-2PY3JUIC.js";
5
6
  import {
6
7
  fumaMatter
7
8
  } from "./chunk-VWJKRQZR.js";
@@ -293,7 +294,7 @@ async function generateBrowserIndexFile(ctx) {
293
294
  codegen.lines.push("};", "export default browserCollections;");
294
295
  }
295
296
  function getBase(collection) {
296
- return path2.relative(process.cwd(), collection.dir);
297
+ return slash(path2.relative(process.cwd(), collection.dir));
297
298
  }
298
299
  function generateDocCollectionFrontmatterGlob({ codegen, workspace }, collection, eager = false) {
299
300
  return codegen.generateGlobImport(collection.patterns, {
@@ -82,7 +82,7 @@ function createMdxLoader({ getCore }) {
82
82
  };
83
83
  }
84
84
  const lineOffset = isDevelopment ? countLines(matter.matter) : 0;
85
- const { buildMDX } = await import("./build-mdx-RXJZQXGA.js");
85
+ const { buildMDX } = await import("./build-mdx-5XLFMP5P.js");
86
86
  const compiled = await buildMDX(core, docCollection, {
87
87
  isDevelopment,
88
88
  source: "\n".repeat(lineOffset) + matter.content,
@@ -63,6 +63,76 @@ function flattenNode(node) {
63
63
  }
64
64
 
65
65
  // src/loaders/mdx/remark-include.ts
66
+ var REGION_MARKERS = [
67
+ {
68
+ start: /^\s*\/\/\s*#?region\b\s*(.*?)\s*$/,
69
+ end: /^\s*\/\/\s*#?endregion\b\s*(.*?)\s*$/
70
+ },
71
+ {
72
+ start: /^\s*<!--\s*#?region\b\s*(.*?)\s*-->/,
73
+ end: /^\s*<!--\s*#?endregion\b\s*(.*?)\s*-->/
74
+ },
75
+ {
76
+ start: /^\s*\/\*\s*#region\b\s*(.*?)\s*\*\//,
77
+ end: /^\s*\/\*\s*#endregion\b\s*(.*?)\s*\*\//
78
+ },
79
+ {
80
+ start: /^\s*#[rR]egion\b\s*(.*?)\s*$/,
81
+ end: /^\s*#[eE]nd ?[rR]egion\b\s*(.*?)\s*$/
82
+ },
83
+ {
84
+ start: /^\s*#\s*#?region\b\s*(.*?)\s*$/,
85
+ end: /^\s*#\s*#?endregion\b\s*(.*?)\s*$/
86
+ },
87
+ {
88
+ start: /^\s*(?:--|::|@?REM)\s*#region\b\s*(.*?)\s*$/,
89
+ end: /^\s*(?:--|::|@?REM)\s*#endregion\b\s*(.*?)\s*$/
90
+ },
91
+ {
92
+ start: /^\s*#pragma\s+region\b\s*(.*?)\s*$/,
93
+ end: /^\s*#pragma\s+endregion\b\s*(.*?)\s*$/
94
+ },
95
+ {
96
+ start: /^\s*\(\*\s*#region\b\s*(.*?)\s*\*\)/,
97
+ end: /^\s*\(\*\s*#endregion\b\s*(.*?)\s*\*\)/
98
+ }
99
+ ];
100
+ function dedent(lines) {
101
+ const minIndent = lines.reduce((min, line) => {
102
+ const match = line.match(/^(\s*)\S/);
103
+ return match ? Math.min(min, match[1].length) : min;
104
+ }, Infinity);
105
+ return minIndent === Infinity ? lines.join("\n") : lines.map((l) => l.slice(minIndent)).join("\n");
106
+ }
107
+ function extractCodeRegion(content, regionName) {
108
+ const lines = content.split("\n");
109
+ for (let i = 0; i < lines.length; i++) {
110
+ for (const re of REGION_MARKERS) {
111
+ let match = re.start.exec(lines[i]);
112
+ if (match?.[1] !== regionName) continue;
113
+ let depth = 1;
114
+ const extractedLines = [];
115
+ for (let j = i + 1; j < lines.length; j++) {
116
+ match = re.start.exec(lines[j]);
117
+ if (match) {
118
+ depth++;
119
+ continue;
120
+ }
121
+ match = re.end.exec(lines[j]);
122
+ if (match) {
123
+ if (match[1] === regionName) depth = 0;
124
+ else if (match[1] === "") depth--;
125
+ else continue;
126
+ if (depth > 0) continue;
127
+ return dedent(extractedLines);
128
+ } else {
129
+ extractedLines.push(lines[j]);
130
+ }
131
+ }
132
+ }
133
+ }
134
+ throw new Error(`Region "${regionName}" not found`);
135
+ }
66
136
  var ElementLikeTypes = [
67
137
  "mdxJsxFlowElement",
68
138
  "mdxJsxTextElement",
@@ -144,11 +214,15 @@ ${e instanceof Error ? e.message : String(e)}`,
144
214
  _compiler?.addDependency(targetPath);
145
215
  if (params.lang || ext !== ".md" && ext !== ".mdx") {
146
216
  const lang = params.lang ?? ext.slice(1);
217
+ let value = content;
218
+ if (heading) {
219
+ value = extractCodeRegion(content, heading.trim());
220
+ }
147
221
  return {
148
222
  type: "code",
149
223
  lang,
150
224
  meta: params.meta,
151
- value: content,
225
+ value,
152
226
  data: {}
153
227
  };
154
228
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ValidationError
3
- } from "./chunk-VKSHE52K.js";
3
+ } from "./chunk-KWSETXYC.js";
4
4
 
5
5
  // src/loaders/adapter.ts
6
6
  import { fileURLToPath } from "url";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  remarkInclude
3
- } from "../chunk-Y7ISNZ7X.js";
3
+ } from "../chunk-WFDF56IJ.js";
4
4
  import {
5
5
  applyMdxPreset
6
6
  } from "../chunk-S7KOJHHO.js";
@@ -965,7 +965,7 @@ async function generateBrowserIndexFile(ctx) {
965
965
  codegen.lines.push("};", "export default browserCollections;");
966
966
  }
967
967
  function getBase(collection) {
968
- return import_path.default.relative(process.cwd(), collection.dir);
968
+ return slash(import_path.default.relative(process.cwd(), collection.dir));
969
969
  }
970
970
  function generateDocCollectionFrontmatterGlob({ codegen, workspace }, collection, eager = false) {
971
971
  return codegen.generateGlobImport(collection.patterns, {
@@ -10,11 +10,11 @@ import {
10
10
  import {
11
11
  _Defaults,
12
12
  createCore
13
- } from "../chunk-VKSHE52K.js";
13
+ } from "../chunk-KWSETXYC.js";
14
14
  import {
15
15
  indexFile
16
- } from "../chunk-VITVHHR6.js";
17
- import "../chunk-PW2AZGGD.js";
16
+ } from "../chunk-STLEUNK7.js";
17
+ import "../chunk-2PY3JUIC.js";
18
18
  import "../chunk-VWJKRQZR.js";
19
19
 
20
20
  // src/next/index.ts
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createMdxLoader
3
- } from "../chunk-T6G5VOED.js";
3
+ } from "../chunk-USQZ5OLE.js";
4
4
  import {
5
5
  createMetaLoader
6
6
  } from "../chunk-ZAYZWFWP.js";
7
7
  import {
8
8
  createStandaloneConfigLoader,
9
9
  toNode
10
- } from "../chunk-WAAWFNDX.js";
10
+ } from "../chunk-WSQ23PNV.js";
11
11
  import "../chunk-4JSFLXXT.js";
12
12
  import {
13
13
  _Defaults,
14
14
  createCore
15
- } from "../chunk-VKSHE52K.js";
16
- import "../chunk-PW2AZGGD.js";
15
+ } from "../chunk-KWSETXYC.js";
16
+ import "../chunk-2PY3JUIC.js";
17
17
  import "../chunk-VWJKRQZR.js";
18
18
 
19
19
  // src/node/loader.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  indexFile
3
- } from "../chunk-VITVHHR6.js";
4
- import "../chunk-PW2AZGGD.js";
3
+ } from "../chunk-STLEUNK7.js";
4
+ import "../chunk-2PY3JUIC.js";
5
5
  import "../chunk-VWJKRQZR.js";
6
6
  export {
7
7
  indexFile as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ident
3
- } from "../chunk-PW2AZGGD.js";
3
+ } from "../chunk-2PY3JUIC.js";
4
4
 
5
5
  // src/plugins/last-modified.ts
6
6
  import path from "path";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  buildMDX
3
- } from "../chunk-7W73RILB.js";
3
+ } from "../chunk-4EUH5CD2.js";
4
4
  import {
5
5
  server
6
6
  } from "../chunk-5OBUOALK.js";
7
- import "../chunk-Y7ISNZ7X.js";
7
+ import "../chunk-WFDF56IJ.js";
8
8
  import {
9
9
  buildConfig
10
10
  } from "../chunk-OLD35ARB.js";
11
11
  import "../chunk-S7KOJHHO.js";
12
12
  import {
13
13
  createCore
14
- } from "../chunk-VKSHE52K.js";
15
- import "../chunk-PW2AZGGD.js";
14
+ } from "../chunk-KWSETXYC.js";
15
+ import "../chunk-2PY3JUIC.js";
16
16
  import {
17
17
  fumaMatter
18
18
  } from "../chunk-VWJKRQZR.js";
@@ -4,29 +4,34 @@ import {
4
4
  import "../chunk-S7KOJHHO.js";
5
5
  import {
6
6
  createMdxLoader
7
- } from "../chunk-T6G5VOED.js";
7
+ } from "../chunk-USQZ5OLE.js";
8
8
  import {
9
9
  createMetaLoader
10
10
  } from "../chunk-ZAYZWFWP.js";
11
11
  import {
12
12
  createIntegratedConfigLoader,
13
13
  toVite
14
- } from "../chunk-WAAWFNDX.js";
14
+ } from "../chunk-WSQ23PNV.js";
15
15
  import "../chunk-4JSFLXXT.js";
16
16
  import {
17
17
  ValidationError,
18
18
  _Defaults,
19
19
  createCore
20
- } from "../chunk-VKSHE52K.js";
20
+ } from "../chunk-KWSETXYC.js";
21
21
  import {
22
22
  indexFile
23
- } from "../chunk-VITVHHR6.js";
24
- import "../chunk-PW2AZGGD.js";
23
+ } from "../chunk-STLEUNK7.js";
24
+ import "../chunk-2PY3JUIC.js";
25
25
  import "../chunk-VWJKRQZR.js";
26
26
 
27
27
  // src/vite/index.ts
28
28
  import { mergeConfig } from "vite";
29
- var FumadocsDeps = ["fumadocs-core", "fumadocs-ui", "fumadocs-openapi"];
29
+ var FumadocsDeps = [
30
+ "fumadocs-core",
31
+ "fumadocs-ui",
32
+ "fumadocs-openapi",
33
+ "@fumadocs/base-ui"
34
+ ];
30
35
  async function mdx(config, pluginOptions = {}) {
31
36
  const options = applyDefaults(pluginOptions);
32
37
  const core = createViteCore(options);
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  getCore
3
- } from "../chunk-K7N6GD4M.js";
3
+ } from "../chunk-257RZJEQ.js";
4
4
  import {
5
5
  createMdxLoader
6
- } from "../chunk-T6G5VOED.js";
6
+ } from "../chunk-USQZ5OLE.js";
7
7
  import {
8
8
  createStandaloneConfigLoader,
9
9
  toWebpack
10
- } from "../chunk-WAAWFNDX.js";
10
+ } from "../chunk-WSQ23PNV.js";
11
11
  import "../chunk-4JSFLXXT.js";
12
- import "../chunk-VKSHE52K.js";
13
- import "../chunk-PW2AZGGD.js";
12
+ import "../chunk-KWSETXYC.js";
13
+ import "../chunk-2PY3JUIC.js";
14
14
  import "../chunk-VWJKRQZR.js";
15
15
 
16
16
  // src/webpack/mdx.ts
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  getCore
3
- } from "../chunk-K7N6GD4M.js";
3
+ } from "../chunk-257RZJEQ.js";
4
4
  import {
5
5
  createMetaLoader
6
6
  } from "../chunk-ZAYZWFWP.js";
7
7
  import {
8
8
  createStandaloneConfigLoader,
9
9
  toWebpack
10
- } from "../chunk-WAAWFNDX.js";
10
+ } from "../chunk-WSQ23PNV.js";
11
11
  import "../chunk-4JSFLXXT.js";
12
- import "../chunk-VKSHE52K.js";
13
- import "../chunk-PW2AZGGD.js";
12
+ import "../chunk-KWSETXYC.js";
13
+ import "../chunk-2PY3JUIC.js";
14
14
 
15
15
  // src/webpack/meta.ts
16
16
  var instance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -58,9 +58,9 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@mdx-js/mdx": "^3.1.1",
61
- "@standard-schema/spec": "^1.0.0",
61
+ "@standard-schema/spec": "^1.1.0",
62
62
  "chokidar": "^5.0.0",
63
- "esbuild": "^0.27.1",
63
+ "esbuild": "^0.27.2",
64
64
  "estree-util-value-to-estree": "^3.5.0",
65
65
  "js-yaml": "^4.1.1",
66
66
  "mdast-util-to-markdown": "^2.1.2",
@@ -73,30 +73,30 @@
73
73
  "unist-util-remove-position": "^5.0.0",
74
74
  "unist-util-visit": "^5.0.0",
75
75
  "vfile": "^6.0.3",
76
- "zod": "^4.1.13"
76
+ "zod": "^4.2.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@types/bun": "^1.3.3",
79
+ "@types/bun": "^1.3.5",
80
80
  "@types/js-yaml": "^4.0.9",
81
81
  "@types/mdast": "^4.0.4",
82
82
  "@types/mdx": "^2.0.13",
83
- "@types/node": "^24.10.1",
83
+ "@types/node": "^24.10.2",
84
84
  "@types/picomatch": "^4.0.2",
85
85
  "@types/react": "^19.2.7",
86
- "astro": "^5.16.4",
86
+ "astro": "^5.16.6",
87
87
  "mdast-util-directive": "^3.1.0",
88
88
  "mdast-util-mdx-jsx": "^3.2.0",
89
- "next": "16.0.7",
90
- "react": "^19.2.1",
89
+ "next": "16.1.0",
90
+ "react": "^19.2.3",
91
91
  "remark": "^15.0.1",
92
92
  "remark-directive": "^4.0.0",
93
93
  "remark-stringify": "^11.0.0",
94
- "rollup": "^4.53.3",
95
- "vite": "^7.2.6",
96
- "webpack": "^5.103.0",
94
+ "rollup": "^4.53.5",
95
+ "vite": "^7.3.0",
96
+ "webpack": "^5.104.1",
97
97
  "@fumadocs/mdx-remote": "1.4.3",
98
98
  "eslint-config-custom": "0.0.0",
99
- "fumadocs-core": "16.2.3",
99
+ "fumadocs-core": "16.3.1",
100
100
  "tsconfig": "0.0.0"
101
101
  },
102
102
  "peerDependencies": {