webpack 5.81.0 → 5.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/bin/webpack.js +13 -2
- package/lib/Compilation.js +4 -1
- package/lib/CssModule.js +39 -7
- package/lib/DependenciesBlock.js +8 -0
- package/lib/FileSystemInfo.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +3 -2
- package/lib/Module.js +3 -2
- package/lib/ModuleTypeConstants.js +90 -0
- package/lib/NormalModule.js +2 -1
- package/lib/RuntimeModule.js +4 -3
- package/lib/Template.js +2 -1
- package/lib/WebpackOptionsApply.js +33 -40
- package/lib/asset/AssetGenerator.js +4 -3
- package/lib/asset/AssetModulesPlugin.js +21 -11
- package/lib/asset/RawDataUrlModule.js +2 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +2 -0
- package/lib/config/defaults.js +4 -2
- package/lib/container/FallbackModule.js +2 -1
- package/lib/container/RemoteModule.js +2 -1
- package/lib/css/CssGenerator.js +4 -0
- package/lib/css/CssLoadingRuntimeModule.js +9 -2
- package/lib/css/CssModulesPlugin.js +149 -39
- package/lib/css/CssParser.js +443 -319
- package/lib/css/walkCssTokens.js +118 -27
- package/lib/debug/ProfilingPlugin.js +2 -0
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +1 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +4 -2
- package/lib/hmr/LazyCompilationPlugin.js +13 -4
- package/lib/javascript/BasicEvaluatedExpression.js +108 -1
- package/lib/javascript/JavascriptModulesPlugin.js +3 -2
- package/lib/javascript/JavascriptParser.js +132 -11
- package/lib/json/JsonData.js +25 -0
- package/lib/json/JsonGenerator.js +15 -3
- package/lib/json/JsonModulesPlugin.js +1 -0
- package/lib/json/JsonParser.js +2 -1
- package/lib/library/ModuleLibraryPlugin.js +2 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +3 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -0
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +22 -3
- package/lib/schemes/DataUriPlugin.js +4 -0
- package/lib/schemes/HttpUriPlugin.js +38 -0
- package/lib/sharing/ConsumeSharedModule.js +5 -2
- package/lib/sharing/ProvideSharedModule.js +2 -1
- package/lib/sharing/utils.js +293 -7
- package/lib/stats/DefaultStatsFactoryPlugin.js +7 -4
- package/lib/stats/DefaultStatsPrinterPlugin.js +25 -0
- package/lib/util/StackedCacheMap.js +6 -0
- package/lib/util/StringXor.js +51 -0
- package/lib/util/compileBooleanMatcher.js +31 -0
- package/lib/util/createHash.js +4 -3
- package/lib/util/deprecation.js +8 -0
- package/lib/util/identifier.js +4 -0
- package/lib/util/numberHash.js +75 -21
- package/lib/util/propertyAccess.js +5 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +4 -0
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -0
- package/lib/wasm-async/AsyncWebAssemblyParser.js +1 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +8 -4
- package/package.json +3 -3
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +25 -0
- package/types.d.ts +181 -39
package/lib/config/defaults.js
CHANGED
@@ -13,7 +13,8 @@ const {
|
|
13
13
|
WEBASSEMBLY_MODULE_TYPE_ASYNC,
|
14
14
|
JAVASCRIPT_MODULE_TYPE_ESM,
|
15
15
|
JAVASCRIPT_MODULE_TYPE_DYNAMIC,
|
16
|
-
WEBASSEMBLY_MODULE_TYPE_SYNC
|
16
|
+
WEBASSEMBLY_MODULE_TYPE_SYNC,
|
17
|
+
ASSET_MODULE_TYPE
|
17
18
|
} = require("../ModuleTypeConstants");
|
18
19
|
const Template = require("../Template");
|
19
20
|
const { cleverMerge } = require("../util/cleverMerge");
|
@@ -511,7 +512,7 @@ const applyModuleDefaults = (
|
|
511
512
|
D(module, "unsafeCache", false);
|
512
513
|
}
|
513
514
|
|
514
|
-
F(module.parser,
|
515
|
+
F(module.parser, ASSET_MODULE_TYPE, () => ({}));
|
515
516
|
F(module.parser.asset, "dataUrlCondition", () => ({}));
|
516
517
|
if (typeof module.parser.asset.dataUrlCondition === "object") {
|
517
518
|
D(module.parser.asset.dataUrlCondition, "maxSize", 8096);
|
@@ -961,6 +962,7 @@ const applyOutputDefaults = (
|
|
961
962
|
() =>
|
962
963
|
output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack"
|
963
964
|
);
|
965
|
+
D(trustedTypes, "onPolicyCreationFailure", "stop");
|
964
966
|
}
|
965
967
|
|
966
968
|
/**
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
const { RawSource } = require("webpack-sources");
|
9
9
|
const Module = require("../Module");
|
10
|
+
const { WEBPACK_MODULE_TYPE_FALLBACK } = require("../ModuleTypeConstants");
|
10
11
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
11
12
|
const Template = require("../Template");
|
12
13
|
const makeSerializable = require("../util/makeSerializable");
|
@@ -37,7 +38,7 @@ class FallbackModule extends Module {
|
|
37
38
|
* @param {string[]} requests list of requests to choose one
|
38
39
|
*/
|
39
40
|
constructor(requests) {
|
40
|
-
super(
|
41
|
+
super(WEBPACK_MODULE_TYPE_FALLBACK);
|
41
42
|
this.requests = requests;
|
42
43
|
this._identifier = `fallback ${this.requests.join(" ")}`;
|
43
44
|
}
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
const { RawSource } = require("webpack-sources");
|
9
9
|
const Module = require("../Module");
|
10
|
+
const { WEBPACK_MODULE_TYPE_REMOTE } = require("../ModuleTypeConstants");
|
10
11
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
11
12
|
const makeSerializable = require("../util/makeSerializable");
|
12
13
|
const FallbackDependency = require("./FallbackDependency");
|
@@ -39,7 +40,7 @@ class RemoteModule extends Module {
|
|
39
40
|
* @param {string} shareScope the used share scope name
|
40
41
|
*/
|
41
42
|
constructor(request, externalRequests, internalRequest, shareScope) {
|
42
|
-
super(
|
43
|
+
super(WEBPACK_MODULE_TYPE_REMOTE);
|
43
44
|
this.request = request;
|
44
45
|
this.externalRequests = externalRequests;
|
45
46
|
this.internalRequest = internalRequest;
|
package/lib/css/CssGenerator.js
CHANGED
@@ -32,6 +32,7 @@ class CssGenerator extends Generator {
|
|
32
32
|
generate(module, generateContext) {
|
33
33
|
const originalSource = module.originalSource();
|
34
34
|
const source = new ReplaceSource(originalSource);
|
35
|
+
/** @type {InitFragment[]} */
|
35
36
|
const initFragments = [];
|
36
37
|
const cssExports = new Map();
|
37
38
|
|
@@ -51,6 +52,9 @@ class CssGenerator extends Generator {
|
|
51
52
|
cssExports
|
52
53
|
};
|
53
54
|
|
55
|
+
/**
|
56
|
+
* @param {Dependency} dependency dependency
|
57
|
+
*/
|
54
58
|
const handleDependency = dependency => {
|
55
59
|
const constructor = /** @type {new (...args: any[]) => Dependency} */ (
|
56
60
|
dependency.constructor
|
@@ -14,6 +14,7 @@ const compileBooleanMatcher = require("../util/compileBooleanMatcher");
|
|
14
14
|
const { chunkHasCss } = require("./CssModulesPlugin");
|
15
15
|
|
16
16
|
/** @typedef {import("../Chunk")} Chunk */
|
17
|
+
/** @typedef {import("../Compilation").RuntimeRequirementsContext} RuntimeRequirementsContext */
|
17
18
|
|
18
19
|
/**
|
19
20
|
* @typedef {Object} JsonpCompilationPluginHooks
|
@@ -44,11 +45,13 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|
44
45
|
return hooks;
|
45
46
|
}
|
46
47
|
|
47
|
-
|
48
|
+
/**
|
49
|
+
* @param {Set<string>} runtimeRequirements runtime requirements
|
50
|
+
*/
|
51
|
+
constructor(runtimeRequirements) {
|
48
52
|
super("css loading", 10);
|
49
53
|
|
50
54
|
this._runtimeRequirements = runtimeRequirements;
|
51
|
-
this.runtimeOptions = runtimeOptions;
|
52
55
|
}
|
53
56
|
|
54
57
|
/**
|
@@ -76,10 +79,13 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|
76
79
|
const withLoading =
|
77
80
|
_runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) &&
|
78
81
|
hasCssMatcher !== false;
|
82
|
+
/** @type {boolean} */
|
79
83
|
const withHmr = _runtimeRequirements.has(
|
80
84
|
RuntimeGlobals.hmrDownloadUpdateHandlers
|
81
85
|
);
|
86
|
+
/** @type {Set<number | string | null>} */
|
82
87
|
const initialChunkIdsWithCss = new Set();
|
88
|
+
/** @type {Set<number | string | null>} */
|
83
89
|
const initialChunkIdsWithoutCss = new Set();
|
84
90
|
for (const c of chunk.getAllInitialChunks()) {
|
85
91
|
(chunkHasCss(c, chunkGraph)
|
@@ -120,6 +126,7 @@ class CssLoadingRuntimeModule extends RuntimeModule {
|
|
120
126
|
: ""
|
121
127
|
]);
|
122
128
|
|
129
|
+
/** @type {(str: string) => number} */
|
123
130
|
const cc = str => str.charCodeAt(0);
|
124
131
|
|
125
132
|
return Template.asString([
|
@@ -15,6 +15,7 @@ const {
|
|
15
15
|
} = require("../ModuleTypeConstants");
|
16
16
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
17
17
|
const SelfModuleFactory = require("../SelfModuleFactory");
|
18
|
+
const WebpackError = require("../WebpackError");
|
18
19
|
const CssExportDependency = require("../dependencies/CssExportDependency");
|
19
20
|
const CssImportDependency = require("../dependencies/CssImportDependency");
|
20
21
|
const CssLocalIdentifierDependency = require("../dependencies/CssLocalIdentifierDependency");
|
@@ -32,9 +33,14 @@ const CssParser = require("./CssParser");
|
|
32
33
|
|
33
34
|
/** @typedef {import("webpack-sources").Source} Source */
|
34
35
|
/** @typedef {import("../../declarations/WebpackOptions").CssExperimentOptions} CssExperimentOptions */
|
36
|
+
/** @typedef {import("../../declarations/WebpackOptions").Output} OutputOptions */
|
35
37
|
/** @typedef {import("../Chunk")} Chunk */
|
38
|
+
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
39
|
+
/** @typedef {import("../CodeGenerationResults")} CodeGenerationResults */
|
40
|
+
/** @typedef {import("../Compilation")} Compilation */
|
36
41
|
/** @typedef {import("../Compiler")} Compiler */
|
37
42
|
/** @typedef {import("../Module")} Module */
|
43
|
+
/** @typedef {import("../util/memoize")} Memoize */
|
38
44
|
|
39
45
|
const getCssLoadingRuntimeModule = memoize(() =>
|
40
46
|
require("./CssLoadingRuntimeModule")
|
@@ -65,6 +71,11 @@ const validateParserOptions = createSchemaValidation(
|
|
65
71
|
}
|
66
72
|
);
|
67
73
|
|
74
|
+
/**
|
75
|
+
* @param {string} str string
|
76
|
+
* @param {boolean=} omitOptionalUnderscore if true, optional underscore is not added
|
77
|
+
* @returns {string} escaped string
|
78
|
+
*/
|
68
79
|
const escapeCss = (str, omitOptionalUnderscore) => {
|
69
80
|
const escaped = `${str}`.replace(
|
70
81
|
// cspell:word uffff
|
@@ -146,7 +157,6 @@ class CssModulesPlugin {
|
|
146
157
|
return new CssParser();
|
147
158
|
case CSS_MODULE_TYPE_GLOBAL:
|
148
159
|
return new CssParser({
|
149
|
-
allowPseudoBlocks: false,
|
150
160
|
allowModeSwitch: false
|
151
161
|
});
|
152
162
|
case CSS_MODULE_TYPE_MODULE:
|
@@ -170,12 +180,56 @@ class CssModulesPlugin {
|
|
170
180
|
// When CSS is imported from CSS there is only one dependency
|
171
181
|
const dependency = resolveData.dependencies[0];
|
172
182
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
183
|
+
if (dependency instanceof CssImportDependency) {
|
184
|
+
const parent =
|
185
|
+
/** @type {CssModule} */
|
186
|
+
(compilation.moduleGraph.getParentModule(dependency));
|
187
|
+
|
188
|
+
if (parent instanceof CssModule) {
|
189
|
+
/** @type {import("../CssModule").Inheritance | undefined} */
|
190
|
+
let inheritance;
|
191
|
+
|
192
|
+
if (
|
193
|
+
(parent.cssLayer !== null &&
|
194
|
+
parent.cssLayer !== undefined) ||
|
195
|
+
parent.supports ||
|
196
|
+
parent.media
|
197
|
+
) {
|
198
|
+
if (!inheritance) {
|
199
|
+
inheritance = [];
|
200
|
+
}
|
201
|
+
|
202
|
+
inheritance.push([
|
203
|
+
parent.cssLayer,
|
204
|
+
parent.supports,
|
205
|
+
parent.media
|
206
|
+
]);
|
207
|
+
}
|
208
|
+
|
209
|
+
if (parent.inheritance) {
|
210
|
+
if (!inheritance) {
|
211
|
+
inheritance = [];
|
212
|
+
}
|
213
|
+
|
214
|
+
inheritance.push(...parent.inheritance);
|
215
|
+
}
|
216
|
+
|
217
|
+
return new CssModule({
|
218
|
+
...createData,
|
219
|
+
cssLayer: dependency.layer,
|
220
|
+
supports: dependency.supports,
|
221
|
+
media: dependency.media,
|
222
|
+
inheritance
|
223
|
+
});
|
224
|
+
}
|
225
|
+
|
226
|
+
return new CssModule({
|
227
|
+
...createData,
|
228
|
+
cssLayer: dependency.layer,
|
229
|
+
supports: dependency.supports,
|
230
|
+
media: dependency.media
|
231
|
+
});
|
232
|
+
}
|
179
233
|
}
|
180
234
|
|
181
235
|
return new CssModule(createData);
|
@@ -219,6 +273,7 @@ class CssModulesPlugin {
|
|
219
273
|
|
220
274
|
if (chunk instanceof HotUpdateChunk) return result;
|
221
275
|
|
276
|
+
/** @type {CssModule[] | undefined} */
|
222
277
|
const modules = orderedCssModulesPerChunk.get(chunk);
|
223
278
|
if (modules !== undefined) {
|
224
279
|
result.push({
|
@@ -246,12 +301,20 @@ class CssModulesPlugin {
|
|
246
301
|
}
|
247
302
|
return result;
|
248
303
|
});
|
249
|
-
const
|
304
|
+
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
305
|
+
const isEnabledForChunk = chunk => {
|
306
|
+
const options = chunk.getEntryOptions();
|
307
|
+
const chunkLoading =
|
308
|
+
options && options.chunkLoading !== undefined
|
309
|
+
? options.chunkLoading
|
310
|
+
: globalChunkLoading;
|
311
|
+
return chunkLoading === "jsonp";
|
312
|
+
};
|
313
|
+
const onceForChunkSet = new WeakSet();
|
250
314
|
const handler = (chunk, set) => {
|
251
|
-
if (
|
252
|
-
|
253
|
-
|
254
|
-
enabledChunks.add(chunk);
|
315
|
+
if (onceForChunkSet.has(chunk)) return;
|
316
|
+
onceForChunkSet.add(chunk);
|
317
|
+
if (!isEnabledForChunk(chunk)) return;
|
255
318
|
|
256
319
|
set.add(RuntimeGlobals.publicPath);
|
257
320
|
set.add(RuntimeGlobals.getChunkCssFilename);
|
@@ -275,9 +338,16 @@ class CssModulesPlugin {
|
|
275
338
|
);
|
276
339
|
}
|
277
340
|
|
341
|
+
/**
|
342
|
+
* @param {Chunk} chunk chunk
|
343
|
+
* @param {Iterable<Module>} modules unordered modules
|
344
|
+
* @param {Compilation} compilation compilation
|
345
|
+
* @returns {Module[]} ordered modules
|
346
|
+
*/
|
278
347
|
getModulesInOrder(chunk, modules, compilation) {
|
279
348
|
if (!modules) return [];
|
280
349
|
|
350
|
+
/** @type {Module[]} */
|
281
351
|
const modulesList = [...modules];
|
282
352
|
|
283
353
|
// Get ordered list of modules per chunk group
|
@@ -311,6 +381,7 @@ class CssModulesPlugin {
|
|
311
381
|
|
312
382
|
modulesByChunkGroup.sort(compareModuleLists);
|
313
383
|
|
384
|
+
/** @type {Module[]} */
|
314
385
|
const finalModules = [];
|
315
386
|
|
316
387
|
for (;;) {
|
@@ -320,6 +391,7 @@ class CssModulesPlugin {
|
|
320
391
|
// done, everything empty
|
321
392
|
break;
|
322
393
|
}
|
394
|
+
/** @type {Module} */
|
323
395
|
let selectedModule = list[list.length - 1];
|
324
396
|
let hasFailed = undefined;
|
325
397
|
outer: for (;;) {
|
@@ -345,18 +417,17 @@ class CssModulesPlugin {
|
|
345
417
|
if (compilation) {
|
346
418
|
// TODO print better warning
|
347
419
|
compilation.warnings.push(
|
348
|
-
new
|
349
|
-
`chunk ${
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
)} and ${selectedModule.readableIdentifier(
|
420
|
+
new WebpackError(
|
421
|
+
`chunk ${chunk.name || chunk.id}\nConflicting order between ${
|
422
|
+
/** @type {Module} */
|
423
|
+
(hasFailed).readableIdentifier(compilation.requestShortener)
|
424
|
+
} and ${selectedModule.readableIdentifier(
|
354
425
|
compilation.requestShortener
|
355
426
|
)}`
|
356
427
|
)
|
357
428
|
);
|
358
429
|
}
|
359
|
-
selectedModule = hasFailed;
|
430
|
+
selectedModule = /** @type {Module} */ (hasFailed);
|
360
431
|
}
|
361
432
|
// Insert the selected module into the final modules list
|
362
433
|
finalModules.push(selectedModule);
|
@@ -374,6 +445,12 @@ class CssModulesPlugin {
|
|
374
445
|
return finalModules;
|
375
446
|
}
|
376
447
|
|
448
|
+
/**
|
449
|
+
* @param {Chunk} chunk chunk
|
450
|
+
* @param {ChunkGraph} chunkGraph chunk graph
|
451
|
+
* @param {Compilation} compilation compilation
|
452
|
+
* @returns {Module[]} ordered css modules
|
453
|
+
*/
|
377
454
|
getOrderedChunkCssModules(chunk, chunkGraph, compilation) {
|
378
455
|
return [
|
379
456
|
...this.getModulesInOrder(
|
@@ -397,6 +474,15 @@ class CssModulesPlugin {
|
|
397
474
|
];
|
398
475
|
}
|
399
476
|
|
477
|
+
/**
|
478
|
+
* @param {Object} options options
|
479
|
+
* @param {string | undefined} options.uniqueName unique name
|
480
|
+
* @param {Chunk} options.chunk chunk
|
481
|
+
* @param {ChunkGraph} options.chunkGraph chunk graph
|
482
|
+
* @param {CodeGenerationResults} options.codeGenerationResults code generation results
|
483
|
+
* @param {CssModule[]} options.modules ordered css modules
|
484
|
+
* @returns {Source} generated source
|
485
|
+
*/
|
400
486
|
renderChunk({
|
401
487
|
uniqueName,
|
402
488
|
chunk,
|
@@ -405,6 +491,7 @@ class CssModulesPlugin {
|
|
405
491
|
modules
|
406
492
|
}) {
|
407
493
|
const source = new ConcatSource();
|
494
|
+
/** @type {string[]} */
|
408
495
|
const metaData = [];
|
409
496
|
for (const module of modules) {
|
410
497
|
try {
|
@@ -414,35 +501,48 @@ class CssModulesPlugin {
|
|
414
501
|
codeGenResult.sources.get("css") ||
|
415
502
|
codeGenResult.sources.get("css-import");
|
416
503
|
|
417
|
-
|
418
|
-
moduleSource = new ConcatSource(
|
419
|
-
`@media ${module.media} {\n`,
|
420
|
-
new PrefixSource("\t", moduleSource),
|
421
|
-
"}"
|
422
|
-
);
|
423
|
-
}
|
504
|
+
let inheritance = [[module.cssLayer, module.supports, module.media]];
|
424
505
|
|
425
|
-
if (module.
|
426
|
-
|
427
|
-
`@supports (${module.supports}) {\n`,
|
428
|
-
new PrefixSource("\t", moduleSource),
|
429
|
-
"}"
|
430
|
-
);
|
506
|
+
if (module.inheritance) {
|
507
|
+
inheritance.push(...module.inheritance);
|
431
508
|
}
|
432
509
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
510
|
+
for (let i = 0; i < inheritance.length; i++) {
|
511
|
+
const layer = inheritance[i][0];
|
512
|
+
const supports = inheritance[i][1];
|
513
|
+
const media = inheritance[i][2];
|
514
|
+
|
515
|
+
if (media) {
|
516
|
+
moduleSource = new ConcatSource(
|
517
|
+
`@media ${media} {\n`,
|
518
|
+
new PrefixSource("\t", moduleSource),
|
519
|
+
"}\n"
|
520
|
+
);
|
521
|
+
}
|
522
|
+
|
523
|
+
if (supports) {
|
524
|
+
moduleSource = new ConcatSource(
|
525
|
+
`@supports (${supports}) {\n`,
|
526
|
+
new PrefixSource("\t", moduleSource),
|
527
|
+
"}\n"
|
528
|
+
);
|
529
|
+
}
|
530
|
+
|
531
|
+
// Layer can be anonymous
|
532
|
+
if (layer !== undefined && layer !== null) {
|
533
|
+
moduleSource = new ConcatSource(
|
534
|
+
`@layer${layer ? ` ${layer}` : ""} {\n`,
|
535
|
+
new PrefixSource("\t", moduleSource),
|
536
|
+
"}\n"
|
537
|
+
);
|
538
|
+
}
|
440
539
|
}
|
441
540
|
|
442
541
|
if (moduleSource) {
|
443
542
|
source.add(moduleSource);
|
444
543
|
source.add("\n");
|
445
544
|
}
|
545
|
+
/** @type {Map<string, string> | undefined} */
|
446
546
|
const exports =
|
447
547
|
codeGenResult.data && codeGenResult.data.get("css-exports");
|
448
548
|
let moduleId = chunkGraph.getModuleId(module) + "";
|
@@ -482,6 +582,11 @@ class CssModulesPlugin {
|
|
482
582
|
return source;
|
483
583
|
}
|
484
584
|
|
585
|
+
/**
|
586
|
+
* @param {Chunk} chunk chunk
|
587
|
+
* @param {OutputOptions} outputOptions output options
|
588
|
+
* @returns {Chunk["cssFilenameTemplate"] | OutputOptions["cssFilename"] | OutputOptions["cssChunkFilename"]} used filename template
|
589
|
+
*/
|
485
590
|
static getChunkFilenameTemplate(chunk, outputOptions) {
|
486
591
|
if (chunk.cssFilenameTemplate) {
|
487
592
|
return chunk.cssFilenameTemplate;
|
@@ -492,6 +597,11 @@ class CssModulesPlugin {
|
|
492
597
|
}
|
493
598
|
}
|
494
599
|
|
600
|
+
/**
|
601
|
+
* @param {Chunk} chunk chunk
|
602
|
+
* @param {ChunkGraph} chunkGraph chunk graph
|
603
|
+
* @returns {boolean} true, when the chunk has css
|
604
|
+
*/
|
495
605
|
static chunkHasCss(chunk, chunkGraph) {
|
496
606
|
return (
|
497
607
|
!!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") ||
|