UNPKG

@fumadocs/mdx-remote

Version:

The remote MDX files adapter for Fumadocs

34 lines (32 loc) 1.04 kB
import jsxRuntimeDefault from "react/jsx-runtime"; //#region src/render.ts const AsyncFunction = Object.getPrototypeOf(executeMdx).constructor; async function executeMdx(compiled, options = {}) { const { opts: scopeOpts, ...scope } = options.scope ?? {}; const fullScope = { opts: { ...scopeOpts, ...options.jsxRuntime ?? jsxRuntimeDefault, baseUrl: options.baseUrl }, ...scope }; const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled); return await hydrateFn.apply(hydrateFn, Object.values(fullScope)); } function executeMdxSync(compiled, options = {}) { const { opts: scopeOpts, ...scope } = options.scope ?? {}; const fullScope = { opts: { ...scopeOpts, ...options.jsxRuntime ?? jsxRuntimeDefault, baseUrl: options.baseUrl }, ...scope }; const hydrateFn = new Function(...Object.keys(fullScope), compiled); return hydrateFn.apply(hydrateFn, Object.values(fullScope)); } //#endregion export { executeMdxSync as n, executeMdx as t }; //# sourceMappingURL=render-D3Ssff59.js.map