-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeScript typings for core & webpack
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Type definitions for @webpack-blocks/core 1.0.0 | ||
// Project: webpack-blocks | ||
// Definitions by: Stephan Schneider <https://github.com/zcei> | ||
|
||
import { Configuration as WebpackConfig, Condition, Rule, Plugin } from 'webpack' | ||
|
||
export function createConfig(configSetter: WebpackBlock[]): object | ||
export function group(configSetters: WebpackBlock[]): WebpackBlock | ||
export function env(envName: string, configSetters: WebpackBlock[]): WebpackBlock | ||
export function match(test: Condition | Condition[], configSetters: Function[]): Function | ||
|
||
|
||
export interface WebpackBlock { | ||
(context: Object, util: WebpackBlockUtils): WebpackBlockUpdater | ||
} | ||
|
||
export interface WebpackBlockUpdater { | ||
(previousConfig: WebpackConfig): WebpackConfig | ||
} | ||
|
||
/*~ You can declare types that are available via importing the module */ | ||
export interface WebpackBlockUtils { | ||
merge: (configSnippet: WebpackConfig) => WebpackBlockUpdater | ||
addLoader: (loader: Rule) => WebpackBlockUpdater | ||
addPlugin: (plugin: Plugin) => WebpackBlockUpdater | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Type definitions for @webpack-blocks/webpack 1.0.0 | ||
// Project: webpack-blocks | ||
// Definitions by: Stephan Schneider <https://github.com/zcei> | ||
|
||
import { | ||
createConfig, | ||
group, | ||
env, | ||
match, | ||
WebpackBlock, | ||
WebpackBlockUpdater | ||
} from '@webpack-blocks/core' | ||
import { Configuration, Plugin, Entry, Options, Resolve, Output } from 'webpack' | ||
export { createConfig, group, env, match } | ||
|
||
export function addPlugins(plugins: Plugin[]): WebpackBlock | ||
export function customConfig(configSnippet: Configuration): WebpackBlockUpdater | ||
export function defineConstants(constants: { [key: string]: any }): WebpackBlock | ||
export function setEnv(envs: string[] | { [key: string]: any }): WebpackBlock | ||
// TODO: support EntryFunc | ||
export function entryPoint(entry: string | string[] | Entry): WebpackBlock | ||
export function performance(perfBudgetOptions: Options.Performance): WebpackBlock | ||
export function resolve(config: Resolve): WebpackBlock | ||
export function setContext(path: string): WebpackBlock | ||
export function setDevTool(devtool: Options.Devtool): WebpackBlock | ||
export function setOutput(output: string | Output): WebpackBlock | ||
export function sourceMaps(devtool?: Options.Devtool): WebpackBlock |