@rspack/core 1.3.5 → 1.3.6

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.
package/dist/worker.js CHANGED
@@ -1,1864 +1,939 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function __require() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
- mod
33
- ));
34
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
-
36
- // src/lib/WebpackError.ts
37
- var import_node_util, WebpackError, WebpackError_default;
38
- var init_WebpackError = __esm({
39
- "src/lib/WebpackError.ts"() {
40
- "use strict";
41
- import_node_util = require("util");
42
- WebpackError = class extends Error {
43
- [import_node_util.inspect.custom]() {
44
- return this.stack + (this.details ? `
45
- ${this.details}` : "");
46
- }
47
- };
48
- WebpackError_default = WebpackError;
49
- }
50
- });
51
-
52
- // src/lib/AbstractMethodError.ts
53
- function createMessage(method) {
54
- return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
55
- }
56
- var CURRENT_METHOD_REGEXP, Message, AbstractMethodError, AbstractMethodError_default;
57
- var init_AbstractMethodError = __esm({
58
- "src/lib/AbstractMethodError.ts"() {
59
- "use strict";
60
- init_WebpackError();
61
- CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
62
- Message = class extends Error {
63
- constructor() {
64
- super();
65
- this.stack = void 0;
66
- Error.captureStackTrace(this);
67
- const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
68
- this.message = (match == null ? void 0 : match[1]) ? createMessage(match[1]) : createMessage();
69
- }
70
- };
71
- AbstractMethodError = class extends WebpackError_default {
72
- constructor() {
73
- super(new Message().message);
74
- this.name = "AbstractMethodError";
75
- }
76
- };
77
- AbstractMethodError_default = AbstractMethodError;
78
- }
79
- });
80
-
81
- // src/util/hash/index.ts
82
- var Hash;
83
- var init_hash = __esm({
84
- "src/util/hash/index.ts"() {
85
- "use strict";
86
- init_AbstractMethodError();
87
- Hash = class {
88
- /* istanbul ignore next */
89
- /**
90
- * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
91
- * @abstract
92
- * @param data data
93
- * @param inputEncoding data encoding
94
- * @returns updated hash
95
- */
96
- update(data, inputEncoding) {
97
- throw new AbstractMethodError_default();
98
- }
99
- /* istanbul ignore next */
100
- /**
101
- * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
102
- * @param {string=} encoding encoding of the return value
103
- * @returns {string|Buffer} digest
104
- */
105
- digest(encoding) {
106
- throw new AbstractMethodError_default();
107
- }
108
- };
109
- }
110
- });
111
-
112
- // src/util/hash/wasm-hash.ts
113
- var MAX_SHORT_STRING, WasmHash, create, wasm_hash_default;
114
- var init_wasm_hash = __esm({
115
- "src/util/hash/wasm-hash.ts"() {
116
- "use strict";
117
- MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3;
118
- WasmHash = class {
119
- /**
120
- * @param instance wasm instance
121
- * @param instancesPool pool of instances
122
- * @param chunkSize size of data chunks passed to wasm
123
- * @param digestSize size of digest returned by wasm
124
- */
125
- constructor(instance, instancesPool, chunkSize, digestSize) {
126
- const exports2 = instance.exports;
127
- exports2.init();
128
- this.exports = exports2;
129
- this.mem = Buffer.from(exports2.memory.buffer, 0, 65536);
130
- this.buffered = 0;
131
- this.instancesPool = instancesPool;
132
- this.chunkSize = chunkSize;
133
- this.digestSize = digestSize;
134
- }
135
- reset() {
136
- this.buffered = 0;
137
- this.exports.init();
138
- }
139
- /**
140
- * @param data data
141
- * @param encoding encoding
142
- * @returns itself
143
- */
144
- update(data, encoding) {
145
- if (typeof data === "string") {
146
- let normalizedData = data;
147
- while (normalizedData.length > MAX_SHORT_STRING) {
148
- this._updateWithShortString(
149
- normalizedData.slice(0, MAX_SHORT_STRING),
150
- encoding
151
- );
152
- normalizedData = normalizedData.slice(MAX_SHORT_STRING);
153
- }
154
- this._updateWithShortString(normalizedData, encoding);
155
- return this;
156
- }
157
- this._updateWithBuffer(data);
158
- return this;
159
- }
160
- /**
161
- * @param {string} data data
162
- * @param {BufferEncoding=} encoding encoding
163
- * @returns {void}
164
- */
165
- _updateWithShortString(data, encoding) {
166
- const { exports: exports2, buffered, mem, chunkSize } = this;
167
- let endPos;
168
- if (data.length < 70) {
169
- if (!encoding || encoding === "utf-8" || encoding === "utf8") {
170
- endPos = buffered;
171
- for (let i = 0; i < data.length; i++) {
172
- const cc = data.charCodeAt(i);
173
- if (cc < 128) mem[endPos++] = cc;
174
- else if (cc < 2048) {
175
- mem[endPos] = cc >> 6 | 192;
176
- mem[endPos + 1] = cc & 63 | 128;
177
- endPos += 2;
178
- } else {
179
- endPos += mem.write(data.slice(i), endPos, encoding);
180
- break;
181
- }
2
+ var __webpack_modules__ = {
3
+ "./src/util/cleverMerge.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4
+ __webpack_require__.d(__webpack_exports__, {
5
+ R_: ()=>cleverMerge
6
+ });
7
+ let DYNAMIC_INFO = Symbol("cleverMerge dynamic info"), mergeCache = new WeakMap();
8
+ new WeakMap();
9
+ let DELETE = Symbol("DELETE"), cachedCleverMerge = (first, second)=>{
10
+ if (void 0 === second) return first;
11
+ if (void 0 === first || "object" != typeof second || null === second) return second;
12
+ if ("object" != typeof first || null === first) return first;
13
+ let innerCache = mergeCache.get(first);
14
+ void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
15
+ let prevMerge = innerCache.get(second);
16
+ if (void 0 !== prevMerge) return prevMerge;
17
+ let newMerge = _cleverMerge(first, second, !0);
18
+ return innerCache.set(second, newMerge), newMerge;
19
+ }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
20
+ let entry = parseCache.get(obj);
21
+ if (void 0 !== entry) return entry;
22
+ let result = parseObject(obj);
23
+ return parseCache.set(obj, result), result;
24
+ }, parseObject = (obj)=>{
25
+ let dynamicInfo, info = new Map(), getInfo = (p)=>{
26
+ let entry = info.get(p);
27
+ if (void 0 !== entry) return entry;
28
+ let newEntry = {
29
+ base: void 0,
30
+ byProperty: void 0,
31
+ byValues: new Map()
32
+ };
33
+ return info.set(p, newEntry), newEntry;
34
+ };
35
+ for (let key of Object.keys(obj))if (key.startsWith("by")) {
36
+ let byObj = obj[key];
37
+ if ("object" == typeof byObj) for (let byValue of Object.keys(byObj)){
38
+ let obj = byObj[byValue];
39
+ for (let key1 of Object.keys(obj)){
40
+ let entry = getInfo(key1);
41
+ if (void 0 === entry.byProperty) entry.byProperty = key;
42
+ else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
43
+ 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);
44
+ }
45
+ }
46
+ else if ("function" == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
47
+ byProperty: key,
48
+ fn: byObj
49
+ };
50
+ else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
51
+ else getInfo(key).base = obj[key];
52
+ } else getInfo(key).base = obj[key];
53
+ return {
54
+ static: info,
55
+ dynamic: dynamicInfo
56
+ };
57
+ }, serializeObject = (info, dynamicInfo)=>{
58
+ let obj = {};
59
+ for (let entry of info.values())if (void 0 !== entry.byProperty) {
60
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
61
+ for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
182
62
  }
183
- } else if (encoding === "latin1") {
184
- endPos = buffered;
185
- for (let i = 0; i < data.length; i++) {
186
- const cc = data.charCodeAt(i);
187
- mem[endPos++] = cc;
63
+ for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
64
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
65
+ for (let byValue of Object.keys(byObj)){
66
+ let value = getFromByValues(entry.byValues, byValue);
67
+ void 0 !== value && (byObj[byValue][key] = value);
68
+ }
188
69
  }
189
- } else {
190
- endPos = buffered + mem.write(data, buffered, encoding);
191
- }
192
- } else {
193
- endPos = buffered + mem.write(data, buffered, encoding);
194
- }
195
- if (endPos < chunkSize) {
196
- this.buffered = endPos;
197
- } else {
198
- const l = endPos & ~(this.chunkSize - 1);
199
- exports2.update(l);
200
- const newBuffered = endPos - l;
201
- this.buffered = newBuffered;
202
- if (newBuffered > 0) mem.copyWithin(0, l, endPos);
203
- }
204
- }
205
- /**
206
- * @param data data
207
- * @returns
208
- */
209
- _updateWithBuffer(data) {
210
- const { exports: exports2, buffered, mem } = this;
211
- const length = data.length;
212
- if (buffered + length < this.chunkSize) {
213
- data.copy(mem, buffered, 0, length);
214
- this.buffered += length;
215
- } else {
216
- const l = buffered + length & ~(this.chunkSize - 1);
217
- if (l > 65536) {
218
- let i = 65536 - buffered;
219
- data.copy(mem, buffered, 0, i);
220
- exports2.update(65536);
221
- const stop = l - buffered - 65536;
222
- while (i < stop) {
223
- data.copy(mem, 0, i, i + 65536);
224
- exports2.update(65536);
225
- i += 65536;
70
+ return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
71
+ }, 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)=>{
72
+ let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
73
+ if (void 0 !== firstDynamicInfo) {
74
+ let { byProperty, fn } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
75
+ fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
76
+ let newFn = (...args)=>{
77
+ let fnResult = fn(...args);
78
+ return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
79
+ };
80
+ return newFn[DYNAMIC_INFO] = [
81
+ fn,
82
+ secondObj
83
+ ], serializeObject(firstObject.static, {
84
+ byProperty,
85
+ fn: newFn
86
+ });
87
+ }
88
+ let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
89
+ for (let [key, firstEntry] of firstInfo){
90
+ let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
91
+ resultInfo.set(key, entry);
92
+ }
93
+ for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
94
+ return serializeObject(resultInfo, secondDynamicInfo);
95
+ }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
96
+ switch(getValueType(secondEntry.base)){
97
+ case 1:
98
+ case 4:
99
+ return secondEntry;
100
+ case 0:
101
+ {
102
+ if (!firstEntry.byProperty) return {
103
+ base: firstEntry.base,
104
+ byProperty: secondEntry.byProperty,
105
+ byValues: secondEntry.byValues
106
+ };
107
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
108
+ let newByValues = new Map(firstEntry.byValues);
109
+ for (let [key, value] of secondEntry.byValues){
110
+ let firstValue = getFromByValues(firstEntry.byValues, key);
111
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
112
+ }
113
+ return {
114
+ base: firstEntry.base,
115
+ byProperty: firstEntry.byProperty,
116
+ byValues: newByValues
117
+ };
118
+ }
119
+ default:
120
+ {
121
+ let newBase;
122
+ if (!firstEntry.byProperty) return {
123
+ base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
124
+ byProperty: secondEntry.byProperty,
125
+ byValues: secondEntry.byValues
126
+ };
127
+ let intermediateByValues = new Map(firstEntry.byValues);
128
+ for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
129
+ if (Array.from(firstEntry.byValues.values()).every((value)=>{
130
+ let type = getValueType(value);
131
+ return 1 === type || 4 === type;
132
+ }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has("default") || intermediateByValues.set("default", secondEntry.base)), !secondEntry.byProperty) return {
133
+ base: newBase,
134
+ byProperty: firstEntry.byProperty,
135
+ byValues: intermediateByValues
136
+ };
137
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
138
+ let newByValues = new Map(intermediateByValues);
139
+ for (let [key, value] of secondEntry.byValues){
140
+ let firstValue = getFromByValues(intermediateByValues, key);
141
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
142
+ }
143
+ return {
144
+ base: newBase,
145
+ byProperty: firstEntry.byProperty,
146
+ byValues: newByValues
147
+ };
148
+ }
149
+ }
150
+ }, getFromByValues = (byValues, key)=>"default" !== key && byValues.has(key) ? byValues.get(key) : byValues.get("default"), mergeSingleValue = (a, b, internalCaching)=>{
151
+ let bType = getValueType(b), aType = getValueType(a);
152
+ switch(bType){
153
+ case 4:
154
+ case 1:
155
+ return b;
156
+ case 3:
157
+ return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
158
+ case 0:
159
+ return a;
160
+ case 2:
161
+ switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
162
+ case 0:
163
+ return b;
164
+ case 4:
165
+ return b.filter((item)=>"..." !== item);
166
+ case 2:
167
+ {
168
+ let newArray = [];
169
+ for (let item of b)if ("..." === item) for (let item of a)newArray.push(item);
170
+ else newArray.push(item);
171
+ return newArray;
172
+ }
173
+ case 3:
174
+ return b.map((item)=>"..." === item ? a : item);
175
+ default:
176
+ throw Error("Not implemented");
177
+ }
178
+ default:
179
+ throw Error("Not implemented");
226
180
  }
227
- data.copy(mem, 0, i, l - buffered);
228
- exports2.update(l - buffered - i);
229
- } else {
230
- data.copy(mem, buffered, 0, l - buffered);
231
- exports2.update(l);
232
- }
233
- const newBuffered = length + buffered - l;
234
- this.buffered = newBuffered;
235
- if (newBuffered > 0) data.copy(mem, 0, length - newBuffered, length);
236
- }
237
- }
238
- digest(type) {
239
- const { exports: exports2, buffered, mem, digestSize } = this;
240
- exports2.final(buffered);
241
- this.instancesPool.push(this);
242
- const hex = mem.toString("latin1", 0, digestSize);
243
- if (type === "hex") return hex;
244
- if (type === "binary" || !type) return Buffer.from(hex, "hex");
245
- return Buffer.from(hex, "hex").toString(type);
246
- }
247
- };
248
- create = (wasmModule, instancesPool, chunkSize, digestSize) => {
249
- if (instancesPool.length > 0) {
250
- const old = instancesPool.pop();
251
- old.reset();
252
- return old;
253
- }
254
- return new WasmHash(
255
- new WebAssembly.Instance(wasmModule),
256
- instancesPool,
257
- chunkSize,
258
- digestSize
259
- );
260
- };
261
- wasm_hash_default = create;
262
- }
263
- });
264
-
265
- // src/util/hash/md4.ts
266
- var createMd4, md4_default;
267
- var init_md4 = __esm({
268
- "src/util/hash/md4.ts"() {
269
- "use strict";
270
- init_wasm_hash();
271
- md4_default = () => {
272
- if (!createMd4) {
273
- const md4 = new WebAssembly.Module(
274
- Buffer.from(
275
- // 2156 bytes
276
- "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",
277
- "base64"
278
- )
279
- );
280
- createMd4 = wasm_hash_default.bind(null, md4, [], 64, 32);
281
- }
282
- return createMd4();
283
- };
284
- }
285
- });
286
-
287
- // src/util/hash/xxhash64.ts
288
- var createXxhash64, xxhash64_default;
289
- var init_xxhash64 = __esm({
290
- "src/util/hash/xxhash64.ts"() {
291
- "use strict";
292
- init_wasm_hash();
293
- xxhash64_default = () => {
294
- if (!createXxhash64) {
295
- const xxhash64 = new WebAssembly.Module(
296
- Buffer.from(
297
- // 1170 bytes
298
- "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",
299
- "base64"
300
- )
301
- );
302
- createXxhash64 = wasm_hash_default.bind(null, xxhash64, [], 32, 16);
303
- }
304
- return createXxhash64();
305
- };
306
- }
307
- });
308
-
309
- // src/util/createHash.ts
310
- var createHash_exports = {};
311
- __export(createHash_exports, {
312
- createHash: () => createHash
313
- });
314
- var import_node_crypto, BULK_SIZE, digestCaches, BulkUpdateDecorator, DebugHash, WasmHashAdapter, createHash;
315
- var init_createHash = __esm({
316
- "src/util/createHash.ts"() {
317
- "use strict";
318
- import_node_crypto = __toESM(require("crypto"));
319
- init_hash();
320
- init_md4();
321
- init_xxhash64();
322
- BULK_SIZE = 2e3;
323
- digestCaches = {};
324
- BulkUpdateDecorator = class extends Hash {
325
- /**
326
- * @param hashOrFactory function to create a hash
327
- * @param hashKey key for caching
328
- */
329
- constructor(hashOrFactory, hashKey) {
330
- super();
331
- this.hashKey = hashKey;
332
- if (typeof hashOrFactory === "function") {
333
- this.hashFactory = hashOrFactory;
334
- this.hash = void 0;
335
- } else {
336
- this.hashFactory = void 0;
337
- this.hash = hashOrFactory;
338
- }
339
- this.buffer = "";
340
- }
341
- update(data, inputEncoding) {
342
- if (inputEncoding !== void 0 || typeof data !== "string" || data.length > BULK_SIZE) {
343
- if (this.hash === void 0) this.hash = this.hashFactory();
344
- if (this.buffer.length > 0) {
345
- this.hash.update(Buffer.from(this.buffer));
346
- this.buffer = "";
347
- }
348
- if (Buffer.isBuffer(data)) {
349
- this.hash.update(data);
350
- } else {
351
- this.hash.update(data, inputEncoding);
352
- }
353
- } else {
354
- this.buffer += data;
355
- if (this.buffer.length > BULK_SIZE) {
356
- if (this.hash === void 0) this.hash = this.hashFactory();
357
- this.hash.update(Buffer.from(this.buffer));
358
- this.buffer = "";
359
- }
360
- }
361
- return this;
362
- }
363
- /**
364
- * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
365
- * @param {string=} encoding encoding of the return value
366
- * @returns {string|Buffer} digest
367
- */
368
- digest(encoding) {
369
- let digestCache;
370
- const buffer = this.buffer;
371
- if (this.hash === void 0) {
372
- const cacheKey = `${this.hashKey}-${encoding}`;
373
- digestCache = digestCaches[cacheKey];
374
- if (digestCache === void 0) {
375
- digestCache = digestCaches[cacheKey] = /* @__PURE__ */ new Map();
376
- }
377
- const cacheEntry = digestCache.get(buffer);
378
- if (cacheEntry !== void 0)
379
- return encoding ? cacheEntry : Buffer.from(cacheEntry, "hex");
380
- this.hash = this.hashFactory();
381
- }
382
- if (buffer.length > 0) {
383
- this.hash.update(Buffer.from(buffer));
384
- }
385
- const result = encoding ? this.hash.digest(encoding) : this.hash.digest();
386
- if (digestCache !== void 0 && typeof result === "string") {
387
- digestCache.set(buffer, result);
388
- }
389
- return result;
390
- }
391
- };
392
- DebugHash = class extends Hash {
393
- constructor() {
394
- super();
395
- this.string = "";
396
- }
397
- update(data, inputEncoding) {
398
- var _a;
399
- let normalizedData;
400
- if (Buffer.isBuffer(data)) {
401
- normalizedData = data.toString("utf-8");
402
- } else {
403
- normalizedData = data;
404
- }
405
- if (normalizedData.startsWith("debug-digest-")) {
406
- normalizedData = Buffer.from(
407
- normalizedData.slice("debug-digest-".length),
408
- "hex"
409
- ).toString();
410
- }
411
- this.string += `[${normalizedData}](${(_a = new Error().stack) == null ? void 0 : _a.split("\n", 3)[2]})
412
- `;
413
- return this;
414
- }
415
- /**
416
- * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
417
- * @param {string=} encoding encoding of the return value
418
- * @returns {string|Buffer} digest
419
- */
420
- digest(encoding) {
421
- const result = `debug-digest-${Buffer.from(this.string).toString("hex")}`;
422
- return encoding ? result : Buffer.from(result);
423
- }
424
- };
425
- WasmHashAdapter = class extends Hash {
426
- constructor(wasmHash) {
427
- super();
428
- this.wasmHash = wasmHash;
429
- }
430
- update(data, inputEncoding) {
431
- if (Buffer.isBuffer(data)) {
432
- this.wasmHash.update(data);
433
- } else {
434
- this.wasmHash.update(data, inputEncoding);
435
- }
436
- return this;
437
- }
438
- /**
439
- * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
440
- * @param {string=} encoding encoding of the return value
441
- * @returns {string|Buffer} digest
442
- */
443
- digest(encoding) {
444
- return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
445
- }
446
- };
447
- createHash = (algorithm) => {
448
- if (typeof algorithm === "function") {
449
- return new BulkUpdateDecorator(() => new algorithm());
450
- }
451
- switch (algorithm) {
452
- // TODO add non-cryptographic algorithm here
453
- case "debug":
454
- return new DebugHash();
455
- case "xxhash64": {
456
- const hash = xxhash64_default();
457
- return new WasmHashAdapter(hash);
458
- }
459
- case "md4": {
460
- const hash = md4_default();
461
- return new WasmHashAdapter(hash);
462
- }
463
- case "native-md4":
464
- return new BulkUpdateDecorator(() => import_node_crypto.default.createHash("md4"), "md4");
465
- default:
466
- return new BulkUpdateDecorator(
467
- () => import_node_crypto.default.createHash(algorithm),
468
- algorithm
469
- );
470
- }
471
- };
472
- }
473
- });
474
-
475
- // src/util/cleverMerge.ts
476
- var cleverMerge_exports = {};
477
- __export(cleverMerge_exports, {
478
- DELETE: () => DELETE,
479
- cachedCleverMerge: () => cachedCleverMerge,
480
- cachedSetProperty: () => cachedSetProperty,
481
- cleverMerge: () => cleverMerge,
482
- removeOperations: () => removeOperations,
483
- resolveByProperty: () => resolveByProperty
484
- });
485
- function isPropertyInObject(obj, property) {
486
- return typeof obj === "object" && obj !== null && property in obj;
487
- }
488
- var DYNAMIC_INFO, mergeCache, setPropertyCache, DELETE, cachedCleverMerge, cachedSetProperty, parseCache, cachedParseObject, parseObject, serializeObject, VALUE_TYPE_UNDEFINED, VALUE_TYPE_ATOM, VALUE_TYPE_ARRAY_EXTEND, VALUE_TYPE_OBJECT, VALUE_TYPE_DELETE, getValueType, cleverMerge, _cleverMerge, mergeEntries, getFromByValues, mergeSingleValue, removeOperations, resolveByProperty;
489
- var init_cleverMerge = __esm({
490
- "src/util/cleverMerge.ts"() {
491
- "use strict";
492
- DYNAMIC_INFO = Symbol("cleverMerge dynamic info");
493
- mergeCache = /* @__PURE__ */ new WeakMap();
494
- setPropertyCache = /* @__PURE__ */ new WeakMap();
495
- DELETE = Symbol("DELETE");
496
- cachedCleverMerge = (first, second) => {
497
- if (second === void 0) return first;
498
- if (first === void 0) return second;
499
- if (typeof second !== "object" || second === null) return second;
500
- if (typeof first !== "object" || first === null) return first;
501
- let innerCache = mergeCache.get(first);
502
- if (innerCache === void 0) {
503
- innerCache = /* @__PURE__ */ new WeakMap();
504
- mergeCache.set(first, innerCache);
505
- }
506
- const prevMerge = innerCache.get(second);
507
- if (prevMerge !== void 0) return prevMerge;
508
- const newMerge = _cleverMerge(first, second, true);
509
- innerCache.set(second, newMerge);
510
- return newMerge;
511
- };
512
- cachedSetProperty = (obj, property, value) => {
513
- let mapByProperty = setPropertyCache.get(obj);
514
- if (mapByProperty === void 0) {
515
- mapByProperty = /* @__PURE__ */ new Map();
516
- setPropertyCache.set(obj, mapByProperty);
517
- }
518
- let mapByValue = mapByProperty.get(property);
519
- if (mapByValue === void 0) {
520
- mapByValue = /* @__PURE__ */ new Map();
521
- mapByProperty.set(property, mapByValue);
522
- }
523
- let result = mapByValue.get(value);
524
- if (result) return result;
525
- result = {
526
- ...obj,
527
- [property]: value
528
- };
529
- mapByValue.set(value, result);
530
- return result;
531
- };
532
- parseCache = /* @__PURE__ */ new WeakMap();
533
- cachedParseObject = (obj) => {
534
- const entry = parseCache.get(obj);
535
- if (entry !== void 0) return entry;
536
- const result = parseObject(obj);
537
- parseCache.set(obj, result);
538
- return result;
539
- };
540
- parseObject = (obj) => {
541
- const info = /* @__PURE__ */ new Map();
542
- let dynamicInfo;
543
- const getInfo = (p) => {
544
- const entry = info.get(p);
545
- if (entry !== void 0) return entry;
546
- const newEntry = {
547
- base: void 0,
548
- byProperty: void 0,
549
- byValues: /* @__PURE__ */ new Map()
550
181
  };
551
- info.set(p, newEntry);
552
- return newEntry;
553
- };
554
- for (const key of Object.keys(obj)) {
555
- if (key.startsWith("by")) {
556
- const byProperty = key;
557
- const byObj = obj[byProperty];
558
- if (typeof byObj === "object") {
559
- for (const byValue of Object.keys(byObj)) {
560
- const obj2 = byObj[byValue];
561
- for (const key2 of Object.keys(obj2)) {
562
- const entry = getInfo(key2);
563
- if (entry.byProperty === void 0) {
564
- entry.byProperty = byProperty;
565
- } else if (entry.byProperty !== byProperty) {
566
- throw new Error(
567
- `${byProperty} and ${entry.byProperty} for a single property is not supported`
568
- );
569
- }
570
- entry.byValues.set(byValue, obj2[key2]);
571
- if (byValue === "default") {
572
- for (const otherByValue of Object.keys(byObj)) {
573
- if (!entry.byValues.has(otherByValue))
574
- entry.byValues.set(otherByValue, void 0);
575
- }
576
- }
577
- }
182
+ },
183
+ "./src/util/createHash.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
184
+ let createMd4, createXxhash64;
185
+ __webpack_require__.d(__webpack_exports__, {
186
+ j: ()=>createHash
187
+ });
188
+ let external_node_crypto_namespaceObject = require("node:crypto");
189
+ var _computedKey, external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject);
190
+ _computedKey = __webpack_require__("node:util").inspect.custom;
191
+ let WebpackError = class extends Error {
192
+ loc;
193
+ file;
194
+ chunk;
195
+ module;
196
+ details;
197
+ hideStack;
198
+ [_computedKey]() {
199
+ return this.stack + (this.details ? `\n${this.details}` : "");
578
200
  }
579
- } else if (typeof byObj === "function") {
580
- if (dynamicInfo === void 0) {
581
- dynamicInfo = {
582
- byProperty: key,
583
- fn: byObj
584
- };
585
- } else {
586
- throw new Error(
587
- `${key} and ${dynamicInfo.byProperty} when both are functions is not supported`
588
- );
201
+ }, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
202
+ function createMessage(method) {
203
+ return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
204
+ }
205
+ class Message extends Error {
206
+ constructor(){
207
+ super(), this.stack = void 0, Error.captureStackTrace(this);
208
+ let match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
209
+ this.message = match?.[1] ? createMessage(match[1]) : createMessage();
589
210
  }
590
- } else {
591
- const entry = getInfo(key);
592
- entry.base = obj[key];
593
- }
594
- } else {
595
- const entry = getInfo(key);
596
- entry.base = obj[key];
597
- }
598
- }
599
- return {
600
- static: info,
601
- dynamic: dynamicInfo
602
- };
603
- };
604
- serializeObject = (info, dynamicInfo) => {
605
- const obj = {};
606
- for (const entry of info.values()) {
607
- if (entry.byProperty !== void 0) {
608
- const byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
609
- for (const byValue of entry.byValues.keys()) {
610
- byObj[byValue] = byObj[byValue] || {};
611
- }
612
- }
613
- }
614
- for (const [key, entry] of info) {
615
- if (entry.base !== void 0) {
616
- obj[key] = entry.base;
617
- }
618
- if (entry.byProperty !== void 0) {
619
- const byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
620
- for (const byValue of Object.keys(byObj)) {
621
- const value = getFromByValues(entry.byValues, byValue);
622
- if (value !== void 0) byObj[byValue][key] = value;
623
- }
624
- }
625
- }
626
- if (dynamicInfo !== void 0) {
627
- obj[dynamicInfo.byProperty] = dynamicInfo.fn;
628
- }
629
- return obj;
630
- };
631
- VALUE_TYPE_UNDEFINED = 0;
632
- VALUE_TYPE_ATOM = 1;
633
- VALUE_TYPE_ARRAY_EXTEND = 2;
634
- VALUE_TYPE_OBJECT = 3;
635
- VALUE_TYPE_DELETE = 4;
636
- getValueType = (value) => {
637
- if (value === void 0) {
638
- return VALUE_TYPE_UNDEFINED;
639
- }
640
- if (value === DELETE) {
641
- return VALUE_TYPE_DELETE;
642
- }
643
- if (Array.isArray(value)) {
644
- if (value.lastIndexOf("...") !== -1) return VALUE_TYPE_ARRAY_EXTEND;
645
- return VALUE_TYPE_ATOM;
646
- }
647
- if (typeof value === "object" && value !== null && (!value.constructor || value.constructor === Object)) {
648
- return VALUE_TYPE_OBJECT;
649
- }
650
- return VALUE_TYPE_ATOM;
651
- };
652
- cleverMerge = (first, second) => {
653
- if (second === void 0) return first;
654
- if (first === void 0) return second;
655
- if (typeof second !== "object" || second === null) return second;
656
- if (typeof first !== "object" || first === null) return first;
657
- return _cleverMerge(first, second, false);
658
- };
659
- _cleverMerge = (first, second, internalCaching = false) => {
660
- const firstObject = internalCaching ? cachedParseObject(first) : parseObject(first);
661
- const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject;
662
- let secondObj = second;
663
- if (firstDynamicInfo !== void 0) {
664
- let { byProperty, fn } = firstDynamicInfo;
665
- const fnInfo = fn[DYNAMIC_INFO];
666
- if (fnInfo) {
667
- secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second);
668
- fn = fnInfo[0];
669
211
  }
670
- const newFn = (...args) => {
671
- const fnResult = fn(...args);
672
- return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
212
+ let AbstractMethodError = class extends WebpackError {
213
+ constructor(){
214
+ super(new Message().message), this.name = "AbstractMethodError";
215
+ }
673
216
  };
674
- newFn[DYNAMIC_INFO] = [fn, secondObj];
675
- return serializeObject(firstObject.static, { byProperty, fn: newFn });
676
- }
677
- const secondObject = internalCaching ? cachedParseObject(second) : parseObject(second);
678
- const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject;
679
- const resultInfo = /* @__PURE__ */ new Map();
680
- for (const [key, firstEntry] of firstInfo) {
681
- const secondEntry = secondInfo.get(key);
682
- const entry = secondEntry !== void 0 ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
683
- resultInfo.set(key, entry);
684
- }
685
- for (const [key, secondEntry] of secondInfo) {
686
- if (!firstInfo.has(key)) {
687
- resultInfo.set(key, secondEntry);
688
- }
689
- }
690
- return serializeObject(resultInfo, secondDynamicInfo);
691
- };
692
- mergeEntries = (firstEntry, secondEntry, internalCaching) => {
693
- switch (getValueType(secondEntry.base)) {
694
- case VALUE_TYPE_ATOM:
695
- case VALUE_TYPE_DELETE:
696
- return secondEntry;
697
- case VALUE_TYPE_UNDEFINED: {
698
- if (!firstEntry.byProperty) {
699
- return {
700
- base: firstEntry.base,
701
- byProperty: secondEntry.byProperty,
702
- byValues: secondEntry.byValues
703
- };
704
- }
705
- if (firstEntry.byProperty !== secondEntry.byProperty) {
706
- throw new Error(
707
- `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`
708
- );
709
- }
710
- const newByValues = new Map(firstEntry.byValues);
711
- for (const [key, value] of secondEntry.byValues) {
712
- const firstValue = getFromByValues(firstEntry.byValues, key);
713
- newByValues.set(
714
- key,
715
- mergeSingleValue(firstValue, value, internalCaching)
716
- );
717
- }
718
- return {
719
- base: firstEntry.base,
720
- byProperty: firstEntry.byProperty,
721
- byValues: newByValues
722
- };
723
- }
724
- default: {
725
- if (!firstEntry.byProperty) {
726
- return {
727
- base: mergeSingleValue(
728
- firstEntry.base,
729
- secondEntry.base,
730
- internalCaching
731
- ),
732
- byProperty: secondEntry.byProperty,
733
- byValues: secondEntry.byValues
734
- };
735
- }
736
- let newBase;
737
- const intermediateByValues = new Map(firstEntry.byValues);
738
- for (const [key, value] of intermediateByValues) {
739
- intermediateByValues.set(
740
- key,
741
- mergeSingleValue(value, secondEntry.base, internalCaching)
742
- );
743
- }
744
- if (Array.from(firstEntry.byValues.values()).every((value) => {
745
- const type = getValueType(value);
746
- return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE;
747
- })) {
748
- newBase = mergeSingleValue(
749
- firstEntry.base,
750
- secondEntry.base,
751
- internalCaching
752
- );
753
- } else {
754
- newBase = firstEntry.base;
755
- if (!intermediateByValues.has("default"))
756
- intermediateByValues.set("default", secondEntry.base);
757
- }
758
- if (!secondEntry.byProperty) {
759
- return {
760
- base: newBase,
761
- byProperty: firstEntry.byProperty,
762
- byValues: intermediateByValues
763
- };
764
- }
765
- if (firstEntry.byProperty !== secondEntry.byProperty) {
766
- throw new Error(
767
- `${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`
768
- );
769
- }
770
- const newByValues = new Map(intermediateByValues);
771
- for (const [key, value] of secondEntry.byValues) {
772
- const firstValue = getFromByValues(intermediateByValues, key);
773
- newByValues.set(
774
- key,
775
- mergeSingleValue(firstValue, value, internalCaching)
776
- );
777
- }
778
- return {
779
- base: newBase,
780
- byProperty: firstEntry.byProperty,
781
- byValues: newByValues
782
- };
783
- }
784
- }
785
- };
786
- getFromByValues = (byValues, key) => {
787
- if (key !== "default" && byValues.has(key)) {
788
- return byValues.get(key);
789
- }
790
- return byValues.get("default");
791
- };
792
- mergeSingleValue = (a, b, internalCaching) => {
793
- const bType = getValueType(b);
794
- const aType = getValueType(a);
795
- switch (bType) {
796
- case VALUE_TYPE_DELETE:
797
- case VALUE_TYPE_ATOM:
798
- return b;
799
- case VALUE_TYPE_OBJECT: {
800
- return aType !== VALUE_TYPE_OBJECT ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
217
+ class Hash {
218
+ update(data, inputEncoding) {
219
+ throw new AbstractMethodError();
220
+ }
221
+ digest(encoding) {
222
+ throw new AbstractMethodError();
223
+ }
801
224
  }
802
- case VALUE_TYPE_UNDEFINED:
803
- return a;
804
- case VALUE_TYPE_ARRAY_EXTEND:
805
- switch (aType !== VALUE_TYPE_ATOM ? aType : Array.isArray(a) ? VALUE_TYPE_ARRAY_EXTEND : VALUE_TYPE_OBJECT) {
806
- case VALUE_TYPE_UNDEFINED:
807
- return b;
808
- case VALUE_TYPE_DELETE:
809
- return b.filter((item) => item !== "...");
810
- case VALUE_TYPE_ARRAY_EXTEND: {
811
- const newArray = [];
812
- for (const item of b) {
813
- if (item === "...") {
814
- for (const item2 of a) {
815
- newArray.push(item2);
816
- }
817
- } else {
818
- newArray.push(item);
225
+ let MAX_SHORT_STRING = -4 & Math.floor(16368);
226
+ class WasmHash {
227
+ exports;
228
+ instancesPool;
229
+ buffered;
230
+ mem;
231
+ chunkSize;
232
+ digestSize;
233
+ constructor(instance, instancesPool, chunkSize, digestSize){
234
+ let exports1 = instance.exports;
235
+ 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;
236
+ }
237
+ reset() {
238
+ this.buffered = 0, this.exports.init();
239
+ }
240
+ update(data, encoding) {
241
+ if ("string" == typeof data) {
242
+ let normalizedData = data;
243
+ for(; normalizedData.length > MAX_SHORT_STRING;)this._updateWithShortString(normalizedData.slice(0, MAX_SHORT_STRING), encoding), normalizedData = normalizedData.slice(MAX_SHORT_STRING);
244
+ return this._updateWithShortString(normalizedData, encoding), this;
819
245
  }
820
- }
821
- return newArray;
246
+ return this._updateWithBuffer(data), this;
247
+ }
248
+ _updateWithShortString(data, encoding) {
249
+ let endPos, { exports: exports1, buffered, mem, chunkSize } = this;
250
+ if (data.length < 70) if (encoding && "utf-8" !== encoding && "utf8" !== encoding) if ("latin1" === encoding) {
251
+ endPos = buffered;
252
+ for(let i = 0; i < data.length; i++){
253
+ let cc = data.charCodeAt(i);
254
+ mem[endPos++] = cc;
255
+ }
256
+ } else endPos = buffered + mem.write(data, buffered, encoding);
257
+ else {
258
+ endPos = buffered;
259
+ for(let i = 0; i < data.length; i++){
260
+ let cc = data.charCodeAt(i);
261
+ if (cc < 0x80) mem[endPos++] = cc;
262
+ else if (cc < 0x800) mem[endPos] = cc >> 6 | 0xc0, mem[endPos + 1] = 0x3f & cc | 0x80, endPos += 2;
263
+ else {
264
+ endPos += mem.write(data.slice(i), endPos, encoding);
265
+ break;
266
+ }
267
+ }
268
+ }
269
+ else endPos = buffered + mem.write(data, buffered, encoding);
270
+ if (endPos < chunkSize) this.buffered = endPos;
271
+ else {
272
+ let l = endPos & ~(this.chunkSize - 1);
273
+ exports1.update(l);
274
+ let newBuffered = endPos - l;
275
+ this.buffered = newBuffered, newBuffered > 0 && mem.copyWithin(0, l, endPos);
276
+ }
277
+ }
278
+ _updateWithBuffer(data) {
279
+ let { exports: exports1, buffered, mem } = this, length = data.length;
280
+ if (buffered + length < this.chunkSize) data.copy(mem, buffered, 0, length), this.buffered += length;
281
+ else {
282
+ let l = buffered + length & ~(this.chunkSize - 1);
283
+ if (l > 65536) {
284
+ let i = 65536 - buffered;
285
+ data.copy(mem, buffered, 0, i), exports1.update(65536);
286
+ let stop = l - buffered - 65536;
287
+ for(; i < stop;)data.copy(mem, 0, i, i + 65536), exports1.update(65536), i += 65536;
288
+ data.copy(mem, 0, i, l - buffered), exports1.update(l - buffered - i);
289
+ } else data.copy(mem, buffered, 0, l - buffered), exports1.update(l);
290
+ let newBuffered = length + buffered - l;
291
+ this.buffered = newBuffered, newBuffered > 0 && data.copy(mem, 0, length - newBuffered, length);
292
+ }
293
+ }
294
+ digest(type) {
295
+ let { exports: exports1, buffered, mem, digestSize } = this;
296
+ exports1.final(buffered), this.instancesPool.push(this);
297
+ let hex = mem.toString("latin1", 0, digestSize);
298
+ return "hex" === type ? hex : "binary" !== type && type ? Buffer.from(hex, "hex").toString(type) : Buffer.from(hex, "hex");
822
299
  }
823
- case VALUE_TYPE_OBJECT:
824
- return b.map((item) => item === "..." ? a : item);
825
- default:
826
- throw new Error("Not implemented");
827
- }
828
- default:
829
- throw new Error("Not implemented");
830
- }
831
- };
832
- removeOperations = (obj) => {
833
- const newObj = {};
834
- for (const key of Object.keys(obj)) {
835
- const value = obj[key];
836
- const type = getValueType(value);
837
- switch (type) {
838
- case VALUE_TYPE_UNDEFINED:
839
- case VALUE_TYPE_DELETE:
840
- break;
841
- case VALUE_TYPE_OBJECT:
842
- newObj[key] = removeOperations(value);
843
- break;
844
- case VALUE_TYPE_ARRAY_EXTEND:
845
- newObj[key] = value.filter((i) => i !== "...");
846
- break;
847
- default:
848
- newObj[key] = value;
849
- break;
850
- }
851
- }
852
- return newObj;
853
- };
854
- resolveByProperty = (obj, byProperty, ...values) => {
855
- if (!isPropertyInObject(obj, byProperty)) {
856
- return obj;
857
- }
858
- const { [byProperty]: _byValue, ..._remaining } = obj;
859
- const remaining = _remaining;
860
- const byValue = _byValue;
861
- if (typeof byValue === "object") {
862
- const key = values[0];
863
- if (key in byValue) {
864
- return cachedCleverMerge(remaining, byValue[key]);
865
- }
866
- if ("default" in byValue) {
867
- return cachedCleverMerge(remaining, byValue.default);
868
300
  }
869
- return remaining;
870
- }
871
- if (typeof byValue === "function") {
872
- const result = byValue.apply(null, values);
873
- return cachedCleverMerge(
874
- remaining,
875
- resolveByProperty(result, byProperty, ...values)
876
- );
877
- }
878
- };
879
- }
880
- });
881
-
882
- // ../../node_modules/.pnpm/json-parse-even-better-errors@3.0.2/node_modules/json-parse-even-better-errors/lib/index.js
883
- var require_lib = __commonJS({
884
- "../../node_modules/.pnpm/json-parse-even-better-errors@3.0.2/node_modules/json-parse-even-better-errors/lib/index.js"(exports2, module2) {
885
- "use strict";
886
- var INDENT = Symbol.for("indent");
887
- var NEWLINE = Symbol.for("newline");
888
- var DEFAULT_NEWLINE = "\n";
889
- var DEFAULT_INDENT = " ";
890
- var BOM = /^\uFEFF/;
891
- var FORMAT = /^\s*[{[]((?:\r?\n)+)([\s\t]*)/;
892
- var EMPTY = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
893
- var UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i;
894
- var hexify = (char) => {
895
- const h = char.charCodeAt(0).toString(16).toUpperCase();
896
- return `0x${h.length % 2 ? "0" : ""}${h}`;
897
- };
898
- var stripBOM = (txt) => String(txt).replace(BOM, "");
899
- var makeParsedError = (msg, parsing, position = 0) => ({
900
- message: `${msg} while parsing ${parsing}`,
901
- position
902
- });
903
- var parseError = (e, txt, context = 20) => {
904
- let msg = e.message;
905
- if (!txt) {
906
- return makeParsedError(msg, "empty string");
907
- }
908
- const badTokenMatch = msg.match(UNEXPECTED_TOKEN);
909
- const badIndexMatch = msg.match(/ position\s+(\d+)/i);
910
- if (badTokenMatch) {
911
- msg = msg.replace(
912
- UNEXPECTED_TOKEN,
913
- `Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hexify(badTokenMatch[1])})$2 `
914
- );
915
- }
916
- let errIdx;
917
- if (badIndexMatch) {
918
- errIdx = +badIndexMatch[1];
919
- } else if (msg.match(/^Unexpected end of JSON.*/i)) {
920
- errIdx = txt.length - 1;
921
- }
922
- if (errIdx == null) {
923
- return makeParsedError(msg, `'${txt.slice(0, context * 2)}'`);
924
- }
925
- const start = errIdx <= context ? 0 : errIdx - context;
926
- const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
927
- const slice = `${start ? "..." : ""}${txt.slice(start, end)}${end === txt.length ? "" : "..."}`;
928
- return makeParsedError(
929
- msg,
930
- `${txt === slice ? "" : "near "}${JSON.stringify(slice)}`,
931
- errIdx
932
- );
933
- };
934
- var JSONParseError = class extends SyntaxError {
935
- constructor(er, txt, context, caller) {
936
- const metadata = parseError(er, txt, context);
937
- super(metadata.message);
938
- Object.assign(this, metadata);
939
- this.code = "EJSONPARSE";
940
- this.systemError = er;
941
- Error.captureStackTrace(this, caller || this.constructor);
942
- }
943
- get name() {
944
- return this.constructor.name;
945
- }
946
- set name(n) {
947
- }
948
- get [Symbol.toStringTag]() {
949
- return this.constructor.name;
950
- }
951
- };
952
- var parseJson = (txt, reviver) => {
953
- const result = JSON.parse(txt, reviver);
954
- if (result && typeof result === "object") {
955
- const match = txt.match(EMPTY) || txt.match(FORMAT) || [null, "", ""];
956
- result[NEWLINE] = match[1] ?? DEFAULT_NEWLINE;
957
- result[INDENT] = match[2] ?? DEFAULT_INDENT;
958
- }
959
- return result;
960
- };
961
- var parseJsonError = (raw, reviver, context) => {
962
- const txt = stripBOM(raw);
963
- try {
964
- return parseJson(txt, reviver);
965
- } catch (e) {
966
- if (typeof raw !== "string" && !Buffer.isBuffer(raw)) {
967
- const msg = Array.isArray(raw) && raw.length === 0 ? "an empty array" : String(raw);
968
- throw Object.assign(
969
- new TypeError(`Cannot parse ${msg}`),
970
- { code: "EJSONPARSE", systemError: e }
971
- );
301
+ let wasm_hash = (wasmModule, instancesPool, chunkSize, digestSize)=>{
302
+ if (instancesPool.length > 0) {
303
+ let old = instancesPool.pop();
304
+ return old.reset(), old;
305
+ }
306
+ return new WasmHash(new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize);
307
+ }, hash_md4 = ()=>{
308
+ if (!createMd4) {
309
+ let md4 = new WebAssembly.Module(Buffer.from("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", "base64"));
310
+ createMd4 = wasm_hash.bind(null, md4, [], 64, 32);
311
+ }
312
+ return createMd4();
313
+ }, hash_xxhash64 = ()=>{
314
+ if (!createXxhash64) {
315
+ 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"));
316
+ createXxhash64 = wasm_hash.bind(null, xxhash64, [], 32, 16);
317
+ }
318
+ return createXxhash64();
319
+ }, digestCaches = {};
320
+ class BulkUpdateDecorator extends Hash {
321
+ hash;
322
+ hashFactory;
323
+ hashKey;
324
+ buffer;
325
+ constructor(hashOrFactory, hashKey){
326
+ super(), this.hashKey = hashKey, "function" == typeof hashOrFactory ? (this.hashFactory = hashOrFactory, this.hash = void 0) : (this.hashFactory = void 0, this.hash = hashOrFactory), this.buffer = "";
327
+ }
328
+ update(data, inputEncoding) {
329
+ 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;
330
+ }
331
+ digest(encoding) {
332
+ let digestCache, buffer = this.buffer;
333
+ if (void 0 === this.hash) {
334
+ let cacheKey = `${this.hashKey}-${encoding}`;
335
+ void 0 === (digestCache = digestCaches[cacheKey]) && (digestCache = digestCaches[cacheKey] = new Map());
336
+ let cacheEntry = digestCache.get(buffer);
337
+ if (void 0 !== cacheEntry) return encoding ? cacheEntry : Buffer.from(cacheEntry, "hex");
338
+ this.hash = this.hashFactory();
339
+ }
340
+ buffer.length > 0 && this.hash.update(Buffer.from(buffer));
341
+ let result = encoding ? this.hash.digest(encoding) : this.hash.digest();
342
+ return void 0 !== digestCache && "string" == typeof result && digestCache.set(buffer, result), result;
343
+ }
972
344
  }
973
- throw new JSONParseError(e, txt, context, parseJsonError);
974
- }
975
- };
976
- module2.exports = parseJsonError;
977
- parseJsonError.JSONParseError = JSONParseError;
978
- parseJsonError.noExceptions = (raw, reviver) => {
979
- try {
980
- return parseJson(stripBOM(raw), reviver);
981
- } catch {
982
- }
983
- };
984
- }
985
- });
986
-
987
- // src/loader-runner/worker.ts
988
- var import_node_querystring = __toESM(require("querystring"));
989
- var import_node_util3 = require("util");
990
- var import_node_worker_threads2 = require("worker_threads");
991
- var import_binding = require("@rspack/binding");
992
- init_createHash();
993
-
994
- // src/util/identifier.ts
995
- var import_node_path = __toESM(require("path"));
996
- var WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
997
- var SEGMENTS_SPLIT_REGEXP = /([|!])/;
998
- var WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
999
- var relativePathToRequest = (relativePath) => {
1000
- if (relativePath === "") return "./.";
1001
- if (relativePath === "..") return "../.";
1002
- if (relativePath.startsWith("../")) return relativePath;
1003
- return `./${relativePath}`;
1004
- };
1005
- var absoluteToRequest = (context, maybeAbsolutePath) => {
1006
- if (maybeAbsolutePath[0] === "/") {
1007
- if (maybeAbsolutePath.length > 1 && maybeAbsolutePath[maybeAbsolutePath.length - 1] === "/") {
1008
- return maybeAbsolutePath;
1009
- }
1010
- const querySplitPos = maybeAbsolutePath.indexOf("?");
1011
- let resource = querySplitPos === -1 ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
1012
- resource = relativePathToRequest(import_node_path.default.posix.relative(context, resource));
1013
- return querySplitPos === -1 ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
1014
- }
1015
- if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
1016
- const querySplitPos = maybeAbsolutePath.indexOf("?");
1017
- let resource = querySplitPos === -1 ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
1018
- resource = import_node_path.default.win32.relative(context, resource);
1019
- if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) {
1020
- resource = relativePathToRequest(
1021
- resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/")
1022
- );
1023
- }
1024
- return querySplitPos === -1 ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
1025
- }
1026
- return maybeAbsolutePath;
1027
- };
1028
- var requestToAbsolute = (context, relativePath) => {
1029
- if (relativePath.startsWith("./") || relativePath.startsWith("../"))
1030
- return import_node_path.default.join(context, relativePath);
1031
- return relativePath;
1032
- };
1033
- var makeCacheable = (realFn) => {
1034
- const cache = /* @__PURE__ */ new WeakMap();
1035
- const getCache = (associatedObjectForCache) => {
1036
- const entry = cache.get(associatedObjectForCache);
1037
- if (entry !== void 0) return entry;
1038
- const map = /* @__PURE__ */ new Map();
1039
- cache.set(associatedObjectForCache, map);
1040
- return map;
1041
- };
1042
- const fn = (str, associatedObjectForCache) => {
1043
- if (!associatedObjectForCache) return realFn(str);
1044
- const cache2 = getCache(associatedObjectForCache);
1045
- const entry = cache2.get(str);
1046
- if (entry !== void 0) return entry;
1047
- const result = realFn(str);
1048
- cache2.set(str, result);
1049
- return result;
1050
- };
1051
- fn.bindCache = (associatedObjectForCache) => {
1052
- const cache2 = getCache(associatedObjectForCache);
1053
- return (str) => {
1054
- const entry = cache2.get(str);
1055
- if (entry !== void 0) return entry;
1056
- const result = realFn(str);
1057
- cache2.set(str, result);
1058
- return result;
1059
- };
1060
- };
1061
- return fn;
1062
- };
1063
- var makeCacheableWithContext = (fn) => {
1064
- const cache = /* @__PURE__ */ new WeakMap();
1065
- const cachedFn = (context, identifier, associatedObjectForCache) => {
1066
- if (!associatedObjectForCache) return fn(context, identifier);
1067
- let innerCache = cache.get(
1068
- associatedObjectForCache
1069
- );
1070
- if (innerCache === void 0) {
1071
- innerCache = /* @__PURE__ */ new Map();
1072
- cache.set(associatedObjectForCache, innerCache);
1073
- }
1074
- let cachedResult;
1075
- let innerSubCache = innerCache.get(context);
1076
- if (innerSubCache === void 0) {
1077
- innerCache.set(context, innerSubCache = /* @__PURE__ */ new Map());
1078
- } else {
1079
- cachedResult = innerSubCache.get(identifier);
1080
- }
1081
- if (cachedResult !== void 0) {
1082
- return cachedResult;
1083
- }
1084
- const result = fn(context, identifier);
1085
- innerSubCache.set(identifier, result);
1086
- return result;
1087
- };
1088
- cachedFn.bindCache = (associatedObjectForCache) => {
1089
- let innerCache;
1090
- if (associatedObjectForCache) {
1091
- innerCache = cache.get(associatedObjectForCache);
1092
- if (innerCache === void 0) {
1093
- innerCache = /* @__PURE__ */ new Map();
1094
- cache.set(associatedObjectForCache, innerCache);
1095
- }
1096
- } else {
1097
- innerCache = /* @__PURE__ */ new Map();
1098
- }
1099
- const boundFn = (context, identifier) => {
1100
- let cachedResult;
1101
- let innerSubCache = innerCache == null ? void 0 : innerCache.get(context);
1102
- if (innerSubCache === void 0) {
1103
- innerSubCache = /* @__PURE__ */ new Map();
1104
- innerCache == null ? void 0 : innerCache.set(context, innerSubCache);
1105
- } else {
1106
- cachedResult = innerSubCache.get(identifier);
1107
- }
1108
- if (cachedResult !== void 0) {
1109
- return cachedResult;
1110
- }
1111
- const result = fn(context, identifier);
1112
- innerSubCache.set(identifier, result);
1113
- return result;
1114
- };
1115
- return boundFn;
1116
- };
1117
- cachedFn.bindContextCache = (context, associatedObjectForCache) => {
1118
- let innerSubCache;
1119
- if (associatedObjectForCache) {
1120
- let innerCache = cache.get(associatedObjectForCache);
1121
- if (innerCache === void 0) {
1122
- innerCache = /* @__PURE__ */ new Map();
1123
- cache.set(associatedObjectForCache, innerCache);
1124
- }
1125
- innerSubCache = innerCache.get(context);
1126
- if (innerSubCache === void 0) {
1127
- innerCache.set(context, innerSubCache = /* @__PURE__ */ new Map());
1128
- }
1129
- } else {
1130
- innerSubCache = /* @__PURE__ */ new Map();
1131
- }
1132
- const boundFn = (identifier) => {
1133
- const cachedResult = innerSubCache == null ? void 0 : innerSubCache.get(identifier);
1134
- if (cachedResult !== void 0) {
1135
- return cachedResult;
1136
- }
1137
- const result = fn(context, identifier);
1138
- innerSubCache == null ? void 0 : innerSubCache.set(identifier, result);
1139
- return result;
1140
- };
1141
- return boundFn;
1142
- };
1143
- return cachedFn;
1144
- };
1145
- var _makePathsRelative = (context, identifier) => {
1146
- return identifier.split(SEGMENTS_SPLIT_REGEXP).map((str) => absoluteToRequest(context, str)).join("");
1147
- };
1148
- var makePathsRelative = makeCacheableWithContext(_makePathsRelative);
1149
- var _makePathsAbsolute = (context, identifier) => {
1150
- return identifier.split(SEGMENTS_SPLIT_REGEXP).map((str) => requestToAbsolute(context, str)).join("");
1151
- };
1152
- var makePathsAbsolute = makeCacheableWithContext(_makePathsAbsolute);
1153
- var _contextify = (context, request) => {
1154
- return request.split("!").map((r) => absoluteToRequest(context, r)).join("!");
1155
- };
1156
- var contextify = makeCacheableWithContext(_contextify);
1157
- var _absolutify = (context, request) => {
1158
- return request.split("!").map((r) => requestToAbsolute(context, r)).join("!");
1159
- };
1160
- var absolutify = makeCacheableWithContext(_absolutify);
1161
- var PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
1162
- var PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
1163
- var _parseResource = (str) => {
1164
- const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
1165
- return {
1166
- resource: str,
1167
- path: match[1].replace(/\u200b(.)/g, "$1"),
1168
- query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : "",
1169
- fragment: match[3] || ""
1170
- };
1171
- };
1172
- var parseResource = makeCacheable(_parseResource);
1173
- var _parseResourceWithoutFragment = (str) => {
1174
- const match = PATH_QUERY_REGEXP.exec(str);
1175
- return {
1176
- resource: str,
1177
- path: match[1].replace(/\u200b(.)/g, "$1"),
1178
- query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
1179
- };
1180
- };
1181
- var parseResourceWithoutFragment = makeCacheable(
1182
- _parseResourceWithoutFragment
1183
- );
1184
-
1185
- // src/util/memoize.ts
1186
- var memoize = (fn) => {
1187
- let cache = false;
1188
- let result;
1189
- let callback = fn;
1190
- return () => {
1191
- if (cache) {
1192
- return result;
1193
- }
1194
- result = callback();
1195
- cache = true;
1196
- callback = void 0;
1197
- return result;
1198
- };
1199
- };
1200
-
1201
- // src/loader-runner/LoaderLoadingError.ts
1202
- var LoadingLoaderError = class extends Error {
1203
- constructor(message) {
1204
- super(message);
1205
- this.name = "LoaderRunnerError";
1206
- Error.captureStackTrace(this, this.constructor);
1207
- }
1208
- };
1209
- var LoaderLoadingError_default = LoadingLoaderError;
1210
-
1211
- // src/loader-runner/loadLoader.ts
1212
- var url = void 0;
1213
- function loadLoader(loader, callback) {
1214
- if (loader.type === "module") {
1215
- try {
1216
- if (url === void 0) url = require("url");
1217
- const loaderUrl = url.pathToFileURL(loader.path);
1218
- const modulePromise = import(loaderUrl.toString());
1219
- modulePromise.then((module2) => {
1220
- handleResult(loader, module2, callback);
1221
- }, callback);
1222
- return;
1223
- } catch (e) {
1224
- callback(e);
1225
- }
1226
- } else {
1227
- let module2;
1228
- try {
1229
- module2 = require(loader.path);
1230
- } catch (e) {
1231
- if (e instanceof Error && e.code === "EMFILE") {
1232
- const retry = loadLoader.bind(null, loader, callback);
1233
- return void setImmediate(retry);
1234
- }
1235
- return callback(e);
1236
- }
1237
- return handleResult(loader, module2, callback);
1238
- }
1239
- }
1240
- function handleResult(loader, module2, callback) {
1241
- if (typeof module2 !== "function" && typeof module2 !== "object") {
1242
- return callback(
1243
- new LoaderLoadingError_default(
1244
- `Module '${loader.path}' is not a loader (export function or es6 module)`
1245
- )
1246
- );
1247
- }
1248
- loader.normal = typeof module2 === "function" ? module2 : module2.default;
1249
- loader.pitch = module2.pitch;
1250
- loader.raw = module2.raw;
1251
- if (typeof loader.normal !== "function" && typeof loader.pitch !== "function") {
1252
- return callback(
1253
- new LoaderLoadingError_default(
1254
- `Module '${loader.path}' is not a loader (must have normal or pitch function)`
1255
- )
1256
- );
1257
- }
1258
- callback();
1259
- }
1260
-
1261
- // src/loader-runner/service.ts
1262
- var import_node_path2 = __toESM(require("path"));
1263
- var import_node_worker_threads = require("worker_threads");
1264
- function isWorkerResponseMessage(message) {
1265
- return message.type === "response";
1266
- }
1267
- function isWorkerResponseErrorMessage(message) {
1268
- return message.type === "response-error";
1269
- }
1270
- function serializeError(error) {
1271
- if (error instanceof Error || error && typeof error === "object" && "message" in error) {
1272
- return {
1273
- ...error,
1274
- name: error.name,
1275
- stack: error.stack,
1276
- message: error.message
1277
- };
1278
- }
1279
- if (typeof error === "string") {
1280
- return {
1281
- name: "Error",
1282
- message: error
1283
- };
1284
- }
1285
- throw new Error(
1286
- "Failed to serialize error, only string, Error instances and objects with a message property are supported"
1287
- );
1288
- }
1289
-
1290
- // src/loader-runner/utils.ts
1291
- var import_node_util2 = require("util");
1292
- var decoder = new TextDecoder();
1293
- function utf8BufferToString(buf) {
1294
- const str = decoder.decode(buf);
1295
- if (str.charCodeAt(0) === 65279) {
1296
- return str.slice(1);
1297
- }
1298
- return str;
1299
- }
1300
- function convertArgs(args, raw) {
1301
- if (!raw && args[0] instanceof Uint8Array)
1302
- args[0] = utf8BufferToString(args[0]);
1303
- else if (raw && typeof args[0] === "string")
1304
- args[0] = Buffer.from(args[0], "utf-8");
1305
- if (raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0])) {
1306
- args[0] = Buffer.from(args[0].buffer);
1307
- }
1308
- }
1309
- var loadLoader2 = (0, import_node_util2.promisify)(loadLoader);
1310
- var runSyncOrAsync = (0, import_node_util2.promisify)(function runSyncOrAsync2(fn, context, args, callback) {
1311
- let isSync = true;
1312
- let isDone = false;
1313
- let isError = false;
1314
- let reportedError = false;
1315
- context.async = function async() {
1316
- if (isDone) {
1317
- if (reportedError) return void 0;
1318
- throw new Error("async(): The callback was already called.");
1319
- }
1320
- isSync = false;
1321
- return innerCallback;
1322
- };
1323
- const innerCallback = (err, ...args2) => {
1324
- if (isDone) {
1325
- if (reportedError) return;
1326
- throw new Error("callback(): The callback was already called.");
1327
- }
1328
- isDone = true;
1329
- isSync = false;
1330
- try {
1331
- callback(err, args2);
1332
- } catch (e) {
1333
- isError = true;
1334
- throw e;
1335
- }
1336
- };
1337
- context.callback = innerCallback;
1338
- try {
1339
- const result = function LOADER_EXECUTION() {
1340
- return fn.apply(context, args);
1341
- }();
1342
- if (isSync) {
1343
- isDone = true;
1344
- if (result === void 0) {
1345
- callback(null, []);
1346
- return;
1347
- }
1348
- if (result && typeof result === "object" && typeof result.then === "function") {
1349
- result.then((r) => {
1350
- callback(null, [r]);
1351
- }, callback);
1352
- return;
1353
- }
1354
- callback(null, [result]);
1355
- return;
1356
- }
1357
- } catch (e) {
1358
- const err = e;
1359
- if ("hideStack" in err && err.hideStack) {
1360
- err.hideStack = "true";
1361
- }
1362
- if (isError) throw e;
1363
- if (isDone) {
1364
- if (e instanceof Error) console.error(e.stack);
1365
- else console.error(e);
1366
- return;
1367
- }
1368
- isDone = true;
1369
- reportedError = true;
1370
- callback(e, []);
1371
- }
1372
- });
1373
-
1374
- // src/loader-runner/worker.ts
1375
- var BUILTIN_LOADER_PREFIX = "builtin:";
1376
- var loadLoaderAsync = (0, import_node_util3.promisify)(loadLoader);
1377
- function dirname(path3) {
1378
- if (path3 === "/") return "/";
1379
- const i = path3.lastIndexOf("/");
1380
- const j = path3.lastIndexOf("\\");
1381
- const i2 = path3.indexOf("/");
1382
- const j2 = path3.indexOf("\\");
1383
- const idx = i > j ? i : j;
1384
- const idx2 = i > j ? i2 : j2;
1385
- if (idx < 0) return path3;
1386
- if (idx === idx2) return path3.slice(0, idx + 1);
1387
- return path3.slice(0, idx);
1388
- }
1389
- async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, waitForPendingRequest) {
1390
- const resourcePath = loaderContext.resourcePath;
1391
- const contextDirectory = resourcePath ? dirname(resourcePath) : null;
1392
- const pendingDependencyRequest = [];
1393
- loaderContext.parallel = true;
1394
- loaderContext.dependency = loaderContext.addDependency = function addDependency(file) {
1395
- pendingDependencyRequest.push(
1396
- sendRequest("AddDependency" /* AddDependency */, file)
1397
- );
1398
- };
1399
- loaderContext.addContextDependency = function addContextDependency(context) {
1400
- pendingDependencyRequest.push(
1401
- sendRequest("AddContextDependency" /* AddContextDependency */, context)
1402
- );
1403
- };
1404
- loaderContext.addBuildDependency = function addBuildDependency(file) {
1405
- pendingDependencyRequest.push(
1406
- sendRequest("AddBuildDependency" /* AddBuildDependency */, file)
1407
- );
1408
- };
1409
- loaderContext.getDependencies = function getDependencies() {
1410
- waitForPendingRequest(pendingDependencyRequest);
1411
- return sendRequest("GetDependencies" /* GetDependencies */).wait();
1412
- };
1413
- loaderContext.getContextDependencies = function getContextDependencies() {
1414
- waitForPendingRequest(pendingDependencyRequest);
1415
- return sendRequest("GetContextDependencies" /* GetContextDependencies */).wait();
1416
- };
1417
- loaderContext.getMissingDependencies = function getMissingDependencies() {
1418
- waitForPendingRequest(pendingDependencyRequest);
1419
- return sendRequest("GetMissingDependencies" /* GetMissingDependencies */).wait();
1420
- };
1421
- loaderContext.clearDependencies = function clearDependencies() {
1422
- pendingDependencyRequest.push(sendRequest("ClearDependencies" /* ClearDependencies */));
1423
- };
1424
- loaderContext.resolve = function resolve(context, request, callback) {
1425
- sendRequest("Resolve" /* Resolve */, context, request).then(
1426
- (result) => {
1427
- callback(null, result);
1428
- },
1429
- (err) => {
1430
- callback(err);
1431
- }
1432
- );
1433
- };
1434
- loaderContext.getResolve = function getResolve(options) {
1435
- return (context, request, callback) => {
1436
- if (!callback) {
1437
- return new Promise((resolve, reject) => {
1438
- sendRequest("GetResolve" /* GetResolve */, options, context, request).then(
1439
- (result) => {
1440
- resolve(result);
1441
- },
1442
- (err) => {
1443
- reject(err);
345
+ class DebugHash extends Hash {
346
+ string;
347
+ constructor(){
348
+ super(), this.string = "";
349
+ }
350
+ update(data, inputEncoding) {
351
+ let normalizedData;
352
+ 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;
353
+ }
354
+ digest(encoding) {
355
+ let result = `debug-digest-${Buffer.from(this.string).toString("hex")}`;
356
+ return encoding ? result : Buffer.from(result);
1444
357
  }
1445
- );
1446
- });
1447
- }
1448
- sendRequest("GetResolve" /* GetResolve */, options, context, request).then(
1449
- (result) => {
1450
- callback(null, result);
1451
- },
1452
- (err) => {
1453
- callback(err);
1454
358
  }
1455
- );
1456
- };
1457
- };
1458
- loaderContext.getLogger = function getLogger(name) {
1459
- return {
1460
- error(...args2) {
1461
- sendRequest("GetLogger" /* GetLogger */, "error", name, args2);
1462
- },
1463
- warn(...args2) {
1464
- sendRequest("GetLogger" /* GetLogger */, "warn", name, args2);
1465
- },
1466
- info(...args2) {
1467
- sendRequest("GetLogger" /* GetLogger */, "info", name, args2);
1468
- },
1469
- log(...args2) {
1470
- sendRequest("GetLogger" /* GetLogger */, "log", name, args2);
1471
- },
1472
- debug(...args2) {
1473
- sendRequest("GetLogger" /* GetLogger */, "debug", name, args2);
1474
- },
1475
- assert(assertion, ...args2) {
1476
- if (!assertion) {
1477
- sendRequest("GetLogger" /* GetLogger */, "error", name, args2);
359
+ class WasmHashAdapter extends Hash {
360
+ wasmHash;
361
+ constructor(wasmHash){
362
+ super(), this.wasmHash = wasmHash;
363
+ }
364
+ update(data, inputEncoding) {
365
+ return Buffer.isBuffer(data) ? this.wasmHash.update(data) : this.wasmHash.update(data, inputEncoding), this;
366
+ }
367
+ digest(encoding) {
368
+ return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
369
+ }
1478
370
  }
1479
- },
1480
- trace() {
1481
- sendRequest("GetLogger" /* GetLogger */, "trace", name, ["Trace"]);
1482
- },
1483
- clear() {
1484
- sendRequest("GetLogger" /* GetLogger */, "clear", name);
1485
- },
1486
- status(...args2) {
1487
- sendRequest("GetLogger" /* GetLogger */, "status", name, args2);
1488
- },
1489
- group(...args2) {
1490
- sendRequest("GetLogger" /* GetLogger */, "group", name, args2);
1491
- },
1492
- groupCollapsed(...args2) {
1493
- sendRequest("GetLogger" /* GetLogger */, "groupCollapsed", name, args2);
1494
- },
1495
- groupEnd(...args2) {
1496
- sendRequest("GetLogger" /* GetLogger */, "groupEnd", name, args2);
1497
- },
1498
- profile(label) {
1499
- sendRequest("GetLogger" /* GetLogger */, "profile", name, [label]);
1500
- },
1501
- profileEnd(label) {
1502
- sendRequest("GetLogger" /* GetLogger */, "profileEnd", name, [label]);
1503
- },
1504
- time(label) {
1505
- sendRequest("GetLogger" /* GetLogger */, "time", name, [label]);
1506
- },
1507
- timeEnd(label) {
1508
- sendRequest("GetLogger" /* GetLogger */, "timeEnd", name, [label]);
1509
- },
1510
- timeLog(label, ...args2) {
1511
- sendRequest("GetLogger" /* GetLogger */, "timeLog", name, [label, ...args2]);
1512
- },
1513
- timeAggregate(label) {
1514
- sendRequest("GetLogger" /* GetLogger */, "timeAggregate", name, [label]);
1515
- },
1516
- timeAggregateEnd(label) {
1517
- sendRequest("GetLogger" /* GetLogger */, "timeAggregateEnd", name, [label]);
1518
- }
1519
- };
1520
- };
1521
- loaderContext.emitError = function emitError(err) {
1522
- sendRequest("EmitError" /* EmitError */, serializeError(err));
1523
- };
1524
- loaderContext.emitWarning = function emitWarning(warning) {
1525
- sendRequest("EmitWarning" /* EmitWarning */, serializeError(warning));
1526
- };
1527
- loaderContext.emitFile = function emitFile(name, content, sourceMap, assetInfo) {
1528
- sendRequest("EmitFile" /* EmitFile */, name, content, sourceMap, assetInfo);
1529
- };
1530
- loaderContext.experiments = {
1531
- emitDiagnostic(diagnostic) {
1532
- sendRequest("EmitDiagnostic" /* EmitDiagnostic */, diagnostic);
1533
- }
1534
- };
1535
- const getAbsolutify = memoize(() => absolutify.bindCache({}));
1536
- const getAbsolutifyInContext = memoize(
1537
- () => absolutify.bindContextCache(contextDirectory, {})
1538
- );
1539
- const getContextify = memoize(() => contextify.bindCache({}));
1540
- const getContextifyInContext = memoize(
1541
- () => contextify.bindContextCache(contextDirectory, {})
1542
- );
1543
- loaderContext.utils = {
1544
- absolutify: (context, request) => {
1545
- return context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request);
1546
- },
1547
- contextify: (context, request) => {
1548
- return context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request);
371
+ let createHash = (algorithm)=>{
372
+ if ("function" == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
373
+ switch(algorithm){
374
+ case "debug":
375
+ return new DebugHash();
376
+ case "xxhash64":
377
+ return new WasmHashAdapter(hash_xxhash64());
378
+ case "md4":
379
+ return new WasmHashAdapter(hash_md4());
380
+ case "native-md4":
381
+ return new BulkUpdateDecorator(()=>external_node_crypto_default().createHash("md4"), "md4");
382
+ default:
383
+ return new BulkUpdateDecorator(()=>external_node_crypto_default().createHash(algorithm), algorithm);
384
+ }
385
+ };
1549
386
  },
1550
- createHash: (type) => {
1551
- return createHash(
1552
- type || loaderContext._compilation.outputOptions.hashFunction
1553
- );
1554
- }
1555
- };
1556
- loaderContext._compiler = {
1557
- ...loaderContext._compiler,
1558
- // @ts-expect-error: some properties are missing.
1559
- webpack: {
1560
- util: {
1561
- createHash: (init_createHash(), __toCommonJS(createHash_exports)).createHash,
1562
- cleverMerge: (init_cleverMerge(), __toCommonJS(cleverMerge_exports)).cleverMerge
1563
- }
1564
- }
1565
- };
1566
- loaderContext._compilation = {
1567
- ...loaderContext._compilation,
1568
- getPath(filename, data) {
1569
- return sendRequest("CompilationGetPath" /* CompilationGetPath */, filename, data).wait();
387
+ "node:fs": function(module) {
388
+ module.exports = require("node:fs");
1570
389
  },
1571
- getPathWithInfo(filename, data) {
1572
- return sendRequest(
1573
- "CompilationGetPathWithInfo" /* CompilationGetPathWithInfo */,
1574
- filename,
1575
- data
1576
- ).wait();
390
+ "node:os": function(module) {
391
+ module.exports = require("node:os");
1577
392
  },
1578
- getAssetPath(filename, data) {
1579
- return sendRequest(
1580
- "CompilationGetAssetPath" /* CompilationGetAssetPath */,
1581
- filename,
1582
- data
1583
- ).wait();
393
+ "node:url": function(module) {
394
+ module.exports = require("node:url");
1584
395
  },
1585
- getAssetPathWithInfo(filename, data) {
1586
- return sendRequest(
1587
- "CompilationGetAssetPathWithInfo" /* CompilationGetAssetPathWithInfo */,
1588
- filename,
1589
- data
1590
- ).wait();
1591
- }
1592
- };
1593
- const _module = loaderContext._module;
1594
- loaderContext._module = {
1595
- type: _module.type,
1596
- identifier() {
1597
- return _module.identifier;
396
+ "node:util": function(module) {
397
+ module.exports = require("node:util");
1598
398
  },
1599
- matchResource: _module.matchResource,
1600
- request: _module.request,
1601
- userRequest: _module.userRequest,
1602
- rawRequest: _module.rawRequest
1603
- };
1604
- loaderContext.importModule = function importModule(request, options, callback) {
1605
- if (!callback) {
1606
- return new Promise((resolve, reject) => {
1607
- sendRequest("ImportModule" /* ImportModule */, request, options).then(
1608
- (result) => {
1609
- resolve(result);
1610
- },
1611
- (err) => {
1612
- reject(err);
1613
- }
1614
- );
1615
- });
1616
- }
1617
- sendRequest("ImportModule" /* ImportModule */, request, options).then(
1618
- (result) => {
1619
- callback(null, result);
1620
- },
1621
- (err) => {
1622
- callback(err);
1623
- }
1624
- );
1625
- };
1626
- loaderContext.fs = require("fs");
1627
- Object.defineProperty(loaderContext, "request", {
1628
- enumerable: true,
1629
- get: () => loaderContext.loaders.map((o) => o.request).concat(loaderContext.resource || "").join("!")
1630
- });
1631
- Object.defineProperty(loaderContext, "remainingRequest", {
1632
- enumerable: true,
1633
- get: () => {
1634
- if (loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource)
1635
- return "";
1636
- return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map((o) => o.request).concat(loaderContext.resource || "").join("!");
1637
- }
1638
- });
1639
- Object.defineProperty(loaderContext, "currentRequest", {
1640
- enumerable: true,
1641
- get: () => loaderContext.loaders.slice(loaderContext.loaderIndex).map((o) => o.request).concat(loaderContext.resource || "").join("!")
1642
- });
1643
- Object.defineProperty(loaderContext, "previousRequest", {
1644
- enumerable: true,
1645
- get: () => loaderContext.loaders.slice(0, loaderContext.loaderIndex).map((o) => o.request).join("!")
1646
- });
1647
- Object.defineProperty(loaderContext, "query", {
1648
- enumerable: true,
1649
- get: () => {
1650
- const entry = loaderContext.loaders[loaderContext.loaderIndex];
1651
- return entry.options && typeof entry.options === "object" ? entry.options : entry.query;
399
+ tinypool: function(module) {
400
+ module.exports = import("../compiled/tinypool/dist/index.js").then(function(module) {
401
+ return module;
402
+ });
1652
403
  }
1653
- });
1654
- loaderContext.getOptions = function getOptions() {
1655
- const loader = getCurrentLoader(loaderContext);
1656
- let options = loader == null ? void 0 : loader.options;
1657
- if (typeof options === "string") {
1658
- if (options.startsWith("{") && options.endsWith("}")) {
1659
- try {
1660
- const parseJson = require_lib();
1661
- options = parseJson(options);
404
+ }, __webpack_module_cache__ = {};
405
+ function __webpack_require__(moduleId) {
406
+ var cachedModule = __webpack_module_cache__[moduleId];
407
+ if (void 0 !== cachedModule) return cachedModule.exports;
408
+ var module = __webpack_module_cache__[moduleId] = {
409
+ exports: {}
410
+ };
411
+ return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
412
+ }
413
+ __webpack_require__.n = (module)=>{
414
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
415
+ return __webpack_require__.d(getter, {
416
+ a: getter
417
+ }), getter;
418
+ }, __webpack_require__.d = (exports1, definition)=>{
419
+ for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
420
+ enumerable: !0,
421
+ get: definition[key]
422
+ });
423
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
424
+ 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
425
+ value: 'Module'
426
+ }), Object.defineProperty(exports1, '__esModule', {
427
+ value: !0
428
+ });
429
+ };
430
+ var __webpack_exports__ = {};
431
+ for(var __webpack_i__ in (()=>{
432
+ let url;
433
+ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
434
+ default: ()=>loader_runner_worker
435
+ });
436
+ let external_node_querystring_namespaceObject = require("node:querystring");
437
+ var RequestType, RequestSyncType, external_node_querystring_default = __webpack_require__.n(external_node_querystring_namespaceObject), external_node_util_ = __webpack_require__("node:util");
438
+ let external_node_worker_threads_namespaceObject = require("node:worker_threads"), binding_namespaceObject = require("@rspack/binding");
439
+ var createHash = __webpack_require__("./src/util/createHash.ts");
440
+ let external_node_path_namespaceObject = require("node:path");
441
+ var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
442
+ 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)=>{
443
+ if ("/" === maybeAbsolutePath[0]) {
444
+ if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
445
+ let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
446
+ return resource = relativePathToRequest(external_node_path_default().posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
447
+ }
448
+ if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
449
+ let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
450
+ 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);
451
+ }
452
+ return maybeAbsolutePath;
453
+ }, requestToAbsolute = (context, relativePath)=>relativePath.startsWith("./") || relativePath.startsWith("../") ? external_node_path_default().join(context, relativePath) : relativePath, makeCacheable = (realFn)=>{
454
+ let cache = new WeakMap(), getCache = (associatedObjectForCache)=>{
455
+ let entry = cache.get(associatedObjectForCache);
456
+ if (void 0 !== entry) return entry;
457
+ let map = new Map();
458
+ return cache.set(associatedObjectForCache, map), map;
459
+ }, fn = (str, associatedObjectForCache)=>{
460
+ if (!associatedObjectForCache) return realFn(str);
461
+ let cache = getCache(associatedObjectForCache), entry = cache.get(str);
462
+ if (void 0 !== entry) return entry;
463
+ let result = realFn(str);
464
+ return cache.set(str, result), result;
465
+ };
466
+ return fn.bindCache = (associatedObjectForCache)=>{
467
+ let cache = getCache(associatedObjectForCache);
468
+ return (str)=>{
469
+ let entry = cache.get(str);
470
+ if (void 0 !== entry) return entry;
471
+ let result = realFn(str);
472
+ return cache.set(str, result), result;
473
+ };
474
+ }, fn;
475
+ }, makeCacheableWithContext = (fn)=>{
476
+ let cache = new WeakMap(), cachedFn = (context, identifier, associatedObjectForCache)=>{
477
+ let cachedResult;
478
+ if (!associatedObjectForCache) return fn(context, identifier);
479
+ let innerCache = cache.get(associatedObjectForCache);
480
+ void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache));
481
+ let innerSubCache = innerCache.get(context);
482
+ if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
483
+ let result = fn(context, identifier);
484
+ return innerSubCache.set(identifier, result), result;
485
+ };
486
+ return cachedFn.bindCache = (associatedObjectForCache)=>{
487
+ let innerCache;
488
+ return associatedObjectForCache ? void 0 === (innerCache = cache.get(associatedObjectForCache)) && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)) : innerCache = new Map(), (context, identifier)=>{
489
+ let cachedResult, innerSubCache = innerCache?.get(context);
490
+ if (void 0 === innerSubCache ? (innerSubCache = new Map(), innerCache?.set(context, innerSubCache)) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
491
+ let result = fn(context, identifier);
492
+ return innerSubCache.set(identifier, result), result;
493
+ };
494
+ }, cachedFn.bindContextCache = (context, associatedObjectForCache)=>{
495
+ let innerSubCache;
496
+ if (associatedObjectForCache) {
497
+ let innerCache = cache.get(associatedObjectForCache);
498
+ void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)), void 0 === (innerSubCache = innerCache.get(context)) && innerCache.set(context, innerSubCache = new Map());
499
+ } else innerSubCache = new Map();
500
+ return (identifier)=>{
501
+ let cachedResult = innerSubCache?.get(identifier);
502
+ if (void 0 !== cachedResult) return cachedResult;
503
+ let result = fn(context, identifier);
504
+ return innerSubCache?.set(identifier, result), result;
505
+ };
506
+ }, cachedFn;
507
+ };
508
+ makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join("")), makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>requestToAbsolute(context, str)).join(""));
509
+ let contextify = makeCacheableWithContext((context, request)=>request.split("!").map((r)=>absoluteToRequest(context, r)).join("!")), absolutify = makeCacheableWithContext((context, request)=>request.split("!").map((r)=>requestToAbsolute(context, r)).join("!")), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/;
510
+ makeCacheable((str)=>{
511
+ let match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
512
+ return {
513
+ resource: str,
514
+ path: match[1].replace(/\u200b(.)/g, "$1"),
515
+ query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : "",
516
+ fragment: match[3] || ""
517
+ };
518
+ }), makeCacheable((str)=>{
519
+ let match = PATH_QUERY_REGEXP.exec(str);
520
+ return {
521
+ resource: str,
522
+ path: match[1].replace(/\u200b(.)/g, "$1"),
523
+ query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
524
+ };
525
+ });
526
+ let memoize = (fn)=>{
527
+ let result, cache = !1, callback = fn;
528
+ return ()=>(cache || (result = callback(), cache = !0, callback = void 0), result);
529
+ }, LoaderLoadingError = class extends Error {
530
+ constructor(message){
531
+ super(message), this.name = "LoaderRunnerError", Error.captureStackTrace(this, this.constructor);
532
+ }
533
+ };
534
+ function loadLoader(loader, callback) {
535
+ if ("module" === loader.type) try {
536
+ void 0 === url && (url = __webpack_require__("node:url")), import(url.pathToFileURL(loader.path).toString()).then((module)=>{
537
+ handleResult(loader, module, callback);
538
+ }, callback);
539
+ return;
1662
540
  } catch (e) {
1663
- throw new Error(`Cannot parse string options: ${e.message}`);
1664
- }
1665
- } else {
1666
- options = import_node_querystring.default.parse(options);
1667
- }
1668
- }
1669
- if (options === null || options === void 0) {
1670
- options = {};
1671
- }
1672
- return options;
1673
- };
1674
- loaderContext.cacheable = function cacheable(flag) {
1675
- if (flag === false) {
1676
- sendRequest("SetCacheable" /* SetCacheable */, false);
1677
- }
1678
- };
1679
- Object.defineProperty(loaderContext, "data", {
1680
- enumerable: true,
1681
- get: () => loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
1682
- set: (value) => {
1683
- loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = value;
1684
- }
1685
- });
1686
- const shouldYieldToMainThread = (currentLoaderObject) => {
1687
- if (!(currentLoaderObject == null ? void 0 : currentLoaderObject.parallel)) {
1688
- return true;
1689
- }
1690
- if (currentLoaderObject == null ? void 0 : currentLoaderObject.request.startsWith(BUILTIN_LOADER_PREFIX)) {
1691
- return true;
1692
- }
1693
- return false;
1694
- };
1695
- switch (loaderState) {
1696
- case import_binding.JsLoaderState.Pitching: {
1697
- while (loaderContext.loaderIndex < loaderContext.loaders.length) {
1698
- const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
1699
- if (shouldYieldToMainThread(currentLoaderObject)) break;
1700
- if (currentLoaderObject.pitchExecuted) {
1701
- loaderContext.loaderIndex += 1;
1702
- continue;
1703
- }
1704
- await loadLoaderAsync(currentLoaderObject);
1705
- const fn = currentLoaderObject.pitch;
1706
- currentLoaderObject.pitchExecuted = true;
1707
- if (!fn) continue;
1708
- args = await runSyncOrAsync(fn, loaderContext, [
1709
- loaderContext.remainingRequest,
1710
- loaderContext.previousRequest,
1711
- currentLoaderObject.loaderItem.data
1712
- ]) || [];
1713
- const hasArg = args.some((value) => value !== void 0);
1714
- if (hasArg) {
1715
- break;
1716
- }
1717
- }
1718
- }
1719
- case import_binding.JsLoaderState.Normal: {
1720
- while (loaderContext.loaderIndex >= 0) {
1721
- const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
1722
- if (shouldYieldToMainThread(currentLoaderObject)) break;
1723
- if (currentLoaderObject.normalExecuted) {
1724
- loaderContext.loaderIndex--;
1725
- continue;
541
+ callback(e);
542
+ }
543
+ else {
544
+ let module;
545
+ try {
546
+ module = require(loader.path);
547
+ } catch (e) {
548
+ if (e instanceof Error && "EMFILE" === e.code) return void setImmediate(loadLoader.bind(null, loader, callback));
549
+ return callback(e);
550
+ }
551
+ return handleResult(loader, module, callback);
1726
552
  }
1727
- await loadLoaderAsync(currentLoaderObject);
1728
- const fn = currentLoaderObject.normal;
1729
- currentLoaderObject.normalExecuted = true;
1730
- if (!fn) continue;
1731
- convertArgs(args, !!currentLoaderObject.raw);
1732
- args = await runSyncOrAsync(fn, loaderContext, args) || [];
1733
- }
1734
553
  }
1735
- }
1736
- sendRequest(
1737
- "UpdateLoaderObjects" /* UpdateLoaderObjects */,
1738
- loaderContext.loaders.map((item) => {
1739
- return {
1740
- data: item.loaderItem.data,
1741
- normalExecuted: item.normalExecuted,
1742
- pitchExecuted: item.pitchExecuted
1743
- };
1744
- })
1745
- );
1746
- return args;
1747
- }
1748
- var nextId = 0;
1749
- var responseCallbacks = {};
1750
- function handleIncomingResponses(workerMessage) {
1751
- if (isWorkerResponseMessage(workerMessage)) {
1752
- const { id, data } = workerMessage;
1753
- const callback = responseCallbacks[id];
1754
- if (callback) {
1755
- delete responseCallbacks[id];
1756
- callback(
1757
- null,
1758
- /* data */
1759
- data
1760
- );
1761
- } else {
1762
- throw new Error(`No callback found for response with id ${id}`);
554
+ function handleResult(loader, module, callback) {
555
+ 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, "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();
1763
556
  }
1764
- } else if (isWorkerResponseErrorMessage(workerMessage)) {
1765
- const { id, error } = workerMessage;
1766
- const callback = responseCallbacks[id];
1767
- if (callback) {
1768
- delete responseCallbacks[id];
1769
- callback(error, void 0);
1770
- } else {
1771
- throw new Error(`No callback found for response with id ${id}`);
557
+ function isWorkerResponseMessage(message) {
558
+ return "response" === message.type;
1772
559
  }
1773
- }
1774
- }
1775
- function createWaitForPendingRequest(sendRequest) {
1776
- return (requests) => {
1777
- return sendRequest.sync(
1778
- "WaitForPendingRequest" /* WaitForPendingRequest */,
1779
- (Array.isArray(requests) ? requests : [requests]).map((request) => {
1780
- return request.id;
1781
- })
1782
- );
1783
- };
1784
- }
1785
- function createSendRequest(workerPort, workerSyncPort) {
1786
- const sendRequest = (requestType, ...args) => {
1787
- const id = nextId++;
1788
- workerPort.postMessage({
1789
- type: "request",
1790
- id,
1791
- requestType,
1792
- data: args
1793
- });
1794
- const result = new Promise((resolve, reject) => {
1795
- responseCallbacks[id] = (err, data) => {
1796
- if (err) {
1797
- reject(err);
1798
- return;
560
+ var service_RequestType = ((RequestType = {}).AddDependency = "AddDependency", RequestType.AddContextDependency = "AddContextDependency", RequestType.AddMissingDependency = "AddMissingDependency", RequestType.AddBuildDependency = "AddBuildDependency", RequestType.GetDependencies = "GetDependencies", RequestType.GetContextDependencies = "GetContextDependencies", RequestType.GetMissingDependencies = "GetMissingDependencies", RequestType.ClearDependencies = "ClearDependencies", RequestType.Resolve = "Resolve", RequestType.GetResolve = "GetResolve", RequestType.GetLogger = "GetLogger", RequestType.EmitError = "EmitError", RequestType.EmitWarning = "EmitWarning", RequestType.EmitFile = "EmitFile", RequestType.EmitDiagnostic = "EmitDiagnostic", RequestType.SetCacheable = "SetCacheable", RequestType.ImportModule = "ImportModule", RequestType.UpdateLoaderObjects = "UpdateLoaderObjects", RequestType.CompilationGetPath = "CompilationGetPath", RequestType.CompilationGetPathWithInfo = "CompilationGetPathWithInfo", RequestType.CompilationGetAssetPath = "CompilationGetAssetPath", RequestType.CompilationGetAssetPathWithInfo = "CompilationGetAssetPathWithInfo", RequestType), service_RequestSyncType = ((RequestSyncType = {}).WaitForPendingRequest = "WaitForPendingRequest", RequestSyncType);
561
+ function serializeError(error) {
562
+ if (error instanceof Error || error && "object" == typeof error && "message" in error) return {
563
+ ...error,
564
+ name: error.name,
565
+ stack: error.stack,
566
+ message: error.message
567
+ };
568
+ if ("string" == typeof error) return {
569
+ name: "Error",
570
+ message: error
571
+ };
572
+ throw Error("Failed to serialize error, only string, Error instances and objects with a message property are supported");
573
+ }
574
+ let decoder = new TextDecoder();
575
+ (0, external_node_util_.promisify)(loadLoader);
576
+ let utils_runSyncOrAsync = (0, external_node_util_.promisify)(function(fn, context, args, callback) {
577
+ let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
578
+ context.async = function() {
579
+ if (isDone) {
580
+ if (reportedError) return;
581
+ throw Error("async(): The callback was already called.");
582
+ }
583
+ return isSync = !1, innerCallback;
584
+ };
585
+ let innerCallback = (err, ...args)=>{
586
+ if (isDone) {
587
+ if (reportedError) return;
588
+ throw Error("callback(): The callback was already called.");
589
+ }
590
+ isDone = !0, isSync = !1;
591
+ try {
592
+ callback(err, args);
593
+ } catch (e) {
594
+ throw isError = !0, e;
595
+ }
596
+ };
597
+ context.callback = innerCallback;
598
+ try {
599
+ let result = fn.apply(context, args);
600
+ if (isSync) {
601
+ if (isDone = !0, void 0 === result) return void callback(null, []);
602
+ if (result && "object" == typeof result && "function" == typeof result.then) return void result.then((r)=>{
603
+ callback(null, [
604
+ r
605
+ ]);
606
+ }, callback);
607
+ callback(null, [
608
+ result
609
+ ]);
610
+ return;
611
+ }
612
+ } catch (e) {
613
+ if ("hideStack" in e && e.hideStack && (e.hideStack = "true"), isError) throw e;
614
+ if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
615
+ isDone = !0, reportedError = !0, callback(e, []);
616
+ }
617
+ }), loadLoaderAsync = (0, external_node_util_.promisify)(loadLoader);
618
+ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, waitForPendingRequest) {
619
+ let resourcePath = loaderContext.resourcePath, contextDirectory = resourcePath ? function(path) {
620
+ if ("/" === path) return "/";
621
+ let i = path.lastIndexOf("/"), j = path.lastIndexOf("\\"), i2 = path.indexOf("/"), j2 = path.indexOf("\\"), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
622
+ return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
623
+ }(resourcePath) : null, pendingDependencyRequest = [];
624
+ loaderContext.parallel = !0, loaderContext.dependency = loaderContext.addDependency = function(file) {
625
+ pendingDependencyRequest.push(sendRequest(service_RequestType.AddDependency, file));
626
+ }, loaderContext.addContextDependency = function(context) {
627
+ pendingDependencyRequest.push(sendRequest(service_RequestType.AddContextDependency, context));
628
+ }, loaderContext.addBuildDependency = function(file) {
629
+ pendingDependencyRequest.push(sendRequest(service_RequestType.AddBuildDependency, file));
630
+ }, loaderContext.getDependencies = function() {
631
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetDependencies).wait();
632
+ }, loaderContext.getContextDependencies = function() {
633
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetContextDependencies).wait();
634
+ }, loaderContext.getMissingDependencies = function() {
635
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetMissingDependencies).wait();
636
+ }, loaderContext.clearDependencies = function() {
637
+ pendingDependencyRequest.push(sendRequest(service_RequestType.ClearDependencies));
638
+ }, loaderContext.resolve = function(context, request, callback) {
639
+ sendRequest(service_RequestType.Resolve, context, request).then((result)=>{
640
+ callback(null, result);
641
+ }, (err)=>{
642
+ callback(err);
643
+ });
644
+ }, loaderContext.getResolve = function(options) {
645
+ return (context, request, callback)=>{
646
+ if (!callback) return new Promise((resolve, reject)=>{
647
+ sendRequest(service_RequestType.GetResolve, options, context, request).then((result)=>{
648
+ resolve(result);
649
+ }, (err)=>{
650
+ reject(err);
651
+ });
652
+ });
653
+ sendRequest(service_RequestType.GetResolve, options, context, request).then((result)=>{
654
+ callback(null, result);
655
+ }, (err)=>{
656
+ callback(err);
657
+ });
658
+ };
659
+ }, loaderContext.getLogger = function(name) {
660
+ return {
661
+ error (...args) {
662
+ sendRequest(service_RequestType.GetLogger, "error", name, args);
663
+ },
664
+ warn (...args) {
665
+ sendRequest(service_RequestType.GetLogger, "warn", name, args);
666
+ },
667
+ info (...args) {
668
+ sendRequest(service_RequestType.GetLogger, "info", name, args);
669
+ },
670
+ log (...args) {
671
+ sendRequest(service_RequestType.GetLogger, "log", name, args);
672
+ },
673
+ debug (...args) {
674
+ sendRequest(service_RequestType.GetLogger, "debug", name, args);
675
+ },
676
+ assert (assertion, ...args) {
677
+ assertion || sendRequest(service_RequestType.GetLogger, "error", name, args);
678
+ },
679
+ trace () {
680
+ sendRequest(service_RequestType.GetLogger, "trace", name, [
681
+ "Trace"
682
+ ]);
683
+ },
684
+ clear () {
685
+ sendRequest(service_RequestType.GetLogger, "clear", name);
686
+ },
687
+ status (...args) {
688
+ sendRequest(service_RequestType.GetLogger, "status", name, args);
689
+ },
690
+ group (...args) {
691
+ sendRequest(service_RequestType.GetLogger, "group", name, args);
692
+ },
693
+ groupCollapsed (...args) {
694
+ sendRequest(service_RequestType.GetLogger, "groupCollapsed", name, args);
695
+ },
696
+ groupEnd (...args) {
697
+ sendRequest(service_RequestType.GetLogger, "groupEnd", name, args);
698
+ },
699
+ profile (label) {
700
+ sendRequest(service_RequestType.GetLogger, "profile", name, [
701
+ label
702
+ ]);
703
+ },
704
+ profileEnd (label) {
705
+ sendRequest(service_RequestType.GetLogger, "profileEnd", name, [
706
+ label
707
+ ]);
708
+ },
709
+ time (label) {
710
+ sendRequest(service_RequestType.GetLogger, "time", name, [
711
+ label
712
+ ]);
713
+ },
714
+ timeEnd (label) {
715
+ sendRequest(service_RequestType.GetLogger, "timeEnd", name, [
716
+ label
717
+ ]);
718
+ },
719
+ timeLog (label, ...args) {
720
+ sendRequest(service_RequestType.GetLogger, "timeLog", name, [
721
+ label,
722
+ ...args
723
+ ]);
724
+ },
725
+ timeAggregate (label) {
726
+ sendRequest(service_RequestType.GetLogger, "timeAggregate", name, [
727
+ label
728
+ ]);
729
+ },
730
+ timeAggregateEnd (label) {
731
+ sendRequest(service_RequestType.GetLogger, "timeAggregateEnd", name, [
732
+ label
733
+ ]);
734
+ }
735
+ };
736
+ }, loaderContext.emitError = function(err) {
737
+ sendRequest(service_RequestType.EmitError, serializeError(err));
738
+ }, loaderContext.emitWarning = function(warning) {
739
+ sendRequest(service_RequestType.EmitWarning, serializeError(warning));
740
+ }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
741
+ sendRequest(service_RequestType.EmitFile, name, content, sourceMap, assetInfo);
742
+ }, loaderContext.experiments = {
743
+ emitDiagnostic (diagnostic) {
744
+ sendRequest(service_RequestType.EmitDiagnostic, diagnostic);
745
+ }
746
+ };
747
+ let getAbsolutify = memoize(()=>absolutify.bindCache({})), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, {})), getContextify = memoize(()=>contextify.bindCache({})), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, {}));
748
+ loaderContext.utils = {
749
+ absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
750
+ contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
751
+ createHash: (type)=>(0, createHash.j)(type || loaderContext._compilation.outputOptions.hashFunction)
752
+ }, loaderContext._compiler = {
753
+ ...loaderContext._compiler,
754
+ webpack: {
755
+ util: {
756
+ createHash: __webpack_require__("./src/util/createHash.ts").j,
757
+ cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").R_
758
+ }
759
+ }
760
+ }, loaderContext._compilation = {
761
+ ...loaderContext._compilation,
762
+ getPath: (filename, data)=>sendRequest(service_RequestType.CompilationGetPath, filename, data).wait(),
763
+ getPathWithInfo: (filename, data)=>sendRequest(service_RequestType.CompilationGetPathWithInfo, filename, data).wait(),
764
+ getAssetPath: (filename, data)=>sendRequest(service_RequestType.CompilationGetAssetPath, filename, data).wait(),
765
+ getAssetPathWithInfo: (filename, data)=>sendRequest(service_RequestType.CompilationGetAssetPathWithInfo, filename, data).wait()
766
+ };
767
+ let _module = loaderContext._module;
768
+ loaderContext._module = {
769
+ type: _module.type,
770
+ identifier: ()=>_module.identifier,
771
+ matchResource: _module.matchResource,
772
+ request: _module.request,
773
+ userRequest: _module.userRequest,
774
+ rawRequest: _module.rawRequest
775
+ }, loaderContext.importModule = function(request, options, callback) {
776
+ if (!callback) return new Promise((resolve, reject)=>{
777
+ sendRequest(service_RequestType.ImportModule, request, options).then((result)=>{
778
+ resolve(result);
779
+ }, (err)=>{
780
+ reject(err);
781
+ });
782
+ });
783
+ sendRequest(service_RequestType.ImportModule, request, options).then((result)=>{
784
+ callback(null, result);
785
+ }, (err)=>{
786
+ callback(err);
787
+ });
788
+ }, loaderContext.fs = __webpack_require__("node:fs"), Object.defineProperty(loaderContext, "request", {
789
+ enumerable: !0,
790
+ get: ()=>loaderContext.loaders.map((o)=>o.request).concat(loaderContext.resource || "").join("!")
791
+ }), Object.defineProperty(loaderContext, "remainingRequest", {
792
+ enumerable: !0,
793
+ get: ()=>loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource ? "" : loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map((o)=>o.request).concat(loaderContext.resource || "").join("!")
794
+ }), Object.defineProperty(loaderContext, "currentRequest", {
795
+ enumerable: !0,
796
+ get: ()=>loaderContext.loaders.slice(loaderContext.loaderIndex).map((o)=>o.request).concat(loaderContext.resource || "").join("!")
797
+ }), Object.defineProperty(loaderContext, "previousRequest", {
798
+ enumerable: !0,
799
+ get: ()=>loaderContext.loaders.slice(0, loaderContext.loaderIndex).map((o)=>o.request).join("!")
800
+ }), Object.defineProperty(loaderContext, "query", {
801
+ enumerable: !0,
802
+ get: ()=>{
803
+ let entry = loaderContext.loaders[loaderContext.loaderIndex];
804
+ return entry.options && "object" == typeof entry.options ? entry.options : entry.query;
805
+ }
806
+ }), loaderContext.getOptions = function() {
807
+ let loader = function(loaderContext, index = loaderContext.loaderIndex) {
808
+ return loaderContext.loaders?.length && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index] ? loaderContext.loaders[index] : null;
809
+ }(loaderContext), options = loader?.options;
810
+ if ("string" == typeof options) if (options.startsWith("{") && options.endsWith("}")) try {
811
+ options = JSON.parse(options);
812
+ } catch (e) {
813
+ throw Error(`JSON parsing failed for loader's string options: ${e.message}`);
814
+ }
815
+ else options = external_node_querystring_default().parse(options);
816
+ return null == options && (options = {}), options;
817
+ }, loaderContext.cacheable = function(flag) {
818
+ !1 === flag && sendRequest(service_RequestType.SetCacheable, !1);
819
+ }, Object.defineProperty(loaderContext, "data", {
820
+ enumerable: !0,
821
+ get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
822
+ set: (value)=>{
823
+ loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = value;
824
+ }
825
+ });
826
+ let shouldYieldToMainThread = (currentLoaderObject)=>!!(!currentLoaderObject?.parallel || currentLoaderObject?.request.startsWith("builtin:"));
827
+ switch(loaderState){
828
+ case binding_namespaceObject.JsLoaderState.Pitching:
829
+ for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
830
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
831
+ if (shouldYieldToMainThread(currentLoaderObject)) break;
832
+ if (currentLoaderObject.pitchExecuted) {
833
+ loaderContext.loaderIndex += 1;
834
+ continue;
835
+ }
836
+ await loadLoaderAsync(currentLoaderObject);
837
+ let fn = currentLoaderObject.pitch;
838
+ if ((currentLoaderObject.pitchExecuted = !0, fn) && (args = await utils_runSyncOrAsync(fn, loaderContext, [
839
+ loaderContext.remainingRequest,
840
+ loaderContext.previousRequest,
841
+ currentLoaderObject.loaderItem.data
842
+ ]) || []).some((value)=>void 0 !== value)) break;
843
+ }
844
+ case binding_namespaceObject.JsLoaderState.Normal:
845
+ for(; loaderContext.loaderIndex >= 0;){
846
+ var args1, raw;
847
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
848
+ if (shouldYieldToMainThread(currentLoaderObject)) break;
849
+ if (currentLoaderObject.normalExecuted) {
850
+ loaderContext.loaderIndex--;
851
+ continue;
852
+ }
853
+ await loadLoaderAsync(currentLoaderObject);
854
+ let fn = currentLoaderObject.normal;
855
+ currentLoaderObject.normalExecuted = !0, fn && (args1 = args, !(raw = !!currentLoaderObject.raw) && args1[0] instanceof Uint8Array ? args1[0] = function(buf) {
856
+ let str = decoder.decode(buf);
857
+ return 0xfeff === str.charCodeAt(0) ? str.slice(1) : str;
858
+ }(args1[0]) : raw && "string" == typeof args1[0] && (args1[0] = Buffer.from(args1[0], "utf-8")), raw && args1[0] instanceof Uint8Array && !Buffer.isBuffer(args1[0]) && (args1[0] = Buffer.from(args1[0].buffer)), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
859
+ }
1799
860
  }
1800
- resolve(data);
1801
- };
1802
- });
1803
- result.wait = () => {
1804
- return sendRequest.sync("WaitForPendingRequest" /* WaitForPendingRequest */, id);
861
+ return sendRequest(service_RequestType.UpdateLoaderObjects, loaderContext.loaders.map((item)=>({
862
+ data: item.loaderItem.data,
863
+ normalExecuted: item.normalExecuted,
864
+ pitchExecuted: item.pitchExecuted
865
+ }))), args;
866
+ }
867
+ let nextId = 0, responseCallbacks = {};
868
+ function handleIncomingResponses(workerMessage) {
869
+ if (isWorkerResponseMessage(workerMessage)) {
870
+ let { id, data } = workerMessage, callback = responseCallbacks[id];
871
+ if (callback) delete responseCallbacks[id], callback(null, data);
872
+ else throw Error(`No callback found for response with id ${id}`);
873
+ } else if ("response-error" === workerMessage.type) {
874
+ let { id, error } = workerMessage, callback = responseCallbacks[id];
875
+ if (callback) delete responseCallbacks[id], callback(error, void 0);
876
+ else throw Error(`No callback found for response with id ${id}`);
877
+ }
878
+ }
879
+ let loader_runner_worker = function(workerOptions) {
880
+ var sendRequest;
881
+ let workerData = workerOptions.workerData;
882
+ delete workerOptions.workerData, workerData.workerPort.on("message", handleIncomingResponses);
883
+ let sendRequest1 = function(workerPort, workerSyncPort) {
884
+ var workerSyncPort1;
885
+ let sendRequest = (requestType, ...args)=>{
886
+ let id = nextId++;
887
+ workerPort.postMessage({
888
+ type: "request",
889
+ id,
890
+ requestType,
891
+ data: args
892
+ });
893
+ let result = new Promise((resolve, reject)=>{
894
+ responseCallbacks[id] = (err, data)=>{
895
+ if (err) return void reject(err);
896
+ resolve(data);
897
+ };
898
+ });
899
+ return result.wait = ()=>sendRequest.sync(service_RequestSyncType.WaitForPendingRequest, id), result.id = id, result;
900
+ };
901
+ return sendRequest.sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
902
+ let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
903
+ workerSyncPort1.postMessage({
904
+ type: "request-sync",
905
+ id,
906
+ requestType,
907
+ data: args,
908
+ sharedBuffer
909
+ });
910
+ let status = Atomics.wait(sharedBufferView, 0, 0);
911
+ if ("ok" !== status && "not-equal" !== status) throw Error(`Internal error: Atomics.wait() failed: ${status}`);
912
+ let { message } = (0, external_node_worker_threads_namespaceObject.receiveMessageOnPort)(workerSyncPort1);
913
+ if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
914
+ if (isWorkerResponseMessage(message)) return message.data;
915
+ throw message.error;
916
+ }), sendRequest;
917
+ }(workerData.workerPort, workerData.workerSyncPort), waitFor = (sendRequest = sendRequest1, (requests)=>sendRequest.sync(service_RequestSyncType.WaitForPendingRequest, (Array.isArray(requests) ? requests : [
918
+ requests
919
+ ]).map((request)=>request.id)));
920
+ loaderImpl(workerOptions, sendRequest1, waitFor).then(async (data)=>{
921
+ workerData.workerPort.postMessage({
922
+ type: "done",
923
+ data
924
+ });
925
+ }).catch(async (err)=>{
926
+ workerData.workerPort.postMessage({
927
+ type: "done-error",
928
+ error: serializeError(err)
929
+ });
930
+ });
1805
931
  };
1806
- result.id = id;
1807
- return result;
1808
- };
1809
- sendRequest.sync = createSendRequestSync(workerSyncPort);
1810
- return sendRequest;
1811
- }
1812
- function createSendRequestSync(workerSyncPort) {
1813
- return (requestType, ...args) => {
1814
- const id = nextId++;
1815
- const sharedBuffer = new SharedArrayBuffer(8);
1816
- const sharedBufferView = new Int32Array(sharedBuffer);
1817
- workerSyncPort.postMessage({
1818
- type: "request-sync",
1819
- id,
1820
- requestType,
1821
- data: args,
1822
- sharedBuffer
1823
- });
1824
- const status = Atomics.wait(sharedBufferView, 0, 0);
1825
- if (status !== "ok" && status !== "not-equal")
1826
- throw new Error(`Internal error: Atomics.wait() failed: ${status}`);
1827
- const {
1828
- message
1829
- } = (0, import_node_worker_threads2.receiveMessageOnPort)(workerSyncPort);
1830
- if (id !== message.id) {
1831
- throw new Error(`Unexpected response id: ${message.id}, expected: ${id}`);
1832
- }
1833
- if (isWorkerResponseMessage(message)) {
1834
- return message.data;
1835
- }
1836
- throw message.error;
1837
- };
1838
- }
1839
- function worker(workerOptions) {
1840
- const workerData = workerOptions.workerData;
1841
- delete workerOptions.workerData;
1842
- workerData.workerPort.on("message", handleIncomingResponses);
1843
- const sendRequest = createSendRequest(
1844
- workerData.workerPort,
1845
- workerData.workerSyncPort
1846
- );
1847
- const waitFor = createWaitForPendingRequest(sendRequest);
1848
- loaderImpl(workerOptions, sendRequest, waitFor).then(async (data) => {
1849
- workerData.workerPort.postMessage({ type: "done", data });
1850
- }).catch(async (err) => {
1851
- workerData.workerPort.postMessage({
1852
- type: "done-error",
1853
- error: serializeError(err)
1854
- });
1855
- });
1856
- }
1857
- function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
1858
- var _a;
1859
- if (((_a = loaderContext.loaders) == null ? void 0 : _a.length) && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index]) {
1860
- return loaderContext.loaders[index];
1861
- }
1862
- return null;
1863
- }
1864
- module.exports = worker;
932
+ })(), exports.default = __webpack_exports__.default, __webpack_exports__)-1 === [
933
+ "default"
934
+ ].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
935
+ Object.defineProperty(exports, '__esModule', {
936
+ value: !0
937
+ });
938
+
939
+ module.exports = __webpack_exports__.default;