import type { MinifyOptions } from 'terser'; import type { Asset } from './asset'; import type { Style } from './style'; import type { Resolve, ResolveNormalized } from './resolve'; import type { LogLevel, ILogger } from '../logger'; import type { SpeedyPlugin } from '../type'; import type { Input } from './input'; import type { Output, OutputNormalized } from './output'; import type { DevServer, DevServerNormalized } from './dev'; import type { Html } from './html'; import type { Analyze, AnalyzeNormalized } from './analyze'; export * from './style'; export * from './asset'; export * from './output'; export * from './resolve'; export * from './dev'; export * from './style'; export * from './asset'; export * from './output'; export * from './input'; export * from './analyze'; export * from './html'; /** * - `'serve'` will enable devPlugin, which will start a server. * - `'build'` is default options. */ export declare type Command = 'serve' | 'build'; /** * Different mode has different default args. * For example, in production mode, `minify` is enabled by default. */ export declare type Mode = 'development' | 'production'; /** * Enable profile plugin. * - `true` means enable cpuProfile. * - `hooks` means enable tapable profile. */ declare type Profile = boolean | 'hooks'; /** * When file changed bundler will rebuild under watch mode. */ declare type Watch = boolean; /** * Write to disk or not. */ declare type Write = boolean; /** * Options for minify. */ declare type Minify = 'esbuild' | 'terser' | false; /** * Options for terser, it will enabled when `minify` is `'terser'`. */ declare type TerserMinifyOptions = MinifyOptions; /** * The code version of output. */ declare type Target = 'es6' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext'; /** * The mode of sourcemap */ declare type SourceMap = boolean | 'inline' | 'external'; declare type Globals = Record; /** * @internal * @experimental experimental features */ declare type LegalComments = 'none' | 'inline' | 'eof' | 'linked' | 'external'; declare type Define = Record; declare type External = string[]; declare type Platform = 'node' | 'browser'; export interface SwcFeature { systemjs?: boolean; } export interface UserConfig { mode?: Mode; input?: Input; output?: Output; profile?: Profile; watch?: Watch; logLevel?: LogLevel; resolve?: Resolve; write?: Write; plugins?: SpeedyPlugin[]; minify?: Minify; terserOptions?: TerserMinifyOptions; target?: Target; sourceMap?: SourceMap; globals?: Globals; style?: Style; asset?: Asset; external?: External; dev?: DevServer | false; html?: Html; /** @default "none" */ legalComments?: LegalComments; /** @default { metafile: false, stats: false } */ analyze?: Analyze; /** @default {} */ define?: Define; /** @default "browser" */ platform?: Platform; /** @default "webapp" */ preset?: 'webapp' | 'library'; cache?: Cache; experimental?: { swc?: SwcFeature; }; } export interface Cache { /** * enable transform cache. * @default true */ transform?: boolean; } export interface CLIConfig extends UserConfig { /** * project root dir */ root?: string; /** * The path of config file, default by `speedy.config.js`. * * - `false` means do not read any config file. */ configFile?: string | false; /** * The mode of cli. */ command?: Command; } export interface BuildConfig extends Required> { logger: ILogger; analyze: AnalyzeNormalized; resolve: ResolveNormalized; output: OutputNormalized; dev: DevServerNormalized | false; terserOptions?: TerserMinifyOptions; css_resolve: (id: string, dir: string) => string; node_resolve: (id: string, dir: string) => string; }