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.
- package/README.md +95 -52
- package/bin/webpack.js +128 -43
- package/lib/AmdMainTemplatePlugin.js +10 -0
- package/lib/AsyncDependencyToInitialChunkError.js +12 -2
- package/lib/BannerPlugin.js +115 -101
- package/lib/CaseSensitiveModulesWarning.js +20 -2
- package/lib/Chunk.js +1 -0
- package/lib/ChunkGroup.js +465 -465
- package/lib/ChunkRenderError.js +8 -0
- package/lib/ChunkTemplate.js +71 -71
- package/lib/Compilation.js +1 -1
- package/lib/Compiler.js +2 -1
- package/lib/ContextModule.js +8 -8
- package/lib/DllPlugin.js +3 -1
- package/lib/DllReferencePlugin.js +2 -1
- package/lib/Entrypoint.js +54 -54
- package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +115 -115
- package/lib/ExportPropertyMainTemplatePlugin.js +13 -0
- package/lib/Generator.js +52 -52
- package/lib/HotModuleReplacement.runtime.js +633 -633
- package/lib/JsonParser.js +2 -1
- package/lib/LibManifestPlugin.js +9 -0
- package/lib/LibraryTemplatePlugin.js +66 -33
- package/lib/MainTemplate.js +468 -468
- package/lib/Module.js +3 -3
- package/lib/ModuleDependencyError.js +12 -2
- package/lib/NormalModuleFactory.js +5 -3
- package/lib/Parser.js +27 -23
- package/lib/ProgressPlugin.js +1 -1
- package/lib/RecordIdsPlugin.js +3 -1
- package/lib/RuntimeTemplate.js +1 -1
- package/lib/SetVarMainTemplatePlugin.js +12 -0
- package/lib/SourceMapDevToolPlugin.js +11 -13
- package/lib/Template.js +289 -290
- package/lib/UmdMainTemplatePlugin.js +67 -32
- package/lib/WebpackError.js +8 -2
- package/lib/compareLocations.js +20 -0
- package/lib/debug/ProfilingPlugin.js +416 -416
- package/lib/dependencies/ContextDependencyHelpers.js +142 -142
- package/lib/dependencies/WebpackMissingModule.js +2 -2
- package/lib/optimize/RemoveEmptyChunksPlugin.js +42 -40
- package/lib/optimize/RuntimeChunkPlugin.js +9 -5
- package/lib/optimize/SplitChunksPlugin.js +195 -124
- package/lib/util/Queue.js +46 -46
- package/lib/util/SetHelpers.js +48 -48
- package/lib/util/SortableSet.js +106 -106
- package/lib/util/StackedSetMap.js +128 -128
- package/lib/util/cachedMerge.js +13 -0
- package/lib/util/identifier.js +5 -0
- package/lib/util/objectToMap.js +16 -16
- package/lib/wasm/WebAssemblyGenerator.js +280 -280
- package/lib/wasm/WebAssemblyParser.js +79 -79
- package/lib/web/JsonpMainTemplatePlugin.js +2 -2
- package/package.json +21 -17
- package/schemas/WebpackOptions.json +12 -1
- package/schemas/plugins/BannerPlugin.json +96 -85
- 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;
|