fumadocs-mdx 8.2.3 → 8.2.4

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.
package/dist/config.d.mts CHANGED
@@ -6,7 +6,7 @@ import { RemarkImageOptions, RehypeCodeOptions } from 'fumadocs-core/mdx-plugins
6
6
  import { PluggableList } from 'unified';
7
7
  import { Configuration } from 'webpack';
8
8
  import { Options as Options$1 } from './loader-mdx.mjs';
9
- import { O as Options } from './search-index-plugin-sA93pAAG.mjs';
9
+ import { O as Options } from './search-index-plugin-rijIlRD4.mjs';
10
10
  import '@mdx-js/mdx';
11
11
 
12
12
  type MDXOptions = Omit<NonNullable<Options$1>, 'rehypePlugins' | 'remarkPlugins'> & {
@@ -36,8 +36,12 @@ interface CreateMDXOptions {
36
36
  * @defaultValue `'./content'`
37
37
  */
38
38
  rootContentPath?: string;
39
+ /**
40
+ * {@link LoaderOptions.include}
41
+ */
42
+ include?: string | string[];
39
43
  }
40
- declare const createMDX: ({ mdxOptions, cwd, rootMapPath, rootContentPath, buildSearchIndex, }?: CreateMDXOptions) => (nextConfig?: NextConfig) => {
44
+ declare const createMDX: ({ mdxOptions, cwd, rootMapPath, rootContentPath, buildSearchIndex, ...loadOptions }?: CreateMDXOptions) => (nextConfig?: NextConfig) => {
41
45
  webpack: (config: Configuration, options: next_dist_server_config_shared.WebpackConfigContext) => any;
42
46
  exportPathMap?: ((defaultMap: next_dist_server_config_shared.ExportPathMap, ctx: {
43
47
  dev: boolean;
package/dist/config.mjs CHANGED
@@ -162,24 +162,23 @@ function getMDXLoaderOptions({
162
162
  "lastModified",
163
163
  ...valueToExport
164
164
  ];
165
- const remarkPlugins = pluginOption(
166
- (v) => [
167
- remarkGfm,
168
- remarkHeading,
169
- ...remarkImageOptions === false ? [] : [[remarkImage, remarkImageOptions]],
170
- ...v,
171
- remarkStructure,
172
- [remarkMdxExport, { values: mdxExports }]
173
- ],
174
- mdxOptions.remarkPlugins
175
- );
176
- const rehypePlugins = pluginOption(
177
- (v) => [
178
- ...rehypeCodeOptions === false ? [] : [[rehypeCode, rehypeCodeOptions]],
179
- ...v
180
- ],
181
- mdxOptions.rehypePlugins
182
- );
165
+ const remarkPlugins = pluginOption((v) => {
166
+ const plugins = [remarkGfm, remarkHeading];
167
+ if (remarkImageOptions !== false)
168
+ plugins.push([remarkImage, remarkImageOptions]);
169
+ plugins.push(...v, remarkStructure, [
170
+ remarkMdxExport,
171
+ { values: mdxExports }
172
+ ]);
173
+ return plugins;
174
+ }, mdxOptions.remarkPlugins);
175
+ const rehypePlugins = pluginOption((v) => {
176
+ const plugins = [...v];
177
+ if (rehypeCodeOptions !== false) {
178
+ plugins.unshift([rehypeCode, rehypeCodeOptions]);
179
+ }
180
+ return plugins;
181
+ }, mdxOptions.rehypePlugins);
183
182
  return {
184
183
  providerImportSource: "next-mdx-import-source-file",
185
184
  ...mdxOptions,
@@ -192,7 +191,8 @@ var createMDX = ({
192
191
  cwd = process.cwd(),
193
192
  rootMapPath = "./.map.ts",
194
193
  rootContentPath = "./content",
195
- buildSearchIndex = false
194
+ buildSearchIndex = false,
195
+ ...loadOptions
196
196
  } = {}) => (nextConfig = {}) => {
197
197
  const rootMapFile = path2.resolve(cwd, rootMapPath);
198
198
  const rootContentDir = path2.resolve(cwd, rootContentPath);
@@ -227,7 +227,8 @@ var createMDX = ({
227
227
  loader: "fumadocs-mdx/loader",
228
228
  options: {
229
229
  rootContentDir,
230
- rootMapFile
230
+ rootMapFile,
231
+ ...loadOptions
231
232
  }
232
233
  }
233
234
  }
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  import { MDXProps } from 'mdx/types';
4
4
  import { StructuredData } from 'fumadocs-core/mdx-plugins';
5
5
  import { TableOfContents } from 'fumadocs-core/server';
6
- export { S as SearchIndex } from './search-index-plugin-sA93pAAG.mjs';
6
+ export { S as SearchIndex } from './search-index-plugin-rijIlRD4.mjs';
7
7
 
8
8
  declare const defaultSchemas: {
9
9
  frontmatter: z.ZodObject<{
package/dist/loader.d.mts CHANGED
@@ -3,6 +3,12 @@ import { LoaderContext } from 'webpack';
3
3
  interface LoaderOptions {
4
4
  rootContentDir: string;
5
5
  rootMapFile: string;
6
+ /**
7
+ * Included files in the map file
8
+ *
9
+ * @defaultValue '.&#47;**&#47;*.&#123;md,mdx,json&#125;'
10
+ */
11
+ include?: string | string[];
6
12
  }
7
13
  /**
8
14
  * Load the root `.map.ts` file
package/dist/loader.mjs CHANGED
@@ -7,9 +7,13 @@ function loader(_source, callback) {
7
7
  this.addContextDependency(options.rootContentDir);
8
8
  callback(null, buildMap(options));
9
9
  }
10
- function buildMap({ rootContentDir, rootMapFile }) {
10
+ function buildMap({
11
+ rootContentDir,
12
+ rootMapFile,
13
+ include = ["./**/*.{md,mdx,json}"]
14
+ }) {
11
15
  const mapDir = path.dirname(rootMapFile);
12
- const files = fg.sync("./**/*.{md,mdx,json}", {
16
+ const files = fg.sync(include, {
13
17
  cwd: rootContentDir
14
18
  });
15
19
  const imports = [];
@@ -8,17 +8,14 @@ interface SearchIndex {
8
8
  structuredData: StructuredData;
9
9
  }
10
10
  interface Options {
11
+ rootContentDir: string;
12
+ rootMapFile: string;
11
13
  /**
12
14
  * Only build search indexes in production builds
13
15
  *
14
16
  * @defaultValue true
15
17
  */
16
18
  productionOnly?: boolean;
17
- /**
18
- * Absolute path of root content directory
19
- */
20
- rootContentDir: string;
21
- rootMapFile: string;
22
19
  /**
23
20
  * @param path - MDX file path relative to root content dir
24
21
  * @returns page URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "8.2.3",
3
+ "version": "8.2.4",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -43,7 +43,7 @@
43
43
  "fast-glob": "^3.3.1",
44
44
  "gray-matter": "^4.0.3",
45
45
  "zod": "^3.22.4",
46
- "fumadocs-core": "10.0.4"
46
+ "fumadocs-core": "10.0.5"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/cross-spawn": "^6.0.6",