webpack 5.99.6 → 5.99.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/lib/AutomaticPrefetchPlugin.js +21 -22
  2. package/lib/BannerPlugin.js +31 -35
  3. package/lib/CleanPlugin.js +5 -3
  4. package/lib/Compilation.js +9 -8
  5. package/lib/Compiler.js +2 -1
  6. package/lib/ContextExclusionPlugin.js +4 -2
  7. package/lib/ContextReplacementPlugin.js +5 -3
  8. package/lib/DelegatedPlugin.js +4 -2
  9. package/lib/DllEntryPlugin.js +4 -2
  10. package/lib/DllPlugin.js +5 -3
  11. package/lib/DllReferencePlugin.js +56 -60
  12. package/lib/DynamicEntryPlugin.js +4 -2
  13. package/lib/EntryOptionPlugin.js +3 -1
  14. package/lib/EntryPlugin.js +4 -2
  15. package/lib/EnvironmentPlugin.js +4 -2
  16. package/lib/EvalDevToolModulePlugin.js +9 -7
  17. package/lib/EvalSourceMapDevToolPlugin.js +137 -138
  18. package/lib/ExternalsPlugin.js +3 -1
  19. package/lib/FlagDependencyExportsPlugin.js +2 -1
  20. package/lib/IgnorePlugin.js +6 -4
  21. package/lib/IgnoreWarningsPlugin.js +4 -2
  22. package/lib/LibManifestPlugin.js +3 -4
  23. package/lib/LoaderOptionsPlugin.js +4 -2
  24. package/lib/LoaderTargetPlugin.js +4 -2
  25. package/lib/Module.js +19 -12
  26. package/lib/ModuleInfoHeaderPlugin.js +11 -12
  27. package/lib/MultiCompiler.js +5 -3
  28. package/lib/NoEmitOnErrorsPlugin.js +5 -3
  29. package/lib/NormalModule.js +5 -1
  30. package/lib/NormalModuleReplacementPlugin.js +33 -36
  31. package/lib/PlatformPlugin.js +3 -1
  32. package/lib/PrefetchPlugin.js +4 -2
  33. package/lib/ProgressPlugin.js +23 -26
  34. package/lib/RecordIdsPlugin.js +72 -102
  35. package/lib/RuntimePlugin.js +34 -32
  36. package/lib/SourceMapDevToolPlugin.js +7 -5
  37. package/lib/WarnCaseSensitiveModulesPlugin.js +36 -37
  38. package/lib/WarnNoModeSetPlugin.js +3 -1
  39. package/lib/WatchIgnorePlugin.js +3 -1
  40. package/lib/WebpackError.js +11 -3
  41. package/lib/WebpackOptionsApply.js +5 -3
  42. package/lib/async-modules/InferAsyncModulesPlugin.js +25 -26
  43. package/lib/cache/IdleFileCachePlugin.js +11 -12
  44. package/lib/cache/MemoryWithGcCachePlugin.js +7 -5
  45. package/lib/cache/ResolverCachePlugin.js +8 -6
  46. package/lib/cli.js +5 -1
  47. package/lib/config/normalization.js +9 -3
  48. package/lib/container/ContainerReferencePlugin.js +24 -26
  49. package/lib/container/ModuleFederationPlugin.js +2 -1
  50. package/lib/css/CssGenerator.js +1 -1
  51. package/lib/css/CssModulesPlugin.js +6 -4
  52. package/lib/dependencies/HarmonyDetectionParserPlugin.js +9 -15
  53. package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -15
  54. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -2
  55. package/lib/dependencies/LoaderPlugin.js +5 -3
  56. package/lib/dependencies/RequireContextDependencyParserPlugin.js +46 -46
  57. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +94 -100
  58. package/lib/esm/ModuleChunkLoadingPlugin.js +72 -73
  59. package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
  60. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +0 -1
  61. package/lib/hmr/LazyCompilationPlugin.js +17 -18
  62. package/lib/ids/ChunkModuleIdRangePlugin.js +6 -6
  63. package/lib/ids/DeterministicModuleIdsPlugin.js +47 -48
  64. package/lib/ids/HashedModuleIdsPlugin.js +4 -2
  65. package/lib/ids/NamedChunkIdsPlugin.js +4 -2
  66. package/lib/ids/NamedModuleIdsPlugin.js +4 -2
  67. package/lib/ids/NaturalChunkIdsPlugin.js +4 -2
  68. package/lib/ids/NaturalModuleIdsPlugin.js +4 -2
  69. package/lib/ids/OccurrenceChunkIdsPlugin.js +4 -2
  70. package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -2
  71. package/lib/javascript/JavascriptParser.js +634 -656
  72. package/lib/library/ModuleLibraryPlugin.js +60 -42
  73. package/lib/node/CommonJsChunkLoadingPlugin.js +69 -73
  74. package/lib/node/NodeEnvironmentPlugin.js +3 -1
  75. package/lib/optimize/AggressiveSplittingPlugin.js +224 -232
  76. package/lib/optimize/ConcatenatedModule.js +12 -15
  77. package/lib/optimize/FlagIncludedChunksPlugin.js +92 -97
  78. package/lib/optimize/LimitChunkCountPlugin.js +4 -2
  79. package/lib/optimize/MangleExportsPlugin.js +15 -16
  80. package/lib/optimize/MinChunkSizePlugin.js +4 -2
  81. package/lib/optimize/ModuleConcatenationPlugin.js +4 -2
  82. package/lib/optimize/RealContentHashPlugin.js +4 -2
  83. package/lib/optimize/RemoveEmptyChunksPlugin.js +5 -3
  84. package/lib/optimize/RemoveParentModulesPlugin.js +4 -2
  85. package/lib/optimize/RuntimeChunkPlugin.js +17 -18
  86. package/lib/optimize/SplitChunksPlugin.js +7 -5
  87. package/lib/performance/SizeLimitsPlugin.js +3 -1
  88. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +61 -62
  89. package/lib/runtime/StartupChunkDependenciesPlugin.js +39 -42
  90. package/lib/schemes/DataUriPlugin.js +5 -3
  91. package/lib/schemes/FileUriPlugin.js +5 -3
  92. package/lib/schemes/HttpUriPlugin.js +32 -39
  93. package/lib/serialization/AggregateErrorSerializer.js +42 -0
  94. package/lib/serialization/ErrorObjectSerializer.js +7 -2
  95. package/lib/serialization/ObjectMiddleware.js +13 -0
  96. package/lib/sharing/ProvideSharedPlugin.js +6 -4
  97. package/lib/stats/DefaultStatsFactoryPlugin.js +89 -33
  98. package/lib/stats/DefaultStatsPresetPlugin.js +25 -20
  99. package/lib/stats/DefaultStatsPrinterPlugin.js +306 -341
  100. package/lib/util/concatenate.js +4 -2
  101. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +55 -57
  102. package/lib/web/JsonpChunkLoadingPlugin.js +73 -74
  103. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +77 -78
  104. package/package.json +4 -3
  105. package/schemas/WebpackOptions.check.js +1 -1
  106. package/schemas/WebpackOptions.json +24 -2
  107. package/types.d.ts +148 -55
@@ -198,11 +198,13 @@ const RESERVED_NAMES = new Set(
198
198
  .split(",")
199
199
  );
200
200
 
201
+ /** @typedef {{ usedNames: UsedNames, alreadyCheckedScopes: ScopeSet }} ScopeInfo */
202
+
201
203
  /**
202
- * @param {Map<string, { usedNames: UsedNames, alreadyCheckedScopes: ScopeSet }>} usedNamesInScopeInfo used names in scope info
204
+ * @param {Map<string, ScopeInfo>} usedNamesInScopeInfo used names in scope info
203
205
  * @param {string} module module identifier
204
206
  * @param {string} id export id
205
- * @returns {{ usedNames: UsedNames, alreadyCheckedScopes: ScopeSet }} info
207
+ * @returns {ScopeInfo} info
206
208
  */
207
209
  const getUsedNamesInScopeInfo = (usedNamesInScopeInfo, module, id) => {
208
210
  const key = `${module}-${id}`;
@@ -13,6 +13,8 @@ const UnsupportedWebAssemblyFeatureError = require("./UnsupportedWebAssemblyFeat
13
13
  /** @typedef {import("../Module")} Module */
14
14
  /** @typedef {import("../Module").BuildMeta} BuildMeta */
15
15
 
16
+ const PLUGIN_NAME = "WasmFinalizeExportsPlugin";
17
+
16
18
  class WasmFinalizeExportsPlugin {
17
19
  /**
18
20
  * Apply the plugin
@@ -20,72 +22,68 @@ class WasmFinalizeExportsPlugin {
20
22
  * @returns {void}
21
23
  */
22
24
  apply(compiler) {
23
- compiler.hooks.compilation.tap("WasmFinalizeExportsPlugin", compilation => {
24
- compilation.hooks.finishModules.tap(
25
- "WasmFinalizeExportsPlugin",
26
- modules => {
27
- for (const module of modules) {
28
- // 1. if a WebAssembly module
29
- if (module.type.startsWith("webassembly") === true) {
30
- const jsIncompatibleExports =
31
- /** @type {BuildMeta} */
32
- (module.buildMeta).jsIncompatibleExports;
25
+ compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
26
+ compilation.hooks.finishModules.tap(PLUGIN_NAME, modules => {
27
+ for (const module of modules) {
28
+ // 1. if a WebAssembly module
29
+ if (module.type.startsWith("webassembly") === true) {
30
+ const jsIncompatibleExports =
31
+ /** @type {BuildMeta} */
32
+ (module.buildMeta).jsIncompatibleExports;
33
33
 
34
- if (jsIncompatibleExports === undefined) {
35
- continue;
36
- }
34
+ if (jsIncompatibleExports === undefined) {
35
+ continue;
36
+ }
37
37
 
38
- for (const connection of compilation.moduleGraph.getIncomingConnections(
39
- module
40
- )) {
41
- // 2. is active and referenced by a non-WebAssembly module
42
- if (
43
- connection.isTargetActive(undefined) &&
44
- /** @type {Module} */
45
- (connection.originModule).type.startsWith("webassembly") ===
46
- false
47
- ) {
48
- const referencedExports =
49
- compilation.getDependencyReferencedExports(
50
- /** @type {Dependency} */ (connection.dependency),
51
- undefined
52
- );
38
+ for (const connection of compilation.moduleGraph.getIncomingConnections(
39
+ module
40
+ )) {
41
+ // 2. is active and referenced by a non-WebAssembly module
42
+ if (
43
+ connection.isTargetActive(undefined) &&
44
+ /** @type {Module} */
45
+ (connection.originModule).type.startsWith("webassembly") ===
46
+ false
47
+ ) {
48
+ const referencedExports =
49
+ compilation.getDependencyReferencedExports(
50
+ /** @type {Dependency} */ (connection.dependency),
51
+ undefined
52
+ );
53
53
 
54
- for (const info of referencedExports) {
55
- const names = Array.isArray(info) ? info : info.name;
56
- if (names.length === 0) continue;
57
- const name = names[0];
58
- if (typeof name === "object") continue;
59
- // 3. and uses a func with an incompatible JS signature
60
- if (
61
- Object.prototype.hasOwnProperty.call(
62
- jsIncompatibleExports,
63
- name
64
- )
65
- ) {
66
- // 4. error
67
- const error = new UnsupportedWebAssemblyFeatureError(
68
- `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` +
69
- `It's used from ${
70
- /** @type {Module} */
71
- (connection.originModule).readableIdentifier(
72
- compilation.requestShortener
73
- )
74
- } at ${formatLocation(
75
- /** @type {Dependency} */ (connection.dependency)
76
- .loc
77
- )}.`
78
- );
79
- error.module = module;
80
- compilation.errors.push(error);
81
- }
54
+ for (const info of referencedExports) {
55
+ const names = Array.isArray(info) ? info : info.name;
56
+ if (names.length === 0) continue;
57
+ const name = names[0];
58
+ if (typeof name === "object") continue;
59
+ // 3. and uses a func with an incompatible JS signature
60
+ if (
61
+ Object.prototype.hasOwnProperty.call(
62
+ jsIncompatibleExports,
63
+ name
64
+ )
65
+ ) {
66
+ // 4. error
67
+ const error = new UnsupportedWebAssemblyFeatureError(
68
+ `Export "${name}" with ${jsIncompatibleExports[name]} can only be used for direct wasm to wasm dependencies\n` +
69
+ `It's used from ${
70
+ /** @type {Module} */
71
+ (connection.originModule).readableIdentifier(
72
+ compilation.requestShortener
73
+ )
74
+ } at ${formatLocation(
75
+ /** @type {Dependency} */ (connection.dependency).loc
76
+ )}.`
77
+ );
78
+ error.module = module;
79
+ compilation.errors.push(error);
82
80
  }
83
81
  }
84
82
  }
85
83
  }
86
84
  }
87
85
  }
88
- );
86
+ });
89
87
  });
90
88
  }
91
89
  }
@@ -11,6 +11,8 @@ const JsonpChunkLoadingRuntimeModule = require("./JsonpChunkLoadingRuntimeModule
11
11
  /** @typedef {import("../Chunk")} Chunk */
12
12
  /** @typedef {import("../Compiler")} Compiler */
13
13
 
14
+ const PLUGIN_NAME = "JsonpChunkLoadingPlugin";
15
+
14
16
  class JsonpChunkLoadingPlugin {
15
17
  /**
16
18
  * Apply the plugin
@@ -18,82 +20,79 @@ class JsonpChunkLoadingPlugin {
18
20
  * @returns {void}
19
21
  */
20
22
  apply(compiler) {
21
- compiler.hooks.thisCompilation.tap(
22
- "JsonpChunkLoadingPlugin",
23
- compilation => {
24
- const globalChunkLoading = compilation.outputOptions.chunkLoading;
25
- /**
26
- * @param {Chunk} chunk chunk
27
- * @returns {boolean} true, if wasm loading is enabled for the chunk
28
- */
29
- const isEnabledForChunk = chunk => {
30
- const options = chunk.getEntryOptions();
31
- const chunkLoading =
32
- options && options.chunkLoading !== undefined
33
- ? options.chunkLoading
34
- : globalChunkLoading;
35
- return chunkLoading === "jsonp";
36
- };
37
- const onceForChunkSet = new WeakSet();
38
- /**
39
- * @param {Chunk} chunk chunk
40
- * @param {Set<string>} set runtime requirements
41
- */
42
- const handler = (chunk, set) => {
43
- if (onceForChunkSet.has(chunk)) return;
44
- onceForChunkSet.add(chunk);
23
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
24
+ const globalChunkLoading = compilation.outputOptions.chunkLoading;
25
+ /**
26
+ * @param {Chunk} chunk chunk
27
+ * @returns {boolean} true, if wasm loading is enabled for the chunk
28
+ */
29
+ const isEnabledForChunk = chunk => {
30
+ const options = chunk.getEntryOptions();
31
+ const chunkLoading =
32
+ options && options.chunkLoading !== undefined
33
+ ? options.chunkLoading
34
+ : globalChunkLoading;
35
+ return chunkLoading === "jsonp";
36
+ };
37
+ const onceForChunkSet = new WeakSet();
38
+ /**
39
+ * @param {Chunk} chunk chunk
40
+ * @param {Set<string>} set runtime requirements
41
+ */
42
+ const handler = (chunk, set) => {
43
+ if (onceForChunkSet.has(chunk)) return;
44
+ onceForChunkSet.add(chunk);
45
+ if (!isEnabledForChunk(chunk)) return;
46
+ set.add(RuntimeGlobals.moduleFactoriesAddOnly);
47
+ set.add(RuntimeGlobals.hasOwnProperty);
48
+ compilation.addRuntimeModule(
49
+ chunk,
50
+ new JsonpChunkLoadingRuntimeModule(set)
51
+ );
52
+ };
53
+ compilation.hooks.runtimeRequirementInTree
54
+ .for(RuntimeGlobals.ensureChunkHandlers)
55
+ .tap(PLUGIN_NAME, handler);
56
+ compilation.hooks.runtimeRequirementInTree
57
+ .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
58
+ .tap(PLUGIN_NAME, handler);
59
+ compilation.hooks.runtimeRequirementInTree
60
+ .for(RuntimeGlobals.hmrDownloadManifest)
61
+ .tap(PLUGIN_NAME, handler);
62
+ compilation.hooks.runtimeRequirementInTree
63
+ .for(RuntimeGlobals.baseURI)
64
+ .tap(PLUGIN_NAME, handler);
65
+ compilation.hooks.runtimeRequirementInTree
66
+ .for(RuntimeGlobals.onChunksLoaded)
67
+ .tap(PLUGIN_NAME, handler);
68
+
69
+ compilation.hooks.runtimeRequirementInTree
70
+ .for(RuntimeGlobals.ensureChunkHandlers)
71
+ .tap(PLUGIN_NAME, (chunk, set) => {
72
+ if (!isEnabledForChunk(chunk)) return;
73
+ set.add(RuntimeGlobals.publicPath);
74
+ set.add(RuntimeGlobals.loadScript);
75
+ set.add(RuntimeGlobals.getChunkScriptFilename);
76
+ });
77
+ compilation.hooks.runtimeRequirementInTree
78
+ .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
79
+ .tap(PLUGIN_NAME, (chunk, set) => {
45
80
  if (!isEnabledForChunk(chunk)) return;
81
+ set.add(RuntimeGlobals.publicPath);
82
+ set.add(RuntimeGlobals.loadScript);
83
+ set.add(RuntimeGlobals.getChunkUpdateScriptFilename);
84
+ set.add(RuntimeGlobals.moduleCache);
85
+ set.add(RuntimeGlobals.hmrModuleData);
46
86
  set.add(RuntimeGlobals.moduleFactoriesAddOnly);
47
- set.add(RuntimeGlobals.hasOwnProperty);
48
- compilation.addRuntimeModule(
49
- chunk,
50
- new JsonpChunkLoadingRuntimeModule(set)
51
- );
52
- };
53
- compilation.hooks.runtimeRequirementInTree
54
- .for(RuntimeGlobals.ensureChunkHandlers)
55
- .tap("JsonpChunkLoadingPlugin", handler);
56
- compilation.hooks.runtimeRequirementInTree
57
- .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
58
- .tap("JsonpChunkLoadingPlugin", handler);
59
- compilation.hooks.runtimeRequirementInTree
60
- .for(RuntimeGlobals.hmrDownloadManifest)
61
- .tap("JsonpChunkLoadingPlugin", handler);
62
- compilation.hooks.runtimeRequirementInTree
63
- .for(RuntimeGlobals.baseURI)
64
- .tap("JsonpChunkLoadingPlugin", handler);
65
- compilation.hooks.runtimeRequirementInTree
66
- .for(RuntimeGlobals.onChunksLoaded)
67
- .tap("JsonpChunkLoadingPlugin", handler);
68
-
69
- compilation.hooks.runtimeRequirementInTree
70
- .for(RuntimeGlobals.ensureChunkHandlers)
71
- .tap("JsonpChunkLoadingPlugin", (chunk, set) => {
72
- if (!isEnabledForChunk(chunk)) return;
73
- set.add(RuntimeGlobals.publicPath);
74
- set.add(RuntimeGlobals.loadScript);
75
- set.add(RuntimeGlobals.getChunkScriptFilename);
76
- });
77
- compilation.hooks.runtimeRequirementInTree
78
- .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
79
- .tap("JsonpChunkLoadingPlugin", (chunk, set) => {
80
- if (!isEnabledForChunk(chunk)) return;
81
- set.add(RuntimeGlobals.publicPath);
82
- set.add(RuntimeGlobals.loadScript);
83
- set.add(RuntimeGlobals.getChunkUpdateScriptFilename);
84
- set.add(RuntimeGlobals.moduleCache);
85
- set.add(RuntimeGlobals.hmrModuleData);
86
- set.add(RuntimeGlobals.moduleFactoriesAddOnly);
87
- });
88
- compilation.hooks.runtimeRequirementInTree
89
- .for(RuntimeGlobals.hmrDownloadManifest)
90
- .tap("JsonpChunkLoadingPlugin", (chunk, set) => {
91
- if (!isEnabledForChunk(chunk)) return;
92
- set.add(RuntimeGlobals.publicPath);
93
- set.add(RuntimeGlobals.getUpdateManifestFilename);
94
- });
95
- }
96
- );
87
+ });
88
+ compilation.hooks.runtimeRequirementInTree
89
+ .for(RuntimeGlobals.hmrDownloadManifest)
90
+ .tap(PLUGIN_NAME, (chunk, set) => {
91
+ if (!isEnabledForChunk(chunk)) return;
92
+ set.add(RuntimeGlobals.publicPath);
93
+ set.add(RuntimeGlobals.getUpdateManifestFilename);
94
+ });
95
+ });
97
96
  }
98
97
  }
99
98
 
@@ -12,6 +12,8 @@ const ImportScriptsChunkLoadingRuntimeModule = require("./ImportScriptsChunkLoad
12
12
  /** @typedef {import("../Chunk")} Chunk */
13
13
  /** @typedef {import("../Compiler")} Compiler */
14
14
 
15
+ const PLUGIN_NAME = "ImportScriptsChunkLoadingPlugin";
16
+
15
17
  class ImportScriptsChunkLoadingPlugin {
16
18
  /**
17
19
  * Apply the plugin
@@ -23,86 +25,83 @@ class ImportScriptsChunkLoadingPlugin {
23
25
  chunkLoading: "import-scripts",
24
26
  asyncChunkLoading: true
25
27
  }).apply(compiler);
26
- compiler.hooks.thisCompilation.tap(
27
- "ImportScriptsChunkLoadingPlugin",
28
- compilation => {
29
- const globalChunkLoading = compilation.outputOptions.chunkLoading;
30
- /**
31
- * @param {Chunk} chunk chunk
32
- * @returns {boolean} true, if wasm loading is enabled for the chunk
33
- */
34
- const isEnabledForChunk = chunk => {
35
- const options = chunk.getEntryOptions();
36
- const chunkLoading =
37
- options && options.chunkLoading !== undefined
38
- ? options.chunkLoading
39
- : globalChunkLoading;
40
- return chunkLoading === "import-scripts";
41
- };
42
- const onceForChunkSet = new WeakSet();
43
- /**
44
- * @param {Chunk} chunk chunk
45
- * @param {Set<string>} set runtime requirements
46
- */
47
- const handler = (chunk, set) => {
48
- if (onceForChunkSet.has(chunk)) return;
49
- onceForChunkSet.add(chunk);
28
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
29
+ const globalChunkLoading = compilation.outputOptions.chunkLoading;
30
+ /**
31
+ * @param {Chunk} chunk chunk
32
+ * @returns {boolean} true, if wasm loading is enabled for the chunk
33
+ */
34
+ const isEnabledForChunk = chunk => {
35
+ const options = chunk.getEntryOptions();
36
+ const chunkLoading =
37
+ options && options.chunkLoading !== undefined
38
+ ? options.chunkLoading
39
+ : globalChunkLoading;
40
+ return chunkLoading === "import-scripts";
41
+ };
42
+ const onceForChunkSet = new WeakSet();
43
+ /**
44
+ * @param {Chunk} chunk chunk
45
+ * @param {Set<string>} set runtime requirements
46
+ */
47
+ const handler = (chunk, set) => {
48
+ if (onceForChunkSet.has(chunk)) return;
49
+ onceForChunkSet.add(chunk);
50
+ if (!isEnabledForChunk(chunk)) return;
51
+ const withCreateScriptUrl = Boolean(
52
+ compilation.outputOptions.trustedTypes
53
+ );
54
+ set.add(RuntimeGlobals.moduleFactoriesAddOnly);
55
+ set.add(RuntimeGlobals.hasOwnProperty);
56
+ if (withCreateScriptUrl) {
57
+ set.add(RuntimeGlobals.createScriptUrl);
58
+ }
59
+ compilation.addRuntimeModule(
60
+ chunk,
61
+ new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl)
62
+ );
63
+ };
64
+ compilation.hooks.runtimeRequirementInTree
65
+ .for(RuntimeGlobals.ensureChunkHandlers)
66
+ .tap(PLUGIN_NAME, handler);
67
+ compilation.hooks.runtimeRequirementInTree
68
+ .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
69
+ .tap(PLUGIN_NAME, handler);
70
+ compilation.hooks.runtimeRequirementInTree
71
+ .for(RuntimeGlobals.hmrDownloadManifest)
72
+ .tap(PLUGIN_NAME, handler);
73
+ compilation.hooks.runtimeRequirementInTree
74
+ .for(RuntimeGlobals.baseURI)
75
+ .tap(PLUGIN_NAME, handler);
76
+ compilation.hooks.runtimeRequirementInTree
77
+ .for(RuntimeGlobals.onChunksLoaded)
78
+ .tap(PLUGIN_NAME, handler);
79
+
80
+ compilation.hooks.runtimeRequirementInTree
81
+ .for(RuntimeGlobals.ensureChunkHandlers)
82
+ .tap(PLUGIN_NAME, (chunk, set) => {
83
+ if (!isEnabledForChunk(chunk)) return;
84
+ set.add(RuntimeGlobals.publicPath);
85
+ set.add(RuntimeGlobals.getChunkScriptFilename);
86
+ });
87
+ compilation.hooks.runtimeRequirementInTree
88
+ .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
89
+ .tap(PLUGIN_NAME, (chunk, set) => {
50
90
  if (!isEnabledForChunk(chunk)) return;
51
- const withCreateScriptUrl = Boolean(
52
- compilation.outputOptions.trustedTypes
53
- );
91
+ set.add(RuntimeGlobals.publicPath);
92
+ set.add(RuntimeGlobals.getChunkUpdateScriptFilename);
93
+ set.add(RuntimeGlobals.moduleCache);
94
+ set.add(RuntimeGlobals.hmrModuleData);
54
95
  set.add(RuntimeGlobals.moduleFactoriesAddOnly);
55
- set.add(RuntimeGlobals.hasOwnProperty);
56
- if (withCreateScriptUrl) {
57
- set.add(RuntimeGlobals.createScriptUrl);
58
- }
59
- compilation.addRuntimeModule(
60
- chunk,
61
- new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl)
62
- );
63
- };
64
- compilation.hooks.runtimeRequirementInTree
65
- .for(RuntimeGlobals.ensureChunkHandlers)
66
- .tap("ImportScriptsChunkLoadingPlugin", handler);
67
- compilation.hooks.runtimeRequirementInTree
68
- .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
69
- .tap("ImportScriptsChunkLoadingPlugin", handler);
70
- compilation.hooks.runtimeRequirementInTree
71
- .for(RuntimeGlobals.hmrDownloadManifest)
72
- .tap("ImportScriptsChunkLoadingPlugin", handler);
73
- compilation.hooks.runtimeRequirementInTree
74
- .for(RuntimeGlobals.baseURI)
75
- .tap("ImportScriptsChunkLoadingPlugin", handler);
76
- compilation.hooks.runtimeRequirementInTree
77
- .for(RuntimeGlobals.onChunksLoaded)
78
- .tap("ImportScriptsChunkLoadingPlugin", handler);
79
-
80
- compilation.hooks.runtimeRequirementInTree
81
- .for(RuntimeGlobals.ensureChunkHandlers)
82
- .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => {
83
- if (!isEnabledForChunk(chunk)) return;
84
- set.add(RuntimeGlobals.publicPath);
85
- set.add(RuntimeGlobals.getChunkScriptFilename);
86
- });
87
- compilation.hooks.runtimeRequirementInTree
88
- .for(RuntimeGlobals.hmrDownloadUpdateHandlers)
89
- .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => {
90
- if (!isEnabledForChunk(chunk)) return;
91
- set.add(RuntimeGlobals.publicPath);
92
- set.add(RuntimeGlobals.getChunkUpdateScriptFilename);
93
- set.add(RuntimeGlobals.moduleCache);
94
- set.add(RuntimeGlobals.hmrModuleData);
95
- set.add(RuntimeGlobals.moduleFactoriesAddOnly);
96
- });
97
- compilation.hooks.runtimeRequirementInTree
98
- .for(RuntimeGlobals.hmrDownloadManifest)
99
- .tap("ImportScriptsChunkLoadingPlugin", (chunk, set) => {
100
- if (!isEnabledForChunk(chunk)) return;
101
- set.add(RuntimeGlobals.publicPath);
102
- set.add(RuntimeGlobals.getUpdateManifestFilename);
103
- });
104
- }
105
- );
96
+ });
97
+ compilation.hooks.runtimeRequirementInTree
98
+ .for(RuntimeGlobals.hmrDownloadManifest)
99
+ .tap(PLUGIN_NAME, (chunk, set) => {
100
+ if (!isEnabledForChunk(chunk)) return;
101
+ set.add(RuntimeGlobals.publicPath);
102
+ set.add(RuntimeGlobals.getUpdateManifestFilename);
103
+ });
104
+ });
106
105
  }
107
106
  }
108
107
  module.exports = ImportScriptsChunkLoadingPlugin;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.99.6",
3
+ "version": "5.99.7",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@types/eslint-scope": "^3.7.7",
9
9
  "@types/estree": "^1.0.6",
10
+ "@types/json-schema": "^7.0.15",
10
11
  "@webassemblyjs/ast": "^1.14.1",
11
12
  "@webassemblyjs/wasm-edit": "^1.14.1",
12
13
  "@webassemblyjs/wasm-parser": "^1.14.1",
@@ -23,7 +24,7 @@
23
24
  "loader-runner": "^4.2.0",
24
25
  "mime-types": "^2.1.27",
25
26
  "neo-async": "^2.6.2",
26
- "schema-utils": "^4.3.0",
27
+ "schema-utils": "^4.3.2",
27
28
  "tapable": "^2.1.1",
28
29
  "terser-webpack-plugin": "^5.3.11",
29
30
  "watchpack": "^2.4.1",
@@ -167,7 +168,7 @@
167
168
  "pretty-lint": "yarn pretty-lint-base --check",
168
169
  "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock",
169
170
  "yarn-lint-fix": "yarn-deduplicate -s highest yarn.lock",
170
- "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
171
+ "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.mjs\" --runInBand",
171
172
  "cover": "yarn cover:all && yarn cover:report",
172
173
  "cover:clean": "rimraf .nyc_output coverage",
173
174
  "cover:all": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --coverage",