@hanzo/docs-mdx 14.1.0 → 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-Jwap8N8Y.js +144 -0
- package/dist/adapter-Jwap8N8Y.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-DP5xMGSd.js +100 -0
- package/dist/build-DP5xMGSd.js.map +1 -0
- package/dist/build-mdx-B0MQbgVM.js +5 -0
- package/dist/build-mdx-CNzC71ea.js +153 -0
- package/dist/build-mdx-CNzC71ea.js.map +1 -0
- package/dist/build-mdx-DyJk_jWV.d.ts +53 -0
- package/dist/build-mdx-DyJk_jWV.d.ts.map +1 -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-BJualF84.js +212 -0
- package/dist/core-BJualF84.js.map +1 -0
- package/dist/core-D2BJuXMW.d.ts +364 -0
- package/dist/core-D2BJuXMW.d.ts.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-Bil6OoJJ.js +264 -0
- package/dist/index-file-Bil6OoJJ.js.map +1 -0
- package/dist/index.d.ts +3 -61
- package/dist/index.js +1 -0
- package/dist/load-from-file-BD2SdoUT.js +5 -0
- package/dist/load-from-file-CSjo1gN1.js +38 -0
- package/dist/load-from-file-CSjo1gN1.js.map +1 -0
- package/dist/loaders-BVwYfelL.js +7 -0
- package/dist/loaders-BVwYfelL.js.map +1 -0
- package/dist/mdx-QPp-1kXt.js +91 -0
- package/dist/mdx-QPp-1kXt.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-DtKimtBh.js +61 -0
- package/dist/preset-DtKimtBh.js.map +1 -0
- package/dist/remark-include-DirFkbLw.js +247 -0
- package/dist/remark-include-DirFkbLw.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-CBMeukTI.d.ts +63 -0
- package/dist/types-CBMeukTI.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 -114
- 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-DKHWtYK4.js +15 -0
- package/dist/webpack-DKHWtYK4.js.map +1 -0
- package/loader-mdx.cjs +1 -3
- package/loader-meta.cjs +1 -3
- package/package.json +51 -51
- package/dist/build-mdx-LN7FEKIP.js +0 -8
- package/dist/build-mdx-RXJZQXGA.js +0 -8
- package/dist/chunk-4JSFLXXT.js +0 -8
- package/dist/chunk-5OBUOALK.js +0 -141
- package/dist/chunk-72JS4QVZ.js +0 -17
- package/dist/chunk-7I4W7XGI.js +0 -179
- package/dist/chunk-7W73RILB.js +0 -173
- package/dist/chunk-A3YIGE7S.js +0 -334
- package/dist/chunk-AOTZP2TV.js +0 -152
- package/dist/chunk-AXJB5MGS.js +0 -173
- package/dist/chunk-DMIIE3XZ.js +0 -179
- package/dist/chunk-DTFUANSF.js +0 -40
- package/dist/chunk-JWZR25CW.js +0 -116
- package/dist/chunk-K7N6GD4M.js +0 -17
- package/dist/chunk-LXB7WYAF.js +0 -334
- package/dist/chunk-MYAVS2LD.js +0 -116
- package/dist/chunk-OLD35ARB.js +0 -116
- package/dist/chunk-PW2AZGGD.js +0 -125
- package/dist/chunk-RGBNABKS.js +0 -334
- package/dist/chunk-RPUM7REY.js +0 -40
- package/dist/chunk-RR2X6AE6.js +0 -274
- package/dist/chunk-S7KOJHHO.js +0 -89
- package/dist/chunk-STUCUTJQ.js +0 -334
- package/dist/chunk-T6G5VOED.js +0 -116
- package/dist/chunk-U5YPLCO5.js +0 -89
- package/dist/chunk-UB55AMXC.js +0 -274
- package/dist/chunk-VITVHHR6.js +0 -334
- package/dist/chunk-VKSHE52K.js +0 -274
- package/dist/chunk-VWJKRQZR.js +0 -19
- package/dist/chunk-WAAWFNDX.js +0 -179
- package/dist/chunk-WGXYJGSZ.js +0 -141
- package/dist/chunk-WLJ6EKOZ.js +0 -17
- package/dist/chunk-WMYYALAS.js +0 -334
- package/dist/chunk-Y7ISNZ7X.js +0 -216
- package/dist/chunk-YKRCQ42E.js +0 -216
- package/dist/chunk-ZAYZWFWP.js +0 -89
- package/dist/core-BQcKaqmC.d.ts +0 -350
- package/dist/core-BhWOtait.d.ts +0 -350
- package/dist/core-CV8uFMUa.d.ts +0 -350
- package/dist/core-DAQ64Hkq.d.ts +0 -350
- package/dist/core-DZtRjhds.d.ts +0 -350
- package/dist/core-De5K4ixv.d.ts +0 -350
- 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/load-from-file-S5CQ4H6T.js +0 -8
package/dist/bun/index.js
CHANGED
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "../chunk-DMIIE3XZ.js";
|
|
11
|
-
import "../chunk-4JSFLXXT.js";
|
|
12
|
-
import {
|
|
13
|
-
buildConfig
|
|
14
|
-
} from "../chunk-MYAVS2LD.js";
|
|
15
|
-
import "../chunk-U5YPLCO5.js";
|
|
16
|
-
import {
|
|
17
|
-
_Defaults,
|
|
18
|
-
createCore
|
|
19
|
-
} from "../chunk-RR2X6AE6.js";
|
|
20
|
-
import "../chunk-PW2AZGGD.js";
|
|
21
|
-
import "../chunk-VWJKRQZR.js";
|
|
1
|
+
import "../fuma-matter-CHgJa_-B.js";
|
|
2
|
+
import { t as createMdxLoader } from "../mdx-QPp-1kXt.js";
|
|
3
|
+
import "../preset-DtKimtBh.js";
|
|
4
|
+
import { t as buildConfig } from "../build-DP5xMGSd.js";
|
|
5
|
+
import { n as createCore, t as _Defaults } from "../core-BJualF84.js";
|
|
6
|
+
import "../codegen-DleOVLNr.js";
|
|
7
|
+
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-Jwap8N8Y.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-hanzo-docs-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-hanzo-docs-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,UAAU,QAAuC;AACrD,QAAK,MAAM,QAAQ,MAAM,QAAQ,IAAI,OAAO,EAAE;AAC5C,QAAI,SAAS,OAAW;AAExB,SAAK,MAAM,KAAK,KAAK;;;EAIzB,MAAM,mBACJ,UACA,SACiB;AACjB,OAAI,WAAW,OACb,QAAO,KAAK,uBAAuB,UAAU,QAAQ;AAGvD,UAAO,KAAK,uBAAuB,UAAU,QAAQ;;EAGvD,uBACE,UACA,EAAE,MAAM,GAAG,QACH;AACR,eAAY,OAAO,aAAa,WAAW,CAAC,SAAS,GAAG,UAAU,IAAI,sBAAs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OAAO;AACjB,eAAW,KAAK,UAAU,GAAG,KAAK,SAAS,IAAI,OAAO;AACtD,QAAI,YAAa,aAAY;SAE7B,YAAW;GAGb,MAAM,aAAa,MAAM,KAAK,SAAS,QAAQ,SAAS,CAAC;AACzD,UAAO,WAAW,WAAW,IAAI,GAAG,aAAa,KAAK;;EAExD,WAAW;AACT,UAAO,CAAC,GAAG,QAAQ,GAAG,KAAK,MAAM,CAAC,KAAK,KAAK;;EAE/C;;;;;AAMH,SAAS,sBAAsB,MAAc;AAC3C,QAAO,MAAM,KAAK;AAClB,KAAI,KAAK,WAAW,KAAK,CAAE,QAAO;AAClC,KAAI,KAAK,WAAW,IAAI,CAAE,QAAO,IAAI;AAErC,QAAO,KAAK;;AAGd,SAAgB,MAAM,QAAsB;AAG1C,KAF6BC,OAAK,WAAW,UAAU,CAGrD,QAAOA;AAGT,QAAOA,OAAK,WAAW,MAAM,IAAI;;AAGnC,SAAgB,MAAM,MAAc,MAAc,GAAG;AACnD,QAAO,KACJ,MAAM,KAAK,CACX,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG,EAAE,CAChC,KAAK,KAAK"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Root } from 'mdast';
|
|
4
|
-
export { pageSchema as frontmatterSchema, metaSchema } from '@hanzo/docs-core/source/schema';
|
|
5
|
-
import '@mdx-js/mdx';
|
|
6
|
-
import '@standard-schema/spec';
|
|
7
|
-
import '@hanzo/docs-core/mdx-plugins';
|
|
8
|
-
import 'chokidar';
|
|
9
|
-
import 'vfile';
|
|
10
|
-
import '@hanzo/docs-core/source';
|
|
11
|
-
import '../runtime/types.js';
|
|
12
|
-
import '@hanzo/docs-core/mdx-plugins/remark-structure';
|
|
13
|
-
import '@hanzo/docs-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-D2BJuXMW.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-U5YPLCO5.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-DtKimtBh.js";
|
|
3
|
+
import { t as remarkInclude } from "../remark-include-DirFkbLw.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 '@hanzo/docs-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"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { n as ident } from "./codegen-DleOVLNr.js";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/validation.ts
|
|
6
|
+
var ValidationError = class extends Error {
|
|
7
|
+
constructor(message, issues) {
|
|
8
|
+
super(`${message}:\n${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`);
|
|
9
|
+
this.title = message;
|
|
10
|
+
this.issues = issues;
|
|
11
|
+
}
|
|
12
|
+
async toStringFormatted() {
|
|
13
|
+
const picocolorsModule = await import("picocolors");
|
|
14
|
+
const picocolors = picocolorsModule.default ?? picocolorsModule;
|
|
15
|
+
return [picocolors.bold(`[MDX] ${this.title}:`), ...this.issues.map((issue) => picocolors.redBright(`- ${picocolors.bold(issue.path?.join(".") ?? "*")}: ${issue.message}`))].join("\n");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
async function validate(schema, data, context, errorMessage) {
|
|
19
|
+
if (typeof schema === "function" && !("~standard" in schema)) schema = schema(context);
|
|
20
|
+
if ("~standard" in schema) {
|
|
21
|
+
const result = await schema["~standard"].validate(data);
|
|
22
|
+
if (result.issues) throw new ValidationError(errorMessage, result.issues);
|
|
23
|
+
return result.value;
|
|
24
|
+
}
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/core.ts
|
|
30
|
+
const _Defaults = {
|
|
31
|
+
configPath: "source.config.ts",
|
|
32
|
+
outDir: ".docs"
|
|
33
|
+
};
|
|
34
|
+
async function getPlugins(pluginOptions) {
|
|
35
|
+
const plugins = [];
|
|
36
|
+
for await (const option of pluginOptions) {
|
|
37
|
+
if (!option) continue;
|
|
38
|
+
if (Array.isArray(option)) plugins.push(...await getPlugins(option));
|
|
39
|
+
else plugins.push(option);
|
|
40
|
+
}
|
|
41
|
+
return plugins;
|
|
42
|
+
}
|
|
43
|
+
function createCore(options) {
|
|
44
|
+
let config;
|
|
45
|
+
let plugins;
|
|
46
|
+
const workspaces = /* @__PURE__ */ new Map();
|
|
47
|
+
async function transformMetadata({ collection, filePath, source }, data) {
|
|
48
|
+
if (collection.schema) data = await validate(collection.schema, data, {
|
|
49
|
+
path: filePath,
|
|
50
|
+
source
|
|
51
|
+
}, collection.type === "doc" ? `invalid frontmatter in ${filePath}` : `invalid data in ${filePath}`);
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
cache: /* @__PURE__ */ new Map(),
|
|
56
|
+
async init({ config: newConfig }) {
|
|
57
|
+
config = await newConfig;
|
|
58
|
+
this.cache.clear();
|
|
59
|
+
workspaces.clear();
|
|
60
|
+
plugins = await getPlugins([
|
|
61
|
+
postprocessPlugin(),
|
|
62
|
+
options.plugins,
|
|
63
|
+
config.global.plugins
|
|
64
|
+
]);
|
|
65
|
+
for (const plugin of plugins) {
|
|
66
|
+
const out = await plugin.config?.call(this.getPluginContext(), config);
|
|
67
|
+
if (out) config = out;
|
|
68
|
+
}
|
|
69
|
+
if (!options.workspace) await Promise.all(Object.entries(config.workspaces).map(async ([name, workspace]) => {
|
|
70
|
+
const core = createCore({
|
|
71
|
+
...options,
|
|
72
|
+
outDir: path.join(options.outDir, name),
|
|
73
|
+
workspace: {
|
|
74
|
+
name,
|
|
75
|
+
parent: this,
|
|
76
|
+
dir: workspace.dir
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
await core.init({ config: workspace.config });
|
|
80
|
+
workspaces.set(name, core);
|
|
81
|
+
}));
|
|
82
|
+
},
|
|
83
|
+
getWorkspaces() {
|
|
84
|
+
return workspaces;
|
|
85
|
+
},
|
|
86
|
+
getOptions() {
|
|
87
|
+
return options;
|
|
88
|
+
},
|
|
89
|
+
getConfig() {
|
|
90
|
+
return config;
|
|
91
|
+
},
|
|
92
|
+
getCompiledConfigPath() {
|
|
93
|
+
return path.join(options.outDir, "source.config.mjs");
|
|
94
|
+
},
|
|
95
|
+
getPlugins() {
|
|
96
|
+
return plugins;
|
|
97
|
+
},
|
|
98
|
+
getCollections() {
|
|
99
|
+
return Array.from(config.collections.values());
|
|
100
|
+
},
|
|
101
|
+
getCollection(name) {
|
|
102
|
+
return config.collections.get(name);
|
|
103
|
+
},
|
|
104
|
+
getPluginContext() {
|
|
105
|
+
return { core: this };
|
|
106
|
+
},
|
|
107
|
+
async initServer(server) {
|
|
108
|
+
const ctx = this.getPluginContext();
|
|
109
|
+
for (const plugin of plugins) await plugin.configureServer?.call(ctx, server);
|
|
110
|
+
for (const workspace of workspaces.values()) await workspace.initServer(server);
|
|
111
|
+
},
|
|
112
|
+
async emit(emitOptions = {}) {
|
|
113
|
+
const { filterPlugin, filterWorkspace, write = false } = emitOptions;
|
|
114
|
+
const start = performance.now();
|
|
115
|
+
const ctx = this.getPluginContext();
|
|
116
|
+
const added = /* @__PURE__ */ new Set();
|
|
117
|
+
const out = {
|
|
118
|
+
entries: [],
|
|
119
|
+
workspaces: {}
|
|
120
|
+
};
|
|
121
|
+
for (const li of await Promise.all(plugins.map((plugin) => {
|
|
122
|
+
if (filterPlugin && !filterPlugin(plugin) || !plugin.emit) return;
|
|
123
|
+
return plugin.emit.call(ctx);
|
|
124
|
+
}))) {
|
|
125
|
+
if (!li) continue;
|
|
126
|
+
for (const item of li) {
|
|
127
|
+
if (added.has(item.path)) continue;
|
|
128
|
+
out.entries.push(item);
|
|
129
|
+
added.add(item.path);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (write) {
|
|
133
|
+
await Promise.all(out.entries.map(async (entry) => {
|
|
134
|
+
const file = path.join(options.outDir, entry.path);
|
|
135
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
136
|
+
await fs.writeFile(file, entry.content);
|
|
137
|
+
}));
|
|
138
|
+
console.log(options.workspace ? `[MDX: ${options.workspace.name}] generated files in ${performance.now() - start}ms` : `[MDX] generated files in ${performance.now() - start}ms`);
|
|
139
|
+
}
|
|
140
|
+
for (const [name, workspace] of workspaces) {
|
|
141
|
+
if (filterWorkspace && !filterWorkspace(name)) continue;
|
|
142
|
+
out.workspaces[name] = (await workspace.emit(emitOptions)).entries;
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
},
|
|
146
|
+
async transformMeta(options$1, data) {
|
|
147
|
+
const ctx = {
|
|
148
|
+
...this.getPluginContext(),
|
|
149
|
+
...options$1
|
|
150
|
+
};
|
|
151
|
+
data = await transformMetadata(options$1, data);
|
|
152
|
+
for (const plugin of plugins) if (plugin.meta?.transform) data = await plugin.meta.transform.call(ctx, data) ?? data;
|
|
153
|
+
return data;
|
|
154
|
+
},
|
|
155
|
+
async transformFrontmatter(options$1, data) {
|
|
156
|
+
const ctx = {
|
|
157
|
+
...this.getPluginContext(),
|
|
158
|
+
...options$1
|
|
159
|
+
};
|
|
160
|
+
data = await transformMetadata(options$1, data);
|
|
161
|
+
for (const plugin of plugins) if (plugin.doc?.frontmatter) data = await plugin.doc.frontmatter.call(ctx, data) ?? data;
|
|
162
|
+
return data;
|
|
163
|
+
},
|
|
164
|
+
async transformVFile(options$1, file) {
|
|
165
|
+
const ctx = {
|
|
166
|
+
...this.getPluginContext(),
|
|
167
|
+
...options$1
|
|
168
|
+
};
|
|
169
|
+
for (const plugin of plugins) if (plugin.doc?.vfile) file = await plugin.doc.vfile.call(ctx, file) ?? file;
|
|
170
|
+
return file;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function postprocessPlugin() {
|
|
175
|
+
const LinkReferenceTypes = `{
|
|
176
|
+
/**
|
|
177
|
+
* extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
|
|
178
|
+
*/
|
|
179
|
+
extractedReferences: import("@hanzo/docs-mdx").ExtractedReference[];
|
|
180
|
+
}`;
|
|
181
|
+
return { "index-file": {
|
|
182
|
+
generateTypeConfig() {
|
|
183
|
+
const lines = [];
|
|
184
|
+
lines.push("{");
|
|
185
|
+
lines.push(" DocData: {");
|
|
186
|
+
for (const collection of this.core.getCollections()) {
|
|
187
|
+
let postprocessOptions;
|
|
188
|
+
switch (collection.type) {
|
|
189
|
+
case "doc":
|
|
190
|
+
postprocessOptions = collection.postprocess;
|
|
191
|
+
break;
|
|
192
|
+
case "docs":
|
|
193
|
+
postprocessOptions = collection.docs.postprocess;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
if (postprocessOptions?.extractLinkReferences) lines.push(ident(`${collection.name}: ${LinkReferenceTypes},`, 2));
|
|
197
|
+
}
|
|
198
|
+
lines.push(" }");
|
|
199
|
+
lines.push("}");
|
|
200
|
+
return lines.join("\n");
|
|
201
|
+
},
|
|
202
|
+
serverOptions(options) {
|
|
203
|
+
options.doc ??= {};
|
|
204
|
+
options.doc.passthroughs ??= [];
|
|
205
|
+
options.doc.passthroughs.push("extractedReferences");
|
|
206
|
+
}
|
|
207
|
+
} };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
export { createCore as n, ValidationError as r, _Defaults as t };
|
|
212
|
+
//# sourceMappingURL=core-BJualF84.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-BJualF84.js","names":["plugins: Plugin[]","config: LoadedConfig","out: EmitOutput","options","lines: string[]","postprocessOptions: Partial<PostprocessOptions> | undefined"],"sources":["../src/utils/validation.ts","../src/core.ts"],"sourcesContent":["import type { CollectionSchema } from '@/config';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport class ValidationError extends Error {\n title: string;\n issues: readonly StandardSchemaV1.Issue[];\n\n constructor(message: string, issues: readonly StandardSchemaV1.Issue[]) {\n super(`${message}:\\n${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join('\\n')}`);\n\n this.title = message;\n this.issues = issues;\n }\n\n async toStringFormatted() {\n // Handle ESM/CJS interop: picocolors is a CJS module that exports via\n // module.exports = createColors(). When dynamically imported in ESM context\n // (e.g., Next.js 16 Turbopack), the exports are wrapped under .default\n const picocolorsModule = await import('picocolors');\n const picocolors = picocolorsModule.default ?? picocolorsModule;\n\n return [\n picocolors.bold(`[MDX] ${this.title}:`),\n ...this.issues.map((issue) =>\n picocolors.redBright(\n `- ${picocolors.bold(issue.path?.join('.') ?? '*')}: ${issue.message}`,\n ),\n ),\n ].join('\\n');\n }\n}\n\nexport async function validate<Schema extends StandardSchemaV1, Context>(\n schema: CollectionSchema<Schema, Context>,\n data: unknown,\n context: Context,\n errorMessage: string,\n): Promise<StandardSchemaV1.InferOutput<Schema>> {\n if (typeof schema === 'function' && !('~standard' in schema)) {\n schema = schema(context);\n }\n\n if ('~standard' in schema) {\n const result = await (schema as StandardSchemaV1)['~standard'].validate(data);\n\n if (result.issues) {\n throw new ValidationError(errorMessage, result.issues);\n }\n\n return result.value;\n }\n\n return data;\n}\n","import type {\n CollectionItem,\n DocCollectionItem,\n LoadedConfig,\n MetaCollectionItem,\n} from '@/config/build';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport type { FSWatcher } from 'chokidar';\nimport { validate } from './utils/validation';\nimport type { VFile } from 'vfile';\nimport type { IndexFilePlugin } from './plugins/index-file';\nimport type { PostprocessOptions } from './config';\nimport { ident } from './utils/codegen';\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface EmitEntry {\n /**\n * path relative to output directory\n */\n path: string;\n content: string;\n}\n\nexport interface PluginContext {\n core: Core;\n}\n\nexport type CompilationContext<Collection> = PluginContext & TransformOptions<Collection>;\n\nexport interface TransformOptions<Collection> {\n collection: Collection;\n filePath: string;\n source: string;\n}\n\nexport interface Plugin extends IndexFilePlugin {\n name?: string;\n\n /**\n * on config loaded/updated\n */\n config?: (this: PluginContext, config: LoadedConfig) => Awaitable<void | LoadedConfig>;\n\n /**\n * Generate files (e.g. types, index file, or JSON schemas)\n */\n emit?: (this: PluginContext) => Awaitable<EmitEntry[]>;\n\n /**\n * Configure Fumadocs dev server\n */\n configureServer?: (this: PluginContext, server: ServerContext) => Awaitable<void>;\n\n meta?: {\n /**\n * Transform metadata\n */\n transform?: (\n this: CompilationContext<MetaCollectionItem>,\n data: unknown,\n ) => Awaitable<unknown | void>;\n };\n\n doc?: {\n /**\n * Transform frontmatter\n */\n frontmatter?: (\n this: CompilationContext<DocCollectionItem>,\n data: Record<string, unknown>,\n ) => Awaitable<Record<string, unknown> | void>;\n\n /**\n * Transform `vfile` on compilation stage\n */\n vfile?: (this: CompilationContext<DocCollectionItem>, file: VFile) => Awaitable<VFile | void>;\n };\n}\n\nexport type PluginOption = Awaitable<Plugin | PluginOption[] | false | undefined>;\n\nexport interface ServerContext {\n /**\n * the file watcher, by default all content files are watched, along with other files.\n *\n * make sure to filter when listening to events\n */\n watcher?: FSWatcher;\n}\n\nexport interface CoreOptions {\n environment: string;\n configPath: string;\n outDir: string;\n plugins?: PluginOption[];\n\n /**\n * the workspace info if this instance is created as a workspace\n */\n workspace?: {\n parent: Core;\n name: string;\n dir: string;\n };\n}\n\nexport interface EmitOptions {\n /**\n * filter the plugins to run emit\n */\n filterPlugin?: (plugin: Plugin) => boolean;\n\n /**\n * filter the workspaces to run emit\n */\n filterWorkspace?: (workspace: string) => boolean;\n\n /**\n * write files\n */\n write?: boolean;\n}\n\nexport interface EmitOutput {\n entries: EmitEntry[];\n workspaces: Record<string, EmitEntry[]>;\n}\n\nexport const _Defaults = {\n configPath: 'source.config.ts',\n outDir: '.docs',\n};\n\nasync function getPlugins(pluginOptions: PluginOption[]): Promise<Plugin[]> {\n const plugins: Plugin[] = [];\n\n for await (const option of pluginOptions) {\n if (!option) continue;\n if (Array.isArray(option)) plugins.push(...(await getPlugins(option)));\n else plugins.push(option);\n }\n\n return plugins;\n}\n\nexport function createCore(options: CoreOptions) {\n let config: LoadedConfig;\n let plugins: Plugin[];\n const workspaces = new Map<string, Core>();\n\n async function transformMetadata<T>(\n { collection, filePath, source }: TransformOptions<DocCollectionItem | MetaCollectionItem>,\n data: unknown,\n ): Promise<T> {\n if (collection.schema) {\n data = await validate(\n collection.schema,\n data,\n { path: filePath, source },\n collection.type === 'doc'\n ? `invalid frontmatter in ${filePath}`\n : `invalid data in ${filePath}`,\n );\n }\n\n return data as T;\n }\n\n return {\n /**\n * Convenient cache store, reset when config changes\n */\n cache: new Map<string, unknown>(),\n async init({ config: newConfig }: { config: Awaitable<LoadedConfig> }) {\n config = await newConfig;\n this.cache.clear();\n workspaces.clear();\n plugins = await getPlugins([postprocessPlugin(), options.plugins, config.global.plugins]);\n\n for (const plugin of plugins) {\n const out = await plugin.config?.call(this.getPluginContext(), config);\n if (out) config = out;\n }\n\n // only support workspaces with max depth 1\n if (!options.workspace) {\n await Promise.all(\n Object.entries(config.workspaces).map(async ([name, workspace]) => {\n const core = createCore({\n ...options,\n outDir: path.join(options.outDir, name),\n workspace: {\n name,\n parent: this,\n dir: workspace.dir,\n },\n });\n await core.init({ config: workspace.config });\n workspaces.set(name, core);\n }),\n );\n }\n },\n getWorkspaces() {\n return workspaces;\n },\n getOptions() {\n return options;\n },\n getConfig(): LoadedConfig {\n return config;\n },\n /**\n * The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling)\n */\n getCompiledConfigPath(): string {\n return path.join(options.outDir, 'source.config.mjs');\n },\n getPlugins() {\n return plugins;\n },\n getCollections(): CollectionItem[] {\n return Array.from(config.collections.values());\n },\n getCollection(name: string): CollectionItem | undefined {\n return config.collections.get(name);\n },\n getPluginContext(): PluginContext {\n return {\n core: this,\n };\n },\n async initServer(server: ServerContext): Promise<void> {\n const ctx = this.getPluginContext();\n for (const plugin of plugins) {\n await plugin.configureServer?.call(ctx, server);\n }\n for (const workspace of workspaces.values()) {\n await workspace.initServer(server);\n }\n },\n async emit(emitOptions: EmitOptions = {}): Promise<EmitOutput> {\n const { filterPlugin, filterWorkspace, write = false } = emitOptions;\n const start = performance.now();\n const ctx = this.getPluginContext();\n const added = new Set<string>();\n const out: EmitOutput = {\n entries: [],\n workspaces: {},\n };\n\n for (const li of await Promise.all(\n plugins.map((plugin) => {\n if ((filterPlugin && !filterPlugin(plugin)) || !plugin.emit) return;\n return plugin.emit.call(ctx);\n }),\n )) {\n if (!li) continue;\n for (const item of li) {\n if (added.has(item.path)) continue;\n out.entries.push(item);\n added.add(item.path);\n }\n }\n\n if (write) {\n await Promise.all(\n out.entries.map(async (entry) => {\n const file = path.join(options.outDir, entry.path);\n\n await fs.mkdir(path.dirname(file), { recursive: true });\n await fs.writeFile(file, entry.content);\n }),\n );\n\n console.log(\n options.workspace\n ? `[MDX: ${options.workspace.name}] generated files in ${performance.now() - start}ms`\n : `[MDX] generated files in ${performance.now() - start}ms`,\n );\n }\n\n for (const [name, workspace] of workspaces) {\n if (filterWorkspace && !filterWorkspace(name)) continue;\n out.workspaces[name] = (await workspace.emit(emitOptions)).entries;\n }\n\n return out;\n },\n async transformMeta(\n options: TransformOptions<MetaCollectionItem>,\n data: unknown,\n ): Promise<unknown> {\n const ctx = {\n ...this.getPluginContext(),\n ...options,\n };\n\n data = await transformMetadata(options, data);\n for (const plugin of plugins) {\n if (plugin.meta?.transform) data = (await plugin.meta.transform.call(ctx, data)) ?? data;\n }\n\n return data;\n },\n async transformFrontmatter(\n options: TransformOptions<DocCollectionItem>,\n data: Record<string, unknown>,\n ): Promise<Record<string, unknown>> {\n const ctx = {\n ...this.getPluginContext(),\n ...options,\n };\n\n data = await transformMetadata(options, data);\n for (const plugin of plugins) {\n if (plugin.doc?.frontmatter) data = (await plugin.doc.frontmatter.call(ctx, data)) ?? data;\n }\n\n return data;\n },\n async transformVFile(\n options: TransformOptions<DocCollectionItem>,\n file: VFile,\n ): Promise<VFile> {\n const ctx = {\n ...this.getPluginContext(),\n ...options,\n };\n\n for (const plugin of plugins) {\n if (plugin.doc?.vfile) file = (await plugin.doc.vfile.call(ctx, file)) ?? file;\n }\n\n return file;\n },\n };\n}\n\nfunction postprocessPlugin(): Plugin {\n const LinkReferenceTypes = `{\n /**\n * extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.\n */\n extractedReferences: import(\"@hanzo/docs-mdx\").ExtractedReference[];\n}`;\n\n return {\n 'index-file': {\n generateTypeConfig() {\n const lines: string[] = [];\n lines.push('{');\n lines.push(' DocData: {');\n for (const collection of this.core.getCollections()) {\n let postprocessOptions: Partial<PostprocessOptions> | undefined;\n switch (collection.type) {\n case 'doc':\n postprocessOptions = collection.postprocess;\n break;\n case 'docs':\n postprocessOptions = collection.docs.postprocess;\n break;\n }\n\n if (postprocessOptions?.extractLinkReferences) {\n lines.push(ident(`${collection.name}: ${LinkReferenceTypes},`, 2));\n }\n }\n lines.push(' }');\n lines.push('}');\n return lines.join('\\n');\n },\n serverOptions(options) {\n options.doc ??= {};\n options.doc.passthroughs ??= [];\n options.doc.passthroughs.push('extractedReferences');\n },\n },\n };\n}\n\nexport type Core = ReturnType<typeof createCore>;\n"],"mappings":";;;;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CAIzC,YAAY,SAAiB,QAA2C;AACtE,QAAM,GAAG,QAAQ,KAAK,OAAO,KAAK,UAAU,KAAK,MAAM,KAAK,IAAI,MAAM,UAAU,CAAC,KAAK,KAAK,GAAG;AAE9F,OAAK,QAAQ;AACb,OAAK,SAAS;;CAGhB,MAAM,oBAAoB;EAIxB,MAAM,mBAAmB,MAAM,OAAO;EACtC,MAAM,aAAa,iBAAiB,WAAW;AAE/C,SAAO,CACL,WAAW,KAAK,SAAS,KAAK,MAAM,GAAG,EACvC,GAAG,KAAK,OAAO,KAAK,UAClB,WAAW,UACT,KAAK,WAAW,KAAK,MAAM,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM,UAC9D,CACF,CACF,CAAC,KAAK,KAAK;;;AAIhB,eAAsB,SACpB,QACA,MACA,SACA,cAC+C;AAC/C,KAAI,OAAO,WAAW,cAAc,EAAE,eAAe,QACnD,UAAS,OAAO,QAAQ;AAG1B,KAAI,eAAe,QAAQ;EACzB,MAAM,SAAS,MAAO,OAA4B,aAAa,SAAS,KAAK;AAE7E,MAAI,OAAO,OACT,OAAM,IAAI,gBAAgB,cAAc,OA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