UNPKG

@vuesax-alpha/auto-import-resolver

Version:

On-demand components auto importing for Vuesax Alpha.

53 lines (51 loc) 1.5 kB
type Awaitable<T> = T | Promise<T>; interface ImportInfo { as?: string; name?: string; from: string; } type SideEffectsInfo = (ImportInfo | string)[] | ImportInfo | string | undefined; interface ComponentInfo extends ImportInfo { sideEffects?: SideEffectsInfo; } type ComponentResolveResult = Awaitable<string | ComponentInfo | null | undefined | void>; type ComponentResolverFunction = (name: string) => ComponentResolveResult; interface ComponentResolverObject { type: 'component' | 'directive'; resolve: ComponentResolverFunction; } type ComponentResolver = ComponentResolverFunction | ComponentResolverObject; interface ResolverOptions { /** * import style css or sass with components * * @default 'css' */ importStyle?: boolean | 'css' | 'sass'; /** * use commonjs lib & source css or scss for ssr */ ssr?: boolean; /** * specify vuesax-alpha version to load style * * @default installed version */ version?: string; /** * auto import for directives * * @default true */ directives?: boolean; /** * exclude component name, if match do not resolve the name */ exclude?: RegExp; /** * a list of component names that have no styles, so resolving their styles file should be prevented */ noStylesComponents?: string[]; } declare function VuesaxAlphaResolver(options?: ResolverOptions): ComponentResolver[]; export { VuesaxAlphaResolver };