webpack 4.16.0 → 4.16.4

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 (71) hide show
  1. package/README.md +5 -2
  2. package/SECURITY.md +9 -9
  3. package/buildin/global.js +20 -20
  4. package/buildin/module.js +22 -22
  5. package/hot/log-apply-result.js +44 -44
  6. package/hot/log.js +2 -0
  7. package/lib/BasicEvaluatedExpression.js +211 -211
  8. package/lib/Chunk.js +32 -10
  9. package/lib/ChunkGroup.js +3 -3
  10. package/lib/Compilation.js +47 -11
  11. package/lib/ContextExclusionPlugin.js +11 -0
  12. package/lib/ContextModule.js +116 -30
  13. package/lib/ContextModuleFactory.js +6 -0
  14. package/lib/DefinePlugin.js +49 -0
  15. package/lib/DelegatedModule.js +5 -0
  16. package/lib/DependenciesBlock.js +1 -1
  17. package/lib/DllModule.js +6 -0
  18. package/lib/DllReferencePlugin.js +51 -3
  19. package/lib/ExternalModule.js +6 -0
  20. package/lib/Generator.js +11 -3
  21. package/lib/HotModuleReplacementPlugin.js +1 -5
  22. package/lib/MemoryOutputFileSystem.js +5 -5
  23. package/lib/Module.js +52 -12
  24. package/lib/MultiModule.js +6 -0
  25. package/lib/NodeStuffPlugin.js +18 -0
  26. package/lib/NormalModule.js +6 -0
  27. package/lib/NullFactory.js +12 -12
  28. package/lib/OptionsApply.js +10 -10
  29. package/lib/Parser.js +12 -3
  30. package/lib/RuntimeTemplate.js +12 -0
  31. package/lib/Stats.js +19 -2
  32. package/lib/Template.js +44 -43
  33. package/lib/WatchIgnorePlugin.js +18 -18
  34. package/lib/debug/ProfilingPlugin.js +1 -1
  35. package/lib/dependencies/AMDRequireItemDependency.js +22 -22
  36. package/lib/dependencies/CommonJsRequireDependency.js +22 -22
  37. package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +6 -0
  38. package/lib/dependencies/CriticalDependencyWarning.js +20 -20
  39. package/lib/dependencies/DelegatedSourceDependency.js +18 -18
  40. package/lib/dependencies/DllEntryDependency.js +20 -20
  41. package/lib/dependencies/LocalModule.js +23 -23
  42. package/lib/dependencies/ModuleHotAcceptDependency.js +23 -23
  43. package/lib/dependencies/ModuleHotDeclineDependency.js +23 -23
  44. package/lib/dependencies/PrefetchDependency.js +18 -18
  45. package/lib/dependencies/RequireEnsureItemDependency.js +21 -21
  46. package/lib/dependencies/RequireResolveDependency.js +22 -22
  47. package/lib/node/NodeOutputFileSystem.js +22 -22
  48. package/lib/node/NodeTargetPlugin.js +1 -0
  49. package/lib/optimize/ConcatenatedModule.js +5 -0
  50. package/lib/optimize/OccurrenceChunkOrderPlugin.js +1 -1
  51. package/lib/optimize/OccurrenceModuleOrderPlugin.js +1 -1
  52. package/lib/optimize/OccurrenceOrderPlugin.js +2 -2
  53. package/lib/util/SortableSet.js +1 -0
  54. package/lib/util/StackedSetMap.js +12 -3
  55. package/lib/wasm/WebAssemblyGenerator.js +22 -5
  56. package/lib/wasm/WebAssemblyJavascriptGenerator.js +16 -2
  57. package/lib/webpack.js +1 -0
  58. package/package.json +12 -20
  59. package/schemas/WebpackOptions.json +2 -6
  60. package/schemas/ajv.absolutePath.js +55 -55
  61. package/schemas/plugins/BannerPlugin.json +96 -96
  62. package/schemas/plugins/DllPlugin.json +32 -32
  63. package/schemas/plugins/DllReferencePlugin.json +99 -99
  64. package/schemas/plugins/HashedModuleIdsPlugin.json +24 -24
  65. package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
  66. package/schemas/plugins/SourceMapDevToolPlugin.json +187 -187
  67. package/schemas/plugins/WatchIgnorePlugin.json +16 -16
  68. package/schemas/plugins/debug/ProfilingPlugin.json +12 -12
  69. package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +22 -22
  70. package/schemas/plugins/optimize/LimitChunkCountPlugin.json +15 -15
  71. package/schemas/plugins/optimize/MinChunkSizePlugin.json +13 -13
@@ -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
- generate(module, dependencyTemplates, runtimeTemplate) {
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: dep.userRequest,
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.0",
3
+ "version": "4.16.4",
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",
@@ -16,7 +16,7 @@
16
16
  "ajv-keywords": "^3.1.0",
17
17
  "chrome-trace-event": "^1.0.0",
18
18
  "enhanced-resolve": "^4.1.0",
19
- "eslint-scope": "^3.7.1",
19
+ "eslint-scope": "^4.0.0",
20
20
  "json-parse-better-errors": "^1.0.2",
21
21
  "loader-runner": "^2.3.0",
22
22
  "loader-utils": "^1.1.0",
@@ -43,11 +43,11 @@
43
43
  "coveralls": "^2.11.2",
44
44
  "css-loader": "^0.28.3",
45
45
  "es6-promise-polyfill": "^1.1.1",
46
- "eslint": "^4.19.1",
46
+ "eslint": "^5.2.0",
47
47
  "eslint-config-prettier": "^2.9.0",
48
- "eslint-plugin-jest": "^21.17.0",
49
- "eslint-plugin-node": "^6.0.1",
50
- "eslint-plugin-prettier": "^2.6.0",
48
+ "eslint-plugin-jest": "^21.18.0",
49
+ "eslint-plugin-node": "^7.0.1",
50
+ "eslint-plugin-prettier": "^2.6.2",
51
51
  "express": "~4.13.1",
52
52
  "file-loader": "^1.1.6",
53
53
  "glob": "^7.1.2",
@@ -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.3.0",
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
- "lint-staged": "^7.1.0",
64
+ "lint-staged": "^7.2.0",
65
65
  "lodash": "^4.17.4",
66
- "prettier": "^1.13.5",
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",
@@ -73,7 +73,7 @@
73
73
  "script-loader": "~0.7.0",
74
74
  "simple-git": "^1.65.0",
75
75
  "style-loader": "^0.19.1",
76
- "typescript": "^2.9.1",
76
+ "typescript": "^3.0.0-rc",
77
77
  "url-loader": "^0.6.2",
78
78
  "val-loader": "^1.0.2",
79
79
  "vm-browserify": "~0.0.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",
@@ -410,11 +410,7 @@
410
410
  },
411
411
  "hashDigest": {
412
412
  "description": "Digest type used for the hash",
413
- "enum": [
414
- "latin1",
415
- "hex",
416
- "base64"
417
- ]
413
+ "type": "string"
418
414
  },
419
415
  "hashDigestLength": {
420
416
  "description": "Number of chars which are used for the hash",
@@ -1596,7 +1592,7 @@
1596
1592
  "type": "boolean"
1597
1593
  },
1598
1594
  "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)",
1595
+ "description": "Define the algorithm to choose module ids (natural: numeric ids in order of 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
1596
  "enum": [
1601
1597
  "natural",
1602
1598
  "named",
@@ -1,55 +1,55 @@
1
- "use strict";
2
-
3
- const errorMessage = (schema, data, message) => ({
4
- keyword: "absolutePath",
5
- params: { absolutePath: data },
6
- message: message,
7
- parentSchema: schema
8
- });
9
-
10
- const getErrorFor = (shouldBeAbsolute, data, schema) => {
11
- const message = shouldBeAbsolute
12
- ? `The provided value ${JSON.stringify(data)} is not an absolute path!`
13
- : `A relative path is expected. However, the provided value ${JSON.stringify(
14
- data
15
- )} is an absolute path!`;
16
-
17
- return errorMessage(schema, data, message);
18
- };
19
-
20
- module.exports = ajv =>
21
- ajv.addKeyword("absolutePath", {
22
- errors: true,
23
- type: "string",
24
- compile(expected, schema) {
25
- function callback(data) {
26
- let passes = true;
27
- const isExclamationMarkPresent = data.includes("!");
28
- const isCorrectAbsoluteOrRelativePath =
29
- expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
30
-
31
- if (isExclamationMarkPresent) {
32
- callback.errors = [
33
- errorMessage(
34
- schema,
35
- data,
36
- `The provided value ${JSON.stringify(
37
- data
38
- )} contans exclamation mark (!) which is not allowed because it's reserved for loader syntax.`
39
- )
40
- ];
41
- passes = false;
42
- }
43
-
44
- if (!isCorrectAbsoluteOrRelativePath) {
45
- callback.errors = [getErrorFor(expected, data, schema)];
46
- passes = false;
47
- }
48
-
49
- return passes;
50
- }
51
- callback.errors = [];
52
-
53
- return callback;
54
- }
55
- });
1
+ "use strict";
2
+
3
+ const errorMessage = (schema, data, message) => ({
4
+ keyword: "absolutePath",
5
+ params: { absolutePath: data },
6
+ message: message,
7
+ parentSchema: schema
8
+ });
9
+
10
+ const getErrorFor = (shouldBeAbsolute, data, schema) => {
11
+ const message = shouldBeAbsolute
12
+ ? `The provided value ${JSON.stringify(data)} is not an absolute path!`
13
+ : `A relative path is expected. However, the provided value ${JSON.stringify(
14
+ data
15
+ )} is an absolute path!`;
16
+
17
+ return errorMessage(schema, data, message);
18
+ };
19
+
20
+ module.exports = ajv =>
21
+ ajv.addKeyword("absolutePath", {
22
+ errors: true,
23
+ type: "string",
24
+ compile(expected, schema) {
25
+ function callback(data) {
26
+ let passes = true;
27
+ const isExclamationMarkPresent = data.includes("!");
28
+ const isCorrectAbsoluteOrRelativePath =
29
+ expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
30
+
31
+ if (isExclamationMarkPresent) {
32
+ callback.errors = [
33
+ errorMessage(
34
+ schema,
35
+ data,
36
+ `The provided value ${JSON.stringify(
37
+ data
38
+ )} contans exclamation mark (!) which is not allowed because it's reserved for loader syntax.`
39
+ )
40
+ ];
41
+ passes = false;
42
+ }
43
+
44
+ if (!isCorrectAbsoluteOrRelativePath) {
45
+ callback.errors = [getErrorFor(expected, data, schema)];
46
+ passes = false;
47
+ }
48
+
49
+ return passes;
50
+ }
51
+ callback.errors = [];
52
+
53
+ return callback;
54
+ }
55
+ });
@@ -1,96 +1,96 @@
1
- {
2
- "definitions": {
3
- "rule": {
4
- "oneOf": [
5
- {
6
- "instanceof": "RegExp"
7
- },
8
- {
9
- "minLength": 1,
10
- "type": "string"
11
- }
12
- ]
13
- },
14
- "rules": {
15
- "oneOf": [
16
- {
17
- "items": {
18
- "description": "A rule condition",
19
- "anyOf": [
20
- {
21
- "$ref": "#/definitions/rule"
22
- }
23
- ]
24
- },
25
- "type": "array"
26
- },
27
- {
28
- "$ref": "#/definitions/rule"
29
- }
30
- ]
31
- }
32
- },
33
- "oneOf": [
34
- {
35
- "type": "object",
36
- "additionalProperties": false,
37
- "required": [
38
- "banner"
39
- ],
40
- "properties": {
41
- "banner": {
42
- "description": "Specifies the banner",
43
- "anyOf": [
44
- {
45
- "instanceof": "Function"
46
- },
47
- {
48
- "type": "string"
49
- }
50
- ]
51
- },
52
- "raw": {
53
- "description": "If true, banner will not be wrapped in a comment",
54
- "type": "boolean"
55
- },
56
- "entryOnly": {
57
- "description": "If true, the banner will only be added to the entry chunks",
58
- "type": "boolean"
59
- },
60
- "test": {
61
- "description": "Include all modules that pass test assertion",
62
- "anyOf": [
63
- {
64
- "$ref": "#/definitions/rules"
65
- }
66
- ]
67
- },
68
- "include": {
69
- "description": "Include all modules matching any of these conditions",
70
- "anyOf": [
71
- {
72
- "$ref": "#/definitions/rules"
73
- }
74
- ]
75
- },
76
- "exclude": {
77
- "description": "Exclude all modules matching any of these conditions",
78
- "anyOf": [
79
- {
80
- "$ref": "#/definitions/rules"
81
- }
82
- ]
83
- }
84
- }
85
- },
86
- {
87
- "description": "The banner as function, it will be wrapped in a comment",
88
- "instanceof": "Function"
89
- },
90
- {
91
- "description": "The banner as string, it will be wrapped in a comment",
92
- "minLength": 1,
93
- "type": "string"
94
- }
95
- ]
96
- }
1
+ {
2
+ "definitions": {
3
+ "rule": {
4
+ "oneOf": [
5
+ {
6
+ "instanceof": "RegExp"
7
+ },
8
+ {
9
+ "minLength": 1,
10
+ "type": "string"
11
+ }
12
+ ]
13
+ },
14
+ "rules": {
15
+ "oneOf": [
16
+ {
17
+ "items": {
18
+ "description": "A rule condition",
19
+ "anyOf": [
20
+ {
21
+ "$ref": "#/definitions/rule"
22
+ }
23
+ ]
24
+ },
25
+ "type": "array"
26
+ },
27
+ {
28
+ "$ref": "#/definitions/rule"
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ "oneOf": [
34
+ {
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": [
38
+ "banner"
39
+ ],
40
+ "properties": {
41
+ "banner": {
42
+ "description": "Specifies the banner",
43
+ "anyOf": [
44
+ {
45
+ "instanceof": "Function"
46
+ },
47
+ {
48
+ "type": "string"
49
+ }
50
+ ]
51
+ },
52
+ "raw": {
53
+ "description": "If true, banner will not be wrapped in a comment",
54
+ "type": "boolean"
55
+ },
56
+ "entryOnly": {
57
+ "description": "If true, the banner will only be added to the entry chunks",
58
+ "type": "boolean"
59
+ },
60
+ "test": {
61
+ "description": "Include all modules that pass test assertion",
62
+ "anyOf": [
63
+ {
64
+ "$ref": "#/definitions/rules"
65
+ }
66
+ ]
67
+ },
68
+ "include": {
69
+ "description": "Include all modules matching any of these conditions",
70
+ "anyOf": [
71
+ {
72
+ "$ref": "#/definitions/rules"
73
+ }
74
+ ]
75
+ },
76
+ "exclude": {
77
+ "description": "Exclude all modules matching any of these conditions",
78
+ "anyOf": [
79
+ {
80
+ "$ref": "#/definitions/rules"
81
+ }
82
+ ]
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "description": "The banner as function, it will be wrapped in a comment",
88
+ "instanceof": "Function"
89
+ },
90
+ {
91
+ "description": "The banner as string, it will be wrapped in a comment",
92
+ "minLength": 1,
93
+ "type": "string"
94
+ }
95
+ ]
96
+ }
@@ -1,32 +1,32 @@
1
- {
2
- "additionalProperties": false,
3
- "required": [
4
- "path"
5
- ],
6
- "properties": {
7
- "context": {
8
- "description": "Context of requests in the manifest file (defaults to the webpack context)",
9
- "minLength": 1,
10
- "type": "string"
11
- },
12
- "name": {
13
- "description": "Name of the exposed dll function (external name, use value of 'output.library')",
14
- "minLength": 1,
15
- "type": "string"
16
- },
17
- "type": {
18
- "description": "Type of the dll bundle (external type, use value of 'output.libraryTarget')",
19
- "minLength": 1,
20
- "type": "string"
21
- },
22
- "path": {
23
- "description": "Absolute path to the manifest json file (output)",
24
- "minLength": 1,
25
- "type": "string"
26
- },
27
- "entryOnly": {
28
- "description": "If true, only entry points will be exposed",
29
- "type": "boolean"
30
- }
31
- }
32
- }
1
+ {
2
+ "additionalProperties": false,
3
+ "required": [
4
+ "path"
5
+ ],
6
+ "properties": {
7
+ "context": {
8
+ "description": "Context of requests in the manifest file (defaults to the webpack context)",
9
+ "minLength": 1,
10
+ "type": "string"
11
+ },
12
+ "name": {
13
+ "description": "Name of the exposed dll function (external name, use value of 'output.library')",
14
+ "minLength": 1,
15
+ "type": "string"
16
+ },
17
+ "type": {
18
+ "description": "Type of the dll bundle (external type, use value of 'output.libraryTarget')",
19
+ "minLength": 1,
20
+ "type": "string"
21
+ },
22
+ "path": {
23
+ "description": "Absolute path to the manifest json file (output)",
24
+ "minLength": 1,
25
+ "type": "string"
26
+ },
27
+ "entryOnly": {
28
+ "description": "If true, only entry points will be exposed",
29
+ "type": "boolean"
30
+ }
31
+ }
32
+ }