@depup/webpack 5.110.3-depup.0 → 5.111.1-depup.0

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 (283) hide show
  1. package/README.md +7 -8
  2. package/changes.json +7 -11
  3. package/lib/APIPlugin.js +26 -11
  4. package/lib/AutomaticPrefetchPlugin.js +1 -1
  5. package/lib/Cache.js +8 -3
  6. package/lib/CacheFacade.js +1 -1
  7. package/lib/CircularModulesPlugin.js +157 -55
  8. package/lib/CleanPlugin.js +2 -2
  9. package/lib/CompatibilityPlugin.js +3 -4
  10. package/lib/Compilation.js +336 -337
  11. package/lib/Compiler.js +213 -51
  12. package/lib/ConstPlugin.js +16 -132
  13. package/lib/CopyPlugin.js +1054 -0
  14. package/lib/DefinePlugin.js +24 -8
  15. package/lib/DependencyTemplate.js +2 -1
  16. package/lib/DotenvPlugin.js +24 -28
  17. package/lib/ErrorHelpers.js +113 -0
  18. package/lib/ExportsInfo.js +20 -16
  19. package/lib/ExternalModule.js +47 -22
  20. package/lib/FileSystemInfo.js +17 -14
  21. package/lib/FlagDependencyExportsPlugin.js +53 -34
  22. package/lib/FlagDependencyUsagePlugin.js +9 -13
  23. package/lib/Generator.js +24 -2
  24. package/lib/HotModuleReplacementPlugin.js +55 -7
  25. package/lib/IgnorePlugin.js +1 -1
  26. package/lib/JavascriptMetaInfoPlugin.js +5 -3
  27. package/lib/LoaderOptionsPlugin.js +1 -1
  28. package/lib/MainTemplate.js +5 -1
  29. package/lib/Module.js +19 -10
  30. package/lib/ModuleGraph.js +6 -9
  31. package/lib/MultiCompiler.js +7 -17
  32. package/lib/MultiWatching.js +1 -1
  33. package/lib/NormalModule.js +135 -50
  34. package/lib/NormalModuleFactory.js +1 -1
  35. package/lib/RuntimeGlobals.js +21 -7
  36. package/lib/RuntimeModule.js +28 -12
  37. package/lib/RuntimePlugin.js +30 -3
  38. package/lib/RuntimeTemplate.js +813 -518
  39. package/lib/SourceMapDevToolPlugin.js +54 -104
  40. package/lib/TemplatedPathPlugin.js +16 -59
  41. package/lib/Watching.js +9 -0
  42. package/lib/WebpackOptionsApply.js +84 -91
  43. package/lib/asset/AssetBytesGenerator.js +7 -1
  44. package/lib/asset/AssetGenerator.js +50 -24
  45. package/lib/asset/AssetModule.js +3 -0
  46. package/lib/asset/AssetSourceGenerator.js +7 -1
  47. package/lib/asset/WebManifestParser.js +7 -5
  48. package/lib/buildChunkGraph.js +11 -15
  49. package/lib/cache/AddBuildDependenciesPlugin.js +33 -4
  50. package/lib/cache/IdleFileCachePlugin.js +2 -2
  51. package/lib/cache/MemoryCachePlugin.js +4 -4
  52. package/lib/cache/MemoryWithGcCachePlugin.js +7 -8
  53. package/lib/cache/PackFileCacheStrategy.js +17 -19
  54. package/lib/cache/getLazyHashedEtag.js +3 -5
  55. package/lib/config/browserslistTargetHandler.js +17 -4
  56. package/lib/config/defaults.js +138 -128
  57. package/lib/config/getClaimedAssetTypes.js +10 -11
  58. package/lib/config/normalization.js +82 -12
  59. package/lib/config/target.js +13 -4
  60. package/lib/container/ContainerReferencePlugin.js +6 -0
  61. package/lib/container/RemoteRuntimeModule.js +9 -0
  62. package/lib/container/declaredRemotes.js +39 -0
  63. package/lib/{ContextExclusionPlugin.js → context/ContextExclusionPlugin.js} +1 -1
  64. package/lib/{ContextModule.js → context/ContextModule.js} +54 -115
  65. package/lib/{ContextModuleFactory.js → context/ContextModuleFactory.js} +19 -21
  66. package/lib/{ContextReplacementPlugin.js → context/ContextReplacementPlugin.js} +4 -4
  67. package/lib/css/CssGenerator.js +27 -11
  68. package/lib/css/CssInjectStyleRuntimeModule.js +9 -0
  69. package/lib/css/CssLoadingRuntimeModule.js +94 -36
  70. package/lib/css/CssModule.js +1 -1
  71. package/lib/css/CssModulesPlugin.js +7 -6
  72. package/lib/css/CssParser.js +162 -31
  73. package/lib/css/CssServerStylesRuntimeModule.js +9 -0
  74. package/lib/css/cssMinify.js +43 -32
  75. package/lib/css/data.js +3514 -869
  76. package/lib/css/syntax.js +6370 -1220
  77. package/lib/debug/ProfilingPlugin.js +7 -4
  78. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +6 -3
  79. package/lib/dependencies/AMDRuntimeModules.js +18 -0
  80. package/lib/dependencies/CommonJsExportRequireDependency.js +13 -12
  81. package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -13
  82. package/lib/dependencies/CommonJsImportsParserPlugin.js +5 -5
  83. package/lib/dependencies/CommonJsPlugin.js +19 -3
  84. package/lib/dependencies/CommonJsRequireDependency.js +14 -5
  85. package/lib/dependencies/CommonJsSelfReferenceDependency.js +2 -4
  86. package/lib/dependencies/ContextDependency.js +1 -1
  87. package/lib/dependencies/ContextDependencyHelpers.js +3 -9
  88. package/lib/dependencies/ContextElementDependency.js +1 -1
  89. package/lib/dependencies/CssIcssExportDependency.js +13 -9
  90. package/lib/dependencies/CssIcssImportDependency.js +3 -6
  91. package/lib/dependencies/CssUrlDependency.js +3 -5
  92. package/lib/dependencies/HarmonyCompatibilityDependency.js +67 -22
  93. package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -4
  94. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +10 -7
  95. package/lib/dependencies/HarmonyExportExpressionDependency.js +47 -33
  96. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +74 -17
  97. package/lib/dependencies/HarmonyExportInitFragment.js +110 -23
  98. package/lib/dependencies/HarmonyExportSpecifierDependency.js +25 -58
  99. package/lib/dependencies/HarmonyImportBareSideEffectDependency.js +59 -0
  100. package/lib/dependencies/HarmonyImportDependency.js +6 -1
  101. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +111 -17
  102. package/lib/dependencies/HarmonyImportSideEffectDependency.js +3 -4
  103. package/lib/dependencies/HarmonyImportSpecifierDependency.js +40 -3
  104. package/lib/dependencies/HarmonyModulesPlugin.js +20 -0
  105. package/lib/dependencies/HtmlEntryDependency.js +124 -102
  106. package/lib/dependencies/HtmlInlineScriptDependency.js +3 -4
  107. package/lib/dependencies/HtmlInlineStyleDependency.js +3 -4
  108. package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +1 -1
  109. package/lib/dependencies/ImportMetaGlobHelpers.js +1 -1
  110. package/lib/dependencies/ImportMetaMainDependency.js +104 -0
  111. package/lib/dependencies/ImportMetaPlugin.js +67 -25
  112. package/lib/dependencies/ImportParserPlugin.js +1 -1
  113. package/lib/dependencies/LoaderPlugin.js +26 -1
  114. package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
  115. package/lib/dependencies/SystemRuntimeModule.js +9 -0
  116. package/lib/dependencies/URLContextDependency.js +1 -1
  117. package/lib/dependencies/URLDependency.js +6 -5
  118. package/lib/dependencies/WorkerAndWorkletPlugin.js +15 -21
  119. package/lib/dependencies/WorkerDependency.js +7 -7
  120. package/lib/dependencies/WorkletDependency.js +7 -11
  121. package/lib/dll/DelegatedModule.js +18 -1
  122. package/lib/dll/DllReferencePlugin.js +11 -8
  123. package/lib/dll/LibManifestPlugin.js +1 -1
  124. package/lib/errors/AnalyzableBailoutsWarning.js +41 -0
  125. package/lib/errors/DuplicateModulesWarning.js +12 -7
  126. package/lib/errors/EmptyCopyPatternWarning.js +26 -0
  127. package/lib/errors/ExternalStarReexportError.js +44 -0
  128. package/lib/errors/HookWebpackError.js +3 -2
  129. package/lib/errors/MissingSourceMapsWarning.js +36 -0
  130. package/lib/errors/ModuleParseError.js +2 -1
  131. package/lib/errors/UnusedAssetsWarning.js +36 -0
  132. package/lib/errors/UnusedFederationWarning.js +35 -0
  133. package/lib/errors/UnusedModulesWarning.js +38 -0
  134. package/lib/esm/ExportWebpackRequireRuntimeModule.js +9 -0
  135. package/lib/esm/ModuleChunkFormatPlugin.js +28 -3
  136. package/lib/esm/ModuleChunkLoadingPlugin.js +30 -11
  137. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +92 -60
  138. package/lib/hmr/HotModuleReplacement.runtime.js +8 -2
  139. package/lib/hmr/HotModuleReplacementRuntimeModule.js +9 -0
  140. package/lib/hmr/LazyCompilationPlugin.js +3 -5
  141. package/lib/html/HtmlGenerator.js +72 -87
  142. package/lib/html/HtmlModulesPlugin.js +418 -200
  143. package/lib/html/HtmlParser.js +110 -147
  144. package/lib/html/builtinEmbeddedRenderer.js +107 -0
  145. package/lib/html/data.js +142 -7
  146. package/lib/html/htmlMinify.js +92 -122
  147. package/lib/html/syntax.js +1618 -1391
  148. package/lib/ids/HashedModuleIdsPlugin.js +2 -1
  149. package/lib/index.js +49 -3
  150. package/lib/javascript/ChunkFormatHelpers.js +4 -3
  151. package/lib/javascript/JavascriptGenerator.js +8 -1
  152. package/lib/javascript/JavascriptModule.js +1 -0
  153. package/lib/javascript/JavascriptModulesPlugin.js +73 -72
  154. package/lib/javascript/JavascriptParser.js +1970 -900
  155. package/lib/javascript/StartupHelpers.js +27 -3
  156. package/lib/javascript/data.js +172 -0
  157. package/lib/javascript/grammar.js +5546 -0
  158. package/lib/javascript/parser.js +1500 -0
  159. package/lib/javascript/regexp.js +1762 -0
  160. package/lib/javascript/regexpData.js +51 -0
  161. package/lib/javascript/syntax.js +9061 -5262
  162. package/lib/json/JsonGenerator.js +7 -1
  163. package/lib/library/ModuleLibraryPlugin.js +171 -132
  164. package/lib/loaders/LoaderRunner.js +137 -9
  165. package/lib/node/NodeWatchFileSystem.js +3 -9
  166. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +22 -0
  167. package/lib/node/RequireChunkLoadingRuntimeModule.js +22 -0
  168. package/lib/optimize/AggressiveMergingPlugin.js +3 -5
  169. package/lib/optimize/ConcatenatedModule.js +178 -120
  170. package/lib/optimize/ConstExportsPlugin.js +50 -39
  171. package/lib/optimize/FlagIncludedChunksPlugin.js +3 -11
  172. package/lib/optimize/InlineExports.js +20 -123
  173. package/lib/optimize/InnerGraphPlugin.js +7 -13
  174. package/lib/optimize/LimitChunkCountPlugin.js +5 -8
  175. package/lib/optimize/MangleExportsPlugin.js +13 -4
  176. package/lib/optimize/ModuleConcatenationPlugin.js +27 -5
  177. package/lib/optimize/RealContentHashPlugin.js +68 -9
  178. package/lib/optimize/SideEffectsFlagPlugin.js +24 -28
  179. package/lib/optimize/SplitChunksPlugin.js +2 -4
  180. package/lib/performance/AnalyzableBailoutsPlugin.js +115 -0
  181. package/lib/performance/BroadContextsPlugin.js +1 -1
  182. package/lib/performance/CacheEffectivenessPlugin.js +7 -7
  183. package/lib/performance/DuplicateModulesPlugin.js +57 -13
  184. package/lib/performance/EvalUsagePlugin.js +5 -2
  185. package/lib/performance/MissingSourceMapsPlugin.js +115 -0
  186. package/lib/performance/PureAnnotationsPlugin.js +6 -3
  187. package/lib/performance/SizeLimitsPlugin.js +2 -4
  188. package/lib/performance/TopLevelThisPlugin.js +5 -4
  189. package/lib/performance/UnusedAssetsPlugin.js +109 -0
  190. package/lib/performance/UnusedFederationPlugin.js +147 -0
  191. package/lib/performance/UnusedModulesPlugin.js +141 -0
  192. package/lib/performance/UnusedReexportsPlugin.js +1 -55
  193. package/lib/performance/isOnlyReexported.js +65 -0
  194. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +25 -5
  195. package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +8 -8
  196. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +9 -0
  197. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +9 -0
  198. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +9 -0
  199. package/lib/prefetch/ResourceHintPlugin.js +18 -23
  200. package/lib/prefetch/ResourceHintRuntimeModule.js +9 -0
  201. package/lib/prefetch/StartupAssetHintRuntimeModule.js +16 -10
  202. package/lib/rules/RuleSetCompiler.js +211 -4
  203. package/lib/runtime/AsyncModuleRuntimeModule.js +98 -66
  204. package/lib/runtime/AutoPublicPathRuntimeModule.js +9 -0
  205. package/lib/runtime/BaseUriRuntimeModule.js +9 -0
  206. package/lib/runtime/ChunkNameRuntimeModule.js +9 -0
  207. package/lib/runtime/EnsureChunkRuntimeModule.js +35 -16
  208. package/lib/runtime/GetChunkFilenameRuntimeModule.js +12 -4
  209. package/lib/runtime/GetFullHashRuntimeModule.js +9 -0
  210. package/lib/runtime/GetMainFilenameRuntimeModule.js +9 -0
  211. package/lib/runtime/GetWorkletBootstrapRuntimeModule.js +9 -0
  212. package/lib/runtime/GlobalRuntimeModule.js +11 -4
  213. package/lib/runtime/HasOwnPropertyRuntimeModule.js +9 -0
  214. package/lib/runtime/HelperRuntimeModule.js +10 -0
  215. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +305 -224
  216. package/lib/runtime/NonceRuntimeModule.js +9 -0
  217. package/lib/runtime/OnChunksLoadedRuntimeModule.js +67 -20
  218. package/lib/runtime/PublicPathRuntimeModule.js +9 -0
  219. package/lib/runtime/RuntimeIdRuntimeModule.js +9 -0
  220. package/lib/runtime/SpecNamespaceObjectRuntimeModule.js +90 -0
  221. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +9 -0
  222. package/lib/runtime/StartupEntrypointRuntimeModule.js +9 -0
  223. package/lib/runtime/SystemContextRuntimeModule.js +9 -0
  224. package/lib/runtime/ToBinaryRuntimeModule.js +9 -0
  225. package/lib/schemes/DataUriPlugin.js +3 -6
  226. package/lib/schemes/VirtualUrlPlugin.js +1 -1
  227. package/lib/serialization/BinaryMiddleware.js +9 -9
  228. package/lib/serialization/FileMiddleware.js +16 -16
  229. package/lib/serialization/ObjectMiddleware.js +168 -139
  230. package/lib/sharing/ConsumeSharedPlugin.js +12 -0
  231. package/lib/sharing/ConsumeSharedRuntimeModule.js +11 -0
  232. package/lib/sharing/ShareRuntimeModule.js +9 -0
  233. package/lib/sharing/declaredShared.js +47 -0
  234. package/lib/stats/DefaultStatsFactoryPlugin.js +6 -5
  235. package/lib/stats/DefaultStatsPrinterPlugin.js +3 -0
  236. package/lib/typescript/TypeScriptPlugin.js +2 -3
  237. package/lib/url/URLParserPlugin.js +6 -8
  238. package/lib/util/LocConverter.js +4 -7
  239. package/lib/util/SourceProcessor.js +91 -91
  240. package/lib/util/async.js +292 -0
  241. package/lib/util/buildDiagnostics.js +69 -0
  242. package/lib/util/chainedImports.js +3 -4
  243. package/lib/util/concatenate.js +4 -4
  244. package/lib/util/createHooksRegistry.js +1 -2
  245. package/lib/util/dataURL.js +2 -3
  246. package/lib/util/deterministicGrouping.js +8 -13
  247. package/lib/util/findGraphRoots.js +6 -13
  248. package/lib/util/fs.js +27 -1
  249. package/lib/util/globUtils.js +1 -1
  250. package/lib/util/handlerKeys.js +40 -0
  251. package/lib/util/hash/wasm-hash.js +3 -4
  252. package/lib/util/identifier.js +20 -0
  253. package/lib/util/internalSerializables.js +5 -1
  254. package/lib/util/registerExternalSerializer.js +6 -45
  255. package/lib/util/semver.js +5 -3
  256. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +9 -0
  257. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +9 -0
  258. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -1
  259. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -1
  260. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +12 -4
  261. package/lib/wasm-sync/WebAssemblyGenerator.js +6 -1
  262. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -1
  263. package/lib/wasm-sync/WebAssemblyUtils.js +2 -4
  264. package/lib/web/JsonpChunkLoadingRuntimeModule.js +36 -0
  265. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +19 -0
  266. package/package.json +55 -46
  267. package/schemas/WebpackOptions.check.js +1 -1
  268. package/schemas/WebpackOptions.json +379 -66
  269. package/schemas/plugins/LoaderOptionsPlugin.check.js +1 -1
  270. package/schemas/plugins/ManifestPlugin.check.js +1 -1
  271. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  272. package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
  273. package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
  274. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  275. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  276. package/schemas/plugins/debug/ProfilingPlugin.check.js +1 -1
  277. package/schemas/plugins/dll/DllReferencePlugin.check.js +1 -1
  278. package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +1 -1
  279. package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
  280. package/types.d.ts +1723 -604
  281. package/lib/dependencies/ExportBindingInitFragment.js +0 -191
  282. package/lib/errors/EntrypointOverlapWarning.js +0 -45
  283. package/lib/performance/EntrypointOverlapPlugin.js +0 -122
@@ -20,6 +20,7 @@ const {
20
20
  evaluateToString,
21
21
  toConstantDependency
22
22
  } = require("./javascript/JavascriptParserHelpers");
23
+ const { getBuildDiagnostics } = require("./util/buildDiagnostics");
23
24
  const createHash = require("./util/createHash");
24
25
  const createHooksRegistry = require("./util/createHooksRegistry");
25
26
 
@@ -92,8 +93,10 @@ class RuntimeValue {
92
93
  const buildInfo = /** @type {BuildInfo} */ (parser.state.module.buildInfo);
93
94
  if (this.options === true) {
94
95
  buildInfo.cacheable = false;
96
+ const diagnostics = getBuildDiagnostics(buildInfo);
95
97
  const reasons =
96
- buildInfo.notCacheableReasons || (buildInfo.notCacheableReasons = []);
98
+ diagnostics.notCacheableReasons ||
99
+ (diagnostics.notCacheableReasons = []);
97
100
  const reason = `DefinePlugin runtime value ${key}`;
98
101
  if (!reasons.includes(reason)) reasons.push(reason);
99
102
  } else {
@@ -375,7 +378,7 @@ const PLUGIN_NAME = "DefinePlugin";
375
378
  const VALUE_DEP_PREFIX = `webpack/${PLUGIN_NAME} `;
376
379
  const VALUE_DEP_MAIN = `webpack/${PLUGIN_NAME}_hash`;
377
380
 
378
- // Keys webpack injects itself are not the user's to remove, so `performance.unusedDefines`
381
+ // Keys webpack injects itself are not the user's to remove, so `performance.unusedConfig`
379
382
  // never sees them.
380
383
  /** @type {WeakSet<DefinePlugin>} */
381
384
  const INTERNAL_PLUGINS = new WeakSet();
@@ -721,11 +724,11 @@ class DefinePlugin {
721
724
  (compilation, { normalModuleFactory }) => {
722
725
  const definitions = this.definitions;
723
726
  const { performance } = compilation.options;
724
- // Only `performance.unusedDefines` reads these, so a build without it
727
+ // Only `performance.unusedConfig` reads these, so a build without it
725
728
  // collects nothing.
726
729
  const collectDeclared =
727
730
  performance !== false &&
728
- performance.unusedDefines === true &&
731
+ performance.unusedConfig === true &&
729
732
  !INTERNAL_PLUGINS.has(this);
730
733
  /** @type {Set<string> | undefined} */
731
734
  let declaredKeys;
@@ -1218,13 +1221,26 @@ class DefinePlugin {
1218
1221
  }
1219
1222
  return -1;
1220
1223
  };
1224
+ // Cut the chain at the undefined member, so a read after it still
1225
+ // throws; an optional link there short-circuits the whole chain.
1221
1226
  parser.hooks.expressionMemberChain
1222
1227
  .for(chainRoot)
1223
- .tap(PLUGIN_NAME, (expr, members) => {
1228
+ .tap(PLUGIN_NAME, (expr, members, membersOptionals) => {
1224
1229
  const deps = [key];
1225
- if (findUndefinedMemberAccess(members, deps) === -1) return;
1230
+ const undefinedIndex = findUndefinedMemberAccess(members, deps);
1231
+ if (undefinedIndex === -1) return;
1226
1232
  for (const dep of deps) addValueDependency(dep);
1227
- return toConstantDependency(parser, "undefined")(expr);
1233
+ return toConstantDependency(
1234
+ parser,
1235
+ "undefined"
1236
+ )(
1237
+ membersOptionals[undefinedIndex + 1]
1238
+ ? expr
1239
+ : dropTrailingMembers(
1240
+ expr,
1241
+ members.length - 1 - undefinedIndex
1242
+ )
1243
+ );
1228
1244
  });
1229
1245
  // Cut the chain at the undefined member, so what follows still
1230
1246
  // throws; an optional link there takes the call, arguments unevaluated.
@@ -1331,7 +1347,7 @@ class DefinePlugin {
1331
1347
  DefinePlugin.getCompilationHooks = createHooksRegistry(createCompilationHooks);
1332
1348
 
1333
1349
  /**
1334
- * Marks an instance as webpack's own, so `performance.unusedDefines` never
1350
+ * Marks an instance as webpack's own, so `performance.unusedConfig` never
1335
1351
  * reports the keys it declares against the user.
1336
1352
  * @param {DefinePlugin} plugin the instance webpack constructed itself
1337
1353
  * @returns {DefinePlugin} the same instance
@@ -12,7 +12,7 @@
12
12
  /** @import Dependency from "./Dependency" */
13
13
  /** @import DependencyTemplates from "./DependencyTemplates" */
14
14
  /** @import { GenerateContext } from "./Generator" */
15
- /** @import Module, { RuntimeRequirements } from "./Module" */
15
+ /** @import Module, { CodeGenerationResultData, RuntimeRequirements } from "./Module" */
16
16
  /** @import ModuleGraph from "./ModuleGraph" */
17
17
  /** @import RuntimeTemplate from "./RuntimeTemplate" */
18
18
  /** @import { RuntimeSpec } from "./util/runtime" */
@@ -37,6 +37,7 @@
37
37
  * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
38
38
  * @property {CodeGenerationResults} codeGenerationResults the code generation results
39
39
  * @property {InitFragment<GenerateContext>[]} chunkInitFragments chunkInitFragments
40
+ * @property {(() => CodeGenerationResultData)=} getData get access to the code generation data
40
41
  */
41
42
 
42
43
  /**
@@ -3,28 +3,6 @@
3
3
  Author Natsu @xiaoxiaojx
4
4
  */
5
5
 
6
- "use strict";
7
-
8
- const FileSystemInfo = require("./FileSystemInfo");
9
- const DotenvFileError = require("./errors/DotenvFileError");
10
- const { join } = require("./util/fs");
11
-
12
- /** @import { DotenvPluginOptions } from "../declarations/WebpackOptions" */
13
- /** @import Compiler from "./Compiler" */
14
- /** @import { ItemCacheFacade } from "./CacheFacade" */
15
- /** @import { InputFileSystem } from "./util/fs" */
16
- /** @import { Snapshot } from "./FileSystemInfo" */
17
-
18
- /** @typedef {Exclude<DotenvPluginOptions["prefix"], string | undefined>} Prefix */
19
- /** @typedef {Record<string, string>} Env */
20
-
21
- const DEFAULT_TEMPLATE = [
22
- ".env",
23
- ".env.local",
24
- ".env.[mode]",
25
- ".env.[mode].local"
26
- ];
27
-
28
6
  // cspell:ignore Motte, motdotla
29
7
 
30
8
  /*
@@ -62,6 +40,28 @@ const DEFAULT_TEMPLATE = [
62
40
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63
41
  */
64
42
 
43
+ "use strict";
44
+
45
+ const FileSystemInfo = require("./FileSystemInfo");
46
+ const DotenvFileError = require("./errors/DotenvFileError");
47
+ const { join } = require("./util/fs");
48
+
49
+ /** @import { DotenvPluginOptions } from "../declarations/WebpackOptions" */
50
+ /** @import Compiler from "./Compiler" */
51
+ /** @import { ItemCacheFacade } from "./CacheFacade" */
52
+ /** @import { InputFileSystem } from "./util/fs" */
53
+ /** @import { Snapshot } from "./FileSystemInfo" */
54
+
55
+ /** @typedef {Exclude<DotenvPluginOptions["prefix"], string | undefined>} Prefix */
56
+ /** @typedef {Record<string, string>} Env */
57
+
58
+ const DEFAULT_TEMPLATE = [
59
+ ".env",
60
+ ".env.local",
61
+ ".env.[mode]",
62
+ ".env.[mode].local"
63
+ ];
64
+
65
65
  // Regex for parsing .env files
66
66
  // ported from https://github.com/motdotla/dotenv/blob/v17.4.2/lib/main.js#L38
67
67
  const LINE =
@@ -223,12 +223,8 @@ function expand(options) {
223
223
  runningParsed[key] = resolvedValue;
224
224
  }
225
225
 
226
- // Part of `dotenv-expand` code, but we don't need it because of we don't modify `process.env`
227
- // for (const processKey in options.parsed) {
228
- // if (processEnv) {
229
- // processEnv[processKey] = options.parsed[processKey];
230
- // }
231
- // }
226
+ // `dotenv-expand` writes the parsed values back into `process.env` here.
227
+ // Omitted: webpack never mutates the ambient environment.
232
228
 
233
229
  return options;
234
230
  }
@@ -5,10 +5,39 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ const path = require("path");
9
+ const { fileUrlToPath } = require("./util/identifier");
10
+ const memoize = require("./util/memoize");
11
+
12
+ /** @import RequestShortener from "./RequestShortener" */
13
+
14
+ const getNonErrorEmittedError = memoize(() =>
15
+ require("./errors/NonErrorEmittedError")
16
+ );
17
+
8
18
  const loaderFlag = "LOADER_EXECUTION";
9
19
 
10
20
  const webpackOptionsFlag = "WEBPACK_OPTIONS";
11
21
 
22
+ // Every frame of a stack is indented, so a line opening with `at ` after
23
+ // whitespace is a frame rather than a part of the message itself.
24
+ const STACK_FRAME_REGEXP = /^\s+at\s/;
25
+
26
+ // `at name (file:line:column)`, and the `at file:line:column` a frame with no
27
+ // name is written as.
28
+ const STACK_FRAME_FILE_REGEXP = /^(\s+at\s(?:.*\()?)(.+?):(\d+):(\d+)(\)?)$/;
29
+
30
+ // A generated function nests its parentheses and carries a position of its
31
+ // own, so each `file:line:column` in it is read on its own.
32
+ const GENERATED_FRAME_REGEXP = /\beval at /;
33
+ const POSITION_REGEXP = /([^\s()]+):\d+:\d+/g;
34
+
35
+ const WEBPACK_SOURCE_PATH = path.join(__dirname, path.sep);
36
+
37
+ // The engine's own frames name no file of the project: `node:internal/…` under
38
+ // node and deno, the bare `native` under bun.
39
+ const ENGINE_FILE_REGEXP = /^(?:node:|native$)/;
40
+
12
41
  /**
13
42
  * Returns stack trace without the specified flag included.
14
43
  * @param {string} stack stack trace
@@ -74,6 +103,88 @@ const cutOffMessage = (stack, message) => {
74
103
  return firstLine === message ? stack.slice(nextLine + 1) : stack;
75
104
  };
76
105
 
106
+ /**
107
+ * Returns the file a stack frame names, or undefined when the line names none.
108
+ * @param {string} line line of a stack
109
+ * @returns {string | undefined} the file the frame names
110
+ */
111
+ const frameFile = (line) => {
112
+ const match = STACK_FRAME_FILE_REGEXP.exec(line);
113
+ return match === null ? undefined : fileUrlToPath(match[2]);
114
+ };
115
+
116
+ /**
117
+ * Returns the stack without the frames this file's own wrapping put on it.
118
+ * @param {string | undefined} stack stack trace
119
+ * @returns {string | undefined} stack trace starting at the caller
120
+ */
121
+ const cutOffWrappingFrames = (stack) => {
122
+ if (typeof stack !== "string") return stack;
123
+ const lines = stack.split("\n");
124
+ const index = lines.findIndex((line) => STACK_FRAME_REGEXP.test(line));
125
+ if (index === -1) return stack;
126
+ while (index < lines.length && frameFile(lines[index]) === __filename) {
127
+ lines.splice(index, 1);
128
+ }
129
+ return lines.join("\n");
130
+ };
131
+
132
+ /**
133
+ * Returns the value as an error, naming whatever a tap, a loader or a plugin
134
+ * failed with when that is not one. Everything reading a failure expects one.
135
+ * @param {EXPECTED_ANY} value value something failed with
136
+ * @returns {Error} the value, or an error naming it
137
+ */
138
+ const toError = (value) => {
139
+ if (value instanceof Error) return value;
140
+ const error = new (getNonErrorEmittedError())(value);
141
+ // The wrapping is not the site: the stack starts where the value was caught.
142
+ // Cut rather than `captureStackTrace`, which elides every frame under bun.
143
+ error.stack = cutOffWrappingFrames(error.stack);
144
+ return error;
145
+ };
146
+
147
+ /**
148
+ * Returns whether a rebuild of the same project names the same position in the
149
+ * file. Webpack's own sources move with a release, and the engine's with it.
150
+ * @param {string} file file a stack frame names
151
+ * @returns {boolean} whether the position is worth keeping
152
+ */
153
+ const isReproduciblePosition = (file) =>
154
+ !file.startsWith(WEBPACK_SOURCE_PATH) && !ENGINE_FILE_REGEXP.test(file);
155
+
156
+ /**
157
+ * Returns the message with every stack frame naming its file relative to the
158
+ * context, and a position only where {@link isReproduciblePosition} allows one.
159
+ * @param {string} message error message
160
+ * @param {RequestShortener} requestShortener request shortener
161
+ * @returns {string} message whose frames a second build writes the same way
162
+ */
163
+ const contextifyStackFrames = (message, requestShortener) =>
164
+ message
165
+ .split("\n")
166
+ .map((line) => {
167
+ if (!STACK_FRAME_REGEXP.test(line)) return line;
168
+ if (GENERATED_FRAME_REGEXP.test(line)) {
169
+ return line.replace(
170
+ POSITION_REGEXP,
171
+ (position, file) =>
172
+ /** @type {string} */
173
+ (requestShortener.shorten(fileUrlToPath(file)))
174
+ );
175
+ }
176
+ const match = STACK_FRAME_FILE_REGEXP.exec(line);
177
+ if (match === null) return line;
178
+ const [, frame, url, lineNumber, column, end] = match;
179
+ // An engine may name the file as a URL rather than as a path.
180
+ const file = fileUrlToPath(url);
181
+ const position = isReproduciblePosition(file)
182
+ ? `:${lineNumber}:${column}`
183
+ : "";
184
+ return `${frame}${requestShortener.shorten(file)}${position}${end}`;
185
+ })
186
+ .join("\n");
187
+
77
188
  /**
78
189
  * Returns stack trace without the loader execution flag and message included.
79
190
  * @param {string} stack stack trace
@@ -100,8 +211,10 @@ const cleanUpWebpackOptions = (stack, message) => {
100
211
 
101
212
  module.exports.cleanUp = cleanUp;
102
213
  module.exports.cleanUpWebpackOptions = cleanUpWebpackOptions;
214
+ module.exports.contextifyStackFrames = contextifyStackFrames;
103
215
  module.exports.cutOffByFlag = cutOffByFlag;
104
216
  module.exports.cutOffLoaderExecution = cutOffLoaderExecution;
105
217
  module.exports.cutOffMessage = cutOffMessage;
106
218
  module.exports.cutOffMultilineMessage = cutOffMultilineMessage;
107
219
  module.exports.cutOffWebpackOptions = cutOffWebpackOptions;
220
+ module.exports.toError = toError;
@@ -151,20 +151,20 @@ class ExportsInfo {
151
151
  /** @type {Exports} */
152
152
  this._exports = new Map();
153
153
 
154
- // `_otherExportsInfo` is a fallback entry for unlisted exports. Two roles:
155
- // 1. factory template — `getExportInfo` creates `new ExportInfo(name, this)`,
156
- // so created export info extends its properties.
157
- // 2. flags whether the whole exportsInfo can be statically analyzed.
158
- // Its `used` reachable values:
159
- // - NoInfo: no use analysis yet (`optimization#usedExports` off), or used without info
160
- // - Unused: analyzed, no unlisted export needed
161
- // - Unknown: used in unknown way
162
- // - Used/OnlyPropertiesUsed: never reached
163
- // Its `provided` reachable values:
164
- // - undefined: provision not determined yet
165
- // - false: determined, no unlisted export is provided
166
- // - null: only runtime knows (dynamic/unknown exports)
167
- // - true: never reached
154
+ // WHY: a fallback entry for the unlisted exports, in two roles — the factory
155
+ // template `getExportInfo` extends with `new ExportInfo(name, this)`, and the
156
+ // flag for whether this exportsInfo can be statically analyzed at all.
157
+ // Its reachable `used` values:
158
+ // - NoInfo: no use analysis yet (`optimization#usedExports` off), or used
159
+ // without info
160
+ // - Unused: analyzed, no unlisted export needed
161
+ // - Unknown: used in an unknown way
162
+ // - Used/OnlyPropertiesUsed: never reached
163
+ // Its reachable `provided` values:
164
+ // - undefined: provision not determined yet
165
+ // - false: determined, no unlisted export is provided
166
+ // - null: only runtime knows (dynamic or unknown exports)
167
+ // - true: never reached
168
168
  /** @type {ExportInfo} */
169
169
  this._otherExportsInfo = new ExportInfo(null);
170
170
  /** @type {ExportInfo} */
@@ -1671,7 +1671,9 @@ class ExportInfo {
1671
1671
  }
1672
1672
 
1673
1673
  /**
1674
- * Returns the target, undefined when there is no target, false when no target is valid.
1674
+ * Walks the reexport chain and returns the first target whose module passes
1675
+ * `validTargetModuleFilter`. Returns undefined when there is no target, false
1676
+ * when the chain ends without a valid module.
1675
1677
  * @param {ModuleGraph} moduleGraph the module graph
1676
1678
  * @param {ValidTargetModuleFilter} validTargetModuleFilter a valid target module
1677
1679
  * @returns {TargetItemWithoutConnection | null | undefined | false} the target, undefined when there is no target, false when no target is valid
@@ -1736,7 +1738,9 @@ class ExportInfo {
1736
1738
  }
1737
1739
 
1738
1740
  /**
1739
- * Returns the target.
1741
+ * Resolves the reexport chain as far as `resolveTargetFilter` allows and
1742
+ * returns where it ends. Returns undefined when there is no target, the
1743
+ * targets disagree, or the chain is circular.
1740
1744
  * @param {ModuleGraph} moduleGraph the module graph
1741
1745
  * @param {ResolveTargetFilter} resolveTargetFilter filter function to further resolve target
1742
1746
  * @returns {TargetItemWithConnection | undefined} the target
@@ -29,6 +29,7 @@ const { coreModules } = require("./node/nodeBuiltins");
29
29
  const createHash = require("./util/createHash");
30
30
  const createHooksRegistry = require("./util/createHooksRegistry");
31
31
  const extractUrlAndGlobal = require("./util/extractUrlAndGlobal");
32
+ const { toJsStringLiteral } = require("./util/identifier");
32
33
  const makeSerializable = require("./util/makeSerializable");
33
34
  const memoize = require("./util/memoize");
34
35
  const { propertyAccess } = require("./util/property");
@@ -110,6 +111,7 @@ const getEnvironmentNotSupportAsyncWarning = memoize(() =>
110
111
  * @property {InitFragment<ChunkRenderContext>[]=} chunkInitFragments
111
112
  * @property {ReadOnlyRuntimeRequirements=} runtimeRequirements
112
113
  * @property {[string, string][]=} specifiers
114
+ * @property {string=} externalReexport native reexport source and attributes
113
115
  */
114
116
 
115
117
  /** @typedef {true | [string, string][]} Imported */
@@ -346,10 +348,9 @@ const getSourceForImportExternal = (
346
348
  }
347
349
  const phase = dependencyMeta && dependencyMeta.phase;
348
350
  checkPhaseIsSupported(phase, runtimeTemplate);
349
- // `import.defer(…)` and `import.source(…)` are only valid forms of the
350
- // native `import(…)` function, so we only emit the phase suffix when the
351
- // importFunctionName is the default `"import"`. Anything else has no phase
352
- // form at all, and dropping it would silently import eagerly instead.
351
+ // `import.defer(…)` and `import.source(…)` are forms of the native `import(…)`
352
+ // alone, so the phase suffix is emitted only for the default name. Anything
353
+ // else has no phase form, and dropping it would import eagerly instead.
353
354
  if (
354
355
  baseImportName !== "import" &&
355
356
  (ImportPhaseUtils.isDefer(phase) || ImportPhaseUtils.isSource(phase))
@@ -417,6 +418,18 @@ const importAssertionReplacer = (key, value) => {
417
418
  return value;
418
419
  };
419
420
 
421
+ /**
422
+ * Renders the import attributes clause of a static import or reexport.
423
+ * @param {ImportDependencyMeta | undefined} dependencyMeta import metadata
424
+ * @returns {string} static import attributes
425
+ */
426
+ const getImportAttributes = (dependencyMeta) =>
427
+ dependencyMeta && dependencyMeta.attributes
428
+ ? dependencyMeta.attributes._isLegacyAssert
429
+ ? ` assert ${JSON.stringify(dependencyMeta.attributes, importAssertionReplacer)}`
430
+ : ` with ${JSON.stringify(dependencyMeta.attributes)}`
431
+ : "";
432
+
420
433
  /**
421
434
  * Represents ModuleExternalInitFragment.
422
435
  * @extends {InitFragment<GenerateContext>}
@@ -503,33 +516,25 @@ class ModuleExternalInitFragment extends InitFragment {
503
516
  _request: request,
504
517
  _identifier: identifier
505
518
  } = this;
506
- const attributes =
507
- dependencyMeta && dependencyMeta.attributes
508
- ? dependencyMeta.attributes._isLegacyAssert
509
- ? ` assert ${JSON.stringify(
510
- dependencyMeta.attributes,
511
- importAssertionReplacer
512
- )}`
513
- : ` with ${JSON.stringify(dependencyMeta.attributes)}`
514
- : "";
519
+ const attributes = getImportAttributes(dependencyMeta);
515
520
  const phase = dependencyMeta && dependencyMeta.phase;
516
521
  checkPhaseIsSupported(phase, context.runtimeTemplate);
517
522
  let content = "";
518
523
  if (ImportPhaseUtils.isSource(phase) && imported === true) {
519
524
  // There is no `import source * as ns` form: the source phase binds one
520
525
  // identifier, so it stands in for the namespace the other branches build.
521
- content = `import source ${identifier} from ${JSON.stringify(
526
+ content = `import source ${identifier} from ${toJsStringLiteral(
522
527
  request
523
528
  )}${attributes};\n`;
524
529
  } else if (imported === true) {
525
530
  // namespace
526
531
  const phaseKeyword = ImportPhaseUtils.isDefer(phase) ? "defer " : "";
527
- content = `import ${phaseKeyword}* as ${identifier} from ${JSON.stringify(
532
+ content = `import ${phaseKeyword}* as ${identifier} from ${toJsStringLiteral(
528
533
  request
529
534
  )}${attributes};\n`;
530
535
  } else if (imported.length === 0) {
531
536
  // just import, no use
532
- content = `import ${JSON.stringify(request)}${attributes};\n`;
537
+ content = `import ${toJsStringLiteral(request)}${attributes};\n`;
533
538
  } else if (
534
539
  ImportPhaseUtils.isSource(phase) &&
535
540
  imported.length === 1 &&
@@ -537,7 +542,7 @@ class ModuleExternalInitFragment extends InitFragment {
537
542
  ) {
538
543
  // `import source x from "…"` — the source-phase form binds the source
539
544
  // object directly to a single identifier (no namespace, no destructuring).
540
- content = `import source ${imported[0][1]} from ${JSON.stringify(
545
+ content = `import source ${imported[0][1]} from ${toJsStringLiteral(
541
546
  request
542
547
  )}${attributes};\n`;
543
548
  } else {
@@ -548,7 +553,7 @@ class ModuleExternalInitFragment extends InitFragment {
548
553
  }
549
554
  return name;
550
555
  })
551
- .join(", ")} } from ${JSON.stringify(request)}${attributes};\n`;
556
+ .join(", ")} } from ${toJsStringLiteral(request)}${attributes};\n`;
552
557
  }
553
558
  return content;
554
559
  }
@@ -689,10 +694,9 @@ const getSourceForModuleExternal = (
689
694
  imported = true;
690
695
  }
691
696
 
692
- // `import defer …` is only valid as `import defer * as ns from "…"`, so
693
- // keep the namespace form even if usage analysis would otherwise narrow
694
- // the import down to specific names. Defer + concatenation is semantically
695
- // at odds (lazy vs. eager), so we preserve the user-written shape here.
697
+ // `import defer` is valid only as `import defer * as ns from "…"`, so the
698
+ // namespace form is kept even where usage analysis would narrow it: defer and
699
+ // concatenation are at odds, lazy against eager.
696
700
  if (ImportPhaseUtils.isDefer(phase)) {
697
701
  imported = true;
698
702
  }
@@ -738,6 +742,12 @@ const getSourceForModuleExternal = (
738
742
  }
739
743
  return {
740
744
  expression,
745
+ externalReexport:
746
+ moduleAndSpecifiers.length === 1 &&
747
+ !ImportPhaseUtils.isDefer(phase) &&
748
+ !ImportPhaseUtils.isSource(phase)
749
+ ? `from ${toJsStringLiteral(moduleAndSpecifiers[0])}${getImportAttributes(dependencyMeta)}`
750
+ : undefined,
741
751
  init: moduleRemapping
742
752
  ? `${runtimeTemplate.renderConst()} x = ${runtimeTemplate.basicFunction(
743
753
  "y",
@@ -1238,6 +1248,17 @@ class ExternalModule extends Module {
1238
1248
  return this._resolveExternalType(this.externalType) !== "module";
1239
1249
  }
1240
1250
 
1251
+ /**
1252
+ * The request this external resolves to for its own type, with the record form
1253
+ * narrowed to its entry. An array is a module specifier plus a property path.
1254
+ * @returns {string | string[] | undefined} the resolved request
1255
+ */
1256
+ getResolvedRequest() {
1257
+ return /** @type {string | string[] | undefined} */ (
1258
+ this._getRequestAndExternalType().request
1259
+ );
1260
+ }
1261
+
1241
1262
  /**
1242
1263
  * Get request and external type.
1243
1264
  * @private
@@ -1535,6 +1556,10 @@ class ExternalModule extends Module {
1535
1556
  data = new Map();
1536
1557
  data.set("chunkInitFragments", sourceData.chunkInitFragments);
1537
1558
  }
1559
+ if (sourceData.externalReexport) {
1560
+ if (!data) data = new Map();
1561
+ data.set("externalReexport", sourceData.externalReexport);
1562
+ }
1538
1563
 
1539
1564
  /** @type {Sources} */
1540
1565
  const sources = new Map();
@@ -8,11 +8,11 @@
8
8
  const nodeModule = require("module");
9
9
  const { isAbsolute } = require("path");
10
10
  const { create: createResolver } = require("enhanced-resolve");
11
- const asyncLib = require("neo-async");
12
11
  const { DEFAULTS } = require("./config/defaults");
13
12
  const { collectCjsRequireSpecifiers } = require("./javascript/syntax");
14
13
  const AsyncQueue = require("./util/AsyncQueue");
15
14
  const StackedCacheMap = require("./util/StackedCacheMap");
15
+ const asyncLib = require("./util/async");
16
16
  const createHash = require("./util/createHash");
17
17
  const { dirname, join, lstatReadlinkAbsolute, relative } = require("./util/fs");
18
18
  const makeSerializable = require("./util/makeSerializable");
@@ -1884,10 +1884,13 @@ class FileSystemInfo {
1884
1884
  * Resolves build dependencies.
1885
1885
  * @param {string} context context directory
1886
1886
  * @param {Iterable<string>} deps dependencies
1887
+ * @param {Iterable<string> | undefined} optionalDeps optional dependencies that may be missing
1887
1888
  * @param {(err?: Error | null, resolveBuildDependenciesResult?: ResolveBuildDependenciesResult) => void} callback callback function
1888
1889
  * @returns {void}
1889
1890
  */
1890
- resolveBuildDependencies(context, deps, callback) {
1891
+ resolveBuildDependencies(context, deps, optionalDeps, callback) {
1892
+ /** @type {Set<string>} */
1893
+ const optional = new Set(optionalDeps);
1891
1894
  const { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild } =
1892
1895
  this._createBuildDependenciesResolvers();
1893
1896
 
@@ -1979,7 +1982,7 @@ class FileSystemInfo {
1979
1982
  type: RBDT_RESOLVE_INITIAL,
1980
1983
  context,
1981
1984
  path: dep,
1982
- expected: undefined,
1985
+ expected: optional.has(dep) ? false : undefined,
1983
1986
  issuer: undefined
1984
1987
  })
1985
1988
  ),
@@ -2005,6 +2008,7 @@ class FileSystemInfo {
2005
2008
  if (err) {
2006
2009
  if (expected === false) {
2007
2010
  resolveResults.set(key, false);
2011
+ resolveMissing.add(path);
2008
2012
  return callback();
2009
2013
  }
2010
2014
  invalidResolveResults.add(key);
@@ -2060,6 +2064,7 @@ class FileSystemInfo {
2060
2064
  if (err) {
2061
2065
  if (expected === false) {
2062
2066
  resolveResults.set(key, false);
2067
+ resolveMissing.add(path);
2063
2068
  return callback();
2064
2069
  }
2065
2070
  invalidResolveResults.add(key);
@@ -2514,20 +2519,18 @@ class FileSystemInfo {
2514
2519
  },
2515
2520
  /**
2516
2521
  * Processes the provided err.
2517
- * @param {Error | typeof INVALID=} err error or invalid flag
2522
+ * @param {(Error | typeof INVALID | null)=} err error or invalid flag
2518
2523
  * @returns {void}
2519
2524
  */
2520
- /** @type {import("neo-async").ErrorCallback<Error | typeof INVALID>} */ (
2521
- (err) => {
2522
- if (err === INVALID) {
2523
- return callback(null, false);
2524
- }
2525
- if (err) {
2526
- return callback(err);
2527
- }
2528
- return callback(null, true);
2525
+ (err) => {
2526
+ if (err === INVALID) {
2527
+ return callback(null, false);
2529
2528
  }
2530
- )
2529
+ if (err) {
2530
+ return callback(err);
2531
+ }
2532
+ return callback(null, true);
2533
+ }
2531
2534
  );
2532
2535
  }
2533
2536