webpack 5.96.0 → 5.97.0

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.
Files changed (64) hide show
  1. package/lib/CssModule.js +5 -0
  2. package/lib/DependencyTemplate.js +2 -2
  3. package/lib/EvalSourceMapDevToolPlugin.js +5 -0
  4. package/lib/FalseIIFEUmdWarning.js +19 -0
  5. package/lib/HotModuleReplacementPlugin.js +4 -0
  6. package/lib/Module.js +6 -0
  7. package/lib/ModuleSourceTypesConstants.js +12 -0
  8. package/lib/NormalModule.js +1 -0
  9. package/lib/RuntimeTemplate.js +7 -0
  10. package/lib/SourceMapDevToolPlugin.js +8 -0
  11. package/lib/WebpackOptionsApply.js +3 -1
  12. package/lib/asset/AssetModulesPlugin.js +7 -2
  13. package/lib/config/defaults.js +52 -36
  14. package/lib/config/normalization.js +0 -1
  15. package/lib/config/target.js +8 -8
  16. package/lib/css/CssGenerator.js +139 -35
  17. package/lib/css/CssLoadingRuntimeModule.js +108 -198
  18. package/lib/css/CssModulesPlugin.js +78 -124
  19. package/lib/css/CssParser.js +545 -121
  20. package/lib/css/walkCssTokens.js +41 -19
  21. package/lib/dependencies/CachedConstDependency.js +2 -1
  22. package/lib/dependencies/ContextDependencyTemplateAsId.js +3 -2
  23. package/lib/dependencies/{CssExportDependency.js → CssIcssExportDependency.js} +35 -35
  24. package/lib/dependencies/CssIcssImportDependency.js +118 -0
  25. package/lib/dependencies/CssIcssSymbolDependency.js +132 -0
  26. package/lib/dependencies/CssImportDependency.js +0 -8
  27. package/lib/dependencies/CssLocalIdentifierDependency.js +69 -73
  28. package/lib/dependencies/CssUrlDependency.js +1 -0
  29. package/lib/esm/ModuleChunkFormatPlugin.js +8 -4
  30. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +17 -10
  31. package/lib/index.js +13 -6
  32. package/lib/javascript/EnableChunkLoadingPlugin.js +2 -4
  33. package/lib/library/AssignLibraryPlugin.js +1 -1
  34. package/lib/library/EnableLibraryPlugin.js +17 -0
  35. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +81 -78
  36. package/lib/node/ReadFileCompileWasmPlugin.js +76 -57
  37. package/lib/optimize/MergeDuplicateChunksPlugin.js +22 -2
  38. package/lib/sharing/ConsumeSharedPlugin.js +35 -12
  39. package/lib/sharing/utils.js +35 -4
  40. package/lib/stats/DefaultStatsFactoryPlugin.js +0 -5
  41. package/lib/util/Queue.js +52 -24
  42. package/lib/util/generateDebugId.js +33 -0
  43. package/lib/util/internalSerializables.js +6 -2
  44. package/lib/wasm/EnableWasmLoadingPlugin.js +36 -25
  45. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +26 -2
  46. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +103 -0
  47. package/lib/wasm-sync/WebAssemblyParser.js +1 -1
  48. package/lib/web/FetchCompileAsyncWasmPlugin.js +43 -44
  49. package/lib/web/FetchCompileWasmPlugin.js +4 -4
  50. package/package.json +5 -5
  51. package/schemas/WebpackOptions.check.js +1 -1
  52. package/schemas/WebpackOptions.json +34 -12
  53. package/schemas/plugins/BannerPlugin.json +1 -1
  54. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  55. package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
  56. package/schemas/plugins/css/CssAutoParserOptions.check.js +1 -1
  57. package/schemas/plugins/css/CssGlobalParserOptions.check.js +1 -1
  58. package/schemas/plugins/css/CssModuleParserOptions.check.js +1 -1
  59. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  60. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.d.ts +7 -0
  61. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +6 -0
  62. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.json +11 -0
  63. package/types.d.ts +85 -24
  64. package/lib/css/CssExportsGenerator.js +0 -207
@@ -22,6 +22,7 @@
22
22
  * @property {(function(string, number, number): number)=} rightCurlyBracket
23
23
  * @property {(function(string, number, number): number)=} semicolon
24
24
  * @property {(function(string, number, number): number)=} comma
25
+ * @property {(function(): boolean)=} needTerminate
25
26
  */
26
27
 
27
28
  /** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */
@@ -77,13 +78,6 @@ const CC_HYPHEN_MINUS = "-".charCodeAt(0);
77
78
  const CC_LESS_THAN_SIGN = "<".charCodeAt(0);
78
79
  const CC_GREATER_THAN_SIGN = ">".charCodeAt(0);
79
80
 
80
- /**
81
- * @param {number} cc char code
82
- * @returns {boolean} true, if cc is a newline
83
- */
84
- const _isNewLine = cc =>
85
- cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED;
86
-
87
81
  /** @type {CharHandler} */
88
82
  const consumeSpace = (input, pos, _callbacks) => {
89
83
  // Consume as much whitespace as possible.
@@ -95,6 +89,11 @@ const consumeSpace = (input, pos, _callbacks) => {
95
89
  return pos;
96
90
  };
97
91
 
92
+ // U+000A LINE FEED. Note that U+000D CARRIAGE RETURN and U+000C FORM FEED are not included in this definition,
93
+ // as they are converted to U+000A LINE FEED during preprocessing.
94
+ //
95
+ // Replace any U+000D CARRIAGE RETURN (CR) code points, U+000C FORM FEED (FF) code points, or pairs of U+000D CARRIAGE RETURN (CR) followed by U+000A LINE FEED (LF) in input by a single U+000A LINE FEED (LF) code point.
96
+
98
97
  /**
99
98
  * @param {number} cc char code
100
99
  * @returns {boolean} true, if cc is a newline
@@ -102,6 +101,20 @@ const consumeSpace = (input, pos, _callbacks) => {
102
101
  const _isNewline = cc =>
103
102
  cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED;
104
103
 
104
+ /**
105
+ * @param {number} cc char code
106
+ * @param {string} input input
107
+ * @param {number} pos position
108
+ * @returns {number} position
109
+ */
110
+ const consumeExtraNewline = (cc, input, pos) => {
111
+ if (cc === CC_CARRIAGE_RETURN && input.charCodeAt(pos) === CC_LINE_FEED) {
112
+ pos++;
113
+ }
114
+
115
+ return pos;
116
+ };
117
+
105
118
  /**
106
119
  * @param {number} cc char code
107
120
  * @returns {boolean} true, if cc is a space (U+0009 CHARACTER TABULATION or U+0020 SPACE)
@@ -215,8 +228,11 @@ const _consumeAnEscapedCodePoint = (input, pos) => {
215
228
  }
216
229
  }
217
230
 
218
- if (_isWhiteSpace(input.charCodeAt(pos))) {
231
+ const cc = input.charCodeAt(pos);
232
+
233
+ if (_isWhiteSpace(cc)) {
219
234
  pos++;
235
+ pos = consumeExtraNewline(cc, input, pos);
220
236
  }
221
237
 
222
238
  return pos;
@@ -266,7 +282,7 @@ const consumeAStringToken = (input, pos, callbacks) => {
266
282
  // newline
267
283
  // This is a parse error.
268
284
  // Reconsume the current input code point, create a <bad-string-token>, and return it.
269
- else if (_isNewLine(cc)) {
285
+ else if (_isNewline(cc)) {
270
286
  pos--;
271
287
  // bad string
272
288
  return pos;
@@ -278,8 +294,10 @@ const consumeAStringToken = (input, pos, callbacks) => {
278
294
  return pos;
279
295
  }
280
296
  // Otherwise, if the next input code point is a newline, consume it.
281
- else if (_isNewLine(input.charCodeAt(pos))) {
297
+ else if (_isNewline(input.charCodeAt(pos))) {
298
+ const cc = input.charCodeAt(pos);
282
299
  pos++;
300
+ pos = consumeExtraNewline(cc, input, pos);
283
301
  }
284
302
  // Otherwise, (the stream starts with a valid escape) consume an escaped code point and append the returned code point to the <string-token>’s value.
285
303
  else if (_ifTwoCodePointsAreValidEscape(input, pos)) {
@@ -350,7 +368,7 @@ const _ifTwoCodePointsAreValidEscape = (input, pos, f, s) => {
350
368
  // If the first code point is not U+005C REVERSE SOLIDUS (\), return false.
351
369
  if (first !== CC_REVERSE_SOLIDUS) return false;
352
370
  // Otherwise, if the second code point is a newline, return false.
353
- if (_isNewLine(second)) return false;
371
+ if (_isNewline(second)) return false;
354
372
  // Otherwise, return true.
355
373
  return true;
356
374
  };
@@ -1156,12 +1174,12 @@ const consumeAToken = (input, pos, callbacks) => {
1156
1174
 
1157
1175
  /**
1158
1176
  * @param {string} input input css
1159
- * @param {CssTokenCallbacks} callbacks callbacks
1160
- * @returns {void}
1177
+ * @param {number=} pos pos
1178
+ * @param {CssTokenCallbacks=} callbacks callbacks
1179
+ * @returns {number} pos
1161
1180
  */
1162
- module.exports = (input, callbacks) => {
1181
+ module.exports = (input, pos = 0, callbacks = {}) => {
1163
1182
  // This section describes how to consume a token from a stream of code points. It will return a single token of any type.
1164
- let pos = 0;
1165
1183
  while (pos < input.length) {
1166
1184
  // Consume comments.
1167
1185
  pos = consumeComments(input, pos, callbacks);
@@ -1169,7 +1187,13 @@ module.exports = (input, callbacks) => {
1169
1187
  // Consume the next input code point.
1170
1188
  pos++;
1171
1189
  pos = consumeAToken(input, pos, callbacks);
1190
+
1191
+ if (callbacks.needTerminate && callbacks.needTerminate()) {
1192
+ break;
1193
+ }
1172
1194
  }
1195
+
1196
+ return pos;
1173
1197
  };
1174
1198
 
1175
1199
  module.exports.isIdentStartCodePoint = isIdentStartCodePoint;
@@ -1253,10 +1277,8 @@ module.exports.eatWhiteLine = (input, pos) => {
1253
1277
  pos++;
1254
1278
  continue;
1255
1279
  }
1256
- if (_isNewLine(cc)) pos++;
1257
- // For `\r\n`
1258
- if (cc === CC_CARRIAGE_RETURN && input.charCodeAt(pos + 1) === CC_LINE_FEED)
1259
- pos++;
1280
+ if (_isNewline(cc)) pos++;
1281
+ pos = consumeExtraNewline(cc, input, pos);
1260
1282
  break;
1261
1283
  }
1262
1284
 
@@ -52,8 +52,9 @@ class CachedConstDependency extends NullDependency {
52
52
  * @returns {void}
53
53
  */
54
54
  updateHash(hash, context) {
55
- if (this._hashUpdate === undefined)
55
+ if (this._hashUpdate === undefined) {
56
56
  this._hashUpdate = this._createHashUpdate();
57
+ }
57
58
  hash.update(this._hashUpdate);
58
59
  }
59
60
 
@@ -24,15 +24,16 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
24
24
  { runtimeTemplate, moduleGraph, chunkGraph, runtimeRequirements }
25
25
  ) {
26
26
  const dep = /** @type {ContextDependency} */ (dependency);
27
+ const module = moduleGraph.getModule(dep);
27
28
  const moduleExports = runtimeTemplate.moduleExports({
28
- module: moduleGraph.getModule(dep),
29
+ module,
29
30
  chunkGraph,
30
31
  request: dep.request,
31
32
  weak: dep.weak,
32
33
  runtimeRequirements
33
34
  });
34
35
 
35
- if (moduleGraph.getModule(dep)) {
36
+ if (module) {
36
37
  if (dep.valueRange) {
37
38
  if (Array.isArray(dep.replaces)) {
38
39
  for (let i = 0; i < dep.replaces.length; i++) {
@@ -17,13 +17,12 @@ const NullDependency = require("./NullDependency");
17
17
  /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
18
18
  /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
19
19
  /** @typedef {import("../ModuleGraph")} ModuleGraph */
20
- /** @typedef {import("../css/CssExportsGenerator")} CssExportsGenerator */
21
20
  /** @typedef {import("../css/CssGenerator")} CssGenerator */
22
21
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
23
22
  /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
24
23
  /** @typedef {import("../util/Hash")} Hash */
25
24
 
26
- class CssExportDependency extends NullDependency {
25
+ class CssIcssExportDependency extends NullDependency {
27
26
  /**
28
27
  * @param {string} name name
29
28
  * @param {string} value value
@@ -32,6 +31,7 @@ class CssExportDependency extends NullDependency {
32
31
  super();
33
32
  this.name = name;
34
33
  this.value = value;
34
+ this._hashUpdate = undefined;
35
35
  }
36
36
 
37
37
  get type() {
@@ -59,7 +59,7 @@ class CssExportDependency extends NullDependency {
59
59
  getExports(moduleGraph) {
60
60
  const module = /** @type {CssModule} */ (moduleGraph.getParentModule(this));
61
61
  const convention =
62
- /** @type {CssGenerator | CssExportsGenerator} */
62
+ /** @type {CssGenerator} */
63
63
  (module.generator).convention;
64
64
  const names = this.getExportsConventionNames(this.name, convention);
65
65
  return {
@@ -78,18 +78,21 @@ class CssExportDependency extends NullDependency {
78
78
  * @returns {void}
79
79
  */
80
80
  updateHash(hash, { chunkGraph }) {
81
- const module = /** @type {CssModule} */ (
82
- chunkGraph.moduleGraph.getParentModule(this)
83
- );
84
- const generator =
85
- /** @type {CssGenerator | CssExportsGenerator} */
86
- (module.generator);
87
- const names = this.getExportsConventionNames(
88
- this.name,
89
- generator.convention
90
- );
81
+ if (this._hashUpdate === undefined) {
82
+ const module =
83
+ /** @type {CssModule} */
84
+ (chunkGraph.moduleGraph.getParentModule(this));
85
+ const generator =
86
+ /** @type {CssGenerator} */
87
+ (module.generator);
88
+ const names = this.getExportsConventionNames(
89
+ this.name,
90
+ generator.convention
91
+ );
92
+ this._hashUpdate = JSON.stringify(names);
93
+ }
91
94
  hash.update("exportsConvention");
92
- hash.update(JSON.stringify(names));
95
+ hash.update(this._hashUpdate);
93
96
  }
94
97
 
95
98
  /**
@@ -113,7 +116,7 @@ class CssExportDependency extends NullDependency {
113
116
  }
114
117
  }
115
118
 
116
- CssExportDependency.Template = class CssExportDependencyTemplate extends (
119
+ CssIcssExportDependency.Template = class CssIcssExportDependencyTemplate extends (
117
120
  NullDependency.Template
118
121
  ) {
119
122
  /**
@@ -122,35 +125,32 @@ CssExportDependency.Template = class CssExportDependencyTemplate extends (
122
125
  * @param {DependencyTemplateContext} templateContext the context object
123
126
  * @returns {void}
124
127
  */
125
- apply(
126
- dependency,
127
- source,
128
- { cssExportsData, module: m, runtime, moduleGraph }
129
- ) {
130
- const dep = /** @type {CssExportDependency} */ (dependency);
128
+ apply(dependency, source, { cssData, module: m, runtime, moduleGraph }) {
129
+ const dep = /** @type {CssIcssExportDependency} */ (dependency);
131
130
  const module = /** @type {CssModule} */ (m);
132
131
  const convention =
133
- /** @type {CssGenerator | CssExportsGenerator} */
132
+ /** @type {CssGenerator} */
134
133
  (module.generator).convention;
135
134
  const names = dep.getExportsConventionNames(dep.name, convention);
136
- const usedNames = /** @type {string[]} */ (
137
- names
138
- .map(name =>
139
- moduleGraph.getExportInfo(module, name).getUsedName(name, runtime)
140
- )
141
- .filter(Boolean)
142
- );
143
- if (usedNames.length === 0) return;
135
+ const usedNames =
136
+ /** @type {string[]} */
137
+ (
138
+ names
139
+ .map(name =>
140
+ moduleGraph.getExportInfo(module, name).getUsedName(name, runtime)
141
+ )
142
+ .filter(Boolean)
143
+ );
144
144
 
145
- for (const used of usedNames) {
146
- cssExportsData.exports.set(used, dep.value);
145
+ for (const used of usedNames.concat(names)) {
146
+ cssData.exports.set(used, dep.value);
147
147
  }
148
148
  }
149
149
  };
150
150
 
151
151
  makeSerializable(
152
- CssExportDependency,
153
- "webpack/lib/dependencies/CssExportDependency"
152
+ CssIcssExportDependency,
153
+ "webpack/lib/dependencies/CssIcssExportDependency"
154
154
  );
155
155
 
156
- module.exports = CssExportDependency;
156
+ module.exports = CssIcssExportDependency;
@@ -0,0 +1,118 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Ivan Kopeykin @vankop
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const makeSerializable = require("../util/makeSerializable");
9
+ const CssIcssExportDependency = require("./CssIcssExportDependency");
10
+ const CssLocalIdentifierDependency = require("./CssLocalIdentifierDependency");
11
+ const ModuleDependency = require("./ModuleDependency");
12
+
13
+ /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
14
+ /** @typedef {import("../Dependency")} Dependency */
15
+ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
16
+ /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
17
+ /** @typedef {import("../ModuleGraph")} ModuleGraph */
18
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
19
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
20
+
21
+ class CssIcssImportDependency extends ModuleDependency {
22
+ /**
23
+ * Example of dependency:
24
+ *
25
+ *:import('./style.css') { IMPORTED_NAME: v-primary }
26
+ * @param {string} request request request path which needs resolving
27
+ * @param {string} exportName export name
28
+ * @param {[number, number]} range the range of dependency
29
+ */
30
+ constructor(request, exportName, range) {
31
+ super(request);
32
+ this.range = range;
33
+ this.exportName = exportName;
34
+ }
35
+
36
+ get type() {
37
+ return "css :import";
38
+ }
39
+
40
+ get category() {
41
+ return "css-import";
42
+ }
43
+
44
+ /**
45
+ * @param {ObjectSerializerContext} context context
46
+ */
47
+ serialize(context) {
48
+ const { write } = context;
49
+ write(this.range);
50
+ write(this.exportName);
51
+ super.serialize(context);
52
+ }
53
+
54
+ /**
55
+ * @param {ObjectDeserializerContext} context context
56
+ */
57
+ deserialize(context) {
58
+ const { read } = context;
59
+ this.range = read();
60
+ this.exportName = read();
61
+ super.deserialize(context);
62
+ }
63
+ }
64
+
65
+ CssIcssImportDependency.Template = class CssIcssImportDependencyTemplate extends (
66
+ ModuleDependency.Template
67
+ ) {
68
+ /**
69
+ * @param {Dependency} dependency the dependency for which the template should be applied
70
+ * @param {ReplaceSource} source the current replace source which can be modified
71
+ * @param {DependencyTemplateContext} templateContext the context object
72
+ * @returns {void}
73
+ */
74
+ apply(dependency, source, templateContext) {
75
+ const dep = /** @type {CssIcssImportDependency} */ (dependency);
76
+ const { range } = dep;
77
+ const module = templateContext.moduleGraph.getModule(dep);
78
+ let value;
79
+
80
+ for (const item of module.dependencies) {
81
+ if (
82
+ item instanceof CssLocalIdentifierDependency &&
83
+ dep.exportName === item.name
84
+ ) {
85
+ value = CssLocalIdentifierDependency.Template.getIdentifier(
86
+ item,
87
+ dep.exportName,
88
+ {
89
+ ...templateContext,
90
+ module
91
+ }
92
+ );
93
+ break;
94
+ } else if (
95
+ item instanceof CssIcssExportDependency &&
96
+ dep.exportName === item.name
97
+ ) {
98
+ value = item.value;
99
+ break;
100
+ }
101
+ }
102
+
103
+ if (!value) {
104
+ throw new Error(
105
+ `Imported '${dep.exportName}' name from '${dep.request}' not found`
106
+ );
107
+ }
108
+
109
+ source.replace(range[0], range[1], value);
110
+ }
111
+ };
112
+
113
+ makeSerializable(
114
+ CssIcssImportDependency,
115
+ "webpack/lib/dependencies/CssIcssImportDependency"
116
+ );
117
+
118
+ module.exports = CssIcssImportDependency;
@@ -0,0 +1,132 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Alexander Akait @alexander-akait
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const makeSerializable = require("../util/makeSerializable");
9
+ const NullDependency = require("./NullDependency");
10
+
11
+ /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
12
+ /** @typedef {import("../Dependency")} Dependency */
13
+ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
14
+ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
15
+ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */
16
+ /** @typedef {import("../DependencyTemplate").CssDependencyTemplateContext} DependencyTemplateContext */
17
+ /** @typedef {import("../ModuleGraph")} ModuleGraph */
18
+ /** @typedef {import("../css/CssParser").Range} Range */
19
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
20
+ /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
21
+ /** @typedef {import("../util/Hash")} Hash */
22
+ /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
23
+
24
+ class CssIcssSymbolDependency extends NullDependency {
25
+ /**
26
+ * @param {string} name name
27
+ * @param {string} value value
28
+ * @param {Range} range range
29
+ */
30
+ constructor(name, value, range) {
31
+ super();
32
+ this.name = name;
33
+ this.value = value;
34
+ this.range = range;
35
+ this._hashUpdate = undefined;
36
+ }
37
+
38
+ get type() {
39
+ return "css @value identifier";
40
+ }
41
+
42
+ get category() {
43
+ return "self";
44
+ }
45
+
46
+ /**
47
+ * Update the hash
48
+ * @param {Hash} hash hash to be updated
49
+ * @param {UpdateHashContext} context context
50
+ * @returns {void}
51
+ */
52
+ updateHash(hash, context) {
53
+ if (this._hashUpdate === undefined) {
54
+ this._hashUpdate = `${this.range}${this.name}${this.value}`;
55
+ }
56
+ hash.update(this._hashUpdate);
57
+ }
58
+
59
+ /**
60
+ * Returns the exported names
61
+ * @param {ModuleGraph} moduleGraph module graph
62
+ * @returns {ExportsSpec | undefined} export names
63
+ */
64
+ getExports(moduleGraph) {
65
+ return {
66
+ exports: [
67
+ {
68
+ name: this.name,
69
+ canMangle: true
70
+ }
71
+ ],
72
+ dependencies: undefined
73
+ };
74
+ }
75
+
76
+ /**
77
+ * Returns list of exports referenced by this dependency
78
+ * @param {ModuleGraph} moduleGraph module graph
79
+ * @param {RuntimeSpec} runtime the runtime for which the module is analysed
80
+ * @returns {(string[] | ReferencedExport)[]} referenced exports
81
+ */
82
+ getReferencedExports(moduleGraph, runtime) {
83
+ return [[this.name]];
84
+ }
85
+
86
+ /**
87
+ * @param {ObjectSerializerContext} context context
88
+ */
89
+ serialize(context) {
90
+ const { write } = context;
91
+ write(this.name);
92
+ write(this.value);
93
+ write(this.range);
94
+ super.serialize(context);
95
+ }
96
+
97
+ /**
98
+ * @param {ObjectDeserializerContext} context context
99
+ */
100
+ deserialize(context) {
101
+ const { read } = context;
102
+ this.name = read();
103
+ this.value = read();
104
+ this.range = read();
105
+ super.deserialize(context);
106
+ }
107
+ }
108
+
109
+ CssIcssSymbolDependency.Template = class CssValueAtRuleDependencyTemplate extends (
110
+ NullDependency.Template
111
+ ) {
112
+ /**
113
+ * @param {Dependency} dependency the dependency for which the template should be applied
114
+ * @param {ReplaceSource} source the current replace source which can be modified
115
+ * @param {DependencyTemplateContext} templateContext the context object
116
+ * @returns {void}
117
+ */
118
+ apply(dependency, source, { cssData }) {
119
+ const dep = /** @type {CssIcssSymbolDependency} */ (dependency);
120
+
121
+ source.replace(dep.range[0], dep.range[1] - 1, dep.value);
122
+
123
+ cssData.exports.set(dep.name, dep.value);
124
+ }
125
+ };
126
+
127
+ makeSerializable(
128
+ CssIcssSymbolDependency,
129
+ "webpack/lib/dependencies/CssIcssSymbolDependency"
130
+ );
131
+
132
+ module.exports = CssIcssSymbolDependency;
@@ -70,14 +70,6 @@ class CssImportDependency extends ModuleDependency {
70
70
  return str;
71
71
  }
72
72
 
73
- /**
74
- * @param {string} context context directory
75
- * @returns {Module | null} a module
76
- */
77
- createIgnoredModule(context) {
78
- return null;
79
- }
80
-
81
73
  /**
82
74
  * @param {ObjectSerializerContext} context context
83
75
  */