Initial commit

This commit is contained in:
Pax
2026-07-07 20:48:21 -04:00
committed by GitHub
commit ceb2d21bbf
292 changed files with 42584 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { componentRegistry } from "./registry"
import { QuartzComponent, QuartzComponentConstructor } from "./types"
export function External<Options extends object | undefined>(
name: string,
options?: Options,
): QuartzComponent {
const registered = componentRegistry.get(name)
if (!registered) {
throw new Error(
`External component "${name}" not found. ` +
`Make sure the plugin is installed and components are loaded before layouts are evaluated.`,
)
}
const { component } = registered
if (typeof component === "function") {
return (component as QuartzComponentConstructor<Options>)(options as Options)
}
return component as QuartzComponent
}