diff --git a/playground/providers/custom.ts b/playground/providers/custom.ts index 7e46891..86e8854 100644 --- a/playground/providers/custom.ts +++ b/playground/providers/custom.ts @@ -1,5 +1,4 @@ -// TODO: expose types publicly -import type { FontProvider } from '../../src/types' +import type { FontProvider } from '@nuxt/fonts' const resolvableFonts = new Set() export default { diff --git a/src/module.ts b/src/module.ts index 8d5a326..bab62c8 100644 --- a/src/module.ts +++ b/src/module.ts @@ -10,10 +10,24 @@ import { FontFamilyInjectionPlugin, type FontFaceResolution } from './plugins/tr import { generateFontFace } from './css/render' import type { GenericCSSFamily } from './css/parse' import { setupPublicAssetStrategy } from './assets' -import type { FontFamilyManualOverride, FontFamilyProviderOverride, FontProvider, ModuleOptions } from './types' +import type { FontFamilyManualOverride, FontFamilyProviderOverride, FontProvider, ModuleHooks, ModuleOptions } from './types' import { logger } from './logger' -export type { ModuleOptions } from './types' +export type { + FontProvider, + FontFaceData, + FontFallback, + FontFamilyManualOverride, + FontFamilyOverrides, + FontFamilyProviderOverride, + FontProviderName, + NormalizedFontFaceData, + ResolveFontFacesOptions, + LocalFontSource, + RemoteFontSource, + FontSource, + ModuleOptions +} from './types' const defaultValues = { weights: [400], @@ -222,10 +236,6 @@ async function resolveProviders (_providers: ModuleOptions['providers'] = {}) { return providers as Record } -export interface ModuleHooks { - 'fonts:providers': (providers: FontProvider) => void | Promise -} - declare module '@nuxt/schema' { interface NuxtHooks extends ModuleHooks {} } diff --git a/src/types.ts b/src/types.ts index 5b4ad08..98ce889 100644 --- a/src/types.ts +++ b/src/types.ts @@ -151,3 +151,7 @@ export interface ModuleOptions { // TODO: support default provider // provider?: FontProviderName } + +export interface ModuleHooks { + 'fonts:providers': (providers: FontProvider) => void | Promise +}