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
@@ -1,79 +1,79 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
- "use strict";
6
-
7
- const t = require("@webassemblyjs/ast");
8
- const { decode } = require("@webassemblyjs/wasm-parser");
9
-
10
- const { Tapable } = require("tapable");
11
- const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
12
-
13
- /** @typedef {import("../Module")} Module */
14
-
15
- /**
16
- * @param {t.ModuleImport} n the import
17
- * @returns {boolean} true, if a memory was imported
18
- */
19
- const isMemoryImport = n => n.descr.type === "Memory";
20
-
21
- /**
22
- * @param {t.ModuleImport} n the import
23
- * @returns {boolean} true, if a table was imported
24
- */
25
- const isTableImport = n => n.descr.type === "Table";
26
-
27
- const decoderOpts = {
28
- ignoreCodeSection: true,
29
- ignoreDataSection: true
30
- };
31
-
32
- class WebAssemblyParser extends Tapable {
33
- constructor(options) {
34
- super();
35
- this.hooks = {};
36
- this.options = options;
37
- }
38
-
39
- parse(binary, state) {
40
- // flag it as ESM
41
- state.module.buildMeta.exportsType = "namespace";
42
-
43
- // parse it
44
- const ast = decode(binary, decoderOpts);
45
-
46
- // extract imports and exports
47
- const exports = (state.module.buildMeta.providedExports = []);
48
- t.traverse(ast, {
49
- ModuleExport({ node }) {
50
- exports.push(node.name);
51
- },
52
-
53
- ModuleImport({ node }) {
54
- let onlyDirectImport = false;
55
-
56
- if (isMemoryImport(node) === true) {
57
- onlyDirectImport = true;
58
- }
59
-
60
- if (isTableImport(node) === true) {
61
- onlyDirectImport = true;
62
- }
63
-
64
- const dep = new WebAssemblyImportDependency(
65
- node.module,
66
- node.name,
67
- node.descr,
68
- onlyDirectImport
69
- );
70
-
71
- state.module.addDependency(dep);
72
- }
73
- });
74
-
75
- return state;
76
- }
77
- }
78
-
79
- module.exports = WebAssemblyParser;
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+ */
5
+ "use strict";
6
+
7
+ const t = require("@webassemblyjs/ast");
8
+ const { decode } = require("@webassemblyjs/wasm-parser");
9
+
10
+ const { Tapable } = require("tapable");
11
+ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
12
+
13
+ /** @typedef {import("../Module")} Module */
14
+
15
+ /**
16
+ * @param {t.ModuleImport} n the import
17
+ * @returns {boolean} true, if a memory was imported
18
+ */
19
+ const isMemoryImport = n => n.descr.type === "Memory";
20
+
21
+ /**
22
+ * @param {t.ModuleImport} n the import
23
+ * @returns {boolean} true, if a table was imported
24
+ */
25
+ const isTableImport = n => n.descr.type === "Table";
26
+
27
+ const decoderOpts = {
28
+ ignoreCodeSection: true,
29
+ ignoreDataSection: true
30
+ };
31
+
32
+ class WebAssemblyParser extends Tapable {
33
+ constructor(options) {
34
+ super();
35
+ this.hooks = {};
36
+ this.options = options;
37
+ }
38
+
39
+ parse(binary, state) {
40
+ // flag it as ESM
41
+ state.module.buildMeta.exportsType = "namespace";
42
+
43
+ // parse it
44
+ const ast = decode(binary, decoderOpts);
45
+
46
+ // extract imports and exports
47
+ const exports = (state.module.buildMeta.providedExports = []);
48
+ t.traverse(ast, {
49
+ ModuleExport({ node }) {
50
+ exports.push(node.name);
51
+ },
52
+
53
+ ModuleImport({ node }) {
54
+ let onlyDirectImport = false;
55
+
56
+ if (isMemoryImport(node) === true) {
57
+ onlyDirectImport = true;
58
+ }
59
+
60
+ if (isTableImport(node) === true) {
61
+ onlyDirectImport = true;
62
+ }
63
+
64
+ const dep = new WebAssemblyImportDependency(
65
+ node.module,
66
+ node.name,
67
+ node.descr,
68
+ onlyDirectImport
69
+ );
70
+
71
+ state.module.addDependency(dep);
72
+ }
73
+ });
74
+
75
+ return state;
76
+ }
77
+ }
78
+
79
+ module.exports = WebAssemblyParser;
@@ -173,7 +173,6 @@ class JsonpMainTemplatePlugin {
173
173
  "onScriptComplete({ type: 'timeout', target: script });"
174
174
  ]),
175
175
  `}, ${chunkLoadTimeout});`,
176
- "script.onerror = script.onload = onScriptComplete;",
177
176
  "function onScriptComplete(event) {",
178
177
  Template.indent([
179
178
  "// avoid mem leaks in IE.",
@@ -196,7 +195,8 @@ class JsonpMainTemplatePlugin {
196
195
  ]),
197
196
  "}"
198
197
  ]),
199
- "};"
198
+ "};",
199
+ "script.onerror = script.onload = onScriptComplete;"
200
200
  ]);
201
201
  }
202
202
  );
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.8.2",
3
+ "version": "4.9.2",
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.4.2",
9
- "@webassemblyjs/wasm-edit": "1.4.2",
10
- "@webassemblyjs/wasm-parser": "1.4.2",
8
+ "@webassemblyjs/ast": "1.4.3",
9
+ "@webassemblyjs/wasm-edit": "1.4.3",
10
+ "@webassemblyjs/wasm-parser": "1.4.3",
11
11
  "acorn": "^5.0.0",
12
12
  "acorn-dynamic-import": "^3.0.0",
13
13
  "ajv": "^6.1.0",
@@ -15,6 +15,7 @@
15
15
  "chrome-trace-event": "^0.1.1",
16
16
  "enhanced-resolve": "^4.0.0",
17
17
  "eslint-scope": "^3.7.1",
18
+ "json-parse-better-errors": "^1.0.2",
18
19
  "loader-runner": "^2.3.0",
19
20
  "loader-utils": "^1.1.0",
20
21
  "memory-fs": "~0.4.1",
@@ -51,7 +52,7 @@
51
52
  "istanbul": "^0.4.5",
52
53
  "jade": "^1.11.0",
53
54
  "jade-loader": "~0.8.0",
54
- "jest": "23.0.0-alpha.5",
55
+ "jest": "23.0.0-charlie.3",
55
56
  "jest-silent-reporter": "0.0.4",
56
57
  "json-loader": "^0.5.7",
57
58
  "less": "^2.5.1",
@@ -67,10 +68,11 @@
67
68
  "script-loader": "~0.7.0",
68
69
  "simple-git": "^1.65.0",
69
70
  "style-loader": "^0.19.1",
70
- "typescript": "^2.9.0-dev.20180506",
71
+ "typescript": "^2.9.0-dev.20180518",
71
72
  "url-loader": "^0.6.2",
72
73
  "val-loader": "^1.0.2",
73
74
  "vm-browserify": "~0.0.0",
75
+ "wast-loader": "^1.5.5",
74
76
  "webpack-dev-middleware": "^1.9.0",
75
77
  "worker-loader": "^1.1.1",
76
78
  "xxhashjs": "^0.2.1"
@@ -99,13 +101,14 @@
99
101
  "setup": "node ./setup/setup.js",
100
102
  "test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest",
101
103
  "test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
104
+ "test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
102
105
  "test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
103
- "travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST && yarn cover:report-min",
104
- "travis:unit": "yarn cover:init && yarn cover:unit --ci",
105
- "travis:lint": "yarn lint",
106
+ "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",
107
+ "travis:basic": "yarn test:basic --ci $JEST",
108
+ "travis:lint-unit": "yarn lint && yarn cover:init && yarn cover:unit --ci $JEST",
106
109
  "travis:benchmark": "yarn benchmark --ci",
107
- "appveyor:integration": "yarn cover:init && yarn cover:integration --ci %JEST% && yarn cover:report-min",
108
- "appveyor:unit": "yarn cover:init && yarn cover:unit --ci && yarn cover:report-min",
110
+ "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",
111
+ "appveyor:unit": "yarn cover:init && yarn cover:unit --ci %JEST%",
109
112
  "appveyor:benchmark": "yarn benchmark --ci",
110
113
  "circleci:test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --ci",
111
114
  "circleci:lint": "yarn lint",
@@ -113,10 +116,10 @@
113
116
  "pretest": "yarn lint",
114
117
  "prelint": "yarn setup",
115
118
  "lint": "yarn code-lint && yarn schema-lint && yarn type-lint",
116
- "code-lint": "eslint setup lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
119
+ "code-lint": "eslint --cache setup lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
117
120
  "type-lint": "tsc --pretty",
118
121
  "fix": "yarn code-lint --fix",
119
- "pretty": "prettier \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\" --write",
122
+ "pretty": "prettier --write \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\" \"declarations.d.ts\"",
120
123
  "schema-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
121
124
  "benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
122
125
  "cover": "yarn cover:init && yarn cover:all && yarn cover:report",
@@ -124,8 +127,7 @@
124
127
  "cover:all": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --coverage",
125
128
  "cover:integration": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\" --coverage",
126
129
  "cover:unit": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
127
- "cover:report": "istanbul report",
128
- "cover:report-min": "istanbul report --report lcovonly"
130
+ "cover:report": "istanbul report"
129
131
  },
130
132
  "jest": {
131
133
  "forceExit": true,
@@ -142,7 +144,8 @@
142
144
  "<rootDir>/test/fixtures/temp-",
143
145
  "<rootDir>/benchmark/",
144
146
  "<rootDir>/examples/*/dist",
145
- "<rootDir>/coverage/"
147
+ "<rootDir>/coverage/",
148
+ "<rootDir>/.eslintcache/"
146
149
  ],
147
150
  "modulePathIgnorePatterns": [
148
151
  "<rootDir>/node_modules/webpack/node_modules/",
@@ -152,7 +155,8 @@
152
155
  "<rootDir>/test/fixtures/temp-",
153
156
  "<rootDir>/benchmark/",
154
157
  "<rootDir>/examples/*/dist",
155
- "<rootDir>/coverage/"
158
+ "<rootDir>/coverage/",
159
+ "<rootDir>/.eslintcache/"
156
160
  ],
157
161
  "transformIgnorePatterns": [
158
162
  "<rootDir>/"
@@ -492,7 +492,14 @@
492
492
  "properties": {
493
493
  "root": {
494
494
  "description": "Name of the property exposed globally by a UMD library",
495
- "type": "string"
495
+ "anyOf": [
496
+ {
497
+ "type": "string"
498
+ },
499
+ {
500
+ "$ref": "#/definitions/common.arrayOfStringValues"
501
+ }
502
+ ]
496
503
  },
497
504
  "amd": {
498
505
  "description": "Name of the exposed AMD library in the UMD",
@@ -1672,6 +1679,10 @@
1672
1679
  }
1673
1680
  ]
1674
1681
  },
1682
+ "serve": {
1683
+ "description": "Options for webpack-serve",
1684
+ "type": "object"
1685
+ },
1675
1686
  "stats": {
1676
1687
  "description": "Used by the webpack CLI program to pass stats options.",
1677
1688
  "anyOf": [
@@ -1,85 +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": "The banner as string, it will be wrapped in a comment",
43
- "type": "string"
44
- },
45
- "raw": {
46
- "description": "If true, banner will not be wrapped in a comment",
47
- "type": "boolean"
48
- },
49
- "entryOnly": {
50
- "description": "If true, the banner will only be added to the entry chunks",
51
- "type": "boolean"
52
- },
53
- "test": {
54
- "description": "Include all modules that pass test assertion",
55
- "anyOf": [
56
- {
57
- "$ref": "#/definitions/rules"
58
- }
59
- ]
60
- },
61
- "include": {
62
- "description": "Include all modules matching any of these conditions",
63
- "anyOf": [
64
- {
65
- "$ref": "#/definitions/rules"
66
- }
67
- ]
68
- },
69
- "exclude": {
70
- "description": "Exclude all modules matching any of these conditions",
71
- "anyOf": [
72
- {
73
- "$ref": "#/definitions/rules"
74
- }
75
- ]
76
- }
77
- }
78
- },
79
- {
80
- "description": "The banner as string, it will be wrapped in a comment",
81
- "minLength": 1,
82
- "type": "string"
83
- }
84
- ]
85
- }
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
+ }
@@ -23,6 +23,10 @@
23
23
  "description": "Absolute path to the manifest json file (output)",
24
24
  "minLength": 1,
25
25
  "type": "string"
26
+ },
27
+ "entryOnly": {
28
+ "description": "If true, only entry points will be exposed",
29
+ "type": "boolean"
26
30
  }
27
31
  }
28
32
  }