1
1
export = MiniCssExtractPlugin ;
2
2
declare class MiniCssExtractPlugin {
3
3
/**
4
- * @param {Compiler["webpack"] } webpack
5
- * @returns {CssModuleConstructor }
4
+ * @param {Compiler["webpack"] } webpack webpack
5
+ * @returns {CssModuleConstructor } CSS module constructor
6
6
*/
7
7
static getCssModule ( webpack : Compiler [ "webpack" ] ) : CssModuleConstructor ;
8
8
/**
9
- * @param {Compiler["webpack"] } webpack
10
- * @returns {CssDependencyConstructor }
9
+ * @param {Compiler["webpack"] } webpack webpack
10
+ * @returns {CssDependencyConstructor } CSS dependency constructor
11
11
*/
12
12
static getCssDependency (
13
13
webpack : Compiler [ "webpack" ] ,
@@ -21,13 +21,12 @@ declare class MiniCssExtractPlugin {
21
21
compilation : Compilation ,
22
22
) : MiniCssExtractPluginCompilationHooks ;
23
23
/**
24
- * @param {PluginOptions } [ options]
24
+ * @param {PluginOptions= } options options
25
25
*/
26
- constructor ( options ?: PluginOptions ) ;
26
+ constructor ( options ?: PluginOptions | undefined ) ;
27
27
/**
28
28
* @private
29
29
* @type {WeakMap<Chunk, Set<CssModule>> }
30
- * @private
31
30
*/
32
31
private _sortedModulesCache ;
33
32
/**
@@ -41,35 +40,35 @@ declare class MiniCssExtractPlugin {
41
40
*/
42
41
private runtimeOptions ;
43
42
/**
44
- * @param {Compiler } compiler
43
+ * @param {Compiler } compiler compiler
45
44
*/
46
45
apply ( compiler : Compiler ) : void ;
47
46
/**
48
47
* @private
49
- * @param {Chunk } chunk
50
- * @param {ChunkGraph } chunkGraph
51
- * @returns {Iterable<Module> }
48
+ * @param {Chunk } chunk chunk
49
+ * @param {ChunkGraph } chunkGraph chunk graph
50
+ * @returns {Iterable<Module> } modules
52
51
*/
53
52
private getChunkModules ;
54
53
/**
55
54
* @private
56
- * @param {Compilation } compilation
57
- * @param {Chunk } chunk
58
- * @param {CssModule[] } modules
59
- * @param {Compilation["requestShortener"] } requestShortener
60
- * @returns {Set<CssModule> }
55
+ * @param {Compilation } compilation compilation
56
+ * @param {Chunk } chunk chunk
57
+ * @param {CssModule[] } modules modules
58
+ * @param {Compilation["requestShortener"] } requestShortener request shortener
59
+ * @returns {Set<CssModule> } css modules
61
60
*/
62
61
private sortModules ;
63
62
/**
64
63
* @private
65
- * @param {Compiler } compiler
66
- * @param {Compilation } compilation
67
- * @param {Chunk } chunk
68
- * @param {CssModule[] } modules
69
- * @param {Compiler["requestShortener"] } requestShortener
70
- * @param {string } filenameTemplate
71
- * @param {Parameters<Exclude<Required<Configuration>['output']['filename'], string | undefined>>[0] } pathData
72
- * @returns {Source }
64
+ * @param {Compiler } compiler compiler
65
+ * @param {Compilation } compilation compilation
66
+ * @param {Chunk } chunk chunk
67
+ * @param {CssModule[] } modules modules
68
+ * @param {Compiler["requestShortener"] } requestShortener request shortener
69
+ * @param {string } filenameTemplate filename template
70
+ * @param {Parameters<Exclude<Required<Configuration>['output']['filename'], string | undefined>>[0] } pathData path data
71
+ * @returns {Source } source
73
72
*/
74
73
private renderContentAsset ;
75
74
}
@@ -120,40 +119,40 @@ declare namespace MiniCssExtractPlugin {
120
119
/** @typedef {import("webpack").AssetInfo } AssetInfo */
121
120
/** @typedef {import("./loader.js").Dependency } LoaderDependency */
122
121
/**
123
- * @typedef {Object } LoaderOptions
124
- * @property {string | ((resourcePath: string, rootContext: string) => string) } [ publicPath]
125
- * @property {boolean } [ emit]
126
- * @property {boolean } [ esModule]
127
- * @property {string } [ layer]
128
- * @property {boolean } [ defaultExport]
122
+ * @typedef {object } LoaderOptions
123
+ * @property {string | ((resourcePath: string, rootContext: string) => string)= } publicPath public path
124
+ * @property {boolean= } emit true when need to emit, otherwise false
125
+ * @property {boolean= } esModule need to generate ES module syntax
126
+ * @property {string= } layer a layer
127
+ * @property {boolean= } defaultExport true when need to use default export, otherwise false
129
128
*/
130
129
/**
131
- * @typedef {Object } PluginOptions
132
- * @property {Required<Configuration>['output']['filename'] } [ filename]
133
- * @property {Required<Configuration>['output']['chunkFilename'] } [ chunkFilename]
134
- * @property {boolean } [ ignoreOrder]
135
- * @property {string | ((linkTag: HTMLLinkElement) => void) } [ insert]
136
- * @property {Record<string, string> } [ attributes]
137
- * @property {string | false | 'text/css' } [ linkType]
138
- * @property {boolean } [ runtime]
139
- * @property {boolean } [ experimentalUseImportModule]
130
+ * @typedef {object } PluginOptions
131
+ * @property {Required<Configuration>['output']['filename']= } filename filename
132
+ * @property {Required<Configuration>['output']['chunkFilename']= } chunkFilename chunk filename
133
+ * @property {boolean= } ignoreOrder true when need to ignore order, otherwise false
134
+ * @property {string | ((linkTag: HTMLLinkElement) => void)= } insert link insert place or a custom insert function
135
+ * @property {Record<string, string>= } attributes link attributes
136
+ * @property {string | false | 'text/css'= } linkType value of a link type attribute
137
+ * @property {boolean= } runtime true when need to generate runtime code, otherwise false
138
+ * @property {boolean= } experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false
140
139
*/
141
140
/**
142
- * @typedef {Object } NormalizedPluginOptions
143
- * @property {Required<Configuration>['output']['filename'] } filename
144
- * @property {Required<Configuration>['output']['chunkFilename'] } [ chunkFilename]
145
- * @property {boolean } ignoreOrder
146
- * @property {string | ((linkTag: HTMLLinkElement) => void) } [ insert]
147
- * @property {Record<string, string> } [ attributes]
148
- * @property {string | false | 'text/css' } [ linkType]
149
- * @property {boolean } runtime
150
- * @property {boolean } [ experimentalUseImportModule]
141
+ * @typedef {object } NormalizedPluginOptions
142
+ * @property {Required<Configuration>['output']['filename'] } filename filename
143
+ * @property {Required<Configuration>['output']['chunkFilename']= } chunkFilename chunk filename
144
+ * @property {boolean } ignoreOrder true when need to ignore order, otherwise false
145
+ * @property {string | ((linkTag: HTMLLinkElement) => void)= } insert a link insert place or a custom insert function
146
+ * @property {Record<string, string>= } attributes link attributes
147
+ * @property {string | false | 'text/css'= } linkType value of a link type attribute
148
+ * @property {boolean } runtime true when need to generate runtime code, otherwise false
149
+ * @property {boolean= } experimentalUseImportModule true when need to use `experimentalUseImportModule` API, otherwise false
151
150
*/
152
151
/**
153
- * @typedef {Object } RuntimeOptions
154
- * @property {string | ((linkTag: HTMLLinkElement) => void) | undefined } insert
155
- * @property {string | false | 'text/css' } linkType
156
- * @property {Record<string, string> | undefined } attributes
152
+ * @typedef {object } RuntimeOptions
153
+ * @property {string | ((linkTag: HTMLLinkElement) => void)= } insert a link insert place or a custom insert function
154
+ * @property {string | false | 'text/css' } linkType value of a link type attribute
155
+ * @property {Record<string, string>= } attributes link attributes
157
156
*/
158
157
/** @typedef {any } TODO */
159
158
declare const pluginName : "mini-css-extract-plugin" ;
@@ -173,39 +172,114 @@ type WebpackError = import("webpack").WebpackError;
173
172
type AssetInfo = import ( "webpack" ) . AssetInfo ;
174
173
type LoaderDependency = import ( "./loader.js" ) . Dependency ;
175
174
type LoaderOptions = {
175
+ /**
176
+ * public path
177
+ */
176
178
publicPath ?:
177
- | string
178
- | ( ( resourcePath : string , rootContext : string ) => string )
179
+ | ( string | ( ( resourcePath : string , rootContext : string ) => string ) )
179
180
| undefined ;
181
+ /**
182
+ * true when need to emit, otherwise false
183
+ */
180
184
emit ?: boolean | undefined ;
185
+ /**
186
+ * need to generate ES module syntax
187
+ */
181
188
esModule ?: boolean | undefined ;
189
+ /**
190
+ * a layer
191
+ */
182
192
layer ?: string | undefined ;
193
+ /**
194
+ * true when need to use default export, otherwise false
195
+ */
183
196
defaultExport ?: boolean | undefined ;
184
197
} ;
185
198
type PluginOptions = {
186
- filename ?: Required < Configuration > [ "output" ] [ "filename" ] ;
187
- chunkFilename ?: Required < Configuration > [ "output" ] [ "chunkFilename" ] ;
199
+ /**
200
+ * filename
201
+ */
202
+ filename ?: Required < Configuration > [ "output" ] [ "filename" ] | undefined ;
203
+ /**
204
+ * chunk filename
205
+ */
206
+ chunkFilename ?:
207
+ | Required < Configuration > [ "output" ] [ "chunkFilename" ]
208
+ | undefined ;
209
+ /**
210
+ * true when need to ignore order, otherwise false
211
+ */
188
212
ignoreOrder ?: boolean | undefined ;
189
- insert ?: string | ( ( linkTag : HTMLLinkElement ) => void ) | undefined ;
213
+ /**
214
+ * link insert place or a custom insert function
215
+ */
216
+ insert ?: ( string | ( ( linkTag : HTMLLinkElement ) => void ) ) | undefined ;
217
+ /**
218
+ * link attributes
219
+ */
190
220
attributes ?: Record < string , string > | undefined ;
191
- linkType ?: string | false | undefined ;
221
+ /**
222
+ * value of a link type attribute
223
+ */
224
+ linkType ?: ( string | false | "text/css" ) | undefined ;
225
+ /**
226
+ * true when need to generate runtime code, otherwise false
227
+ */
192
228
runtime ?: boolean | undefined ;
229
+ /**
230
+ * true when need to use `experimentalUseImportModule` API, otherwise false
231
+ */
193
232
experimentalUseImportModule ?: boolean | undefined ;
194
233
} ;
195
234
type NormalizedPluginOptions = {
235
+ /**
236
+ * filename
237
+ */
196
238
filename : Required < Configuration > [ "output" ] [ "filename" ] ;
197
- chunkFilename ?: Required < Configuration > [ "output" ] [ "chunkFilename" ] ;
239
+ /**
240
+ * chunk filename
241
+ */
242
+ chunkFilename ?:
243
+ | Required < Configuration > [ "output" ] [ "chunkFilename" ]
244
+ | undefined ;
245
+ /**
246
+ * true when need to ignore order, otherwise false
247
+ */
198
248
ignoreOrder : boolean ;
199
- insert ?: string | ( ( linkTag : HTMLLinkElement ) => void ) | undefined ;
249
+ /**
250
+ * a link insert place or a custom insert function
251
+ */
252
+ insert ?: ( string | ( ( linkTag : HTMLLinkElement ) => void ) ) | undefined ;
253
+ /**
254
+ * link attributes
255
+ */
200
256
attributes ?: Record < string , string > | undefined ;
201
- linkType ?: string | false | undefined ;
257
+ /**
258
+ * value of a link type attribute
259
+ */
260
+ linkType ?: ( string | false | "text/css" ) | undefined ;
261
+ /**
262
+ * true when need to generate runtime code, otherwise false
263
+ */
202
264
runtime : boolean ;
265
+ /**
266
+ * true when need to use `experimentalUseImportModule` API, otherwise false
267
+ */
203
268
experimentalUseImportModule ?: boolean | undefined ;
204
269
} ;
205
270
type RuntimeOptions = {
206
- insert : string | ( ( linkTag : HTMLLinkElement ) => void ) | undefined ;
271
+ /**
272
+ * a link insert place or a custom insert function
273
+ */
274
+ insert ?: ( string | ( ( linkTag : HTMLLinkElement ) => void ) ) | undefined ;
275
+ /**
276
+ * value of a link type attribute
277
+ */
207
278
linkType : string | false | "text/css" ;
208
- attributes : Record < string , string > | undefined ;
279
+ /**
280
+ * link attributes
281
+ */
282
+ attributes ?: Record < string , string > | undefined ;
209
283
} ;
210
284
type TODO = any ;
211
285
type CssModule = Module & {
@@ -246,18 +320,42 @@ type CssDependencyConstructor = {
246
320
) : CssDependency ;
247
321
} ;
248
322
type VarNames = {
323
+ /**
324
+ * tag
325
+ */
249
326
tag : string ;
327
+ /**
328
+ * chunk id
329
+ */
250
330
chunkId : string ;
331
+ /**
332
+ * href
333
+ */
251
334
href : string ;
335
+ /**
336
+ * resolve
337
+ */
252
338
resolve : string ;
339
+ /**
340
+ * reject
341
+ */
253
342
reject : string ;
254
343
} ;
255
344
type MiniCssExtractPluginCompilationHooks = {
345
+ /**
346
+ * before tag insert hook
347
+ */
256
348
beforeTagInsert : import ( "tapable" ) . SyncWaterfallHook <
257
349
[ string, VarNames ] ,
258
350
string
259
351
> ;
352
+ /**
353
+ * link preload hook
354
+ */
260
355
linkPreload : SyncWaterfallHook < [ string , Chunk ] > ;
356
+ /**
357
+ * link prefetch hook
358
+ */
261
359
linkPrefetch : SyncWaterfallHook < [ string , Chunk ] > ;
262
360
} ;
263
361
import { SyncWaterfallHook } from "tapable" ;
0 commit comments