fumadocs-mdx 14.2.3 → 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 +35 -35
- 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-RSASAHLX.js +0 -91
- 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-XYVVDDIF.js +0 -180
- 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/bun/index.js
CHANGED
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "../
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "../
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
} from "../chunk-RSASAHLX.js";
|
|
11
|
-
import {
|
|
12
|
-
createIntegratedConfigLoader,
|
|
13
|
-
toBun
|
|
14
|
-
} from "../chunk-XYVVDDIF.js";
|
|
15
|
-
import "../chunk-4JSFLXXT.js";
|
|
16
|
-
import {
|
|
17
|
-
_Defaults,
|
|
18
|
-
createCore
|
|
19
|
-
} from "../chunk-KWSETXYC.js";
|
|
20
|
-
import "../chunk-2PY3JUIC.js";
|
|
21
|
-
import "../chunk-VWJKRQZR.js";
|
|
1
|
+
import "../fuma-matter-CHgJa_-B.js";
|
|
2
|
+
import { t as createMdxLoader } from "../mdx-DMZ9tsAa.js";
|
|
3
|
+
import "../preset-gmDZnBcg.js";
|
|
4
|
+
import { t as buildConfig } from "../build-BTTNEFmV.js";
|
|
5
|
+
import { n as createCore, t as _Defaults } from "../core-DjldE3H9.js";
|
|
6
|
+
import "../codegen-DleOVLNr.js";
|
|
7
|
+
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DG-viEbG.js";
|
|
8
|
+
import { t as createMetaLoader } from "../meta-DyieTM4Z.js";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
import { pathToFileURL } from "url";
|
|
11
|
+
//#region src/bun/index.ts
|
|
25
12
|
function createMdxPlugin(options = {}) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
config: buildConfig(await import(importPath))
|
|
43
|
-
});
|
|
44
|
-
const configLoader = createIntegratedConfigLoader(core);
|
|
45
|
-
toBun(createMdxLoader(configLoader))(build);
|
|
46
|
-
if (!disableMetaFile) toBun(createMetaLoader(configLoader))(build);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
13
|
+
const { environment = "bun", outDir = _Defaults.outDir, configPath = _Defaults.configPath, disableMetaFile = false } = options;
|
|
14
|
+
return {
|
|
15
|
+
name: "bun-plugin-fumadocs-mdx",
|
|
16
|
+
async setup(build) {
|
|
17
|
+
const importPath = pathToFileURL(configPath).href;
|
|
18
|
+
const core = createCore({
|
|
19
|
+
environment,
|
|
20
|
+
outDir,
|
|
21
|
+
configPath
|
|
22
|
+
});
|
|
23
|
+
await core.init({ config: buildConfig(await import(importPath)) });
|
|
24
|
+
const configLoader = createIntegratedConfigLoader(core);
|
|
25
|
+
toBun(createMdxLoader(configLoader))(build);
|
|
26
|
+
if (!disableMetaFile) toBun(createMetaLoader(configLoader))(build);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
49
29
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createMdxPlugin };
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":["import type { BunPlugin } from 'bun';\nimport { createMdxLoader } from '@/loaders/mdx';\nimport { buildConfig } from '@/config/build';\nimport { pathToFileURL } from 'node:url';\nimport { _Defaults, type CoreOptions, createCore } from '@/core';\nimport { createIntegratedConfigLoader } from '@/loaders/config';\nimport { createMetaLoader } from '@/loaders/meta';\nimport { toBun } from '@/loaders/adapter';\n\nexport interface MdxPluginOptions extends Partial<CoreOptions> {\n /**\n * Skip meta file transformation step\n */\n disableMetaFile?: boolean;\n}\n\nexport function createMdxPlugin(options: MdxPluginOptions = {}): BunPlugin {\n const {\n environment = 'bun',\n outDir = _Defaults.outDir,\n configPath = _Defaults.configPath,\n disableMetaFile = false,\n } = options;\n\n return {\n name: 'bun-plugin-fumadocs-mdx',\n async setup(build) {\n const importPath = pathToFileURL(configPath).href;\n const core = createCore({\n environment,\n outDir,\n configPath,\n });\n\n await core.init({\n config: buildConfig(await import(importPath)),\n });\n\n const configLoader = createIntegratedConfigLoader(core);\n toBun(createMdxLoader(configLoader))(build);\n if (!disableMetaFile) toBun(createMetaLoader(configLoader))(build);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,gBAAgB,UAA4B,EAAE,EAAa;CACzE,MAAM,EACJ,cAAc,OACd,SAAS,UAAU,QACnB,aAAa,UAAU,YACvB,kBAAkB,UAChB;AAEJ,QAAO;EACL,MAAM;EACN,MAAM,MAAM,OAAO;GACjB,MAAM,aAAa,cAAc,WAAW,CAAC;GAC7C,MAAM,OAAO,WAAW;IACtB;IACA;IACA;IACD,CAAC;AAEF,SAAM,KAAK,KAAK,EACd,QAAQ,YAAY,MAAM,OAAO,YAAY,EAC9C,CAAC;GAEF,MAAM,eAAe,6BAA6B,KAAK;AACvD,SAAM,gBAAgB,aAAa,CAAC,CAAC,MAAM;AAC3C,OAAI,CAAC,gBAAiB,OAAM,iBAAiB,aAAa,CAAC,CAAC,MAAM;;EAErE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { glob } from "tinyglobby";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/codegen.ts
|
|
5
|
+
/**
|
|
6
|
+
* Code generator (one instance per file)
|
|
7
|
+
*/
|
|
8
|
+
function createCodegen({ target = "default", outDir = "", jsExtension = false, globCache = /* @__PURE__ */ new Map() }) {
|
|
9
|
+
let eagerImportId = 0;
|
|
10
|
+
const banner = ["// @ts-nocheck"];
|
|
11
|
+
if (target === "vite") banner.push("/// <reference types=\"vite/client\" />");
|
|
12
|
+
return {
|
|
13
|
+
options: {
|
|
14
|
+
target,
|
|
15
|
+
outDir
|
|
16
|
+
},
|
|
17
|
+
lines: [],
|
|
18
|
+
addImport(statement) {
|
|
19
|
+
this.lines.unshift(statement);
|
|
20
|
+
},
|
|
21
|
+
async pushAsync(insert) {
|
|
22
|
+
for (const line of await Promise.all(insert)) {
|
|
23
|
+
if (line === void 0) continue;
|
|
24
|
+
this.lines.push(line);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
async generateGlobImport(patterns, options) {
|
|
28
|
+
if (target === "vite") return this.generateViteGlobImport(patterns, options);
|
|
29
|
+
return this.generateNodeGlobImport(patterns, options);
|
|
30
|
+
},
|
|
31
|
+
generateViteGlobImport(patterns, { base, ...rest }) {
|
|
32
|
+
patterns = (typeof patterns === "string" ? [patterns] : patterns).map(normalizeViteGlobPath);
|
|
33
|
+
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify({
|
|
34
|
+
base: normalizeViteGlobPath(path.relative(outDir, base)),
|
|
35
|
+
...rest
|
|
36
|
+
}, null, 2)})`;
|
|
37
|
+
},
|
|
38
|
+
async generateNodeGlobImport(patterns, { base, eager = false, query = {}, import: importName }) {
|
|
39
|
+
const cacheKey = JSON.stringify({
|
|
40
|
+
patterns,
|
|
41
|
+
base
|
|
42
|
+
});
|
|
43
|
+
let files = globCache.get(cacheKey);
|
|
44
|
+
if (!files) {
|
|
45
|
+
files = glob(patterns, { cwd: base });
|
|
46
|
+
globCache.set(cacheKey, files);
|
|
47
|
+
}
|
|
48
|
+
let code = "{";
|
|
49
|
+
for (const item of await files) {
|
|
50
|
+
const fullPath = path.join(base, item);
|
|
51
|
+
const searchParams = new URLSearchParams();
|
|
52
|
+
for (const [k, v] of Object.entries(query)) if (v !== void 0) searchParams.set(k, v);
|
|
53
|
+
const importPath = this.formatImportPath(fullPath) + "?" + searchParams.toString();
|
|
54
|
+
if (eager) {
|
|
55
|
+
const name = `__fd_glob_${eagerImportId++}`;
|
|
56
|
+
this.lines.unshift(importName ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}` : `import * as ${name} from ${JSON.stringify(importPath)}`);
|
|
57
|
+
code += `${JSON.stringify(item)}: ${name}, `;
|
|
58
|
+
} else {
|
|
59
|
+
let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;
|
|
60
|
+
if (importName) line += `.then(mod => mod.${importName})`;
|
|
61
|
+
code += `${line}, `;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
code += "}";
|
|
65
|
+
return code;
|
|
66
|
+
},
|
|
67
|
+
formatImportPath(file) {
|
|
68
|
+
const ext = path.extname(file);
|
|
69
|
+
let filename;
|
|
70
|
+
if (ext === ".ts") {
|
|
71
|
+
filename = file.substring(0, file.length - ext.length);
|
|
72
|
+
if (jsExtension) filename += ".js";
|
|
73
|
+
} else filename = file;
|
|
74
|
+
const importPath = slash(path.relative(outDir, filename));
|
|
75
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
76
|
+
},
|
|
77
|
+
toString() {
|
|
78
|
+
return [...banner, ...this.lines].join("\n");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* convert into POSIX & relative file paths, such that Vite can accept it.
|
|
84
|
+
*/
|
|
85
|
+
function normalizeViteGlobPath(file) {
|
|
86
|
+
file = slash(file);
|
|
87
|
+
if (file.startsWith("./")) return file;
|
|
88
|
+
if (file.startsWith("/")) return `.${file}`;
|
|
89
|
+
return `./${file}`;
|
|
90
|
+
}
|
|
91
|
+
function slash(path$1) {
|
|
92
|
+
if (path$1.startsWith("\\\\?\\")) return path$1;
|
|
93
|
+
return path$1.replaceAll("\\", "/");
|
|
94
|
+
}
|
|
95
|
+
function ident(code, tab = 1) {
|
|
96
|
+
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { ident as n, slash as r, createCodegen as t };
|
|
101
|
+
//# sourceMappingURL=codegen-DleOVLNr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-DleOVLNr.js","names":["banner: string[]","code: string","filename: string","path"],"sources":["../src/utils/codegen.ts"],"sourcesContent":["import path from 'node:path';\nimport { glob } from 'tinyglobby';\n\nexport interface GlobImportOptions {\n base: string;\n query?: Record<string, string | undefined>;\n import?: string;\n eager?: boolean;\n}\n\nexport interface CodeGenOptions {\n target: 'default' | 'vite';\n outDir: string;\n /**\n * add .js extenstion to imports\n */\n jsExtension: boolean;\n globCache: Map<string, Promise<string[]>>;\n}\n\nexport type CodeGen = ReturnType<typeof createCodegen>;\n\n/**\n * Code generator (one instance per file)\n */\nexport function createCodegen({\n target = 'default',\n outDir = '',\n jsExtension = false,\n globCache = new Map(),\n}: Partial<CodeGenOptions>) {\n let eagerImportId = 0;\n const banner: string[] = ['// @ts-nocheck'];\n\n if (target === 'vite') {\n banner.push('/// <reference types=\"vite/client\" />');\n }\n\n return {\n options: {\n target,\n outDir,\n } as CodeGenOptions,\n lines: [] as string[],\n addImport(statement: string) {\n this.lines.unshift(statement);\n },\n async pushAsync(insert: Promise<string | undefined>[]) {\n for (const line of await Promise.all(insert)) {\n if (line === undefined) continue;\n\n this.lines.push(line);\n }\n },\n\n async generateGlobImport(\n patterns: string | string[],\n options: GlobImportOptions,\n ): Promise<string> {\n if (target === 'vite') {\n return this.generateViteGlobImport(patterns, options);\n }\n\n return this.generateNodeGlobImport(patterns, options);\n },\n\n generateViteGlobImport(\n patterns: string | string[],\n { base, ...rest }: GlobImportOptions,\n ): string {\n patterns = (typeof patterns === 'string' ? [patterns] : patterns).map(normalizeViteGlobPath);\n\n return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(\n {\n base: normalizeViteGlobPath(path.relative(outDir, base)),\n ...rest,\n },\n null,\n 2,\n )})`;\n },\n async generateNodeGlobImport(\n patterns: string | string[],\n { base, eager = false, query = {}, import: importName }: GlobImportOptions,\n ): Promise<string> {\n const cacheKey = JSON.stringify({ patterns, base });\n let files = globCache.get(cacheKey);\n if (!files) {\n files = glob(patterns, {\n cwd: base,\n });\n globCache.set(cacheKey, files);\n }\n\n let code: string = '{';\n for (const item of await files) {\n const fullPath = path.join(base, item);\n const searchParams = new URLSearchParams();\n\n for (const [k, v] of Object.entries(query)) {\n if (v !== undefined) searchParams.set(k, v);\n }\n\n const importPath = this.formatImportPath(fullPath) + '?' + searchParams.toString();\n if (eager) {\n const name = `__fd_glob_${eagerImportId++}`;\n this.lines.unshift(\n importName\n ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}`\n : `import * as ${name} from ${JSON.stringify(importPath)}`,\n );\n\n code += `${JSON.stringify(item)}: ${name}, `;\n } else {\n let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;\n if (importName) {\n line += `.then(mod => mod.${importName})`;\n }\n\n code += `${line}, `;\n }\n }\n\n code += '}';\n return code;\n },\n formatImportPath(file: string) {\n const ext = path.extname(file);\n let filename: string;\n\n if (ext === '.ts') {\n filename = file.substring(0, file.length - ext.length);\n if (jsExtension) filename += '.js';\n } else {\n filename = file;\n }\n\n const importPath = slash(path.relative(outDir, filename));\n return importPath.startsWith('.') ? importPath : `./${importPath}`;\n },\n toString() {\n return [...banner, ...this.lines].join('\\n');\n },\n };\n}\n\n/**\n * convert into POSIX & relative file paths, such that Vite can accept it.\n */\nfunction normalizeViteGlobPath(file: string) {\n file = slash(file);\n if (file.startsWith('./')) return file;\n if (file.startsWith('/')) return `.${file}`;\n\n return `./${file}`;\n}\n\nexport function slash(path: string): string {\n const isExtendedLengthPath = path.startsWith('\\\\\\\\?\\\\');\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll('\\\\', '/');\n}\n\nexport function ident(code: string, tab: number = 1) {\n return code\n .split('\\n')\n .map((v) => ' '.repeat(tab) + v)\n .join('\\n');\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,cAAc,EAC5B,SAAS,WACT,SAAS,IACT,cAAc,OACd,4BAAY,IAAI,KAAK,IACK;CAC1B,IAAI,gBAAgB;CACpB,MAAMA,SAAmB,CAAC,iBAAiB;AAE3C,KAAI,WAAW,OACb,QAAO,KAAK,0CAAwC;AAGtD,QAAO;EACL,SAAS;GACP;GACA;GACD;EACD,OAAO,EAAE;EACT,UAAU,WAAmB;AAC3B,QAAK,MAAM,QAAQ,UAAU;;EAE/B,MAAM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
|
5
|
-
import '@mdx-js/mdx';
|
|
6
|
-
import '@standard-schema/spec';
|
|
7
|
-
import 'fumadocs-core/mdx-plugins';
|
|
8
|
-
import 'chokidar';
|
|
9
|
-
import 'vfile';
|
|
10
|
-
import 'fumadocs-core/source';
|
|
11
|
-
import '../runtime/types.js';
|
|
12
|
-
import 'fumadocs-core/mdx-plugins/remark-structure';
|
|
13
|
-
import 'fumadocs-core/toc';
|
|
14
|
-
import 'mdx/types';
|
|
15
|
-
|
|
16
|
-
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
17
|
-
|
|
18
|
-
export { remarkInclude };
|
|
1
|
+
import { A as BaseCollection, B as PostprocessOptions, D as metaSchema, E as frontmatterSchema, F as MetaCollection, H as MDXPresetOptions, I as defineCollections, L as defineConfig, M as DocCollection, N as DocsCollection, O as remarkInclude, P as GlobalConfig, R as defineDocs, U as applyMdxPreset, V as DefaultMDXOptions, j as CollectionSchema, k as AnyCollection } from "../core-DG43f_AU.js";
|
|
2
|
+
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
package/dist/config/index.js
CHANGED
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
} from "../
|
|
4
|
-
import {
|
|
5
|
-
applyMdxPreset
|
|
6
|
-
} from "../chunk-S7KOJHHO.js";
|
|
7
|
-
import "../chunk-VWJKRQZR.js";
|
|
8
|
-
|
|
9
|
-
// ../core/dist/source/schema.js
|
|
1
|
+
import "../fuma-matter-CHgJa_-B.js";
|
|
2
|
+
import { t as applyMdxPreset } from "../preset-gmDZnBcg.js";
|
|
3
|
+
import { t as remarkInclude } from "../remark-include-D3G3mAnv.js";
|
|
10
4
|
import { z } from "zod";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
|
|
6
|
+
//#region ../core/dist/source/schema.js
|
|
7
|
+
/**
|
|
8
|
+
* Zod 4 schema
|
|
9
|
+
*/
|
|
10
|
+
const metaSchema = z.object({
|
|
11
|
+
title: z.string().optional(),
|
|
12
|
+
pages: z.array(z.string()).optional(),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
root: z.boolean().optional(),
|
|
15
|
+
defaultOpen: z.boolean().optional(),
|
|
16
|
+
collapsible: z.boolean().optional(),
|
|
17
|
+
icon: z.string().optional()
|
|
19
18
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Zod 4 schema
|
|
21
|
+
*/
|
|
22
|
+
const pageSchema = z.object({
|
|
23
|
+
title: z.string(),
|
|
24
|
+
description: z.string().optional(),
|
|
25
|
+
icon: z.string().optional(),
|
|
26
|
+
full: z.boolean().optional(),
|
|
27
|
+
_openapi: z.looseObject({}).optional()
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/config/define.ts
|
|
30
32
|
function defineCollections(options) {
|
|
31
|
-
|
|
33
|
+
return options;
|
|
32
34
|
}
|
|
33
35
|
function defineDocs(options) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
const dir = options.dir ?? "content/docs";
|
|
37
|
+
return {
|
|
38
|
+
type: "docs",
|
|
39
|
+
dir,
|
|
40
|
+
docs: defineCollections({
|
|
41
|
+
type: "doc",
|
|
42
|
+
dir,
|
|
43
|
+
schema: pageSchema,
|
|
44
|
+
...options?.docs
|
|
45
|
+
}),
|
|
46
|
+
meta: defineCollections({
|
|
47
|
+
type: "meta",
|
|
48
|
+
dir,
|
|
49
|
+
schema: metaSchema,
|
|
50
|
+
...options?.meta
|
|
51
|
+
})
|
|
52
|
+
};
|
|
51
53
|
}
|
|
52
54
|
function defineConfig(config = {}) {
|
|
53
|
-
|
|
55
|
+
return config;
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
defineDocs,
|
|
60
|
-
pageSchema as frontmatterSchema,
|
|
61
|
-
metaSchema,
|
|
62
|
-
remarkInclude
|
|
63
|
-
};
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { applyMdxPreset, defineCollections, defineConfig, defineDocs, pageSchema as frontmatterSchema, metaSchema, remarkInclude };
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../core/dist/source/schema.js","../../src/config/define.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//#region src/source/schema.ts\n/**\n* Zod 4 schema\n*/\nconst metaSchema = z.object({\n\ttitle: z.string().optional(),\n\tpages: z.array(z.string()).optional(),\n\tdescription: z.string().optional(),\n\troot: z.boolean().optional(),\n\tdefaultOpen: z.boolean().optional(),\n\tcollapsible: z.boolean().optional(),\n\ticon: z.string().optional()\n});\n/**\n* Zod 4 schema\n*/\nconst pageSchema = z.object({\n\ttitle: z.string(),\n\tdescription: z.string().optional(),\n\ticon: z.string().optional(),\n\tfull: z.boolean().optional(),\n\t_openapi: z.looseObject({}).optional()\n});\n\n//#endregion\nexport { metaSchema, pageSchema };\n//# sourceMappingURL=schema.js.map","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { MDXPresetOptions } from '@/config/preset';\nimport type { ProcessorOptions } from '@mdx-js/mdx';\nimport { metaSchema, pageSchema } from 'fumadocs-core/source/schema';\nimport type { PostprocessOptions } from '@/loaders/mdx/remark-postprocess';\nimport type { PluginOption } from '@/core';\nimport type { BuildEnvironment } from './build';\n\nexport type CollectionSchema<Schema extends StandardSchemaV1, Context> =\n | Schema\n | ((ctx: Context) => Schema);\n\nexport type AnyCollection = DocsCollection | DocCollection | MetaCollection;\n\nexport interface BaseCollection {\n /**\n * Directory to scan\n */\n dir: string;\n\n /**\n * what files to include/exclude (glob patterns)\n *\n * Include all files if not specified\n */\n files?: string[];\n}\n\nexport interface MetaCollection<\n Schema extends StandardSchemaV1 = StandardSchemaV1,\n> extends BaseCollection {\n type: 'meta';\n\n schema?: CollectionSchema<Schema, { path: string; source: string }>;\n}\n\nexport interface DocCollection<\n Schema extends StandardSchemaV1 = StandardSchemaV1,\n> extends BaseCollection {\n type: 'doc';\n\n postprocess?: Partial<PostprocessOptions>;\n mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);\n\n /**\n * Load files with async\n */\n async?: boolean;\n\n /**\n * Compile files on-demand\n */\n dynamic?: boolean;\n\n schema?: CollectionSchema<Schema, { path: string; source: string }>;\n}\n\nexport interface DocsCollection<\n DocSchema extends StandardSchemaV1 = StandardSchemaV1,\n MetaSchema extends StandardSchemaV1 = StandardSchemaV1,\n> {\n type: 'docs';\n dir: string;\n\n docs: DocCollection<DocSchema>;\n meta: MetaCollection<MetaSchema>;\n}\n\nexport interface GlobalConfig {\n plugins?: PluginOption[];\n\n /**\n * Configure global MDX options\n */\n mdxOptions?: MDXPresetOptions | (() => Promise<MDXPresetOptions>);\n\n workspaces?: Record<\n string,\n {\n dir: string;\n config: Record<string, unknown>;\n }\n >;\n\n /**\n * specify a directory to access & store cache (disabled during development mode).\n *\n * The cache will never be updated, delete the cache folder to clean.\n */\n experimentalBuildCache?: string;\n}\n\nexport function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(\n options: DocCollection<Schema>,\n): DocCollection<Schema>;\nexport function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(\n options: MetaCollection<Schema>,\n): MetaCollection<Schema>;\n\nexport function defineCollections(\n options: DocCollection | MetaCollection,\n): DocCollection | MetaCollection {\n return options as any;\n}\n\nexport function defineDocs<\n DocSchema extends StandardSchemaV1 = typeof pageSchema,\n MetaSchema extends StandardSchemaV1 = typeof metaSchema,\n>(options: {\n /**\n * The content directory to scan files\n *\n * @defaultValue 'content/docs'\n */\n dir?: string;\n\n docs?: Omit<DocCollection<DocSchema>, 'dir' | 'type'>;\n meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;\n}): DocsCollection<DocSchema, MetaSchema> {\n const dir = options.dir ?? 'content/docs';\n\n return {\n type: 'docs',\n dir,\n docs: defineCollections({\n type: 'doc',\n dir,\n schema: pageSchema as any,\n ...options?.docs,\n }),\n meta: defineCollections({\n type: 'meta',\n dir,\n schema: metaSchema as any,\n ...options?.meta,\n }),\n };\n}\n\nexport function defineConfig(config: GlobalConfig = {}): GlobalConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;AAMA,MAAM,aAAa,EAAE,OAAO;CAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACrC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,MAAM,EAAE,SAAS,CAAC,UAAU;CAC5B,aAAa,EAAE,SAAS,CAAC,UAAU;CACnC,aAAa,EAAE,SAAS,CAAC,UAAU;CACnC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,CAAC;;;;AAIF,MAAM,aAAa,EAAE,OAAO;CAC3B,OAAO,EAAE,QAAQ;CACjB,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,MAAM,EAAE,SAAS,CAAC,UAAU;CAC5B,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC,UAAU;CACtC,CAAC;;;;AC2EF,SAAgB,kBACd,SACgC;AAChC,QAAO;;AAGT,SAAgB,WAGd,SAUwC;CACxC,MAAM,MAAM,QAAQ,OAAO;AAE3B,QAAO;EACL,MAAM;EACN;EACA,MAAM,kBAAkB;GACtB,MAAM;GACN;GACA,QAAQ;GACR,GAAG,SAAS;GACb,CAAC;EACF,MAAM,kBAAkB;GACtB,MAAM;GACN;GACA,QAAQ;GACR,GAAG,SAAS;GACb,CAAC;EACH;;AAGH,SAAgB,aAAa,SAAuB,EAAE,EAAgB;AACpE,QAAO"}
|