UNPKG

@rspack/cli

Version:
35 lines (34 loc) 2.35 kB
import type { RspackPluginFunction, RspackPluginInstance } from "@rspack/core"; import { type Compiler, type MultiCompiler, type MultiRspackOptions, type MultiStats, type RspackOptions, type Stats } from "@rspack/core"; import yargs from "yargs"; import type { RspackBuildCLIOptions, RspackCLIColors, RspackCLILogger, RspackCLIOptions } from "./types"; type Command = "serve" | "build"; export declare class RspackCLI { colors: RspackCLIColors; program: yargs.Argv; constructor(); createCompiler(options: RspackBuildCLIOptions, rspackCommand: Command, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>; createColors(useColor?: boolean): RspackCLIColors; getLogger(): RspackCLILogger; run(argv: string[]): Promise<void>; registerCommands(): Promise<void>; buildConfig(item: RspackOptions | MultiRspackOptions, options: RspackBuildCLIOptions, command: Command): Promise<RspackOptions | MultiRspackOptions>; loadConfig(options: RspackCLIOptions): Promise<RspackOptions | MultiRspackOptions>; isMultipleCompiler(compiler: Compiler | MultiCompiler): compiler is MultiCompiler; isWatch(compiler: Compiler | MultiCompiler): boolean; } export type RspackConfigFn = (env: Record<string, any>, argv: Record<string, any>) => RspackOptions | MultiRspackOptions; export type RspackConfigAsyncFn = (env: Record<string, any>, argv: Record<string, any>) => Promise<RspackOptions | MultiRspackOptions>; export type RspackConfigExport = RspackOptions | MultiRspackOptions | RspackConfigFn | RspackConfigAsyncFn; /** * This function helps you to autocomplete configuration types. * It accepts a Rspack config object, or a function that returns a config. */ export declare function defineConfig(config: RspackOptions): RspackOptions; export declare function defineConfig(config: MultiRspackOptions): MultiRspackOptions; export declare function defineConfig(config: RspackConfigFn): RspackConfigFn; export declare function defineConfig(config: RspackConfigAsyncFn): RspackConfigAsyncFn; export declare function defineConfig(config: RspackConfigExport): RspackConfigExport; export declare function definePlugin(plugin: RspackPluginFunction): RspackPluginFunction; export declare function definePlugin(plugin: RspackPluginInstance): RspackPluginInstance; export {};