Add support for presets

This commit is contained in:
Jordan Pittman 2024-08-19 15:30:58 -04:00 • committed by Philipp Spiess
parent 3553b5912e
commit f876304557
2 changed files with 10 additions and 0 deletions

View file

@ -102,6 +102,15 @@ function resolveInternal(ctx: ResolutionContext, user: UserConfig): void {
}
}
// Apply configs from presets
if (Array.isArray(user.presets) && user.presets.length === 0) {
throw new Error('The empty preset `[]` is not supported')
}
for (let preset of user.presets ?? []) {
resolveInternal(ctx, preset)
}
// Apply configs from plugins
for (let plugin of plugins) {
ctx.plugins.push(plugin)

View file

@ -4,6 +4,7 @@ import type { PluginUtils } from './resolve-config'
export type ResolvableTo<T> = T | ((utils: PluginUtils) => T)
export interface UserConfig {
presets?: UserConfig[]
theme?: ThemeConfig
plugins?: Plugin[]
}