diff --git a/src/integration.ts b/src/integration.ts index a5fb81d..4a3cc1c 100644 --- a/src/integration.ts +++ b/src/integration.ts @@ -1,9 +1,17 @@ import type { AstroIntegration } from 'astro' +import { type WebfingerProps } from './utils/simpleWebfinger.js' import webfingerPlugin, { type WebfingerOptions, } from './vite-webfinger-plugin.js' -type Options = WebfingerOptions +interface DeprecatedOptions { + /** @deprecated Use `webfinger({ instance, username }) instead */ + mastodon?: WebfingerProps + instance: never + username: never +} + +type Options = WebfingerOptions | DeprecatedOptions export default function createIntegration( options: Options | undefined @@ -18,6 +26,20 @@ export default function createIntegration( return } + if ('mastodon' in options) { + if (config.output === 'static') { + throw new Error( + `[astro-webfinger] nested "mastodon" objects are were deprecated in v1.0.0 and removed in v2.0.0 + +Pass the { instance, username } object directly to the integration for static builds` + ) + } else { + ;`[astro-webfinger] nested "mastodon" objects are were deprecated in v1.0.0 and removed in v2.0.0 + +Pass a map of user accounts similar to { user: { instance, username } } directly to the integration for SSR builds` + } + } + if ( config.output === 'static' && Array.isArray(options) &&