@hanzo/docs-mdx-remote 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,2 @@
1
- import { MDXComponents } from 'mdx/types';
2
- import { TableOfContents } from '@hanzo/docs-core/toc';
3
- import { FC } from 'react';
4
-
5
- type MdxContent = FC<{
6
- components?: MDXComponents;
7
- }>;
8
- interface Options {
9
- scope?: Record<string, unknown>;
10
- baseUrl?: string | URL;
11
- jsxRuntime?: unknown;
12
- }
13
- declare function executeMdx(compiled: string, options?: Options): Promise<{
14
- default: MdxContent;
15
- toc?: TableOfContents;
16
- }>;
17
- declare function executeMdxSync(compiled: string, options?: Options): {
18
- default: MdxContent;
19
- toc?: TableOfContents;
20
- };
21
-
22
- export { type MdxContent, executeMdx, executeMdxSync };
1
+ import { n as executeMdx, r as executeMdxSync, t as MdxContent } from "../render-BsDRRFKC.js";
2
+ export { MdxContent, executeMdx, executeMdxSync };
@@ -1,8 +1,3 @@
1
- import {
2
- executeMdx,
3
- executeMdxSync
4
- } from "../chunk-5V3MNLHP.js";
5
- export {
6
- executeMdx,
7
- executeMdxSync
8
- };
1
+ import { n as executeMdxSync, t as executeMdx } from "../render-DHnSPAbU.js";
2
+
3
+ export { executeMdx, executeMdxSync };
package/dist/index.d.ts CHANGED
@@ -1,89 +1,92 @@
1
- import { TableOfContents } from '@hanzo/docs-core/toc';
2
- import { MdxContent } from './client/index.js';
3
- import * as Plugins from '@hanzo/docs-core/mdx-plugins';
4
- import { CompileOptions } from '@mdx-js/mdx';
5
- import { MDXComponents } from 'mdx/types';
6
- import { Pluggable } from 'unified';
7
- import { VFile, Compatible } from 'vfile';
8
- import 'react';
1
+ import { t as MdxContent } from "./render-BsDRRFKC.js";
2
+ import * as Plugins from "@hanzo/docs-core/mdx-plugins";
3
+ import { CompileOptions } from "@mdx-js/mdx";
4
+ import { MDXComponents } from "mdx/types";
5
+ import { TableOfContents } from "@hanzo/docs-core/toc";
6
+ import { Pluggable } from "unified";
7
+ import { Compatible, VFile } from "vfile";
9
8
 
9
+ //#region src/utils.d.ts
10
10
  type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
11
11
  /**
12
12
  * Parse frontmatter, currently powered by `gray-matter`
13
13
  */
14
14
  declare function parseFrontmatter(content: string): {
15
- frontmatter: {
16
- [key: string]: any;
17
- };
18
- content: string;
15
+ frontmatter: {
16
+ [key: string]: any;
17
+ };
18
+ content: string;
19
19
  };
20
-
20
+ //#endregion
21
+ //#region src/compile.d.ts
21
22
  type FumadocsPresetOptions = Omit<CompileOptions, 'remarkPlugins' | 'rehypePlugins'> & {
22
- preset?: 'fumadocs';
23
- remarkPlugins?: ResolvePlugins;
24
- rehypePlugins?: ResolvePlugins;
25
- remarkHeadingOptions?: Plugins.RemarkHeadingOptions | false;
26
- rehypeCodeOptions?: Plugins.RehypeCodeOptions | false;
27
- rehypeTocOptions?: Plugins.RehypeTocOptions | false;
28
- remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | false;
29
- remarkNpmOptions?: Plugins.RemarkNpmOptions | false;
30
- /**
31
- * The directory to find image sizes
32
- *
33
- * @defaultValue './public'
34
- * @deprecated Use `remarkImageOptions.publicDir` instead
35
- */
36
- imageDir?: string;
37
- remarkImageOptions?: Plugins.RemarkImageOptions | false;
23
+ preset?: 'fumadocs';
24
+ remarkPlugins?: ResolvePlugins;
25
+ rehypePlugins?: ResolvePlugins;
26
+ remarkHeadingOptions?: Plugins.RemarkHeadingOptions | false;
27
+ rehypeCodeOptions?: Plugins.RehypeCodeOptions | false;
28
+ rehypeTocOptions?: Plugins.RehypeTocOptions | false;
29
+ remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | false;
30
+ remarkNpmOptions?: Plugins.RemarkNpmOptions | false;
31
+ /**
32
+ * The directory to find image sizes
33
+ *
34
+ * @defaultValue './public'
35
+ * @deprecated Use `remarkImageOptions.publicDir` instead
36
+ */
37
+ imageDir?: string;
38
+ remarkImageOptions?: Plugins.RemarkImageOptions | false;
38
39
  };
39
40
  type CompilerOptions = (CompileOptions & {
40
- preset: 'minimal';
41
+ preset: 'minimal';
41
42
  }) | FumadocsPresetOptions;
42
43
  interface CompileMDXOptions {
43
- source: string;
44
- /**
45
- * File path of source content
46
- */
47
- filePath?: string;
48
- components?: MDXComponents;
49
- scope?: Record<string, unknown>;
50
- /**
51
- * @deprecated Use `compiler.compileFile` instead if you doesn't need to execute output JavaScript code.
52
- */
53
- skipRender?: boolean;
44
+ source: string;
45
+ /**
46
+ * File path of source content
47
+ */
48
+ filePath?: string;
49
+ components?: MDXComponents;
50
+ scope?: Record<string, unknown>;
51
+ /**
52
+ * @deprecated Use `compiler.compileFile` instead if you doesn't need to execute output JavaScript code.
53
+ */
54
+ skipRender?: boolean;
54
55
  }
55
56
  interface CompileMDXResult<TFrontmatter = Record<string, unknown>> {
56
- body: MdxContent;
57
- frontmatter: TFrontmatter;
58
- toc: TableOfContents;
59
- vfile: VFile;
60
- compiled: string;
61
- exports: Record<string, unknown> | null;
57
+ body: MdxContent;
58
+ frontmatter: TFrontmatter;
59
+ toc: TableOfContents;
60
+ vfile: VFile;
61
+ compiled: string;
62
+ exports: Record<string, unknown> | null;
62
63
  }
63
64
  declare function createCompiler(mdxOptions?: CompilerOptions): {
64
- render(compiled: string, scope?: Record<string, unknown>, filePath?: string): Promise<{
65
- default: MdxContent;
66
- toc?: TableOfContents;
67
- }>;
68
- /**
69
- * Compile VFile
70
- */
71
- compileFile(from: Compatible): Promise<VFile>;
72
- compile<Frontmatter extends object = Record<string, unknown>>(options: CompileMDXOptions): Promise<CompileMDXResult<Frontmatter>>;
65
+ render(compiled: string, scope?: Record<string, unknown>, filePath?: string): Promise<{
66
+ default: MdxContent;
67
+ toc?: TableOfContents;
68
+ }>;
69
+ /**
70
+ * Compile VFile
71
+ */
72
+ compileFile(from: Compatible): Promise<VFile>;
73
+ compile<Frontmatter extends object = Record<string, unknown>>(options: CompileMDXOptions): Promise<CompileMDXResult<Frontmatter>>;
73
74
  };
74
75
  /**
75
76
  * @deprecated Use `createCompiler()` API instead, this function will always create a new compiler instance.
76
77
  */
77
78
  declare function compileMDX<Frontmatter extends object = Record<string, unknown>>(options: CompileMDXOptions & {
78
- mdxOptions?: CompilerOptions;
79
+ mdxOptions?: CompilerOptions;
79
80
  }): Promise<CompileMDXResult<Frontmatter>>;
80
-
81
+ //#endregion
82
+ //#region src/index.d.ts
81
83
  /**
82
84
  * @deprecated Use `compiler.render` instead
83
85
  */
84
86
  declare function executeMdx(compiled: string, scope: object, baseUrl?: string | URL): Promise<{
85
- default: MdxContent;
86
- toc?: TableOfContents;
87
+ default: MdxContent;
88
+ toc?: TableOfContents;
87
89
  }>;
88
-
89
- export { type CompileMDXOptions, type CompileMDXResult, type CompilerOptions, type FumadocsPresetOptions, type CompilerOptions as MDXOptions, compileMDX, createCompiler, executeMdx, parseFrontmatter };
90
+ //#endregion
91
+ export { CompileMDXOptions, CompileMDXResult, CompilerOptions, type CompilerOptions as MDXOptions, FumadocsPresetOptions, compileMDX, createCompiler, executeMdx, parseFrontmatter };
92
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/utils.ts","../src/compile.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAGY,cAAA,GAAiB,mBAAmB,gBAAgB;;;;iBAkBhD,gBAAA;;;EAlBJ,CAAA;EAAiB,OAAA,EAAA,MAAA;CAAmB;;;KCMpC,qBAAA,GAAwB,KAAK;;EDN7B,aAAA,CAAA,ECQM,cDRQ;EAAG,aAAA,CAAA,ECSX,cDTW;EAAmB,oBAAA,CAAA,ECWvB,OAAA,CAAQ,oBDXe,GAAA,KAAA;EAAgB,iBAAA,CAAA,ECY1C,OAAA,CAAQ,iBDZkC,GAAA,KAAA;EAAS,gBAAA,CAAA,ECapD,OAAA,CAAQ,gBDb4C,GAAA,KAAA;EAkBzD,oBAAgB,CAAA,ECJP,OAAA,CAAQ,oBDID,GAAA,KAAA;qBCHX,OAAA,CAAQ;;;AAT7B;;;;EAGkB,QAAA,CAAA,EAAA,MAAA;EAEO,kBAAQ,CAAA,EAcV,OAAA,CAAQ,kBAdE,GAAA,KAAA;CACX;AACD,KAeT,eAAA,GAfiB,CAeE,cAfF,GAAA;EACJ,MAAQ,EAAA,SAAA;CACZ,CAAA,GAaoD,qBAb5C;AAUN,UAKN,iBAAA,CALc;EAAkB,MAAA,EAAA,MAAA;EAGrC;AAEZ;AAgBA;EAAiD,QAAA,CAAA,EAAA,MAAA;EACzC,UAAA,CAAA,EAVO,aAUP;EACO,KAAA,CAAA,EAVL,MAUK,CAAA,MAAA,EAAA,OAAA,CAAA;EACR;;;EAIU,UAAA,CAAA,EAAA,OAAA;AAGjB;AAA4C,UAV3B,gBAU2B,CAAA,eAVK,MAUL,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAgBD,IAAA,EAzBnC,UAyBmC;eAxB5B;OACR;EAuB8E,KAAA,EAtB5E,KAsB4E;EAUzD,QAAA,EAAA,MAAA;EAAqB,OAAA,EA7BtC,MA6BsC,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,IAAA;;AAGL,iBA7B5B,cAAA,CA6B4B,UAAA,CAAA,EA7BA,eA6BA,CAAA,EAAA;EAC7B,MAAA,CAAA,QAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAd4B,MAc5B,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,QAAA,CAAA,EAAA,MAAA,CAAA,EAdsE,OActE,CAAA;IACiB,OAAA,YAAA;IAAjB,GAAA,CAAA,iBAAA;EAAR,CAAA,CAAA;EAAO;AAmCd;;EACW,WAAA,CAAA,IAAA,EAzCiB,UAyCjB,CAAA,EAzC8B,OAyC9B,CAzCsC,KAyCtC,CAAA;EACM,OAAA,CAAA,oBAAA,MAAA,GAvC2B,MAuC3B,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA,OAAA,EAtCF,iBAsCE,CAAA,EArCV,OAqCU,CArCF,gBAqCE,CArCe,WAqCf,CAAA,CAAA;CAEW;;;;iBAJN,wCAAwC,kCACnD;eACM;IAEd,QAAQ,iBAAiB;;;;;;iBCxHN,UAAA,qDAA+D,MAAG;WAuB3E;EF7BD,GAAA,CAAA,EE8BF,eF9BgB;CAAG,CAAA"}
package/dist/index.js CHANGED
@@ -1,169 +1,140 @@
1
- import {
2
- executeMdx
3
- } from "./chunk-5V3MNLHP.js";
4
-
5
- // src/compile.ts
1
+ import { t as executeMdx$1 } from "./render-DHnSPAbU.js";
6
2
  import * as Plugins from "@hanzo/docs-core/mdx-plugins";
7
3
  import { createProcessor } from "@mdx-js/mdx";
8
-
9
- // src/utils.ts
10
4
  import matter from "gray-matter";
5
+ import { pathToFileURL } from "node:url";
6
+
7
+ //#region src/utils.ts
11
8
  function pluginOption(def, options = []) {
12
- const list = def(Array.isArray(options) ? options : []).filter(
13
- Boolean
14
- );
15
- if (typeof options === "function") {
16
- return options(list);
17
- }
18
- return list;
9
+ const list = def(Array.isArray(options) ? options : []).filter(Boolean);
10
+ if (typeof options === "function") return options(list);
11
+ return list;
19
12
  }
13
+ /**
14
+ * Parse frontmatter, currently powered by `gray-matter`
15
+ */
20
16
  function parseFrontmatter(content) {
21
- const out = matter(content);
22
- return {
23
- frontmatter: out.data,
24
- content: out.content
25
- };
17
+ const out = matter(content);
18
+ return {
19
+ frontmatter: out.data,
20
+ content: out.content
21
+ };
26
22
  }
27
23
 
28
- // src/compile.ts
29
- import { pathToFileURL } from "url";
24
+ //#endregion
25
+ //#region src/compile.ts
30
26
  function createCompiler(mdxOptions) {
31
- let instance;
32
- function getProcessor() {
33
- if (instance) return instance;
34
- let format = mdxOptions?.format;
35
- if (!format || format === "detect") format = "mdx";
36
- return instance = createProcessor({
37
- ...mdxOptions?.preset === "minimal" ? mdxOptions : getCompileOptions(mdxOptions),
38
- format
39
- });
40
- }
41
- return {
42
- async render(compiled, scope, filePath) {
43
- return executeMdx(compiled, {
44
- scope,
45
- baseUrl: filePath ? pathToFileURL(filePath) : void 0,
46
- jsxRuntime: mdxOptions?.development ? await import("react/jsx-dev-runtime") : void 0
47
- });
48
- },
49
- /**
50
- * Compile VFile
51
- */
52
- async compileFile(from) {
53
- return getProcessor().process(from);
54
- },
55
- async compile(options) {
56
- const { scope = {}, skipRender } = options;
57
- const { frontmatter, content } = parseFrontmatter(options.source);
58
- const file = await this.compileFile({
59
- value: content,
60
- path: options.filePath,
61
- data: {
62
- frontmatter
63
- }
64
- });
65
- const compiled = String(file);
66
- const exports = !skipRender ? await this.render(compiled, scope, options.filePath) : null;
67
- return {
68
- vfile: file,
69
- compiled,
70
- frontmatter,
71
- async body(props) {
72
- if (!exports)
73
- throw new Error(
74
- "Body cannot be rendered when `skipRender` is set to true"
75
- );
76
- return exports.default({
77
- components: { ...options.components, ...props.components }
78
- });
79
- },
80
- toc: exports?.toc ?? file.data.toc,
81
- exports
82
- };
83
- }
84
- };
27
+ let instance;
28
+ function getProcessor() {
29
+ if (instance) return instance;
30
+ let format = mdxOptions?.format;
31
+ if (!format || format === "detect") format = "mdx";
32
+ return instance = createProcessor({
33
+ ...mdxOptions?.preset === "minimal" ? mdxOptions : getCompileOptions(mdxOptions),
34
+ format
35
+ });
36
+ }
37
+ return {
38
+ async render(compiled, scope, filePath) {
39
+ return executeMdx$1(compiled, {
40
+ scope,
41
+ baseUrl: filePath ? pathToFileURL(filePath) : void 0,
42
+ jsxRuntime: mdxOptions?.development ? await import("react/jsx-dev-runtime") : void 0
43
+ });
44
+ },
45
+ async compileFile(from) {
46
+ return getProcessor().process(from);
47
+ },
48
+ async compile(options) {
49
+ const { scope = {}, skipRender } = options;
50
+ const { frontmatter, content } = parseFrontmatter(options.source);
51
+ const file = await this.compileFile({
52
+ value: content,
53
+ path: options.filePath,
54
+ data: { frontmatter }
55
+ });
56
+ const compiled = String(file);
57
+ const exports = !skipRender ? await this.render(compiled, scope, options.filePath) : null;
58
+ return {
59
+ vfile: file,
60
+ compiled,
61
+ frontmatter,
62
+ async body(props) {
63
+ if (!exports) throw new Error("Body cannot be rendered when `skipRender` is set to true");
64
+ return exports.default({ components: {
65
+ ...options.components,
66
+ ...props.components
67
+ } });
68
+ },
69
+ toc: exports?.toc ?? file.data.toc,
70
+ exports
71
+ };
72
+ }
73
+ };
85
74
  }
75
+ /**
76
+ * @deprecated Use `createCompiler()` API instead, this function will always create a new compiler instance.
77
+ */
86
78
  async function compileMDX(options) {
87
- const compiler = createCompiler(options.mdxOptions);
88
- return compiler.compile(options);
79
+ return createCompiler(options.mdxOptions).compile(options);
89
80
  }
90
- function getCompileOptions({
91
- preset: _,
92
- rehypeCodeOptions,
93
- remarkImageOptions,
94
- rehypeTocOptions,
95
- remarkHeadingOptions,
96
- remarkCodeTabOptions,
97
- remarkNpmOptions,
98
- imageDir = "./public",
99
- ...options
100
- } = {}) {
101
- function getPlugin(name) {
102
- return name in Plugins ? Plugins[name] : null;
103
- }
104
- const remarkGfm = getPlugin("remarkGfm");
105
- const remarkHeading = getPlugin("remarkHeading");
106
- const remarkCodeTab = getPlugin("remarkCodeTab");
107
- const remarkNpm = getPlugin("remarkNpm");
108
- const remarkImage = getPlugin("remarkImage");
109
- const rehypeCode = getPlugin("rehypeCode");
110
- const rehypeToc = getPlugin("rehypeToc");
111
- return {
112
- ...options,
113
- outputFormat: "function-body",
114
- remarkPlugins: pluginOption(
115
- (v) => [
116
- remarkGfm,
117
- remarkHeading && remarkHeadingOptions !== false ? [remarkHeading, remarkHeadingOptions] : null,
118
- remarkImage && remarkImageOptions !== false ? [
119
- remarkImage,
120
- {
121
- useImport: false,
122
- publicDir: imageDir,
123
- ...remarkImageOptions
124
- }
125
- ] : null,
126
- remarkCodeTab && remarkCodeTabOptions !== false ? [remarkCodeTab, remarkCodeTabOptions] : null,
127
- remarkNpm && remarkNpmOptions !== false ? [remarkNpm, remarkNpmOptions] : null,
128
- ...v
129
- ],
130
- options.remarkPlugins
131
- ),
132
- rehypePlugins: pluginOption(
133
- (v) => [
134
- rehypeCode && rehypeCodeOptions !== false ? [rehypeCode, rehypeCodeOptions] : null,
135
- rehypeToc && rehypeTocOptions !== false ? [rehypeToc, rehypeTocOptions] : null,
136
- ...v
137
- ],
138
- options.rehypePlugins
139
- )
140
- };
81
+ function getCompileOptions({ preset: _, rehypeCodeOptions, remarkImageOptions, rehypeTocOptions, remarkHeadingOptions, remarkCodeTabOptions, remarkNpmOptions, imageDir = "./public", ...options } = {}) {
82
+ function getPlugin(name) {
83
+ return name in Plugins ? Plugins[name] : null;
84
+ }
85
+ const remarkGfm = getPlugin("remarkGfm");
86
+ const remarkHeading = getPlugin("remarkHeading");
87
+ const remarkCodeTab = getPlugin("remarkCodeTab");
88
+ const remarkNpm = getPlugin("remarkNpm");
89
+ const remarkImage = getPlugin("remarkImage");
90
+ const rehypeCode = getPlugin("rehypeCode");
91
+ const rehypeToc = getPlugin("rehypeToc");
92
+ return {
93
+ ...options,
94
+ outputFormat: "function-body",
95
+ remarkPlugins: pluginOption((v) => [
96
+ remarkGfm,
97
+ remarkHeading && remarkHeadingOptions !== false ? [remarkHeading, remarkHeadingOptions] : null,
98
+ remarkImage && remarkImageOptions !== false ? [remarkImage, {
99
+ useImport: false,
100
+ publicDir: imageDir,
101
+ ...remarkImageOptions
102
+ }] : null,
103
+ remarkCodeTab && remarkCodeTabOptions !== false ? [remarkCodeTab, remarkCodeTabOptions] : null,
104
+ remarkNpm && remarkNpmOptions !== false ? [remarkNpm, remarkNpmOptions] : null,
105
+ ...v
106
+ ], options.remarkPlugins),
107
+ rehypePlugins: pluginOption((v) => [
108
+ rehypeCode && rehypeCodeOptions !== false ? [rehypeCode, rehypeCodeOptions] : null,
109
+ rehypeToc && rehypeTocOptions !== false ? [rehypeToc, rehypeTocOptions] : null,
110
+ ...v
111
+ ], options.rehypePlugins)
112
+ };
141
113
  }
142
114
 
143
- // src/index.ts
144
- async function executeMdx2(compiled, scope, baseUrl) {
145
- let jsxRuntime;
146
- if (process.env.NODE_ENV === "production") {
147
- jsxRuntime = await import("react/jsx-runtime");
148
- } else {
149
- jsxRuntime = await import("react/jsx-dev-runtime");
150
- }
151
- const fullScope = {
152
- opts: {
153
- ...jsxRuntime,
154
- baseUrl
155
- },
156
- ...scope
157
- };
158
- const values = Object.values(fullScope);
159
- const params = Object.keys(fullScope);
160
- params.push(`return (async () => { ${compiled} })()`);
161
- const hydrateFn = new Function(...params);
162
- return await hydrateFn.apply(hydrateFn, values);
115
+ //#endregion
116
+ //#region src/index.ts
117
+ /**
118
+ * @deprecated Use `compiler.render` instead
119
+ */
120
+ async function executeMdx(compiled, scope, baseUrl) {
121
+ let jsxRuntime;
122
+ if (process.env.NODE_ENV === "production") jsxRuntime = await import("react/jsx-runtime");
123
+ else jsxRuntime = await import("react/jsx-dev-runtime");
124
+ const fullScope = {
125
+ opts: {
126
+ ...jsxRuntime,
127
+ baseUrl
128
+ },
129
+ ...scope
130
+ };
131
+ const values = Object.values(fullScope);
132
+ const params = Object.keys(fullScope);
133
+ params.push(`return (async () => { ${compiled} })()`);
134
+ const hydrateFn = new Function(...params);
135
+ return await hydrateFn.apply(hydrateFn, values);
163
136
  }
164
- export {
165
- compileMDX,
166
- createCompiler,
167
- executeMdx2 as executeMdx,
168
- parseFrontmatter
169
- };
137
+
138
+ //#endregion
139
+ export { compileMDX, createCompiler, executeMdx, parseFrontmatter };
140
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["executeMdx"],"sources":["../src/utils.ts","../src/compile.ts","../src/index.ts"],"sourcesContent":["import type { Pluggable } from 'unified';\nimport matter from 'gray-matter';\n\nexport type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);\n\nexport function pluginOption(\n def: (v: Pluggable[]) => (Pluggable | false | null)[],\n options: ResolvePlugins = [],\n): Pluggable[] {\n const list = def(Array.isArray(options) ? options : []).filter(Boolean) as Pluggable[];\n\n if (typeof options === 'function') {\n return options(list);\n }\n\n return list;\n}\n\n/**\n * Parse frontmatter, currently powered by `gray-matter`\n */\nexport function parseFrontmatter(content: string) {\n const out = matter(content);\n\n return {\n frontmatter: out.data,\n content: out.content,\n };\n}\n","import * as Plugins from '@hanzo/docs-core/mdx-plugins';\nimport { type CompileOptions, createProcessor } from '@mdx-js/mdx';\nimport type { MDXComponents } from 'mdx/types';\nimport { parseFrontmatter, pluginOption, type ResolvePlugins } from './utils';\nimport type { Compatible, VFile } from 'vfile';\nimport type { TableOfContents } from '@hanzo/docs-core/toc';\nimport { executeMdx, type MdxContent } from '@/render';\nimport { pathToFileURL } from 'node:url';\n\nexport type FumadocsPresetOptions = Omit<CompileOptions, 'remarkPlugins' | 'rehypePlugins'> & {\n preset?: 'fumadocs';\n remarkPlugins?: ResolvePlugins;\n rehypePlugins?: ResolvePlugins;\n\n remarkHeadingOptions?: Plugins.RemarkHeadingOptions | false;\n rehypeCodeOptions?: Plugins.RehypeCodeOptions | false;\n rehypeTocOptions?: Plugins.RehypeTocOptions | false;\n remarkCodeTabOptions?: Plugins.RemarkCodeTabOptions | false;\n remarkNpmOptions?: Plugins.RemarkNpmOptions | false;\n\n /**\n * The directory to find image sizes\n *\n * @defaultValue './public'\n * @deprecated Use `remarkImageOptions.publicDir` instead\n */\n imageDir?: string;\n\n remarkImageOptions?: Plugins.RemarkImageOptions | false;\n};\n\nexport type CompilerOptions = (CompileOptions & { preset: 'minimal' }) | FumadocsPresetOptions;\n\nexport interface CompileMDXOptions {\n source: string;\n /**\n * File path of source content\n */\n filePath?: string;\n\n components?: MDXComponents;\n scope?: Record<string, unknown>;\n\n /**\n * @deprecated Use `compiler.compileFile` instead if you doesn't need to execute output JavaScript code.\n */\n skipRender?: boolean;\n}\n\nexport interface CompileMDXResult<TFrontmatter = Record<string, unknown>> {\n body: MdxContent;\n frontmatter: TFrontmatter;\n toc: TableOfContents;\n vfile: VFile;\n\n compiled: string;\n exports: Record<string, unknown> | null;\n}\n\nexport function createCompiler(mdxOptions?: CompilerOptions) {\n let instance: ReturnType<typeof createProcessor> | undefined;\n\n function getProcessor() {\n if (instance) return instance;\n\n let format = mdxOptions?.format;\n if (!format || format === 'detect') format = 'mdx';\n\n return (instance = createProcessor({\n ...(mdxOptions?.preset === 'minimal' ? mdxOptions : getCompileOptions(mdxOptions)),\n format,\n }));\n }\n\n return {\n async render(compiled: string, scope?: Record<string, unknown>, filePath?: string) {\n return executeMdx(compiled, {\n scope,\n baseUrl: filePath ? pathToFileURL(filePath) : undefined,\n jsxRuntime: mdxOptions?.development ? await import('react/jsx-dev-runtime') : undefined,\n });\n },\n /**\n * Compile VFile\n */\n async compileFile(from: Compatible): Promise<VFile> {\n return getProcessor().process(from);\n },\n async compile<Frontmatter extends object = Record<string, unknown>>(\n options: CompileMDXOptions,\n ): Promise<CompileMDXResult<Frontmatter>> {\n const { scope = {}, skipRender } = options;\n const { frontmatter, content } = parseFrontmatter(options.source);\n\n const file = await this.compileFile({\n value: content,\n path: options.filePath,\n data: {\n frontmatter,\n },\n });\n const compiled = String(file);\n const exports = !skipRender ? await this.render(compiled, scope, options.filePath) : null;\n\n return {\n vfile: file,\n compiled,\n frontmatter: frontmatter as Frontmatter,\n async body(props) {\n if (!exports) throw new Error('Body cannot be rendered when `skipRender` is set to true');\n\n return exports.default({\n components: { ...options.components, ...props.components },\n });\n },\n toc: exports?.toc ?? (file.data.toc as TableOfContents),\n exports,\n };\n },\n };\n}\n\n/**\n * @deprecated Use `createCompiler()` API instead, this function will always create a new compiler instance.\n */\nexport async function compileMDX<Frontmatter extends object = Record<string, unknown>>(\n options: CompileMDXOptions & {\n mdxOptions?: CompilerOptions;\n },\n): Promise<CompileMDXResult<Frontmatter>> {\n const compiler = createCompiler(options.mdxOptions);\n\n return compiler.compile(options);\n}\n\nfunction getCompileOptions({\n preset: _,\n rehypeCodeOptions,\n remarkImageOptions,\n rehypeTocOptions,\n remarkHeadingOptions,\n remarkCodeTabOptions,\n remarkNpmOptions,\n imageDir = './public',\n ...options\n}: FumadocsPresetOptions = {}): CompileOptions {\n function getPlugin<K extends keyof typeof Plugins>(name: K): (typeof Plugins)[K] | null {\n return name in Plugins ? Plugins[name] : null;\n }\n const remarkGfm = getPlugin('remarkGfm');\n const remarkHeading = getPlugin('remarkHeading');\n const remarkCodeTab = getPlugin('remarkCodeTab');\n const remarkNpm = getPlugin('remarkNpm');\n const remarkImage = getPlugin('remarkImage');\n const rehypeCode = getPlugin('rehypeCode');\n const rehypeToc = getPlugin('rehypeToc');\n\n return {\n ...options,\n outputFormat: 'function-body',\n remarkPlugins: pluginOption(\n (v) => [\n remarkGfm,\n remarkHeading && remarkHeadingOptions !== false\n ? [remarkHeading, remarkHeadingOptions]\n : null,\n remarkImage && remarkImageOptions !== false\n ? [\n remarkImage,\n {\n useImport: false,\n publicDir: imageDir,\n ...remarkImageOptions,\n } satisfies Plugins.RemarkImageOptions,\n ]\n : null,\n remarkCodeTab && remarkCodeTabOptions !== false\n ? [remarkCodeTab, remarkCodeTabOptions]\n : null,\n remarkNpm && remarkNpmOptions !== false ? [remarkNpm, remarkNpmOptions] : null,\n ...v,\n ],\n options.remarkPlugins,\n ),\n rehypePlugins: pluginOption(\n (v) => [\n rehypeCode && rehypeCodeOptions !== false ? [rehypeCode, rehypeCodeOptions] : null,\n rehypeToc && rehypeTocOptions !== false ? [rehypeToc, rehypeTocOptions] : null,\n ...v,\n ],\n options.rehypePlugins,\n ),\n };\n}\n\n// backward compatible\nexport type { CompilerOptions as MDXOptions };\n","import type { TableOfContents } from '@hanzo/docs-core/toc';\nimport type { MdxContent } from '@/render';\n\nexport * from './compile';\nexport { parseFrontmatter } from './utils';\n\n/**\n * @deprecated Use `compiler.render` instead\n */\nexport async function executeMdx(compiled: string, scope: object, baseUrl?: string | URL) {\n let jsxRuntime;\n\n if (process.env.NODE_ENV === 'production') {\n jsxRuntime = await import('react/jsx-runtime');\n } else {\n jsxRuntime = await import('react/jsx-dev-runtime');\n }\n\n const fullScope = {\n opts: {\n ...jsxRuntime,\n baseUrl,\n },\n ...scope,\n };\n\n const values = Object.values(fullScope);\n const params = Object.keys(fullScope);\n params.push(`return (async () => { ${compiled} })()`);\n const hydrateFn = new Function(...params);\n\n return (await hydrateFn.apply(hydrateFn, values)) as {\n default: MdxContent;\n toc?: TableOfContents;\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import { MDXComponents } from "mdx/types";
2
+ import { TableOfContents } from "@hanzo/docs-core/toc";
3
+ import { FC } from "react";
4
+
5
+ //#region src/render.d.ts
6
+ type MdxContent = FC<{
7
+ components?: MDXComponents;
8
+ }>;
9
+ interface Options {
10
+ scope?: Record<string, unknown>;
11
+ baseUrl?: string | URL;
12
+ jsxRuntime?: unknown;
13
+ }
14
+ declare function executeMdx(compiled: string, options?: Options): Promise<{
15
+ default: MdxContent;
16
+ toc?: TableOfContents;
17
+ }>;
18
+ declare function executeMdxSync(compiled: string, options?: Options): {
19
+ default: MdxContent;
20
+ toc?: TableOfContents;
21
+ };
22
+ //#endregion
23
+ export { executeMdx as n, executeMdxSync as r, MdxContent as t };
24
+ //# sourceMappingURL=render-BsDRRFKC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-BsDRRFKC.d.ts","names":[],"sources":["../src/render.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,UAAA,GAAa;eAAkB;AAA3C,CAAA,CAAA;AAA4D,UAElD,OAAA,CAAO;EASK,KAAA,CAAA,EARZ,MAQsB,CAAA,MAAA,EAAA,OAAA,CAAA;EAA4B,OAAA,CAAA,EAAA,MAAA,GAPvC,GAOuC;EAa/C,UAAA,CAAA,EAAA,OAAA;;AAb2D,iBAAlD,UAAA,CAAkD,QAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAZ,OAAY,CAAA,EAAA,OAAA,CAAA;EAAA,OAAA,EAa3D,UAb2D;EAkBxD,GAAA,CAAA,EAJN,eAIoB;CAA4B,CAAA;AAc7C,iBAdG,cAAA,CAcH,QAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAd6C,OAc7C,CAAA,EAAA;EACH,OAAA,EADG,UACH;EAAe,GAAA,CAAA,EAAf,eAAe"}
@@ -0,0 +1,34 @@
1
+ import jsxRuntimeDefault from "react/jsx-runtime";
2
+
3
+ //#region src/render.ts
4
+ const AsyncFunction = Object.getPrototypeOf(executeMdx).constructor;
5
+ async function executeMdx(compiled, options = {}) {
6
+ const { opts: scopeOpts, ...scope } = options.scope ?? {};
7
+ const fullScope = {
8
+ opts: {
9
+ ...scopeOpts,
10
+ ...options.jsxRuntime ?? jsxRuntimeDefault,
11
+ baseUrl: options.baseUrl
12
+ },
13
+ ...scope
14
+ };
15
+ const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);
16
+ return await hydrateFn.apply(hydrateFn, Object.values(fullScope));
17
+ }
18
+ function executeMdxSync(compiled, options = {}) {
19
+ const { opts: scopeOpts, ...scope } = options.scope ?? {};
20
+ const fullScope = {
21
+ opts: {
22
+ ...scopeOpts,
23
+ ...options.jsxRuntime ?? jsxRuntimeDefault,
24
+ baseUrl: options.baseUrl
25
+ },
26
+ ...scope
27
+ };
28
+ const hydrateFn = new Function(...Object.keys(fullScope), compiled);
29
+ return hydrateFn.apply(hydrateFn, Object.values(fullScope));
30
+ }
31
+
32
+ //#endregion
33
+ export { executeMdxSync as n, executeMdx as t };
34
+ //# sourceMappingURL=render-DHnSPAbU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-DHnSPAbU.js","names":[],"sources":["../src/render.ts"],"sourcesContent":["import type { MDXComponents } from 'mdx/types';\nimport type { TableOfContents } from '@hanzo/docs-core/toc';\nimport type { FC } from 'react';\nimport jsxRuntimeDefault from 'react/jsx-runtime';\n\nexport type MdxContent = FC<{ components?: MDXComponents }>;\n\ninterface Options {\n scope?: Record<string, unknown>;\n baseUrl?: string | URL;\n jsxRuntime?: unknown;\n}\n\nconst AsyncFunction: new (...args: string[]) => (...args: unknown[]) => Promise<unknown> =\n Object.getPrototypeOf(executeMdx).constructor;\n\nexport async function executeMdx(compiled: string, options: Options = {}) {\n const { opts: scopeOpts, ...scope } = options.scope ?? {};\n const fullScope = {\n opts: {\n ...(scopeOpts as object),\n ...(options.jsxRuntime ?? jsxRuntimeDefault),\n baseUrl: options.baseUrl,\n },\n ...scope,\n };\n\n const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);\n return (await hydrateFn.apply(hydrateFn, Object.values(fullScope))) as {\n default: MdxContent;\n toc?: TableOfContents;\n };\n}\n\nexport function executeMdxSync(compiled: string, options: Options = {}) {\n const { opts: scopeOpts, ...scope } = options.scope ?? {};\n const fullScope = {\n opts: {\n ...(scopeOpts as object),\n ...(options.jsxRuntime ?? jsxRuntimeDefault),\n baseUrl: options.baseUrl,\n },\n ...scope,\n };\n\n const hydrateFn = new Function(...Object.keys(fullScope), compiled);\n\n return hydrateFn.apply(hydrateFn, Object.values(fullScope)) as {\n default: MdxContent;\n toc?: TableOfContents;\n };\n}\n"],"mappings":";;;AAaA,MAAM,gBACJ,OAAO,eAAe,WAAW,CAAC;AAEpC,eAAsB,WAAW,UAAkB,UAAmB,EAAE,EAAE;CACxE,MAAM,EAAE,MAAM,WAAW,GAAG,UAAU,QAAQ,SAAS,EAAE;CACzD,MAAM,YAAY;EAChB,MAAM;GACJ,GAAI;GACJ,GAAI,QAAQ,cAAc;GAC1B,SAAS,QAAQ;GAClB;EACD,GAAG;EACJ;CAED,MAAM,YAAY,IAAI,cAAc,GAAG,OAAO,KAAK,UAAU,EAAE,SAAS;AACxE,QAAQ,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,UAAU,CAAC;;AAMpE,SAAgB,eAAe,UAAkB,UAAmB,EAAE,EAAE;CACtE,MAAM,EAAE,MAAM,WAAW,GAAG,UAAU,QAAQ,SAAS,EAAE;CACzD,MAAM,YAAY;EAChB,MAAM;GACJ,GAAI;GACJ,GAAI,QAAQ,cAAc;GAC1B,SAAS,QAAQ;GAClB;EACD,GAAG;EACJ;CAED,MAAM,YAAY,IAAI,SAAS,GAAG,OAAO,KAAK,UAAU,EAAE,SAAS;AAEnE,QAAO,UAAU,MAAM,WAAW,OAAO,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,48 +1,52 @@
1
1
  {
2
2
  "name": "@hanzo/docs-mdx-remote",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "The remote MDX files adapter for Hanzo Docs",
5
5
  "keywords": [
6
- "Hanzo",
7
6
  "Docs",
8
- "MDX",
9
- "Remote"
7
+ "NextJs",
8
+ "fumadocs",
9
+ "next-mdx-remote"
10
10
  ],
11
- "homepage": "https://hanzo.ai/docs",
12
- "repository": "github:hanzoai/docs",
11
+ "homepage": "https://docs.hanzo.ai",
13
12
  "license": "MIT",
14
13
  "author": "Fuma Nama",
14
+ "repository": "github:hanzoai/docs",
15
+ "files": [
16
+ "dist/*"
17
+ ],
15
18
  "type": "module",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
16
21
  "exports": {
17
22
  ".": {
18
- "import": "./dist/index.js",
19
- "types": "./dist/index.d.ts"
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
20
25
  },
21
26
  "./client": {
22
- "import": "./dist/client/index.js",
23
- "types": "./dist/client/index.d.ts"
27
+ "types": "./dist/client/index.d.ts",
28
+ "import": "./dist/client/index.js"
24
29
  }
25
30
  },
26
- "module": "./dist/index.js",
27
- "types": "./dist/index.d.ts",
28
- "files": [
29
- "dist/*"
30
- ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
31
34
  "dependencies": {
32
35
  "@mdx-js/mdx": "^3.1.1",
33
36
  "gray-matter": "^4.0.3",
34
- "zod": "^4.1.13"
37
+ "zod": "^4.3.5"
35
38
  },
36
39
  "devDependencies": {
37
40
  "@types/mdx": "^2.0.13",
38
- "@types/node": "24.10.2",
39
- "@types/react": "^19.2.7",
41
+ "@types/node": "25.0.5",
42
+ "@types/react": "^19.2.8",
40
43
  "react": "^19.2.3",
41
44
  "tinyglobby": "^0.2.15",
45
+ "tsdown": "^0.19.0",
42
46
  "unified": "^11.0.5",
43
47
  "vfile": "^6.0.3",
44
48
  "eslint-config-custom": "0.0.0",
45
- "@hanzo/docs-core": "16.2.5",
49
+ "@hanzo/docs-core": "16.5.0",
46
50
  "tsconfig": "0.0.0"
47
51
  },
48
52
  "peerDependencies": {
@@ -55,13 +59,10 @@
55
59
  "optional": true
56
60
  }
57
61
  },
58
- "publishConfig": {
59
- "access": "public"
60
- },
61
62
  "scripts": {
62
- "build": "tsup",
63
+ "build": "tsdown",
63
64
  "clean": "rimraf dist",
64
- "dev": "tsup --watch",
65
+ "dev": "tsdown --watch",
65
66
  "lint": "eslint .",
66
67
  "types:check": "tsc --noEmit"
67
68
  }
@@ -1,34 +0,0 @@
1
- // src/render.ts
2
- import jsxRuntimeDefault from "react/jsx-runtime";
3
- var AsyncFunction = Object.getPrototypeOf(executeMdx).constructor;
4
- async function executeMdx(compiled, options = {}) {
5
- const { opts: scopeOpts, ...scope } = options.scope ?? {};
6
- const fullScope = {
7
- opts: {
8
- ...scopeOpts,
9
- ...options.jsxRuntime ?? jsxRuntimeDefault,
10
- baseUrl: options.baseUrl
11
- },
12
- ...scope
13
- };
14
- const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);
15
- return await hydrateFn.apply(hydrateFn, Object.values(fullScope));
16
- }
17
- function executeMdxSync(compiled, options = {}) {
18
- const { opts: scopeOpts, ...scope } = options.scope ?? {};
19
- const fullScope = {
20
- opts: {
21
- ...scopeOpts,
22
- ...options.jsxRuntime ?? jsxRuntimeDefault,
23
- baseUrl: options.baseUrl
24
- },
25
- ...scope
26
- };
27
- const hydrateFn = new Function(...Object.keys(fullScope), compiled);
28
- return hydrateFn.apply(hydrateFn, Object.values(fullScope));
29
- }
30
-
31
- export {
32
- executeMdx,
33
- executeMdxSync
34
- };