@rspack/core 1.3.0 → 1.3.2

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/index.js CHANGED
@@ -148,15 +148,15 @@ var require_CachedInputFileSystem = __commonJS({
148
148
  "../../node_modules/.pnpm/enhanced-resolve@5.18.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js"(exports2, module2) {
149
149
  "use strict";
150
150
  var nextTick = require("process").nextTick;
151
- var dirname4 = (path12) => {
152
- let idx = path12.length - 1;
151
+ var dirname4 = (path13) => {
152
+ let idx = path13.length - 1;
153
153
  while (idx >= 0) {
154
- const c = path12.charCodeAt(idx);
154
+ const c = path13.charCodeAt(idx);
155
155
  if (c === 47 || c === 92) break;
156
156
  idx--;
157
157
  }
158
158
  if (idx < 0) return "";
159
- return path12.slice(0, idx);
159
+ return path13.slice(0, idx);
160
160
  };
161
161
  var runCallbacks = (callbacks, err, result2) => {
162
162
  if (callbacks.length === 1) {
@@ -193,13 +193,13 @@ var require_CachedInputFileSystem = __commonJS({
193
193
  * @param {FileSystemCallback<any>=} callback callback
194
194
  * @returns {any} result
195
195
  */
196
- (path12, options, callback) => {
196
+ (path13, options, callback) => {
197
197
  if (typeof options === "function") {
198
198
  callback = /** @type {FileSystemCallback<any>} */
199
199
  options;
200
200
  options = void 0;
201
201
  }
202
- if (typeof path12 !== "string" && !Buffer.isBuffer(path12) && !(path12 instanceof URL) && typeof path12 !== "number") {
202
+ if (typeof path13 !== "string" && !Buffer.isBuffer(path13) && !(path13 instanceof URL) && typeof path13 !== "number") {
203
203
  callback(
204
204
  new TypeError("path must be a string, Buffer, URL or number")
205
205
  );
@@ -210,26 +210,26 @@ var require_CachedInputFileSystem = __commonJS({
210
210
  /** @type {Function} */
211
211
  this._provider.call(
212
212
  this._providerContext,
213
- path12,
213
+ path13,
214
214
  options,
215
215
  callback
216
216
  )
217
217
  );
218
218
  }
219
- let callbacks = this._activeAsyncOperations.get(path12);
219
+ let callbacks = this._activeAsyncOperations.get(path13);
220
220
  if (callbacks) {
221
221
  callbacks.push(callback);
222
222
  return;
223
223
  }
224
- this._activeAsyncOperations.set(path12, callbacks = [callback]);
224
+ this._activeAsyncOperations.set(path13, callbacks = [callback]);
225
225
  provider(
226
- path12,
226
+ path13,
227
227
  /**
228
228
  * @param {Error} err error
229
229
  * @param {any} result result
230
230
  */
231
231
  (err, result2) => {
232
- this._activeAsyncOperations.delete(path12);
232
+ this._activeAsyncOperations.delete(path13);
233
233
  runCallbacks(callbacks, err, result2);
234
234
  }
235
235
  );
@@ -241,12 +241,12 @@ var require_CachedInputFileSystem = __commonJS({
241
241
  * @param {object=} options options
242
242
  * @returns {any} result
243
243
  */
244
- (path12, options) => {
244
+ (path13, options) => {
245
245
  return (
246
246
  /** @type {Function} */
247
247
  this._syncProvider.call(
248
248
  this._providerContext,
249
- path12,
249
+ path13,
250
250
  options
251
251
  )
252
252
  );
@@ -292,22 +292,22 @@ var require_CachedInputFileSystem = __commonJS({
292
292
  * @param {FileSystemCallback<any>} callback callback
293
293
  * @returns {void}
294
294
  */
295
- provide(path12, options, callback) {
295
+ provide(path13, options, callback) {
296
296
  if (typeof options === "function") {
297
297
  callback = options;
298
298
  options = void 0;
299
299
  }
300
- if (typeof path12 !== "string" && !Buffer.isBuffer(path12) && !(path12 instanceof URL) && typeof path12 !== "number") {
300
+ if (typeof path13 !== "string" && !Buffer.isBuffer(path13) && !(path13 instanceof URL) && typeof path13 !== "number") {
301
301
  callback(new TypeError("path must be a string, Buffer, URL or number"));
302
302
  return;
303
303
  }
304
- const strPath = typeof path12 !== "string" ? path12.toString() : path12;
304
+ const strPath = typeof path13 !== "string" ? path13.toString() : path13;
305
305
  if (options) {
306
306
  return (
307
307
  /** @type {Function} */
308
308
  this._provider.call(
309
309
  this._providerContext,
310
- path12,
310
+ path13,
311
311
  options,
312
312
  callback
313
313
  )
@@ -329,7 +329,7 @@ var require_CachedInputFileSystem = __commonJS({
329
329
  this._activeAsyncOperations.set(strPath, callbacks = [callback]);
330
330
  this._provider.call(
331
331
  this._providerContext,
332
- path12,
332
+ path13,
333
333
  /**
334
334
  * @param {Error | null} err error
335
335
  * @param {any} [result] result
@@ -352,17 +352,17 @@ var require_CachedInputFileSystem = __commonJS({
352
352
  * @param {any} options options
353
353
  * @returns {any} result
354
354
  */
355
- provideSync(path12, options) {
356
- if (typeof path12 !== "string" && !Buffer.isBuffer(path12) && !(path12 instanceof URL) && typeof path12 !== "number") {
355
+ provideSync(path13, options) {
356
+ if (typeof path13 !== "string" && !Buffer.isBuffer(path13) && !(path13 instanceof URL) && typeof path13 !== "number") {
357
357
  throw new TypeError("path must be a string");
358
358
  }
359
- const strPath = typeof path12 !== "string" ? path12.toString() : path12;
359
+ const strPath = typeof path13 !== "string" ? path13.toString() : path13;
360
360
  if (options) {
361
361
  return (
362
362
  /** @type {Function} */
363
363
  this._syncProvider.call(
364
364
  this._providerContext,
365
- path12,
365
+ path13,
366
366
  options
367
367
  )
368
368
  );
@@ -382,7 +382,7 @@ var require_CachedInputFileSystem = __commonJS({
382
382
  result2 = /** @type {Function} */
383
383
  this._syncProvider.call(
384
384
  this._providerContext,
385
- path12
385
+ path13
386
386
  );
387
387
  } catch (err) {
388
388
  this._storeResult(
@@ -471,11 +471,11 @@ var require_CachedInputFileSystem = __commonJS({
471
471
  * @param {Error | null} err error
472
472
  * @param {any} result result
473
473
  */
474
- _storeResult(path12, err, result2) {
475
- if (this._data.has(path12)) return;
474
+ _storeResult(path13, err, result2) {
475
+ if (this._data.has(path13)) return;
476
476
  const level = this._levels[this._currentLevel];
477
- this._data.set(path12, { err, result: result2, level });
478
- level.add(path12);
477
+ this._data.set(path13, { err, result: result2, level });
478
+ level.add(path13);
479
479
  }
480
480
  _decayLevel() {
481
481
  const nextLevel = (this._currentLevel + 1) % this._levels.length;
@@ -610,8 +610,8 @@ var require_CachedInputFileSystem = __commonJS({
610
610
  * @param {string} path path
611
611
  * @param {FileSystemCallback<any>} callback
612
612
  */
613
- ((path12, callback) => {
614
- this.readFile(path12, (err, buffer) => {
613
+ ((path13, callback) => {
614
+ this.readFile(path13, (err, buffer) => {
615
615
  if (err) return callback(err);
616
616
  if (!buffer || buffer.length === 0)
617
617
  return callback(new Error("No file content"));
@@ -632,8 +632,8 @@ var require_CachedInputFileSystem = __commonJS({
632
632
  * @param {string} path path
633
633
  * @returns {any} result
634
634
  */
635
- ((path12) => {
636
- const buffer = this.readFileSync(path12);
635
+ ((path13) => {
636
+ const buffer = this.readFileSync(path13);
637
637
  const data = JSON.parse(buffer.toString("utf-8"));
638
638
  return data;
639
639
  }),
@@ -1288,7 +1288,10 @@ var toBuffer = (bufLike) => {
1288
1288
  if (typeof bufLike === "string") {
1289
1289
  return Buffer.from(bufLike);
1290
1290
  }
1291
- throw new Error("Buffer or string expected");
1291
+ if (bufLike instanceof Uint8Array) {
1292
+ return Buffer.from(bufLike.buffer);
1293
+ }
1294
+ throw new Error("Buffer, Uint8Array or string expected");
1292
1295
  };
1293
1296
  var toObject = (input) => {
1294
1297
  let s;
@@ -2550,6 +2553,13 @@ var JsSource = class extends import_webpack_sources.Source {
2550
2553
  };
2551
2554
 
2552
2555
  // src/Compilation.ts
2556
+ var checkCompilation = (compilation) => {
2557
+ if (!(compilation instanceof Compilation)) {
2558
+ throw new TypeError(
2559
+ `The 'compilation' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.`
2560
+ );
2561
+ }
2562
+ };
2553
2563
  var _inner, _shutdown, _addIncludeDispatcher, _Compilation_instances, createCachedAssets_fn, _rebuildModuleTask;
2554
2564
  var _Compilation = class _Compilation {
2555
2565
  constructor(compiler, inner) {
@@ -5138,7 +5148,6 @@ function toFeatures(featureOptions) {
5138
5148
  // src/loader-runner/index.ts
5139
5149
  var import_node_querystring = __toESM(require("querystring"));
5140
5150
  var import_node_assert2 = __toESM(require("assert"));
5141
- var import_node_util4 = require("util");
5142
5151
  var import_binding3 = require("@rspack/binding");
5143
5152
  var import_webpack_sources2 = require("../compiled/webpack-sources/index.js");
5144
5153
 
@@ -5206,11 +5215,7 @@ Object.defineProperty(binding.NormalModule, "getCompilationHooks", {
5206
5215
  enumerable: true,
5207
5216
  configurable: true,
5208
5217
  value(compilation) {
5209
- if (!(compilation instanceof Compilation)) {
5210
- throw new TypeError(
5211
- "The 'compilation' argument must be an instance of Compilation"
5212
- );
5213
- }
5218
+ checkCompilation(compilation);
5214
5219
  let hooks = compilationHooksMap.get(compilation);
5215
5220
  if (hooks === void 0) {
5216
5221
  hooks = {
@@ -5243,6 +5248,166 @@ Object.defineProperty(binding.NormalModule, "getCompilationHooks", {
5243
5248
  }
5244
5249
  });
5245
5250
 
5251
+ // src/loader-runner/service.ts
5252
+ var import_node_path3 = __toESM(require("path"));
5253
+ var import_node_worker_threads = require("worker_threads");
5254
+ var pool;
5255
+ var ensureLoaderWorkerPool = async () => {
5256
+ if (pool) {
5257
+ return pool;
5258
+ }
5259
+ return pool = import("tinypool").then(({ Tinypool }) => {
5260
+ const cpus = require("os").cpus().length;
5261
+ const availableThreads = Math.max(cpus - 1, 1);
5262
+ const pool2 = new Tinypool({
5263
+ filename: import_node_path3.default.resolve(__dirname, "worker.js"),
5264
+ useAtomics: false,
5265
+ maxThreads: availableThreads,
5266
+ minThreads: availableThreads,
5267
+ concurrentTasksPerWorker: 1
5268
+ });
5269
+ return pool2;
5270
+ });
5271
+ };
5272
+ function isWorkerDoneMessage(message) {
5273
+ return message.type === "done";
5274
+ }
5275
+ function isWorkerDoneErrorMessage(message) {
5276
+ return message.type === "done-error";
5277
+ }
5278
+ function isWorkerRequestMessage(message) {
5279
+ return message.type === "request";
5280
+ }
5281
+ function serializeError(error) {
5282
+ if (error instanceof Error || error && typeof error === "object" && "message" in error) {
5283
+ return {
5284
+ ...error,
5285
+ name: error.name,
5286
+ stack: error.stack,
5287
+ message: error.message
5288
+ };
5289
+ }
5290
+ if (typeof error === "string") {
5291
+ return {
5292
+ name: "Error",
5293
+ message: error
5294
+ };
5295
+ }
5296
+ throw new Error(
5297
+ "Failed to serialize error, only string, Error instances and objects with a message property are supported"
5298
+ );
5299
+ }
5300
+ var run = async (task, options) => ensureLoaderWorkerPool().then(async (pool2) => {
5301
+ const { port1: mainPort, port2: workerPort } = new import_node_worker_threads.MessageChannel();
5302
+ const { port1: mainSyncPort, port2: workerSyncPort } = new import_node_worker_threads.MessageChannel();
5303
+ return new Promise((resolve2, reject) => {
5304
+ const handleError = (error) => {
5305
+ mainPort.close();
5306
+ mainSyncPort.close();
5307
+ reject(error);
5308
+ };
5309
+ const pendingRequests = /* @__PURE__ */ new Map();
5310
+ mainPort.on("message", (message) => {
5311
+ if (isWorkerDoneMessage(message)) {
5312
+ Promise.allSettled(pendingRequests.values()).then((p) => {
5313
+ mainPort.close();
5314
+ mainSyncPort.close();
5315
+ resolve2(message.data);
5316
+ });
5317
+ } else if (isWorkerDoneErrorMessage(message)) {
5318
+ Promise.allSettled(pendingRequests.values()).then(() => {
5319
+ mainPort.close();
5320
+ mainSyncPort.close();
5321
+ reject(message.error);
5322
+ });
5323
+ } else if (isWorkerRequestMessage(message)) {
5324
+ pendingRequests.set(
5325
+ message.id,
5326
+ Promise.resolve().then(
5327
+ () => options.handleIncomingRequest(
5328
+ message.requestType,
5329
+ ...message.data
5330
+ )
5331
+ ).then((result2) => {
5332
+ mainPort.postMessage({
5333
+ type: "response",
5334
+ id: message.id,
5335
+ data: result2
5336
+ });
5337
+ return result2;
5338
+ }).catch((error) => {
5339
+ mainPort.postMessage({
5340
+ type: "response-error",
5341
+ id: message.id,
5342
+ error: serializeError(error)
5343
+ });
5344
+ })
5345
+ );
5346
+ }
5347
+ });
5348
+ mainPort.on("messageerror", handleError);
5349
+ mainSyncPort.on("message", async (message) => {
5350
+ const sharedBuffer = message.sharedBuffer;
5351
+ const sharedBufferView = new Int32Array(sharedBuffer);
5352
+ let result2;
5353
+ try {
5354
+ switch (message.requestType) {
5355
+ case "WaitForPendingRequest" /* WaitForPendingRequest */: {
5356
+ const pendingRequestId = message.data[0];
5357
+ const isArray = Array.isArray(pendingRequestId);
5358
+ const ids = isArray ? pendingRequestId : [pendingRequestId];
5359
+ result2 = await Promise.all(
5360
+ ids.map((id) => pendingRequests.get(id))
5361
+ );
5362
+ if (!isArray) {
5363
+ result2 = result2[0];
5364
+ }
5365
+ break;
5366
+ }
5367
+ default:
5368
+ throw new Error(`Unknown request type: ${message.requestType}`);
5369
+ }
5370
+ mainSyncPort.postMessage({
5371
+ type: "response",
5372
+ id: message.id,
5373
+ data: result2
5374
+ });
5375
+ } catch (e) {
5376
+ mainSyncPort.postMessage({
5377
+ type: "response-error",
5378
+ id: message.id,
5379
+ error: serializeError(e)
5380
+ });
5381
+ }
5382
+ Atomics.add(sharedBufferView, 0, 1);
5383
+ Atomics.notify(sharedBufferView, 0, Number.POSITIVE_INFINITY);
5384
+ });
5385
+ mainSyncPort.on("messageerror", handleError);
5386
+ pool2.run(
5387
+ {
5388
+ ...task,
5389
+ // Internal worker data. Tinypool does not support passing `transferList` to
5390
+ // `new Worker(..)`
5391
+ workerData: {
5392
+ workerPort,
5393
+ workerSyncPort
5394
+ }
5395
+ },
5396
+ {
5397
+ ...options,
5398
+ transferList: [
5399
+ ...(options == null ? void 0 : options.transferList) || [],
5400
+ workerPort,
5401
+ workerSyncPort
5402
+ ]
5403
+ }
5404
+ ).catch(handleError);
5405
+ });
5406
+ });
5407
+
5408
+ // src/loader-runner/utils.ts
5409
+ var import_node_util4 = require("util");
5410
+
5246
5411
  // src/loader-runner/LoaderLoadingError.ts
5247
5412
  var LoadingLoaderError = class extends Error {
5248
5413
  constructor(message) {
@@ -5303,6 +5468,89 @@ function handleResult(loader2, module2, callback) {
5303
5468
  callback();
5304
5469
  }
5305
5470
 
5471
+ // src/loader-runner/utils.ts
5472
+ var decoder = new TextDecoder();
5473
+ function utf8BufferToString(buf) {
5474
+ const str = decoder.decode(buf);
5475
+ if (str.charCodeAt(0) === 65279) {
5476
+ return str.slice(1);
5477
+ }
5478
+ return str;
5479
+ }
5480
+ function convertArgs(args, raw) {
5481
+ if (!raw && args[0] instanceof Uint8Array)
5482
+ args[0] = utf8BufferToString(args[0]);
5483
+ else if (raw && typeof args[0] === "string")
5484
+ args[0] = Buffer.from(args[0], "utf-8");
5485
+ if (raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0])) {
5486
+ args[0] = Buffer.from(args[0].buffer);
5487
+ }
5488
+ }
5489
+ var loadLoader2 = (0, import_node_util4.promisify)(loadLoader);
5490
+ var runSyncOrAsync = (0, import_node_util4.promisify)(function runSyncOrAsync2(fn2, context2, args, callback) {
5491
+ let isSync = true;
5492
+ let isDone = false;
5493
+ let isError = false;
5494
+ let reportedError = false;
5495
+ context2.async = function async() {
5496
+ if (isDone) {
5497
+ if (reportedError) return void 0;
5498
+ throw new Error("async(): The callback was already called.");
5499
+ }
5500
+ isSync = false;
5501
+ return innerCallback;
5502
+ };
5503
+ const innerCallback = (err, ...args2) => {
5504
+ if (isDone) {
5505
+ if (reportedError) return;
5506
+ throw new Error("callback(): The callback was already called.");
5507
+ }
5508
+ isDone = true;
5509
+ isSync = false;
5510
+ try {
5511
+ callback(err, args2);
5512
+ } catch (e) {
5513
+ isError = true;
5514
+ throw e;
5515
+ }
5516
+ };
5517
+ context2.callback = innerCallback;
5518
+ try {
5519
+ const result2 = function LOADER_EXECUTION() {
5520
+ return fn2.apply(context2, args);
5521
+ }();
5522
+ if (isSync) {
5523
+ isDone = true;
5524
+ if (result2 === void 0) {
5525
+ callback(null, []);
5526
+ return;
5527
+ }
5528
+ if (result2 && typeof result2 === "object" && typeof result2.then === "function") {
5529
+ result2.then((r) => {
5530
+ callback(null, [r]);
5531
+ }, callback);
5532
+ return;
5533
+ }
5534
+ callback(null, [result2]);
5535
+ return;
5536
+ }
5537
+ } catch (e) {
5538
+ const err = e;
5539
+ if ("hideStack" in err && err.hideStack) {
5540
+ err.hideStack = "true";
5541
+ }
5542
+ if (isError) throw e;
5543
+ if (isDone) {
5544
+ if (e instanceof Error) console.error(e.stack);
5545
+ else console.error(e);
5546
+ return;
5547
+ }
5548
+ isDone = true;
5549
+ reportedError = true;
5550
+ callback(e, []);
5551
+ }
5552
+ });
5553
+
5306
5554
  // src/loader-runner/index.ts
5307
5555
  function createLoaderObject(loader2, compiler) {
5308
5556
  const obj = {
@@ -5357,11 +5605,10 @@ function createLoaderObject(loader2, compiler) {
5357
5605
  return obj;
5358
5606
  }
5359
5607
  var LoaderObject = class {
5360
- #loaderItem;
5361
5608
  constructor(loaderItem, compiler) {
5362
5609
  const {
5363
5610
  request,
5364
- path: path12,
5611
+ path: path13,
5365
5612
  query,
5366
5613
  fragment,
5367
5614
  options,
@@ -5372,7 +5619,7 @@ var LoaderObject = class {
5372
5619
  type
5373
5620
  } = createLoaderObject(loaderItem, compiler);
5374
5621
  this.request = request;
5375
- this.path = path12;
5622
+ this.path = path13;
5376
5623
  this.query = query;
5377
5624
  this.fragment = fragment;
5378
5625
  this.options = options;
@@ -5381,41 +5628,23 @@ var LoaderObject = class {
5381
5628
  this.pitch = pitch;
5382
5629
  this.raw = raw;
5383
5630
  this.type = type;
5384
- this.#loaderItem = loaderItem;
5631
+ this.parallel = ident ? compiler.__internal__ruleSet.references.get(`${ident}$$parallelism`) : false;
5632
+ this.loaderItem = loaderItem;
5633
+ this.loaderItem.data = this.loaderItem.data ?? {};
5385
5634
  }
5386
5635
  get pitchExecuted() {
5387
- return this.#loaderItem.pitchExecuted;
5636
+ return this.loaderItem.pitchExecuted;
5388
5637
  }
5389
5638
  set pitchExecuted(value) {
5390
5639
  (0, import_node_assert2.default)(value);
5391
- this.#loaderItem.pitchExecuted = true;
5640
+ this.loaderItem.pitchExecuted = true;
5392
5641
  }
5393
5642
  get normalExecuted() {
5394
- return this.#loaderItem.normalExecuted;
5643
+ return this.loaderItem.normalExecuted;
5395
5644
  }
5396
5645
  set normalExecuted(value) {
5397
5646
  (0, import_node_assert2.default)(value);
5398
- this.#loaderItem.normalExecuted = true;
5399
- }
5400
- // A data object shared between the pitch and the normal phase
5401
- get data() {
5402
- return new Proxy(this.#loaderItem.data = this.#loaderItem.data ?? {}, {
5403
- set: (_, property, value) => {
5404
- if (typeof property === "string") {
5405
- this.#loaderItem.data[property] = value;
5406
- }
5407
- return true;
5408
- },
5409
- get: (_, property) => {
5410
- if (typeof property === "string") {
5411
- return this.#loaderItem.data[property];
5412
- }
5413
- }
5414
- });
5415
- }
5416
- // A data object shared between the pitch and the normal phase
5417
- set data(data) {
5418
- this.#loaderItem.data = data;
5647
+ this.loaderItem.normalExecuted = true;
5419
5648
  }
5420
5649
  shouldYield() {
5421
5650
  return this.request.startsWith(BUILTIN_LOADER_PREFIX);
@@ -5424,7 +5653,7 @@ var LoaderObject = class {
5424
5653
  return new this(loaderItem, compiler);
5425
5654
  }
5426
5655
  static __to_binding(loader2) {
5427
- return loader2.#loaderItem;
5656
+ return loader2.loaderItem;
5428
5657
  }
5429
5658
  };
5430
5659
  var JsSourceMap = class {
@@ -5435,81 +5664,17 @@ var JsSourceMap = class {
5435
5664
  return serializeObject(map);
5436
5665
  }
5437
5666
  };
5438
- var loadLoaderAsync = (0, import_node_util4.promisify)(loadLoader);
5439
- var runSyncOrAsync = (0, import_node_util4.promisify)(function runSyncOrAsync2(fn2, context2, args, callback) {
5440
- let isSync = true;
5441
- let isDone = false;
5442
- let isError = false;
5443
- let reportedError = false;
5444
- context2.async = function async() {
5445
- if (isDone) {
5446
- if (reportedError) return void 0;
5447
- throw new Error("async(): The callback was already called.");
5448
- }
5449
- isSync = false;
5450
- return innerCallback;
5451
- };
5452
- const innerCallback = (err, ...args2) => {
5453
- if (isDone) {
5454
- if (reportedError) return;
5455
- throw new Error("callback(): The callback was already called.");
5456
- }
5457
- isDone = true;
5458
- isSync = false;
5459
- try {
5460
- callback(err, args2);
5461
- } catch (e) {
5462
- isError = true;
5463
- throw e;
5464
- }
5465
- };
5466
- context2.callback = innerCallback;
5467
- try {
5468
- const result2 = function LOADER_EXECUTION() {
5469
- return fn2.apply(context2, args);
5470
- }();
5471
- if (isSync) {
5472
- isDone = true;
5473
- if (result2 === void 0) {
5474
- callback(null, []);
5475
- return;
5476
- }
5477
- if (result2 && typeof result2 === "object" && typeof result2.then === "function") {
5478
- result2.then((r) => {
5479
- callback(null, [r]);
5480
- }, callback);
5481
- return;
5482
- }
5483
- callback(null, [result2]);
5484
- return;
5485
- }
5486
- } catch (e) {
5487
- const err = e;
5488
- if ("hideStack" in err && err.hideStack) {
5489
- err.hideStack = "true";
5490
- }
5491
- if (isError) throw e;
5492
- if (isDone) {
5493
- if (e instanceof Error) console.error(e.stack);
5494
- else console.error(e);
5495
- return;
5496
- }
5497
- isDone = true;
5498
- reportedError = true;
5499
- callback(e, []);
5500
- }
5501
- });
5502
- function dirname2(path12) {
5503
- if (path12 === "/") return "/";
5504
- const i = path12.lastIndexOf("/");
5505
- const j = path12.lastIndexOf("\\");
5506
- const i2 = path12.indexOf("/");
5507
- const j2 = path12.indexOf("\\");
5667
+ function dirname2(path13) {
5668
+ if (path13 === "/") return "/";
5669
+ const i = path13.lastIndexOf("/");
5670
+ const j = path13.lastIndexOf("\\");
5671
+ const i2 = path13.indexOf("/");
5672
+ const j2 = path13.indexOf("\\");
5508
5673
  const idx = i > j ? i : j;
5509
5674
  const idx2 = i > j ? i2 : j2;
5510
- if (idx < 0) return path12;
5511
- if (idx === idx2) return path12.slice(0, idx + 1);
5512
- return path12.slice(0, idx);
5675
+ if (idx < 0) return path13;
5676
+ if (idx === idx2) return path13.slice(0, idx + 1);
5677
+ return path13.slice(0, idx);
5513
5678
  }
5514
5679
  function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
5515
5680
  var _a;
@@ -5559,7 +5724,6 @@ async function tryTrace(context2) {
5559
5724
  return null;
5560
5725
  }
5561
5726
  async function runLoaders(compiler, context2) {
5562
- var _a, _b;
5563
5727
  const { tracer, activeContext } = await tryTrace(context2) ?? {};
5564
5728
  const loaderState = context2.loaderState;
5565
5729
  const { resource } = context2.resourceData;
@@ -5910,48 +6074,271 @@ async function runLoaders(compiler, context2) {
5910
6074
  });
5911
6075
  Object.defineProperty(loaderContext, "data", {
5912
6076
  enumerable: true,
5913
- get: () => loaderContext.loaders[loaderContext.loaderIndex].data,
5914
- set: (data) => loaderContext.loaders[loaderContext.loaderIndex].data = data
6077
+ get: () => loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
6078
+ set: (data) => loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = data
5915
6079
  });
5916
6080
  Object.defineProperty(loaderContext, "__internal__parseMeta", {
5917
6081
  enumerable: true,
5918
6082
  get: () => context2.__internal__parseMeta
5919
6083
  });
6084
+ const getWorkerLoaderContext = () => {
6085
+ const normalModule = loaderContext._module instanceof import_binding2.NormalModule ? loaderContext._module : void 0;
6086
+ const workerLoaderContext = {
6087
+ hot: loaderContext.hot,
6088
+ context: loaderContext.context,
6089
+ resourcePath: loaderContext.resourcePath,
6090
+ resourceQuery: loaderContext.resourceQuery,
6091
+ resourceFragment: loaderContext.resourceFragment,
6092
+ resource: loaderContext.resource,
6093
+ mode: loaderContext.mode,
6094
+ sourceMap: loaderContext.sourceMap,
6095
+ rootContext: loaderContext.context,
6096
+ loaderIndex: loaderContext.loaderIndex,
6097
+ loaders: loaderContext.loaders.map((item) => {
6098
+ return {
6099
+ ...item,
6100
+ pitch: void 0,
6101
+ normal: void 0,
6102
+ normalExecuted: item.normalExecuted,
6103
+ pitchExecuted: item.pitchExecuted
6104
+ };
6105
+ }),
6106
+ __internal__workerInfo: {
6107
+ hashFunction: compiler._lastCompilation.outputOptions.hashFunction
6108
+ },
6109
+ _compiler: {
6110
+ options: {
6111
+ experiments: {
6112
+ css: compiler.options.experiments.css
6113
+ }
6114
+ }
6115
+ },
6116
+ _compilation: {
6117
+ options: {
6118
+ output: {
6119
+ // css-loader
6120
+ environment: compiler._lastCompilation.outputOptions.environment
6121
+ }
6122
+ },
6123
+ // css-loader
6124
+ outputOptions: {
6125
+ hashSalt: compiler._lastCompilation.outputOptions.hashSalt,
6126
+ hashFunction: compiler._lastCompilation.outputOptions.hashFunction,
6127
+ hashDigest: compiler._lastCompilation.outputOptions.hashDigest,
6128
+ hashDigestLength: compiler._lastCompilation.outputOptions.hashDigestLength
6129
+ }
6130
+ },
6131
+ _module: {
6132
+ type: loaderContext._module.type,
6133
+ identifier: loaderContext._module.identifier(),
6134
+ matchResource: normalModule == null ? void 0 : normalModule.matchResource,
6135
+ request: normalModule == null ? void 0 : normalModule.request,
6136
+ userRequest: normalModule == null ? void 0 : normalModule.userRequest,
6137
+ rawRequest: normalModule == null ? void 0 : normalModule.rawRequest
6138
+ }
6139
+ };
6140
+ Object.assign(workerLoaderContext, compiler.options.loader);
6141
+ return workerLoaderContext;
6142
+ };
6143
+ const getWorkerLoaderHandlers = function() {
6144
+ return {
6145
+ handleIncomingRequest(requestType, ...args) {
6146
+ switch (requestType) {
6147
+ case "AddDependency" /* AddDependency */: {
6148
+ loaderContext.addDependency(args[0]);
6149
+ break;
6150
+ }
6151
+ case "AddContextDependency" /* AddContextDependency */: {
6152
+ loaderContext.addContextDependency(args[0]);
6153
+ break;
6154
+ }
6155
+ case "AddMissingDependency" /* AddMissingDependency */: {
6156
+ loaderContext.addMissingDependency(args[0]);
6157
+ break;
6158
+ }
6159
+ case "AddBuildDependency" /* AddBuildDependency */: {
6160
+ loaderContext.addBuildDependency(args[0]);
6161
+ break;
6162
+ }
6163
+ case "GetDependencies" /* GetDependencies */: {
6164
+ return loaderContext.getDependencies();
6165
+ }
6166
+ case "GetContextDependencies" /* GetContextDependencies */: {
6167
+ return loaderContext.getContextDependencies();
6168
+ }
6169
+ case "GetMissingDependencies" /* GetMissingDependencies */: {
6170
+ return loaderContext.getMissingDependencies();
6171
+ }
6172
+ case "ClearDependencies" /* ClearDependencies */: {
6173
+ loaderContext.clearDependencies();
6174
+ break;
6175
+ }
6176
+ case "Resolve" /* Resolve */: {
6177
+ return new Promise((resolve2, reject) => {
6178
+ loaderContext.resolve(args[0], args[1], (err, result2) => {
6179
+ if (err) reject(err);
6180
+ else resolve2(result2);
6181
+ });
6182
+ });
6183
+ }
6184
+ case "GetResolve" /* GetResolve */: {
6185
+ return new Promise((resolve2, reject) => {
6186
+ loaderContext.getResolve(args[0])(
6187
+ args[1],
6188
+ args[2],
6189
+ (err, result2) => {
6190
+ if (err) reject(err);
6191
+ else resolve2(result2);
6192
+ }
6193
+ );
6194
+ });
6195
+ }
6196
+ case "GetLogger" /* GetLogger */: {
6197
+ const [type, name2, arg] = args;
6198
+ loaderContext.getLogger(name2)[type](...arg);
6199
+ }
6200
+ case "EmitError" /* EmitError */: {
6201
+ const workerError = args[0];
6202
+ const error = new Error(workerError.message);
6203
+ error.stack = workerError.stack;
6204
+ error.name = workerError.name;
6205
+ loaderContext.emitError(error);
6206
+ break;
6207
+ }
6208
+ case "EmitWarning" /* EmitWarning */: {
6209
+ const workerError = args[0];
6210
+ const error = new Error(workerError.message);
6211
+ error.stack = workerError.stack;
6212
+ error.name = workerError.name;
6213
+ loaderContext.emitWarning(error);
6214
+ break;
6215
+ }
6216
+ case "EmitFile" /* EmitFile */: {
6217
+ const [name2, content, sourceMap, assetInfo] = args;
6218
+ loaderContext.emitFile(name2, content, sourceMap, assetInfo);
6219
+ break;
6220
+ }
6221
+ case "EmitDiagnostic" /* EmitDiagnostic */: {
6222
+ const diagnostic = args[0];
6223
+ loaderContext.experiments.emitDiagnostic(diagnostic);
6224
+ break;
6225
+ }
6226
+ case "SetCacheable" /* SetCacheable */: {
6227
+ const cacheable = args[0];
6228
+ loaderContext.cacheable(cacheable);
6229
+ break;
6230
+ }
6231
+ case "ImportModule" /* ImportModule */: {
6232
+ return loaderContext.importModule(args[0], args[1]);
6233
+ }
6234
+ case "UpdateLoaderObjects" /* UpdateLoaderObjects */: {
6235
+ const updates = args[0];
6236
+ loaderContext.loaders = loaderContext.loaders.map((item, index) => {
6237
+ const update = updates[index];
6238
+ item.loaderItem.data = update.data;
6239
+ if (update.pitchExecuted) {
6240
+ item.pitchExecuted = true;
6241
+ }
6242
+ if (update.normalExecuted) {
6243
+ item.normalExecuted = true;
6244
+ }
6245
+ return item;
6246
+ });
6247
+ break;
6248
+ }
6249
+ case "CompilationGetPath" /* CompilationGetPath */: {
6250
+ const filename2 = args[0];
6251
+ const data = args[1];
6252
+ return compiler._lastCompilation.getPath(filename2, data);
6253
+ }
6254
+ case "CompilationGetPathWithInfo" /* CompilationGetPathWithInfo */: {
6255
+ const filename2 = args[0];
6256
+ const data = args[1];
6257
+ return compiler._lastCompilation.getPathWithInfo(filename2, data);
6258
+ }
6259
+ case "CompilationGetAssetPath" /* CompilationGetAssetPath */: {
6260
+ const filename2 = args[0];
6261
+ const data = args[1];
6262
+ return compiler._lastCompilation.getAssetPath(filename2, data);
6263
+ }
6264
+ case "CompilationGetAssetPathWithInfo" /* CompilationGetAssetPathWithInfo */: {
6265
+ const filename2 = args[0];
6266
+ const data = args[1];
6267
+ return compiler._lastCompilation.getAssetPathWithInfo(
6268
+ filename2,
6269
+ data
6270
+ );
6271
+ }
6272
+ default: {
6273
+ throw new Error(`Unknown request type: ${requestType}`);
6274
+ }
6275
+ }
6276
+ }
6277
+ };
6278
+ };
6279
+ const enableParallelism = (currentLoaderObject) => {
6280
+ return compiler.options.experiments.parallelLoader && (currentLoaderObject == null ? void 0 : currentLoaderObject.parallel);
6281
+ };
6282
+ const isomorphoicRun = async (fn2, args) => {
6283
+ const currentLoaderObject = getCurrentLoader(loaderContext);
6284
+ const parallelism = enableParallelism(currentLoaderObject);
6285
+ const pitch = loaderState === import_binding3.JsLoaderState.Pitching;
6286
+ const worker2 = parallelism;
6287
+ let result2;
6288
+ const span = tracer == null ? void 0 : tracer.startSpan(
6289
+ `LoaderRunner:${pitch ? "pitch" : "normal"}${worker2 ? " (worker)" : ""}`,
6290
+ {
6291
+ attributes: {
6292
+ "loader.identifier": currentLoaderObject == null ? void 0 : currentLoaderObject.request
6293
+ }
6294
+ },
6295
+ activeContext
6296
+ );
6297
+ if (parallelism) {
6298
+ result2 = await run(
6299
+ {
6300
+ loaderContext: getWorkerLoaderContext(),
6301
+ loaderState,
6302
+ args
6303
+ },
6304
+ getWorkerLoaderHandlers()
6305
+ ) || [];
6306
+ } else {
6307
+ if (loaderState === import_binding3.JsLoaderState.Normal)
6308
+ convertArgs(args, !!(currentLoaderObject == null ? void 0 : currentLoaderObject.raw));
6309
+ result2 = await runSyncOrAsync(fn2, loaderContext, args) || [];
6310
+ }
6311
+ span == null ? void 0 : span.end();
6312
+ return result2;
6313
+ };
5920
6314
  try {
5921
6315
  switch (loaderState) {
5922
6316
  case import_binding3.JsLoaderState.Pitching: {
5923
6317
  while (loaderContext.loaderIndex < loaderContext.loaders.length) {
5924
6318
  const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
6319
+ const parallelism = enableParallelism(currentLoaderObject);
5925
6320
  if (currentLoaderObject.shouldYield()) break;
5926
6321
  if (currentLoaderObject.pitchExecuted) {
5927
6322
  loaderContext.loaderIndex += 1;
5928
6323
  continue;
5929
6324
  }
5930
- await loadLoaderAsync(currentLoaderObject);
6325
+ await loadLoader2(currentLoaderObject);
5931
6326
  const fn2 = currentLoaderObject.pitch;
5932
- currentLoaderObject.pitchExecuted = true;
6327
+ if (!parallelism || !fn2) {
6328
+ currentLoaderObject.pitchExecuted = true;
6329
+ }
5933
6330
  if (!fn2) continue;
5934
- const span = tracer == null ? void 0 : tracer.startSpan(
5935
- "LoaderRunner:pitch",
5936
- {
5937
- attributes: {
5938
- "loader.identifier": (_a = getCurrentLoader(loaderContext)) == null ? void 0 : _a.request
5939
- }
5940
- },
5941
- activeContext
5942
- );
5943
- const args = await runSyncOrAsync(fn2, loaderContext, [
6331
+ const args = await isomorphoicRun(fn2, [
5944
6332
  loaderContext.remainingRequest,
5945
6333
  loaderContext.previousRequest,
5946
- currentLoaderObject.data
5947
- ]) || [];
5948
- span == null ? void 0 : span.end();
6334
+ currentLoaderObject.loaderItem.data
6335
+ ]);
5949
6336
  const hasArg = args.some((value) => value !== void 0);
5950
6337
  if (hasArg) {
5951
6338
  const [content, sourceMap, additionalData] = args;
5952
6339
  context2.content = isNil(content) ? null : toBuffer(content);
5953
6340
  context2.sourceMap = serializeObject(sourceMap);
5954
- context2.additionalData = additionalData;
6341
+ context2.additionalData = additionalData || void 0;
5955
6342
  break;
5956
6343
  }
5957
6344
  }
@@ -5963,28 +6350,23 @@ async function runLoaders(compiler, context2) {
5963
6350
  let additionalData = context2.additionalData;
5964
6351
  while (loaderContext.loaderIndex >= 0) {
5965
6352
  const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
6353
+ const parallelism = enableParallelism(currentLoaderObject);
5966
6354
  if (currentLoaderObject.shouldYield()) break;
5967
6355
  if (currentLoaderObject.normalExecuted) {
5968
6356
  loaderContext.loaderIndex--;
5969
6357
  continue;
5970
6358
  }
5971
- await loadLoaderAsync(currentLoaderObject);
6359
+ await loadLoader2(currentLoaderObject);
5972
6360
  const fn2 = currentLoaderObject.normal;
5973
- currentLoaderObject.normalExecuted = true;
6361
+ if (!parallelism || !fn2) {
6362
+ currentLoaderObject.normalExecuted = true;
6363
+ }
5974
6364
  if (!fn2) continue;
5975
- const args = [content, sourceMap, additionalData];
5976
- convertArgs(args, !!currentLoaderObject.raw);
5977
- const span = tracer == null ? void 0 : tracer.startSpan(
5978
- "LoaderRunner:normal",
5979
- {
5980
- attributes: {
5981
- "loader.identifier": (_b = getCurrentLoader(loaderContext)) == null ? void 0 : _b.request
5982
- }
5983
- },
5984
- activeContext
5985
- );
5986
- [content, sourceMap, additionalData] = await runSyncOrAsync(fn2, loaderContext, args) || [];
5987
- span == null ? void 0 : span.end();
6365
+ [content, sourceMap, additionalData] = await isomorphoicRun(fn2, [
6366
+ content,
6367
+ sourceMap,
6368
+ additionalData
6369
+ ]);
5988
6370
  }
5989
6371
  context2.content = isNil(content) ? null : toBuffer(content);
5990
6372
  context2.sourceMap = JsSourceMap.__to_binding(sourceMap);
@@ -6011,18 +6393,6 @@ async function runLoaders(compiler, context2) {
6011
6393
  }
6012
6394
  return context2;
6013
6395
  }
6014
- function utf8BufferToString(buf) {
6015
- const str = buf.toString("utf-8");
6016
- if (str.charCodeAt(0) === 65279) {
6017
- return str.slice(1);
6018
- }
6019
- return str;
6020
- }
6021
- function convertArgs(args, raw) {
6022
- if (!raw && Buffer.isBuffer(args[0])) args[0] = utf8BufferToString(args[0]);
6023
- else if (raw && typeof args[0] === "string")
6024
- args[0] = Buffer.from(args[0], "utf-8");
6025
- }
6026
6396
  var PATH_QUERY_FRAGMENT_REGEXP2 = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
6027
6397
  function parsePathQueryFragment(str) {
6028
6398
  const match = PATH_QUERY_FRAGMENT_REGEXP2.exec(str);
@@ -6035,10 +6405,10 @@ function parsePathQueryFragment(str) {
6035
6405
 
6036
6406
  // src/config/adapterRuleUse.ts
6037
6407
  var BUILTIN_LOADER_PREFIX = "builtin:";
6038
- function createRawModuleRuleUses(uses, path12, options) {
6408
+ function createRawModuleRuleUses(uses, path13, options) {
6039
6409
  const normalizeRuleSetUseItem = (item) => typeof item === "string" ? { loader: item } : item;
6040
6410
  const allUses = Array.isArray(uses) ? [...uses].map(normalizeRuleSetUseItem) : [normalizeRuleSetUseItem(uses)];
6041
- return createRawModuleRuleUsesImpl(allUses, path12, options);
6411
+ return createRawModuleRuleUsesImpl(allUses, path13, options);
6042
6412
  }
6043
6413
  var getSwcLoaderOptions = (options, _) => {
6044
6414
  if (options && typeof options === "object") {
@@ -6079,7 +6449,7 @@ function getBuiltinLoaderOptions(identifier, o, options) {
6079
6449
  }
6080
6450
  return o;
6081
6451
  }
6082
- function createRawModuleRuleUsesImpl(uses, path12, options) {
6452
+ function createRawModuleRuleUsesImpl(uses, path13, options) {
6083
6453
  if (!uses.length) {
6084
6454
  return [];
6085
6455
  }
@@ -6094,7 +6464,7 @@ function createRawModuleRuleUsesImpl(uses, path12, options) {
6094
6464
  return {
6095
6465
  loader: resolveStringifyLoaders(
6096
6466
  use,
6097
- `${path12}[${index}]`,
6467
+ `${path13}[${index}]`,
6098
6468
  options.compiler,
6099
6469
  isBuiltin
6100
6470
  ),
@@ -6102,20 +6472,33 @@ function createRawModuleRuleUsesImpl(uses, path12, options) {
6102
6472
  };
6103
6473
  });
6104
6474
  }
6105
- function resolveStringifyLoaders(use, path12, compiler, isBuiltin) {
6475
+ function resolveStringifyLoaders(use, path13, compiler, isBuiltin) {
6106
6476
  const obj = parsePathQueryFragment(use.loader);
6107
- let ident = null;
6477
+ let ident = use.ident;
6108
6478
  if (use.options === null) {
6109
6479
  } else if (use.options === void 0) {
6110
6480
  } else if (typeof use.options === "string") obj.query = `?${use.options}`;
6111
6481
  else if (use.ident) obj.query = `??${ident = use.ident}`;
6112
6482
  else if (typeof use.options === "object" && use.options.ident)
6113
6483
  obj.query = `??${ident = use.options.ident}`;
6114
- else if (typeof use.options === "object") obj.query = `??${ident = path12}`;
6484
+ else if (typeof use.options === "object") obj.query = `??${ident = path13}`;
6115
6485
  else obj.query = `?${JSON.stringify(use.options)}`;
6486
+ const parallelism = !!use.parallel;
6487
+ if (parallelism && (!use.options || typeof use.options !== "object")) {
6488
+ throw new Error(
6489
+ `\`Rule.use.parallel\` requires \`Rule.use.options\` to be an object.
6490
+ However the received value is \`${use.options}\` under option path \`${path13}\`
6491
+ Internally, parallelism is provided by passing \`Rule.use.ident\` to the loader as an identifier to ident the parallelism option
6492
+ You can either replace the \`Rule.use.loader\` with \`Rule.use.options = {}\` or remove \`Rule.use.parallel\`.`
6493
+ );
6494
+ }
6116
6495
  if (use.options && typeof use.options === "object") {
6117
6496
  if (!ident) ident = "[[missing ident]]";
6118
6497
  compiler.__internal__ruleSet.references.set(ident, use.options);
6498
+ compiler.__internal__ruleSet.references.set(
6499
+ `${ident}$$parallelism`,
6500
+ parallelism
6501
+ );
6119
6502
  if (isBuiltin) {
6120
6503
  compiler.__internal__ruleSet.builtinReferences.set(ident, use.options);
6121
6504
  }
@@ -6280,7 +6663,7 @@ function tryMatch(payload, condition) {
6280
6663
  }
6281
6664
  return false;
6282
6665
  }
6283
- var getRawModuleRule = (rule, path12, options, upperType) => {
6666
+ var getRawModuleRule = (rule, path13, options, upperType) => {
6284
6667
  if (rule.loader) {
6285
6668
  rule.use = [
6286
6669
  {
@@ -6298,7 +6681,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6298
6681
  compiler: options.compiler
6299
6682
  };
6300
6683
  const uses = use(context2);
6301
- return createRawModuleRuleUses(uses ?? [], `${path12}.use`, options);
6684
+ return createRawModuleRuleUses(uses ?? [], `${path13}.use`, options);
6302
6685
  };
6303
6686
  }
6304
6687
  const rawModuleRule = {
@@ -6326,7 +6709,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6326
6709
  scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
6327
6710
  mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
6328
6711
  sideEffects: rule.sideEffects,
6329
- use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path12}.use`, options),
6712
+ use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path13}.use`, options),
6330
6713
  type: rule.type,
6331
6714
  layer: rule.layer,
6332
6715
  parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
@@ -6335,7 +6718,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6335
6718
  oneOf: rule.oneOf ? rule.oneOf.filter(Boolean).map(
6336
6719
  (rule2, index) => getRawModuleRule(
6337
6720
  rule2,
6338
- `${path12}.oneOf[${index}]`,
6721
+ `${path13}.oneOf[${index}]`,
6339
6722
  options,
6340
6723
  rule2.type ?? upperType
6341
6724
  )
@@ -6343,7 +6726,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6343
6726
  rules: rule.rules ? rule.rules.filter(Boolean).map(
6344
6727
  (rule2, index) => getRawModuleRule(
6345
6728
  rule2,
6346
- `${path12}.rules[${index}]`,
6729
+ `${path13}.rules[${index}]`,
6347
6730
  options,
6348
6731
  rule2.type ?? upperType
6349
6732
  )
@@ -6357,11 +6740,11 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6357
6740
  delete rawModuleRule.resourceFragment;
6358
6741
  rawModuleRule.rspackResource = getRawRuleSetCondition(
6359
6742
  (resourceQueryFragment) => {
6360
- const { path: path13, query, fragment } = parseResource(resourceQueryFragment);
6361
- if (rule.test && !tryMatch(path13, rule.test)) {
6743
+ const { path: path14, query, fragment } = parseResource(resourceQueryFragment);
6744
+ if (rule.test && !tryMatch(path14, rule.test)) {
6362
6745
  return false;
6363
6746
  }
6364
- if (rule.resource && !tryMatch(path13, rule.resource)) {
6747
+ if (rule.resource && !tryMatch(path14, rule.resource)) {
6365
6748
  return false;
6366
6749
  }
6367
6750
  if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
@@ -6671,7 +7054,7 @@ function getRawStats(stats) {
6671
7054
  // src/config/defaults.ts
6672
7055
  var import_node_assert6 = __toESM(require("assert"));
6673
7056
  var import_node_fs3 = __toESM(require("fs"));
6674
- var import_node_path10 = __toESM(require("path"));
7057
+ var import_node_path11 = __toESM(require("path"));
6675
7058
 
6676
7059
  // src/ModuleTypeConstants.ts
6677
7060
  var JSON_MODULE_TYPE = "json";
@@ -7022,13 +7405,13 @@ var CopyRspackPlugin = create2(
7022
7405
 
7023
7406
  // src/builtin-plugin/css-extract/index.ts
7024
7407
  var import_binding15 = require("@rspack/binding");
7025
- var import_node_path5 = require("path");
7408
+ var import_node_path6 = require("path");
7026
7409
 
7027
7410
  // src/builtin-plugin/css-extract/loader.ts
7028
- var import_node_path4 = __toESM(require("path"));
7411
+ var import_node_path5 = __toESM(require("path"));
7029
7412
 
7030
7413
  // src/builtin-plugin/css-extract/utils.ts
7031
- var import_node_path3 = __toESM(require("path"));
7414
+ var import_node_path4 = __toESM(require("path"));
7032
7415
  var PLUGIN_NAME = "css-extract-rspack-plugin";
7033
7416
 
7034
7417
  // src/builtin-plugin/css-extract/loader.ts
@@ -7038,7 +7421,7 @@ var ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
7038
7421
 
7039
7422
  // src/builtin-plugin/css-extract/index.ts
7040
7423
  var DEFAULT_FILENAME = "[name].css";
7041
- var LOADER_PATH = (0, import_node_path5.join)(__dirname, "cssExtractLoader.js");
7424
+ var LOADER_PATH = (0, import_node_path6.join)(__dirname, "cssExtractLoader.js");
7042
7425
  var CssExtractRspackPlugin = class {
7043
7426
  constructor(options) {
7044
7427
  this.options = options || {};
@@ -7686,18 +8069,14 @@ var HotModuleReplacementPlugin = class extends RspackBuiltinPlugin {
7686
8069
 
7687
8070
  // src/builtin-plugin/html-plugin/plugin.ts
7688
8071
  var import_node_fs = __toESM(require("fs"));
7689
- var import_node_path6 = __toESM(require("path"));
8072
+ var import_node_path7 = __toESM(require("path"));
7690
8073
  var import_binding35 = require("@rspack/binding");
7691
8074
 
7692
8075
  // src/builtin-plugin/html-plugin/hooks.ts
7693
8076
  var liteTapable5 = __toESM(require("@rspack/lite-tapable"));
7694
8077
  var compilationHooksMap2 = /* @__PURE__ */ new WeakMap();
7695
8078
  var getPluginHooks = (compilation) => {
7696
- if (!(compilation instanceof Compilation)) {
7697
- throw new TypeError(
7698
- "The 'compilation' argument must be an instance of Compilation"
7699
- );
7700
- }
8079
+ checkCompilation(compilation);
7701
8080
  let hooks = compilationHooksMap2.get(compilation);
7702
8081
  if (hooks === void 0) {
7703
8082
  hooks = {
@@ -7754,11 +8133,11 @@ function isNonEmptyArray(value) {
7754
8133
  return value.length !== 0;
7755
8134
  }
7756
8135
  var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
7757
- function joinPath(path12) {
7758
- if (path12.length === 1) {
7759
- return path12[0].toString();
8136
+ function joinPath(path13) {
8137
+ if (path13.length === 1) {
8138
+ return path13[0].toString();
7760
8139
  }
7761
- return path12.reduce((acc, item) => {
8140
+ return path13.reduce((acc, item) => {
7762
8141
  if (typeof item === "number") {
7763
8142
  return acc + "[" + item.toString() + "]";
7764
8143
  }
@@ -8108,10 +8487,10 @@ var HtmlRspackPluginImpl = create2(
8108
8487
  templateContent = "";
8109
8488
  } else if (c.template) {
8110
8489
  const filename2 = c.template.split("?")[0];
8111
- if ([".js", ".cjs"].includes(import_node_path6.default.extname(filename2))) {
8490
+ if ([".js", ".cjs"].includes(import_node_path7.default.extname(filename2))) {
8112
8491
  templateFn = async (data) => {
8113
8492
  const context2 = this.options.context || process.cwd();
8114
- const templateFilePath = import_node_path6.default.resolve(context2, filename2);
8493
+ const templateFilePath = import_node_path7.default.resolve(context2, filename2);
8115
8494
  if (!import_node_fs.default.existsSync(templateFilePath)) {
8116
8495
  throw new Error(
8117
8496
  `HtmlRspackPlugin: could not load file \`${filename2}\` from \`${context2}\``
@@ -8248,7 +8627,7 @@ var HttpExternalsRspackPlugin = create2(
8248
8627
  );
8249
8628
 
8250
8629
  // src/builtin-plugin/HttpUriPlugin.ts
8251
- var import_node_path7 = __toESM(require("path"));
8630
+ var import_node_path8 = __toESM(require("path"));
8252
8631
  var import_binding37 = require("@rspack/binding");
8253
8632
  var defaultHttpClient = (url2, headers) => {
8254
8633
  return fetch(url2, { headers }).then((response) => {
@@ -8274,7 +8653,7 @@ var HttpUriPlugin = class extends RspackBuiltinPlugin {
8274
8653
  }
8275
8654
  raw(compiler) {
8276
8655
  const { options } = this;
8277
- const lockfileLocation = options.lockfileLocation ?? import_node_path7.default.join(
8656
+ const lockfileLocation = options.lockfileLocation ?? import_node_path8.default.join(
8278
8657
  compiler.context,
8279
8658
  compiler.name ? `${compiler.name}.rspack.lock` : "rspack.lock"
8280
8659
  );
@@ -8335,11 +8714,7 @@ var JavascriptModulesPlugin = class extends RspackBuiltinPlugin {
8335
8714
  return createBuiltinPlugin(this.name, void 0);
8336
8715
  }
8337
8716
  static getCompilationHooks(compilation) {
8338
- if (!(compilation instanceof Compilation)) {
8339
- throw new TypeError(
8340
- "The 'compilation' argument must be an instance of Compilation"
8341
- );
8342
- }
8717
+ checkCompilation(compilation);
8343
8718
  let hooks = compilationHooksMap3.get(compilation);
8344
8719
  if (hooks === void 0) {
8345
8720
  hooks = {
@@ -8393,11 +8768,11 @@ var lazyCompilationMiddleware = (compiler, userOptions = {}) => {
8393
8768
  const activeModules = /* @__PURE__ */ new Map();
8394
8769
  const filesByKey = /* @__PURE__ */ new Map();
8395
8770
  new BuiltinLazyCompilationPlugin(
8396
- ({ module: module2, path: path12 }) => {
8771
+ ({ module: module2, path: path13 }) => {
8397
8772
  const key = encodeURIComponent(
8398
8773
  module2.replace(/\\/g, "/").replace(/@/g, "_")
8399
8774
  ).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent);
8400
- filesByKey.set(key, path12);
8775
+ filesByKey.set(key, path13);
8401
8776
  const active = activeModules.get(key) === true;
8402
8777
  return {
8403
8778
  client: `${options.client || getDefaultClient(compiler)}?${encodeURIComponent((options.serverUrl ?? "") + LAZY_COMPILATION_PREFIX)}`,
@@ -8725,11 +9100,7 @@ var RuntimePluginImpl = create2(
8725
9100
  var RuntimePlugin = RuntimePluginImpl;
8726
9101
  var compilationHooksMap4 = /* @__PURE__ */ new WeakMap();
8727
9102
  RuntimePlugin.getHooks = RuntimePlugin.getCompilationHooks = (compilation) => {
8728
- if (!(compilation instanceof Compilation)) {
8729
- throw new TypeError(
8730
- "The 'compilation' argument must be an instance of Compilation"
8731
- );
8732
- }
9103
+ checkCompilation(compilation);
8733
9104
  let hooks = compilationHooksMap4.get(compilation);
8734
9105
  if (hooks === void 0) {
8735
9106
  hooks = {
@@ -9153,13 +9524,13 @@ var import_binding73 = require("@rspack/binding");
9153
9524
  var LibManifestPlugin = create2(
9154
9525
  import_binding73.BuiltinPluginName.LibManifestPlugin,
9155
9526
  (options) => {
9156
- const { context: context2, entryOnly, format: format3, name: name2, path: path12, type } = options;
9527
+ const { context: context2, entryOnly, format: format3, name: name2, path: path13, type } = options;
9157
9528
  return {
9158
9529
  context: context2,
9159
9530
  entryOnly,
9160
9531
  format: format3,
9161
9532
  name: name2,
9162
- path: path12,
9533
+ path: path13,
9163
9534
  type
9164
9535
  };
9165
9536
  }
@@ -9209,11 +9580,7 @@ var RsdoctorPluginImpl = create2(
9209
9580
  var compilationHooksMap5 = /* @__PURE__ */ new WeakMap();
9210
9581
  var RsdoctorPlugin = RsdoctorPluginImpl;
9211
9582
  RsdoctorPlugin.getHooks = RsdoctorPlugin.getCompilationHooks = (compilation) => {
9212
- if (!(compilation instanceof Compilation)) {
9213
- throw new TypeError(
9214
- "The 'compilation' argument must be an instance of Compilation"
9215
- );
9216
- }
9583
+ checkCompilation(compilation);
9217
9584
  let hooks = compilationHooksMap5.get(compilation);
9218
9585
  if (hooks === void 0) {
9219
9586
  hooks = {
@@ -9300,7 +9667,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9300
9667
  // src/builtin-plugin/SubresourceIntegrityPlugin.ts
9301
9668
  var import_node_crypto2 = require("crypto");
9302
9669
  var import_node_fs2 = require("fs");
9303
- var import_node_path8 = require("path");
9670
+ var import_node_path9 = require("path");
9304
9671
  var import_binding77 = require("@rspack/binding");
9305
9672
  var import_zod4 = require("../compiled/zod/index.js");
9306
9673
  var PLUGIN_NAME2 = "SubresourceIntegrityPlugin";
@@ -9382,7 +9749,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9382
9749
  for (const asset of assets.js) {
9383
9750
  jsIntegrity.push(
9384
9751
  this.getIntegrityChecksumForAsset(
9385
- (0, import_node_path8.relative)(publicPath2, decodeURIComponent(asset))
9752
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9386
9753
  )
9387
9754
  );
9388
9755
  }
@@ -9390,7 +9757,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9390
9757
  for (const asset of assets.css) {
9391
9758
  cssIntegrity.push(
9392
9759
  this.getIntegrityChecksumForAsset(
9393
- (0, import_node_path8.relative)(publicPath2, decodeURIComponent(asset))
9760
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9394
9761
  )
9395
9762
  );
9396
9763
  }
@@ -9410,10 +9777,10 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9410
9777
  if (!tagSrc) {
9411
9778
  return;
9412
9779
  }
9413
- const src = (0, import_node_path8.relative)(publicPath2, decodeURIComponent(tagSrc));
9780
+ const src = (0, import_node_path9.relative)(publicPath2, decodeURIComponent(tagSrc));
9414
9781
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(
9415
9782
  this.options.hashFuncNames,
9416
- (0, import_node_fs2.readFileSync)((0, import_node_path8.join)(outputPath, src))
9783
+ (0, import_node_fs2.readFileSync)((0, import_node_path9.join)(outputPath, src))
9417
9784
  );
9418
9785
  tag.attributes.crossorigin = crossOriginLoading2 || "anonymous";
9419
9786
  }
@@ -9513,8 +9880,8 @@ function computeIntegrity(hashFuncNames, source) {
9513
9880
  ).join(" ");
9514
9881
  return result2;
9515
9882
  }
9516
- function normalizePath(path12) {
9517
- return path12.replace(/\?.*$/, "").split(import_node_path8.sep).join("/");
9883
+ function normalizePath(path13) {
9884
+ return path13.replace(/\?.*$/, "").split(import_node_path9.sep).join("/");
9518
9885
  }
9519
9886
 
9520
9887
  // src/builtin-plugin/ModuleInfoHeaderPlugin.ts
@@ -9859,13 +10226,13 @@ __export(browserslistTargetHandler_exports, {
9859
10226
  load: () => load,
9860
10227
  resolve: () => resolve
9861
10228
  });
9862
- var import_node_path9 = __toESM(require("path"));
10229
+ var import_node_path10 = __toESM(require("path"));
9863
10230
  var inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
9864
10231
  var parse = (input, context2) => {
9865
10232
  if (!input) {
9866
10233
  return {};
9867
10234
  }
9868
- if (import_node_path9.default.isAbsolute(input)) {
10235
+ if (import_node_path10.default.isAbsolute(input)) {
9869
10236
  const [, configPath, env] = inputRx.exec(input) || [];
9870
10237
  return { configPath, env };
9871
10238
  }
@@ -10552,6 +10919,7 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
10552
10919
  }
10553
10920
  D(experiments3, "rspackFuture", {});
10554
10921
  D(experiments3, "parallelCodeSplitting", true);
10922
+ D(experiments3, "parallelLoader", false);
10555
10923
  };
10556
10924
  var applybundlerInfoDefaults = (rspackFuture, library3) => {
10557
10925
  if (typeof rspackFuture === "object") {
@@ -10814,7 +11182,7 @@ var applyOutputDefaults = (output2, {
10814
11182
  }
10815
11183
  );
10816
11184
  if (libraryName2) return libraryName2;
10817
- const pkgPath = import_node_path10.default.resolve(context2, "package.json");
11185
+ const pkgPath = import_node_path11.default.resolve(context2, "package.json");
10818
11186
  try {
10819
11187
  const packageInfo = JSON.parse(import_node_fs3.default.readFileSync(pkgPath, "utf-8"));
10820
11188
  return packageInfo.name || "";
@@ -10870,7 +11238,7 @@ while determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
10870
11238
  D(output2, "assetModuleFilename", "[hash][ext][query]");
10871
11239
  D(output2, "webassemblyModuleFilename", "[hash].module.wasm");
10872
11240
  D(output2, "compareBeforeEmit", true);
10873
- F(output2, "path", () => import_node_path10.default.join(process.cwd(), "dist"));
11241
+ F(output2, "path", () => import_node_path11.default.join(process.cwd(), "dist"));
10874
11242
  F(output2, "pathinfo", () => development);
10875
11243
  D(
10876
11244
  output2,
@@ -11345,7 +11713,7 @@ var getPnpDefault = () => {
11345
11713
  };
11346
11714
 
11347
11715
  // src/config/normalization.ts
11348
- var import_node_path11 = __toESM(require("path"));
11716
+ var import_node_path12 = __toESM(require("path"));
11349
11717
  var import_node_util5 = __toESM(require("util"));
11350
11718
  var getNormalizedRspackOptions = (config2) => {
11351
11719
  return {
@@ -11535,7 +11903,7 @@ var getNormalizedRspackOptions = (config2) => {
11535
11903
  type: "persistent",
11536
11904
  buildDependencies: nestedArray(
11537
11905
  cache.buildDependencies,
11538
- (deps) => deps.map((d) => import_node_path11.default.resolve(config2.context || process.cwd(), d))
11906
+ (deps) => deps.map((d) => import_node_path12.default.resolve(config2.context || process.cwd(), d))
11539
11907
  ),
11540
11908
  version: cache.version || "",
11541
11909
  snapshot: {
@@ -11547,7 +11915,7 @@ var getNormalizedRspackOptions = (config2) => {
11547
11915
  },
11548
11916
  storage: {
11549
11917
  type: "filesystem",
11550
- directory: import_node_path11.default.resolve(
11918
+ directory: import_node_path12.default.resolve(
11551
11919
  config2.context || process.cwd(),
11552
11920
  ((_a = cache.storage) == null ? void 0 : _a.directory) || "node_modules/.cache/rspack"
11553
11921
  )
@@ -11579,7 +11947,8 @@ var getNormalizedRspackOptions = (config2) => {
11579
11947
  } : options
11580
11948
  ),
11581
11949
  parallelCodeSplitting: experiments3.parallelCodeSplitting,
11582
- buildHttp: experiments3.buildHttp
11950
+ buildHttp: experiments3.buildHttp,
11951
+ parallelLoader: experiments3.parallelLoader
11583
11952
  })),
11584
11953
  watch: config2.watch,
11585
11954
  watchOptions: cloneObject(config2.watchOptions),
@@ -11685,14 +12054,14 @@ var Resolver = class _Resolver {
11685
12054
  constructor(binding14) {
11686
12055
  this.binding = binding14;
11687
12056
  }
11688
- resolveSync(context2, path12, request) {
11689
- const data = this.binding.resolveSync(path12, request);
12057
+ resolveSync(context2, path13, request) {
12058
+ const data = this.binding.resolveSync(path13, request);
11690
12059
  if (data === false) return data;
11691
12060
  return data.resource;
11692
12061
  }
11693
- resolve(context2, path12, request, resolveContext, callback) {
12062
+ resolve(context2, path13, request, resolveContext, callback) {
11694
12063
  try {
11695
- const data = this.binding.resolveSync(path12, request);
12064
+ const data = this.binding.resolveSync(path13, request);
11696
12065
  if (data === false) {
11697
12066
  callback(null, false);
11698
12067
  return;
@@ -12038,7 +12407,7 @@ var Watching = class {
12038
12407
 
12039
12408
  // src/util/bindingVersionCheck.ts
12040
12409
  var import_node_fs4 = require("fs");
12041
- var import_node_path12 = __toESM(require("path"));
12410
+ var import_node_path13 = __toESM(require("path"));
12042
12411
  var NodePlatformArchToAbi = {
12043
12412
  android: {
12044
12413
  arm64: "",
@@ -12110,7 +12479,7 @@ var checkVersion = () => {
12110
12479
  }
12111
12480
  let ADDON_VERSION;
12112
12481
  try {
12113
- const BINDING_PKG_DIR = import_node_path12.default.dirname(
12482
+ const BINDING_PKG_DIR = import_node_path13.default.dirname(
12114
12483
  require.resolve("@rspack/binding/package.json")
12115
12484
  );
12116
12485
  const isLocal = (0, import_node_fs4.readdirSync)(BINDING_PKG_DIR).some(
@@ -12802,15 +13171,17 @@ var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) =>
12802
13171
  function(queried) {
12803
13172
  return function({
12804
13173
  chunk: chunkBinding,
13174
+ allRuntimeRequirements,
12805
13175
  runtimeRequirements
12806
13176
  }) {
12807
13177
  const set = __from_binding_runtime_globals(runtimeRequirements);
13178
+ const all = __from_binding_runtime_globals(allRuntimeRequirements);
12808
13179
  const chunk = Chunk.__from_binding(chunkBinding);
12809
13180
  for (const r of set) {
12810
- queried.for(r).call(chunk, set);
13181
+ queried.for(r).call(chunk, all);
12811
13182
  }
12812
13183
  return {
12813
- runtimeRequirements: __to_binding_runtime_globals(set)
13184
+ allRuntimeRequirements: __to_binding_runtime_globals(all)
12814
13185
  };
12815
13186
  };
12816
13187
  }
@@ -13678,7 +14049,7 @@ var Compiler = class _Compiler {
13678
14049
  return finalCallback(null, stats);
13679
14050
  });
13680
14051
  };
13681
- const run = () => {
14052
+ const run2 = () => {
13682
14053
  this.hooks.beforeRun.callAsync(this, (err) => {
13683
14054
  if (err) {
13684
14055
  return finalCallback(err);
@@ -13695,10 +14066,10 @@ var Compiler = class _Compiler {
13695
14066
  this.cache.endIdle((err) => {
13696
14067
  if (err) return callback(err);
13697
14068
  this.idle = false;
13698
- run();
14069
+ run2();
13699
14070
  });
13700
14071
  } else {
13701
- run();
14072
+ run2();
13702
14073
  }
13703
14074
  }
13704
14075
  runAsChild(callback) {
@@ -14550,7 +14921,7 @@ var MultiCompiler = class {
14550
14921
  * @param {Callback<MultiStats>} callback callback when all compilers are done, result includes Stats of all changed compilers
14551
14922
  * @returns {SetupResult[]} result of setup
14552
14923
  */
14553
- #runGraph(setup, run, callback) {
14924
+ #runGraph(setup, run2, callback) {
14554
14925
  const nodes = this.compilers.map((compiler) => ({
14555
14926
  compiler,
14556
14927
  setupResult: void 0,
@@ -14664,7 +15035,7 @@ var MultiCompiler = class {
14664
15035
  if (node3.state === "queued" || node3.state === "blocked" && node3.parents.every((p) => p.state === "done")) {
14665
15036
  running++;
14666
15037
  node3.state = "starting";
14667
- run(
15038
+ run2(
14668
15039
  node3.compiler,
14669
15040
  node3.setupResult,
14670
15041
  nodeDone.bind(null, node3)
@@ -15183,17 +15554,17 @@ var ASSETS_GROUPERS = {
15183
15554
  const extensionMatch = groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
15184
15555
  const extension = extensionMatch ? extensionMatch[1] : "";
15185
15556
  const pathMatch = groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name);
15186
- const path12 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15557
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15187
15558
  const keys = [];
15188
15559
  if (groupAssetsByPath) {
15189
15560
  keys.push(".");
15190
15561
  if (extension)
15191
15562
  keys.push(
15192
- path12.length ? `${path12.join("/")}/*${extension}` : `*${extension}`
15563
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15193
15564
  );
15194
- while (path12.length > 0) {
15195
- keys.push(`${path12.join("/")}/`);
15196
- path12.pop();
15565
+ while (path13.length > 0) {
15566
+ keys.push(`${path13.join("/")}/`);
15567
+ path13.pop();
15197
15568
  }
15198
15569
  } else {
15199
15570
  if (extension) keys.push(`*${extension}`);
@@ -15379,16 +15750,16 @@ var MODULES_GROUPERS = (type) => ({
15379
15750
  const extensionMatch = groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource);
15380
15751
  const extension = extensionMatch ? extensionMatch[1] : "";
15381
15752
  const pathMatch = groupModulesByPath && GROUP_PATH_REGEXP.exec(resource);
15382
- const path12 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15753
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15383
15754
  const keys = [];
15384
15755
  if (groupModulesByPath) {
15385
15756
  if (extension)
15386
15757
  keys.push(
15387
- path12.length ? `${path12.join("/")}/*${extension}` : `*${extension}`
15758
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15388
15759
  );
15389
- while (path12.length > 0) {
15390
- keys.push(`${path12.join("/")}/`);
15391
- path12.pop();
15760
+ while (path13.length > 0) {
15761
+ keys.push(`${path13.join("/")}/`);
15762
+ path13.pop();
15392
15763
  }
15393
15764
  } else {
15394
15765
  if (extension) keys.push(`*${extension}`);
@@ -18967,7 +19338,7 @@ var NodeTemplatePlugin = class {
18967
19338
  };
18968
19339
 
18969
19340
  // src/config/zod.ts
18970
- var import_node_path13 = __toESM(require("path"));
19341
+ var import_node_path14 = __toESM(require("path"));
18971
19342
  var import_zod8 = require("../compiled/zod/index.js");
18972
19343
 
18973
19344
  // src/config/utils.ts
@@ -19125,7 +19496,7 @@ var filename = filenameTemplate.or(
19125
19496
  var name = import_zod8.z.string();
19126
19497
  var dependencies = import_zod8.z.array(name);
19127
19498
  var context = import_zod8.z.string().refine(
19128
- (val) => import_node_path13.default.isAbsolute(val),
19499
+ (val) => import_node_path14.default.isAbsolute(val),
19129
19500
  (val) => ({
19130
19501
  message: `The provided value ${JSON.stringify(val)} must be an absolute path.`
19131
19502
  })
@@ -19224,7 +19595,7 @@ var entryDynamic = import_zod8.z.function().returns(
19224
19595
  entryStatic.or(import_zod8.z.promise(entryStatic))
19225
19596
  );
19226
19597
  var entry = entryStatic.or(entryDynamic);
19227
- var path11 = import_zod8.z.string();
19598
+ var path12 = import_zod8.z.string();
19228
19599
  var pathinfo = import_zod8.z.boolean().or(import_zod8.z.literal("verbose"));
19229
19600
  var assetModuleFilename = filename;
19230
19601
  var webassemblyModuleFilename = import_zod8.z.string();
@@ -19298,7 +19669,7 @@ var environment = import_zod8.z.strictObject({
19298
19669
  templateLiteral: import_zod8.z.boolean().optional()
19299
19670
  });
19300
19671
  var output = import_zod8.z.strictObject({
19301
- path: path11.optional(),
19672
+ path: path12.optional(),
19302
19673
  pathinfo: pathinfo.optional(),
19303
19674
  clean: clean.optional(),
19304
19675
  publicPath: publicPath.optional(),
@@ -19403,7 +19774,8 @@ var ruleSetLoaderOptions = import_zod8.z.string().or(import_zod8.z.record(import
19403
19774
  var ruleSetLoaderWithOptions = import_zod8.z.strictObject({
19404
19775
  ident: import_zod8.z.string().optional(),
19405
19776
  loader: ruleSetLoader,
19406
- options: ruleSetLoaderOptions.optional()
19777
+ options: ruleSetLoaderOptions.optional(),
19778
+ parallel: import_zod8.z.boolean().optional()
19407
19779
  });
19408
19780
  var ruleSetUseItem = ruleSetLoader.or(
19409
19781
  ruleSetLoaderWithOptions
@@ -20089,7 +20461,8 @@ var experiments = import_zod8.z.strictObject({
20089
20461
  parallelCodeSplitting: import_zod8.z.boolean().optional(),
20090
20462
  futureDefaults: import_zod8.z.boolean().optional(),
20091
20463
  rspackFuture: rspackFutureOptions.optional(),
20092
- buildHttp: buildHttpOptions.optional()
20464
+ buildHttp: buildHttpOptions.optional(),
20465
+ parallelLoader: import_zod8.z.boolean().optional()
20093
20466
  });
20094
20467
  var watch = import_zod8.z.boolean();
20095
20468
  var watchOptions = import_zod8.z.strictObject({