-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderers.mjs
More file actions
51 lines (48 loc) · 1.86 KB
/
renderers.mjs
File metadata and controls
51 lines (48 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { H as renderJSX, I as createVNode, J as AstroJSX, a as AstroUserError } from './chunks/astro/server_DEq4NUVT.mjs';
const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
async function check(Component, props, { default: children = null, ...slotted } = {}) {
if (typeof Component !== "function") return false;
const slots = {};
for (const [key, value] of Object.entries(slotted)) {
const name = slotName(key);
slots[name] = value;
}
try {
const result = await Component({ ...props, ...slots, children });
return result[AstroJSX];
} catch (e) {
throwEnhancedErrorIfMdxComponent(e, Component);
}
return false;
}
async function renderToStaticMarkup(Component, props = {}, { default: children = null, ...slotted } = {}) {
const slots = {};
for (const [key, value] of Object.entries(slotted)) {
const name = slotName(key);
slots[name] = value;
}
const { result } = this;
try {
const html = await renderJSX(result, createVNode(Component, { ...props, ...slots, children }));
return { html };
} catch (e) {
throwEnhancedErrorIfMdxComponent(e, Component);
throw e;
}
}
function throwEnhancedErrorIfMdxComponent(error, Component) {
if (Component[Symbol.for("mdx-component")]) {
if (AstroUserError.is(error)) return;
error.title = error.name;
error.hint = `This issue often occurs when your MDX component encounters runtime errors.`;
throw error;
}
}
const renderer = {
name: "astro:jsx",
check,
renderToStaticMarkup
};
var server_default = renderer;
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"file:///C:/My_Notebook/WindMillCode/projects/angular-templates/starlight-docs/node_modules/.pnpm/@astrojs+mdx@4.3.6_astro@5._8fbb999a77a82f36f23f5785346bfee3/node_modules/@astrojs/mdx/dist/server.js"}, { ssr: server_default }),];
export { renderers };