|
1 | 1 | export = MiniCssExtractPlugin; |
2 | 2 | declare class MiniCssExtractPlugin { |
3 | | - /** |
4 | | - * @param {Compiler["webpack"]} webpack |
5 | | - * @returns {CssModuleConstructor} |
6 | | - */ |
7 | | - static getCssModule(webpack: Compiler["webpack"]): CssModuleConstructor; |
8 | | - /** |
9 | | - * @param {Compiler["webpack"]} webpack |
10 | | - * @returns {CssDependencyConstructor} |
11 | | - */ |
12 | | - static getCssDependency( |
13 | | - webpack: Compiler["webpack"] |
14 | | - ): CssDependencyConstructor; |
15 | | - /** |
16 | | - * Returns all hooks for the given compilation |
17 | | - * @param {Compilation} compilation the compilation |
18 | | - * @returns {MiniCssExtractPluginCompilationHooks} hooks |
19 | | - */ |
20 | | - static getCompilationHooks( |
21 | | - compilation: Compilation |
22 | | - ): MiniCssExtractPluginCompilationHooks; |
23 | | - /** |
24 | | - * @param {PluginOptions} [options] |
25 | | - */ |
26 | | - constructor(options?: PluginOptions | undefined); |
27 | | - /** |
28 | | - * @private |
29 | | - * @type {WeakMap<Chunk, Set<CssModule>>} |
30 | | - * @private |
31 | | - */ |
32 | | - private _sortedModulesCache; |
33 | | - /** |
34 | | - * @private |
35 | | - * @type {NormalizedPluginOptions} |
36 | | - */ |
37 | | - private options; |
38 | | - /** |
39 | | - * @private |
40 | | - * @type {RuntimeOptions} |
41 | | - */ |
42 | | - private runtimeOptions; |
43 | | - /** |
44 | | - * @param {Compiler} compiler |
45 | | - */ |
46 | | - apply(compiler: Compiler): void; |
47 | | - /** |
48 | | - * @private |
49 | | - * @param {Chunk} chunk |
50 | | - * @param {ChunkGraph} chunkGraph |
51 | | - * @returns {Iterable<Module>} |
52 | | - */ |
53 | | - private getChunkModules; |
54 | | - /** |
55 | | - * @private |
56 | | - * @param {Compilation} compilation |
57 | | - * @param {Chunk} chunk |
58 | | - * @param {CssModule[]} modules |
59 | | - * @param {Compilation["requestShortener"]} requestShortener |
60 | | - * @returns {Set<CssModule>} |
61 | | - */ |
62 | | - private sortModules; |
63 | | - /** |
64 | | - * @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} |
73 | | - */ |
74 | | - private renderContentAsset; |
| 3 | + /** |
| 4 | + * @param {Compiler["webpack"]} webpack |
| 5 | + * @returns {CssModuleConstructor} |
| 6 | + */ |
| 7 | + static getCssModule(webpack: Compiler["webpack"]): CssModuleConstructor; |
| 8 | + /** |
| 9 | + * @param {Compiler["webpack"]} webpack |
| 10 | + * @returns {CssDependencyConstructor} |
| 11 | + */ |
| 12 | + static getCssDependency(webpack: Compiler["webpack"]): CssDependencyConstructor; |
| 13 | + /** |
| 14 | + * Returns all hooks for the given compilation |
| 15 | + * @param {Compilation} compilation the compilation |
| 16 | + * @returns {MiniCssExtractPluginCompilationHooks} hooks |
| 17 | + */ |
| 18 | + static getCompilationHooks(compilation: Compilation): MiniCssExtractPluginCompilationHooks; |
| 19 | + /** |
| 20 | + * @param {PluginOptions} [options] |
| 21 | + */ |
| 22 | + constructor(options?: PluginOptions | undefined); |
| 23 | + /** |
| 24 | + * @private |
| 25 | + * @type {WeakMap<Chunk, Set<CssModule>>} |
| 26 | + * @private |
| 27 | + */ |
| 28 | + private _sortedModulesCache; |
| 29 | + /** |
| 30 | + * @private |
| 31 | + * @type {NormalizedPluginOptions} |
| 32 | + */ |
| 33 | + private options; |
| 34 | + /** |
| 35 | + * @private |
| 36 | + * @type {RuntimeOptions} |
| 37 | + */ |
| 38 | + private runtimeOptions; |
| 39 | + /** |
| 40 | + * @param {Compiler} compiler |
| 41 | + */ |
| 42 | + apply(compiler: Compiler): void; |
| 43 | + /** |
| 44 | + * @private |
| 45 | + * @param {Chunk} chunk |
| 46 | + * @param {ChunkGraph} chunkGraph |
| 47 | + * @returns {Iterable<Module>} |
| 48 | + */ |
| 49 | + private getChunkModules; |
| 50 | + /** |
| 51 | + * @private |
| 52 | + * @param {Compilation} compilation |
| 53 | + * @param {Chunk} chunk |
| 54 | + * @param {CssModule[]} modules |
| 55 | + * @param {Compilation["requestShortener"]} requestShortener |
| 56 | + * @returns {Set<CssModule>} |
| 57 | + */ |
| 58 | + private sortModules; |
| 59 | + /** |
| 60 | + * @private |
| 61 | + * @param {Compiler} compiler |
| 62 | + * @param {Compilation} compilation |
| 63 | + * @param {Chunk} chunk |
| 64 | + * @param {CssModule[]} modules |
| 65 | + * @param {Compiler["requestShortener"]} requestShortener |
| 66 | + * @param {string} filenameTemplate |
| 67 | + * @param {Parameters<Exclude<Required<Configuration>['output']['filename'], string | undefined>>[0]} pathData |
| 68 | + * @returns {Source} |
| 69 | + */ |
| 70 | + private renderContentAsset; |
75 | 71 | } |
76 | 72 | declare namespace MiniCssExtractPlugin { |
77 | | - export { |
78 | | - pluginName, |
79 | | - pluginSymbol, |
80 | | - loader, |
81 | | - Schema, |
82 | | - Compiler, |
83 | | - Compilation, |
84 | | - ChunkGraph, |
85 | | - Chunk, |
86 | | - ChunkGroup, |
87 | | - Module, |
88 | | - Dependency, |
89 | | - Source, |
90 | | - Configuration, |
91 | | - WebpackError, |
92 | | - AssetInfo, |
93 | | - LoaderDependency, |
94 | | - LoaderOptions, |
95 | | - PluginOptions, |
96 | | - NormalizedPluginOptions, |
97 | | - RuntimeOptions, |
98 | | - TODO, |
99 | | - CssModule, |
100 | | - CssModuleDependency, |
101 | | - CssModuleConstructor, |
102 | | - CssDependency, |
103 | | - CssDependencyOptions, |
104 | | - CssDependencyConstructor, |
105 | | - VarNames, |
106 | | - MiniCssExtractPluginCompilationHooks, |
107 | | - }; |
| 73 | + export { pluginName, pluginSymbol, loader, Schema, Compiler, Compilation, ChunkGraph, Chunk, ChunkGroup, Module, Dependency, Source, Configuration, WebpackError, AssetInfo, LoaderDependency, LoaderOptions, PluginOptions, NormalizedPluginOptions, RuntimeOptions, TODO, CssModule, CssModuleDependency, CssModuleConstructor, CssDependency, CssDependencyOptions, CssDependencyConstructor, VarNames, MiniCssExtractPluginCompilationHooks }; |
108 | 74 | } |
109 | 75 | type Compiler = import("webpack").Compiler; |
110 | 76 | type CssModuleConstructor = new (dependency: CssModuleDependency) => CssModule; |
111 | | -type CssDependencyConstructor = new ( |
112 | | - loaderDependency: CssDependencyOptions, |
113 | | - context: string | null, |
114 | | - identifierIndex: number |
115 | | -) => CssDependency; |
| 77 | +type CssDependencyConstructor = new (loaderDependency: CssDependencyOptions, context: string | null, identifierIndex: number) => CssDependency; |
116 | 78 | type Compilation = import("webpack").Compilation; |
117 | 79 | type MiniCssExtractPluginCompilationHooks = { |
118 | | - beforeTagInsert: import("tapable").SyncWaterfallHook< |
119 | | - [string, VarNames], |
120 | | - string |
121 | | - >; |
122 | | - linkPreload: SyncWaterfallHook<[string, Chunk]>; |
123 | | - linkPrefetch: SyncWaterfallHook<[string, Chunk]>; |
| 80 | + beforeTagInsert: import("tapable").SyncWaterfallHook<[string, VarNames], string>; |
| 81 | + linkPreload: SyncWaterfallHook<[string, Chunk]>; |
| 82 | + linkPrefetch: SyncWaterfallHook<[string, Chunk]>; |
124 | 83 | }; |
125 | 84 | type PluginOptions = { |
126 | | - filename?: Required<Configuration>["output"]["filename"]; |
127 | | - chunkFilename?: Required<Configuration>["output"]["chunkFilename"]; |
128 | | - ignoreOrder?: boolean | undefined; |
129 | | - insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
130 | | - attributes?: Record<string, string> | undefined; |
131 | | - linkType?: string | false | undefined; |
132 | | - runtime?: boolean | undefined; |
133 | | - experimentalUseImportModule?: boolean | undefined; |
| 85 | + filename?: Required<Configuration>['output']['filename']; |
| 86 | + chunkFilename?: Required<Configuration>['output']['chunkFilename']; |
| 87 | + ignoreOrder?: boolean | undefined; |
| 88 | + insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
| 89 | + attributes?: Record<string, string> | undefined; |
| 90 | + linkType?: string | false | undefined; |
| 91 | + runtime?: boolean | undefined; |
| 92 | + experimentalUseImportModule?: boolean | undefined; |
134 | 93 | }; |
135 | 94 | /** @typedef {import("schema-utils/declarations/validate").Schema} Schema */ |
136 | 95 | /** @typedef {import("webpack").Compiler} Compiler */ |
@@ -197,67 +156,60 @@ type WebpackError = import("webpack").WebpackError; |
197 | 156 | type AssetInfo = import("webpack").AssetInfo; |
198 | 157 | type LoaderDependency = import("./loader.js").Dependency; |
199 | 158 | type LoaderOptions = { |
200 | | - publicPath?: |
201 | | - | string |
202 | | - | ((resourcePath: string, rootContext: string) => string) |
203 | | - | undefined; |
204 | | - emit?: boolean | undefined; |
205 | | - esModule?: boolean | undefined; |
206 | | - layer?: string | undefined; |
207 | | - defaultExport?: boolean | undefined; |
| 159 | + publicPath?: string | ((resourcePath: string, rootContext: string) => string) | undefined; |
| 160 | + emit?: boolean | undefined; |
| 161 | + esModule?: boolean | undefined; |
| 162 | + layer?: string | undefined; |
| 163 | + defaultExport?: boolean | undefined; |
208 | 164 | }; |
209 | 165 | type NormalizedPluginOptions = { |
210 | | - filename: Required<Configuration>["output"]["filename"]; |
211 | | - chunkFilename?: Required<Configuration>["output"]["chunkFilename"]; |
212 | | - ignoreOrder: boolean; |
213 | | - insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
214 | | - attributes?: Record<string, string> | undefined; |
215 | | - linkType?: string | false | undefined; |
216 | | - runtime: boolean; |
217 | | - experimentalUseImportModule?: boolean | undefined; |
| 166 | + filename: Required<Configuration>['output']['filename']; |
| 167 | + chunkFilename?: Required<Configuration>['output']['chunkFilename']; |
| 168 | + ignoreOrder: boolean; |
| 169 | + insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
| 170 | + attributes?: Record<string, string> | undefined; |
| 171 | + linkType?: string | false | undefined; |
| 172 | + runtime: boolean; |
| 173 | + experimentalUseImportModule?: boolean | undefined; |
218 | 174 | }; |
219 | 175 | type RuntimeOptions = { |
220 | | - insert: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
221 | | - linkType: string | false | "text/css"; |
222 | | - attributes: Record<string, string> | undefined; |
| 176 | + insert: string | ((linkTag: HTMLLinkElement) => void) | undefined; |
| 177 | + linkType: string | false | 'text/css'; |
| 178 | + attributes: Record<string, string> | undefined; |
223 | 179 | }; |
224 | 180 | type TODO = any; |
225 | 181 | type CssModule = import("webpack").Module & { |
226 | | - content: Buffer; |
227 | | - media?: string | undefined; |
228 | | - sourceMap?: Buffer | undefined; |
229 | | - supports?: string | undefined; |
230 | | - layer?: string | undefined; |
231 | | - assets?: |
232 | | - | { |
| 182 | + content: Buffer; |
| 183 | + media?: string | undefined; |
| 184 | + sourceMap?: Buffer | undefined; |
| 185 | + supports?: string | undefined; |
| 186 | + layer?: string | undefined; |
| 187 | + assets?: { |
233 | 188 | [key: string]: any; |
234 | | - } |
235 | | - | undefined; |
236 | | - assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined; |
| 189 | + } | undefined; |
| 190 | + assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined; |
237 | 191 | }; |
238 | 192 | type CssModuleDependency = { |
239 | | - context: string | null; |
240 | | - identifier: string; |
241 | | - identifierIndex: number; |
242 | | - content: Buffer; |
243 | | - sourceMap?: Buffer | undefined; |
244 | | - media?: string | undefined; |
245 | | - supports?: string | undefined; |
246 | | - layer?: TODO; |
247 | | - assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined; |
248 | | - assets?: |
249 | | - | { |
| 193 | + context: string | null; |
| 194 | + identifier: string; |
| 195 | + identifierIndex: number; |
| 196 | + content: Buffer; |
| 197 | + sourceMap?: Buffer | undefined; |
| 198 | + media?: string | undefined; |
| 199 | + supports?: string | undefined; |
| 200 | + layer?: TODO; |
| 201 | + assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined; |
| 202 | + assets?: { |
250 | 203 | [key: string]: any; |
251 | | - } |
252 | | - | undefined; |
| 204 | + } | undefined; |
253 | 205 | }; |
254 | 206 | type CssDependency = Dependency & CssModuleDependency; |
255 | 207 | type CssDependencyOptions = Omit<LoaderDependency, "context">; |
256 | 208 | type VarNames = { |
257 | | - tag: string; |
258 | | - chunkId: string; |
259 | | - href: string; |
260 | | - resolve: string; |
261 | | - reject: string; |
| 209 | + tag: string; |
| 210 | + chunkId: string; |
| 211 | + href: string; |
| 212 | + resolve: string; |
| 213 | + reject: string; |
262 | 214 | }; |
263 | 215 | import { SyncWaterfallHook } from "tapable"; |
0 commit comments