1 | import * as webpack from 'webpack';
|
2 | import * as https from 'https';
|
3 |
|
4 | export = Config;
|
5 |
|
6 | declare namespace __Config {
|
7 | class Chained<Parent> {
|
8 | end(): Parent;
|
9 | }
|
10 |
|
11 | class TypedChainedMap<Parent, Value> extends Chained<Parent> {
|
12 | clear(): this;
|
13 | delete(key: string): this;
|
14 | has(key: string): boolean;
|
15 | get(key: string): Value;
|
16 | set(key: string, value: Value): this;
|
17 | merge(obj: { [key: string]: Value }): this;
|
18 | entries(): { [key: string]: Value };
|
19 | values(): Value[];
|
20 | when(condition: boolean, trueBrancher: (obj: this) => void, falseBrancher?: (obj: this) => void): this;
|
21 | }
|
22 |
|
23 | class ChainedMap<Parent> extends TypedChainedMap<Parent, any> {}
|
24 |
|
25 | class TypedChainedSet<Parent, Value> extends Chained<Parent> {
|
26 | add(value: Value): this;
|
27 | prepend(value: Value): this;
|
28 | clear(): this;
|
29 | delete(key: string): this;
|
30 | has(key: string): boolean;
|
31 | merge(arr: Value[]): this;
|
32 | values(): Value[];
|
33 | when(condition: boolean, trueBrancher: (obj: this) => void, falseBrancher?: (obj: this) => void): this;
|
34 | }
|
35 |
|
36 | class ChainedSet<Parent> extends TypedChainedSet<Parent, any> {}
|
37 | }
|
38 |
|
39 | declare class Config extends __Config.ChainedMap<void> {
|
40 | devServer: Config.DevServer;
|
41 | entryPoints: Config.TypedChainedMap<Config, Config.EntryPoint>;
|
42 | module: Config.Module;
|
43 | node: Config.ChainedMap<this>;
|
44 | output: Config.Output;
|
45 | optimization: Config.Optimization;
|
46 | performance: Config.Performance;
|
47 | plugins: Config.Plugins<this>;
|
48 | resolve: Config.Resolve;
|
49 | resolveLoader: Config.ResolveLoader;
|
50 |
|
51 | amd(value: { [moduleName: string]: boolean }): this;
|
52 | bail(value: boolean): this;
|
53 | cache(value: boolean | any): this;
|
54 | devtool(value: Config.DevTool): this;
|
55 | context(value: string): this;
|
56 | externals(value: webpack.ExternalsElement | webpack.ExternalsElement[]): this;
|
57 | loader(value: any): this;
|
58 | name(value: string): this;
|
59 | mode(value: 'development' | 'production') : this;
|
60 | parallelism(value: number) : this;
|
61 | profile(value: boolean): this;
|
62 | recordsPath(value: string): this;
|
63 | recordsInputPath(value: string): this;
|
64 | recordsOutputPath(value: string): this;
|
65 | stats(value: webpack.Options.Stats): this;
|
66 | target(value: string): this;
|
67 | watch(value: boolean): this;
|
68 | watchOptions(value: webpack.Options.WatchOptions): this;
|
69 |
|
70 | entry(name: string): Config.EntryPoint;
|
71 | plugin(name: string): Config.Plugin<this>;
|
72 |
|
73 | toConfig(): webpack.Configuration;
|
74 | }
|
75 |
|
76 | declare namespace Config {
|
77 | class Chained<Parent> extends __Config.Chained<Parent> {}
|
78 | class TypedChainedMap<Parent, Value> extends __Config.TypedChainedMap<Parent, Value> {}
|
79 | class ChainedMap<Parent> extends __Config.TypedChainedMap<Parent, any> {}
|
80 | class TypedChainedSet<Parent, Value> extends __Config.TypedChainedSet<Parent, Value> {}
|
81 | class ChainedSet<Parent> extends __Config.TypedChainedSet<Parent, any> {}
|
82 |
|
83 | class Plugins<Parent> extends TypedChainedMap<Parent, Plugin<Parent>> {}
|
84 |
|
85 | class Plugin<Parent> extends ChainedMap<Parent> implements Orderable {
|
86 | init(value: (plugin: PluginClass, args: any[]) => webpack.Plugin): this;
|
87 | use(plugin: PluginClass, args?: any[]): this;
|
88 | tap(f: (args: any[]) => any[]): this;
|
89 |
|
90 |
|
91 | before(name: string): this;
|
92 | after(name: string): this;
|
93 | }
|
94 |
|
95 | class Module extends ChainedMap<Config> {
|
96 | rules: TypedChainedMap<this, Rule>;
|
97 | rule(name: string): Rule;
|
98 | noParse(noParse: RegExp | RegExp[] | ((contentPath: string) => boolean)): this;
|
99 | }
|
100 |
|
101 | class Output extends ChainedMap<Config> {
|
102 | auxiliaryComment(value: string | { [comment:string]: string }): this;
|
103 | chunkFilename(value: string): this;
|
104 | chunkLoadTimeout(value: number): this;
|
105 | crossOriginLoading(value: boolean | string): this;
|
106 | filename(value: string): this;
|
107 | library(value: string): this;
|
108 | libraryExport(value: string | string[]): this;
|
109 | libraryTarget(value: string): this;
|
110 | devtoolFallbackModuleFilenameTemplate(value: any): this;
|
111 | devtoolLineToLine(value: any): this;
|
112 | devtoolModuleFilenameTemplate(value: any): this;
|
113 | hashFunction(value: string): this;
|
114 | hashDigest(value: string): this;
|
115 | hashDigestLength(value: number): this;
|
116 | hashSalt(value: any): this;
|
117 | hotUpdateChunkFilename(value: string): this;
|
118 | hotUpdateFunction(value: any): this;
|
119 | hotUpdateMainFilename(value: string): this;
|
120 | jsonpFunction(value: string): this;
|
121 | path(value: string): this;
|
122 | pathinfo(value: boolean): this;
|
123 | publicPath(value: string): this;
|
124 | sourceMapFilename(value: string): this;
|
125 | sourcePrefix(value: string): this;
|
126 | strictModuleExceptionHandling(value: boolean): this;
|
127 | umdNamedDefine(value: boolean): this;
|
128 | }
|
129 |
|
130 | class DevServer extends ChainedMap<Config> {
|
131 | allowedHosts: TypedChainedSet<this, string>;
|
132 |
|
133 |
|
134 | bonjour(value: boolean): this;
|
135 | clientLogLevel(value: 'none' | 'error' | 'warning' | 'info'): this;
|
136 | color(value: boolean): this;
|
137 | compress(value: boolean): this;
|
138 | contentBase(value: boolean | string | string[]): this;
|
139 | disableHostCheck(value: boolean): this;
|
140 | filename(value: string): this;
|
141 | headers(value: { [header: string]: string }): this;
|
142 | historyApiFallback(value: boolean | any): this;
|
143 | host(value: string): this;
|
144 | hot(value: boolean): this;
|
145 | hotOnly(value: boolean): this;
|
146 | https(value: boolean | https.ServerOptions): this;
|
147 | inline(value: boolean): this;
|
148 | info(value: boolean): this;
|
149 | lazy(value: boolean): this;
|
150 | noInfo(value: boolean): this;
|
151 | open(value: boolean): this;
|
152 | overlay(value: boolean | { warnings?: boolean, errors?: boolean }): this;
|
153 | pfx(value: string): this;
|
154 | pfxPassphrase(value: string): this;
|
155 | port(value: number): this;
|
156 | progress(value: boolean): this;
|
157 | proxy(value: any): this;
|
158 | public(value: string): this;
|
159 | publicPath(publicPath: string): this;
|
160 | quiet(value: boolean): this;
|
161 | setup(value: (expressApp: any) => void): this;
|
162 | socket(value: string): this;
|
163 | staticOptions(value: any): this;
|
164 | stats(value: webpack.Options.Stats): this;
|
165 | stdin(value: boolean): this;
|
166 | useLocalIp(value: boolean): this;
|
167 | watchContentBase(value: boolean): this;
|
168 | watchOptions(value: any): this;
|
169 | }
|
170 |
|
171 | class Performance extends ChainedMap<Config> {
|
172 | hints(value: boolean | 'error' | 'warning'): this;
|
173 | maxEntrypointSize(value: number): this;
|
174 | maxAssetSize(value: number): this;
|
175 | assetFilter(value: (assetFilename: string) => boolean): this;
|
176 | }
|
177 |
|
178 | class EntryPoint extends TypedChainedSet<Config, string> {}
|
179 |
|
180 | class Resolve extends ChainedMap<Config> {
|
181 | alias: TypedChainedMap<this, string>;
|
182 | aliasFields: TypedChainedSet<this, string>;
|
183 | descriptionFiles: TypedChainedSet<this, string>;
|
184 | extensions: TypedChainedSet<this, string>;
|
185 | mainFields: TypedChainedSet<this, string>;
|
186 | mainFiles: TypedChainedSet<this, string>;
|
187 | modules: TypedChainedSet<this, string>;
|
188 | plugins: TypedChainedMap<this, Plugin<this>>;
|
189 |
|
190 | enforceExtension(value: boolean): this;
|
191 | enforceModuleExtension(value: boolean): this;
|
192 | unsafeCache(value: boolean | RegExp | RegExp[]): this;
|
193 | symlinks(value: boolean): this;
|
194 | cachePredicate(value: (data: { path: string, request: string }) => boolean): this;
|
195 | cacheWithContext(value: boolean): this;
|
196 |
|
197 | plugin(name: string): Plugin<this>;
|
198 | }
|
199 |
|
200 | class ResolveLoader extends ChainedMap<Config> {
|
201 | extensions: TypedChainedSet<this, string>;
|
202 | modules: TypedChainedSet<this, string>;
|
203 | moduleExtensions: TypedChainedSet<this, string>;
|
204 | packageMains: TypedChainedSet<this, string>;
|
205 | }
|
206 |
|
207 | class Rule extends ChainedMap<Module> {
|
208 | oneOfs: TypedChainedMap<this, OneOf>;
|
209 | uses: TypedChainedMap<this, Use>;
|
210 | include: TypedChainedSet<this, webpack.Condition>;
|
211 | exclude: TypedChainedSet<this, webpack.Condition>;
|
212 |
|
213 | parser(value: { [optName: string]: any }): this;
|
214 | test(value: webpack.Condition | webpack.Condition[]): this;
|
215 | enforce(value: 'pre' | 'post'): this;
|
216 |
|
217 | use(name: string): Use;
|
218 | oneOf(name: string): OneOf;
|
219 | pre(): this;
|
220 | post(): this;
|
221 | }
|
222 |
|
223 | class Optimization extends ChainedMap<Config> {
|
224 | concatenateModules(value: boolean): this;
|
225 | flagIncludedChunks(value: boolean): this;
|
226 | mergeDuplicateChunks(value: boolean): this;
|
227 | minimize(value: boolean): this;
|
228 | minimizer(name: string): Config.Plugin<this>;
|
229 | namedChunks(value: boolean): this;
|
230 | namedModules(value: boolean): this;
|
231 | nodeEnv(value: boolean | string): this;
|
232 | noEmitOnErrors(value: boolean): this;
|
233 | occurrenceOrder(value: boolean): this;
|
234 | portableRecords(value: boolean): this;
|
235 | providedExports(value: boolean): this;
|
236 | removeAvailableModules(value: boolean): this;
|
237 | removeEmptyChunks(value: boolean): this;
|
238 | runtimeChunk(value: boolean | "single" | "multiple" | RuntimeChunk): this;
|
239 | sideEffects(value: boolean): this;
|
240 | splitChunks(value: SplitChunksOptions): this;
|
241 | usedExports(value: boolean): this;
|
242 | }
|
243 |
|
244 | interface RuntimeChunk {
|
245 | name: string | RuntimeChunkFunction;
|
246 | }
|
247 |
|
248 | type RuntimeChunkFunction = (entryPoint: EntryPoint) => string;
|
249 |
|
250 | interface SplitChunksOptions { [name: string]: any; }
|
251 |
|
252 | interface LoaderOptions { [name: string]: any; }
|
253 |
|
254 | class Use extends ChainedMap<Rule> implements Orderable {
|
255 | loader(value: string): this;
|
256 | options(value: LoaderOptions): this;
|
257 |
|
258 | tap(f: (options: LoaderOptions) => LoaderOptions): this;
|
259 |
|
260 |
|
261 | before(name: string): this;
|
262 | after(name: string): this;
|
263 | }
|
264 |
|
265 | class OneOf extends ChainedMap<Rule> implements Orderable {
|
266 | resourceQuery(value: webpack.Condition | webpack.Condition[]): this;
|
267 | use(name: string): Use;
|
268 |
|
269 |
|
270 | before(name: string): this;
|
271 | after(name: string): this;
|
272 | }
|
273 |
|
274 | type DevTool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' |
|
275 | 'cheap-module-eval-source-map' | 'cheap-module-source-map' | 'eval-source-map' | 'source-map' |
|
276 | 'nosources-source-map' | 'hidden-source-map' | 'nosources-source-map' | '@eval' |
|
277 | '@inline-source-map' | '@cheap-eval-source-map' | '@cheap-source-map' |
|
278 | '@cheap-module-eval-source-map' | '@cheap-module-source-map' | '@eval-source-map' |
|
279 | '@source-map' | '@nosources-source-map' | '@hidden-source-map' | '@nosources-source-map' |
|
280 | '#eval' | '#inline-source-map' | '#cheap-eval-source-map' | '#cheap-source-map' |
|
281 | '#cheap-module-eval-source-map' | '#cheap-module-source-map' | '#eval-source-map' |
|
282 | '#source-map' | '#nosources-source-map' | '#hidden-source-map' | '#nosources-source-map' |
|
283 | '#@eval' | '#@inline-source-map' | '#@cheap-eval-source-map' | '#@cheap-source-map' |
|
284 | '#@cheap-module-eval-source-map' | '#@cheap-module-source-map' | '#@eval-source-map' |
|
285 | '#@source-map' | '#@nosources-source-map' | '#@hidden-source-map' | '#@nosources-source-map' |
|
286 | boolean;
|
287 |
|
288 | interface PluginClass {
|
289 | new (...opts: any[]): webpack.Plugin;
|
290 | }
|
291 |
|
292 | interface Orderable {
|
293 | before(name: string): this;
|
294 | after(name: string): this;
|
295 | }
|
296 | }
|