fumadocs-mdx 14.2.2 → 14.2.4
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/adapter-DG-viEbG.js +144 -0
- package/dist/adapter-DG-viEbG.js.map +1 -0
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +21 -12
- package/dist/bin.js.map +1 -0
- package/dist/build-BTTNEFmV.js +100 -0
- package/dist/build-BTTNEFmV.js.map +1 -0
- package/dist/build-mdx-10MrLupc.d.ts +53 -0
- package/dist/build-mdx-10MrLupc.d.ts.map +1 -0
- package/dist/build-mdx-BVeBo4jT.js +153 -0
- package/dist/build-mdx-BVeBo4jT.js.map +1 -0
- package/dist/build-mdx-ChjP7zAn.js +5 -0
- package/dist/bun/index.d.ts +10 -21
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +30 -49
- package/dist/bun/index.js.map +1 -0
- package/dist/codegen-DleOVLNr.js +101 -0
- package/dist/codegen-DleOVLNr.js.map +1 -0
- package/dist/config/index.d.ts +2 -18
- package/dist/config/index.js +50 -53
- package/dist/config/index.js.map +1 -0
- package/dist/core-DG43f_AU.d.ts +364 -0
- package/dist/core-DG43f_AU.d.ts.map +1 -0
- package/dist/core-DjldE3H9.js +212 -0
- package/dist/core-DjldE3H9.js.map +1 -0
- package/dist/fuma-matter-CHgJa_-B.js +27 -0
- package/dist/fuma-matter-CHgJa_-B.js.map +1 -0
- package/dist/index-Bc_4I1HE.d.ts +12 -0
- package/dist/index-Bc_4I1HE.d.ts.map +1 -0
- package/dist/index-file-D9HsrWU_.js +264 -0
- package/dist/index-file-D9HsrWU_.js.map +1 -0
- package/dist/index.d.ts +3 -61
- package/dist/index.js +1 -0
- package/dist/load-from-file-B7Rswy9i.js +5 -0
- package/dist/load-from-file-Doc98oEB.js +38 -0
- package/dist/load-from-file-Doc98oEB.js.map +1 -0
- package/dist/loaders-BVwYfelL.js +7 -0
- package/dist/loaders-BVwYfelL.js.map +1 -0
- package/dist/mdx-DMZ9tsAa.js +91 -0
- package/dist/mdx-DMZ9tsAa.js.map +1 -0
- package/dist/meta-DyieTM4Z.js +81 -0
- package/dist/meta-DyieTM4Z.js.map +1 -0
- package/dist/next/index.cjs +863 -1076
- package/dist/next/index.d.ts +17 -28
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +141 -170
- package/dist/next/index.js.map +1 -0
- package/dist/node/loader.d.ts +4 -2
- package/dist/node/loader.d.ts.map +1 -0
- package/dist/node/loader.js +26 -38
- package/dist/node/loader.js.map +1 -0
- package/dist/plugins/index-file.d.ts +2 -14
- package/dist/plugins/index-file.js +5 -8
- package/dist/plugins/json-schema.d.ts +14 -23
- package/dist/plugins/json-schema.d.ts.map +1 -0
- package/dist/plugins/json-schema.js +70 -78
- package/dist/plugins/json-schema.js.map +1 -0
- package/dist/plugins/last-modified.d.ts +21 -32
- package/dist/plugins/last-modified.d.ts.map +1 -0
- package/dist/plugins/last-modified.js +70 -78
- package/dist/plugins/last-modified.js.map +1 -0
- package/dist/preset-gmDZnBcg.js +61 -0
- package/dist/preset-gmDZnBcg.js.map +1 -0
- package/dist/remark-include-D3G3mAnv.js +247 -0
- package/dist/remark-include-D3G3mAnv.js.map +1 -0
- package/dist/runtime/browser.d.ts +32 -41
- package/dist/runtime/browser.d.ts.map +1 -0
- package/dist/runtime/browser.js +56 -63
- package/dist/runtime/browser.js.map +1 -0
- package/dist/runtime/dynamic.d.ts +13 -21
- package/dist/runtime/dynamic.d.ts.map +1 -0
- package/dist/runtime/dynamic.js +64 -76
- package/dist/runtime/dynamic.js.map +1 -0
- package/dist/runtime/server.d.ts +2 -14
- package/dist/runtime/server.js +111 -8
- package/dist/runtime/server.js.map +1 -0
- package/dist/runtime/types.d.ts +2 -61
- package/dist/runtime/types.js +1 -0
- package/dist/types-B6myALSk.d.ts +63 -0
- package/dist/types-B6myALSk.d.ts.map +1 -0
- package/dist/vite/index.d.ts +28 -39
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +79 -122
- package/dist/vite/index.js.map +1 -0
- package/dist/webpack/mdx.d.ts +6 -3
- package/dist/webpack/mdx.d.ts.map +1 -0
- package/dist/webpack/mdx.js +21 -34
- package/dist/webpack/mdx.js.map +1 -0
- package/dist/webpack/meta.d.ts +6 -3
- package/dist/webpack/meta.d.ts.map +1 -0
- package/dist/webpack/meta.js +23 -37
- package/dist/webpack/meta.js.map +1 -0
- package/dist/webpack--VSEE6Zp.js +15 -0
- package/dist/webpack--VSEE6Zp.js.map +1 -0
- package/loader-mdx.cjs +1 -3
- package/loader-meta.cjs +1 -3
- package/package.json +38 -38
- package/dist/build-mdx-5XLFMP5P.js +0 -8
- package/dist/chunk-257RZJEQ.js +0 -17
- package/dist/chunk-2PY3JUIC.js +0 -126
- package/dist/chunk-4EUH5CD2.js +0 -173
- package/dist/chunk-4JSFLXXT.js +0 -8
- package/dist/chunk-5OBUOALK.js +0 -141
- package/dist/chunk-DTFUANSF.js +0 -40
- package/dist/chunk-KWSETXYC.js +0 -274
- package/dist/chunk-OLD35ARB.js +0 -116
- package/dist/chunk-S7KOJHHO.js +0 -89
- package/dist/chunk-STLEUNK7.js +0 -335
- package/dist/chunk-USQZ5OLE.js +0 -116
- package/dist/chunk-VWJKRQZR.js +0 -19
- package/dist/chunk-WFDF56IJ.js +0 -290
- package/dist/chunk-WSQ23PNV.js +0 -179
- package/dist/chunk-ZAYZWFWP.js +0 -89
- package/dist/core-X5ggQtBM.d.ts +0 -350
- package/dist/index-BqkSNsGO.d.ts +0 -8
- package/dist/load-from-file-FHW724YY.js +0 -8
package/dist/chunk-2PY3JUIC.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// src/utils/codegen.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { glob } from "tinyglobby";
|
|
4
|
-
function createCodegen({
|
|
5
|
-
target = "default",
|
|
6
|
-
outDir = "",
|
|
7
|
-
jsExtension = false,
|
|
8
|
-
globCache = /* @__PURE__ */ new Map()
|
|
9
|
-
}) {
|
|
10
|
-
let eagerImportId = 0;
|
|
11
|
-
const banner = ["// @ts-nocheck"];
|
|
12
|
-
if (target === "vite") {
|
|
13
|
-
banner.push('/// <reference types="vite/client" />');
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
options: {
|
|
17
|
-
target,
|
|
18
|
-
outDir
|
|
19
|
-
},
|
|
20
|
-
lines: [],
|
|
21
|
-
addImport(statement) {
|
|
22
|
-
this.lines.unshift(statement);
|
|
23
|
-
},
|
|
24
|
-
async pushAsync(insert) {
|
|
25
|
-
for (const line of await Promise.all(insert)) {
|
|
26
|
-
if (line === void 0) continue;
|
|
27
|
-
this.lines.push(line);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
async generateGlobImport(patterns, options) {
|
|
31
|
-
if (target === "vite") {
|
|
32
|
-
return this.generateViteGlobImport(patterns, options);
|
|
33
|
-
}
|
|
34
|
-
return this.generateNodeGlobImport(patterns, options);
|
|
35
|
-
},
|
|
36
|
-
generateViteGlobImport(patterns, { base, ...rest }) {
|
|
37
|
-
patterns = (typeof patterns === "string" ? [patterns] : patterns).map(
|
|
38
|
-
normalizeViteGlobPath
|
|
39
|
-
);
|
|
40
|
-
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(
|
|
41
|
-
{
|
|
42
|
-
base: normalizeViteGlobPath(path.relative(outDir, base)),
|
|
43
|
-
...rest
|
|
44
|
-
},
|
|
45
|
-
null,
|
|
46
|
-
2
|
|
47
|
-
)})`;
|
|
48
|
-
},
|
|
49
|
-
async generateNodeGlobImport(patterns, {
|
|
50
|
-
base,
|
|
51
|
-
eager = false,
|
|
52
|
-
query = {},
|
|
53
|
-
import: importName
|
|
54
|
-
}) {
|
|
55
|
-
const cacheKey = JSON.stringify({ patterns, base });
|
|
56
|
-
let files = globCache.get(cacheKey);
|
|
57
|
-
if (!files) {
|
|
58
|
-
files = glob(patterns, {
|
|
59
|
-
cwd: base
|
|
60
|
-
});
|
|
61
|
-
globCache.set(cacheKey, files);
|
|
62
|
-
}
|
|
63
|
-
let code = "{";
|
|
64
|
-
for (const item of await files) {
|
|
65
|
-
const fullPath = path.join(base, item);
|
|
66
|
-
const searchParams = new URLSearchParams();
|
|
67
|
-
for (const [k, v] of Object.entries(query)) {
|
|
68
|
-
if (v !== void 0) searchParams.set(k, v);
|
|
69
|
-
}
|
|
70
|
-
const importPath = this.formatImportPath(fullPath) + "?" + searchParams.toString();
|
|
71
|
-
if (eager) {
|
|
72
|
-
const name = `__fd_glob_${eagerImportId++}`;
|
|
73
|
-
this.lines.unshift(
|
|
74
|
-
importName ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}` : `import * as ${name} from ${JSON.stringify(importPath)}`
|
|
75
|
-
);
|
|
76
|
-
code += `${JSON.stringify(item)}: ${name}, `;
|
|
77
|
-
} else {
|
|
78
|
-
let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;
|
|
79
|
-
if (importName) {
|
|
80
|
-
line += `.then(mod => mod.${importName})`;
|
|
81
|
-
}
|
|
82
|
-
code += `${line}, `;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
code += "}";
|
|
86
|
-
return code;
|
|
87
|
-
},
|
|
88
|
-
formatImportPath(file) {
|
|
89
|
-
const ext = path.extname(file);
|
|
90
|
-
let filename;
|
|
91
|
-
if (ext === ".ts") {
|
|
92
|
-
filename = file.substring(0, file.length - ext.length);
|
|
93
|
-
if (jsExtension) filename += ".js";
|
|
94
|
-
} else {
|
|
95
|
-
filename = file;
|
|
96
|
-
}
|
|
97
|
-
const importPath = slash(path.relative(outDir, filename));
|
|
98
|
-
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
99
|
-
},
|
|
100
|
-
toString() {
|
|
101
|
-
return [...banner, ...this.lines].join("\n");
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function normalizeViteGlobPath(file) {
|
|
106
|
-
file = slash(file);
|
|
107
|
-
if (file.startsWith("./")) return file;
|
|
108
|
-
if (file.startsWith("/")) return `.${file}`;
|
|
109
|
-
return `./${file}`;
|
|
110
|
-
}
|
|
111
|
-
function slash(path2) {
|
|
112
|
-
const isExtendedLengthPath = path2.startsWith("\\\\?\\");
|
|
113
|
-
if (isExtendedLengthPath) {
|
|
114
|
-
return path2;
|
|
115
|
-
}
|
|
116
|
-
return path2.replaceAll("\\", "/");
|
|
117
|
-
}
|
|
118
|
-
function ident(code, tab = 1) {
|
|
119
|
-
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
createCodegen,
|
|
124
|
-
slash,
|
|
125
|
-
ident
|
|
126
|
-
};
|
package/dist/chunk-4EUH5CD2.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
flattenNode,
|
|
3
|
-
remarkInclude
|
|
4
|
-
} from "./chunk-WFDF56IJ.js";
|
|
5
|
-
|
|
6
|
-
// src/loaders/mdx/build-mdx.ts
|
|
7
|
-
import { createProcessor } from "@mdx-js/mdx";
|
|
8
|
-
import { VFile } from "vfile";
|
|
9
|
-
|
|
10
|
-
// src/loaders/mdx/remark-postprocess.ts
|
|
11
|
-
import { visit } from "unist-util-visit";
|
|
12
|
-
import { toMarkdown } from "mdast-util-to-markdown";
|
|
13
|
-
import { valueToEstree } from "estree-util-value-to-estree";
|
|
14
|
-
import { removePosition } from "unist-util-remove-position";
|
|
15
|
-
import remarkMdx from "remark-mdx";
|
|
16
|
-
function remarkPostprocess({
|
|
17
|
-
_format,
|
|
18
|
-
includeProcessedMarkdown = false,
|
|
19
|
-
includeMDAST = false,
|
|
20
|
-
extractLinkReferences = false,
|
|
21
|
-
valueToExport = []
|
|
22
|
-
}) {
|
|
23
|
-
let _stringifyProcessor;
|
|
24
|
-
const getStringifyProcessor = () => {
|
|
25
|
-
return _stringifyProcessor ??= _format === "mdx" ? this : (
|
|
26
|
-
// force Markdown processor to stringify MDX nodes
|
|
27
|
-
this().use(remarkMdx).freeze()
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
return (tree, file) => {
|
|
31
|
-
const frontmatter = file.data.frontmatter ??= {};
|
|
32
|
-
if (!frontmatter.title) {
|
|
33
|
-
visit(tree, "heading", (node) => {
|
|
34
|
-
if (node.depth === 1) {
|
|
35
|
-
frontmatter.title = flattenNode(node);
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
file.data["mdx-export"] ??= [];
|
|
41
|
-
file.data["mdx-export"].push({
|
|
42
|
-
name: "frontmatter",
|
|
43
|
-
value: frontmatter
|
|
44
|
-
});
|
|
45
|
-
if (extractLinkReferences) {
|
|
46
|
-
const urls = [];
|
|
47
|
-
visit(tree, "link", (node) => {
|
|
48
|
-
urls.push({
|
|
49
|
-
href: node.url
|
|
50
|
-
});
|
|
51
|
-
return "skip";
|
|
52
|
-
});
|
|
53
|
-
file.data["mdx-export"].push({
|
|
54
|
-
name: "extractedReferences",
|
|
55
|
-
value: urls
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (includeProcessedMarkdown) {
|
|
59
|
-
const processor = getStringifyProcessor();
|
|
60
|
-
const markdown = toMarkdown(tree, {
|
|
61
|
-
...processor.data("settings"),
|
|
62
|
-
// from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js
|
|
63
|
-
extensions: processor.data("toMarkdownExtensions") || []
|
|
64
|
-
});
|
|
65
|
-
file.data["mdx-export"].push({
|
|
66
|
-
name: "_markdown",
|
|
67
|
-
value: markdown
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (includeMDAST) {
|
|
71
|
-
const options = includeMDAST === true ? {} : includeMDAST;
|
|
72
|
-
const mdast = JSON.stringify(
|
|
73
|
-
options.removePosition ? removePosition(structuredClone(tree)) : tree
|
|
74
|
-
);
|
|
75
|
-
file.data["mdx-export"].push({
|
|
76
|
-
name: "_mdast",
|
|
77
|
-
value: mdast
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
for (const { name, value } of file.data["mdx-export"]) {
|
|
81
|
-
tree.children.unshift(getMdastExport(name, value));
|
|
82
|
-
}
|
|
83
|
-
file.data["mdx-export"] = [];
|
|
84
|
-
for (const name of valueToExport) {
|
|
85
|
-
if (!(name in file.data)) continue;
|
|
86
|
-
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function getMdastExport(name, value) {
|
|
91
|
-
return {
|
|
92
|
-
type: "mdxjsEsm",
|
|
93
|
-
value: "",
|
|
94
|
-
data: {
|
|
95
|
-
estree: {
|
|
96
|
-
type: "Program",
|
|
97
|
-
sourceType: "module",
|
|
98
|
-
body: [
|
|
99
|
-
{
|
|
100
|
-
type: "ExportNamedDeclaration",
|
|
101
|
-
attributes: [],
|
|
102
|
-
specifiers: [],
|
|
103
|
-
source: null,
|
|
104
|
-
declaration: {
|
|
105
|
-
type: "VariableDeclaration",
|
|
106
|
-
kind: "let",
|
|
107
|
-
declarations: [
|
|
108
|
-
{
|
|
109
|
-
type: "VariableDeclarator",
|
|
110
|
-
id: {
|
|
111
|
-
type: "Identifier",
|
|
112
|
-
name
|
|
113
|
-
},
|
|
114
|
-
init: valueToEstree(value)
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// src/loaders/mdx/build-mdx.ts
|
|
126
|
-
async function buildMDX(core, collection, {
|
|
127
|
-
filePath,
|
|
128
|
-
frontmatter,
|
|
129
|
-
source,
|
|
130
|
-
_compiler,
|
|
131
|
-
environment,
|
|
132
|
-
isDevelopment
|
|
133
|
-
}) {
|
|
134
|
-
const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);
|
|
135
|
-
function getProcessor(format) {
|
|
136
|
-
const cache = core.cache;
|
|
137
|
-
const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
|
|
138
|
-
let processor = cache.get(key);
|
|
139
|
-
if (!processor) {
|
|
140
|
-
const postprocessOptions = {
|
|
141
|
-
_format: format,
|
|
142
|
-
...collection?.postprocess
|
|
143
|
-
};
|
|
144
|
-
processor = createProcessor({
|
|
145
|
-
outputFormat: "program",
|
|
146
|
-
development: isDevelopment,
|
|
147
|
-
...mdxOptions,
|
|
148
|
-
remarkPlugins: [
|
|
149
|
-
remarkInclude,
|
|
150
|
-
...mdxOptions.remarkPlugins ?? [],
|
|
151
|
-
[remarkPostprocess, postprocessOptions]
|
|
152
|
-
],
|
|
153
|
-
format
|
|
154
|
-
});
|
|
155
|
-
cache.set(key, processor);
|
|
156
|
-
}
|
|
157
|
-
return processor;
|
|
158
|
-
}
|
|
159
|
-
let vfile = new VFile({
|
|
160
|
-
value: source,
|
|
161
|
-
path: filePath,
|
|
162
|
-
cwd: collection?.cwd,
|
|
163
|
-
data: { frontmatter, _compiler, _getProcessor: getProcessor }
|
|
164
|
-
});
|
|
165
|
-
if (collection) {
|
|
166
|
-
vfile = await core.transformVFile({ collection, filePath, source }, vfile);
|
|
167
|
-
}
|
|
168
|
-
return getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md").process(vfile);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export {
|
|
172
|
-
buildMDX
|
|
173
|
-
};
|
package/dist/chunk-4JSFLXXT.js
DELETED
package/dist/chunk-5OBUOALK.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// src/runtime/server.ts
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
function server(options = {}) {
|
|
4
|
-
const { doc: { passthroughs: docPassthroughs = [] } = {} } = options;
|
|
5
|
-
function fileInfo(file, base) {
|
|
6
|
-
if (file.startsWith("./")) {
|
|
7
|
-
file = file.slice(2);
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
path: file,
|
|
11
|
-
fullPath: path.join(base, file)
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function mapDocData(entry) {
|
|
15
|
-
const data = {
|
|
16
|
-
body: entry.default,
|
|
17
|
-
toc: entry.toc,
|
|
18
|
-
structuredData: entry.structuredData,
|
|
19
|
-
_exports: entry
|
|
20
|
-
};
|
|
21
|
-
for (const key of docPassthroughs) {
|
|
22
|
-
data[key] = entry[key];
|
|
23
|
-
}
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
async doc(_name, base, glob) {
|
|
28
|
-
const out = await Promise.all(
|
|
29
|
-
Object.entries(glob).map(async ([k, v]) => {
|
|
30
|
-
const data = typeof v === "function" ? await v() : v;
|
|
31
|
-
return {
|
|
32
|
-
...mapDocData(data),
|
|
33
|
-
...data.frontmatter,
|
|
34
|
-
...createDocMethods(fileInfo(k, base), () => data)
|
|
35
|
-
};
|
|
36
|
-
})
|
|
37
|
-
);
|
|
38
|
-
return out;
|
|
39
|
-
},
|
|
40
|
-
async docLazy(_name, base, head, body) {
|
|
41
|
-
const out = await Promise.all(
|
|
42
|
-
Object.entries(head).map(async ([k, v]) => {
|
|
43
|
-
const data = typeof v === "function" ? await v() : v;
|
|
44
|
-
const content = body[k];
|
|
45
|
-
return {
|
|
46
|
-
...data,
|
|
47
|
-
...createDocMethods(fileInfo(k, base), content),
|
|
48
|
-
async load() {
|
|
49
|
-
return mapDocData(await content());
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
})
|
|
53
|
-
);
|
|
54
|
-
return out;
|
|
55
|
-
},
|
|
56
|
-
async meta(_name, base, glob) {
|
|
57
|
-
const out = await Promise.all(
|
|
58
|
-
Object.entries(glob).map(async ([k, v]) => {
|
|
59
|
-
const data = typeof v === "function" ? await v() : v;
|
|
60
|
-
return {
|
|
61
|
-
info: fileInfo(k, base),
|
|
62
|
-
...data
|
|
63
|
-
};
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
return out;
|
|
67
|
-
},
|
|
68
|
-
async docs(name, base, metaGlob, docGlob) {
|
|
69
|
-
const entry = {
|
|
70
|
-
docs: await this.doc(name, base, docGlob),
|
|
71
|
-
meta: await this.meta(name, base, metaGlob),
|
|
72
|
-
toFumadocsSource() {
|
|
73
|
-
return toFumadocsSource(this.docs, this.meta);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return entry;
|
|
77
|
-
},
|
|
78
|
-
async docsLazy(name, base, metaGlob, docHeadGlob, docBodyGlob) {
|
|
79
|
-
const entry = {
|
|
80
|
-
docs: await this.docLazy(name, base, docHeadGlob, docBodyGlob),
|
|
81
|
-
meta: await this.meta(name, base, metaGlob),
|
|
82
|
-
toFumadocsSource() {
|
|
83
|
-
return toFumadocsSource(this.docs, this.meta);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return entry;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function toFumadocsSource(pages, metas) {
|
|
91
|
-
const files = [];
|
|
92
|
-
for (const entry of pages) {
|
|
93
|
-
files.push({
|
|
94
|
-
type: "page",
|
|
95
|
-
path: entry.info.path,
|
|
96
|
-
absolutePath: entry.info.fullPath,
|
|
97
|
-
data: entry
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
for (const entry of metas) {
|
|
101
|
-
files.push({
|
|
102
|
-
type: "meta",
|
|
103
|
-
path: entry.info.path,
|
|
104
|
-
absolutePath: entry.info.fullPath,
|
|
105
|
-
data: entry
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
files
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function createDocMethods(info, load) {
|
|
113
|
-
return {
|
|
114
|
-
info,
|
|
115
|
-
async getText(type) {
|
|
116
|
-
if (type === "raw") {
|
|
117
|
-
const fs = await import("fs/promises");
|
|
118
|
-
return (await fs.readFile(info.fullPath)).toString();
|
|
119
|
-
}
|
|
120
|
-
const data = await load();
|
|
121
|
-
if (typeof data._markdown !== "string")
|
|
122
|
-
throw new Error(
|
|
123
|
-
"getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config."
|
|
124
|
-
);
|
|
125
|
-
return data._markdown;
|
|
126
|
-
},
|
|
127
|
-
async getMDAST() {
|
|
128
|
-
const data = await load();
|
|
129
|
-
if (!data._mdast)
|
|
130
|
-
throw new Error(
|
|
131
|
-
"getMDAST() requires `includeMDAST` to be enabled in your collection config."
|
|
132
|
-
);
|
|
133
|
-
return JSON.parse(data._mdast);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export {
|
|
139
|
-
server,
|
|
140
|
-
toFumadocsSource
|
|
141
|
-
};
|
package/dist/chunk-DTFUANSF.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildConfig
|
|
3
|
-
} from "./chunk-OLD35ARB.js";
|
|
4
|
-
|
|
5
|
-
// src/config/load-from-file.ts
|
|
6
|
-
import { pathToFileURL } from "url";
|
|
7
|
-
async function compileConfig(core) {
|
|
8
|
-
const { build } = await import("esbuild");
|
|
9
|
-
const { configPath, outDir } = core.getOptions();
|
|
10
|
-
const transformed = await build({
|
|
11
|
-
entryPoints: [{ in: configPath, out: "source.config" }],
|
|
12
|
-
bundle: true,
|
|
13
|
-
outdir: outDir,
|
|
14
|
-
target: "node20",
|
|
15
|
-
write: true,
|
|
16
|
-
platform: "node",
|
|
17
|
-
format: "esm",
|
|
18
|
-
packages: "external",
|
|
19
|
-
outExtension: {
|
|
20
|
-
".js": ".mjs"
|
|
21
|
-
},
|
|
22
|
-
allowOverwrite: true
|
|
23
|
-
});
|
|
24
|
-
if (transformed.errors.length > 0) {
|
|
25
|
-
throw new Error("failed to compile configuration file");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async function loadConfig(core, build = false) {
|
|
29
|
-
if (build) await compileConfig(core);
|
|
30
|
-
const url = pathToFileURL(core.getCompiledConfigPath());
|
|
31
|
-
url.searchParams.set("hash", Date.now().toString());
|
|
32
|
-
const config = import(url.href).then(
|
|
33
|
-
(loaded) => buildConfig(loaded)
|
|
34
|
-
);
|
|
35
|
-
return await config;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
loadConfig
|
|
40
|
-
};
|