webpack 4.8.2 → 4.9.2

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 (57) hide show
  1. package/README.md +95 -52
  2. package/bin/webpack.js +128 -43
  3. package/lib/AmdMainTemplatePlugin.js +10 -0
  4. package/lib/AsyncDependencyToInitialChunkError.js +12 -2
  5. package/lib/BannerPlugin.js +115 -101
  6. package/lib/CaseSensitiveModulesWarning.js +20 -2
  7. package/lib/Chunk.js +1 -0
  8. package/lib/ChunkGroup.js +465 -465
  9. package/lib/ChunkRenderError.js +8 -0
  10. package/lib/ChunkTemplate.js +71 -71
  11. package/lib/Compilation.js +1 -1
  12. package/lib/Compiler.js +2 -1
  13. package/lib/ContextModule.js +8 -8
  14. package/lib/DllPlugin.js +3 -1
  15. package/lib/DllReferencePlugin.js +2 -1
  16. package/lib/Entrypoint.js +54 -54
  17. package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +115 -115
  18. package/lib/ExportPropertyMainTemplatePlugin.js +13 -0
  19. package/lib/Generator.js +52 -52
  20. package/lib/HotModuleReplacement.runtime.js +633 -633
  21. package/lib/JsonParser.js +2 -1
  22. package/lib/LibManifestPlugin.js +9 -0
  23. package/lib/LibraryTemplatePlugin.js +66 -33
  24. package/lib/MainTemplate.js +468 -468
  25. package/lib/Module.js +3 -3
  26. package/lib/ModuleDependencyError.js +12 -2
  27. package/lib/NormalModuleFactory.js +5 -3
  28. package/lib/Parser.js +27 -23
  29. package/lib/ProgressPlugin.js +1 -1
  30. package/lib/RecordIdsPlugin.js +3 -1
  31. package/lib/RuntimeTemplate.js +1 -1
  32. package/lib/SetVarMainTemplatePlugin.js +12 -0
  33. package/lib/SourceMapDevToolPlugin.js +11 -13
  34. package/lib/Template.js +289 -290
  35. package/lib/UmdMainTemplatePlugin.js +67 -32
  36. package/lib/WebpackError.js +8 -2
  37. package/lib/compareLocations.js +20 -0
  38. package/lib/debug/ProfilingPlugin.js +416 -416
  39. package/lib/dependencies/ContextDependencyHelpers.js +142 -142
  40. package/lib/dependencies/WebpackMissingModule.js +2 -2
  41. package/lib/optimize/RemoveEmptyChunksPlugin.js +42 -40
  42. package/lib/optimize/RuntimeChunkPlugin.js +9 -5
  43. package/lib/optimize/SplitChunksPlugin.js +195 -124
  44. package/lib/util/Queue.js +46 -46
  45. package/lib/util/SetHelpers.js +48 -48
  46. package/lib/util/SortableSet.js +106 -106
  47. package/lib/util/StackedSetMap.js +128 -128
  48. package/lib/util/cachedMerge.js +13 -0
  49. package/lib/util/identifier.js +5 -0
  50. package/lib/util/objectToMap.js +16 -16
  51. package/lib/wasm/WebAssemblyGenerator.js +280 -280
  52. package/lib/wasm/WebAssemblyParser.js +79 -79
  53. package/lib/web/JsonpMainTemplatePlugin.js +2 -2
  54. package/package.json +21 -17
  55. package/schemas/WebpackOptions.json +12 -1
  56. package/schemas/plugins/BannerPlugin.json +96 -85
  57. package/schemas/plugins/DllPlugin.json +4 -0
package/lib/Generator.js CHANGED
@@ -1,52 +1,52 @@
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("./Module")} Module */
8
- /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
9
- /** @typedef {import("webpack-sources").Source} Source */
10
-
11
- /**
12
- *
13
- */
14
- class Generator {
15
- static byType(map) {
16
- return new ByTypeGenerator(map);
17
- }
18
-
19
- /**
20
- * @abstract
21
- * @param {Module} module module for which the code should be generated
22
- * @param {Map<Function, TODO>} dependencyTemplates mapping from dependencies to templates
23
- * @param {RuntimeTemplate} runtimeTemplate the runtime template
24
- * @param {string} type which kind of code should be generated
25
- * @returns {Source} generated code
26
- */
27
- generate(module, dependencyTemplates, runtimeTemplate, type) {
28
- throw new Error("Generator.generate: must be overriden");
29
- }
30
- }
31
-
32
- class ByTypeGenerator extends Generator {
33
- constructor(map) {
34
- super();
35
- this.map = map;
36
- }
37
-
38
- generate(module, dependencyTemplates, runtimeTemplate, type) {
39
- const generator = this.map[type];
40
- if (!generator) {
41
- throw new Error(`Generator.byType: no generator specified for ${type}`);
42
- }
43
- return generator.generate(
44
- module,
45
- dependencyTemplates,
46
- runtimeTemplate,
47
- type
48
- );
49
- }
50
- }
51
-
52
- module.exports = Generator;
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("./Module")} Module */
8
+ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
9
+ /** @typedef {import("webpack-sources").Source} Source */
10
+
11
+ /**
12
+ *
13
+ */
14
+ class Generator {
15
+ static byType(map) {
16
+ return new ByTypeGenerator(map);
17
+ }
18
+
19
+ /**
20
+ * @abstract
21
+ * @param {Module} module module for which the code should be generated
22
+ * @param {Map<Function, TODO>} dependencyTemplates mapping from dependencies to templates
23
+ * @param {RuntimeTemplate} runtimeTemplate the runtime template
24
+ * @param {string} type which kind of code should be generated
25
+ * @returns {Source} generated code
26
+ */
27
+ generate(module, dependencyTemplates, runtimeTemplate, type) {
28
+ throw new Error("Generator.generate: must be overriden");
29
+ }
30
+ }
31
+
32
+ class ByTypeGenerator extends Generator {
33
+ constructor(map) {
34
+ super();
35
+ this.map = map;
36
+ }
37
+
38
+ generate(module, dependencyTemplates, runtimeTemplate, type) {
39
+ const generator = this.map[type];
40
+ if (!generator) {
41
+ throw new Error(`Generator.byType: no generator specified for ${type}`);
42
+ }
43
+ return generator.generate(
44
+ module,
45
+ dependencyTemplates,
46
+ runtimeTemplate,
47
+ type
48
+ );
49
+ }
50
+ }
51
+
52
+ module.exports = Generator;