fumadocs-mdx 8.1.1 → 8.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.
- package/dist/config.d.mts +5 -3
- package/dist/config.mjs +127 -61
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +12 -17
- package/dist/loader-mdx.d.mts +10 -1
- package/dist/loader-mdx.mjs +44 -54
- package/dist/loader.d.mts +2 -3
- package/dist/loader.mjs +6 -9
- package/dist/search-index-plugin-qbqv40V1.d.mts +34 -0
- package/package.json +9 -9
- package/dist/chunk-P26LYDRL.mjs +0 -58
package/dist/config.d.mts
CHANGED
|
@@ -5,10 +5,11 @@ import { NextConfig } from 'next';
|
|
|
5
5
|
import { RemarkImageOptions, RehypeCodeOptions } from 'fumadocs-core/mdx-plugins';
|
|
6
6
|
import { PluggableList } from 'unified';
|
|
7
7
|
import { Configuration } from 'webpack';
|
|
8
|
-
import { Options } from './loader-mdx.mjs';
|
|
8
|
+
import { Options as Options$1 } from './loader-mdx.mjs';
|
|
9
|
+
import { O as Options } from './search-index-plugin-qbqv40V1.mjs';
|
|
9
10
|
import '@mdx-js/mdx';
|
|
10
11
|
|
|
11
|
-
type MDXOptions = Omit<NonNullable<Options>, 'rehypePlugins' | 'remarkPlugins'> & {
|
|
12
|
+
type MDXOptions = Omit<NonNullable<Options$1>, 'rehypePlugins' | 'remarkPlugins'> & {
|
|
12
13
|
rehypePlugins?: ResolvePlugins;
|
|
13
14
|
remarkPlugins?: ResolvePlugins;
|
|
14
15
|
/**
|
|
@@ -22,6 +23,7 @@ type ResolvePlugins = PluggableList | ((v: PluggableList) => PluggableList);
|
|
|
22
23
|
interface CreateMDXOptions {
|
|
23
24
|
cwd?: string;
|
|
24
25
|
mdxOptions?: MDXOptions;
|
|
26
|
+
buildSearchIndex?: Partial<Options> | false;
|
|
25
27
|
/**
|
|
26
28
|
* Where the root map.ts should be, relative to cwd
|
|
27
29
|
*
|
|
@@ -35,7 +37,7 @@ interface CreateMDXOptions {
|
|
|
35
37
|
*/
|
|
36
38
|
rootContentPath?: string;
|
|
37
39
|
}
|
|
38
|
-
declare const createMDX: ({ mdxOptions, cwd, rootMapPath, rootContentPath, }?: CreateMDXOptions) => (nextConfig?: NextConfig) => {
|
|
40
|
+
declare const createMDX: ({ mdxOptions, cwd, rootMapPath, rootContentPath, buildSearchIndex, }?: CreateMDXOptions) => (nextConfig?: NextConfig) => {
|
|
39
41
|
webpack: (config: Configuration, options: next_dist_server_config_shared.WebpackConfigContext) => any;
|
|
40
42
|
exportPathMap?: ((defaultMap: next_dist_server_config_shared.ExportPathMap, ctx: {
|
|
41
43
|
dev: boolean;
|
package/dist/config.mjs
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "./chunk-P26LYDRL.mjs";
|
|
6
|
-
|
|
7
1
|
// src/config.ts
|
|
8
|
-
import
|
|
2
|
+
import path2 from "node:path";
|
|
9
3
|
import {
|
|
10
4
|
rehypeCode,
|
|
11
5
|
remarkGfm,
|
|
@@ -15,7 +9,7 @@ import {
|
|
|
15
9
|
} from "fumadocs-core/mdx-plugins";
|
|
16
10
|
|
|
17
11
|
// src/webpack-plugins/map-plugin.ts
|
|
18
|
-
import fs from "fs";
|
|
12
|
+
import * as fs from "node:fs";
|
|
19
13
|
var firstLoad = true;
|
|
20
14
|
var content = `
|
|
21
15
|
/** Auto-generated **/
|
|
@@ -86,6 +80,67 @@ function remarkMdxExport({ values }) {
|
|
|
86
80
|
};
|
|
87
81
|
}
|
|
88
82
|
|
|
83
|
+
// src/webpack-plugins/search-index-plugin.ts
|
|
84
|
+
import * as path from "node:path";
|
|
85
|
+
import { createRequire } from "node:module";
|
|
86
|
+
import { createGetUrl, getSlugs, parseFilePath } from "fumadocs-core/source";
|
|
87
|
+
var require2 = createRequire(import.meta.url);
|
|
88
|
+
var pkg = require2("next/dist/compiled/webpack/webpack.js");
|
|
89
|
+
var SearchIndexPlugin = class _SearchIndexPlugin {
|
|
90
|
+
constructor(options) {
|
|
91
|
+
this.options = options;
|
|
92
|
+
}
|
|
93
|
+
apply(compiler) {
|
|
94
|
+
const {
|
|
95
|
+
rootContentDir,
|
|
96
|
+
productionOnly = true,
|
|
97
|
+
filter = () => true,
|
|
98
|
+
getUrl = (file) => {
|
|
99
|
+
return createGetUrl("/")(getSlugs(parseFilePath(file)));
|
|
100
|
+
}
|
|
101
|
+
} = this.options;
|
|
102
|
+
const logger = compiler.getInfrastructureLogger(_SearchIndexPlugin.name);
|
|
103
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
104
|
+
if (productionOnly && !isProduction)
|
|
105
|
+
return;
|
|
106
|
+
compiler.hooks.compilation.tap(_SearchIndexPlugin.name, (compilation) => {
|
|
107
|
+
if (compilation.name !== "server")
|
|
108
|
+
return;
|
|
109
|
+
compilation.hooks.processAssets.tap(
|
|
110
|
+
{
|
|
111
|
+
name: _SearchIndexPlugin.name,
|
|
112
|
+
stage: pkg.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
113
|
+
},
|
|
114
|
+
() => {
|
|
115
|
+
const indexFiles = /* @__PURE__ */ new Map();
|
|
116
|
+
for (const m of compilation.modules.values()) {
|
|
117
|
+
if (!m.buildInfo || !("__fumadocs" in m.buildInfo))
|
|
118
|
+
continue;
|
|
119
|
+
const info = m.buildInfo.__fumadocs;
|
|
120
|
+
const relativePath = path.relative(rootContentDir, info.path);
|
|
121
|
+
if (!filter(relativePath))
|
|
122
|
+
continue;
|
|
123
|
+
indexFiles.set(info.path, {
|
|
124
|
+
id: info.path,
|
|
125
|
+
structuredData: info.data.structuredData,
|
|
126
|
+
title: info.data.frontmatter.title,
|
|
127
|
+
description: info.data.frontmatter.description,
|
|
128
|
+
url: getUrl(relativePath)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
compilation.emitAsset(
|
|
132
|
+
"fumadocs_search.json",
|
|
133
|
+
new pkg.sources.RawSource(
|
|
134
|
+
JSON.stringify(Array.from(indexFiles.values()))
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
logger.info("Generated Search Indexes");
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
89
144
|
// src/config.ts
|
|
90
145
|
function pluginOption(def, options = []) {
|
|
91
146
|
const list = def(Array.isArray(options) ? options : []);
|
|
@@ -94,16 +149,12 @@ function pluginOption(def, options = []) {
|
|
|
94
149
|
}
|
|
95
150
|
return list;
|
|
96
151
|
}
|
|
97
|
-
function getMDXLoaderOptions(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"valueToExport",
|
|
104
|
-
"rehypeCodeOptions",
|
|
105
|
-
"remarkImageOptions"
|
|
106
|
-
]);
|
|
152
|
+
function getMDXLoaderOptions({
|
|
153
|
+
valueToExport = [],
|
|
154
|
+
rehypeCodeOptions,
|
|
155
|
+
remarkImageOptions,
|
|
156
|
+
...mdxOptions
|
|
157
|
+
}) {
|
|
107
158
|
const mdxExports = [
|
|
108
159
|
"structuredData",
|
|
109
160
|
"toc",
|
|
@@ -129,61 +180,76 @@ function getMDXLoaderOptions(_a) {
|
|
|
129
180
|
],
|
|
130
181
|
mdxOptions.rehypePlugins
|
|
131
182
|
);
|
|
132
|
-
return
|
|
133
|
-
providerImportSource: "next-mdx-import-source-file"
|
|
134
|
-
|
|
183
|
+
return {
|
|
184
|
+
providerImportSource: "next-mdx-import-source-file",
|
|
185
|
+
...mdxOptions,
|
|
135
186
|
remarkPlugins,
|
|
136
187
|
rehypePlugins
|
|
137
|
-
}
|
|
188
|
+
};
|
|
138
189
|
}
|
|
139
190
|
var createMDX = ({
|
|
140
191
|
mdxOptions = {},
|
|
141
192
|
cwd = process.cwd(),
|
|
142
193
|
rootMapPath = "./.map.ts",
|
|
143
|
-
rootContentPath = "./content"
|
|
194
|
+
rootContentPath = "./content",
|
|
195
|
+
buildSearchIndex = false
|
|
144
196
|
} = {}) => (nextConfig = {}) => {
|
|
145
|
-
const
|
|
197
|
+
const rootMapFile = path2.resolve(cwd, rootMapPath);
|
|
198
|
+
const rootContentDir = path2.resolve(cwd, rootContentPath);
|
|
146
199
|
const mdxLoaderOptions = getMDXLoaderOptions(mdxOptions);
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
200
|
+
return {
|
|
201
|
+
...nextConfig,
|
|
202
|
+
...{
|
|
203
|
+
webpack: (config, options) => {
|
|
204
|
+
config.resolve ||= {};
|
|
205
|
+
const alias = config.resolve.alias;
|
|
206
|
+
alias["next-mdx-import-source-file"] = [
|
|
207
|
+
"private-next-root-dir/src/mdx-components",
|
|
208
|
+
"private-next-root-dir/mdx-components",
|
|
209
|
+
"@mdx-js/react"
|
|
210
|
+
];
|
|
211
|
+
config.module ||= {};
|
|
212
|
+
config.module.rules ||= [];
|
|
213
|
+
config.module.rules.push(
|
|
214
|
+
{
|
|
215
|
+
test: /\.mdx?$/,
|
|
216
|
+
use: [
|
|
217
|
+
options.defaultLoaders.babel,
|
|
218
|
+
{
|
|
219
|
+
loader: "fumadocs-mdx/loader-mdx",
|
|
220
|
+
options: mdxLoaderOptions
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
test: rootMapFile,
|
|
226
|
+
use: {
|
|
227
|
+
loader: "fumadocs-mdx/loader",
|
|
228
|
+
options: {
|
|
229
|
+
rootContentDir,
|
|
230
|
+
rootMapFile
|
|
231
|
+
}
|
|
178
232
|
}
|
|
179
233
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
234
|
+
);
|
|
235
|
+
config.plugins ||= [];
|
|
236
|
+
config.plugins.push(
|
|
237
|
+
new MapWebpackPlugin({
|
|
238
|
+
rootMapFile
|
|
239
|
+
})
|
|
240
|
+
);
|
|
241
|
+
if (buildSearchIndex !== false)
|
|
242
|
+
config.plugins.push(
|
|
243
|
+
new SearchIndexPlugin({
|
|
244
|
+
rootContentDir,
|
|
245
|
+
rootMapFile,
|
|
246
|
+
...buildSearchIndex
|
|
247
|
+
})
|
|
248
|
+
);
|
|
249
|
+
return nextConfig.webpack?.(config, options) ?? config;
|
|
250
|
+
}
|
|
185
251
|
}
|
|
186
|
-
}
|
|
252
|
+
};
|
|
187
253
|
};
|
|
188
254
|
export {
|
|
189
255
|
createMDX as default
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +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-qbqv40V1.mjs';
|
|
6
7
|
|
|
7
8
|
declare const defaultSchemas: {
|
|
8
9
|
frontmatter: z.ZodObject<{
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "./chunk-P26LYDRL.mjs";
|
|
6
|
-
|
|
7
1
|
// src/resolve-files.ts
|
|
8
|
-
import path from "path";
|
|
2
|
+
import path from "node:path";
|
|
9
3
|
|
|
10
4
|
// src/utils/schema.ts
|
|
11
5
|
import { z } from "zod";
|
|
@@ -41,7 +35,6 @@ function resolveFiles({
|
|
|
41
35
|
rootDir = "",
|
|
42
36
|
schema = {}
|
|
43
37
|
}) {
|
|
44
|
-
var _a, _c;
|
|
45
38
|
const outputs = [];
|
|
46
39
|
for (const [file, value] of Object.entries(map)) {
|
|
47
40
|
if (!file.startsWith(rootDir))
|
|
@@ -51,23 +44,24 @@ function resolveFiles({
|
|
|
51
44
|
outputs.push({
|
|
52
45
|
type: "meta",
|
|
53
46
|
path: file,
|
|
54
|
-
data: parse(
|
|
47
|
+
data: parse(schema.meta ?? defaultSchemas.meta, value, file)
|
|
55
48
|
});
|
|
56
49
|
continue;
|
|
57
50
|
}
|
|
58
51
|
if (pageTypes.includes(parsed.ext)) {
|
|
59
|
-
const
|
|
52
|
+
const { frontmatter, ...data } = value;
|
|
60
53
|
const parsedFrontmatter = parse(
|
|
61
|
-
|
|
54
|
+
schema.frontmatter ?? defaultSchemas.frontmatter,
|
|
62
55
|
frontmatter,
|
|
63
56
|
file
|
|
64
57
|
);
|
|
65
58
|
outputs.push({
|
|
66
59
|
type: "page",
|
|
67
60
|
path: file,
|
|
68
|
-
data:
|
|
61
|
+
data: {
|
|
62
|
+
...parsedFrontmatter,
|
|
69
63
|
exports: data
|
|
70
|
-
}
|
|
64
|
+
}
|
|
71
65
|
});
|
|
72
66
|
continue;
|
|
73
67
|
}
|
|
@@ -79,13 +73,14 @@ function resolveFiles({
|
|
|
79
73
|
// src/create.ts
|
|
80
74
|
function createMDXSource(map, options) {
|
|
81
75
|
return {
|
|
82
|
-
files: (rootDir) => loadMDXSource(map,
|
|
76
|
+
files: (rootDir) => loadMDXSource(map, { ...options, rootDir })
|
|
83
77
|
};
|
|
84
78
|
}
|
|
85
79
|
function loadMDXSource(map, options) {
|
|
86
|
-
return resolveFiles(
|
|
87
|
-
map
|
|
88
|
-
|
|
80
|
+
return resolveFiles({
|
|
81
|
+
map,
|
|
82
|
+
...options
|
|
83
|
+
});
|
|
89
84
|
}
|
|
90
85
|
export {
|
|
91
86
|
createMDXSource,
|
package/dist/loader-mdx.d.mts
CHANGED
|
@@ -8,6 +8,15 @@ interface Options extends ProcessorOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
lastModifiedTime?: 'git' | 'none';
|
|
10
10
|
}
|
|
11
|
+
interface InternalBuildInfo {
|
|
12
|
+
__fumadocs?: {
|
|
13
|
+
path: string;
|
|
14
|
+
/**
|
|
15
|
+
* `vfile.data` parsed from file
|
|
16
|
+
*/
|
|
17
|
+
data: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* Load MDX/markdown files
|
|
13
22
|
*
|
|
@@ -15,4 +24,4 @@ interface Options extends ProcessorOptions {
|
|
|
15
24
|
*/
|
|
16
25
|
declare function loader(this: LoaderContext<Options>, source: string, callback: LoaderContext<Options>['callback']): Promise<void>;
|
|
17
26
|
|
|
18
|
-
export { type Options, loader as default };
|
|
27
|
+
export { type InternalBuildInfo, type Options, loader as default };
|
package/dist/loader-mdx.mjs
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async,
|
|
3
|
-
__objRest,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "./chunk-P26LYDRL.mjs";
|
|
7
|
-
|
|
8
1
|
// src/loader-mdx.ts
|
|
9
|
-
import path2 from "path";
|
|
2
|
+
import path2 from "node:path";
|
|
10
3
|
import { createProcessor } from "@mdx-js/mdx";
|
|
11
4
|
import grayMatter from "gray-matter";
|
|
12
5
|
|
|
13
6
|
// src/utils/git-timestamp.ts
|
|
14
|
-
import path from "path";
|
|
15
|
-
import fs from "fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import fs from "node:fs";
|
|
16
9
|
import { spawn } from "cross-spawn";
|
|
17
10
|
var cache = /* @__PURE__ */ new Map();
|
|
18
11
|
function getGitTimestamp(file) {
|
|
@@ -42,51 +35,48 @@ function getGitTimestamp(file) {
|
|
|
42
35
|
|
|
43
36
|
// src/loader-mdx.ts
|
|
44
37
|
var cache2 = /* @__PURE__ */ new Map();
|
|
45
|
-
function loader(source, callback) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
async function loader(source, callback) {
|
|
39
|
+
this.cacheable(true);
|
|
40
|
+
const context = this.context;
|
|
41
|
+
const filePath = this.resourcePath;
|
|
42
|
+
const { lastModifiedTime, ...options } = this.getOptions();
|
|
43
|
+
const { content, data: frontmatter } = grayMatter(source);
|
|
44
|
+
const detectedFormat = filePath.endsWith(".mdx") ? "mdx" : "md";
|
|
45
|
+
const format = options.format ?? detectedFormat;
|
|
46
|
+
let timestamp;
|
|
47
|
+
let processor = cache2.get(format);
|
|
48
|
+
if (processor === void 0) {
|
|
49
|
+
processor = createProcessor({
|
|
50
|
+
...options,
|
|
51
|
+
development: this.mode === "development",
|
|
52
|
+
format
|
|
53
|
+
});
|
|
54
|
+
cache2.set(format, processor);
|
|
55
|
+
}
|
|
56
|
+
if (lastModifiedTime === "git")
|
|
57
|
+
timestamp = (await getGitTimestamp(filePath))?.getTime();
|
|
58
|
+
processor.process({
|
|
59
|
+
value: content,
|
|
60
|
+
path: filePath,
|
|
61
|
+
data: {
|
|
62
|
+
lastModified: timestamp,
|
|
63
|
+
frontmatter
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
data: file.data
|
|
80
|
-
};
|
|
81
|
-
callback(void 0, String(file.value), file.map || void 0);
|
|
82
|
-
},
|
|
83
|
-
(error) => {
|
|
84
|
-
const fpath = path2.relative(context, filePath);
|
|
85
|
-
error.message = `${fpath}:${error.name}: ${error.message}`;
|
|
86
|
-
callback(error);
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
});
|
|
65
|
+
}).then(
|
|
66
|
+
(file) => {
|
|
67
|
+
const info = this._module?.buildInfo;
|
|
68
|
+
info.__fumadocs = {
|
|
69
|
+
path: filePath,
|
|
70
|
+
data: file.data
|
|
71
|
+
};
|
|
72
|
+
callback(void 0, String(file.value), file.map ?? void 0);
|
|
73
|
+
},
|
|
74
|
+
(error) => {
|
|
75
|
+
const fpath = path2.relative(context, filePath);
|
|
76
|
+
error.message = `${fpath}:${error.name}: ${error.message}`;
|
|
77
|
+
callback(error);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
90
80
|
}
|
|
91
81
|
export {
|
|
92
82
|
loader as default
|
package/dist/loader.d.mts
CHANGED
package/dist/loader.mjs
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import "./chunk-P26LYDRL.mjs";
|
|
2
|
-
|
|
3
1
|
// src/loader.ts
|
|
4
|
-
import path from "path";
|
|
2
|
+
import path from "node:path";
|
|
5
3
|
import fg from "fast-glob";
|
|
6
4
|
function loader(_source, callback) {
|
|
7
5
|
const options = this.getOptions();
|
|
8
6
|
this.cacheable(true);
|
|
9
|
-
this.addContextDependency(
|
|
7
|
+
this.addContextDependency(options.rootContentDir);
|
|
10
8
|
callback(null, buildMap(options));
|
|
11
9
|
}
|
|
12
|
-
function buildMap({
|
|
13
|
-
const mapDir = path.dirname(
|
|
14
|
-
const absoluteContentPath = path.resolve(cwd, rootContentPath);
|
|
10
|
+
function buildMap({ rootContentDir, rootMapFile }) {
|
|
11
|
+
const mapDir = path.dirname(rootMapFile);
|
|
15
12
|
const files = fg.sync("./**/*.{md,mdx,json}", {
|
|
16
|
-
cwd:
|
|
13
|
+
cwd: rootContentDir
|
|
17
14
|
});
|
|
18
15
|
const imports = [];
|
|
19
16
|
const entries = [];
|
|
20
17
|
files.forEach((file, i) => {
|
|
21
|
-
let importPath = path.relative(mapDir, path.join(
|
|
18
|
+
let importPath = path.relative(mapDir, path.join(rootContentDir, file)).replaceAll(path.sep, "/");
|
|
22
19
|
if (!importPath.startsWith(".")) {
|
|
23
20
|
importPath = `./${importPath}`;
|
|
24
21
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
|
+
|
|
3
|
+
interface SearchIndex {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
url: string;
|
|
8
|
+
structuredData: StructuredData;
|
|
9
|
+
}
|
|
10
|
+
interface Options {
|
|
11
|
+
/**
|
|
12
|
+
* Only enable at production builds, default: `true`
|
|
13
|
+
*/
|
|
14
|
+
productionOnly?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Absolute path of root content directory
|
|
17
|
+
*/
|
|
18
|
+
rootContentDir: string;
|
|
19
|
+
rootMapFile: string;
|
|
20
|
+
/**
|
|
21
|
+
* @param path - MDX file path relative to root content dir
|
|
22
|
+
* @returns page URL
|
|
23
|
+
*/
|
|
24
|
+
getUrl?: (path: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Filter MDX files with specific path
|
|
27
|
+
*
|
|
28
|
+
* @param path - MDX file path relative to root content dir
|
|
29
|
+
* @returns whether should include this item in search indexes
|
|
30
|
+
*/
|
|
31
|
+
filter?: (path: string) => boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type { Options as O, SearchIndex as S };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -37,27 +37,27 @@
|
|
|
37
37
|
"loader.js"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mdx-js/mdx": "^3.0.
|
|
40
|
+
"@mdx-js/mdx": "^3.0.1",
|
|
41
41
|
"cross-spawn": "^7.0.3",
|
|
42
42
|
"estree-util-value-to-estree": "^3.0.1",
|
|
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.
|
|
46
|
+
"fumadocs-core": "10.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/cross-spawn": "^6.0.
|
|
49
|
+
"@types/cross-spawn": "^6.0.6",
|
|
50
50
|
"@types/mdast": "^4.0.3",
|
|
51
|
-
"@types/mdx": "^2.0.
|
|
52
|
-
"@types/react": "18.2.0",
|
|
53
|
-
"next": "14.1.
|
|
51
|
+
"@types/mdx": "^2.0.11",
|
|
52
|
+
"@types/react": "^18.2.0",
|
|
53
|
+
"next": "^14.1.2",
|
|
54
54
|
"unified": "^11.0.4",
|
|
55
|
-
"webpack": "^5.
|
|
55
|
+
"webpack": "^5.90.3",
|
|
56
56
|
"eslint-config-custom": "0.0.0",
|
|
57
57
|
"tsconfig": "0.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"next": ">=
|
|
60
|
+
"next": ">= 14.1.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
package/dist/chunk-P26LYDRL.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
__spreadValues,
|
|
55
|
-
__spreadProps,
|
|
56
|
-
__objRest,
|
|
57
|
-
__async
|
|
58
|
-
};
|