@hanzo/docs-mdx 14.1.1 → 14.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +21 -12
- package/dist/bin.js.map +1 -0
- package/dist/build-GdAvxpd7.js +100 -0
- package/dist/build-GdAvxpd7.js.map +1 -0
- package/dist/build-mdx-COY0QD1z.js +153 -0
- package/dist/build-mdx-COY0QD1z.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/build-mdx-hB1gzgHy.js +5 -0
- package/dist/bun/index.d.ts +10 -21
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +30 -49
- package/dist/bun/index.js.map +1 -0
- package/dist/codegen-Dd9ILNOr.js +101 -0
- package/dist/codegen-Dd9ILNOr.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/config-DSrG5Dfc.js +144 -0
- package/dist/config-DSrG5Dfc.js.map +1 -0
- package/dist/core-D2BJuXMW.d.ts +364 -0
- package/dist/core-D2BJuXMW.d.ts.map +1 -0
- package/dist/core-DOav5JBx.js +212 -0
- package/dist/core-DOav5JBx.js.map +1 -0
- package/dist/fuma-matter-DL-PfQJ7.js +27 -0
- package/dist/fuma-matter-DL-PfQJ7.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-B3LmDGdu.js +264 -0
- package/dist/index-file-B3LmDGdu.js.map +1 -0
- package/dist/index.d.ts +3 -61
- package/dist/index.js +1 -0
- package/dist/load-from-file-BoO9y-n6.js +5 -0
- package/dist/load-from-file-dsGIDpOc.js +38 -0
- package/dist/load-from-file-dsGIDpOc.js.map +1 -0
- package/dist/loaders-Mp-ZCdLT.js +7 -0
- package/dist/loaders-Mp-ZCdLT.js.map +1 -0
- package/dist/mdx-CJaKR3FR.js +91 -0
- package/dist/mdx-CJaKR3FR.js.map +1 -0
- package/dist/meta-CKrL1Sl9.js +81 -0
- package/dist/meta-CKrL1Sl9.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-D_quDsKp.js +61 -0
- package/dist/preset-D_quDsKp.js.map +1 -0
- package/dist/remark-include-BbnDmUoc.js +247 -0
- package/dist/remark-include-BbnDmUoc.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-BHjsXgTD.js +15 -0
- package/dist/webpack-BHjsXgTD.js.map +1 -0
- package/loader-mdx.cjs +1 -3
- package/loader-meta.cjs +1 -3
- package/package.json +49 -49
- 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/bin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
package/dist/bin.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
import { existsSync } from "fs";
|
|
4
|
+
//#region src/bin.ts
|
|
5
5
|
async function start() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const [configPath, outDir] = process.argv.slice(2);
|
|
7
|
+
if (existsSync("next.config.js") || existsSync("next.config.mjs") || existsSync("next.config.mts") || existsSync("next.config.ts")) {
|
|
8
|
+
const { postInstall } = await import("./next/index.js");
|
|
9
|
+
await postInstall({
|
|
10
|
+
configPath,
|
|
11
|
+
outDir
|
|
12
|
+
});
|
|
13
|
+
} else {
|
|
14
|
+
const { postInstall } = await import("./vite/index.js");
|
|
15
|
+
await postInstall({
|
|
16
|
+
configPath,
|
|
17
|
+
outDir
|
|
18
|
+
});
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
|
-
|
|
21
|
+
start();
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { };
|
|
25
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync } from 'node:fs';\n\nasync function start() {\n const [configPath, outDir] = process.argv.slice(2);\n const isNext =\n existsSync('next.config.js') ||\n existsSync('next.config.mjs') ||\n existsSync('next.config.mts') ||\n existsSync('next.config.ts');\n\n if (isNext) {\n const { postInstall } = await import('./next');\n await postInstall({ configPath, outDir });\n } else {\n const { postInstall } = await import('./vite');\n await postInstall({ configPath, outDir });\n }\n}\n\nvoid start();\n"],"mappings":";;;;AAIA,eAAe,QAAQ;CACrB,MAAM,CAAC,YAAY,UAAU,QAAQ,KAAK,MAAM,EAAE;AAOlD,KALE,WAAW,iBAAiB,IAC5B,WAAW,kBAAkB,IAC7B,WAAW,kBAAkB,IAC7B,WAAW,iBAAiB,EAElB;EACV,MAAM,EAAE,gBAAgB,MAAM,OAAO;AACrC,QAAM,YAAY;GAAE;GAAY;GAAQ,CAAC;QACpC;EACL,MAAM,EAAE,gBAAgB,MAAM,OAAO;AACrC,QAAM,YAAY;GAAE;GAAY;GAAQ,CAAC;;;AAIxC,OAAO"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { t as applyMdxPreset } from "./preset-D_quDsKp.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import picomatch from "picomatch";
|
|
4
|
+
|
|
5
|
+
//#region src/config/build.ts
|
|
6
|
+
const SupportedFormats = {
|
|
7
|
+
doc: ["mdx", "md"],
|
|
8
|
+
meta: ["json", "yaml"]
|
|
9
|
+
};
|
|
10
|
+
function buildCollection(name, collection, cwd) {
|
|
11
|
+
if (collection.type === "docs") return {
|
|
12
|
+
...collection,
|
|
13
|
+
type: "docs",
|
|
14
|
+
get dir() {
|
|
15
|
+
return this.docs.dir;
|
|
16
|
+
},
|
|
17
|
+
name,
|
|
18
|
+
meta: buildCollection(name, collection.meta, cwd),
|
|
19
|
+
docs: buildCollection(name, collection.docs, cwd),
|
|
20
|
+
hasFile(filePath) {
|
|
21
|
+
return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);
|
|
22
|
+
},
|
|
23
|
+
isFileSupported(filePath) {
|
|
24
|
+
return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);
|
|
25
|
+
},
|
|
26
|
+
cwd
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
...collection,
|
|
30
|
+
...buildPrimitiveCollection(name, collection, cwd)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function buildPrimitiveCollection(name, config, cwd) {
|
|
34
|
+
const supportedFormats = SupportedFormats[config.type];
|
|
35
|
+
const patterns = config.files ?? [`**/*.{${supportedFormats.join(",")}}`];
|
|
36
|
+
let matcher;
|
|
37
|
+
return {
|
|
38
|
+
dir: path.resolve(cwd, config.dir),
|
|
39
|
+
cwd,
|
|
40
|
+
name,
|
|
41
|
+
patterns,
|
|
42
|
+
isFileSupported(filePath) {
|
|
43
|
+
return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
|
|
44
|
+
},
|
|
45
|
+
hasFile(filePath) {
|
|
46
|
+
if (!this.isFileSupported(filePath)) return false;
|
|
47
|
+
const relativePath = path.relative(this.dir, filePath);
|
|
48
|
+
if (relativePath.startsWith(`..${path.sep}`)) return false;
|
|
49
|
+
return (matcher ??= picomatch(patterns))(relativePath);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function buildConfig(config, cwd = process.cwd()) {
|
|
54
|
+
const collections = /* @__PURE__ */ new Map();
|
|
55
|
+
const loaded = {};
|
|
56
|
+
for (const [k, v] of Object.entries(config)) {
|
|
57
|
+
if (!v) continue;
|
|
58
|
+
if (typeof v === "object" && "type" in v) {
|
|
59
|
+
if (v.type === "docs" || v.type === "doc" || v.type === "meta") {
|
|
60
|
+
collections.set(k, buildCollection(k, v, cwd));
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (k === "default" && v) {
|
|
65
|
+
Object.assign(loaded, v);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
throw new Error(`Unknown export "${k}", you can only export collections from source configuration file.`);
|
|
69
|
+
}
|
|
70
|
+
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
71
|
+
return {
|
|
72
|
+
global: loaded,
|
|
73
|
+
collections,
|
|
74
|
+
workspaces: Object.fromEntries(Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {
|
|
75
|
+
return [key, {
|
|
76
|
+
dir: value.dir,
|
|
77
|
+
config: buildConfig(value.config, path.resolve(cwd, value.dir))
|
|
78
|
+
}];
|
|
79
|
+
})),
|
|
80
|
+
getMDXOptions(collection, environment = "bundler") {
|
|
81
|
+
const key = collection ? `${environment}:${collection.name}` : environment;
|
|
82
|
+
const cached = mdxOptionsCache.get(key);
|
|
83
|
+
if (cached) return cached;
|
|
84
|
+
let result;
|
|
85
|
+
if (collection?.mdxOptions) {
|
|
86
|
+
const optionsFn = collection.mdxOptions;
|
|
87
|
+
result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
|
|
88
|
+
} else result = (async () => {
|
|
89
|
+
const optionsFn = this.global.mdxOptions;
|
|
90
|
+
return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
|
|
91
|
+
})();
|
|
92
|
+
mdxOptionsCache.set(key, result);
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
export { buildConfig as t };
|
|
100
|
+
//# sourceMappingURL=build-GdAvxpd7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-GdAvxpd7.js","names":["matcher: picomatch.Matcher","loaded: GlobalConfig","result: ProcessorOptions | Promise<ProcessorOptions>"],"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 '@/config/define';\nimport picomatch from 'picomatch';\nimport { applyMdxPreset } from '@/config/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;AAChB,KAAI,WAAW,SAAS,OACtB,QAAO;EACL,GAAG;EACH,MAAM;EACN,IAAI,MAAM;AACR,UAAO,KAAK,KAAK;;EAEnB;EACA,MAAM,gBAAgB,MAAM,WAAW,MAAM,IAAI;EACjD,MAAM,gBAAgB,MAAM,WAAW,MAAM,IAAI;EACjD,QAAQ,UAAU;AAChB,UAAO,KAAK,KAAK,QAAQ,SAAS,IAAI,KAAK,KAAK,QAAQ,SAAS;;EAEnE,gBAAgB,UAAU;AACxB,UAAO,KAAK,KAAK,gBAAgB,SAAS,IAAI,KAAK,KAAK,gBAAgB,SAAS;;EAEnF;EACD;AAGH,QAAO;EACL,GAAG;EACH,GAAG,yBAAyB,MAAM,YAAY,IAAI;EACnD;;AAGH,SAAS,yBACP,MACA,QACA,KACyB;CACzB,MAAM,mBAAmB,iBAAiB,OAAO;CACjD,MAAM,WAAW,OAAO,SAAS,CAAC,SAAS,iBAAiB,KAAK,IAAI,CAAC,GAAG;CACzE,IAAIA;AAEJ,QAAO;EACL,KAAK,KAAK,QAA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I,IAAI;AACvC,OAAI,OAAQ,QAAO;GACnB,IAAIC;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"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { n as flattenNode, t as remarkInclude } from "./remark-include-BbnDmUoc.js";
|
|
2
|
+
import { visit } from "unist-util-visit";
|
|
3
|
+
import { VFile } from "vfile";
|
|
4
|
+
import { createProcessor } from "@mdx-js/mdx";
|
|
5
|
+
import { toMarkdown } from "mdast-util-to-markdown";
|
|
6
|
+
import { valueToEstree } from "estree-util-value-to-estree";
|
|
7
|
+
import { removePosition } from "unist-util-remove-position";
|
|
8
|
+
import remarkMdx from "remark-mdx";
|
|
9
|
+
|
|
10
|
+
//#region src/loaders/mdx/remark-postprocess.ts
|
|
11
|
+
/**
|
|
12
|
+
* - collect references
|
|
13
|
+
* - write frontmatter (auto-title & description)
|
|
14
|
+
*/
|
|
15
|
+
function remarkPostprocess({ _format, includeProcessedMarkdown = false, includeMDAST = false, extractLinkReferences = false, valueToExport = [] }) {
|
|
16
|
+
let _stringifyProcessor;
|
|
17
|
+
const getStringifyProcessor = () => {
|
|
18
|
+
return _stringifyProcessor ??= _format === "mdx" ? this : this().use(remarkMdx).freeze();
|
|
19
|
+
};
|
|
20
|
+
return (tree, file) => {
|
|
21
|
+
const frontmatter = file.data.frontmatter ??= {};
|
|
22
|
+
if (!frontmatter.title) visit(tree, "heading", (node) => {
|
|
23
|
+
if (node.depth === 1) {
|
|
24
|
+
frontmatter.title = flattenNode(node);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
file.data["mdx-export"] ??= [];
|
|
29
|
+
file.data["mdx-export"].push({
|
|
30
|
+
name: "frontmatter",
|
|
31
|
+
value: frontmatter
|
|
32
|
+
});
|
|
33
|
+
if (extractLinkReferences) {
|
|
34
|
+
const urls = [];
|
|
35
|
+
visit(tree, "link", (node) => {
|
|
36
|
+
urls.push({ href: node.url });
|
|
37
|
+
return "skip";
|
|
38
|
+
});
|
|
39
|
+
file.data["mdx-export"].push({
|
|
40
|
+
name: "extractedReferences",
|
|
41
|
+
value: urls
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (includeProcessedMarkdown) {
|
|
45
|
+
const processor = getStringifyProcessor();
|
|
46
|
+
const markdown = toMarkdown(tree, {
|
|
47
|
+
...processor.data("settings"),
|
|
48
|
+
extensions: processor.data("toMarkdownExtensions") || []
|
|
49
|
+
});
|
|
50
|
+
file.data["mdx-export"].push({
|
|
51
|
+
name: "_markdown",
|
|
52
|
+
value: markdown
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (includeMDAST) {
|
|
56
|
+
const options = includeMDAST === true ? {} : includeMDAST;
|
|
57
|
+
const mdast = JSON.stringify(options.removePosition ? removePosition(structuredClone(tree)) : tree);
|
|
58
|
+
file.data["mdx-export"].push({
|
|
59
|
+
name: "_mdast",
|
|
60
|
+
value: mdast
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
for (const { name, value } of file.data["mdx-export"]) tree.children.unshift(getMdastExport(name, value));
|
|
64
|
+
file.data["mdx-export"] = [];
|
|
65
|
+
for (const name of valueToExport) {
|
|
66
|
+
if (!(name in file.data)) continue;
|
|
67
|
+
tree.children.unshift(getMdastExport(name, file.data[name]));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins
|
|
73
|
+
*
|
|
74
|
+
* Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node
|
|
75
|
+
*/
|
|
76
|
+
function getMdastExport(name, value) {
|
|
77
|
+
return {
|
|
78
|
+
type: "mdxjsEsm",
|
|
79
|
+
value: "",
|
|
80
|
+
data: { estree: {
|
|
81
|
+
type: "Program",
|
|
82
|
+
sourceType: "module",
|
|
83
|
+
body: [{
|
|
84
|
+
type: "ExportNamedDeclaration",
|
|
85
|
+
attributes: [],
|
|
86
|
+
specifiers: [],
|
|
87
|
+
source: null,
|
|
88
|
+
declaration: {
|
|
89
|
+
type: "VariableDeclaration",
|
|
90
|
+
kind: "let",
|
|
91
|
+
declarations: [{
|
|
92
|
+
type: "VariableDeclarator",
|
|
93
|
+
id: {
|
|
94
|
+
type: "Identifier",
|
|
95
|
+
name
|
|
96
|
+
},
|
|
97
|
+
init: valueToEstree(value)
|
|
98
|
+
}]
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
} }
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/loaders/mdx/build-mdx.ts
|
|
107
|
+
async function buildMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
|
|
108
|
+
const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);
|
|
109
|
+
function getProcessor(format) {
|
|
110
|
+
const cache = core.cache;
|
|
111
|
+
const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
|
|
112
|
+
let processor = cache.get(key);
|
|
113
|
+
if (!processor) {
|
|
114
|
+
const postprocessOptions = {
|
|
115
|
+
_format: format,
|
|
116
|
+
...collection?.postprocess
|
|
117
|
+
};
|
|
118
|
+
processor = createProcessor({
|
|
119
|
+
outputFormat: "program",
|
|
120
|
+
development: isDevelopment,
|
|
121
|
+
...mdxOptions,
|
|
122
|
+
remarkPlugins: [
|
|
123
|
+
remarkInclude,
|
|
124
|
+
...mdxOptions.remarkPlugins ?? [],
|
|
125
|
+
[remarkPostprocess, postprocessOptions]
|
|
126
|
+
],
|
|
127
|
+
format
|
|
128
|
+
});
|
|
129
|
+
cache.set(key, processor);
|
|
130
|
+
}
|
|
131
|
+
return processor;
|
|
132
|
+
}
|
|
133
|
+
let vfile = new VFile({
|
|
134
|
+
value: source,
|
|
135
|
+
path: filePath,
|
|
136
|
+
cwd: collection?.cwd,
|
|
137
|
+
data: {
|
|
138
|
+
frontmatter,
|
|
139
|
+
_compiler,
|
|
140
|
+
_getProcessor: getProcessor
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (collection) vfile = await core.transformVFile({
|
|
144
|
+
collection,
|
|
145
|
+
filePath,
|
|
146
|
+
source
|
|
147
|
+
}, vfile);
|
|
148
|
+
return getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md").process(vfile);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { buildMDX as t };
|
|
153
|
+
//# sourceMappingURL=build-mdx-COY0QD1z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-mdx-COY0QD1z.js","names":["_stringifyProcessor: Processor | undefined","urls: ExtractedReference[]","postprocessOptions: PostprocessOptions"],"sources":["../src/loaders/mdx/remark-postprocess.ts","../src/loaders/mdx/build-mdx.ts"],"sourcesContent":["import type { Processor, Transformer } from 'unified';\nimport type { 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?: boolean;\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 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 });\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 '@/loaders/mdx/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 '@/loaders/mdx/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 FumadocsDataMap {\n /**\n * [Fumadocs MDX] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fumadocs MDX] additional ESM exports to write\n */\n 'mdx-export'?: { name: string; value: unknown }[];\n\n /**\n * [Fumadocs MDX] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Fumadocs 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 FumadocsDataMap {}\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":";;;;;;;;;;;;;;AA6CA,SAAgB,kBAEd,EACE,SACA,2BAA2B,OAC3B,eAAe,OACf,wBAAwB,OACxB,gBAAgB,EAAE,IAEK;CACzB,IAAIA;CACJ,MAAM,8BAA8B;AAClC,SAAQ,wBACN,YAAY,QACR,OAEA,MAAM,CAAC,IAAI,U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|
|
1
|
+
import { StructuredData } from "@hanzo/docs-core/mdx-plugins";
|
|
2
|
+
import { VFile } from "vfile";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import { createProcessor } from "@mdx-js/mdx";
|
|
5
|
+
import { TOCItemType } from "@hanzo/docs-core/toc";
|
|
6
|
+
import { MDXProps } from "mdx/types";
|
|
7
|
+
|
|
8
|
+
//#region src/loaders/mdx/build-mdx.d.ts
|
|
9
|
+
type Processor = ReturnType<typeof createProcessor>;
|
|
10
|
+
interface CompilerOptions {
|
|
11
|
+
addDependency: (file: string) => void;
|
|
12
|
+
}
|
|
13
|
+
interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
14
|
+
frontmatter: Frontmatter;
|
|
15
|
+
structuredData: StructuredData;
|
|
16
|
+
toc: TOCItemType[];
|
|
17
|
+
default: FC<MDXProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Enable from `postprocess` option.
|
|
20
|
+
*/
|
|
21
|
+
_markdown?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Enable from `postprocess` option.
|
|
24
|
+
*/
|
|
25
|
+
_mdast?: string;
|
|
26
|
+
}
|
|
27
|
+
interface FumadocsDataMap {
|
|
28
|
+
/**
|
|
29
|
+
* [Fumadocs MDX] raw frontmatter, you can modify it
|
|
30
|
+
*/
|
|
31
|
+
frontmatter?: Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* [Fumadocs MDX] additional ESM exports to write
|
|
34
|
+
*/
|
|
35
|
+
'mdx-export'?: {
|
|
36
|
+
name: string;
|
|
37
|
+
value: unknown;
|
|
38
|
+
}[];
|
|
39
|
+
/**
|
|
40
|
+
* [Fumadocs MDX] The compiler object from loader
|
|
41
|
+
*/
|
|
42
|
+
_compiler?: CompilerOptions;
|
|
43
|
+
/**
|
|
44
|
+
* [Fumadocs MDX] get internal processor, do not use this on user land.
|
|
45
|
+
*/
|
|
46
|
+
_getProcessor?: (format: 'md' | 'mdx') => Processor;
|
|
47
|
+
}
|
|
48
|
+
declare module 'vfile' {
|
|
49
|
+
interface DataMap extends FumadocsDataMap {}
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { CompiledMDXProperties as t };
|
|
53
|
+
//# sourceMappingURL=build-mdx-DyJk_jWV.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-mdx-DyJk_jWV.d.ts","names":[],"sources":["../src/loaders/mdx/build-mdx.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASwD,KAEnD,SAAA,GAAY,UAAH,CAAqB,OAAA,eAAlB,CAAA;AAiDH,UAlCG,eAAA,CAkCH;EAK8B,aAAA,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,IAAA;;AAC3C,UApCgB,qBAoChB,CAAA,cApCoD,MAoCpD,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAAA,WAAA,EAnCc,WAmCd;gBAI2B,EAtCV,cAsCyB;EAAA,GAAA,EArCpC,WAqCoC,EAAA;EAAA,OAAA,EApChC,EAoCgC,CApC7B,QAoC6B,CAAA;;;;;;;;;;UAxB1B,eAAA;;;;gBAID;;;;;;;;;;;cAUF;;;;4CAK8B;;;4BAKhB"}
|
package/dist/bun/index.d.ts
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import '@mdx-js/mdx';
|
|
4
|
-
import '@standard-schema/spec';
|
|
5
|
-
import 'unified';
|
|
6
|
-
import '@hanzo/docs-core/mdx-plugins';
|
|
7
|
-
import '@hanzo/docs-core/source/schema';
|
|
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 'mdast';
|
|
15
|
-
import 'mdx/types';
|
|
1
|
+
import { r as CoreOptions } from "../core-D2BJuXMW.js";
|
|
2
|
+
import { BunPlugin } from "bun";
|
|
16
3
|
|
|
4
|
+
//#region src/bun/index.d.ts
|
|
17
5
|
interface MdxPluginOptions extends Partial<CoreOptions> {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Skip meta file transformation step
|
|
8
|
+
*/
|
|
9
|
+
disableMetaFile?: boolean;
|
|
22
10
|
}
|
|
23
11
|
declare function createMdxPlugin(options?: MdxPluginOptions): BunPlugin;
|
|
24
|
-
|
|
25
|
-
export {
|
|
12
|
+
//#endregion
|
|
13
|
+
export { MdxPluginOptions, createMdxPlugin };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/bun/index.ts"],"sourcesContent":[],"mappings":";;;;UASiB,gBAAA,SAAyB,QAAQ;;AAAlD;AAOA;;;iBAAgB,eAAA,WAAyB,mBAAwB"}
|
package/dist/bun/index.js
CHANGED
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
} from "../
|
|
4
|
-
import "../
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
} from "../
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
} from "../chunk-ZAYZWFWP.js";
|
|
11
|
-
import {
|
|
12
|
-
createIntegratedConfigLoader,
|
|
13
|
-
toBun
|
|
14
|
-
} from "../chunk-DMIIE3XZ.js";
|
|
15
|
-
import "../chunk-4JSFLXXT.js";
|
|
16
|
-
import {
|
|
17
|
-
_Defaults,
|
|
18
|
-
createCore
|
|
19
|
-
} from "../chunk-RR2X6AE6.js";
|
|
20
|
-
import "../chunk-PW2AZGGD.js";
|
|
21
|
-
import "../chunk-VWJKRQZR.js";
|
|
1
|
+
import "../preset-D_quDsKp.js";
|
|
2
|
+
import "../fuma-matter-DL-PfQJ7.js";
|
|
3
|
+
import { t as buildConfig } from "../build-GdAvxpd7.js";
|
|
4
|
+
import { n as createCore, t as _Defaults } from "../core-DOav5JBx.js";
|
|
5
|
+
import "../codegen-Dd9ILNOr.js";
|
|
6
|
+
import { t as createMdxLoader } from "../mdx-CJaKR3FR.js";
|
|
7
|
+
import { r as toBun, t as createIntegratedConfigLoader } from "../config-DSrG5Dfc.js";
|
|
8
|
+
import { t as createMetaLoader } from "../meta-CKrL1Sl9.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-Dd9ILNOr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-Dd9ILNOr.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,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