import { LibraryOptions, PluginOption, ServerOptions } from 'vite'; import { ViteUserConfig } from 'vitest/config'; import { InlineConfig } from 'vitest/node'; /** * A config builder for the vite build system. * * This is helpful when building different types * of projects and keeping a standard. * * @example vite.config.ts * * ```ts * // Before Config Builder * export default defineConfig({ * build: { * lib: { * entry: { * index: "./src/index.ts", * }, * formats: ["cjs", "es"], * }, * }, * minify: false, * sourceMap: true, * plugins: [ * swc.vite(), * tsConfigPaths(), * externalizeDeps(), * dtsPlugin({ * compilerOptions: { * paths: {}, * }, * }), * ], * }); * ``` * * ```ts * // After config builder * const config = new ZViteConfigBuilder().library().build(); * export default defineConfig(config); * ``` * * @deprecated Use @zthun/janitor-vite plugins instead. */ export declare class ZViteConfigBuilder { private config; /** * Initializes a new instance of this object. */ constructor(); /** * Sets whether to minify the build output. * * @param minify - * The flag as to minify the output. * * @returns * This object. */ minify(minify?: boolean): this; /** * Adds a list of plugins. * * @param option - * The plugins to add. * * @returns * This object. */ plugin(option?: PluginOption | PluginOption[]): this; /** * Sets whether to generate source maps. * * @param sourcemap - * True to generate a sourcemap, false for faster build. * * @returns * This object. */ sourceMap(sourcemap?: boolean): this; /** * Adds an alias to the resolution options. * * @param key - * The name of the package to alias * @param value - * The alias resolution * * @returns * This object. */ alias(key: string, value: string): this; /** * Adds an alias for lodash to lodash-es. * * @returns * This object. */ lodash: () => this; /** * Assigns the server options. * * @param options - * The server options to assign. * * @returns * This object. */ server(options: ServerOptions): this; /** * Sets vite into library mode. * * @param lib - * The options for the library. You can set this to * nothing to use the default library which looks for * an entry point at the source directory called index.ts * * @see {@link ZViteLibraryBuilder} for more information. * * @returns * This object. */ library(lib?: LibraryOptions): this; /** * Constructs the config to act as if it's compiling a node application. * * This is just an alias to {@link ZViteConfigBuilder.library} with two * entry points. * * 1. The file src/cli.ts is the main entry point of the application. * 1. The file, src/index.ts, is the api for importing and using it as an api. * * @returns * This object. */ cli(): this; /** * Constructs the config to act as if it's compiling a nest application. * * This is just an alias to {@link ZViteConfigBuilder.library} with a single * entry point. * * 1. The file, src/main.mts * * @returns * This object. */ nest(): this; /** * Constructs the config to act as if it's compiling a web application. * * @returns * This object. */ web(): this; /** * Constructs the config to compile a react application. * * @returns * This object. */ react(): this; /** * Constructs the config to be for testing. * * @param options - * The test config to use. */ test(options: InlineConfig): this; /** * Returns the currently built config. * * @returns * The currently built config. */ build(): ViteUserConfig; }