import type { SendProgress, Server } from '@callstack/repack-dev-server'; import type { EnvOptions } from '../types.js'; export type Bundler = 'rspack' | 'webpack'; export interface BundleArguments { entryFile?: string; platform: string; dev: boolean; minify?: boolean; bundleOutput?: string; sourcemapOutput?: string; assetsDest?: string; json?: string; stats?: string; resetCache?: boolean; verbose?: boolean; watch?: boolean; maxWorkers?: number; config?: string; webpackConfig?: string; bundler?: Bundler; } export interface StartArguments { port?: number; host: string; https?: boolean; key?: string; cert?: string; interactive?: boolean; json?: boolean; logFile?: string; logRequests?: boolean; platform?: string; resetCache?: boolean; reversePort?: boolean; verbose?: boolean; maxWorkers?: number; config?: string; webpackConfig?: string; bundler?: Bundler; } export interface CliConfig { root: string; platforms: string[]; reactNativePath: string; } export interface StartCliOptions { command: 'start'; config: CliConfig; arguments: { start: StartArguments; }; } export interface BundleCliOptions { command: 'bundle'; config: CliConfig; arguments: { bundle: BundleArguments; }; } export type CliOptions = StartCliOptions | BundleCliOptions; export type RemoveRecord = T extends infer U & Record ? U : never; type ConfigKeys = 'name' | 'context' | 'mode' | 'devServer' | 'entry' | 'optimization' | 'output' | 'resolve' | 'experiments' | 'cache' | 'watchOptions' | 'stats' | 'plugins'; /** * Loose configuration shape used as a generic constraint for `makeCompilerConfig`. * Values are intentionally `any` — both webpack and rspack `Configuration` types * must satisfy `C extends ConfigurationObject` in generic helper functions that * assign to `Partial` properties (e.g. `getCliOverrides`, `normalizeConfig`). * Using `unknown` values would break these generic assignments. */ export type ConfigurationObject = Partial>; export type Configuration = T | ((env: EnvOptions, argv: Record) => T | Promise); export interface CompilerAsset { data: Buffer; info: { hotModuleReplacement?: boolean; related?: { sourceMap?: string | string[]; }; size?: number; [key: string]: unknown; }; size: number; } export interface CompilerInterface { platforms: string[]; assetsCache: Record | undefined>; statsCache: Record; setDevServerContext(ctx: Server.DelegateContext): void; start(): void; close(callback?: (error?: Error | null) => void): void; getAsset(filename: string, platform: string, sendProgress?: SendProgress): Promise; getSource(filename: string, platform: string | undefined, sendProgress?: SendProgress): Promise; getSourceMap(filename: string, platform: string | undefined): Promise; } export {};