Skip to content

Commit

Permalink
Merge pull request #7 from tony-sull/feat/2.0
Browse files Browse the repository at this point in the history
🚀 2.0 release
  • Loading branch information
tony-sull authored Mar 9, 2023
2 parents d395306 + 7070c51 commit d79bccf
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/integration.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) &&
Expand Down

0 comments on commit d79bccf

Please sign in to comment.