webpack 4.15.1 → 4.16.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 (45) hide show
  1. package/hot/dev-server.js +2 -2
  2. package/hot/only-dev-server.js +2 -2
  3. package/hot/poll.js +5 -2
  4. package/hot/signal.js +2 -2
  5. package/lib/AutomaticPrefetchPlugin.js +1 -1
  6. package/lib/Chunk.js +3 -3
  7. package/lib/ChunkGroup.js +1 -1
  8. package/lib/CommentCompilationWarning.js +2 -2
  9. package/lib/CompatibilityPlugin.js +1 -1
  10. package/lib/Compilation.js +7 -4
  11. package/lib/ContextModule.js +20 -1
  12. package/lib/DelegatedModuleFactoryPlugin.js +7 -1
  13. package/lib/Dependency.js +10 -4
  14. package/lib/Entrypoint.js +1 -1
  15. package/lib/EnvironmentPlugin.js +8 -1
  16. package/lib/Generator.js +1 -1
  17. package/lib/HotModuleReplacementPlugin.js +1 -1
  18. package/lib/IgnorePlugin.js +1 -1
  19. package/lib/SingleEntryPlugin.js +6 -1
  20. package/lib/Stats.js +10 -4
  21. package/lib/UseStrictPlugin.js +1 -1
  22. package/lib/WebpackOptionsApply.js +92 -10
  23. package/lib/WebpackOptionsDefaulter.js +20 -6
  24. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -1
  25. package/lib/dependencies/LoaderPlugin.js +18 -1
  26. package/lib/dependencies/SystemPlugin.js +1 -1
  27. package/lib/formatLocation.js +55 -41
  28. package/lib/node/NodeMainTemplatePlugin.js +2 -2
  29. package/lib/node/NodeSourcePlugin.js +1 -1
  30. package/lib/optimize/NaturalChunkOrderPlugin.js +41 -0
  31. package/lib/optimize/OccurrenceChunkOrderPlugin.js +61 -0
  32. package/lib/optimize/OccurrenceModuleOrderPlugin.js +103 -0
  33. package/lib/optimize/OccurrenceOrderPlugin.js +2 -0
  34. package/lib/optimize/SplitChunksPlugin.js +26 -16
  35. package/lib/util/cachedMerge.js +1 -1
  36. package/lib/util/deterministicGrouping.js +1 -1
  37. package/lib/wasm/WasmFinalizeExportsPlugin.js +1 -1
  38. package/lib/web/JsonpMainTemplatePlugin.js +1 -1
  39. package/lib/web/WebEnvironmentPlugin.js +18 -18
  40. package/lib/webpack.js +4 -0
  41. package/lib/webworker/WebWorkerMainTemplatePlugin.js +1 -1
  42. package/package.json +14 -5
  43. package/schemas/WebpackOptions.json +33 -3
  44. package/schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json +10 -0
  45. package/schemas/plugins/optimize/OccurrenceOrderModuleIdsPlugin.json +10 -0
@@ -72,7 +72,7 @@ class SystemPlugin {
72
72
  parser.hooks.expression.for("System").tap("SystemPlugin", () => {
73
73
  const systemPolyfillRequire = ParserHelpers.requireFileAsExpression(
74
74
  parser.state.module.context,
75
- require.resolve("../../buildin/system.js")
75
+ require.resolve("../../buildin/system")
76
76
  );
77
77
  return ParserHelpers.addParsedVariableToModule(
78
78
  parser,
@@ -5,57 +5,71 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
9
+ /** @typedef {import("./Dependency").SourcePosition} SourcePosition */
10
+
11
+ // TODO webpack 5: pos must be SourcePosition
12
+ /**
13
+ * @param {SourcePosition|DependencyLocation|string} pos position
14
+ * @returns {string} formatted position
15
+ */
8
16
  const formatPosition = pos => {
9
17
  if (pos === null) return "";
10
- const typeOfPos = typeof pos;
11
- switch (typeOfPos) {
12
- case "string":
13
- return pos;
14
- case "number":
15
- return `${pos}`;
16
- case "object":
17
- if (typeof pos.line === "number" && typeof pos.column === "number") {
18
- return `${pos.line}:${pos.column}`;
19
- } else if (typeof pos.line === "number") {
20
- return `${pos.line}:?`;
21
- } else if (typeof pos.index === "number") {
22
- return `+${pos.index}`;
23
- } else {
24
- return "";
25
- }
26
- default:
18
+ // TODO webpack 5: Simplify this
19
+ if (typeof pos === "string") return pos;
20
+ if (typeof pos === "number") return `${pos}`;
21
+ if (typeof pos === "object") {
22
+ if ("line" in pos && "column" in pos) {
23
+ return `${pos.line}:${pos.column}`;
24
+ } else if ("line" in pos) {
25
+ return `${pos.line}:?`;
26
+ } else if ("index" in pos) {
27
+ // TODO webpack 5 remove this case
28
+ return `+${pos.index}`;
29
+ } else {
27
30
  return "";
31
+ }
28
32
  }
33
+ return "";
29
34
  };
30
35
 
36
+ // TODO webpack 5: loc must be DependencyLocation
37
+ /**
38
+ * @param {DependencyLocation|SourcePosition|string} loc location
39
+ * @returns {string} formatted location
40
+ */
31
41
  const formatLocation = loc => {
32
42
  if (loc === null) return "";
33
- const typeOfLoc = typeof loc;
34
- switch (typeOfLoc) {
35
- case "string":
36
- return loc;
37
- case "number":
38
- return `${loc}`;
39
- case "object":
40
- if (loc.start && loc.end) {
41
- if (
42
- typeof loc.start.line === "number" &&
43
- typeof loc.end.line === "number" &&
44
- typeof loc.end.column === "number" &&
45
- loc.start.line === loc.end.line
46
- ) {
47
- return `${formatPosition(loc.start)}-${loc.end.column}`;
48
- } else {
49
- return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
50
- }
51
- }
52
- if (loc.start) {
53
- return formatPosition(loc.start);
43
+ // TODO webpack 5: Simplify this
44
+ if (typeof loc === "string") return loc;
45
+ if (typeof loc === "number") return `${loc}`;
46
+ if (typeof loc === "object") {
47
+ if ("start" in loc && loc.start && "end" in loc && loc.end) {
48
+ if (
49
+ typeof loc.start === "object" &&
50
+ typeof loc.start.line === "number" &&
51
+ typeof loc.end === "object" &&
52
+ typeof loc.end.line === "number" &&
53
+ typeof loc.end.column === "number" &&
54
+ loc.start.line === loc.end.line
55
+ ) {
56
+ return `${formatPosition(loc.start)}-${loc.end.column}`;
57
+ } else {
58
+ return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
54
59
  }
55
- return formatPosition(loc);
56
- default:
57
- return "";
60
+ }
61
+ if ("start" in loc && loc.start) {
62
+ return formatPosition(loc.start);
63
+ }
64
+ if ("name" in loc && "index" in loc) {
65
+ return `${loc.name}[${loc.index}]`;
66
+ }
67
+ if ("name" in loc) {
68
+ return loc.name;
69
+ }
70
+ return formatPosition(loc);
58
71
  }
72
+ return "";
59
73
  };
60
74
 
61
75
  module.exports = formatLocation;
@@ -305,8 +305,8 @@ module.exports = class NodeMainTemplatePlugin {
305
305
  );
306
306
  return Template.getFunctionContent(
307
307
  asyncChunkLoading
308
- ? require("./NodeMainTemplateAsync.runtime.js")
309
- : require("./NodeMainTemplate.runtime.js")
308
+ ? require("./NodeMainTemplateAsync.runtime")
309
+ : require("./NodeMainTemplate.runtime")
310
310
  )
311
311
  .replace(/\$require\$/g, mainTemplate.requireFn)
312
312
  .replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
@@ -71,7 +71,7 @@ module.exports = class NodeSourcePlugin {
71
71
  .tap("NodeSourcePlugin", () => {
72
72
  const retrieveGlobalModule = ParserHelpers.requireFileAsExpression(
73
73
  parser.state.module.context,
74
- require.resolve("../../buildin/global.js")
74
+ require.resolve("../../buildin/global")
75
75
  );
76
76
  return ParserHelpers.addParsedVariableToModule(
77
77
  parser,
@@ -0,0 +1,41 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ /** @typedef {import("../Compiler")} Compiler */
8
+
9
+ class NaturalChunkOrderPlugin {
10
+ /**
11
+ * @param {Compiler} compiler webpack compiler
12
+ * @returns {void}
13
+ */
14
+ apply(compiler) {
15
+ compiler.hooks.compilation.tap("NaturalChunkOrderPlugin", compilation => {
16
+ compilation.hooks.optimizeChunkOrder.tap(
17
+ "NaturalChunkOrderPlugin",
18
+ chunks => {
19
+ chunks.sort((chunkA, chunkB) => {
20
+ const a = chunkA.modulesIterable[Symbol.iterator]();
21
+ const b = chunkB.modulesIterable[Symbol.iterator]();
22
+ // eslint-disable-next-line no-constant-condition
23
+ while (true) {
24
+ const aItem = a.next();
25
+ const bItem = b.next();
26
+ if (aItem.done && bItem.done) return 0;
27
+ if (aItem.done) return -1;
28
+ if (bItem.done) return 1;
29
+ const aModuleId = aItem.value.id;
30
+ const bModuleId = bItem.value.id;
31
+ if (aModuleId < bModuleId) return -1;
32
+ if (aModuleId > bModuleId) return 1;
33
+ }
34
+ });
35
+ }
36
+ );
37
+ });
38
+ }
39
+ }
40
+
41
+ module.exports = NaturalChunkOrderPlugin;
@@ -0,0 +1,61 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ const validateOptions = require("schema-utils");
8
+ const schema = require("../../schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json");
9
+
10
+ class OccurrenceOrderChunkIdsPlugin {
11
+ constructor(options = {}) {
12
+ validateOptions(schema, options, "Occurrence Order Chunk Ids Plugin");
13
+ this.options = options;
14
+ }
15
+
16
+ apply(compiler) {
17
+ const prioritiseInitial = this.options.prioritiseInitial;
18
+ compiler.hooks.compilation.tap(
19
+ "OccurrenceOrderChunkIdsPlugin",
20
+ compilation => {
21
+ compilation.hooks.optimizeChunkOrder.tap(
22
+ "OccurrenceOrderChunkIdsPlugin",
23
+ chunks => {
24
+ const occursInInitialChunksMap = new Map();
25
+ const originalOrder = new Map();
26
+
27
+ let i = 0;
28
+ for (const c of chunks) {
29
+ let occurs = 0;
30
+ for (const chunkGroup of c.groupsIterable) {
31
+ for (const parent of chunkGroup.parentsIterable) {
32
+ if (parent.isInitial()) occurs++;
33
+ }
34
+ }
35
+ occursInInitialChunksMap.set(c, occurs);
36
+ originalOrder.set(c, i++);
37
+ }
38
+
39
+ chunks.sort((a, b) => {
40
+ if (prioritiseInitial) {
41
+ const aEntryOccurs = occursInInitialChunksMap.get(a);
42
+ const bEntryOccurs = occursInInitialChunksMap.get(b);
43
+ if (aEntryOccurs > bEntryOccurs) return -1;
44
+ if (aEntryOccurs < bEntryOccurs) return 1;
45
+ }
46
+ const aOccurs = a.getNumberOfGroups();
47
+ const bOccurs = b.getNumberOfGroups();
48
+ if (aOccurs > bOccurs) return -1;
49
+ if (aOccurs < bOccurs) return 1;
50
+ const orgA = originalOrder.get(a);
51
+ const orgB = originalOrder.get(b);
52
+ return orgB - orgA;
53
+ });
54
+ }
55
+ );
56
+ }
57
+ );
58
+ }
59
+ }
60
+
61
+ module.exports = OccurrenceOrderChunkIdsPlugin;
@@ -0,0 +1,103 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ const validateOptions = require("schema-utils");
8
+ const schema = require("../../schemas/plugins/optimize/OccurrenceOrderModuleIdsPlugin.json");
9
+
10
+ class OccurrenceOrderModuleIdsPlugin {
11
+ constructor(options = {}) {
12
+ validateOptions(schema, options, "Occurrence Order Module Ids Plugin");
13
+ this.options = options;
14
+ }
15
+
16
+ apply(compiler) {
17
+ const prioritiseInitial = this.options.prioritiseInitial;
18
+ compiler.hooks.compilation.tap(
19
+ "OccurrenceOrderModuleIdsPlugin",
20
+ compilation => {
21
+ compilation.hooks.optimizeModuleOrder.tap(
22
+ "OccurrenceOrderModuleIdsPlugin",
23
+ modules => {
24
+ const occursInInitialChunksMap = new Map();
25
+ const occursInAllChunksMap = new Map();
26
+
27
+ const initialChunkChunkMap = new Map();
28
+ const entryCountMap = new Map();
29
+ for (const m of modules) {
30
+ let initial = 0;
31
+ let entry = 0;
32
+ for (const c of m.chunksIterable) {
33
+ if (c.canBeInitial()) initial++;
34
+ if (c.entryModule === m) entry++;
35
+ }
36
+ initialChunkChunkMap.set(m, initial);
37
+ entryCountMap.set(m, entry);
38
+ }
39
+
40
+ const countOccursInEntry = (sum, r) => {
41
+ if (!r.module) {
42
+ return sum;
43
+ }
44
+ return sum + initialChunkChunkMap.get(r.module);
45
+ };
46
+ const countOccurs = (sum, r) => {
47
+ if (!r.module) {
48
+ return sum;
49
+ }
50
+ let factor = 1;
51
+ if (typeof r.dependency.getNumberOfIdOccurrences === "function") {
52
+ factor = r.dependency.getNumberOfIdOccurrences();
53
+ }
54
+ if (factor === 0) {
55
+ return sum;
56
+ }
57
+ return sum + factor * r.module.getNumberOfChunks();
58
+ };
59
+
60
+ if (prioritiseInitial) {
61
+ for (const m of modules) {
62
+ const result =
63
+ m.reasons.reduce(countOccursInEntry, 0) +
64
+ initialChunkChunkMap.get(m) +
65
+ entryCountMap.get(m);
66
+ occursInInitialChunksMap.set(m, result);
67
+ }
68
+ }
69
+
70
+ const originalOrder = new Map();
71
+ let i = 0;
72
+ for (const m of modules) {
73
+ const result =
74
+ m.reasons.reduce(countOccurs, 0) +
75
+ m.getNumberOfChunks() +
76
+ entryCountMap.get(m);
77
+ occursInAllChunksMap.set(m, result);
78
+ originalOrder.set(m, i++);
79
+ }
80
+
81
+ modules.sort((a, b) => {
82
+ if (prioritiseInitial) {
83
+ const aEntryOccurs = occursInInitialChunksMap.get(a);
84
+ const bEntryOccurs = occursInInitialChunksMap.get(b);
85
+ if (aEntryOccurs > bEntryOccurs) return -1;
86
+ if (aEntryOccurs < bEntryOccurs) return 1;
87
+ }
88
+ const aOccurs = occursInAllChunksMap.get(a);
89
+ const bOccurs = occursInAllChunksMap.get(b);
90
+ if (aOccurs > bOccurs) return -1;
91
+ if (aOccurs < bOccurs) return 1;
92
+ const orgA = originalOrder.get(a);
93
+ const orgB = originalOrder.get(b);
94
+ return orgB - orgA;
95
+ });
96
+ }
97
+ );
98
+ }
99
+ );
100
+ }
101
+ }
102
+
103
+ module.exports = OccurrenceOrderModuleIdsPlugin;
@@ -4,6 +4,8 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
+ // TODO webpack 5 remove this plugin
8
+ // It has been splitted into separate plugins for modules and chunks
7
9
  class OccurrenceOrderPlugin {
8
10
  constructor(preferEntry) {
9
11
  if (preferEntry !== undefined && typeof preferEntry !== "boolean") {
@@ -115,15 +115,11 @@ module.exports = class SplitChunksPlugin {
115
115
  minChunks: options.minChunks || 1,
116
116
  maxAsyncRequests: options.maxAsyncRequests || 1,
117
117
  maxInitialRequests: options.maxInitialRequests || 1,
118
- getName:
119
- SplitChunksPlugin.normalizeName({
120
- name: options.name,
121
- automaticNameDelimiter: options.automaticNameDelimiter
122
- }) || (() => {}),
123
118
  hidePathInfo: options.hidePathInfo || false,
124
119
  filename: options.filename || undefined,
125
120
  getCacheGroups: SplitChunksPlugin.normalizeCacheGroups({
126
121
  cacheGroups: options.cacheGroups,
122
+ name: options.name,
127
123
  automaticNameDelimiter: options.automaticNameDelimiter
128
124
  }),
129
125
  automaticNameDelimiter: options.automaticNameDelimiter,
@@ -134,7 +130,7 @@ module.exports = class SplitChunksPlugin {
134
130
  };
135
131
  }
136
132
 
137
- static normalizeName({ name, automaticNameDelimiter }) {
133
+ static normalizeName({ name, automaticNameDelimiter, automaticNamePrefix }) {
138
134
  if (name === true) {
139
135
  /** @type {WeakMap<Chunk[], Record<string, string>>} */
140
136
  const cache = new WeakMap();
@@ -152,10 +148,12 @@ module.exports = class SplitChunksPlugin {
152
148
  return;
153
149
  }
154
150
  names.sort();
155
- let name =
156
- (cacheGroup && cacheGroup !== "default"
157
- ? cacheGroup + automaticNameDelimiter
158
- : "") + names.join(automaticNameDelimiter);
151
+ const prefix =
152
+ typeof automaticNamePrefix === "string"
153
+ ? automaticNamePrefix
154
+ : cacheGroup;
155
+ const namePrefix = prefix ? prefix + automaticNameDelimiter : "";
156
+ let name = namePrefix + names.join(automaticNameDelimiter);
159
157
  // Filenames and paths can't be too long otherwise an
160
158
  // ENAMETOOLONG error is raised. If the generated name if too
161
159
  // long, it is truncated and a hash is appended. The limit has
@@ -212,7 +210,7 @@ module.exports = class SplitChunksPlugin {
212
210
  };
213
211
  }
214
212
 
215
- static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) {
213
+ static normalizeCacheGroups({ cacheGroups, name, automaticNameDelimiter }) {
216
214
  if (typeof cacheGroups === "function") {
217
215
  // TODO webpack 5 remove this
218
216
  if (cacheGroups.length !== 1) {
@@ -251,10 +249,15 @@ module.exports = class SplitChunksPlugin {
251
249
  results.push({
252
250
  key: key,
253
251
  priority: option.priority,
254
- getName: SplitChunksPlugin.normalizeName({
255
- name: option.name,
256
- automaticNameDelimiter
257
- }),
252
+ getName:
253
+ SplitChunksPlugin.normalizeName({
254
+ name: option.name || name,
255
+ automaticNameDelimiter:
256
+ typeof option.automaticNameDelimiter === "string"
257
+ ? option.automaticNameDelimiter
258
+ : automaticNameDelimiter,
259
+ automaticNamePrefix: option.automaticNamePrefix
260
+ }) || (() => {}),
258
261
  chunksFilter: SplitChunksPlugin.normalizeChunksFilter(
259
262
  option.chunks
260
263
  ),
@@ -487,6 +490,12 @@ module.exports = class SplitChunksPlugin {
487
490
  chunksKeys: new Set()
488
491
  })
489
492
  );
493
+ } else {
494
+ if (info.cacheGroup !== cacheGroup) {
495
+ if (info.cacheGroup.priority < cacheGroup.priority) {
496
+ info.cacheGroup = cacheGroup;
497
+ }
498
+ }
490
499
  }
491
500
  info.modules.add(module);
492
501
  info.size += module.size();
@@ -645,7 +654,7 @@ module.exports = class SplitChunksPlugin {
645
654
  isReused = true;
646
655
  }
647
656
  }
648
- // Check if maxRequests condition can be fullfilled
657
+ // Check if maxRequests condition can be fulfilled
649
658
 
650
659
  const usedChunks = Array.from(item.chunks).filter(chunk => {
651
660
  // skip if we address ourself
@@ -831,6 +840,7 @@ module.exports = class SplitChunksPlugin {
831
840
  if (i !== results.length - 1) {
832
841
  newPart = compilation.addChunk(name);
833
842
  chunk.split(newPart);
843
+ newPart.chunkReason = chunk.chunkReason;
834
844
  // Add all modules to the new chunk
835
845
  for (const module of group.items) {
836
846
  if (typeof module.chunkCondition === "function") {
@@ -7,7 +7,7 @@
7
7
  const mergeCache = new WeakMap();
8
8
 
9
9
  /**
10
- * Merges two given objects and caches the result to avoid computation if same objects passed as arguements again.
10
+ * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again.
11
11
  * @example
12
12
  * // performs Object.assign(first, second), stores the result in WeakMap and returns result
13
13
  * cachedMerge({a: 1}, {a: 2})
@@ -186,7 +186,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
186
186
  if (left <= right) {
187
187
  // when there is a area between left and right
188
188
  // we look for best split point
189
- // we split at the minimum similiarity
189
+ // we split at the minimum similarity
190
190
  // here key space is separated the most
191
191
  let best = left - 1;
192
192
  let bestSimilarity = group.similarities[best];
@@ -4,7 +4,7 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
- const UnsupportedWebAssemblyFeatureError = require("../wasm/UnsupportedWebAssemblyFeatureError");
7
+ const UnsupportedWebAssemblyFeatureError = require("./UnsupportedWebAssemblyFeatureError");
8
8
 
9
9
  class WasmFinalizeExportsPlugin {
10
10
  apply(compiler) {
@@ -556,7 +556,7 @@ class JsonpMainTemplatePlugin {
556
556
  }
557
557
  );
558
558
  const runtimeSource = Template.getFunctionContent(
559
- require("./JsonpMainTemplate.runtime.js")
559
+ require("./JsonpMainTemplate.runtime")
560
560
  )
561
561
  .replace(/\/\/\$semicolon/g, ";")
562
562
  .replace(/\$require\$/g, mainTemplate.requireFn)
@@ -1,18 +1,18 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- "use strict";
6
-
7
- class WebEnvironmentPlugin {
8
- constructor(inputFileSystem, outputFileSystem) {
9
- this.inputFileSystem = inputFileSystem;
10
- this.outputFileSystem = outputFileSystem;
11
- }
12
-
13
- apply(compiler) {
14
- compiler.outputFileSystem = this.outputFileSystem;
15
- }
16
- }
17
-
18
- module.exports = WebEnvironmentPlugin;
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ class WebEnvironmentPlugin {
8
+ constructor(inputFileSystem, outputFileSystem) {
9
+ this.inputFileSystem = inputFileSystem;
10
+ this.outputFileSystem = outputFileSystem;
11
+ }
12
+
13
+ apply(compiler) {
14
+ compiler.outputFileSystem = this.outputFileSystem;
15
+ }
16
+ }
17
+
18
+ module.exports = WebEnvironmentPlugin;
package/lib/webpack.js CHANGED
@@ -137,6 +137,10 @@ exportPlugins((exports.optimize = {}), {
137
137
  ModuleConcatenationPlugin: () =>
138
138
  require("./optimize/ModuleConcatenationPlugin"),
139
139
  OccurrenceOrderPlugin: () => require("./optimize/OccurrenceOrderPlugin"),
140
+ OccurrenceModuleOrderPlugin: () =>
141
+ require("./optimize/OccurrenceModuleOrderPlugin"),
142
+ OccurrenceChunkOrderPlugin: () =>
143
+ require("./optimize/OccurrenceChunkOrderPlugin"),
140
144
  RuntimeChunkPlugin: () => require("./optimize/RuntimeChunkPlugin"),
141
145
  SideEffectsFlagPlugin: () => require("./optimize/SideEffectsFlagPlugin"),
142
146
  SplitChunksPlugin: () => require("./optimize/SplitChunksPlugin")
@@ -172,7 +172,7 @@ class WebWorkerMainTemplatePlugin {
172
172
  )}];\n` +
173
173
  `${globalObject}[${JSON.stringify(hotUpdateFunction)}] = ` +
174
174
  Template.getFunctionContent(
175
- require("./WebWorkerMainTemplate.runtime.js")
175
+ require("./WebWorkerMainTemplate.runtime")
176
176
  )
177
177
  .replace(/\/\/\$semicolon/g, ";")
178
178
  .replace(/\$require\$/g, mainTemplate.requireFn)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "istanbul": "^0.4.5",
57
57
  "jade": "^1.11.0",
58
58
  "jade-loader": "~0.8.0",
59
- "jest": "^23.0.1",
59
+ "jest": "^23.3.0",
60
60
  "jest-silent-reporter": "^0.0.5",
61
61
  "json-loader": "^0.5.7",
62
62
  "less": "^2.5.1",
@@ -82,6 +82,14 @@
82
82
  "worker-loader": "^1.1.1",
83
83
  "xxhashjs": "^0.2.1"
84
84
  },
85
+ "resolutions": {
86
+ "**/jest-message-util/micromatch": "^2.3.11",
87
+ "**/jest-cli/micromatch": "^2.3.11",
88
+ "**/jest-runtime/micromatch": "^2.3.11",
89
+ "**/jest-haste-map/micromatch": "^2.3.11",
90
+ "**/jest-haste-map/sane/micromatch": "^2.3.11",
91
+ "**/jest-config/babel-jest/babel-plugin-istanbul/test-exclude/micromatch": "^2.3.11"
92
+ },
85
93
  "engines": {
86
94
  "node": ">=6.11.5"
87
95
  },
@@ -109,11 +117,11 @@
109
117
  "test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
110
118
  "test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
111
119
  "test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
112
- "travis:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-2.json",
120
+ "travis:integration": "yarn cover:init && yarn cover:integration \"test/(?!TestCases)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-1.json && yarn cover:integration \"test/TestCasesD\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-2.json && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && mv coverage/coverage-final.json coverage/coverage-final-3.json",
113
121
  "travis:basic": "yarn test:basic --ci $JEST",
114
122
  "travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST",
115
123
  "travis:benchmark": "yarn benchmark --ci",
116
- "appveyor:integration": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-1.json && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-2.json",
124
+ "appveyor:integration": "yarn cover:init && yarn cover:integration \"test/(?!TestCases)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-1.json&& yarn cover:integration \"test/TestCasesD\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-2.json && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && move coverage\\coverage-final.json coverage\\coverage-final-3.json",
117
125
  "appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%",
118
126
  "appveyor:benchmark": "yarn benchmark --ci",
119
127
  "build:examples": "cd examples && node buildAll.js",
@@ -179,7 +187,8 @@
179
187
  "coveragePathIgnorePatterns": [
180
188
  "\\.runtime\\.js$",
181
189
  "<rootDir>/test/",
182
- "<rootDir>/schemas/"
190
+ "<rootDir>/schemas/",
191
+ "<rootDir>/node_modules/"
183
192
  ],
184
193
  "testEnvironment": "node",
185
194
  "coverageReporters": [