UNPKG

@empjs/chain

Version:
162 lines (150 loc) 5.24 kB
declare class Chainable { parent: any; constructor(parent: any); batch(handler: (instance: this) => void): this; end(): any; } declare class ChainedMap extends Chainable { store: Map<string, any>; shorthands?: string[]; constructor(parent: any); extend(methods: string[]): this; clear(): this; delete(key: string): this; order(): { entries: Record<string, any>; order: string[]; }; entries(): Record<string, any> | undefined; values(): any[]; get(key: string): any; getOrCompute(key: string, fn: () => any): any; has(key: string): boolean; set(key: string, value: any): this; merge(obj: Record<string, any>, omit?: string[]): this; clean(obj: Record<string, any>): Record<string, any>; when(condition: any, whenTruthy?: (instance: this) => void, whenFalsy?: (instance: this) => void): this; } declare class ChainedSet extends Chainable { store: Set<any>; constructor(parent: any); add(value: any): this; prepend(value: any): this; clear(): this; delete(value: any): this; values(): any[]; has(value: any): boolean; merge(arr: any[]): this; when(condition: any, whenTruthy?: (instance: this) => void, whenFalsy?: (instance: this) => void): this; } declare class DevServer extends ChainedMap { allowedHosts: ChainedSet; constructor(parent: any); toConfig(): any; merge(obj: any, omit?: string[]): this; } declare class Module extends ChainedMap { rules: ChainedMap; defaultRules: ChainedMap; constructor(parent: any); noParse(value: RegExp | RegExp[] | ((resource: string) => boolean) | Array<(resource: string) => boolean> | string | Array<string | RegExp>): this; strictExportPresence(value: boolean): this; defaultRule(name: string): any; rule(name: string): any; toConfig(): any; merge(obj: any, omit?: string[]): this; } declare class Optimization extends ChainedMap { minimizers: ChainedMap; constructor(parent: any); splitChunks(value: false | { chunks?: 'all' | 'async' | 'initial'; minSize?: number; minChunks?: number; automaticNameDelimiter?: string; cacheGroups?: Record<string, any>; [key: string]: any; }): this; concatenateModules(value: boolean): this; flagIncludedChunks(value: boolean): this; mergeDuplicateChunks(value: boolean): this; minimize(value: boolean): this; namedChunks(value: boolean | string): this; namedModules(value: boolean | string): this; nodeEnv(value: string | boolean): this; noEmitOnErrors(value: boolean): this; occurrenceOrder(value: boolean): this; portableRecords(value: boolean): this; providedExports(value: boolean): this; removeAvailableModules(value: boolean): this; removeEmptyChunks(value: boolean): this; runtimeChunk(value: boolean | 'single' | 'multiple' | { name?: string | ((entryPoint: any) => string); }): this; sideEffects(value: boolean): this; usedExports(value: boolean | 'global'): this; minimizer(name: string | any[]): any; toConfig(): any; merge(obj: any, omit?: string[]): this; } declare class Output extends ChainedMap { constructor(parent: any); } declare class Performance extends ChainedMap { constructor(parent: any); assetFilter(value: (assetFilename: string) => boolean): this; hints(value: 'warning' | 'error' | false): this; maxAssetSize(value: number): this; maxEntrypointSize(value: number): this; } declare class Resolve extends ChainedMap { alias: ChainedMap; aliasFields: ChainedSet; descriptionFiles: ChainedSet; extensions: ChainedSet; mainFields: ChainedSet; mainFiles: ChainedSet; modules: ChainedSet; plugins: ChainedMap; constructor(parent: any); cachePredicate(value: (request: string, context?: Record<string, any>) => boolean): this; cacheWithContext(value: boolean): this; concord(value: Record<string, unknown>): this; enforceExtension(value: boolean): this; enforceModuleExtension(value: boolean): this; symlinks(value: boolean): this; unsafeCache(value: boolean | RegExp | ((request: string) => boolean)): this; plugin(name: string): any; toConfig(): any; merge(obj: any, omit?: string[]): this; } declare class ResolveLoader extends Resolve { moduleExtensions: ChainedSet; packageMains: ChainedSet; constructor(parent: any); toConfig(): any; merge(obj: any, omit?: string[]): this; } declare class Config extends ChainedMap { devServer: DevServer; entryPoints: ChainedMap; module: Module; node: ChainedMap; optimization: Optimization; output: Output; performance: Performance; plugins: ChainedMap; resolve: Resolve; resolveLoader: ResolveLoader; constructor(); static toString(config: any, { verbose, configPrefix }?: { verbose?: boolean | undefined; configPrefix?: string | undefined; }): string; entry(name: string): ChainedSet; plugin(name: string): any; toConfig(): any; toString(options?: any): string; merge(obj?: any, omit?: string[]): this; } export { Config as default };