webpack 4.28.3 → 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/README.md CHANGED
@@ -43,6 +43,23 @@
43
43
  </p>
44
44
  </div>
45
45
 
46
+ ## Table of Contents
47
+
48
+ 1. [Install](#install)
49
+ 2. [Introduction](#introduction)
50
+ 3. [Concepts](#concepts)
51
+ 4. [Contributing](#contributing)
52
+ 5. [Support](#support)
53
+ 6. [Core Team](#core-team)
54
+ 7. [Sponsoring](#sponsoring)
55
+ 8. [Premium Partners](#premium-partners)
56
+ 9. [Other Backers and Sponsors](#other-backers-and-sponsors)
57
+ 10. [Gold Sponsors](#gold-sponsors)
58
+ 11. [Silver Sponsors](#silver-sponsors)
59
+ 12. [Bronze Sponsors](#bronze-sponsors)
60
+ 13. [Backers](#backers)
61
+ 14. [Special Thanks](#special-thanks-to)
62
+
46
63
  <h2 align="center">Install</h2>
47
64
 
48
65
  Install with npm:
@@ -329,7 +346,7 @@ If you create a loader or plugin, we would <3 for you to open source it, and put
329
346
 
330
347
  <h2 align="center">Support</h2>
331
348
 
332
- We consider webpack to be a low-level tool used not only individually but also layered beneath other awesome tools. Because of it's flexibility, webpack isn't always the _easiest_ entry-level solution, however we do believe it is the most powerful. That said, we're always looking for ways improve and simplify the tool without compromising functionality. If you have any ideas on ways to accomplish this, we're all ears!
349
+ We consider webpack to be a low-level tool used not only individually but also layered beneath other awesome tools. Because of its flexibility, webpack isn't always the _easiest_ entry-level solution, however we do believe it is the most powerful. That said, we're always looking for ways improve and simplify the tool without compromising functionality. If you have any ideas on ways to accomplish this, we're all ears!
333
350
 
334
351
  If you're just getting started, take a look at [our new docs and concepts page](https://webpack.js.org/concepts/). This has a high level overview that is great for beginners!!
335
352
 
@@ -724,7 +741,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI"></a>
724
741
  <a href="https://opencollective.com/webpack/backer/99/website?requireActive=false" target="_blank"><img src="https://opencollective.com/webpack/backer/99/avatar.svg?requireActive=false"></a>
725
742
  <a href="https://opencollective.com/webpack/backer/100/website?requireActive=false" target="_blank"><img src="https://opencollective.com/webpack/backer/100/avatar.svg?requireActive=false"></a>
726
743
 
727
- <h2 align="center">Thanks to</h2>
744
+ <h2 align="center">Special Thanks to</h2>
728
745
  <p align="center">(In chronological order)</p>
729
746
 
730
747
  * @google for [Google Web Toolkit (GWT)](http://www.gwtproject.org/), which aims to compile Java to JavaScript. It features a similar [Code Splitting](http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html) as webpack.
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".
@@ -1051,6 +1051,10 @@ export interface OutputOptions {
1051
1051
  * Specifies the name of each output file on disk. You must **not** specify an absolute path here! The `output.path` option determines the location on disk the files are written to, filename is used solely for naming the individual files.
1052
1052
  */
1053
1053
  filename?: string | Function;
1054
+ /**
1055
+ * Use the future version of asset emitting logic, which is allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version.
1056
+ */
1057
+ futureEmitAssets?: boolean;
1054
1058
  /**
1055
1059
  * An expression which is used to address the global object/scope in runtime code
1056
1060
  */
@@ -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
@@ -491,6 +491,8 @@ class Compilation extends Tapable {
491
491
  this._buildingModules = new Map();
492
492
  /** @private @type {Map<Module, Callback[]>} */
493
493
  this._rebuildingModules = new Map();
494
+ /** @type {Set<string>} */
495
+ this.emittedAssets = new Set();
494
496
  }
495
497
 
496
498
  getStats() {
package/lib/Compiler.js CHANGED
@@ -7,6 +7,7 @@
7
7
  const parseJson = require("json-parse-better-errors");
8
8
  const asyncLib = require("neo-async");
9
9
  const path = require("path");
10
+ const { Source } = require("webpack-sources");
10
11
  const util = require("util");
11
12
  const {
12
13
  Tapable,
@@ -188,6 +189,11 @@ class Compiler extends Tapable {
188
189
 
189
190
  /** @type {boolean} */
190
191
  this.watchMode = false;
192
+
193
+ /** @private @type {WeakMap<Source, { sizeOnlySource: SizeOnlySource, writtenTo: Map<string, number> }>} */
194
+ this._assetEmittingSourceCache = new WeakMap();
195
+ /** @private @type {Map<string, number>} */
196
+ this._assetEmittingWrittenFiles = new Map();
191
197
  }
192
198
 
193
199
  watch(watchOptions, handler) {
@@ -207,6 +213,10 @@ class Compiler extends Tapable {
207
213
  const finalCallback = (err, stats) => {
208
214
  this.running = false;
209
215
 
216
+ if (err) {
217
+ this.hooks.failed.call(err);
218
+ }
219
+
210
220
  if (callback !== undefined) return callback(err, stats);
211
221
  };
212
222
 
@@ -308,8 +318,9 @@ class Compiler extends Tapable {
308
318
  const emitFiles = err => {
309
319
  if (err) return callback(err);
310
320
 
311
- asyncLib.forEach(
321
+ asyncLib.forEachLimit(
312
322
  compilation.assets,
323
+ 15,
313
324
  (source, file, callback) => {
314
325
  let targetFile = file;
315
326
  const queryStringIdx = targetFile.indexOf("?");
@@ -323,19 +334,86 @@ class Compiler extends Tapable {
323
334
  outputPath,
324
335
  targetFile
325
336
  );
326
- if (source.existsAt === targetPath) {
327
- source.emitted = false;
328
- return callback();
337
+ // TODO webpack 5 remove futureEmitAssets option and make it on by default
338
+ if (this.options.output.futureEmitAssets) {
339
+ // check if the target file has already been written by this Compiler
340
+ const targetFileGeneration = this._assetEmittingWrittenFiles.get(
341
+ targetPath
342
+ );
343
+
344
+ // create an cache entry for this Source if not already existing
345
+ let cacheEntry = this._assetEmittingSourceCache.get(source);
346
+ if (cacheEntry === undefined) {
347
+ cacheEntry = {
348
+ sizeOnlySource: undefined,
349
+ writtenTo: new Map()
350
+ };
351
+ this._assetEmittingSourceCache.set(source, cacheEntry);
352
+ }
353
+
354
+ // if the target file has already been written
355
+ if (targetFileGeneration !== undefined) {
356
+ // check if the Source has been written to this target file
357
+ const writtenGeneration = cacheEntry.writtenTo.get(targetPath);
358
+ if (writtenGeneration === targetFileGeneration) {
359
+ // if yes, we skip writing the file
360
+ // as it's already there
361
+ // (we assume one doesn't remove files while the Compiler is running)
362
+ return callback();
363
+ }
364
+ }
365
+
366
+ // get the binary (Buffer) content from the Source
367
+ /** @type {Buffer} */
368
+ let content;
369
+ if (typeof source.buffer === "function") {
370
+ content = source.buffer();
371
+ } else {
372
+ const bufferOrString = source.source();
373
+ if (Buffer.isBuffer(bufferOrString)) {
374
+ content = bufferOrString;
375
+ } else {
376
+ content = Buffer.from(bufferOrString, "utf8");
377
+ }
378
+ }
379
+
380
+ // Create a replacement resource which only allows to ask for size
381
+ // This allows to GC all memory allocated by the Source
382
+ // (expect when the Source is stored in any other cache)
383
+ cacheEntry.sizeOnlySource = new SizeOnlySource(content.length);
384
+ compilation.assets[file] = cacheEntry.sizeOnlySource;
385
+
386
+ // Write the file to output file system
387
+ this.outputFileSystem.writeFile(targetPath, content, err => {
388
+ if (err) return callback(err);
389
+
390
+ // information marker that the asset has been emitted
391
+ compilation.emittedAssets.add(file);
392
+
393
+ // cache the information that the Source has been written to that location
394
+ const newGeneration =
395
+ targetFileGeneration === undefined
396
+ ? 1
397
+ : targetFileGeneration + 1;
398
+ cacheEntry.writtenTo.set(targetPath, newGeneration);
399
+ this._assetEmittingWrittenFiles.set(targetPath, newGeneration);
400
+ callback();
401
+ });
402
+ } else {
403
+ if (source.existsAt === targetPath) {
404
+ source.emitted = false;
405
+ return callback();
406
+ }
407
+ let content = source.source();
408
+
409
+ if (!Buffer.isBuffer(content)) {
410
+ content = Buffer.from(content, "utf8");
411
+ }
412
+
413
+ source.existsAt = targetPath;
414
+ source.emitted = true;
415
+ this.outputFileSystem.writeFile(targetPath, content, callback);
329
416
  }
330
- let content = source.source();
331
-
332
- if (!Buffer.isBuffer(content)) {
333
- content = Buffer.from(content, "utf8");
334
- }
335
-
336
- source.existsAt = targetPath;
337
- source.emitted = true;
338
- this.outputFileSystem.writeFile(targetPath, content, callback);
339
417
  };
340
418
 
341
419
  if (targetFile.match(/\/|\\/)) {
@@ -558,3 +636,48 @@ class Compiler extends Tapable {
558
636
  }
559
637
 
560
638
  module.exports = Compiler;
639
+
640
+ class SizeOnlySource extends Source {
641
+ constructor(size) {
642
+ super();
643
+ this._size = size;
644
+ }
645
+
646
+ _error() {
647
+ return new Error(
648
+ "Content and Map of this Source is no longer available (only size() is supported)"
649
+ );
650
+ }
651
+
652
+ size() {
653
+ return this._size;
654
+ }
655
+
656
+ /**
657
+ * @param {any} options options
658
+ * @returns {string} the source
659
+ */
660
+ source(options) {
661
+ throw this._error();
662
+ }
663
+
664
+ node() {
665
+ throw this._error();
666
+ }
667
+
668
+ listMap() {
669
+ throw this._error();
670
+ }
671
+
672
+ map() {
673
+ throw this._error();
674
+ }
675
+
676
+ listNode() {
677
+ throw this._error();
678
+ }
679
+
680
+ updateHash() {
681
+ throw this._error();
682
+ }
683
+ }
@@ -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
@@ -6,7 +6,8 @@
6
6
 
7
7
  // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
8
8
 
9
- const acorn = require("acorn-dynamic-import").default;
9
+ const acorn = require("acorn");
10
+ const acornDynamicImport = require("acorn-dynamic-import").default;
10
11
  const { Tapable, SyncBailHook, HookMap } = require("tapable");
11
12
  const util = require("util");
12
13
  const vm = require("vm");
@@ -14,6 +15,8 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
14
15
  const StackedSetMap = require("./util/StackedSetMap");
15
16
  const TrackingSet = require("./util/TrackingSet");
16
17
 
18
+ const acornParser = acorn.Parser.extend(acornDynamicImport);
19
+
17
20
  const joinRanges = (startRange, endRange) => {
18
21
  if (!endRange) return startRange;
19
22
  if (!startRange) return endRange;
@@ -25,10 +28,7 @@ const defaultParserOptions = {
25
28
  locations: true,
26
29
  ecmaVersion: 2019,
27
30
  sourceType: "module",
28
- onComment: null,
29
- plugins: {
30
- dynamicImport: true
31
- }
31
+ onComment: null
32
32
  };
33
33
 
34
34
  // regexp to match at lease one "magic comment"
@@ -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": {
@@ -2133,9 +2133,13 @@ class Parser extends Tapable {
2133
2133
  sourceType: this.sourceType,
2134
2134
  locations: false
2135
2135
  });
2136
+ // TODO(https://github.com/acornjs/acorn/issues/741)
2137
+ // @ts-ignore
2136
2138
  if (ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") {
2137
2139
  throw new Error("evaluate: Source is not a expression");
2138
2140
  }
2141
+ // TODO(https://github.com/acornjs/acorn/issues/741)
2142
+ // @ts-ignore
2139
2143
  return this.evaluateExpression(ast.body[0].expression);
2140
2144
  }
2141
2145
 
@@ -2226,7 +2230,7 @@ class Parser extends Tapable {
2226
2230
  let error;
2227
2231
  let threw = false;
2228
2232
  try {
2229
- ast = acorn.parse(code, parserOptions);
2233
+ ast = acornParser.parse(code, parserOptions);
2230
2234
  } catch (e) {
2231
2235
  error = e;
2232
2236
  threw = true;
@@ -2238,7 +2242,7 @@ class Parser extends Tapable {
2238
2242
  parserOptions.onComment.length = 0;
2239
2243
  }
2240
2244
  try {
2241
- ast = acorn.parse(code, parserOptions);
2245
+ ast = acornParser.parse(code, parserOptions);
2242
2246
  threw = false;
2243
2247
  } catch (e) {
2244
2248
  threw = true;
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) {
@@ -400,7 +400,10 @@ class Stats {
400
400
  size: compilation.assets[asset].size(),
401
401
  chunks: [],
402
402
  chunkNames: [],
403
- emitted: compilation.assets[asset].emitted
403
+ // TODO webpack 5: remove .emitted
404
+ emitted:
405
+ compilation.assets[asset].emitted ||
406
+ compilation.emittedAssets.has(asset)
404
407
  };
405
408
 
406
409
  if (showPerformance) {
@@ -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,
@@ -463,7 +463,7 @@ class WebpackOptionsApply extends OptionsApply {
463
463
  if (options.optimization.minimize) {
464
464
  for (const minimizer of options.optimization.minimizer) {
465
465
  if (typeof minimizer === "function") {
466
- minimizer.apply(compiler);
466
+ minimizer.call(compiler, compiler);
467
467
  } else {
468
468
  minimizer.apply(compiler);
469
469
  }
@@ -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));
@@ -36,8 +36,12 @@ module.exports = class AMDRequireDependenciesBlock extends AsyncDependenciesBloc
36
36
  } else {
37
37
  this.range = expr.range;
38
38
  }
39
- const dep = new AMDRequireDependency(this);
39
+ const dep = this.newRequireDependency();
40
40
  dep.loc = loc;
41
41
  this.addDependency(dep);
42
42
  }
43
+
44
+ newRequireDependency() {
45
+ return new AMDRequireDependency(this);
46
+ }
43
47
  };
@@ -13,9 +13,13 @@ module.exports = class HarmonyDetectionParserPlugin {
13
13
  const isStrictHarmony = parser.state.module.type === "javascript/esm";
14
14
  const isHarmony =
15
15
  isStrictHarmony ||
16
- ast.body.some(statement => {
17
- return /^(Import|Export).*Declaration$/.test(statement.type);
18
- });
16
+ ast.body.some(
17
+ statement =>
18
+ statement.type === "ImportDeclaration" ||
19
+ statement.type === "ExportDefaultDeclaration" ||
20
+ statement.type === "ExportNamedDeclaration" ||
21
+ statement.type === "ExportAllDeclaration"
22
+ );
19
23
  if (isHarmony) {
20
24
  const module = parser.state.module;
21
25
  const compatDep = new HarmonyCompatibilityDependency(module);
@@ -1096,7 +1096,7 @@ class ConcatenatedModule extends Module {
1096
1096
 
1097
1097
  // add harmony compatibility flag (must be first because of possible circular dependencies)
1098
1098
  const usedExports = this.rootModule.usedExports;
1099
- if (usedExports === true) {
1099
+ if (usedExports === true || usedExports === null) {
1100
1100
  result.add(
1101
1101
  runtimeTemplate.defineEsModuleFlagStatement({
1102
1102
  exportsArgument: this.exportsArgument
@@ -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.28.3",
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",
@@ -9,8 +9,8 @@
9
9
  "@webassemblyjs/helper-module-context": "1.7.11",
10
10
  "@webassemblyjs/wasm-edit": "1.7.11",
11
11
  "@webassemblyjs/wasm-parser": "1.7.11",
12
- "acorn": "^5.6.2",
13
- "acorn-dynamic-import": "^3.0.0",
12
+ "acorn": "^6.0.5",
13
+ "acorn-dynamic-import": "^4.0.0",
14
14
  "ajv": "^6.1.0",
15
15
  "ajv-keywords": "^3.1.0",
16
16
  "chrome-trace-event": "^1.0.0",
@@ -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",
@@ -867,6 +867,10 @@
867
867
  }
868
868
  ]
869
869
  },
870
+ "futureEmitAssets": {
871
+ "description": "Use the future version of asset emitting logic, which is allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after emitting. Will be the new default in the next major version.",
872
+ "type": "boolean"
873
+ },
870
874
  "globalObject": {
871
875
  "description": "An expression which is used to address the global object/scope in runtime code",
872
876
  "type": "string",