@conloca/mdx 0.1.14 → 0.1.16
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/README.md +31 -9
- package/dist/blocks.d.ts +37 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +51 -0
- package/dist/code-block-frame.d.ts +41 -0
- package/dist/code-block-frame.d.ts.map +1 -0
- package/dist/code-block-frame.js +186 -0
- package/dist/editor-core.d.ts +58 -0
- package/dist/editor-core.d.ts.map +1 -0
- package/dist/editor-core.js +181 -0
- package/dist/hooks/useMDXEvaluation.d.ts +28 -0
- package/dist/hooks/useMDXEvaluation.d.ts.map +1 -0
- package/dist/hooks/useMDXEvaluation.js +117 -0
- package/dist/index.d.mts +104 -50
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.mjs +440 -369
- package/dist/index.mjs.map +1 -1
- package/dist/markdown-options.d.ts +3 -0
- package/dist/markdown-options.d.ts.map +1 -0
- package/dist/markdown-options.js +19 -0
- package/dist/mdx/compile.d.ts +3 -0
- package/dist/mdx/compile.d.ts.map +1 -0
- package/dist/mdx/compile.js +27 -0
- package/dist/mdx/evaluate.d.ts +44 -0
- package/dist/mdx/evaluate.d.ts.map +1 -0
- package/dist/mdx/evaluate.js +57 -0
- package/dist/mdx-editor.d.ts +7 -0
- package/dist/mdx-editor.d.ts.map +1 -0
- package/dist/mdx-editor.js +7 -0
- package/dist/node.d.mts +46 -74
- package/dist/node.d.mts.map +1 -1
- package/dist/node.d.ts +17 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +16 -0
- package/dist/node.mjs +35 -116
- package/dist/node.mjs.map +1 -1
- package/dist/style.css +88 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +54 -15
package/dist/node.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { compile, evaluate } from "@mdx-js/mdx";
|
|
2
|
-
import React from "react";
|
|
3
1
|
import * as runtime from "react/jsx-runtime";
|
|
2
|
+
import { compile, evaluate } from "@mdx-js/mdx";
|
|
4
3
|
import remarkFrontmatter from "remark-frontmatter";
|
|
5
4
|
import remarkGfm from "remark-gfm";
|
|
6
5
|
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
7
|
-
import { readFile } from "fs/promises";
|
|
8
6
|
import matter from "gray-matter";
|
|
9
|
-
|
|
10
7
|
//#region src/mdx/evaluate.ts
|
|
11
8
|
/**
|
|
12
9
|
* Evaluate MDX content string to a React component.
|
|
@@ -63,98 +60,58 @@ async function evaluateMDXToComponent(mdxContent, options) {
|
|
|
63
60
|
};
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
|
-
|
|
67
63
|
//#endregion
|
|
68
64
|
//#region src/blocks.ts
|
|
69
65
|
/**
|
|
70
|
-
* Evaluate all MDX blocks from
|
|
71
|
-
*
|
|
72
|
-
* High-level helper function for Astro pages that handles:
|
|
73
|
-
* - Fetching all blocks from Content API
|
|
74
|
-
* - Evaluating MDX content to React components
|
|
75
|
-
* - Error handling with fallback error components
|
|
76
|
-
* - Empty content handling with fallback components
|
|
77
|
-
*
|
|
78
|
-
* Returns data in the format expected by `createPageRendererWithBlocks`.
|
|
66
|
+
* Evaluate all MDX blocks from a compatible content API.
|
|
79
67
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* @returns Array of blocks with evaluated React components
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```astro
|
|
86
|
-
* ---
|
|
87
|
-
* import { createPageRendererWithBlocks } from '@conloca/astro-cms/components';
|
|
88
|
-
* import { createContentAPI } from '@conloca/content-api/node';
|
|
89
|
-
* import config from '../puck.config';
|
|
90
|
-
*
|
|
91
|
-
* const api = await createContentAPI({ contentRoot: './content' });
|
|
92
|
-
* const mdxComponents = await evaluateMDXBlocks(api, 'en');
|
|
93
|
-
* const PageRenderer = createPageRendererWithBlocks(config, puckData, mdxComponents);
|
|
94
|
-
* ---
|
|
95
|
-
* <PageRenderer />
|
|
96
|
-
* ```
|
|
68
|
+
* Returns structured success/error results so callers can decide how to
|
|
69
|
+
* surface broken blocks instead of hardcoding fallback UI in this package.
|
|
97
70
|
*/
|
|
98
71
|
async function evaluateMDXBlocks(api, locale) {
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
blocks = Array.from(api.listAllContent({ kind: "block" }));
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error("[evaluateMDXBlocks] Failed to list blocks from Content API:", error);
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
72
|
+
const blocks = Array.from(api.listAllContent({ kind: "block" }));
|
|
106
73
|
return Promise.all(blocks.map(async (block) => {
|
|
107
74
|
const locales = Object.keys(block.locales);
|
|
108
75
|
const firstLocale = locales.length > 0 ? block.locales[locales[0]] : null;
|
|
109
|
-
const
|
|
110
|
-
let mdxContent;
|
|
76
|
+
const manifestTitle = firstLocale?.meta?.title || firstLocale?.name || block.id;
|
|
111
77
|
try {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
78
|
+
const blockLocalized = await api.getLocalized(block.id, locale);
|
|
79
|
+
const blockTitle = blockLocalized?.localized?.meta?.title || blockLocalized?.localized?.name || manifestTitle;
|
|
80
|
+
const mdxContent = blockLocalized?.localized?.content?.mdx;
|
|
81
|
+
if (!mdxContent) return {
|
|
82
|
+
ok: false,
|
|
83
|
+
id: block.id,
|
|
84
|
+
title: blockTitle,
|
|
85
|
+
error: /* @__PURE__ */ new Error(`No MDX content found for block: ${block.id}`)
|
|
86
|
+
};
|
|
87
|
+
const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);
|
|
88
|
+
if (error || !EvaluatedComponent) return {
|
|
89
|
+
ok: false,
|
|
90
|
+
id: block.id,
|
|
91
|
+
title: blockTitle,
|
|
92
|
+
error: error || /* @__PURE__ */ new Error(`MDX evaluation failed for block: ${block.id}`)
|
|
93
|
+
};
|
|
116
94
|
return {
|
|
95
|
+
ok: true,
|
|
117
96
|
id: block.id,
|
|
118
97
|
title: blockTitle,
|
|
119
|
-
Component
|
|
98
|
+
Component: EvaluatedComponent
|
|
99
|
+
};
|
|
100
|
+
} catch (error) {
|
|
101
|
+
return {
|
|
102
|
+
ok: false,
|
|
103
|
+
id: block.id,
|
|
104
|
+
title: manifestTitle,
|
|
105
|
+
error: error instanceof Error ? error : /* @__PURE__ */ new Error(`Failed to evaluate block: ${block.id}`)
|
|
120
106
|
};
|
|
121
107
|
}
|
|
122
|
-
let Component;
|
|
123
|
-
if (mdxContent) {
|
|
124
|
-
const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);
|
|
125
|
-
if (error || !EvaluatedComponent) {
|
|
126
|
-
const errorMsg = error?.message || "MDX evaluation failed";
|
|
127
|
-
Component = () => React.createElement("div", { className: "p-4 bg-red-50 border border-red-200 rounded text-red-600" }, React.createElement("p", { className: "font-semibold mb-2" }, "MDX Compilation Error"), React.createElement("p", { className: "text-sm" }, `Block: ${block.id}`), React.createElement("p", { className: "text-xs mt-2" }, errorMsg));
|
|
128
|
-
} else Component = EvaluatedComponent;
|
|
129
|
-
} else Component = () => React.createElement("div", { className: "p-4 bg-gray-100 border border-gray-300 rounded text-gray-600" }, React.createElement("p", { className: "text-sm" }, `No content found for block: ${block.id}`));
|
|
130
|
-
return {
|
|
131
|
-
id: block.id,
|
|
132
|
-
title: blockTitle,
|
|
133
|
-
Component
|
|
134
|
-
};
|
|
135
108
|
}));
|
|
136
109
|
}
|
|
137
|
-
|
|
138
110
|
//#endregion
|
|
139
111
|
//#region src/mdx/compile.ts
|
|
140
|
-
|
|
141
|
-
* Compile MDX content to executable JavaScript
|
|
142
|
-
*
|
|
143
|
-
* We use BOTH gray-matter and remark-frontmatter plugins:
|
|
144
|
-
* 1. gray-matter extracts frontmatter data for returning as separate metadata
|
|
145
|
-
* 2. remark-frontmatter + remark-mdx-frontmatter allow using frontmatter values as {variables} in MDX
|
|
146
|
-
*
|
|
147
|
-
* This dual approach gives us:
|
|
148
|
-
* - Separate metadata object for the API response
|
|
149
|
-
* - Ability to use frontmatter variables like {title} directly in MDX content
|
|
150
|
-
*
|
|
151
|
-
* @param content - MDX content string (may include frontmatter)
|
|
152
|
-
* @param components - Component scope to inject
|
|
153
|
-
* @returns Compiled code and extracted metadata
|
|
154
|
-
*/
|
|
155
|
-
async function compileMDX(content, components) {
|
|
112
|
+
async function compileMDX(content) {
|
|
156
113
|
try {
|
|
157
|
-
const { data: metadata } = matter(content);
|
|
114
|
+
const { data: metadata } = matter(content, {});
|
|
158
115
|
const compiled = await compile(content, {
|
|
159
116
|
outputFormat: "function-body",
|
|
160
117
|
development: process.env.NODE_ENV === "development",
|
|
@@ -177,45 +134,7 @@ async function compileMDX(content, components) {
|
|
|
177
134
|
throw error;
|
|
178
135
|
}
|
|
179
136
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Create an MDX compiler with a fixed component scope
|
|
182
|
-
*
|
|
183
|
-
* @param componentScope - Components available to all MDX files
|
|
184
|
-
* @returns Compiler instance
|
|
185
|
-
*/
|
|
186
|
-
function createMDXCompiler(componentScope) {
|
|
187
|
-
return {
|
|
188
|
-
compile: async (content) => {
|
|
189
|
-
return compileMDX(content, componentScope);
|
|
190
|
-
},
|
|
191
|
-
compileFile: async (filePath) => {
|
|
192
|
-
try {
|
|
193
|
-
return compileMDX(await readFile(filePath, "utf-8"), componentScope);
|
|
194
|
-
} catch (error) {
|
|
195
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") throw new Error(`MDX file not found: ${filePath}`);
|
|
196
|
-
throw error;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Default component scope for MDX files in the CMS
|
|
203
|
-
* This can be extended with project-specific components
|
|
204
|
-
*/
|
|
205
|
-
const defaultMDXComponents = {};
|
|
206
|
-
/**
|
|
207
|
-
* Create a component scope by merging defaults with custom components
|
|
208
|
-
*
|
|
209
|
-
* @param customComponents - Project-specific components
|
|
210
|
-
* @returns Merged component scope
|
|
211
|
-
*/
|
|
212
|
-
function createComponentScope(customComponents = {}) {
|
|
213
|
-
return {
|
|
214
|
-
...defaultMDXComponents,
|
|
215
|
-
...customComponents
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
137
|
//#endregion
|
|
220
|
-
export { compileMDX,
|
|
138
|
+
export { compileMDX, evaluateMDXBlocks, evaluateMDXToComponent };
|
|
139
|
+
|
|
221
140
|
//# sourceMappingURL=node.mjs.map
|
package/dist/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.mjs","names":["mdxCompile"],"sources":["../src/mdx/evaluate.ts","../src/blocks.ts","../src/mdx/compile.ts"],"sourcesContent":["import { evaluate } from '@mdx-js/mdx';\nimport type { ComponentType } from 'react';\nimport * as runtime from 'react/jsx-runtime';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\n\n/**\n * Evaluate MDX content string to a React component.\n *\n * This is a framework-agnostic utility for converting MDX strings into\n * executable React components. Works in any Node.js environment (Astro,\n * Next.js, Remix, etc.) at build time or server-side.\n *\n * **When to use:**\n * - Building static sites with MDX content\n * - Server-side rendering MDX as React components\n * - Need React components (not HTML strings)\n *\n * @param mdxContent - The MDX string to evaluate\n * @param options - Optional configuration\n * @param options.development - Whether to use development mode (default: false)\n * @returns Object containing Component (or null) and optional error\n *\n * @example\n * ```typescript\n * import { evaluateMDXToComponent } from '@conloca/mdx/node';\n *\n * const { Component, error } = await evaluateMDXToComponent('# Hello\\n\\nThis is **MDX**');\n * if (error) {\n * console.error('Failed to evaluate:', error);\n * } else if (Component) {\n * // Render <Component /> in your React app\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In Astro pages\n * const { Component } = await evaluateMDXToComponent(mdxContent);\n * // Then render in JSX: <Component />\n * ```\n */\nexport async function evaluateMDXToComponent(\n mdxContent: string,\n options?: { development?: boolean },\n): Promise<{ Component: ComponentType | null; error?: Error }> {\n try {\n // Use evaluate() to compile and execute MDX in one step\n const { default: MDXComponent } = await evaluate(mdxContent, {\n ...runtime,\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n development: options?.development ?? false,\n });\n\n return { Component: MDXComponent };\n } catch (error) {\n return {\n Component: null,\n error: error instanceof Error ? error : new Error('MDX evaluation failed'),\n };\n }\n}\n","import type { ContentAPI, ContentManifest } from '@conloca/content-api';\nimport type { ComponentType } from 'react';\nimport React from 'react';\nimport { evaluateMDXToComponent } from './mdx/evaluate.js';\n\n/**\n * Evaluate all MDX blocks from Content API into React components.\n *\n * High-level helper function for Astro pages that handles:\n * - Fetching all blocks from Content API\n * - Evaluating MDX content to React components\n * - Error handling with fallback error components\n * - Empty content handling with fallback components\n *\n * Returns data in the format expected by `createPageRendererWithBlocks`.\n *\n * @param api - ContentAPI instance\n * @param locale - Locale code to fetch (e.g., 'en', 'es')\n * @returns Array of blocks with evaluated React components\n *\n * @example\n * ```astro\n * ---\n * import { createPageRendererWithBlocks } from '@conloca/astro-cms/components';\n * import { createContentAPI } from '@conloca/content-api/node';\n * import config from '../puck.config';\n *\n * const api = await createContentAPI({ contentRoot: './content' });\n * const mdxComponents = await evaluateMDXBlocks(api, 'en');\n * const PageRenderer = createPageRendererWithBlocks(config, puckData, mdxComponents);\n * ---\n * <PageRenderer />\n * ```\n */\nexport async function evaluateMDXBlocks(\n api: ContentAPI,\n locale: string,\n): Promise<\n Array<{\n id: string;\n title: string;\n Component: ComponentType;\n }>\n> {\n // Fetch all blocks with error handling\n let blocks: ContentManifest[];\n try {\n blocks = Array.from(api.listAllContent({ kind: 'block' })) as ContentManifest[];\n } catch (error) {\n console.error('[evaluateMDXBlocks] Failed to list blocks from Content API:', error);\n return [];\n }\n\n return Promise.all(\n blocks.map(async (block) => {\n const locales = Object.keys(block.locales);\n const firstLocale = locales.length > 0 ? block.locales[locales[0]] : null;\n const blockTitle = firstLocale?.meta?.title || firstLocale?.name || block.id;\n\n // Fetch the localized block to get MDX content with error handling\n let mdxContent: string | undefined;\n try {\n const blockLocalized = await api.getLocalized(block.id, locale);\n mdxContent = blockLocalized?.localized?.content?.mdx;\n } catch (error) {\n console.error(`[evaluateMDXBlocks] Failed to fetch block \"${block.id}\" for locale \"${locale}\":`, error);\n // Create error component for Content API failure\n const Component = () =>\n React.createElement(\n 'div',\n { className: 'p-4 bg-red-50 border border-red-200 rounded text-red-600' },\n React.createElement('p', { className: 'font-semibold mb-2' }, 'Content API Error'),\n React.createElement('p', { className: 'text-sm' }, `Failed to fetch block: ${block.id}`),\n React.createElement(\n 'p',\n { className: 'text-xs mt-2' },\n error instanceof Error ? error.message : 'Unknown error',\n ),\n );\n\n return {\n id: block.id,\n title: blockTitle,\n Component,\n };\n }\n\n // Evaluate MDX to React component\n let Component: ComponentType;\n\n if (mdxContent) {\n const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);\n\n if (error || !EvaluatedComponent) {\n // Create error component for failed MDX compilation\n const errorMsg = error?.message || 'MDX evaluation failed';\n Component = () =>\n React.createElement(\n 'div',\n { className: 'p-4 bg-red-50 border border-red-200 rounded text-red-600' },\n React.createElement('p', { className: 'font-semibold mb-2' }, 'MDX Compilation Error'),\n React.createElement('p', { className: 'text-sm' }, `Block: ${block.id}`),\n React.createElement('p', { className: 'text-xs mt-2' }, errorMsg),\n );\n } else {\n Component = EvaluatedComponent;\n }\n } else {\n // Empty component for blocks without content\n Component = () =>\n React.createElement(\n 'div',\n { className: 'p-4 bg-gray-100 border border-gray-300 rounded text-gray-600' },\n React.createElement('p', { className: 'text-sm' }, `No content found for block: ${block.id}`),\n );\n }\n\n return {\n id: block.id,\n title: blockTitle,\n Component,\n };\n }),\n );\n}\n","import { compile as mdxCompile } from '@mdx-js/mdx';\nimport { readFile } from 'fs/promises';\nimport matter from 'gray-matter';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\nimport type { MDXCompileResult, MDXCompiler } from '../types.js';\n\n/**\n * Compile MDX content to executable JavaScript\n *\n * We use BOTH gray-matter and remark-frontmatter plugins:\n * 1. gray-matter extracts frontmatter data for returning as separate metadata\n * 2. remark-frontmatter + remark-mdx-frontmatter allow using frontmatter values as {variables} in MDX\n *\n * This dual approach gives us:\n * - Separate metadata object for the API response\n * - Ability to use frontmatter variables like {title} directly in MDX content\n *\n * @param content - MDX content string (may include frontmatter)\n * @param components - Component scope to inject\n * @returns Compiled code and extracted metadata\n */\nexport async function compileMDX(content: string, components: Record<string, any>): Promise<MDXCompileResult> {\n try {\n // Extract frontmatter for metadata (but keep original content intact)\n const { data: metadata } = matter(content);\n\n // Compile MDX to JavaScript (with frontmatter still in content)\n const compiled = await mdxCompile(content, {\n outputFormat: 'function-body',\n development: process.env.NODE_ENV === 'development',\n remarkPlugins: [\n remarkFrontmatter, // Parse frontmatter syntax\n remarkMdxFrontmatter, // Make frontmatter available as variables in MDX\n remarkGfm, // Support tables, strikethrough, task lists, etc.\n ],\n });\n\n // The compiled value is a VFile, extract the string value\n const code = String(compiled.value);\n\n return {\n code,\n metadata,\n };\n } catch (error) {\n if (error instanceof Error) {\n // Enhance error message for better debugging\n const enhancedError = new Error(`MDX compilation failed: ${error.message}`);\n enhancedError.stack = error.stack;\n throw enhancedError;\n }\n throw error;\n }\n}\n\n/**\n * Create an MDX compiler with a fixed component scope\n *\n * @param componentScope - Components available to all MDX files\n * @returns Compiler instance\n */\nexport function createMDXCompiler(componentScope: Record<string, any>): MDXCompiler {\n return {\n compile: async (content: string) => {\n return compileMDX(content, componentScope);\n },\n\n compileFile: async (filePath: string) => {\n try {\n const content = await readFile(filePath, 'utf-8');\n return compileMDX(content, componentScope);\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {\n throw new Error(`MDX file not found: ${filePath}`);\n }\n throw error;\n }\n },\n };\n}\n\n/**\n * Default component scope for MDX files in the CMS\n * This can be extended with project-specific components\n */\nexport const defaultMDXComponents = {\n // HTML element overrides can be added here\n // h1: CustomH1,\n // p: CustomParagraph,\n // Custom components would be added here\n // Button: ButtonComponent,\n // Card: CardComponent,\n};\n\n/**\n * Create a component scope by merging defaults with custom components\n *\n * @param customComponents - Project-specific components\n * @returns Merged component scope\n */\nexport function createComponentScope(customComponents: Record<string, any> = {}) {\n return {\n ...defaultMDXComponents,\n ...customComponents,\n };\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"node.mjs","names":["mdxCompile"],"sources":["../src/mdx/evaluate.ts","../src/blocks.ts","../src/mdx/compile.ts"],"sourcesContent":["import { evaluate } from '@mdx-js/mdx';\nimport type { ComponentType } from 'react';\nimport * as runtime from 'react/jsx-runtime';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\n\n/**\n * Evaluate MDX content string to a React component.\n *\n * This is a framework-agnostic utility for converting MDX strings into\n * executable React components. Works in any Node.js environment (Astro,\n * Next.js, Remix, etc.) at build time or server-side.\n *\n * **When to use:**\n * - Building static sites with MDX content\n * - Server-side rendering MDX as React components\n * - Need React components (not HTML strings)\n *\n * @param mdxContent - The MDX string to evaluate\n * @param options - Optional configuration\n * @param options.development - Whether to use development mode (default: false)\n * @returns Object containing Component (or null) and optional error\n *\n * @example\n * ```typescript\n * import { evaluateMDXToComponent } from '@conloca/mdx/node';\n *\n * const { Component, error } = await evaluateMDXToComponent('# Hello\\n\\nThis is **MDX**');\n * if (error) {\n * console.error('Failed to evaluate:', error);\n * } else if (Component) {\n * // Render <Component /> in your React app\n * }\n * ```\n *\n * @example\n * ```typescript\n * // In Astro pages\n * const { Component } = await evaluateMDXToComponent(mdxContent);\n * // Then render in JSX: <Component />\n * ```\n */\nexport async function evaluateMDXToComponent(\n mdxContent: string,\n options?: { development?: boolean },\n): Promise<{ Component: ComponentType | null; error?: Error }> {\n try {\n const { default: MDXComponent } = await evaluate(mdxContent, {\n ...runtime,\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n development: options?.development ?? false,\n });\n\n return { Component: MDXComponent };\n } catch (error) {\n return {\n Component: null,\n error: error instanceof Error ? error : new Error('MDX evaluation failed'),\n };\n }\n}\n","import { evaluateMDXToComponent } from './mdx/evaluate.js';\nimport type { MDXBlockEvaluationResult } from './types.js';\n\ninterface BlockLocaleSummary {\n meta?: {\n title?: string;\n };\n name?: string;\n}\n\ninterface BlockManifest {\n id: string;\n locales: Record<string, BlockLocaleSummary | undefined>;\n}\n\ninterface BlockLocalizedEntry {\n localized?: {\n meta?: {\n title?: string;\n };\n name?: string;\n content?: {\n mdx?: string;\n };\n };\n}\n\ninterface BlockAPI {\n listAllContent(filters: { kind: 'block' }): Iterable<BlockManifest>;\n getLocalized(id: string, locale: string): Promise<BlockLocalizedEntry | null>;\n}\n\n/**\n * Evaluate all MDX blocks from a compatible content API.\n *\n * Returns structured success/error results so callers can decide how to\n * surface broken blocks instead of hardcoding fallback UI in this package.\n */\nexport async function evaluateMDXBlocks(api: BlockAPI, locale: string): Promise<MDXBlockEvaluationResult[]> {\n const blocks = Array.from(api.listAllContent({ kind: 'block' }));\n\n return Promise.all(\n blocks.map(async (block) => {\n const locales = Object.keys(block.locales);\n const firstLocale = locales.length > 0 ? block.locales[locales[0]] : null;\n const manifestTitle = firstLocale?.meta?.title || firstLocale?.name || block.id;\n\n try {\n const blockLocalized = await api.getLocalized(block.id, locale);\n const blockTitle = blockLocalized?.localized?.meta?.title || blockLocalized?.localized?.name || manifestTitle;\n const mdxContent = blockLocalized?.localized?.content?.mdx;\n\n if (!mdxContent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: new Error(`No MDX content found for block: ${block.id}`),\n };\n }\n\n const { Component: EvaluatedComponent, error } = await evaluateMDXToComponent(mdxContent);\n\n if (error || !EvaluatedComponent) {\n return {\n ok: false,\n id: block.id,\n title: blockTitle,\n error: error || new Error(`MDX evaluation failed for block: ${block.id}`),\n };\n }\n\n return {\n ok: true,\n id: block.id,\n title: blockTitle,\n Component: EvaluatedComponent,\n };\n } catch (error) {\n return {\n ok: false,\n id: block.id,\n title: manifestTitle,\n error: error instanceof Error ? error : new Error(`Failed to evaluate block: ${block.id}`),\n };\n }\n }),\n );\n}\n","import { compile as mdxCompile } from '@mdx-js/mdx';\nimport matter from 'gray-matter';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdxFrontmatter from 'remark-mdx-frontmatter';\nimport type { MDXCompileResult } from '../types.js';\n\nexport async function compileMDX(content: string): Promise<MDXCompileResult> {\n try {\n const { data: metadata } = matter(content, {});\n\n const compiled = await mdxCompile(content, {\n outputFormat: 'function-body',\n development: process.env.NODE_ENV === 'development',\n remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],\n });\n\n return {\n code: String(compiled.value),\n metadata: metadata as Record<string, unknown>,\n };\n } catch (error) {\n if (error instanceof Error) {\n const enhancedError = new Error(`MDX compilation failed: ${error.message}`);\n enhancedError.stack = error.stack;\n throw enhancedError;\n }\n\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,eAAsB,uBACpB,YACA,SAC6D;CAC7D,IAAI;EACF,MAAM,EAAE,SAAS,iBAAiB,MAAM,SAAS,YAAY;GAC3D,GAAG;GACH,eAAe;IAAC;IAAmB;IAAsB;GAAS;GAClE,aAAa,SAAS,eAAe;EACvC,CAAC;EAED,OAAO,EAAE,WAAW,aAAa;CACnC,SAAS,OAAO;EACd,OAAO;GACL,WAAW;GACX,OAAO,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,uBAAuB;EAC3E;CACF;AACF;;;;;;;;;ACvBA,eAAsB,kBAAkB,KAAe,QAAqD;CAC1G,MAAM,SAAS,MAAM,KAAK,IAAI,eAAe,EAAE,MAAM,QAAQ,CAAC,CAAC;CAE/D,OAAO,QAAQ,IACb,OAAO,IAAI,OAAO,UAAU;EAC1B,MAAM,UAAU,OAAO,KAAK,MAAM,OAAO;EACzC,MAAM,cAAc,QAAQ,SAAS,IAAI,MAAM,QAAQ,QAAQ,MAAM;EACrE,MAAM,gBAAgB,aAAa,MAAM,SAAS,aAAa,QAAQ,MAAM;EAE7E,IAAI;GACF,MAAM,iBAAiB,MAAM,IAAI,aAAa,MAAM,IAAI,MAAM;GAC9D,MAAM,aAAa,gBAAgB,WAAW,MAAM,SAAS,gBAAgB,WAAW,QAAQ;GAChG,MAAM,aAAa,gBAAgB,WAAW,SAAS;GAEvD,IAAI,CAAC,YACH,OAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,uBAAO,IAAI,MAAM,mCAAmC,MAAM,IAAI;GAChE;GAGF,MAAM,EAAE,WAAW,oBAAoB,UAAU,MAAM,uBAAuB,UAAU;GAExF,IAAI,SAAS,CAAC,oBACZ,OAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,OAAO,yBAAS,IAAI,MAAM,oCAAoC,MAAM,IAAI;GAC1E;GAGF,OAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,WAAW;GACb;EACF,SAAS,OAAO;GACd,OAAO;IACL,IAAI;IACJ,IAAI,MAAM;IACV,OAAO;IACP,OAAO,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,6BAA6B,MAAM,IAAI;GAC3F;EACF;CACF,CAAC,CACH;AACF;;;ACjFA,eAAsB,WAAW,SAA4C;CAC3E,IAAI;EACF,MAAM,EAAE,MAAM,aAAa,OAAO,SAAS,CAAC,CAAC;EAE7C,MAAM,WAAW,MAAMA,QAAW,SAAS;GACzC,cAAc;GACd,aAAa,QAAQ,IAAI,aAAa;GACtC,eAAe;IAAC;IAAmB;IAAsB;GAAS;EACpE,CAAC;EAED,OAAO;GACL,MAAM,OAAO,SAAS,KAAK;GACjB;EACZ;CACF,SAAS,OAAO;EACd,IAAI,iBAAiB,OAAO;GAC1B,MAAM,gCAAgB,IAAI,MAAM,2BAA2B,MAAM,SAAS;GAC1E,cAAc,QAAQ,MAAM;GAC5B,MAAM;EACR;EAEA,MAAM;CACR;AACF"}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.mdxeditor-toolbar-wrap {
|
|
2
|
+
flex-wrap: wrap;
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
row-gap: 4px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.mdxeditor {
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
height: 100%;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.mdxeditor-diff-source-wrapper {
|
|
15
|
+
flex: 1;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mdxeditor-toolbar-wrap [aria-label="Block type"] > span:first-child:empty:before {
|
|
21
|
+
content: "Block";
|
|
22
|
+
opacity: .6;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (width <= 640px) {
|
|
26
|
+
.mdxeditor-toolbar-wrap {
|
|
27
|
+
gap: 2px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.mdxeditor-toolbar-wrap button {
|
|
31
|
+
padding-inline: 4px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.mdxeditor-toolbar-wrap [data-orientation="vertical"] {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.mdxeditor-toolbar-wrap > div:first-child {
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
row-gap: 2px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[class*="_contentEditable_"].conloca-prose {
|
|
45
|
+
font-family: var(--conloca-host-font-family, inherit);
|
|
46
|
+
font-size: var(--conloca-host-font-size, inherit);
|
|
47
|
+
font-weight: var(--conloca-host-font-weight, inherit);
|
|
48
|
+
font-style: var(--conloca-host-font-style, inherit);
|
|
49
|
+
line-height: var(--conloca-host-line-height, inherit);
|
|
50
|
+
letter-spacing: var(--conloca-host-letter-spacing, inherit);
|
|
51
|
+
color: var(--conloca-host-color, inherit);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.conloca-prose [class*="_listitem_"] {
|
|
55
|
+
margin-block: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.conloca-code-block [class*="codeMirrorWrapper"] {
|
|
59
|
+
background: none;
|
|
60
|
+
border: 0;
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
position: static;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.conloca-code-block {
|
|
68
|
+
position: relative;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.conloca-code-block__filename {
|
|
72
|
+
all: unset;
|
|
73
|
+
font: inherit;
|
|
74
|
+
color: inherit;
|
|
75
|
+
cursor: text;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
width: 100%;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.conloca-code-block__filename:focus {
|
|
82
|
+
outline-offset: 2px;
|
|
83
|
+
outline: 1px dashed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.conloca-code-block .cm-editor, .conloca-code-block .cm-editor .cm-scroller, .conloca-code-block .cm-editor .cm-gutters, .conloca-code-block .cm-editor .cm-content, .conloca-code-block .cm-editor .cm-line {
|
|
87
|
+
background: none;
|
|
88
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
export type { MDXCompileResponse as MDXCompileResult } from '@conloca/content-api';
|
|
3
|
+
export interface EvaluatedMDXBlock {
|
|
4
|
+
ok: true;
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
Component: ComponentType;
|
|
8
|
+
}
|
|
9
|
+
export interface FailedMDXBlockEvaluation {
|
|
10
|
+
ok: false;
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
error: Error;
|
|
14
|
+
}
|
|
15
|
+
export type MDXBlockEvaluationResult = EvaluatedMDXBlock | FailedMDXBlockEvaluation;
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,YAAY,EAAE,kBAAkB,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,IAAI,CAAC;IACT,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,KAAK,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,GAAG,wBAAwB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conloca/mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/conloca/conloca.git",
|
|
10
|
-
"directory": "mdx"
|
|
10
|
+
"directory": "packages/mdx"
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/index.mjs",
|
|
13
13
|
"module": "./dist/index.mjs",
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@conloca/content-api": "0.1.16",
|
|
15
16
|
"@mdx-js/mdx": "^3.1.1",
|
|
16
17
|
"@mdx-js/react": "^3.1.1",
|
|
17
|
-
"@mdxeditor/editor": "^3.
|
|
18
|
+
"@mdxeditor/editor": "^3.55.0",
|
|
18
19
|
"gray-matter": "^4.0.3",
|
|
19
20
|
"lucide-react": "^0.564.0",
|
|
21
|
+
"mdast-util-to-markdown": "^2.1.2",
|
|
20
22
|
"remark-frontmatter": "^5.0.0",
|
|
21
23
|
"remark-gfm": "^4.0.0",
|
|
22
24
|
"remark-mdx-frontmatter": "^5.2.0",
|
|
23
25
|
"tslib": "^2.8.1"
|
|
24
26
|
},
|
|
25
27
|
"peerDependencies": {
|
|
26
|
-
"react": "^19.
|
|
27
|
-
"react-dom": "^19.
|
|
28
|
+
"react": "^19.2.5",
|
|
29
|
+
"react-dom": "^19.2.5"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
32
|
+
"@happy-dom/global-registrator": "20.6.1",
|
|
30
33
|
"@testing-library/react": "^16.3.2",
|
|
34
|
+
"@tsdown/css": "^0.22.0",
|
|
31
35
|
"@types/react": "19.2.14",
|
|
32
36
|
"@types/react-dom": "19.2.3",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
37
|
+
"happy-dom": "20.6.1",
|
|
38
|
+
"mdast-util-from-markdown": "^2.0.0",
|
|
39
|
+
"mdast-util-gfm": "^3.1.0",
|
|
40
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
35
41
|
"react": "19.2.4",
|
|
36
42
|
"react-dom": "19.2.4"
|
|
37
43
|
},
|
|
38
44
|
"exports": {
|
|
39
45
|
"./package.json": "./package.json",
|
|
40
46
|
".": {
|
|
41
|
-
"types": "./dist/index.d.
|
|
47
|
+
"types": "./dist/index.d.mts",
|
|
42
48
|
"import": "./dist/index.mjs",
|
|
43
49
|
"default": "./dist/index.mjs"
|
|
44
50
|
},
|
|
45
51
|
"./node": {
|
|
46
|
-
"types": "./dist/node.d.
|
|
52
|
+
"types": "./dist/node.d.mts",
|
|
47
53
|
"import": "./dist/node.mjs",
|
|
48
54
|
"default": "./dist/node.mjs"
|
|
49
55
|
}
|
|
@@ -53,19 +59,52 @@
|
|
|
53
59
|
"!**/*.tsbuildinfo"
|
|
54
60
|
],
|
|
55
61
|
"scripts": {
|
|
56
|
-
"
|
|
57
|
-
"test": "tsc-bun-test",
|
|
58
|
-
"test:watch": "bun test --watch"
|
|
62
|
+
"test": "nx run mdx:test --outputStyle=stream"
|
|
59
63
|
},
|
|
60
64
|
"nx": {
|
|
61
65
|
"targets": {
|
|
62
66
|
"test": {
|
|
63
67
|
"dependsOn": [
|
|
68
|
+
"typecheck-tests",
|
|
64
69
|
"^build"
|
|
65
|
-
]
|
|
70
|
+
],
|
|
71
|
+
"executor": "@smoothbricks/nx-plugin:bounded-exec",
|
|
72
|
+
"options": {
|
|
73
|
+
"command": "bun --conditions=production test",
|
|
74
|
+
"cwd": "{projectRoot}",
|
|
75
|
+
"timeoutMs": 120000,
|
|
76
|
+
"killAfterMs": 1e4
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"lint": {},
|
|
80
|
+
"tsdown-js": {
|
|
81
|
+
"executor": "nx:run-commands",
|
|
82
|
+
"cache": true,
|
|
83
|
+
"dependsOn": [
|
|
84
|
+
"^build"
|
|
85
|
+
],
|
|
86
|
+
"inputs": [
|
|
87
|
+
"{projectRoot}/src/**/*",
|
|
88
|
+
"{projectRoot}/tsdown.config.ts",
|
|
89
|
+
"{projectRoot}/tsconfig.lib.json",
|
|
90
|
+
"{projectRoot}/package.json"
|
|
91
|
+
],
|
|
92
|
+
"outputs": [
|
|
93
|
+
"{projectRoot}/dist/**/*.mjs",
|
|
94
|
+
"{projectRoot}/dist/**/*.d.mts"
|
|
95
|
+
],
|
|
96
|
+
"options": {
|
|
97
|
+
"command": "tsdown",
|
|
98
|
+
"cwd": "{projectRoot}"
|
|
99
|
+
}
|
|
66
100
|
}
|
|
67
|
-
}
|
|
101
|
+
},
|
|
102
|
+
"tags": [
|
|
103
|
+
"npm:public"
|
|
104
|
+
],
|
|
105
|
+
"name": "mdx"
|
|
68
106
|
},
|
|
69
107
|
"type": "module",
|
|
70
|
-
"types": "./dist/index.d.
|
|
108
|
+
"types": "./dist/index.d.mts",
|
|
109
|
+
"license": "FSL-1.1-ALv2"
|
|
71
110
|
}
|