fumadocs-mdx 11.6.6 → 11.6.7
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/bin.js +1 -1
- package/dist/{chunk-3UUEUK4M.js → chunk-2Z6EJ3GA.js} +4 -1
- package/dist/{chunk-GWITJLOZ.js → chunk-SXOJYWZ3.js} +3 -3
- package/dist/config/index.cjs +4 -1
- package/dist/config/index.js +1 -1
- package/dist/loader-mdx.cjs +9 -6
- package/dist/loader-mdx.d.cts +1 -0
- package/dist/loader-mdx.d.ts +1 -0
- package/dist/loader-mdx.js +4 -4
- package/dist/next/index.cjs +30 -32
- package/dist/next/index.d.cts +8 -2
- package/dist/next/index.d.ts +8 -2
- package/dist/next/index.js +26 -28
- package/dist/runtime/async.cjs +4 -1
- package/dist/runtime/async.js +1 -1
- package/package.json +7 -7
package/bin.js
CHANGED
|
@@ -57,7 +57,10 @@ function remarkInclude() {
|
|
|
57
57
|
parsed
|
|
58
58
|
);
|
|
59
59
|
}).catch((e) => {
|
|
60
|
-
|
|
60
|
+
throw new Error(
|
|
61
|
+
`failed to read file ${targetPath}
|
|
62
|
+
${e instanceof Error ? e.message : String(e)}`
|
|
63
|
+
);
|
|
61
64
|
})
|
|
62
65
|
);
|
|
63
66
|
return "skip";
|
|
@@ -30,12 +30,12 @@ async function compileConfig(configPath, outDir) {
|
|
|
30
30
|
throw new Error("failed to compile configuration file");
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
async function loadConfig(configPath, hash, build = false) {
|
|
33
|
+
async function loadConfig(configPath, outDir, hash, build = false) {
|
|
34
34
|
if (cache && cache.hash === hash) {
|
|
35
35
|
return await cache.config;
|
|
36
36
|
}
|
|
37
|
-
if (build) await compileConfig(configPath,
|
|
38
|
-
const url = pathToFileURL(path.resolve("
|
|
37
|
+
if (build) await compileConfig(configPath, outDir);
|
|
38
|
+
const url = pathToFileURL(path.resolve(outDir, "source.config.mjs"));
|
|
39
39
|
const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
|
|
40
40
|
const [err, config2] = buildConfig(
|
|
41
41
|
// every call to `loadConfig` will cause the previous cache to be ignored
|
package/dist/config/index.cjs
CHANGED
|
@@ -268,7 +268,10 @@ function remarkInclude() {
|
|
|
268
268
|
parsed
|
|
269
269
|
);
|
|
270
270
|
}).catch((e) => {
|
|
271
|
-
|
|
271
|
+
throw new Error(
|
|
272
|
+
`failed to read file ${targetPath}
|
|
273
|
+
${e instanceof Error ? e.message : String(e)}`
|
|
274
|
+
);
|
|
272
275
|
})
|
|
273
276
|
);
|
|
274
277
|
return "skip";
|
package/dist/config/index.js
CHANGED
package/dist/loader-mdx.cjs
CHANGED
|
@@ -230,12 +230,12 @@ async function compileConfig(configPath, outDir) {
|
|
|
230
230
|
throw new Error("failed to compile configuration file");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
async function loadConfig(configPath, hash, build = false) {
|
|
233
|
+
async function loadConfig(configPath, outDir, hash, build = false) {
|
|
234
234
|
if (cache && cache.hash === hash) {
|
|
235
235
|
return await cache.config;
|
|
236
236
|
}
|
|
237
|
-
if (build) await compileConfig(configPath,
|
|
238
|
-
const url = (0, import_node_url.pathToFileURL)(path.resolve("
|
|
237
|
+
if (build) await compileConfig(configPath, outDir);
|
|
238
|
+
const url = (0, import_node_url.pathToFileURL)(path.resolve(outDir, "source.config.mjs"));
|
|
239
239
|
const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
|
|
240
240
|
const [err, config2] = buildConfig(
|
|
241
241
|
// every call to `loadConfig` will cause the previous cache to be ignored
|
|
@@ -317,7 +317,10 @@ function remarkInclude() {
|
|
|
317
317
|
parsed
|
|
318
318
|
);
|
|
319
319
|
}).catch((e) => {
|
|
320
|
-
|
|
320
|
+
throw new Error(
|
|
321
|
+
`failed to read file ${targetPath}
|
|
322
|
+
${e instanceof Error ? e.message : String(e)}`
|
|
323
|
+
);
|
|
321
324
|
})
|
|
322
325
|
);
|
|
323
326
|
return "skip";
|
|
@@ -445,13 +448,13 @@ async function loader(source, callback) {
|
|
|
445
448
|
this.cacheable(true);
|
|
446
449
|
const context = this.context;
|
|
447
450
|
const filePath = this.resourcePath;
|
|
448
|
-
const { configPath } = this.getOptions();
|
|
451
|
+
const { configPath, outDir } = this.getOptions();
|
|
449
452
|
const matter2 = (0, import_gray_matter2.default)(source);
|
|
450
453
|
const {
|
|
451
454
|
hash: configHash = await getConfigHash(configPath),
|
|
452
455
|
collection: collectionId
|
|
453
456
|
} = (0, import_node_querystring.parse)(this.resourceQuery.slice(1));
|
|
454
|
-
const config = await loadConfig(configPath, configHash);
|
|
457
|
+
const config = await loadConfig(configPath, outDir, configHash);
|
|
455
458
|
let collection = collectionId !== void 0 ? config.collections.get(collectionId) : void 0;
|
|
456
459
|
if (collection && collection.type === "docs") collection = collection.docs;
|
|
457
460
|
if (collection && collection.type !== "doc") {
|
package/dist/loader-mdx.d.cts
CHANGED
package/dist/loader-mdx.d.ts
CHANGED
package/dist/loader-mdx.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
getConfigHash,
|
|
3
3
|
getGitTimestamp,
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SXOJYWZ3.js";
|
|
6
6
|
import {
|
|
7
7
|
ValidationError,
|
|
8
8
|
validate
|
|
9
9
|
} from "./chunk-OTM6WYMS.js";
|
|
10
10
|
import {
|
|
11
11
|
remarkInclude
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2Z6EJ3GA.js";
|
|
13
13
|
import "./chunk-DRVUBK5B.js";
|
|
14
14
|
|
|
15
15
|
// src/loader-mdx.ts
|
|
@@ -55,13 +55,13 @@ async function loader(source, callback) {
|
|
|
55
55
|
this.cacheable(true);
|
|
56
56
|
const context = this.context;
|
|
57
57
|
const filePath = this.resourcePath;
|
|
58
|
-
const { configPath } = this.getOptions();
|
|
58
|
+
const { configPath, outDir } = this.getOptions();
|
|
59
59
|
const matter = grayMatter(source);
|
|
60
60
|
const {
|
|
61
61
|
hash: configHash = await getConfigHash(configPath),
|
|
62
62
|
collection: collectionId
|
|
63
63
|
} = parse(this.resourceQuery.slice(1));
|
|
64
|
-
const config = await loadConfig(configPath, configHash);
|
|
64
|
+
const config = await loadConfig(configPath, outDir, configHash);
|
|
65
65
|
let collection = collectionId !== void 0 ? config.collections.get(collectionId) : void 0;
|
|
66
66
|
if (collection && collection.type === "docs") collection = collection.docs;
|
|
67
67
|
if (collection && collection.type !== "doc") {
|
package/dist/next/index.cjs
CHANGED
|
@@ -69,9 +69,6 @@ __export(next_exports, {
|
|
|
69
69
|
});
|
|
70
70
|
module.exports = __toCommonJS(next_exports);
|
|
71
71
|
|
|
72
|
-
// src/next/create.ts
|
|
73
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
74
|
-
|
|
75
72
|
// src/utils/config.ts
|
|
76
73
|
var fs = __toESM(require("fs/promises"), 1);
|
|
77
74
|
var path = __toESM(require("path"), 1);
|
|
@@ -118,12 +115,12 @@ function findConfigFile() {
|
|
|
118
115
|
return path.resolve("source.config.ts");
|
|
119
116
|
}
|
|
120
117
|
var cache = null;
|
|
121
|
-
async function compileConfig(configPath,
|
|
118
|
+
async function compileConfig(configPath, outDir) {
|
|
122
119
|
const { build } = await import("esbuild");
|
|
123
120
|
const transformed = await build({
|
|
124
121
|
entryPoints: [{ in: configPath, out: "source.config" }],
|
|
125
122
|
bundle: true,
|
|
126
|
-
outdir:
|
|
123
|
+
outdir: outDir,
|
|
127
124
|
target: "node18",
|
|
128
125
|
write: true,
|
|
129
126
|
platform: "node",
|
|
@@ -138,12 +135,12 @@ async function compileConfig(configPath, outDir2) {
|
|
|
138
135
|
throw new Error("failed to compile configuration file");
|
|
139
136
|
}
|
|
140
137
|
}
|
|
141
|
-
async function loadConfig(configPath, hash, build = false) {
|
|
138
|
+
async function loadConfig(configPath, outDir, hash, build = false) {
|
|
142
139
|
if (cache && cache.hash === hash) {
|
|
143
140
|
return await cache.config;
|
|
144
141
|
}
|
|
145
|
-
if (build) await compileConfig(configPath,
|
|
146
|
-
const url = (0, import_node_url.pathToFileURL)(path.resolve("
|
|
142
|
+
if (build) await compileConfig(configPath, outDir);
|
|
143
|
+
const url = (0, import_node_url.pathToFileURL)(path.resolve(outDir, "source.config.mjs"));
|
|
147
144
|
const config = import(`${url.href}?hash=${hash}`).then((loaded) => {
|
|
148
145
|
const [err, config2] = buildConfig(
|
|
149
146
|
// every call to `loadConfig` will cause the previous cache to be ignored
|
|
@@ -176,8 +173,8 @@ var import_tinyglobby = require("tinyglobby");
|
|
|
176
173
|
var import_node_path = require("path");
|
|
177
174
|
var docTypes = [".mdx", ".md"];
|
|
178
175
|
var metaTypes = [".json", ".yaml"];
|
|
179
|
-
function getTypeFromPath(
|
|
180
|
-
const ext = (0, import_node_path.extname)(
|
|
176
|
+
function getTypeFromPath(path6) {
|
|
177
|
+
const ext = (0, import_node_path.extname)(path6);
|
|
181
178
|
if (docTypes.includes(ext)) return "doc";
|
|
182
179
|
if (metaTypes.includes(ext)) return "meta";
|
|
183
180
|
}
|
|
@@ -243,16 +240,16 @@ var map = new import_lru_cache.LRUCache({
|
|
|
243
240
|
max: 200
|
|
244
241
|
});
|
|
245
242
|
var fileCache = {
|
|
246
|
-
read(namespace,
|
|
247
|
-
return map.get(`${namespace}.${
|
|
243
|
+
read(namespace, path6) {
|
|
244
|
+
return map.get(`${namespace}.${path6}`);
|
|
248
245
|
},
|
|
249
|
-
write(namespace,
|
|
250
|
-
map.set(`${namespace}.${
|
|
246
|
+
write(namespace, path6, data) {
|
|
247
|
+
map.set(`${namespace}.${path6}`, data);
|
|
251
248
|
},
|
|
252
|
-
removeCache(
|
|
249
|
+
removeCache(path6) {
|
|
253
250
|
for (const key of map.keys()) {
|
|
254
251
|
const keyPath = key.slice(key.indexOf(".") + 1);
|
|
255
|
-
if (keyPath ===
|
|
252
|
+
if (keyPath === path6) map.delete(key);
|
|
256
253
|
}
|
|
257
254
|
}
|
|
258
255
|
};
|
|
@@ -291,7 +288,7 @@ async function readFileWithCache(file) {
|
|
|
291
288
|
return (await fs2.readFile(file)).toString();
|
|
292
289
|
}
|
|
293
290
|
async function generateJS(configPath, config, outputPath, configHash) {
|
|
294
|
-
const
|
|
291
|
+
const outDir = path3.dirname(outputPath);
|
|
295
292
|
let asyncInit = false;
|
|
296
293
|
const lines = [
|
|
297
294
|
getImportCode({
|
|
@@ -301,7 +298,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
301
298
|
}),
|
|
302
299
|
getImportCode({
|
|
303
300
|
type: "namespace",
|
|
304
|
-
specifier: toImportPath(configPath,
|
|
301
|
+
specifier: toImportPath(configPath, outDir),
|
|
305
302
|
name: "_source"
|
|
306
303
|
})
|
|
307
304
|
];
|
|
@@ -313,7 +310,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
313
310
|
getImportCode({
|
|
314
311
|
type: "namespace",
|
|
315
312
|
name: importId,
|
|
316
|
-
specifier: `${toImportPath(file.absolutePath,
|
|
313
|
+
specifier: `${toImportPath(file.absolutePath, outDir)}?collection=${collectionName}&hash=${configHash}`
|
|
317
314
|
})
|
|
318
315
|
);
|
|
319
316
|
return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
|
|
@@ -467,10 +464,10 @@ function parseMetaEntry(file, content) {
|
|
|
467
464
|
}
|
|
468
465
|
|
|
469
466
|
// src/map/index.ts
|
|
470
|
-
async function start(dev, configPath,
|
|
467
|
+
async function start(dev, configPath, outDir) {
|
|
471
468
|
let configHash = await getConfigHash(configPath);
|
|
472
|
-
let config = await loadConfig(configPath, configHash, true);
|
|
473
|
-
const outPath = path4.resolve(
|
|
469
|
+
let config = await loadConfig(configPath, outDir, configHash, true);
|
|
470
|
+
const outPath = path4.resolve(outDir, `index.ts`);
|
|
474
471
|
async function updateMapFile() {
|
|
475
472
|
const start2 = performance.now();
|
|
476
473
|
try {
|
|
@@ -501,7 +498,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
501
498
|
const isConfigFile = absolutePath === configPath;
|
|
502
499
|
if (isConfigFile) {
|
|
503
500
|
configHash = await getConfigHash(configPath);
|
|
504
|
-
config = await loadConfig(configPath, configHash, true);
|
|
501
|
+
config = await loadConfig(configPath, outDir, configHash, true);
|
|
505
502
|
}
|
|
506
503
|
if (event === "change") fileCache.removeCache(absolutePath);
|
|
507
504
|
await updateMapFile();
|
|
@@ -516,10 +513,10 @@ async function start(dev, configPath, outDir2) {
|
|
|
516
513
|
}
|
|
517
514
|
|
|
518
515
|
// src/next/create.ts
|
|
519
|
-
var outDir = import_node_path3.default.resolve(".source");
|
|
520
516
|
var defaultPageExtensions = ["mdx", "md", "jsx", "js", "tsx", "ts"];
|
|
521
517
|
function createMDX({
|
|
522
|
-
configPath = findConfigFile()
|
|
518
|
+
configPath = findConfigFile(),
|
|
519
|
+
outDir = ".source"
|
|
523
520
|
} = {}) {
|
|
524
521
|
const isDev = process.argv.includes("dev");
|
|
525
522
|
const isBuild = process.argv.includes("build");
|
|
@@ -529,7 +526,8 @@ function createMDX({
|
|
|
529
526
|
}
|
|
530
527
|
return (nextConfig = {}) => {
|
|
531
528
|
const mdxLoaderOptions = {
|
|
532
|
-
configPath
|
|
529
|
+
configPath,
|
|
530
|
+
outDir
|
|
533
531
|
};
|
|
534
532
|
return {
|
|
535
533
|
...nextConfig,
|
|
@@ -572,14 +570,14 @@ function createMDX({
|
|
|
572
570
|
}
|
|
573
571
|
|
|
574
572
|
// src/postinstall.ts
|
|
575
|
-
var
|
|
573
|
+
var path5 = __toESM(require("path"), 1);
|
|
576
574
|
var fs4 = __toESM(require("fs/promises"), 1);
|
|
577
|
-
async function postInstall(configPath = findConfigFile()) {
|
|
578
|
-
const jsOut =
|
|
575
|
+
async function postInstall(configPath = findConfigFile(), outDir = ".source") {
|
|
576
|
+
const jsOut = path5.resolve(outDir, "index.ts");
|
|
579
577
|
const hash = await getConfigHash(configPath);
|
|
580
|
-
const config = await loadConfig(configPath, hash, true);
|
|
581
|
-
await fs4.rm(
|
|
582
|
-
await fs4.mkdir(
|
|
578
|
+
const config = await loadConfig(configPath, outDir, hash, true);
|
|
579
|
+
await fs4.rm(path5.dirname(jsOut), { recursive: true });
|
|
580
|
+
await fs4.mkdir(path5.dirname(jsOut), { recursive: true });
|
|
583
581
|
await fs4.writeFile(jsOut, await generateJS(configPath, config, jsOut, hash));
|
|
584
582
|
console.log("[MDX] types generated");
|
|
585
583
|
}
|
package/dist/next/index.d.cts
CHANGED
|
@@ -12,10 +12,16 @@ interface CreateMDXOptions {
|
|
|
12
12
|
* Path to source configuration file
|
|
13
13
|
*/
|
|
14
14
|
configPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Directory for output files
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue '.source'
|
|
19
|
+
*/
|
|
20
|
+
outDir?: string;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
declare function createMDX({ configPath, }?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
23
|
+
declare function createMDX({ configPath, outDir, }?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
18
24
|
|
|
19
|
-
declare function postInstall(configPath?: string): Promise<void>;
|
|
25
|
+
declare function postInstall(configPath?: string, outDir?: string): Promise<void>;
|
|
20
26
|
|
|
21
27
|
export { type CreateMDXOptions, createMDX, postInstall, start };
|
package/dist/next/index.d.ts
CHANGED
|
@@ -12,10 +12,16 @@ interface CreateMDXOptions {
|
|
|
12
12
|
* Path to source configuration file
|
|
13
13
|
*/
|
|
14
14
|
configPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Directory for output files
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue '.source'
|
|
19
|
+
*/
|
|
20
|
+
outDir?: string;
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
declare function createMDX({ configPath, }?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
23
|
+
declare function createMDX({ configPath, outDir, }?: CreateMDXOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
18
24
|
|
|
19
|
-
declare function postInstall(configPath?: string): Promise<void>;
|
|
25
|
+
declare function postInstall(configPath?: string, outDir?: string): Promise<void>;
|
|
20
26
|
|
|
21
27
|
export { type CreateMDXOptions, createMDX, postInstall, start };
|
package/dist/next/index.js
CHANGED
|
@@ -3,16 +3,13 @@ import {
|
|
|
3
3
|
getConfigHash,
|
|
4
4
|
getGitTimestamp,
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-SXOJYWZ3.js";
|
|
7
7
|
import {
|
|
8
8
|
ValidationError,
|
|
9
9
|
validate
|
|
10
10
|
} from "../chunk-OTM6WYMS.js";
|
|
11
11
|
import "../chunk-DRVUBK5B.js";
|
|
12
12
|
|
|
13
|
-
// src/next/create.ts
|
|
14
|
-
import path3 from "path";
|
|
15
|
-
|
|
16
13
|
// src/map/index.ts
|
|
17
14
|
import * as path2 from "path";
|
|
18
15
|
import * as fs2 from "fs/promises";
|
|
@@ -26,8 +23,8 @@ import { glob } from "tinyglobby";
|
|
|
26
23
|
import { extname } from "path";
|
|
27
24
|
var docTypes = [".mdx", ".md"];
|
|
28
25
|
var metaTypes = [".json", ".yaml"];
|
|
29
|
-
function getTypeFromPath(
|
|
30
|
-
const ext = extname(
|
|
26
|
+
function getTypeFromPath(path4) {
|
|
27
|
+
const ext = extname(path4);
|
|
31
28
|
if (docTypes.includes(ext)) return "doc";
|
|
32
29
|
if (metaTypes.includes(ext)) return "meta";
|
|
33
30
|
}
|
|
@@ -38,16 +35,16 @@ var map = new LRUCache({
|
|
|
38
35
|
max: 200
|
|
39
36
|
});
|
|
40
37
|
var fileCache = {
|
|
41
|
-
read(namespace,
|
|
42
|
-
return map.get(`${namespace}.${
|
|
38
|
+
read(namespace, path4) {
|
|
39
|
+
return map.get(`${namespace}.${path4}`);
|
|
43
40
|
},
|
|
44
|
-
write(namespace,
|
|
45
|
-
map.set(`${namespace}.${
|
|
41
|
+
write(namespace, path4, data) {
|
|
42
|
+
map.set(`${namespace}.${path4}`, data);
|
|
46
43
|
},
|
|
47
|
-
removeCache(
|
|
44
|
+
removeCache(path4) {
|
|
48
45
|
for (const key of map.keys()) {
|
|
49
46
|
const keyPath = key.slice(key.indexOf(".") + 1);
|
|
50
|
-
if (keyPath ===
|
|
47
|
+
if (keyPath === path4) map.delete(key);
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
};
|
|
@@ -61,7 +58,7 @@ async function readFileWithCache(file) {
|
|
|
61
58
|
return (await fs.readFile(file)).toString();
|
|
62
59
|
}
|
|
63
60
|
async function generateJS(configPath, config, outputPath, configHash) {
|
|
64
|
-
const
|
|
61
|
+
const outDir = path.dirname(outputPath);
|
|
65
62
|
let asyncInit = false;
|
|
66
63
|
const lines = [
|
|
67
64
|
getImportCode({
|
|
@@ -71,7 +68,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
71
68
|
}),
|
|
72
69
|
getImportCode({
|
|
73
70
|
type: "namespace",
|
|
74
|
-
specifier: toImportPath(configPath,
|
|
71
|
+
specifier: toImportPath(configPath, outDir),
|
|
75
72
|
name: "_source"
|
|
76
73
|
})
|
|
77
74
|
];
|
|
@@ -83,7 +80,7 @@ async function generateJS(configPath, config, outputPath, configHash) {
|
|
|
83
80
|
getImportCode({
|
|
84
81
|
type: "namespace",
|
|
85
82
|
name: importId,
|
|
86
|
-
specifier: `${toImportPath(file.absolutePath,
|
|
83
|
+
specifier: `${toImportPath(file.absolutePath, outDir)}?collection=${collectionName}&hash=${configHash}`
|
|
87
84
|
})
|
|
88
85
|
);
|
|
89
86
|
return `{ info: ${JSON.stringify(file)}, data: ${importId} }`;
|
|
@@ -237,10 +234,10 @@ function parseMetaEntry(file, content) {
|
|
|
237
234
|
}
|
|
238
235
|
|
|
239
236
|
// src/map/index.ts
|
|
240
|
-
async function start(dev, configPath,
|
|
237
|
+
async function start(dev, configPath, outDir) {
|
|
241
238
|
let configHash = await getConfigHash(configPath);
|
|
242
|
-
let config = await loadConfig(configPath, configHash, true);
|
|
243
|
-
const outPath = path2.resolve(
|
|
239
|
+
let config = await loadConfig(configPath, outDir, configHash, true);
|
|
240
|
+
const outPath = path2.resolve(outDir, `index.ts`);
|
|
244
241
|
async function updateMapFile() {
|
|
245
242
|
const start2 = performance.now();
|
|
246
243
|
try {
|
|
@@ -271,7 +268,7 @@ async function start(dev, configPath, outDir2) {
|
|
|
271
268
|
const isConfigFile = absolutePath === configPath;
|
|
272
269
|
if (isConfigFile) {
|
|
273
270
|
configHash = await getConfigHash(configPath);
|
|
274
|
-
config = await loadConfig(configPath, configHash, true);
|
|
271
|
+
config = await loadConfig(configPath, outDir, configHash, true);
|
|
275
272
|
}
|
|
276
273
|
if (event === "change") fileCache.removeCache(absolutePath);
|
|
277
274
|
await updateMapFile();
|
|
@@ -286,10 +283,10 @@ async function start(dev, configPath, outDir2) {
|
|
|
286
283
|
}
|
|
287
284
|
|
|
288
285
|
// src/next/create.ts
|
|
289
|
-
var outDir = path3.resolve(".source");
|
|
290
286
|
var defaultPageExtensions = ["mdx", "md", "jsx", "js", "tsx", "ts"];
|
|
291
287
|
function createMDX({
|
|
292
|
-
configPath = findConfigFile()
|
|
288
|
+
configPath = findConfigFile(),
|
|
289
|
+
outDir = ".source"
|
|
293
290
|
} = {}) {
|
|
294
291
|
const isDev = process.argv.includes("dev");
|
|
295
292
|
const isBuild = process.argv.includes("build");
|
|
@@ -299,7 +296,8 @@ function createMDX({
|
|
|
299
296
|
}
|
|
300
297
|
return (nextConfig = {}) => {
|
|
301
298
|
const mdxLoaderOptions = {
|
|
302
|
-
configPath
|
|
299
|
+
configPath,
|
|
300
|
+
outDir
|
|
303
301
|
};
|
|
304
302
|
return {
|
|
305
303
|
...nextConfig,
|
|
@@ -342,14 +340,14 @@ function createMDX({
|
|
|
342
340
|
}
|
|
343
341
|
|
|
344
342
|
// src/postinstall.ts
|
|
345
|
-
import * as
|
|
343
|
+
import * as path3 from "path";
|
|
346
344
|
import * as fs3 from "fs/promises";
|
|
347
|
-
async function postInstall(configPath = findConfigFile()) {
|
|
348
|
-
const jsOut =
|
|
345
|
+
async function postInstall(configPath = findConfigFile(), outDir = ".source") {
|
|
346
|
+
const jsOut = path3.resolve(outDir, "index.ts");
|
|
349
347
|
const hash = await getConfigHash(configPath);
|
|
350
|
-
const config = await loadConfig(configPath, hash, true);
|
|
351
|
-
await fs3.rm(
|
|
352
|
-
await fs3.mkdir(
|
|
348
|
+
const config = await loadConfig(configPath, outDir, hash, true);
|
|
349
|
+
await fs3.rm(path3.dirname(jsOut), { recursive: true });
|
|
350
|
+
await fs3.mkdir(path3.dirname(jsOut), { recursive: true });
|
|
353
351
|
await fs3.writeFile(jsOut, await generateJS(configPath, config, jsOut, hash));
|
|
354
352
|
console.log("[MDX] types generated");
|
|
355
353
|
}
|
package/dist/runtime/async.cjs
CHANGED
|
@@ -95,7 +95,10 @@ function remarkInclude() {
|
|
|
95
95
|
parsed
|
|
96
96
|
);
|
|
97
97
|
}).catch((e) => {
|
|
98
|
-
|
|
98
|
+
throw new Error(
|
|
99
|
+
`failed to read file ${targetPath}
|
|
100
|
+
${e instanceof Error ? e.message : String(e)}`
|
|
101
|
+
);
|
|
99
102
|
})
|
|
100
103
|
);
|
|
101
104
|
return "skip";
|
package/dist/runtime/async.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.7",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -45,30 +45,30 @@
|
|
|
45
45
|
"@mdx-js/mdx": "^3.1.0",
|
|
46
46
|
"@standard-schema/spec": "^1.0.0",
|
|
47
47
|
"chokidar": "^4.0.3",
|
|
48
|
-
"esbuild": "^0.25.
|
|
48
|
+
"esbuild": "^0.25.5",
|
|
49
49
|
"estree-util-value-to-estree": "^3.4.0",
|
|
50
50
|
"gray-matter": "^4.0.3",
|
|
51
51
|
"js-yaml": "^4.1.0",
|
|
52
52
|
"lru-cache": "^11.1.0",
|
|
53
53
|
"picocolors": "^1.1.1",
|
|
54
54
|
"tinyexec": "^1.0.1",
|
|
55
|
-
"tinyglobby": "^0.2.
|
|
55
|
+
"tinyglobby": "^0.2.14",
|
|
56
56
|
"unist-util-visit": "^5.0.0",
|
|
57
|
-
"zod": "^3.25.
|
|
57
|
+
"zod": "^3.25.42"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/js-yaml": "^4.0.9",
|
|
61
61
|
"@types/mdast": "^4.0.3",
|
|
62
62
|
"@types/mdx": "^2.0.13",
|
|
63
|
-
"@types/react": "^19.1.
|
|
63
|
+
"@types/react": "^19.1.6",
|
|
64
64
|
"mdast-util-mdx-jsx": "^3.2.0",
|
|
65
|
-
"next": "^15.3.
|
|
65
|
+
"next": "^15.3.3",
|
|
66
66
|
"unified": "^11.0.5",
|
|
67
67
|
"vfile": "^6.0.3",
|
|
68
68
|
"webpack": "^5.99.9",
|
|
69
69
|
"@fumadocs/mdx-remote": "1.3.2",
|
|
70
70
|
"eslint-config-custom": "0.0.0",
|
|
71
|
-
"fumadocs-core": "15.
|
|
71
|
+
"fumadocs-core": "15.5.1",
|
|
72
72
|
"tsconfig": "0.0.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|