import type { Configuration, Items, Loaders, Rules } from '@roots/bud-framework'; import type { Base } from './base.js'; import type { Item } from './item.js'; import type { Loader } from './loader.js'; import type { Rule, Options as RuleOptions, Output as RuleOutput } from './rule.js'; /** * Build Service * * @remarks * Generates a compiler config and acts as a repository for {@link Rule} {@link Item} * and {@link Loader} instances. * * @example * Access the configuration: * * ```js * build.config * ``` * * @example * Build the configuration: * * ```js * await build.make() * ``` * * @example * Get the current `build.entry` value * * ```js * bud.hooks.filter('build.entry', {}) * ``` */ export interface Build { /** * Compiler configuration */ config: Partial; /** * Get a {@link Item} instance */ getItem(name: K): Items[K]; /** * Set a {@link Loader} instance */ getLoader(name: K): Loaders[K]; /** * Get a {@link Rule} instance */ getRule(name: K): Rules[K]; /** * {@link Item} instances */ items: Items; /** * {@link Loader} instances */ loaders: Loaders; /** * Make {@link Build.config} */ make(): Promise; /** * Make a new {@link Item} instance */ makeItem(options?: Partial): Item; /** * Make a {@link Loader} instance */ makeLoader(name: string, definition?: string): Loader; /** * Make a new {@link Rule} instance */ makeRule(options?: Partial | RuleOutput): Rule; /** * {@link Rule} instances */ rules: Rules; /** * Set a {@link Item} instance */ setItem(name: K, options?: any): this; /** * Set a {@link Loader} instance */ setLoader(name: K, definition?: any): this; /** * Set a {@link Rule} instance */ setRule(name: K, options?: Rule | RuleOptions): this; } export type { Base, Item, Loader, Rule };