fumadocs-mdx 11.10.1 → 12.0.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.
- package/dist/bin.cjs +126 -218
- package/dist/bin.js +1 -1
- package/dist/{browser-B2G8uAF2.d.cts → browser-D5lvL8vv.d.ts} +51 -4
- package/dist/{browser-DrH7tKRi.d.ts → browser-DjWADqp8.d.cts} +51 -4
- package/dist/bun/index.cjs +274 -230
- package/dist/bun/index.js +8 -8
- package/dist/chunk-ADR6R7HM.js +29 -0
- package/dist/{chunk-UOOPSLFY.js → chunk-AUOOMFAI.js} +27 -21
- package/dist/chunk-FSZMKRVH.js +80 -0
- package/dist/{chunk-766EAFX6.js → chunk-LGYVNESJ.js} +2 -36
- package/dist/chunk-LMG6UWCL.js +167 -0
- package/dist/chunk-QAUWMR5D.js +142 -0
- package/dist/{chunk-QJCCVMBJ.js → chunk-SP7CHRTS.js} +17 -47
- package/dist/{chunk-QVZ7JH4H.js → chunk-U4MQ44TS.js} +1 -1
- package/dist/{chunk-CNKI574E.js → chunk-VXEBLM4X.js} +1 -1
- package/dist/chunk-XMFLD5J6.js +30 -0
- package/dist/chunk-ZLCSVXCD.js +10 -0
- package/dist/{chunk-XXSKWWMB.js → chunk-ZX7TM4AR.js} +4 -2
- package/dist/config/index.cjs +97 -148
- package/dist/config/index.d.cts +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +48 -9
- package/dist/{define-BH4bnHQl.d.ts → define--6HQ1ehX.d.cts} +18 -3
- package/dist/{define-BH4bnHQl.d.cts → define--6HQ1ehX.d.ts} +18 -3
- package/dist/load-UUXLUBHL.js +9 -0
- package/dist/loader-mdx.cjs +336 -305
- package/dist/loader-mdx.js +8 -8
- package/dist/next/index.cjs +152 -242
- package/dist/next/index.js +52 -66
- package/dist/node/loader.cjs +274 -243
- package/dist/node/loader.js +7 -8
- package/dist/postinstall-SCSXM4IM.js +10 -0
- package/dist/{mdx-options-T73E4LQB.js → preset-ZMP6U62C.js} +1 -1
- package/dist/runtime/next/async.cjs +304 -204
- package/dist/runtime/next/async.d.cts +3 -3
- package/dist/runtime/next/async.d.ts +3 -3
- package/dist/runtime/next/async.js +59 -32
- package/dist/runtime/next/index.cjs +32 -21
- package/dist/runtime/next/index.d.cts +11 -7
- package/dist/runtime/next/index.d.ts +11 -7
- package/dist/runtime/next/index.js +2 -1
- package/dist/runtime/vite/browser.d.cts +2 -3
- package/dist/runtime/vite/browser.d.ts +2 -3
- package/dist/runtime/vite/server.cjs +67 -21
- package/dist/runtime/vite/server.d.cts +14 -28
- package/dist/runtime/vite/server.d.ts +14 -28
- package/dist/runtime/vite/server.js +61 -21
- package/dist/shared-0QIuV0XZ.d.ts +70 -0
- package/dist/shared-CqgMnt9h.d.cts +70 -0
- package/dist/{types-DN9KrG7R.d.ts → types-CFlQxTN8.d.ts} +10 -37
- package/dist/{types-DT83Ijs6.d.cts → types-DkGjw-Uo.d.cts} +10 -37
- package/dist/vite/index.cjs +299 -279
- package/dist/vite/index.d.cts +1 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +15 -20
- package/dist/{watcher-4NDMOH4R.js → watcher-HGOH3APP.js} +1 -1
- package/package.json +16 -16
- package/dist/build-mdx-DnC1jKvn.d.cts +0 -46
- package/dist/build-mdx-DnC1jKvn.d.ts +0 -46
- package/dist/chunk-GBMFGEC7.js +0 -57
- package/dist/chunk-QQWCBFFE.js +0 -40
- package/dist/chunk-SMSNZ6N5.js +0 -155
- package/dist/chunk-SVTXMVLQ.js +0 -139
- package/dist/config/zod-3.cjs +0 -422
- package/dist/config/zod-3.d.cts +0 -53
- package/dist/config/zod-3.d.ts +0 -53
- package/dist/config/zod-3.js +0 -40
- package/dist/postinstall-XV4WSHZP.js +0 -9
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
toImportPath
|
|
5
5
|
} from "./chunk-6Y5JDZHD.js";
|
|
6
6
|
import {
|
|
7
|
-
findConfigFile,
|
|
8
7
|
loadConfig
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LGYVNESJ.js";
|
|
9
|
+
import {
|
|
10
|
+
findConfigFile
|
|
11
|
+
} from "./chunk-XMFLD5J6.js";
|
|
10
12
|
|
|
11
13
|
// src/vite/postinstall.ts
|
|
12
14
|
import fs from "fs/promises";
|
package/dist/config/index.cjs
CHANGED
|
@@ -64,11 +64,7 @@ function defineCollections(options) {
|
|
|
64
64
|
return options;
|
|
65
65
|
}
|
|
66
66
|
function defineDocs(options) {
|
|
67
|
-
|
|
68
|
-
console.warn(
|
|
69
|
-
"[`source.config.ts`] Deprecated: please pass options to `defineDocs()` and specify a `dir`."
|
|
70
|
-
);
|
|
71
|
-
const dir = options?.dir ?? "content/docs";
|
|
67
|
+
const dir = options.dir ?? "content/docs";
|
|
72
68
|
return {
|
|
73
69
|
type: "docs",
|
|
74
70
|
dir,
|
|
@@ -90,81 +86,8 @@ function defineConfig(config = {}) {
|
|
|
90
86
|
return config;
|
|
91
87
|
}
|
|
92
88
|
|
|
93
|
-
// src/
|
|
89
|
+
// src/loaders/mdx/preset.ts
|
|
94
90
|
var plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
95
|
-
|
|
96
|
-
// src/mdx-plugins/remark-postprocess.ts
|
|
97
|
-
var import_unist_util_visit = require("unist-util-visit");
|
|
98
|
-
var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
99
|
-
function remarkPostprocess({
|
|
100
|
-
injectExports
|
|
101
|
-
}) {
|
|
102
|
-
return (tree, file) => {
|
|
103
|
-
let title;
|
|
104
|
-
const urls = [];
|
|
105
|
-
(0, import_unist_util_visit.visit)(tree, ["heading", "link"], (node) => {
|
|
106
|
-
if (node.type === "heading" && node.depth === 1) {
|
|
107
|
-
title = flattenNode(node);
|
|
108
|
-
}
|
|
109
|
-
if (node.type !== "link") return;
|
|
110
|
-
urls.push({
|
|
111
|
-
href: node.url
|
|
112
|
-
});
|
|
113
|
-
return "skip";
|
|
114
|
-
});
|
|
115
|
-
if (title) {
|
|
116
|
-
file.data.frontmatter ??= {};
|
|
117
|
-
if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
|
|
118
|
-
}
|
|
119
|
-
file.data.extractedReferences = urls;
|
|
120
|
-
for (const name of injectExports) {
|
|
121
|
-
if (!(name in file.data)) continue;
|
|
122
|
-
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function flattenNode(node) {
|
|
127
|
-
if ("children" in node)
|
|
128
|
-
return node.children.map((child) => flattenNode(child)).join("");
|
|
129
|
-
if ("value" in node) return node.value;
|
|
130
|
-
return "";
|
|
131
|
-
}
|
|
132
|
-
function getMdastExport(name, value) {
|
|
133
|
-
return {
|
|
134
|
-
type: "mdxjsEsm",
|
|
135
|
-
value: "",
|
|
136
|
-
data: {
|
|
137
|
-
estree: {
|
|
138
|
-
type: "Program",
|
|
139
|
-
sourceType: "module",
|
|
140
|
-
body: [
|
|
141
|
-
{
|
|
142
|
-
type: "ExportNamedDeclaration",
|
|
143
|
-
attributes: [],
|
|
144
|
-
specifiers: [],
|
|
145
|
-
source: null,
|
|
146
|
-
declaration: {
|
|
147
|
-
type: "VariableDeclaration",
|
|
148
|
-
kind: "let",
|
|
149
|
-
declarations: [
|
|
150
|
-
{
|
|
151
|
-
type: "VariableDeclarator",
|
|
152
|
-
id: {
|
|
153
|
-
type: "Identifier",
|
|
154
|
-
name
|
|
155
|
-
},
|
|
156
|
-
init: (0, import_estree_util_value_to_estree.valueToEstree)(value)
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// src/utils/mdx-options.ts
|
|
168
91
|
function pluginOption(def, options = []) {
|
|
169
92
|
const list = def(Array.isArray(options) ? options : []).filter(
|
|
170
93
|
Boolean
|
|
@@ -185,13 +108,6 @@ function getDefaultMDXOptions({
|
|
|
185
108
|
_withoutBundler = false,
|
|
186
109
|
...mdxOptions
|
|
187
110
|
}) {
|
|
188
|
-
const mdxExports = [
|
|
189
|
-
"structuredData",
|
|
190
|
-
"extractedReferences",
|
|
191
|
-
"frontmatter",
|
|
192
|
-
"lastModified",
|
|
193
|
-
...valueToExport
|
|
194
|
-
];
|
|
195
111
|
const remarkPlugins = pluginOption(
|
|
196
112
|
(v) => [
|
|
197
113
|
plugins.remarkGfm,
|
|
@@ -219,10 +135,15 @@ function getDefaultMDXOptions({
|
|
|
219
135
|
plugins.remarkStructure,
|
|
220
136
|
remarkStructureOptions
|
|
221
137
|
],
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
138
|
+
() => {
|
|
139
|
+
return (_, file) => {
|
|
140
|
+
file.data["mdx-export"] ??= [];
|
|
141
|
+
for (const name of valueToExport) {
|
|
142
|
+
if (name in file.data)
|
|
143
|
+
file.data["mdx-export"].push({ name, value: file.data[name] });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
226
147
|
],
|
|
227
148
|
mdxOptions.remarkPlugins
|
|
228
149
|
);
|
|
@@ -242,9 +163,9 @@ function getDefaultMDXOptions({
|
|
|
242
163
|
};
|
|
243
164
|
}
|
|
244
165
|
|
|
245
|
-
// src/mdx
|
|
166
|
+
// src/loaders/mdx/remark-include.ts
|
|
246
167
|
var import_unified = require("unified");
|
|
247
|
-
var
|
|
168
|
+
var import_unist_util_visit = require("unist-util-visit");
|
|
248
169
|
var path = __toESM(require("path"), 1);
|
|
249
170
|
var fs = __toESM(require("fs/promises"), 1);
|
|
250
171
|
|
|
@@ -264,14 +185,35 @@ function fumaMatter(input) {
|
|
|
264
185
|
return output;
|
|
265
186
|
}
|
|
266
187
|
|
|
267
|
-
// src/mdx
|
|
188
|
+
// src/loaders/mdx/remark-include.ts
|
|
268
189
|
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
269
190
|
var import_remark_mdx = __toESM(require("remark-mdx"), 1);
|
|
270
191
|
var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
271
|
-
var
|
|
272
|
-
|
|
192
|
+
var ElementLikeTypes = [
|
|
193
|
+
"mdxJsxFlowElement",
|
|
194
|
+
"mdxJsxTextElement",
|
|
195
|
+
"containerDirective",
|
|
196
|
+
"textDirective",
|
|
197
|
+
"leafDirective"
|
|
198
|
+
];
|
|
199
|
+
function isElementLike(node) {
|
|
200
|
+
return ElementLikeTypes.includes(node.type);
|
|
201
|
+
}
|
|
202
|
+
function parseElementAttributes(element) {
|
|
203
|
+
if (Array.isArray(element.attributes)) {
|
|
204
|
+
const attributes = {};
|
|
205
|
+
for (const attr of element.attributes) {
|
|
206
|
+
if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
|
|
207
|
+
attributes[attr.name] = attr.value;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return attributes;
|
|
211
|
+
}
|
|
212
|
+
return element.attributes ?? {};
|
|
213
|
+
}
|
|
214
|
+
function flattenNode(node) {
|
|
273
215
|
if ("children" in node)
|
|
274
|
-
return node.children.map((child) =>
|
|
216
|
+
return node.children.map((child) => flattenNode(child)).join("");
|
|
275
217
|
if ("value" in node) return node.value;
|
|
276
218
|
return "";
|
|
277
219
|
}
|
|
@@ -285,21 +227,31 @@ function parseSpecifier(specifier) {
|
|
|
285
227
|
}
|
|
286
228
|
function extractSection(root, section) {
|
|
287
229
|
let nodes;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
230
|
+
let capturingHeadingContent = false;
|
|
231
|
+
(0, import_unist_util_visit.visit)(root, (node) => {
|
|
232
|
+
if (node.type === "heading") {
|
|
233
|
+
if (capturingHeadingContent) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (node.data?.hProperties?.id === section) {
|
|
237
|
+
capturingHeadingContent = true;
|
|
238
|
+
nodes = [node];
|
|
239
|
+
return "skip";
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
294
242
|
}
|
|
295
|
-
if (
|
|
296
|
-
nodes
|
|
297
|
-
|
|
243
|
+
if (capturingHeadingContent) {
|
|
244
|
+
nodes?.push(node);
|
|
245
|
+
return "skip";
|
|
298
246
|
}
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
247
|
+
if (isElementLike(node) && node.name === "section") {
|
|
248
|
+
const attributes = parseElementAttributes(node);
|
|
249
|
+
if (attributes.id === section) {
|
|
250
|
+
nodes = node.children;
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
303
255
|
if (nodes)
|
|
304
256
|
return {
|
|
305
257
|
type: "root",
|
|
@@ -331,55 +283,52 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
331
283
|
data: {}
|
|
332
284
|
};
|
|
333
285
|
}
|
|
334
|
-
const
|
|
286
|
+
const parser = (data._getProcessor ?? getDefaultProcessor)(
|
|
335
287
|
ext === ".mdx" ? "mdx" : "md"
|
|
336
288
|
);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
289
|
+
const parsed = fumaMatter(content);
|
|
290
|
+
let mdast = parser.parse({
|
|
291
|
+
path: file,
|
|
292
|
+
value: parsed.content,
|
|
293
|
+
data: { frontmatter: parsed.data }
|
|
294
|
+
});
|
|
340
295
|
if (heading) {
|
|
341
|
-
const extracted = extractSection(
|
|
296
|
+
const extracted = extractSection(
|
|
297
|
+
await (0, import_unified.unified)().use(import_mdx_plugins.remarkHeading).run(mdast),
|
|
298
|
+
heading
|
|
299
|
+
);
|
|
342
300
|
if (!extracted)
|
|
343
301
|
throw new Error(
|
|
344
|
-
`Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag.`
|
|
302
|
+
`Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag, or a :::section directive with remark-directive configured.`
|
|
345
303
|
);
|
|
346
|
-
|
|
304
|
+
mdast = extracted;
|
|
347
305
|
}
|
|
348
|
-
await update(
|
|
349
|
-
return
|
|
306
|
+
await update(mdast, path.dirname(file), data);
|
|
307
|
+
return mdast;
|
|
350
308
|
}
|
|
351
309
|
async function update(tree, directory, data) {
|
|
352
310
|
const queue = [];
|
|
353
|
-
(0,
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
Object.assign(
|
|
375
|
-
parent && parent.type === "paragraph" ? parent : node,
|
|
376
|
-
replace
|
|
377
|
-
);
|
|
378
|
-
})
|
|
379
|
-
);
|
|
380
|
-
return "skip";
|
|
381
|
-
}
|
|
382
|
-
);
|
|
311
|
+
(0, import_unist_util_visit.visit)(tree, ElementLikeTypes, (_node, _, parent) => {
|
|
312
|
+
const node = _node;
|
|
313
|
+
if (node.name !== TagName) return;
|
|
314
|
+
const specifier = flattenNode(node);
|
|
315
|
+
if (specifier.length === 0) return "skip";
|
|
316
|
+
const attributes = parseElementAttributes(node);
|
|
317
|
+
const { file: relativePath, section } = parseSpecifier(specifier);
|
|
318
|
+
const file = path.resolve(
|
|
319
|
+
"cwd" in attributes ? process.cwd() : directory,
|
|
320
|
+
relativePath
|
|
321
|
+
);
|
|
322
|
+
queue.push(
|
|
323
|
+
embedContent(file, section, attributes, data).then((replace) => {
|
|
324
|
+
Object.assign(
|
|
325
|
+
parent && parent.type === "paragraph" ? parent : node,
|
|
326
|
+
replace
|
|
327
|
+
);
|
|
328
|
+
})
|
|
329
|
+
);
|
|
330
|
+
return "skip";
|
|
331
|
+
});
|
|
383
332
|
await Promise.all(queue);
|
|
384
333
|
}
|
|
385
334
|
return async (tree, file) => {
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define--6HQ1ehX.cjs';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@standard-schema/spec';
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, C as CollectionSchema, D as DefaultMDXOptions, a as DocCollection, b as DocsCollection, G as GlobalConfig, M as MetaCollection, d as defineCollections, e as defineConfig, c as defineDocs, f as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../define--6HQ1ehX.js';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
4
|
import '@standard-schema/spec';
|
package/dist/config/index.js
CHANGED
|
@@ -1,17 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineCollections,
|
|
3
|
-
defineConfig,
|
|
4
|
-
defineDocs,
|
|
5
|
-
frontmatterSchema,
|
|
6
|
-
metaSchema
|
|
7
|
-
} from "../chunk-GBMFGEC7.js";
|
|
8
1
|
import {
|
|
9
2
|
getDefaultMDXOptions
|
|
10
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-FSZMKRVH.js";
|
|
11
4
|
import {
|
|
12
5
|
remarkInclude
|
|
13
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-LMG6UWCL.js";
|
|
14
7
|
import "../chunk-VWJKRQZR.js";
|
|
8
|
+
|
|
9
|
+
// src/config/zod-4.ts
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
var metaSchema = z.object({
|
|
12
|
+
title: z.string().optional(),
|
|
13
|
+
pages: z.array(z.string()).optional(),
|
|
14
|
+
description: z.string().optional(),
|
|
15
|
+
root: z.boolean().optional(),
|
|
16
|
+
defaultOpen: z.boolean().optional(),
|
|
17
|
+
icon: z.string().optional()
|
|
18
|
+
});
|
|
19
|
+
var frontmatterSchema = z.object({
|
|
20
|
+
title: z.string(),
|
|
21
|
+
description: z.string().optional(),
|
|
22
|
+
icon: z.string().optional(),
|
|
23
|
+
full: z.boolean().optional(),
|
|
24
|
+
// Fumadocs OpenAPI generated
|
|
25
|
+
_openapi: z.looseObject({}).optional()
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/config/define.ts
|
|
29
|
+
function defineCollections(options) {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
function defineDocs(options) {
|
|
33
|
+
const dir = options.dir ?? "content/docs";
|
|
34
|
+
return {
|
|
35
|
+
type: "docs",
|
|
36
|
+
dir,
|
|
37
|
+
docs: defineCollections({
|
|
38
|
+
type: "doc",
|
|
39
|
+
dir,
|
|
40
|
+
schema: frontmatterSchema,
|
|
41
|
+
...options?.docs
|
|
42
|
+
}),
|
|
43
|
+
meta: defineCollections({
|
|
44
|
+
type: "meta",
|
|
45
|
+
dir,
|
|
46
|
+
schema: metaSchema,
|
|
47
|
+
...options?.meta
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function defineConfig(config = {}) {
|
|
52
|
+
return config;
|
|
53
|
+
}
|
|
15
54
|
export {
|
|
16
55
|
defineCollections,
|
|
17
56
|
defineConfig,
|
|
@@ -38,6 +38,20 @@ declare const frontmatterSchema: z.ZodObject<{
|
|
|
38
38
|
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
|
|
41
|
+
interface ExtractedReference {
|
|
42
|
+
href: string;
|
|
43
|
+
}
|
|
44
|
+
interface PostprocessOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Properties to export from `vfile.data`
|
|
47
|
+
*/
|
|
48
|
+
valueToExport?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* stringify MDAST and export via `_markdown`.
|
|
51
|
+
*/
|
|
52
|
+
includeProcessedMarkdown?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
42
56
|
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
43
57
|
interface BaseCollection {
|
|
@@ -61,6 +75,7 @@ interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> ext
|
|
|
61
75
|
}
|
|
62
76
|
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
63
77
|
type: 'doc';
|
|
78
|
+
postprocess?: PostprocessOptions;
|
|
64
79
|
mdxOptions?: ProcessorOptions;
|
|
65
80
|
/**
|
|
66
81
|
* Load files with async
|
|
@@ -101,9 +116,9 @@ interface GlobalConfig {
|
|
|
101
116
|
}
|
|
102
117
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = false>(options: DocCollection<Schema, Async>): DocCollection<Schema, Async>;
|
|
103
118
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
104
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options
|
|
119
|
+
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options: {
|
|
105
120
|
/**
|
|
106
|
-
* The directory to scan files
|
|
121
|
+
* The content directory to scan files
|
|
107
122
|
*
|
|
108
123
|
* @defaultValue 'content/docs'
|
|
109
124
|
*/
|
|
@@ -113,4 +128,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
|
|
|
113
128
|
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
114
129
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
115
130
|
|
|
116
|
-
export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
|
|
131
|
+
export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
|
|
@@ -38,6 +38,20 @@ declare const frontmatterSchema: z.ZodObject<{
|
|
|
38
38
|
_openapi: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
|
|
41
|
+
interface ExtractedReference {
|
|
42
|
+
href: string;
|
|
43
|
+
}
|
|
44
|
+
interface PostprocessOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Properties to export from `vfile.data`
|
|
47
|
+
*/
|
|
48
|
+
valueToExport?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* stringify MDAST and export via `_markdown`.
|
|
51
|
+
*/
|
|
52
|
+
includeProcessedMarkdown?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
42
56
|
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
43
57
|
interface BaseCollection {
|
|
@@ -61,6 +75,7 @@ interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> ext
|
|
|
61
75
|
}
|
|
62
76
|
interface DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = boolean> extends BaseCollection {
|
|
63
77
|
type: 'doc';
|
|
78
|
+
postprocess?: PostprocessOptions;
|
|
64
79
|
mdxOptions?: ProcessorOptions;
|
|
65
80
|
/**
|
|
66
81
|
* Load files with async
|
|
@@ -101,9 +116,9 @@ interface GlobalConfig {
|
|
|
101
116
|
}
|
|
102
117
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1, Async extends boolean = false>(options: DocCollection<Schema, Async>): DocCollection<Schema, Async>;
|
|
103
118
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
104
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options
|
|
119
|
+
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmatterSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema, Async extends boolean = false>(options: {
|
|
105
120
|
/**
|
|
106
|
-
* The directory to scan files
|
|
121
|
+
* The content directory to scan files
|
|
107
122
|
*
|
|
108
123
|
* @defaultValue 'content/docs'
|
|
109
124
|
*/
|
|
@@ -113,4 +128,4 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
|
|
|
113
128
|
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
114
129
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
115
130
|
|
|
116
|
-
export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
|
|
131
|
+
export { type AnyCollection as A, type BaseCollection as B, type CollectionSchema as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type MetaCollection as M, type DocCollection as a, type DocsCollection as b, defineDocs as c, defineCollections as d, defineConfig as e, frontmatterSchema as f, getDefaultMDXOptions as g, metaSchema as m };
|