@rspack-debug/core 1.3.14

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 (392) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +15 -0
  3. package/compiled/@swc/types/index.d.ts +2109 -0
  4. package/compiled/@swc/types/index.js +19 -0
  5. package/compiled/@swc/types/license +201 -0
  6. package/compiled/@swc/types/package.json +1 -0
  7. package/compiled/browserslist-load-config/index.d.ts +10 -0
  8. package/compiled/browserslist-load-config/index.js +266 -0
  9. package/compiled/browserslist-load-config/license +21 -0
  10. package/compiled/browserslist-load-config/package.json +1 -0
  11. package/compiled/enhanced-resolve/CachedInputFileSystem.d.ts +0 -0
  12. package/compiled/enhanced-resolve/CachedInputFileSystem.js +664 -0
  13. package/compiled/enhanced-resolve/index.d.ts +1124 -0
  14. package/compiled/enhanced-resolve/license +20 -0
  15. package/compiled/enhanced-resolve/package.json +1 -0
  16. package/compiled/graceful-fs/index.d.ts +13 -0
  17. package/compiled/graceful-fs/index.js +1063 -0
  18. package/compiled/graceful-fs/license +15 -0
  19. package/compiled/graceful-fs/package.json +1 -0
  20. package/compiled/tinypool/LICENSE +24 -0
  21. package/compiled/tinypool/README.md +212 -0
  22. package/compiled/tinypool/dist/chunk-6LX4VMOV.js +31 -0
  23. package/compiled/tinypool/dist/chunk-ACQHDOFQ.js +12 -0
  24. package/compiled/tinypool/dist/chunk-E2J7JLFN.js +53 -0
  25. package/compiled/tinypool/dist/chunk-UBWFVGJX.js +38 -0
  26. package/compiled/tinypool/dist/entry/process.d.ts +2 -0
  27. package/compiled/tinypool/dist/entry/process.js +92 -0
  28. package/compiled/tinypool/dist/entry/utils.d.ts +5 -0
  29. package/compiled/tinypool/dist/entry/utils.js +9 -0
  30. package/compiled/tinypool/dist/entry/worker.d.ts +2 -0
  31. package/compiled/tinypool/dist/entry/worker.js +103 -0
  32. package/compiled/tinypool/dist/index.d.ts +188 -0
  33. package/compiled/tinypool/dist/index.js +1080 -0
  34. package/compiled/tinypool/package.json +55 -0
  35. package/compiled/watchpack/index.d.ts +216 -0
  36. package/compiled/watchpack/index.js +2127 -0
  37. package/compiled/watchpack/license +20 -0
  38. package/compiled/watchpack/package.json +1 -0
  39. package/compiled/webpack-sources/index.js +4720 -0
  40. package/compiled/webpack-sources/license +21 -0
  41. package/compiled/webpack-sources/package.json +1 -0
  42. package/compiled/webpack-sources/types.d.ts +320 -0
  43. package/compiled/zod/dist/types/index.d.ts +3 -0
  44. package/compiled/zod/dist/types/v3/ZodError.d.ts +164 -0
  45. package/compiled/zod/dist/types/v3/benchmarks/datetime.d.ts +5 -0
  46. package/compiled/zod/dist/types/v3/benchmarks/discriminatedUnion.d.ts +5 -0
  47. package/compiled/zod/dist/types/v3/benchmarks/index.d.ts +1 -0
  48. package/compiled/zod/dist/types/v3/benchmarks/ipv4.d.ts +5 -0
  49. package/compiled/zod/dist/types/v3/benchmarks/object.d.ts +5 -0
  50. package/compiled/zod/dist/types/v3/benchmarks/primitives.d.ts +5 -0
  51. package/compiled/zod/dist/types/v3/benchmarks/realworld.d.ts +5 -0
  52. package/compiled/zod/dist/types/v3/benchmarks/string.d.ts +5 -0
  53. package/compiled/zod/dist/types/v3/benchmarks/union.d.ts +5 -0
  54. package/compiled/zod/dist/types/v3/errors.d.ts +5 -0
  55. package/compiled/zod/dist/types/v3/external.d.ts +6 -0
  56. package/compiled/zod/dist/types/v3/helpers/enumUtil.d.ts +8 -0
  57. package/compiled/zod/dist/types/v3/helpers/errorUtil.d.ts +9 -0
  58. package/compiled/zod/dist/types/v3/helpers/parseUtil.d.ts +78 -0
  59. package/compiled/zod/dist/types/v3/helpers/partialUtil.d.ts +8 -0
  60. package/compiled/zod/dist/types/v3/helpers/typeAliases.d.ts +2 -0
  61. package/compiled/zod/dist/types/v3/helpers/util.d.ts +85 -0
  62. package/compiled/zod/dist/types/v3/index.d.ts +4 -0
  63. package/compiled/zod/dist/types/v3/locales/en.d.ts +3 -0
  64. package/compiled/zod/dist/types/v3/standard-schema.d.ts +102 -0
  65. package/compiled/zod/dist/types/v3/tests/Mocker.d.ts +17 -0
  66. package/compiled/zod/dist/types/v3/types.d.ts +1031 -0
  67. package/compiled/zod/dist/types/v4/classic/checks.d.ts +1 -0
  68. package/compiled/zod/dist/types/v4/classic/coerce.d.ts +17 -0
  69. package/compiled/zod/dist/types/v4/classic/compat.d.ts +48 -0
  70. package/compiled/zod/dist/types/v4/classic/errors.d.ts +30 -0
  71. package/compiled/zod/dist/types/v4/classic/external.d.ts +13 -0
  72. package/compiled/zod/dist/types/v4/classic/index.d.ts +4 -0
  73. package/compiled/zod/dist/types/v4/classic/iso.d.ts +22 -0
  74. package/compiled/zod/dist/types/v4/classic/parse.d.ts +23 -0
  75. package/compiled/zod/dist/types/v4/classic/schemas.d.ts +619 -0
  76. package/compiled/zod/dist/types/v4/core/api.d.ts +273 -0
  77. package/compiled/zod/dist/types/v4/core/checks.d.ts +277 -0
  78. package/compiled/zod/dist/types/v4/core/config.d.ts +9 -0
  79. package/compiled/zod/dist/types/v4/core/core.d.ts +47 -0
  80. package/compiled/zod/dist/types/v4/core/doc.d.ts +14 -0
  81. package/compiled/zod/dist/types/v4/core/errors.d.ts +204 -0
  82. package/compiled/zod/dist/types/v4/core/function.d.ts +52 -0
  83. package/compiled/zod/dist/types/v4/core/index.d.ts +15 -0
  84. package/compiled/zod/dist/types/v4/core/json-schema.d.ts +100 -0
  85. package/compiled/zod/dist/types/v4/core/parse.d.ts +25 -0
  86. package/compiled/zod/dist/types/v4/core/regexes.d.ts +62 -0
  87. package/compiled/zod/dist/types/v4/core/registries.d.ts +37 -0
  88. package/compiled/zod/dist/types/v4/core/schemas.d.ts +1011 -0
  89. package/compiled/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
  90. package/compiled/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
  91. package/compiled/zod/dist/types/v4/core/util.d.ts +182 -0
  92. package/compiled/zod/dist/types/v4/core/versions.d.ts +5 -0
  93. package/compiled/zod/dist/types/v4/core/zsf.d.ts +91 -0
  94. package/compiled/zod/dist/types/v4/index.d.ts +3 -0
  95. package/compiled/zod/dist/types/v4/locales/ar.d.ts +4 -0
  96. package/compiled/zod/dist/types/v4/locales/az.d.ts +4 -0
  97. package/compiled/zod/dist/types/v4/locales/be.d.ts +4 -0
  98. package/compiled/zod/dist/types/v4/locales/ca.d.ts +4 -0
  99. package/compiled/zod/dist/types/v4/locales/cs.d.ts +4 -0
  100. package/compiled/zod/dist/types/v4/locales/de.d.ts +4 -0
  101. package/compiled/zod/dist/types/v4/locales/en.d.ts +5 -0
  102. package/compiled/zod/dist/types/v4/locales/es.d.ts +4 -0
  103. package/compiled/zod/dist/types/v4/locales/fa.d.ts +4 -0
  104. package/compiled/zod/dist/types/v4/locales/fi.d.ts +4 -0
  105. package/compiled/zod/dist/types/v4/locales/fr-CA.d.ts +4 -0
  106. package/compiled/zod/dist/types/v4/locales/fr.d.ts +4 -0
  107. package/compiled/zod/dist/types/v4/locales/he.d.ts +4 -0
  108. package/compiled/zod/dist/types/v4/locales/hu.d.ts +4 -0
  109. package/compiled/zod/dist/types/v4/locales/id.d.ts +4 -0
  110. package/compiled/zod/dist/types/v4/locales/index.d.ts +37 -0
  111. package/compiled/zod/dist/types/v4/locales/it.d.ts +4 -0
  112. package/compiled/zod/dist/types/v4/locales/ja.d.ts +4 -0
  113. package/compiled/zod/dist/types/v4/locales/kh.d.ts +4 -0
  114. package/compiled/zod/dist/types/v4/locales/ko.d.ts +4 -0
  115. package/compiled/zod/dist/types/v4/locales/mk.d.ts +4 -0
  116. package/compiled/zod/dist/types/v4/locales/ms.d.ts +4 -0
  117. package/compiled/zod/dist/types/v4/locales/nl.d.ts +4 -0
  118. package/compiled/zod/dist/types/v4/locales/no.d.ts +4 -0
  119. package/compiled/zod/dist/types/v4/locales/ota.d.ts +4 -0
  120. package/compiled/zod/dist/types/v4/locales/pl.d.ts +4 -0
  121. package/compiled/zod/dist/types/v4/locales/pt.d.ts +4 -0
  122. package/compiled/zod/dist/types/v4/locales/ru.d.ts +4 -0
  123. package/compiled/zod/dist/types/v4/locales/sl.d.ts +4 -0
  124. package/compiled/zod/dist/types/v4/locales/sv.d.ts +4 -0
  125. package/compiled/zod/dist/types/v4/locales/ta.d.ts +4 -0
  126. package/compiled/zod/dist/types/v4/locales/th.d.ts +4 -0
  127. package/compiled/zod/dist/types/v4/locales/tr.d.ts +5 -0
  128. package/compiled/zod/dist/types/v4/locales/ua.d.ts +4 -0
  129. package/compiled/zod/dist/types/v4/locales/ur.d.ts +4 -0
  130. package/compiled/zod/dist/types/v4/locales/vi.d.ts +4 -0
  131. package/compiled/zod/dist/types/v4/locales/zh-CN.d.ts +4 -0
  132. package/compiled/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
  133. package/compiled/zod/dist/types/v4/mini/checks.d.ts +1 -0
  134. package/compiled/zod/dist/types/v4/mini/coerce.d.ts +7 -0
  135. package/compiled/zod/dist/types/v4/mini/external.d.ts +11 -0
  136. package/compiled/zod/dist/types/v4/mini/index.d.ts +3 -0
  137. package/compiled/zod/dist/types/v4/mini/iso.d.ts +22 -0
  138. package/compiled/zod/dist/types/v4/mini/parse.d.ts +1 -0
  139. package/compiled/zod/dist/types/v4/mini/schemas.d.ts +398 -0
  140. package/compiled/zod/index.js +4513 -0
  141. package/compiled/zod/license +21 -0
  142. package/compiled/zod/package.json +1 -0
  143. package/compiled/zod/v3/index.d.ts +3 -0
  144. package/compiled/zod/v4/core/index.d.ts +1 -0
  145. package/compiled/zod/v4/index.d.ts +3 -0
  146. package/compiled/zod/v4/locales/en.d.ts +2 -0
  147. package/compiled/zod/v4/locales/index.d.ts +1 -0
  148. package/compiled/zod/v4-mini/index.d.ts +1 -0
  149. package/dist/Chunk.d.ts +35 -0
  150. package/dist/ChunkGraph.d.ts +23 -0
  151. package/dist/ChunkGroup.d.ts +33 -0
  152. package/dist/Chunks.d.ts +13 -0
  153. package/dist/CodeGenerationResults.d.ts +1 -0
  154. package/dist/Compilation.d.ts +411 -0
  155. package/dist/Compiler.d.ts +192 -0
  156. package/dist/ConcatenatedModule.d.ts +1 -0
  157. package/dist/ContextModule.d.ts +1 -0
  158. package/dist/ContextModuleFactory.d.ts +13 -0
  159. package/dist/Diagnostics.d.ts +7 -0
  160. package/dist/Entrypoint.d.ts +10 -0
  161. package/dist/ErrorHelpers.d.ts +1 -0
  162. package/dist/ExecuteModulePlugin.d.ts +4 -0
  163. package/dist/ExportsInfo.d.ts +20 -0
  164. package/dist/ExternalModule.d.ts +1 -0
  165. package/dist/FileSystem.d.ts +29 -0
  166. package/dist/FileSystemInfo.d.ts +5 -0
  167. package/dist/Module.d.ts +66 -0
  168. package/dist/ModuleGraph.d.ts +19 -0
  169. package/dist/ModuleTypeConstants.d.ts +8 -0
  170. package/dist/MultiCompiler.d.ts +75 -0
  171. package/dist/MultiStats.d.ts +22 -0
  172. package/dist/MultiWatching.d.ts +26 -0
  173. package/dist/NormalModule.d.ts +15 -0
  174. package/dist/NormalModuleFactory.d.ts +23 -0
  175. package/dist/Resolver.d.ts +18 -0
  176. package/dist/ResolverFactory.d.ts +14 -0
  177. package/dist/RspackError.d.ts +9 -0
  178. package/dist/RuleSetCompiler.d.ts +9 -0
  179. package/dist/RuntimeGlobals.d.ts +325 -0
  180. package/dist/RuntimeModule.d.ts +32 -0
  181. package/dist/Stats.d.ts +17 -0
  182. package/dist/Template.d.ts +77 -0
  183. package/dist/Watching.d.ts +38 -0
  184. package/dist/builtin-loader/index.d.ts +1 -0
  185. package/dist/builtin-loader/lightningcss/index.d.ts +117 -0
  186. package/dist/builtin-loader/swc/index.d.ts +3 -0
  187. package/dist/builtin-loader/swc/pluginImport.d.ts +68 -0
  188. package/dist/builtin-loader/swc/types.d.ts +2315 -0
  189. package/dist/builtin-plugin/APIPlugin.d.ts +10 -0
  190. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +10 -0
  191. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +10 -0
  192. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +10 -0
  193. package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
  194. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +15 -0
  195. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +10 -0
  196. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +59 -0
  197. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +10 -0
  198. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +10 -0
  199. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
  200. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +19 -0
  201. package/dist/builtin-plugin/CssModulesPlugin.d.ts +10 -0
  202. package/dist/builtin-plugin/DataUriPlugin.d.ts +10 -0
  203. package/dist/builtin-plugin/DefinePlugin.d.ts +17 -0
  204. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +8 -0
  205. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +8 -0
  206. package/dist/builtin-plugin/DllEntryPlugin.d.ts +13 -0
  207. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
  208. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
  209. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +10 -0
  210. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +26 -0
  211. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
  212. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +10 -0
  213. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +10 -0
  214. package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
  215. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
  216. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
  217. package/dist/builtin-plugin/ExternalsPlugin.d.ts +10 -0
  218. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +10 -0
  219. package/dist/builtin-plugin/FileUriPlugin.d.ts +10 -0
  220. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +10 -0
  221. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +10 -0
  222. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -0
  223. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
  224. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +10 -0
  225. package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
  226. package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
  227. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +10 -0
  228. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
  229. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +11 -0
  230. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +10 -0
  231. package/dist/builtin-plugin/LibManifestPlugin.d.ts +18 -0
  232. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +33 -0
  233. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +15 -0
  234. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -0
  235. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +10 -0
  236. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +10 -0
  237. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -0
  238. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +10 -0
  239. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +10 -0
  240. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +10 -0
  241. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +8 -0
  242. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +8 -0
  243. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +10 -0
  244. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +10 -0
  245. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
  246. package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
  247. package/dist/builtin-plugin/ProvidePlugin.d.ts +11 -0
  248. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +10 -0
  249. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
  250. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +10 -0
  251. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +45 -0
  252. package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
  253. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
  254. package/dist/builtin-plugin/RuntimePlugin.d.ts +28 -0
  255. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +10 -0
  256. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +20 -0
  257. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
  258. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
  259. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +40 -0
  260. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +213 -0
  261. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +10 -0
  262. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
  263. package/dist/builtin-plugin/WorkerPlugin.d.ts +13 -0
  264. package/dist/builtin-plugin/base.d.ts +21 -0
  265. package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
  266. package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
  267. package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
  268. package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
  269. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
  270. package/dist/builtin-plugin/html-plugin/options.d.ts +83 -0
  271. package/dist/builtin-plugin/html-plugin/plugin.d.ts +24 -0
  272. package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
  273. package/dist/builtin-plugin/index.d.ts +79 -0
  274. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +25 -0
  275. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +4 -0
  276. package/dist/config/adapter.d.ts +8 -0
  277. package/dist/config/adapterRuleUse.d.ts +333 -0
  278. package/dist/config/browserslistTargetHandler.d.ts +15 -0
  279. package/dist/config/defaults.d.ts +13 -0
  280. package/dist/config/devServer.d.ts +207 -0
  281. package/dist/config/index.d.ts +4 -0
  282. package/dist/config/normalization.d.ts +148 -0
  283. package/dist/config/target.d.ts +89 -0
  284. package/dist/config/types.d.ts +2228 -0
  285. package/dist/config/utils.d.ts +16 -0
  286. package/dist/config/zod.d.ts +4228 -0
  287. package/dist/container/ContainerPlugin.d.ts +40 -0
  288. package/dist/container/ContainerReferencePlugin.d.ts +33 -0
  289. package/dist/container/ModuleFederationPlugin.d.ts +13 -0
  290. package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
  291. package/dist/container/ModuleFederationRuntimePlugin.d.ts +10 -0
  292. package/dist/container/options.d.ts +3 -0
  293. package/dist/cssExtractHmr.js +125 -0
  294. package/dist/cssExtractLoader.js +161 -0
  295. package/dist/error/ConcurrentCompilationError.d.ts +14 -0
  296. package/dist/exports.d.ts +191 -0
  297. package/dist/index.d.ts +10 -0
  298. package/dist/index.js +13559 -0
  299. package/dist/lib/AbstractMethodError.d.ts +23 -0
  300. package/dist/lib/Cache.d.ts +65 -0
  301. package/dist/lib/CacheFacade.d.ts +139 -0
  302. package/dist/lib/DllPlugin.d.ts +42 -0
  303. package/dist/lib/DllReferencePlugin.d.ts +119 -0
  304. package/dist/lib/EntryOptionPlugin.d.ts +33 -0
  305. package/dist/lib/EnvironmentPlugin.d.ts +22 -0
  306. package/dist/lib/HookWebpackError.d.ts +40 -0
  307. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  308. package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
  309. package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
  310. package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
  311. package/dist/lib/NormalModuleReplacementPlugin.d.ts +29 -0
  312. package/dist/lib/WebpackError.d.ts +23 -0
  313. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  314. package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
  315. package/dist/lib/cache/mergeEtags.d.ts +17 -0
  316. package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
  317. package/dist/loader-runner/index.d.ts +43 -0
  318. package/dist/loader-runner/loadLoader.d.ts +11 -0
  319. package/dist/loader-runner/service.d.ts +71 -0
  320. package/dist/loader-runner/utils.d.ts +6 -0
  321. package/dist/loader-runner/worker.d.ts +14 -0
  322. package/dist/logging/Logger.d.ts +61 -0
  323. package/dist/logging/createConsoleLogger.d.ts +35 -0
  324. package/dist/logging/truncateArgs.d.ts +16 -0
  325. package/dist/moduleFederationDefaultRuntime.js +1 -0
  326. package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
  327. package/dist/node/NodeTemplatePlugin.d.ts +18 -0
  328. package/dist/node/NodeWatchFileSystem.d.ts +18 -0
  329. package/dist/node/nodeConsole.d.ts +15 -0
  330. package/dist/rspack.d.ts +16 -0
  331. package/dist/rspackOptionsApply.d.ts +4 -0
  332. package/dist/runtime/cssExtractHmr.d.ts +4 -0
  333. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  334. package/dist/sharing/ConsumeSharedPlugin.d.ts +41 -0
  335. package/dist/sharing/ProvideSharedPlugin.d.ts +34 -0
  336. package/dist/sharing/SharePlugin.d.ts +51 -0
  337. package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
  338. package/dist/sharing/utils.d.ts +1 -0
  339. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +4 -0
  340. package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
  341. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
  342. package/dist/stats/StatsFactory.d.ts +57 -0
  343. package/dist/stats/StatsPrinter.d.ts +57 -0
  344. package/dist/stats/statsFactoryUtils.d.ts +325 -0
  345. package/dist/swc.d.ts +5 -0
  346. package/dist/taps/compilation.d.ts +8 -0
  347. package/dist/taps/compiler.d.ts +2 -0
  348. package/dist/taps/contextModuleFactory.d.ts +2 -0
  349. package/dist/taps/index.d.ts +6 -0
  350. package/dist/taps/javascriptModules.d.ts +2 -0
  351. package/dist/taps/normalModuleFactory.d.ts +2 -0
  352. package/dist/taps/types.d.ts +11 -0
  353. package/dist/trace/index.d.ts +42 -0
  354. package/dist/trace/traceHookPlugin.d.ts +5 -0
  355. package/dist/util/ArrayQueue.d.ts +45 -0
  356. package/dist/util/AsyncTask.d.ts +7 -0
  357. package/dist/util/MergeCaller.d.ts +10 -0
  358. package/dist/util/SizeFormatHelpers.d.ts +10 -0
  359. package/dist/util/SplitChunkSize.d.ts +5 -0
  360. package/dist/util/assertNotNil.d.ts +1 -0
  361. package/dist/util/assetCondition.d.ts +2 -0
  362. package/dist/util/asyncLib.d.ts +54 -0
  363. package/dist/util/bindingVersionCheck.d.ts +5 -0
  364. package/dist/util/cleverMerge.d.ts +24 -0
  365. package/dist/util/comparators.d.ts +16 -0
  366. package/dist/util/createHash.d.ts +16 -0
  367. package/dist/util/createReadonlyMap.d.ts +1 -0
  368. package/dist/util/fake.d.ts +9 -0
  369. package/dist/util/fs.d.ts +342 -0
  370. package/dist/util/hash/index.d.ts +26 -0
  371. package/dist/util/hash/md4.d.ts +11 -0
  372. package/dist/util/hash/wasm-hash.d.ts +51 -0
  373. package/dist/util/hash/xxhash64.d.ts +11 -0
  374. package/dist/util/identifier.d.ts +31 -0
  375. package/dist/util/index.d.ts +13 -0
  376. package/dist/util/memoize.d.ts +2 -0
  377. package/dist/util/runtime.d.ts +2 -0
  378. package/dist/util/smartGrouping.d.ts +21 -0
  379. package/dist/util/source.d.ts +7 -0
  380. package/dist/util/validate.d.ts +9 -0
  381. package/dist/worker.js +937 -0
  382. package/hot/dev-server.js +75 -0
  383. package/hot/emitter.js +21 -0
  384. package/hot/lazy-compilation-node.js +54 -0
  385. package/hot/lazy-compilation-web.js +79 -0
  386. package/hot/log-apply-result.js +49 -0
  387. package/hot/log.js +79 -0
  388. package/hot/only-dev-server.js +103 -0
  389. package/hot/poll.js +40 -0
  390. package/hot/signal.js +66 -0
  391. package/module.d.ts +276 -0
  392. package/package.json +78 -0
@@ -0,0 +1,2127 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ var __webpack_modules__ = ({
3
+
4
+ /***/ 137:
5
+ /***/ ((module) => {
6
+
7
+ module.exports = function (glob, opts) {
8
+ if (typeof glob !== 'string') {
9
+ throw new TypeError('Expected a string');
10
+ }
11
+
12
+ var str = String(glob);
13
+
14
+ // The regexp we are building, as a string.
15
+ var reStr = "";
16
+
17
+ // Whether we are matching so called "extended" globs (like bash) and should
18
+ // support single character matching, matching ranges of characters, group
19
+ // matching, etc.
20
+ var extended = opts ? !!opts.extended : false;
21
+
22
+ // When globstar is _false_ (default), '/foo/*' is translated a regexp like
23
+ // '^\/foo\/.*$' which will match any string beginning with '/foo/'
24
+ // When globstar is _true_, '/foo/*' is translated to regexp like
25
+ // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
26
+ // which does not have a '/' to the right of it.
27
+ // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
28
+ // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
29
+ // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
30
+ // globstar is _false_
31
+ var globstar = opts ? !!opts.globstar : false;
32
+
33
+ // If we are doing extended matching, this boolean is true when we are inside
34
+ // a group (eg {*.html,*.js}), and false otherwise.
35
+ var inGroup = false;
36
+
37
+ // RegExp flags (eg "i" ) to pass in to RegExp constructor.
38
+ var flags = opts && typeof( opts.flags ) === "string" ? opts.flags : "";
39
+
40
+ var c;
41
+ for (var i = 0, len = str.length; i < len; i++) {
42
+ c = str[i];
43
+
44
+ switch (c) {
45
+ case "/":
46
+ case "$":
47
+ case "^":
48
+ case "+":
49
+ case ".":
50
+ case "(":
51
+ case ")":
52
+ case "=":
53
+ case "!":
54
+ case "|":
55
+ reStr += "\\" + c;
56
+ break;
57
+
58
+ case "?":
59
+ if (extended) {
60
+ reStr += ".";
61
+ break;
62
+ }
63
+
64
+ case "[":
65
+ case "]":
66
+ if (extended) {
67
+ reStr += c;
68
+ break;
69
+ }
70
+
71
+ case "{":
72
+ if (extended) {
73
+ inGroup = true;
74
+ reStr += "(";
75
+ break;
76
+ }
77
+
78
+ case "}":
79
+ if (extended) {
80
+ inGroup = false;
81
+ reStr += ")";
82
+ break;
83
+ }
84
+
85
+ case ",":
86
+ if (inGroup) {
87
+ reStr += "|";
88
+ break;
89
+ }
90
+ reStr += "\\" + c;
91
+ break;
92
+
93
+ case "*":
94
+ // Move over all consecutive "*"'s.
95
+ // Also store the previous and next characters
96
+ var prevChar = str[i - 1];
97
+ var starCount = 1;
98
+ while(str[i + 1] === "*") {
99
+ starCount++;
100
+ i++;
101
+ }
102
+ var nextChar = str[i + 1];
103
+
104
+ if (!globstar) {
105
+ // globstar is disabled, so treat any number of "*" as one
106
+ reStr += ".*";
107
+ } else {
108
+ // globstar is enabled, so determine if this is a globstar segment
109
+ var isGlobstar = starCount > 1 // multiple "*"'s
110
+ && (prevChar === "/" || prevChar === undefined) // from the start of the segment
111
+ && (nextChar === "/" || nextChar === undefined) // to the end of the segment
112
+
113
+ if (isGlobstar) {
114
+ // it's a globstar, so match zero or more path segments
115
+ reStr += "((?:[^/]*(?:\/|$))*)";
116
+ i++; // move over the "/"
117
+ } else {
118
+ // it's not a globstar, so only match one path segment
119
+ reStr += "([^/]*)";
120
+ }
121
+ }
122
+ break;
123
+
124
+ default:
125
+ reStr += c;
126
+ }
127
+ }
128
+
129
+ // When regexp 'g' flag is specified don't
130
+ // constrain the regular expression with ^ & $
131
+ if (!flags || !~flags.indexOf('g')) {
132
+ reStr = "^" + reStr + "$";
133
+ }
134
+
135
+ return new RegExp(reStr, flags);
136
+ };
137
+
138
+
139
+ /***/ }),
140
+
141
+ /***/ 799:
142
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
143
+
144
+ "use strict";
145
+ /*
146
+ MIT License http://www.opensource.org/licenses/mit-license.php
147
+ Author Tobias Koppers @sokra
148
+ */
149
+
150
+
151
+ const EventEmitter = (__nccwpck_require__(434).EventEmitter);
152
+ const fs = __nccwpck_require__(923);
153
+ const path = __nccwpck_require__(928);
154
+
155
+ const watchEventSource = __nccwpck_require__(214);
156
+
157
+ const EXISTANCE_ONLY_TIME_ENTRY = Object.freeze({});
158
+
159
+ let FS_ACCURACY = 2000;
160
+
161
+ const IS_OSX = (__nccwpck_require__(857).platform)() === "darwin";
162
+ const IS_WIN = (__nccwpck_require__(857).platform)() === "win32";
163
+
164
+ const WATCHPACK_POLLING = process.env.WATCHPACK_POLLING;
165
+ const FORCE_POLLING =
166
+ `${+WATCHPACK_POLLING}` === WATCHPACK_POLLING
167
+ ? +WATCHPACK_POLLING
168
+ : !!WATCHPACK_POLLING && WATCHPACK_POLLING !== "false";
169
+
170
+ function withoutCase(str) {
171
+ return str.toLowerCase();
172
+ }
173
+
174
+ function needCalls(times, callback) {
175
+ return function() {
176
+ if (--times === 0) {
177
+ return callback();
178
+ }
179
+ };
180
+ }
181
+
182
+ class Watcher extends EventEmitter {
183
+ constructor(directoryWatcher, filePath, startTime) {
184
+ super();
185
+ this.directoryWatcher = directoryWatcher;
186
+ this.path = filePath;
187
+ this.startTime = startTime && +startTime;
188
+ }
189
+
190
+ checkStartTime(mtime, initial) {
191
+ const startTime = this.startTime;
192
+ if (typeof startTime !== "number") return !initial;
193
+ return startTime <= mtime;
194
+ }
195
+
196
+ close() {
197
+ this.emit("closed");
198
+ }
199
+ }
200
+
201
+ class DirectoryWatcher extends EventEmitter {
202
+ constructor(watcherManager, directoryPath, options) {
203
+ super();
204
+ if (FORCE_POLLING) {
205
+ options.poll = FORCE_POLLING;
206
+ }
207
+ this.watcherManager = watcherManager;
208
+ this.options = options;
209
+ this.path = directoryPath;
210
+ // safeTime is the point in time after which reading is safe to be unchanged
211
+ // timestamp is a value that should be compared with another timestamp (mtime)
212
+ /** @type {Map<string, { safeTime: number, timestamp: number }} */
213
+ this.files = new Map();
214
+ /** @type {Map<string, number>} */
215
+ this.filesWithoutCase = new Map();
216
+ this.directories = new Map();
217
+ this.lastWatchEvent = 0;
218
+ this.initialScan = true;
219
+ this.ignored = options.ignored || (() => false);
220
+ this.nestedWatching = false;
221
+ this.polledWatching =
222
+ typeof options.poll === "number"
223
+ ? options.poll
224
+ : options.poll
225
+ ? 5007
226
+ : false;
227
+ this.timeout = undefined;
228
+ this.initialScanRemoved = new Set();
229
+ this.initialScanFinished = undefined;
230
+ /** @type {Map<string, Set<Watcher>>} */
231
+ this.watchers = new Map();
232
+ this.parentWatcher = null;
233
+ this.refs = 0;
234
+ this._activeEvents = new Map();
235
+ this.closed = false;
236
+ this.scanning = false;
237
+ this.scanAgain = false;
238
+ this.scanAgainInitial = false;
239
+
240
+ this.createWatcher();
241
+ this.doScan(true);
242
+ }
243
+
244
+ createWatcher() {
245
+ try {
246
+ if (this.polledWatching) {
247
+ this.watcher = {
248
+ close: () => {
249
+ if (this.timeout) {
250
+ clearTimeout(this.timeout);
251
+ this.timeout = undefined;
252
+ }
253
+ }
254
+ };
255
+ } else {
256
+ if (IS_OSX) {
257
+ this.watchInParentDirectory();
258
+ }
259
+ this.watcher = watchEventSource.watch(this.path);
260
+ this.watcher.on("change", this.onWatchEvent.bind(this));
261
+ this.watcher.on("error", this.onWatcherError.bind(this));
262
+ }
263
+ } catch (err) {
264
+ this.onWatcherError(err);
265
+ }
266
+ }
267
+
268
+ forEachWatcher(path, fn) {
269
+ const watchers = this.watchers.get(withoutCase(path));
270
+ if (watchers !== undefined) {
271
+ for (const w of watchers) {
272
+ fn(w);
273
+ }
274
+ }
275
+ }
276
+
277
+ setMissing(itemPath, initial, type) {
278
+ if (this.initialScan) {
279
+ this.initialScanRemoved.add(itemPath);
280
+ }
281
+
282
+ const oldDirectory = this.directories.get(itemPath);
283
+ if (oldDirectory) {
284
+ if (this.nestedWatching) oldDirectory.close();
285
+ this.directories.delete(itemPath);
286
+
287
+ this.forEachWatcher(itemPath, w => w.emit("remove", type));
288
+ if (!initial) {
289
+ this.forEachWatcher(this.path, w =>
290
+ w.emit("change", itemPath, null, type, initial)
291
+ );
292
+ }
293
+ }
294
+
295
+ const oldFile = this.files.get(itemPath);
296
+ if (oldFile) {
297
+ this.files.delete(itemPath);
298
+ const key = withoutCase(itemPath);
299
+ const count = this.filesWithoutCase.get(key) - 1;
300
+ if (count <= 0) {
301
+ this.filesWithoutCase.delete(key);
302
+ this.forEachWatcher(itemPath, w => w.emit("remove", type));
303
+ } else {
304
+ this.filesWithoutCase.set(key, count);
305
+ }
306
+
307
+ if (!initial) {
308
+ this.forEachWatcher(this.path, w =>
309
+ w.emit("change", itemPath, null, type, initial)
310
+ );
311
+ }
312
+ }
313
+ }
314
+
315
+ setFileTime(filePath, mtime, initial, ignoreWhenEqual, type) {
316
+ const now = Date.now();
317
+
318
+ if (this.ignored(filePath)) return;
319
+
320
+ const old = this.files.get(filePath);
321
+
322
+ let safeTime, accuracy;
323
+ if (initial) {
324
+ safeTime = Math.min(now, mtime) + FS_ACCURACY;
325
+ accuracy = FS_ACCURACY;
326
+ } else {
327
+ safeTime = now;
328
+ accuracy = 0;
329
+
330
+ if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now) {
331
+ // We are sure that mtime is untouched
332
+ // This can be caused by some file attribute change
333
+ // e. g. when access time has been changed
334
+ // but the file content is untouched
335
+ return;
336
+ }
337
+ }
338
+
339
+ if (ignoreWhenEqual && old && old.timestamp === mtime) return;
340
+
341
+ this.files.set(filePath, {
342
+ safeTime,
343
+ accuracy,
344
+ timestamp: mtime
345
+ });
346
+
347
+ if (!old) {
348
+ const key = withoutCase(filePath);
349
+ const count = this.filesWithoutCase.get(key);
350
+ this.filesWithoutCase.set(key, (count || 0) + 1);
351
+ if (count !== undefined) {
352
+ // There is already a file with case-insensitive-equal name
353
+ // On a case-insensitive filesystem we may miss the renaming
354
+ // when only casing is changed.
355
+ // To be sure that our information is correct
356
+ // we trigger a rescan here
357
+ this.doScan(false);
358
+ }
359
+
360
+ this.forEachWatcher(filePath, w => {
361
+ if (!initial || w.checkStartTime(safeTime, initial)) {
362
+ w.emit("change", mtime, type);
363
+ }
364
+ });
365
+ } else if (!initial) {
366
+ this.forEachWatcher(filePath, w => w.emit("change", mtime, type));
367
+ }
368
+ this.forEachWatcher(this.path, w => {
369
+ if (!initial || w.checkStartTime(safeTime, initial)) {
370
+ w.emit("change", filePath, safeTime, type, initial);
371
+ }
372
+ });
373
+ }
374
+
375
+ setDirectory(directoryPath, birthtime, initial, type) {
376
+ if (this.ignored(directoryPath)) return;
377
+ if (directoryPath === this.path) {
378
+ if (!initial) {
379
+ this.forEachWatcher(this.path, w =>
380
+ w.emit("change", directoryPath, birthtime, type, initial)
381
+ );
382
+ }
383
+ } else {
384
+ const old = this.directories.get(directoryPath);
385
+ if (!old) {
386
+ const now = Date.now();
387
+
388
+ if (this.nestedWatching) {
389
+ this.createNestedWatcher(directoryPath);
390
+ } else {
391
+ this.directories.set(directoryPath, true);
392
+ }
393
+
394
+ let safeTime;
395
+ if (initial) {
396
+ safeTime = Math.min(now, birthtime) + FS_ACCURACY;
397
+ } else {
398
+ safeTime = now;
399
+ }
400
+
401
+ this.forEachWatcher(directoryPath, w => {
402
+ if (!initial || w.checkStartTime(safeTime, false)) {
403
+ w.emit("change", birthtime, type);
404
+ }
405
+ });
406
+ this.forEachWatcher(this.path, w => {
407
+ if (!initial || w.checkStartTime(safeTime, initial)) {
408
+ w.emit("change", directoryPath, safeTime, type, initial);
409
+ }
410
+ });
411
+ }
412
+ }
413
+ }
414
+
415
+ createNestedWatcher(directoryPath) {
416
+ const watcher = this.watcherManager.watchDirectory(directoryPath, 1);
417
+ watcher.on("change", (filePath, mtime, type, initial) => {
418
+ this.forEachWatcher(this.path, w => {
419
+ if (!initial || w.checkStartTime(mtime, initial)) {
420
+ w.emit("change", filePath, mtime, type, initial);
421
+ }
422
+ });
423
+ });
424
+ this.directories.set(directoryPath, watcher);
425
+ }
426
+
427
+ setNestedWatching(flag) {
428
+ if (this.nestedWatching !== !!flag) {
429
+ this.nestedWatching = !!flag;
430
+ if (this.nestedWatching) {
431
+ for (const directory of this.directories.keys()) {
432
+ this.createNestedWatcher(directory);
433
+ }
434
+ } else {
435
+ for (const [directory, watcher] of this.directories) {
436
+ watcher.close();
437
+ this.directories.set(directory, true);
438
+ }
439
+ }
440
+ }
441
+ }
442
+
443
+ watch(filePath, startTime) {
444
+ const key = withoutCase(filePath);
445
+ let watchers = this.watchers.get(key);
446
+ if (watchers === undefined) {
447
+ watchers = new Set();
448
+ this.watchers.set(key, watchers);
449
+ }
450
+ this.refs++;
451
+ const watcher = new Watcher(this, filePath, startTime);
452
+ watcher.on("closed", () => {
453
+ if (--this.refs <= 0) {
454
+ this.close();
455
+ return;
456
+ }
457
+ watchers.delete(watcher);
458
+ if (watchers.size === 0) {
459
+ this.watchers.delete(key);
460
+ if (this.path === filePath) this.setNestedWatching(false);
461
+ }
462
+ });
463
+ watchers.add(watcher);
464
+ let safeTime;
465
+ if (filePath === this.path) {
466
+ this.setNestedWatching(true);
467
+ safeTime = this.lastWatchEvent;
468
+ for (const entry of this.files.values()) {
469
+ fixupEntryAccuracy(entry);
470
+ safeTime = Math.max(safeTime, entry.safeTime);
471
+ }
472
+ } else {
473
+ const entry = this.files.get(filePath);
474
+ if (entry) {
475
+ fixupEntryAccuracy(entry);
476
+ safeTime = entry.safeTime;
477
+ } else {
478
+ safeTime = 0;
479
+ }
480
+ }
481
+ if (safeTime) {
482
+ if (safeTime >= startTime) {
483
+ process.nextTick(() => {
484
+ if (this.closed) return;
485
+ if (filePath === this.path) {
486
+ watcher.emit(
487
+ "change",
488
+ filePath,
489
+ safeTime,
490
+ "watch (outdated on attach)",
491
+ true
492
+ );
493
+ } else {
494
+ watcher.emit(
495
+ "change",
496
+ safeTime,
497
+ "watch (outdated on attach)",
498
+ true
499
+ );
500
+ }
501
+ });
502
+ }
503
+ } else if (this.initialScan) {
504
+ if (this.initialScanRemoved.has(filePath)) {
505
+ process.nextTick(() => {
506
+ if (this.closed) return;
507
+ watcher.emit("remove");
508
+ });
509
+ }
510
+ } else if (
511
+ filePath !== this.path &&
512
+ !this.directories.has(filePath) &&
513
+ watcher.checkStartTime(this.initialScanFinished, false)
514
+ ) {
515
+ process.nextTick(() => {
516
+ if (this.closed) return;
517
+ watcher.emit("initial-missing", "watch (missing on attach)");
518
+ });
519
+ }
520
+ return watcher;
521
+ }
522
+
523
+ onWatchEvent(eventType, filename) {
524
+ if (this.closed) return;
525
+ if (!filename) {
526
+ // In some cases no filename is provided
527
+ // This seem to happen on windows
528
+ // So some event happened but we don't know which file is affected
529
+ // We have to do a full scan of the directory
530
+ this.doScan(false);
531
+ return;
532
+ }
533
+
534
+ const filePath = path.join(this.path, filename);
535
+ if (this.ignored(filePath)) return;
536
+
537
+ if (this._activeEvents.get(filename) === undefined) {
538
+ this._activeEvents.set(filename, false);
539
+ const checkStats = () => {
540
+ if (this.closed) return;
541
+ this._activeEvents.set(filename, false);
542
+ fs.lstat(filePath, (err, stats) => {
543
+ if (this.closed) return;
544
+ if (this._activeEvents.get(filename) === true) {
545
+ process.nextTick(checkStats);
546
+ return;
547
+ }
548
+ this._activeEvents.delete(filename);
549
+ // ENOENT happens when the file/directory doesn't exist
550
+ // EPERM happens when the containing directory doesn't exist
551
+ if (err) {
552
+ if (
553
+ err.code !== "ENOENT" &&
554
+ err.code !== "EPERM" &&
555
+ err.code !== "EBUSY"
556
+ ) {
557
+ this.onStatsError(err);
558
+ } else {
559
+ if (filename === path.basename(this.path)) {
560
+ // This may indicate that the directory itself was removed
561
+ if (!fs.existsSync(this.path)) {
562
+ this.onDirectoryRemoved("stat failed");
563
+ }
564
+ }
565
+ }
566
+ }
567
+ this.lastWatchEvent = Date.now();
568
+ if (!stats) {
569
+ this.setMissing(filePath, false, eventType);
570
+ } else if (stats.isDirectory()) {
571
+ this.setDirectory(
572
+ filePath,
573
+ +stats.birthtime || 1,
574
+ false,
575
+ eventType
576
+ );
577
+ } else if (stats.isFile() || stats.isSymbolicLink()) {
578
+ if (stats.mtime) {
579
+ ensureFsAccuracy(stats.mtime);
580
+ }
581
+ this.setFileTime(
582
+ filePath,
583
+ +stats.mtime || +stats.ctime || 1,
584
+ false,
585
+ false,
586
+ eventType
587
+ );
588
+ }
589
+ });
590
+ };
591
+ process.nextTick(checkStats);
592
+ } else {
593
+ this._activeEvents.set(filename, true);
594
+ }
595
+ }
596
+
597
+ onWatcherError(err) {
598
+ if (this.closed) return;
599
+ if (err) {
600
+ if (err.code !== "EPERM" && err.code !== "ENOENT") {
601
+ console.error("Watchpack Error (watcher): " + err);
602
+ }
603
+ this.onDirectoryRemoved("watch error");
604
+ }
605
+ }
606
+
607
+ onStatsError(err) {
608
+ if (err) {
609
+ console.error("Watchpack Error (stats): " + err);
610
+ }
611
+ }
612
+
613
+ onScanError(err) {
614
+ if (err) {
615
+ console.error("Watchpack Error (initial scan): " + err);
616
+ }
617
+ this.onScanFinished();
618
+ }
619
+
620
+ onScanFinished() {
621
+ if (this.polledWatching) {
622
+ this.timeout = setTimeout(() => {
623
+ if (this.closed) return;
624
+ this.doScan(false);
625
+ }, this.polledWatching);
626
+ }
627
+ }
628
+
629
+ onDirectoryRemoved(reason) {
630
+ if (this.watcher) {
631
+ this.watcher.close();
632
+ this.watcher = null;
633
+ }
634
+ this.watchInParentDirectory();
635
+ const type = `directory-removed (${reason})`;
636
+ for (const directory of this.directories.keys()) {
637
+ this.setMissing(directory, null, type);
638
+ }
639
+ for (const file of this.files.keys()) {
640
+ this.setMissing(file, null, type);
641
+ }
642
+ }
643
+
644
+ watchInParentDirectory() {
645
+ if (!this.parentWatcher) {
646
+ const parentDir = path.dirname(this.path);
647
+ // avoid watching in the root directory
648
+ // removing directories in the root directory is not supported
649
+ if (path.dirname(parentDir) === parentDir) return;
650
+
651
+ this.parentWatcher = this.watcherManager.watchFile(this.path, 1);
652
+ this.parentWatcher.on("change", (mtime, type) => {
653
+ if (this.closed) return;
654
+
655
+ // On non-osx platforms we don't need this watcher to detect
656
+ // directory removal, as an EPERM error indicates that
657
+ if ((!IS_OSX || this.polledWatching) && this.parentWatcher) {
658
+ this.parentWatcher.close();
659
+ this.parentWatcher = null;
660
+ }
661
+ // Try to create the watcher when parent directory is found
662
+ if (!this.watcher) {
663
+ this.createWatcher();
664
+ this.doScan(false);
665
+
666
+ // directory was created so we emit an event
667
+ this.forEachWatcher(this.path, w =>
668
+ w.emit("change", this.path, mtime, type, false)
669
+ );
670
+ }
671
+ });
672
+ this.parentWatcher.on("remove", () => {
673
+ this.onDirectoryRemoved("parent directory removed");
674
+ });
675
+ }
676
+ }
677
+
678
+ doScan(initial) {
679
+ if (this.scanning) {
680
+ if (this.scanAgain) {
681
+ if (!initial) this.scanAgainInitial = false;
682
+ } else {
683
+ this.scanAgain = true;
684
+ this.scanAgainInitial = initial;
685
+ }
686
+ return;
687
+ }
688
+ this.scanning = true;
689
+ if (this.timeout) {
690
+ clearTimeout(this.timeout);
691
+ this.timeout = undefined;
692
+ }
693
+ process.nextTick(() => {
694
+ if (this.closed) return;
695
+ fs.readdir(this.path, (err, items) => {
696
+ if (this.closed) return;
697
+ if (err) {
698
+ if (err.code === "ENOENT" || err.code === "EPERM") {
699
+ this.onDirectoryRemoved("scan readdir failed");
700
+ } else {
701
+ this.onScanError(err);
702
+ }
703
+ this.initialScan = false;
704
+ this.initialScanFinished = Date.now();
705
+ if (initial) {
706
+ for (const watchers of this.watchers.values()) {
707
+ for (const watcher of watchers) {
708
+ if (watcher.checkStartTime(this.initialScanFinished, false)) {
709
+ watcher.emit(
710
+ "initial-missing",
711
+ "scan (parent directory missing in initial scan)"
712
+ );
713
+ }
714
+ }
715
+ }
716
+ }
717
+ if (this.scanAgain) {
718
+ this.scanAgain = false;
719
+ this.doScan(this.scanAgainInitial);
720
+ } else {
721
+ this.scanning = false;
722
+ }
723
+ return;
724
+ }
725
+ const itemPaths = new Set(
726
+ items.map(item => path.join(this.path, item.normalize("NFC")))
727
+ );
728
+ for (const file of this.files.keys()) {
729
+ if (!itemPaths.has(file)) {
730
+ this.setMissing(file, initial, "scan (missing)");
731
+ }
732
+ }
733
+ for (const directory of this.directories.keys()) {
734
+ if (!itemPaths.has(directory)) {
735
+ this.setMissing(directory, initial, "scan (missing)");
736
+ }
737
+ }
738
+ if (this.scanAgain) {
739
+ // Early repeat of scan
740
+ this.scanAgain = false;
741
+ this.doScan(initial);
742
+ return;
743
+ }
744
+ const itemFinished = needCalls(itemPaths.size + 1, () => {
745
+ if (this.closed) return;
746
+ this.initialScan = false;
747
+ this.initialScanRemoved = null;
748
+ this.initialScanFinished = Date.now();
749
+ if (initial) {
750
+ const missingWatchers = new Map(this.watchers);
751
+ missingWatchers.delete(withoutCase(this.path));
752
+ for (const item of itemPaths) {
753
+ missingWatchers.delete(withoutCase(item));
754
+ }
755
+ for (const watchers of missingWatchers.values()) {
756
+ for (const watcher of watchers) {
757
+ if (watcher.checkStartTime(this.initialScanFinished, false)) {
758
+ watcher.emit(
759
+ "initial-missing",
760
+ "scan (missing in initial scan)"
761
+ );
762
+ }
763
+ }
764
+ }
765
+ }
766
+ if (this.scanAgain) {
767
+ this.scanAgain = false;
768
+ this.doScan(this.scanAgainInitial);
769
+ } else {
770
+ this.scanning = false;
771
+ this.onScanFinished();
772
+ }
773
+ });
774
+ for (const itemPath of itemPaths) {
775
+ fs.lstat(itemPath, (err2, stats) => {
776
+ if (this.closed) return;
777
+ if (err2) {
778
+ if (
779
+ err2.code === "ENOENT" ||
780
+ err2.code === "EPERM" ||
781
+ err2.code === "EACCES" ||
782
+ err2.code === "EBUSY" ||
783
+ // TODO https://github.com/libuv/libuv/pull/4566
784
+ (err2.code === "EINVAL" && IS_WIN)
785
+ ) {
786
+ this.setMissing(itemPath, initial, "scan (" + err2.code + ")");
787
+ } else {
788
+ this.onScanError(err2);
789
+ }
790
+ itemFinished();
791
+ return;
792
+ }
793
+ if (stats.isFile() || stats.isSymbolicLink()) {
794
+ if (stats.mtime) {
795
+ ensureFsAccuracy(stats.mtime);
796
+ }
797
+ this.setFileTime(
798
+ itemPath,
799
+ +stats.mtime || +stats.ctime || 1,
800
+ initial,
801
+ true,
802
+ "scan (file)"
803
+ );
804
+ } else if (stats.isDirectory()) {
805
+ if (!initial || !this.directories.has(itemPath))
806
+ this.setDirectory(
807
+ itemPath,
808
+ +stats.birthtime || 1,
809
+ initial,
810
+ "scan (dir)"
811
+ );
812
+ }
813
+ itemFinished();
814
+ });
815
+ }
816
+ itemFinished();
817
+ });
818
+ });
819
+ }
820
+
821
+ getTimes() {
822
+ const obj = Object.create(null);
823
+ let safeTime = this.lastWatchEvent;
824
+ for (const [file, entry] of this.files) {
825
+ fixupEntryAccuracy(entry);
826
+ safeTime = Math.max(safeTime, entry.safeTime);
827
+ obj[file] = Math.max(entry.safeTime, entry.timestamp);
828
+ }
829
+ if (this.nestedWatching) {
830
+ for (const w of this.directories.values()) {
831
+ const times = w.directoryWatcher.getTimes();
832
+ for (const file of Object.keys(times)) {
833
+ const time = times[file];
834
+ safeTime = Math.max(safeTime, time);
835
+ obj[file] = time;
836
+ }
837
+ }
838
+ obj[this.path] = safeTime;
839
+ }
840
+ if (!this.initialScan) {
841
+ for (const watchers of this.watchers.values()) {
842
+ for (const watcher of watchers) {
843
+ const path = watcher.path;
844
+ if (!Object.prototype.hasOwnProperty.call(obj, path)) {
845
+ obj[path] = null;
846
+ }
847
+ }
848
+ }
849
+ }
850
+ return obj;
851
+ }
852
+
853
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
854
+ let safeTime = this.lastWatchEvent;
855
+ for (const [file, entry] of this.files) {
856
+ fixupEntryAccuracy(entry);
857
+ safeTime = Math.max(safeTime, entry.safeTime);
858
+ fileTimestamps.set(file, entry);
859
+ }
860
+ if (this.nestedWatching) {
861
+ for (const w of this.directories.values()) {
862
+ safeTime = Math.max(
863
+ safeTime,
864
+ w.directoryWatcher.collectTimeInfoEntries(
865
+ fileTimestamps,
866
+ directoryTimestamps
867
+ )
868
+ );
869
+ }
870
+ fileTimestamps.set(this.path, EXISTANCE_ONLY_TIME_ENTRY);
871
+ directoryTimestamps.set(this.path, {
872
+ safeTime
873
+ });
874
+ } else {
875
+ for (const dir of this.directories.keys()) {
876
+ // No additional info about this directory
877
+ // but maybe another DirectoryWatcher has info
878
+ fileTimestamps.set(dir, EXISTANCE_ONLY_TIME_ENTRY);
879
+ if (!directoryTimestamps.has(dir))
880
+ directoryTimestamps.set(dir, EXISTANCE_ONLY_TIME_ENTRY);
881
+ }
882
+ fileTimestamps.set(this.path, EXISTANCE_ONLY_TIME_ENTRY);
883
+ directoryTimestamps.set(this.path, EXISTANCE_ONLY_TIME_ENTRY);
884
+ }
885
+ if (!this.initialScan) {
886
+ for (const watchers of this.watchers.values()) {
887
+ for (const watcher of watchers) {
888
+ const path = watcher.path;
889
+ if (!fileTimestamps.has(path)) {
890
+ fileTimestamps.set(path, null);
891
+ }
892
+ }
893
+ }
894
+ }
895
+ return safeTime;
896
+ }
897
+
898
+ close() {
899
+ this.closed = true;
900
+ this.initialScan = false;
901
+ if (this.watcher) {
902
+ this.watcher.close();
903
+ this.watcher = null;
904
+ }
905
+ if (this.nestedWatching) {
906
+ for (const w of this.directories.values()) {
907
+ w.close();
908
+ }
909
+ this.directories.clear();
910
+ }
911
+ if (this.parentWatcher) {
912
+ this.parentWatcher.close();
913
+ this.parentWatcher = null;
914
+ }
915
+ this.emit("closed");
916
+ }
917
+ }
918
+
919
+ module.exports = DirectoryWatcher;
920
+ module.exports.EXISTANCE_ONLY_TIME_ENTRY = EXISTANCE_ONLY_TIME_ENTRY;
921
+
922
+ function fixupEntryAccuracy(entry) {
923
+ if (entry.accuracy > FS_ACCURACY) {
924
+ entry.safeTime = entry.safeTime - entry.accuracy + FS_ACCURACY;
925
+ entry.accuracy = FS_ACCURACY;
926
+ }
927
+ }
928
+
929
+ function ensureFsAccuracy(mtime) {
930
+ if (!mtime) return;
931
+ if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1;
932
+ else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10;
933
+ else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100;
934
+ else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000;
935
+ }
936
+
937
+
938
+ /***/ }),
939
+
940
+ /***/ 308:
941
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
942
+
943
+ "use strict";
944
+ /*
945
+ MIT License http://www.opensource.org/licenses/mit-license.php
946
+ Author Tobias Koppers @sokra
947
+ */
948
+
949
+
950
+ const fs = __nccwpck_require__(896);
951
+ const path = __nccwpck_require__(928);
952
+
953
+ // macOS, Linux, and Windows all rely on these errors
954
+ const EXPECTED_ERRORS = new Set(["EINVAL", "ENOENT"]);
955
+
956
+ // On Windows there is also this error in some cases
957
+ if (process.platform === "win32") EXPECTED_ERRORS.add("UNKNOWN");
958
+
959
+ class LinkResolver {
960
+ constructor() {
961
+ this.cache = new Map();
962
+ }
963
+
964
+ /**
965
+ * @param {string} file path to file or directory
966
+ * @returns {string[]} array of file and all symlinks contributed in the resolving process (first item is the resolved file)
967
+ */
968
+ resolve(file) {
969
+ const cacheEntry = this.cache.get(file);
970
+ if (cacheEntry !== undefined) {
971
+ return cacheEntry;
972
+ }
973
+ const parent = path.dirname(file);
974
+ if (parent === file) {
975
+ // At root of filesystem there can't be a link
976
+ const result = Object.freeze([file]);
977
+ this.cache.set(file, result);
978
+ return result;
979
+ }
980
+ // resolve the parent directory to find links there and get the real path
981
+ const parentResolved = this.resolve(parent);
982
+ let realFile = file;
983
+
984
+ // is the parent directory really somewhere else?
985
+ if (parentResolved[0] !== parent) {
986
+ // get the real location of file
987
+ const basename = path.basename(file);
988
+ realFile = path.resolve(parentResolved[0], basename);
989
+ }
990
+ // try to read the link content
991
+ try {
992
+ const linkContent = fs.readlinkSync(realFile);
993
+
994
+ // resolve the link content relative to the parent directory
995
+ const resolvedLink = path.resolve(parentResolved[0], linkContent);
996
+
997
+ // recursive resolve the link content for more links in the structure
998
+ const linkResolved = this.resolve(resolvedLink);
999
+
1000
+ // merge parent and link resolve results
1001
+ let result;
1002
+ if (linkResolved.length > 1 && parentResolved.length > 1) {
1003
+ // when both contain links we need to duplicate them with a Set
1004
+ const resultSet = new Set(linkResolved);
1005
+ // add the link
1006
+ resultSet.add(realFile);
1007
+ // add all symlinks of the parent
1008
+ for (let i = 1; i < parentResolved.length; i++) {
1009
+ resultSet.add(parentResolved[i]);
1010
+ }
1011
+ result = Object.freeze(Array.from(resultSet));
1012
+ } else if (parentResolved.length > 1) {
1013
+ // we have links in the parent but not for the link content location
1014
+ result = parentResolved.slice();
1015
+ result[0] = linkResolved[0];
1016
+ // add the link
1017
+ result.push(realFile);
1018
+ Object.freeze(result);
1019
+ } else if (linkResolved.length > 1) {
1020
+ // we can return the link content location result
1021
+ result = linkResolved.slice();
1022
+ // add the link
1023
+ result.push(realFile);
1024
+ Object.freeze(result);
1025
+ } else {
1026
+ // neither link content location nor parent have links
1027
+ // this link is the only link here
1028
+ result = Object.freeze([
1029
+ // the resolve real location
1030
+ linkResolved[0],
1031
+ // add the link
1032
+ realFile
1033
+ ]);
1034
+ }
1035
+ this.cache.set(file, result);
1036
+ return result;
1037
+ } catch (e) {
1038
+ if (!EXPECTED_ERRORS.has(e.code)) {
1039
+ throw e;
1040
+ }
1041
+ // no link
1042
+ const result = parentResolved.slice();
1043
+ result[0] = realFile;
1044
+ Object.freeze(result);
1045
+ this.cache.set(file, result);
1046
+ return result;
1047
+ }
1048
+ }
1049
+ }
1050
+ module.exports = LinkResolver;
1051
+
1052
+
1053
+ /***/ }),
1054
+
1055
+ /***/ 847:
1056
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1057
+
1058
+ "use strict";
1059
+ /*
1060
+ MIT License http://www.opensource.org/licenses/mit-license.php
1061
+ Author Tobias Koppers @sokra
1062
+ */
1063
+
1064
+
1065
+ const path = __nccwpck_require__(928);
1066
+ const DirectoryWatcher = __nccwpck_require__(799);
1067
+
1068
+ class WatcherManager {
1069
+ constructor(options) {
1070
+ this.options = options;
1071
+ this.directoryWatchers = new Map();
1072
+ }
1073
+
1074
+ getDirectoryWatcher(directory) {
1075
+ const watcher = this.directoryWatchers.get(directory);
1076
+ if (watcher === undefined) {
1077
+ const newWatcher = new DirectoryWatcher(this, directory, this.options);
1078
+ this.directoryWatchers.set(directory, newWatcher);
1079
+ newWatcher.on("closed", () => {
1080
+ this.directoryWatchers.delete(directory);
1081
+ });
1082
+ return newWatcher;
1083
+ }
1084
+ return watcher;
1085
+ }
1086
+
1087
+ watchFile(p, startTime) {
1088
+ const directory = path.dirname(p);
1089
+ if (directory === p) return null;
1090
+ return this.getDirectoryWatcher(directory).watch(p, startTime);
1091
+ }
1092
+
1093
+ watchDirectory(directory, startTime) {
1094
+ return this.getDirectoryWatcher(directory).watch(directory, startTime);
1095
+ }
1096
+ }
1097
+
1098
+ const watcherManagers = new WeakMap();
1099
+ /**
1100
+ * @param {object} options options
1101
+ * @returns {WatcherManager} the watcher manager
1102
+ */
1103
+ module.exports = options => {
1104
+ const watcherManager = watcherManagers.get(options);
1105
+ if (watcherManager !== undefined) return watcherManager;
1106
+ const newWatcherManager = new WatcherManager(options);
1107
+ watcherManagers.set(options, newWatcherManager);
1108
+ return newWatcherManager;
1109
+ };
1110
+ module.exports.WatcherManager = WatcherManager;
1111
+
1112
+
1113
+ /***/ }),
1114
+
1115
+ /***/ 935:
1116
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1117
+
1118
+ "use strict";
1119
+ /*
1120
+ MIT License http://www.opensource.org/licenses/mit-license.php
1121
+ Author Tobias Koppers @sokra
1122
+ */
1123
+
1124
+
1125
+ const path = __nccwpck_require__(928);
1126
+
1127
+ /**
1128
+ * @template T
1129
+ * @typedef {Object} TreeNode
1130
+ * @property {string} filePath
1131
+ * @property {TreeNode} parent
1132
+ * @property {TreeNode[]} children
1133
+ * @property {number} entries
1134
+ * @property {boolean} active
1135
+ * @property {T[] | T | undefined} value
1136
+ */
1137
+
1138
+ /**
1139
+ * @template T
1140
+ * @param {Map<string, T[] | T} plan
1141
+ * @param {number} limit
1142
+ * @returns {Map<string, Map<T, string>>} the new plan
1143
+ */
1144
+ module.exports = (plan, limit) => {
1145
+ const treeMap = new Map();
1146
+ // Convert to tree
1147
+ for (const [filePath, value] of plan) {
1148
+ treeMap.set(filePath, {
1149
+ filePath,
1150
+ parent: undefined,
1151
+ children: undefined,
1152
+ entries: 1,
1153
+ active: true,
1154
+ value
1155
+ });
1156
+ }
1157
+ let currentCount = treeMap.size;
1158
+ // Create parents and calculate sum of entries
1159
+ for (const node of treeMap.values()) {
1160
+ const parentPath = path.dirname(node.filePath);
1161
+ if (parentPath !== node.filePath) {
1162
+ let parent = treeMap.get(parentPath);
1163
+ if (parent === undefined) {
1164
+ parent = {
1165
+ filePath: parentPath,
1166
+ parent: undefined,
1167
+ children: [node],
1168
+ entries: node.entries,
1169
+ active: false,
1170
+ value: undefined
1171
+ };
1172
+ treeMap.set(parentPath, parent);
1173
+ node.parent = parent;
1174
+ } else {
1175
+ node.parent = parent;
1176
+ if (parent.children === undefined) {
1177
+ parent.children = [node];
1178
+ } else {
1179
+ parent.children.push(node);
1180
+ }
1181
+ do {
1182
+ parent.entries += node.entries;
1183
+ parent = parent.parent;
1184
+ } while (parent);
1185
+ }
1186
+ }
1187
+ }
1188
+ // Reduce until limit reached
1189
+ while (currentCount > limit) {
1190
+ // Select node that helps reaching the limit most effectively without overmerging
1191
+ const overLimit = currentCount - limit;
1192
+ let bestNode = undefined;
1193
+ let bestCost = Infinity;
1194
+ for (const node of treeMap.values()) {
1195
+ if (node.entries <= 1 || !node.children || !node.parent) continue;
1196
+ if (node.children.length === 0) continue;
1197
+ if (node.children.length === 1 && !node.value) continue;
1198
+ // Try to select the node with has just a bit more entries than we need to reduce
1199
+ // When just a bit more is over 30% over the limit,
1200
+ // also consider just a bit less entries then we need to reduce
1201
+ const cost =
1202
+ node.entries - 1 >= overLimit
1203
+ ? node.entries - 1 - overLimit
1204
+ : overLimit - node.entries + 1 + limit * 0.3;
1205
+ if (cost < bestCost) {
1206
+ bestNode = node;
1207
+ bestCost = cost;
1208
+ }
1209
+ }
1210
+ if (!bestNode) break;
1211
+ // Merge all children
1212
+ const reduction = bestNode.entries - 1;
1213
+ bestNode.active = true;
1214
+ bestNode.entries = 1;
1215
+ currentCount -= reduction;
1216
+ let parent = bestNode.parent;
1217
+ while (parent) {
1218
+ parent.entries -= reduction;
1219
+ parent = parent.parent;
1220
+ }
1221
+ const queue = new Set(bestNode.children);
1222
+ for (const node of queue) {
1223
+ node.active = false;
1224
+ node.entries = 0;
1225
+ if (node.children) {
1226
+ for (const child of node.children) queue.add(child);
1227
+ }
1228
+ }
1229
+ }
1230
+ // Write down new plan
1231
+ const newPlan = new Map();
1232
+ for (const rootNode of treeMap.values()) {
1233
+ if (!rootNode.active) continue;
1234
+ const map = new Map();
1235
+ const queue = new Set([rootNode]);
1236
+ for (const node of queue) {
1237
+ if (node.active && node !== rootNode) continue;
1238
+ if (node.value) {
1239
+ if (Array.isArray(node.value)) {
1240
+ for (const item of node.value) {
1241
+ map.set(item, node.filePath);
1242
+ }
1243
+ } else {
1244
+ map.set(node.value, node.filePath);
1245
+ }
1246
+ }
1247
+ if (node.children) {
1248
+ for (const child of node.children) {
1249
+ queue.add(child);
1250
+ }
1251
+ }
1252
+ }
1253
+ newPlan.set(rootNode.filePath, map);
1254
+ }
1255
+ return newPlan;
1256
+ };
1257
+
1258
+
1259
+ /***/ }),
1260
+
1261
+ /***/ 214:
1262
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1263
+
1264
+ "use strict";
1265
+ /*
1266
+ MIT License http://www.opensource.org/licenses/mit-license.php
1267
+ Author Tobias Koppers @sokra
1268
+ */
1269
+
1270
+
1271
+ const fs = __nccwpck_require__(896);
1272
+ const path = __nccwpck_require__(928);
1273
+ const { EventEmitter } = __nccwpck_require__(434);
1274
+ const reducePlan = __nccwpck_require__(935);
1275
+
1276
+ const IS_OSX = (__nccwpck_require__(857).platform)() === "darwin";
1277
+ const IS_WIN = (__nccwpck_require__(857).platform)() === "win32";
1278
+ const SUPPORTS_RECURSIVE_WATCHING = IS_OSX || IS_WIN;
1279
+
1280
+ // Use 20 for OSX to make `FSWatcher.close` faster
1281
+ // https://github.com/nodejs/node/issues/29949
1282
+ const watcherLimit =
1283
+ +process.env.WATCHPACK_WATCHER_LIMIT || (IS_OSX ? 20 : 10000);
1284
+
1285
+ const recursiveWatcherLogging = !!process.env
1286
+ .WATCHPACK_RECURSIVE_WATCHER_LOGGING;
1287
+
1288
+ let isBatch = false;
1289
+ let watcherCount = 0;
1290
+
1291
+ /** @type {Map<Watcher, string>} */
1292
+ const pendingWatchers = new Map();
1293
+
1294
+ /** @type {Map<string, RecursiveWatcher>} */
1295
+ const recursiveWatchers = new Map();
1296
+
1297
+ /** @type {Map<string, DirectWatcher>} */
1298
+ const directWatchers = new Map();
1299
+
1300
+ /** @type {Map<Watcher, RecursiveWatcher | DirectWatcher>} */
1301
+ const underlyingWatcher = new Map();
1302
+
1303
+ function createEPERMError(filePath) {
1304
+ const error = new Error(`Operation not permitted: ${filePath}`);
1305
+ error.code = "EPERM";
1306
+ return error;
1307
+ }
1308
+
1309
+ function createHandleChangeEvent(watcher, filePath, handleChangeEvent) {
1310
+ return (type, filename) => {
1311
+ // TODO: After Node.js v22, fs.watch(dir) and deleting a dir will trigger the rename change event.
1312
+ // Here we just ignore it and keep the same behavior as before v22
1313
+ // https://github.com/libuv/libuv/pull/4376
1314
+ if (
1315
+ type === "rename" &&
1316
+ path.isAbsolute(filename) &&
1317
+ path.basename(filename) === path.basename(filePath)
1318
+ ) {
1319
+ if (!IS_OSX) {
1320
+ // Before v22, windows will throw EPERM error
1321
+ watcher.emit("error", createEPERMError(filename));
1322
+ }
1323
+ // Before v22, macos nothing to do
1324
+ return;
1325
+ }
1326
+ handleChangeEvent(type, filename);
1327
+ };
1328
+ }
1329
+
1330
+ class DirectWatcher {
1331
+ constructor(filePath) {
1332
+ this.filePath = filePath;
1333
+ this.watchers = new Set();
1334
+ this.watcher = undefined;
1335
+ try {
1336
+ const watcher = fs.watch(filePath);
1337
+
1338
+ this.watcher = watcher;
1339
+ const handleChangeEvent = createHandleChangeEvent(
1340
+ watcher,
1341
+ filePath,
1342
+ (type, filename) => {
1343
+ for (const w of this.watchers) {
1344
+ w.emit("change", type, filename);
1345
+ }
1346
+ }
1347
+ );
1348
+ watcher.on("change", handleChangeEvent);
1349
+ watcher.on("error", error => {
1350
+ for (const w of this.watchers) {
1351
+ w.emit("error", error);
1352
+ }
1353
+ });
1354
+ } catch (err) {
1355
+ process.nextTick(() => {
1356
+ for (const w of this.watchers) {
1357
+ w.emit("error", err);
1358
+ }
1359
+ });
1360
+ }
1361
+ watcherCount++;
1362
+ }
1363
+
1364
+ add(watcher) {
1365
+ underlyingWatcher.set(watcher, this);
1366
+ this.watchers.add(watcher);
1367
+ }
1368
+
1369
+ remove(watcher) {
1370
+ this.watchers.delete(watcher);
1371
+ if (this.watchers.size === 0) {
1372
+ directWatchers.delete(this.filePath);
1373
+ watcherCount--;
1374
+ if (this.watcher) this.watcher.close();
1375
+ }
1376
+ }
1377
+
1378
+ getWatchers() {
1379
+ return this.watchers;
1380
+ }
1381
+ }
1382
+
1383
+ class RecursiveWatcher {
1384
+ constructor(rootPath) {
1385
+ this.rootPath = rootPath;
1386
+ /** @type {Map<Watcher, string>} */
1387
+ this.mapWatcherToPath = new Map();
1388
+ /** @type {Map<string, Set<Watcher>>} */
1389
+ this.mapPathToWatchers = new Map();
1390
+ this.watcher = undefined;
1391
+ try {
1392
+ const watcher = fs.watch(rootPath, {
1393
+ recursive: true
1394
+ });
1395
+ this.watcher = watcher;
1396
+ watcher.on("change", (type, filename) => {
1397
+ if (!filename) {
1398
+ if (recursiveWatcherLogging) {
1399
+ process.stderr.write(
1400
+ `[watchpack] dispatch ${type} event in recursive watcher (${this.rootPath}) to all watchers\n`
1401
+ );
1402
+ }
1403
+ for (const w of this.mapWatcherToPath.keys()) {
1404
+ w.emit("change", type);
1405
+ }
1406
+ } else {
1407
+ const dir = path.dirname(filename);
1408
+ const watchers = this.mapPathToWatchers.get(dir);
1409
+ if (recursiveWatcherLogging) {
1410
+ process.stderr.write(
1411
+ `[watchpack] dispatch ${type} event in recursive watcher (${
1412
+ this.rootPath
1413
+ }) for '${filename}' to ${
1414
+ watchers ? watchers.size : 0
1415
+ } watchers\n`
1416
+ );
1417
+ }
1418
+ if (watchers === undefined) return;
1419
+ for (const w of watchers) {
1420
+ w.emit("change", type, path.basename(filename));
1421
+ }
1422
+ }
1423
+ });
1424
+ watcher.on("error", error => {
1425
+ for (const w of this.mapWatcherToPath.keys()) {
1426
+ w.emit("error", error);
1427
+ }
1428
+ });
1429
+ } catch (err) {
1430
+ process.nextTick(() => {
1431
+ for (const w of this.mapWatcherToPath.keys()) {
1432
+ w.emit("error", err);
1433
+ }
1434
+ });
1435
+ }
1436
+ watcherCount++;
1437
+ if (recursiveWatcherLogging) {
1438
+ process.stderr.write(
1439
+ `[watchpack] created recursive watcher at ${rootPath}\n`
1440
+ );
1441
+ }
1442
+ }
1443
+
1444
+ add(filePath, watcher) {
1445
+ underlyingWatcher.set(watcher, this);
1446
+ const subpath = filePath.slice(this.rootPath.length + 1) || ".";
1447
+ this.mapWatcherToPath.set(watcher, subpath);
1448
+ const set = this.mapPathToWatchers.get(subpath);
1449
+ if (set === undefined) {
1450
+ const newSet = new Set();
1451
+ newSet.add(watcher);
1452
+ this.mapPathToWatchers.set(subpath, newSet);
1453
+ } else {
1454
+ set.add(watcher);
1455
+ }
1456
+ }
1457
+
1458
+ remove(watcher) {
1459
+ const subpath = this.mapWatcherToPath.get(watcher);
1460
+ if (!subpath) return;
1461
+ this.mapWatcherToPath.delete(watcher);
1462
+ const set = this.mapPathToWatchers.get(subpath);
1463
+ set.delete(watcher);
1464
+ if (set.size === 0) {
1465
+ this.mapPathToWatchers.delete(subpath);
1466
+ }
1467
+ if (this.mapWatcherToPath.size === 0) {
1468
+ recursiveWatchers.delete(this.rootPath);
1469
+ watcherCount--;
1470
+ if (this.watcher) this.watcher.close();
1471
+ if (recursiveWatcherLogging) {
1472
+ process.stderr.write(
1473
+ `[watchpack] closed recursive watcher at ${this.rootPath}\n`
1474
+ );
1475
+ }
1476
+ }
1477
+ }
1478
+
1479
+ getWatchers() {
1480
+ return this.mapWatcherToPath;
1481
+ }
1482
+ }
1483
+
1484
+ class Watcher extends EventEmitter {
1485
+ close() {
1486
+ if (pendingWatchers.has(this)) {
1487
+ pendingWatchers.delete(this);
1488
+ return;
1489
+ }
1490
+ const watcher = underlyingWatcher.get(this);
1491
+ watcher.remove(this);
1492
+ underlyingWatcher.delete(this);
1493
+ }
1494
+ }
1495
+
1496
+ const createDirectWatcher = filePath => {
1497
+ const existing = directWatchers.get(filePath);
1498
+ if (existing !== undefined) return existing;
1499
+ const w = new DirectWatcher(filePath);
1500
+ directWatchers.set(filePath, w);
1501
+ return w;
1502
+ };
1503
+
1504
+ const createRecursiveWatcher = rootPath => {
1505
+ const existing = recursiveWatchers.get(rootPath);
1506
+ if (existing !== undefined) return existing;
1507
+ const w = new RecursiveWatcher(rootPath);
1508
+ recursiveWatchers.set(rootPath, w);
1509
+ return w;
1510
+ };
1511
+
1512
+ const execute = () => {
1513
+ /** @type {Map<string, Watcher[] | Watcher>} */
1514
+ const map = new Map();
1515
+ const addWatcher = (watcher, filePath) => {
1516
+ const entry = map.get(filePath);
1517
+ if (entry === undefined) {
1518
+ map.set(filePath, watcher);
1519
+ } else if (Array.isArray(entry)) {
1520
+ entry.push(watcher);
1521
+ } else {
1522
+ map.set(filePath, [entry, watcher]);
1523
+ }
1524
+ };
1525
+ for (const [watcher, filePath] of pendingWatchers) {
1526
+ addWatcher(watcher, filePath);
1527
+ }
1528
+ pendingWatchers.clear();
1529
+
1530
+ // Fast case when we are not reaching the limit
1531
+ if (!SUPPORTS_RECURSIVE_WATCHING || watcherLimit - watcherCount >= map.size) {
1532
+ // Create watchers for all entries in the map
1533
+ for (const [filePath, entry] of map) {
1534
+ const w = createDirectWatcher(filePath);
1535
+ if (Array.isArray(entry)) {
1536
+ for (const item of entry) w.add(item);
1537
+ } else {
1538
+ w.add(entry);
1539
+ }
1540
+ }
1541
+ return;
1542
+ }
1543
+
1544
+ // Reconsider existing watchers to improving watch plan
1545
+ for (const watcher of recursiveWatchers.values()) {
1546
+ for (const [w, subpath] of watcher.getWatchers()) {
1547
+ addWatcher(w, path.join(watcher.rootPath, subpath));
1548
+ }
1549
+ }
1550
+ for (const watcher of directWatchers.values()) {
1551
+ for (const w of watcher.getWatchers()) {
1552
+ addWatcher(w, watcher.filePath);
1553
+ }
1554
+ }
1555
+
1556
+ // Merge map entries to keep watcher limit
1557
+ // Create a 10% buffer to be able to enter fast case more often
1558
+ const plan = reducePlan(map, watcherLimit * 0.9);
1559
+
1560
+ // Update watchers for all entries in the map
1561
+ for (const [filePath, entry] of plan) {
1562
+ if (entry.size === 1) {
1563
+ for (const [watcher, filePath] of entry) {
1564
+ const w = createDirectWatcher(filePath);
1565
+ const old = underlyingWatcher.get(watcher);
1566
+ if (old === w) continue;
1567
+ w.add(watcher);
1568
+ if (old !== undefined) old.remove(watcher);
1569
+ }
1570
+ } else {
1571
+ const filePaths = new Set(entry.values());
1572
+ if (filePaths.size > 1) {
1573
+ const w = createRecursiveWatcher(filePath);
1574
+ for (const [watcher, watcherPath] of entry) {
1575
+ const old = underlyingWatcher.get(watcher);
1576
+ if (old === w) continue;
1577
+ w.add(watcherPath, watcher);
1578
+ if (old !== undefined) old.remove(watcher);
1579
+ }
1580
+ } else {
1581
+ for (const filePath of filePaths) {
1582
+ const w = createDirectWatcher(filePath);
1583
+ for (const watcher of entry.keys()) {
1584
+ const old = underlyingWatcher.get(watcher);
1585
+ if (old === w) continue;
1586
+ w.add(watcher);
1587
+ if (old !== undefined) old.remove(watcher);
1588
+ }
1589
+ }
1590
+ }
1591
+ }
1592
+ }
1593
+ };
1594
+
1595
+ exports.watch = filePath => {
1596
+ const watcher = new Watcher();
1597
+ // Find an existing watcher
1598
+ const directWatcher = directWatchers.get(filePath);
1599
+ if (directWatcher !== undefined) {
1600
+ directWatcher.add(watcher);
1601
+ return watcher;
1602
+ }
1603
+ let current = filePath;
1604
+ for (;;) {
1605
+ const recursiveWatcher = recursiveWatchers.get(current);
1606
+ if (recursiveWatcher !== undefined) {
1607
+ recursiveWatcher.add(filePath, watcher);
1608
+ return watcher;
1609
+ }
1610
+ const parent = path.dirname(current);
1611
+ if (parent === current) break;
1612
+ current = parent;
1613
+ }
1614
+ // Queue up watcher for creation
1615
+ pendingWatchers.set(watcher, filePath);
1616
+ if (!isBatch) execute();
1617
+ return watcher;
1618
+ };
1619
+
1620
+ exports.batch = fn => {
1621
+ isBatch = true;
1622
+ try {
1623
+ fn();
1624
+ } finally {
1625
+ isBatch = false;
1626
+ execute();
1627
+ }
1628
+ };
1629
+
1630
+ exports.getNumberOfWatchers = () => {
1631
+ return watcherCount;
1632
+ };
1633
+
1634
+ exports.createHandleChangeEvent = createHandleChangeEvent;
1635
+ exports.watcherLimit = watcherLimit;
1636
+
1637
+
1638
+ /***/ }),
1639
+
1640
+ /***/ 882:
1641
+ /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1642
+
1643
+ "use strict";
1644
+ /*
1645
+ MIT License http://www.opensource.org/licenses/mit-license.php
1646
+ Author Tobias Koppers @sokra
1647
+ */
1648
+
1649
+
1650
+ const getWatcherManager = __nccwpck_require__(847);
1651
+ const LinkResolver = __nccwpck_require__(308);
1652
+ const EventEmitter = (__nccwpck_require__(434).EventEmitter);
1653
+ const globToRegExp = __nccwpck_require__(137);
1654
+ const watchEventSource = __nccwpck_require__(214);
1655
+
1656
+ const EMPTY_ARRAY = [];
1657
+ const EMPTY_OPTIONS = {};
1658
+
1659
+ function addWatchersToSet(watchers, set) {
1660
+ for (const ww of watchers) {
1661
+ const w = ww.watcher;
1662
+ if (!set.has(w.directoryWatcher)) {
1663
+ set.add(w.directoryWatcher);
1664
+ }
1665
+ }
1666
+ }
1667
+
1668
+ const stringToRegexp = ignored => {
1669
+ if (ignored.length === 0) {
1670
+ return;
1671
+ }
1672
+ const source = globToRegExp(ignored, { globstar: true, extended: true })
1673
+ .source;
1674
+ return source.slice(0, source.length - 1) + "(?:$|\\/)";
1675
+ };
1676
+
1677
+ const ignoredToFunction = ignored => {
1678
+ if (Array.isArray(ignored)) {
1679
+ const stringRegexps = ignored.map(i => stringToRegexp(i)).filter(Boolean);
1680
+ if (stringRegexps.length === 0) {
1681
+ return () => false;
1682
+ }
1683
+ const regexp = new RegExp(stringRegexps.join("|"));
1684
+ return x => regexp.test(x.replace(/\\/g, "/"));
1685
+ } else if (typeof ignored === "string") {
1686
+ const stringRegexp = stringToRegexp(ignored);
1687
+ if (!stringRegexp) {
1688
+ return () => false;
1689
+ }
1690
+ const regexp = new RegExp(stringRegexp);
1691
+ return x => regexp.test(x.replace(/\\/g, "/"));
1692
+ } else if (ignored instanceof RegExp) {
1693
+ return x => ignored.test(x.replace(/\\/g, "/"));
1694
+ } else if (ignored instanceof Function) {
1695
+ return ignored;
1696
+ } else if (ignored) {
1697
+ throw new Error(`Invalid option for 'ignored': ${ignored}`);
1698
+ } else {
1699
+ return () => false;
1700
+ }
1701
+ };
1702
+
1703
+ const normalizeOptions = options => {
1704
+ return {
1705
+ followSymlinks: !!options.followSymlinks,
1706
+ ignored: ignoredToFunction(options.ignored),
1707
+ poll: options.poll
1708
+ };
1709
+ };
1710
+
1711
+ const normalizeCache = new WeakMap();
1712
+ const cachedNormalizeOptions = options => {
1713
+ const cacheEntry = normalizeCache.get(options);
1714
+ if (cacheEntry !== undefined) return cacheEntry;
1715
+ const normalized = normalizeOptions(options);
1716
+ normalizeCache.set(options, normalized);
1717
+ return normalized;
1718
+ };
1719
+
1720
+ class WatchpackFileWatcher {
1721
+ constructor(watchpack, watcher, files) {
1722
+ this.files = Array.isArray(files) ? files : [files];
1723
+ this.watcher = watcher;
1724
+ watcher.on("initial-missing", type => {
1725
+ for (const file of this.files) {
1726
+ if (!watchpack._missing.has(file))
1727
+ watchpack._onRemove(file, file, type);
1728
+ }
1729
+ });
1730
+ watcher.on("change", (mtime, type) => {
1731
+ for (const file of this.files) {
1732
+ watchpack._onChange(file, mtime, file, type);
1733
+ }
1734
+ });
1735
+ watcher.on("remove", type => {
1736
+ for (const file of this.files) {
1737
+ watchpack._onRemove(file, file, type);
1738
+ }
1739
+ });
1740
+ }
1741
+
1742
+ update(files) {
1743
+ if (!Array.isArray(files)) {
1744
+ if (this.files.length !== 1) {
1745
+ this.files = [files];
1746
+ } else if (this.files[0] !== files) {
1747
+ this.files[0] = files;
1748
+ }
1749
+ } else {
1750
+ this.files = files;
1751
+ }
1752
+ }
1753
+
1754
+ close() {
1755
+ this.watcher.close();
1756
+ }
1757
+ }
1758
+
1759
+ class WatchpackDirectoryWatcher {
1760
+ constructor(watchpack, watcher, directories) {
1761
+ this.directories = Array.isArray(directories) ? directories : [directories];
1762
+ this.watcher = watcher;
1763
+ watcher.on("initial-missing", type => {
1764
+ for (const item of this.directories) {
1765
+ watchpack._onRemove(item, item, type);
1766
+ }
1767
+ });
1768
+ watcher.on("change", (file, mtime, type) => {
1769
+ for (const item of this.directories) {
1770
+ watchpack._onChange(item, mtime, file, type);
1771
+ }
1772
+ });
1773
+ watcher.on("remove", type => {
1774
+ for (const item of this.directories) {
1775
+ watchpack._onRemove(item, item, type);
1776
+ }
1777
+ });
1778
+ }
1779
+
1780
+ update(directories) {
1781
+ if (!Array.isArray(directories)) {
1782
+ if (this.directories.length !== 1) {
1783
+ this.directories = [directories];
1784
+ } else if (this.directories[0] !== directories) {
1785
+ this.directories[0] = directories;
1786
+ }
1787
+ } else {
1788
+ this.directories = directories;
1789
+ }
1790
+ }
1791
+
1792
+ close() {
1793
+ this.watcher.close();
1794
+ }
1795
+ }
1796
+
1797
+ class Watchpack extends EventEmitter {
1798
+ constructor(options) {
1799
+ super();
1800
+ if (!options) options = EMPTY_OPTIONS;
1801
+ this.options = options;
1802
+ this.aggregateTimeout =
1803
+ typeof options.aggregateTimeout === "number"
1804
+ ? options.aggregateTimeout
1805
+ : 200;
1806
+ this.watcherOptions = cachedNormalizeOptions(options);
1807
+ this.watcherManager = getWatcherManager(this.watcherOptions);
1808
+ this.fileWatchers = new Map();
1809
+ this.directoryWatchers = new Map();
1810
+ this._missing = new Set();
1811
+ this.startTime = undefined;
1812
+ this.paused = false;
1813
+ this.aggregatedChanges = new Set();
1814
+ this.aggregatedRemovals = new Set();
1815
+ this.aggregateTimer = undefined;
1816
+ this._onTimeout = this._onTimeout.bind(this);
1817
+ }
1818
+
1819
+ watch(arg1, arg2, arg3) {
1820
+ let files, directories, missing, startTime;
1821
+ if (!arg2) {
1822
+ ({
1823
+ files = EMPTY_ARRAY,
1824
+ directories = EMPTY_ARRAY,
1825
+ missing = EMPTY_ARRAY,
1826
+ startTime
1827
+ } = arg1);
1828
+ } else {
1829
+ files = arg1;
1830
+ directories = arg2;
1831
+ missing = EMPTY_ARRAY;
1832
+ startTime = arg3;
1833
+ }
1834
+ this.paused = false;
1835
+ const fileWatchers = this.fileWatchers;
1836
+ const directoryWatchers = this.directoryWatchers;
1837
+ const ignored = this.watcherOptions.ignored;
1838
+ const filter = path => !ignored(path);
1839
+ const addToMap = (map, key, item) => {
1840
+ const list = map.get(key);
1841
+ if (list === undefined) {
1842
+ map.set(key, item);
1843
+ } else if (Array.isArray(list)) {
1844
+ list.push(item);
1845
+ } else {
1846
+ map.set(key, [list, item]);
1847
+ }
1848
+ };
1849
+ const fileWatchersNeeded = new Map();
1850
+ const directoryWatchersNeeded = new Map();
1851
+ const missingFiles = new Set();
1852
+ if (this.watcherOptions.followSymlinks) {
1853
+ const resolver = new LinkResolver();
1854
+ for (const file of files) {
1855
+ if (filter(file)) {
1856
+ for (const innerFile of resolver.resolve(file)) {
1857
+ if (file === innerFile || filter(innerFile)) {
1858
+ addToMap(fileWatchersNeeded, innerFile, file);
1859
+ }
1860
+ }
1861
+ }
1862
+ }
1863
+ for (const file of missing) {
1864
+ if (filter(file)) {
1865
+ for (const innerFile of resolver.resolve(file)) {
1866
+ if (file === innerFile || filter(innerFile)) {
1867
+ missingFiles.add(file);
1868
+ addToMap(fileWatchersNeeded, innerFile, file);
1869
+ }
1870
+ }
1871
+ }
1872
+ }
1873
+ for (const dir of directories) {
1874
+ if (filter(dir)) {
1875
+ let first = true;
1876
+ for (const innerItem of resolver.resolve(dir)) {
1877
+ if (filter(innerItem)) {
1878
+ addToMap(
1879
+ first ? directoryWatchersNeeded : fileWatchersNeeded,
1880
+ innerItem,
1881
+ dir
1882
+ );
1883
+ }
1884
+ first = false;
1885
+ }
1886
+ }
1887
+ }
1888
+ } else {
1889
+ for (const file of files) {
1890
+ if (filter(file)) {
1891
+ addToMap(fileWatchersNeeded, file, file);
1892
+ }
1893
+ }
1894
+ for (const file of missing) {
1895
+ if (filter(file)) {
1896
+ missingFiles.add(file);
1897
+ addToMap(fileWatchersNeeded, file, file);
1898
+ }
1899
+ }
1900
+ for (const dir of directories) {
1901
+ if (filter(dir)) {
1902
+ addToMap(directoryWatchersNeeded, dir, dir);
1903
+ }
1904
+ }
1905
+ }
1906
+ // Close unneeded old watchers
1907
+ // and update existing watchers
1908
+ for (const [key, w] of fileWatchers) {
1909
+ const needed = fileWatchersNeeded.get(key);
1910
+ if (needed === undefined) {
1911
+ w.close();
1912
+ fileWatchers.delete(key);
1913
+ } else {
1914
+ w.update(needed);
1915
+ fileWatchersNeeded.delete(key);
1916
+ }
1917
+ }
1918
+ for (const [key, w] of directoryWatchers) {
1919
+ const needed = directoryWatchersNeeded.get(key);
1920
+ if (needed === undefined) {
1921
+ w.close();
1922
+ directoryWatchers.delete(key);
1923
+ } else {
1924
+ w.update(needed);
1925
+ directoryWatchersNeeded.delete(key);
1926
+ }
1927
+ }
1928
+ // Create new watchers and install handlers on these watchers
1929
+ watchEventSource.batch(() => {
1930
+ for (const [key, files] of fileWatchersNeeded) {
1931
+ const watcher = this.watcherManager.watchFile(key, startTime);
1932
+ if (watcher) {
1933
+ fileWatchers.set(key, new WatchpackFileWatcher(this, watcher, files));
1934
+ }
1935
+ }
1936
+ for (const [key, directories] of directoryWatchersNeeded) {
1937
+ const watcher = this.watcherManager.watchDirectory(key, startTime);
1938
+ if (watcher) {
1939
+ directoryWatchers.set(
1940
+ key,
1941
+ new WatchpackDirectoryWatcher(this, watcher, directories)
1942
+ );
1943
+ }
1944
+ }
1945
+ });
1946
+ this._missing = missingFiles;
1947
+ this.startTime = startTime;
1948
+ }
1949
+
1950
+ close() {
1951
+ this.paused = true;
1952
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
1953
+ for (const w of this.fileWatchers.values()) w.close();
1954
+ for (const w of this.directoryWatchers.values()) w.close();
1955
+ this.fileWatchers.clear();
1956
+ this.directoryWatchers.clear();
1957
+ }
1958
+
1959
+ pause() {
1960
+ this.paused = true;
1961
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
1962
+ }
1963
+
1964
+ getTimes() {
1965
+ const directoryWatchers = new Set();
1966
+ addWatchersToSet(this.fileWatchers.values(), directoryWatchers);
1967
+ addWatchersToSet(this.directoryWatchers.values(), directoryWatchers);
1968
+ const obj = Object.create(null);
1969
+ for (const w of directoryWatchers) {
1970
+ const times = w.getTimes();
1971
+ for (const file of Object.keys(times)) obj[file] = times[file];
1972
+ }
1973
+ return obj;
1974
+ }
1975
+
1976
+ getTimeInfoEntries() {
1977
+ const map = new Map();
1978
+ this.collectTimeInfoEntries(map, map);
1979
+ return map;
1980
+ }
1981
+
1982
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
1983
+ const allWatchers = new Set();
1984
+ addWatchersToSet(this.fileWatchers.values(), allWatchers);
1985
+ addWatchersToSet(this.directoryWatchers.values(), allWatchers);
1986
+ const safeTime = { value: 0 };
1987
+ for (const w of allWatchers) {
1988
+ w.collectTimeInfoEntries(fileTimestamps, directoryTimestamps, safeTime);
1989
+ }
1990
+ }
1991
+
1992
+ getAggregated() {
1993
+ if (this.aggregateTimer) {
1994
+ clearTimeout(this.aggregateTimer);
1995
+ this.aggregateTimer = undefined;
1996
+ }
1997
+ const changes = this.aggregatedChanges;
1998
+ const removals = this.aggregatedRemovals;
1999
+ this.aggregatedChanges = new Set();
2000
+ this.aggregatedRemovals = new Set();
2001
+ return { changes, removals };
2002
+ }
2003
+
2004
+ _onChange(item, mtime, file, type) {
2005
+ file = file || item;
2006
+ if (!this.paused) {
2007
+ this.emit("change", file, mtime, type);
2008
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
2009
+ this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
2010
+ }
2011
+ this.aggregatedRemovals.delete(item);
2012
+ this.aggregatedChanges.add(item);
2013
+ }
2014
+
2015
+ _onRemove(item, file, type) {
2016
+ file = file || item;
2017
+ if (!this.paused) {
2018
+ this.emit("remove", file, type);
2019
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
2020
+ this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
2021
+ }
2022
+ this.aggregatedChanges.delete(item);
2023
+ this.aggregatedRemovals.add(item);
2024
+ }
2025
+
2026
+ _onTimeout() {
2027
+ this.aggregateTimer = undefined;
2028
+ const changes = this.aggregatedChanges;
2029
+ const removals = this.aggregatedRemovals;
2030
+ this.aggregatedChanges = new Set();
2031
+ this.aggregatedRemovals = new Set();
2032
+ this.emit("aggregated", changes, removals);
2033
+ }
2034
+ }
2035
+
2036
+ module.exports = Watchpack;
2037
+
2038
+
2039
+ /***/ }),
2040
+
2041
+ /***/ 923:
2042
+ /***/ ((module) => {
2043
+
2044
+ "use strict";
2045
+ module.exports = require("../graceful-fs/index.js");
2046
+
2047
+ /***/ }),
2048
+
2049
+ /***/ 434:
2050
+ /***/ ((module) => {
2051
+
2052
+ "use strict";
2053
+ module.exports = require("events");
2054
+
2055
+ /***/ }),
2056
+
2057
+ /***/ 896:
2058
+ /***/ ((module) => {
2059
+
2060
+ "use strict";
2061
+ module.exports = require("fs");
2062
+
2063
+ /***/ }),
2064
+
2065
+ /***/ 857:
2066
+ /***/ ((module) => {
2067
+
2068
+ "use strict";
2069
+ module.exports = require("os");
2070
+
2071
+ /***/ }),
2072
+
2073
+ /***/ 928:
2074
+ /***/ ((module) => {
2075
+
2076
+ "use strict";
2077
+ module.exports = require("path");
2078
+
2079
+ /***/ })
2080
+
2081
+ /******/ });
2082
+ /************************************************************************/
2083
+ /******/ // The module cache
2084
+ /******/ var __webpack_module_cache__ = {};
2085
+ /******/
2086
+ /******/ // The require function
2087
+ /******/ function __nccwpck_require__(moduleId) {
2088
+ /******/ // Check if module is in cache
2089
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
2090
+ /******/ if (cachedModule !== undefined) {
2091
+ /******/ return cachedModule.exports;
2092
+ /******/ }
2093
+ /******/ // Create a new module (and put it into the cache)
2094
+ /******/ var module = __webpack_module_cache__[moduleId] = {
2095
+ /******/ // no module.id needed
2096
+ /******/ // no module.loaded needed
2097
+ /******/ exports: {}
2098
+ /******/ };
2099
+ /******/
2100
+ /******/ // Execute the module function
2101
+ /******/ var threw = true;
2102
+ /******/ try {
2103
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
2104
+ /******/ threw = false;
2105
+ /******/ } finally {
2106
+ /******/ if(threw) delete __webpack_module_cache__[moduleId];
2107
+ /******/ }
2108
+ /******/
2109
+ /******/ // Return the exports of the module
2110
+ /******/ return module.exports;
2111
+ /******/ }
2112
+ /******/
2113
+ /************************************************************************/
2114
+ /******/ /* webpack/runtime/compat */
2115
+ /******/
2116
+ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
2117
+ /******/
2118
+ /************************************************************************/
2119
+ /******/
2120
+ /******/ // startup
2121
+ /******/ // Load entry module and return exports
2122
+ /******/ // This entry module is referenced by other modules so it can't be inlined
2123
+ /******/ var __webpack_exports__ = __nccwpck_require__(882);
2124
+ /******/ module.exports = __webpack_exports__;
2125
+ /******/
2126
+ /******/ })()
2127
+ ;