/// import { PackageJSON } from 'resolve'; import yargsParser from 'yargs-parser'; import { Logger } from '../utils/logger.js'; import type * as http from 'http'; import type * as express from 'express'; type Request = express.Request; type Response = express.Response; export interface IDep { [name: string]: string; } export interface IPackage { name?: string; dependencies?: IDep; devDependencies?: IDep; [key: string]: any; } export interface IPlugin { id: string; key: string; path: string; apply: (...args: any[]) => any; config?: IPluginConfig; isPreset?: boolean; } export interface IPluginConfig { default?: any; onChange?: string | ((...args: any[]) => any); } export interface IHook { name: string; fn?: { (state: any, config: any): void; }; pluginId?: string; } export interface ICommand { name: string; description?: string; details?: string; initialState?: any; fn: { (args: yargsParser.Arguments, config: any): void; }; } export interface IConfig { plugins?: string[]; [key: string]: any; } interface applyHookConfig { name: string; config?: T; } export interface API { cwd: string; logger: Logger; userConfig: IConfig; buildConfig: any; devBuildConfig: any; compileMode: string; commands: string[]; packageJson: PackageJSON; registerCommand: { (command: ICommand): void; }; registerHook: { (hook: IHook): void; }; registerMethod: { (method: (...args: any[]) => any): void; }; applyHook: { (opts: applyHookConfig): void; }; setStore: { (name: string, initialState: any): void; }; } export interface RemoteProxy { target: string; localPort?: number; localStatic?: StaticFileMatcher[]; fowardingURL?: string[]; } export interface StaticFileMatcher { url: string; local: string; } export interface UserConfig { mock?: MockConfig; proxy?: RemoteProxy; plugins?: string[]; compileMode?: string; buildConfig?: BuildConfig[]; devBuildConfig?: DevBuildConfig; } export interface MockConfig { enableMock?: boolean; mockPath?: string; } export interface DevBuildConfig { name: string; path: string; args?: Record; env?: Record; devProxy?: DevProxy; } export interface DevProxy { target: string; matcher: (pathname: string, req: Request) => boolean; onProxyRes: (proxyRes: http.IncomingMessage, req: Request, res: Response) => void; } export interface BuildConfig { name: string; path: string; args?: Record; env?: Record; } export type ExportUserConfig = UserConfig | Promise; export declare function defineConfig(config: ExportUserConfig): ExportUserConfig; export interface Arguments { _: Array; '--'?: Array; [argName: string]: any; } export {};