1
+ declare namespace Webpack {
2
+ export class Dependency {
3
+ module : Module | null ;
4
+ getReference ( ) : { module : Module | null , importedNames : boolean | string [ ] } | null ;
5
+ static compare ( a : Dependency , b : Dependency ) : number ;
6
+ }
7
+
8
+ export class DependenciesBlock {
9
+ dependencies : Dependency [ ] ;
10
+
11
+ addDependency ( dependency : Dependency ) : void ;
12
+ }
13
+
14
+ export class Module extends DependenciesBlock {
15
+ id : string ;
16
+ meta : object | null ;
17
+ rawRequest : string ;
18
+ reasons : Reason [ ] ;
19
+ resource : string ;
20
+
21
+ isUsed ( _export : string ) : boolean | string ;
22
+ }
23
+
24
+ export interface Reason {
25
+ module : Module ;
26
+ dependency : Dependency ;
27
+ }
28
+
29
+ export type Expression =
30
+ MemberExpression |
31
+ IdentifierExpression |
32
+ CallExpression |
33
+ ObjectExpression ;
34
+
35
+ export class MemberExpression {
36
+ range : [ number , number ] ;
37
+ // Those types are not correct, but that's enough to compile this project
38
+ property : IdentifierExpression ;
39
+ object : { name : string ; type : string ; } & MemberExpression ;
40
+ type : "MemberExpression" ;
41
+ }
42
+
43
+ export class IdentifierExpression {
44
+ range : [ number , number ] ;
45
+ name : string ;
46
+ type : "IdentifierExpression" ;
47
+ }
48
+
49
+ export class CallExpression {
50
+ range : [ number , number ] ;
51
+ arguments : Expression [ ] ;
52
+ type : "CallExpression" ;
53
+ }
54
+
55
+ export class ObjectExpression {
56
+ range : [ number , number ] ;
57
+ type : "ObjectExpression" ;
58
+ properties : {
59
+ key : {
60
+ type : string ;
61
+ name : string ;
62
+ } ;
63
+ value : Expression ;
64
+ } [ ] ;
65
+ }
66
+
67
+ export class Parser {
68
+ state : {
69
+ current : Module ;
70
+ module : Module ;
71
+ }
72
+
73
+ plugin ( type : string , cb : ( e : Expression ) => any ) : void ;
74
+ evaluateExpression ( expr : Expression ) : EvaluatedExpression ;
75
+ apply ( plugin : Object ) : void ;
76
+ }
77
+
78
+ export class EvaluatedExpression {
79
+ isString ( ) : boolean ;
80
+ isArray ( ) : boolean ;
81
+ string ?: string ;
82
+ items ?: EvaluatedExpression [ ] ;
83
+ }
84
+
85
+ export class Compiler {
86
+ options : Options ;
87
+
88
+ apply ( ...plugin : Object [ ] ) : void ;
89
+ plugin ( type : "compilation" , cb : ( compilation : Compilation , params : CompilationParameters ) => void ) : void ;
90
+ plugin ( type : "before-compile" , cb : ( params : { } , callback : Function ) => void ) : void ;
91
+ resolvers : {
92
+ normal : Resolver ;
93
+ }
94
+ }
95
+
96
+ interface Options {
97
+ entry : string | string [ ] | { [ name : string ] : string | string [ ] } ;
98
+ target : string ;
99
+ module : {
100
+ rules ?: { test ?: RegExp ; use : string | string [ ] } [ ] ;
101
+ loaders ?: { test ?: RegExp ; use : string | string [ ] } [ ] ; // same as rules, supported for backward compat with 1.x
102
+ } ;
103
+ resolve : {
104
+ alias : { [ key : string ] : string } ;
105
+ modules : string [ ] ;
106
+ extensions : string [ ] ;
107
+ plugins : Object [ ] ;
108
+ symlinks : boolean ;
109
+ } ;
110
+ resolveLoader : {
111
+ alias ?: { [ key : string ] : string } ;
112
+ symlinks : boolean ;
113
+ } ;
114
+ plugins : object [ ] ;
115
+ }
116
+
117
+ export class Compilation {
118
+ options : Options ;
119
+ inputFileSystem : FileSystem ;
120
+
121
+ dependencyFactories : { set ( d : any , f : ModuleFactory ) : void ; } ;
122
+ dependencyTemplates : { set ( d : any , f : any ) : void ; } ;
123
+ plugin ( type : "succeed-module" , cb : ( module : Webpack . Module ) => void ) : void ;
124
+ plugin ( type : "before-module-ids" , cb : ( modules : Module [ ] ) => void ) : void ;
125
+ plugin ( type : "finish-modules" , cb : ( modules : Module [ ] ) => void ) : void ;
126
+ }
127
+
128
+ export class CompilationParameters {
129
+ normalModuleFactory : ModuleFactory ;
130
+ }
131
+
132
+ export class Source {
133
+ replace ( from : number , to : number , text : string ) : void ;
134
+ }
135
+
136
+ export class ModuleFactory {
137
+ plugin ( type : "parser" , cb : ( parser : Parser ) => void ) : void ;
138
+ }
139
+
140
+ type ResolverCallback = ( request : ResolveRequest , cb : ( err ?: any , result ?: any ) => void ) => void ;
141
+
142
+ export class Resolver {
143
+ fileSystem : FileSystem ;
144
+ plugin ( type : "resolve-step" , handler : ( type : string , request : ResolveRequest ) => void ) : void ;
145
+ plugin ( type : "after-resolve" , handler : ResolverCallback ) : void ;
146
+ plugin ( type : "before-described-resolve" , handler : ResolverCallback ) : void ;
147
+ doResolve ( step : string , request : ResolveRequest , message : string , cb : ( err ?: any , result ?: any ) => void ) : void ;
148
+ resolve ( context : string | null , path : string , request : string , cb : ( err : any , result : string ) => void ) : void ;
149
+ }
150
+
151
+ export class ResolveRequest {
152
+ path : string ;
153
+ request : string ;
154
+ context : any ;
155
+ }
156
+
157
+ export interface FileSystem {
158
+ readdirSync ( path : string ) : string [ ] ;
159
+ statSync ( fname : string ) : {
160
+ isDirectory ( ) : boolean ;
161
+ isFile ( ) : boolean ;
162
+ } ;
163
+ }
164
+
165
+ export interface Loader {
166
+ _module : Module ;
167
+ cacheable ?( ) : void ;
168
+ }
169
+ }
170
+
171
+ declare module "webpack" {
172
+ export class DefinePlugin {
173
+ constructor ( hash : any ) ;
174
+ }
175
+
176
+ export class DllPlugin {
177
+ }
178
+
179
+ export class DllReferencePlugin {
180
+ }
181
+ }
182
+
183
+ declare module "webpack/lib/Dependency" {
184
+ const Dependency : typeof Webpack . Dependency ;
185
+ export = Dependency ;
186
+ }
187
+
188
+ declare module "webpack/lib/dependencies/NullDependency" {
189
+ class NullDependencyTemplate {
190
+ }
191
+
192
+ class NullDependency extends Webpack . Dependency {
193
+ static Template : typeof NullDependencyTemplate ;
194
+ }
195
+
196
+ export = NullDependency ;
197
+ }
198
+
199
+ declare module "webpack/lib/dependencies/ModuleDependency" {
200
+ class ModuleDependency extends Webpack . Dependency {
201
+ constructor ( request : string ) ;
202
+ request : string ;
203
+ }
204
+
205
+ export = ModuleDependency ;
206
+ }
207
+
208
+ declare module "webpack/lib/BasicEvaluatedExpression" {
209
+ class BasicEvaluatedExpression {
210
+ setIdentifier ( identifier : string ) : this;
211
+ setRange ( range : [ number , number ] ) : this;
212
+ }
213
+
214
+ export = BasicEvaluatedExpression ;
215
+ }
216
+
217
+ declare module "html-loader/lib/attributesParser" {
218
+ function parse ( content : string , cb : ( tag : string , attr : string ) => boolean ) : { value : string } [ ] ;
219
+
220
+ export = parse ;
221
+ }
222
+
223
+ declare interface DependencyOptionsEx { }
224
+
225
+ declare module "minimatch" {
226
+ interface IMinimatch {
227
+ match ( fname : string , partial : boolean ) : boolean ;
228
+ }
229
+ }
0 commit comments