import type { PluginStore, Plugins, DefaultBuilderPluginAPI } from './plugin'; import type { BuilderContext } from './context'; import type { Compiler, MultiCompiler } from 'webpack'; import type { BuilderMode, CreateBuilderOptions } from './builder'; import type { Server, ModernDevServerOptions } from '@modern-js/server'; import type { AddressUrl } from '@modern-js/utils'; import { Logger } from '@modern-js/prod-server'; export type Bundler = 'webpack' | 'rspack'; export type CreateCompilerOptions = { watch?: boolean; }; export type StartDevServerOptions = { compiler?: Compiler | MultiCompiler; printURLs?: boolean | ((urls: AddressUrl[]) => AddressUrl[]); logger?: Logger; strictPort?: boolean; getPortSilently?: boolean; serverOptions?: Partial> & { config?: Partial; }; }; export type BuildOptions = { mode?: BuilderMode; watch?: boolean; compiler?: Compiler | MultiCompiler; }; export type InspectConfigOptions = { env?: BuilderMode; verbose?: boolean; outputPath?: string; writeToDisk?: boolean; }; export type StartServerResult = { urls: string[]; port: number; server: Server; }; export type BuilderProvider = Record, BundlerConfig extends Record = Record, NormalizedConfig extends Record = Record, Compiler extends Record = Record> = (options: { pluginStore: PluginStore; builderOptions: Required; plugins: Plugins; }) => Promise>; export type ProviderInstance = Record, BundlerConfig extends Record = Record, NormalizedConfig extends Record = Record, CommonCompiler extends Record = Record> = { readonly bundler: Bundler; readonly publicContext: Readonly; pluginAPI: DefaultBuilderPluginAPI; applyDefaultPlugins: (pluginStore: PluginStore) => Promise; createCompiler: (options?: CreateCompilerOptions) => Promise; startDevServer: (options?: StartDevServerOptions) => Promise; serve: () => Promise; build: (options?: BuildOptions) => Promise; initConfigs: () => Promise; inspectConfig: (options?: InspectConfigOptions) => Promise<{ builderConfig: string; bundlerConfigs: string[]; origin: { builderConfig: BuilderConfig; bundlerConfigs: BundlerConfig[]; }; }>; };