UNPKG

@roots/bud-build

Version:

bud.js core module

79 lines (78 loc) 2.2 kB
import type { Bud, Build as BudBuild } from '@roots/bud-framework'; import type { Items, Loaders, Rules } from '@roots/bud-framework'; import type { Configuration } from '@roots/bud-framework/config'; import Item from '@roots/bud-build/item'; import Loader from '@roots/bud-build/loader'; import { register } from '@roots/bud-build/registry'; import Rule, { type Options as RuleOptions } from '@roots/bud-build/rule'; import { Service } from '@roots/bud-framework/service'; /** * {@link BudBuild} */ declare class Build extends Service implements BudBuild { /** * {@link BudBuild.config} */ config: Partial<Configuration>; /** * {@link BudBuild.items} */ items: Items; /** * {@link BudBuild.loaders} */ loaders: Loaders; /** * {@link BudBuild.register} */ register?: typeof register; /** * {@link BudBuild.rules} */ rules: Rules; /** * {@link Service.register} */ bootstrap?(app: Bud): Promise<void>; /** * {@link BudBuild.getItem} */ getItem(name: `${keyof Items & string}`): Item; /** * {@link BudBuild.getLoader} */ getLoader(name: string): Loader; /** * {@link BudBuild.getRule} */ getRule<K extends `${keyof Rules & string}`>(ident: K): Rules[K]; /** * {@link BudBuild.make} */ make(): Promise<Partial<Configuration>>; /** * {@link BudBuild.makeItem} */ makeItem(options?: Partial<Item['options']>): Item; /** * {@link BudBuild.makeLoader} */ makeLoader(src?: string, definition?: string): Loader; /** * {@link BudBuild.makeRule} */ makeRule(options?: RuleOptions): Rule; /** * {@link BudBuild.setItem} */ setItem<K extends `${keyof Items & string}`>(ident: K, definition?: ((item: Items[K]) => Items[K]) | Items[K]): this; /** * {@link BudBuild.setLoader} */ setLoader<K extends `${keyof Loaders & string}`>(name: K, definition?: any): this; /** * {@link BudBuild.setRule} */ setRule<K extends `${keyof Rules & string}`>(name: K, definition?: Rule | RuleOptions): this; } export { Build as default };