fumadocs-mdx 11.7.4 → 11.8.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/{chunk-OWZSTKKX.js → chunk-6Y5JDZHD.js} +8 -1
- package/dist/chunk-7JFPDRW7.js +42 -0
- package/dist/chunk-GBMFGEC7.js +57 -0
- package/dist/{chunk-ZOWJF3OH.js → chunk-GX3THK2Q.js} +25 -20
- package/dist/{chunk-2CSSQTP6.js → chunk-GYWPPGFD.js} +9 -1
- package/dist/{chunk-PQCNPAD3.js → chunk-IGXZS2W6.js} +10 -7
- package/dist/chunk-UCY7OBZG.js +12 -0
- package/dist/{chunk-KVWX6THC.js → chunk-VWJKRQZR.js} +2 -2
- package/dist/{chunk-JFNBRKRV.js → chunk-XVL4ZQFK.js} +12 -6
- package/dist/{chunk-4CGSOZUZ.js → chunk-XZR5QXVY.js} +32 -2
- package/dist/config/index.cjs +21 -11
- package/dist/config/index.d.cts +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +9 -37
- package/dist/config/zod-3.cjs +371 -0
- package/dist/config/zod-3.d.cts +53 -0
- package/dist/config/zod-3.d.ts +53 -0
- package/dist/config/zod-3.js +40 -0
- package/dist/{define-E6TRBwBQ.d.cts → define-DnJzAZrj.d.cts} +3 -2
- package/dist/{define-E6TRBwBQ.d.ts → define-DnJzAZrj.d.ts} +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/loader-mdx.cjs +83 -50
- package/dist/loader-mdx.js +10 -10
- package/dist/{mdx-options-UDV5WEFU.js → mdx-options-3NB74EMB.js} +1 -1
- package/dist/next/index.cjs +63 -29
- package/dist/next/index.js +7 -9
- package/dist/runtime/async.cjs +167 -128
- package/dist/runtime/async.d.cts +3 -3
- package/dist/runtime/async.d.ts +3 -3
- package/dist/runtime/async.js +30 -46
- package/dist/runtime/vite.cjs +49 -41
- package/dist/runtime/vite.d.cts +26 -18
- package/dist/runtime/vite.d.ts +26 -18
- package/dist/runtime/vite.js +49 -41
- package/dist/{types-Lh_-Uuix.d.cts → types-B2ozVm_9.d.ts} +11 -5
- package/dist/{types-DiL328cG.d.ts → types-BukvTPdG.d.cts} +11 -5
- package/dist/vite/index.cjs +125 -99
- package/dist/vite/index.d.cts +6 -1
- package/dist/vite/index.d.ts +6 -1
- package/dist/vite/index.js +54 -38
- package/package.json +17 -12
- package/dist/chunk-2K55VKP6.js +0 -49
- package/dist/chunk-VUEZTR2H.js +0 -26
package/dist/loader-mdx.cjs
CHANGED
|
@@ -102,6 +102,7 @@ function getDefaultMDXOptions({
|
|
|
102
102
|
remarkStructureOptions,
|
|
103
103
|
remarkCodeTabOptions,
|
|
104
104
|
remarkNpmOptions,
|
|
105
|
+
_withoutBundler = false,
|
|
105
106
|
...mdxOptions
|
|
106
107
|
}) {
|
|
107
108
|
const mdxExports = [
|
|
@@ -120,7 +121,13 @@ function getDefaultMDXOptions({
|
|
|
120
121
|
...remarkHeadingOptions
|
|
121
122
|
}
|
|
122
123
|
],
|
|
123
|
-
remarkImageOptions !== false && [
|
|
124
|
+
remarkImageOptions !== false && [
|
|
125
|
+
plugins.remarkImage,
|
|
126
|
+
{
|
|
127
|
+
...remarkImageOptions,
|
|
128
|
+
useImport: _withoutBundler ? false : remarkImageOptions?.useImport
|
|
129
|
+
}
|
|
130
|
+
],
|
|
124
131
|
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
|
|
125
132
|
plugins.remarkCodeTab,
|
|
126
133
|
remarkCodeTabOptions
|
|
@@ -145,6 +152,7 @@ function getDefaultMDXOptions({
|
|
|
145
152
|
);
|
|
146
153
|
return {
|
|
147
154
|
...mdxOptions,
|
|
155
|
+
outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
|
|
148
156
|
remarkPlugins,
|
|
149
157
|
rehypePlugins
|
|
150
158
|
};
|
|
@@ -198,37 +206,73 @@ function buildConfig(config) {
|
|
|
198
206
|
`Unknown export "${k}", you can only export collections from source configuration file.`
|
|
199
207
|
);
|
|
200
208
|
}
|
|
201
|
-
|
|
209
|
+
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
202
210
|
return {
|
|
203
211
|
global: globalConfig,
|
|
204
212
|
collections,
|
|
205
|
-
async getDefaultMDXOptions() {
|
|
206
|
-
|
|
213
|
+
async getDefaultMDXOptions(mode = "default") {
|
|
214
|
+
const cached = mdxOptionsCache.get(mode);
|
|
215
|
+
if (cached) return cached;
|
|
207
216
|
const input = this.global.mdxOptions;
|
|
208
217
|
async function uncached() {
|
|
209
218
|
const options = typeof input === "function" ? await input() : input;
|
|
210
219
|
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
|
|
211
220
|
if (options?.preset === "minimal") return options;
|
|
212
|
-
return getDefaultMDXOptions2(
|
|
221
|
+
return getDefaultMDXOptions2({
|
|
222
|
+
...options,
|
|
223
|
+
_withoutBundler: mode === "remote"
|
|
224
|
+
});
|
|
213
225
|
}
|
|
214
|
-
|
|
226
|
+
const result = uncached();
|
|
227
|
+
mdxOptionsCache.set(mode, result);
|
|
228
|
+
return result;
|
|
215
229
|
}
|
|
216
230
|
};
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
// src/utils/config.ts
|
|
220
234
|
var cache = null;
|
|
235
|
+
async function isZod3() {
|
|
236
|
+
try {
|
|
237
|
+
const content = JSON.parse(
|
|
238
|
+
(await fs.readFile("node_modules/zod/package.json")).toString()
|
|
239
|
+
);
|
|
240
|
+
const version = content.version;
|
|
241
|
+
return typeof version === "string" && version.startsWith("3.");
|
|
242
|
+
} catch {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function createCompatZodPlugin() {
|
|
247
|
+
return {
|
|
248
|
+
name: "replace-zod-import",
|
|
249
|
+
async setup(build) {
|
|
250
|
+
const usingZod3 = await isZod3();
|
|
251
|
+
if (!usingZod3) return;
|
|
252
|
+
console.warn(
|
|
253
|
+
"[Fumadocs MDX] Noticed Zod v3 in your node_modules, we recommend upgrading to Zod v4 for better compatibility."
|
|
254
|
+
);
|
|
255
|
+
build.onResolve({ filter: /^fumadocs-mdx\/config$/ }, () => {
|
|
256
|
+
return {
|
|
257
|
+
path: "fumadocs-mdx/config/zod-3",
|
|
258
|
+
external: true
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
221
264
|
async function compileConfig(configPath, outDir) {
|
|
222
265
|
const { build } = await import("esbuild");
|
|
223
266
|
const transformed = await build({
|
|
224
267
|
entryPoints: [{ in: configPath, out: "source.config" }],
|
|
225
268
|
bundle: true,
|
|
226
269
|
outdir: outDir,
|
|
227
|
-
target: "
|
|
270
|
+
target: "node20",
|
|
228
271
|
write: true,
|
|
229
272
|
platform: "node",
|
|
230
273
|
format: "esm",
|
|
231
274
|
packages: "external",
|
|
275
|
+
plugins: [createCompatZodPlugin()],
|
|
232
276
|
outExtension: {
|
|
233
277
|
".js": ".mjs"
|
|
234
278
|
},
|
|
@@ -278,9 +322,9 @@ function fumaMatter(input) {
|
|
|
278
322
|
if (!match) {
|
|
279
323
|
return output;
|
|
280
324
|
}
|
|
281
|
-
output.matter = match[
|
|
325
|
+
output.matter = match[0];
|
|
282
326
|
output.content = input.slice(match[0].length);
|
|
283
|
-
const loaded = (0, import_js_yaml.load)(
|
|
327
|
+
const loaded = (0, import_js_yaml.load)(match[1]);
|
|
284
328
|
output.data = loaded ?? {};
|
|
285
329
|
return output;
|
|
286
330
|
}
|
|
@@ -314,7 +358,7 @@ function extractSection(root, section) {
|
|
|
314
358
|
}
|
|
315
359
|
function remarkInclude() {
|
|
316
360
|
const TagName = "include";
|
|
317
|
-
async function update(tree, directory,
|
|
361
|
+
async function update(tree, directory, data) {
|
|
318
362
|
const queue = [];
|
|
319
363
|
(0, import_unist_util_visit.visit)(
|
|
320
364
|
tree,
|
|
@@ -342,7 +386,7 @@ function remarkInclude() {
|
|
|
342
386
|
const asCode = params.lang || !file.endsWith(".md") && !file.endsWith(".mdx");
|
|
343
387
|
queue.push(
|
|
344
388
|
fs2.readFile(targetPath).then((buffer) => buffer.toString()).then(async (content) => {
|
|
345
|
-
|
|
389
|
+
data._compiler?.addDependency(targetPath);
|
|
346
390
|
if (asCode) {
|
|
347
391
|
const lang = params.lang ?? path2.extname(file).slice(1);
|
|
348
392
|
Object.assign(node, {
|
|
@@ -354,6 +398,9 @@ function remarkInclude() {
|
|
|
354
398
|
});
|
|
355
399
|
return;
|
|
356
400
|
}
|
|
401
|
+
const processor = data._processor ? data._processor.getProcessor(
|
|
402
|
+
targetPath.endsWith(".md") ? "md" : "mdx"
|
|
403
|
+
) : this;
|
|
357
404
|
let parsed = processor.parse(fumaMatter(content).content);
|
|
358
405
|
if (section) {
|
|
359
406
|
const extracted = extractSection(parsed, section);
|
|
@@ -363,11 +410,11 @@ function remarkInclude() {
|
|
|
363
410
|
);
|
|
364
411
|
parsed = extracted;
|
|
365
412
|
}
|
|
366
|
-
await update(
|
|
413
|
+
await update.call(
|
|
414
|
+
processor,
|
|
367
415
|
parsed,
|
|
368
416
|
path2.dirname(targetPath),
|
|
369
|
-
|
|
370
|
-
compiler
|
|
417
|
+
data
|
|
371
418
|
);
|
|
372
419
|
Object.assign(
|
|
373
420
|
parent && parent.type === "paragraph" ? parent : node,
|
|
@@ -387,7 +434,7 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
387
434
|
await Promise.all(queue);
|
|
388
435
|
}
|
|
389
436
|
return async (tree, file) => {
|
|
390
|
-
await update(tree, path2.dirname(file.path),
|
|
437
|
+
await update.call(this, tree, path2.dirname(file.path), file.data);
|
|
391
438
|
};
|
|
392
439
|
}
|
|
393
440
|
|
|
@@ -395,29 +442,32 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
395
442
|
var cache2 = /* @__PURE__ */ new Map();
|
|
396
443
|
async function buildMDX(cacheKey, source, options) {
|
|
397
444
|
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
});
|
|
412
|
-
cache2.set(key, cached);
|
|
445
|
+
function getProcessor(format) {
|
|
446
|
+
const key = `${cacheKey}:${format}`;
|
|
447
|
+
let processor = cache2.get(key);
|
|
448
|
+
if (!processor) {
|
|
449
|
+
processor = (0, import_mdx.createProcessor)({
|
|
450
|
+
outputFormat: "program",
|
|
451
|
+
...rest,
|
|
452
|
+
remarkPlugins: [remarkInclude, ...rest.remarkPlugins ?? []],
|
|
453
|
+
format
|
|
454
|
+
});
|
|
455
|
+
cache2.set(key, processor);
|
|
456
|
+
}
|
|
457
|
+
return processor;
|
|
413
458
|
}
|
|
414
|
-
return
|
|
459
|
+
return getProcessor(
|
|
460
|
+
options.format ?? filePath.endsWith(".mdx") ? "mdx" : "md"
|
|
461
|
+
).process({
|
|
415
462
|
value: source,
|
|
416
463
|
path: filePath,
|
|
417
464
|
data: {
|
|
418
465
|
...data,
|
|
419
466
|
frontmatter,
|
|
420
|
-
_compiler
|
|
467
|
+
_compiler,
|
|
468
|
+
_processor: {
|
|
469
|
+
getProcessor
|
|
470
|
+
}
|
|
421
471
|
}
|
|
422
472
|
});
|
|
423
473
|
}
|
|
@@ -445,25 +495,8 @@ async function getGitTimestamp(file) {
|
|
|
445
495
|
}
|
|
446
496
|
}
|
|
447
497
|
|
|
448
|
-
// src/utils/
|
|
449
|
-
var import_zod = require("zod");
|
|
498
|
+
// src/utils/validation.ts
|
|
450
499
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
451
|
-
var metaSchema = import_zod.z.object({
|
|
452
|
-
title: import_zod.z.string().optional(),
|
|
453
|
-
pages: import_zod.z.array(import_zod.z.string()).optional(),
|
|
454
|
-
description: import_zod.z.string().optional(),
|
|
455
|
-
root: import_zod.z.boolean().optional(),
|
|
456
|
-
defaultOpen: import_zod.z.boolean().optional(),
|
|
457
|
-
icon: import_zod.z.string().optional()
|
|
458
|
-
});
|
|
459
|
-
var frontmatterSchema = import_zod.z.object({
|
|
460
|
-
title: import_zod.z.string(),
|
|
461
|
-
description: import_zod.z.string().optional(),
|
|
462
|
-
icon: import_zod.z.string().optional(),
|
|
463
|
-
full: import_zod.z.boolean().optional(),
|
|
464
|
-
// Fumadocs OpenAPI generated
|
|
465
|
-
_openapi: import_zod.z.looseObject({}).optional()
|
|
466
|
-
});
|
|
467
500
|
var ValidationError = class extends Error {
|
|
468
501
|
constructor(message, issues) {
|
|
469
502
|
super(
|
package/dist/loader-mdx.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getConfigHash,
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XZR5QXVY.js";
|
|
5
5
|
import {
|
|
6
|
-
buildMDX,
|
|
7
6
|
countLines
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
getGitTimestamp
|
|
11
|
-
} from "./chunk-VUEZTR2H.js";
|
|
7
|
+
} from "./chunk-UCY7OBZG.js";
|
|
12
8
|
import {
|
|
13
9
|
ValidationError,
|
|
10
|
+
getGitTimestamp,
|
|
14
11
|
validate
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import
|
|
17
|
-
|
|
12
|
+
} from "./chunk-GX3THK2Q.js";
|
|
13
|
+
import {
|
|
14
|
+
buildMDX
|
|
15
|
+
} from "./chunk-7JFPDRW7.js";
|
|
16
|
+
import "./chunk-IGXZS2W6.js";
|
|
17
|
+
import "./chunk-XVL4ZQFK.js";
|
|
18
18
|
import {
|
|
19
19
|
fumaMatter
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-VWJKRQZR.js";
|
|
21
21
|
|
|
22
22
|
// src/loader-mdx.ts
|
|
23
23
|
import * as path from "path";
|
package/dist/next/index.cjs
CHANGED
|
@@ -102,6 +102,7 @@ function getDefaultMDXOptions({
|
|
|
102
102
|
remarkStructureOptions,
|
|
103
103
|
remarkCodeTabOptions,
|
|
104
104
|
remarkNpmOptions,
|
|
105
|
+
_withoutBundler = false,
|
|
105
106
|
...mdxOptions
|
|
106
107
|
}) {
|
|
107
108
|
const mdxExports = [
|
|
@@ -120,7 +121,13 @@ function getDefaultMDXOptions({
|
|
|
120
121
|
...remarkHeadingOptions
|
|
121
122
|
}
|
|
122
123
|
],
|
|
123
|
-
remarkImageOptions !== false && [
|
|
124
|
+
remarkImageOptions !== false && [
|
|
125
|
+
plugins.remarkImage,
|
|
126
|
+
{
|
|
127
|
+
...remarkImageOptions,
|
|
128
|
+
useImport: _withoutBundler ? false : remarkImageOptions?.useImport
|
|
129
|
+
}
|
|
130
|
+
],
|
|
124
131
|
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
|
|
125
132
|
plugins.remarkCodeTab,
|
|
126
133
|
remarkCodeTabOptions
|
|
@@ -145,6 +152,7 @@ function getDefaultMDXOptions({
|
|
|
145
152
|
);
|
|
146
153
|
return {
|
|
147
154
|
...mdxOptions,
|
|
155
|
+
outputFormat: _withoutBundler ? "function-body" : mdxOptions.outputFormat,
|
|
148
156
|
remarkPlugins,
|
|
149
157
|
rehypePlugins
|
|
150
158
|
};
|
|
@@ -228,20 +236,26 @@ function buildConfig(config) {
|
|
|
228
236
|
`Unknown export "${k}", you can only export collections from source configuration file.`
|
|
229
237
|
);
|
|
230
238
|
}
|
|
231
|
-
|
|
239
|
+
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
232
240
|
return {
|
|
233
241
|
global: globalConfig,
|
|
234
242
|
collections,
|
|
235
|
-
async getDefaultMDXOptions() {
|
|
236
|
-
|
|
243
|
+
async getDefaultMDXOptions(mode = "default") {
|
|
244
|
+
const cached = mdxOptionsCache.get(mode);
|
|
245
|
+
if (cached) return cached;
|
|
237
246
|
const input = this.global.mdxOptions;
|
|
238
247
|
async function uncached() {
|
|
239
248
|
const options = typeof input === "function" ? await input() : input;
|
|
240
249
|
const { getDefaultMDXOptions: getDefaultMDXOptions2 } = await Promise.resolve().then(() => (init_mdx_options(), mdx_options_exports));
|
|
241
250
|
if (options?.preset === "minimal") return options;
|
|
242
|
-
return getDefaultMDXOptions2(
|
|
251
|
+
return getDefaultMDXOptions2({
|
|
252
|
+
...options,
|
|
253
|
+
_withoutBundler: mode === "remote"
|
|
254
|
+
});
|
|
243
255
|
}
|
|
244
|
-
|
|
256
|
+
const result = uncached();
|
|
257
|
+
mdxOptionsCache.set(mode, result);
|
|
258
|
+
return result;
|
|
245
259
|
}
|
|
246
260
|
};
|
|
247
261
|
}
|
|
@@ -251,17 +265,47 @@ function findConfigFile() {
|
|
|
251
265
|
return path.resolve("source.config.ts");
|
|
252
266
|
}
|
|
253
267
|
var cache = null;
|
|
268
|
+
async function isZod3() {
|
|
269
|
+
try {
|
|
270
|
+
const content = JSON.parse(
|
|
271
|
+
(await fs.readFile("node_modules/zod/package.json")).toString()
|
|
272
|
+
);
|
|
273
|
+
const version = content.version;
|
|
274
|
+
return typeof version === "string" && version.startsWith("3.");
|
|
275
|
+
} catch {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function createCompatZodPlugin() {
|
|
280
|
+
return {
|
|
281
|
+
name: "replace-zod-import",
|
|
282
|
+
async setup(build) {
|
|
283
|
+
const usingZod3 = await isZod3();
|
|
284
|
+
if (!usingZod3) return;
|
|
285
|
+
console.warn(
|
|
286
|
+
"[Fumadocs MDX] Noticed Zod v3 in your node_modules, we recommend upgrading to Zod v4 for better compatibility."
|
|
287
|
+
);
|
|
288
|
+
build.onResolve({ filter: /^fumadocs-mdx\/config$/ }, () => {
|
|
289
|
+
return {
|
|
290
|
+
path: "fumadocs-mdx/config/zod-3",
|
|
291
|
+
external: true
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
254
297
|
async function compileConfig(configPath, outDir) {
|
|
255
298
|
const { build } = await import("esbuild");
|
|
256
299
|
const transformed = await build({
|
|
257
300
|
entryPoints: [{ in: configPath, out: "source.config" }],
|
|
258
301
|
bundle: true,
|
|
259
302
|
outdir: outDir,
|
|
260
|
-
target: "
|
|
303
|
+
target: "node20",
|
|
261
304
|
write: true,
|
|
262
305
|
platform: "node",
|
|
263
306
|
format: "esm",
|
|
264
307
|
packages: "external",
|
|
308
|
+
plugins: [createCompatZodPlugin()],
|
|
265
309
|
outExtension: {
|
|
266
310
|
".js": ".mjs"
|
|
267
311
|
},
|
|
@@ -303,25 +347,8 @@ var path4 = __toESM(require("path"), 1);
|
|
|
303
347
|
var fs2 = __toESM(require("fs/promises"), 1);
|
|
304
348
|
var import_tinyglobby = require("tinyglobby");
|
|
305
349
|
|
|
306
|
-
// src/utils/
|
|
307
|
-
var import_zod = require("zod");
|
|
350
|
+
// src/utils/validation.ts
|
|
308
351
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
309
|
-
var metaSchema = import_zod.z.object({
|
|
310
|
-
title: import_zod.z.string().optional(),
|
|
311
|
-
pages: import_zod.z.array(import_zod.z.string()).optional(),
|
|
312
|
-
description: import_zod.z.string().optional(),
|
|
313
|
-
root: import_zod.z.boolean().optional(),
|
|
314
|
-
defaultOpen: import_zod.z.boolean().optional(),
|
|
315
|
-
icon: import_zod.z.string().optional()
|
|
316
|
-
});
|
|
317
|
-
var frontmatterSchema = import_zod.z.object({
|
|
318
|
-
title: import_zod.z.string(),
|
|
319
|
-
description: import_zod.z.string().optional(),
|
|
320
|
-
icon: import_zod.z.string().optional(),
|
|
321
|
-
full: import_zod.z.boolean().optional(),
|
|
322
|
-
// Fumadocs OpenAPI generated
|
|
323
|
-
_openapi: import_zod.z.looseObject({}).optional()
|
|
324
|
-
});
|
|
325
352
|
var ValidationError = class extends Error {
|
|
326
353
|
constructor(message, issues) {
|
|
327
354
|
super(
|
|
@@ -413,9 +440,9 @@ function fumaMatter(input) {
|
|
|
413
440
|
if (!match) {
|
|
414
441
|
return output;
|
|
415
442
|
}
|
|
416
|
-
output.matter = match[
|
|
443
|
+
output.matter = match[0];
|
|
417
444
|
output.content = input.slice(match[0].length);
|
|
418
|
-
const loaded = (0, import_js_yaml.load)(
|
|
445
|
+
const loaded = (0, import_js_yaml.load)(match[1]);
|
|
419
446
|
output.data = loaded ?? {};
|
|
420
447
|
return output;
|
|
421
448
|
}
|
|
@@ -437,7 +464,14 @@ function getImportCode(info) {
|
|
|
437
464
|
}
|
|
438
465
|
function toImportPath(file, config) {
|
|
439
466
|
const ext = import_node_path2.default.extname(file);
|
|
440
|
-
|
|
467
|
+
let filename;
|
|
468
|
+
if (ext === ".ts" && config.jsExtension) {
|
|
469
|
+
filename = file.substring(0, file.length - ext.length) + ".js";
|
|
470
|
+
} else if (ext === ".ts") {
|
|
471
|
+
filename = file.substring(0, file.length - ext.length);
|
|
472
|
+
} else {
|
|
473
|
+
filename = file;
|
|
474
|
+
}
|
|
441
475
|
let importPath;
|
|
442
476
|
if ("relativeTo" in config) {
|
|
443
477
|
importPath = import_node_path2.default.relative(config.relativeTo, filename);
|
|
@@ -562,7 +596,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
|
|
|
562
596
|
info: file,
|
|
563
597
|
lastModified,
|
|
564
598
|
data,
|
|
565
|
-
content: parsed.content
|
|
599
|
+
content: { body: parsed.content, matter: parsed.matter }
|
|
566
600
|
});
|
|
567
601
|
});
|
|
568
602
|
return Promise.all(entries2);
|
package/dist/next/index.js
CHANGED
|
@@ -2,24 +2,22 @@ import {
|
|
|
2
2
|
findConfigFile,
|
|
3
3
|
getConfigHash,
|
|
4
4
|
loadConfig
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-XZR5QXVY.js";
|
|
6
6
|
import {
|
|
7
7
|
getGlobPatterns,
|
|
8
8
|
getImportCode,
|
|
9
9
|
isFileSupported,
|
|
10
10
|
toImportPath
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import {
|
|
13
|
-
getGitTimestamp
|
|
14
|
-
} from "../chunk-VUEZTR2H.js";
|
|
11
|
+
} from "../chunk-6Y5JDZHD.js";
|
|
15
12
|
import {
|
|
16
13
|
ValidationError,
|
|
14
|
+
getGitTimestamp,
|
|
17
15
|
validate
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-GX3THK2Q.js";
|
|
17
|
+
import "../chunk-XVL4ZQFK.js";
|
|
20
18
|
import {
|
|
21
19
|
fumaMatter
|
|
22
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-VWJKRQZR.js";
|
|
23
21
|
|
|
24
22
|
// src/map/index.ts
|
|
25
23
|
import * as path2 from "path";
|
|
@@ -145,7 +143,7 @@ async function generateJS(configPath, config, importPath, configHash = false) {
|
|
|
145
143
|
info: file,
|
|
146
144
|
lastModified,
|
|
147
145
|
data,
|
|
148
|
-
content: parsed.content
|
|
146
|
+
content: { body: parsed.content, matter: parsed.matter }
|
|
149
147
|
});
|
|
150
148
|
});
|
|
151
149
|
return Promise.all(entries2);
|