UNPKG

7.66 kBTypeScriptView Raw
1export = MiniCssExtractPlugin;
2declare 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 * @param {PluginOptions} [options]
17 */
18 constructor(options?: PluginOptions | undefined);
19 /**
20 * @private
21 * @type {WeakMap<Chunk, Set<CssModule>>}
22 * @private
23 */
24 private _sortedModulesCache;
25 /**
26 * @private
27 * @type {NormalizedPluginOptions}
28 */
29 private options;
30 /**
31 * @private
32 * @type {RuntimeOptions}
33 */
34 private runtimeOptions;
35 /**
36 * @param {Compiler} compiler
37 */
38 apply(compiler: Compiler): void;
39 /**
40 * @private
41 * @param {Chunk} chunk
42 * @param {ChunkGraph} chunkGraph
43 * @returns {Iterable<Module>}
44 */
45 private getChunkModules;
46 /**
47 * @private
48 * @param {Compilation} compilation
49 * @param {Chunk} chunk
50 * @param {CssModule[]} modules
51 * @param {Compilation["requestShortener"]} requestShortener
52 * @returns {Set<CssModule>}
53 */
54 private sortModules;
55 /**
56 * @private
57 * @param {Compiler} compiler
58 * @param {Compilation} compilation
59 * @param {Chunk} chunk
60 * @param {CssModule[]} modules
61 * @param {Compiler["requestShortener"]} requestShortener
62 * @param {string} filenameTemplate
63 * @param {Parameters<Exclude<Required<Configuration>['output']['filename'], string | undefined>>[0]} pathData
64 * @returns {Source}
65 */
66 private renderContentAsset;
67}
68declare namespace MiniCssExtractPlugin {
69 export {
70 pluginName,
71 pluginSymbol,
72 loader,
73 Schema,
74 Compiler,
75 Compilation,
76 ChunkGraph,
77 Chunk,
78 ChunkGroup,
79 Module,
80 Dependency,
81 Source,
82 Configuration,
83 WebpackError,
84 AssetInfo,
85 LoaderDependency,
86 LoaderOptions,
87 PluginOptions,
88 NormalizedPluginOptions,
89 RuntimeOptions,
90 TODO,
91 CssModule,
92 CssModuleDependency,
93 CssModuleConstructor,
94 CssDependency,
95 CssDependencyOptions,
96 CssDependencyConstructor,
97 };
98}
99type Compiler = import("webpack").Compiler;
100type CssModuleConstructor = new (dependency: CssModuleDependency) => CssModule;
101type CssDependencyConstructor = new (
102 loaderDependency: CssDependencyOptions,
103 context: string | null,
104 identifierIndex: number
105) => CssDependency;
106type PluginOptions = {
107 filename?: Required<Configuration>["output"]["filename"];
108 chunkFilename?: Required<Configuration>["output"]["chunkFilename"];
109 ignoreOrder?: boolean | undefined;
110 insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined;
111 attributes?: Record<string, string> | undefined;
112 linkType?: string | false | undefined;
113 runtime?: boolean | undefined;
114 experimentalUseImportModule?: boolean | undefined;
115};
116/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
117/** @typedef {import("webpack").Compiler} Compiler */
118/** @typedef {import("webpack").Compilation} Compilation */
119/** @typedef {import("webpack").ChunkGraph} ChunkGraph */
120/** @typedef {import("webpack").Chunk} Chunk */
121/** @typedef {Parameters<import("webpack").Chunk["isInGroup"]>[0]} ChunkGroup */
122/** @typedef {import("webpack").Module} Module */
123/** @typedef {import("webpack").Dependency} Dependency */
124/** @typedef {import("webpack").sources.Source} Source */
125/** @typedef {import("webpack").Configuration} Configuration */
126/** @typedef {import("webpack").WebpackError} WebpackError */
127/** @typedef {import("webpack").AssetInfo} AssetInfo */
128/** @typedef {import("./loader.js").Dependency} LoaderDependency */
129/**
130 * @typedef {Object} LoaderOptions
131 * @property {string | ((resourcePath: string, rootContext: string) => string)} [publicPath]
132 * @property {boolean} [emit]
133 * @property {boolean} [esModule]
134 * @property {string} [layer]
135 */
136/**
137 * @typedef {Object} PluginOptions
138 * @property {Required<Configuration>['output']['filename']} [filename]
139 * @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
140 * @property {boolean} [ignoreOrder]
141 * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
142 * @property {Record<string, string>} [attributes]
143 * @property {string | false | 'text/css'} [linkType]
144 * @property {boolean} [runtime]
145 * @property {boolean} [experimentalUseImportModule]
146 */
147/**
148 * @typedef {Object} NormalizedPluginOptions
149 * @property {Required<Configuration>['output']['filename']} filename
150 * @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
151 * @property {boolean} ignoreOrder
152 * @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
153 * @property {Record<string, string>} [attributes]
154 * @property {string | false | 'text/css'} [linkType]
155 * @property {boolean} runtime
156 * @property {boolean} [experimentalUseImportModule]
157 */
158/**
159 * @typedef {Object} RuntimeOptions
160 * @property {string | ((linkTag: HTMLLinkElement) => void) | undefined} insert
161 * @property {string | false | 'text/css'} linkType
162 * @property {Record<string, string> | undefined} attributes
163 */
164/** @typedef {any} TODO */
165declare const pluginName: "mini-css-extract-plugin";
166declare const pluginSymbol: unique symbol;
167declare var loader: string;
168type Schema = import("schema-utils/declarations/validate").Schema;
169type Compilation = import("webpack").Compilation;
170type ChunkGraph = import("webpack").ChunkGraph;
171type Chunk = import("webpack").Chunk;
172type ChunkGroup = Parameters<import("webpack").Chunk["isInGroup"]>[0];
173type Module = import("webpack").Module;
174type Dependency = import("webpack").Dependency;
175type Source = import("webpack").sources.Source;
176type Configuration = import("webpack").Configuration;
177type WebpackError = import("webpack").WebpackError;
178type AssetInfo = import("webpack").AssetInfo;
179type LoaderDependency = import("./loader.js").Dependency;
180type LoaderOptions = {
181 publicPath?:
182 | string
183 | ((resourcePath: string, rootContext: string) => string)
184 | undefined;
185 emit?: boolean | undefined;
186 esModule?: boolean | undefined;
187 layer?: string | undefined;
188};
189type NormalizedPluginOptions = {
190 filename: Required<Configuration>["output"]["filename"];
191 chunkFilename?: Required<Configuration>["output"]["chunkFilename"];
192 ignoreOrder: boolean;
193 insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined;
194 attributes?: Record<string, string> | undefined;
195 linkType?: string | false | undefined;
196 runtime: boolean;
197 experimentalUseImportModule?: boolean | undefined;
198};
199type RuntimeOptions = {
200 insert: string | ((linkTag: HTMLLinkElement) => void) | undefined;
201 linkType: string | false | "text/css";
202 attributes: Record<string, string> | undefined;
203};
204type TODO = any;
205type CssModule = import("webpack").Module & {
206 content: Buffer;
207 media?: string | undefined;
208 sourceMap?: Buffer | undefined;
209 supports?: string | undefined;
210 layer?: string | undefined;
211 assets?:
212 | {
213 [key: string]: any;
214 }
215 | undefined;
216 assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined;
217};
218type CssModuleDependency = {
219 context: string | null;
220 identifier: string;
221 identifierIndex: number;
222 content: Buffer;
223 sourceMap?: Buffer | undefined;
224 media?: string | undefined;
225 supports?: string | undefined;
226 layer?: TODO;
227 assetsInfo?: Map<string, import("webpack").AssetInfo> | undefined;
228 assets?:
229 | {
230 [key: string]: any;
231 }
232 | undefined;
233};
234type CssDependency = Dependency & CssModuleDependency;
235type CssDependencyOptions = Omit<LoaderDependency, "context">;
236
\No newline at end of file