@rspack-canary/core 1.7.3-canary-0b48f4eb-20260120024403 → 1.7.4-canary-e31ee70c-20260121175734

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 (208) hide show
  1. package/dist/ChunkGraph.d.ts +1 -1
  2. package/dist/Compilation.d.ts +27 -27
  3. package/dist/Compiler.d.ts +17 -18
  4. package/dist/ContextModuleFactory.d.ts +1 -1
  5. package/dist/Diagnostics.d.ts +1 -1
  6. package/dist/ExecuteModulePlugin.d.ts +1 -1
  7. package/dist/ExportsInfo.d.ts +1 -1
  8. package/dist/FileSystem.d.ts +1 -1
  9. package/dist/Module.d.ts +2 -2
  10. package/dist/ModuleGraph.d.ts +2 -2
  11. package/dist/MultiCompiler.d.ts +7 -7
  12. package/dist/MultiStats.d.ts +3 -3
  13. package/dist/MultiWatching.d.ts +2 -2
  14. package/dist/NativeWatchFileSystem.d.ts +1 -1
  15. package/dist/NormalModule.d.ts +3 -3
  16. package/dist/NormalModuleFactory.d.ts +3 -3
  17. package/dist/Resolver.d.ts +1 -1
  18. package/dist/ResolverFactory.d.ts +2 -2
  19. package/dist/RuntimeGlobals.d.ts +1 -1
  20. package/dist/RuntimeModule.d.ts +3 -3
  21. package/dist/Stats.d.ts +4 -4
  22. package/dist/VirtualModulesPlugin.d.ts +1 -1
  23. package/dist/Watching.d.ts +4 -4
  24. package/dist/builtin-loader/index.d.ts +1 -1
  25. package/dist/builtin-loader/lightningcss/index.d.ts +5 -0
  26. package/dist/builtin-loader/swc/index.d.ts +5 -5
  27. package/dist/builtin-loader/swc/types.d.ts +6 -4
  28. package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
  29. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
  30. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
  31. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
  32. package/dist/builtin-plugin/BannerPlugin.d.ts +3 -3
  33. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +3 -3
  34. package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +3 -3
  35. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
  36. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +4 -4
  37. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
  38. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +3 -3
  39. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +3 -3
  40. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +3 -3
  41. package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
  42. package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
  43. package/dist/builtin-plugin/DefinePlugin.d.ts +3 -3
  44. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/DllEntryPlugin.d.ts +3 -3
  47. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +3 -3
  48. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +3 -3
  49. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
  50. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
  51. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
  52. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
  53. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
  54. package/dist/builtin-plugin/EntryPlugin.d.ts +4 -4
  55. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +3 -3
  57. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -3
  58. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
  59. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
  60. package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
  61. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +3 -3
  62. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
  63. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +3 -3
  66. package/dist/builtin-plugin/HttpUriPlugin.d.ts +2 -2
  67. package/dist/builtin-plugin/IgnorePlugin.d.ts +3 -3
  68. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
  69. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +3 -3
  70. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +4 -4
  71. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +2 -2
  72. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
  73. package/dist/builtin-plugin/LibManifestPlugin.d.ts +3 -3
  74. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +10 -5
  75. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +3 -3
  76. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
  78. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
  79. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +3 -3
  81. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
  82. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
  83. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  85. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +3 -3
  86. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
  87. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +4 -4
  88. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +3 -3
  89. package/dist/builtin-plugin/ProgressPlugin.d.ts +3 -3
  90. package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
  91. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
  92. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +3 -3
  93. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
  94. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +8 -4
  95. package/dist/builtin-plugin/RslibPlugin.d.ts +3 -3
  96. package/dist/builtin-plugin/RstestPlugin.d.ts +3 -3
  97. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +3 -3
  98. package/dist/builtin-plugin/RuntimePlugin.d.ts +10 -6
  99. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
  100. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +3 -3
  101. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +3 -3
  102. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
  103. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
  104. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +5 -5
  105. package/dist/builtin-plugin/URLPlugin.d.ts +3 -3
  106. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +2 -2
  107. package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
  108. package/dist/builtin-plugin/base.d.ts +3 -3
  109. package/dist/builtin-plugin/css-extract/index.d.ts +3 -3
  110. package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
  111. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
  112. package/dist/builtin-plugin/html-plugin/hooks.d.ts +2 -2
  113. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -2
  114. package/dist/builtin-plugin/html-plugin/options.d.ts +6 -1
  115. package/dist/builtin-plugin/html-plugin/plugin.d.ts +9 -5
  116. package/dist/builtin-plugin/html-plugin/taps.d.ts +1 -1
  117. package/dist/builtin-plugin/index.d.ts +84 -85
  118. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +4 -4
  119. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
  120. package/dist/config/adapter.d.ts +4 -4
  121. package/dist/config/adapterRuleUse.d.ts +9 -9
  122. package/dist/config/browserslistTargetHandler.d.ts +1 -1
  123. package/dist/config/defaults.d.ts +1 -1
  124. package/dist/config/devServer.d.ts +3 -3
  125. package/dist/config/index.d.ts +5 -5
  126. package/dist/config/normalization.d.ts +35 -7
  127. package/dist/config/types.d.ts +156 -67
  128. package/dist/container/ContainerPlugin.d.ts +3 -3
  129. package/dist/container/ContainerReferencePlugin.d.ts +3 -3
  130. package/dist/container/ModuleFederationManifestPlugin.d.ts +2 -2
  131. package/dist/container/ModuleFederationPlugin.d.ts +5 -3
  132. package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
  133. package/dist/container/ModuleFederationRuntimePlugin.d.ts +7 -3
  134. package/dist/container/index.d.ts +4 -4
  135. package/dist/cssExtractHmr.js +27 -2
  136. package/dist/cssExtractLoader.js +57 -15
  137. package/dist/exports.d.ts +81 -70
  138. package/dist/index.d.ts +3 -3
  139. package/dist/index.js +11731 -11457
  140. package/dist/lib/AbstractMethodError.d.ts +1 -1
  141. package/dist/lib/Cache.d.ts +1 -1
  142. package/dist/lib/CacheFacade.d.ts +3 -3
  143. package/dist/lib/DllPlugin.d.ts +2 -2
  144. package/dist/lib/DllReferencePlugin.d.ts +3 -3
  145. package/dist/lib/EntryOptionPlugin.d.ts +2 -2
  146. package/dist/lib/EnvironmentPlugin.d.ts +1 -1
  147. package/dist/lib/HookWebpackError.d.ts +1 -1
  148. package/dist/lib/IgnoreWarningsPlugin.d.ts +1 -1
  149. package/dist/lib/LoaderOptionsPlugin.d.ts +2 -2
  150. package/dist/lib/LoaderTargetPlugin.d.ts +2 -2
  151. package/dist/lib/WebpackError.d.ts +2 -2
  152. package/dist/lib/cache/MemoryCachePlugin.d.ts +1 -1
  153. package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
  154. package/dist/lib/cache/mergeEtags.d.ts +1 -1
  155. package/dist/loader-runner/ModuleError.d.ts +1 -1
  156. package/dist/loader-runner/index.d.ts +1 -1
  157. package/dist/loader-runner/loadLoader.d.ts +2 -2
  158. package/dist/loader-runner/utils.d.ts +3 -3
  159. package/dist/loader-runner/worker.d.ts +1 -1
  160. package/dist/logging/createConsoleLogger.d.ts +2 -2
  161. package/dist/moduleFederationDefaultRuntime.js +1 -1
  162. package/dist/node/NodeEnvironmentPlugin.d.ts +2 -2
  163. package/dist/node/NodeTemplatePlugin.d.ts +1 -1
  164. package/dist/node/NodeWatchFileSystem.d.ts +1 -1
  165. package/dist/node/nodeConsole.d.ts +1 -1
  166. package/dist/rspack.d.ts +5 -5
  167. package/dist/rspackOptionsApply.d.ts +1 -1
  168. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -1
  169. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  170. package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
  171. package/dist/sharing/SharePlugin.d.ts +1 -1
  172. package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
  173. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +1 -1
  174. package/dist/stats/DefaultStatsPresetPlugin.d.ts +1 -1
  175. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +1 -1
  176. package/dist/stats/StatsFactory.d.ts +2 -2
  177. package/dist/stats/StatsPrinter.d.ts +1 -1
  178. package/dist/stats/statsFactoryUtils.d.ts +6 -3
  179. package/dist/taps/compilation.d.ts +1 -1
  180. package/dist/taps/compiler.d.ts +1 -1
  181. package/dist/taps/contextModuleFactory.d.ts +1 -1
  182. package/dist/taps/index.d.ts +6 -6
  183. package/dist/taps/javascriptModules.d.ts +1 -1
  184. package/dist/taps/normalModuleFactory.d.ts +1 -1
  185. package/dist/taps/types.d.ts +1 -1
  186. package/dist/trace/traceHookPlugin.d.ts +1 -1
  187. package/dist/util/createHash.d.ts +1 -1
  188. package/dist/util/fs.d.ts +1 -1
  189. package/dist/util/hash/md4.d.ts +1 -1
  190. package/dist/util/hash/xxhash64.d.ts +1 -1
  191. package/dist/util/index.d.ts +1 -1
  192. package/dist/util/validateConfig.d.ts +1 -1
  193. package/dist/worker.js +918 -846
  194. package/hot/dev-server.js +9 -12
  195. package/hot/emitter.js +1 -5
  196. package/hot/lazy-compilation-node.js +1 -4
  197. package/hot/lazy-compilation-web.js +3 -2
  198. package/hot/log-apply-result.js +5 -8
  199. package/hot/log.js +7 -17
  200. package/hot/only-dev-server.js +10 -13
  201. package/hot/poll.js +8 -11
  202. package/hot/signal.js +9 -13
  203. package/package.json +6 -9
  204. package/dist/builtin-plugin/rsc/Coordinator.d.ts +0 -8
  205. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +0 -13
  206. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +0 -14
  207. package/dist/builtin-plugin/rsc/index.d.ts +0 -24
  208. package/dist/rslib-runtime.js +0 -29
package/dist/worker.js CHANGED
@@ -1,906 +1,978 @@
1
- let createMd4, createXxhash64, url;
2
- import { createRequire as __rspack_createRequire, createRequire } from "node:module";
3
- let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
4
- import { __webpack_require__ } from "./rslib-runtime.js";
5
- import node_fs from "node:fs";
6
- import node_querystring from "node:querystring";
7
- import { inspect, promisify } from "node:util";
8
- import { receiveMessageOnPort } from "node:worker_threads";
9
- import node_path from "node:path";
10
- var swc_namespaceObject = {};
11
- __webpack_require__.r(swc_namespaceObject), __webpack_require__.d(swc_namespaceObject, {
12
- minify: ()=>minify,
13
- minifySync: ()=>minifySync,
14
- transform: ()=>transform,
15
- transformSync: ()=>transformSync
16
- });
17
- let binding_namespaceObject = __rspack_createRequire_require("@rspack/binding");
18
- var binding_default = __webpack_require__.n(binding_namespaceObject);
19
- async function minify(source, options) {
20
- let _options = JSON.stringify(options || {});
21
- return binding_default().minify(source, _options);
22
- }
23
- function minifySync(source, options) {
24
- let _options = JSON.stringify(options || {});
25
- return binding_default().minifySync(source, _options);
26
- }
27
- async function transform(source, options) {
28
- let _options = JSON.stringify(options || {});
29
- return binding_default().transform(source, _options);
30
- }
31
- function transformSync(source, options) {
32
- let _options = JSON.stringify(options || {});
33
- return binding_default().transformSync(source, _options);
34
- }
35
- let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
36
- if (void 0 === second) return first;
37
- if (void 0 === first || 'object' != typeof second || null === second) return second;
38
- if ('object' != typeof first || null === first) return first;
39
- let innerCache = mergeCache.get(first);
40
- void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
41
- let prevMerge = innerCache.get(second);
42
- if (void 0 !== prevMerge) return prevMerge;
43
- let newMerge = _cleverMerge(first, second, !0);
44
- return innerCache.set(second, newMerge), newMerge;
45
- }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
46
- let entry = parseCache.get(obj);
47
- if (void 0 !== entry) return entry;
48
- let result = parseObject(obj);
49
- return parseCache.set(obj, result), result;
50
- }, parseObject = (obj)=>{
51
- let dynamicInfo, info = new Map(), getInfo = (p)=>{
52
- let entry = info.get(p);
53
- if (void 0 !== entry) return entry;
54
- let newEntry = {
55
- base: void 0,
56
- byProperty: void 0,
57
- byValues: new Map()
58
- };
59
- return info.set(p, newEntry), newEntry;
60
- };
61
- for (let key of Object.keys(obj))if (key.startsWith('by')) {
62
- let byObj = obj[key];
63
- if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
64
- let obj = byObj[byValue];
65
- for (let key1 of Object.keys(obj)){
66
- let entry = getInfo(key1);
67
- if (void 0 === entry.byProperty) entry.byProperty = key;
68
- else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
69
- if (entry.byValues.set(byValue, obj[key1]), 'default' === byValue) for (let otherByValue of Object.keys(byObj))entry.byValues.has(otherByValue) || entry.byValues.set(otherByValue, void 0);
70
- }
1
+ "use strict";
2
+ var __webpack_modules__ = {
3
+ "./src/swc.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
4
+ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
5
+ minify: ()=>minify,
6
+ minifySync: ()=>minifySync,
7
+ transform: ()=>transform,
8
+ transformSync: ()=>transformSync
9
+ });
10
+ var _rspack_binding__rspack_import_0 = __webpack_require__("@rspack/binding"), _rspack_binding__rspack_import_0_default = __webpack_require__.n(_rspack_binding__rspack_import_0);
11
+ async function minify(source, options) {
12
+ let _options = JSON.stringify(options || {});
13
+ return _rspack_binding__rspack_import_0_default().minify(source, _options);
71
14
  }
72
- else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
73
- byProperty: key,
74
- fn: byObj
75
- };
76
- else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
77
- else getInfo(key).base = obj[key];
78
- } else getInfo(key).base = obj[key];
79
- return {
80
- static: info,
81
- dynamic: dynamicInfo
82
- };
83
- }, serializeObject = (info, dynamicInfo)=>{
84
- let obj = {};
85
- for (let entry of info.values())if (void 0 !== entry.byProperty) {
86
- let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
87
- for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
88
- }
89
- for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
90
- let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
91
- for (let byValue of Object.keys(byObj)){
92
- let value = getFromByValues(entry.byValues, byValue);
93
- void 0 !== value && (byObj[byValue][key] = value);
15
+ function minifySync(source, options) {
16
+ let _options = JSON.stringify(options || {});
17
+ return _rspack_binding__rspack_import_0_default().minifySync(source, _options);
94
18
  }
95
- }
96
- return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
97
- }, getValueType = (value)=>void 0 === value ? 0 : value === DELETE ? 4 : Array.isArray(value) ? -1 !== value.lastIndexOf('...') ? 2 : 1 : 'object' != typeof value || null === value || value.constructor && value.constructor !== Object ? 1 : 3, cleverMerge = (first, second)=>void 0 === second ? first : void 0 === first || 'object' != typeof second || null === second ? second : 'object' != typeof first || null === first ? first : _cleverMerge(first, second, !1), _cleverMerge = (first, second, internalCaching = !1)=>{
98
- let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
99
- if (void 0 !== firstDynamicInfo) {
100
- let { byProperty, fn } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
101
- fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
102
- let newFn = (...args)=>{
103
- let fnResult = fn(...args);
104
- return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
105
- };
106
- return newFn[DYNAMIC_INFO] = [
107
- fn,
108
- secondObj
109
- ], serializeObject(firstObject.static, {
110
- byProperty,
111
- fn: newFn
19
+ async function transform(source, options) {
20
+ let _options = JSON.stringify(options || {});
21
+ return _rspack_binding__rspack_import_0_default().transform(source, _options);
22
+ }
23
+ function transformSync(source, options) {
24
+ let _options = JSON.stringify(options || {});
25
+ return _rspack_binding__rspack_import_0_default().transformSync(source, _options);
26
+ }
27
+ },
28
+ "./src/util/cleverMerge.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
29
+ __webpack_require__.d(__webpack_exports__, {
30
+ ks: ()=>cleverMerge
112
31
  });
113
- }
114
- let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
115
- for (let [key, firstEntry] of firstInfo){
116
- let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
117
- resultInfo.set(key, entry);
118
- }
119
- for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
120
- return serializeObject(resultInfo, secondDynamicInfo);
121
- }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
122
- switch(getValueType(secondEntry.base)){
123
- case 1:
124
- case 4:
125
- return secondEntry;
126
- case 0:
127
- {
128
- if (!firstEntry.byProperty) return {
129
- base: firstEntry.base,
130
- byProperty: secondEntry.byProperty,
131
- byValues: secondEntry.byValues
32
+ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
33
+ if (void 0 === second) return first;
34
+ if (void 0 === first || 'object' != typeof second || null === second) return second;
35
+ if ('object' != typeof first || null === first) return first;
36
+ let innerCache = mergeCache.get(first);
37
+ void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
38
+ let prevMerge = innerCache.get(second);
39
+ if (void 0 !== prevMerge) return prevMerge;
40
+ let newMerge = _cleverMerge(first, second, !0);
41
+ return innerCache.set(second, newMerge), newMerge;
42
+ }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
43
+ let entry = parseCache.get(obj);
44
+ if (void 0 !== entry) return entry;
45
+ let result = parseObject(obj);
46
+ return parseCache.set(obj, result), result;
47
+ }, parseObject = (obj)=>{
48
+ let dynamicInfo, info = new Map(), getInfo = (p)=>{
49
+ let entry = info.get(p);
50
+ if (void 0 !== entry) return entry;
51
+ let newEntry = {
52
+ base: void 0,
53
+ byProperty: void 0,
54
+ byValues: new Map()
132
55
  };
133
- if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
134
- let newByValues = new Map(firstEntry.byValues);
135
- for (let [key, value] of secondEntry.byValues){
136
- let firstValue = getFromByValues(firstEntry.byValues, key);
137
- newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
56
+ return info.set(p, newEntry), newEntry;
57
+ };
58
+ for (let key of Object.keys(obj))if (key.startsWith('by')) {
59
+ let byObj = obj[key];
60
+ if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
61
+ let obj = byObj[byValue];
62
+ for (let key1 of Object.keys(obj)){
63
+ let entry = getInfo(key1);
64
+ if (void 0 === entry.byProperty) entry.byProperty = key;
65
+ else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
66
+ if (entry.byValues.set(byValue, obj[key1]), 'default' === byValue) for (let otherByValue of Object.keys(byObj))entry.byValues.has(otherByValue) || entry.byValues.set(otherByValue, void 0);
67
+ }
138
68
  }
139
- return {
140
- base: firstEntry.base,
141
- byProperty: firstEntry.byProperty,
142
- byValues: newByValues
69
+ else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
70
+ byProperty: key,
71
+ fn: byObj
143
72
  };
73
+ else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
74
+ else getInfo(key).base = obj[key];
75
+ } else getInfo(key).base = obj[key];
76
+ return {
77
+ static: info,
78
+ dynamic: dynamicInfo
79
+ };
80
+ }, serializeObject = (info, dynamicInfo)=>{
81
+ let obj = {};
82
+ for (let entry of info.values())if (void 0 !== entry.byProperty) {
83
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
84
+ for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
144
85
  }
145
- default:
146
- {
147
- let newBase;
148
- if (!firstEntry.byProperty) return {
149
- base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
150
- byProperty: secondEntry.byProperty,
151
- byValues: secondEntry.byValues
152
- };
153
- let intermediateByValues = new Map(firstEntry.byValues);
154
- for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
155
- if (Array.from(firstEntry.byValues.values()).every((value)=>{
156
- let type = getValueType(value);
157
- return 1 === type || 4 === type;
158
- }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
159
- base: newBase,
160
- byProperty: firstEntry.byProperty,
161
- byValues: intermediateByValues
162
- };
163
- if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
164
- let newByValues = new Map(intermediateByValues);
165
- for (let [key, value] of secondEntry.byValues){
166
- let firstValue = getFromByValues(intermediateByValues, key);
167
- newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
86
+ for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
87
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
88
+ for (let byValue of Object.keys(byObj)){
89
+ let value = getFromByValues(entry.byValues, byValue);
90
+ void 0 !== value && (byObj[byValue][key] = value);
168
91
  }
169
- return {
170
- base: newBase,
171
- byProperty: firstEntry.byProperty,
172
- byValues: newByValues
92
+ }
93
+ return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
94
+ }, getValueType = (value)=>void 0 === value ? 0 : value === DELETE ? 4 : Array.isArray(value) ? -1 !== value.lastIndexOf('...') ? 2 : 1 : 'object' != typeof value || null === value || value.constructor && value.constructor !== Object ? 1 : 3, cleverMerge = (first, second)=>void 0 === second ? first : void 0 === first || 'object' != typeof second || null === second ? second : 'object' != typeof first || null === first ? first : _cleverMerge(first, second, !1), _cleverMerge = (first, second, internalCaching = !1)=>{
95
+ let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
96
+ if (void 0 !== firstDynamicInfo) {
97
+ let { byProperty, fn } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
98
+ fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
99
+ let newFn = (...args)=>{
100
+ let fnResult = fn(...args);
101
+ return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
173
102
  };
103
+ return newFn[DYNAMIC_INFO] = [
104
+ fn,
105
+ secondObj
106
+ ], serializeObject(firstObject.static, {
107
+ byProperty,
108
+ fn: newFn
109
+ });
174
110
  }
175
- }
176
- }, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
177
- let bType = getValueType(b), aType = getValueType(a);
178
- switch(bType){
179
- case 4:
180
- case 1:
181
- return b;
182
- case 3:
183
- return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
184
- case 0:
185
- return a;
186
- case 2:
187
- switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
188
- case 0:
189
- return b;
111
+ let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
112
+ for (let [key, firstEntry] of firstInfo){
113
+ let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
114
+ resultInfo.set(key, entry);
115
+ }
116
+ for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
117
+ return serializeObject(resultInfo, secondDynamicInfo);
118
+ }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
119
+ switch(getValueType(secondEntry.base)){
120
+ case 1:
190
121
  case 4:
191
- return b.filter((item)=>'...' !== item);
192
- case 2:
122
+ return secondEntry;
123
+ case 0:
124
+ {
125
+ if (!firstEntry.byProperty) return {
126
+ base: firstEntry.base,
127
+ byProperty: secondEntry.byProperty,
128
+ byValues: secondEntry.byValues
129
+ };
130
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
131
+ let newByValues = new Map(firstEntry.byValues);
132
+ for (let [key, value] of secondEntry.byValues){
133
+ let firstValue = getFromByValues(firstEntry.byValues, key);
134
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
135
+ }
136
+ return {
137
+ base: firstEntry.base,
138
+ byProperty: firstEntry.byProperty,
139
+ byValues: newByValues
140
+ };
141
+ }
142
+ default:
193
143
  {
194
- let newArray = [];
195
- for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
196
- else newArray.push(item);
197
- return newArray;
144
+ let newBase;
145
+ if (!firstEntry.byProperty) return {
146
+ base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
147
+ byProperty: secondEntry.byProperty,
148
+ byValues: secondEntry.byValues
149
+ };
150
+ let intermediateByValues = new Map(firstEntry.byValues);
151
+ for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
152
+ if (Array.from(firstEntry.byValues.values()).every((value)=>{
153
+ let type = getValueType(value);
154
+ return 1 === type || 4 === type;
155
+ }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
156
+ base: newBase,
157
+ byProperty: firstEntry.byProperty,
158
+ byValues: intermediateByValues
159
+ };
160
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
161
+ let newByValues = new Map(intermediateByValues);
162
+ for (let [key, value] of secondEntry.byValues){
163
+ let firstValue = getFromByValues(intermediateByValues, key);
164
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
165
+ }
166
+ return {
167
+ base: newBase,
168
+ byProperty: firstEntry.byProperty,
169
+ byValues: newByValues
170
+ };
198
171
  }
172
+ }
173
+ }, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
174
+ let bType = getValueType(b), aType = getValueType(a);
175
+ switch(bType){
176
+ case 4:
177
+ case 1:
178
+ return b;
199
179
  case 3:
200
- return b.map((item)=>'...' === item ? a : item);
180
+ return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
181
+ case 0:
182
+ return a;
183
+ case 2:
184
+ switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
185
+ case 0:
186
+ return b;
187
+ case 4:
188
+ return b.filter((item)=>'...' !== item);
189
+ case 2:
190
+ {
191
+ let newArray = [];
192
+ for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
193
+ else newArray.push(item);
194
+ return newArray;
195
+ }
196
+ case 3:
197
+ return b.map((item)=>'...' === item ? a : item);
198
+ default:
199
+ throw Error('Not implemented');
200
+ }
201
201
  default:
202
202
  throw Error('Not implemented');
203
203
  }
204
- default:
205
- throw Error('Not implemented');
206
- }
207
- };
208
- class WebpackError extends Error {
209
- loc;
210
- file;
211
- chunk;
212
- module;
213
- details;
214
- hideStack;
215
- }
216
- Object.defineProperty(WebpackError.prototype, inspect.custom, {
217
- value: function() {
218
- return this.stack + (this.details ? `\n${this.details}` : '');
204
+ };
219
205
  },
220
- enumerable: !1,
221
- configurable: !0
222
- });
223
- let lib_WebpackError = WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
224
- function createMessage(method) {
225
- return `Abstract method${method ? ` ${method}` : ''}. Must be overridden.`;
226
- }
227
- class Message extends Error {
228
- constructor(){
229
- super(), this.stack = void 0, Error.captureStackTrace(this);
230
- let match = this.stack.split('\n')[3].match(CURRENT_METHOD_REGEXP);
231
- this.message = match?.[1] ? createMessage(match[1]) : createMessage();
232
- }
233
- }
234
- class AbstractMethodError extends lib_WebpackError {
235
- constructor(){
236
- super(new Message().message), this.name = 'AbstractMethodError';
237
- }
238
- }
239
- class Hash {
240
- update() {
241
- throw new AbstractMethodError();
242
- }
243
- digest() {
244
- throw new AbstractMethodError();
245
- }
246
- }
247
- let MAX_SHORT_STRING = -4 & Math.floor(16368);
248
- class WasmHash {
249
- exports;
250
- instancesPool;
251
- buffered;
252
- mem;
253
- chunkSize;
254
- digestSize;
255
- constructor(instance, instancesPool, chunkSize, digestSize){
256
- let exports = instance.exports;
257
- exports.init(), this.exports = exports, this.mem = Buffer.from(exports.memory.buffer, 0, 65536), this.buffered = 0, this.instancesPool = instancesPool, this.chunkSize = chunkSize, this.digestSize = digestSize;
258
- }
259
- reset() {
260
- this.buffered = 0, this.exports.init();
261
- }
262
- update(data, encoding) {
263
- if ('string' == typeof data) {
264
- let normalizedData = data;
265
- for(; normalizedData.length > MAX_SHORT_STRING;)this._updateWithShortString(normalizedData.slice(0, MAX_SHORT_STRING), encoding), normalizedData = normalizedData.slice(MAX_SHORT_STRING);
266
- return this._updateWithShortString(normalizedData, encoding), this;
206
+ "./src/util/createHash.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
207
+ let createMd4, createXxhash64;
208
+ __webpack_require__.d(__webpack_exports__, {
209
+ n: ()=>createHash_createHash
210
+ });
211
+ var external_node_util_ = __webpack_require__("node:util");
212
+ class WebpackError extends Error {
213
+ loc;
214
+ file;
215
+ chunk;
216
+ module;
217
+ details;
218
+ hideStack;
267
219
  }
268
- return this._updateWithBuffer(data), this;
269
- }
270
- _updateWithShortString(data, encoding) {
271
- let endPos, { exports, buffered, mem, chunkSize } = this;
272
- if (data.length < 70) if (encoding && 'utf-8' !== encoding && 'utf8' !== encoding) if ('latin1' === encoding) {
273
- endPos = buffered;
274
- for(let i = 0; i < data.length; i++){
275
- let cc = data.charCodeAt(i);
276
- mem[endPos++] = cc;
277
- }
278
- } else endPos = buffered + mem.write(data, buffered, encoding);
279
- else {
280
- endPos = buffered;
281
- for(let i = 0; i < data.length; i++){
282
- let cc = data.charCodeAt(i);
283
- if (cc < 0x80) mem[endPos++] = cc;
284
- else if (cc < 0x800) mem[endPos] = cc >> 6 | 0xc0, mem[endPos + 1] = 0x3f & cc | 0x80, endPos += 2;
220
+ Object.defineProperty(WebpackError.prototype, external_node_util_.inspect.custom, {
221
+ value: function() {
222
+ return this.stack + (this.details ? `\n${this.details}` : '');
223
+ },
224
+ enumerable: !1,
225
+ configurable: !0
226
+ });
227
+ let lib_WebpackError = WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
228
+ function createMessage(method) {
229
+ return `Abstract method${method ? ` ${method}` : ''}. Must be overridden.`;
230
+ }
231
+ class Message extends Error {
232
+ constructor(){
233
+ super(), this.stack = void 0, Error.captureStackTrace(this);
234
+ const match = this.stack.split('\n')[3].match(CURRENT_METHOD_REGEXP);
235
+ this.message = match?.[1] ? createMessage(match[1]) : createMessage();
236
+ }
237
+ }
238
+ class AbstractMethodError extends lib_WebpackError {
239
+ constructor(){
240
+ super(new Message().message), this.name = 'AbstractMethodError';
241
+ }
242
+ }
243
+ class Hash {
244
+ update() {
245
+ throw new AbstractMethodError();
246
+ }
247
+ digest() {
248
+ throw new AbstractMethodError();
249
+ }
250
+ }
251
+ let MAX_SHORT_STRING = -4 & Math.floor(16368);
252
+ class WasmHash {
253
+ exports;
254
+ instancesPool;
255
+ buffered;
256
+ mem;
257
+ chunkSize;
258
+ digestSize;
259
+ constructor(instance, instancesPool, chunkSize, digestSize){
260
+ const exports1 = instance.exports;
261
+ exports1.init(), this.exports = exports1, this.mem = Buffer.from(exports1.memory.buffer, 0, 65536), this.buffered = 0, this.instancesPool = instancesPool, this.chunkSize = chunkSize, this.digestSize = digestSize;
262
+ }
263
+ reset() {
264
+ this.buffered = 0, this.exports.init();
265
+ }
266
+ update(data, encoding) {
267
+ if ('string' == typeof data) {
268
+ let normalizedData = data;
269
+ for(; normalizedData.length > MAX_SHORT_STRING;)this._updateWithShortString(normalizedData.slice(0, MAX_SHORT_STRING), encoding), normalizedData = normalizedData.slice(MAX_SHORT_STRING);
270
+ return this._updateWithShortString(normalizedData, encoding), this;
271
+ }
272
+ return this._updateWithBuffer(data), this;
273
+ }
274
+ _updateWithShortString(data, encoding) {
275
+ let endPos, { exports: exports1, buffered, mem, chunkSize } = this;
276
+ if (data.length < 70) if (encoding && 'utf-8' !== encoding && 'utf8' !== encoding) if ('latin1' === encoding) {
277
+ endPos = buffered;
278
+ for(let i = 0; i < data.length; i++){
279
+ let cc = data.charCodeAt(i);
280
+ mem[endPos++] = cc;
281
+ }
282
+ } else endPos = buffered + mem.write(data, buffered, encoding);
283
+ else {
284
+ endPos = buffered;
285
+ for(let i = 0; i < data.length; i++){
286
+ let cc = data.charCodeAt(i);
287
+ if (cc < 0x80) mem[endPos++] = cc;
288
+ else if (cc < 0x800) mem[endPos] = cc >> 6 | 0xc0, mem[endPos + 1] = 0x3f & cc | 0x80, endPos += 2;
289
+ else {
290
+ endPos += mem.write(data.slice(i), endPos, encoding);
291
+ break;
292
+ }
293
+ }
294
+ }
295
+ else endPos = buffered + mem.write(data, buffered, encoding);
296
+ if (endPos < chunkSize) this.buffered = endPos;
297
+ else {
298
+ let l = endPos & ~(this.chunkSize - 1);
299
+ exports1.update(l);
300
+ let newBuffered = endPos - l;
301
+ this.buffered = newBuffered, newBuffered > 0 && mem.copyWithin(0, l, endPos);
302
+ }
303
+ }
304
+ _updateWithBuffer(data) {
305
+ let { exports: exports1, buffered, mem } = this, length = data.length;
306
+ if (buffered + length < this.chunkSize) data.copy(mem, buffered, 0, length), this.buffered += length;
285
307
  else {
286
- endPos += mem.write(data.slice(i), endPos, encoding);
287
- break;
308
+ let l = buffered + length & ~(this.chunkSize - 1);
309
+ if (l > 65536) {
310
+ let i = 65536 - buffered;
311
+ data.copy(mem, buffered, 0, i), exports1.update(65536);
312
+ let stop = l - buffered - 65536;
313
+ for(; i < stop;)data.copy(mem, 0, i, i + 65536), exports1.update(65536), i += 65536;
314
+ data.copy(mem, 0, i, l - buffered), exports1.update(l - buffered - i);
315
+ } else data.copy(mem, buffered, 0, l - buffered), exports1.update(l);
316
+ let newBuffered = length + buffered - l;
317
+ this.buffered = newBuffered, newBuffered > 0 && data.copy(mem, 0, length - newBuffered, length);
288
318
  }
289
319
  }
320
+ digest(type) {
321
+ let { exports: exports1, buffered, mem, digestSize } = this;
322
+ exports1.final(buffered), this.instancesPool.push(this);
323
+ let hex = mem.toString('latin1', 0, digestSize);
324
+ return 'hex' === type ? hex : 'binary' !== type && type ? Buffer.from(hex, 'hex').toString(type) : Buffer.from(hex, 'hex');
325
+ }
290
326
  }
291
- else endPos = buffered + mem.write(data, buffered, encoding);
292
- if (endPos < chunkSize) this.buffered = endPos;
293
- else {
294
- let l = endPos & ~(this.chunkSize - 1);
295
- exports.update(l);
296
- let newBuffered = endPos - l;
297
- this.buffered = newBuffered, newBuffered > 0 && mem.copyWithin(0, l, endPos);
327
+ let wasm_hash = (wasmModule, instancesPool, chunkSize, digestSize)=>{
328
+ if (instancesPool.length > 0) {
329
+ let old = instancesPool.pop();
330
+ return old.reset(), old;
331
+ }
332
+ return new WasmHash(new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize);
333
+ }, digestCaches = {};
334
+ class BulkUpdateDecorator extends Hash {
335
+ hash;
336
+ hashFactory;
337
+ hashKey;
338
+ buffer;
339
+ constructor(hashOrFactory, hashKey){
340
+ super(), this.hashKey = hashKey, 'function' == typeof hashOrFactory ? (this.hashFactory = hashOrFactory, this.hash = void 0) : (this.hashFactory = void 0, this.hash = hashOrFactory), this.buffer = '';
341
+ }
342
+ update(data, inputEncoding) {
343
+ return void 0 !== inputEncoding || 'string' != typeof data || data.length > 2000 ? (void 0 === this.hash && (this.hash = this.hashFactory()), this.buffer.length > 0 && (this.hash.update(Buffer.from(this.buffer)), this.buffer = ''), Buffer.isBuffer(data) ? this.hash.update(data) : this.hash.update(data, inputEncoding)) : (this.buffer += data, this.buffer.length > 2000 && (void 0 === this.hash && (this.hash = this.hashFactory()), this.hash.update(Buffer.from(this.buffer)), this.buffer = '')), this;
344
+ }
345
+ digest(encoding) {
346
+ let digestCache, buffer = this.buffer;
347
+ if (void 0 === this.hash) {
348
+ let cacheKey = `${this.hashKey}-${encoding}`;
349
+ void 0 === (digestCache = digestCaches[cacheKey]) && (digestCache = digestCaches[cacheKey] = new Map());
350
+ let cacheEntry = digestCache.get(buffer);
351
+ if (void 0 !== cacheEntry) return encoding ? cacheEntry : Buffer.from(cacheEntry, 'hex');
352
+ this.hash = this.hashFactory();
353
+ }
354
+ buffer.length > 0 && this.hash.update(Buffer.from(buffer));
355
+ let result = encoding ? this.hash.digest(encoding) : this.hash.digest();
356
+ return void 0 !== digestCache && 'string' == typeof result && digestCache.set(buffer, result), result;
357
+ }
298
358
  }
299
- }
300
- _updateWithBuffer(data) {
301
- let { exports, buffered, mem } = this, length = data.length;
302
- if (buffered + length < this.chunkSize) data.copy(mem, buffered, 0, length), this.buffered += length;
303
- else {
304
- let l = buffered + length & ~(this.chunkSize - 1);
305
- if (l > 65536) {
306
- let i = 65536 - buffered;
307
- data.copy(mem, buffered, 0, i), exports.update(65536);
308
- let stop = l - buffered - 65536;
309
- for(; i < stop;)data.copy(mem, 0, i, i + 65536), exports.update(65536), i += 65536;
310
- data.copy(mem, 0, i, l - buffered), exports.update(l - buffered - i);
311
- } else data.copy(mem, buffered, 0, l - buffered), exports.update(l);
312
- let newBuffered = length + buffered - l;
313
- this.buffered = newBuffered, newBuffered > 0 && data.copy(mem, 0, length - newBuffered, length);
359
+ class DebugHash extends Hash {
360
+ string;
361
+ constructor(){
362
+ super(), this.string = '';
363
+ }
364
+ update(data) {
365
+ let normalizedData;
366
+ return (normalizedData = Buffer.isBuffer(data) ? data.toString('utf-8') : data).startsWith('debug-digest-') && (normalizedData = Buffer.from(normalizedData.slice(13), 'hex').toString()), this.string += `[${normalizedData}](${Error().stack?.split('\n', 3)[2]})\n`, this;
367
+ }
368
+ digest(encoding) {
369
+ let result = `debug-digest-${Buffer.from(this.string).toString('hex')}`;
370
+ return encoding ? result : Buffer.from(result);
371
+ }
314
372
  }
315
- }
316
- digest(type) {
317
- let { exports, buffered, mem, digestSize } = this;
318
- exports.final(buffered), this.instancesPool.push(this);
319
- let hex = mem.toString('latin1', 0, digestSize);
320
- return 'hex' === type ? hex : 'binary' !== type && type ? Buffer.from(hex, 'hex').toString(type) : Buffer.from(hex, 'hex');
321
- }
322
- }
323
- let wasm_hash = (wasmModule, instancesPool, chunkSize, digestSize)=>{
324
- if (instancesPool.length > 0) {
325
- let old = instancesPool.pop();
326
- return old.reset(), old;
327
- }
328
- return new WasmHash(new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize);
329
- }, createHash_require = createRequire(import.meta.url), digestCaches = {};
330
- class BulkUpdateDecorator extends Hash {
331
- hash;
332
- hashFactory;
333
- hashKey;
334
- buffer;
335
- constructor(hashOrFactory, hashKey){
336
- super(), this.hashKey = hashKey, 'function' == typeof hashOrFactory ? (this.hashFactory = hashOrFactory, this.hash = void 0) : (this.hashFactory = void 0, this.hash = hashOrFactory), this.buffer = '';
337
- }
338
- update(data, inputEncoding) {
339
- return void 0 !== inputEncoding || 'string' != typeof data || data.length > 2000 ? (void 0 === this.hash && (this.hash = this.hashFactory()), this.buffer.length > 0 && (this.hash.update(Buffer.from(this.buffer)), this.buffer = ''), Buffer.isBuffer(data) ? this.hash.update(data) : this.hash.update(data, inputEncoding)) : (this.buffer += data, this.buffer.length > 2000 && (void 0 === this.hash && (this.hash = this.hashFactory()), this.hash.update(Buffer.from(this.buffer)), this.buffer = '')), this;
340
- }
341
- digest(encoding) {
342
- let digestCache, buffer = this.buffer;
343
- if (void 0 === this.hash) {
344
- let cacheKey = `${this.hashKey}-${encoding}`;
345
- void 0 === (digestCache = digestCaches[cacheKey]) && (digestCache = digestCaches[cacheKey] = new Map());
346
- let cacheEntry = digestCache.get(buffer);
347
- if (void 0 !== cacheEntry) return encoding ? cacheEntry : Buffer.from(cacheEntry, 'hex');
348
- this.hash = this.hashFactory();
373
+ class WasmHashAdapter extends Hash {
374
+ wasmHash;
375
+ constructor(wasmHash){
376
+ super(), this.wasmHash = wasmHash;
377
+ }
378
+ update(data, inputEncoding) {
379
+ return Buffer.isBuffer(data) ? this.wasmHash.update(data) : this.wasmHash.update(data, inputEncoding), this;
380
+ }
381
+ digest(encoding) {
382
+ return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
383
+ }
349
384
  }
350
- buffer.length > 0 && this.hash.update(Buffer.from(buffer));
351
- let result = encoding ? this.hash.digest(encoding) : this.hash.digest();
352
- return void 0 !== digestCache && 'string' == typeof result && digestCache.set(buffer, result), result;
353
- }
354
- }
355
- class DebugHash extends Hash {
356
- string;
357
- constructor(){
358
- super(), this.string = '';
359
- }
360
- update(data) {
361
- let normalizedData;
362
- return (normalizedData = Buffer.isBuffer(data) ? data.toString('utf-8') : data).startsWith('debug-digest-') && (normalizedData = Buffer.from(normalizedData.slice(13), 'hex').toString()), this.string += `[${normalizedData}](${Error().stack?.split('\n', 3)[2]})\n`, this;
363
- }
364
- digest(encoding) {
365
- let result = `debug-digest-${Buffer.from(this.string).toString('hex')}`;
366
- return encoding ? result : Buffer.from(result);
367
- }
368
- }
369
- class WasmHashAdapter extends Hash {
370
- wasmHash;
371
- constructor(wasmHash){
372
- super(), this.wasmHash = wasmHash;
373
- }
374
- update(data, inputEncoding) {
375
- return Buffer.isBuffer(data) ? this.wasmHash.update(data) : this.wasmHash.update(data, inputEncoding), this;
376
- }
377
- digest(encoding) {
378
- return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
379
- }
380
- }
381
- let createHash_createHash = (algorithm)=>{
382
- if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
383
- switch(algorithm){
384
- case 'debug':
385
- return new DebugHash();
386
- case 'xxhash64':
387
- return new WasmHashAdapter((()=>{
388
- if (!createXxhash64) {
389
- let xxhash64 = new WebAssembly.Module(Buffer.from('AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL', 'base64'));
390
- createXxhash64 = wasm_hash.bind(null, xxhash64, [], 32, 16);
391
- }
392
- return createXxhash64();
393
- })());
394
- case 'md4':
395
- return new WasmHashAdapter((()=>{
396
- if (!createMd4) {
397
- let md4 = new WebAssembly.Module(Buffer.from('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', 'base64'));
398
- createMd4 = wasm_hash.bind(null, md4, [], 64, 32);
399
- }
400
- return createMd4();
401
- })());
402
- case 'native-md4':
403
- return new BulkUpdateDecorator(()=>{
404
- let { createHash } = createHash_require('node:crypto');
405
- return createHash('md4');
406
- }, 'md4');
407
- default:
408
- return new BulkUpdateDecorator(()=>{
409
- let { createHash } = createHash_require('node:crypto');
410
- return createHash(algorithm);
411
- }, algorithm);
412
- }
413
- }, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
414
- if ('/' === maybeAbsolutePath[0]) {
415
- if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
416
- let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
417
- return resource = relativePathToRequest(node_path.posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
418
- }
419
- if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
420
- let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
421
- return resource = node_path.win32.relative(context, resource), WINDOWS_ABS_PATH_REGEXP.test(resource) || (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
422
- }
423
- return maybeAbsolutePath;
424
- }, makeCacheable = (realFn)=>{
425
- let cache = new WeakMap(), getCache = (associatedObjectForCache)=>{
426
- let entry = cache.get(associatedObjectForCache);
427
- if (void 0 !== entry) return entry;
428
- let map = new Map();
429
- return cache.set(associatedObjectForCache, map), map;
430
- }, fn = (str, associatedObjectForCache)=>{
431
- if (!associatedObjectForCache) return realFn(str);
432
- let cache = getCache(associatedObjectForCache), entry = cache.get(str);
433
- if (void 0 !== entry) return entry;
434
- let result = realFn(str);
435
- return cache.set(str, result), result;
385
+ let createHash_createHash = (algorithm)=>{
386
+ if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
387
+ switch(algorithm){
388
+ case 'debug':
389
+ return new DebugHash();
390
+ case 'xxhash64':
391
+ return new WasmHashAdapter((()=>{
392
+ if (!createXxhash64) {
393
+ let xxhash64 = new WebAssembly.Module(Buffer.from('AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL', 'base64'));
394
+ createXxhash64 = wasm_hash.bind(null, xxhash64, [], 32, 16);
395
+ }
396
+ return createXxhash64();
397
+ })());
398
+ case 'md4':
399
+ return new WasmHashAdapter((()=>{
400
+ if (!createMd4) {
401
+ let md4 = new WebAssembly.Module(Buffer.from('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', 'base64'));
402
+ createMd4 = wasm_hash.bind(null, md4, [], 64, 32);
403
+ }
404
+ return createMd4();
405
+ })());
406
+ case 'native-md4':
407
+ return new BulkUpdateDecorator(()=>{
408
+ let { createHash } = __webpack_require__("node:crypto");
409
+ return createHash('md4');
410
+ }, 'md4');
411
+ default:
412
+ return new BulkUpdateDecorator(()=>{
413
+ let { createHash } = __webpack_require__("node:crypto");
414
+ return createHash(algorithm);
415
+ }, algorithm);
416
+ }
417
+ };
418
+ },
419
+ "@rspack/binding" (module) {
420
+ module.exports = require("@rspack/binding");
421
+ },
422
+ "node:crypto" (module) {
423
+ module.exports = require("node:crypto");
424
+ },
425
+ "node:fs" (module) {
426
+ module.exports = require("node:fs");
427
+ },
428
+ "node:os" (module) {
429
+ module.exports = require("node:os");
430
+ },
431
+ "node:url" (module) {
432
+ module.exports = require("node:url");
433
+ },
434
+ "node:util" (module) {
435
+ module.exports = require("node:util");
436
+ }
437
+ }, __webpack_module_cache__ = {};
438
+ function __webpack_require__(moduleId) {
439
+ var cachedModule = __webpack_module_cache__[moduleId];
440
+ if (void 0 !== cachedModule) return cachedModule.exports;
441
+ var module = __webpack_module_cache__[moduleId] = {
442
+ exports: {}
436
443
  };
437
- return fn.bindCache = (associatedObjectForCache)=>{
438
- let cache = getCache(associatedObjectForCache);
439
- return (str)=>{
440
- let entry = cache.get(str);
444
+ return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
445
+ }
446
+ __webpack_require__.n = (module)=>{
447
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
448
+ return __webpack_require__.d(getter, {
449
+ a: getter
450
+ }), getter;
451
+ }, __webpack_require__.d = (exports1, definition)=>{
452
+ for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
453
+ enumerable: !0,
454
+ get: definition[key]
455
+ });
456
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
457
+ "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
458
+ value: 'Module'
459
+ }), Object.defineProperty(exports1, '__esModule', {
460
+ value: !0
461
+ });
462
+ };
463
+ var __webpack_exports__ = {};
464
+ for(var __rspack_i in (()=>{
465
+ let url;
466
+ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
467
+ default: ()=>loader_runner_worker
468
+ });
469
+ let external_node_querystring_namespaceObject = require("node:querystring");
470
+ var external_node_querystring_default = __webpack_require__.n(external_node_querystring_namespaceObject), external_node_util_ = __webpack_require__("node:util");
471
+ let external_node_worker_threads_namespaceObject = require("node:worker_threads");
472
+ var binding_ = __webpack_require__("@rspack/binding"), createHash = __webpack_require__("./src/util/createHash.ts");
473
+ let external_node_path_namespaceObject = require("node:path");
474
+ var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
475
+ let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
476
+ if ('/' === maybeAbsolutePath[0]) {
477
+ if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
478
+ let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
479
+ return resource = relativePathToRequest(external_node_path_default().posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
480
+ }
481
+ if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
482
+ let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
483
+ return resource = external_node_path_default().win32.relative(context, resource), WINDOWS_ABS_PATH_REGEXP.test(resource) || (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
484
+ }
485
+ return maybeAbsolutePath;
486
+ }, makeCacheable = (realFn)=>{
487
+ let cache = new WeakMap(), getCache = (associatedObjectForCache)=>{
488
+ let entry = cache.get(associatedObjectForCache);
489
+ if (void 0 !== entry) return entry;
490
+ let map = new Map();
491
+ return cache.set(associatedObjectForCache, map), map;
492
+ }, fn = (str, associatedObjectForCache)=>{
493
+ if (!associatedObjectForCache) return realFn(str);
494
+ let cache = getCache(associatedObjectForCache), entry = cache.get(str);
441
495
  if (void 0 !== entry) return entry;
442
496
  let result = realFn(str);
443
497
  return cache.set(str, result), result;
444
498
  };
445
- }, fn;
446
- }, makeCacheableWithContext = (fn)=>{
447
- let cache = new WeakMap(), cachedFn = (context, identifier, associatedObjectForCache)=>{
448
- let cachedResult;
449
- if (!associatedObjectForCache) return fn(context, identifier);
450
- let innerCache = cache.get(associatedObjectForCache);
451
- void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache));
452
- let innerSubCache = innerCache.get(context);
453
- if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
454
- let result = fn(context, identifier);
455
- return innerSubCache.set(identifier, result), result;
456
- };
457
- return cachedFn.bindCache = (associatedObjectForCache)=>{
458
- let innerCache;
459
- return associatedObjectForCache ? void 0 === (innerCache = cache.get(associatedObjectForCache)) && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)) : innerCache = new Map(), (context, identifier)=>{
460
- let cachedResult, innerSubCache = innerCache?.get(context);
461
- if (void 0 === innerSubCache ? (innerSubCache = new Map(), innerCache?.set(context, innerSubCache)) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
462
- let result = fn(context, identifier);
463
- return innerSubCache.set(identifier, result), result;
464
- };
465
- }, cachedFn.bindContextCache = (context, associatedObjectForCache)=>{
466
- let innerSubCache;
467
- if (associatedObjectForCache) {
499
+ return fn.bindCache = (associatedObjectForCache)=>{
500
+ let cache = getCache(associatedObjectForCache);
501
+ return (str)=>{
502
+ let entry = cache.get(str);
503
+ if (void 0 !== entry) return entry;
504
+ let result = realFn(str);
505
+ return cache.set(str, result), result;
506
+ };
507
+ }, fn;
508
+ }, makeCacheableWithContext = (fn)=>{
509
+ let cache = new WeakMap(), cachedFn = (context, identifier, associatedObjectForCache)=>{
510
+ let cachedResult;
511
+ if (!associatedObjectForCache) return fn(context, identifier);
468
512
  let innerCache = cache.get(associatedObjectForCache);
469
- void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)), void 0 === (innerSubCache = innerCache.get(context)) && innerCache.set(context, innerSubCache = new Map());
470
- } else innerSubCache = new Map();
471
- return (identifier)=>{
472
- let cachedResult = innerSubCache?.get(identifier);
473
- if (void 0 !== cachedResult) return cachedResult;
513
+ void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache));
514
+ let innerSubCache = innerCache.get(context);
515
+ if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
474
516
  let result = fn(context, identifier);
475
- return innerSubCache?.set(identifier, result), result;
517
+ return innerSubCache.set(identifier, result), result;
476
518
  };
477
- }, cachedFn;
478
- };
479
- makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join(''));
480
- let contextify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>absoluteToRequest(context, r)).join('!')), absolutify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>r.startsWith('./') || r.startsWith('../') ? node_path.join(context, r) : r).join('!')), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
481
- makeCacheable((str)=>{
482
- let match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
483
- return {
484
- resource: str,
485
- path: match[1].replace(/\u200b(.)/g, '$1'),
486
- query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
487
- fragment: match[3] || ''
488
- };
489
- }), makeCacheable((str)=>{
490
- let match = PATH_QUERY_REGEXP.exec(str);
491
- return {
492
- resource: str,
493
- path: match[1].replace(/\u200b(.)/g, '$1'),
494
- query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
519
+ return cachedFn.bindCache = (associatedObjectForCache)=>{
520
+ let innerCache;
521
+ return associatedObjectForCache ? void 0 === (innerCache = cache.get(associatedObjectForCache)) && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)) : innerCache = new Map(), (context, identifier)=>{
522
+ let cachedResult, innerSubCache = innerCache?.get(context);
523
+ if (void 0 === innerSubCache ? (innerSubCache = new Map(), innerCache?.set(context, innerSubCache)) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
524
+ let result = fn(context, identifier);
525
+ return innerSubCache.set(identifier, result), result;
526
+ };
527
+ }, cachedFn.bindContextCache = (context, associatedObjectForCache)=>{
528
+ let innerSubCache;
529
+ if (associatedObjectForCache) {
530
+ let innerCache = cache.get(associatedObjectForCache);
531
+ void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)), void 0 === (innerSubCache = innerCache.get(context)) && innerCache.set(context, innerSubCache = new Map());
532
+ } else innerSubCache = new Map();
533
+ return (identifier)=>{
534
+ let cachedResult = innerSubCache?.get(identifier);
535
+ if (void 0 !== cachedResult) return cachedResult;
536
+ let result = fn(context, identifier);
537
+ return innerSubCache?.set(identifier, result), result;
538
+ };
539
+ }, cachedFn;
495
540
  };
496
- });
497
- let memoize = (fn)=>{
498
- let result, cache = !1, callback = fn;
499
- return ()=>(cache || (result = callback(), cache = !0, callback = void 0), result);
500
- }, LoaderLoadingError = class extends Error {
501
- constructor(message){
502
- super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
503
- }
504
- }, loadLoader_require = createRequire(import.meta.url);
505
- function loadLoader(loader, compiler, callback) {
506
- if ('module' === loader.type) try {
507
- void 0 === url && (url = loadLoader_require('node:url')), import(url.pathToFileURL(loader.path).toString()).then((module)=>{
508
- handleResult(loader, module, callback);
509
- }, callback);
510
- return;
511
- } catch (e) {
512
- callback(e);
513
- }
514
- else {
515
- let module;
516
- try {
517
- module = loadLoader_require(loader.path);
518
- } catch (e) {
519
- if (e instanceof Error && 'EMFILE' === e.code) return void setImmediate(loadLoader.bind(null, loader, compiler, callback));
520
- return callback(e);
541
+ makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join(''));
542
+ let contextify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>absoluteToRequest(context, r)).join('!')), absolutify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>{
543
+ var context1, relativePath;
544
+ return context1 = context, (relativePath = r).startsWith('./') || relativePath.startsWith('../') ? external_node_path_default().join(context1, relativePath) : relativePath;
545
+ }).join('!')), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
546
+ makeCacheable((str)=>{
547
+ let match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
548
+ return {
549
+ resource: str,
550
+ path: match[1].replace(/\u200b(.)/g, '$1'),
551
+ query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
552
+ fragment: match[3] || ''
553
+ };
554
+ }), makeCacheable((str)=>{
555
+ let match = PATH_QUERY_REGEXP.exec(str);
556
+ return {
557
+ resource: str,
558
+ path: match[1].replace(/\u200b(.)/g, '$1'),
559
+ query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
560
+ };
561
+ });
562
+ let memoize = (fn)=>{
563
+ let result, cache = !1, callback = fn;
564
+ return ()=>(cache || (result = callback(), cache = !0, callback = void 0), result);
565
+ }, LoaderLoadingError = class extends Error {
566
+ constructor(message){
567
+ super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
521
568
  }
522
- return handleResult(loader, module, callback);
523
- }
524
- }
525
- function handleResult(loader, module, callback) {
526
- return 'function' != typeof module && 'object' != typeof module ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (export function or es6 module)`)) : (loader.normal = 'function' == typeof module ? module : module.default, loader.pitch = module.pitch, loader.raw = module.raw, loader.pitch || (loader.noPitch = !0), 'function' != typeof loader.normal && 'function' != typeof loader.pitch) ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (must have normal or pitch function)`)) : void callback();
527
- }
528
- function isWorkerResponseMessage(message) {
529
- return 'response' === message.type;
530
- }
531
- function serializeError(error) {
532
- if (error instanceof Error || error && 'object' == typeof error && 'message' in error) return {
533
- ...error,
534
- name: error.name,
535
- stack: error.stack,
536
- message: error.message
537
- };
538
- if ('string' == typeof error) return {
539
- name: 'Error',
540
- message: error
541
569
  };
542
- throw Error('Failed to serialize error, only string, Error instances and objects with a message property are supported');
543
- }
544
- createRequire(import.meta.url);
545
- let decoder = new TextDecoder();
546
- promisify(loadLoader);
547
- let utils_runSyncOrAsync = promisify(function(fn, context, args, callback) {
548
- let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
549
- context.async = function() {
550
- if (isDone) {
551
- if (reportedError) return;
552
- throw Error('async(): The callback was already called.');
570
+ function loadLoader(loader, compiler, callback) {
571
+ if ('module' === loader.type) try {
572
+ void 0 === url && (url = __webpack_require__("node:url")), import(url.pathToFileURL(loader.path).toString()).then((module)=>{
573
+ handleResult(loader, module, callback);
574
+ }, callback);
575
+ return;
576
+ } catch (e) {
577
+ callback(e);
553
578
  }
554
- return isSync = !1, innerCallback;
555
- };
556
- let innerCallback = (err, ...args)=>{
557
- if (isDone) {
558
- if (reportedError) return;
559
- throw Error('callback(): The callback was already called.');
579
+ else {
580
+ let module;
581
+ try {
582
+ module = require(loader.path);
583
+ } catch (e) {
584
+ if (e instanceof Error && 'EMFILE' === e.code) return void setImmediate(loadLoader.bind(null, loader, compiler, callback));
585
+ return callback(e);
586
+ }
587
+ return handleResult(loader, module, callback);
560
588
  }
561
- isDone = !0, isSync = !1;
589
+ }
590
+ function handleResult(loader, module, callback) {
591
+ return 'function' != typeof module && 'object' != typeof module ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (export function or es6 module)`)) : (loader.normal = 'function' == typeof module ? module : module.default, loader.pitch = module.pitch, loader.raw = module.raw, loader.pitch || (loader.noPitch = !0), 'function' != typeof loader.normal && 'function' != typeof loader.pitch) ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (must have normal or pitch function)`)) : void callback();
592
+ }
593
+ function isWorkerResponseMessage(message) {
594
+ return 'response' === message.type;
595
+ }
596
+ function serializeError(error) {
597
+ if (error instanceof Error || error && 'object' == typeof error && 'message' in error) return {
598
+ ...error,
599
+ name: error.name,
600
+ stack: error.stack,
601
+ message: error.message
602
+ };
603
+ if ('string' == typeof error) return {
604
+ name: 'Error',
605
+ message: error
606
+ };
607
+ throw Error('Failed to serialize error, only string, Error instances and objects with a message property are supported');
608
+ }
609
+ let decoder = new TextDecoder();
610
+ (0, external_node_util_.promisify)(loadLoader);
611
+ let utils_runSyncOrAsync = (0, external_node_util_.promisify)(function(fn, context, args, callback) {
612
+ let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
613
+ context.async = function() {
614
+ if (isDone) {
615
+ if (reportedError) return;
616
+ throw Error('async(): The callback was already called.');
617
+ }
618
+ return isSync = !1, innerCallback;
619
+ };
620
+ let innerCallback = (err, ...args)=>{
621
+ if (isDone) {
622
+ if (reportedError) return;
623
+ throw Error('callback(): The callback was already called.');
624
+ }
625
+ isDone = !0, isSync = !1;
626
+ try {
627
+ callback(err, args);
628
+ } catch (e) {
629
+ throw isError = !0, e;
630
+ }
631
+ };
632
+ context.callback = innerCallback;
562
633
  try {
563
- callback(err, args);
564
- } catch (e) {
565
- throw isError = !0, e;
566
- }
567
- };
568
- context.callback = innerCallback;
569
- try {
570
- let result = fn.apply(context, args);
571
- if (isSync) {
572
- if (isDone = !0, void 0 === result) return void callback(null, []);
573
- if (result && 'object' == typeof result && 'function' == typeof result.then) return void result.then((r)=>{
634
+ let result = fn.apply(context, args);
635
+ if (isSync) {
636
+ if (isDone = !0, void 0 === result) return void callback(null, []);
637
+ if (result && 'object' == typeof result && 'function' == typeof result.then) return void result.then((r)=>{
638
+ callback(null, [
639
+ r
640
+ ]);
641
+ }, callback);
574
642
  callback(null, [
575
- r
643
+ result
576
644
  ]);
577
- }, callback);
578
- callback(null, [
579
- result
580
- ]);
581
- return;
645
+ return;
646
+ }
647
+ } catch (e) {
648
+ if ('hideStack' in e && e.hideStack && (e.hideStack = 'true'), isError) throw e;
649
+ if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
650
+ isDone = !0, reportedError = !0, callback(e, []);
582
651
  }
583
- } catch (e) {
584
- if ('hideStack' in e && e.hideStack && (e.hideStack = 'true'), isError) throw e;
585
- if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
586
- isDone = !0, reportedError = !0, callback(e, []);
587
- }
588
- }), loadLoaderAsync = promisify(loadLoader);
589
- async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, waitForPendingRequest) {
590
- let resourcePath = loaderContext.resourcePath, contextDirectory = resourcePath ? function(path) {
591
- if ('/' === path) return '/';
592
- let i = path.lastIndexOf('/'), j = path.lastIndexOf('\\'), i2 = path.indexOf('/'), j2 = path.indexOf('\\'), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
593
- return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
594
- }(resourcePath) : null, pendingDependencyRequest = [];
595
- loaderContext.parallel = !0, loaderContext.dependency = loaderContext.addDependency = function(file) {
596
- pendingDependencyRequest.push(sendRequest("AddDependency", file));
597
- }, loaderContext.addContextDependency = function(context) {
598
- pendingDependencyRequest.push(sendRequest("AddContextDependency", context));
599
- }, loaderContext.addBuildDependency = function(file) {
600
- pendingDependencyRequest.push(sendRequest("AddBuildDependency", file));
601
- }, loaderContext.getDependencies = function() {
602
- return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetDependencies").wait();
603
- }, loaderContext.getContextDependencies = function() {
604
- return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetContextDependencies").wait();
605
- }, loaderContext.getMissingDependencies = function() {
606
- return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetMissingDependencies").wait();
607
- }, loaderContext.clearDependencies = function() {
608
- pendingDependencyRequest.push(sendRequest("ClearDependencies"));
609
- }, loaderContext.resolve = function(context, request, callback) {
610
- sendRequest("Resolve", context, request).then((result)=>{
611
- callback(null, result);
612
- }, (err)=>{
613
- callback(err);
614
- });
615
- }, loaderContext.getResolve = function(options) {
616
- return (context, request, callback)=>{
617
- if (!callback) return new Promise((resolve, reject)=>{
652
+ }), loadLoaderAsync = (0, external_node_util_.promisify)(loadLoader);
653
+ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, waitForPendingRequest) {
654
+ let resourcePath = loaderContext.resourcePath, contextDirectory = resourcePath ? function(path) {
655
+ if ('/' === path) return '/';
656
+ let i = path.lastIndexOf('/'), j = path.lastIndexOf('\\'), i2 = path.indexOf('/'), j2 = path.indexOf('\\'), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
657
+ return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
658
+ }(resourcePath) : null, pendingDependencyRequest = [];
659
+ loaderContext.parallel = !0, loaderContext.dependency = loaderContext.addDependency = function(file) {
660
+ pendingDependencyRequest.push(sendRequest("AddDependency", file));
661
+ }, loaderContext.addContextDependency = function(context) {
662
+ pendingDependencyRequest.push(sendRequest("AddContextDependency", context));
663
+ }, loaderContext.addBuildDependency = function(file) {
664
+ pendingDependencyRequest.push(sendRequest("AddBuildDependency", file));
665
+ }, loaderContext.getDependencies = function() {
666
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetDependencies").wait();
667
+ }, loaderContext.getContextDependencies = function() {
668
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetContextDependencies").wait();
669
+ }, loaderContext.getMissingDependencies = function() {
670
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetMissingDependencies").wait();
671
+ }, loaderContext.clearDependencies = function() {
672
+ pendingDependencyRequest.push(sendRequest("ClearDependencies"));
673
+ }, loaderContext.resolve = function(context, request, callback) {
674
+ sendRequest("Resolve", context, request).then((result)=>{
675
+ callback(null, result);
676
+ }, (err)=>{
677
+ callback(err);
678
+ });
679
+ }, loaderContext.getResolve = function(options) {
680
+ return (context, request, callback)=>{
681
+ if (!callback) return new Promise((resolve, reject)=>{
682
+ sendRequest("GetResolve", options, context, request).then((result)=>{
683
+ resolve(result);
684
+ }, (err)=>{
685
+ reject(err);
686
+ });
687
+ });
618
688
  sendRequest("GetResolve", options, context, request).then((result)=>{
689
+ callback(null, result);
690
+ }, (err)=>{
691
+ callback(err);
692
+ });
693
+ };
694
+ }, loaderContext.getLogger = function(name) {
695
+ return {
696
+ error (...args) {
697
+ sendRequest("GetLogger", 'error', name, args);
698
+ },
699
+ warn (...args) {
700
+ sendRequest("GetLogger", 'warn', name, args);
701
+ },
702
+ info (...args) {
703
+ sendRequest("GetLogger", 'info', name, args);
704
+ },
705
+ log (...args) {
706
+ sendRequest("GetLogger", 'log', name, args);
707
+ },
708
+ debug (...args) {
709
+ sendRequest("GetLogger", 'debug', name, args);
710
+ },
711
+ assert (assertion, ...args) {
712
+ assertion || sendRequest("GetLogger", 'error', name, args);
713
+ },
714
+ trace () {
715
+ sendRequest("GetLogger", 'trace', name, [
716
+ 'Trace'
717
+ ]);
718
+ },
719
+ clear () {
720
+ sendRequest("GetLogger", 'clear', name);
721
+ },
722
+ status (...args) {
723
+ sendRequest("GetLogger", 'status', name, args);
724
+ },
725
+ group (...args) {
726
+ sendRequest("GetLogger", 'group', name, args);
727
+ },
728
+ groupCollapsed (...args) {
729
+ sendRequest("GetLogger", 'groupCollapsed', name, args);
730
+ },
731
+ groupEnd (...args) {
732
+ sendRequest("GetLogger", 'groupEnd', name, args);
733
+ },
734
+ profile (label) {
735
+ sendRequest("GetLogger", 'profile', name, [
736
+ label
737
+ ]);
738
+ },
739
+ profileEnd (label) {
740
+ sendRequest("GetLogger", 'profileEnd', name, [
741
+ label
742
+ ]);
743
+ },
744
+ time (label) {
745
+ sendRequest("GetLogger", 'time', name, [
746
+ label
747
+ ]);
748
+ },
749
+ timeEnd (label) {
750
+ sendRequest("GetLogger", 'timeEnd', name, [
751
+ label
752
+ ]);
753
+ },
754
+ timeLog (label, ...args) {
755
+ sendRequest("GetLogger", 'timeLog', name, [
756
+ label,
757
+ ...args
758
+ ]);
759
+ },
760
+ timeAggregate (label) {
761
+ sendRequest("GetLogger", 'timeAggregate', name, [
762
+ label
763
+ ]);
764
+ },
765
+ timeAggregateEnd (label) {
766
+ sendRequest("GetLogger", 'timeAggregateEnd', name, [
767
+ label
768
+ ]);
769
+ }
770
+ };
771
+ }, loaderContext.emitError = function(err) {
772
+ sendRequest("EmitError", serializeError(err));
773
+ }, loaderContext.emitWarning = function(warning) {
774
+ sendRequest("EmitWarning", serializeError(warning));
775
+ }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
776
+ sendRequest("EmitFile", name, content, sourceMap, assetInfo);
777
+ }, loaderContext.experiments = {
778
+ emitDiagnostic (diagnostic) {
779
+ sendRequest("EmitDiagnostic", diagnostic);
780
+ }
781
+ };
782
+ let getAbsolutify = memoize(()=>absolutify.bindCache({})), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, {})), getContextify = memoize(()=>contextify.bindCache({})), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, {}));
783
+ loaderContext.utils = {
784
+ absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
785
+ contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
786
+ createHash: (type)=>(0, createHash.n)(type || loaderContext._compilation.outputOptions.hashFunction)
787
+ }, loaderContext._compiler = {
788
+ ...loaderContext._compiler,
789
+ rspack: {
790
+ experiments: {
791
+ swc: __webpack_require__("./src/swc.ts")
792
+ }
793
+ },
794
+ webpack: {
795
+ util: {
796
+ createHash: __webpack_require__("./src/util/createHash.ts").n,
797
+ cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").ks
798
+ }
799
+ }
800
+ }, loaderContext._compilation = {
801
+ ...loaderContext._compilation,
802
+ getPath: (filename, data)=>sendRequest("CompilationGetPath", filename, data).wait(),
803
+ getPathWithInfo: (filename, data)=>sendRequest("CompilationGetPathWithInfo", filename, data).wait(),
804
+ getAssetPath: (filename, data)=>sendRequest("CompilationGetAssetPath", filename, data).wait(),
805
+ getAssetPathWithInfo: (filename, data)=>sendRequest("CompilationGetAssetPathWithInfo", filename, data).wait()
806
+ };
807
+ let _module = loaderContext._module;
808
+ loaderContext._module = {
809
+ type: _module.type,
810
+ identifier: ()=>_module.identifier,
811
+ matchResource: _module.matchResource,
812
+ request: _module.request,
813
+ userRequest: _module.userRequest,
814
+ rawRequest: _module.rawRequest
815
+ }, loaderContext.importModule = function(request, options, callback) {
816
+ if (!callback) return new Promise((resolve, reject)=>{
817
+ sendRequest("ImportModule", request, options).then((result)=>{
619
818
  resolve(result);
620
819
  }, (err)=>{
621
820
  reject(err);
622
821
  });
623
822
  });
624
- sendRequest("GetResolve", options, context, request).then((result)=>{
823
+ sendRequest("ImportModule", request, options).then((result)=>{
625
824
  callback(null, result);
626
825
  }, (err)=>{
627
826
  callback(err);
628
827
  });
629
- };
630
- }, loaderContext.getLogger = function(name) {
631
- return {
632
- error (...args) {
633
- sendRequest("GetLogger", 'error', name, args);
634
- },
635
- warn (...args) {
636
- sendRequest("GetLogger", 'warn', name, args);
637
- },
638
- info (...args) {
639
- sendRequest("GetLogger", 'info', name, args);
640
- },
641
- log (...args) {
642
- sendRequest("GetLogger", 'log', name, args);
643
- },
644
- debug (...args) {
645
- sendRequest("GetLogger", 'debug', name, args);
646
- },
647
- assert (assertion, ...args) {
648
- assertion || sendRequest("GetLogger", 'error', name, args);
649
- },
650
- trace () {
651
- sendRequest("GetLogger", 'trace', name, [
652
- 'Trace'
653
- ]);
654
- },
655
- clear () {
656
- sendRequest("GetLogger", 'clear', name);
657
- },
658
- status (...args) {
659
- sendRequest("GetLogger", 'status', name, args);
660
- },
661
- group (...args) {
662
- sendRequest("GetLogger", 'group', name, args);
663
- },
664
- groupCollapsed (...args) {
665
- sendRequest("GetLogger", 'groupCollapsed', name, args);
666
- },
667
- groupEnd (...args) {
668
- sendRequest("GetLogger", 'groupEnd', name, args);
669
- },
670
- profile (label) {
671
- sendRequest("GetLogger", 'profile', name, [
672
- label
673
- ]);
674
- },
675
- profileEnd (label) {
676
- sendRequest("GetLogger", 'profileEnd', name, [
677
- label
678
- ]);
679
- },
680
- time (label) {
681
- sendRequest("GetLogger", 'time', name, [
682
- label
683
- ]);
684
- },
685
- timeEnd (label) {
686
- sendRequest("GetLogger", 'timeEnd', name, [
687
- label
688
- ]);
689
- },
690
- timeLog (label, ...args) {
691
- sendRequest("GetLogger", 'timeLog', name, [
692
- label,
693
- ...args
694
- ]);
695
- },
696
- timeAggregate (label) {
697
- sendRequest("GetLogger", 'timeAggregate', name, [
698
- label
699
- ]);
700
- },
701
- timeAggregateEnd (label) {
702
- sendRequest("GetLogger", 'timeAggregateEnd', name, [
703
- label
704
- ]);
828
+ }, loaderContext.fs = __webpack_require__("node:fs"), Object.defineProperty(loaderContext, 'request', {
829
+ enumerable: !0,
830
+ get: ()=>loaderContext.loaders.map((o)=>o.request).concat(loaderContext.resource || '').join('!')
831
+ }), Object.defineProperty(loaderContext, 'remainingRequest', {
832
+ enumerable: !0,
833
+ get: ()=>loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource ? '' : loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
834
+ }), Object.defineProperty(loaderContext, 'currentRequest', {
835
+ enumerable: !0,
836
+ get: ()=>loaderContext.loaders.slice(loaderContext.loaderIndex).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
837
+ }), Object.defineProperty(loaderContext, 'previousRequest', {
838
+ enumerable: !0,
839
+ get: ()=>loaderContext.loaders.slice(0, loaderContext.loaderIndex).map((o)=>o.request).join('!')
840
+ }), Object.defineProperty(loaderContext, 'query', {
841
+ enumerable: !0,
842
+ get: ()=>{
843
+ let entry = loaderContext.loaders[loaderContext.loaderIndex];
844
+ return entry.options && 'object' == typeof entry.options ? entry.options : entry.query;
705
845
  }
706
- };
707
- }, loaderContext.emitError = function(err) {
708
- sendRequest("EmitError", serializeError(err));
709
- }, loaderContext.emitWarning = function(warning) {
710
- sendRequest("EmitWarning", serializeError(warning));
711
- }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
712
- sendRequest("EmitFile", name, content, sourceMap, assetInfo);
713
- }, loaderContext.experiments = {
714
- emitDiagnostic (diagnostic) {
715
- sendRequest("EmitDiagnostic", diagnostic);
716
- }
717
- };
718
- let getAbsolutify = memoize(()=>absolutify.bindCache({})), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, {})), getContextify = memoize(()=>contextify.bindCache({})), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, {}));
719
- loaderContext.utils = {
720
- absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
721
- contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
722
- createHash: (type)=>createHash_createHash(type || loaderContext._compilation.outputOptions.hashFunction)
723
- }, loaderContext._compiler = {
724
- ...loaderContext._compiler,
725
- rspack: {
726
- experiments: {
727
- swc: swc_namespaceObject
728
- }
729
- },
730
- webpack: {
731
- util: {
732
- createHash: createHash_createHash,
733
- cleverMerge: cleverMerge
846
+ }), loaderContext.getOptions = function() {
847
+ let loader = function(loaderContext, index = loaderContext.loaderIndex) {
848
+ return loaderContext.loaders?.length && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index] ? loaderContext.loaders[index] : null;
849
+ }(loaderContext), options = loader?.options;
850
+ if ('string' == typeof options) if (options.startsWith('{') && options.endsWith('}')) try {
851
+ options = JSON.parse(options);
852
+ } catch (e) {
853
+ throw Error(`JSON parsing failed for loader's string options: ${e.message}`);
854
+ }
855
+ else options = external_node_querystring_default().parse(options);
856
+ return null == options && (options = {}), options;
857
+ }, loaderContext.cacheable = function(flag) {
858
+ !1 === flag && sendRequest("SetCacheable", !1);
859
+ }, Object.defineProperty(loaderContext, 'data', {
860
+ enumerable: !0,
861
+ get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
862
+ set: (value)=>{
863
+ loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = value;
734
864
  }
735
- }
736
- }, loaderContext._compilation = {
737
- ...loaderContext._compilation,
738
- getPath: (filename, data)=>sendRequest("CompilationGetPath", filename, data).wait(),
739
- getPathWithInfo: (filename, data)=>sendRequest("CompilationGetPathWithInfo", filename, data).wait(),
740
- getAssetPath: (filename, data)=>sendRequest("CompilationGetAssetPath", filename, data).wait(),
741
- getAssetPathWithInfo: (filename, data)=>sendRequest("CompilationGetAssetPathWithInfo", filename, data).wait()
742
- };
743
- let _module = loaderContext._module;
744
- loaderContext._module = {
745
- type: _module.type,
746
- identifier: ()=>_module.identifier,
747
- matchResource: _module.matchResource,
748
- request: _module.request,
749
- userRequest: _module.userRequest,
750
- rawRequest: _module.rawRequest
751
- }, loaderContext.importModule = function(request, options, callback) {
752
- if (!callback) return new Promise((resolve, reject)=>{
753
- sendRequest("ImportModule", request, options).then((result)=>{
754
- resolve(result);
755
- }, (err)=>{
756
- reject(err);
757
- });
758
- });
759
- sendRequest("ImportModule", request, options).then((result)=>{
760
- callback(null, result);
761
- }, (err)=>{
762
- callback(err);
763
865
  });
764
- }, loaderContext.fs = node_fs, Object.defineProperty(loaderContext, 'request', {
765
- enumerable: !0,
766
- get: ()=>loaderContext.loaders.map((o)=>o.request).concat(loaderContext.resource || '').join('!')
767
- }), Object.defineProperty(loaderContext, 'remainingRequest', {
768
- enumerable: !0,
769
- get: ()=>loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource ? '' : loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
770
- }), Object.defineProperty(loaderContext, 'currentRequest', {
771
- enumerable: !0,
772
- get: ()=>loaderContext.loaders.slice(loaderContext.loaderIndex).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
773
- }), Object.defineProperty(loaderContext, 'previousRequest', {
774
- enumerable: !0,
775
- get: ()=>loaderContext.loaders.slice(0, loaderContext.loaderIndex).map((o)=>o.request).join('!')
776
- }), Object.defineProperty(loaderContext, 'query', {
777
- enumerable: !0,
778
- get: ()=>{
779
- let entry = loaderContext.loaders[loaderContext.loaderIndex];
780
- return entry.options && 'object' == typeof entry.options ? entry.options : entry.query;
781
- }
782
- }), loaderContext.getOptions = function() {
783
- let loader = function(loaderContext, index = loaderContext.loaderIndex) {
784
- return loaderContext.loaders?.length && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index] ? loaderContext.loaders[index] : null;
785
- }(loaderContext), options = loader?.options;
786
- if ('string' == typeof options) if (options.startsWith('{') && options.endsWith('}')) try {
787
- options = JSON.parse(options);
788
- } catch (e) {
789
- throw Error(`JSON parsing failed for loader's string options: ${e.message}`);
790
- }
791
- else options = node_querystring.parse(options);
792
- return null == options && (options = {}), options;
793
- }, loaderContext.cacheable = function(flag) {
794
- !1 === flag && sendRequest("SetCacheable", !1);
795
- }, Object.defineProperty(loaderContext, 'data', {
796
- enumerable: !0,
797
- get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
798
- set: (value)=>{
799
- loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = value;
800
- }
801
- });
802
- let shouldYieldToMainThread = (currentLoaderObject)=>!!(!currentLoaderObject?.parallel || currentLoaderObject?.request.startsWith('builtin:'));
803
- switch(loaderState){
804
- case binding_namespaceObject.JsLoaderState.Pitching:
805
- for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
806
- let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
807
- if (shouldYieldToMainThread(currentLoaderObject)) break;
808
- if (currentLoaderObject.pitchExecuted) {
809
- loaderContext.loaderIndex += 1;
810
- continue;
866
+ let shouldYieldToMainThread = (currentLoaderObject)=>!!(!currentLoaderObject?.parallel || currentLoaderObject?.request.startsWith('builtin:'));
867
+ switch(loaderState){
868
+ case binding_.JsLoaderState.Pitching:
869
+ for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
870
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
871
+ if (shouldYieldToMainThread(currentLoaderObject)) break;
872
+ if (currentLoaderObject.pitchExecuted) {
873
+ loaderContext.loaderIndex += 1;
874
+ continue;
875
+ }
876
+ await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
877
+ let fn = currentLoaderObject.pitch;
878
+ if ((currentLoaderObject.pitchExecuted = !0, fn) && (args = await utils_runSyncOrAsync(fn, loaderContext, [
879
+ loaderContext.remainingRequest,
880
+ loaderContext.previousRequest,
881
+ currentLoaderObject.loaderItem.data
882
+ ]) || []).some((value)=>void 0 !== value)) break;
811
883
  }
812
- await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
813
- let fn = currentLoaderObject.pitch;
814
- if ((currentLoaderObject.pitchExecuted = !0, fn) && (args = await utils_runSyncOrAsync(fn, loaderContext, [
815
- loaderContext.remainingRequest,
816
- loaderContext.previousRequest,
817
- currentLoaderObject.loaderItem.data
818
- ]) || []).some((value)=>void 0 !== value)) break;
819
- }
820
- break;
821
- case binding_namespaceObject.JsLoaderState.Normal:
822
- for(; loaderContext.loaderIndex >= 0;){
823
- let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
824
- if (shouldYieldToMainThread(currentLoaderObject)) break;
825
- if (currentLoaderObject.normalExecuted) {
826
- loaderContext.loaderIndex--;
827
- continue;
884
+ break;
885
+ case binding_.JsLoaderState.Normal:
886
+ for(; loaderContext.loaderIndex >= 0;){
887
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
888
+ if (shouldYieldToMainThread(currentLoaderObject)) break;
889
+ if (currentLoaderObject.normalExecuted) {
890
+ loaderContext.loaderIndex--;
891
+ continue;
892
+ }
893
+ await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
894
+ let fn = currentLoaderObject.normal;
895
+ currentLoaderObject.normalExecuted = !0, fn && (!function(args, raw) {
896
+ if (!raw && args[0] instanceof Uint8Array) {
897
+ var buf;
898
+ let isShared, str;
899
+ args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === 'SharedArrayBuffer', 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
900
+ } else raw && 'string' == typeof args[0] && (args[0] = Buffer.from(args[0], 'utf-8'));
901
+ raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
902
+ }(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
828
903
  }
829
- await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
830
- let fn = currentLoaderObject.normal;
831
- currentLoaderObject.normalExecuted = !0, fn && (!function(args, raw) {
832
- if (!raw && args[0] instanceof Uint8Array) {
833
- var buf;
834
- let isShared, str;
835
- args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === 'SharedArrayBuffer', 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
836
- } else raw && 'string' == typeof args[0] && (args[0] = Buffer.from(args[0], 'utf-8'));
837
- raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
838
- }(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
839
- }
840
- }
841
- return sendRequest("UpdateLoaderObjects", loaderContext.loaders.map((item)=>({
842
- data: item.loaderItem.data,
843
- normalExecuted: item.normalExecuted,
844
- pitchExecuted: item.pitchExecuted
845
- }))), args;
846
- }
847
- let nextId = 0, responseCallbacks = {};
848
- function handleIncomingResponses(workerMessage) {
849
- if (isWorkerResponseMessage(workerMessage)) {
850
- let { id, data } = workerMessage, callback = responseCallbacks[id];
851
- if (callback) delete responseCallbacks[id], callback(null, data);
852
- else throw Error(`No callback found for response with id ${id}`);
853
- } else if ('response-error' === workerMessage.type) {
854
- let { id, error } = workerMessage, callback = responseCallbacks[id];
855
- if (callback) delete responseCallbacks[id], callback(error, void 0);
856
- else throw Error(`No callback found for response with id ${id}`);
904
+ }
905
+ return sendRequest("UpdateLoaderObjects", loaderContext.loaders.map((item)=>({
906
+ data: item.loaderItem.data,
907
+ normalExecuted: item.normalExecuted,
908
+ pitchExecuted: item.pitchExecuted
909
+ }))), args;
910
+ }
911
+ let nextId = 0, responseCallbacks = {};
912
+ function handleIncomingResponses(workerMessage) {
913
+ if (isWorkerResponseMessage(workerMessage)) {
914
+ let { id, data } = workerMessage, callback = responseCallbacks[id];
915
+ if (callback) delete responseCallbacks[id], callback(null, data);
916
+ else throw Error(`No callback found for response with id ${id}`);
917
+ } else if ('response-error' === workerMessage.type) {
918
+ let { id, error } = workerMessage, callback = responseCallbacks[id];
919
+ if (callback) delete responseCallbacks[id], callback(error, void 0);
920
+ else throw Error(`No callback found for response with id ${id}`);
921
+ }
857
922
  }
858
- }
859
- export default function(workerOptions) {
860
- var workerPort, workerSyncPort, workerSyncPort1;
861
- let sendRequest, workerData = workerOptions.workerData;
862
- delete workerOptions.workerData, workerData.workerPort.on('message', handleIncomingResponses);
863
- let sendRequest1 = (workerPort = workerData.workerPort, workerSyncPort = workerData.workerSyncPort, (sendRequest = (requestType, ...args)=>{
864
- let id = nextId++;
865
- workerPort.postMessage({
866
- type: 'request',
867
- id,
868
- requestType,
869
- data: args
870
- });
871
- let result = new Promise((resolve, reject)=>{
872
- responseCallbacks[id] = (err, data)=>{
873
- err ? reject(err) : resolve(data);
874
- };
875
- });
876
- return result.wait = ()=>sendRequest.sync("WaitForPendingRequest", id), result.id = id, result;
877
- }).sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
878
- let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
879
- workerSyncPort1.postMessage({
880
- type: 'request-sync',
881
- id,
882
- requestType,
883
- data: args,
884
- sharedBuffer
885
- });
886
- let status = Atomics.wait(sharedBufferView, 0, 0);
887
- if ('ok' !== status && 'not-equal' !== status) throw Error(`Internal error: Atomics.wait() failed: ${status}`);
888
- let { message } = receiveMessageOnPort(workerSyncPort1);
889
- if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
890
- if (isWorkerResponseMessage(message)) return message.data;
891
- throw message.error;
892
- }), sendRequest), waitFor = (requests)=>sendRequest1.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
893
- requests
894
- ]).map((request)=>request.id));
895
- loaderImpl(workerOptions, sendRequest1, waitFor).then((data)=>{
896
- workerData.workerPort.postMessage({
897
- type: 'done',
898
- data
899
- });
900
- }).catch((err)=>{
901
- workerData.workerPort.postMessage({
902
- type: 'done-error',
903
- error: serializeError(err)
923
+ let loader_runner_worker = function(workerOptions) {
924
+ var workerPort, workerSyncPort, sendRequest, workerSyncPort1;
925
+ let sendRequest1, workerData = workerOptions.workerData;
926
+ delete workerOptions.workerData, workerData.workerPort.on('message', handleIncomingResponses);
927
+ let sendRequest2 = (workerPort = workerData.workerPort, workerSyncPort = workerData.workerSyncPort, (sendRequest1 = (requestType, ...args)=>{
928
+ let id = nextId++;
929
+ workerPort.postMessage({
930
+ type: 'request',
931
+ id,
932
+ requestType,
933
+ data: args
934
+ });
935
+ let result = new Promise((resolve, reject)=>{
936
+ responseCallbacks[id] = (err, data)=>{
937
+ err ? reject(err) : resolve(data);
938
+ };
939
+ });
940
+ return result.wait = ()=>sendRequest1.sync("WaitForPendingRequest", id), result.id = id, result;
941
+ }).sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
942
+ let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
943
+ workerSyncPort1.postMessage({
944
+ type: 'request-sync',
945
+ id,
946
+ requestType,
947
+ data: args,
948
+ sharedBuffer
949
+ });
950
+ let status = Atomics.wait(sharedBufferView, 0, 0);
951
+ if ('ok' !== status && 'not-equal' !== status) throw Error(`Internal error: Atomics.wait() failed: ${status}`);
952
+ let { message } = (0, external_node_worker_threads_namespaceObject.receiveMessageOnPort)(workerSyncPort1);
953
+ if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
954
+ if (isWorkerResponseMessage(message)) return message.data;
955
+ throw message.error;
956
+ }), sendRequest1), waitFor = (sendRequest = sendRequest2, (requests)=>sendRequest.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
957
+ requests
958
+ ]).map((request)=>request.id)));
959
+ loaderImpl(workerOptions, sendRequest2, waitFor).then((data)=>{
960
+ workerData.workerPort.postMessage({
961
+ type: 'done',
962
+ data
963
+ });
964
+ }).catch((err)=>{
965
+ workerData.workerPort.postMessage({
966
+ type: 'done-error',
967
+ error: serializeError(err)
968
+ });
904
969
  });
905
- });
906
- };
970
+ };
971
+ })(), exports.default = __webpack_exports__.default, __webpack_exports__)-1 === [
972
+ "default"
973
+ ].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
974
+ Object.defineProperty(exports, '__esModule', {
975
+ value: !0
976
+ });
977
+
978
+ module.exports = __webpack_exports__.default;