@empjs/chain
Version:
emp chain
123 lines (111 loc) • 3.38 kB
text/typescript
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);
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);
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);
}
declare class Resolve extends ChainedMap {
alias: ChainedMap;
aliasFields: ChainedSet;
descriptionFiles: ChainedSet;
extensions: ChainedSet;
mainFields: ChainedSet;
mainFiles: ChainedSet;
modules: ChainedSet;
plugins: ChainedMap;
constructor(parent: any);
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 };