webpack 4.29.1 → 4.29.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/bin/webpack.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // @ts-ignore
3
4
  process.exitCode = 0;
4
5
 
5
6
  /**
@@ -164,5 +165,7 @@ if (installedClis.length === 0) {
164
165
  " and "
165
166
  )} together. To work with the "webpack" command you need only one CLI package, please remove one of them or use them directly via their binary.`
166
167
  );
168
+
169
+ // @ts-ignore
167
170
  process.exitCode = 1;
168
171
  }
@@ -15,7 +15,7 @@ export type Entry = EntryDynamic | EntryStatic;
15
15
  * This interface was referenced by `WebpackOptions`'s JSON-Schema
16
16
  * via the `definition` "EntryDynamic".
17
17
  */
18
- export type EntryDynamic = (() => EntryStatic | Promise<EntryStatic>);
18
+ export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
19
19
  /**
20
20
  * This interface was referenced by `WebpackOptions`'s JSON-Schema
21
21
  * via the `definition` "EntryStatic".
@@ -11,15 +11,13 @@ export type BannerPluginArgument =
11
11
  /**
12
12
  * The banner as function, it will be wrapped in a comment
13
13
  */
14
- export type BannerFunction = (
15
- data: {
16
- hash: string;
17
- chunk: import("../../lib/Chunk");
18
- filename: string;
19
- basename: string;
20
- query: string;
21
- }
22
- ) => string;
14
+ export type BannerFunction = (data: {
15
+ hash: string;
16
+ chunk: import("../../lib/Chunk");
17
+ filename: string;
18
+ basename: string;
19
+ query: string;
20
+ }) => string;
23
21
  export type Rules = Rule[] | Rule;
24
22
  export type Rule = RegExp | string;
25
23
 
@@ -19,9 +19,9 @@ export type IgnorePluginOptions =
19
19
  /**
20
20
  * A filter function for context
21
21
  */
22
- checkContext?: ((context: string) => boolean);
22
+ checkContext?: (context: string) => boolean;
23
23
  /**
24
24
  * A filter function for resource and context
25
25
  */
26
- checkResource?: ((resource: string, context: string) => boolean);
26
+ checkResource?: (resource: string, context: string) => boolean;
27
27
  };
@@ -8,11 +8,11 @@ export type ProgressPluginArgument = ProgressPluginOptions | HandlerFunction;
8
8
  /**
9
9
  * Function that executes for every progress step
10
10
  */
11
- export type HandlerFunction = ((
11
+ export type HandlerFunction = (
12
12
  percentage: number,
13
13
  msg: string,
14
14
  ...args: string[]
15
- ) => void);
15
+ ) => void;
16
16
 
17
17
  export interface ProgressPluginOptions {
18
18
  /**
@@ -40,8 +40,8 @@ class AmdMainTemplatePlugin {
40
40
  const onRenderWithEntry = (source, chunk, hash) => {
41
41
  const externals = chunk.getModules().filter(m => m.external);
42
42
  const externalsDepsArray = JSON.stringify(
43
- externals.map(
44
- m => (typeof m.request === "object" ? m.request.amd : m.request)
43
+ externals.map(m =>
44
+ typeof m.request === "object" ? m.request.amd : m.request
45
45
  )
46
46
  );
47
47
  const externalsArguments = externals
@@ -12,9 +12,8 @@ const stringifySafe = data => {
12
12
  return undefined; // Invalid JSON
13
13
  }
14
14
 
15
- return stringified.replace(
16
- /\u2028|\u2029/g,
17
- str => (str === "\u2029" ? "\\u2029" : "\\u2028")
15
+ return stringified.replace(/\u2028|\u2029/g, str =>
16
+ str === "\u2029" ? "\\u2029" : "\\u2028"
18
17
  ); // invalid in JavaScript but valid JSON
19
18
  };
20
19
 
package/lib/Parser.js CHANGED
@@ -1335,8 +1335,8 @@ class Parser extends Tapable {
1335
1335
  statement.kind === "const"
1336
1336
  ? this.hooks.varDeclarationConst
1337
1337
  : statement.kind === "let"
1338
- ? this.hooks.varDeclarationLet
1339
- : this.hooks.varDeclarationVar;
1338
+ ? this.hooks.varDeclarationLet
1339
+ : this.hooks.varDeclarationVar;
1340
1340
  for (const declarator of statement.declarations) {
1341
1341
  switch (declarator.type) {
1342
1342
  case "VariableDeclarator": {
package/lib/Stats.js CHANGED
@@ -288,8 +288,8 @@ class Stats {
288
288
  e.chunk.hasRuntime()
289
289
  ? " [entry]"
290
290
  : e.chunk.canBeInitial()
291
- ? " [initial]"
292
- : ""
291
+ ? " [initial]"
292
+ : ""
293
293
  }\n`;
294
294
  }
295
295
  if (e.file) {
@@ -236,12 +236,12 @@ class UmdMainTemplatePlugin {
236
236
  amdFactory +
237
237
  ");\n"
238
238
  : this.names.amd && this.namedDefine === true
239
- ? " define(" +
240
- libraryName(this.names.amd) +
241
- ", [], " +
242
- amdFactory +
243
- ");\n"
244
- : " define([], " + amdFactory + ");\n") +
239
+ ? " define(" +
240
+ libraryName(this.names.amd) +
241
+ ", [], " +
242
+ amdFactory +
243
+ ");\n"
244
+ : " define([], " + amdFactory + ");\n") +
245
245
  (this.names.root || this.names.commonjs
246
246
  ? getAuxilaryComment("commonjs") +
247
247
  " else if(typeof exports === 'object')\n" +
@@ -17,8 +17,8 @@ class IgnoringWatchFileSystem {
17
17
 
18
18
  watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
19
19
  const ignored = path =>
20
- this.paths.some(
21
- p => (p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0)
20
+ this.paths.some(p =>
21
+ p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
22
22
  );
23
23
 
24
24
  const notIgnored = path => !ignored(path);
@@ -260,10 +260,10 @@ class WebpackOptionsApply extends OptionsApply {
260
260
  "MappingURL=[url]\n//# source" +
261
261
  "MappingURL=[url]\n*/"
262
262
  : legacy
263
- ? "\n/*\n//@ source" + "MappingURL=[url]\n*/"
264
- : modern
265
- ? "\n//# source" + "MappingURL=[url]"
266
- : null;
263
+ ? "\n/*\n//@ source" + "MappingURL=[url]\n*/"
264
+ : modern
265
+ ? "\n//# source" + "MappingURL=[url]"
266
+ : null;
267
267
  const Plugin = evalWrapped
268
268
  ? EvalSourceMapDevToolPlugin
269
269
  : SourceMapDevToolPlugin;
@@ -286,10 +286,10 @@ class WebpackOptionsApply extends OptionsApply {
286
286
  legacy && modern
287
287
  ? "\n//@ sourceURL=[url]\n//# sourceURL=[url]"
288
288
  : legacy
289
- ? "\n//@ sourceURL=[url]"
290
- : modern
291
- ? "\n//# sourceURL=[url]"
292
- : null;
289
+ ? "\n//@ sourceURL=[url]"
290
+ : modern
291
+ ? "\n//# sourceURL=[url]"
292
+ : null;
293
293
  new EvalDevToolModulePlugin({
294
294
  sourceUrlComment: comment,
295
295
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
@@ -33,10 +33,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
33
33
 
34
34
  this.set("entry", "./src");
35
35
 
36
- this.set(
37
- "devtool",
38
- "make",
39
- options => (options.mode === "development" ? "eval" : false)
36
+ this.set("devtool", "make", options =>
37
+ options.mode === "development" ? "eval" : false
40
38
  );
41
39
  this.set("cache", "make", options => options.mode === "development");
42
40
 
@@ -193,10 +191,8 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
193
191
  });
194
192
  this.set("performance.maxAssetSize", 250000);
195
193
  this.set("performance.maxEntrypointSize", 250000);
196
- this.set(
197
- "performance.hints",
198
- "make",
199
- options => (isProductionLikeMode(options) ? "warning" : false)
194
+ this.set("performance.hints", "make", options =>
195
+ isProductionLikeMode(options) ? "warning" : false
200
196
  );
201
197
 
202
198
  this.set("optimization", "call", value => Object.assign({}, value));
@@ -123,7 +123,7 @@ class SideEffectsFlagPlugin {
123
123
  dep,
124
124
  reason.explanation
125
125
  ? reason.explanation +
126
- " (skipped side-effect-free modules)"
126
+ " (skipped side-effect-free modules)"
127
127
  : "(skipped side-effect-free modules)"
128
128
  );
129
129
  // removing the currect reason, by not adding it to the newReasons array
@@ -534,8 +534,8 @@ module.exports = class SplitChunksPlugin {
534
534
  cacheGroupSource.minSize !== undefined
535
535
  ? cacheGroupSource.minSize
536
536
  : cacheGroupSource.enforce
537
- ? 0
538
- : this.options.minSize,
537
+ ? 0
538
+ : this.options.minSize,
539
539
  minSizeForMaxSize:
540
540
  cacheGroupSource.minSize !== undefined
541
541
  ? cacheGroupSource.minSize
@@ -544,26 +544,26 @@ module.exports = class SplitChunksPlugin {
544
544
  cacheGroupSource.maxSize !== undefined
545
545
  ? cacheGroupSource.maxSize
546
546
  : cacheGroupSource.enforce
547
- ? 0
548
- : this.options.maxSize,
547
+ ? 0
548
+ : this.options.maxSize,
549
549
  minChunks:
550
550
  cacheGroupSource.minChunks !== undefined
551
551
  ? cacheGroupSource.minChunks
552
552
  : cacheGroupSource.enforce
553
- ? 1
554
- : this.options.minChunks,
553
+ ? 1
554
+ : this.options.minChunks,
555
555
  maxAsyncRequests:
556
556
  cacheGroupSource.maxAsyncRequests !== undefined
557
557
  ? cacheGroupSource.maxAsyncRequests
558
558
  : cacheGroupSource.enforce
559
- ? Infinity
560
- : this.options.maxAsyncRequests,
559
+ ? Infinity
560
+ : this.options.maxAsyncRequests,
561
561
  maxInitialRequests:
562
562
  cacheGroupSource.maxInitialRequests !== undefined
563
563
  ? cacheGroupSource.maxInitialRequests
564
564
  : cacheGroupSource.enforce
565
- ? Infinity
566
- : this.options.maxInitialRequests,
565
+ ? Infinity
566
+ : this.options.maxInitialRequests,
567
567
  getName:
568
568
  cacheGroupSource.getName !== undefined
569
569
  ? cacheGroupSource.getName
@@ -683,11 +683,11 @@ module.exports = class SplitChunksPlugin {
683
683
  const maxRequests = chunk.isOnlyInitial()
684
684
  ? item.cacheGroup.maxInitialRequests
685
685
  : chunk.canBeInitial()
686
- ? Math.min(
687
- item.cacheGroup.maxInitialRequests,
688
- item.cacheGroup.maxAsyncRequests
689
- )
690
- : item.cacheGroup.maxAsyncRequests;
686
+ ? Math.min(
687
+ item.cacheGroup.maxInitialRequests,
688
+ item.cacheGroup.maxAsyncRequests
689
+ )
690
+ : item.cacheGroup.maxAsyncRequests;
691
691
  return (
692
692
  !isFinite(maxRequests) || getRequests(chunk) < maxRequests
693
693
  );
@@ -96,12 +96,10 @@ class StackedSetMap {
96
96
 
97
97
  asPairArray() {
98
98
  this._compress();
99
- return Array.from(
100
- this.map.entries(),
101
- pair =>
102
- /** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER
103
- ? [pair[0], undefined]
104
- : pair)
99
+ return Array.from(this.map.entries(), pair =>
100
+ /** @type {[TODO, TODO]} */ (pair[1] === UNDEFINED_MARKER
101
+ ? [pair[0], undefined]
102
+ : pair)
105
103
  );
106
104
  }
107
105
 
@@ -156,8 +156,8 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
156
156
  // We hit an edgecase where the working set is already smaller than minSize
157
157
  // We merge it with the smallest result node to keep minSize intact
158
158
  if (result.length > 0) {
159
- const smallestGroup = result.reduce(
160
- (min, group) => (min.size > group.size ? group : min)
159
+ const smallestGroup = result.reduce((min, group) =>
160
+ min.size > group.size ? group : min
161
161
  );
162
162
  for (const node of initialGroup.nodes) smallestGroup.nodes.push(node);
163
163
  smallestGroup.nodes.sort((a, b) => {
@@ -36,11 +36,10 @@ const normalizePathSeparator = p => p.replace(/\\/g, "/");
36
36
  const _makePathsRelative = (context, identifier) => {
37
37
  return identifier
38
38
  .split(/([|! ])/)
39
- .map(
40
- str =>
41
- looksLikeAbsolutePath(str)
42
- ? normalizePathSeparator(path.relative(context, str))
43
- : str
39
+ .map(str =>
40
+ looksLikeAbsolutePath(str)
41
+ ? normalizePathSeparator(path.relative(context, str))
42
+ : str
44
43
  )
45
44
  .join("");
46
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.29.1",
3
+ "version": "4.29.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",
@@ -24,62 +24,61 @@
24
24
  "mkdirp": "~0.5.0",
25
25
  "neo-async": "^2.5.0",
26
26
  "node-libs-browser": "^2.0.0",
27
- "schema-utils": "^0.4.4",
27
+ "schema-utils": "^1.0.0",
28
28
  "tapable": "^1.1.0",
29
29
  "terser-webpack-plugin": "^1.1.0",
30
30
  "watchpack": "^1.5.0",
31
31
  "webpack-sources": "^1.3.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^9.6.4",
34
+ "@types/node": "^10.12.21",
35
35
  "@types/tapable": "^1.0.1",
36
36
  "@types/webpack-sources": "^0.1.4",
37
37
  "benchmark": "^2.1.1",
38
38
  "bundle-loader": "~0.5.0",
39
- "codacy-coverage": "^2.0.1",
40
39
  "coffee-loader": "^0.9.0",
41
- "coffeescript": "^1.10.0",
40
+ "coffeescript": "^2.3.2",
42
41
  "coveralls": "^3.0.2",
43
- "css-loader": "^0.28.3",
42
+ "css-loader": "^2.1.0",
44
43
  "es6-promise-polyfill": "^1.1.1",
45
44
  "eslint": "^5.8.0",
46
- "eslint-config-prettier": "^3.1.0",
47
- "eslint-plugin-jest": "^21.26.2",
45
+ "eslint-config-prettier": "^4.0.0",
46
+ "eslint-plugin-jest": "^22.2.2",
48
47
  "eslint-plugin-node": "^8.0.0",
49
48
  "eslint-plugin-prettier": "^3.0.0",
50
- "express": "~4.13.1",
51
- "file-loader": "^1.1.6",
49
+ "express": "~4.16.4",
50
+ "file-loader": "^3.0.1",
52
51
  "glob": "^7.1.3",
53
52
  "husky": "^1.1.3",
54
53
  "i18n-webpack-plugin": "^1.0.0",
55
54
  "istanbul": "^0.4.5",
56
55
  "jade": "^1.11.0",
57
56
  "jade-loader": "~0.8.0",
58
- "jest": "24.0.0-alpha.1",
59
- "jest-junit": "^5.2.0",
57
+ "jest": "24.1.0",
58
+ "jest-junit": "^6.2.1",
60
59
  "json-loader": "^0.5.7",
61
60
  "json-schema-to-typescript": "^6.0.1",
62
- "less": "^2.5.1",
61
+ "less": "^3.9.0",
63
62
  "less-loader": "^4.0.3",
64
63
  "lint-staged": "^8.0.4",
65
64
  "lodash": "^4.17.4",
66
65
  "prettier": "^1.14.3",
67
66
  "pug": "^2.0.3",
68
67
  "pug-loader": "^2.4.0",
69
- "raw-loader": "~0.5.0",
70
- "react": "^15.2.1",
71
- "react-dom": "^15.2.1",
68
+ "raw-loader": "^1.0.0",
69
+ "react": "^16.8.0",
70
+ "react-dom": "^16.8.0",
72
71
  "rimraf": "^2.6.2",
73
72
  "script-loader": "~0.7.0",
74
73
  "simple-git": "^1.65.0",
75
- "style-loader": "^0.19.1",
74
+ "style-loader": "^0.23.1",
76
75
  "typescript": "^3.0.0-rc",
77
- "url-loader": "^0.6.2",
76
+ "url-loader": "^1.1.2",
78
77
  "val-loader": "^1.0.2",
79
- "vm-browserify": "~0.0.0",
78
+ "vm-browserify": "~1.1.0",
80
79
  "wast-loader": "^1.5.5",
81
- "webpack-dev-middleware": "^1.9.0",
82
- "worker-loader": "^1.1.1",
80
+ "webpack-dev-middleware": "^3.5.1",
81
+ "worker-loader": "^2.0.0",
83
82
  "xxhashjs": "^0.2.1"
84
83
  },
85
84
  "engines": {
@@ -108,7 +107,7 @@
108
107
  "test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest",
109
108
  "test:update-snapshots": "yarn jest -u",
110
109
  "test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
111
- "test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
110
+ "test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"",
112
111
  "test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
113
112
  "travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST",
114
113
  "travis:basic": "yarn test:basic --ci $JEST",