webpack 4.13.0 → 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 (93) hide show
  1. package/bin/webpack.js +7 -2
  2. package/hot/dev-server.js +2 -2
  3. package/hot/only-dev-server.js +2 -2
  4. package/hot/poll.js +5 -2
  5. package/hot/signal.js +2 -2
  6. package/lib/AsyncDependenciesBlock.js +44 -0
  7. package/lib/AutomaticPrefetchPlugin.js +2 -2
  8. package/lib/Chunk.js +56 -6
  9. package/lib/ChunkGroup.js +2 -2
  10. package/lib/ChunkTemplate.js +14 -2
  11. package/lib/CommentCompilationWarning.js +3 -3
  12. package/lib/CompatibilityPlugin.js +1 -1
  13. package/lib/Compilation.js +494 -36
  14. package/lib/Compiler.js +57 -4
  15. package/lib/ContextModule.js +23 -16
  16. package/lib/DelegatedModule.js +9 -1
  17. package/lib/DelegatedModuleFactoryPlugin.js +7 -1
  18. package/lib/DependenciesBlock.js +36 -3
  19. package/lib/DependenciesBlockVariable.js +22 -0
  20. package/lib/Dependency.js +33 -6
  21. package/lib/DllEntryPlugin.js +4 -1
  22. package/lib/DynamicEntryPlugin.js +21 -1
  23. package/lib/EntryOptionPlugin.js +12 -0
  24. package/lib/Entrypoint.js +1 -1
  25. package/lib/EnvironmentPlugin.js +8 -1
  26. package/lib/ExtendedAPIPlugin.js +8 -4
  27. package/lib/ExternalModuleFactoryPlugin.js +1 -1
  28. package/lib/FlagDependencyUsagePlugin.js +18 -13
  29. package/lib/Generator.js +1 -1
  30. package/lib/GraphHelpers.js +2 -1
  31. package/lib/HotModuleReplacement.runtime.js +8 -5
  32. package/lib/HotModuleReplacementPlugin.js +115 -117
  33. package/lib/IgnorePlugin.js +1 -1
  34. package/lib/MainTemplate.js +19 -4
  35. package/lib/Module.js +9 -3
  36. package/lib/ModuleReason.js +8 -0
  37. package/lib/MultiEntryPlugin.js +25 -3
  38. package/lib/NormalModule.js +5 -23
  39. package/lib/RuleSet.js +3 -3
  40. package/lib/RuntimeTemplate.js +4 -0
  41. package/lib/SingleEntryPlugin.js +20 -1
  42. package/lib/Stats.js +12 -5
  43. package/lib/Template.js +4 -1
  44. package/lib/UmdMainTemplatePlugin.js +12 -12
  45. package/lib/UseStrictPlugin.js +1 -1
  46. package/lib/WebpackError.js +4 -0
  47. package/lib/WebpackOptionsApply.js +92 -10
  48. package/lib/WebpackOptionsDefaulter.js +23 -6
  49. package/lib/WebpackOptionsValidationError.js +0 -1
  50. package/lib/compareLocations.js +13 -17
  51. package/lib/debug/ProfilingPlugin.js +5 -7
  52. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -6
  53. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +0 -2
  54. package/lib/dependencies/DependencyReference.js +4 -0
  55. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +18 -8
  56. package/lib/dependencies/LoaderDependency.js +3 -0
  57. package/lib/dependencies/LoaderPlugin.js +21 -2
  58. package/lib/dependencies/ModuleDependency.js +3 -0
  59. package/lib/dependencies/MultiEntryDependency.js +5 -0
  60. package/lib/dependencies/SingleEntryDependency.js +3 -0
  61. package/lib/dependencies/SystemPlugin.js +1 -1
  62. package/lib/formatLocation.js +55 -41
  63. package/lib/node/NodeMainTemplateAsync.runtime.js +1 -1
  64. package/lib/node/NodeMainTemplatePlugin.js +2 -2
  65. package/lib/node/NodeSourcePlugin.js +1 -1
  66. package/lib/optimize/ConcatenatedModule.js +24 -8
  67. package/lib/optimize/ModuleConcatenationPlugin.js +29 -14
  68. package/lib/optimize/NaturalChunkOrderPlugin.js +41 -0
  69. package/lib/optimize/OccurrenceChunkOrderPlugin.js +61 -0
  70. package/lib/optimize/OccurrenceModuleOrderPlugin.js +103 -0
  71. package/lib/optimize/OccurrenceOrderPlugin.js +2 -0
  72. package/lib/optimize/SplitChunksPlugin.js +168 -18
  73. package/lib/util/Semaphore.js +12 -0
  74. package/lib/util/SetHelpers.js +4 -4
  75. package/lib/util/SortableSet.js +1 -1
  76. package/lib/util/cachedMerge.js +1 -1
  77. package/lib/util/createHash.js +15 -0
  78. package/lib/util/deterministicGrouping.js +251 -0
  79. package/lib/util/identifier.js +27 -0
  80. package/lib/wasm/WasmFinalizeExportsPlugin.js +5 -2
  81. package/lib/wasm/WasmMainTemplatePlugin.js +10 -4
  82. package/lib/wasm/WebAssemblyGenerator.js +12 -12
  83. package/lib/wasm/WebAssemblyInInitialChunkError.js +88 -0
  84. package/lib/wasm/WebAssemblyModulesPlugin.js +28 -0
  85. package/lib/web/JsonpMainTemplatePlugin.js +1 -1
  86. package/lib/web/WebEnvironmentPlugin.js +18 -18
  87. package/lib/webpack.js +7 -0
  88. package/lib/webpack.web.js +2 -2
  89. package/lib/webworker/WebWorkerMainTemplatePlugin.js +1 -1
  90. package/package.json +21 -11
  91. package/schemas/WebpackOptions.json +70 -4
  92. package/schemas/plugins/optimize/OccurrenceOrderChunkIdsPlugin.json +10 -0
  93. package/schemas/plugins/optimize/OccurrenceOrderModuleIdsPlugin.json +10 -0
@@ -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) {
@@ -25,7 +25,10 @@ class WasmFinalizeExportsPlugin {
25
25
  for (const reason of module.reasons) {
26
26
  // 2. is referenced by a non-WebAssembly module
27
27
  if (reason.module.type.startsWith("webassembly") === false) {
28
- const ref = reason.dependency.getReference();
28
+ const ref = compilation.getDependencyReference(
29
+ reason.module,
30
+ reason.dependency
31
+ );
29
32
 
30
33
  const importedNames = ref.importedNames;
31
34
 
@@ -8,9 +8,10 @@ const Template = require("../Template");
8
8
  const WebAssemblyUtils = require("./WebAssemblyUtils");
9
9
 
10
10
  /** @typedef {import("../Module")} Module */
11
+ /** @typedef {import("../MainTemplate")} MainTemplate */
11
12
 
12
13
  // Get all wasm modules
13
- function getAllWasmModules(chunk) {
14
+ const getAllWasmModules = chunk => {
14
15
  const wasmModules = chunk.getAllAsyncChunks();
15
16
  const array = [];
16
17
  for (const chunk of wasmModules) {
@@ -22,7 +23,7 @@ function getAllWasmModules(chunk) {
22
23
  }
23
24
 
24
25
  return array;
25
- }
26
+ };
26
27
 
27
28
  /**
28
29
  * generates the import object function for a module
@@ -30,7 +31,7 @@ function getAllWasmModules(chunk) {
30
31
  * @param {boolean} mangle mangle imports
31
32
  * @returns {string} source code
32
33
  */
33
- function generateImportObject(module, mangle) {
34
+ const generateImportObject = (module, mangle) => {
34
35
  const waitForInstances = new Map();
35
36
  const properties = [];
36
37
  const usedWasmDependencies = WebAssemblyUtils.getUsedDependencies(
@@ -151,7 +152,7 @@ function generateImportObject(module, mangle) {
151
152
  "},"
152
153
  ]);
153
154
  }
154
- }
155
+ };
155
156
 
156
157
  class WasmMainTemplatePlugin {
157
158
  constructor({ generateLoadBinaryCode, supportsStreaming, mangleImports }) {
@@ -159,6 +160,11 @@ class WasmMainTemplatePlugin {
159
160
  this.supportsStreaming = supportsStreaming;
160
161
  this.mangleImports = mangleImports;
161
162
  }
163
+
164
+ /**
165
+ * @param {MainTemplate} mainTemplate main template
166
+ * @returns {void}
167
+ */
162
168
  apply(mainTemplate) {
163
169
  mainTemplate.hooks.localVars.tap(
164
170
  "WasmMainTemplatePlugin",
@@ -32,21 +32,21 @@ const WebAssemblyExportImportedDependency = require("../dependencies/WebAssembly
32
32
  * @param {ArrayBuffer} ab - original binary
33
33
  * @returns {ArrayBufferTransform} transform
34
34
  */
35
- function preprocess(ab) {
35
+ const preprocess = ab => {
36
36
  const optBin = shrinkPaddedLEB128(new Uint8Array(ab));
37
37
  return optBin.buffer;
38
- }
38
+ };
39
39
 
40
40
  /**
41
41
  * @template T
42
42
  * @param {Function[]} fns transforms
43
43
  * @returns {Function} composed transform
44
44
  */
45
- function compose(...fns) {
45
+ const compose = (...fns) => {
46
46
  return fns.reduce((prevFn, nextFn) => {
47
47
  return value => nextFn(prevFn(value));
48
48
  }, value => value);
49
- }
49
+ };
50
50
 
51
51
  // TODO replace with @callback
52
52
 
@@ -70,7 +70,7 @@ const removeStartFunc = state => bin => {
70
70
  * @param {Object} ast - Module's AST
71
71
  * @returns {Array<t.ModuleImport>} - nodes
72
72
  */
73
- function getImportedGlobals(ast) {
73
+ const getImportedGlobals = ast => {
74
74
  const importedGlobals = [];
75
75
 
76
76
  t.traverse(ast, {
@@ -82,9 +82,9 @@ function getImportedGlobals(ast) {
82
82
  });
83
83
 
84
84
  return importedGlobals;
85
- }
85
+ };
86
86
 
87
- function getCountImportedFunc(ast) {
87
+ const getCountImportedFunc = ast => {
88
88
  let count = 0;
89
89
 
90
90
  t.traverse(ast, {
@@ -96,7 +96,7 @@ function getCountImportedFunc(ast) {
96
96
  });
97
97
 
98
98
  return count;
99
- }
99
+ };
100
100
 
101
101
  /**
102
102
  * Get next type index
@@ -104,7 +104,7 @@ function getCountImportedFunc(ast) {
104
104
  * @param {Object} ast - Module's AST
105
105
  * @returns {t.Index} - index
106
106
  */
107
- function getNextTypeIndex(ast) {
107
+ const getNextTypeIndex = ast => {
108
108
  const typeSectionMetadata = t.getSectionMetadata(ast, "type");
109
109
 
110
110
  if (typeof typeSectionMetadata === "undefined") {
@@ -112,7 +112,7 @@ function getNextTypeIndex(ast) {
112
112
  }
113
113
 
114
114
  return t.indexLiteral(typeSectionMetadata.vectorOfSize.value);
115
- }
115
+ };
116
116
 
117
117
  /**
118
118
  * Get next func index
@@ -125,7 +125,7 @@ function getNextTypeIndex(ast) {
125
125
  * @param {Number} countImportedFunc - number of imported funcs
126
126
  * @returns {t.Index} - index
127
127
  */
128
- function getNextFuncIndex(ast, countImportedFunc) {
128
+ const getNextFuncIndex = (ast, countImportedFunc) => {
129
129
  const funcSectionMetadata = t.getSectionMetadata(ast, "func");
130
130
 
131
131
  if (typeof funcSectionMetadata === "undefined") {
@@ -135,7 +135,7 @@ function getNextFuncIndex(ast, countImportedFunc) {
135
135
  const vectorOfSize = funcSectionMetadata.vectorOfSize.value;
136
136
 
137
137
  return t.indexLiteral(vectorOfSize + countImportedFunc);
138
- }
138
+ };
139
139
 
140
140
  /**
141
141
  * Create a init instruction for a global
@@ -0,0 +1,88 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ */
4
+ "use strict";
5
+
6
+ const WebpackError = require("../WebpackError");
7
+
8
+ /** @typedef {import("../Module")} Module */
9
+ /** @typedef {import("../RequestShortener")} RequestShortener */
10
+
11
+ /**
12
+ * @param {Module} module module to get chains from
13
+ * @param {RequestShortener} requestShortener to make readable identifiers
14
+ * @returns {string[]} all chains to the module
15
+ */
16
+ const getInitialModuleChains = (module, requestShortener) => {
17
+ const queue = [
18
+ { head: module, message: module.readableIdentifier(requestShortener) }
19
+ ];
20
+ /** @type {Set<string>} */
21
+ const results = new Set();
22
+ /** @type {Set<string>} */
23
+ const incompleteResults = new Set();
24
+ /** @type {Set<Module>} */
25
+ const visitedModules = new Set();
26
+
27
+ for (const chain of queue) {
28
+ const { head, message } = chain;
29
+ let final = true;
30
+ /** @type {Set<Module>} */
31
+ const alreadyReferencedModules = new Set();
32
+ for (const reason of head.reasons) {
33
+ const newHead = reason.module;
34
+ if (newHead) {
35
+ if (!newHead.getChunks().some(c => c.canBeInitial())) continue;
36
+ final = false;
37
+ if (alreadyReferencedModules.has(newHead)) continue;
38
+ alreadyReferencedModules.add(newHead);
39
+ const moduleName = newHead.readableIdentifier(requestShortener);
40
+ const detail = reason.explanation ? ` (${reason.explanation})` : "";
41
+ const newMessage = `${moduleName}${detail} --> ${message}`;
42
+ if (visitedModules.has(newHead)) {
43
+ incompleteResults.add(`... --> ${newMessage}`);
44
+ continue;
45
+ }
46
+ visitedModules.add(newHead);
47
+ queue.push({
48
+ head: newHead,
49
+ message: newMessage
50
+ });
51
+ } else {
52
+ final = false;
53
+ const newMessage = reason.explanation
54
+ ? `(${reason.explanation}) --> ${message}`
55
+ : message;
56
+ results.add(newMessage);
57
+ }
58
+ }
59
+ if (final) {
60
+ results.add(message);
61
+ }
62
+ }
63
+ for (const result of incompleteResults) {
64
+ results.add(result);
65
+ }
66
+ return Array.from(results);
67
+ };
68
+
69
+ module.exports = class WebAssemblyInInitialChunkError extends WebpackError {
70
+ /**
71
+ * @param {Module} module WASM module
72
+ * @param {RequestShortener} requestShortener request shortener
73
+ */
74
+ constructor(module, requestShortener) {
75
+ const moduleChains = getInitialModuleChains(module, requestShortener);
76
+ const message = `WebAssembly module is included in initial chunk.
77
+ This is not allowed, because WebAssembly download and compilation must happen asynchronous.
78
+ Add an async splitpoint (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
79
+ ${moduleChains.map(s => `* ${s}`).join("\n")}`;
80
+
81
+ super(message);
82
+ this.name = "WebAssemblyInInitialChunkError";
83
+ this.hideStack = true;
84
+ this.module = module;
85
+
86
+ Error.captureStackTrace(this, this.constructor);
87
+ }
88
+ };
@@ -10,12 +10,19 @@ const WebAssemblyGenerator = require("./WebAssemblyGenerator");
10
10
  const WebAssemblyJavascriptGenerator = require("./WebAssemblyJavascriptGenerator");
11
11
  const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
12
12
  const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
13
+ const WebAssemblyInInitialChunkError = require("./WebAssemblyInInitialChunkError");
14
+
15
+ /** @typedef {import("../Compiler")} Compiler */
13
16
 
14
17
  class WebAssemblyModulesPlugin {
15
18
  constructor(options) {
16
19
  this.options = options;
17
20
  }
18
21
 
22
+ /**
23
+ * @param {Compiler} compiler compiler
24
+ * @returns {void}
25
+ */
19
26
  apply(compiler) {
20
27
  compiler.hooks.compilation.tap(
21
28
  "WebAssemblyModulesPlugin",
@@ -78,6 +85,27 @@ class WebAssemblyModulesPlugin {
78
85
  return result;
79
86
  }
80
87
  );
88
+
89
+ compilation.hooks.afterChunks.tap("WebAssemblyModulesPlugin", () => {
90
+ const initialWasmModules = new Set();
91
+ for (const chunk of compilation.chunks) {
92
+ if (chunk.canBeInitial()) {
93
+ for (const module of chunk.modulesIterable) {
94
+ if (module.type.startsWith("webassembly")) {
95
+ initialWasmModules.add(module);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ for (const module of initialWasmModules) {
101
+ compilation.errors.push(
102
+ new WebAssemblyInInitialChunkError(
103
+ module,
104
+ compilation.requestShortener
105
+ )
106
+ );
107
+ }
108
+ });
81
109
  }
82
110
  );
83
111
  }
@@ -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
@@ -123,6 +123,9 @@ exportPlugins(exports, {
123
123
  UmdMainTemplatePlugin: () => require("./UmdMainTemplatePlugin"),
124
124
  WatchIgnorePlugin: () => require("./WatchIgnorePlugin")
125
125
  });
126
+ exportPlugins((exports.dependencies = {}), {
127
+ DependencyReference: () => require("./dependencies/DependencyReference")
128
+ });
126
129
  exportPlugins((exports.optimize = {}), {
127
130
  AggressiveMergingPlugin: () => require("./optimize/AggressiveMergingPlugin"),
128
131
  AggressiveSplittingPlugin: () =>
@@ -134,6 +137,10 @@ exportPlugins((exports.optimize = {}), {
134
137
  ModuleConcatenationPlugin: () =>
135
138
  require("./optimize/ModuleConcatenationPlugin"),
136
139
  OccurrenceOrderPlugin: () => require("./optimize/OccurrenceOrderPlugin"),
140
+ OccurrenceModuleOrderPlugin: () =>
141
+ require("./optimize/OccurrenceModuleOrderPlugin"),
142
+ OccurrenceChunkOrderPlugin: () =>
143
+ require("./optimize/OccurrenceChunkOrderPlugin"),
137
144
  RuntimeChunkPlugin: () => require("./optimize/RuntimeChunkPlugin"),
138
145
  SideEffectsFlagPlugin: () => require("./optimize/SideEffectsFlagPlugin"),
139
146
  SplitChunksPlugin: () => require("./optimize/SplitChunksPlugin")
@@ -9,7 +9,7 @@ const WebEnvironmentPlugin = require("./web/WebEnvironmentPlugin");
9
9
  const WebpackOptionsApply = require("./WebpackOptionsApply");
10
10
  const WebpackOptionsDefaulter = require("./WebpackOptionsDefaulter");
11
11
 
12
- function webpack(options, callback) {
12
+ const webpack = (options, callback) => {
13
13
  new WebpackOptionsDefaulter().process(options);
14
14
 
15
15
  const compiler = new Compiler();
@@ -22,7 +22,7 @@ function webpack(options, callback) {
22
22
  compiler.run(callback);
23
23
  }
24
24
  return compiler;
25
- }
25
+ };
26
26
  module.exports = webpack;
27
27
 
28
28
  webpack.WebpackOptionsDefaulter = WebpackOptionsDefaulter;
@@ -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,15 +1,15 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.13.0",
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",
7
7
  "dependencies": {
8
- "@webassemblyjs/ast": "1.5.12",
9
- "@webassemblyjs/helper-module-context": "1.5.12",
10
- "@webassemblyjs/wasm-edit": "1.5.12",
11
- "@webassemblyjs/wasm-opt": "1.5.12",
12
- "@webassemblyjs/wasm-parser": "1.5.12",
8
+ "@webassemblyjs/ast": "1.5.13",
9
+ "@webassemblyjs/helper-module-context": "1.5.13",
10
+ "@webassemblyjs/wasm-edit": "1.5.13",
11
+ "@webassemblyjs/wasm-opt": "1.5.13",
12
+ "@webassemblyjs/wasm-parser": "1.5.13",
13
13
  "acorn": "^5.6.2",
14
14
  "acorn-dynamic-import": "^3.0.0",
15
15
  "ajv": "^6.1.0",
@@ -34,6 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@types/node": "^9.6.4",
36
36
  "@types/tapable": "^1.0.1",
37
+ "@types/webpack-sources": "^0.1.4",
37
38
  "benchmark": "^2.1.1",
38
39
  "bundle-loader": "~0.5.0",
39
40
  "codacy-coverage": "^2.0.1",
@@ -55,7 +56,7 @@
55
56
  "istanbul": "^0.4.5",
56
57
  "jade": "^1.11.0",
57
58
  "jade-loader": "~0.8.0",
58
- "jest": "^23.0.1",
59
+ "jest": "^23.3.0",
59
60
  "jest-silent-reporter": "^0.0.5",
60
61
  "json-loader": "^0.5.7",
61
62
  "less": "^2.5.1",
@@ -81,6 +82,14 @@
81
82
  "worker-loader": "^1.1.1",
82
83
  "xxhashjs": "^0.2.1"
83
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
+ },
84
93
  "engines": {
85
94
  "node": ">=6.11.5"
86
95
  },
@@ -108,11 +117,11 @@
108
117
  "test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
109
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\"",
110
119
  "test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
111
- "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",
112
121
  "travis:basic": "yarn test:basic --ci $JEST",
113
122
  "travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST",
114
123
  "travis:benchmark": "yarn benchmark --ci",
115
- "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",
116
125
  "appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%",
117
126
  "appveyor:benchmark": "yarn benchmark --ci",
118
127
  "build:examples": "cd examples && node buildAll.js",
@@ -122,7 +131,7 @@
122
131
  "code-lint": "eslint --cache setup lib bin hot buildin benchmark \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
123
132
  "type-lint": "tsc --pretty",
124
133
  "fix": "yarn code-lint --fix",
125
- "pretty": "prettier --write \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\"",
134
+ "pretty": "prettier --write \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\" \"tsconfig.json\"",
126
135
  "schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
127
136
  "benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
128
137
  "cover": "yarn cover:init && yarn cover:all && yarn cover:report",
@@ -178,7 +187,8 @@
178
187
  "coveragePathIgnorePatterns": [
179
188
  "\\.runtime\\.js$",
180
189
  "<rootDir>/test/",
181
- "<rootDir>/schemas/"
190
+ "<rootDir>/schemas/",
191
+ "<rootDir>/node_modules/"
182
192
  ],
183
193
  "testEnvironment": "node",
184
194
  "coverageReporters": [
@@ -1351,7 +1351,12 @@
1351
1351
  ]
1352
1352
  },
1353
1353
  "minSize": {
1354
- "description": "Minimal size for the created chunk",
1354
+ "description": "Minimal size for the created chunks",
1355
+ "type": "number",
1356
+ "minimum": 0
1357
+ },
1358
+ "maxSize": {
1359
+ "description": "Maximal size hint for the created chunks",
1355
1360
  "type": "number",
1356
1361
  "minimum": 0
1357
1362
  },
@@ -1394,6 +1399,32 @@
1394
1399
  "type": "string",
1395
1400
  "minLength": 1
1396
1401
  },
1402
+ "hidePathInfo": {
1403
+ "description": "Prevents exposing path info when creating names for parts splitted by maxSize",
1404
+ "type": "boolean"
1405
+ },
1406
+ "fallbackCacheGroup": {
1407
+ "description": "Options for modules not selected by any other cache group",
1408
+ "type": "object",
1409
+ "additionalProperties": false,
1410
+ "properties": {
1411
+ "minSize": {
1412
+ "description": "Minimal size for the created chunk",
1413
+ "type": "number",
1414
+ "minimum": 0
1415
+ },
1416
+ "maxSize": {
1417
+ "description": "Maximal size hint for the created chunks",
1418
+ "type": "number",
1419
+ "minimum": 0
1420
+ },
1421
+ "automaticNameDelimiter": {
1422
+ "description": "Sets the name delimiter for created chunks",
1423
+ "type": "string",
1424
+ "minLength": 1
1425
+ }
1426
+ }
1427
+ },
1397
1428
  "cacheGroups": {
1398
1429
  "description": "Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks)",
1399
1430
  "type": "object",
@@ -1460,6 +1491,11 @@
1460
1491
  "type": "number",
1461
1492
  "minimum": 0
1462
1493
  },
1494
+ "maxSize": {
1495
+ "description": "Maximal size hint for the created chunks",
1496
+ "type": "number",
1497
+ "minimum": 0
1498
+ },
1463
1499
  "minChunks": {
1464
1500
  "description": "Minimum number of times a module has to be duplicated until it's considered for splitting",
1465
1501
  "type": "number",
@@ -1493,6 +1529,15 @@
1493
1529
  }
1494
1530
  ]
1495
1531
  },
1532
+ "automaticNameDelimiter": {
1533
+ "description": "Sets the name delimiter for created chunks",
1534
+ "type": "string",
1535
+ "minLength": 1
1536
+ },
1537
+ "automaticNamePrefix": {
1538
+ "description": "Sets the name prefix for created chunks",
1539
+ "type": "string"
1540
+ },
1496
1541
  "filename": {
1497
1542
  "description": "Sets the template for the filename for created chunks (Only works for initial chunks)",
1498
1543
  "type": "string",
@@ -1550,16 +1595,37 @@
1550
1595
  "description": "Reduce size of WASM by changing imports to shorter strings.",
1551
1596
  "type": "boolean"
1552
1597
  },
1598
+ "moduleIds": {
1599
+ "description": "Define the algorithm to choose module ids (natural: numeric ids in order for usage, named: readable ids for better debugging, hashed: short hashes as ids for better long term caching, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)",
1600
+ "enum": [
1601
+ "natural",
1602
+ "named",
1603
+ "hashed",
1604
+ "size",
1605
+ "total-size",
1606
+ false
1607
+ ]
1608
+ },
1609
+ "chunkIds": {
1610
+ "description": "Define the algorithm to choose chunk ids (named: readable ids for better debugging, size: numeric ids focused on minimal initial download size, total-size: numeric ids focused on minimal total download size, false: no algorithm used, as custom one can be provided via plugin)",
1611
+ "enum": [
1612
+ "natural",
1613
+ "named",
1614
+ "size",
1615
+ "total-size",
1616
+ false
1617
+ ]
1618
+ },
1553
1619
  "namedModules": {
1554
- "description": "Use readable module identifiers for better debugging",
1620
+ "description": "Use readable module identifiers for better debugging (deprecated, used moduleIds: named instead)",
1555
1621
  "type": "boolean"
1556
1622
  },
1557
1623
  "hashedModuleIds": {
1558
- "description": "Use hashed module id instead module identifiers for better long term caching",
1624
+ "description": "Use hashed module id instead module identifiers for better long term caching (deprecated, used moduleIds: hashed instead)",
1559
1625
  "type": "boolean"
1560
1626
  },
1561
1627
  "namedChunks": {
1562
- "description": "Use readable chunk identifiers for better debugging",
1628
+ "description": "Use readable chunk identifiers for better debugging (deprecated, used chunkIds: named instead)",
1563
1629
  "type": "boolean"
1564
1630
  },
1565
1631
  "portableRecords": {
@@ -0,0 +1,10 @@
1
+ {
2
+ "additionalProperties": false,
3
+ "type": "object",
4
+ "properties": {
5
+ "prioritiseInitial": {
6
+ "description": "Prioritise initial size over total size",
7
+ "type": "boolean"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "additionalProperties": false,
3
+ "type": "object",
4
+ "properties": {
5
+ "prioritiseInitial": {
6
+ "description": "Prioritise initial size over total size",
7
+ "type": "boolean"
8
+ }
9
+ }
10
+ }