@rspack/core 1.3.0 → 1.3.1

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,162 @@ 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 ids = Array.isArray(pendingRequestId) ? pendingRequestId : [pendingRequestId];
5358
+ result2 = await Promise.all(
5359
+ ids.map((id) => pendingRequests.get(id))
5360
+ );
5361
+ break;
5362
+ }
5363
+ default:
5364
+ throw new Error(`Unknown request type: ${message.requestType}`);
5365
+ }
5366
+ mainSyncPort.postMessage({
5367
+ type: "response",
5368
+ id: message.id,
5369
+ data: result2
5370
+ });
5371
+ } catch (e) {
5372
+ mainSyncPort.postMessage({
5373
+ type: "response-error",
5374
+ id: message.id,
5375
+ error: serializeError(e)
5376
+ });
5377
+ }
5378
+ Atomics.add(sharedBufferView, 0, 1);
5379
+ Atomics.notify(sharedBufferView, 0, Number.POSITIVE_INFINITY);
5380
+ });
5381
+ mainSyncPort.on("messageerror", handleError);
5382
+ pool2.run(
5383
+ {
5384
+ ...task,
5385
+ // Internal worker data. Tinypool does not support passing `transferList` to
5386
+ // `new Worker(..)`
5387
+ workerData: {
5388
+ workerPort,
5389
+ workerSyncPort
5390
+ }
5391
+ },
5392
+ {
5393
+ ...options,
5394
+ transferList: [
5395
+ ...(options == null ? void 0 : options.transferList) || [],
5396
+ workerPort,
5397
+ workerSyncPort
5398
+ ]
5399
+ }
5400
+ ).catch(handleError);
5401
+ });
5402
+ });
5403
+
5404
+ // src/loader-runner/utils.ts
5405
+ var import_node_util4 = require("util");
5406
+
5246
5407
  // src/loader-runner/LoaderLoadingError.ts
5247
5408
  var LoadingLoaderError = class extends Error {
5248
5409
  constructor(message) {
@@ -5303,6 +5464,89 @@ function handleResult(loader2, module2, callback) {
5303
5464
  callback();
5304
5465
  }
5305
5466
 
5467
+ // src/loader-runner/utils.ts
5468
+ var decoder = new TextDecoder();
5469
+ function utf8BufferToString(buf) {
5470
+ const str = decoder.decode(buf);
5471
+ if (str.charCodeAt(0) === 65279) {
5472
+ return str.slice(1);
5473
+ }
5474
+ return str;
5475
+ }
5476
+ function convertArgs(args, raw) {
5477
+ if (!raw && args[0] instanceof Uint8Array)
5478
+ args[0] = utf8BufferToString(args[0]);
5479
+ else if (raw && typeof args[0] === "string")
5480
+ args[0] = Buffer.from(args[0], "utf-8");
5481
+ if (raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0])) {
5482
+ args[0] = Buffer.from(args[0].buffer);
5483
+ }
5484
+ }
5485
+ var loadLoader2 = (0, import_node_util4.promisify)(loadLoader);
5486
+ var runSyncOrAsync = (0, import_node_util4.promisify)(function runSyncOrAsync2(fn2, context2, args, callback) {
5487
+ let isSync = true;
5488
+ let isDone = false;
5489
+ let isError = false;
5490
+ let reportedError = false;
5491
+ context2.async = function async() {
5492
+ if (isDone) {
5493
+ if (reportedError) return void 0;
5494
+ throw new Error("async(): The callback was already called.");
5495
+ }
5496
+ isSync = false;
5497
+ return innerCallback;
5498
+ };
5499
+ const innerCallback = (err, ...args2) => {
5500
+ if (isDone) {
5501
+ if (reportedError) return;
5502
+ throw new Error("callback(): The callback was already called.");
5503
+ }
5504
+ isDone = true;
5505
+ isSync = false;
5506
+ try {
5507
+ callback(err, args2);
5508
+ } catch (e) {
5509
+ isError = true;
5510
+ throw e;
5511
+ }
5512
+ };
5513
+ context2.callback = innerCallback;
5514
+ try {
5515
+ const result2 = function LOADER_EXECUTION() {
5516
+ return fn2.apply(context2, args);
5517
+ }();
5518
+ if (isSync) {
5519
+ isDone = true;
5520
+ if (result2 === void 0) {
5521
+ callback(null, []);
5522
+ return;
5523
+ }
5524
+ if (result2 && typeof result2 === "object" && typeof result2.then === "function") {
5525
+ result2.then((r) => {
5526
+ callback(null, [r]);
5527
+ }, callback);
5528
+ return;
5529
+ }
5530
+ callback(null, [result2]);
5531
+ return;
5532
+ }
5533
+ } catch (e) {
5534
+ const err = e;
5535
+ if ("hideStack" in err && err.hideStack) {
5536
+ err.hideStack = "true";
5537
+ }
5538
+ if (isError) throw e;
5539
+ if (isDone) {
5540
+ if (e instanceof Error) console.error(e.stack);
5541
+ else console.error(e);
5542
+ return;
5543
+ }
5544
+ isDone = true;
5545
+ reportedError = true;
5546
+ callback(e, []);
5547
+ }
5548
+ });
5549
+
5306
5550
  // src/loader-runner/index.ts
5307
5551
  function createLoaderObject(loader2, compiler) {
5308
5552
  const obj = {
@@ -5357,11 +5601,10 @@ function createLoaderObject(loader2, compiler) {
5357
5601
  return obj;
5358
5602
  }
5359
5603
  var LoaderObject = class {
5360
- #loaderItem;
5361
5604
  constructor(loaderItem, compiler) {
5362
5605
  const {
5363
5606
  request,
5364
- path: path12,
5607
+ path: path13,
5365
5608
  query,
5366
5609
  fragment,
5367
5610
  options,
@@ -5372,7 +5615,7 @@ var LoaderObject = class {
5372
5615
  type
5373
5616
  } = createLoaderObject(loaderItem, compiler);
5374
5617
  this.request = request;
5375
- this.path = path12;
5618
+ this.path = path13;
5376
5619
  this.query = query;
5377
5620
  this.fragment = fragment;
5378
5621
  this.options = options;
@@ -5381,41 +5624,23 @@ var LoaderObject = class {
5381
5624
  this.pitch = pitch;
5382
5625
  this.raw = raw;
5383
5626
  this.type = type;
5384
- this.#loaderItem = loaderItem;
5627
+ this.parallel = ident ? compiler.__internal__ruleSet.references.get(`${ident}$$parallelism`) : false;
5628
+ this.loaderItem = loaderItem;
5629
+ this.loaderItem.data = this.loaderItem.data ?? {};
5385
5630
  }
5386
5631
  get pitchExecuted() {
5387
- return this.#loaderItem.pitchExecuted;
5632
+ return this.loaderItem.pitchExecuted;
5388
5633
  }
5389
5634
  set pitchExecuted(value) {
5390
5635
  (0, import_node_assert2.default)(value);
5391
- this.#loaderItem.pitchExecuted = true;
5636
+ this.loaderItem.pitchExecuted = true;
5392
5637
  }
5393
5638
  get normalExecuted() {
5394
- return this.#loaderItem.normalExecuted;
5639
+ return this.loaderItem.normalExecuted;
5395
5640
  }
5396
5641
  set normalExecuted(value) {
5397
5642
  (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;
5643
+ this.loaderItem.normalExecuted = true;
5419
5644
  }
5420
5645
  shouldYield() {
5421
5646
  return this.request.startsWith(BUILTIN_LOADER_PREFIX);
@@ -5424,7 +5649,7 @@ var LoaderObject = class {
5424
5649
  return new this(loaderItem, compiler);
5425
5650
  }
5426
5651
  static __to_binding(loader2) {
5427
- return loader2.#loaderItem;
5652
+ return loader2.loaderItem;
5428
5653
  }
5429
5654
  };
5430
5655
  var JsSourceMap = class {
@@ -5435,81 +5660,17 @@ var JsSourceMap = class {
5435
5660
  return serializeObject(map);
5436
5661
  }
5437
5662
  };
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("\\");
5663
+ function dirname2(path13) {
5664
+ if (path13 === "/") return "/";
5665
+ const i = path13.lastIndexOf("/");
5666
+ const j = path13.lastIndexOf("\\");
5667
+ const i2 = path13.indexOf("/");
5668
+ const j2 = path13.indexOf("\\");
5508
5669
  const idx = i > j ? i : j;
5509
5670
  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);
5671
+ if (idx < 0) return path13;
5672
+ if (idx === idx2) return path13.slice(0, idx + 1);
5673
+ return path13.slice(0, idx);
5513
5674
  }
5514
5675
  function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
5515
5676
  var _a;
@@ -5559,7 +5720,6 @@ async function tryTrace(context2) {
5559
5720
  return null;
5560
5721
  }
5561
5722
  async function runLoaders(compiler, context2) {
5562
- var _a, _b;
5563
5723
  const { tracer, activeContext } = await tryTrace(context2) ?? {};
5564
5724
  const loaderState = context2.loaderState;
5565
5725
  const { resource } = context2.resourceData;
@@ -5910,48 +6070,228 @@ async function runLoaders(compiler, context2) {
5910
6070
  });
5911
6071
  Object.defineProperty(loaderContext, "data", {
5912
6072
  enumerable: true,
5913
- get: () => loaderContext.loaders[loaderContext.loaderIndex].data,
5914
- set: (data) => loaderContext.loaders[loaderContext.loaderIndex].data = data
6073
+ get: () => loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
6074
+ set: (data) => loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = data
5915
6075
  });
5916
6076
  Object.defineProperty(loaderContext, "__internal__parseMeta", {
5917
6077
  enumerable: true,
5918
6078
  get: () => context2.__internal__parseMeta
5919
6079
  });
6080
+ const getWorkerLoaderContext = () => {
6081
+ const workerLoaderContext = {
6082
+ hot: loaderContext.hot,
6083
+ context: loaderContext.context,
6084
+ resourcePath: loaderContext.resourcePath,
6085
+ resourceQuery: loaderContext.resourceQuery,
6086
+ resourceFragment: loaderContext.resourceFragment,
6087
+ resource: loaderContext.resource,
6088
+ mode: loaderContext.mode,
6089
+ sourceMap: loaderContext.sourceMap,
6090
+ rootContext: loaderContext.context,
6091
+ loaderIndex: loaderContext.loaderIndex,
6092
+ loaders: loaderContext.loaders.map((item) => {
6093
+ return {
6094
+ ...item,
6095
+ pitch: void 0,
6096
+ normal: void 0,
6097
+ normalExecuted: item.normalExecuted,
6098
+ pitchExecuted: item.pitchExecuted
6099
+ };
6100
+ }),
6101
+ __internal__workerInfo: {
6102
+ hashFunction: compiler._lastCompilation.outputOptions.hashFunction
6103
+ },
6104
+ _compiler: {
6105
+ options: {
6106
+ experiments: {
6107
+ css: compiler.options.experiments.css
6108
+ }
6109
+ }
6110
+ },
6111
+ _compilation: {
6112
+ outputOptions: compiler._lastCompilation.outputOptions
6113
+ },
6114
+ _module: {
6115
+ type: loaderContext._module.type,
6116
+ identifier: loaderContext._module.identifier()
6117
+ }
6118
+ };
6119
+ Object.assign(workerLoaderContext, compiler.options.loader);
6120
+ return workerLoaderContext;
6121
+ };
6122
+ const getWorkerLoaderHandlers = function() {
6123
+ return {
6124
+ handleIncomingRequest(requestType, ...args) {
6125
+ switch (requestType) {
6126
+ case "AddDependency" /* AddDependency */: {
6127
+ loaderContext.addDependency(args[0]);
6128
+ break;
6129
+ }
6130
+ case "AddContextDependency" /* AddContextDependency */: {
6131
+ loaderContext.addContextDependency(args[0]);
6132
+ break;
6133
+ }
6134
+ case "AddMissingDependency" /* AddMissingDependency */: {
6135
+ loaderContext.addMissingDependency(args[0]);
6136
+ break;
6137
+ }
6138
+ case "AddBuildDependency" /* AddBuildDependency */: {
6139
+ loaderContext.addBuildDependency(args[0]);
6140
+ break;
6141
+ }
6142
+ case "GetDependencies" /* GetDependencies */: {
6143
+ return loaderContext.getDependencies();
6144
+ }
6145
+ case "GetContextDependencies" /* GetContextDependencies */: {
6146
+ return loaderContext.getContextDependencies();
6147
+ }
6148
+ case "GetMissingDependencies" /* GetMissingDependencies */: {
6149
+ return loaderContext.getMissingDependencies();
6150
+ }
6151
+ case "ClearDependencies" /* ClearDependencies */: {
6152
+ loaderContext.clearDependencies();
6153
+ break;
6154
+ }
6155
+ case "Resolve" /* Resolve */: {
6156
+ return new Promise((resolve2, reject) => {
6157
+ loaderContext.resolve(args[0], args[1], (err, result2) => {
6158
+ if (err) reject(err);
6159
+ else resolve2(result2);
6160
+ });
6161
+ });
6162
+ }
6163
+ case "GetResolve" /* GetResolve */: {
6164
+ return new Promise((resolve2, reject) => {
6165
+ loaderContext.getResolve(args[0])(
6166
+ args[1],
6167
+ args[2],
6168
+ (err, result2) => {
6169
+ if (err) reject(err);
6170
+ else resolve2(result2);
6171
+ }
6172
+ );
6173
+ });
6174
+ }
6175
+ case "GetLogger" /* GetLogger */: {
6176
+ const [type, name2, arg] = args;
6177
+ loaderContext.getLogger(name2)[type](...arg);
6178
+ }
6179
+ case "EmitError" /* EmitError */: {
6180
+ const workerError = args[0];
6181
+ const error = new Error(workerError.message);
6182
+ error.stack = workerError.stack;
6183
+ error.name = workerError.name;
6184
+ loaderContext.emitError(error);
6185
+ break;
6186
+ }
6187
+ case "EmitWarning" /* EmitWarning */: {
6188
+ const workerError = args[0];
6189
+ const error = new Error(workerError.message);
6190
+ error.stack = workerError.stack;
6191
+ error.name = workerError.name;
6192
+ loaderContext.emitWarning(error);
6193
+ break;
6194
+ }
6195
+ case "EmitFile" /* EmitFile */: {
6196
+ const [name2, content, sourceMap, assetInfo] = args;
6197
+ loaderContext.emitFile(name2, content, sourceMap, assetInfo);
6198
+ break;
6199
+ }
6200
+ case "EmitDiagnostic" /* EmitDiagnostic */: {
6201
+ const diagnostic = args[0];
6202
+ loaderContext.experiments.emitDiagnostic(diagnostic);
6203
+ break;
6204
+ }
6205
+ case "SetCacheable" /* SetCacheable */: {
6206
+ const cacheable = args[0];
6207
+ loaderContext.cacheable(cacheable);
6208
+ break;
6209
+ }
6210
+ case "UpdateLoaderObjects" /* UpdateLoaderObjects */: {
6211
+ const updates = args[0];
6212
+ loaderContext.loaders = loaderContext.loaders.map((item, index) => {
6213
+ const update = updates[index];
6214
+ item.loaderItem.data = update.data;
6215
+ if (update.pitchExecuted) {
6216
+ item.pitchExecuted = true;
6217
+ }
6218
+ if (update.normalExecuted) {
6219
+ item.normalExecuted = true;
6220
+ }
6221
+ return item;
6222
+ });
6223
+ break;
6224
+ }
6225
+ default: {
6226
+ throw new Error(`Unknown request type: ${requestType}`);
6227
+ }
6228
+ }
6229
+ }
6230
+ };
6231
+ };
6232
+ const enableParallelism = (currentLoaderObject) => {
6233
+ return compiler.options.experiments.parallelLoader && (currentLoaderObject == null ? void 0 : currentLoaderObject.parallel);
6234
+ };
6235
+ const isomorphoicRun = async (fn2, args) => {
6236
+ const currentLoaderObject = getCurrentLoader(loaderContext);
6237
+ const parallelism = enableParallelism(currentLoaderObject);
6238
+ const pitch = loaderState === import_binding3.JsLoaderState.Pitching;
6239
+ const worker2 = parallelism;
6240
+ let result2;
6241
+ const span = tracer == null ? void 0 : tracer.startSpan(
6242
+ `LoaderRunner:${pitch ? "pitch" : "normal"}${worker2 ? " (worker)" : ""}`,
6243
+ {
6244
+ attributes: {
6245
+ "loader.identifier": currentLoaderObject == null ? void 0 : currentLoaderObject.request
6246
+ }
6247
+ },
6248
+ activeContext
6249
+ );
6250
+ if (parallelism) {
6251
+ result2 = await run(
6252
+ {
6253
+ loaderContext: getWorkerLoaderContext(),
6254
+ loaderState,
6255
+ args
6256
+ },
6257
+ getWorkerLoaderHandlers()
6258
+ ) || [];
6259
+ } else {
6260
+ if (loaderState === import_binding3.JsLoaderState.Normal)
6261
+ convertArgs(args, !!(currentLoaderObject == null ? void 0 : currentLoaderObject.raw));
6262
+ result2 = await runSyncOrAsync(fn2, loaderContext, args) || [];
6263
+ }
6264
+ span == null ? void 0 : span.end();
6265
+ return result2;
6266
+ };
5920
6267
  try {
5921
6268
  switch (loaderState) {
5922
6269
  case import_binding3.JsLoaderState.Pitching: {
5923
6270
  while (loaderContext.loaderIndex < loaderContext.loaders.length) {
5924
6271
  const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
6272
+ const parallelism = enableParallelism(currentLoaderObject);
5925
6273
  if (currentLoaderObject.shouldYield()) break;
5926
6274
  if (currentLoaderObject.pitchExecuted) {
5927
6275
  loaderContext.loaderIndex += 1;
5928
6276
  continue;
5929
6277
  }
5930
- await loadLoaderAsync(currentLoaderObject);
6278
+ await loadLoader2(currentLoaderObject);
5931
6279
  const fn2 = currentLoaderObject.pitch;
5932
- currentLoaderObject.pitchExecuted = true;
6280
+ if (!parallelism || !fn2) {
6281
+ currentLoaderObject.pitchExecuted = true;
6282
+ }
5933
6283
  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, [
6284
+ const args = await isomorphoicRun(fn2, [
5944
6285
  loaderContext.remainingRequest,
5945
6286
  loaderContext.previousRequest,
5946
- currentLoaderObject.data
5947
- ]) || [];
5948
- span == null ? void 0 : span.end();
6287
+ currentLoaderObject.loaderItem.data
6288
+ ]);
5949
6289
  const hasArg = args.some((value) => value !== void 0);
5950
6290
  if (hasArg) {
5951
6291
  const [content, sourceMap, additionalData] = args;
5952
6292
  context2.content = isNil(content) ? null : toBuffer(content);
5953
6293
  context2.sourceMap = serializeObject(sourceMap);
5954
- context2.additionalData = additionalData;
6294
+ context2.additionalData = additionalData || void 0;
5955
6295
  break;
5956
6296
  }
5957
6297
  }
@@ -5963,28 +6303,23 @@ async function runLoaders(compiler, context2) {
5963
6303
  let additionalData = context2.additionalData;
5964
6304
  while (loaderContext.loaderIndex >= 0) {
5965
6305
  const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
6306
+ const parallelism = enableParallelism(currentLoaderObject);
5966
6307
  if (currentLoaderObject.shouldYield()) break;
5967
6308
  if (currentLoaderObject.normalExecuted) {
5968
6309
  loaderContext.loaderIndex--;
5969
6310
  continue;
5970
6311
  }
5971
- await loadLoaderAsync(currentLoaderObject);
6312
+ await loadLoader2(currentLoaderObject);
5972
6313
  const fn2 = currentLoaderObject.normal;
5973
- currentLoaderObject.normalExecuted = true;
6314
+ if (!parallelism || !fn2) {
6315
+ currentLoaderObject.normalExecuted = true;
6316
+ }
5974
6317
  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();
6318
+ [content, sourceMap, additionalData] = await isomorphoicRun(fn2, [
6319
+ content,
6320
+ sourceMap,
6321
+ additionalData
6322
+ ]);
5988
6323
  }
5989
6324
  context2.content = isNil(content) ? null : toBuffer(content);
5990
6325
  context2.sourceMap = JsSourceMap.__to_binding(sourceMap);
@@ -6011,18 +6346,6 @@ async function runLoaders(compiler, context2) {
6011
6346
  }
6012
6347
  return context2;
6013
6348
  }
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
6349
  var PATH_QUERY_FRAGMENT_REGEXP2 = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
6027
6350
  function parsePathQueryFragment(str) {
6028
6351
  const match = PATH_QUERY_FRAGMENT_REGEXP2.exec(str);
@@ -6035,10 +6358,10 @@ function parsePathQueryFragment(str) {
6035
6358
 
6036
6359
  // src/config/adapterRuleUse.ts
6037
6360
  var BUILTIN_LOADER_PREFIX = "builtin:";
6038
- function createRawModuleRuleUses(uses, path12, options) {
6361
+ function createRawModuleRuleUses(uses, path13, options) {
6039
6362
  const normalizeRuleSetUseItem = (item) => typeof item === "string" ? { loader: item } : item;
6040
6363
  const allUses = Array.isArray(uses) ? [...uses].map(normalizeRuleSetUseItem) : [normalizeRuleSetUseItem(uses)];
6041
- return createRawModuleRuleUsesImpl(allUses, path12, options);
6364
+ return createRawModuleRuleUsesImpl(allUses, path13, options);
6042
6365
  }
6043
6366
  var getSwcLoaderOptions = (options, _) => {
6044
6367
  if (options && typeof options === "object") {
@@ -6079,7 +6402,7 @@ function getBuiltinLoaderOptions(identifier, o, options) {
6079
6402
  }
6080
6403
  return o;
6081
6404
  }
6082
- function createRawModuleRuleUsesImpl(uses, path12, options) {
6405
+ function createRawModuleRuleUsesImpl(uses, path13, options) {
6083
6406
  if (!uses.length) {
6084
6407
  return [];
6085
6408
  }
@@ -6094,7 +6417,7 @@ function createRawModuleRuleUsesImpl(uses, path12, options) {
6094
6417
  return {
6095
6418
  loader: resolveStringifyLoaders(
6096
6419
  use,
6097
- `${path12}[${index}]`,
6420
+ `${path13}[${index}]`,
6098
6421
  options.compiler,
6099
6422
  isBuiltin
6100
6423
  ),
@@ -6102,20 +6425,33 @@ function createRawModuleRuleUsesImpl(uses, path12, options) {
6102
6425
  };
6103
6426
  });
6104
6427
  }
6105
- function resolveStringifyLoaders(use, path12, compiler, isBuiltin) {
6428
+ function resolveStringifyLoaders(use, path13, compiler, isBuiltin) {
6106
6429
  const obj = parsePathQueryFragment(use.loader);
6107
- let ident = null;
6430
+ let ident = use.ident;
6108
6431
  if (use.options === null) {
6109
6432
  } else if (use.options === void 0) {
6110
6433
  } else if (typeof use.options === "string") obj.query = `?${use.options}`;
6111
6434
  else if (use.ident) obj.query = `??${ident = use.ident}`;
6112
6435
  else if (typeof use.options === "object" && use.options.ident)
6113
6436
  obj.query = `??${ident = use.options.ident}`;
6114
- else if (typeof use.options === "object") obj.query = `??${ident = path12}`;
6437
+ else if (typeof use.options === "object") obj.query = `??${ident = path13}`;
6115
6438
  else obj.query = `?${JSON.stringify(use.options)}`;
6439
+ const parallelism = !!use.parallel;
6440
+ if (parallelism && (!use.options || typeof use.options !== "object")) {
6441
+ throw new Error(
6442
+ `\`Rule.use.parallel\` requires \`Rule.use.options\` to be an object.
6443
+ However the received value is \`${use.options}\` under option path \`${path13}\`
6444
+ Internally, parallelism is provided by passing \`Rule.use.ident\` to the loader as an identifier to ident the parallelism option
6445
+ You can either replace the \`Rule.use.loader\` with \`Rule.use.options = {}\` or remove \`Rule.use.parallel\`.`
6446
+ );
6447
+ }
6116
6448
  if (use.options && typeof use.options === "object") {
6117
6449
  if (!ident) ident = "[[missing ident]]";
6118
6450
  compiler.__internal__ruleSet.references.set(ident, use.options);
6451
+ compiler.__internal__ruleSet.references.set(
6452
+ `${ident}$$parallelism`,
6453
+ parallelism
6454
+ );
6119
6455
  if (isBuiltin) {
6120
6456
  compiler.__internal__ruleSet.builtinReferences.set(ident, use.options);
6121
6457
  }
@@ -6280,7 +6616,7 @@ function tryMatch(payload, condition) {
6280
6616
  }
6281
6617
  return false;
6282
6618
  }
6283
- var getRawModuleRule = (rule, path12, options, upperType) => {
6619
+ var getRawModuleRule = (rule, path13, options, upperType) => {
6284
6620
  if (rule.loader) {
6285
6621
  rule.use = [
6286
6622
  {
@@ -6298,7 +6634,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6298
6634
  compiler: options.compiler
6299
6635
  };
6300
6636
  const uses = use(context2);
6301
- return createRawModuleRuleUses(uses ?? [], `${path12}.use`, options);
6637
+ return createRawModuleRuleUses(uses ?? [], `${path13}.use`, options);
6302
6638
  };
6303
6639
  }
6304
6640
  const rawModuleRule = {
@@ -6326,7 +6662,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6326
6662
  scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
6327
6663
  mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
6328
6664
  sideEffects: rule.sideEffects,
6329
- use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path12}.use`, options),
6665
+ use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path13}.use`, options),
6330
6666
  type: rule.type,
6331
6667
  layer: rule.layer,
6332
6668
  parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
@@ -6335,7 +6671,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6335
6671
  oneOf: rule.oneOf ? rule.oneOf.filter(Boolean).map(
6336
6672
  (rule2, index) => getRawModuleRule(
6337
6673
  rule2,
6338
- `${path12}.oneOf[${index}]`,
6674
+ `${path13}.oneOf[${index}]`,
6339
6675
  options,
6340
6676
  rule2.type ?? upperType
6341
6677
  )
@@ -6343,7 +6679,7 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6343
6679
  rules: rule.rules ? rule.rules.filter(Boolean).map(
6344
6680
  (rule2, index) => getRawModuleRule(
6345
6681
  rule2,
6346
- `${path12}.rules[${index}]`,
6682
+ `${path13}.rules[${index}]`,
6347
6683
  options,
6348
6684
  rule2.type ?? upperType
6349
6685
  )
@@ -6357,11 +6693,11 @@ var getRawModuleRule = (rule, path12, options, upperType) => {
6357
6693
  delete rawModuleRule.resourceFragment;
6358
6694
  rawModuleRule.rspackResource = getRawRuleSetCondition(
6359
6695
  (resourceQueryFragment) => {
6360
- const { path: path13, query, fragment } = parseResource(resourceQueryFragment);
6361
- if (rule.test && !tryMatch(path13, rule.test)) {
6696
+ const { path: path14, query, fragment } = parseResource(resourceQueryFragment);
6697
+ if (rule.test && !tryMatch(path14, rule.test)) {
6362
6698
  return false;
6363
6699
  }
6364
- if (rule.resource && !tryMatch(path13, rule.resource)) {
6700
+ if (rule.resource && !tryMatch(path14, rule.resource)) {
6365
6701
  return false;
6366
6702
  }
6367
6703
  if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
@@ -6671,7 +7007,7 @@ function getRawStats(stats) {
6671
7007
  // src/config/defaults.ts
6672
7008
  var import_node_assert6 = __toESM(require("assert"));
6673
7009
  var import_node_fs3 = __toESM(require("fs"));
6674
- var import_node_path10 = __toESM(require("path"));
7010
+ var import_node_path11 = __toESM(require("path"));
6675
7011
 
6676
7012
  // src/ModuleTypeConstants.ts
6677
7013
  var JSON_MODULE_TYPE = "json";
@@ -7022,13 +7358,13 @@ var CopyRspackPlugin = create2(
7022
7358
 
7023
7359
  // src/builtin-plugin/css-extract/index.ts
7024
7360
  var import_binding15 = require("@rspack/binding");
7025
- var import_node_path5 = require("path");
7361
+ var import_node_path6 = require("path");
7026
7362
 
7027
7363
  // src/builtin-plugin/css-extract/loader.ts
7028
- var import_node_path4 = __toESM(require("path"));
7364
+ var import_node_path5 = __toESM(require("path"));
7029
7365
 
7030
7366
  // src/builtin-plugin/css-extract/utils.ts
7031
- var import_node_path3 = __toESM(require("path"));
7367
+ var import_node_path4 = __toESM(require("path"));
7032
7368
  var PLUGIN_NAME = "css-extract-rspack-plugin";
7033
7369
 
7034
7370
  // src/builtin-plugin/css-extract/loader.ts
@@ -7038,7 +7374,7 @@ var ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
7038
7374
 
7039
7375
  // src/builtin-plugin/css-extract/index.ts
7040
7376
  var DEFAULT_FILENAME = "[name].css";
7041
- var LOADER_PATH = (0, import_node_path5.join)(__dirname, "cssExtractLoader.js");
7377
+ var LOADER_PATH = (0, import_node_path6.join)(__dirname, "cssExtractLoader.js");
7042
7378
  var CssExtractRspackPlugin = class {
7043
7379
  constructor(options) {
7044
7380
  this.options = options || {};
@@ -7686,18 +8022,14 @@ var HotModuleReplacementPlugin = class extends RspackBuiltinPlugin {
7686
8022
 
7687
8023
  // src/builtin-plugin/html-plugin/plugin.ts
7688
8024
  var import_node_fs = __toESM(require("fs"));
7689
- var import_node_path6 = __toESM(require("path"));
8025
+ var import_node_path7 = __toESM(require("path"));
7690
8026
  var import_binding35 = require("@rspack/binding");
7691
8027
 
7692
8028
  // src/builtin-plugin/html-plugin/hooks.ts
7693
8029
  var liteTapable5 = __toESM(require("@rspack/lite-tapable"));
7694
8030
  var compilationHooksMap2 = /* @__PURE__ */ new WeakMap();
7695
8031
  var getPluginHooks = (compilation) => {
7696
- if (!(compilation instanceof Compilation)) {
7697
- throw new TypeError(
7698
- "The 'compilation' argument must be an instance of Compilation"
7699
- );
7700
- }
8032
+ checkCompilation(compilation);
7701
8033
  let hooks = compilationHooksMap2.get(compilation);
7702
8034
  if (hooks === void 0) {
7703
8035
  hooks = {
@@ -7754,11 +8086,11 @@ function isNonEmptyArray(value) {
7754
8086
  return value.length !== 0;
7755
8087
  }
7756
8088
  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();
8089
+ function joinPath(path13) {
8090
+ if (path13.length === 1) {
8091
+ return path13[0].toString();
7760
8092
  }
7761
- return path12.reduce((acc, item) => {
8093
+ return path13.reduce((acc, item) => {
7762
8094
  if (typeof item === "number") {
7763
8095
  return acc + "[" + item.toString() + "]";
7764
8096
  }
@@ -8108,10 +8440,10 @@ var HtmlRspackPluginImpl = create2(
8108
8440
  templateContent = "";
8109
8441
  } else if (c.template) {
8110
8442
  const filename2 = c.template.split("?")[0];
8111
- if ([".js", ".cjs"].includes(import_node_path6.default.extname(filename2))) {
8443
+ if ([".js", ".cjs"].includes(import_node_path7.default.extname(filename2))) {
8112
8444
  templateFn = async (data) => {
8113
8445
  const context2 = this.options.context || process.cwd();
8114
- const templateFilePath = import_node_path6.default.resolve(context2, filename2);
8446
+ const templateFilePath = import_node_path7.default.resolve(context2, filename2);
8115
8447
  if (!import_node_fs.default.existsSync(templateFilePath)) {
8116
8448
  throw new Error(
8117
8449
  `HtmlRspackPlugin: could not load file \`${filename2}\` from \`${context2}\``
@@ -8248,7 +8580,7 @@ var HttpExternalsRspackPlugin = create2(
8248
8580
  );
8249
8581
 
8250
8582
  // src/builtin-plugin/HttpUriPlugin.ts
8251
- var import_node_path7 = __toESM(require("path"));
8583
+ var import_node_path8 = __toESM(require("path"));
8252
8584
  var import_binding37 = require("@rspack/binding");
8253
8585
  var defaultHttpClient = (url2, headers) => {
8254
8586
  return fetch(url2, { headers }).then((response) => {
@@ -8274,7 +8606,7 @@ var HttpUriPlugin = class extends RspackBuiltinPlugin {
8274
8606
  }
8275
8607
  raw(compiler) {
8276
8608
  const { options } = this;
8277
- const lockfileLocation = options.lockfileLocation ?? import_node_path7.default.join(
8609
+ const lockfileLocation = options.lockfileLocation ?? import_node_path8.default.join(
8278
8610
  compiler.context,
8279
8611
  compiler.name ? `${compiler.name}.rspack.lock` : "rspack.lock"
8280
8612
  );
@@ -8335,11 +8667,7 @@ var JavascriptModulesPlugin = class extends RspackBuiltinPlugin {
8335
8667
  return createBuiltinPlugin(this.name, void 0);
8336
8668
  }
8337
8669
  static getCompilationHooks(compilation) {
8338
- if (!(compilation instanceof Compilation)) {
8339
- throw new TypeError(
8340
- "The 'compilation' argument must be an instance of Compilation"
8341
- );
8342
- }
8670
+ checkCompilation(compilation);
8343
8671
  let hooks = compilationHooksMap3.get(compilation);
8344
8672
  if (hooks === void 0) {
8345
8673
  hooks = {
@@ -8393,11 +8721,11 @@ var lazyCompilationMiddleware = (compiler, userOptions = {}) => {
8393
8721
  const activeModules = /* @__PURE__ */ new Map();
8394
8722
  const filesByKey = /* @__PURE__ */ new Map();
8395
8723
  new BuiltinLazyCompilationPlugin(
8396
- ({ module: module2, path: path12 }) => {
8724
+ ({ module: module2, path: path13 }) => {
8397
8725
  const key = encodeURIComponent(
8398
8726
  module2.replace(/\\/g, "/").replace(/@/g, "_")
8399
8727
  ).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent);
8400
- filesByKey.set(key, path12);
8728
+ filesByKey.set(key, path13);
8401
8729
  const active = activeModules.get(key) === true;
8402
8730
  return {
8403
8731
  client: `${options.client || getDefaultClient(compiler)}?${encodeURIComponent((options.serverUrl ?? "") + LAZY_COMPILATION_PREFIX)}`,
@@ -8725,11 +9053,7 @@ var RuntimePluginImpl = create2(
8725
9053
  var RuntimePlugin = RuntimePluginImpl;
8726
9054
  var compilationHooksMap4 = /* @__PURE__ */ new WeakMap();
8727
9055
  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
- }
9056
+ checkCompilation(compilation);
8733
9057
  let hooks = compilationHooksMap4.get(compilation);
8734
9058
  if (hooks === void 0) {
8735
9059
  hooks = {
@@ -9153,13 +9477,13 @@ var import_binding73 = require("@rspack/binding");
9153
9477
  var LibManifestPlugin = create2(
9154
9478
  import_binding73.BuiltinPluginName.LibManifestPlugin,
9155
9479
  (options) => {
9156
- const { context: context2, entryOnly, format: format3, name: name2, path: path12, type } = options;
9480
+ const { context: context2, entryOnly, format: format3, name: name2, path: path13, type } = options;
9157
9481
  return {
9158
9482
  context: context2,
9159
9483
  entryOnly,
9160
9484
  format: format3,
9161
9485
  name: name2,
9162
- path: path12,
9486
+ path: path13,
9163
9487
  type
9164
9488
  };
9165
9489
  }
@@ -9209,11 +9533,7 @@ var RsdoctorPluginImpl = create2(
9209
9533
  var compilationHooksMap5 = /* @__PURE__ */ new WeakMap();
9210
9534
  var RsdoctorPlugin = RsdoctorPluginImpl;
9211
9535
  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
- }
9536
+ checkCompilation(compilation);
9217
9537
  let hooks = compilationHooksMap5.get(compilation);
9218
9538
  if (hooks === void 0) {
9219
9539
  hooks = {
@@ -9300,7 +9620,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9300
9620
  // src/builtin-plugin/SubresourceIntegrityPlugin.ts
9301
9621
  var import_node_crypto2 = require("crypto");
9302
9622
  var import_node_fs2 = require("fs");
9303
- var import_node_path8 = require("path");
9623
+ var import_node_path9 = require("path");
9304
9624
  var import_binding77 = require("@rspack/binding");
9305
9625
  var import_zod4 = require("../compiled/zod/index.js");
9306
9626
  var PLUGIN_NAME2 = "SubresourceIntegrityPlugin";
@@ -9382,7 +9702,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9382
9702
  for (const asset of assets.js) {
9383
9703
  jsIntegrity.push(
9384
9704
  this.getIntegrityChecksumForAsset(
9385
- (0, import_node_path8.relative)(publicPath2, decodeURIComponent(asset))
9705
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9386
9706
  )
9387
9707
  );
9388
9708
  }
@@ -9390,7 +9710,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9390
9710
  for (const asset of assets.css) {
9391
9711
  cssIntegrity.push(
9392
9712
  this.getIntegrityChecksumForAsset(
9393
- (0, import_node_path8.relative)(publicPath2, decodeURIComponent(asset))
9713
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9394
9714
  )
9395
9715
  );
9396
9716
  }
@@ -9410,10 +9730,10 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9410
9730
  if (!tagSrc) {
9411
9731
  return;
9412
9732
  }
9413
- const src = (0, import_node_path8.relative)(publicPath2, decodeURIComponent(tagSrc));
9733
+ const src = (0, import_node_path9.relative)(publicPath2, decodeURIComponent(tagSrc));
9414
9734
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(
9415
9735
  this.options.hashFuncNames,
9416
- (0, import_node_fs2.readFileSync)((0, import_node_path8.join)(outputPath, src))
9736
+ (0, import_node_fs2.readFileSync)((0, import_node_path9.join)(outputPath, src))
9417
9737
  );
9418
9738
  tag.attributes.crossorigin = crossOriginLoading2 || "anonymous";
9419
9739
  }
@@ -9513,8 +9833,8 @@ function computeIntegrity(hashFuncNames, source) {
9513
9833
  ).join(" ");
9514
9834
  return result2;
9515
9835
  }
9516
- function normalizePath(path12) {
9517
- return path12.replace(/\?.*$/, "").split(import_node_path8.sep).join("/");
9836
+ function normalizePath(path13) {
9837
+ return path13.replace(/\?.*$/, "").split(import_node_path9.sep).join("/");
9518
9838
  }
9519
9839
 
9520
9840
  // src/builtin-plugin/ModuleInfoHeaderPlugin.ts
@@ -9859,13 +10179,13 @@ __export(browserslistTargetHandler_exports, {
9859
10179
  load: () => load,
9860
10180
  resolve: () => resolve
9861
10181
  });
9862
- var import_node_path9 = __toESM(require("path"));
10182
+ var import_node_path10 = __toESM(require("path"));
9863
10183
  var inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
9864
10184
  var parse = (input, context2) => {
9865
10185
  if (!input) {
9866
10186
  return {};
9867
10187
  }
9868
- if (import_node_path9.default.isAbsolute(input)) {
10188
+ if (import_node_path10.default.isAbsolute(input)) {
9869
10189
  const [, configPath, env] = inputRx.exec(input) || [];
9870
10190
  return { configPath, env };
9871
10191
  }
@@ -10552,6 +10872,7 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
10552
10872
  }
10553
10873
  D(experiments3, "rspackFuture", {});
10554
10874
  D(experiments3, "parallelCodeSplitting", true);
10875
+ D(experiments3, "parallelLoader", false);
10555
10876
  };
10556
10877
  var applybundlerInfoDefaults = (rspackFuture, library3) => {
10557
10878
  if (typeof rspackFuture === "object") {
@@ -10814,7 +11135,7 @@ var applyOutputDefaults = (output2, {
10814
11135
  }
10815
11136
  );
10816
11137
  if (libraryName2) return libraryName2;
10817
- const pkgPath = import_node_path10.default.resolve(context2, "package.json");
11138
+ const pkgPath = import_node_path11.default.resolve(context2, "package.json");
10818
11139
  try {
10819
11140
  const packageInfo = JSON.parse(import_node_fs3.default.readFileSync(pkgPath, "utf-8"));
10820
11141
  return packageInfo.name || "";
@@ -10870,7 +11191,7 @@ while determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
10870
11191
  D(output2, "assetModuleFilename", "[hash][ext][query]");
10871
11192
  D(output2, "webassemblyModuleFilename", "[hash].module.wasm");
10872
11193
  D(output2, "compareBeforeEmit", true);
10873
- F(output2, "path", () => import_node_path10.default.join(process.cwd(), "dist"));
11194
+ F(output2, "path", () => import_node_path11.default.join(process.cwd(), "dist"));
10874
11195
  F(output2, "pathinfo", () => development);
10875
11196
  D(
10876
11197
  output2,
@@ -11345,7 +11666,7 @@ var getPnpDefault = () => {
11345
11666
  };
11346
11667
 
11347
11668
  // src/config/normalization.ts
11348
- var import_node_path11 = __toESM(require("path"));
11669
+ var import_node_path12 = __toESM(require("path"));
11349
11670
  var import_node_util5 = __toESM(require("util"));
11350
11671
  var getNormalizedRspackOptions = (config2) => {
11351
11672
  return {
@@ -11535,7 +11856,7 @@ var getNormalizedRspackOptions = (config2) => {
11535
11856
  type: "persistent",
11536
11857
  buildDependencies: nestedArray(
11537
11858
  cache.buildDependencies,
11538
- (deps) => deps.map((d) => import_node_path11.default.resolve(config2.context || process.cwd(), d))
11859
+ (deps) => deps.map((d) => import_node_path12.default.resolve(config2.context || process.cwd(), d))
11539
11860
  ),
11540
11861
  version: cache.version || "",
11541
11862
  snapshot: {
@@ -11547,7 +11868,7 @@ var getNormalizedRspackOptions = (config2) => {
11547
11868
  },
11548
11869
  storage: {
11549
11870
  type: "filesystem",
11550
- directory: import_node_path11.default.resolve(
11871
+ directory: import_node_path12.default.resolve(
11551
11872
  config2.context || process.cwd(),
11552
11873
  ((_a = cache.storage) == null ? void 0 : _a.directory) || "node_modules/.cache/rspack"
11553
11874
  )
@@ -11579,7 +11900,8 @@ var getNormalizedRspackOptions = (config2) => {
11579
11900
  } : options
11580
11901
  ),
11581
11902
  parallelCodeSplitting: experiments3.parallelCodeSplitting,
11582
- buildHttp: experiments3.buildHttp
11903
+ buildHttp: experiments3.buildHttp,
11904
+ parallelLoader: experiments3.parallelLoader
11583
11905
  })),
11584
11906
  watch: config2.watch,
11585
11907
  watchOptions: cloneObject(config2.watchOptions),
@@ -11685,14 +12007,14 @@ var Resolver = class _Resolver {
11685
12007
  constructor(binding14) {
11686
12008
  this.binding = binding14;
11687
12009
  }
11688
- resolveSync(context2, path12, request) {
11689
- const data = this.binding.resolveSync(path12, request);
12010
+ resolveSync(context2, path13, request) {
12011
+ const data = this.binding.resolveSync(path13, request);
11690
12012
  if (data === false) return data;
11691
12013
  return data.resource;
11692
12014
  }
11693
- resolve(context2, path12, request, resolveContext, callback) {
12015
+ resolve(context2, path13, request, resolveContext, callback) {
11694
12016
  try {
11695
- const data = this.binding.resolveSync(path12, request);
12017
+ const data = this.binding.resolveSync(path13, request);
11696
12018
  if (data === false) {
11697
12019
  callback(null, false);
11698
12020
  return;
@@ -12038,7 +12360,7 @@ var Watching = class {
12038
12360
 
12039
12361
  // src/util/bindingVersionCheck.ts
12040
12362
  var import_node_fs4 = require("fs");
12041
- var import_node_path12 = __toESM(require("path"));
12363
+ var import_node_path13 = __toESM(require("path"));
12042
12364
  var NodePlatformArchToAbi = {
12043
12365
  android: {
12044
12366
  arm64: "",
@@ -12110,7 +12432,7 @@ var checkVersion = () => {
12110
12432
  }
12111
12433
  let ADDON_VERSION;
12112
12434
  try {
12113
- const BINDING_PKG_DIR = import_node_path12.default.dirname(
12435
+ const BINDING_PKG_DIR = import_node_path13.default.dirname(
12114
12436
  require.resolve("@rspack/binding/package.json")
12115
12437
  );
12116
12438
  const isLocal = (0, import_node_fs4.readdirSync)(BINDING_PKG_DIR).some(
@@ -13678,7 +14000,7 @@ var Compiler = class _Compiler {
13678
14000
  return finalCallback(null, stats);
13679
14001
  });
13680
14002
  };
13681
- const run = () => {
14003
+ const run2 = () => {
13682
14004
  this.hooks.beforeRun.callAsync(this, (err) => {
13683
14005
  if (err) {
13684
14006
  return finalCallback(err);
@@ -13695,10 +14017,10 @@ var Compiler = class _Compiler {
13695
14017
  this.cache.endIdle((err) => {
13696
14018
  if (err) return callback(err);
13697
14019
  this.idle = false;
13698
- run();
14020
+ run2();
13699
14021
  });
13700
14022
  } else {
13701
- run();
14023
+ run2();
13702
14024
  }
13703
14025
  }
13704
14026
  runAsChild(callback) {
@@ -14550,7 +14872,7 @@ var MultiCompiler = class {
14550
14872
  * @param {Callback<MultiStats>} callback callback when all compilers are done, result includes Stats of all changed compilers
14551
14873
  * @returns {SetupResult[]} result of setup
14552
14874
  */
14553
- #runGraph(setup, run, callback) {
14875
+ #runGraph(setup, run2, callback) {
14554
14876
  const nodes = this.compilers.map((compiler) => ({
14555
14877
  compiler,
14556
14878
  setupResult: void 0,
@@ -14664,7 +14986,7 @@ var MultiCompiler = class {
14664
14986
  if (node3.state === "queued" || node3.state === "blocked" && node3.parents.every((p) => p.state === "done")) {
14665
14987
  running++;
14666
14988
  node3.state = "starting";
14667
- run(
14989
+ run2(
14668
14990
  node3.compiler,
14669
14991
  node3.setupResult,
14670
14992
  nodeDone.bind(null, node3)
@@ -15183,17 +15505,17 @@ var ASSETS_GROUPERS = {
15183
15505
  const extensionMatch = groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
15184
15506
  const extension = extensionMatch ? extensionMatch[1] : "";
15185
15507
  const pathMatch = groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name);
15186
- const path12 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15508
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15187
15509
  const keys = [];
15188
15510
  if (groupAssetsByPath) {
15189
15511
  keys.push(".");
15190
15512
  if (extension)
15191
15513
  keys.push(
15192
- path12.length ? `${path12.join("/")}/*${extension}` : `*${extension}`
15514
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15193
15515
  );
15194
- while (path12.length > 0) {
15195
- keys.push(`${path12.join("/")}/`);
15196
- path12.pop();
15516
+ while (path13.length > 0) {
15517
+ keys.push(`${path13.join("/")}/`);
15518
+ path13.pop();
15197
15519
  }
15198
15520
  } else {
15199
15521
  if (extension) keys.push(`*${extension}`);
@@ -15379,16 +15701,16 @@ var MODULES_GROUPERS = (type) => ({
15379
15701
  const extensionMatch = groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource);
15380
15702
  const extension = extensionMatch ? extensionMatch[1] : "";
15381
15703
  const pathMatch = groupModulesByPath && GROUP_PATH_REGEXP.exec(resource);
15382
- const path12 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15704
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15383
15705
  const keys = [];
15384
15706
  if (groupModulesByPath) {
15385
15707
  if (extension)
15386
15708
  keys.push(
15387
- path12.length ? `${path12.join("/")}/*${extension}` : `*${extension}`
15709
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15388
15710
  );
15389
- while (path12.length > 0) {
15390
- keys.push(`${path12.join("/")}/`);
15391
- path12.pop();
15711
+ while (path13.length > 0) {
15712
+ keys.push(`${path13.join("/")}/`);
15713
+ path13.pop();
15392
15714
  }
15393
15715
  } else {
15394
15716
  if (extension) keys.push(`*${extension}`);
@@ -18967,7 +19289,7 @@ var NodeTemplatePlugin = class {
18967
19289
  };
18968
19290
 
18969
19291
  // src/config/zod.ts
18970
- var import_node_path13 = __toESM(require("path"));
19292
+ var import_node_path14 = __toESM(require("path"));
18971
19293
  var import_zod8 = require("../compiled/zod/index.js");
18972
19294
 
18973
19295
  // src/config/utils.ts
@@ -19125,7 +19447,7 @@ var filename = filenameTemplate.or(
19125
19447
  var name = import_zod8.z.string();
19126
19448
  var dependencies = import_zod8.z.array(name);
19127
19449
  var context = import_zod8.z.string().refine(
19128
- (val) => import_node_path13.default.isAbsolute(val),
19450
+ (val) => import_node_path14.default.isAbsolute(val),
19129
19451
  (val) => ({
19130
19452
  message: `The provided value ${JSON.stringify(val)} must be an absolute path.`
19131
19453
  })
@@ -19224,7 +19546,7 @@ var entryDynamic = import_zod8.z.function().returns(
19224
19546
  entryStatic.or(import_zod8.z.promise(entryStatic))
19225
19547
  );
19226
19548
  var entry = entryStatic.or(entryDynamic);
19227
- var path11 = import_zod8.z.string();
19549
+ var path12 = import_zod8.z.string();
19228
19550
  var pathinfo = import_zod8.z.boolean().or(import_zod8.z.literal("verbose"));
19229
19551
  var assetModuleFilename = filename;
19230
19552
  var webassemblyModuleFilename = import_zod8.z.string();
@@ -19298,7 +19620,7 @@ var environment = import_zod8.z.strictObject({
19298
19620
  templateLiteral: import_zod8.z.boolean().optional()
19299
19621
  });
19300
19622
  var output = import_zod8.z.strictObject({
19301
- path: path11.optional(),
19623
+ path: path12.optional(),
19302
19624
  pathinfo: pathinfo.optional(),
19303
19625
  clean: clean.optional(),
19304
19626
  publicPath: publicPath.optional(),
@@ -19403,7 +19725,8 @@ var ruleSetLoaderOptions = import_zod8.z.string().or(import_zod8.z.record(import
19403
19725
  var ruleSetLoaderWithOptions = import_zod8.z.strictObject({
19404
19726
  ident: import_zod8.z.string().optional(),
19405
19727
  loader: ruleSetLoader,
19406
- options: ruleSetLoaderOptions.optional()
19728
+ options: ruleSetLoaderOptions.optional(),
19729
+ parallel: import_zod8.z.boolean().optional()
19407
19730
  });
19408
19731
  var ruleSetUseItem = ruleSetLoader.or(
19409
19732
  ruleSetLoaderWithOptions
@@ -20089,7 +20412,8 @@ var experiments = import_zod8.z.strictObject({
20089
20412
  parallelCodeSplitting: import_zod8.z.boolean().optional(),
20090
20413
  futureDefaults: import_zod8.z.boolean().optional(),
20091
20414
  rspackFuture: rspackFutureOptions.optional(),
20092
- buildHttp: buildHttpOptions.optional()
20415
+ buildHttp: buildHttpOptions.optional(),
20416
+ parallelLoader: import_zod8.z.boolean().optional()
20093
20417
  });
20094
20418
  var watch = import_zod8.z.boolean();
20095
20419
  var watchOptions = import_zod8.z.strictObject({