import type { AstroIntegration } from "astro"; import type { AstroBuildDoneHookInput, IntegrationDefaults, IntegrationInput, IntegrationOptions, } from "./types.ts"; import { buildDoneHook } from "./hook.ts"; const defaults: IntegrationDefaults = { width: 1200, height: 630, verbose: false, }; export function astroOpenGraphImages({ options, render, filter, pathFilter, }: IntegrationInput): AstroIntegration { const optionsWithDefaults: IntegrationOptions = { ...defaults, ...options }; return { name: "astro-opengraph-images", hooks: { "astro:build:done": async (entry: AstroBuildDoneHookInput) => { return buildDoneHook({ ...entry, options: optionsWithDefaults, render, filter, pathFilter, }); }, }, }; }