@rspack/core 1.3.0-beta.1 → 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.
Files changed (80) hide show
  1. package/dist/Compilation.d.ts +1 -0
  2. package/dist/NormalModule.d.ts +1 -1
  3. package/dist/Watching.d.ts +4 -1
  4. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  5. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  6. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  7. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  8. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  9. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  10. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  11. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  13. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
  33. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  55. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/RuntimePlugin.d.ts +2 -2
  57. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/base.d.ts +1 -1
  64. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  65. package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
  66. package/dist/builtin-plugin/index.d.ts +1 -0
  67. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  68. package/dist/config/adapterRuleUse.d.ts +1 -2
  69. package/dist/config/normalization.d.ts +3 -0
  70. package/dist/config/types.d.ts +17 -1
  71. package/dist/config/zod.d.ts +448 -360
  72. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  73. package/dist/index.js +851 -439
  74. package/dist/loader-runner/index.d.ts +5 -3
  75. package/dist/loader-runner/service.d.ts +66 -0
  76. package/dist/loader-runner/utils.d.ts +5 -0
  77. package/dist/loader-runner/worker.d.ts +14 -0
  78. package/dist/util/index.d.ts +1 -1
  79. package/dist/worker.js +1853 -0
  80. package/package.json +4 -3
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 = (path11) => {
152
- let idx = path11.length - 1;
151
+ var dirname4 = (path13) => {
152
+ let idx = path13.length - 1;
153
153
  while (idx >= 0) {
154
- const c = path11.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 path11.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
- (path11, 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 path11 !== "string" && !Buffer.isBuffer(path11) && !(path11 instanceof URL) && typeof path11 !== "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
- path11,
213
+ path13,
214
214
  options,
215
215
  callback
216
216
  )
217
217
  );
218
218
  }
219
- let callbacks = this._activeAsyncOperations.get(path11);
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(path11, callbacks = [callback]);
224
+ this._activeAsyncOperations.set(path13, callbacks = [callback]);
225
225
  provider(
226
- path11,
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(path11);
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
- (path11, options) => {
244
+ (path13, options) => {
245
245
  return (
246
246
  /** @type {Function} */
247
247
  this._syncProvider.call(
248
248
  this._providerContext,
249
- path11,
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(path11, 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 path11 !== "string" && !Buffer.isBuffer(path11) && !(path11 instanceof URL) && typeof path11 !== "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 path11 !== "string" ? path11.toString() : path11;
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
- path11,
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
- path11,
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(path11, options) {
356
- if (typeof path11 !== "string" && !Buffer.isBuffer(path11) && !(path11 instanceof URL) && typeof path11 !== "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 path11 !== "string" ? path11.toString() : path11;
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
- path11,
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
- path11
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(path11, err, result2) {
475
- if (this._data.has(path11)) 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(path11, { err, result: result2, level });
478
- level.add(path11);
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
- ((path11, callback) => {
614
- this.readFile(path11, (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
- ((path11) => {
636
- const buffer = this.readFileSync(path11);
635
+ ((path13) => {
636
+ const buffer = this.readFileSync(path13);
637
637
  const data = JSON.parse(buffer.toString("utf-8"));
638
638
  return data;
639
639
  }),
@@ -689,28 +689,28 @@ var require_CachedInputFileSystem = __commonJS({
689
689
  // src/index.ts
690
690
  var index_exports = {};
691
691
  __export(index_exports, {
692
- AsyncDependenciesBlock: () => import_binding89.AsyncDependenciesBlock,
692
+ AsyncDependenciesBlock: () => import_binding90.AsyncDependenciesBlock,
693
693
  BannerPlugin: () => BannerPlugin,
694
694
  CircularDependencyRspackPlugin: () => CircularDependencyRspackPlugin,
695
695
  Compilation: () => Compilation,
696
696
  Compiler: () => Compiler,
697
- ConcatenatedModule: () => import_binding80.ConcatenatedModule,
698
- ContextModule: () => import_binding79.ContextModule,
697
+ ConcatenatedModule: () => import_binding81.ConcatenatedModule,
698
+ ContextModule: () => import_binding80.ContextModule,
699
699
  ContextReplacementPlugin: () => ContextReplacementPlugin,
700
700
  CopyRspackPlugin: () => CopyRspackPlugin,
701
701
  CssExtractRspackPlugin: () => CssExtractRspackPlugin,
702
702
  DefinePlugin: () => DefinePlugin,
703
- Dependency: () => import_binding89.Dependency,
703
+ Dependency: () => import_binding90.Dependency,
704
704
  DllPlugin: () => DllPlugin,
705
705
  DllReferencePlugin: () => DllReferencePlugin,
706
706
  DynamicEntryPlugin: () => DynamicEntryPlugin,
707
- EntryDependency: () => import_binding89.EntryDependency,
707
+ EntryDependency: () => import_binding90.EntryDependency,
708
708
  EntryOptionPlugin: () => EntryOptionPlugin_default,
709
709
  EntryPlugin: () => EntryPlugin,
710
710
  EnvironmentPlugin: () => EnvironmentPlugin,
711
711
  EvalDevToolModulePlugin: () => EvalDevToolModulePlugin,
712
712
  EvalSourceMapDevToolPlugin: () => EvalSourceMapDevToolPlugin,
713
- ExternalModule: () => import_binding81.ExternalModule,
713
+ ExternalModule: () => import_binding82.ExternalModule,
714
714
  ExternalsPlugin: () => ExternalsPlugin,
715
715
  HotModuleReplacementPlugin: () => HotModuleReplacementPlugin,
716
716
  HtmlRspackPlugin: () => HtmlRspackPlugin,
@@ -762,28 +762,28 @@ module.exports = __toCommonJS(index_exports);
762
762
  // src/exports.ts
763
763
  var exports_exports = {};
764
764
  __export(exports_exports, {
765
- AsyncDependenciesBlock: () => import_binding89.AsyncDependenciesBlock,
765
+ AsyncDependenciesBlock: () => import_binding90.AsyncDependenciesBlock,
766
766
  BannerPlugin: () => BannerPlugin,
767
767
  CircularDependencyRspackPlugin: () => CircularDependencyRspackPlugin,
768
768
  Compilation: () => Compilation,
769
769
  Compiler: () => Compiler,
770
- ConcatenatedModule: () => import_binding80.ConcatenatedModule,
771
- ContextModule: () => import_binding79.ContextModule,
770
+ ConcatenatedModule: () => import_binding81.ConcatenatedModule,
771
+ ContextModule: () => import_binding80.ContextModule,
772
772
  ContextReplacementPlugin: () => ContextReplacementPlugin,
773
773
  CopyRspackPlugin: () => CopyRspackPlugin,
774
774
  CssExtractRspackPlugin: () => CssExtractRspackPlugin,
775
775
  DefinePlugin: () => DefinePlugin,
776
- Dependency: () => import_binding89.Dependency,
776
+ Dependency: () => import_binding90.Dependency,
777
777
  DllPlugin: () => DllPlugin,
778
778
  DllReferencePlugin: () => DllReferencePlugin,
779
779
  DynamicEntryPlugin: () => DynamicEntryPlugin,
780
- EntryDependency: () => import_binding89.EntryDependency,
780
+ EntryDependency: () => import_binding90.EntryDependency,
781
781
  EntryOptionPlugin: () => EntryOptionPlugin_default,
782
782
  EntryPlugin: () => EntryPlugin,
783
783
  EnvironmentPlugin: () => EnvironmentPlugin,
784
784
  EvalDevToolModulePlugin: () => EvalDevToolModulePlugin,
785
785
  EvalSourceMapDevToolPlugin: () => EvalSourceMapDevToolPlugin,
786
- ExternalModule: () => import_binding81.ExternalModule,
786
+ ExternalModule: () => import_binding82.ExternalModule,
787
787
  ExternalsPlugin: () => ExternalsPlugin,
788
788
  HotModuleReplacementPlugin: () => HotModuleReplacementPlugin,
789
789
  HtmlRspackPlugin: () => HtmlRspackPlugin,
@@ -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: path11,
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 = path11;
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(path11) {
5503
- if (path11 === "/") return "/";
5504
- const i = path11.lastIndexOf("/");
5505
- const j = path11.lastIndexOf("\\");
5506
- const i2 = path11.indexOf("/");
5507
- const j2 = path11.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 path11;
5511
- if (idx === idx2) return path11.slice(0, idx + 1);
5512
- return path11.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, path11, 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, path11, 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, path11, options) {
6405
+ function createRawModuleRuleUsesImpl(uses, path13, options) {
6083
6406
  if (!uses.length) {
6084
6407
  return [];
6085
6408
  }
@@ -6094,7 +6417,7 @@ function createRawModuleRuleUsesImpl(uses, path11, options) {
6094
6417
  return {
6095
6418
  loader: resolveStringifyLoaders(
6096
6419
  use,
6097
- `${path11}[${index}]`,
6420
+ `${path13}[${index}]`,
6098
6421
  options.compiler,
6099
6422
  isBuiltin
6100
6423
  ),
@@ -6102,20 +6425,33 @@ function createRawModuleRuleUsesImpl(uses, path11, options) {
6102
6425
  };
6103
6426
  });
6104
6427
  }
6105
- function resolveStringifyLoaders(use, path11, 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 = path11}`;
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
  }
@@ -6198,10 +6534,13 @@ function getRawExtensionAlias(alias = {}) {
6198
6534
  return Object.fromEntries(entries);
6199
6535
  }
6200
6536
  function getRawAlias(alias = {}) {
6201
- return Object.entries(alias).map(([key, value]) => ({
6202
- path: key,
6203
- redirect: Array.isArray(value) ? value : [value]
6204
- }));
6537
+ if (typeof alias === "object" && alias !== null && !Array.isArray(alias)) {
6538
+ return Object.entries(alias).map(([key, value]) => ({
6539
+ path: key,
6540
+ redirect: Array.isArray(value) ? value : [value]
6541
+ }));
6542
+ }
6543
+ return false;
6205
6544
  }
6206
6545
  function getRawResolveByDependency(byDependency) {
6207
6546
  if (byDependency === void 0) return byDependency;
@@ -6277,7 +6616,7 @@ function tryMatch(payload, condition) {
6277
6616
  }
6278
6617
  return false;
6279
6618
  }
6280
- var getRawModuleRule = (rule, path11, options, upperType) => {
6619
+ var getRawModuleRule = (rule, path13, options, upperType) => {
6281
6620
  if (rule.loader) {
6282
6621
  rule.use = [
6283
6622
  {
@@ -6295,7 +6634,7 @@ var getRawModuleRule = (rule, path11, options, upperType) => {
6295
6634
  compiler: options.compiler
6296
6635
  };
6297
6636
  const uses = use(context2);
6298
- return createRawModuleRuleUses(uses ?? [], `${path11}.use`, options);
6637
+ return createRawModuleRuleUses(uses ?? [], `${path13}.use`, options);
6299
6638
  };
6300
6639
  }
6301
6640
  const rawModuleRule = {
@@ -6323,7 +6662,7 @@ var getRawModuleRule = (rule, path11, options, upperType) => {
6323
6662
  scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
6324
6663
  mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
6325
6664
  sideEffects: rule.sideEffects,
6326
- use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path11}.use`, options),
6665
+ use: typeof rule.use === "function" ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path13}.use`, options),
6327
6666
  type: rule.type,
6328
6667
  layer: rule.layer,
6329
6668
  parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
@@ -6332,7 +6671,7 @@ var getRawModuleRule = (rule, path11, options, upperType) => {
6332
6671
  oneOf: rule.oneOf ? rule.oneOf.filter(Boolean).map(
6333
6672
  (rule2, index) => getRawModuleRule(
6334
6673
  rule2,
6335
- `${path11}.oneOf[${index}]`,
6674
+ `${path13}.oneOf[${index}]`,
6336
6675
  options,
6337
6676
  rule2.type ?? upperType
6338
6677
  )
@@ -6340,7 +6679,7 @@ var getRawModuleRule = (rule, path11, options, upperType) => {
6340
6679
  rules: rule.rules ? rule.rules.filter(Boolean).map(
6341
6680
  (rule2, index) => getRawModuleRule(
6342
6681
  rule2,
6343
- `${path11}.rules[${index}]`,
6682
+ `${path13}.rules[${index}]`,
6344
6683
  options,
6345
6684
  rule2.type ?? upperType
6346
6685
  )
@@ -6354,11 +6693,11 @@ var getRawModuleRule = (rule, path11, options, upperType) => {
6354
6693
  delete rawModuleRule.resourceFragment;
6355
6694
  rawModuleRule.rspackResource = getRawRuleSetCondition(
6356
6695
  (resourceQueryFragment) => {
6357
- const { path: path12, query, fragment } = parseResource(resourceQueryFragment);
6358
- if (rule.test && !tryMatch(path12, rule.test)) {
6696
+ const { path: path14, query, fragment } = parseResource(resourceQueryFragment);
6697
+ if (rule.test && !tryMatch(path14, rule.test)) {
6359
6698
  return false;
6360
6699
  }
6361
- if (rule.resource && !tryMatch(path12, rule.resource)) {
6700
+ if (rule.resource && !tryMatch(path14, rule.resource)) {
6362
6701
  return false;
6363
6702
  }
6364
6703
  if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
@@ -6480,7 +6819,7 @@ function getRawParserOptions(parser, type) {
6480
6819
  json: getRawJsonParserOptions(parser)
6481
6820
  };
6482
6821
  }
6483
- throw new Error(`unreachable: unknow module type: ${type}`);
6822
+ throw new Error(`unreachable: unknown module type: ${type}`);
6484
6823
  }
6485
6824
  function getRawJavascriptParserOptions(parser) {
6486
6825
  var _a, _b, _c;
@@ -6668,7 +7007,7 @@ function getRawStats(stats) {
6668
7007
  // src/config/defaults.ts
6669
7008
  var import_node_assert6 = __toESM(require("assert"));
6670
7009
  var import_node_fs3 = __toESM(require("fs"));
6671
- var import_node_path9 = __toESM(require("path"));
7010
+ var import_node_path11 = __toESM(require("path"));
6672
7011
 
6673
7012
  // src/ModuleTypeConstants.ts
6674
7013
  var JSON_MODULE_TYPE = "json";
@@ -7019,13 +7358,13 @@ var CopyRspackPlugin = create2(
7019
7358
 
7020
7359
  // src/builtin-plugin/css-extract/index.ts
7021
7360
  var import_binding15 = require("@rspack/binding");
7022
- var import_node_path5 = require("path");
7361
+ var import_node_path6 = require("path");
7023
7362
 
7024
7363
  // src/builtin-plugin/css-extract/loader.ts
7025
- var import_node_path4 = __toESM(require("path"));
7364
+ var import_node_path5 = __toESM(require("path"));
7026
7365
 
7027
7366
  // src/builtin-plugin/css-extract/utils.ts
7028
- var import_node_path3 = __toESM(require("path"));
7367
+ var import_node_path4 = __toESM(require("path"));
7029
7368
  var PLUGIN_NAME = "css-extract-rspack-plugin";
7030
7369
 
7031
7370
  // src/builtin-plugin/css-extract/loader.ts
@@ -7035,7 +7374,7 @@ var ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
7035
7374
 
7036
7375
  // src/builtin-plugin/css-extract/index.ts
7037
7376
  var DEFAULT_FILENAME = "[name].css";
7038
- var LOADER_PATH = (0, import_node_path5.join)(__dirname, "cssExtractLoader.js");
7377
+ var LOADER_PATH = (0, import_node_path6.join)(__dirname, "cssExtractLoader.js");
7039
7378
  var CssExtractRspackPlugin = class {
7040
7379
  constructor(options) {
7041
7380
  this.options = options || {};
@@ -7534,38 +7873,36 @@ function getRawExternalItem(compiler, item) {
7534
7873
  issuer: data.contextInfo.issuer,
7535
7874
  issuerLayer: data.contextInfo.issuerLayer ?? null
7536
7875
  },
7537
- getResolve: function getResolve(options) {
7876
+ getResolve: (options) => (context2, request, callback) => {
7538
7877
  const resolver = new Resolver(ctx.getResolver());
7878
+ const child = options ? resolver.withOptions(options) : resolver;
7539
7879
  const getResolveContext = () => ({
7540
7880
  fileDependencies: compiler._lastCompilation.fileDependencies,
7541
7881
  missingDependencies: compiler._lastCompilation.missingDependencies,
7542
7882
  contextDependencies: compiler._lastCompilation.contextDependencies
7543
7883
  });
7544
- const child = options ? resolver.withOptions(options) : resolver;
7545
- return (context2, request, callback) => {
7546
- if (callback) {
7884
+ if (callback) {
7885
+ child.resolve(
7886
+ {},
7887
+ context2,
7888
+ request,
7889
+ getResolveContext(),
7890
+ callback
7891
+ );
7892
+ } else {
7893
+ return new Promise((resolve3, reject2) => {
7547
7894
  child.resolve(
7548
7895
  {},
7549
7896
  context2,
7550
7897
  request,
7551
7898
  getResolveContext(),
7552
- callback
7899
+ (err, result2) => {
7900
+ if (err) reject2(err);
7901
+ else resolve3(result2);
7902
+ }
7553
7903
  );
7554
- } else {
7555
- return new Promise((resolve3, reject2) => {
7556
- child.resolve(
7557
- {},
7558
- context2,
7559
- request,
7560
- getResolveContext(),
7561
- (err, result2) => {
7562
- if (err) reject2(err);
7563
- else resolve3(result2);
7564
- }
7565
- );
7566
- });
7567
- }
7568
- };
7904
+ });
7905
+ }
7569
7906
  }
7570
7907
  },
7571
7908
  (err, result2, type) => {
@@ -7685,18 +8022,14 @@ var HotModuleReplacementPlugin = class extends RspackBuiltinPlugin {
7685
8022
 
7686
8023
  // src/builtin-plugin/html-plugin/plugin.ts
7687
8024
  var import_node_fs = __toESM(require("fs"));
7688
- var import_node_path6 = __toESM(require("path"));
8025
+ var import_node_path7 = __toESM(require("path"));
7689
8026
  var import_binding35 = require("@rspack/binding");
7690
8027
 
7691
8028
  // src/builtin-plugin/html-plugin/hooks.ts
7692
8029
  var liteTapable5 = __toESM(require("@rspack/lite-tapable"));
7693
8030
  var compilationHooksMap2 = /* @__PURE__ */ new WeakMap();
7694
8031
  var getPluginHooks = (compilation) => {
7695
- if (!(compilation instanceof Compilation)) {
7696
- throw new TypeError(
7697
- "The 'compilation' argument must be an instance of Compilation"
7698
- );
7699
- }
8032
+ checkCompilation(compilation);
7700
8033
  let hooks = compilationHooksMap2.get(compilation);
7701
8034
  if (hooks === void 0) {
7702
8035
  hooks = {
@@ -7753,11 +8086,11 @@ function isNonEmptyArray(value) {
7753
8086
  return value.length !== 0;
7754
8087
  }
7755
8088
  var identifierRegex = /[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;
7756
- function joinPath(path11) {
7757
- if (path11.length === 1) {
7758
- return path11[0].toString();
8089
+ function joinPath(path13) {
8090
+ if (path13.length === 1) {
8091
+ return path13[0].toString();
7759
8092
  }
7760
- return path11.reduce((acc, item) => {
8093
+ return path13.reduce((acc, item) => {
7761
8094
  if (typeof item === "number") {
7762
8095
  return acc + "[" + item.toString() + "]";
7763
8096
  }
@@ -8107,10 +8440,10 @@ var HtmlRspackPluginImpl = create2(
8107
8440
  templateContent = "";
8108
8441
  } else if (c.template) {
8109
8442
  const filename2 = c.template.split("?")[0];
8110
- if ([".js", ".cjs"].includes(import_node_path6.default.extname(filename2))) {
8443
+ if ([".js", ".cjs"].includes(import_node_path7.default.extname(filename2))) {
8111
8444
  templateFn = async (data) => {
8112
8445
  const context2 = this.options.context || process.cwd();
8113
- const templateFilePath = import_node_path6.default.resolve(context2, filename2);
8446
+ const templateFilePath = import_node_path7.default.resolve(context2, filename2);
8114
8447
  if (!import_node_fs.default.existsSync(templateFilePath)) {
8115
8448
  throw new Error(
8116
8449
  `HtmlRspackPlugin: could not load file \`${filename2}\` from \`${context2}\``
@@ -8246,8 +8579,53 @@ var HttpExternalsRspackPlugin = create2(
8246
8579
  }
8247
8580
  );
8248
8581
 
8249
- // src/builtin-plugin/IgnorePlugin.ts
8582
+ // src/builtin-plugin/HttpUriPlugin.ts
8583
+ var import_node_path8 = __toESM(require("path"));
8250
8584
  var import_binding37 = require("@rspack/binding");
8585
+ var defaultHttpClient = (url2, headers) => {
8586
+ return fetch(url2, { headers }).then((response) => {
8587
+ return response.arrayBuffer().then((buffer) => {
8588
+ const responseHeaders = {};
8589
+ response.headers.forEach((value, key) => {
8590
+ responseHeaders[key] = value;
8591
+ });
8592
+ return {
8593
+ status: response.status,
8594
+ headers: responseHeaders,
8595
+ body: Buffer.from(buffer)
8596
+ };
8597
+ });
8598
+ });
8599
+ };
8600
+ var HttpUriPlugin = class extends RspackBuiltinPlugin {
8601
+ constructor(options) {
8602
+ super();
8603
+ this.options = options;
8604
+ this.name = import_binding37.BuiltinPluginName.HttpUriPlugin;
8605
+ this.affectedHooks = "compilation";
8606
+ }
8607
+ raw(compiler) {
8608
+ const { options } = this;
8609
+ const lockfileLocation = options.lockfileLocation ?? import_node_path8.default.join(
8610
+ compiler.context,
8611
+ compiler.name ? `${compiler.name}.rspack.lock` : "rspack.lock"
8612
+ );
8613
+ const cacheLocation = options.cacheLocation === false ? void 0 : options.cacheLocation ?? `${lockfileLocation}.data`;
8614
+ const raw = {
8615
+ allowedUris: options.allowedUris,
8616
+ lockfileLocation,
8617
+ cacheLocation,
8618
+ upgrade: options.upgrade ?? false,
8619
+ // frozen: options.frozen,
8620
+ // proxy: options.proxy,
8621
+ httpClient: options.httpClient ?? defaultHttpClient
8622
+ };
8623
+ return createBuiltinPlugin(this.name, raw);
8624
+ }
8625
+ };
8626
+
8627
+ // src/builtin-plugin/IgnorePlugin.ts
8628
+ var import_binding38 = require("@rspack/binding");
8251
8629
  var import_zod2 = require("../compiled/zod/index.js");
8252
8630
  var IgnorePluginOptions = import_zod2.z.union([
8253
8631
  import_zod2.z.object({
@@ -8259,7 +8637,7 @@ var IgnorePluginOptions = import_zod2.z.union([
8259
8637
  })
8260
8638
  ]);
8261
8639
  var IgnorePlugin = create2(
8262
- import_binding37.BuiltinPluginName.IgnorePlugin,
8640
+ import_binding38.BuiltinPluginName.IgnorePlugin,
8263
8641
  (options) => {
8264
8642
  validate(options, IgnorePluginOptions);
8265
8643
  return options;
@@ -8267,33 +8645,29 @@ var IgnorePlugin = create2(
8267
8645
  );
8268
8646
 
8269
8647
  // src/builtin-plugin/InferAsyncModulesPlugin.ts
8270
- var import_binding38 = require("@rspack/binding");
8648
+ var import_binding39 = require("@rspack/binding");
8271
8649
  var InferAsyncModulesPlugin = create2(
8272
- import_binding38.BuiltinPluginName.InferAsyncModulesPlugin,
8650
+ import_binding39.BuiltinPluginName.InferAsyncModulesPlugin,
8273
8651
  () => {
8274
8652
  },
8275
8653
  "compilation"
8276
8654
  );
8277
8655
 
8278
8656
  // src/builtin-plugin/JavascriptModulesPlugin.ts
8279
- var import_binding39 = require("@rspack/binding");
8657
+ var import_binding40 = require("@rspack/binding");
8280
8658
  var liteTapable6 = __toESM(require("@rspack/lite-tapable"));
8281
8659
  var compilationHooksMap3 = /* @__PURE__ */ new WeakMap();
8282
8660
  var JavascriptModulesPlugin = class extends RspackBuiltinPlugin {
8283
8661
  constructor() {
8284
8662
  super(...arguments);
8285
- this.name = import_binding39.BuiltinPluginName.JavascriptModulesPlugin;
8663
+ this.name = import_binding40.BuiltinPluginName.JavascriptModulesPlugin;
8286
8664
  this.affectedHooks = "compilation";
8287
8665
  }
8288
8666
  raw() {
8289
8667
  return createBuiltinPlugin(this.name, void 0);
8290
8668
  }
8291
8669
  static getCompilationHooks(compilation) {
8292
- if (!(compilation instanceof Compilation)) {
8293
- throw new TypeError(
8294
- "The 'compilation' argument must be an instance of Compilation"
8295
- );
8296
- }
8670
+ checkCompilation(compilation);
8297
8671
  let hooks = compilationHooksMap3.get(compilation);
8298
8672
  if (hooks === void 0) {
8299
8673
  hooks = {
@@ -8306,27 +8680,27 @@ var JavascriptModulesPlugin = class extends RspackBuiltinPlugin {
8306
8680
  };
8307
8681
 
8308
8682
  // src/builtin-plugin/JsLoaderRspackPlugin.ts
8309
- var import_binding40 = require("@rspack/binding");
8683
+ var import_binding41 = require("@rspack/binding");
8310
8684
  var JsLoaderRspackPlugin = create2(
8311
- import_binding40.BuiltinPluginName.JsLoaderRspackPlugin,
8685
+ import_binding41.BuiltinPluginName.JsLoaderRspackPlugin,
8312
8686
  (compiler) => runLoaders.bind(null, compiler),
8313
8687
  /* Not Inheretable */
8314
8688
  "thisCompilation"
8315
8689
  );
8316
8690
 
8317
8691
  // src/builtin-plugin/JsonModulesPlugin.ts
8318
- var import_binding41 = require("@rspack/binding");
8692
+ var import_binding42 = require("@rspack/binding");
8319
8693
  var JsonModulesPlugin = create2(
8320
- import_binding41.BuiltinPluginName.JsonModulesPlugin,
8694
+ import_binding42.BuiltinPluginName.JsonModulesPlugin,
8321
8695
  () => {
8322
8696
  },
8323
8697
  "compilation"
8324
8698
  );
8325
8699
 
8326
8700
  // src/builtin-plugin/lazy-compilation/lazyCompilation.ts
8327
- var import_binding42 = require("@rspack/binding");
8701
+ var import_binding43 = require("@rspack/binding");
8328
8702
  var BuiltinLazyCompilationPlugin = create2(
8329
- import_binding42.BuiltinPluginName.LazyCompilationPlugin,
8703
+ import_binding43.BuiltinPluginName.LazyCompilationPlugin,
8330
8704
  (module2, cacheable, entries, imports, test) => ({ module: module2, cacheable, imports, entries, test }),
8331
8705
  "thisCompilation"
8332
8706
  );
@@ -8347,11 +8721,11 @@ var lazyCompilationMiddleware = (compiler, userOptions = {}) => {
8347
8721
  const activeModules = /* @__PURE__ */ new Map();
8348
8722
  const filesByKey = /* @__PURE__ */ new Map();
8349
8723
  new BuiltinLazyCompilationPlugin(
8350
- ({ module: module2, path: path11 }) => {
8724
+ ({ module: module2, path: path13 }) => {
8351
8725
  const key = encodeURIComponent(
8352
8726
  module2.replace(/\\/g, "/").replace(/@/g, "_")
8353
8727
  ).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent);
8354
- filesByKey.set(key, path11);
8728
+ filesByKey.set(key, path13);
8355
8729
  const active = activeModules.get(key) === true;
8356
8730
  return {
8357
8731
  client: `${options.client || getDefaultClient(compiler)}?${encodeURIComponent((options.serverUrl ?? "") + LAZY_COMPILATION_PREFIX)}`,
@@ -8402,28 +8776,30 @@ var lazyCompilationMiddlewareInternal = (compiler, activeModules, filesByKey) =>
8402
8776
  }).filter(Boolean)
8403
8777
  );
8404
8778
  if (rebuiltModules.size) {
8405
- compiler.watching.invalidateWithChangedFiles(new Set(rebuiltModules));
8779
+ compiler.watching.invalidateWithChangesAndRemovals(
8780
+ new Set(rebuiltModules)
8781
+ );
8406
8782
  }
8407
8783
  }
8408
8784
  };
8409
8785
  };
8410
8786
 
8411
8787
  // src/builtin-plugin/LimitChunkCountPlugin.ts
8412
- var import_binding43 = require("@rspack/binding");
8788
+ var import_binding44 = require("@rspack/binding");
8413
8789
  var LimitChunkCountPlugin = create2(
8414
- import_binding43.BuiltinPluginName.LimitChunkCountPlugin,
8790
+ import_binding44.BuiltinPluginName.LimitChunkCountPlugin,
8415
8791
  (options) => {
8416
8792
  return options;
8417
8793
  }
8418
8794
  );
8419
8795
 
8420
8796
  // src/builtin-plugin/MangleExportsPlugin.ts
8421
- var import_binding44 = require("@rspack/binding");
8797
+ var import_binding45 = require("@rspack/binding");
8422
8798
  var MangleExportsPlugin = class extends RspackBuiltinPlugin {
8423
8799
  constructor(deterministic) {
8424
8800
  super();
8425
8801
  this.deterministic = deterministic;
8426
- this.name = import_binding44.BuiltinPluginName.MangleExportsPlugin;
8802
+ this.name = import_binding45.BuiltinPluginName.MangleExportsPlugin;
8427
8803
  this.affectedHooks = "compilation";
8428
8804
  }
8429
8805
  raw(compiler) {
@@ -8454,27 +8830,27 @@ var MangleExportsPlugin = class extends RspackBuiltinPlugin {
8454
8830
  };
8455
8831
 
8456
8832
  // src/builtin-plugin/MergeDuplicateChunksPlugin.ts
8457
- var import_binding45 = require("@rspack/binding");
8833
+ var import_binding46 = require("@rspack/binding");
8458
8834
  var MergeDuplicateChunksPlugin = create2(
8459
- import_binding45.BuiltinPluginName.MergeDuplicateChunksPlugin,
8835
+ import_binding46.BuiltinPluginName.MergeDuplicateChunksPlugin,
8460
8836
  () => {
8461
8837
  }
8462
8838
  );
8463
8839
 
8464
8840
  // src/builtin-plugin/ModuleChunkFormatPlugin.ts
8465
- var import_binding46 = require("@rspack/binding");
8841
+ var import_binding47 = require("@rspack/binding");
8466
8842
  var ModuleChunkFormatPlugin = create2(
8467
- import_binding46.BuiltinPluginName.ModuleChunkFormatPlugin,
8843
+ import_binding47.BuiltinPluginName.ModuleChunkFormatPlugin,
8468
8844
  () => {
8469
8845
  }
8470
8846
  );
8471
8847
 
8472
8848
  // src/builtin-plugin/ModuleConcatenationPlugin.ts
8473
- var import_binding47 = require("@rspack/binding");
8849
+ var import_binding48 = require("@rspack/binding");
8474
8850
  var ModuleConcatenationPlugin = class extends RspackBuiltinPlugin {
8475
8851
  constructor() {
8476
8852
  super(...arguments);
8477
- this.name = import_binding47.BuiltinPluginName.ModuleConcatenationPlugin;
8853
+ this.name = import_binding48.BuiltinPluginName.ModuleConcatenationPlugin;
8478
8854
  this.affectedHooks = "compilation";
8479
8855
  }
8480
8856
  raw(compiler) {
@@ -8529,29 +8905,29 @@ var ModuleConcatenationPlugin = class extends RspackBuiltinPlugin {
8529
8905
  };
8530
8906
 
8531
8907
  // src/builtin-plugin/NamedChunkIdsPlugin.ts
8532
- var import_binding48 = require("@rspack/binding");
8908
+ var import_binding49 = require("@rspack/binding");
8533
8909
  var NamedChunkIdsPlugin = create2(
8534
- import_binding48.BuiltinPluginName.NamedChunkIdsPlugin,
8910
+ import_binding49.BuiltinPluginName.NamedChunkIdsPlugin,
8535
8911
  () => {
8536
8912
  },
8537
8913
  "compilation"
8538
8914
  );
8539
8915
 
8540
8916
  // src/builtin-plugin/NamedModuleIdsPlugin.ts
8541
- var import_binding49 = require("@rspack/binding");
8917
+ var import_binding50 = require("@rspack/binding");
8542
8918
  var NamedModuleIdsPlugin = create2(
8543
- import_binding49.BuiltinPluginName.NamedModuleIdsPlugin,
8919
+ import_binding50.BuiltinPluginName.NamedModuleIdsPlugin,
8544
8920
  () => {
8545
8921
  },
8546
8922
  "compilation"
8547
8923
  );
8548
8924
 
8549
8925
  // src/builtin-plugin/NaturalChunkIdsPlugin.ts
8550
- var import_binding50 = require("@rspack/binding");
8926
+ var import_binding51 = require("@rspack/binding");
8551
8927
  var NaturalChunkIdsPlugin = class extends RspackBuiltinPlugin {
8552
8928
  constructor() {
8553
8929
  super(...arguments);
8554
- this.name = import_binding50.BuiltinPluginName.NaturalChunkIdsPlugin;
8930
+ this.name = import_binding51.BuiltinPluginName.NaturalChunkIdsPlugin;
8555
8931
  this.affectedHooks = "compilation";
8556
8932
  }
8557
8933
  raw(compiler) {
@@ -8570,11 +8946,11 @@ var NaturalChunkIdsPlugin = class extends RspackBuiltinPlugin {
8570
8946
  };
8571
8947
 
8572
8948
  // src/builtin-plugin/NaturalModuleIdsPlugin.ts
8573
- var import_binding51 = require("@rspack/binding");
8949
+ var import_binding52 = require("@rspack/binding");
8574
8950
  var NaturalModuleIdsPlugin = class extends RspackBuiltinPlugin {
8575
8951
  constructor() {
8576
8952
  super(...arguments);
8577
- this.name = import_binding51.BuiltinPluginName.NaturalModuleIdsPlugin;
8953
+ this.name = import_binding52.BuiltinPluginName.NaturalModuleIdsPlugin;
8578
8954
  this.affectedHooks = "compilation";
8579
8955
  }
8580
8956
  raw(compiler) {
@@ -8593,24 +8969,24 @@ var NaturalModuleIdsPlugin = class extends RspackBuiltinPlugin {
8593
8969
  };
8594
8970
 
8595
8971
  // src/builtin-plugin/NodeTargetPlugin.ts
8596
- var import_binding52 = require("@rspack/binding");
8972
+ var import_binding53 = require("@rspack/binding");
8597
8973
  var NodeTargetPlugin = create2(
8598
- import_binding52.BuiltinPluginName.NodeTargetPlugin,
8974
+ import_binding53.BuiltinPluginName.NodeTargetPlugin,
8599
8975
  () => void 0
8600
8976
  );
8601
8977
 
8602
8978
  // src/builtin-plugin/OccurrenceChunkIdsPlugin.ts
8603
- var import_binding53 = require("@rspack/binding");
8979
+ var import_binding54 = require("@rspack/binding");
8604
8980
  var OccurrenceChunkIdsPlugin = create2(
8605
- import_binding53.BuiltinPluginName.OccurrenceChunkIdsPlugin,
8981
+ import_binding54.BuiltinPluginName.OccurrenceChunkIdsPlugin,
8606
8982
  (options) => ({ ...options }),
8607
8983
  "compilation"
8608
8984
  );
8609
8985
 
8610
8986
  // src/builtin-plugin/ProgressPlugin.ts
8611
- var import_binding54 = require("@rspack/binding");
8987
+ var import_binding55 = require("@rspack/binding");
8612
8988
  var ProgressPlugin = create2(
8613
- import_binding54.BuiltinPluginName.ProgressPlugin,
8989
+ import_binding55.BuiltinPluginName.ProgressPlugin,
8614
8990
  (progress = {}) => {
8615
8991
  if (typeof progress === "function") {
8616
8992
  return {
@@ -8624,9 +9000,9 @@ var ProgressPlugin = create2(
8624
9000
  );
8625
9001
 
8626
9002
  // src/builtin-plugin/ProvidePlugin.ts
8627
- var import_binding55 = require("@rspack/binding");
9003
+ var import_binding56 = require("@rspack/binding");
8628
9004
  var ProvidePlugin = create2(
8629
- import_binding55.BuiltinPluginName.ProvidePlugin,
9005
+ import_binding56.BuiltinPluginName.ProvidePlugin,
8630
9006
  (provide) => {
8631
9007
  const entries = Object.entries(provide).map(([key, value]) => {
8632
9008
  if (typeof value === "string") {
@@ -8640,27 +9016,27 @@ var ProvidePlugin = create2(
8640
9016
  );
8641
9017
 
8642
9018
  // src/builtin-plugin/RealContentHashPlugin.ts
8643
- var import_binding56 = require("@rspack/binding");
9019
+ var import_binding57 = require("@rspack/binding");
8644
9020
  var RealContentHashPlugin = create2(
8645
- import_binding56.BuiltinPluginName.RealContentHashPlugin,
9021
+ import_binding57.BuiltinPluginName.RealContentHashPlugin,
8646
9022
  () => {
8647
9023
  },
8648
9024
  "compilation"
8649
9025
  );
8650
9026
 
8651
9027
  // src/builtin-plugin/RemoveEmptyChunksPlugin.ts
8652
- var import_binding57 = require("@rspack/binding");
9028
+ var import_binding58 = require("@rspack/binding");
8653
9029
  var RemoveEmptyChunksPlugin = create2(
8654
- import_binding57.BuiltinPluginName.RemoveEmptyChunksPlugin,
9030
+ import_binding58.BuiltinPluginName.RemoveEmptyChunksPlugin,
8655
9031
  () => {
8656
9032
  },
8657
9033
  "compilation"
8658
9034
  );
8659
9035
 
8660
9036
  // src/builtin-plugin/RuntimeChunkPlugin.ts
8661
- var import_binding58 = require("@rspack/binding");
9037
+ var import_binding59 = require("@rspack/binding");
8662
9038
  var RuntimeChunkPlugin = create2(
8663
- import_binding58.BuiltinPluginName.RuntimeChunkPlugin,
9039
+ import_binding59.BuiltinPluginName.RuntimeChunkPlugin,
8664
9040
  (options) => options,
8665
9041
  "thisCompilation"
8666
9042
  );
@@ -8677,11 +9053,7 @@ var RuntimePluginImpl = create2(
8677
9053
  var RuntimePlugin = RuntimePluginImpl;
8678
9054
  var compilationHooksMap4 = /* @__PURE__ */ new WeakMap();
8679
9055
  RuntimePlugin.getHooks = RuntimePlugin.getCompilationHooks = (compilation) => {
8680
- if (!(compilation instanceof Compilation)) {
8681
- throw new TypeError(
8682
- "The 'compilation' argument must be an instance of Compilation"
8683
- );
8684
- }
9056
+ checkCompilation(compilation);
8685
9057
  let hooks = compilationHooksMap4.get(compilation);
8686
9058
  if (hooks === void 0) {
8687
9059
  hooks = {
@@ -8738,18 +9110,18 @@ var createRuntimePluginHooksRegisters = (getCompiler, createTap, createMapTap) =
8738
9110
  };
8739
9111
 
8740
9112
  // src/builtin-plugin/SideEffectsFlagPlugin.ts
8741
- var import_binding59 = require("@rspack/binding");
9113
+ var import_binding60 = require("@rspack/binding");
8742
9114
  var SideEffectsFlagPlugin = create2(
8743
- import_binding59.BuiltinPluginName.SideEffectsFlagPlugin,
9115
+ import_binding60.BuiltinPluginName.SideEffectsFlagPlugin,
8744
9116
  () => {
8745
9117
  },
8746
9118
  "compilation"
8747
9119
  );
8748
9120
 
8749
9121
  // src/builtin-plugin/SizeLimitsPlugin.ts
8750
- var import_binding60 = require("@rspack/binding");
9122
+ var import_binding61 = require("@rspack/binding");
8751
9123
  var SizeLimitsPlugin = create2(
8752
- import_binding60.BuiltinPluginName.SizeLimitsPlugin,
9124
+ import_binding61.BuiltinPluginName.SizeLimitsPlugin,
8753
9125
  (options) => {
8754
9126
  const hints = options.hints === false ? void 0 : options.hints;
8755
9127
  return { ...options, hints };
@@ -8757,16 +9129,16 @@ var SizeLimitsPlugin = create2(
8757
9129
  );
8758
9130
 
8759
9131
  // src/builtin-plugin/SourceMapDevToolPlugin.ts
8760
- var import_binding61 = require("@rspack/binding");
9132
+ var import_binding62 = require("@rspack/binding");
8761
9133
  var SourceMapDevToolPlugin = create2(
8762
- import_binding61.BuiltinPluginName.SourceMapDevToolPlugin,
9134
+ import_binding62.BuiltinPluginName.SourceMapDevToolPlugin,
8763
9135
  (options) => options,
8764
9136
  "compilation"
8765
9137
  );
8766
9138
 
8767
9139
  // src/builtin-plugin/SplitChunksPlugin.ts
8768
9140
  var import_node_assert5 = __toESM(require("assert"));
8769
- var import_binding62 = require("@rspack/binding");
9141
+ var import_binding63 = require("@rspack/binding");
8770
9142
 
8771
9143
  // src/util/SplitChunkSize.ts
8772
9144
  var JsSplitChunkSizes = class {
@@ -8789,7 +9161,7 @@ var SplitChunksPlugin = class extends RspackBuiltinPlugin {
8789
9161
  constructor(options) {
8790
9162
  super();
8791
9163
  this.options = options;
8792
- this.name = import_binding62.BuiltinPluginName.SplitChunksPlugin;
9164
+ this.name = import_binding63.BuiltinPluginName.SplitChunksPlugin;
8793
9165
  this.affectedHooks = "thisCompilation";
8794
9166
  }
8795
9167
  raw(compiler) {
@@ -8889,9 +9261,9 @@ function toRawSplitChunksOptions(sc, compiler) {
8889
9261
  }
8890
9262
 
8891
9263
  // src/builtin-plugin/LightningCssMinimizerRspackPlugin.ts
8892
- var import_binding63 = require("@rspack/binding");
9264
+ var import_binding64 = require("@rspack/binding");
8893
9265
  var LightningCssMinimizerRspackPlugin = create2(
8894
- import_binding63.BuiltinPluginName.LightningCssMinimizerRspackPlugin,
9266
+ import_binding64.BuiltinPluginName.LightningCssMinimizerRspackPlugin,
8895
9267
  (options) => {
8896
9268
  var _a, _b, _c;
8897
9269
  const { include, exclude, draft, nonStandard, pseudoClasses, drafts } = (options == null ? void 0 : options.minimizerOptions) ?? {};
@@ -8919,16 +9291,16 @@ var LightningCssMinimizerRspackPlugin = create2(
8919
9291
  );
8920
9292
 
8921
9293
  // src/builtin-plugin/RemoveDuplicateModulesPlugin.ts
8922
- var import_binding64 = require("@rspack/binding");
9294
+ var import_binding65 = require("@rspack/binding");
8923
9295
  var RemoveDuplicateModulesPlugin = create2(
8924
- import_binding64.BuiltinPluginName.RemoveDuplicateModulesPlugin,
9296
+ import_binding65.BuiltinPluginName.RemoveDuplicateModulesPlugin,
8925
9297
  () => {
8926
9298
  return {};
8927
9299
  }
8928
9300
  );
8929
9301
 
8930
9302
  // src/builtin-plugin/SwcJsMinimizerPlugin.ts
8931
- var import_binding65 = require("@rspack/binding");
9303
+ var import_binding66 = require("@rspack/binding");
8932
9304
  function isObject2(value) {
8933
9305
  const type = typeof value;
8934
9306
  return value != null && (type === "object" || type === "function");
@@ -8971,7 +9343,7 @@ function getRawExtractCommentsOptions(extractComments) {
8971
9343
  return void 0;
8972
9344
  }
8973
9345
  var SwcJsMinimizerRspackPlugin = create2(
8974
- import_binding65.BuiltinPluginName.SwcJsMinimizerRspackPlugin,
9346
+ import_binding66.BuiltinPluginName.SwcJsMinimizerRspackPlugin,
8975
9347
  (options) => {
8976
9348
  var _a, _b, _c, _d, _e;
8977
9349
  let compress = ((_a = options == null ? void 0 : options.minimizerOptions) == null ? void 0 : _a.compress) ?? true;
@@ -9009,20 +9381,20 @@ var SwcJsMinimizerRspackPlugin = create2(
9009
9381
  );
9010
9382
 
9011
9383
  // src/builtin-plugin/WarnCaseSensitiveModulesPlugin.ts
9012
- var import_binding66 = require("@rspack/binding");
9384
+ var import_binding67 = require("@rspack/binding");
9013
9385
  var WarnCaseSensitiveModulesPlugin = create2(
9014
- import_binding66.BuiltinPluginName.WarnCaseSensitiveModulesPlugin,
9386
+ import_binding67.BuiltinPluginName.WarnCaseSensitiveModulesPlugin,
9015
9387
  () => {
9016
9388
  },
9017
9389
  "compilation"
9018
9390
  );
9019
9391
 
9020
9392
  // src/builtin-plugin/WebWorkerTemplatePlugin.ts
9021
- var import_binding67 = require("@rspack/binding");
9393
+ var import_binding68 = require("@rspack/binding");
9022
9394
  var WebWorkerTemplatePlugin = class extends RspackBuiltinPlugin {
9023
9395
  constructor() {
9024
9396
  super(...arguments);
9025
- this.name = import_binding67.BuiltinPluginName.WebWorkerTemplatePlugin;
9397
+ this.name = import_binding68.BuiltinPluginName.WebWorkerTemplatePlugin;
9026
9398
  }
9027
9399
  raw(compiler) {
9028
9400
  compiler.options.output.chunkLoading = "import-scripts";
@@ -9031,7 +9403,7 @@ var WebWorkerTemplatePlugin = class extends RspackBuiltinPlugin {
9031
9403
  };
9032
9404
 
9033
9405
  // src/builtin-plugin/WorkerPlugin.ts
9034
- var import_binding68 = require("@rspack/binding");
9406
+ var import_binding69 = require("@rspack/binding");
9035
9407
  var WorkerPlugin = class extends RspackBuiltinPlugin {
9036
9408
  constructor(chunkLoading2, wasmLoading2, module2, workerPublicPath2) {
9037
9409
  super();
@@ -9039,7 +9411,7 @@ var WorkerPlugin = class extends RspackBuiltinPlugin {
9039
9411
  this.wasmLoading = wasmLoading2;
9040
9412
  this.module = module2;
9041
9413
  this.workerPublicPath = workerPublicPath2;
9042
- this.name = import_binding68.BuiltinPluginName.WorkerPlugin;
9414
+ this.name = import_binding69.BuiltinPluginName.WorkerPlugin;
9043
9415
  }
9044
9416
  raw(compiler) {
9045
9417
  if (this.chunkLoading) {
@@ -9053,25 +9425,25 @@ var WorkerPlugin = class extends RspackBuiltinPlugin {
9053
9425
  };
9054
9426
 
9055
9427
  // src/builtin-plugin/FetchCompileAsyncWasmPlugin.ts
9056
- var import_binding69 = require("@rspack/binding");
9428
+ var import_binding70 = require("@rspack/binding");
9057
9429
  var FetchCompileAsyncWasmPlugin = create2(
9058
- import_binding69.BuiltinPluginName.FetchCompileAsyncWasmPlugin,
9430
+ import_binding70.BuiltinPluginName.FetchCompileAsyncWasmPlugin,
9059
9431
  () => {
9060
9432
  },
9061
9433
  "thisCompilation"
9062
9434
  );
9063
9435
 
9064
9436
  // src/builtin-plugin/NoEmitOnErrorsPlugin.ts
9065
- var import_binding70 = require("@rspack/binding");
9437
+ var import_binding71 = require("@rspack/binding");
9066
9438
  var NoEmitOnErrorsPlugin = create2(
9067
- import_binding70.BuiltinPluginName.NoEmitOnErrorsPlugin,
9439
+ import_binding71.BuiltinPluginName.NoEmitOnErrorsPlugin,
9068
9440
  () => void 0
9069
9441
  );
9070
9442
 
9071
9443
  // src/builtin-plugin/ContextReplacementPlugin.ts
9072
- var import_binding71 = require("@rspack/binding");
9444
+ var import_binding72 = require("@rspack/binding");
9073
9445
  var ContextReplacementPlugin = create2(
9074
- import_binding71.BuiltinPluginName.ContextReplacementPlugin,
9446
+ import_binding72.BuiltinPluginName.ContextReplacementPlugin,
9075
9447
  (resourceRegExp, newContentResource, newContentRecursive, newContentRegExp) => {
9076
9448
  const rawOptions = {
9077
9449
  resourceRegExp
@@ -9101,26 +9473,26 @@ var ContextReplacementPlugin = create2(
9101
9473
  );
9102
9474
 
9103
9475
  // src/builtin-plugin/LibManifestPlugin.ts
9104
- var import_binding72 = require("@rspack/binding");
9476
+ var import_binding73 = require("@rspack/binding");
9105
9477
  var LibManifestPlugin = create2(
9106
- import_binding72.BuiltinPluginName.LibManifestPlugin,
9478
+ import_binding73.BuiltinPluginName.LibManifestPlugin,
9107
9479
  (options) => {
9108
- const { context: context2, entryOnly, format: format3, name: name2, path: path11, type } = options;
9480
+ const { context: context2, entryOnly, format: format3, name: name2, path: path13, type } = options;
9109
9481
  return {
9110
9482
  context: context2,
9111
9483
  entryOnly,
9112
9484
  format: format3,
9113
9485
  name: name2,
9114
- path: path11,
9486
+ path: path13,
9115
9487
  type
9116
9488
  };
9117
9489
  }
9118
9490
  );
9119
9491
 
9120
9492
  // src/builtin-plugin/DllEntryPlugin.ts
9121
- var import_binding73 = require("@rspack/binding");
9493
+ var import_binding74 = require("@rspack/binding");
9122
9494
  var DllEntryPlugin = create2(
9123
- import_binding73.BuiltinPluginName.DllEntryPlugin,
9495
+ import_binding74.BuiltinPluginName.DllEntryPlugin,
9124
9496
  (context2, entries, options) => {
9125
9497
  return {
9126
9498
  context: context2,
@@ -9131,14 +9503,14 @@ var DllEntryPlugin = create2(
9131
9503
  );
9132
9504
 
9133
9505
  // src/builtin-plugin/DllReferenceAgencyPlugin.ts
9134
- var import_binding74 = require("@rspack/binding");
9506
+ var import_binding75 = require("@rspack/binding");
9135
9507
  var DllReferenceAgencyPlugin = create2(
9136
- import_binding74.BuiltinPluginName.DllReferenceAgencyPlugin,
9508
+ import_binding75.BuiltinPluginName.DllReferenceAgencyPlugin,
9137
9509
  (options) => options
9138
9510
  );
9139
9511
 
9140
9512
  // src/builtin-plugin/RsdoctorPlugin.ts
9141
- var import_binding75 = require("@rspack/binding");
9513
+ var import_binding76 = require("@rspack/binding");
9142
9514
  var liteTapable8 = __toESM(require("@rspack/lite-tapable"));
9143
9515
  var import_zod3 = require("../compiled/zod/index.js");
9144
9516
  var rsdoctorPluginSchema = import_zod3.z.strictObject({
@@ -9146,7 +9518,7 @@ var rsdoctorPluginSchema = import_zod3.z.strictObject({
9146
9518
  chunkGraphFeatures: import_zod3.z.union([import_zod3.z.boolean(), import_zod3.z.array(import_zod3.z.enum(["graph", "assets"]))]).optional()
9147
9519
  });
9148
9520
  var RsdoctorPluginImpl = create2(
9149
- import_binding75.BuiltinPluginName.RsdoctorPlugin,
9521
+ import_binding76.BuiltinPluginName.RsdoctorPlugin,
9150
9522
  function(c = {
9151
9523
  moduleGraphFeatures: true,
9152
9524
  chunkGraphFeatures: true
@@ -9161,11 +9533,7 @@ var RsdoctorPluginImpl = create2(
9161
9533
  var compilationHooksMap5 = /* @__PURE__ */ new WeakMap();
9162
9534
  var RsdoctorPlugin = RsdoctorPluginImpl;
9163
9535
  RsdoctorPlugin.getHooks = RsdoctorPlugin.getCompilationHooks = (compilation) => {
9164
- if (!(compilation instanceof Compilation)) {
9165
- throw new TypeError(
9166
- "The 'compilation' argument must be an instance of Compilation"
9167
- );
9168
- }
9536
+ checkCompilation(compilation);
9169
9537
  let hooks = compilationHooksMap5.get(compilation);
9170
9538
  if (hooks === void 0) {
9171
9539
  hooks = {
@@ -9182,7 +9550,7 @@ RsdoctorPlugin.getHooks = RsdoctorPlugin.getCompilationHooks = (compilation) =>
9182
9550
  var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap) => {
9183
9551
  return {
9184
9552
  registerRsdoctorPluginModuleGraphTaps: createTap(
9185
- import_binding75.RegisterJsTapKind.RsdoctorPluginModuleGraph,
9553
+ import_binding76.RegisterJsTapKind.RsdoctorPluginModuleGraph,
9186
9554
  function() {
9187
9555
  return RsdoctorPlugin.getCompilationHooks(
9188
9556
  getCompiler().__internal__get_compilation()
@@ -9195,7 +9563,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9195
9563
  }
9196
9564
  ),
9197
9565
  registerRsdoctorPluginChunkGraphTaps: createTap(
9198
- import_binding75.RegisterJsTapKind.RsdoctorPluginChunkGraph,
9566
+ import_binding76.RegisterJsTapKind.RsdoctorPluginChunkGraph,
9199
9567
  function() {
9200
9568
  return RsdoctorPlugin.getCompilationHooks(
9201
9569
  getCompiler().__internal__get_compilation()
@@ -9208,7 +9576,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9208
9576
  }
9209
9577
  ),
9210
9578
  registerRsdoctorPluginModuleIdsTaps: createTap(
9211
- import_binding75.RegisterJsTapKind.RsdoctorPluginModuleIds,
9579
+ import_binding76.RegisterJsTapKind.RsdoctorPluginModuleIds,
9212
9580
  function() {
9213
9581
  return RsdoctorPlugin.getCompilationHooks(
9214
9582
  getCompiler().__internal__get_compilation()
@@ -9221,7 +9589,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9221
9589
  }
9222
9590
  ),
9223
9591
  registerRsdoctorPluginModuleSourcesTaps: createTap(
9224
- import_binding75.RegisterJsTapKind.RsdoctorPluginModuleSources,
9592
+ import_binding76.RegisterJsTapKind.RsdoctorPluginModuleSources,
9225
9593
  function() {
9226
9594
  return RsdoctorPlugin.getCompilationHooks(
9227
9595
  getCompiler().__internal__get_compilation()
@@ -9234,7 +9602,7 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9234
9602
  }
9235
9603
  ),
9236
9604
  registerRsdoctorPluginAssetsTaps: createTap(
9237
- import_binding75.RegisterJsTapKind.RsdoctorPluginAssets,
9605
+ import_binding76.RegisterJsTapKind.RsdoctorPluginAssets,
9238
9606
  function() {
9239
9607
  return RsdoctorPlugin.getCompilationHooks(
9240
9608
  getCompiler().__internal__get_compilation()
@@ -9252,8 +9620,8 @@ var createRsdoctorPluginHooksRegisters = (getCompiler, createTap, createMapTap)
9252
9620
  // src/builtin-plugin/SubresourceIntegrityPlugin.ts
9253
9621
  var import_node_crypto2 = require("crypto");
9254
9622
  var import_node_fs2 = require("fs");
9255
- var import_node_path7 = require("path");
9256
- var import_binding76 = require("@rspack/binding");
9623
+ var import_node_path9 = require("path");
9624
+ var import_binding77 = require("@rspack/binding");
9257
9625
  var import_zod4 = require("../compiled/zod/index.js");
9258
9626
  var PLUGIN_NAME2 = "SubresourceIntegrityPlugin";
9259
9627
  var NATIVE_HTML_PLUGIN = "HtmlRspackPlugin";
@@ -9264,7 +9632,7 @@ var pluginOptionsSchema2 = import_zod4.z.object({
9264
9632
  enabled: import_zod4.z.literal("auto").or(import_zod4.z.boolean()).optional()
9265
9633
  });
9266
9634
  var NativeSubresourceIntegrityPlugin = create2(
9267
- import_binding76.BuiltinPluginName.SubresourceIntegrityPlugin,
9635
+ import_binding77.BuiltinPluginName.SubresourceIntegrityPlugin,
9268
9636
  function(options) {
9269
9637
  let htmlPlugin = "Disabled";
9270
9638
  if (options.htmlPlugin === NATIVE_HTML_PLUGIN) {
@@ -9334,7 +9702,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9334
9702
  for (const asset of assets.js) {
9335
9703
  jsIntegrity.push(
9336
9704
  this.getIntegrityChecksumForAsset(
9337
- (0, import_node_path7.relative)(publicPath2, decodeURIComponent(asset))
9705
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9338
9706
  )
9339
9707
  );
9340
9708
  }
@@ -9342,7 +9710,7 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9342
9710
  for (const asset of assets.css) {
9343
9711
  cssIntegrity.push(
9344
9712
  this.getIntegrityChecksumForAsset(
9345
- (0, import_node_path7.relative)(publicPath2, decodeURIComponent(asset))
9713
+ (0, import_node_path9.relative)(publicPath2, decodeURIComponent(asset))
9346
9714
  )
9347
9715
  );
9348
9716
  }
@@ -9362,10 +9730,10 @@ var SubresourceIntegrityPlugin = class extends NativeSubresourceIntegrityPlugin
9362
9730
  if (!tagSrc) {
9363
9731
  return;
9364
9732
  }
9365
- const src = (0, import_node_path7.relative)(publicPath2, decodeURIComponent(tagSrc));
9733
+ const src = (0, import_node_path9.relative)(publicPath2, decodeURIComponent(tagSrc));
9366
9734
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(
9367
9735
  this.options.hashFuncNames,
9368
- (0, import_node_fs2.readFileSync)((0, import_node_path7.join)(outputPath, src))
9736
+ (0, import_node_fs2.readFileSync)((0, import_node_path9.join)(outputPath, src))
9369
9737
  );
9370
9738
  tag.attributes.crossorigin = crossOriginLoading2 || "anonymous";
9371
9739
  }
@@ -9465,14 +9833,14 @@ function computeIntegrity(hashFuncNames, source) {
9465
9833
  ).join(" ");
9466
9834
  return result2;
9467
9835
  }
9468
- function normalizePath(path11) {
9469
- return path11.replace(/\?.*$/, "").split(import_node_path7.sep).join("/");
9836
+ function normalizePath(path13) {
9837
+ return path13.replace(/\?.*$/, "").split(import_node_path9.sep).join("/");
9470
9838
  }
9471
9839
 
9472
9840
  // src/builtin-plugin/ModuleInfoHeaderPlugin.ts
9473
- var import_binding77 = require("@rspack/binding");
9841
+ var import_binding78 = require("@rspack/binding");
9474
9842
  var ModuleInfoHeaderPlugin = create2(
9475
- import_binding77.BuiltinPluginName.ModuleInfoHeaderPlugin,
9843
+ import_binding78.BuiltinPluginName.ModuleInfoHeaderPlugin,
9476
9844
  (verbose) => verbose,
9477
9845
  "compilation"
9478
9846
  );
@@ -9811,13 +10179,13 @@ __export(browserslistTargetHandler_exports, {
9811
10179
  load: () => load,
9812
10180
  resolve: () => resolve
9813
10181
  });
9814
- var import_node_path8 = __toESM(require("path"));
10182
+ var import_node_path10 = __toESM(require("path"));
9815
10183
  var inputRx = /^(?:((?:[A-Z]:)?[/\\].*?))?(?::(.+?))?$/i;
9816
10184
  var parse = (input, context2) => {
9817
10185
  if (!input) {
9818
10186
  return {};
9819
10187
  }
9820
- if (import_node_path8.default.isAbsolute(input)) {
10188
+ if (import_node_path10.default.isAbsolute(input)) {
9821
10189
  const [, configPath, env] = inputRx.exec(input) || [];
9822
10190
  return { configPath, env };
9823
10191
  }
@@ -10416,7 +10784,8 @@ var applyRspackOptionsDefaults = (options) => {
10416
10784
  options.output.library
10417
10785
  );
10418
10786
  applyExternalsPresetsDefaults(options.externalsPresets, {
10419
- targetProperties
10787
+ targetProperties,
10788
+ buildHttp: Boolean(options.experiments.buildHttp)
10420
10789
  });
10421
10790
  F(options, "externalsType", () => {
10422
10791
  return options.output.library ? (
@@ -10479,6 +10848,10 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
10479
10848
  D(experiments3, "css", experiments3.futureDefaults ? true : void 0);
10480
10849
  D(experiments3, "layers", false);
10481
10850
  D(experiments3, "topLevelAwait", true);
10851
+ D(experiments3, "buildHttp", void 0);
10852
+ if (experiments3.buildHttp && typeof experiments3.buildHttp === "object") {
10853
+ D(experiments3.buildHttp, "upgrade", false);
10854
+ }
10482
10855
  D(experiments3, "incremental", !production ? {} : false);
10483
10856
  if (typeof experiments3.incremental === "object") {
10484
10857
  D(experiments3.incremental, "make", true);
@@ -10498,7 +10871,8 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
10498
10871
  D(experiments3.incremental, "emitAssets", true);
10499
10872
  }
10500
10873
  D(experiments3, "rspackFuture", {});
10501
- D(experiments3, "parallelCodeSplitting", false);
10874
+ D(experiments3, "parallelCodeSplitting", true);
10875
+ D(experiments3, "parallelLoader", false);
10502
10876
  };
10503
10877
  var applybundlerInfoDefaults = (rspackFuture, library3) => {
10504
10878
  if (typeof rspackFuture === "object") {
@@ -10761,7 +11135,7 @@ var applyOutputDefaults = (output2, {
10761
11135
  }
10762
11136
  );
10763
11137
  if (libraryName2) return libraryName2;
10764
- const pkgPath = import_node_path9.default.resolve(context2, "package.json");
11138
+ const pkgPath = import_node_path11.default.resolve(context2, "package.json");
10765
11139
  try {
10766
11140
  const packageInfo = JSON.parse(import_node_fs3.default.readFileSync(pkgPath, "utf-8"));
10767
11141
  return packageInfo.name || "";
@@ -10817,7 +11191,7 @@ while determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
10817
11191
  D(output2, "assetModuleFilename", "[hash][ext][query]");
10818
11192
  D(output2, "webassemblyModuleFilename", "[hash].module.wasm");
10819
11193
  D(output2, "compareBeforeEmit", true);
10820
- F(output2, "path", () => import_node_path9.default.join(process.cwd(), "dist"));
11194
+ F(output2, "path", () => import_node_path11.default.join(process.cwd(), "dist"));
10821
11195
  F(output2, "pathinfo", () => development);
10822
11196
  D(
10823
11197
  output2,
@@ -11020,8 +11394,8 @@ ${helpMessage}`
11020
11394
  );
11021
11395
  F(environment2, "document", () => tp && optimistic(tp.document));
11022
11396
  };
11023
- var applyExternalsPresetsDefaults = (externalsPresets2, { targetProperties }) => {
11024
- D(externalsPresets2, "web", targetProperties == null ? void 0 : targetProperties.web);
11397
+ var applyExternalsPresetsDefaults = (externalsPresets2, { targetProperties, buildHttp }) => {
11398
+ D(externalsPresets2, "web", !buildHttp && (targetProperties == null ? void 0 : targetProperties.web));
11025
11399
  D(externalsPresets2, "node", targetProperties == null ? void 0 : targetProperties.node);
11026
11400
  D(externalsPresets2, "electron", targetProperties == null ? void 0 : targetProperties.electron);
11027
11401
  D(
@@ -11088,7 +11462,7 @@ var applyOptimizationDefaults = (optimization2, {
11088
11462
  development,
11089
11463
  css
11090
11464
  }) => {
11091
- D(optimization2, "removeAvailableModules", false);
11465
+ D(optimization2, "removeAvailableModules", true);
11092
11466
  D(optimization2, "removeEmptyChunks", true);
11093
11467
  D(optimization2, "mergeDuplicateChunks", true);
11094
11468
  F(optimization2, "moduleIds", () => {
@@ -11292,7 +11666,7 @@ var getPnpDefault = () => {
11292
11666
  };
11293
11667
 
11294
11668
  // src/config/normalization.ts
11295
- var import_node_path10 = __toESM(require("path"));
11669
+ var import_node_path12 = __toESM(require("path"));
11296
11670
  var import_node_util5 = __toESM(require("util"));
11297
11671
  var getNormalizedRspackOptions = (config2) => {
11298
11672
  return {
@@ -11482,7 +11856,7 @@ var getNormalizedRspackOptions = (config2) => {
11482
11856
  type: "persistent",
11483
11857
  buildDependencies: nestedArray(
11484
11858
  cache.buildDependencies,
11485
- (deps) => deps.map((d) => import_node_path10.default.resolve(config2.context || process.cwd(), d))
11859
+ (deps) => deps.map((d) => import_node_path12.default.resolve(config2.context || process.cwd(), d))
11486
11860
  ),
11487
11861
  version: cache.version || "",
11488
11862
  snapshot: {
@@ -11494,7 +11868,7 @@ var getNormalizedRspackOptions = (config2) => {
11494
11868
  },
11495
11869
  storage: {
11496
11870
  type: "filesystem",
11497
- directory: import_node_path10.default.resolve(
11871
+ directory: import_node_path12.default.resolve(
11498
11872
  config2.context || process.cwd(),
11499
11873
  ((_a = cache.storage) == null ? void 0 : _a.directory) || "node_modules/.cache/rspack"
11500
11874
  )
@@ -11525,7 +11899,9 @@ var getNormalizedRspackOptions = (config2) => {
11525
11899
  emitAssets: true
11526
11900
  } : options
11527
11901
  ),
11528
- parallelCodeSplitting: experiments3.parallelCodeSplitting
11902
+ parallelCodeSplitting: experiments3.parallelCodeSplitting,
11903
+ buildHttp: experiments3.buildHttp,
11904
+ parallelLoader: experiments3.parallelLoader
11529
11905
  })),
11530
11906
  watch: config2.watch,
11531
11907
  watchOptions: cloneObject(config2.watchOptions),
@@ -11631,14 +12007,14 @@ var Resolver = class _Resolver {
11631
12007
  constructor(binding14) {
11632
12008
  this.binding = binding14;
11633
12009
  }
11634
- resolveSync(context2, path11, request) {
11635
- const data = this.binding.resolveSync(path11, request);
12010
+ resolveSync(context2, path13, request) {
12011
+ const data = this.binding.resolveSync(path13, request);
11636
12012
  if (data === false) return data;
11637
12013
  return data.resource;
11638
12014
  }
11639
- resolve(context2, path11, request, resolveContext, callback) {
12015
+ resolve(context2, path13, request, resolveContext, callback) {
11640
12016
  try {
11641
- const data = this.binding.resolveSync(path11, request);
12017
+ const data = this.binding.resolveSync(path13, request);
11642
12018
  if (data === false) {
11643
12019
  callback(null, false);
11644
12020
  return;
@@ -11820,8 +12196,19 @@ var Watching = class {
11820
12196
  this.onChange();
11821
12197
  this.#invalidate();
11822
12198
  }
11823
- invalidateWithChangedFiles(files) {
11824
- this.#invalidate(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), files, /* @__PURE__ */ new Set());
12199
+ /**
12200
+ * @internal This is not a public API yet, still unstable, might change in the future
12201
+ */
12202
+ invalidateWithChangesAndRemovals(changedFiles, removedFiles, callback) {
12203
+ if (callback) {
12204
+ this.callbacks.push(callback);
12205
+ }
12206
+ if (!this.#invalidReported) {
12207
+ this.#invalidReported = true;
12208
+ this.compiler.hooks.invalid.call(null, Date.now());
12209
+ }
12210
+ this.onChange();
12211
+ this.#invalidate(void 0, void 0, changedFiles, removedFiles);
11825
12212
  }
11826
12213
  #invalidate(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
11827
12214
  this.#mergeWithCollected(changedFiles, removedFiles);
@@ -11942,16 +12329,18 @@ var Watching = class {
11942
12329
  });
11943
12330
  }
11944
12331
  #mergeWithCollected(changedFiles, removedFiles) {
11945
- if (!changedFiles) return;
11946
- if (!removedFiles) return;
11947
12332
  if (!this.#collectedChangedFiles || !this.#collectedRemovedFiles) {
11948
12333
  this.#collectedChangedFiles = new Set(changedFiles);
11949
12334
  this.#collectedRemovedFiles = new Set(removedFiles);
11950
- } else {
12335
+ return;
12336
+ }
12337
+ if (changedFiles) {
11951
12338
  for (const file of changedFiles) {
11952
12339
  this.#collectedChangedFiles.add(file);
11953
12340
  this.#collectedRemovedFiles.delete(file);
11954
12341
  }
12342
+ }
12343
+ if (removedFiles) {
11955
12344
  for (const file of removedFiles) {
11956
12345
  this.#collectedChangedFiles.delete(file);
11957
12346
  this.#collectedRemovedFiles.add(file);
@@ -11971,7 +12360,7 @@ var Watching = class {
11971
12360
 
11972
12361
  // src/util/bindingVersionCheck.ts
11973
12362
  var import_node_fs4 = require("fs");
11974
- var import_node_path11 = __toESM(require("path"));
12363
+ var import_node_path13 = __toESM(require("path"));
11975
12364
  var NodePlatformArchToAbi = {
11976
12365
  android: {
11977
12366
  arm64: "",
@@ -12043,7 +12432,7 @@ var checkVersion = () => {
12043
12432
  }
12044
12433
  let ADDON_VERSION;
12045
12434
  try {
12046
- const BINDING_PKG_DIR = import_node_path11.default.dirname(
12435
+ const BINDING_PKG_DIR = import_node_path13.default.dirname(
12047
12436
  require.resolve("@rspack/binding/package.json")
12048
12437
  );
12049
12438
  const isLocal = (0, import_node_fs4.readdirSync)(BINDING_PKG_DIR).some(
@@ -12219,7 +12608,7 @@ var binding6 = __toESM(require("@rspack/binding"));
12219
12608
 
12220
12609
  // src/Module.ts
12221
12610
  var binding5 = __toESM(require("@rspack/binding"));
12222
- var import_binding78 = require("@rspack/binding");
12611
+ var import_binding79 = require("@rspack/binding");
12223
12612
  var ContextModuleFactoryBeforeResolveData = class _ContextModuleFactoryBeforeResolveData {
12224
12613
  #inner;
12225
12614
  static __from_binding(binding14) {
@@ -13611,7 +14000,7 @@ var Compiler = class _Compiler {
13611
14000
  return finalCallback(null, stats);
13612
14001
  });
13613
14002
  };
13614
- const run = () => {
14003
+ const run2 = () => {
13615
14004
  this.hooks.beforeRun.callAsync(this, (err) => {
13616
14005
  if (err) {
13617
14006
  return finalCallback(err);
@@ -13628,10 +14017,10 @@ var Compiler = class _Compiler {
13628
14017
  this.cache.endIdle((err) => {
13629
14018
  if (err) return callback(err);
13630
14019
  this.idle = false;
13631
- run();
14020
+ run2();
13632
14021
  });
13633
14022
  } else {
13634
- run();
14023
+ run2();
13635
14024
  }
13636
14025
  }
13637
14026
  runAsChild(callback) {
@@ -14483,7 +14872,7 @@ var MultiCompiler = class {
14483
14872
  * @param {Callback<MultiStats>} callback callback when all compilers are done, result includes Stats of all changed compilers
14484
14873
  * @returns {SetupResult[]} result of setup
14485
14874
  */
14486
- #runGraph(setup, run, callback) {
14875
+ #runGraph(setup, run2, callback) {
14487
14876
  const nodes = this.compilers.map((compiler) => ({
14488
14877
  compiler,
14489
14878
  setupResult: void 0,
@@ -14597,7 +14986,7 @@ var MultiCompiler = class {
14597
14986
  if (node3.state === "queued" || node3.state === "blocked" && node3.parents.every((p) => p.state === "done")) {
14598
14987
  running++;
14599
14988
  node3.state = "starting";
14600
- run(
14989
+ run2(
14601
14990
  node3.compiler,
14602
14991
  node3.setupResult,
14603
14992
  nodeDone.bind(null, node3)
@@ -15116,17 +15505,17 @@ var ASSETS_GROUPERS = {
15116
15505
  const extensionMatch = groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
15117
15506
  const extension = extensionMatch ? extensionMatch[1] : "";
15118
15507
  const pathMatch = groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name);
15119
- const path11 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15508
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15120
15509
  const keys = [];
15121
15510
  if (groupAssetsByPath) {
15122
15511
  keys.push(".");
15123
15512
  if (extension)
15124
15513
  keys.push(
15125
- path11.length ? `${path11.join("/")}/*${extension}` : `*${extension}`
15514
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15126
15515
  );
15127
- while (path11.length > 0) {
15128
- keys.push(`${path11.join("/")}/`);
15129
- path11.pop();
15516
+ while (path13.length > 0) {
15517
+ keys.push(`${path13.join("/")}/`);
15518
+ path13.pop();
15130
15519
  }
15131
15520
  } else {
15132
15521
  if (extension) keys.push(`*${extension}`);
@@ -15312,16 +15701,16 @@ var MODULES_GROUPERS = (type) => ({
15312
15701
  const extensionMatch = groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource);
15313
15702
  const extension = extensionMatch ? extensionMatch[1] : "";
15314
15703
  const pathMatch = groupModulesByPath && GROUP_PATH_REGEXP.exec(resource);
15315
- const path11 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15704
+ const path13 = pathMatch ? pathMatch[1].split(/[/\\]/) : [];
15316
15705
  const keys = [];
15317
15706
  if (groupModulesByPath) {
15318
15707
  if (extension)
15319
15708
  keys.push(
15320
- path11.length ? `${path11.join("/")}/*${extension}` : `*${extension}`
15709
+ path13.length ? `${path13.join("/")}/*${extension}` : `*${extension}`
15321
15710
  );
15322
- while (path11.length > 0) {
15323
- keys.push(`${path11.join("/")}/`);
15324
- path11.pop();
15711
+ while (path13.length > 0) {
15712
+ keys.push(`${path13.join("/")}/`);
15713
+ path13.pop();
15325
15714
  }
15326
15715
  } else {
15327
15716
  if (extension) keys.push(`*${extension}`);
@@ -17762,6 +18151,9 @@ var RspackOptionsApply = class {
17762
18151
  new APIPlugin().apply(compiler);
17763
18152
  new DataUriPlugin().apply(compiler);
17764
18153
  new FileUriPlugin().apply(compiler);
18154
+ if (options.experiments.buildHttp) {
18155
+ new HttpUriPlugin(options.experiments.buildHttp).apply(compiler);
18156
+ }
17765
18157
  new EnsureChunkConditionsPlugin().apply(compiler);
17766
18158
  if (options.optimization.mergeDuplicateChunks) {
17767
18159
  new MergeDuplicateChunksPlugin().apply(compiler);
@@ -17896,7 +18288,7 @@ var RspackOptionsApply = class {
17896
18288
 
17897
18289
  // src/ContextModule.ts
17898
18290
  var binding11 = __toESM(require("@rspack/binding"));
17899
- var import_binding79 = require("@rspack/binding");
18291
+ var import_binding80 = require("@rspack/binding");
17900
18292
  Object.defineProperty(binding11.ContextModule.prototype, "originalSource", {
17901
18293
  enumerable: true,
17902
18294
  configurable: true,
@@ -17918,7 +18310,7 @@ Object.defineProperty(binding11.ContextModule.prototype, "emitFile", {
17918
18310
 
17919
18311
  // src/ConcatenatedModule.ts
17920
18312
  var binding12 = __toESM(require("@rspack/binding"));
17921
- var import_binding80 = require("@rspack/binding");
18313
+ var import_binding81 = require("@rspack/binding");
17922
18314
  Object.defineProperty(binding12.ConcatenatedModule.prototype, "originalSource", {
17923
18315
  enumerable: true,
17924
18316
  configurable: true,
@@ -17940,7 +18332,7 @@ Object.defineProperty(binding12.ConcatenatedModule.prototype, "emitFile", {
17940
18332
 
17941
18333
  // src/ExternalModule.ts
17942
18334
  var binding13 = __toESM(require("@rspack/binding"));
17943
- var import_binding81 = require("@rspack/binding");
18335
+ var import_binding82 = require("@rspack/binding");
17944
18336
  Object.defineProperty(binding13.ExternalModule.prototype, "originalSource", {
17945
18337
  enumerable: true,
17946
18338
  configurable: true,
@@ -17961,7 +18353,7 @@ Object.defineProperty(binding13.ExternalModule.prototype, "emitFile", {
17961
18353
  });
17962
18354
 
17963
18355
  // src/exports.ts
17964
- var import_binding89 = require("@rspack/binding");
18356
+ var import_binding90 = require("@rspack/binding");
17965
18357
 
17966
18358
  // src/lib/ModuleFilenameHelpers.ts
17967
18359
  var ModuleFilenameHelpers_exports = {};
@@ -18006,9 +18398,9 @@ var matchObject = (obj, str) => {
18006
18398
  var import_zod5 = __toESM(require("../compiled/zod/index.js"));
18007
18399
 
18008
18400
  // src/builtin-plugin/FlagAllModulesAsUsedPlugin.ts
18009
- var import_binding82 = require("@rspack/binding");
18401
+ var import_binding83 = require("@rspack/binding");
18010
18402
  var FlagAllModulesAsUsedPlugin = create2(
18011
- import_binding82.BuiltinPluginName.FlagAllModulesAsUsedPlugin,
18403
+ import_binding83.BuiltinPluginName.FlagAllModulesAsUsedPlugin,
18012
18404
  (explanation) => {
18013
18405
  return {
18014
18406
  explanation
@@ -18897,7 +19289,7 @@ var NodeTemplatePlugin = class {
18897
19289
  };
18898
19290
 
18899
19291
  // src/config/zod.ts
18900
- var import_node_path12 = __toESM(require("path"));
19292
+ var import_node_path14 = __toESM(require("path"));
18901
19293
  var import_zod8 = require("../compiled/zod/index.js");
18902
19294
 
18903
19295
  // src/config/utils.ts
@@ -19055,7 +19447,7 @@ var filename = filenameTemplate.or(
19055
19447
  var name = import_zod8.z.string();
19056
19448
  var dependencies = import_zod8.z.array(name);
19057
19449
  var context = import_zod8.z.string().refine(
19058
- (val) => import_node_path12.default.isAbsolute(val),
19450
+ (val) => import_node_path14.default.isAbsolute(val),
19059
19451
  (val) => ({
19060
19452
  message: `The provided value ${JSON.stringify(val)} must be an absolute path.`
19061
19453
  })
@@ -19154,7 +19546,7 @@ var entryDynamic = import_zod8.z.function().returns(
19154
19546
  entryStatic.or(import_zod8.z.promise(entryStatic))
19155
19547
  );
19156
19548
  var entry = entryStatic.or(entryDynamic);
19157
- var path10 = import_zod8.z.string();
19549
+ var path12 = import_zod8.z.string();
19158
19550
  var pathinfo = import_zod8.z.boolean().or(import_zod8.z.literal("verbose"));
19159
19551
  var assetModuleFilename = filename;
19160
19552
  var webassemblyModuleFilename = import_zod8.z.string();
@@ -19228,7 +19620,7 @@ var environment = import_zod8.z.strictObject({
19228
19620
  templateLiteral: import_zod8.z.boolean().optional()
19229
19621
  });
19230
19622
  var output = import_zod8.z.strictObject({
19231
- path: path10.optional(),
19623
+ path: path12.optional(),
19232
19624
  pathinfo: pathinfo.optional(),
19233
19625
  clean: clean.optional(),
19234
19626
  publicPath: publicPath.optional(),
@@ -19284,7 +19676,7 @@ var output = import_zod8.z.strictObject({
19284
19676
  });
19285
19677
  var resolveAlias = import_zod8.z.record(
19286
19678
  import_zod8.z.literal(false).or(import_zod8.z.string()).or(import_zod8.z.array(import_zod8.z.string().or(import_zod8.z.literal(false))))
19287
- );
19679
+ ).or(import_zod8.z.literal(false));
19288
19680
  var resolveTsConfigFile = import_zod8.z.string();
19289
19681
  var resolveTsConfig = resolveTsConfigFile.or(
19290
19682
  import_zod8.z.strictObject({
@@ -19333,7 +19725,8 @@ var ruleSetLoaderOptions = import_zod8.z.string().or(import_zod8.z.record(import
19333
19725
  var ruleSetLoaderWithOptions = import_zod8.z.strictObject({
19334
19726
  ident: import_zod8.z.string().optional(),
19335
19727
  loader: ruleSetLoader,
19336
- options: ruleSetLoaderOptions.optional()
19728
+ options: ruleSetLoaderOptions.optional(),
19729
+ parallel: import_zod8.z.boolean().optional()
19337
19730
  });
19338
19731
  var ruleSetUseItem = ruleSetLoader.or(
19339
19732
  ruleSetLoaderWithOptions
@@ -19865,7 +20258,7 @@ var optimizationRuntimeChunk = import_zod8.z.enum(["single", "multiple"]).or(imp
19865
20258
  ).optional()
19866
20259
  })
19867
20260
  );
19868
- var optimizationSplitChunksNameFunction = import_zod8.z.function().args(import_zod8.z.instanceof(import_binding78.Module), import_zod8.z.array(import_zod8.z.instanceof(Chunk)), import_zod8.z.string()).returns(
20261
+ var optimizationSplitChunksNameFunction = import_zod8.z.function().args(import_zod8.z.instanceof(import_binding79.Module), import_zod8.z.array(import_zod8.z.instanceof(Chunk)), import_zod8.z.string()).returns(
19869
20262
  import_zod8.z.string().optional()
19870
20263
  );
19871
20264
  var optimizationSplitChunksName = import_zod8.z.string().or(import_zod8.z.literal(false)).or(optimizationSplitChunksNameFunction);
@@ -19892,7 +20285,7 @@ var sharedOptimizationSplitChunksCacheGroup = {
19892
20285
  var optimizationSplitChunksCacheGroup = import_zod8.z.strictObject({
19893
20286
  test: import_zod8.z.string().or(import_zod8.z.instanceof(RegExp)).or(
19894
20287
  import_zod8.z.function().args(
19895
- import_zod8.z.instanceof(import_binding78.Module),
20288
+ import_zod8.z.instanceof(import_binding79.Module),
19896
20289
  import_zod8.z.object({
19897
20290
  moduleGraph: import_zod8.z.instanceof(ModuleGraph),
19898
20291
  chunkGraph: import_zod8.z.instanceof(ChunkGraph)
@@ -19990,6 +20383,23 @@ var incremental = import_zod8.z.strictObject({
19990
20383
  chunksRender: import_zod8.z.boolean().optional(),
19991
20384
  emitAssets: import_zod8.z.boolean().optional()
19992
20385
  });
20386
+ var buildHttpOptions = import_zod8.z.object({
20387
+ allowedUris: import_zod8.z.array(import_zod8.z.union([import_zod8.z.string(), import_zod8.z.instanceof(RegExp)])),
20388
+ lockfileLocation: import_zod8.z.string().optional(),
20389
+ cacheLocation: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.literal(false)]).optional(),
20390
+ upgrade: import_zod8.z.boolean().optional(),
20391
+ // proxy: z.string().optional(),
20392
+ // frozen: z.boolean().optional(),
20393
+ httpClient: import_zod8.z.function().args(import_zod8.z.string(), import_zod8.z.record(import_zod8.z.string())).returns(
20394
+ import_zod8.z.promise(
20395
+ import_zod8.z.object({
20396
+ status: import_zod8.z.number(),
20397
+ headers: import_zod8.z.record(import_zod8.z.string()),
20398
+ body: import_zod8.z.instanceof(Buffer)
20399
+ })
20400
+ )
20401
+ ).optional()
20402
+ });
19993
20403
  var experiments = import_zod8.z.strictObject({
19994
20404
  cache: import_zod8.z.boolean().optional().or(experimentCacheOptions),
19995
20405
  lazyCompilation: import_zod8.z.boolean().optional().or(lazyCompilationOptions),
@@ -20001,7 +20411,9 @@ var experiments = import_zod8.z.strictObject({
20001
20411
  incremental: import_zod8.z.boolean().or(incremental).optional(),
20002
20412
  parallelCodeSplitting: import_zod8.z.boolean().optional(),
20003
20413
  futureDefaults: import_zod8.z.boolean().optional(),
20004
- rspackFuture: rspackFutureOptions.optional()
20414
+ rspackFuture: rspackFutureOptions.optional(),
20415
+ buildHttp: buildHttpOptions.optional(),
20416
+ parallelLoader: import_zod8.z.boolean().optional()
20005
20417
  });
20006
20418
  var watch = import_zod8.z.boolean();
20007
20419
  var watchOptions = import_zod8.z.strictObject({
@@ -20060,9 +20472,9 @@ var rspackOptions = import_zod8.z.strictObject({
20060
20472
  });
20061
20473
 
20062
20474
  // src/container/ModuleFederationRuntimePlugin.ts
20063
- var import_binding83 = require("@rspack/binding");
20475
+ var import_binding84 = require("@rspack/binding");
20064
20476
  var ModuleFederationRuntimePlugin = create2(
20065
- import_binding83.BuiltinPluginName.ModuleFederationRuntimePlugin,
20477
+ import_binding84.BuiltinPluginName.ModuleFederationRuntimePlugin,
20066
20478
  () => {
20067
20479
  }
20068
20480
  );
@@ -20258,10 +20670,10 @@ function getDefaultEntryRuntime(paths, options, compiler) {
20258
20670
  }
20259
20671
 
20260
20672
  // src/sharing/ConsumeSharedPlugin.ts
20261
- var import_binding85 = require("@rspack/binding");
20673
+ var import_binding86 = require("@rspack/binding");
20262
20674
 
20263
20675
  // src/sharing/ShareRuntimePlugin.ts
20264
- var import_binding84 = require("@rspack/binding");
20676
+ var import_binding85 = require("@rspack/binding");
20265
20677
  var compilerSet = /* @__PURE__ */ new WeakSet();
20266
20678
  function isSingleton(compiler) {
20267
20679
  return compilerSet.has(compiler);
@@ -20273,7 +20685,7 @@ var ShareRuntimePlugin = class extends RspackBuiltinPlugin {
20273
20685
  constructor(enhanced = false) {
20274
20686
  super();
20275
20687
  this.enhanced = enhanced;
20276
- this.name = import_binding84.BuiltinPluginName.ShareRuntimePlugin;
20688
+ this.name = import_binding85.BuiltinPluginName.ShareRuntimePlugin;
20277
20689
  }
20278
20690
  raw(compiler) {
20279
20691
  if (isSingleton(compiler)) return;
@@ -20292,7 +20704,7 @@ function isRequiredVersion(str) {
20292
20704
  var ConsumeSharedPlugin = class extends RspackBuiltinPlugin {
20293
20705
  constructor(options) {
20294
20706
  super();
20295
- this.name = import_binding85.BuiltinPluginName.ConsumeSharedPlugin;
20707
+ this.name = import_binding86.BuiltinPluginName.ConsumeSharedPlugin;
20296
20708
  this._options = {
20297
20709
  consumes: parseOptions(
20298
20710
  options.consumes,
@@ -20355,11 +20767,11 @@ var ConsumeSharedPlugin = class extends RspackBuiltinPlugin {
20355
20767
  };
20356
20768
 
20357
20769
  // src/sharing/ProvideSharedPlugin.ts
20358
- var import_binding86 = require("@rspack/binding");
20770
+ var import_binding87 = require("@rspack/binding");
20359
20771
  var ProvideSharedPlugin = class extends RspackBuiltinPlugin {
20360
20772
  constructor(options) {
20361
20773
  super();
20362
- this.name = import_binding86.BuiltinPluginName.ProvideSharedPlugin;
20774
+ this.name = import_binding87.BuiltinPluginName.ProvideSharedPlugin;
20363
20775
  this._provides = parseOptions(
20364
20776
  options.provides,
20365
20777
  (item) => {
@@ -20464,11 +20876,11 @@ var SharePlugin = class {
20464
20876
  };
20465
20877
 
20466
20878
  // src/container/ContainerPlugin.ts
20467
- var import_binding87 = require("@rspack/binding");
20879
+ var import_binding88 = require("@rspack/binding");
20468
20880
  var ContainerPlugin = class extends RspackBuiltinPlugin {
20469
20881
  constructor(options) {
20470
20882
  super();
20471
- this.name = import_binding87.BuiltinPluginName.ContainerPlugin;
20883
+ this.name = import_binding88.BuiltinPluginName.ContainerPlugin;
20472
20884
  this._options = {
20473
20885
  name: options.name,
20474
20886
  shareScope: options.shareScope || "default",
@@ -20512,11 +20924,11 @@ var ContainerPlugin = class extends RspackBuiltinPlugin {
20512
20924
  };
20513
20925
 
20514
20926
  // src/container/ContainerReferencePlugin.ts
20515
- var import_binding88 = require("@rspack/binding");
20927
+ var import_binding89 = require("@rspack/binding");
20516
20928
  var ContainerReferencePlugin = class extends RspackBuiltinPlugin {
20517
20929
  constructor(options) {
20518
20930
  super();
20519
- this.name = import_binding88.BuiltinPluginName.ContainerReferencePlugin;
20931
+ this.name = import_binding89.BuiltinPluginName.ContainerReferencePlugin;
20520
20932
  this._options = {
20521
20933
  remoteType: options.remoteType,
20522
20934
  remotes: parseOptions(
@@ -20601,7 +21013,7 @@ var ModuleFederationPluginV1 = class {
20601
21013
  };
20602
21014
 
20603
21015
  // src/exports.ts
20604
- var import_binding90 = require("@rspack/binding");
21016
+ var import_binding91 = require("@rspack/binding");
20605
21017
  var rspackVersion = import_package.version;
20606
21018
  var version = import_package.webpackVersion;
20607
21019
  var WebpackError2 = Error;
@@ -20648,7 +21060,7 @@ var sharing = {
20648
21060
  var experiments2 = {
20649
21061
  globalTrace: {
20650
21062
  async register(filter, layer2, output2) {
20651
- (0, import_binding90.registerGlobalTrace)(filter, layer2, output2);
21063
+ (0, import_binding91.registerGlobalTrace)(filter, layer2, output2);
20652
21064
  if (layer2 === "otel") {
20653
21065
  try {
20654
21066
  const { initOpenTelemetry } = await import("@rspack/tracing");
@@ -20662,7 +21074,7 @@ var experiments2 = {
20662
21074
  }
20663
21075
  },
20664
21076
  async cleanup() {
20665
- (0, import_binding90.cleanupGlobalTrace)();
21077
+ (0, import_binding91.cleanupGlobalTrace)();
20666
21078
  try {
20667
21079
  const { shutdownOpenTelemetry } = await import("@rspack/tracing");
20668
21080
  await shutdownOpenTelemetry();