fumadocs-mdx 14.1.1 → 14.2.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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  import { BunPlugin } from 'bun';
2
- import { h as CoreOptions } from '../core-nagEel33.js';
2
+ import { C as CoreOptions } from '../core-X5ggQtBM.js';
3
3
  import '@mdx-js/mdx';
4
4
  import '@standard-schema/spec';
5
5
  import 'unified';
package/dist/bun/index.js CHANGED
@@ -4,7 +4,7 @@ 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";
@@ -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";
@@ -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,4 +1,4 @@
1
- export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, e as DefaultMDXOptions, D as DocCollection, a as DocsCollection, G as GlobalConfig, f as MDXPresetOptions, M as MetaCollection, P as PostprocessOptions, g as applyMdxPreset, d as defineCollections, c as defineConfig, b as defineDocs } from '../core-nagEel33.js';
1
+ export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, f as DefaultMDXOptions, D as DocCollection, b as DocsCollection, G as GlobalConfig, g as MDXPresetOptions, M as MetaCollection, P as PostprocessOptions, h as applyMdxPreset, d as defineCollections, e as defineConfig, c as defineDocs } from '../core-X5ggQtBM.js';
2
2
  import { Processor, Transformer } from 'unified';
3
3
  import { Root } from 'mdast';
4
4
  export { pageSchema as frontmatterSchema, metaSchema } from 'fumadocs-core/source/schema';
@@ -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";
@@ -347,4 +347,4 @@ declare function createCore(options: CoreOptions): {
347
347
  };
348
348
  type Core = ReturnType<typeof createCore>;
349
349
 
350
- export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DocCollection as D, type ExtractedReference as E, indexFile as F, type GlobalConfig as G, type IndexFilePlugin as H, type IndexFilePluginOptions as I, type MetaCollection as M, type PostprocessOptions as P, type ServerOptions as S, type TransformOptions as T, _Defaults as _, type DocsCollection as a, defineDocs as b, defineConfig as c, defineCollections as d, type DefaultMDXOptions as e, type MDXPresetOptions as f, applyMdxPreset as g, type CoreOptions as h, type Plugin as i, type AsyncDocCollectionEntry as j, type AsyncDocsCollectionEntry as k, type EmitEntry as l, type PluginContext as m, type CompilationContext as n, type PluginOption as o, type ServerContext as p, type EmitOptions as q, type EmitOutput as r, createCore as s, type Core as t, type MetaCollectionEntry as u, type DocCollectionEntry as v, type DocsCollectionEntry as w, type ServerCreate as x, server as y, toFumadocsSource as z };
350
+ export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DocCollection as D, type ExtractedReference as E, indexFile as F, type GlobalConfig as G, type IndexFilePlugin as H, type IndexFilePluginOptions as I, type MetaCollection as M, type PostprocessOptions as P, type ServerOptions as S, type TransformOptions as T, _Defaults as _, type CollectionSchema as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, type DefaultMDXOptions as f, type MDXPresetOptions as g, applyMdxPreset as h, type Plugin as i, type AsyncDocCollectionEntry as j, type AsyncDocsCollectionEntry as k, type EmitEntry as l, type PluginContext as m, type CompilationContext as n, type PluginOption as o, type ServerContext as p, type EmitOptions as q, type EmitOutput as r, createCore as s, type Core as t, type MetaCollectionEntry as u, type DocCollectionEntry as v, type DocsCollectionEntry as w, type ServerCreate as x, server as y, toFumadocsSource as z };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { n as CompilationContext, t as Core, h as CoreOptions, l as EmitEntry, q as EmitOptions, r as EmitOutput, E as ExtractedReference, i as Plugin, m as PluginContext, o as PluginOption, p as ServerContext, T as TransformOptions, _ as _Defaults, s as createCore } from './core-nagEel33.js';
1
+ export { n as CompilationContext, t as Core, C as CoreOptions, l as EmitEntry, q as EmitOptions, r as EmitOutput, E as ExtractedReference, i as Plugin, m as PluginContext, o as PluginOption, p as ServerContext, T as TransformOptions, _ as _Defaults, s as createCore } from './core-X5ggQtBM.js';
2
2
  import { createProcessor } from '@mdx-js/mdx';
3
3
  import { StructuredData } from 'fumadocs-core/mdx-plugins';
4
4
  import { TOCItemType } from 'fumadocs-core/toc';
@@ -1,5 +1,5 @@
1
1
  import { NextConfig } from 'next';
2
- import { I as IndexFilePluginOptions } from '../core-nagEel33.js';
2
+ import { I as IndexFilePluginOptions } from '../core-X5ggQtBM.js';
3
3
  import '@mdx-js/mdx';
4
4
  import '@standard-schema/spec';
5
5
  import 'unified';
@@ -1,6 +1,6 @@
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";
@@ -1,4 +1,4 @@
1
- export { H as IndexFilePlugin, I as IndexFilePluginOptions, F as default } from '../core-nagEel33.js';
1
+ export { H as IndexFilePlugin, I as IndexFilePluginOptions, F as default } from '../core-X5ggQtBM.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -1,4 +1,4 @@
1
- import { i as Plugin } from '../core-nagEel33.js';
1
+ import { i as Plugin } from '../core-X5ggQtBM.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -1,4 +1,4 @@
1
- import { i as Plugin } from '../core-nagEel33.js';
1
+ import { i as Plugin } from '../core-X5ggQtBM.js';
2
2
  import '@mdx-js/mdx';
3
3
  import '@standard-schema/spec';
4
4
  import 'unified';
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, FC } from 'react';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
- import { D as DocCollection, a as DocsCollection } from '../core-nagEel33.js';
3
+ import { D as DocCollection, b as DocsCollection } from '../core-X5ggQtBM.js';
4
4
  import { CompiledMDXProperties } from '../index.js';
5
5
  import { InternalTypeConfig } from './types.js';
6
6
  import '@mdx-js/mdx';
@@ -1,5 +1,5 @@
1
1
  import * as fumadocs_core_source from 'fumadocs-core/source';
2
- import { h as CoreOptions, S as ServerOptions, D as DocCollection, a as DocsCollection, j as AsyncDocCollectionEntry, k as AsyncDocsCollectionEntry } from '../core-nagEel33.js';
2
+ import { C as CoreOptions, S as ServerOptions, D as DocCollection, b as DocsCollection, j as AsyncDocCollectionEntry, k as AsyncDocsCollectionEntry } from '../core-X5ggQtBM.js';
3
3
  import * as _standard_schema_spec from '@standard-schema/spec';
4
4
  import { FileInfo, InternalTypeConfig } from './types.js';
5
5
  import '@mdx-js/mdx';
@@ -1,10 +1,10 @@
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";
@@ -1,5 +1,5 @@
1
1
  import 'fumadocs-core/source';
2
- export { j as AsyncDocCollectionEntry, k as AsyncDocsCollectionEntry, v as DocCollectionEntry, w as DocsCollectionEntry, u as MetaCollectionEntry, x as ServerCreate, S as ServerOptions, y as server, z as toFumadocsSource } from '../core-nagEel33.js';
2
+ export { j as AsyncDocCollectionEntry, k as AsyncDocsCollectionEntry, v as DocCollectionEntry, w as DocsCollectionEntry, u as MetaCollectionEntry, x as ServerCreate, S as ServerOptions, y as server, z as toFumadocsSource } from '../core-X5ggQtBM.js';
3
3
  import '@standard-schema/spec';
4
4
  import './types.js';
5
5
  import '@mdx-js/mdx';
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import { I as IndexFilePluginOptions } from '../core-nagEel33.js';
2
+ import { I as IndexFilePluginOptions } from '../core-X5ggQtBM.js';
3
3
  import '@mdx-js/mdx';
4
4
  import '@standard-schema/spec';
5
5
  import 'unified';
@@ -4,7 +4,7 @@ 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";
@@ -26,7 +26,6 @@ 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"];
30
29
  async function mdx(config, pluginOptions = {}) {
31
30
  const options = applyDefaults(pluginOptions);
32
31
  const core = createViteCore(options);
@@ -48,12 +47,21 @@ async function mdx(config, pluginOptions = {}) {
48
47
  config(config2) {
49
48
  if (!options.updateViteConfig) return config2;
50
49
  return mergeConfig(config2, {
51
- optimizeDeps: {
52
- exclude: FumadocsDeps
53
- },
54
50
  resolve: {
55
- noExternal: FumadocsDeps,
56
- dedupe: FumadocsDeps
51
+ noExternal: [
52
+ "fumadocs-core",
53
+ "fumadocs-ui",
54
+ "fumadocs-openapi",
55
+ "@fumadocs/base-ui",
56
+ "@fumadocs/ui"
57
+ ],
58
+ // only dedupe for public, non-transitive libs
59
+ dedupe: [
60
+ "fumadocs-core",
61
+ "fumadocs-ui",
62
+ "fumadocs-openapi",
63
+ "@fumadocs/base-ui"
64
+ ]
57
65
  }
58
66
  });
59
67
  },
@@ -3,7 +3,7 @@ import {
3
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "14.1.1",
3
+ "version": "14.2.1",
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,31 +73,31 @@
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.4",
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
83
  "@types/node": "^24.10.2",
84
84
  "@types/picomatch": "^4.0.2",
85
85
  "@types/react": "^19.2.7",
86
- "astro": "^5.16.5",
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.10",
89
+ "next": "16.1.0",
90
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.7",
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
- "tsconfig": "0.0.0",
100
- "fumadocs-core": "16.2.5"
99
+ "fumadocs-core": "16.3.1",
100
+ "tsconfig": "0.0.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@fumadocs/mdx-remote": "^1.4.0",