UNPKG

3.54 kBTypeScriptView Raw
1/// <reference types="node" />
2import HtmlWebpackPlugin from 'html-webpack-plugin';
3import { compilation, Configuration, Entry, EntryFunc, ExternalsElement, Options as WebpackOptions, Plugin, RuleSetRule } from 'webpack';
4export declare type HookReturn<T> = void | null | T | Promise<void | null | T>;
5export declare type Hook<T> = (input: T) => HookReturn<T>;
6export declare type Entries = string | Array<string> | Entry | EntryFunc;
7export declare type Externals = ExternalsElement | Array<ExternalsElement>;
8export declare type Target = 'web' | 'webworker' | 'node' | 'async-node' | 'node-webkit' | 'atom' | 'electron' | 'electron-renderer' | 'electron-main' | ((compiler?: any) => void);
9export declare type LibraryTarget = 'var' | 'this' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'window' | 'assign' | 'jsonp';
10export declare type FilenameGenerator = (data: OutputData) => string;
11export interface HtmlWebpackTrackerPluginParameters {
12 outputName: string;
13 plugin: HtmlWebpackPlugin.Options;
14}
15export interface OutputData {
16 chunk: compilation.Chunk;
17 hash: string;
18}
19export interface Output {
20 filename?: string | FilenameGenerator;
21 publicPath?: string;
22 target?: Target;
23 libraryTarget?: LibraryTarget;
24}
25export interface Environment {
26 environment: string;
27 version: string;
28 serviceWorkerEnabled: boolean;
29 [key: string]: any;
30}
31export interface Rules {
32 additional?: Array<RuleSetRule>;
33 babel?: boolean;
34 typescript?: boolean;
35 react?: boolean;
36 images?: boolean;
37 manifest?: boolean;
38 robots?: boolean;
39 afterHook?: Hook<Array<RuleSetRule>>;
40}
41export interface Plugins {
42 additional?: Array<Plugin>;
43 concatenate?: boolean;
44 minify?: boolean;
45 hotModuleReload?: boolean;
46 splitChunks?: boolean | WebpackOptions.SplitChunksOptions;
47 analyze?: boolean | string;
48 afterHook?: Hook<Array<Plugin>>;
49}
50export interface IconsToLoad {
51 [key: string]: Array<string>;
52}
53export interface Icons {
54 tags: {
55 [key: string]: string;
56 };
57 definitions: string;
58}
59export interface ServiceWorker {
60 enabled?: boolean;
61 src?: string;
62 dest?: string;
63 options?: object;
64 debug?: boolean;
65}
66export interface Server {
67 host?: string;
68 port?: number;
69 https?: boolean | {
70 [key: string]: string | Buffer;
71 };
72 compress?: boolean;
73 hot?: boolean | object;
74 history?: boolean | object;
75 disableHostCheck?: boolean;
76 inline?: boolean;
77 options?: object;
78 afterHook?: Hook<Server>;
79}
80export interface Babel {
81 browsersWhiteList?: string | Array<string> | {
82 [key: string]: string;
83 };
84 removeFunctions?: Array<string>;
85 exclude?: Array<string>;
86 modules?: boolean;
87 configuration?: any;
88 envDebug?: boolean;
89}
90export declare type ExtendedConfiguration = Configuration & {
91 output: any;
92 devServer: any;
93};
94export interface Options extends Output {
95 environment?: string | object;
96 additionalEnvironment?: object;
97 version?: string;
98 env?: Environment;
99 entries?: Entries;
100 index?: boolean | string;
101 rules?: Rules;
102 plugins?: Plugins;
103 stats?: WebpackOptions.Stats;
104 performance?: WebpackOptions.Performance;
105 icons?: IconsToLoad | Icons;
106 serviceWorker?: ServiceWorker;
107 srcFolder?: string;
108 destFolder?: string;
109 sourceMaps?: WebpackOptions.Devtool;
110 externals?: Externals;
111 server?: Server;
112 babel?: Babel;
113 useESModules?: boolean;
114 uglify?: object;
115 afterHook?: Hook<ExtendedConfiguration>;
116}