webpack 4.16.0 → 4.16.4

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 (71) hide show
  1. package/README.md +5 -2
  2. package/SECURITY.md +9 -9
  3. package/buildin/global.js +20 -20
  4. package/buildin/module.js +22 -22
  5. package/hot/log-apply-result.js +44 -44
  6. package/hot/log.js +2 -0
  7. package/lib/BasicEvaluatedExpression.js +211 -211
  8. package/lib/Chunk.js +32 -10
  9. package/lib/ChunkGroup.js +3 -3
  10. package/lib/Compilation.js +47 -11
  11. package/lib/ContextExclusionPlugin.js +11 -0
  12. package/lib/ContextModule.js +116 -30
  13. package/lib/ContextModuleFactory.js +6 -0
  14. package/lib/DefinePlugin.js +49 -0
  15. package/lib/DelegatedModule.js +5 -0
  16. package/lib/DependenciesBlock.js +1 -1
  17. package/lib/DllModule.js +6 -0
  18. package/lib/DllReferencePlugin.js +51 -3
  19. package/lib/ExternalModule.js +6 -0
  20. package/lib/Generator.js +11 -3
  21. package/lib/HotModuleReplacementPlugin.js +1 -5
  22. package/lib/MemoryOutputFileSystem.js +5 -5
  23. package/lib/Module.js +52 -12
  24. package/lib/MultiModule.js +6 -0
  25. package/lib/NodeStuffPlugin.js +18 -0
  26. package/lib/NormalModule.js +6 -0
  27. package/lib/NullFactory.js +12 -12
  28. package/lib/OptionsApply.js +10 -10
  29. package/lib/Parser.js +12 -3
  30. package/lib/RuntimeTemplate.js +12 -0
  31. package/lib/Stats.js +19 -2
  32. package/lib/Template.js +44 -43
  33. package/lib/WatchIgnorePlugin.js +18 -18
  34. package/lib/debug/ProfilingPlugin.js +1 -1
  35. package/lib/dependencies/AMDRequireItemDependency.js +22 -22
  36. package/lib/dependencies/CommonJsRequireDependency.js +22 -22
  37. package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +6 -0
  38. package/lib/dependencies/CriticalDependencyWarning.js +20 -20
  39. package/lib/dependencies/DelegatedSourceDependency.js +18 -18
  40. package/lib/dependencies/DllEntryDependency.js +20 -20
  41. package/lib/dependencies/LocalModule.js +23 -23
  42. package/lib/dependencies/ModuleHotAcceptDependency.js +23 -23
  43. package/lib/dependencies/ModuleHotDeclineDependency.js +23 -23
  44. package/lib/dependencies/PrefetchDependency.js +18 -18
  45. package/lib/dependencies/RequireEnsureItemDependency.js +21 -21
  46. package/lib/dependencies/RequireResolveDependency.js +22 -22
  47. package/lib/node/NodeOutputFileSystem.js +22 -22
  48. package/lib/node/NodeTargetPlugin.js +1 -0
  49. package/lib/optimize/ConcatenatedModule.js +5 -0
  50. package/lib/optimize/OccurrenceChunkOrderPlugin.js +1 -1
  51. package/lib/optimize/OccurrenceModuleOrderPlugin.js +1 -1
  52. package/lib/optimize/OccurrenceOrderPlugin.js +2 -2
  53. package/lib/util/SortableSet.js +1 -0
  54. package/lib/util/StackedSetMap.js +12 -3
  55. package/lib/wasm/WebAssemblyGenerator.js +22 -5
  56. package/lib/wasm/WebAssemblyJavascriptGenerator.js +16 -2
  57. package/lib/webpack.js +1 -0
  58. package/package.json +12 -20
  59. package/schemas/WebpackOptions.json +2 -6
  60. package/schemas/ajv.absolutePath.js +55 -55
  61. package/schemas/plugins/BannerPlugin.json +96 -96
  62. package/schemas/plugins/DllPlugin.json +32 -32
  63. package/schemas/plugins/DllReferencePlugin.json +99 -99
  64. package/schemas/plugins/HashedModuleIdsPlugin.json +24 -24
  65. package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
  66. package/schemas/plugins/SourceMapDevToolPlugin.json +187 -187
  67. package/schemas/plugins/WatchIgnorePlugin.json +16 -16
  68. package/schemas/plugins/debug/ProfilingPlugin.json +12 -12
  69. package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +22 -22
  70. package/schemas/plugins/optimize/LimitChunkCountPlugin.json +15 -15
  71. package/schemas/plugins/optimize/MinChunkSizePlugin.json +13 -13
package/lib/Generator.js CHANGED
@@ -4,9 +4,10 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
- /** @typedef {import("./Module")} Module */
7
+ /** @typedef {import("./NormalModule")} NormalModule */
8
8
  /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
9
9
  /** @typedef {import("webpack-sources").Source} Source */
10
+ /** @typedef {import("./Dependency").DependencyTemplate} DependencyTemplate */
10
11
 
11
12
  /**
12
13
  *
@@ -18,8 +19,8 @@ class Generator {
18
19
 
19
20
  /**
20
21
  * @abstract
21
- * @param {Module} module module for which the code should be generated
22
- * @param {Map<Function, TODO>} dependencyTemplates mapping from dependencies to templates
22
+ * @param {NormalModule} module module for which the code should be generated
23
+ * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
23
24
  * @param {RuntimeTemplate} runtimeTemplate the runtime template
24
25
  * @param {string} type which kind of code should be generated
25
26
  * @returns {Source} generated code
@@ -35,6 +36,13 @@ class ByTypeGenerator extends Generator {
35
36
  this.map = map;
36
37
  }
37
38
 
39
+ /**
40
+ * @param {NormalModule} module module for which the code should be generated
41
+ * @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
42
+ * @param {RuntimeTemplate} runtimeTemplate the runtime template
43
+ * @param {string} type which kind of code should be generated
44
+ * @returns {Source} generated code
45
+ */
38
46
  generate(module, dependencyTemplates, runtimeTemplate, type) {
39
47
  const generator = this.map[type];
40
48
  if (!generator) {
@@ -285,11 +285,7 @@ module.exports = class HotModuleReplacementPlugin {
285
285
  compilation.assets[filename] = source;
286
286
  hotUpdateMainContent.c[chunkId] = true;
287
287
  currentChunk.files.push(filename);
288
- compilation.hooks.chunkAsset.call(
289
- "HotModuleReplacementPlugin",
290
- currentChunk,
291
- filename
292
- );
288
+ compilation.hooks.chunkAsset.call(currentChunk, filename);
293
289
  }
294
290
  } else {
295
291
  hotUpdateMainContent.c[chunkId] = false;
@@ -1,5 +1,5 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- module.exports = require("memory-fs");
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ module.exports = require("memory-fs");
package/lib/Module.js CHANGED
@@ -14,6 +14,7 @@ const Template = require("./Template");
14
14
  /** @typedef {import("./Chunk")} Chunk */
15
15
  /** @typedef {import("./RequestShortener")} RequestShortener */
16
16
  /** @typedef {import("./WebpackError")} WebpackError */
17
+ /** @typedef {import("./util/createHash").Hash} Hash */
17
18
 
18
19
  const EMPTY_RESOLVE_OPTIONS = {};
19
20
 
@@ -298,6 +299,10 @@ class Module extends DependenciesBlock {
298
299
  return true;
299
300
  }
300
301
 
302
+ /**
303
+ * @param {Hash} hash the hash used to track dependencies
304
+ * @returns {void}
305
+ */
301
306
  updateHash(hash) {
302
307
  hash.update(`${this.id}`);
303
308
  hash.update(JSON.stringify(this.usedExports));
@@ -339,17 +344,35 @@ class Module extends DependenciesBlock {
339
344
  // TODO remove in webpack 5
340
345
  Object.defineProperty(Module.prototype, "forEachChunk", {
341
346
  configurable: false,
342
- value: util.deprecate(function(fn) {
343
- this._chunks.forEach(fn);
344
- }, "Module.forEachChunk: Use for(const chunk of module.chunksIterable) instead")
347
+ value: util.deprecate(
348
+ /**
349
+ * @deprecated
350
+ * @param {function(any, any, Set<any>): void} fn callback function
351
+ * @returns {void}
352
+ * @this {Module}
353
+ */
354
+ function(fn) {
355
+ this._chunks.forEach(fn);
356
+ },
357
+ "Module.forEachChunk: Use for(const chunk of module.chunksIterable) instead"
358
+ )
345
359
  });
346
360
 
347
361
  // TODO remove in webpack 5
348
362
  Object.defineProperty(Module.prototype, "mapChunks", {
349
363
  configurable: false,
350
- value: util.deprecate(function(fn) {
351
- return Array.from(this._chunks, fn);
352
- }, "Module.mapChunks: Use Array.from(module.chunksIterable, fn) instead")
364
+ value: util.deprecate(
365
+ /**
366
+ * @deprecated
367
+ * @param {function(any, any): void} fn Mapper function
368
+ * @returns {Array<TODO>} Array of chunks mapped
369
+ * @this {Module}
370
+ */
371
+ function(fn) {
372
+ return Array.from(this._chunks, fn);
373
+ },
374
+ "Module.mapChunks: Use Array.from(module.chunksIterable, fn) instead"
375
+ )
353
376
  });
354
377
 
355
378
  // TODO remove in webpack 5
@@ -366,12 +389,29 @@ Object.defineProperty(Module.prototype, "entry", {
366
389
  // TODO remove in webpack 5
367
390
  Object.defineProperty(Module.prototype, "meta", {
368
391
  configurable: false,
369
- get: util.deprecate(function() {
370
- return this.buildMeta;
371
- }, "Module.meta was renamed to Module.buildMeta"),
372
- set: util.deprecate(function(value) {
373
- this.buildMeta = value;
374
- }, "Module.meta was renamed to Module.buildMeta")
392
+ get: util.deprecate(
393
+ /**
394
+ * @deprecated
395
+ * @returns {void}
396
+ * @this {Module}
397
+ */
398
+ function() {
399
+ return this.buildMeta;
400
+ },
401
+ "Module.meta was renamed to Module.buildMeta"
402
+ ),
403
+ set: util.deprecate(
404
+ /**
405
+ * @deprecated
406
+ * @param {TODO} value Value
407
+ * @returns {void}
408
+ * @this {Module}
409
+ */
410
+ function(value) {
411
+ this.buildMeta = value;
412
+ },
413
+ "Module.meta was renamed to Module.buildMeta"
414
+ )
375
415
  });
376
416
 
377
417
  /** @type {function(): string} */
@@ -8,6 +8,8 @@ const Module = require("./Module");
8
8
  const Template = require("./Template");
9
9
  const { RawSource } = require("webpack-sources");
10
10
 
11
+ /** @typedef {import("./util/createHash").Hash} Hash */
12
+
11
13
  class MultiModule extends Module {
12
14
  constructor(context, dependencies, name) {
13
15
  super("javascript/dynamic", context);
@@ -45,6 +47,10 @@ class MultiModule extends Module {
45
47
  return 16 + this.dependencies.length * 12;
46
48
  }
47
49
 
50
+ /**
51
+ * @param {Hash} hash the hash used to track dependencies
52
+ * @returns {void}
53
+ */
48
54
  updateHash(hash) {
49
55
  hash.update("multi module");
50
56
  hash.update(this.name || "");
@@ -108,6 +108,24 @@ class NodeStuffPlugin {
108
108
  "require.extensions is not supported by webpack. Use a loader instead."
109
109
  )
110
110
  );
111
+ parser.hooks.expression
112
+ .for("require.main.require")
113
+ .tap(
114
+ "NodeStuffPlugin",
115
+ ParserHelpers.expressionIsUnsupported(
116
+ parser,
117
+ "require.main.require is not supported by webpack."
118
+ )
119
+ );
120
+ parser.hooks.expression
121
+ .for("module.parent.require")
122
+ .tap(
123
+ "NodeStuffPlugin",
124
+ ParserHelpers.expressionIsUnsupported(
125
+ parser,
126
+ "module.parent.require is not supported by webpack."
127
+ )
128
+ );
111
129
  parser.hooks.expression
112
130
  .for("module.loaded")
113
131
  .tap("NodeStuffPlugin", expr => {
@@ -24,6 +24,8 @@ const ModuleWarning = require("./ModuleWarning");
24
24
  const createHash = require("./util/createHash");
25
25
  const contextify = require("./util/identifier").contextify;
26
26
 
27
+ /** @typedef {import("./util/createHash").Hash} Hash */
28
+
27
29
  const asString = buf => {
28
30
  if (Buffer.isBuffer(buf)) {
29
31
  return buf.toString("utf-8");
@@ -527,6 +529,10 @@ class NormalModule extends Module {
527
529
  return this._source ? this._source.size() : -1;
528
530
  }
529
531
 
532
+ /**
533
+ * @param {Hash} hash the hash used to track dependencies
534
+ * @returns {void}
535
+ */
530
536
  updateHash(hash) {
531
537
  hash.update(this._buildHash);
532
538
  super.updateHash(hash);
@@ -1,12 +1,12 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- "use strict";
6
-
7
- class NullFactory {
8
- create(data, callback) {
9
- return callback();
10
- }
11
- }
12
- module.exports = NullFactory;
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ class NullFactory {
8
+ create(data, callback) {
9
+ return callback();
10
+ }
11
+ }
12
+ module.exports = NullFactory;
@@ -1,10 +1,10 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- "use strict";
6
-
7
- class OptionsApply {
8
- process(options, compiler) {}
9
- }
10
- module.exports = OptionsApply;
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ class OptionsApply {
8
+ process(options, compiler) {}
9
+ }
10
+ module.exports = OptionsApply;
package/lib/Parser.js CHANGED
@@ -2185,9 +2185,18 @@ class Parser extends Tapable {
2185
2185
  // TODO remove in webpack 5
2186
2186
  Object.defineProperty(Parser.prototype, "getCommentOptions", {
2187
2187
  configurable: false,
2188
- value: util.deprecate(function(range) {
2189
- return this.parseCommentOptions(range).options;
2190
- }, "Parser.getCommentOptions: Use Parser.parseCommentOptions(range) instead")
2188
+ value: util.deprecate(
2189
+ /**
2190
+ * @deprecated
2191
+ * @param {TODO} range Range
2192
+ * @returns {void}
2193
+ * @this {Parser}
2194
+ */
2195
+ function(range) {
2196
+ return this.parseCommentOptions(range).options;
2197
+ },
2198
+ "Parser.getCommentOptions: Use Parser.parseCommentOptions(range) instead"
2199
+ )
2191
2200
  });
2192
2201
 
2193
2202
  module.exports = Parser;
@@ -6,6 +6,8 @@
6
6
 
7
7
  const Template = require("./Template");
8
8
 
9
+ /** @typedef {import("./Module")} Module */
10
+
9
11
  module.exports = class RuntimeTemplate {
10
12
  constructor(outputOptions, requestShortener) {
11
13
  this.outputOptions = outputOptions || {};
@@ -188,6 +190,16 @@ module.exports = class RuntimeTemplate {
188
190
  return `${promise || "Promise.resolve()"}.then(${getModuleFunction})`;
189
191
  }
190
192
 
193
+ /**
194
+ *
195
+ * @param {Object} options options object
196
+ * @param {boolean=} options.update whether a new variable should be created or the existing one updated
197
+ * @param {Module} options.module the module
198
+ * @param {string} options.request the request that should be printed as comment
199
+ * @param {string} options.importVar name of the import variable
200
+ * @param {Module} options.originModule module in which the statement is emitted
201
+ * @returns {string} the import statement
202
+ */
191
203
  importStatement({ update, module, request, importVar, originModule }) {
192
204
  if (!module) {
193
205
  return this.missingModuleStatement({
package/lib/Stats.js CHANGED
@@ -8,6 +8,7 @@ const RequestShortener = require("./RequestShortener");
8
8
  const SizeFormatHelpers = require("./SizeFormatHelpers");
9
9
  const formatLocation = require("./formatLocation");
10
10
  const identifierUtils = require("./util/identifier");
11
+ const compareLocations = require("./compareLocations");
11
12
 
12
13
  const optionsOrFallback = (...args) => {
13
14
  let optionValues = [];
@@ -523,6 +524,23 @@ class Stats {
523
524
  }
524
525
  if (showReasons) {
525
526
  obj.reasons = module.reasons
527
+ .sort((a, b) => {
528
+ if (a.module && !b.module) return -1;
529
+ if (!a.module && b.module) return 1;
530
+ if (a.module && b.module) {
531
+ const cmp = compareId(a.module.id, b.module.id);
532
+ if (cmp) return cmp;
533
+ }
534
+ if (a.dependency && !b.dependency) return -1;
535
+ if (!a.dependency && b.dependency) return 1;
536
+ if (a.dependency && b.dependency) {
537
+ const cmp = compareLocations(a.dependency.loc, b.dependency.loc);
538
+ if (cmp) return cmp;
539
+ if (a.dependency.type < b.dependency.type) return -1;
540
+ if (a.dependency.type > b.dependency.type) return 1;
541
+ }
542
+ return 0;
543
+ })
526
544
  .map(reason => {
527
545
  const obj = {
528
546
  moduleId: reason.module ? reason.module.id : null,
@@ -548,8 +566,7 @@ class Stats {
548
566
  }
549
567
  }
550
568
  return obj;
551
- })
552
- .sort(compareId);
569
+ });
553
570
  }
554
571
  if (showUsedExports) {
555
572
  if (module.used === true) {
package/lib/Template.js CHANGED
@@ -27,7 +27,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
27
27
  /**
28
28
  * @typedef {Object} HasId
29
29
  * @property {number | string} id
30
- * */
30
+ */
31
31
 
32
32
  /**
33
33
  * @typedef {function(Module, number): boolean} ModuleFilterPredicate
@@ -39,8 +39,8 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
39
39
  * @returns {-1|0|1} the sort value
40
40
  */
41
41
  const stringifyIdSortPredicate = (a, b) => {
42
- var aId = a.id + "";
43
- var bId = b.id + "";
42
+ const aId = a.id + "";
43
+ const bId = b.id + "";
44
44
  if (aId < bId) return -1;
45
45
  if (aId > bId) return 1;
46
46
  return 0;
@@ -59,6 +59,7 @@ class Template {
59
59
  .replace(INDENT_MULTILINE_REGEX, "")
60
60
  .replace(LINE_SEPARATOR_REGEX, "\n");
61
61
  }
62
+
62
63
  /**
63
64
  * @param {string} str the string converted to identifier
64
65
  * @returns {string} created identifier
@@ -128,31 +129,28 @@ class Template {
128
129
 
129
130
  /**
130
131
  *
131
- * @param {string | string[]} str string to convert to identity
132
+ * @param {string | string[]} s string to convert to identity
132
133
  * @returns {string} converted identity
133
134
  */
134
- static indent(str) {
135
- if (Array.isArray(str)) {
136
- return str.map(Template.indent).join("\n");
135
+ static indent(s) {
136
+ if (Array.isArray(s)) {
137
+ return s.map(Template.indent).join("\n");
137
138
  } else {
138
- str = str.trimRight();
139
+ const str = s.trimRight();
139
140
  if (!str) return "";
140
- var ind = str[0] === "\n" ? "" : "\t";
141
+ const ind = str[0] === "\n" ? "" : "\t";
141
142
  return ind + str.replace(/\n([^\n])/g, "\n\t$1");
142
143
  }
143
144
  }
144
145
 
145
146
  /**
146
147
  *
147
- * @param {string|string[]} str string to create prefix for
148
+ * @param {string|string[]} s string to create prefix for
148
149
  * @param {string} prefix prefix to compose
149
150
  * @returns {string} returns new prefix string
150
151
  */
151
- static prefix(str, prefix) {
152
- if (Array.isArray(str)) {
153
- str = str.join("\n");
154
- }
155
- str = str.trim();
152
+ static prefix(s, prefix) {
153
+ const str = Template.asString(s).trim();
156
154
  if (!str) return "";
157
155
  const ind = str[0] === "\n" ? "" : prefix;
158
156
  return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
@@ -181,8 +179,8 @@ class Template {
181
179
  * or false if not every module has a number based id
182
180
  */
183
181
  static getModulesArrayBounds(modules) {
184
- var maxId = -Infinity;
185
- var minId = Infinity;
182
+ let maxId = -Infinity;
183
+ let minId = Infinity;
186
184
  for (const module of modules) {
187
185
  if (typeof module.id !== "number") return false;
188
186
  if (maxId < module.id) maxId = /** @type {number} */ (module.id);
@@ -192,15 +190,11 @@ class Template {
192
190
  // add minId x ',' instead of 'Array(minId).concat(…)'
193
191
  minId = 0;
194
192
  }
195
- var objectOverhead = modules
196
- .map(module => {
197
- var idLength = (module.id + "").length;
198
- return idLength + 2;
199
- })
200
- .reduce((a, b) => {
201
- return a + b;
202
- }, -1);
203
- var arrayOverhead = minId === 0 ? maxId : 16 + ("" + minId).length + maxId;
193
+ const objectOverhead = modules
194
+ .map(module => (module.id + "").length + 2)
195
+ .reduce((a, b) => a + b, -1);
196
+ const arrayOverhead =
197
+ minId === 0 ? maxId : 16 + ("" + minId).length + maxId;
204
198
  return arrayOverhead < objectOverhead ? [minId, maxId] : false;
205
199
  }
206
200
 
@@ -217,13 +211,13 @@ class Template {
217
211
  filterFn,
218
212
  moduleTemplate,
219
213
  dependencyTemplates,
220
- prefix
214
+ prefix = ""
221
215
  ) {
222
- if (!prefix) prefix = "";
223
- var source = new ConcatSource();
216
+ const source = new ConcatSource();
224
217
  const modules = chunk.getModules().filter(filterFn);
218
+ let removedModules;
225
219
  if (chunk instanceof HotUpdateChunk) {
226
- var removedModules = chunk.removedModules;
220
+ removedModules = chunk.removedModules;
227
221
  }
228
222
  if (
229
223
  modules.length === 0 &&
@@ -233,7 +227,7 @@ class Template {
233
227
  return source;
234
228
  }
235
229
  /** @type {{id: string|number, source: Source|string}[]} */
236
- var allModules = modules.map(module => {
230
+ const allModules = modules.map(module => {
237
231
  return {
238
232
  id: module.id,
239
233
  source: moduleTemplate.render(module, dependencyTemplates, {
@@ -249,38 +243,45 @@ class Template {
249
243
  });
250
244
  }
251
245
  }
252
- var bounds = Template.getModulesArrayBounds(allModules);
253
-
246
+ const bounds = Template.getModulesArrayBounds(allModules);
254
247
  if (bounds) {
255
248
  // Render a spare array
256
- var minId = bounds[0];
257
- var maxId = bounds[1];
258
- if (minId !== 0) source.add("Array(" + minId + ").concat(");
249
+ const minId = bounds[0];
250
+ const maxId = bounds[1];
251
+ if (minId !== 0) {
252
+ source.add(`Array(${minId}).concat(`);
253
+ }
259
254
  source.add("[\n");
260
255
  const modules = new Map();
261
256
  for (const module of allModules) {
262
257
  modules.set(module.id, module);
263
258
  }
264
- for (var idx = minId; idx <= maxId; idx++) {
265
- var module = modules.get(idx);
266
- if (idx !== minId) source.add(",\n");
267
- source.add("/* " + idx + " */");
259
+ for (let idx = minId; idx <= maxId; idx++) {
260
+ const module = modules.get(idx);
261
+ if (idx !== minId) {
262
+ source.add(",\n");
263
+ }
264
+ source.add(`/* ${idx} */`);
268
265
  if (module) {
269
266
  source.add("\n");
270
267
  source.add(module.source);
271
268
  }
272
269
  }
273
270
  source.add("\n" + prefix + "]");
274
- if (minId !== 0) source.add(")");
271
+ if (minId !== 0) {
272
+ source.add(")");
273
+ }
275
274
  } else {
276
275
  // Render an object
277
276
  source.add("{\n");
278
277
  allModules.sort(stringifyIdSortPredicate).forEach((module, idx) => {
279
- if (idx !== 0) source.add(",\n");
278
+ if (idx !== 0) {
279
+ source.add(",\n");
280
+ }
280
281
  source.add(`\n/***/ ${JSON.stringify(module.id)}:\n`);
281
282
  source.add(module.source);
282
283
  });
283
- source.add("\n\n" + prefix + "}");
284
+ source.add(`\n\n${prefix}}`);
284
285
  }
285
286
  return source;
286
287
  }
@@ -7,24 +7,6 @@
7
7
  const validateOptions = require("schema-utils");
8
8
  const schema = require("../schemas/plugins/WatchIgnorePlugin.json");
9
9
 
10
- class WatchIgnorePlugin {
11
- constructor(paths) {
12
- validateOptions(schema, paths, "Watch Ignore Plugin");
13
- this.paths = paths;
14
- }
15
-
16
- apply(compiler) {
17
- compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => {
18
- compiler.watchFileSystem = new IgnoringWatchFileSystem(
19
- compiler.watchFileSystem,
20
- this.paths
21
- );
22
- });
23
- }
24
- }
25
-
26
- module.exports = WatchIgnorePlugin;
27
-
28
10
  class IgnoringWatchFileSystem {
29
11
  constructor(wfs, paths) {
30
12
  this.wfs = wfs;
@@ -98,3 +80,21 @@ class IgnoringWatchFileSystem {
98
80
  };
99
81
  }
100
82
  }
83
+
84
+ class WatchIgnorePlugin {
85
+ constructor(paths) {
86
+ validateOptions(schema, paths, "Watch Ignore Plugin");
87
+ this.paths = paths;
88
+ }
89
+
90
+ apply(compiler) {
91
+ compiler.hooks.afterEnvironment.tap("WatchIgnorePlugin", () => {
92
+ compiler.watchFileSystem = new IgnoringWatchFileSystem(
93
+ compiler.watchFileSystem,
94
+ this.paths
95
+ );
96
+ });
97
+ }
98
+ }
99
+
100
+ module.exports = WatchIgnorePlugin;
@@ -5,7 +5,7 @@ const schema = require("../../schemas/plugins/debug/ProfilingPlugin.json");
5
5
  let inspector = undefined;
6
6
 
7
7
  try {
8
- // eslint-disable-next-line node/no-missing-require
8
+ // eslint-disable-next-line node/no-unsupported-features/node-builtins
9
9
  inspector = require("inspector");
10
10
  } catch (e) {
11
11
  console.log("Unable to CPU profile in < node 8.0");
@@ -1,22 +1,22 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- "use strict";
6
- const ModuleDependency = require("./ModuleDependency");
7
- const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
8
-
9
- class AMDRequireItemDependency extends ModuleDependency {
10
- constructor(request, range) {
11
- super(request);
12
- this.range = range;
13
- }
14
-
15
- get type() {
16
- return "amd require";
17
- }
18
- }
19
-
20
- AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId;
21
-
22
- module.exports = AMDRequireItemDependency;
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+ const ModuleDependency = require("./ModuleDependency");
7
+ const ModuleDependencyTemplateAsRequireId = require("./ModuleDependencyTemplateAsRequireId");
8
+
9
+ class AMDRequireItemDependency extends ModuleDependency {
10
+ constructor(request, range) {
11
+ super(request);
12
+ this.range = range;
13
+ }
14
+
15
+ get type() {
16
+ return "amd require";
17
+ }
18
+ }
19
+
20
+ AMDRequireItemDependency.Template = ModuleDependencyTemplateAsRequireId;
21
+
22
+ module.exports = AMDRequireItemDependency;