webpack 5.37.0 → 5.37.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 (94) hide show
  1. package/README.md +5 -8
  2. package/lib/CacheFacade.js +3 -3
  3. package/lib/Chunk.js +2 -3
  4. package/lib/Compilation.js +43 -55
  5. package/lib/Compiler.js +4 -4
  6. package/lib/ConcatenationScope.js +2 -1
  7. package/lib/ContextModule.js +3 -3
  8. package/lib/ContextReplacementPlugin.js +4 -3
  9. package/lib/DefinePlugin.js +16 -12
  10. package/lib/EvalSourceMapDevToolPlugin.js +3 -1
  11. package/lib/FileSystemInfo.js +24 -30
  12. package/lib/FlagDependencyExportsPlugin.js +8 -7
  13. package/lib/FlagDependencyUsagePlugin.js +2 -4
  14. package/lib/HotModuleReplacementPlugin.js +20 -30
  15. package/lib/JavascriptMetaInfoPlugin.js +2 -1
  16. package/lib/MainTemplate.js +2 -3
  17. package/lib/ModuleFilenameHelpers.js +4 -2
  18. package/lib/ModuleGraphConnection.js +6 -2
  19. package/lib/ModuleInfoHeaderPlugin.js +2 -3
  20. package/lib/MultiCompiler.js +31 -27
  21. package/lib/NormalModule.js +22 -5
  22. package/lib/RecordIdsPlugin.js +5 -4
  23. package/lib/ResolverFactory.js +10 -7
  24. package/lib/SourceMapDevToolPlugin.js +13 -14
  25. package/lib/Template.js +4 -2
  26. package/lib/Watching.js +83 -46
  27. package/lib/asset/AssetGenerator.js +19 -23
  28. package/lib/buildChunkGraph.js +21 -21
  29. package/lib/cache/PackFileCacheStrategy.js +12 -9
  30. package/lib/config/defaults.js +12 -9
  31. package/lib/config/normalization.js +7 -7
  32. package/lib/debug/ProfilingPlugin.js +4 -3
  33. package/lib/dependencies/AMDRequireDependency.js +3 -3
  34. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -3
  35. package/lib/dependencies/CommonJsExportsParserPlugin.js +3 -1
  36. package/lib/dependencies/CommonJsImportsParserPlugin.js +2 -4
  37. package/lib/dependencies/CommonJsPlugin.js +8 -7
  38. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -1
  39. package/lib/dependencies/ContextDependencyHelpers.js +10 -8
  40. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +11 -13
  41. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +2 -4
  42. package/lib/dependencies/HarmonyImportSpecifierDependency.js +4 -11
  43. package/lib/dependencies/ImportDependency.js +3 -3
  44. package/lib/dependencies/ImportParserPlugin.js +2 -4
  45. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +2 -3
  46. package/lib/dependencies/RequireEnsureDependency.js +3 -3
  47. package/lib/dependencies/WorkerDependency.js +6 -6
  48. package/lib/dependencies/WorkerPlugin.js +18 -19
  49. package/lib/hmr/LazyCompilationPlugin.js +6 -4
  50. package/lib/ids/HashedModuleIdsPlugin.js +3 -3
  51. package/lib/ids/OccurrenceModuleIdsPlugin.js +2 -3
  52. package/lib/index.js +5 -3
  53. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -6
  54. package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -3
  55. package/lib/javascript/JavascriptGenerator.js +3 -1
  56. package/lib/javascript/JavascriptModulesPlugin.js +15 -23
  57. package/lib/javascript/JavascriptParser.js +10 -8
  58. package/lib/library/AssignLibraryPlugin.js +4 -2
  59. package/lib/node/NodeWatchFileSystem.js +19 -4
  60. package/lib/optimize/AggressiveSplittingPlugin.js +5 -4
  61. package/lib/optimize/ConcatenatedModule.js +22 -27
  62. package/lib/optimize/FlagIncludedChunksPlugin.js +4 -6
  63. package/lib/optimize/InnerGraph.js +9 -11
  64. package/lib/optimize/InnerGraphPlugin.js +3 -1
  65. package/lib/optimize/ModuleConcatenationPlugin.js +7 -10
  66. package/lib/optimize/RealContentHashPlugin.js +14 -16
  67. package/lib/optimize/SideEffectsFlagPlugin.js +6 -5
  68. package/lib/optimize/SplitChunksPlugin.js +13 -15
  69. package/lib/runtime/EnsureChunkRuntimeModule.js +9 -8
  70. package/lib/runtime/LoadScriptRuntimeModule.js +2 -3
  71. package/lib/runtime/OnChunksLoadedRuntimeModule.js +38 -37
  72. package/lib/serialization/BinaryMiddleware.js +2 -3
  73. package/lib/serialization/FileMiddleware.js +3 -1
  74. package/lib/serialization/ObjectMiddleware.js +11 -7
  75. package/lib/stats/DefaultStatsFactoryPlugin.js +2 -3
  76. package/lib/stats/DefaultStatsPrinterPlugin.js +11 -9
  77. package/lib/stats/StatsFactory.js +2 -1
  78. package/lib/stats/StatsPrinter.js +3 -3
  79. package/lib/util/LazyBucketSortedSet.js +3 -3
  80. package/lib/util/cleverMerge.js +3 -1
  81. package/lib/util/comparators.js +13 -13
  82. package/lib/util/identifier.js +2 -1
  83. package/lib/validateSchema.js +5 -3
  84. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +4 -4
  85. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +5 -4
  86. package/lib/wasm-sync/WebAssemblyGenerator.js +89 -83
  87. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -1
  88. package/lib/wasm-sync/WebAssemblyParser.js +6 -5
  89. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -4
  90. package/lib/webpack.js +11 -7
  91. package/package.json +6 -3
  92. package/schemas/WebpackOptions.check.js +1 -1
  93. package/schemas/WebpackOptions.json +68 -60
  94. package/types.d.ts +89 -257
package/README.md CHANGED
@@ -169,17 +169,14 @@ or are automatically applied via regex from your webpack configuration.
169
169
 
170
170
  #### Transpiling
171
171
 
172
- | Name | Status | Install Size | Description |
173
- | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------: | :-------------: | :--------------------------------------------------------------------------------------------------- |
174
- | <a href="https://github.com/babel/babel-loader"><img width="48" height="48" title="babel-loader" src="https://worldvectorlogo.com/logos/babel-10.svg"></a> | ![babel-npm] | ![babel-size] | Loads ES2015+ code and transpiles to ES5 using <a href="https://github.com/babel/babel">Babel</a> |
175
- | <a href="https://github.com/jupl/traceur-loader"><img width="48" height="48" src="https://google.github.com/traceur-compiler/logo/tc.svg"></a> | ![traceur-npm] | ![traceur-size] | Loads ES2015+ code and transpiles to ES5 using [Traceur](https://github.com/google/traceur-compiler) |
176
- | <a href="https://github.com/TypeStrong/ts-loader"><img width="48" height="48" src="https://cdn.rawgit.com/Microsoft/TypeScript/master/doc/logo.svg"></a> | ![type-npm] | ![type-size] | Loads TypeScript like JavaScript |
177
- | <a href="https://github.com/webpack-contrib/coffee-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/coffeescript.svg"></a> | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript |
172
+ | Name | Status | Install Size | Description |
173
+ | :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: | :------------------------------------------------------------------------------------------------ |
174
+ | <a href="https://github.com/babel/babel-loader"><img width="48" height="48" title="babel-loader" src="https://worldvectorlogo.com/logos/babel-10.svg"></a> | ![babel-npm] | ![babel-size] | Loads ES2015+ code and transpiles to ES5 using <a href="https://github.com/babel/babel">Babel</a> |
175
+ | <a href="https://github.com/TypeStrong/ts-loader"><img width="48" height="48" src="https://cdn.rawgit.com/Microsoft/TypeScript/master/doc/logo.svg"></a> | ![type-npm] | ![type-size] | Loads TypeScript like JavaScript |
176
+ | <a href="https://github.com/webpack-contrib/coffee-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/coffeescript.svg"></a> | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript |
178
177
 
179
178
  [babel-npm]: https://img.shields.io/npm/v/babel-loader.svg
180
179
  [babel-size]: https://packagephobia.com/badge?p=babel-loader
181
- [traceur-npm]: https://img.shields.io/npm/v/traceur-loader.svg
182
- [traceur-size]: https://packagephobia.com/badge?p=traceur-loader
183
180
  [coffee-npm]: https://img.shields.io/npm/v/coffee-loader.svg
184
181
  [coffee-size]: https://packagephobia.com/badge?p=coffee-loader
185
182
  [type-npm]: https://img.shields.io/npm/v/ts-loader.svg
@@ -90,9 +90,9 @@ class MultiItemCache {
90
90
  * @returns {Promise<void>} promise signals when the value is stored
91
91
  */
92
92
  storePromise(data) {
93
- return Promise.all(
94
- this._items.map(item => item.storePromise(data))
95
- ).then(() => {});
93
+ return Promise.all(this._items.map(item => item.storePromise(data))).then(
94
+ () => {}
95
+ );
96
96
  }
97
97
  }
98
98
 
package/lib/Chunk.js CHANGED
@@ -547,9 +547,8 @@ class Chunk {
547
547
  xor.add(chunkGraph.getModuleHash(m, this.runtime));
548
548
  }
549
549
  xor.updateHash(hash);
550
- const entryModules = chunkGraph.getChunkEntryModulesWithChunkGroupIterable(
551
- this
552
- );
550
+ const entryModules =
551
+ chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this);
553
552
  for (const [m, chunkGroup] of entryModules) {
554
553
  hash.update("entry");
555
554
  hash.update(`${chunkGraph.getModuleId(m)}`);
@@ -510,7 +510,8 @@ class Compilation {
510
510
  * @returns {FakeHook<Pick<AsyncSeriesHook<T>, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects
511
511
  */
512
512
  const createProcessAssetsHook = (name, stage, getArgs, code) => {
513
- const errorMessage = reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
513
+ const errorMessage =
514
+ reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
514
515
  BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
515
516
  const getOptions = options => {
516
517
  if (typeof options === "string") options = { name: options };
@@ -1615,9 +1616,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1615
1616
  let creatingModuleDuringBuildSet = undefined;
1616
1617
  if (!recursive && this.buildQueue.isProcessing(originModule)) {
1617
1618
  // Track build dependency
1618
- creatingModuleDuringBuildSet = this.creatingModuleDuringBuild.get(
1619
- originModule
1620
- );
1619
+ creatingModuleDuringBuildSet =
1620
+ this.creatingModuleDuringBuild.get(originModule);
1621
1621
  if (creatingModuleDuringBuildSet === undefined) {
1622
1622
  creatingModuleDuringBuildSet = new Set();
1623
1623
  this.creatingModuleDuringBuild.set(
@@ -1746,11 +1746,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1746
1746
  module: result
1747
1747
  };
1748
1748
  }
1749
- const {
1750
- fileDependencies,
1751
- contextDependencies,
1752
- missingDependencies
1753
- } = result;
1749
+ const { fileDependencies, contextDependencies, missingDependencies } =
1750
+ result;
1754
1751
  if (fileDependencies) {
1755
1752
  this.fileDependencies.addAll(fileDependencies);
1756
1753
  }
@@ -2316,7 +2313,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2316
2313
  }
2317
2314
  ] of this.entries) {
2318
2315
  if (dependOn && runtime) {
2319
- const err = new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid.
2316
+ const err =
2317
+ new WebpackError(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid.
2320
2318
  Entrypoints that depend on other entrypoints do not have their own runtime.
2321
2319
  They will use the runtime(s) from referenced entrypoints instead.
2322
2320
  Remove the 'runtime' option from the entrypoint.`);
@@ -2357,11 +2355,12 @@ Remove the 'runtime' option from the entrypoint.`);
2357
2355
  let chunk = this.namedChunks.get(runtime);
2358
2356
  if (chunk) {
2359
2357
  if (!runtimeChunks.has(chunk)) {
2360
- const err = new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'.
2358
+ const err =
2359
+ new WebpackError(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'.
2361
2360
  It's not valid to use other entrypoints as runtime chunk.
2362
2361
  Did you mean to use 'dependOn: ${JSON.stringify(
2363
- runtime
2364
- )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used.
2362
+ runtime
2363
+ )}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used.
2365
2364
  Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`);
2366
2365
  const entryChunk = entry.getEntrypointChunk();
2367
2366
  err.chunk = entryChunk;
@@ -2621,12 +2620,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2621
2620
  _runCodeGenerationJobs(jobs, callback) {
2622
2621
  let statModulesFromCache = 0;
2623
2622
  let statModulesGenerated = 0;
2624
- const {
2625
- chunkGraph,
2626
- moduleGraph,
2627
- dependencyTemplates,
2628
- runtimeTemplate
2629
- } = this;
2623
+ const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } =
2624
+ this;
2630
2625
  const results = this.codeGenerationResults;
2631
2626
  const errors = [];
2632
2627
  asyncLib.eachLimit(
@@ -2773,17 +2768,15 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2773
2768
  chunkGraphEntries = this._getChunkGraphEntries()
2774
2769
  } = {}) {
2775
2770
  const context = { chunkGraph, codeGenerationResults };
2776
- const additionalModuleRuntimeRequirements = this.hooks
2777
- .additionalModuleRuntimeRequirements;
2771
+ const additionalModuleRuntimeRequirements =
2772
+ this.hooks.additionalModuleRuntimeRequirements;
2778
2773
  const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule;
2779
2774
  for (const module of modules) {
2780
2775
  if (chunkGraph.getNumberOfModuleChunks(module) > 0) {
2781
2776
  for (const runtime of chunkGraph.getModuleRuntimes(module)) {
2782
2777
  let set;
2783
- const runtimeRequirements = codeGenerationResults.getRuntimeRequirements(
2784
- module,
2785
- runtime
2786
- );
2778
+ const runtimeRequirements =
2779
+ codeGenerationResults.getRuntimeRequirements(module, runtime);
2787
2780
  if (runtimeRequirements && runtimeRequirements.size > 0) {
2788
2781
  set = new Set(runtimeRequirements);
2789
2782
  } else if (additionalModuleRuntimeRequirements.isUsed()) {
@@ -2823,9 +2816,8 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
2823
2816
  for (const treeEntry of chunkGraphEntries) {
2824
2817
  const set = new Set();
2825
2818
  for (const chunk of treeEntry.getAllReferencedChunks()) {
2826
- const runtimeRequirements = chunkGraph.getChunkRuntimeRequirements(
2827
- chunk
2828
- );
2819
+ const runtimeRequirements =
2820
+ chunkGraph.getChunkRuntimeRequirements(chunk);
2829
2821
  for (const r of runtimeRequirements) set.add(r);
2830
2822
  }
2831
2823
 
@@ -3223,9 +3215,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3223
3215
  runtime,
3224
3216
  runtimeTemplate
3225
3217
  });
3226
- const moduleHashDigest = /** @type {string} */ (moduleHash.digest(
3227
- hashDigest
3228
- ));
3218
+ const moduleHashDigest = /** @type {string} */ (
3219
+ moduleHash.digest(hashDigest)
3220
+ );
3229
3221
  chunkGraph.setModuleHashes(
3230
3222
  module,
3231
3223
  runtime,
@@ -3354,10 +3346,11 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
3354
3346
  }
3355
3347
  }
3356
3348
  circularRuntimeChunkInfo.sort(compareSelect(i => i.chunk, byId));
3357
- const err = new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
3358
- circularRuntimeChunkInfo,
3359
- c => c.chunk.name || c.chunk.id
3360
- ).join(", ")})
3349
+ const err =
3350
+ new WebpackError(`Circular dependency between chunks with runtime (${Array.from(
3351
+ circularRuntimeChunkInfo,
3352
+ c => c.chunk.name || c.chunk.id
3353
+ ).join(", ")})
3361
3354
  This prevents using hashes of each other and should be avoided.`);
3362
3355
  err.chunk = circularRuntimeChunkInfo[0].chunk;
3363
3356
  this.warnings.push(err);
@@ -3420,15 +3413,14 @@ This prevents using hashes of each other and should be avoided.`);
3420
3413
  moduleGraph: this.moduleGraph,
3421
3414
  runtimeTemplate: this.runtimeTemplate
3422
3415
  });
3423
- const chunkHashDigest = /** @type {string} */ (chunkHash.digest(
3424
- hashDigest
3425
- ));
3416
+ const chunkHashDigest = /** @type {string} */ (
3417
+ chunkHash.digest(hashDigest)
3418
+ );
3426
3419
  hash.update(chunkHashDigest);
3427
3420
  chunk.hash = chunkHashDigest;
3428
3421
  chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
3429
- const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(
3430
- chunk
3431
- );
3422
+ const fullHashModules =
3423
+ chunkGraph.getChunkFullHashModulesIterable(chunk);
3432
3424
  if (fullHashModules) {
3433
3425
  fullHashChunks.add(chunk);
3434
3426
  } else {
@@ -3459,9 +3451,9 @@ This prevents using hashes of each other and should be avoided.`);
3459
3451
  runtime: chunk.runtime,
3460
3452
  runtimeTemplate
3461
3453
  });
3462
- const moduleHashDigest = /** @type {string} */ (moduleHash.digest(
3463
- hashDigest
3464
- ));
3454
+ const moduleHashDigest = /** @type {string} */ (
3455
+ moduleHash.digest(hashDigest)
3456
+ );
3465
3457
  const oldHash = chunkGraph.getModuleHash(module, chunk.runtime);
3466
3458
  chunkGraph.setModuleHashes(
3467
3459
  module,
@@ -3474,9 +3466,9 @@ This prevents using hashes of each other and should be avoided.`);
3474
3466
  const chunkHash = createHash(hashFunction);
3475
3467
  chunkHash.update(chunk.hash);
3476
3468
  chunkHash.update(this.hash);
3477
- const chunkHashDigest = /** @type {string} */ (chunkHash.digest(
3478
- hashDigest
3479
- ));
3469
+ const chunkHashDigest = /** @type {string} */ (
3470
+ chunkHash.digest(hashDigest)
3471
+ );
3480
3472
  chunk.hash = chunkHashDigest;
3481
3473
  chunk.renderedHash = chunk.hash.substr(0, hashDigestLength);
3482
3474
  this.hooks.contentHash.call(chunk);
@@ -4051,11 +4043,8 @@ This prevents using hashes of each other and should be avoided.`);
4051
4043
  // Create new chunk graph, chunk and entrypoint for the build time execution
4052
4044
  const chunkGraph = new ChunkGraph(this.moduleGraph);
4053
4045
  const runtime = "build time";
4054
- const {
4055
- hashFunction,
4056
- hashDigest,
4057
- hashDigestLength
4058
- } = this.outputOptions;
4046
+ const { hashFunction, hashDigest, hashDigestLength } =
4047
+ this.outputOptions;
4059
4048
  const runtimeTemplate = this.runtimeTemplate;
4060
4049
 
4061
4050
  const chunk = new Chunk("build time chunk");
@@ -4151,9 +4140,8 @@ This prevents using hashes of each other and should be avoided.`);
4151
4140
  });
4152
4141
  this.chunkGraph = old;
4153
4142
 
4154
- const runtimeModules = chunkGraph.getChunkRuntimeModulesIterable(
4155
- chunk
4156
- );
4143
+ const runtimeModules =
4144
+ chunkGraph.getChunkRuntimeModulesIterable(chunk);
4157
4145
 
4158
4146
  // Hash runtime modules
4159
4147
  for (const module of runtimeModules) {
package/lib/Compiler.js CHANGED
@@ -590,9 +590,8 @@ class Compiler {
590
590
  allTargetPaths.add(targetPath);
591
591
 
592
592
  // check if the target file has already been written by this Compiler
593
- const targetFileGeneration = this._assetEmittingWrittenFiles.get(
594
- targetPath
595
- );
593
+ const targetFileGeneration =
594
+ this._assetEmittingWrittenFiles.get(targetPath);
596
595
 
597
596
  // create an cache entry for this Source if not already existing
598
597
  let cacheEntry = this._assetEmittingSourceCache.get(source);
@@ -622,7 +621,8 @@ class Compiler {
622
621
  }
623
622
  alreadyWritten();
624
623
  } else {
625
- const err = new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file.
624
+ const err =
625
+ new WebpackError(`Prevent writing to file that only differs in casing or query string from already written file.
626
626
  This will lead to a race-condition and corrupted files on case-insensitive file systems.
627
627
  ${targetPath}
628
628
  ${other}`);
@@ -7,7 +7,8 @@
7
7
 
8
8
  /** @typedef {import("./Module")} Module */
9
9
 
10
- const MODULE_REFERENCE_REGEXP = /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/;
10
+ const MODULE_REFERENCE_REGEXP =
11
+ /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_directImport)?(?:_asiSafe(\d))?__$/;
11
12
 
12
13
  const DEFAULT_EXPORT = "__WEBPACK_DEFAULT_EXPORT__";
13
14
  const NAMESPACE_OBJECT_EXPORT = "__WEBPACK_NAMESPACE_OBJECT__";
@@ -1016,9 +1016,9 @@ module.exports = webpackEmptyAsyncContext;`;
1016
1016
  this.getSource(this.getSourceString(this.options.mode, context))
1017
1017
  );
1018
1018
  const set = new Set();
1019
- const allDeps = /** @type {ContextElementDependency[]} */ (this.dependencies.concat(
1020
- this.blocks.map(b => b.dependencies[0])
1021
- ));
1019
+ const allDeps = /** @type {ContextElementDependency[]} */ (
1020
+ this.dependencies.concat(this.blocks.map(b => b.dependencies[0]))
1021
+ );
1022
1022
  set.add(RuntimeGlobals.module);
1023
1023
  set.add(RuntimeGlobals.hasOwnProperty);
1024
1024
  if (allDeps.length > 0) {
@@ -104,9 +104,10 @@ class ContextReplacementPlugin {
104
104
  result.regExp = newContentRegExp;
105
105
  }
106
106
  if (typeof newContentCreateContextMap === "function") {
107
- result.resolveDependencies = createResolveDependenciesFromContextMap(
108
- newContentCreateContextMap
109
- );
107
+ result.resolveDependencies =
108
+ createResolveDependenciesFromContextMap(
109
+ newContentCreateContextMap
110
+ );
110
111
  }
111
112
  if (typeof newContentCallback === "function") {
112
113
  const origResource = result.resource;
@@ -89,9 +89,9 @@ class RuntimeValue {
89
89
  module: parser.state.module,
90
90
  key,
91
91
  get version() {
92
- return /** @type {string} */ (valueCacheVersions.get(
93
- VALUE_DEP_PREFIX + key
94
- ));
92
+ return /** @type {string} */ (
93
+ valueCacheVersions.get(VALUE_DEP_PREFIX + key)
94
+ );
95
95
  }
96
96
  });
97
97
  }
@@ -286,11 +286,13 @@ class DefinePlugin {
286
286
  );
287
287
  const { runtimeTemplate } = compilation;
288
288
 
289
- const mainValue = /** @type {Set<string>} */ (provide(
290
- compilation.valueCacheVersions,
291
- VALUE_DEP_MAIN,
292
- () => new Set()
293
- ));
289
+ const mainValue = /** @type {Set<string>} */ (
290
+ provide(
291
+ compilation.valueCacheVersions,
292
+ VALUE_DEP_MAIN,
293
+ () => new Set()
294
+ )
295
+ );
294
296
 
295
297
  /**
296
298
  * Handler
@@ -313,10 +315,12 @@ class DefinePlugin {
313
315
  );
314
316
  };
315
317
 
316
- const withValueDependency = (key, fn) => (...args) => {
317
- addValueDependency(key);
318
- return fn(...args);
319
- };
318
+ const withValueDependency =
319
+ (key, fn) =>
320
+ (...args) => {
321
+ addValueDependency(key);
322
+ return fn(...args);
323
+ };
320
324
 
321
325
  /**
322
326
  * Walk definitions
@@ -91,7 +91,9 @@ class EvalSourceMapDevToolPlugin {
91
91
  } else if (m instanceof ConcatenatedModule) {
92
92
  const concatModule = /** @type {ConcatenatedModule} */ (m);
93
93
  if (concatModule.rootModule instanceof NormalModule) {
94
- const module = /** @type {NormalModule} */ (concatModule.rootModule);
94
+ const module = /** @type {NormalModule} */ (
95
+ concatModule.rootModule
96
+ );
95
97
  if (!matchModule(module.resource)) {
96
98
  return result(source);
97
99
  }
@@ -1160,12 +1160,8 @@ class FileSystemInfo {
1160
1160
  * @returns {void}
1161
1161
  */
1162
1162
  resolveBuildDependencies(context, deps, callback) {
1163
- const {
1164
- resolveContext,
1165
- resolveEsm,
1166
- resolveCjs,
1167
- resolveCjsAsChild
1168
- } = this._createBuildDependenciesResolvers();
1163
+ const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } =
1164
+ this._createBuildDependenciesResolvers();
1169
1165
 
1170
1166
  /** @type {Set<string>} */
1171
1167
  const files = new Set();
@@ -1547,9 +1543,8 @@ class FileSystemInfo {
1547
1543
  break;
1548
1544
  }
1549
1545
  case RBDT_DIRECTORY_DEPENDENCIES: {
1550
- const match = /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(
1551
- path
1552
- );
1546
+ const match =
1547
+ /(^.+[\\/]node_modules[\\/](?:@[^\\/]+[\\/])?[^\\/]+)/.exec(path);
1553
1548
  const packagePath = match ? match[1] : path;
1554
1549
  const packageJson = join(this.fs, packagePath, "package.json");
1555
1550
  this.fs.readFile(packageJson, (err, content) => {
@@ -1637,12 +1632,8 @@ class FileSystemInfo {
1637
1632
  * @returns {void}
1638
1633
  */
1639
1634
  checkResolveResultsValid(resolveResults, callback) {
1640
- const {
1641
- resolveCjs,
1642
- resolveCjsAsChild,
1643
- resolveEsm,
1644
- resolveContext
1645
- } = this._createBuildDependenciesResolvers();
1635
+ const { resolveCjs, resolveCjsAsChild, resolveEsm, resolveContext } =
1636
+ this._createBuildDependenciesResolvers();
1646
1637
  asyncLib.eachLimit(
1647
1638
  resolveResults,
1648
1639
  20,
@@ -1844,11 +1835,12 @@ class FileSystemInfo {
1844
1835
  unsharedManagedFiles
1845
1836
  );
1846
1837
  }
1847
- const unsharedManagedContexts = this._managedContextsOptimization.optimize(
1848
- managedContexts,
1849
- undefined,
1850
- children
1851
- );
1838
+ const unsharedManagedContexts =
1839
+ this._managedContextsOptimization.optimize(
1840
+ managedContexts,
1841
+ undefined,
1842
+ children
1843
+ );
1852
1844
  if (managedContexts.size !== 0) {
1853
1845
  snapshot.setManagedContexts(managedContexts);
1854
1846
  this._managedContextsOptimization.storeUnsharedSnapshot(
@@ -1856,11 +1848,12 @@ class FileSystemInfo {
1856
1848
  unsharedManagedContexts
1857
1849
  );
1858
1850
  }
1859
- const unsharedManagedMissing = this._managedMissingOptimization.optimize(
1860
- managedMissing,
1861
- undefined,
1862
- children
1863
- );
1851
+ const unsharedManagedMissing =
1852
+ this._managedMissingOptimization.optimize(
1853
+ managedMissing,
1854
+ undefined,
1855
+ children
1856
+ );
1864
1857
  if (managedMissing.size !== 0) {
1865
1858
  snapshot.setManagedMissing(managedMissing);
1866
1859
  this._managedMissingOptimization.storeUnsharedSnapshot(
@@ -2064,11 +2057,12 @@ class FileSystemInfo {
2064
2057
  }
2065
2058
  break;
2066
2059
  case 1:
2067
- unsharedContextTimestamps = this._contextTimestampsOptimization.optimize(
2068
- capturedDirectories,
2069
- startTime,
2070
- children
2071
- );
2060
+ unsharedContextTimestamps =
2061
+ this._contextTimestampsOptimization.optimize(
2062
+ capturedDirectories,
2063
+ startTime,
2064
+ children
2065
+ );
2072
2066
  for (const path of capturedDirectories) {
2073
2067
  const cache = this._contextTimestamps.get(path);
2074
2068
  if (cache !== undefined) {
@@ -225,7 +225,8 @@ class FlagDependencyExportsPlugin {
225
225
  }
226
226
 
227
227
  if (exports) {
228
- const nestedExportsInfo = exportInfo.createNestedExportsInfo();
228
+ const nestedExportsInfo =
229
+ exportInfo.createNestedExportsInfo();
229
230
  mergeExports(nestedExportsInfo, exports);
230
231
  }
231
232
 
@@ -247,12 +248,12 @@ class FlagDependencyExportsPlugin {
247
248
  const target = exportInfo.getTarget(moduleGraph);
248
249
  let targetExportsInfo = undefined;
249
250
  if (target) {
250
- const targetModuleExportsInfo = moduleGraph.getExportsInfo(
251
- target.module
252
- );
253
- targetExportsInfo = targetModuleExportsInfo.getNestedExportsInfo(
254
- target.export
255
- );
251
+ const targetModuleExportsInfo =
252
+ moduleGraph.getExportsInfo(target.module);
253
+ targetExportsInfo =
254
+ targetModuleExportsInfo.getNestedExportsInfo(
255
+ target.export
256
+ );
256
257
  // add dependency for this module
257
258
  const set = dependencies.get(target.module);
258
259
  if (set === undefined) {
@@ -201,10 +201,8 @@ class FlagDependencyUsagePlugin {
201
201
  if (oldReferencedExports === EXPORTS_OBJECT_REFERENCED) {
202
202
  continue;
203
203
  }
204
- const referencedExports = compilation.getDependencyReferencedExports(
205
- dep,
206
- runtime
207
- );
204
+ const referencedExports =
205
+ compilation.getDependencyReferencedExports(dep, runtime);
208
206
  if (
209
207
  oldReferencedExports === undefined ||
210
208
  oldReferencedExports === NO_EXPORTS_REFERENCED ||
@@ -87,10 +87,8 @@ class HotModuleReplacementPlugin {
87
87
  const runtimeRequirements = [RuntimeGlobals.module];
88
88
 
89
89
  const createAcceptHandler = (parser, ParamDependency) => {
90
- const {
91
- hotAcceptCallback,
92
- hotAcceptWithoutCallback
93
- } = HotModuleReplacementPlugin.getParserHooks(parser);
90
+ const { hotAcceptCallback, hotAcceptWithoutCallback } =
91
+ HotModuleReplacementPlugin.getParserHooks(parser);
94
92
 
95
93
  return expr => {
96
94
  const module = parser.state.module;
@@ -306,9 +304,7 @@ class HotModuleReplacementPlugin {
306
304
  }
307
305
  records.chunkModuleIds = {};
308
306
  for (const chunk of compilation.chunks) {
309
- records.chunkModuleIds[
310
- chunk.id
311
- ] = Array.from(
307
+ records.chunkModuleIds[chunk.id] = Array.from(
312
308
  chunkGraph.getOrderedChunkModulesIterable(
313
309
  chunk,
314
310
  compareModulesById(chunkGraph)
@@ -341,9 +337,8 @@ class HotModuleReplacementPlugin {
341
337
  return chunkGraph.getModuleHash(module, chunk.runtime);
342
338
  }
343
339
  };
344
- const fullHashModulesInThisChunk = chunkGraph.getChunkFullHashModulesSet(
345
- chunk
346
- );
340
+ const fullHashModulesInThisChunk =
341
+ chunkGraph.getChunkFullHashModulesSet(chunk);
347
342
  if (fullHashModulesInThisChunk !== undefined) {
348
343
  for (const module of fullHashModulesInThisChunk) {
349
344
  fullHashModules.add(module, chunk);
@@ -451,16 +446,14 @@ class HotModuleReplacementPlugin {
451
446
  allOldRuntime = mergeRuntimeOwned(allOldRuntime, runtime);
452
447
  }
453
448
  forEachRuntime(allOldRuntime, runtime => {
454
- const {
455
- path: filename,
456
- info: assetInfo
457
- } = compilation.getPathWithInfo(
458
- compilation.outputOptions.hotUpdateMainFilename,
459
- {
460
- hash: records.hash,
461
- runtime
462
- }
463
- );
449
+ const { path: filename, info: assetInfo } =
450
+ compilation.getPathWithInfo(
451
+ compilation.outputOptions.hotUpdateMainFilename,
452
+ {
453
+ hash: records.hash,
454
+ runtime
455
+ }
456
+ );
464
457
  hotUpdateMainContentByRuntime.set(runtime, {
465
458
  updatedChunkIds: new Set(),
466
459
  removedChunkIds: new Set(),
@@ -516,9 +509,8 @@ class HotModuleReplacementPlugin {
516
509
  newRuntimeModules = Array.from(
517
510
  chunkGraph.getChunkRuntimeModulesIterable(currentChunk)
518
511
  ).filter(module => updatedModules.has(module, currentChunk));
519
- const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(
520
- currentChunk
521
- );
512
+ const fullHashModules =
513
+ chunkGraph.getChunkFullHashModulesIterable(currentChunk);
522
514
  newFullHashModules =
523
515
  fullHashModules &&
524
516
  Array.from(fullHashModules).filter(module =>
@@ -631,13 +623,11 @@ class HotModuleReplacementPlugin {
631
623
  filename = entry.filename;
632
624
  assetInfo = entry.info;
633
625
  } else {
634
- ({
635
- path: filename,
636
- info: assetInfo
637
- } = compilation.getPathWithInfo(
638
- entry.filenameTemplate,
639
- entry.pathOptions
640
- ));
626
+ ({ path: filename, info: assetInfo } =
627
+ compilation.getPathWithInfo(
628
+ entry.filenameTemplate,
629
+ entry.pathOptions
630
+ ));
641
631
  }
642
632
  const source = entry.render();
643
633
  compilation.additionalChunkAssets.push(filename);
@@ -34,7 +34,8 @@ class JavascriptMetaInfoPlugin {
34
34
  let topLevelDeclarations =
35
35
  parser.state.module.buildInfo.topLevelDeclarations;
36
36
  if (topLevelDeclarations === undefined) {
37
- topLevelDeclarations = parser.state.module.buildInfo.topLevelDeclarations = new Set();
37
+ topLevelDeclarations =
38
+ parser.state.module.buildInfo.topLevelDeclarations = new Set();
38
39
  }
39
40
  for (const name of parser.scope.definitions.asSet()) {
40
41
  const freeInfo = parser.getFreeInfoFromVariable(name);
@@ -239,9 +239,8 @@ class MainTemplate {
239
239
  "chunkIdExpression"
240
240
  ]),
241
241
  get jsonpScript() {
242
- const hooks = getLoadScriptRuntimeModule().getCompilationHooks(
243
- compilation
244
- );
242
+ const hooks =
243
+ getLoadScriptRuntimeModule().getCompilationHooks(compilation);
245
244
  return hooks.createScript;
246
245
  },
247
246
  get linkPrefetch() {