@types/webpack-blocks__core
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

Installation

npm install --save @types/webpack-blocks__core

Summary

This package contains type definitions for @webpack-blocks/core (https://github.com/andywer/webpack-blocks/tree/master/packages/core).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webpack-blocks__core.

index.d.ts

import { Configuration, Plugin, RuleSetRule } from "webpack";

export type ConfigSetter<T extends Context = Context> = (
    context: T,
    util: Util,
) => (config: Configuration) => Configuration;

export interface Block<T extends Context = Context> extends ConfigSetter<T> {
    pre?: ConfigSetter<T> | Array<ConfigSetter<T>> | undefined;
    post?: ConfigSetter<T> | Array<ConfigSetter<T>> | undefined;
}

export interface Context {
    match: {
        test: RegExp | RegExp[];
    };
}

export interface InitialContext {
    webpack: any;
    webpackVersion: string;
}

export interface MatchOptions {
    include?: string | undefined;
    exclude?: RegExp | undefined;
}

export interface Util {
    addLoader(loaderDefinition: RuleSetRule): () => Configuration;
    addPlugin(plugin: Plugin): () => Configuration;
    merge(configSnippet: Configuration): () => Configuration;
}

export namespace Core {
    function createConfig(configSetters: Block[]): Block;
    function createConfig(initialContext: InitialContext, configSetters: Block[]): Block;
    function group(configSetters: Block[]): Block;
    function env(envName: string, configSetters: Block[]): Block;
    function match(test: string | string[], configSetters: Block[]): Block;
    function match(test: string | string[], options: MatchOptions, configSetters: Block[]): Block;
    function when(condition: boolean, configSetters: Block[]): Block;
}

export function createConfig(configSetters: Block[]): Block;
export function createConfig(initialContext: InitialContext, configSetters: Block[]): Block;

export function group(configSetters: Block[]): Block;

export function env(envName: string, configSetters: Block[]): Block;

export function match(test: string | string[], configSetters: Block[]): Block;
export function match(test: string | string[], options: MatchOptions, configSetters: Block[]): Block;

export function when(condition: boolean, configSetters: Block[]): Block;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/webpack

Credits

These definitions were written by Max Boguslavskiy.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/webpack-blocks__core

Weekly Downloads

21

Version

2.0.7

License

MIT

Unpacked Size

6.67 kB

Total Files

5

Last publish

Collaborators

  • types