@rspack/core 1.4.2 → 1.4.4

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 (81) hide show
  1. package/dist/Chunk.d.ts +14 -34
  2. package/dist/ChunkGraph.d.ts +6 -21
  3. package/dist/Chunks.d.ts +0 -1
  4. package/dist/Compilation.d.ts +8 -7
  5. package/dist/Entrypoint.d.ts +2 -10
  6. package/dist/ErrorHelpers.d.ts +2 -0
  7. package/dist/RspackError.d.ts +1 -1
  8. package/dist/builtin-plugin/APIPlugin.d.ts +1 -2
  9. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -2
  10. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -2
  11. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -2
  12. package/dist/builtin-plugin/BannerPlugin.d.ts +3 -3
  13. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -2
  14. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -2
  15. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -2
  16. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -2
  17. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  18. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -2
  20. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -2
  21. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -2
  22. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -2
  23. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
  24. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -2
  25. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -2
  26. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -2
  27. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -2
  28. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  29. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
  30. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
  31. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -2
  32. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -2
  33. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -2
  34. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -2
  35. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -2
  36. package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
  37. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -2
  38. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -2
  39. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -2
  40. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -2
  41. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -2
  42. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -2
  43. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -2
  44. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -2
  45. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -2
  46. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -2
  47. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -2
  48. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -2
  49. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -2
  50. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
  51. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  52. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -2
  53. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -2
  54. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -2
  55. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -2
  56. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  57. package/dist/builtin-plugin/RslibPlugin.d.ts +2 -2
  58. package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
  59. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
  60. package/dist/builtin-plugin/RuntimePlugin.d.ts +2 -2
  61. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -2
  62. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -2
  63. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
  64. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -2
  66. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -2
  67. package/dist/builtin-plugin/base.d.ts +29 -5
  68. package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
  69. package/dist/builtin-plugin/index.d.ts +1 -1
  70. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -2
  71. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -2
  72. package/dist/exports.d.ts +3 -1
  73. package/dist/index.js +197 -348
  74. package/dist/lib/WebpackError.d.ts +1 -1
  75. package/dist/loader-runner/ModuleError.d.ts +7 -0
  76. package/dist/loader-runner/ModuleWarning.d.ts +7 -0
  77. package/dist/stats/StatsFactory.d.ts +2 -2
  78. package/dist/stats/statsFactoryUtils.d.ts +2 -2
  79. package/dist/util/index.d.ts +0 -2
  80. package/package.json +5 -3
  81. package/dist/ChunkGroup.d.ts +0 -33
package/dist/index.js CHANGED
@@ -220,10 +220,10 @@ var __webpack_modules__ = {
220
220
  module.exports = require("./moduleFederationDefaultRuntime.js");
221
221
  },
222
222
  "@rspack/binding": function(module) {
223
- module.exports = require("@rspack/binding");
223
+ module.exports = require(process.env.RSPACK_BINDING ? process.env.RSPACK_BINDING : "@rspack/binding");
224
224
  },
225
225
  "@rspack/binding/package.json": function(module) {
226
- module.exports = require("@rspack/binding/package.json");
226
+ module.exports = require(process.env.RSPACK_BINDING ? require("node:path").resolve(process.env.RSPACK_BINDING, './package.json') : "@rspack/binding/package.json");
227
227
  },
228
228
  "node:http": function(module) {
229
229
  module.exports = require("node:http");
@@ -231,6 +231,9 @@ var __webpack_modules__ = {
231
231
  "node:https": function(module) {
232
232
  module.exports = require("node:https");
233
233
  },
234
+ "node:inspector": function(module) {
235
+ module.exports = require("node:inspector");
236
+ },
234
237
  "node:os": function(module) {
235
238
  module.exports = require("node:os");
236
239
  },
@@ -250,11 +253,6 @@ var __webpack_modules__ = {
250
253
  module.exports = import("../compiled/tinypool/dist/index.js").then(function(module) {
251
254
  return module;
252
255
  });
253
- },
254
- "node:inspector": function(module) {
255
- module.exports = import("node:inspector").then(function(module) {
256
- return module;
257
- });
258
256
  }
259
257
  }, __webpack_module_cache__ = {};
260
258
  function __webpack_require__(moduleId) {
@@ -437,240 +435,20 @@ for(var __webpack_i__ in (()=>{
437
435
  webworker: ()=>webworker
438
436
  });
439
437
  var binding_ = __webpack_require__("@rspack/binding"), binding_default = __webpack_require__.n(binding_);
440
- let lite_tapable_namespaceObject = require("@rspack/lite-tapable"), CHUNK_GROUP_MAPPINGS = new WeakMap();
441
- class ChunkGroup {
442
- #inner;
443
- static __from_binding(binding) {
444
- let chunkGroup = CHUNK_GROUP_MAPPINGS.get(binding);
445
- return chunkGroup || (chunkGroup = new ChunkGroup(binding), CHUNK_GROUP_MAPPINGS.set(binding, chunkGroup)), chunkGroup;
446
- }
447
- constructor(inner){
448
- this.#inner = inner, Object.defineProperties(this, {
449
- chunks: {
450
- enumerable: !0,
451
- get: ()=>this.#inner.chunks.map((binding)=>Chunk.__from_binding(binding))
452
- },
453
- index: {
454
- enumerable: !0,
455
- get: ()=>this.#inner.index
456
- },
457
- name: {
458
- enumerable: !0,
459
- get: ()=>this.#inner.name
460
- },
461
- origins: {
462
- enumerable: !0,
463
- get: ()=>this.#inner.origins.map((origin)=>({
464
- module: origin.module ? origin.module : void 0,
465
- request: origin.request,
466
- loc: origin.loc
467
- }))
468
- },
469
- childrenIterable: {
470
- enumerable: !0,
471
- get: ()=>this.#inner.childrenIterable.map((child)=>ChunkGroup.__from_binding(child))
472
- }
473
- });
474
- }
475
- getFiles() {
476
- return this.#inner.getFiles();
477
- }
478
- getParents() {
479
- return this.#inner.getParents().map((binding)=>ChunkGroup.__from_binding(binding));
480
- }
481
- isInitial() {
482
- return this.#inner.isInitial();
483
- }
484
- getModulePreOrderIndex(module) {
485
- return this.#inner.getModulePreOrderIndex(module);
486
- }
487
- getModulePostOrderIndex(module) {
488
- return this.#inner.getModulePostOrderIndex(module);
489
- }
490
- }
491
- let CHUNK_MAPPINGS = new WeakMap();
492
- class Chunk {
493
- #inner;
494
- static __from_binding(binding) {
495
- let chunk = CHUNK_MAPPINGS.get(binding);
496
- return chunk || (chunk = new Chunk(binding), CHUNK_MAPPINGS.set(binding, chunk)), chunk;
497
- }
498
- static __to_binding(chunk) {
499
- return chunk.#inner;
500
- }
501
- constructor(binding){
502
- this.#inner = binding, Object.defineProperties(this, {
503
- name: {
504
- enumerable: !0,
505
- get: ()=>binding.name
506
- },
507
- id: {
508
- enumerable: !0,
509
- get: ()=>binding.id
510
- },
511
- ids: {
512
- enumerable: !0,
513
- get: ()=>binding.ids
514
- },
515
- idNameHints: {
516
- enumerable: !0,
517
- get: ()=>binding.idNameHints
518
- },
519
- filenameTemplate: {
520
- enumerable: !0,
521
- get: ()=>binding.filenameTemplate
522
- },
523
- cssFilenameTemplate: {
524
- enumerable: !0,
525
- get: ()=>binding.cssFilenameTemplate
526
- },
527
- files: {
528
- enumerable: !0,
529
- get: ()=>new Set(binding.files)
530
- },
531
- runtime: {
532
- enumerable: !0,
533
- get: ()=>new Set(binding.runtime)
534
- },
535
- hash: {
536
- enumerable: !0,
537
- get: ()=>binding.hash
538
- },
539
- contentHash: {
540
- enumerable: !0,
541
- get: ()=>binding.contentHash
542
- },
543
- renderedHash: {
544
- enumerable: !0,
545
- get: ()=>binding.renderedHash
546
- },
547
- chunkReason: {
548
- enumerable: !0,
549
- get: ()=>binding.chunkReason
550
- },
551
- auxiliaryFiles: {
552
- enumerable: !0,
553
- get: ()=>new Set(binding.auxiliaryFiles)
554
- }
555
- });
556
- }
557
- isOnlyInitial() {
558
- return this.#inner.isOnlyInitial();
559
- }
560
- canBeInitial() {
561
- return this.#inner.canBeInitial();
562
- }
563
- hasRuntime() {
564
- return this.#inner.hasRuntime();
565
- }
566
- get groupsIterable() {
567
- return new Set(this.#inner.groups().map((binding)=>ChunkGroup.__from_binding(binding)));
568
- }
569
- getChunkMaps(realHash) {
570
- let chunkHashMap = {}, chunkContentHashMap = {}, chunkNameMap = {};
571
- for (let chunk of this.getAllAsyncChunks()){
572
- let id = chunk.id;
573
- if (!id) continue;
574
- let chunkHash = realHash ? chunk.hash : chunk.renderedHash;
575
- for (let key of (chunkHash && (chunkHashMap[id] = chunkHash), Object.keys(chunk.contentHash)))chunkContentHashMap[key] || (chunkContentHashMap[key] = {}), chunkContentHashMap[key][id] = chunk.contentHash[key];
576
- chunk.name && (chunkNameMap[id] = chunk.name);
577
- }
578
- return {
579
- hash: chunkHashMap,
580
- contentHash: chunkContentHashMap,
581
- name: chunkNameMap
582
- };
583
- }
584
- getAllAsyncChunks() {
585
- return new Set(this.#inner.getAllAsyncChunks().map((binding)=>Chunk.__from_binding(binding)));
586
- }
587
- getAllInitialChunks() {
588
- return new Set(this.#inner.getAllInitialChunks().map((binding)=>Chunk.__from_binding(binding)));
589
- }
590
- getAllReferencedChunks() {
591
- return new Set(this.#inner.getAllReferencedChunks().map((binding)=>Chunk.__from_binding(binding)));
592
- }
593
- getEntryOptions() {
594
- return this.#inner.getEntryOptions();
595
- }
596
- }
597
- function toJsRuntimeSpec(runtime) {
598
- return runtime instanceof Set ? Array.from(runtime) : runtime;
599
- }
600
- class ChunkGraph {
601
- #inner;
602
- static __from_binding(binding) {
603
- return new ChunkGraph(binding);
604
- }
605
- constructor(binding){
606
- this.#inner = binding;
607
- }
608
- hasChunkEntryDependentChunks(chunk) {
609
- return this.#inner.hasChunkEntryDependentChunks(Chunk.__to_binding(chunk));
610
- }
611
- getChunkModules(chunk) {
612
- return this.#inner.getChunkModules(Chunk.__to_binding(chunk));
613
- }
614
- getChunkModulesIterable(chunk) {
615
- return this.#inner.getChunkModules(Chunk.__to_binding(chunk));
616
- }
617
- getOrderedChunkModulesIterable(chunk, compareFn) {
618
- let res = this.#inner.getChunkModules(Chunk.__to_binding(chunk));
619
- return res.sort(compareFn), res;
620
- }
621
- getChunkEntryModulesIterable(chunk) {
622
- return this.#inner.getChunkEntryModules(Chunk.__to_binding(chunk));
623
- }
624
- getNumberOfEntryModules(chunk) {
625
- return this.#inner.getNumberOfEntryModules(Chunk.__to_binding(chunk));
626
- }
627
- getChunkEntryDependentChunksIterable(chunk) {
628
- return this.#inner.getChunkEntryDependentChunksIterable(Chunk.__to_binding(chunk)).map((binding)=>Chunk.__from_binding(binding));
629
- }
630
- getChunkModulesIterableBySourceType(chunk, sourceType) {
631
- return this.#inner.getChunkModulesIterableBySourceType(Chunk.__to_binding(chunk), sourceType);
632
- }
633
- getModuleChunks(module) {
634
- return this.#inner.getModuleChunks(module).map((binding)=>Chunk.__from_binding(binding));
635
- }
636
- getModuleChunksIterable(module) {
637
- return this.#inner.getModuleChunks(module).map((binding)=>Chunk.__from_binding(binding));
638
- }
639
- getModuleId(module) {
640
- return this.#inner.getModuleId(module);
641
- }
642
- getModuleHash(module, runtime) {
643
- return this.#inner.getModuleHash(module, toJsRuntimeSpec(runtime));
644
- }
645
- getBlockChunkGroup(depBlock) {
646
- let binding = this.#inner.getBlockChunkGroup(depBlock);
647
- return binding ? ChunkGroup.__from_binding(binding) : null;
648
- }
649
- }
650
- let ENTRYPOINT_MAPPINGS = new WeakMap();
651
- class Entrypoint extends ChunkGroup {
652
- #inner;
653
- static __from_binding(binding) {
654
- let entrypoint = ENTRYPOINT_MAPPINGS.get(binding);
655
- return entrypoint || (entrypoint = new Entrypoint(binding), ENTRYPOINT_MAPPINGS.set(binding, entrypoint)), entrypoint;
656
- }
657
- constructor(binding){
658
- super(binding), this.#inner = binding;
659
- }
660
- getRuntimeChunk() {
661
- let chunkBinding = this.#inner.getRuntimeChunk();
662
- return chunkBinding ? Chunk.__from_binding(chunkBinding) : null;
663
- }
664
- getEntrypointChunk() {
665
- let chunkBinding = this.#inner.getEntrypointChunk();
666
- return chunkBinding ? Chunk.__from_binding(chunkBinding) : null;
667
- }
668
- }
669
- let cutOffByFlag = (stack, flag)=>{
438
+ let lite_tapable_namespaceObject = require("@rspack/lite-tapable"), cutOffByFlag = (stack, flag)=>{
670
439
  let stacks = stack.split("\n");
671
440
  for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
672
441
  return stacks.join("\n");
673
- }, cutOffLoaderExecution = (stack)=>cutOffByFlag(stack, "LOADER_EXECUTION");
442
+ }, cutOffLoaderExecution = (stack)=>cutOffByFlag(stack, "LOADER_EXECUTION"), cleanUp = (stack, name, message)=>{
443
+ let details = cutOffLoaderExecution(stack);
444
+ return cutOffMessage(stack, name, message);
445
+ }, cutOffMessage = (stack, name, message)=>{
446
+ let nextLine = stack.indexOf("\n");
447
+ return -1 === nextLine ? stack === message ? "" : stack : stack.slice(0, nextLine) === `${name}: ${message}` ? stack.slice(nextLine + 1) : stack;
448
+ };
449
+ function toJsRuntimeSpec(runtime) {
450
+ return runtime instanceof Set ? Array.from(runtime) : runtime;
451
+ }
674
452
  class ExportsInfo {
675
453
  #inner;
676
454
  static __from_binding(binding) {
@@ -1456,14 +1234,61 @@ for(var __webpack_i__ in (()=>{
1456
1234
  };
1457
1235
  }
1458
1236
  }
1459
- function isNil(value) {
1460
- return null == value;
1461
- }
1462
- Object.defineProperty(binding_.Chunks.prototype, "values", {
1237
+ Object.defineProperty(binding_.Chunk.prototype, "files", {
1238
+ enumerable: !0,
1239
+ configurable: !0,
1240
+ get () {
1241
+ return new Set(this._files);
1242
+ }
1243
+ }), Object.defineProperty(binding_.Chunk.prototype, "runtime", {
1244
+ enumerable: !0,
1245
+ configurable: !0,
1246
+ get () {
1247
+ return new Set(this._runtime);
1248
+ }
1249
+ }), Object.defineProperty(binding_.Chunk.prototype, "auxiliaryFiles", {
1250
+ enumerable: !0,
1251
+ configurable: !0,
1252
+ get () {
1253
+ return new Set(this._auxiliaryFiles);
1254
+ }
1255
+ }), Object.defineProperty(binding_.Chunk.prototype, "groupsIterable", {
1256
+ enumerable: !0,
1257
+ configurable: !0,
1258
+ get () {
1259
+ return new Set(this._groupsIterable);
1260
+ }
1261
+ }), Object.defineProperty(binding_.Chunk.prototype, "getChunkMaps", {
1262
+ enumerable: !0,
1263
+ configurable: !0,
1264
+ value (realHash) {
1265
+ let chunkHashMap = {}, chunkContentHashMap = {}, chunkNameMap = {};
1266
+ for (let chunk of this.getAllAsyncChunks()){
1267
+ let id = chunk.id;
1268
+ if (!id) continue;
1269
+ let chunkHash = realHash ? chunk.hash : chunk.renderedHash;
1270
+ for (let key of (chunkHash && (chunkHashMap[id] = chunkHash), Object.keys(chunk.contentHash)))chunkContentHashMap[key] || (chunkContentHashMap[key] = {}), chunkContentHashMap[key][id] = chunk.contentHash[key];
1271
+ chunk.name && (chunkNameMap[id] = chunk.name);
1272
+ }
1273
+ return {
1274
+ hash: chunkHashMap,
1275
+ contentHash: chunkContentHashMap,
1276
+ name: chunkNameMap
1277
+ };
1278
+ }
1279
+ }), Object.defineProperty(binding_.Chunk.prototype, external_node_util_default().inspect.custom, {
1463
1280
  enumerable: !0,
1464
1281
  configurable: !0,
1465
1282
  value () {
1466
- return this._values().map((binding)=>Chunk.__from_binding(binding)).values();
1283
+ return {
1284
+ ...this
1285
+ };
1286
+ }
1287
+ }), Object.defineProperty(binding_.Chunks.prototype, "values", {
1288
+ enumerable: !0,
1289
+ configurable: !0,
1290
+ value () {
1291
+ return this._values().values();
1467
1292
  }
1468
1293
  }), Object.defineProperty(binding_.Chunks.prototype, Symbol.iterator, {
1469
1294
  enumerable: !0,
@@ -1481,16 +1306,26 @@ for(var __webpack_i__ in (()=>{
1481
1306
  enumerable: !0,
1482
1307
  configurable: !0,
1483
1308
  value (callbackfn, thisArg) {
1484
- for (let binding of this._values()){
1485
- let chunk = Chunk.__from_binding(binding);
1486
- callbackfn.call(thisArg, chunk, chunk, this);
1487
- }
1309
+ for (let chunk of this._values())callbackfn.call(thisArg, chunk, chunk, this);
1488
1310
  }
1489
1311
  }), Object.defineProperty(binding_.Chunks.prototype, "has", {
1490
1312
  enumerable: !0,
1491
1313
  configurable: !0,
1492
1314
  value (value) {
1493
- return this._has(Chunk.__to_binding(value));
1315
+ return this._has(value);
1316
+ }
1317
+ }), Object.defineProperty(binding_.ChunkGraph.prototype, "getOrderedChunkModulesIterable", {
1318
+ enumerable: !0,
1319
+ configurable: !0,
1320
+ value (chunk, compareFn) {
1321
+ let modules = this.getChunkModules(chunk);
1322
+ return modules.sort(compareFn), modules;
1323
+ }
1324
+ }), Object.defineProperty(binding_.ChunkGraph.prototype, "getModuleHash", {
1325
+ enumerable: !0,
1326
+ configurable: !0,
1327
+ value (module, runtime) {
1328
+ return this._getModuleHash(module, toJsRuntimeSpec(runtime));
1494
1329
  }
1495
1330
  }), Object.defineProperty(binding_.Sources.prototype, "get", {
1496
1331
  enumerable: !0,
@@ -1500,32 +1335,7 @@ for(var __webpack_i__ in (()=>{
1500
1335
  return originalSource ? JsSource.__from_binding(originalSource) : null;
1501
1336
  }
1502
1337
  });
1503
- let toBuffer = (bufLike)=>{
1504
- if (Buffer.isBuffer(bufLike)) return bufLike;
1505
- if ("string" == typeof bufLike) return Buffer.from(bufLike);
1506
- if (bufLike instanceof Uint8Array) return Buffer.from(bufLike.buffer);
1507
- throw Error("Buffer, Uint8Array or string expected");
1508
- }, toObject = (input)=>{
1509
- let s;
1510
- if (Buffer.isBuffer(input)) s = input.toString("utf8");
1511
- else if (input && "object" == typeof input) return input;
1512
- else if ("string" == typeof input) s = input;
1513
- else throw Error("Buffer or string or object expected");
1514
- return JSON.parse(s);
1515
- };
1516
- function serializeObject(map) {
1517
- if (!isNil(map)) return "string" == typeof map ? map ? toBuffer(map) : void 0 : toBuffer(JSON.stringify(map));
1518
- }
1519
- function concatErrorMsgAndStack(err) {
1520
- return "string" == typeof err ? Error(err) : (!("hideStack" in err && err.hideStack) && "stack" in err ? err.message = err.stack || err.toString() : err.message = err.toString(), err.stack = err.stack || void 0, err);
1521
- }
1522
- function stringifyLoaderObject(o) {
1523
- return o.path + o.query + o.fragment;
1524
- }
1525
- let unsupported = (name, issue)=>{
1526
- let s = `${name} is not supported by rspack.`;
1527
- throw issue && (s += ` Please refer to issue ${issue} for more information.`), Error(s);
1528
- }, $proxy = Symbol.for("proxy");
1338
+ let $proxy = Symbol.for("proxy");
1529
1339
  function createDiagnosticArray(adm) {
1530
1340
  if ($proxy in adm) return adm[$proxy];
1531
1341
  let array = [];
@@ -1539,14 +1349,14 @@ for(var __webpack_i__ in (()=>{
1539
1349
  case 2:
1540
1350
  return adm.spliceWithArray(index, deleteCount);
1541
1351
  }
1542
- return adm.spliceWithArray(index, deleteCount, newItems.map((item)=>concatErrorMsgAndStack(item)));
1352
+ return adm.spliceWithArray(index, deleteCount, newItems);
1543
1353
  }, arrayExtensions = {
1544
1354
  [Symbol.iterator]: ()=>adm.values().values(),
1545
1355
  splice,
1546
- push: (...newItems)=>(adm.spliceWithArray(adm.length, 0, newItems.map((item)=>concatErrorMsgAndStack(item))), adm.length),
1356
+ push: (...newItems)=>(adm.spliceWithArray(adm.length, 0, newItems), adm.length),
1547
1357
  pop: ()=>splice(Math.max(adm.length - 1, 0), 1)[0],
1548
1358
  shift: ()=>splice(0, 1)[0],
1549
- unshift: (...newItems)=>(adm.spliceWithArray(0, 0, newItems.map((item)=>concatErrorMsgAndStack(item))), adm.length),
1359
+ unshift: (...newItems)=>(adm.spliceWithArray(0, 0, newItems), adm.length),
1550
1360
  reverse: ()=>adm.values().reverse(),
1551
1361
  sort (compareFn) {
1552
1362
  let copy = adm.values();
@@ -1564,13 +1374,14 @@ for(var __webpack_i__ in (()=>{
1564
1374
  adm.values().forEach(callbackfn, thisArg);
1565
1375
  },
1566
1376
  map: (callbackfn, thisArg)=>adm.values().map(callbackfn, thisArg),
1377
+ slice: (start, end)=>adm.values().slice(start, end),
1567
1378
  reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
1568
1379
  reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
1569
1380
  }, proxy = new Proxy(array, {
1570
1381
  get: (target, name)=>"length" === name ? adm.length : "string" != typeof name || Number.isNaN(Number.parseInt(name)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name)),
1571
1382
  set (target, name, value) {
1572
1383
  if ("length" === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
1573
- return "symbol" == typeof name || Number.isNaN(Number.parseInt(name)) ? target[name] = value : adm.set(Number.parseInt(name), concatErrorMsgAndStack(value)), !0;
1384
+ return "symbol" == typeof name || Number.isNaN(Number.parseInt(name)) ? target[name] = value : adm.set(Number.parseInt(name), value), !0;
1574
1385
  }
1575
1386
  });
1576
1387
  return adm[$proxy] = proxy, proxy;
@@ -1726,7 +1537,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1726
1537
  seal: new lite_tapable_namespaceObject.SyncHook([]),
1727
1538
  afterSeal: new lite_tapable_namespaceObject.AsyncSeriesHook([]),
1728
1539
  needAdditionalPass: new lite_tapable_namespaceObject.SyncBailHook([])
1729
- }, this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, this.logging = new Map(), this.childrenCounters = {}, this.children = [], this.needAdditionalPass = !1, this.chunkGraph = ChunkGraph.__from_binding(inner.chunkGraph), this.moduleGraph = ModuleGraph.__from_binding(inner.moduleGraph), this.#addIncludeDispatcher = new AddEntryItemDispatcher(inner.addInclude.bind(inner)), this.#addEntryDispatcher = new AddEntryItemDispatcher(inner.addEntry.bind(inner)), this[binding_.COMPILATION_HOOKS_MAP_SYMBOL] = new WeakMap();
1540
+ }, this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, this.logging = new Map(), this.childrenCounters = {}, this.children = [], this.needAdditionalPass = !1, this.chunkGraph = inner.chunkGraph, this.moduleGraph = ModuleGraph.__from_binding(inner.moduleGraph), this.#addIncludeDispatcher = new AddEntryItemDispatcher(inner.addInclude.bind(inner)), this.#addEntryDispatcher = new AddEntryItemDispatcher(inner.addEntry.bind(inner)), this[binding_.COMPILATION_HOOKS_MAP_SYMBOL] = new WeakMap();
1730
1541
  }
1731
1542
  get hash() {
1732
1543
  return this.#inner.hash;
@@ -1738,25 +1549,19 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1738
1549
  return this.#createCachedAssets();
1739
1550
  }
1740
1551
  get entrypoints() {
1741
- return new Map(this.#inner.entrypoints.map((binding)=>{
1742
- let entrypoint = Entrypoint.__from_binding(binding);
1743
- return [
1552
+ return new Map(this.#inner.entrypoints.map((entrypoint)=>[
1744
1553
  entrypoint.name,
1745
1554
  entrypoint
1746
- ];
1747
- }));
1555
+ ]));
1748
1556
  }
1749
1557
  get chunkGroups() {
1750
- return this.#inner.chunkGroups.map((binding)=>ChunkGroup.__from_binding(binding));
1558
+ return this.#inner.chunkGroups;
1751
1559
  }
1752
1560
  get namedChunkGroups() {
1753
1561
  return createReadonlyMap({
1754
1562
  keys: ()=>this.#inner.getNamedChunkGroupKeys()[Symbol.iterator](),
1755
1563
  get: (property)=>{
1756
- if ("string" == typeof property) {
1757
- let binding = this.#inner.getNamedChunkGroup(property);
1758
- return ChunkGroup.__from_binding(binding);
1759
- }
1564
+ if ("string" == typeof property) return this.#inner.getNamedChunkGroup(property);
1760
1565
  }
1761
1566
  });
1762
1567
  }
@@ -1773,10 +1578,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1773
1578
  return createReadonlyMap({
1774
1579
  keys: ()=>this.#inner.getNamedChunkKeys()[Symbol.iterator](),
1775
1580
  get: (property)=>{
1776
- if ("string" == typeof property) {
1777
- let binding = this.#inner.getNamedChunk(property);
1778
- return binding ? Chunk.__from_binding(binding) : void 0;
1779
- }
1581
+ if ("string" == typeof property) return this.#inner.getNamedChunk(property);
1780
1582
  }
1781
1583
  });
1782
1584
  }
@@ -1968,7 +1770,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1968
1770
  this.#rebuildModuleTask.exec(module.identifier(), f);
1969
1771
  }
1970
1772
  addRuntimeModule(chunk, runtimeModule) {
1971
- runtimeModule.attach(this, chunk, this.chunkGraph), this.#inner.addRuntimeModule(Chunk.__to_binding(chunk), RuntimeModule.__to_binding(this, runtimeModule));
1773
+ runtimeModule.attach(this, chunk, this.chunkGraph), this.#inner.addRuntimeModule(chunk, RuntimeModule.__to_binding(this, runtimeModule));
1972
1774
  }
1973
1775
  addInclude(context, dependency, options, callback) {
1974
1776
  this.#addIncludeDispatcher.call(context, dependency, options, callback);
@@ -2846,7 +2648,32 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2846
2648
  return this.resolverFactory.get(type, resolveOptions);
2847
2649
  }
2848
2650
  }
2849
- let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2651
+ function isNil(value) {
2652
+ return null == value;
2653
+ }
2654
+ let toBuffer = (bufLike)=>{
2655
+ if (Buffer.isBuffer(bufLike)) return bufLike;
2656
+ if ("string" == typeof bufLike) return Buffer.from(bufLike);
2657
+ if (bufLike instanceof Uint8Array) return Buffer.from(bufLike.buffer);
2658
+ throw Error("Buffer, Uint8Array or string expected");
2659
+ }, toObject = (input)=>{
2660
+ let s;
2661
+ if (Buffer.isBuffer(input)) s = input.toString("utf8");
2662
+ else if (input && "object" == typeof input) return input;
2663
+ else if ("string" == typeof input) s = input;
2664
+ else throw Error("Buffer or string or object expected");
2665
+ return JSON.parse(s);
2666
+ };
2667
+ function serializeObject(map) {
2668
+ if (!isNil(map)) return "string" == typeof map ? map ? toBuffer(map) : void 0 : toBuffer(JSON.stringify(map));
2669
+ }
2670
+ function stringifyLoaderObject(o) {
2671
+ return o.path + o.query + o.fragment;
2672
+ }
2673
+ let unsupported = (name, issue)=>{
2674
+ let s = `${name} is not supported by rspack.`;
2675
+ throw issue && (s += ` Please refer to issue ${issue} for more information.`), Error(s);
2676
+ }, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2850
2677
  if ("/" === maybeAbsolutePath[0]) {
2851
2678
  if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
2852
2679
  let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
@@ -3160,7 +2987,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3160
2987
  static session;
3161
2988
  static counter = 10000;
3162
2989
  static async initJavaScriptTrace(layer, output) {
3163
- let { Session } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:inspector"));
2990
+ let { Session } = __webpack_require__("node:inspector");
3164
2991
  this.session = new Session(), this.layer = layer, this.output = output, this.events = [], this.state = "on", this.startTime = process.hrtime.bigint();
3165
2992
  }
3166
2993
  static uuid() {
@@ -3252,6 +3079,20 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3252
3079
  });
3253
3080
  }
3254
3081
  }
3082
+ class ModuleError extends WebpackError {
3083
+ error;
3084
+ constructor(err, { from } = {}){
3085
+ let message = "Module Error";
3086
+ from ? message += ` (from ${from}):\n` : message += ": ", err && "object" == typeof err && err.message ? message += err.message : err && (message += err), super(message), this.name = "ModuleError", this.error = err, this.details = err && "object" == typeof err && err.stack ? cleanUp(err.stack, err.name, err.message) : void 0;
3087
+ }
3088
+ }
3089
+ class ModuleWarning extends WebpackError {
3090
+ error;
3091
+ constructor(err, { from } = {}){
3092
+ let message = "Module Warning";
3093
+ from ? message += ` (from ${from}):\n` : message += ": ", err && "object" == typeof err && err.message ? message += err.message : err && (message += err), super(message), this.name = "ModuleWarning", this.error = err, this.details = err && "object" == typeof err && err.stack ? cleanUp(err.stack, err.name, err.message) : void 0;
3094
+ }
3095
+ }
3255
3096
  let external_node_worker_threads_namespaceObject = require("node:worker_threads"), ensureLoaderWorkerPool = async ()=>service_pool || (service_pool = Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "tinypool")).then(({ Tinypool })=>{
3256
3097
  let availableThreads = Math.max(__webpack_require__("node:os").cpus().length - 1, 1);
3257
3098
  return new Tinypool({
@@ -3620,15 +3461,21 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3620
3461
  name,
3621
3462
  resource
3622
3463
  ].filter(Boolean).join("|"));
3623
- }, loaderContext.rootContext = compiler.context, loaderContext.emitError = function(err) {
3624
- let error = err;
3625
- error instanceof Error || (error = new NonErrorEmittedError(error)), error.name = "ModuleError", error.message = `${error.message} (from: ${stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])})`, (error = concatErrorMsgAndStack(error)).moduleIdentifier = loaderContext._module.identifier(), compiler._lastCompilation.__internal__pushRspackDiagnostic({
3464
+ }, loaderContext.rootContext = compiler.context, loaderContext.emitError = function(e) {
3465
+ e instanceof Error || (e = new NonErrorEmittedError(e));
3466
+ let error = new ModuleError(e, {
3467
+ from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
3468
+ });
3469
+ error.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
3626
3470
  error,
3627
3471
  severity: binding_.JsRspackSeverity.Error
3628
3472
  });
3629
- }, loaderContext.emitWarning = function(warn) {
3630
- let warning = warn;
3631
- warning instanceof Error || (warning = new NonErrorEmittedError(warning)), warning.name = "ModuleWarning", warning.message = `${warning.message} (from: ${stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])})`, (warning = concatErrorMsgAndStack(warning)).moduleIdentifier = loaderContext._module.identifier(), compiler._lastCompilation.__internal__pushRspackDiagnostic({
3473
+ }, loaderContext.emitWarning = function(e) {
3474
+ e instanceof Error || (e = new NonErrorEmittedError(e));
3475
+ let warning = new ModuleWarning(e, {
3476
+ from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
3477
+ });
3478
+ warning.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
3632
3479
  error: warning,
3633
3480
  severity: binding_.JsRspackSeverity.Warn
3634
3481
  });
@@ -3936,15 +3783,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3936
3783
  }
3937
3784
  context.loaderItems = loaderContext.loaders.map((item)=>LoaderObject.__to_binding(item));
3938
3785
  } catch (e) {
3939
- context.__internal__error = "string" == typeof e ? {
3940
- name: "ModuleBuildError",
3941
- message: e
3942
- } : {
3943
- name: "ModuleBuildError",
3944
- message: e.message,
3945
- stack: "string" == typeof e.stack ? e.stack : void 0,
3946
- hideStack: "hideStack" in e ? !0 === e.hideStack || "true" === e.hideStack : void 0
3947
- };
3786
+ if ("object" != typeof e || null === e) {
3787
+ let error = Error(`(Emitted value instead of an instance of Error) ${e}`);
3788
+ error.name = "NonErrorEmittedError", context.__internal__error = error;
3789
+ } else context.__internal__error = e;
3948
3790
  }
3949
3791
  return JavaScriptTracer.endAsync({
3950
3792
  name: "run_js_loaders",
@@ -4515,7 +4357,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
4515
4357
  value: name
4516
4358
  }), Plugin;
4517
4359
  }
4518
- let APIPlugin = base_create(binding_.BuiltinPluginName.APIPlugin, ()=>{}), ArrayPushCallbackChunkFormatPlugin = base_create(binding_.BuiltinPluginName.ArrayPushCallbackChunkFormatPlugin, ()=>{}), AssetModulesPlugin = base_create(binding_.BuiltinPluginName.AssetModulesPlugin, ()=>{}, "compilation"), AsyncWebAssemblyModulesPlugin = base_create(binding_.BuiltinPluginName.AsyncWebAssemblyModulesPlugin, ()=>{}, "compilation"), BannerPlugin = base_create(binding_.BuiltinPluginName.BannerPlugin, (args)=>"string" == typeof args || "function" == typeof args ? {
4360
+ let INTERNAL_PLUGIN_NAMES = Object.keys(binding_.BuiltinPluginName), APIPlugin = base_create(binding_.BuiltinPluginName.APIPlugin, ()=>{}), ArrayPushCallbackChunkFormatPlugin = base_create(binding_.BuiltinPluginName.ArrayPushCallbackChunkFormatPlugin, ()=>{}), AssetModulesPlugin = base_create(binding_.BuiltinPluginName.AssetModulesPlugin, ()=>{}, "compilation"), AsyncWebAssemblyModulesPlugin = base_create(binding_.BuiltinPluginName.AsyncWebAssemblyModulesPlugin, ()=>{}, "compilation"), BannerPlugin = base_create(binding_.BuiltinPluginName.BannerPlugin, (args)=>"string" == typeof args || "function" == typeof args ? {
4519
4361
  banner: args
4520
4362
  } : {
4521
4363
  banner: args.banner,
@@ -8044,27 +7886,29 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
8044
7886
  let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
8045
7887
  return serverUrl ? serverUrl + (serverUrl.endsWith("/") ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix) : lazyCompilationPrefix;
8046
7888
  };
8047
- function applyPlugin(compiler, options, activeModules, filesByKey) {
7889
+ function applyPlugin(compiler, moduleToIndex, indexToModule, options, activeModules, filesByKey) {
8048
7890
  new BuiltinLazyCompilationPlugin(({ module, path })=>{
8049
- let key = encodeURIComponent(module.replace(/\\/g, "/").replace(/@/g, "_")).replace(/%(2F|3A|24|26|2B|2C|3B|3D)/g, decodeURIComponent);
7891
+ let index = moduleToIndex.get(module);
7892
+ void 0 === index && (index = moduleToIndex.size.toString(), moduleToIndex.set(module, index), indexToModule.set(index, module));
7893
+ let key = indexToModule.get(index);
8050
7894
  filesByKey.set(key, path);
8051
7895
  let active = !0 === activeModules.get(key);
8052
7896
  return {
8053
7897
  client: `${options.client || getDefaultClient(compiler)}?${encodeURIComponent(getFullServerUrl(options))}`,
8054
- data: key,
7898
+ data: index,
8055
7899
  active
8056
7900
  };
8057
7901
  }, options.cacheable ?? !0, options.entries ?? !0, options.imports ?? !0, options.test).apply(compiler);
8058
7902
  }
8059
- let lazyCompilationMiddlewareInternal = (compiler, activeModules, filesByKey, lazyCompilationPrefix)=>{
7903
+ let lazyCompilationMiddlewareInternal = (compiler, indexToModule, activeModules, filesByKey, lazyCompilationPrefix)=>{
8060
7904
  let logger = compiler.getInfrastructureLogger("LazyCompilation");
8061
7905
  return (req, res, next)=>{
8062
7906
  if (!req.url?.startsWith(lazyCompilationPrefix)) return next?.();
8063
- let keys = req.url.slice(lazyCompilationPrefix.length).split("@");
7907
+ let indices = req.url.slice(lazyCompilationPrefix.length).split("@");
8064
7908
  req.socket.setNoDelay(!0), res.setHeader("content-type", "text/event-stream"), res.writeHead(200), res.write("\n");
8065
7909
  let moduleActivated = [];
8066
- for (let key of keys){
8067
- let oldValue = activeModules.get(key) ?? !1;
7910
+ for (let index of indices){
7911
+ let key = indexToModule.get(index), oldValue = activeModules.get(key) ?? !1;
8068
7912
  activeModules.set(key, !0), oldValue || (logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
8069
7913
  }
8070
7914
  if (moduleActivated.length && compiler.watching) {
@@ -8145,21 +7989,21 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
8145
7989
  return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).createScript;
8146
7990
  }, function(queried) {
8147
7991
  return function(data) {
8148
- return queried.call(data.code, Chunk.__from_binding(data.chunk));
7992
+ return queried.call(data.code, data.chunk);
8149
7993
  };
8150
7994
  }),
8151
7995
  registerRuntimePluginLinkPreloadTaps: createTap(binding_.RegisterJsTapKind.RuntimePluginLinkPreload, function() {
8152
7996
  return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).linkPreload;
8153
7997
  }, function(queried) {
8154
7998
  return function(data) {
8155
- return queried.call(data.code, Chunk.__from_binding(data.chunk));
7999
+ return queried.call(data.code, data.chunk);
8156
8000
  };
8157
8001
  }),
8158
8002
  registerRuntimePluginLinkPrefetchTaps: createTap(binding_.RegisterJsTapKind.RuntimePluginLinkPrefetch, function() {
8159
8003
  return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).linkPrefetch;
8160
8004
  }, function(queried) {
8161
8005
  return function(data) {
8162
- return queried.call(data.code, Chunk.__from_binding(data.chunk));
8006
+ return queried.call(data.code, data.chunk);
8163
8007
  };
8164
8008
  })
8165
8009
  }), SideEffectsFlagPlugin = base_create(binding_.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, "compilation"), SizeLimitsPlugin = base_create(binding_.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
@@ -8190,7 +8034,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
8190
8034
  return "function" == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
8191
8035
  }
8192
8036
  function getChunks(chunks) {
8193
- return "function" == typeof chunks ? (chunk)=>chunks(Chunk.__from_binding(chunk)) : chunks;
8037
+ return "function" == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
8194
8038
  }
8195
8039
  let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
8196
8040
  return {
@@ -9179,6 +9023,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
9179
9023
  See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
9180
9024
  The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
9181
9025
  You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
9026
+ if (Array.isArray(browsers) && 0 === browsers.length) throw Error("Rspack cannot parse the browserslist query. This may happen when the query contains version requirements that exceed the supported range in the browserslist-rs database. Check your browserslist configuration for invalid version numbers.");
9182
9027
  return getBrowserslistTargetHandler().resolve(browsers);
9183
9028
  }
9184
9029
  ],
@@ -9436,7 +9281,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9436
9281
  }, applyExperimentsDefaults = (experiments, { production, development })=>{
9437
9282
  defaults_F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !0), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !0), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1);
9438
9283
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
9439
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.4.2"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
9284
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.4.4"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
9440
9285
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyJavascriptParserOptionsDefaults = (parserOptions)=>{
9441
9286
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
9442
9287
  "..."
@@ -9600,7 +9445,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9600
9445
  return "function" != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, ".css$1") : "[id].css";
9601
9446
  }), D(output, "hotUpdateChunkFilename", `[id].[fullhash].hot-update.${output.module ? "mjs" : "js"}`), D(output, "hotUpdateMainFilename", "[runtime].[fullhash].hot-update.json");
9602
9447
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
9603
- defaults_F(output, "hotUpdateGlobal", ()=>`webpackHotUpdate${uniqueNameId}`), defaults_F(output, "chunkLoadingGlobal", ()=>`webpackChunk${uniqueNameId}`), D(output, "assetModuleFilename", "[hash][ext][query]"), D(output, "webassemblyModuleFilename", "[hash].module.wasm"), D(output, "compareBeforeEmit", !0), defaults_F(output, "path", ()=>external_node_path_default().join(process.cwd(), "dist")), defaults_F(output, "pathinfo", ()=>development), D(output, "publicPath", tp && (tp.document || tp.importScripts) ? "auto" : ""), D(output, "hashFunction", "xxhash64"), D(output, "hashDigest", "hex"), D(output, "hashDigestLength", 16), D(output, "strictModuleErrorHandling", !1), output.library && defaults_F(output.library, "type", ()=>output.module ? "module" : "var"), defaults_F(output, "chunkFormat", ()=>{
9448
+ defaults_F(output, "hotUpdateGlobal", ()=>`webpackHotUpdate${uniqueNameId}`), defaults_F(output, "chunkLoadingGlobal", ()=>`webpackChunk${uniqueNameId}`), D(output, "assetModuleFilename", "[hash][ext][query]"), D(output, "webassemblyModuleFilename", "[hash].module.wasm"), D(output, "compareBeforeEmit", !0), defaults_F(output, "path", ()=>external_node_path_default().join(process.cwd(), "dist")), defaults_F(output, "pathinfo", ()=>development), D(output, "crossOriginLoading", !1), defaults_F(output, "scriptType", ()=>!!output.module && "module"), D(output, "publicPath", tp && (tp.document || tp.importScripts) || "module" === output.scriptType ? "auto" : ""), D(output, "hashFunction", "xxhash64"), D(output, "hashDigest", "hex"), D(output, "hashDigestLength", 16), D(output, "strictModuleErrorHandling", !1), output.library && defaults_F(output.library, "type", ()=>output.module ? "module" : "var"), defaults_F(output, "chunkFormat", ()=>{
9604
9449
  if (tp) {
9605
9450
  let helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
9606
9451
  if (output.module) {
@@ -9660,7 +9505,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9660
9505
  if (tp.globalThis) return "globalThis";
9661
9506
  }
9662
9507
  return "self";
9663
- }), D(output, "importFunctionName", "import"), D(output, "importMetaName", "import.meta"), defaults_F(output, "clean", ()=>!!output.clean), D(output, "crossOriginLoading", !1), D(output, "workerPublicPath", ""), D(output, "sourceMapFilename", "[file].map[query]"), defaults_F(output, "scriptType", ()=>!!output.module && "module"), D(output, "charset", !futureDefaults), D(output, "chunkLoadTimeout", 120000);
9508
+ }), D(output, "importFunctionName", "import"), D(output, "importMetaName", "import.meta"), defaults_F(output, "clean", ()=>!!output.clean), D(output, "workerPublicPath", ""), D(output, "sourceMapFilename", "[file].map[query]"), D(output, "charset", !futureDefaults), D(output, "chunkLoadTimeout", 120000);
9664
9509
  let { trustedTypes } = output;
9665
9510
  trustedTypes && (defaults_F(trustedTypes, "policyName", ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, "_") || "webpack"), D(trustedTypes, "onPolicyCreationFailure", "stop"));
9666
9511
  let forEachEntry = (fn)=>{
@@ -10342,7 +10187,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10342
10187
  },
10343
10188
  arm: "gnueabihf"
10344
10189
  }
10345
- }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.4.2", getAddonPlatformArchAbi = ()=>{
10190
+ }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.4.4", getAddonPlatformArchAbi = ()=>{
10346
10191
  let { platform, arch } = process, binding = "";
10347
10192
  binding += platform;
10348
10193
  let abi = NodePlatformArchToAbi[platform][arch];
@@ -10573,7 +10418,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10573
10418
  }, function(queried) {
10574
10419
  return function({ chunk, runtimeRequirements }) {
10575
10420
  let set = __from_binding_runtime_globals(runtimeRequirements);
10576
- return queried.call(Chunk.__from_binding(chunk), set), {
10421
+ return queried.call(chunk, set), {
10577
10422
  runtimeRequirements: __to_binding_runtime_globals(set)
10578
10423
  };
10579
10424
  };
@@ -10581,8 +10426,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10581
10426
  registerCompilationRuntimeRequirementInTreeTaps: createMapTap(binding_.RegisterJsTapKind.CompilationRuntimeRequirementInTree, function() {
10582
10427
  return getCompiler().__internal__get_compilation().hooks.runtimeRequirementInTree;
10583
10428
  }, function(queried) {
10584
- return function({ chunk: chunkBinding, allRuntimeRequirements, runtimeRequirements }) {
10585
- let set = __from_binding_runtime_globals(runtimeRequirements), all = __from_binding_runtime_globals(allRuntimeRequirements), chunk = Chunk.__from_binding(chunkBinding), customRuntimeGlobals = new Set(), originalAdd = all.add.bind(all), add = function(r) {
10429
+ return function({ chunk, allRuntimeRequirements, runtimeRequirements }) {
10430
+ let set = __from_binding_runtime_globals(runtimeRequirements), all = __from_binding_runtime_globals(allRuntimeRequirements), customRuntimeGlobals = new Set(), originalAdd = all.add.bind(all), add = function(r) {
10586
10431
  return all.has(r) ? all : (isReservedRuntimeGlobal(r) || customRuntimeGlobals.add(r), originalAdd(r));
10587
10432
  };
10588
10433
  for (let r of (all.add = add.bind(add), set))queried.for(r).call(chunk, all);
@@ -10597,7 +10442,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10597
10442
  }, function(queried) {
10598
10443
  return function({ module, chunk }) {
10599
10444
  let originSource = module.source?.source;
10600
- queried.call(module, Chunk.__from_binding(chunk));
10445
+ queried.call(module, chunk);
10601
10446
  let newSource = module.source?.source;
10602
10447
  if (newSource && newSource !== originSource) return module;
10603
10448
  };
@@ -10628,7 +10473,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10628
10473
  }, function(queried) {
10629
10474
  return function({ entry, id, codegenResults, runtimeModules }) {
10630
10475
  try {
10631
- let __nested_webpack_require_4944_4963__ = (id)=>{
10476
+ let __nested_webpack_require_4786_4805__ = (id)=>{
10632
10477
  let cached = moduleCache[id];
10633
10478
  if (void 0 !== cached) {
10634
10479
  if (cached.error) throw cached.error;
@@ -10642,7 +10487,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10642
10487
  loaded: !1,
10643
10488
  error: void 0
10644
10489
  },
10645
- require: __nested_webpack_require_4944_4963__
10490
+ require: __nested_webpack_require_4786_4805__
10646
10491
  };
10647
10492
  for (let handler of interceptModuleExecution)handler(execOptions);
10648
10493
  let result = codegenResults.map[id]["build time"], moduleObject = execOptions.module;
@@ -10650,11 +10495,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10650
10495
  codeGenerationResult: new CodeGenerationResult(result),
10651
10496
  moduleObject
10652
10497
  }, {
10653
- __webpack_require__: __nested_webpack_require_4944_4963__
10498
+ __webpack_require__: __nested_webpack_require_4786_4805__
10654
10499
  }), "Compilation.hooks.executeModule"), moduleObject.loaded = !0, moduleObject.exports;
10655
- }, moduleCache = __nested_webpack_require_4944_4963__[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, "")] = {}, interceptModuleExecution = __nested_webpack_require_4944_4963__[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, "")] = [];
10656
- for (let runtimeModule of runtimeModules)__nested_webpack_require_4944_4963__(runtimeModule);
10657
- let executeResult = __nested_webpack_require_4944_4963__(entry);
10500
+ }, moduleCache = __nested_webpack_require_4786_4805__[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, "")] = {}, interceptModuleExecution = __nested_webpack_require_4786_4805__[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, "")] = [];
10501
+ for (let runtimeModule of runtimeModules)__nested_webpack_require_4786_4805__(runtimeModule);
10502
+ let executeResult = __nested_webpack_require_4786_4805__(entry);
10658
10503
  getCompiler().__internal__get_module_execution_results_map().set(id, executeResult);
10659
10504
  } catch (e) {
10660
10505
  throw getCompiler().__internal__get_module_execution_results_map().set(id, e), e;
@@ -10703,14 +10548,14 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10703
10548
  let digestResult;
10704
10549
  if (!getCompiler().options.output.hashFunction) throw Error("'output.hashFunction' cannot be undefined");
10705
10550
  let hash = createHash(getCompiler().options.output.hashFunction);
10706
- return queried.call(Chunk.__from_binding(chunk), hash), "string" == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
10551
+ return queried.call(chunk, hash), "string" == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
10707
10552
  };
10708
10553
  }),
10709
10554
  registerCompilationChunkAssetTaps: createTap(binding_.RegisterJsTapKind.CompilationChunkAsset, function() {
10710
10555
  return getCompiler().__internal__get_compilation().hooks.chunkAsset;
10711
10556
  }, function(queried) {
10712
10557
  return function({ chunk, filename }) {
10713
- return queried.call(Chunk.__from_binding(chunk), filename);
10558
+ return queried.call(chunk, filename);
10714
10559
  };
10715
10560
  }),
10716
10561
  registerCompilationProcessAssetsTaps: createTap(binding_.RegisterJsTapKind.CompilationProcessAssets, function() {
@@ -10947,7 +10792,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10947
10792
  let digestResult;
10948
10793
  if (!getCompiler().options.output.hashFunction) throw Error("'output.hashFunction' cannot be undefined");
10949
10794
  let hash = createHash(getCompiler().options.output.hashFunction);
10950
- return queried.call(Chunk.__from_binding(chunk), hash), "string" == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
10795
+ return queried.call(chunk, hash), "string" == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
10951
10796
  };
10952
10797
  })
10953
10798
  }), createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMapTap)=>({
@@ -11641,7 +11486,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
11641
11486
  obj.children = this.stats.map((stat, idx)=>{
11642
11487
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
11643
11488
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
11644
- }), childOptions.version && (obj.rspackVersion = "1.4.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11489
+ }), childOptions.version && (obj.rspackVersion = "1.4.4", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11645
11490
  let mapError = (j, obj)=>({
11646
11491
  ...obj,
11647
11492
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -12544,7 +12389,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
12544
12389
  object.hash = context.getStatsCompilation(compilation).hash;
12545
12390
  },
12546
12391
  version: (object)=>{
12547
- object.version = "5.75.0", object.rspackVersion = "1.4.2";
12392
+ object.version = "5.75.0", object.rspackVersion = "1.4.4";
12548
12393
  },
12549
12394
  env: (object, _compilation, _context, { _env })=>{
12550
12395
  object.env = _env;
@@ -16024,7 +15869,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
16024
15869
  let _options = JSON.stringify(options || {});
16025
15870
  return binding_default().transform(source, _options);
16026
15871
  }
16027
- let exports_rspackVersion = "1.4.2", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
15872
+ let exports_rspackVersion = "1.4.4", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
16028
15873
  getNormalizedRspackOptions: getNormalizedRspackOptions,
16029
15874
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
16030
15875
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -16125,8 +15970,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
16125
15970
  ...c.options.experiments.lazyCompilation
16126
15971
  }, prefix = options.prefix || LAZY_COMPILATION_PREFIX;
16127
15972
  options.prefix = `${prefix}__${i++}`;
16128
- let activeModules = new Map(), filesByKey = new Map();
16129
- middlewareByCompiler.set(options.prefix, lazyCompilationMiddlewareInternal(compiler, activeModules, filesByKey, options.prefix)), applyPlugin(c, options, activeModules, filesByKey);
15973
+ let activeModules = new Map(), filesByKey = new Map(), indexToModule = new Map(), moduleToIndex = new Map();
15974
+ middlewareByCompiler.set(options.prefix, lazyCompilationMiddlewareInternal(compiler, indexToModule, activeModules, filesByKey, options.prefix)), applyPlugin(c, moduleToIndex, indexToModule, options, activeModules, filesByKey);
16130
15975
  }
16131
15976
  let keys = [
16132
15977
  ...middlewareByCompiler.keys()
@@ -16139,10 +15984,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
16139
15984
  };
16140
15985
  }
16141
15986
  if (!compiler.options.experiments.lazyCompilation) return noop;
16142
- let activeModules = new Map(), filesByKey = new Map(), options = {
15987
+ let activeModules = new Map(), filesByKey = new Map(), indexToMap = new Map(), moduleToIndex = new Map(), options = {
16143
15988
  ...compiler.options.experiments.lazyCompilation
16144
15989
  };
16145
- return applyPlugin(compiler, options, activeModules, filesByKey), lazyCompilationMiddlewareInternal(compiler, activeModules, filesByKey, options.prefix || LAZY_COMPILATION_PREFIX);
15990
+ return applyPlugin(compiler, moduleToIndex, indexToMap, options, activeModules, filesByKey), lazyCompilationMiddlewareInternal(compiler, indexToMap, activeModules, filesByKey, options.prefix || LAZY_COMPILATION_PREFIX);
16146
15991
  },
16147
15992
  swc: {
16148
15993
  minify: minify,
@@ -16156,7 +16001,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
16156
16001
  return binding_default().transformSync(source, _options);
16157
16002
  }
16158
16003
  },
16159
- CssChunkingPlugin: CssChunkingPlugin
16004
+ CssChunkingPlugin: CssChunkingPlugin,
16005
+ createNativePlugin: function(name, resolve, affectedHooks) {
16006
+ if (INTERNAL_PLUGIN_NAMES.includes(name)) throw Error(`Cannot register native plugin with name '${name}', it conflicts with internal plugin names.`);
16007
+ return base_create(name, resolve, affectedHooks);
16008
+ }
16160
16009
  };
16161
16010
  function createCompiler(userOptions) {
16162
16011
  let options = getNormalizedRspackOptions(userOptions);