import type { TransformOptions } from '@babel/core'; import type { Compiler, Configuration, RuleSetRule, Stats, Watching, } from 'webpack'; export interface ConfigPaths { build?: string; src?: string; } export interface ConfigEntryObject { key: string; path: string; } export type ConfigEntry = string | ConfigEntryObject; export interface Options { aliases: Record; babel: TransformOptions; defines: Record; entries: ConfigEntry[]; serviceWorkerEntry: false | string; env?: string; productionProfiling?: boolean; hmr?: boolean; allowlistExternalExtensions: string[]; includePaths: string[]; jsModuleRules?: RuleSetRule[]; moduleRules?: NonNullable['rules']; paths: ConfigPaths; plugins: ( | NonNullable[number] | undefined | false )[]; prependPlugins?: ( | NonNullable[number] | undefined | false )[]; resolveLoaderModules?: string[]; typescript: boolean; webpackPrefixPackageFields: string[]; } export type WatchCallback = (stats: Stats | undefined) => void; export type FilledWebpackConfigurationKeys = | 'mode' | 'bail' | 'target' | 'devtool' | 'optimization' | 'resolveLoader' | 'resolve' | 'entry' | 'output'; export type FilledWebpackConfiguration = Pick< Configuration, Exclude > & Required>; export interface PobpackCompiler { clean: () => undefined | Buffer; compiler: Compiler; run: () => Promise; watch: (callback: WatchCallback) => Watching; webpackConfig: Readonly; } export interface CreateCompilerOptions { progressBar?: boolean; successMessage?: string; }