webpack 4.16.1 → 4.16.5
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/hot/log.js +2 -0
- package/lib/Chunk.js +32 -10
- package/lib/ChunkGroup.js +3 -3
- package/lib/Compilation.js +58 -13
- package/lib/ContextExclusionPlugin.js +11 -0
- package/lib/ContextModule.js +116 -30
- package/lib/ContextModuleFactory.js +6 -0
- package/lib/DelegatedModule.js +5 -0
- package/lib/DependenciesBlock.js +1 -1
- package/lib/DllModule.js +6 -0
- package/lib/DllReferencePlugin.js +51 -3
- package/lib/ExternalModule.js +6 -0
- package/lib/Generator.js +11 -3
- package/lib/HotModuleReplacementPlugin.js +1 -5
- package/lib/Module.js +52 -12
- package/lib/MultiModule.js +6 -0
- package/lib/NodeStuffPlugin.js +18 -0
- package/lib/NormalModule.js +6 -0
- package/lib/Parser.js +12 -3
- package/lib/RuntimeTemplate.js +12 -0
- package/lib/Stats.js +19 -2
- package/lib/Template.js +44 -43
- package/lib/WatchIgnorePlugin.js +18 -18
- package/lib/debug/ProfilingPlugin.js +1 -1
- package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +6 -0
- package/lib/dependencies/ContextDependencyHelpers.js +78 -43
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/node/NodeTargetPlugin.js +1 -0
- package/lib/optimize/ConcatenatedModule.js +5 -0
- package/lib/util/SortableSet.js +1 -0
- package/lib/util/StackedSetMap.js +12 -3
- package/lib/wasm/WebAssemblyGenerator.js +22 -5
- package/lib/wasm/WebAssemblyJavascriptGenerator.js +16 -2
- package/lib/webpack.js +1 -0
- package/package.json +8 -16
@@ -21,6 +21,7 @@ const createHash = require("../util/createHash");
|
|
21
21
|
|
22
22
|
/** @typedef {import("../Dependency")} Dependency */
|
23
23
|
/** @typedef {import("../Compilation")} Compilation */
|
24
|
+
/** @typedef {import("../util/createHash").Hash} Hash */
|
24
25
|
|
25
26
|
/**
|
26
27
|
* @typedef {Object} ConcatenationEntry
|
@@ -1180,6 +1181,10 @@ class ConcatenatedModule extends Module {
|
|
1180
1181
|
return nameWithNumber;
|
1181
1182
|
}
|
1182
1183
|
|
1184
|
+
/**
|
1185
|
+
* @param {Hash} hash the hash used to track dependencies
|
1186
|
+
* @returns {void}
|
1187
|
+
*/
|
1183
1188
|
updateHash(hash) {
|
1184
1189
|
for (const info of this._orderedConcatenationList) {
|
1185
1190
|
switch (info.type) {
|
package/lib/util/SortableSet.js
CHANGED
@@ -128,8 +128,17 @@ class StackedSetMap {
|
|
128
128
|
}
|
129
129
|
|
130
130
|
// TODO remove in webpack 5
|
131
|
-
StackedSetMap.prototype.push = util.deprecate(
|
132
|
-
|
133
|
-
|
131
|
+
StackedSetMap.prototype.push = util.deprecate(
|
132
|
+
/**
|
133
|
+
* @deprecated
|
134
|
+
* @this {StackedSetMap}
|
135
|
+
* @param {any} item Item to add
|
136
|
+
* @returns {void}
|
137
|
+
*/
|
138
|
+
function(item) {
|
139
|
+
this.add(item);
|
140
|
+
},
|
141
|
+
"This is no longer an Array: Use add instead."
|
142
|
+
);
|
134
143
|
|
135
144
|
module.exports = StackedSetMap;
|
@@ -21,6 +21,10 @@ const WebAssemblyExportImportedDependency = require("../dependencies/WebAssembly
|
|
21
21
|
|
22
22
|
/** @typedef {import("../Module")} Module */
|
23
23
|
/** @typedef {import("./WebAssemblyUtils").UsedWasmDependency} UsedWasmDependency */
|
24
|
+
/** @typedef {import("../NormalModule")} NormalModule */
|
25
|
+
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
26
|
+
/** @typedef {import("webpack-sources").Source} Source */
|
27
|
+
/** @typedef {import("../Dependency").DependencyTemplate} DependencyTemplate */
|
24
28
|
|
25
29
|
/**
|
26
30
|
* @typedef {(ArrayBuffer) => ArrayBuffer} ArrayBufferTransform
|
@@ -43,9 +47,12 @@ const preprocess = ab => {
|
|
43
47
|
* @returns {Function} composed transform
|
44
48
|
*/
|
45
49
|
const compose = (...fns) => {
|
46
|
-
return fns.reduce(
|
47
|
-
|
48
|
-
|
50
|
+
return fns.reduce(
|
51
|
+
(prevFn, nextFn) => {
|
52
|
+
return value => nextFn(prevFn(value));
|
53
|
+
},
|
54
|
+
value => value
|
55
|
+
);
|
49
56
|
};
|
50
57
|
|
51
58
|
// TODO replace with @callback
|
@@ -366,7 +373,14 @@ class WebAssemblyGenerator extends Generator {
|
|
366
373
|
this.options = options;
|
367
374
|
}
|
368
375
|
|
369
|
-
|
376
|
+
/**
|
377
|
+
* @param {NormalModule} module module for which the code should be generated
|
378
|
+
* @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
|
379
|
+
* @param {RuntimeTemplate} runtimeTemplate the runtime template
|
380
|
+
* @param {string} type which kind of code should be generated
|
381
|
+
* @returns {Source} generated code
|
382
|
+
*/
|
383
|
+
generate(module, dependencyTemplates, runtimeTemplate, type) {
|
370
384
|
let bin = module.originalSource().source();
|
371
385
|
bin = preprocess(bin);
|
372
386
|
|
@@ -398,7 +412,10 @@ class WebAssemblyGenerator extends Generator {
|
|
398
412
|
const externalExports = new Set(
|
399
413
|
module.dependencies
|
400
414
|
.filter(d => d instanceof WebAssemblyExportImportedDependency)
|
401
|
-
.map(d =>
|
415
|
+
.map(d => {
|
416
|
+
const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ (d);
|
417
|
+
return wasmDep.exportName;
|
418
|
+
})
|
402
419
|
);
|
403
420
|
|
404
421
|
/** @type {t.Instruction[]} */
|
@@ -10,8 +10,20 @@ const { RawSource } = require("webpack-sources");
|
|
10
10
|
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
11
11
|
const WebAssemblyExportImportedDependency = require("../dependencies/WebAssemblyExportImportedDependency");
|
12
12
|
|
13
|
+
/** @typedef {import("../NormalModule")} NormalModule */
|
14
|
+
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
15
|
+
/** @typedef {import("webpack-sources").Source} Source */
|
16
|
+
/** @typedef {import("../Dependency").DependencyTemplate} DependencyTemplate */
|
17
|
+
|
13
18
|
class WebAssemblyJavascriptGenerator extends Generator {
|
14
|
-
|
19
|
+
/**
|
20
|
+
* @param {NormalModule} module module for which the code should be generated
|
21
|
+
* @param {Map<Function, DependencyTemplate>} dependencyTemplates mapping from dependencies to templates
|
22
|
+
* @param {RuntimeTemplate} runtimeTemplate the runtime template
|
23
|
+
* @param {string} type which kind of code should be generated
|
24
|
+
* @returns {Source} generated code
|
25
|
+
*/
|
26
|
+
generate(module, dependencyTemplates, runtimeTemplate, type) {
|
15
27
|
const initIdentifer = Array.isArray(module.usedExports)
|
16
28
|
? Template.numberToIdentifer(module.usedExports.length)
|
17
29
|
: "__webpack_init__";
|
@@ -21,6 +33,7 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|
21
33
|
const initParams = [];
|
22
34
|
let index = 0;
|
23
35
|
for (const dep of module.dependencies) {
|
36
|
+
const depAsAny = /** @type {any} */ (dep);
|
24
37
|
if (dep.module) {
|
25
38
|
let importData = importedModules.get(dep.module);
|
26
39
|
if (importData === undefined) {
|
@@ -29,7 +42,8 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|
29
42
|
(importData = {
|
30
43
|
importVar: `m${index}`,
|
31
44
|
index,
|
32
|
-
request:
|
45
|
+
request:
|
46
|
+
"userRequest" in depAsAny ? depAsAny.userRequest : undefined,
|
33
47
|
names: new Set(),
|
34
48
|
reexports: []
|
35
49
|
})
|
package/lib/webpack.js
CHANGED
@@ -69,6 +69,7 @@ webpack.WebpackOptionsApply = WebpackOptionsApply;
|
|
69
69
|
webpack.Compiler = Compiler;
|
70
70
|
webpack.MultiCompiler = MultiCompiler;
|
71
71
|
webpack.NodeEnvironmentPlugin = NodeEnvironmentPlugin;
|
72
|
+
// @ts-ignore Global @this directive is not supported
|
72
73
|
webpack.validate = validateSchema.bind(this, webpackOptionsSchema);
|
73
74
|
webpack.validateSchema = validateSchema;
|
74
75
|
webpack.WebpackOptionsValidationError = WebpackOptionsValidationError;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "4.16.
|
3
|
+
"version": "4.16.5",
|
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",
|
@@ -43,10 +43,10 @@
|
|
43
43
|
"coveralls": "^2.11.2",
|
44
44
|
"css-loader": "^0.28.3",
|
45
45
|
"es6-promise-polyfill": "^1.1.1",
|
46
|
-
"eslint": "^5.
|
46
|
+
"eslint": "^5.2.0",
|
47
47
|
"eslint-config-prettier": "^2.9.0",
|
48
|
-
"eslint-plugin-jest": "^21.
|
49
|
-
"eslint-plugin-node": "^
|
48
|
+
"eslint-plugin-jest": "^21.18.0",
|
49
|
+
"eslint-plugin-node": "^7.0.1",
|
50
50
|
"eslint-plugin-prettier": "^2.6.2",
|
51
51
|
"express": "~4.13.1",
|
52
52
|
"file-loader": "^1.1.6",
|
@@ -56,14 +56,14 @@
|
|
56
56
|
"istanbul": "^0.4.5",
|
57
57
|
"jade": "^1.11.0",
|
58
58
|
"jade-loader": "~0.8.0",
|
59
|
-
"jest": "^23.
|
59
|
+
"jest": "^23.4.1",
|
60
60
|
"jest-silent-reporter": "^0.0.5",
|
61
61
|
"json-loader": "^0.5.7",
|
62
62
|
"less": "^2.5.1",
|
63
63
|
"less-loader": "^4.0.3",
|
64
64
|
"lint-staged": "^7.2.0",
|
65
65
|
"lodash": "^4.17.4",
|
66
|
-
"prettier": "^1.
|
66
|
+
"prettier": "^1.14.0",
|
67
67
|
"pug": "^2.0.3",
|
68
68
|
"pug-loader": "^2.4.0",
|
69
69
|
"raw-loader": "~0.5.0",
|
@@ -82,14 +82,6 @@
|
|
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
|
-
},
|
93
85
|
"engines": {
|
94
86
|
"node": ">=6.11.5"
|
95
87
|
},
|
@@ -128,10 +120,10 @@
|
|
128
120
|
"pretest": "yarn lint",
|
129
121
|
"prelint": "yarn setup",
|
130
122
|
"lint": "yarn code-lint && yarn schema-lint && yarn type-lint",
|
131
|
-
"code-lint": "eslint --cache setup lib bin hot buildin benchmark \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
|
123
|
+
"code-lint": "eslint --cache setup lib bin hot buildin benchmark tooling \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
|
132
124
|
"type-lint": "tsc --pretty",
|
133
125
|
"fix": "yarn code-lint --fix",
|
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
|
+
"pretty": "prettier --write \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"tooling/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\" \"tsconfig.json\"",
|
135
127
|
"schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
|
136
128
|
"benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
|
137
129
|
"cover": "yarn cover:init && yarn cover:all && yarn cover:report",
|