17 lines
679 B
TypeScript
17 lines
679 B
TypeScript
// Universal Nuxt plugin syncing `app.config.ts` (`journal.embeds`) into the
|
|
// active Journal embed registry on both SSR and client before page components
|
|
// render, so `htmlGate.ts`, `embeds.ts`, and `useJournalEmbedHydration.ts`
|
|
// agree on the exact same provider set.
|
|
import { defineJournalEmbedProviders, type JournalEmbedProvider } from '../utils/embedRegistry.ts'
|
|
|
|
export default defineNuxtPlugin({
|
|
name: 'journal-embeds',
|
|
enforce: 'pre',
|
|
setup() {
|
|
const appConfig = useAppConfig() as { journal?: { embeds?: Record<string, JournalEmbedProvider> } }
|
|
if (appConfig?.journal?.embeds) {
|
|
defineJournalEmbedProviders(appConfig.journal.embeds)
|
|
}
|
|
},
|
|
})
|