fumadocs-mdx 11.10.1 → 12.0.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/bin.cjs +29 -139
- 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 +126 -108
- package/dist/bun/index.js +5 -5
- package/dist/chunk-3M4SHY6K.js +80 -0
- package/dist/{chunk-UOOPSLFY.js → chunk-AUOOMFAI.js} +27 -21
- package/dist/{chunk-QJCCVMBJ.js → chunk-KGUBBRL6.js} +11 -13
- package/dist/{chunk-SVTXMVLQ.js → chunk-KTDVTBMH.js} +1 -1
- package/dist/{chunk-766EAFX6.js → chunk-POXTQZ4D.js} +1 -31
- package/dist/chunk-SWNOXPYJ.js +142 -0
- package/dist/{chunk-XXSKWWMB.js → chunk-TLD6JMT6.js} +1 -1
- package/dist/{chunk-CNKI574E.js → chunk-VXEBLM4X.js} +1 -1
- package/dist/{chunk-QVZ7JH4H.js → chunk-YC25YEBF.js} +1 -1
- package/dist/chunk-ZLCSVXCD.js +10 -0
- package/dist/config/index.cjs +18 -97
- 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/loader-mdx.cjs +127 -139
- package/dist/loader-mdx.js +6 -6
- package/dist/next/index.cjs +29 -139
- package/dist/next/index.js +16 -16
- package/dist/node/loader.cjs +131 -143
- package/dist/node/loader.js +6 -6
- package/dist/postinstall-U7VROOY7.js +9 -0
- package/dist/{mdx-options-T73E4LQB.js → preset-WFEORCAB.js} +1 -1
- package/dist/runtime/next/async.cjs +198 -150
- package/dist/runtime/next/async.d.cts +3 -3
- package/dist/runtime/next/async.d.ts +3 -3
- package/dist/runtime/next/async.js +50 -30
- 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-DLIAvrgC.d.ts} +6 -32
- package/dist/{types-DT83Ijs6.d.cts → types-Dl8HLbm5.d.cts} +6 -32
- package/dist/vite/index.cjs +131 -143
- package/dist/vite/index.js +7 -7
- package/package.json +2 -6
- 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/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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
remarkInclude
|
|
3
|
+
} from "./chunk-KTDVTBMH.js";
|
|
4
|
+
|
|
5
|
+
// src/mdx/build-mdx.ts
|
|
6
|
+
import { createProcessor } from "@mdx-js/mdx";
|
|
7
|
+
|
|
8
|
+
// src/mdx/remark-postprocess.ts
|
|
9
|
+
import { visit } from "unist-util-visit";
|
|
10
|
+
import { toMarkdown } from "mdast-util-to-markdown";
|
|
11
|
+
import { valueToEstree } from "estree-util-value-to-estree";
|
|
12
|
+
function remarkPostprocess({
|
|
13
|
+
includeProcessedMarkdown = false,
|
|
14
|
+
valueToExport = []
|
|
15
|
+
} = {}) {
|
|
16
|
+
return (tree, file) => {
|
|
17
|
+
let title;
|
|
18
|
+
const urls = [];
|
|
19
|
+
visit(tree, ["heading", "link"], (node) => {
|
|
20
|
+
if (node.type === "heading" && node.depth === 1) {
|
|
21
|
+
title = flattenNode(node);
|
|
22
|
+
}
|
|
23
|
+
if (node.type !== "link") return;
|
|
24
|
+
urls.push({
|
|
25
|
+
href: node.url
|
|
26
|
+
});
|
|
27
|
+
return "skip";
|
|
28
|
+
});
|
|
29
|
+
if (title) {
|
|
30
|
+
file.data.frontmatter ??= {};
|
|
31
|
+
if (!file.data.frontmatter.title) file.data.frontmatter.title = title;
|
|
32
|
+
}
|
|
33
|
+
file.data.extractedReferences = urls;
|
|
34
|
+
if (includeProcessedMarkdown) {
|
|
35
|
+
file.data._markdown = toMarkdown(tree, {
|
|
36
|
+
...this.data("settings"),
|
|
37
|
+
// @ts-expect-error - from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js
|
|
38
|
+
extensions: this.data("toMarkdownExtensions") || []
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
for (const { name, value } of file.data["mdx-export"] ?? []) {
|
|
42
|
+
tree.children.unshift(getMdastExport(name, value));
|
|
43
|
+
}
|
|
44
|
+
for (const name of valueToExport) {
|
|
45
|
+
if (!(name in file.data)) continue;
|
|
46
|
+
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getMdastExport(name, value) {
|
|
51
|
+
return {
|
|
52
|
+
type: "mdxjsEsm",
|
|
53
|
+
value: "",
|
|
54
|
+
data: {
|
|
55
|
+
estree: {
|
|
56
|
+
type: "Program",
|
|
57
|
+
sourceType: "module",
|
|
58
|
+
body: [
|
|
59
|
+
{
|
|
60
|
+
type: "ExportNamedDeclaration",
|
|
61
|
+
attributes: [],
|
|
62
|
+
specifiers: [],
|
|
63
|
+
source: null,
|
|
64
|
+
declaration: {
|
|
65
|
+
type: "VariableDeclaration",
|
|
66
|
+
kind: "let",
|
|
67
|
+
declarations: [
|
|
68
|
+
{
|
|
69
|
+
type: "VariableDeclarator",
|
|
70
|
+
id: {
|
|
71
|
+
type: "Identifier",
|
|
72
|
+
name
|
|
73
|
+
},
|
|
74
|
+
init: valueToEstree(value)
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function flattenNode(node) {
|
|
85
|
+
if ("children" in node)
|
|
86
|
+
return node.children.map((child) => flattenNode(child)).join("");
|
|
87
|
+
if ("value" in node) return node.value;
|
|
88
|
+
return "";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/mdx/build-mdx.ts
|
|
92
|
+
var cache = /* @__PURE__ */ new Map();
|
|
93
|
+
async function buildMDX(cacheKey, source, options) {
|
|
94
|
+
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
95
|
+
function getProcessor(format) {
|
|
96
|
+
const key = `${cacheKey}:${format}`;
|
|
97
|
+
let processor = cache.get(key);
|
|
98
|
+
if (!processor) {
|
|
99
|
+
processor = createProcessor({
|
|
100
|
+
outputFormat: "program",
|
|
101
|
+
...rest,
|
|
102
|
+
remarkPlugins: [
|
|
103
|
+
remarkInclude,
|
|
104
|
+
...rest.remarkPlugins ?? [],
|
|
105
|
+
[
|
|
106
|
+
remarkPostprocess,
|
|
107
|
+
{
|
|
108
|
+
...options.postprocess,
|
|
109
|
+
valueToExport: [
|
|
110
|
+
...options.postprocess?.valueToExport ?? [],
|
|
111
|
+
"structuredData",
|
|
112
|
+
"extractedReferences",
|
|
113
|
+
"frontmatter",
|
|
114
|
+
"lastModified",
|
|
115
|
+
"_markdown"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
],
|
|
120
|
+
format
|
|
121
|
+
});
|
|
122
|
+
cache.set(key, processor);
|
|
123
|
+
}
|
|
124
|
+
return processor;
|
|
125
|
+
}
|
|
126
|
+
return getProcessor(
|
|
127
|
+
options.format ?? filePath.endsWith(".mdx") ? "mdx" : "md"
|
|
128
|
+
).process({
|
|
129
|
+
value: source,
|
|
130
|
+
path: filePath,
|
|
131
|
+
data: {
|
|
132
|
+
...data,
|
|
133
|
+
frontmatter,
|
|
134
|
+
_compiler,
|
|
135
|
+
_getProcessor: getProcessor
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
buildMDX
|
|
142
|
+
};
|
|
@@ -34,7 +34,7 @@ function buildConfig(config) {
|
|
|
34
34
|
const input = this.global.mdxOptions;
|
|
35
35
|
async function uncached() {
|
|
36
36
|
const options = typeof input === "function" ? await input() : input;
|
|
37
|
-
const { getDefaultMDXOptions } = await import("./
|
|
37
|
+
const { getDefaultMDXOptions } = await import("./preset-WFEORCAB.js");
|
|
38
38
|
if (options?.preset === "minimal") return options;
|
|
39
39
|
return getDefaultMDXOptions({
|
|
40
40
|
...options,
|
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/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/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,14 @@ function fumaMatter(input) {
|
|
|
264
185
|
return output;
|
|
265
186
|
}
|
|
266
187
|
|
|
267
|
-
// src/mdx
|
|
188
|
+
// src/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
192
|
var baseProcessor = (0, import_unified.unified)().use(import_mdx_plugins.remarkHeading);
|
|
272
|
-
function
|
|
193
|
+
function flattenNode(node) {
|
|
273
194
|
if ("children" in node)
|
|
274
|
-
return node.children.map((child) =>
|
|
195
|
+
return node.children.map((child) => flattenNode(child)).join("");
|
|
275
196
|
if ("value" in node) return node.value;
|
|
276
197
|
return "";
|
|
277
198
|
}
|
|
@@ -350,14 +271,14 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
350
271
|
}
|
|
351
272
|
async function update(tree, directory, data) {
|
|
352
273
|
const queue = [];
|
|
353
|
-
(0,
|
|
274
|
+
(0, import_unist_util_visit.visit)(
|
|
354
275
|
tree,
|
|
355
276
|
["mdxJsxFlowElement", "mdxJsxTextElement"],
|
|
356
277
|
(_node, _, parent) => {
|
|
357
278
|
const node = _node;
|
|
358
279
|
if (node.name !== TagName) return;
|
|
359
280
|
const params = {};
|
|
360
|
-
const specifier =
|
|
281
|
+
const specifier = flattenNode(node);
|
|
361
282
|
if (specifier.length === 0) return "skip";
|
|
362
283
|
for (const attr of node.attributes) {
|
|
363
284
|
if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
|
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-3M4SHY6K.js";
|
|
11
4
|
import {
|
|
12
5
|
remarkInclude
|
|
13
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-KTDVTBMH.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 };
|