webpack 5.37.1 → 5.39.1

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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (68) hide show
  1. package/bin/webpack.js +20 -5
  2. package/lib/AsyncDependencyToInitialChunkError.js +0 -2
  3. package/lib/CaseSensitiveModulesWarning.js +0 -2
  4. package/lib/Chunk.js +6 -2
  5. package/lib/ChunkRenderError.js +0 -2
  6. package/lib/CodeGenerationError.js +0 -2
  7. package/lib/CommentCompilationWarning.js +0 -2
  8. package/lib/Compilation.js +43 -28
  9. package/lib/Compiler.js +3 -0
  10. package/lib/ConcurrentCompilationError.js +0 -2
  11. package/lib/ContextModule.js +2 -1
  12. package/lib/ContextModuleFactory.js +3 -1
  13. package/lib/DllReferencePlugin.js +0 -2
  14. package/lib/EntryPlugin.js +3 -3
  15. package/lib/ExportsInfo.js +20 -13
  16. package/lib/HarmonyLinkingError.js +0 -2
  17. package/lib/HookWebpackError.js +0 -1
  18. package/lib/HotModuleReplacementPlugin.js +7 -2
  19. package/lib/InvalidDependenciesModuleWarning.js +0 -2
  20. package/lib/ModuleBuildError.js +0 -2
  21. package/lib/ModuleDependencyError.js +0 -2
  22. package/lib/ModuleDependencyWarning.js +0 -2
  23. package/lib/ModuleError.js +0 -2
  24. package/lib/ModuleNotFoundError.js +0 -2
  25. package/lib/ModuleParseError.js +0 -2
  26. package/lib/ModuleRestoreError.js +0 -2
  27. package/lib/ModuleStoreError.js +0 -2
  28. package/lib/ModuleWarning.js +0 -2
  29. package/lib/NoModeWarning.js +0 -2
  30. package/lib/NormalModule.js +4 -3
  31. package/lib/NormalModuleFactory.js +2 -0
  32. package/lib/UnsupportedFeatureWarning.js +0 -2
  33. package/lib/WarnDeprecatedOptionPlugin.js +0 -2
  34. package/lib/Watching.js +21 -14
  35. package/lib/WebpackError.js +0 -2
  36. package/lib/asset/AssetGenerator.js +27 -6
  37. package/lib/asset/AssetModulesPlugin.js +1 -1
  38. package/lib/cache/PackFileCacheStrategy.js +3 -0
  39. package/lib/config/defaults.js +9 -1
  40. package/lib/config/normalization.js +1 -0
  41. package/lib/config/target.js +7 -2
  42. package/lib/dependencies/ContextElementDependency.js +6 -1
  43. package/lib/dependencies/CriticalDependencyWarning.js +0 -2
  44. package/lib/dependencies/ImportParserPlugin.js +1 -0
  45. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +0 -2
  46. package/lib/dependencies/SystemPlugin.js +0 -2
  47. package/lib/errors/BuildCycleError.js +0 -1
  48. package/lib/hmr/LazyCompilationPlugin.js +3 -1
  49. package/lib/node/NodeEnvironmentPlugin.js +1 -0
  50. package/lib/optimize/ConcatenatedModule.js +9 -0
  51. package/lib/performance/AssetsOverSizeLimitWarning.js +0 -2
  52. package/lib/performance/EntrypointsOverSizeLimitWarning.js +0 -2
  53. package/lib/performance/NoAsyncChunksWarning.js +0 -2
  54. package/lib/schemes/DataUriPlugin.js +21 -2
  55. package/lib/serialization/BinaryMiddleware.js +3 -0
  56. package/lib/serialization/SerializerMiddleware.js +19 -0
  57. package/lib/stats/DefaultStatsFactoryPlugin.js +5 -4
  58. package/lib/util/ArrayQueue.js +8 -0
  59. package/lib/util/AsyncQueue.js +9 -0
  60. package/lib/util/createHash.js +5 -4
  61. package/lib/util/serialization.js +108 -59
  62. package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +0 -2
  63. package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +0 -2
  64. package/package.json +4 -4
  65. package/schemas/WebpackOptions.check.js +1 -1
  66. package/schemas/WebpackOptions.json +8 -0
  67. package/types.d.ts +24 -5
  68. package/lib/util/DataURI.js +0 -32
package/lib/Watching.js CHANGED
@@ -90,9 +90,13 @@ class Watching {
90
90
  this.running = true;
91
91
  if (this.watcher) {
92
92
  this.pausedWatcher = this.watcher;
93
+ this.lastWatcherStartTime = Date.now();
93
94
  this.watcher.pause();
94
95
  this.watcher = null;
96
+ } else if (!this.lastWatcherStartTime) {
97
+ this.lastWatcherStartTime = Date.now();
95
98
  }
99
+ this.compiler.fsStartTime = Date.now();
96
100
  this._mergeWithCollected(
97
101
  changedFiles ||
98
102
  (this.pausedWatcher &&
@@ -104,6 +108,19 @@ class Watching {
104
108
  this.pausedWatcher.getAggregatedRemovals &&
105
109
  this.pausedWatcher.getAggregatedRemovals()))
106
110
  );
111
+
112
+ this.compiler.modifiedFiles = this._collectedChangedFiles;
113
+ this._collectedChangedFiles = undefined;
114
+ this.compiler.removedFiles = this._collectedRemovedFiles;
115
+ this._collectedRemovedFiles = undefined;
116
+
117
+ this.compiler.fileTimestamps =
118
+ fileTimeInfoEntries ||
119
+ (this.pausedWatcher && this.pausedWatcher.getFileTimeInfoEntries());
120
+ this.compiler.contextTimestamps =
121
+ contextTimeInfoEntries ||
122
+ (this.pausedWatcher && this.pausedWatcher.getContextTimeInfoEntries());
123
+
107
124
  const run = () => {
108
125
  if (this.compiler.idle) {
109
126
  return this.compiler.cache.endIdle(err => {
@@ -120,19 +137,6 @@ class Watching {
120
137
  run();
121
138
  });
122
139
  }
123
-
124
- this.compiler.modifiedFiles = this._collectedChangedFiles;
125
- this._collectedChangedFiles = undefined;
126
- this.compiler.removedFiles = this._collectedRemovedFiles;
127
- this._collectedRemovedFiles = undefined;
128
-
129
- this.compiler.fileTimestamps =
130
- fileTimeInfoEntries ||
131
- (this.pausedWatcher && this.pausedWatcher.getFileTimeInfoEntries());
132
- this.compiler.contextTimestamps =
133
- contextTimeInfoEntries ||
134
- (this.pausedWatcher && this.pausedWatcher.getContextTimeInfoEntries());
135
-
136
140
  this.invalid = false;
137
141
  this._invalidReported = false;
138
142
  this.compiler.hooks.watchRun.callAsync(this.compiler, err => {
@@ -295,7 +299,7 @@ class Watching {
295
299
  files,
296
300
  dirs,
297
301
  missing,
298
- this.startTime,
302
+ this.lastWatcherStartTime,
299
303
  this.watchOptions,
300
304
  (
301
305
  err,
@@ -309,6 +313,7 @@ class Watching {
309
313
  this.compiler.removedFiles = undefined;
310
314
  this.compiler.fileTimestamps = undefined;
311
315
  this.compiler.contextTimestamps = undefined;
316
+ this.compiler.fsStartTime = undefined;
312
317
  return this.handler(err);
313
318
  }
314
319
  this._invalidate(
@@ -357,6 +362,7 @@ class Watching {
357
362
  }
358
363
 
359
364
  if (this.running) {
365
+ this._mergeWithCollected(changedFiles, removedFiles);
360
366
  this.invalid = true;
361
367
  } else {
362
368
  this._go(
@@ -399,6 +405,7 @@ class Watching {
399
405
  this.compiler.removedFiles = undefined;
400
406
  this.compiler.fileTimestamps = undefined;
401
407
  this.compiler.contextTimestamps = undefined;
408
+ this.compiler.fsStartTime = undefined;
402
409
  const shutdown = () => {
403
410
  this.compiler.cache.shutdown(err => {
404
411
  this.compiler.hooks.watchClose.call();
@@ -31,8 +31,6 @@ class WebpackError extends Error {
31
31
  this.chunk = undefined;
32
32
  /** @type {string} */
33
33
  this.file = undefined;
34
-
35
- Error.captureStackTrace(this, this.constructor);
36
34
  }
37
35
 
38
36
  [inspect]() {
@@ -120,12 +120,33 @@ class AssetGenerator extends Generator {
120
120
  }
121
121
  );
122
122
  } else {
123
- const encoding = this.dataUrlOptions.encoding;
124
- const ext = path.extname(module.nameForCondition());
125
- const mimeType =
126
- this.dataUrlOptions.mimetype || mimeTypes.lookup(ext);
127
-
128
- if (!mimeType) {
123
+ /** @type {string | false | undefined} */
124
+ let encoding = this.dataUrlOptions.encoding;
125
+ if (encoding === undefined) {
126
+ if (
127
+ module.resourceResolveData &&
128
+ module.resourceResolveData.encoding !== undefined
129
+ ) {
130
+ encoding = module.resourceResolveData.encoding;
131
+ }
132
+ }
133
+ if (encoding === undefined) {
134
+ encoding = "base64";
135
+ }
136
+ let ext;
137
+ let mimeType = this.dataUrlOptions.mimetype;
138
+ if (mimeType === undefined) {
139
+ ext = path.extname(module.nameForCondition());
140
+ if (
141
+ module.resourceResolveData &&
142
+ module.resourceResolveData.mimetype !== undefined
143
+ ) {
144
+ mimeType = module.resourceResolveData.mimetype;
145
+ } else if (ext) {
146
+ mimeType = mimeTypes.lookup(ext);
147
+ }
148
+ }
149
+ if (typeof mimeType !== "string") {
129
150
  throw new Error(
130
151
  "DataUrl can't be generated automatically, " +
131
152
  `because there is no mimetype for "${ext}" in mimetype database. ` +
@@ -129,7 +129,7 @@ class AssetModulesPlugin {
129
129
  dataUrl = generatorOptions.dataUrl;
130
130
  if (!dataUrl || typeof dataUrl === "object") {
131
131
  dataUrl = {
132
- encoding: "base64",
132
+ encoding: undefined,
133
133
  mimetype: undefined,
134
134
  ...dataUrl
135
135
  };
@@ -8,6 +8,7 @@
8
8
  const FileSystemInfo = require("../FileSystemInfo");
9
9
  const ProgressPlugin = require("../ProgressPlugin");
10
10
  const { formatSize } = require("../SizeFormatHelpers");
11
+ const SerializerMiddleware = require("../serialization/SerializerMiddleware");
11
12
  const LazySet = require("../util/LazySet");
12
13
  const makeSerializable = require("../util/makeSerializable");
13
14
  const memoize = require("../util/memoize");
@@ -715,6 +716,7 @@ class PackContent {
715
716
  this.logger.timeEnd(timeMessage);
716
717
  }
717
718
  this.content = map;
719
+ this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
718
720
  return map.get(identifier);
719
721
  });
720
722
  } else {
@@ -723,6 +725,7 @@ class PackContent {
723
725
  this.logger.timeEnd(timeMessage);
724
726
  }
725
727
  this.content = map;
728
+ this.lazy = SerializerMiddleware.unMemoizeLazy(this.lazy);
726
729
  return map.get(identifier);
727
730
  }
728
731
  }
@@ -478,7 +478,15 @@ const applyModuleDefaults = (
478
478
  },
479
479
  {
480
480
  dependency: "url",
481
- type: "asset/resource"
481
+ oneOf: [
482
+ {
483
+ scheme: /^data$/,
484
+ type: "asset/inline"
485
+ },
486
+ {
487
+ type: "asset/resource"
488
+ }
489
+ ]
482
490
  }
483
491
  ];
484
492
  if (asyncWebAssembly) {
@@ -129,6 +129,7 @@ const getNormalizedWebpackOptions = config => {
129
129
  case "filesystem":
130
130
  return {
131
131
  type: "filesystem",
132
+ allowCollectingMemory: cache.allowCollectingMemory,
132
133
  maxMemoryGenerations: cache.maxMemoryGenerations,
133
134
  maxAge: cache.maxAge,
134
135
  profile: cache.profile,
@@ -5,14 +5,18 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const browserslistTargetHandler = require("./browserslistTargetHandler");
8
+ const memoize = require("../util/memoize");
9
+
10
+ const getBrowserslistTargetHandler = memoize(() =>
11
+ require("./browserslistTargetHandler")
12
+ );
9
13
 
10
14
  /**
11
15
  * @param {string} context the context directory
12
16
  * @returns {string} default target
13
17
  */
14
18
  const getDefaultTarget = context => {
15
- const browsers = browserslistTargetHandler.load(null, context);
19
+ const browsers = getBrowserslistTargetHandler().load(null, context);
16
20
  return browsers ? "browserslist" : "web";
17
21
  };
18
22
 
@@ -78,6 +82,7 @@ const TARGETS = [
78
82
  "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config",
79
83
  /^browserslist(?::(.+))?$/,
80
84
  (rest, context) => {
85
+ const browserslistTargetHandler = getBrowserslistTargetHandler();
81
86
  const browsers = browserslistTargetHandler.load(
82
87
  rest ? rest.trim() : null,
83
88
  context
@@ -14,9 +14,10 @@ const ModuleDependency = require("./ModuleDependency");
14
14
  /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
15
15
 
16
16
  class ContextElementDependency extends ModuleDependency {
17
- constructor(request, userRequest, category, referencedExports) {
17
+ constructor(request, userRequest, typePrefix, category, referencedExports) {
18
18
  super(request);
19
19
  this.referencedExports = referencedExports;
20
+ this._typePrefix = typePrefix;
20
21
  this._category = category;
21
22
 
22
23
  if (userRequest) {
@@ -25,6 +26,10 @@ class ContextElementDependency extends ModuleDependency {
25
26
  }
26
27
 
27
28
  get type() {
29
+ if (this._typePrefix) {
30
+ return `${this._typePrefix} context element`;
31
+ }
32
+
28
33
  return "context element";
29
34
  }
30
35
 
@@ -14,8 +14,6 @@ class CriticalDependencyWarning extends WebpackError {
14
14
 
15
15
  this.name = "CriticalDependencyWarning";
16
16
  this.message = "Critical dependency: " + message;
17
-
18
- Error.captureStackTrace(this, this.constructor);
19
17
  }
20
18
  }
21
19
 
@@ -248,6 +248,7 @@ class ImportParserPlugin {
248
248
  namespaceObject: parser.state.module.buildMeta.strictHarmonyModule
249
249
  ? "strict"
250
250
  : true,
251
+ typePrefix: "import()",
251
252
  category: "esm",
252
253
  referencedExports: exports
253
254
  },
@@ -67,8 +67,6 @@ class RequireIncludeDeprecationWarning extends WebpackError {
67
67
  this.name = "RequireIncludeDeprecationWarning";
68
68
 
69
69
  this.loc = loc;
70
-
71
- Error.captureStackTrace(this, this.constructor);
72
70
  }
73
71
  }
74
72
 
@@ -127,8 +127,6 @@ class SystemImportDeprecationWarning extends WebpackError {
127
127
  this.name = "SystemImportDeprecationWarning";
128
128
 
129
129
  this.loc = loc;
130
-
131
- Error.captureStackTrace(this, this.constructor);
132
130
  }
133
131
  }
134
132
 
@@ -21,7 +21,6 @@ class BuildCycleError extends WebpackError {
21
21
 
22
22
  this.name = "BuildCycleError";
23
23
  this.module = module;
24
- Error.captureStackTrace(this, this.constructor);
25
24
  }
26
25
  }
27
26
 
@@ -350,7 +350,9 @@ class LazyCompilationPlugin {
350
350
  resolveData.dependencies.every(
351
351
  dep =>
352
352
  IGNORED_DEPENDENCY_TYPES.has(dep.type) ||
353
- (this.imports && dep.type === "import()") ||
353
+ (this.imports &&
354
+ (dep.type === "import()" ||
355
+ dep.type === "import() context element")) ||
354
356
  (this.entries && dep.type === "entry")
355
357
  ) &&
356
358
  !/webpack[/\\]hot[/\\]|webpack-dev-server[/\\]client/.test(
@@ -50,6 +50,7 @@ class NodeEnvironmentPlugin {
50
50
  );
51
51
  compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
52
52
  if (compiler.inputFileSystem === inputFileSystem) {
53
+ compiler.fsStartTime = Date.now();
53
54
  inputFileSystem.purge();
54
55
  }
55
56
  });
@@ -6,6 +6,7 @@
6
6
  "use strict";
7
7
 
8
8
  const eslintScope = require("eslint-scope");
9
+ const Referencer = require("eslint-scope/lib/referencer");
9
10
  const {
10
11
  CachedSource,
11
12
  ConcatSource,
@@ -58,6 +59,14 @@ const {
58
59
  /** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
59
60
  /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
60
61
 
62
+ // fix eslint-scope to support class properties correctly
63
+ // cspell:word Referencer
64
+ const ReferencerClass = Referencer;
65
+ if (!ReferencerClass.prototype.PropertyDefinition) {
66
+ ReferencerClass.prototype.PropertyDefinition =
67
+ ReferencerClass.prototype.Property;
68
+ }
69
+
61
70
  /**
62
71
  * @typedef {Object} ReexportInfo
63
72
  * @property {Module} module
@@ -28,7 +28,5 @@ Assets: ${assetLists}`);
28
28
 
29
29
  this.name = "AssetsOverSizeLimitWarning";
30
30
  this.assets = assetsOverSizeLimit;
31
-
32
- Error.captureStackTrace(this, this.constructor);
33
31
  }
34
32
  };
@@ -31,7 +31,5 @@ Entrypoints:${entrypointList}\n`);
31
31
 
32
32
  this.name = "EntrypointsOverSizeLimitWarning";
33
33
  this.entrypoints = entrypoints;
34
-
35
- Error.captureStackTrace(this, this.constructor);
36
34
  }
37
35
  };
@@ -16,7 +16,5 @@ module.exports = class NoAsyncChunksWarning extends WebpackError {
16
16
  );
17
17
 
18
18
  this.name = "NoAsyncChunksWarning";
19
-
20
- Error.captureStackTrace(this, this.constructor);
21
19
  }
22
20
  };
@@ -6,10 +6,25 @@
6
6
  "use strict";
7
7
 
8
8
  const NormalModule = require("../NormalModule");
9
- const { getMimetype, decodeDataURI } = require("../util/DataURI");
10
9
 
11
10
  /** @typedef {import("../Compiler")} Compiler */
12
11
 
12
+ // data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string"
13
+ // http://www.ietf.org/rfc/rfc2397.txt
14
+ const URIRegEx = /^data:(?:[^;,]+)?(?:(?:;[^;,]+)*?)(;base64)?,(.*)$/i;
15
+ const URIMetaRegEx = /^data:([^;,]+)?(?:(?:;[^;,]+)*?)(?:;(base64))?,/i;
16
+
17
+ const decodeDataURI = uri => {
18
+ const match = URIRegEx.exec(uri);
19
+ if (!match) return null;
20
+
21
+ const isBase64 = match[1];
22
+ const body = match[2];
23
+ return isBase64
24
+ ? Buffer.from(body, "base64")
25
+ : Buffer.from(decodeURIComponent(body), "ascii");
26
+ };
27
+
13
28
  class DataUriPlugin {
14
29
  /**
15
30
  * Apply the plugin
@@ -23,7 +38,11 @@ class DataUriPlugin {
23
38
  normalModuleFactory.hooks.resolveForScheme
24
39
  .for("data")
25
40
  .tap("DataUriPlugin", resourceData => {
26
- resourceData.data.mimetype = getMimetype(resourceData.resource);
41
+ const match = URIMetaRegEx.exec(resourceData.resource);
42
+ if (match) {
43
+ resourceData.data.mimetype = match[1] || "";
44
+ resourceData.data.encoding = match[2] || false;
45
+ }
27
46
  });
28
47
  NormalModule.getCompilationHooks(compilation)
29
48
  .readResourceForScheme.for("data")
@@ -100,6 +100,9 @@ const F64_SIZE = 8;
100
100
  const MEASURE_START_OPERATION = Symbol("MEASURE_START_OPERATION");
101
101
  const MEASURE_END_OPERATION = Symbol("MEASURE_END_OPERATION");
102
102
 
103
+ /** @typedef {typeof MEASURE_START_OPERATION} MEASURE_START_OPERATION_TYPE */
104
+ /** @typedef {typeof MEASURE_END_OPERATION} MEASURE_END_OPERATION_TYPE */
105
+
103
106
  const identifyNumber = n => {
104
107
  if (n === (n | 0)) {
105
108
  if (n <= 127 && n >= -128) return 0;
@@ -126,6 +126,25 @@ class SerializerMiddleware {
126
126
  fn[LAZY_SERIALIZED_VALUE] = lazy;
127
127
  return fn;
128
128
  }
129
+
130
+ /**
131
+ * @param {function(): Promise<any> | any} lazy lazy function
132
+ * @returns {function(): Promise<any> | any} new lazy
133
+ */
134
+ static unMemoizeLazy(lazy) {
135
+ if (!SerializerMiddleware.isLazy(lazy)) return lazy;
136
+ const fn = () => {
137
+ throw new Error(
138
+ "A lazy value that has been unmemorized can't be called again"
139
+ );
140
+ };
141
+ fn[LAZY_SERIALIZED_VALUE] = SerializerMiddleware.unMemoizeLazy(
142
+ lazy[LAZY_SERIALIZED_VALUE]
143
+ );
144
+ fn[LAZY_TARGET] = lazy[LAZY_TARGET];
145
+ fn.options = /** @type {any} */ (lazy).options;
146
+ return fn;
147
+ }
129
148
  }
130
149
 
131
150
  module.exports = SerializerMiddleware;
@@ -10,7 +10,6 @@ const ModuleDependency = require("../dependencies/ModuleDependency");
10
10
  const formatLocation = require("../formatLocation");
11
11
  const { LogType } = require("../logging/Logger");
12
12
  const AggressiveSplittingPlugin = require("../optimize/AggressiveSplittingPlugin");
13
- const ConcatenatedModule = require("../optimize/ConcatenatedModule");
14
13
  const SizeLimitsPlugin = require("../performance/SizeLimitsPlugin");
15
14
  const { countIterable } = require("../util/IterableHelpers");
16
15
  const {
@@ -1227,11 +1226,13 @@ const SIMPLE_EXTRACTORS = {
1227
1226
  },
1228
1227
  nestedModules: (object, module, context, options, factory) => {
1229
1228
  const { type } = context;
1230
- if (module instanceof ConcatenatedModule) {
1231
- const modules = module.modules;
1229
+ const innerModules = /** @type {Module & { modules?: Module[] }} */ (
1230
+ module
1231
+ ).modules;
1232
+ if (Array.isArray(innerModules)) {
1232
1233
  const groupedModules = factory.create(
1233
1234
  `${type.slice(0, -8)}.modules`,
1234
- modules,
1235
+ innerModules,
1235
1236
  context
1236
1237
  );
1237
1238
  const limited = spaceLimited(
@@ -27,6 +27,14 @@ class ArrayQueue {
27
27
  return this._list.length + this._listReversed.length;
28
28
  }
29
29
 
30
+ /**
31
+ * Empties the queue.
32
+ */
33
+ clear() {
34
+ this._list.length = 0;
35
+ this._listReversed.length = 0;
36
+ }
37
+
30
38
  /**
31
39
  * Appends the specified element to this queue.
32
40
  * @param {T} item The element to add.
@@ -359,6 +359,15 @@ class AsyncQueue {
359
359
  inHandleResult--;
360
360
  });
361
361
  }
362
+
363
+ clear() {
364
+ this._entries.clear();
365
+ this._queued.clear();
366
+ this._activeTasks = 0;
367
+ this._willEnsureProcessing = false;
368
+ this._needProcessing = false;
369
+ this._stopped = false;
370
+ }
362
371
  }
363
372
 
364
373
  module.exports = AsyncQueue;
@@ -67,6 +67,7 @@ class BulkUpdateDecorator extends Hash {
67
67
  */
68
68
  digest(encoding) {
69
69
  let digestCache;
70
+ const buffer = this.buffer;
70
71
  if (this.hash === undefined) {
71
72
  // short data for hash, we can use caching
72
73
  const cacheKey = `${this.hashKey}-${encoding}`;
@@ -74,18 +75,18 @@ class BulkUpdateDecorator extends Hash {
74
75
  if (digestCache === undefined) {
75
76
  digestCache = digestCaches[cacheKey] = new Map();
76
77
  }
77
- const cacheEntry = digestCache.get(this.buffer);
78
+ const cacheEntry = digestCache.get(buffer);
78
79
  if (cacheEntry !== undefined) return cacheEntry;
79
80
  this.hash = this.hashFactory();
80
81
  }
81
- if (this.buffer.length > 0) {
82
- this.hash.update(this.buffer);
82
+ if (buffer.length > 0) {
83
+ this.hash.update(buffer);
83
84
  }
84
85
  const digestResult = this.hash.digest(encoding);
85
86
  const result =
86
87
  typeof digestResult === "string" ? digestResult : digestResult.toString();
87
88
  if (digestCache !== undefined) {
88
- digestCache.set(this.buffer, result);
89
+ digestCache.set(buffer, result);
89
90
  }
90
91
  return result;
91
92
  }