@hanzo/docs-mdx 14.2.5 → 14.2.8
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/{config-DSrG5Dfc.js → adapter-DwaTu9dw.js} +39 -38
- package/dist/adapter-DwaTu9dw.js.map +1 -0
- package/dist/{build-GdAvxpd7.js → build-d7coQAP7.js} +2 -2
- package/dist/build-d7coQAP7.js.map +1 -0
- package/dist/{build-mdx-DyJk_jWV.d.ts → build-mdx-CaG9rsmy.d.ts} +7 -7
- package/dist/build-mdx-CaG9rsmy.d.ts.map +1 -0
- package/dist/{build-mdx-COY0QD1z.js → build-mdx-k6Y12VXb.js} +12 -4
- package/dist/build-mdx-k6Y12VXb.js.map +1 -0
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +8 -8
- package/dist/bun/index.js.map +1 -1
- package/dist/{codegen-Dd9ILNOr.js → codegen-DzglA9tJ.js} +4 -4
- package/dist/codegen-DzglA9tJ.js.map +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +3 -3
- package/dist/config/index.js.map +1 -1
- package/dist/{core-DOav5JBx.js → core-DFgQdyqL.js} +12 -12
- package/dist/core-DFgQdyqL.js.map +1 -0
- package/dist/{core-D2BJuXMW.d.ts → core-cnMNewUq.d.ts} +42 -81
- package/dist/core-cnMNewUq.d.ts.map +1 -0
- package/dist/{fuma-matter-DL-PfQJ7.js → frontmatter-DePDVaRD.js} +6 -6
- package/dist/frontmatter-DePDVaRD.js.map +1 -0
- package/dist/fs-cache-DjtD5cW9.js +31 -0
- package/dist/fs-cache-DjtD5cW9.js.map +1 -0
- package/dist/{index-Bc_4I1HE.d.ts → index-Jp-qanl0.d.ts} +1 -1
- package/dist/index-Jp-qanl0.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/{load-from-file-dsGIDpOc.js → load-from-file-C36LHYQZ.js} +5 -3
- package/dist/load-from-file-C36LHYQZ.js.map +1 -0
- package/dist/{loaders-Mp-ZCdLT.js → loaders-hcYVSfeh.js} +1 -1
- package/dist/{loaders-Mp-ZCdLT.js.map → loaders-hcYVSfeh.js.map} +1 -1
- package/dist/{mdx-CJaKR3FR.js → mdx-DbiNLrgs.js} +8 -8
- package/dist/mdx-DbiNLrgs.js.map +1 -0
- package/dist/{meta-CKrL1Sl9.js → meta-C3cm2Bl5.js} +5 -5
- package/dist/meta-C3cm2Bl5.js.map +1 -0
- package/dist/next/index.cjs +21 -20
- package/dist/next/index.d.ts +2 -1
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +8 -8
- package/dist/next/index.js.map +1 -1
- package/dist/node/loader.d.ts.map +1 -1
- package/dist/node/loader.js +6 -6
- package/dist/node/loader.js.map +1 -1
- package/dist/plugins/index-file.d.ts +31 -2
- package/dist/plugins/index-file.d.ts.map +1 -0
- package/dist/plugins/index-file.js +236 -4
- package/dist/plugins/index-file.js.map +1 -0
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/json-schema.d.ts.map +1 -1
- package/dist/plugins/json-schema.js +1 -1
- package/dist/plugins/json-schema.js.map +1 -1
- package/dist/plugins/last-modified.d.ts +1 -1
- package/dist/plugins/last-modified.d.ts.map +1 -1
- package/dist/plugins/last-modified.js +5 -5
- package/dist/plugins/last-modified.js.map +1 -1
- package/dist/{preset-D_quDsKp.js → preset-B14ViDfq.js} +1 -1
- package/dist/{preset-D_quDsKp.js.map → preset-B14ViDfq.js.map} +1 -1
- package/dist/{remark-include-BbnDmUoc.js → remark-include-DfEJ3erI.js} +5 -5
- package/dist/remark-include-DfEJ3erI.js.map +1 -0
- package/dist/rolldown-runtime-CjeV3_4I.js +18 -0
- package/dist/runtime/browser.d.ts +8 -8
- package/dist/runtime/browser.d.ts.map +1 -1
- package/dist/runtime/browser.js +12 -14
- package/dist/runtime/browser.js.map +1 -1
- package/dist/runtime/dynamic.d.ts +4 -2
- package/dist/runtime/dynamic.d.ts.map +1 -1
- package/dist/runtime/dynamic.js +8 -8
- package/dist/runtime/dynamic.js.map +1 -1
- package/dist/runtime/server.d.ts +49 -2
- package/dist/runtime/server.d.ts.map +1 -0
- package/dist/runtime/server.js +6 -6
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/types.d.ts +63 -2
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/vite/index.d.ts +4 -3
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +18 -19
- package/dist/vite/index.js.map +1 -1
- package/dist/webpack/mdx.d.ts +3 -2
- package/dist/webpack/mdx.d.ts.map +1 -1
- package/dist/webpack/mdx.js +6 -6
- package/dist/webpack/mdx.js.map +1 -1
- package/dist/webpack/meta.d.ts +3 -2
- package/dist/webpack/meta.d.ts.map +1 -1
- package/dist/webpack/meta.js +5 -5
- package/dist/webpack/meta.js.map +1 -1
- package/dist/{webpack-BHjsXgTD.js → webpack-Cc8dY43s.js} +2 -2
- package/dist/webpack-Cc8dY43s.js.map +1 -0
- package/package.json +36 -20
- package/dist/build-GdAvxpd7.js.map +0 -1
- package/dist/build-mdx-COY0QD1z.js.map +0 -1
- package/dist/build-mdx-DyJk_jWV.d.ts.map +0 -1
- package/dist/build-mdx-hB1gzgHy.js +0 -5
- package/dist/codegen-Dd9ILNOr.js.map +0 -1
- package/dist/config-DSrG5Dfc.js.map +0 -1
- package/dist/core-D2BJuXMW.d.ts.map +0 -1
- package/dist/core-DOav5JBx.js.map +0 -1
- package/dist/fuma-matter-DL-PfQJ7.js.map +0 -1
- package/dist/index-Bc_4I1HE.d.ts.map +0 -1
- package/dist/index-file-B3LmDGdu.js +0 -264
- package/dist/index-file-B3LmDGdu.js.map +0 -1
- package/dist/load-from-file-BoO9y-n6.js +0 -5
- package/dist/load-from-file-dsGIDpOc.js.map +0 -1
- package/dist/mdx-CJaKR3FR.js.map +0 -1
- package/dist/meta-CKrL1Sl9.js.map +0 -1
- package/dist/remark-include-BbnDmUoc.js.map +0 -1
- package/dist/types-CBMeukTI.d.ts +0 -63
- package/dist/types-CBMeukTI.d.ts.map +0 -1
- package/dist/webpack-BHjsXgTD.js.map +0 -1
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
import { r as ValidationError } from "./core-
|
|
1
|
+
import { r as ValidationError } from "./core-DFgQdyqL.js";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { parse } from "node:querystring";
|
|
6
6
|
|
|
7
|
+
//#region src/loaders/config.ts
|
|
8
|
+
function createStandaloneConfigLoader({ core, buildConfig, mode }) {
|
|
9
|
+
let prev;
|
|
10
|
+
async function getConfigHash() {
|
|
11
|
+
if (mode === "production") return "static";
|
|
12
|
+
return (await fs.stat(core.getOptions().configPath).catch(() => {
|
|
13
|
+
throw new Error("Cannot find config file");
|
|
14
|
+
})).mtime.getTime().toString();
|
|
15
|
+
}
|
|
16
|
+
return { async getCore() {
|
|
17
|
+
const hash = await getConfigHash();
|
|
18
|
+
if (!prev || hash !== prev.hash) prev = {
|
|
19
|
+
hash,
|
|
20
|
+
init: (async () => {
|
|
21
|
+
const { loadConfig } = await import("./load-from-file-C36LHYQZ.js").then((n) => n.n);
|
|
22
|
+
await core.init({ config: loadConfig(core, buildConfig) });
|
|
23
|
+
})()
|
|
24
|
+
};
|
|
25
|
+
await prev.init;
|
|
26
|
+
return core;
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* create config loader from initialized core
|
|
31
|
+
*/
|
|
32
|
+
function createIntegratedConfigLoader(core) {
|
|
33
|
+
return { async getCore() {
|
|
34
|
+
return core;
|
|
35
|
+
} };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
7
39
|
//#region src/loaders/adapter.ts
|
|
8
40
|
function toNode(loader) {
|
|
9
41
|
return async (url, _context, nextLoad) => {
|
|
@@ -34,6 +66,7 @@ function toVite(loader) {
|
|
|
34
66
|
return !loader.test || loader.test.test(id);
|
|
35
67
|
},
|
|
36
68
|
async transform(value, id) {
|
|
69
|
+
const environment = this.environment;
|
|
37
70
|
const [file, query = ""] = id.split("?", 2);
|
|
38
71
|
const result = await loader.load({
|
|
39
72
|
filePath: file,
|
|
@@ -41,9 +74,9 @@ function toVite(loader) {
|
|
|
41
74
|
getSource() {
|
|
42
75
|
return value;
|
|
43
76
|
},
|
|
44
|
-
development:
|
|
45
|
-
compiler: { addDependency: (file
|
|
46
|
-
this.addWatchFile(file
|
|
77
|
+
development: environment.mode === "dev",
|
|
78
|
+
compiler: { addDependency: (file) => {
|
|
79
|
+
this.addWatchFile(file);
|
|
47
80
|
} }
|
|
48
81
|
});
|
|
49
82
|
if (result === null) return null;
|
|
@@ -108,37 +141,5 @@ function toBun(loader) {
|
|
|
108
141
|
}
|
|
109
142
|
|
|
110
143
|
//#endregion
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
let prev;
|
|
114
|
-
async function getConfigHash() {
|
|
115
|
-
if (mode === "production") return "static";
|
|
116
|
-
return (await fs.stat(core.getOptions().configPath).catch(() => {
|
|
117
|
-
throw new Error("Cannot find config file");
|
|
118
|
-
})).mtime.getTime().toString();
|
|
119
|
-
}
|
|
120
|
-
return { async getCore() {
|
|
121
|
-
const hash = await getConfigHash();
|
|
122
|
-
if (!prev || hash !== prev.hash) prev = {
|
|
123
|
-
hash,
|
|
124
|
-
init: (async () => {
|
|
125
|
-
const { loadConfig } = await import("./load-from-file-BoO9y-n6.js");
|
|
126
|
-
await core.init({ config: loadConfig(core, buildConfig) });
|
|
127
|
-
})()
|
|
128
|
-
};
|
|
129
|
-
await prev.init;
|
|
130
|
-
return core;
|
|
131
|
-
} };
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* create config loader from initialized core
|
|
135
|
-
*/
|
|
136
|
-
function createIntegratedConfigLoader(core) {
|
|
137
|
-
return { async getCore() {
|
|
138
|
-
return core;
|
|
139
|
-
} };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
//#endregion
|
|
143
|
-
export { toVite as a, toNode as i, createStandaloneConfigLoader as n, toWebpack as o, toBun as r, createIntegratedConfigLoader as t };
|
|
144
|
-
//# sourceMappingURL=config-DSrG5Dfc.js.map
|
|
144
|
+
export { createIntegratedConfigLoader as a, toWebpack as i, toNode as n, createStandaloneConfigLoader as o, toVite as r, toBun as t };
|
|
145
|
+
//# sourceMappingURL=adapter-DwaTu9dw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-DwaTu9dw.js","names":[],"sources":["../src/loaders/config.ts","../src/loaders/adapter.ts"],"sourcesContent":["import type { Core } from '../core';\nimport fs from 'node:fs/promises';\n\nexport interface ConfigLoader {\n getCore(): Promise<Core>;\n}\n\nexport function createStandaloneConfigLoader({\n core,\n buildConfig,\n mode,\n}: {\n /**\n * core (not initialized)\n */\n core: Core;\n buildConfig: boolean;\n /**\n * In dev mode, the config file is dynamically re-loaded when it's updated.\n */\n mode: 'dev' | 'production';\n}): ConfigLoader {\n let prev:\n | {\n hash: string;\n init: Promise<void>;\n }\n | undefined;\n\n async function getConfigHash(): Promise<string> {\n if (mode === 'production') return 'static';\n\n const stats = await fs.stat(core.getOptions().configPath).catch(() => {\n throw new Error('Cannot find config file');\n });\n\n return stats.mtime.getTime().toString();\n }\n\n return {\n async getCore() {\n const hash = await getConfigHash();\n if (!prev || hash !== prev.hash) {\n prev = {\n hash,\n init: (async () => {\n const { loadConfig } = await import('../config/load-from-file');\n\n await core.init({\n config: loadConfig(core, buildConfig),\n });\n })(),\n };\n }\n\n await prev.init;\n return core;\n },\n };\n}\n\n/**\n * create config loader from initialized core\n */\nexport function createIntegratedConfigLoader(core: Core): ConfigLoader {\n return {\n async getCore() {\n return core;\n },\n };\n}\n","import type { CompilerOptions } from './mdx/build-mdx';\nimport type { LoadFnOutput, LoadHook } from 'node:module';\nimport { fileURLToPath } from 'node:url';\nimport fs from 'node:fs/promises';\nimport type { TransformPluginContext } from 'rollup';\nimport type { Environment, TransformResult } from 'vite';\nimport { parse } from 'node:querystring';\nimport { ValidationError } from '../utils/validation';\nimport type { LoaderContext } from 'webpack';\nimport { readFileSync } from 'node:fs';\n\nexport interface LoaderInput {\n development: boolean;\n compiler: CompilerOptions;\n\n filePath: string;\n query: Record<string, string | string[] | undefined>;\n getSource: () => string | Promise<string>;\n}\n\nexport interface LoaderOutput {\n code: string;\n map?: unknown;\n\n /**\n * Only supported in Vite 8.\n *\n * Explicitly define the transformed module type, for unsupported environments, you need to consider the differences between each bundler.\n */\n moduleType?: 'js' | 'json';\n}\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface Loader {\n /**\n * Filter file paths, the input can be either a file URL or file path.\n *\n * Must take resource query into consideration.\n */\n test?: RegExp;\n\n /**\n * Transform input into JavaScript.\n *\n * Returns:\n * - `LoaderOutput`: JavaScript code & source map.\n * - `null`: skip the loader. Fallback to default behaviour if possible, otherwise the adapter will try workarounds.\n */\n load: (input: LoaderInput) => Awaitable<LoaderOutput | null>;\n\n bun?: {\n /**\n * 1. Bun doesn't allow `null` in loaders.\n * 2. Bun requires sync result to support dynamic require().\n */\n load?: (source: string, input: LoaderInput) => Awaitable<Bun.OnLoadResult>;\n };\n}\n\nexport function toNode(loader: Loader): LoadHook {\n return async (url, _context, nextLoad): Promise<LoadFnOutput> => {\n if (url.startsWith('file:///') && (!loader.test || loader.test.test(url))) {\n const parsedUrl = new URL(url);\n const filePath = fileURLToPath(parsedUrl);\n\n const result = await loader.load({\n filePath,\n query: Object.fromEntries(parsedUrl.searchParams.entries()),\n async getSource() {\n return (await fs.readFile(filePath)).toString();\n },\n development: false,\n compiler: {\n addDependency() {},\n },\n });\n\n if (result) {\n return {\n source: result.code,\n format: 'module',\n shortCircuit: true,\n };\n }\n }\n\n return nextLoad(url);\n };\n}\n\nexport interface ViteLoader {\n filter: (id: string) => boolean;\n\n transform: (\n this: TransformPluginContext,\n value: string,\n id: string,\n ) => Promise<TransformResult | null>;\n}\n\nexport function toVite(loader: Loader): ViteLoader {\n return {\n filter(id) {\n return !loader.test || loader.test.test(id);\n },\n async transform(value, id) {\n // Vite doesn't expose the real context types\n const environment = (this as unknown as { environment: Environment }).environment;\n const [file, query = ''] = id.split('?', 2);\n\n const result = await loader.load({\n filePath: file,\n query: parse(query),\n getSource() {\n return value;\n },\n development: environment.mode === 'dev',\n compiler: {\n addDependency: (file) => {\n this.addWatchFile(file);\n },\n },\n });\n\n if (result === null) return null;\n return {\n code: result.code,\n map: result.map as TransformResult['map'],\n moduleType: result.moduleType,\n };\n },\n };\n}\n\nexport type WebpackLoader = (\n this: LoaderContext<unknown>,\n source: string,\n callback: LoaderContext<unknown>['callback'],\n) => Promise<void>;\n\n/**\n * need to handle the `test` regex in Webpack config instead.\n */\nexport function toWebpack(loader: Loader): WebpackLoader {\n return async function (source, callback) {\n try {\n const result = await loader.load({\n filePath: this.resourcePath,\n query: parse(this.resourceQuery.slice(1)),\n getSource() {\n return source;\n },\n development: this.mode === 'development',\n compiler: this,\n });\n\n if (result === null) {\n callback(undefined, source);\n } else {\n callback(undefined, result.code, result.map as string);\n }\n } catch (error) {\n if (error instanceof ValidationError) {\n return callback(new Error(await error.toStringFormatted()));\n }\n\n if (!(error instanceof Error)) throw error;\n callback(error);\n }\n };\n}\n\nexport function toBun(loader: Loader) {\n function toResult(output: LoaderOutput | null): Bun.OnLoadResult {\n // it errors, treat this as an exception\n if (!output) return;\n\n return {\n contents: output.code,\n loader: output.moduleType ?? 'js',\n };\n }\n\n return (build: Bun.PluginBuilder) => {\n // avoid using async here, because it will cause dynamic require() to fail\n build.onLoad({ filter: loader.test ?? /.+/ }, (args) => {\n const [filePath, query = ''] = args.path.split('?', 2);\n const input: LoaderInput = {\n async getSource() {\n return Bun.file(filePath).text();\n },\n query: parse(query),\n filePath,\n development: false,\n compiler: {\n addDependency() {},\n },\n };\n\n if (loader.bun?.load) {\n return loader.bun.load(readFileSync(filePath).toString(), input);\n }\n\n const result = loader.load(input);\n if (result instanceof Promise) {\n return result.then(toResult);\n }\n return toResult(result);\n });\n };\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,6BAA6B,EAC3C,MACA,aACA,QAWe;CACf,IAAI;CAOJ,eAAe,gBAAiC;AAC9C,MAAI,SAAS,aAAc,QAAO;AAMlC,UAJc,MAAM,GAAG,KAAK,KAAK,YAAY,CAAC,WAAW,CAAC,YAAY;AACpE,SAAM,IAAI,MAAM,0BAA0B;IAC1C,EAEW,MAAM,SAAS,CAAC,UAAU;;AAGzC,QAAO,EACL,MAAM,UAAU;EACd,MAAM,OAAO,MAAM,eAAe;AAClC,MAAI,CAAC,QAAQ,SAAS,KAAK,KACzB,QAAO;GACL;GACA,OAAO,YAAY;IACjB,MAAM,EAAE,eAAe,MAAM,OAAO;AAEpC,UAAM,KAAK,KAAK,EACd,QAAQ,WAAW,MAAM,YAAY,EACtC,CAAC;OACA;GACL;AAGH,QAAM,KAAK;AACX,SAAO;IAEV;;;;;AAMH,SAAgB,6BAA6B,MAA0B;AACrE,QAAO,EACL,MAAM,UAAU;AACd,SAAO;IAEV;;;;;ACTH,SAAgB,OAAO,QAA0B;AAC/C,QAAO,OAAO,KAAK,UAAU,aAAoC;AAC/D,MAAI,IAAI,WAAW,WAAW,KAAK,CAAC,OAAO,QAAQ,OAAO,KAAK,KAAK,IAAI,GAAG;GACzE,MAAM,YAAY,IAAI,IAAI,IAAI;GAC9B,MAAM,WAAW,cAAc,UAAU;GAEzC,MAAM,SAAS,MAAM,OAAO,KAAK;IAC/B;IACA,OAAO,OAAO,YAAY,UAAU,aAAa,SAAS,CAAC;IAC3D,MAAM,YAAY;AAChB,aAAQ,MAAM,GAAG,SAAS,SAAS,EAAE,UAAU;;IAEjD,aAAa;IACb,UAAU,EACR,gBAAgB,IACjB;IACF,CAAC;AAEF,OAAI,OACF,QAAO;IACL,QAAQ,OAAO;IACf,QAAQ;IACR,cAAc;IACf;;AAIL,SAAO,SAAS,IAAI;;;AA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AAM,GAAG,SAAS;GACtD,MAAM,CAAC,UAAU,QAAQ,MAAM,KAAK,KAAK,MAAM,KAAK,EAAE;GACtD,MAAM,QAAqB;IACzB,MAAM,YAAY;AAChB,YAAO,IAAI,KAAK,SAAS,CAAC,MAAM;;IAElC,OAAO,MAAM,MAAM;IACnB;IACA,aAAa;IACb,UAAU,EACR,gBAAgB,IACjB;IACF;AAED,OAAI,OAAO,KAAK,KACd,QAAO,OAAO,IAAI,KAAK,aAAa,SAAS,CAAC,UAAU,EAAE,MAAM;GAGlE,MAAM,SAAS,OAAO,KAAK,MAAM;AACjC,OAAI,kBAAkB,QACpB,QAAO,OAAO,KAAK,SAAS;AAE9B,UAAO,SAAS,OAAO;IACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as applyMdxPreset } from "./preset-
|
|
1
|
+
import { t as applyMdxPreset } from "./preset-B14ViDfq.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import picomatch from "picomatch";
|
|
4
4
|
|
|
@@ -97,4 +97,4 @@ function buildConfig(config, cwd = process.cwd()) {
|
|
|
97
97
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { buildConfig as t };
|
|
100
|
-
//# sourceMappingURL=build-
|
|
100
|
+
//# sourceMappingURL=build-d7coQAP7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-d7coQAP7.js","names":[],"sources":["../src/config/build.ts"],"sourcesContent":["import type { ProcessorOptions } from '@mdx-js/mdx';\nimport type {\n AnyCollection,\n DocCollection,\n DocsCollection,\n GlobalConfig,\n MetaCollection,\n} from './define';\nimport picomatch from 'picomatch';\nimport { applyMdxPreset } from './preset';\nimport path from 'node:path';\n\nexport type BuildEnvironment = 'bundler' | 'runtime';\n\nexport interface LoadedConfig {\n collections: Map<string, CollectionItem>;\n global: GlobalConfig;\n getMDXOptions(\n collection?: DocCollectionItem,\n environment?: BuildEnvironment,\n ): ProcessorOptions | Promise<ProcessorOptions>;\n workspaces: Record<\n string,\n {\n dir: string;\n config: LoadedConfig;\n }\n >;\n}\n\nexport type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;\n\ninterface PrimitiveCollectionItem {\n name: string;\n cwd: string;\n /**\n * content directory (absolute)\n */\n dir: string;\n hasFile: (filePath: string) => boolean;\n isFileSupported: (filePath: string) => boolean;\n patterns: string[];\n}\n\nexport type MetaCollectionItem = PrimitiveCollectionItem & Omit<MetaCollection, 'files' | 'dir'>;\nexport type DocCollectionItem = PrimitiveCollectionItem & Omit<DocCollection, 'files' | 'dir'>;\n\nexport interface DocsCollectionItem\n extends Omit<DocsCollection, 'dir' | 'meta' | 'docs'>, Omit<PrimitiveCollectionItem, 'patterns'> {\n meta: MetaCollectionItem;\n docs: DocCollectionItem;\n}\n\nconst SupportedFormats = {\n doc: ['mdx', 'md'],\n meta: ['json', 'yaml'],\n};\n\nexport function buildCollection(\n name: string,\n collection: AnyCollection,\n cwd: string,\n): CollectionItem {\n if (collection.type === 'docs') {\n return {\n ...collection,\n type: 'docs',\n get dir() {\n return this.docs.dir;\n },\n name,\n meta: buildCollection(name, collection.meta, cwd) as MetaCollectionItem,\n docs: buildCollection(name, collection.docs, cwd) as DocCollectionItem,\n hasFile(filePath) {\n return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);\n },\n isFileSupported(filePath) {\n return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);\n },\n cwd,\n };\n }\n\n return {\n ...collection,\n ...buildPrimitiveCollection(name, collection, cwd),\n };\n}\n\nfunction buildPrimitiveCollection(\n name: string,\n config: DocCollection | MetaCollection,\n cwd: string,\n): PrimitiveCollectionItem {\n const supportedFormats = SupportedFormats[config.type];\n const patterns = config.files ?? [`**/*.{${supportedFormats.join(',')}}`];\n let matcher: picomatch.Matcher;\n\n return {\n dir: path.resolve(cwd, config.dir),\n cwd,\n name,\n patterns,\n isFileSupported(filePath) {\n return supportedFormats.some((format) => filePath.endsWith(`.${format}`));\n },\n hasFile(filePath) {\n if (!this.isFileSupported(filePath)) return false;\n\n const relativePath = path.relative(this.dir, filePath);\n if (relativePath.startsWith(`..${path.sep}`)) return false;\n\n return (matcher ??= picomatch(patterns))(relativePath);\n },\n };\n}\n\nexport function buildConfig(config: Record<string, unknown>, cwd = process.cwd()): LoadedConfig {\n const collections = new Map<string, CollectionItem>();\n const loaded: GlobalConfig = {};\n\n for (const [k, v] of Object.entries(config)) {\n if (!v) {\n continue;\n }\n\n if (typeof v === 'object' && 'type' in v) {\n if (v.type === 'docs' || v.type === 'doc' || v.type === 'meta') {\n collections.set(k, buildCollection(k, v as AnyCollection, cwd));\n continue;\n }\n }\n\n if (k === 'default' && v) {\n Object.assign(loaded, v);\n continue;\n }\n\n throw new Error(\n `Unknown export \"${k}\", you can only export collections from source configuration file.`,\n );\n }\n\n const mdxOptionsCache = new Map<string, ProcessorOptions | Promise<ProcessorOptions>>();\n return {\n global: loaded,\n collections,\n workspaces: Object.fromEntries(\n Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {\n return [\n key,\n {\n dir: value.dir,\n config: buildConfig(value.config, path.resolve(cwd, value.dir)),\n },\n ];\n }),\n ),\n getMDXOptions(collection, environment = 'bundler') {\n const key = collection ? `${environment}:${collection.name}` : environment;\n const cached = mdxOptionsCache.get(key);\n if (cached) return cached;\n let result: ProcessorOptions | Promise<ProcessorOptions>;\n\n if (collection?.mdxOptions) {\n const optionsFn = collection.mdxOptions;\n result = typeof optionsFn === 'function' ? optionsFn(environment) : optionsFn;\n } else {\n result = (async () => {\n const optionsFn = this.global.mdxOptions;\n const options = typeof optionsFn === 'function' ? await optionsFn() : optionsFn;\n\n return applyMdxPreset(options)(environment);\n })();\n }\n\n mdxOptionsCache.set(key, result);\n return result;\n },\n };\n}\n"],"mappings":";;;;;AAqDA,MAAM,mBAAmB;CACvB,KAAK,CAAC,OAAO,KAAK;CAClB,MAAM,CAAC,QAAQ,OAAO;CACvB;AAED,SAAgB,gBACd,MACA,YACA,KACgB;AA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AAI,EAAE,SAAS,UAAU,EAAE,SAAS,SAAS,EAAE,SAAS,QAAQ;AAC9D,gBAAY,IAAI,GAAG,gBAAgB,GAAG,GAAoB,IAAI,CAAC;AAC/D;;;AAIJ,MAAI,MAAM,aAAa,GAAG;AACxB,UAAO,OAAO,QAAQ,EAAE;AACxB;;AAGF,QAAM,IAAI,MACR,mBAAmB,EAAE,oEACtB;;CAGH,MAAM,kCAAkB,IAAI,KAA2D;AACvF,QAAO;EACL,QAAQ;EACR;EACA,YAAY,OAAO,YACjB,OAAO,QAAQ,OAAO,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW;AAC5D,UAAO,CACL,KACA;IACE,KAAK,MAAM;IACX,QAAQ,YAAY,MAAM,QAAQ,KAAK,QAAQ,KAAK,MAAM,IAAI,CAAC;IAChE,CACF;IACD,CACH;EACD,cAAc,YAAY,cAAc,WAAW;GACjD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,WAAW,SAAS;GAC/D,MAAM,SAAS,gBAAgB,IAAI,IAAI;AACvC,OAAI,OAAQ,QAAO;GACnB,IAAI;AAEJ,OAAI,YAAY,YAAY;IAC1B,MAAM,YAAY,WAAW;AAC7B,aAAS,OAAO,cAAc,aAAa,UAAU,YAAY,GAAG;SAEpE,WAAU,YAAY;IACpB,MAAM,YAAY,KAAK,OAAO;AAG9B,WAAO,eAFS,OAAO,cAAc,aAAa,MAAM,WAAW,GAAG,UAExC,CAAC,YAAY;OACzC;AAGN,mBAAgB,IAAI,KAAK,OAAO;AAChC,UAAO;;EAEV"}
|
|
@@ -24,30 +24,30 @@ interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
|
24
24
|
*/
|
|
25
25
|
_mdast?: string;
|
|
26
26
|
}
|
|
27
|
-
interface
|
|
27
|
+
interface DocsDataMap {
|
|
28
28
|
/**
|
|
29
|
-
* [
|
|
29
|
+
* [Hanzo Docs MDX] raw frontmatter, you can modify it
|
|
30
30
|
*/
|
|
31
31
|
frontmatter?: Record<string, unknown>;
|
|
32
32
|
/**
|
|
33
|
-
* [
|
|
33
|
+
* [Hanzo Docs MDX] additional ESM exports to write
|
|
34
34
|
*/
|
|
35
35
|
'mdx-export'?: {
|
|
36
36
|
name: string;
|
|
37
37
|
value: unknown;
|
|
38
38
|
}[];
|
|
39
39
|
/**
|
|
40
|
-
* [
|
|
40
|
+
* [Hanzo Docs MDX] The compiler object from loader
|
|
41
41
|
*/
|
|
42
42
|
_compiler?: CompilerOptions;
|
|
43
43
|
/**
|
|
44
|
-
* [
|
|
44
|
+
* [Hanzo Docs MDX] get internal processor, do not use this on user land.
|
|
45
45
|
*/
|
|
46
46
|
_getProcessor?: (format: 'md' | 'mdx') => Processor;
|
|
47
47
|
}
|
|
48
48
|
declare module 'vfile' {
|
|
49
|
-
interface DataMap extends
|
|
49
|
+
interface DataMap extends DocsDataMap {}
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
export { CompiledMDXProperties as t };
|
|
53
|
-
//# sourceMappingURL=build-mdx-
|
|
53
|
+
//# sourceMappingURL=build-mdx-CaG9rsmy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-mdx-CaG9rsmy.d.ts","names":[],"sources":["../src/loaders/mdx/build-mdx.ts"],"mappings":";;;;;;;;KAWK,SAAA,GAAY,UAAA,QAAkB,eAAA;AAAA,UAelB,eAAA;EACf,aAAA,GAAgB,IAAA;AAAA;AAAA,UAGD,qBAAA,eAAoC,MAAA;EACnD,WAAA,EAAa,WAAA;EACb,cAAA,EAAgB,cAAA;EAChB,GAAA,EAAK,WAAA;EACL,OAAA,EAAS,EAAA,CAAG,QAAA;EAAD;;;EAKX,SAAA;EARa;;;EAYb,MAAA;AAAA;AAAA,UAGe,WAAA;EAZN;;;EAgBT,WAAA,GAAc,MAAA;EAPR;;AAGR;EASE,YAAA;IAAiB,IAAA;IAAc,KAAA;EAAA;EAUW;;;EAL1C,SAAA,GAAY,eAAA;EAVE;;;EAed,aAAA,IAAiB,MAAA,mBAAyB,SAAA;AAAA;AAAA;EAAA,UAKhC,OAAA,SAAgB,WAAA;AAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CjeV3_4I.js";
|
|
2
|
+
import { n as flattenNode, t as remarkInclude } from "./remark-include-DfEJ3erI.js";
|
|
2
3
|
import { visit } from "unist-util-visit";
|
|
3
4
|
import { VFile } from "vfile";
|
|
4
5
|
import { createProcessor } from "@mdx-js/mdx";
|
|
@@ -42,10 +43,16 @@ function remarkPostprocess({ _format, includeProcessedMarkdown = false, includeM
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
if (includeProcessedMarkdown) {
|
|
46
|
+
const { headingIds = true } = typeof includeProcessedMarkdown === "object" ? includeProcessedMarkdown : {};
|
|
45
47
|
const processor = getStringifyProcessor();
|
|
46
48
|
const markdown = toMarkdown(tree, {
|
|
47
49
|
...processor.data("settings"),
|
|
48
|
-
extensions: processor.data("toMarkdownExtensions") || []
|
|
50
|
+
extensions: processor.data("toMarkdownExtensions") || [],
|
|
51
|
+
handlers: { heading: (node) => {
|
|
52
|
+
const id = node.data?.hProperties?.id;
|
|
53
|
+
const content = flattenNode(node);
|
|
54
|
+
return headingIds && id ? `${content} [#${id}]` : content;
|
|
55
|
+
} }
|
|
49
56
|
});
|
|
50
57
|
file.data["mdx-export"].push({
|
|
51
58
|
name: "_markdown",
|
|
@@ -104,6 +111,7 @@ function getMdastExport(name, value) {
|
|
|
104
111
|
|
|
105
112
|
//#endregion
|
|
106
113
|
//#region src/loaders/mdx/build-mdx.ts
|
|
114
|
+
var build_mdx_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
|
|
107
115
|
async function buildMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
|
|
108
116
|
const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);
|
|
109
117
|
function getProcessor(format) {
|
|
@@ -149,5 +157,5 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
|
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
//#endregion
|
|
152
|
-
export { buildMDX as t };
|
|
153
|
-
//# sourceMappingURL=build-mdx-
|
|
160
|
+
export { build_mdx_exports as n, buildMDX as t };
|
|
161
|
+
//# sourceMappingURL=build-mdx-k6Y12VXb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-mdx-k6Y12VXb.js","names":[],"sources":["../src/loaders/mdx/remark-postprocess.ts","../src/loaders/mdx/build-mdx.ts"],"sourcesContent":["import type { Processor, Transformer } from 'unified';\nimport type { Heading, Root, RootContent } from 'mdast';\nimport { visit } from 'unist-util-visit';\nimport { toMarkdown } from 'mdast-util-to-markdown';\nimport { valueToEstree } from 'estree-util-value-to-estree';\nimport { removePosition } from 'unist-util-remove-position';\nimport remarkMdx from 'remark-mdx';\nimport { flattenNode } from './mdast-utils';\n\nexport interface ExtractedReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: 'md' | 'mdx';\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n includeProcessedMarkdown?:\n | boolean\n | {\n /**\n * include heading IDs into the processed markdown.\n */\n headingIds?: boolean;\n };\n\n /**\n * extract link references, export via `extractedReferences`.\n */\n extractLinkReferences?: boolean;\n\n /**\n * store MDAST and export via `_mdast`.\n */\n includeMDAST?:\n | boolean\n | {\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n _format,\n includeProcessedMarkdown = false,\n includeMDAST = false,\n extractLinkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n let _stringifyProcessor: Processor | undefined;\n const getStringifyProcessor = () => {\n return (_stringifyProcessor ??=\n _format === 'mdx'\n ? this\n : // force Markdown processor to stringify MDX nodes\n this().use(remarkMdx).freeze());\n };\n\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, 'heading', (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data['mdx-export'] ??= [];\n file.data['mdx-export'].push({\n name: 'frontmatter',\n value: frontmatter,\n });\n\n if (extractLinkReferences) {\n const urls: ExtractedReference[] = [];\n\n visit(tree, 'link', (node) => {\n urls.push({\n href: node.url,\n });\n return 'skip';\n });\n\n file.data['mdx-export'].push({\n name: 'extractedReferences',\n value: urls,\n });\n }\n\n if (includeProcessedMarkdown) {\n const { headingIds = true } =\n typeof includeProcessedMarkdown === 'object' ? includeProcessedMarkdown : {};\n const processor = getStringifyProcessor();\n const markdown = toMarkdown(tree, {\n ...processor.data('settings'),\n // from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js\n extensions: processor.data('toMarkdownExtensions') || [],\n handlers: {\n heading: (node: Heading) => {\n const id = node.data?.hProperties?.id;\n const content = flattenNode(node);\n return headingIds && id ? `${content} [#${id}]` : content;\n },\n },\n });\n\n file.data['mdx-export'].push({\n name: '_markdown',\n value: markdown,\n });\n }\n\n if (includeMDAST) {\n const options = includeMDAST === true ? {} : includeMDAST;\n const mdast = JSON.stringify(\n options.removePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data['mdx-export'].push({\n name: '_mdast',\n value: mdast,\n });\n }\n\n for (const { name, value } of file.data['mdx-export']) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data['mdx-export'] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: [\n {\n type: 'ExportNamedDeclaration',\n attributes: [],\n specifiers: [],\n source: null,\n declaration: {\n type: 'VariableDeclaration',\n kind: 'let',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: {\n type: 'Identifier',\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import { createProcessor } from '@mdx-js/mdx';\nimport { VFile } from 'vfile';\nimport { remarkInclude } from './remark-include';\nimport type { StructuredData } from '@hanzo/docs-core/mdx-plugins';\nimport type { TOCItemType } from '@hanzo/docs-core/toc';\nimport type { FC } from 'react';\nimport type { MDXProps } from 'mdx/types';\nimport { type PostprocessOptions, remarkPostprocess } from './remark-postprocess';\nimport type { Core } from '../../core';\nimport type { DocCollectionItem } from '../../config/build';\n\ntype Processor = ReturnType<typeof createProcessor>;\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: 'bundler' | 'runtime';\n isDevelopment: boolean;\n _compiler?: CompilerOptions;\n}\n\nexport interface CompilerOptions {\n addDependency: (file: string) => void;\n}\n\nexport interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {\n frontmatter: Frontmatter;\n structuredData: StructuredData;\n toc: TOCItemType[];\n default: FC<MDXProps>;\n\n /**\n * Enable from `postprocess` option.\n */\n _markdown?: string;\n /**\n * Enable from `postprocess` option.\n */\n _mdast?: string;\n}\n\nexport interface DocsDataMap {\n /**\n * [Hanzo Docs MDX] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Hanzo Docs MDX] additional ESM exports to write\n */\n 'mdx-export'?: { name: string; value: unknown }[];\n\n /**\n * [Hanzo Docs MDX] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Hanzo Docs MDX] get internal processor, do not use this on user land.\n */\n _getProcessor?: (format: 'md' | 'mdx') => Processor;\n}\n\ndeclare module 'vfile' {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends DocsDataMap {}\n}\n\nexport async function buildMDX(\n core: Core,\n collection: DocCollectionItem | undefined,\n { filePath, frontmatter, source, _compiler, environment, isDevelopment }: BuildMDXOptions,\n): Promise<VFile> {\n const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);\n\n function getProcessor(format: 'md' | 'mdx') {\n const cache = core.cache as Map<string, Processor>;\n const key = `build-mdx:${collection?.name ?? 'global'}:${format}`;\n let processor = cache.get(key);\n\n if (!processor) {\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...collection?.postprocess,\n };\n\n processor = createProcessor({\n outputFormat: 'program',\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n remarkInclude,\n ...(mdxOptions.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n\n cache.set(key, processor);\n }\n\n return processor;\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: collection?.cwd,\n data: { frontmatter, _compiler, _getProcessor: getProcessor },\n });\n\n if (collection) {\n vfile = await core.transformVFile({ collection, filePath, source }, vfile);\n }\n\n return getProcessor(filePath.endsWith('.mdx') ? 'mdx' : 'md').process(vfile);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,SAAgB,kBAEd,EACE,SACA,2BAA2B,OAC3B,eAAe,OACf,wBAAwB,OACxB,gBAAgB,EAAE,IAEK;CACzB,IAAI;CACJ,MAAM,8BAA8B;AAClC,SAAQ,wBACN,YAAY,QACR,OAEA,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ;;AAGtC,SAAQ,MAAM,SAAS;EACrB,MAAM,cAAe,KAAK,KAAK,gBAAgB,EAAE;AACjD,MAAI,CAAC,YAAY,MACf,OAAM,MAAM,YAAY,SAAS;AAC/B,OAAI,KAAK,UAAU,GAAG;AACpB,gBAAY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,MAAM"}
|
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/bun/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/bun/index.ts"],"mappings":";;;;UASiB,gBAAA,SAAyB,OAAA,CAAQ,WAAA;;AAAlD;;EAIE,eAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,OAAA,GAAS,gBAAA,GAAwB,SAAA"}
|
package/dist/bun/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import "../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import "../frontmatter-DePDVaRD.js";
|
|
2
|
+
import { t as createMdxLoader } from "../mdx-DbiNLrgs.js";
|
|
3
|
+
import "../preset-B14ViDfq.js";
|
|
4
|
+
import { t as buildConfig } from "../build-d7coQAP7.js";
|
|
5
|
+
import { n as createCore, t as _Defaults } from "../core-DFgQdyqL.js";
|
|
6
|
+
import "../codegen-DzglA9tJ.js";
|
|
7
|
+
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DwaTu9dw.js";
|
|
8
|
+
import { t as createMetaLoader } from "../meta-C3cm2Bl5.js";
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
10
10
|
|
|
11
11
|
//#region src/bun/index.ts
|
package/dist/bun/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":["import type { BunPlugin } from 'bun';\nimport { createMdxLoader } from '
|
|
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"}
|
|
@@ -88,9 +88,9 @@ function normalizeViteGlobPath(file) {
|
|
|
88
88
|
if (file.startsWith("/")) return `.${file}`;
|
|
89
89
|
return `./${file}`;
|
|
90
90
|
}
|
|
91
|
-
function slash(path
|
|
92
|
-
if (path
|
|
93
|
-
return path
|
|
91
|
+
function slash(path) {
|
|
92
|
+
if (path.startsWith("\\\\?\\")) return path;
|
|
93
|
+
return path.replaceAll("\\", "/");
|
|
94
94
|
}
|
|
95
95
|
function ident(code, tab = 1) {
|
|
96
96
|
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
@@ -98,4 +98,4 @@ function ident(code, tab = 1) {
|
|
|
98
98
|
|
|
99
99
|
//#endregion
|
|
100
100
|
export { ident as n, slash as r, createCodegen as t };
|
|
101
|
-
//# sourceMappingURL=codegen-
|
|
101
|
+
//# sourceMappingURL=codegen-DzglA9tJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-DzglA9tJ.js","names":[],"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,MAAM,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,sBAAsB;AAE5F,UAAO,oBAAoB,KAAK,UAAU,SAAS,CAAC,IAAI,KAAK,UAC3D;IACE,MAAM,sBAAsB,KAAK,SAAS,QAAQ,KAAK,CAAC;IACxD,GAAG;IACJ,EACD,MACA,EACD,CAAC;;EAEJ,MAAM,uBACJ,UACA,EAAE,MAAM,QAAQ,OAAO,QA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;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,MAAsB;AAG1C,KAF6B,KAAK,WAAW,UAAU,CAGrD,QAAO;AAGT,QAAO,KAAK,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,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
|
1
|
+
import { A as MDXPresetOptions, C as defineConfig, D as metaSchema, E as PostprocessOptions, O as pageSchema, S as defineCollections, _ as CollectionSchema, b as GlobalConfig, g as BaseCollection, h as AnyCollection, j as applyMdxPreset, k as DefaultMDXOptions, m as remarkInclude, v as DocCollection, w as defineDocs, x as MetaCollection, y as DocsCollection } from "../core-cnMNewUq.js";
|
|
2
|
+
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, pageSchema as frontmatterSchema, metaSchema, remarkInclude };
|
package/dist/config/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import { t as remarkInclude } from "../remark-include-
|
|
1
|
+
import "../frontmatter-DePDVaRD.js";
|
|
2
|
+
import { t as applyMdxPreset } from "../preset-B14ViDfq.js";
|
|
3
|
+
import { t as remarkInclude } from "../remark-include-DfEJ3erI.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region ../core/dist/source/schema.js
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +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 }
|
|
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 };","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { MDXPresetOptions } from './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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as ident } from "./codegen-
|
|
2
|
-
import path from "node:path";
|
|
1
|
+
import { n as ident } from "./codegen-DzglA9tJ.js";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/validation.ts
|
|
6
6
|
var ValidationError = class extends Error {
|
|
@@ -29,7 +29,7 @@ async function validate(schema, data, context, errorMessage) {
|
|
|
29
29
|
//#region src/core.ts
|
|
30
30
|
const _Defaults = {
|
|
31
31
|
configPath: "source.config.ts",
|
|
32
|
-
outDir: "
|
|
32
|
+
outDir: "docs"
|
|
33
33
|
};
|
|
34
34
|
async function getPlugins(pluginOptions) {
|
|
35
35
|
const plugins = [];
|
|
@@ -143,28 +143,28 @@ function createCore(options) {
|
|
|
143
143
|
}
|
|
144
144
|
return out;
|
|
145
145
|
},
|
|
146
|
-
async transformMeta(options
|
|
146
|
+
async transformMeta(options, data) {
|
|
147
147
|
const ctx = {
|
|
148
148
|
...this.getPluginContext(),
|
|
149
|
-
...options
|
|
149
|
+
...options
|
|
150
150
|
};
|
|
151
|
-
data = await transformMetadata(options
|
|
151
|
+
data = await transformMetadata(options, data);
|
|
152
152
|
for (const plugin of plugins) if (plugin.meta?.transform) data = await plugin.meta.transform.call(ctx, data) ?? data;
|
|
153
153
|
return data;
|
|
154
154
|
},
|
|
155
|
-
async transformFrontmatter(options
|
|
155
|
+
async transformFrontmatter(options, data) {
|
|
156
156
|
const ctx = {
|
|
157
157
|
...this.getPluginContext(),
|
|
158
|
-
...options
|
|
158
|
+
...options
|
|
159
159
|
};
|
|
160
|
-
data = await transformMetadata(options
|
|
160
|
+
data = await transformMetadata(options, data);
|
|
161
161
|
for (const plugin of plugins) if (plugin.doc?.frontmatter) data = await plugin.doc.frontmatter.call(ctx, data) ?? data;
|
|
162
162
|
return data;
|
|
163
163
|
},
|
|
164
|
-
async transformVFile(options
|
|
164
|
+
async transformVFile(options, file) {
|
|
165
165
|
const ctx = {
|
|
166
166
|
...this.getPluginContext(),
|
|
167
|
-
...options
|
|
167
|
+
...options
|
|
168
168
|
};
|
|
169
169
|
for (const plugin of plugins) if (plugin.doc?.vfile) file = await plugin.doc.vfile.call(ctx, file) ?? file;
|
|
170
170
|
return file;
|
|
@@ -209,4 +209,4 @@ function postprocessPlugin() {
|
|
|
209
209
|
|
|
210
210
|
//#endregion
|
|
211
211
|
export { createCore as n, ValidationError as r, _Defaults as t };
|
|
212
|
-
//# sourceMappingURL=core-
|
|
212
|
+
//# sourceMappingURL=core-DFgQdyqL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-DFgQdyqL.js","names":[],"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 Hanzo Docs 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,SAA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