webpack 5.112.0 → 5.112.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.
Files changed (263) hide show
  1. package/bin/webpack.js +13 -7
  2. package/lib/Compilation.js +152 -60
  3. package/lib/Compiler.js +12 -25
  4. package/lib/asset/AssetBytesGenerator.js +14 -6
  5. package/lib/asset/AssetBytesParser.js +10 -8
  6. package/lib/asset/AssetGenerator.js +36 -48
  7. package/lib/asset/AssetModule.js +11 -0
  8. package/lib/asset/AssetModulesPlugin.js +5 -4
  9. package/lib/asset/AssetParser.js +8 -8
  10. package/lib/asset/AssetSourceGenerator.js +16 -8
  11. package/lib/asset/AssetSourceParser.js +10 -8
  12. package/lib/asset/WebManifestGenerator.js +11 -6
  13. package/lib/asset/WebManifestParser.js +3 -3
  14. package/lib/async-modules/AsyncModuleHelpers.js +8 -2
  15. package/lib/async-modules/InferAsyncModulesPlugin.js +7 -2
  16. package/lib/cache/CacheFacade.js +1 -1
  17. package/lib/cache/PackFileCacheStrategy.js +6 -10
  18. package/lib/cache/ResolverCachePlugin.js +58 -8
  19. package/lib/config/WebpackOptionsApply.js +8 -28
  20. package/lib/config/cli.js +9 -6
  21. package/lib/config/defaults.js +24 -13
  22. package/lib/config/getClaimedAssetTypes.js +2 -2
  23. package/lib/config/target.js +1 -1
  24. package/lib/context/ContextModule.js +1 -1
  25. package/lib/context/ContextModuleFactory.js +1 -1
  26. package/lib/context/ContextReplacementPlugin.js +3 -9
  27. package/lib/css/CssGenerator.js +40 -37
  28. package/lib/css/CssModule.js +10 -0
  29. package/lib/css/CssModulesPlugin.js +2 -2
  30. package/lib/css/CssParser.js +33 -32
  31. package/lib/css/conventions.js +1 -1
  32. package/lib/css/data.js +224 -219
  33. package/lib/css/syntax-parser.js +1159 -298
  34. package/lib/css/syntax-printer.js +90 -35
  35. package/lib/debug/ProfilingPlugin.js +65 -43
  36. package/lib/define/DefinePlugin.js +10 -15
  37. package/lib/define/DotenvPlugin.js +10 -6
  38. package/lib/define/EnvironmentPlugin.js +4 -2
  39. package/lib/dependencies/amd/AMDDefineDependencyParserPlugin.js +1 -2
  40. package/lib/dependencies/amd/AMDRequireDependenciesBlockParserPlugin.js +4 -1
  41. package/lib/dependencies/commonjs/CommonJsExportRequireDependency.js +1 -4
  42. package/lib/dependencies/commonjs/CommonJsExportsParserPlugin.js +18 -33
  43. package/lib/dependencies/commonjs/CommonJsImportsParserPlugin.js +1 -3
  44. package/lib/dependencies/commonjs/CommonJsObjectExportDependency.js +4 -4
  45. package/lib/dependencies/commonjs/CommonJsPlugin.js +2 -5
  46. package/lib/dependencies/commonjs/RequireEnsureDependenciesBlockParserPlugin.js +4 -1
  47. package/lib/dependencies/context/ImportMetaContextDependencyParserPlugin.js +1 -2
  48. package/lib/dependencies/context/ImportMetaGlobDependencyParserPlugin.js +4 -7
  49. package/lib/dependencies/context/ImportMetaGlobHelpers.js +8 -10
  50. package/lib/dependencies/core/CachedConstDependency.js +9 -6
  51. package/lib/dependencies/css/CssIcssExportDependency.js +6 -7
  52. package/lib/dependencies/css/CssIcssImportDependency.js +1 -3
  53. package/lib/dependencies/css/CssUrlDependency.js +2 -6
  54. package/lib/dependencies/esm/ESMDetectionParserPlugin.js +2 -4
  55. package/lib/dependencies/esm/ESMExportExpressionDependency.js +2 -2
  56. package/lib/dependencies/esm/ESMExportImportedSpecifierDependency.js +16 -18
  57. package/lib/dependencies/esm/ESMExportSpecifierDependency.js +20 -3
  58. package/lib/dependencies/esm/ESMExports.js +2 -10
  59. package/lib/dependencies/esm/ESMImportDependency.js +17 -2
  60. package/lib/dependencies/esm/ESMImportDependencyParserPlugin.js +6 -17
  61. package/lib/dependencies/esm/ESMImportGuard.js +11 -23
  62. package/lib/dependencies/esm/ESMImportSideEffectDependency.js +1 -1
  63. package/lib/dependencies/esm/ESMImportSpecifierDependency.js +4 -1
  64. package/lib/dependencies/esm/ESMLiveExportDependency.js +311 -0
  65. package/lib/dependencies/esm/ESMLiveExportParserPlugin.js +862 -0
  66. package/lib/dependencies/esm/ESMModulesPlugin.js +1 -3
  67. package/lib/dependencies/esm/TopLevelAwaitDependency.js +1 -8
  68. package/lib/dependencies/helpers/DynamicExports.js +4 -6
  69. package/lib/dependencies/html/HtmlEntryDependency.js +5 -14
  70. package/lib/dependencies/html/HtmlInlineHtmlDependency.js +1 -4
  71. package/lib/dependencies/html/HtmlInlineScriptDependency.js +2 -6
  72. package/lib/dependencies/html/HtmlInlineStyleDependency.js +1 -4
  73. package/lib/dependencies/import/ImportParserPlugin.js +3 -6
  74. package/lib/dependencies/import-meta/ImportMetaPlugin.js +4 -6
  75. package/lib/dependencies/url/URLParserPlugin.js +1 -1
  76. package/lib/dependencies/worker/WorkerAndWorkletPlugin.js +51 -20
  77. package/lib/devtool/ModuleFilenameHelpers.js +1 -1
  78. package/lib/devtool/SourceMapDevToolPlugin.js +1 -1
  79. package/lib/dll/DelegatedModule.js +3 -3
  80. package/lib/dll/DllModule.js +3 -1
  81. package/lib/dll/DllReferencePlugin.js +1 -4
  82. package/lib/errors/AbstractMethodError.js +1 -1
  83. package/lib/errors/ErrorHelpers.js +2 -1
  84. package/lib/errors/HookWebpackError.js +2 -1
  85. package/lib/errors/JSONParseError.js +4 -4
  86. package/lib/errors/WebpackError.js +3 -2
  87. package/lib/esm/ModuleChunkFormatPlugin.js +36 -1
  88. package/lib/externals/ExternalModule.js +12 -9
  89. package/lib/externals/ExternalModuleFactoryPlugin.js +1 -2
  90. package/lib/externals/ExternalsPlugin.js +1 -1
  91. package/lib/fs/FileSystemInfo.js +4 -4
  92. package/lib/graph/AsyncDependenciesBlock.js +1 -1
  93. package/lib/graph/ChunkGraph.js +5 -0
  94. package/lib/graph/Dependency.js +8 -2
  95. package/lib/graph/ExportsInfo.js +1 -1
  96. package/lib/graph/ModuleGraph.js +14 -3
  97. package/lib/graph/buildChunkGraph.js +17 -19
  98. package/lib/graph/findGraphRoots.js +1 -1
  99. package/lib/hmr/HotModuleReplacement.runtime.js +10 -9
  100. package/lib/hmr/HotModuleReplacementPlugin.js +5 -11
  101. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +16 -19
  102. package/lib/hmr/LazyCompilationPlugin.js +1 -7
  103. package/lib/html/HtmlGenerator.js +25 -17
  104. package/lib/html/HtmlModule.js +11 -1
  105. package/lib/html/HtmlModulesPlugin.js +12 -11
  106. package/lib/html/HtmlParser.js +10 -9
  107. package/lib/html/builtinEmbeddedRenderer.js +31 -33
  108. package/lib/html/data.js +42 -21
  109. package/lib/html/htmlMinify.js +4 -1
  110. package/lib/html/syntax-parser.js +34 -35
  111. package/lib/html/syntax-printer.js +2 -3
  112. package/lib/html/xmlMinify.js +4 -1
  113. package/lib/ids/HashedModuleIdsPlugin.js +1 -1
  114. package/lib/index.js +13 -12
  115. package/lib/javascript/APIPlugin.js +7 -13
  116. package/lib/javascript/BasicEvaluatedExpression.js +5 -5
  117. package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -7
  118. package/lib/javascript/ConstPlugin.js +1 -1
  119. package/lib/javascript/JavascriptGenerator.js +16 -11
  120. package/lib/javascript/JavascriptMetaInfoPlugin.js +3 -15
  121. package/lib/javascript/JavascriptModule.js +10 -0
  122. package/lib/javascript/JavascriptModulesPlugin.js +2 -4
  123. package/lib/javascript/JavascriptParser.js +99 -11
  124. package/lib/javascript/ScopeAnalyzer.js +183 -107
  125. package/lib/javascript/UseStrictPlugin.js +2 -5
  126. package/lib/javascript/jsMinify.js +1 -1
  127. package/lib/javascript/regexp.js +2 -2
  128. package/lib/javascript/syntax-parser.js +2114 -1506
  129. package/lib/javascript/syntax-printer-data.js +167 -1
  130. package/lib/javascript/syntax-printer.js +9554 -2782
  131. package/lib/json/JsonGenerator.js +15 -7
  132. package/lib/json/JsonModule.js +11 -0
  133. package/lib/json/JsonParser.js +7 -6
  134. package/lib/library/AssignLibraryPlugin.js +1 -1
  135. package/lib/library/JsonpLibraryPlugin.js +1 -1
  136. package/lib/library/ModuleLibraryPlugin.js +399 -23
  137. package/lib/loaders/LoaderRunner.js +76 -38
  138. package/lib/loaders/loadLoader.js +16 -10
  139. package/lib/module/Generator.js +17 -9
  140. package/lib/module/Module.js +2 -2
  141. package/lib/module/NormalModule.js +7 -5
  142. package/lib/module/NormalModuleFactory.js +11 -17
  143. package/lib/module/Parser.js +9 -2
  144. package/lib/module/extractSourceMap.js +69 -18
  145. package/lib/module/findCaseMismatch.js +2 -2
  146. package/lib/node/ExternalModuleInitFragment.js +2 -2
  147. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +4 -12
  148. package/lib/node/ReadFileCompileWasmPlugin.js +2 -6
  149. package/lib/node/nodeConsole.js +4 -3
  150. package/lib/optimize/CircularModulesPlugin.js +1 -1
  151. package/lib/optimize/ConcatenatedModule.js +2 -6
  152. package/lib/optimize/FlagDependencyExportsPlugin.js +6 -11
  153. package/lib/optimize/FlagDependencyUsagePlugin.js +28 -3
  154. package/lib/optimize/InlineExports.js +4 -7
  155. package/lib/optimize/LazyBarrels.js +41 -5
  156. package/lib/optimize/ModuleConcatenationPlugin.js +8 -10
  157. package/lib/optimize/RealContentHashPlugin.js +2 -6
  158. package/lib/optimize/SideEffectsFlagPlugin.js +7 -21
  159. package/lib/optimize/SplitChunksPlugin.js +11 -24
  160. package/lib/optimize/TupleQueue.js +1 -1
  161. package/lib/output/CleanPlugin.js +3 -1
  162. package/lib/output/CopyPlugin.js +3 -4
  163. package/lib/performance/EvalUsagePlugin.js +1 -3
  164. package/lib/performance/HotspotsPlugin.js +33 -9
  165. package/lib/performance/PureAnnotationsPlugin.js +16 -10
  166. package/lib/performance/TopLevelThisPlugin.js +17 -9
  167. package/lib/prefetch/ResourceHintPlugin.js +1 -1
  168. package/lib/provide/ProvidedDependency.js +36 -4
  169. package/lib/rules/BasicEffectRulePlugin.js +1 -1
  170. package/lib/rules/RuleSetCompiler.js +15 -5
  171. package/lib/rules/UseEffectRulePlugin.js +1 -3
  172. package/lib/runtime/AsyncModuleRuntimeModule.js +7 -1
  173. package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -5
  174. package/lib/runtime/RuntimeGlobals.js +6 -0
  175. package/lib/runtime/RuntimePlugin.js +2 -0
  176. package/lib/schemes/HttpUriPlugin.js +1 -2
  177. package/lib/schemes/VirtualUrlPlugin.js +3 -1
  178. package/lib/serialization/AggregateErrorSerializer.js +3 -3
  179. package/lib/serialization/BinaryMiddleware.js +4 -1
  180. package/lib/serialization/ErrorObjectSerializer.js +2 -5
  181. package/lib/serialization/ObjectMiddleware.js +17 -15
  182. package/lib/serialization/PlainObjectSerializer.js +3 -7
  183. package/lib/serialization/Serializer.js +21 -11
  184. package/lib/serialization/SerializerMiddleware.js +8 -6
  185. package/lib/stats/DefaultStatsFactoryPlugin.js +35 -35
  186. package/lib/stats/DefaultStatsPresetPlugin.js +2 -6
  187. package/lib/stats/DefaultStatsPrinterPlugin.js +12 -11
  188. package/lib/stats/StatsFactory.js +194 -24
  189. package/lib/stats/StatsPrinter.js +126 -13
  190. package/lib/template/DependencyTemplate.js +1 -1
  191. package/lib/template/RuntimeTemplate.js +13 -32
  192. package/lib/template/Template.js +1 -1
  193. package/lib/util/SourceProcessor.js +98 -15
  194. package/lib/util/WeakTupleMap.js +10 -4
  195. package/lib/util/cleverMerge.js +61 -33
  196. package/lib/util/comparators.js +9 -5
  197. package/lib/util/dataURL.js +2 -0
  198. package/lib/util/deprecation.js +4 -3
  199. package/lib/util/globUtils.js +1 -4
  200. package/lib/util/internalSerializables.js +2 -0
  201. package/lib/util/makeSerializable.js +6 -4
  202. package/lib/util/memoize.js +1 -1
  203. package/lib/util/parseJson.js +2 -2
  204. package/lib/util/serialization.js +31 -27
  205. package/lib/wasm/AsyncWasmModule.js +12 -2
  206. package/lib/wasm/AsyncWebAssemblyGenerator.js +12 -4
  207. package/lib/wasm/AsyncWebAssemblyJavascriptGenerator.js +13 -5
  208. package/lib/wasm/AsyncWebAssemblyParser.js +7 -5
  209. package/lib/wasm/UniversalCompileAsyncWasmPlugin.js +2 -6
  210. package/lib/wasm-sync/SyncWasmModule.js +16 -1
  211. package/lib/wasm-sync/WebAssemblyGenerator.js +15 -10
  212. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +13 -5
  213. package/lib/wasm-sync/WebAssemblyParser.js +10 -12
  214. package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -12
  215. package/lib/web/FetchCompileWasmPlugin.js +2 -6
  216. package/package.json +16 -18
  217. package/schemas/WebpackOptions.check.js +3 -3
  218. package/schemas/WebpackOptions.json +2 -2
  219. package/schemas/plugins/BannerPlugin.check.js +3 -3
  220. package/schemas/plugins/HtmlGeneratorOptions.check.js +3 -3
  221. package/schemas/plugins/HtmlParserOptions.check.js +3 -3
  222. package/schemas/plugins/IgnorePlugin.check.js +3 -3
  223. package/schemas/plugins/LoaderOptionsPlugin.check.js +3 -3
  224. package/schemas/plugins/ManifestPlugin.check.js +3 -3
  225. package/schemas/plugins/ProgressPlugin.check.js +3 -3
  226. package/schemas/plugins/SSRManifestPlugin.check.js +3 -3
  227. package/schemas/plugins/SourceMapDevToolPlugin.check.js +3 -3
  228. package/schemas/plugins/WatchIgnorePlugin.check.js +3 -3
  229. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +3 -3
  230. package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.js +3 -3
  231. package/schemas/plugins/asset/AssetParserOptions.check.js +3 -3
  232. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +3 -3
  233. package/schemas/plugins/container/ContainerPlugin.check.js +3 -3
  234. package/schemas/plugins/container/ContainerReferencePlugin.check.js +3 -3
  235. package/schemas/plugins/container/ExternalsType.check.js +3 -3
  236. package/schemas/plugins/container/ModuleFederationPlugin.check.js +3 -3
  237. package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +3 -3
  238. package/schemas/plugins/css/CssGeneratorOptions.check.js +3 -3
  239. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +3 -3
  240. package/schemas/plugins/css/CssModuleParserOptions.check.js +3 -3
  241. package/schemas/plugins/css/CssParserOptions.check.js +3 -3
  242. package/schemas/plugins/debug/ProfilingPlugin.check.js +3 -3
  243. package/schemas/plugins/define/DotenvPluginOptions.check.js +7 -0
  244. package/schemas/plugins/define/DotenvPluginOptions.json +3 -0
  245. package/schemas/plugins/dll/DllPlugin.check.js +3 -3
  246. package/schemas/plugins/dll/DllReferencePlugin.check.js +3 -3
  247. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +3 -3
  248. package/schemas/plugins/ids/OccurrenceChunkIdsPlugin.check.js +3 -3
  249. package/schemas/plugins/ids/OccurrenceModuleIdsPlugin.check.js +3 -3
  250. package/schemas/plugins/json/JsonModulesPluginGenerator.check.js +3 -3
  251. package/schemas/plugins/json/JsonModulesPluginParser.check.js +3 -3
  252. package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.js +3 -3
  253. package/schemas/plugins/optimize/LimitChunkCountPlugin.check.js +3 -3
  254. package/schemas/plugins/optimize/MergeDuplicateChunksPlugin.check.js +3 -3
  255. package/schemas/plugins/optimize/MinChunkSizePlugin.check.js +3 -3
  256. package/schemas/plugins/output/CleanOptions.check.js +7 -0
  257. package/schemas/plugins/output/CleanOptions.json +3 -0
  258. package/schemas/plugins/schemes/HttpUriPlugin.check.js +3 -3
  259. package/schemas/plugins/schemes/VirtualUrlPlugin.check.js +3 -3
  260. package/schemas/plugins/sharing/ConsumeSharedPlugin.check.js +3 -3
  261. package/schemas/plugins/sharing/ProvideSharedPlugin.check.js +3 -3
  262. package/schemas/plugins/sharing/SharePlugin.check.js +3 -3
  263. package/types.d.ts +1482 -358
@@ -179,6 +179,8 @@ const {
179
179
  _joinSlots,
180
180
  _keepKeywordComments,
181
181
  _lowercaseConditionParts,
182
+ _memoizeBlockBody,
183
+ _memoizedBlockBody,
182
184
  _minifyColorFunction,
183
185
  _minifyPolarColorFunction,
184
186
  _nearByteHalf,
@@ -200,6 +202,7 @@ const {
200
202
  _rulesOf,
201
203
  _setHoistedRuns,
202
204
  _setRuleEntry,
205
+ _setVerbatimLeafPrinter,
203
206
  _shortestAuthoredFlex,
204
207
  _shortestColor,
205
208
  _shortestFlexValue,
@@ -1342,11 +1345,7 @@ const _prefixQualifiedRule = (ruleText, parts, soft, body, scope, top) => {
1342
1345
  const removable = bases.every(
1343
1346
  (base, i) =>
1344
1347
  selectors[i].at === -1 ||
1345
- _prefixRemovable(
1346
- PREFIXED_SELECTORS,
1347
- base,
1348
- /** @type {string} */ (listPrefix)
1349
- )
1348
+ _prefixRemovable(PREFIXED_SELECTORS, base, listPrefix)
1350
1349
  );
1351
1350
  // Covered when every selector is: a list of twins says the same as one twin
1352
1351
  // of the list, and the rules writing them need not be one rule.
@@ -2388,12 +2387,17 @@ const _writeNested = (
2388
2387
  const taken = [];
2389
2388
  // A rule written in another names its own parent where its list opens on a
2390
2389
  // combinator, so that parent stays an `&` the next level out writes in.
2391
- const against =
2392
- path.parent !== null && path.type(path.parent) !== NodeType.Stylesheet
2393
- ? _parentNamed(prelude)
2394
- : prelude;
2390
+ // Read only once a rule written in this one asks.
2391
+ /** @type {string | undefined} */
2392
+ let against;
2395
2393
  for (let i = _pendingNested.length - 1; i >= 0; i--) {
2396
2394
  if (_pendingNested[i].owner !== node) continue;
2395
+ if (against === undefined) {
2396
+ against =
2397
+ path.parent !== null && path.type(path.parent) !== NodeType.Stylesheet
2398
+ ? _parentNamed(prelude)
2399
+ : prelude;
2400
+ }
2397
2401
  const one = _pendingNested[i];
2398
2402
  _pendingNested.splice(i, 1);
2399
2403
  one.prelude = _resolveNestedPrelude(one.prelude, against);
@@ -2504,7 +2508,10 @@ const _hoistedEntry = (text, prelude) => ({
2504
2508
  listKind: LIST_KIND_SELECTOR,
2505
2509
  children: null,
2506
2510
  head: "",
2507
- unordered: false
2511
+ unordered: false,
2512
+ list: null,
2513
+ block: null,
2514
+ declarations: null
2508
2515
  });
2509
2516
 
2510
2517
  /**
@@ -2516,7 +2523,7 @@ const _hoistedEntry = (text, prelude) => ({
2516
2523
  * @returns {void}
2517
2524
  */
2518
2525
  const _recordHoistedRule = (text, parent, parentPrelude) => {
2519
- const node = /** @type {Node} */ (_S._currentNode);
2526
+ const node = _S._currentNode;
2520
2527
  if (parent === null && _nestedRuns.length === 1) {
2521
2528
  _setRuleEntry(node, _hoistedEntry(text, _nestedRuns[0].prelude));
2522
2529
  return;
@@ -3190,8 +3197,11 @@ const _numberAlphaValue = (property, value) => {
3190
3197
  const parts = _LONE_PERCENTAGE_RE.exec(value);
3191
3198
  if (parts === null) return value;
3192
3199
  const digits = `00${parts[2]}`;
3193
- const shifted = _normalizeNumber(
3194
- `${parts[1]}${digits.slice(0, -2)}.${digits.slice(-2)}${parts[3] || ""}`
3200
+ // A number rounds to fewer digits than the percentage it was printed as.
3201
+ const shifted = _roundSignificant(
3202
+ _normalizeNumber(
3203
+ `${parts[1]}${digits.slice(0, -2)}.${digits.slice(-2)}${parts[3] || ""}`
3204
+ )
3195
3205
  );
3196
3206
  return shifted.length < value.length ? shifted : value;
3197
3207
  };
@@ -3587,6 +3597,18 @@ const _dropDefaultGradientPosition = (fn, inner) => {
3587
3597
  return match[1] === undefined ? rest : `${match[1]},${rest}`;
3588
3598
  };
3589
3599
 
3600
+ // The basic shapes `_dropDefaultShapeParts` reads, so every other call is
3601
+ // turned away before its arguments are scanned.
3602
+ const _BASIC_SHAPE_FUNCTIONS = new Set([
3603
+ "polygon",
3604
+ "path",
3605
+ "circle",
3606
+ "ellipse",
3607
+ "inset",
3608
+ "rect",
3609
+ "xywh"
3610
+ ]);
3611
+
3590
3612
  /**
3591
3613
  * Drop what a basic shape (CSS Shapes 1 §3) says with its own defaults: a
3592
3614
  * `closest-side` radius, a zero corner `round`, `nonzero`, and the sides an
@@ -3596,7 +3618,11 @@ const _dropDefaultGradientPosition = (fn, inner) => {
3596
3618
  * @returns {string | null} the arguments without them, or null to keep them
3597
3619
  */
3598
3620
  const _dropDefaultShapeParts = (fn, inner) => {
3599
- if (!_S._transforms.reduceFunctions || containsSubstitutionFunction(inner)) {
3621
+ if (
3622
+ !_BASIC_SHAPE_FUNCTIONS.has(fn) ||
3623
+ !_S._transforms.reduceFunctions ||
3624
+ containsSubstitutionFunction(inner)
3625
+ ) {
3600
3626
  return null;
3601
3627
  }
3602
3628
  if (fn === "polygon" || fn === "path") {
@@ -4285,6 +4311,23 @@ const _standardSpelling = (property) => {
4285
4311
  return standard === undefined ? property : standard;
4286
4312
  };
4287
4313
 
4314
+ /**
4315
+ * What `_composeBlockBody` hands back for a block of declarations alone whose
4316
+ * body was composed before.
4317
+ * @param {string} body the body
4318
+ * @returns {ReturnType<typeof _composeBlockBody>} the composition
4319
+ */
4320
+ const _memoizedComposition = (body) => ({
4321
+ body,
4322
+ items: [],
4323
+ texts: [],
4324
+ superseded: null,
4325
+ droppedPrefix: null,
4326
+ addedPrefix: null,
4327
+ deadPrefixed: null,
4328
+ spans: null
4329
+ });
4330
+
4288
4331
  /**
4289
4332
  * Shorten a shorthand declaration's value to an equivalent spelling. A prefixed
4290
4333
  * spelling is a different property, and neither table lists one.
@@ -4465,6 +4508,7 @@ const _dropFontNormals = (components) => {
4465
4508
  * @returns {string[] | null} the fragments to join, or `null` to keep the value
4466
4509
  */
4467
4510
  const _shortenIndividualTransform = (property, components) => {
4511
+ if (property !== "translate" && property !== "scale") return null;
4468
4512
  if (components.length > 3) return null;
4469
4513
  if (components.some((one) => one.includes("(") || one.includes(","))) {
4470
4514
  return null;
@@ -4486,7 +4530,7 @@ const _shortenIndividualTransform = (property, components) => {
4486
4530
  for (let i = 0; i < kept.length; i++) {
4487
4531
  const percentage = _PERCENTAGE_RE.exec(kept[i]);
4488
4532
  if (percentage === null) continue;
4489
- const number = _shiftDecimal(percentage[1], -2);
4533
+ const number = _roundSignificant(_shiftDecimal(percentage[1], -2));
4490
4534
  if (number.length <= kept[i].length) kept[i] = number;
4491
4535
  }
4492
4536
  if (kept.length === 3 && Number(kept[2]) === 1) kept.pop();
@@ -5625,11 +5669,12 @@ const printer = (path, writer) => {
5625
5669
  }
5626
5670
  // Read before the body: composing it is what leaves the block empty, and
5627
5671
  // the drop below asks the same question again.
5628
- const unusedRule = _takeUnusedRule(/** @type {Node} */ (_S._currentNode));
5672
+ const unusedRule = _takeUnusedRule(_S._currentNode);
5629
5673
  const rules = _rulesOf(path.node);
5630
5674
  // `nl` prefixes each item: nothing minifying, a line break beautifying
5631
5675
  // (declarations end in `;`, rules don't).
5632
5676
  const nl = minify ? "" : "\n";
5677
+ const memoized = _memoizedBlockBody(_S._currentNode);
5633
5678
  const {
5634
5679
  body,
5635
5680
  items,
@@ -5639,15 +5684,23 @@ const printer = (path, writer) => {
5639
5684
  addedPrefix,
5640
5685
  deadPrefixed,
5641
5686
  spans
5642
- } = _composeBlockBody(
5643
- path,
5644
- decls,
5645
- rules,
5646
- writer,
5647
- minify,
5648
- nl,
5687
+ } =
5688
+ memoized === undefined
5689
+ ? _composeBlockBody(
5690
+ path,
5691
+ decls,
5692
+ rules,
5693
+ writer,
5694
+ minify,
5695
+ nl,
5696
+ _S._currentNode,
5697
+ unusedRule
5698
+ )
5699
+ : // A rule its selector made unused writes nothing, whatever its block.
5700
+ _memoizedComposition(unusedRule ? "" : memoized);
5701
+ _memoizeBlockBody(
5649
5702
  _S._currentNode,
5650
- unusedRule
5703
+ memoized === undefined && !unusedRule ? body : null
5651
5704
  );
5652
5705
  if (
5653
5706
  minify &&
@@ -5671,13 +5724,7 @@ const printer = (path, writer) => {
5671
5724
  );
5672
5725
  {
5673
5726
  const written =
5674
- _writeNested(
5675
- path,
5676
- /** @type {Node} */ (_S._currentNode),
5677
- prelude,
5678
- null,
5679
- true
5680
- ) || "";
5727
+ _writeNested(path, _S._currentNode, prelude, null, true) || "";
5681
5728
  if (minify && written.length !== 0) {
5682
5729
  _recordHoistedRule(written, null, 0);
5683
5730
  }
@@ -5772,12 +5819,12 @@ const printer = (path, writer) => {
5772
5819
  const copies =
5773
5820
  out === text ||
5774
5821
  _prefixCopyPreludes.length === 0 ||
5775
- _holdsNested(/** @type {Node} */ (_S._currentNode))
5822
+ _holdsNested(_S._currentNode)
5776
5823
  ? undefined
5777
5824
  : _prefixCopyPreludes;
5778
5825
  const nested = _writeNested(
5779
5826
  path,
5780
- /** @type {Node} */ (_S._currentNode),
5827
+ _S._currentNode,
5781
5828
  prelude,
5782
5829
  ownRest,
5783
5830
  out === text || copies !== undefined,
@@ -5835,7 +5882,10 @@ const printer = (path, writer) => {
5835
5882
  // The block's own merges have run and settled what they grew, so the
5836
5883
  // text above and the children agree; a list one of them still carries
5837
5884
  // concatenated is one this block says is there to settle.
5838
- unordered: _anyUnordered(children)
5885
+ unordered: _anyUnordered(children),
5886
+ list: null,
5887
+ block: null,
5888
+ declarations: null
5839
5889
  });
5840
5890
  }
5841
5891
  if (minify && path.type() === NodeType.QualifiedRule) {
@@ -5868,7 +5918,10 @@ const printer = (path, writer) => {
5868
5918
  listKind,
5869
5919
  children: null,
5870
5920
  head: "",
5871
- unordered: false
5921
+ unordered: false,
5922
+ list: null,
5923
+ block: null,
5924
+ declarations: null
5872
5925
  });
5873
5926
  }
5874
5927
  return text;
@@ -6034,4 +6087,6 @@ const _renderDataUrl = (url) => {
6034
6087
  return buildDataURI(read.parsed, rendered);
6035
6088
  };
6036
6089
 
6090
+ _setVerbatimLeafPrinter(printer);
6091
+
6037
6092
  module.exports.printer = printer;
@@ -34,23 +34,7 @@ const { fileUrlToPath } = require("../util/identifier");
34
34
  * @property {AbsolutePath=} outputPath Path to the output file e.g. `path.resolve(__dirname, 'profiling/events.json')`. Defaults to `events.json`.
35
35
  */
36
36
 
37
- /**
38
- * Defines the hook type used by this module.
39
- * @template T, R
40
- * @typedef {import("tapable").Hook<T, R>} Hook
41
- */
42
-
43
- /**
44
- * Defines the fake hook type used by this module.
45
- * @template T
46
- * @typedef {import("../util/deprecation").FakeHook<T>} FakeHook
47
- */
48
-
49
- /**
50
- * Defines the hook map type used by this module.
51
- * @template T
52
- * @typedef {import("tapable").HookMap<T>} HookMap
53
- */
37
+ /** @import { FakeHookMarker } from "../util/deprecation" */
54
38
 
55
39
  /**
56
40
  * Defines the hook interceptor type used by this module.
@@ -96,8 +80,7 @@ class Profiler {
96
80
 
97
81
  try {
98
82
  this.session = new /** @type {Inspector} */ (inspector).Session();
99
- /** @type {Session} */
100
- (this.session).connect();
83
+ this.session.connect();
101
84
  } catch (_) {
102
85
  this.session = undefined;
103
86
  return Promise.resolve();
@@ -119,7 +102,7 @@ class Profiler {
119
102
  * Returns promise for the result.
120
103
  * @param {string} method method name
121
104
  * @param {import("inspector").Profiler.SetSamplingIntervalParameterType=} params params
122
- * @returns {Promise<EXPECTED_ANY | void>} Promise for the result
105
+ * @returns {Promise<Partial<import("inspector").Profiler.StopReturnType> | void>} Promise for the result, `{}` for commands without one
123
106
  */
124
107
  sendCommand(method, params) {
125
108
  if (this.hasSession()) {
@@ -151,7 +134,9 @@ class Profiler {
151
134
  * @returns {Promise<{ profile: { startTime: number, endTime: number } }>} profile result
152
135
  */
153
136
  stopProfiling() {
154
- return this.sendCommand("Profiler.stop").then(({ profile }) => {
137
+ return /** @type {Promise<import("inspector").Profiler.StopReturnType>} */ (
138
+ this.sendCommand("Profiler.stop")
139
+ ).then(({ profile }) => {
155
140
  const hrtime = process.hrtime();
156
141
  const endTime = hrtime[0] * 1000000 + Math.round(hrtime[1] / 1000);
157
142
  // Avoid coverage problems due indirect changes
@@ -406,18 +391,34 @@ class ProfilingPlugin {
406
391
  }
407
392
  }
408
393
 
409
- /** @typedef {Record<string, Hook<EXPECTED_ANY, EXPECTED_ANY> | FakeHook<EXPECTED_ANY> | HookMap<EXPECTED_ANY>>} Hooks */
394
+ /**
395
+ * The part of a tapable `HookInterceptor` this plugin sets: it rewraps each tap.
396
+ * @typedef {{ register?(tap: FullTap): FullTap }} TapInterceptor
397
+ */
398
+
399
+ /**
400
+ * What intercepting a tapable `Hook` needs of it. Methods, so every hook fits
401
+ * whatever its arguments, result and additional tap options.
402
+ * @typedef {{ intercept(interceptor: TapInterceptor): void, _fakeHook?: undefined }} HookWithInterceptor
403
+ */
404
+
405
+ /**
406
+ * What intercepting a tapable `HookMap` needs of it, whatever hook it holds.
407
+ * @typedef {{ for(key: string): HookWithInterceptor, intercept(interceptor: { factory?(key: string, hook: HookWithInterceptor): HookWithInterceptor }): void, _fakeHook?: undefined }} HookMapWithInterceptor
408
+ */
409
+
410
+ /** @typedef {Record<string, HookWithInterceptor | HookMapWithInterceptor | FakeHookMarker>} Hooks */
410
411
 
411
412
  /**
412
413
  * Intercepts the taps of a hook or every cached and future hook in a hook map.
413
- * @param {Hooks[string]} hook the hook or hook map
414
- * @param {HookInterceptor<EXPECTED_ANY, EXPECTED_ANY>} interceptor what intercepts each tap
414
+ * @param {HookWithInterceptor | HookMapWithInterceptor} hook the hook or hook map
415
+ * @param {TapInterceptor} interceptor what intercepts each tap
415
416
  * @returns {void}
416
417
  */
417
418
  const interceptTaps = (hook, interceptor) => {
418
419
  if ("for" in hook) {
419
420
  const { _map } =
420
- /** @type {HookMap<Hook<EXPECTED_ANY, EXPECTED_ANY>> & { _map: Map<unknown, Hook<EXPECTED_ANY, EXPECTED_ANY>> }} */
421
+ /** @type {HookMapWithInterceptor & { _map: Map<string, HookWithInterceptor> }} */
421
422
  (hook);
422
423
  for (const cached of _map.values()) {
423
424
  cached.intercept(interceptor);
@@ -425,8 +426,8 @@ const interceptTaps = (hook, interceptor) => {
425
426
  hook.intercept({
426
427
  /**
427
428
  * @param {string} key the key the hook is created for
428
- * @param {Hook<EXPECTED_ANY, EXPECTED_ANY>} created the hook created
429
- * @returns {Hook<EXPECTED_ANY, EXPECTED_ANY>} the same hook, intercepted
429
+ * @param {HookWithInterceptor} created the hook created
430
+ * @returns {HookWithInterceptor} the same hook, intercepted
430
431
  */
431
432
  factory: (key, created) => {
432
433
  created.intercept(interceptor);
@@ -533,7 +534,25 @@ const interceptAllCssModulesPluginHooks = (compilation, tracer) => {
533
534
  );
534
535
  };
535
536
 
536
- /** @typedef {(...args: EXPECTED_ANY[]) => EXPECTED_ANY | Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} PluginFunction */
537
+ /**
538
+ * A `sync` tap's function, or a `promise` tap's when `R` is a promise.
539
+ * @template {unknown[]} A the hook's arguments
540
+ * @template R what the tap returns
541
+ * @typedef {(...args: A) => R} PluginFunction
542
+ */
543
+
544
+ /**
545
+ * The callback an `async` tap reports its error or result through.
546
+ * @template R the hook's result
547
+ * @typedef {(error?: Error | null, result?: R) => void} TapCallback
548
+ */
549
+
550
+ /**
551
+ * An `async` tap's function, the hook's callback after its arguments.
552
+ * @template {unknown[]} A the hook's arguments
553
+ * @template R the hook's result
554
+ * @typedef {(...args: [...A, TapCallback<R>]) => void} AsyncPluginFunction
555
+ */
537
556
 
538
557
  /**
539
558
  * Creates interceptor for.
@@ -556,7 +575,7 @@ const makeInterceptorFor = (instance, tracer) => (hookName) => ({
556
575
  : makeNewProfiledTapFn(hookName, tracer, {
557
576
  name,
558
577
  type,
559
- fn: /** @type {PluginFunction} */ (internalFn)
578
+ fn: internalFn
560
579
  });
561
580
  return { ...tapInfo, fn: newFn };
562
581
  }
@@ -564,20 +583,22 @@ const makeInterceptorFor = (instance, tracer) => (hookName) => ({
564
583
 
565
584
  /**
566
585
  * Creates new profiled tap fn.
586
+ * @template {unknown[]} A the hook's arguments
587
+ * @template R the hook's result
567
588
  * @param {string} hookName Name of the hook to profile.
568
589
  * @param {Trace} tracer The trace object.
569
590
  * @param {object} options Options for the profiled fn.
570
591
  * @param {string} options.name Plugin name
571
592
  * @param {"sync" | "async" | "promise"} options.type Plugin type (sync | async | promise)
572
- * @param {PluginFunction} options.fn Plugin function
573
- * @returns {PluginFunction} Chainable hooked function.
593
+ * @param {FullTap["fn"]} options.fn Plugin function, its shape set by `options.type`
594
+ * @returns {FullTap["fn"]} Chainable hooked function.
574
595
  */
575
596
  const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
576
597
  const defaultCategory = ["blink.user_timing"];
577
598
 
578
599
  switch (type) {
579
600
  case "promise":
580
- return (...args) => {
601
+ return /** @type {PluginFunction<A, Promise<R>>} */ (...args) => {
581
602
  const id = ++tracer.counter;
582
603
  tracer.trace.begin({
583
604
  name,
@@ -585,8 +606,8 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
585
606
  cat: defaultCategory
586
607
  });
587
608
  const promise =
588
- /** @type {Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} */
589
- (fn(...args));
609
+ /** @type {PluginFunction<A, Promise<R>>} */
610
+ (fn)(...args);
590
611
  return promise.then((r) => {
591
612
  tracer.trace.end({
592
613
  name,
@@ -597,19 +618,20 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
597
618
  });
598
619
  };
599
620
  case "async":
600
- return (...args) => {
621
+ return /** @type {AsyncPluginFunction<A, R>} */ (...args) => {
601
622
  const id = ++tracer.counter;
602
623
  tracer.trace.begin({
603
624
  name,
604
625
  id,
605
626
  cat: defaultCategory
606
627
  });
607
- const callback = args.pop();
608
- fn(
609
- ...args,
628
+ const callback = /** @type {TapCallback<R>} */ (args.pop());
629
+ /** @type {AsyncPluginFunction<A, R>} */ (fn)(
630
+ // `pop()` took the callback off, which the tuple type cannot follow.
631
+ .../** @type {A} */ (/** @type {unknown[]} */ (args)),
610
632
  /**
611
633
  * Handles the cat callback for this hook.
612
- * @param {...EXPECTED_ANY[]} r result
634
+ * @param {Parameters<TapCallback<R>>} r result
613
635
  */
614
636
  (...r) => {
615
637
  tracer.trace.end({
@@ -622,12 +644,12 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
622
644
  );
623
645
  };
624
646
  case "sync":
625
- return (...args) => {
647
+ return /** @type {PluginFunction<A, R>} */ (...args) => {
626
648
  const id = ++tracer.counter;
627
649
  // Do not instrument ourself due to the CPU
628
650
  // profile needing to be the last event in the trace.
629
651
  if (name === PLUGIN_NAME) {
630
- return fn(...args);
652
+ return /** @type {PluginFunction<A, R>} */ (fn)(...args);
631
653
  }
632
654
 
633
655
  tracer.trace.begin({
@@ -635,10 +657,10 @@ const makeNewProfiledTapFn = (hookName, tracer, { name, type, fn }) => {
635
657
  id,
636
658
  cat: defaultCategory
637
659
  });
638
- /** @type {PluginFunction} */
660
+ /** @type {R} */
639
661
  let r;
640
662
  try {
641
- r = fn(...args);
663
+ r = /** @type {PluginFunction<A, R>} */ (fn)(...args);
642
664
  } catch (err) {
643
665
  tracer.trace.end({
644
666
  name,
@@ -255,7 +255,7 @@ const dropTrailingMembers = (node, count) => {
255
255
 
256
256
  /**
257
257
  * Returns code converted to string that evaluates.
258
- * @param {EXPECTED_ANY[] | { [k: string]: EXPECTED_ANY }} obj obj
258
+ * @param {CodeValue[] | Record<string, CodeValue>} obj obj
259
259
  * @param {JavascriptParser} parser Parser
260
260
  * @param {ValueCacheVersions} valueCacheVersions valueCacheVersions
261
261
  * @param {string} key the defined key
@@ -376,7 +376,7 @@ const toCode = (
376
376
  }
377
377
  if (typeof code === "object") {
378
378
  return stringifyObj(
379
- code,
379
+ /** @type {CodeValue[] | Record<string, CodeValue>} */ (code),
380
380
  parser,
381
381
  valueCacheVersions,
382
382
  key,
@@ -675,7 +675,7 @@ const stringifyMergedNode = (merged, node, parser, key, objKeys) => {
675
675
  }
676
676
  const code = `{${keys
677
677
  .map((k) => {
678
- const value = /** @type {MergedDefinitionNode} */ (node.get(k));
678
+ const value = node.get(k);
679
679
  return `${toPropertyKey(k)}:${
680
680
  value instanceof Map
681
681
  ? stringifyMergedNode(merged, value, parser, k)
@@ -1115,7 +1115,9 @@ class DefinePlugin {
1115
1115
  // so scanning that text cannot find every reference.
1116
1116
  const hasPreparsedAst =
1117
1117
  /** @type {{ _ast: PreparsedAst | null }} */ (
1118
- /** @type {unknown} */ (module)
1118
+ /** @type {NormalModule | { _ast: PreparsedAst | null }} */ (
1119
+ module
1120
+ )
1119
1121
  )._ast !== null;
1120
1122
  await resolveAsyncRuntimeValues(
1121
1123
  compilation,
@@ -1139,9 +1141,7 @@ class DefinePlugin {
1139
1141
  /** @type {ValueCacheVersion} */
1140
1142
  (compilation.valueCacheVersions.get(VALUE_DEP_MAIN));
1141
1143
  parser.hooks.program.tap(PLUGIN_NAME, () => {
1142
- const buildInfo = /** @type {NormalModuleBuildInfo} */ (
1143
- parser.state.module.buildInfo
1144
- );
1144
+ const buildInfo = parser.state.module.buildInfo;
1145
1145
  if (!buildInfo.valueDependencies) {
1146
1146
  buildInfo.valueDependencies = new Map();
1147
1147
  }
@@ -1153,9 +1153,7 @@ class DefinePlugin {
1153
1153
  * @param {string} key key
1154
1154
  */
1155
1155
  const addValueDependency = (key) => {
1156
- const buildInfo =
1157
- /** @type {NormalModuleBuildInfo} */
1158
- (parser.state.module.buildInfo);
1156
+ const buildInfo = parser.state.module.buildInfo;
1159
1157
  /** @type {NonNullable<NormalModuleBuildInfo["valueDependencies"]>} */
1160
1158
  (buildInfo.valueDependencies).set(
1161
1159
  VALUE_DEP_PREFIX + key,
@@ -1229,7 +1227,7 @@ class DefinePlugin {
1229
1227
  // several DefinePlugins can still be destructured together
1230
1228
  const nestedSet = mergedDefinitions.nestedByFinalKey.get(final);
1231
1229
  if (!nestedSet || nestedSet.size <= 0) return;
1232
- for (const nested of /** @type {Set<string>} */ (nestedSet)) {
1230
+ for (const nested of nestedSet) {
1233
1231
  if (nested && !hooked.has(nested)) {
1234
1232
  // only detect the same nested key once
1235
1233
  hooked.add(nested);
@@ -1475,10 +1473,7 @@ class DefinePlugin {
1475
1473
  parser.hooks.expression.for(key).tap(PLUGIN_NAME, (expr) => {
1476
1474
  const valueDependencies =
1477
1475
  /** @type {NonNullable<NormalModuleBuildInfo["valueDependencies"]>} */
1478
- (
1479
- /** @type {NormalModuleBuildInfo} */
1480
- (parser.state.module.buildInfo).valueDependencies
1481
- );
1476
+ (parser.state.module.buildInfo.valueDependencies);
1482
1477
  for (const [name, version] of objectValueDependencies) {
1483
1478
  valueDependencies.set(name, version);
1484
1479
  }
@@ -281,7 +281,11 @@ class DotenvPlugin {
281
281
  {
282
282
  name: "Dotenv Plugin",
283
283
  baseDataPath: "options"
284
- }
284
+ },
285
+ (options) =>
286
+ require("../../schemas/plugins/define/DotenvPluginOptions.check")(
287
+ options
288
+ )
285
289
  );
286
290
  });
287
291
  const definePlugin = new compiler.webpack.DefinePlugin({});
@@ -491,6 +495,8 @@ class DotenvPlugin {
491
495
  * @returns {Env} env variables
492
496
  */
493
497
  _getEnv(prefixes, parsed) {
498
+ // Expansion mutates its input, but the cache must retain the raw file values.
499
+ parsed = Object.assign(/** @type {Env} */ (Object.create(null)), parsed);
494
500
  // Always expand environment variables (like Vite does)
495
501
  // Make a copy of process.env so that dotenv-expand doesn't modify global process.env
496
502
  const processEnv = { ...process.env };
@@ -503,11 +509,9 @@ class DotenvPlugin {
503
509
  // Prioritize actual env variables from `process.env`, fallback to parsed
504
510
  for (const key of keys) {
505
511
  if (prefixes.some((prefix) => key.startsWith(prefix))) {
506
- env[key] =
507
- Object.prototype.hasOwnProperty.call(process.env, key) &&
508
- process.env[key]
509
- ? process.env[key]
510
- : parsed[key];
512
+ env[key] = Object.prototype.hasOwnProperty.call(process.env, key)
513
+ ? /** @type {string} */ (process.env[key])
514
+ : parsed[key];
511
515
  }
512
516
  }
513
517
 
@@ -10,23 +10,25 @@ const DefinePlugin = require("./DefinePlugin");
10
10
 
11
11
  /** @import Compiler from "../Compiler" */
12
12
  /** @import { CodeValue } from "./DefinePlugin" */
13
+ /** @import { JsonObject } from "../fs/fs" */
13
14
 
14
15
  const PLUGIN_NAME = "EnvironmentPlugin";
15
16
 
16
17
  class EnvironmentPlugin {
17
18
  /**
18
19
  * Creates an instance of EnvironmentPlugin.
19
- * @param {(string | string[] | Record<string, EXPECTED_ANY>)[]} keys keys
20
+ * @param {(string | string[] | JsonObject)[]} keys keys
20
21
  */
21
22
  constructor(...keys) {
22
23
  if (keys.length === 1 && Array.isArray(keys[0])) {
23
24
  /** @type {string[]} */
24
25
  this.keys = keys[0];
26
+ /** @type {JsonObject} */
25
27
  this.defaultValues = {};
26
28
  } else if (keys.length === 1 && keys[0] && typeof keys[0] === "object") {
27
29
  this.keys = Object.keys(keys[0]);
28
30
  this.defaultValues =
29
- /** @type {Record<string, EXPECTED_ANY>} */
31
+ /** @type {JsonObject} */
30
32
  (keys[0]);
31
33
  } else {
32
34
  this.keys = /** @type {string[]} */ (keys);
@@ -36,7 +36,6 @@ const { addLocalModule, getLocalModule } = require("./LocalModulesHelpers");
36
36
  * } from "../../../declarations/WebpackOptions"
37
37
  */
38
38
  /** @import Dependency from "../../graph/Dependency" */
39
- /** @import { BuildInfo } from "../../module/Module" */
40
39
  /** @import BasicEvaluatedExpression from "../../javascript/BasicEvaluatedExpression" */
41
40
  /**
42
41
  * @import JavascriptParser, {
@@ -356,7 +355,7 @@ class AMDDefineDependencyParserPlugin {
356
355
  }
357
356
  DynamicExports.bailout(parser.state);
358
357
  recordOptimizationBailout(
359
- /** @type {BuildInfo} */ (parser.state.module.buildInfo),
358
+ parser.state.module.buildInfo,
360
359
  "AMD bailout: define() prevents static exports analysis"
361
360
  );
362
361
  /** @type {Identifier[] | null} */
@@ -39,6 +39,7 @@ const getUnsupportedFeatureWarning = memoize(() =>
39
39
  * } from "../../../declarations/WebpackOptions"
40
40
  */
41
41
  /** @import Dependency, { DependencyLocation } from "../../graph/Dependency" */
42
+ /** @import DependenciesBlock from "../../graph/DependenciesBlock" */
42
43
  /** @import BasicEvaluatedExpression from "../../javascript/BasicEvaluatedExpression" */
43
44
  /** @import JavascriptParser, { Range } from "../../javascript/JavascriptParser" */
44
45
  /** @import LocalModule from "./LocalModule" */
@@ -323,7 +324,9 @@ class AMDRequireDependenciesBlockParserPlugin {
323
324
  dep.loc = parser.getLocation(expr);
324
325
  depBlock.addDependency(dep);
325
326
 
326
- parser.state.current = /** @type {EXPECTED_ANY} */ (depBlock);
327
+ parser.state.current = /** @type {typeof parser.state.current} */ (
328
+ /** @type {DependenciesBlock} */ (depBlock)
329
+ );
327
330
  }
328
331
 
329
332
  if (expr.arguments.length === 1) {