@rspack/core 1.2.0-beta.0 → 1.2.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 (86) hide show
  1. package/compiled/browserslist/index.js +28 -28
  2. package/compiled/graceful-fs/index.js +18 -18
  3. package/compiled/watchpack/index.js +34 -34
  4. package/compiled/webpack-sources/index.js +76 -76
  5. package/compiled/zod/index.js +30 -30
  6. package/dist/ChunkGraph.d.ts +1 -0
  7. package/dist/ChunkGroup.d.ts +2 -0
  8. package/dist/Compiler.d.ts +30 -2
  9. package/dist/ResolverFactory.d.ts +1 -1
  10. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  11. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  13. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/SourceMapDevToolPlugin.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 +30 -0
  65. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
  66. package/dist/builtin-plugin/{HtmlRspackPlugin.d.ts → html-plugin/options.d.ts} +5 -47
  67. package/dist/builtin-plugin/html-plugin/plugin.d.ts +25 -0
  68. package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
  69. package/dist/builtin-plugin/index.d.ts +1 -1
  70. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +1 -1
  71. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  72. package/dist/config/normalization.d.ts +3 -2
  73. package/dist/config/types.d.ts +32 -52
  74. package/dist/config/zod.d.ts +67 -62
  75. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  76. package/dist/exports.d.ts +2 -3
  77. package/dist/index.js +1941 -1670
  78. package/dist/stats/statsFactoryUtils.d.ts +9 -0
  79. package/dist/taps/compilation.d.ts +2 -0
  80. package/dist/taps/compiler.d.ts +2 -0
  81. package/dist/taps/contextModuleFactory.d.ts +2 -0
  82. package/dist/taps/index.d.ts +6 -0
  83. package/dist/taps/javascriptModules.d.ts +2 -0
  84. package/dist/taps/normalModuleFactory.d.ts +2 -0
  85. package/dist/taps/types.d.ts +11 -0
  86. package/package.json +9 -4
package/dist/index.js CHANGED
@@ -821,40 +821,40 @@ var liteTapable = __toESM(require("@rspack/lite-tapable"));
821
821
  // src/Dependency.ts
822
822
  var Dependency = class _Dependency {
823
823
  #inner;
824
- static __from_binding(binding3) {
825
- return new _Dependency(binding3);
824
+ static __from_binding(binding8) {
825
+ return new _Dependency(binding8);
826
826
  }
827
827
  static __to_binding(data) {
828
828
  return data.#inner;
829
829
  }
830
- constructor(binding3) {
831
- this.#inner = binding3;
830
+ constructor(binding8) {
831
+ this.#inner = binding8;
832
832
  Object.defineProperties(this, {
833
833
  type: {
834
834
  enumerable: true,
835
835
  get() {
836
- return binding3.type;
836
+ return binding8.type;
837
837
  }
838
838
  },
839
839
  category: {
840
840
  enumerable: true,
841
841
  get() {
842
- return binding3.category;
842
+ return binding8.category;
843
843
  }
844
844
  },
845
845
  request: {
846
846
  enumerable: true,
847
847
  get() {
848
- return binding3.request;
848
+ return binding8.request;
849
849
  }
850
850
  },
851
851
  critical: {
852
852
  enumerable: true,
853
853
  get() {
854
- return binding3.critical;
854
+ return binding8.critical;
855
855
  },
856
856
  set(val) {
857
- binding3.critical = val;
857
+ binding8.critical = val;
858
858
  }
859
859
  }
860
860
  });
@@ -864,25 +864,25 @@ var Dependency = class _Dependency {
864
864
  // src/DependenciesBlock.ts
865
865
  var DependenciesBlock = class _DependenciesBlock {
866
866
  #binding;
867
- static __from_binding(binding3) {
868
- return new _DependenciesBlock(binding3);
867
+ static __from_binding(binding8) {
868
+ return new _DependenciesBlock(binding8);
869
869
  }
870
870
  static __to_binding(block) {
871
871
  return block.#binding;
872
872
  }
873
- constructor(binding3) {
874
- this.#binding = binding3;
873
+ constructor(binding8) {
874
+ this.#binding = binding8;
875
875
  Object.defineProperties(this, {
876
876
  dependencies: {
877
877
  enumerable: true,
878
878
  get() {
879
- return binding3.dependencies.map((d) => Dependency.__from_binding(d));
879
+ return binding8.dependencies.map((d) => Dependency.__from_binding(d));
880
880
  }
881
881
  },
882
882
  blocks: {
883
883
  enumerable: true,
884
884
  get() {
885
- return binding3.blocks.map((b) => _DependenciesBlock.__from_binding(b));
885
+ return binding8.blocks.map((b) => _DependenciesBlock.__from_binding(b));
886
886
  }
887
887
  }
888
888
  });
@@ -935,49 +935,49 @@ var JsSource = class extends import_webpack_sources.Source {
935
935
  // src/Module.ts
936
936
  var ContextModuleFactoryBeforeResolveData = class _ContextModuleFactoryBeforeResolveData {
937
937
  #inner;
938
- static __from_binding(binding3) {
939
- return new _ContextModuleFactoryBeforeResolveData(binding3);
938
+ static __from_binding(binding8) {
939
+ return new _ContextModuleFactoryBeforeResolveData(binding8);
940
940
  }
941
941
  static __to_binding(data) {
942
942
  return data.#inner;
943
943
  }
944
- constructor(binding3) {
945
- this.#inner = binding3;
944
+ constructor(binding8) {
945
+ this.#inner = binding8;
946
946
  Object.defineProperties(this, {
947
947
  context: {
948
948
  enumerable: true,
949
949
  get() {
950
- return binding3.context;
950
+ return binding8.context;
951
951
  },
952
952
  set(val) {
953
- binding3.context = val;
953
+ binding8.context = val;
954
954
  }
955
955
  },
956
956
  request: {
957
957
  enumerable: true,
958
958
  get() {
959
- return binding3.request;
959
+ return binding8.request;
960
960
  },
961
961
  set(val) {
962
- binding3.request = val;
962
+ binding8.request = val;
963
963
  }
964
964
  },
965
965
  regExp: {
966
966
  enumerable: true,
967
967
  get() {
968
- return binding3.regExp;
968
+ return binding8.regExp;
969
969
  },
970
970
  set(val) {
971
- binding3.regExp = val;
971
+ binding8.regExp = val;
972
972
  }
973
973
  },
974
974
  recursive: {
975
975
  enumerable: true,
976
976
  get() {
977
- return binding3.recursive;
977
+ return binding8.recursive;
978
978
  },
979
979
  set(val) {
980
- binding3.recursive = val;
980
+ binding8.recursive = val;
981
981
  }
982
982
  }
983
983
  });
@@ -985,64 +985,64 @@ var ContextModuleFactoryBeforeResolveData = class _ContextModuleFactoryBeforeRes
985
985
  };
986
986
  var ContextModuleFactoryAfterResolveData = class _ContextModuleFactoryAfterResolveData {
987
987
  #inner;
988
- static __from_binding(binding3) {
989
- return new _ContextModuleFactoryAfterResolveData(binding3);
988
+ static __from_binding(binding8) {
989
+ return new _ContextModuleFactoryAfterResolveData(binding8);
990
990
  }
991
991
  static __to_binding(data) {
992
992
  return data.#inner;
993
993
  }
994
- constructor(binding3) {
995
- this.#inner = binding3;
994
+ constructor(binding8) {
995
+ this.#inner = binding8;
996
996
  Object.defineProperties(this, {
997
997
  resource: {
998
998
  enumerable: true,
999
999
  get() {
1000
- return binding3.resource;
1000
+ return binding8.resource;
1001
1001
  },
1002
1002
  set(val) {
1003
- binding3.resource = val;
1003
+ binding8.resource = val;
1004
1004
  }
1005
1005
  },
1006
1006
  context: {
1007
1007
  enumerable: true,
1008
1008
  get() {
1009
- return binding3.context;
1009
+ return binding8.context;
1010
1010
  },
1011
1011
  set(val) {
1012
- binding3.context = val;
1012
+ binding8.context = val;
1013
1013
  }
1014
1014
  },
1015
1015
  request: {
1016
1016
  enumerable: true,
1017
1017
  get() {
1018
- return binding3.request;
1018
+ return binding8.request;
1019
1019
  },
1020
1020
  set(val) {
1021
- binding3.request = val;
1021
+ binding8.request = val;
1022
1022
  }
1023
1023
  },
1024
1024
  regExp: {
1025
1025
  enumerable: true,
1026
1026
  get() {
1027
- return binding3.regExp;
1027
+ return binding8.regExp;
1028
1028
  },
1029
1029
  set(val) {
1030
- binding3.regExp = val;
1030
+ binding8.regExp = val;
1031
1031
  }
1032
1032
  },
1033
1033
  recursive: {
1034
1034
  enumerable: true,
1035
1035
  get() {
1036
- return binding3.recursive;
1036
+ return binding8.recursive;
1037
1037
  },
1038
1038
  set(val) {
1039
- binding3.recursive = val;
1039
+ binding8.recursive = val;
1040
1040
  }
1041
1041
  },
1042
1042
  dependencies: {
1043
1043
  enumerable: true,
1044
1044
  get() {
1045
- return binding3.dependencies.map(
1045
+ return binding8.dependencies.map(
1046
1046
  (dep) => Dependency.__from_binding(dep)
1047
1047
  );
1048
1048
  }
@@ -1053,13 +1053,13 @@ var ContextModuleFactoryAfterResolveData = class _ContextModuleFactoryAfterResol
1053
1053
  var MODULE_MAPPINGS = /* @__PURE__ */ new WeakMap();
1054
1054
  var Module = class _Module {
1055
1055
  #inner;
1056
- static __from_binding(binding3) {
1057
- let module2 = MODULE_MAPPINGS.get(binding3);
1056
+ static __from_binding(binding8) {
1057
+ let module2 = MODULE_MAPPINGS.get(binding8);
1058
1058
  if (module2) {
1059
1059
  return module2;
1060
1060
  }
1061
- module2 = new _Module(binding3);
1062
- MODULE_MAPPINGS.set(binding3, module2);
1061
+ module2 = new _Module(binding8);
1062
+ MODULE_MAPPINGS.set(binding8, module2);
1063
1063
  return module2;
1064
1064
  }
1065
1065
  static __to_binding(module2) {
@@ -1183,13 +1183,13 @@ var CodeGenerationResult = class {
1183
1183
  var CHUNK_GROUP_MAPPINGS = /* @__PURE__ */ new WeakMap();
1184
1184
  var ChunkGroup = class _ChunkGroup {
1185
1185
  #inner;
1186
- static __from_binding(binding3) {
1187
- let chunkGroup = CHUNK_GROUP_MAPPINGS.get(binding3);
1186
+ static __from_binding(binding8) {
1187
+ let chunkGroup = CHUNK_GROUP_MAPPINGS.get(binding8);
1188
1188
  if (chunkGroup) {
1189
1189
  return chunkGroup;
1190
1190
  }
1191
- chunkGroup = new _ChunkGroup(binding3);
1192
- CHUNK_GROUP_MAPPINGS.set(binding3, chunkGroup);
1191
+ chunkGroup = new _ChunkGroup(binding8);
1192
+ CHUNK_GROUP_MAPPINGS.set(binding8, chunkGroup);
1193
1193
  return chunkGroup;
1194
1194
  }
1195
1195
  constructor(inner) {
@@ -1199,7 +1199,7 @@ var ChunkGroup = class _ChunkGroup {
1199
1199
  enumerable: true,
1200
1200
  get: () => {
1201
1201
  return this.#inner.chunks.map(
1202
- (binding3) => Chunk.__from_binding(binding3)
1202
+ (binding8) => Chunk.__from_binding(binding8)
1203
1203
  );
1204
1204
  }
1205
1205
  },
@@ -1230,108 +1230,114 @@ var ChunkGroup = class _ChunkGroup {
1230
1230
  return this.#inner.getFiles();
1231
1231
  }
1232
1232
  getParents() {
1233
- return this.#inner.getParents().map((binding3) => _ChunkGroup.__from_binding(binding3));
1233
+ return this.#inner.getParents().map((binding8) => _ChunkGroup.__from_binding(binding8));
1234
1234
  }
1235
1235
  isInitial() {
1236
1236
  return this.#inner.isInitial();
1237
1237
  }
1238
+ getModulePreOrderIndex(module2) {
1239
+ return this.#inner.getModulePreOrderIndex(Module.__to_binding(module2));
1240
+ }
1241
+ getModulePostOrderIndex(module2) {
1242
+ return this.#inner.getModulePostOrderIndex(Module.__to_binding(module2));
1243
+ }
1238
1244
  };
1239
1245
 
1240
1246
  // src/Chunk.ts
1241
1247
  var CHUNK_MAPPINGS = /* @__PURE__ */ new WeakMap();
1242
1248
  var Chunk = class _Chunk {
1243
1249
  #inner;
1244
- static __from_binding(binding3) {
1245
- let chunk = CHUNK_MAPPINGS.get(binding3);
1250
+ static __from_binding(binding8) {
1251
+ let chunk = CHUNK_MAPPINGS.get(binding8);
1246
1252
  if (chunk) {
1247
1253
  return chunk;
1248
1254
  }
1249
- chunk = new _Chunk(binding3);
1250
- CHUNK_MAPPINGS.set(binding3, chunk);
1255
+ chunk = new _Chunk(binding8);
1256
+ CHUNK_MAPPINGS.set(binding8, chunk);
1251
1257
  return chunk;
1252
1258
  }
1253
1259
  static __to_binding(chunk) {
1254
1260
  return chunk.#inner;
1255
1261
  }
1256
- constructor(binding3) {
1257
- this.#inner = binding3;
1262
+ constructor(binding8) {
1263
+ this.#inner = binding8;
1258
1264
  Object.defineProperties(this, {
1259
1265
  name: {
1260
1266
  enumerable: true,
1261
1267
  get: () => {
1262
- return binding3.name;
1268
+ return binding8.name;
1263
1269
  }
1264
1270
  },
1265
1271
  id: {
1266
1272
  enumerable: true,
1267
1273
  get: () => {
1268
- return binding3.id;
1274
+ return binding8.id;
1269
1275
  }
1270
1276
  },
1271
1277
  ids: {
1272
1278
  enumerable: true,
1273
1279
  get: () => {
1274
- return binding3.ids;
1280
+ return binding8.ids;
1275
1281
  }
1276
1282
  },
1277
1283
  idNameHints: {
1278
1284
  enumerable: true,
1279
1285
  get: () => {
1280
- return binding3.idNameHints;
1286
+ return binding8.idNameHints;
1281
1287
  }
1282
1288
  },
1283
1289
  filenameTemplate: {
1284
1290
  enumerable: true,
1285
1291
  get: () => {
1286
- return binding3.filenameTemplate;
1292
+ return binding8.filenameTemplate;
1287
1293
  }
1288
1294
  },
1289
1295
  cssFilenameTemplate: {
1290
1296
  enumerable: true,
1291
1297
  get: () => {
1292
- return binding3.cssFilenameTemplate;
1298
+ return binding8.cssFilenameTemplate;
1293
1299
  }
1294
1300
  },
1295
1301
  files: {
1296
1302
  enumerable: true,
1297
1303
  get: () => {
1298
- return new Set(binding3.files);
1304
+ return new Set(binding8.files);
1299
1305
  }
1300
1306
  },
1301
1307
  runtime: {
1302
1308
  enumerable: true,
1303
1309
  get: () => {
1304
- return new Set(binding3.runtime);
1310
+ return new Set(binding8.runtime);
1305
1311
  }
1306
1312
  },
1307
1313
  hash: {
1308
1314
  enumerable: true,
1309
1315
  get: () => {
1310
- return binding3.hash;
1316
+ return binding8.hash;
1311
1317
  }
1312
1318
  },
1313
1319
  contentHash: {
1314
1320
  enumerable: true,
1315
1321
  get: () => {
1316
- return binding3.contentHash;
1322
+ return binding8.contentHash;
1317
1323
  }
1318
1324
  },
1319
1325
  renderedHash: {
1320
1326
  enumerable: true,
1321
1327
  get: () => {
1322
- return binding3.renderedHash;
1328
+ return binding8.renderedHash;
1323
1329
  }
1324
1330
  },
1325
1331
  chunkReason: {
1326
1332
  enumerable: true,
1327
1333
  get: () => {
1328
- return binding3.chunkReason;
1334
+ return binding8.chunkReason;
1329
1335
  }
1330
1336
  },
1331
1337
  auxiliaryFiles: {
1332
1338
  enumerable: true,
1333
1339
  get: () => {
1334
- return new Set(binding3.auxiliaryFiles);
1340
+ return new Set(binding8.auxiliaryFiles);
1335
1341
  }
1336
1342
  }
1337
1343
  });
@@ -1347,7 +1353,7 @@ var Chunk = class _Chunk {
1347
1353
  }
1348
1354
  get groupsIterable() {
1349
1355
  return new Set(
1350
- this.#inner.groups().map((binding3) => ChunkGroup.__from_binding(binding3))
1356
+ this.#inner.groups().map((binding8) => ChunkGroup.__from_binding(binding8))
1351
1357
  );
1352
1358
  }
1353
1359
  getChunkMaps(realHash) {
@@ -1379,17 +1385,17 @@ var Chunk = class _Chunk {
1379
1385
  }
1380
1386
  getAllAsyncChunks() {
1381
1387
  return new Set(
1382
- this.#inner.getAllAsyncChunks().map((binding3) => _Chunk.__from_binding(binding3))
1388
+ this.#inner.getAllAsyncChunks().map((binding8) => _Chunk.__from_binding(binding8))
1383
1389
  );
1384
1390
  }
1385
1391
  getAllInitialChunks() {
1386
1392
  return new Set(
1387
- this.#inner.getAllInitialChunks().map((binding3) => _Chunk.__from_binding(binding3))
1393
+ this.#inner.getAllInitialChunks().map((binding8) => _Chunk.__from_binding(binding8))
1388
1394
  );
1389
1395
  }
1390
1396
  getAllReferencedChunks() {
1391
1397
  return new Set(
1392
- this.#inner.getAllReferencedChunks().map((binding3) => _Chunk.__from_binding(binding3))
1398
+ this.#inner.getAllReferencedChunks().map((binding8) => _Chunk.__from_binding(binding8))
1393
1399
  );
1394
1400
  }
1395
1401
  };
@@ -1397,35 +1403,38 @@ var Chunk = class _Chunk {
1397
1403
  // src/ChunkGraph.ts
1398
1404
  var ChunkGraph = class _ChunkGraph {
1399
1405
  #inner;
1400
- static __from_binding(binding3) {
1401
- return new _ChunkGraph(binding3);
1406
+ static __from_binding(binding8) {
1407
+ return new _ChunkGraph(binding8);
1402
1408
  }
1403
- constructor(binding3) {
1404
- this.#inner = binding3;
1409
+ constructor(binding8) {
1410
+ this.#inner = binding8;
1405
1411
  }
1406
1412
  getChunkModules(chunk) {
1407
- return this.#inner.getChunkModules(Chunk.__to_binding(chunk)).map((binding3) => Module.__from_binding(binding3));
1413
+ return this.#inner.getChunkModules(Chunk.__to_binding(chunk)).map((binding8) => Module.__from_binding(binding8));
1408
1414
  }
1409
1415
  getChunkModulesIterable(chunk) {
1410
- return this.#inner.getChunkModules(Chunk.__to_binding(chunk)).map((binding3) => Module.__from_binding(binding3));
1416
+ return this.#inner.getChunkModules(Chunk.__to_binding(chunk)).map((binding8) => Module.__from_binding(binding8));
1411
1417
  }
1412
1418
  getChunkEntryModulesIterable(chunk) {
1413
- return this.#inner.getChunkEntryModules(Chunk.__to_binding(chunk)).map((binding3) => Module.__from_binding(binding3));
1419
+ return this.#inner.getChunkEntryModules(Chunk.__to_binding(chunk)).map((binding8) => Module.__from_binding(binding8));
1420
+ }
1421
+ getNumberOfEntryModules(chunk) {
1422
+ return this.#inner.getNumberOfEntryModules(Chunk.__to_binding(chunk));
1414
1423
  }
1415
1424
  getChunkEntryDependentChunksIterable(chunk) {
1416
- return this.#inner.getChunkEntryDependentChunksIterable(Chunk.__to_binding(chunk)).map((binding3) => Chunk.__from_binding(binding3));
1425
+ return this.#inner.getChunkEntryDependentChunksIterable(Chunk.__to_binding(chunk)).map((binding8) => Chunk.__from_binding(binding8));
1417
1426
  }
1418
1427
  getChunkModulesIterableBySourceType(chunk, sourceType) {
1419
1428
  return this.#inner.getChunkModulesIterableBySourceType(
1420
1429
  Chunk.__to_binding(chunk),
1421
1430
  sourceType
1422
- ).map((binding3) => Module.__from_binding(binding3));
1431
+ ).map((binding8) => Module.__from_binding(binding8));
1423
1432
  }
1424
1433
  getModuleChunks(module2) {
1425
- return this.#inner.getModuleChunks(Module.__to_binding(module2)).map((binding3) => Chunk.__from_binding(binding3));
1434
+ return this.#inner.getModuleChunks(Module.__to_binding(module2)).map((binding8) => Chunk.__from_binding(binding8));
1426
1435
  }
1427
1436
  getModuleChunksIterable(module2) {
1428
- return this.#inner.getModuleChunks(Module.__to_binding(module2)).map((binding3) => Chunk.__from_binding(binding3));
1437
+ return this.#inner.getModuleChunks(Module.__to_binding(module2)).map((binding8) => Chunk.__from_binding(binding8));
1429
1438
  }
1430
1439
  getModuleId(module2) {
1431
1440
  return this.#inner.getModuleId(Module.__to_binding(module2));
@@ -1436,18 +1445,18 @@ var ChunkGraph = class _ChunkGraph {
1436
1445
  var ENTRYPOINT_MAPPINGS = /* @__PURE__ */ new WeakMap();
1437
1446
  var Entrypoint = class _Entrypoint extends ChunkGroup {
1438
1447
  #inner;
1439
- static __from_binding(binding3) {
1440
- let entrypoint = ENTRYPOINT_MAPPINGS.get(binding3);
1448
+ static __from_binding(binding8) {
1449
+ let entrypoint = ENTRYPOINT_MAPPINGS.get(binding8);
1441
1450
  if (entrypoint) {
1442
1451
  return entrypoint;
1443
1452
  }
1444
- entrypoint = new _Entrypoint(binding3);
1445
- ENTRYPOINT_MAPPINGS.set(binding3, entrypoint);
1453
+ entrypoint = new _Entrypoint(binding8);
1454
+ ENTRYPOINT_MAPPINGS.set(binding8, entrypoint);
1446
1455
  return entrypoint;
1447
1456
  }
1448
- constructor(binding3) {
1449
- super(binding3);
1450
- this.#inner = binding3;
1457
+ constructor(binding8) {
1458
+ super(binding8);
1459
+ this.#inner = binding8;
1451
1460
  }
1452
1461
  getRuntimeChunk() {
1453
1462
  const chunkBinding = this.#inner.getRuntimeChunk();
@@ -1471,11 +1480,11 @@ var cutOffLoaderExecution = (stack) => cutOffByFlag(stack, loaderFlag);
1471
1480
  // src/ExportsInfo.ts
1472
1481
  var ExportsInfo = class _ExportsInfo {
1473
1482
  #inner;
1474
- static __from_binding(binding3) {
1475
- return new _ExportsInfo(binding3);
1483
+ static __from_binding(binding8) {
1484
+ return new _ExportsInfo(binding8);
1476
1485
  }
1477
- constructor(binding3) {
1478
- this.#inner = binding3;
1486
+ constructor(binding8) {
1487
+ this.#inner = binding8;
1479
1488
  }
1480
1489
  isUsed(runtime) {
1481
1490
  return this.#inner.isUsed(runtime);
@@ -1495,31 +1504,31 @@ var ExportsInfo = class _ExportsInfo {
1495
1504
  var MODULE_GRAPH_CONNECTION_MAPPINGS = /* @__PURE__ */ new WeakMap();
1496
1505
  var ModuleGraphConnection = class _ModuleGraphConnection {
1497
1506
  #inner;
1498
- static __from_binding(binding3) {
1499
- let connection = MODULE_GRAPH_CONNECTION_MAPPINGS.get(binding3);
1507
+ static __from_binding(binding8) {
1508
+ let connection = MODULE_GRAPH_CONNECTION_MAPPINGS.get(binding8);
1500
1509
  if (connection) {
1501
1510
  return connection;
1502
1511
  }
1503
- connection = new _ModuleGraphConnection(binding3);
1504
- MODULE_GRAPH_CONNECTION_MAPPINGS.set(binding3, connection);
1512
+ connection = new _ModuleGraphConnection(binding8);
1513
+ MODULE_GRAPH_CONNECTION_MAPPINGS.set(binding8, connection);
1505
1514
  return connection;
1506
1515
  }
1507
1516
  static __to_binding(data) {
1508
1517
  return data.#inner;
1509
1518
  }
1510
- constructor(binding3) {
1511
- this.#inner = binding3;
1519
+ constructor(binding8) {
1520
+ this.#inner = binding8;
1512
1521
  Object.defineProperties(this, {
1513
1522
  module: {
1514
1523
  enumerable: true,
1515
1524
  get() {
1516
- return binding3.module ? Module.__from_binding(binding3.module) : null;
1525
+ return binding8.module ? Module.__from_binding(binding8.module) : null;
1517
1526
  }
1518
1527
  },
1519
1528
  dependency: {
1520
1529
  enumerable: true,
1521
1530
  get() {
1522
- return Dependency.__from_binding(binding3.dependency);
1531
+ return Dependency.__from_binding(binding8.dependency);
1523
1532
  }
1524
1533
  }
1525
1534
  });
@@ -1528,26 +1537,26 @@ var ModuleGraphConnection = class _ModuleGraphConnection {
1528
1537
 
1529
1538
  // src/ModuleGraph.ts
1530
1539
  var ModuleGraph = class _ModuleGraph {
1531
- static __from_binding(binding3) {
1532
- return new _ModuleGraph(binding3);
1540
+ static __from_binding(binding8) {
1541
+ return new _ModuleGraph(binding8);
1533
1542
  }
1534
1543
  #inner;
1535
- constructor(binding3) {
1536
- this.#inner = binding3;
1544
+ constructor(binding8) {
1545
+ this.#inner = binding8;
1537
1546
  }
1538
1547
  getModule(dependency) {
1539
- const binding3 = this.#inner.getModule(Dependency.__to_binding(dependency));
1540
- return binding3 ? Module.__from_binding(binding3) : null;
1548
+ const binding8 = this.#inner.getModule(Dependency.__to_binding(dependency));
1549
+ return binding8 ? Module.__from_binding(binding8) : null;
1541
1550
  }
1542
1551
  getResolvedModule(dependency) {
1543
- const binding3 = this.#inner.getResolvedModule(
1552
+ const binding8 = this.#inner.getResolvedModule(
1544
1553
  Dependency.__to_binding(dependency)
1545
1554
  );
1546
- return binding3 ? Module.__from_binding(binding3) : null;
1555
+ return binding8 ? Module.__from_binding(binding8) : null;
1547
1556
  }
1548
1557
  getIssuer(module2) {
1549
- const binding3 = this.#inner.getIssuer(Module.__to_binding(module2));
1550
- return binding3 ? Module.__from_binding(binding3) : null;
1558
+ const binding8 = this.#inner.getIssuer(Module.__to_binding(module2));
1559
+ return binding8 ? Module.__from_binding(binding8) : null;
1551
1560
  }
1552
1561
  getExportsInfo(module2) {
1553
1562
  return ExportsInfo.__from_binding(
@@ -1555,13 +1564,13 @@ var ModuleGraph = class _ModuleGraph {
1555
1564
  );
1556
1565
  }
1557
1566
  getConnection(dependency) {
1558
- const binding3 = this.#inner.getConnection(
1567
+ const binding8 = this.#inner.getConnection(
1559
1568
  Dependency.__to_binding(dependency)
1560
1569
  );
1561
- return binding3 ? ModuleGraphConnection.__from_binding(binding3) : null;
1570
+ return binding8 ? ModuleGraphConnection.__from_binding(binding8) : null;
1562
1571
  }
1563
1572
  getOutgoingConnections(module2) {
1564
- return this.#inner.getOutgoingConnections(Module.__to_binding(module2)).map((binding3) => ModuleGraphConnection.__from_binding(binding3));
1573
+ return this.#inner.getOutgoingConnections(Module.__to_binding(module2)).map((binding8) => ModuleGraphConnection.__from_binding(binding8));
1565
1574
  }
1566
1575
  };
1567
1576
 
@@ -3048,7 +3057,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3048
3057
  }
3049
3058
  get chunkGroups() {
3050
3059
  return memoizeValue(
3051
- () => __privateGet(this, _inner).chunkGroups.map((binding3) => ChunkGroup.__from_binding(binding3))
3060
+ () => __privateGet(this, _inner).chunkGroups.map((binding8) => ChunkGroup.__from_binding(binding8))
3052
3061
  );
3053
3062
  }
3054
3063
  /**
@@ -3064,8 +3073,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3064
3073
  },
3065
3074
  get: (property) => {
3066
3075
  if (typeof property === "string") {
3067
- const binding3 = __privateGet(this, _inner).getNamedChunkGroup(property);
3068
- return ChunkGroup.__from_binding(binding3);
3076
+ const binding8 = __privateGet(this, _inner).getNamedChunkGroup(property);
3077
+ return ChunkGroup.__from_binding(binding8);
3069
3078
  }
3070
3079
  }
3071
3080
  });
@@ -3096,8 +3105,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3096
3105
  },
3097
3106
  get: (property) => {
3098
3107
  if (typeof property === "string") {
3099
- const binding3 = __privateGet(this, _inner).getNamedChunk(property);
3100
- return Chunk.__from_binding(binding3);
3108
+ const binding8 = __privateGet(this, _inner).getNamedChunk(property);
3109
+ return Chunk.__from_binding(binding8);
3101
3110
  }
3102
3111
  }
3103
3112
  });
@@ -3634,7 +3643,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3634
3643
  * @internal
3635
3644
  */
3636
3645
  __internal__getChunks() {
3637
- return __privateGet(this, _inner).getChunks().map((binding3) => Chunk.__from_binding(binding3));
3646
+ return __privateGet(this, _inner).getChunks().map((binding8) => Chunk.__from_binding(binding8));
3638
3647
  }
3639
3648
  /**
3640
3649
  * Note: This is not a webpack public API, maybe removed in future.
@@ -3752,8 +3761,8 @@ var AddIncludeDispatcher = class {
3752
3761
  }
3753
3762
  });
3754
3763
  };
3755
- constructor(binding3) {
3756
- this.#inner = binding3;
3764
+ constructor(binding8) {
3765
+ this.#inner = binding8;
3757
3766
  this.#running = false;
3758
3767
  }
3759
3768
  call(context2, dependency, options, callback) {
@@ -3765,15 +3774,15 @@ var AddIncludeDispatcher = class {
3765
3774
  }
3766
3775
  };
3767
3776
  var EntryData = class _EntryData {
3768
- static __from_binding(binding3) {
3769
- return new _EntryData(binding3);
3777
+ static __from_binding(binding8) {
3778
+ return new _EntryData(binding8);
3770
3779
  }
3771
- constructor(binding3) {
3772
- this.dependencies = binding3.dependencies.map(Dependency.__from_binding);
3773
- this.includeDependencies = binding3.includeDependencies.map(
3780
+ constructor(binding8) {
3781
+ this.dependencies = binding8.dependencies.map(Dependency.__from_binding);
3782
+ this.includeDependencies = binding8.includeDependencies.map(
3774
3783
  Dependency.__from_binding
3775
3784
  );
3776
- this.options = binding3.options;
3785
+ this.options = binding8.options;
3777
3786
  }
3778
3787
  };
3779
3788
  var Entries = class {
@@ -3785,8 +3794,8 @@ var Entries = class {
3785
3794
  this.#data.clear();
3786
3795
  }
3787
3796
  forEach(callback, thisArg) {
3788
- for (const [key, binding3] of this) {
3789
- const value = EntryData.__from_binding(binding3);
3797
+ for (const [key, binding8] of this) {
3798
+ const value = EntryData.__from_binding(binding8);
3790
3799
  callback.call(thisArg, value, key, this);
3791
3800
  }
3792
3801
  }
@@ -3818,8 +3827,8 @@ var Entries = class {
3818
3827
  return this.#data.delete(key);
3819
3828
  }
3820
3829
  get(key) {
3821
- const binding3 = this.#data.get(key);
3822
- return binding3 ? EntryData.__from_binding(binding3) : void 0;
3830
+ const binding8 = this.#data.get(key);
3831
+ return binding8 ? EntryData.__from_binding(binding8) : void 0;
3823
3832
  }
3824
3833
  keys() {
3825
3834
  return this.#data.keys()[Symbol.iterator]();
@@ -3827,7 +3836,6 @@ var Entries = class {
3827
3836
  };
3828
3837
 
3829
3838
  // src/Compiler.ts
3830
- var binding2 = __toESM(require("@rspack/binding"));
3831
3839
  var liteTapable7 = __toESM(require("@rspack/lite-tapable"));
3832
3840
 
3833
3841
  // src/ExecuteModulePlugin.ts
@@ -4850,395 +4858,52 @@ var CacheFacade = class _CacheFacade {
4850
4858
  };
4851
4859
  var CacheFacade_default = CacheFacade;
4852
4860
 
4853
- // src/RuntimeGlobals.ts
4854
- var REVERSE_RUNTIME_GLOBALS = /* @__PURE__ */ new Map();
4855
- function __from_binding_runtime_globals(runtimeRequirements) {
4856
- const res = /* @__PURE__ */ new Set();
4857
- for (const flag of runtimeRequirements.value) {
4858
- if (flag in RuntimeGlobals) {
4859
- res.add(RuntimeGlobals[flag]);
4860
- } else {
4861
- res.add(flag);
4862
- }
4861
+ // src/builtin-plugin/base.ts
4862
+ var HOOKS_CAN_NOT_INHERENT_FROM_PARENT = [
4863
+ "make",
4864
+ "compile",
4865
+ "emit",
4866
+ "afterEmit",
4867
+ "invalid",
4868
+ "done",
4869
+ "thisCompilation"
4870
+ ];
4871
+ function canInherentFromParent(affectedHooks) {
4872
+ if (typeof affectedHooks === "undefined") {
4873
+ return false;
4863
4874
  }
4864
- return res;
4875
+ return !HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
4865
4876
  }
4866
- function __to_binding_runtime_globals(runtimeRequirements) {
4867
- const res = {
4868
- value: []
4877
+ var RspackBuiltinPlugin = class {
4878
+ apply(compiler) {
4879
+ const raw = this.raw(compiler);
4880
+ if (raw) {
4881
+ raw.canInherentFromParent = canInherentFromParent(this.affectedHooks);
4882
+ compiler.__internal__registerBuiltinPlugin(raw);
4883
+ }
4884
+ }
4885
+ };
4886
+ function createBuiltinPlugin(name2, options) {
4887
+ return {
4888
+ name: name2,
4889
+ options: options ?? false
4890
+ // undefined or null will cause napi error, so false for fallback
4869
4891
  };
4870
- for (const flag of Array.from(runtimeRequirements)) {
4871
- const item = REVERSE_RUNTIME_GLOBALS.get(flag);
4872
- if (typeof item === "string") {
4873
- res.value.push(item);
4874
- } else {
4875
- res.value.push(flag);
4892
+ }
4893
+ function create2(name2, resolve2, affectedHooks) {
4894
+ class Plugin extends RspackBuiltinPlugin {
4895
+ constructor(...args) {
4896
+ super();
4897
+ this.name = name2;
4898
+ this.affectedHooks = affectedHooks;
4899
+ this._args = args;
4900
+ }
4901
+ raw(compiler) {
4902
+ return createBuiltinPlugin(name2, resolve2.apply(compiler, this._args));
4876
4903
  }
4877
4904
  }
4878
- return res;
4879
- }
4880
- var RuntimeGlobals = {
4881
- /**
4882
- * the internal require function
4883
- */
4884
- require: "__webpack_require__",
4885
- /**
4886
- * access to properties of the internal require function/object
4887
- */
4888
- requireScope: "__webpack_require__.*",
4889
- /**
4890
- * the internal exports object
4891
- */
4892
- exports: "__webpack_exports__",
4893
- /**
4894
- * top-level this need to be the exports object
4895
- */
4896
- thisAsExports: "top-level-this-exports",
4897
- /**
4898
- * runtime need to return the exports of the last entry module
4899
- */
4900
- returnExportsFromRuntime: "return-exports-from-runtime",
4901
- /**
4902
- * the internal module object
4903
- */
4904
- module: "module",
4905
- /**
4906
- * the internal module object
4907
- */
4908
- moduleId: "module.id",
4909
- /**
4910
- * the internal module object
4911
- */
4912
- moduleLoaded: "module.loaded",
4913
- /**
4914
- * the bundle public path
4915
- */
4916
- publicPath: "__webpack_require__.p",
4917
- /**
4918
- * the module id of the entry point
4919
- */
4920
- entryModuleId: "__webpack_require__.s",
4921
- /**
4922
- * the module cache
4923
- */
4924
- moduleCache: "__webpack_require__.c",
4925
- /**
4926
- * the module functions
4927
- */
4928
- moduleFactories: "__webpack_require__.m",
4929
- /**
4930
- * the module functions, with only write access
4931
- */
4932
- moduleFactoriesAddOnly: "__webpack_require__.m (add only)",
4933
- /**
4934
- * the chunk ensure function
4935
- */
4936
- ensureChunk: "__webpack_require__.e",
4937
- /**
4938
- * an object with handlers to ensure a chunk
4939
- */
4940
- ensureChunkHandlers: "__webpack_require__.f",
4941
- /**
4942
- * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries
4943
- */
4944
- ensureChunkIncludeEntries: "__webpack_require__.f (include entries)",
4945
- /**
4946
- * the chunk prefetch function
4947
- */
4948
- prefetchChunk: "__webpack_require__.E",
4949
- /**
4950
- * an object with handlers to prefetch a chunk
4951
- */
4952
- prefetchChunkHandlers: "__webpack_require__.F",
4953
- /**
4954
- * the chunk preload function
4955
- */
4956
- preloadChunk: "__webpack_require__.G",
4957
- /**
4958
- * an object with handlers to preload a chunk
4959
- */
4960
- preloadChunkHandlers: "__webpack_require__.H",
4961
- /**
4962
- * the exported property define getters function
4963
- */
4964
- definePropertyGetters: "__webpack_require__.d",
4965
- /**
4966
- * define compatibility on export
4967
- */
4968
- makeNamespaceObject: "__webpack_require__.r",
4969
- /**
4970
- * create a fake namespace object
4971
- */
4972
- createFakeNamespaceObject: "__webpack_require__.t",
4973
- /**
4974
- * compatibility get default export
4975
- */
4976
- compatGetDefaultExport: "__webpack_require__.n",
4977
- /**
4978
- * ES modules decorator
4979
- */
4980
- harmonyModuleDecorator: "__webpack_require__.hmd",
4981
- /**
4982
- * node.js module decorator
4983
- */
4984
- nodeModuleDecorator: "__webpack_require__.nmd",
4985
- /**
4986
- * the webpack hash
4987
- */
4988
- getFullHash: "__webpack_require__.h",
4989
- /**
4990
- * an object containing all installed WebAssembly.Instance export objects keyed by module id
4991
- */
4992
- wasmInstances: "__webpack_require__.w",
4993
- /**
4994
- * instantiate a wasm instance from module exports object, id, hash and importsObject
4995
- */
4996
- instantiateWasm: "__webpack_require__.v",
4997
- /**
4998
- * the uncaught error handler for the webpack runtime
4999
- */
5000
- uncaughtErrorHandler: "__webpack_require__.oe",
5001
- /**
5002
- * the script nonce
5003
- */
5004
- scriptNonce: "__webpack_require__.nc",
5005
- /**
5006
- * function to load a script tag.
5007
- * Arguments: (url: string, done: (event) =\> void), key?: string | number, chunkId?: string | number) =\> void
5008
- * done function is called when loading has finished or timeout occurred.
5009
- * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url.
5010
- */
5011
- loadScript: "__webpack_require__.l",
5012
- /**
5013
- * function to promote a string to a TrustedScript using webpack's Trusted
5014
- * Types policy
5015
- * Arguments: (script: string) =\> TrustedScript
5016
- */
5017
- createScript: "__webpack_require__.ts",
5018
- /**
5019
- * function to promote a string to a TrustedScriptURL using webpack's Trusted
5020
- * Types policy
5021
- * Arguments: (url: string) =\> TrustedScriptURL
5022
- */
5023
- createScriptUrl: "__webpack_require__.tu",
5024
- /**
5025
- * function to return webpack's Trusted Types policy
5026
- * Arguments: () =\> TrustedTypePolicy
5027
- */
5028
- getTrustedTypesPolicy: "__webpack_require__.tt",
5029
- /**
5030
- * a flag when a chunk has a fetch priority
5031
- */
5032
- hasFetchPriority: "has fetch priority",
5033
- /**
5034
- * the chunk name of the chunk with the runtime
5035
- */
5036
- chunkName: "__webpack_require__.cn",
5037
- /**
5038
- * the runtime id of the current runtime
5039
- */
5040
- runtimeId: "__webpack_require__.j",
5041
- /**
5042
- * the filename of the script part of the chunk
5043
- */
5044
- getChunkScriptFilename: "__webpack_require__.u",
5045
- /**
5046
- * the filename of the css part of the chunk
5047
- */
5048
- getChunkCssFilename: "__webpack_require__.k",
5049
- /**
5050
- * a flag when a module/chunk/tree has css modules
5051
- */
5052
- hasCssModules: "has css modules",
5053
- /**
5054
- * the filename of the script part of the hot update chunk
5055
- */
5056
- getChunkUpdateScriptFilename: "__webpack_require__.hu",
5057
- /**
5058
- * the filename of the css part of the hot update chunk
5059
- */
5060
- getChunkUpdateCssFilename: "__webpack_require__.hk",
5061
- /**
5062
- * startup signal from runtime
5063
- * This will be called when the runtime chunk has been loaded.
5064
- */
5065
- startup: "__webpack_require__.x",
5066
- /**
5067
- * @deprecated
5068
- * creating a default startup function with the entry modules
5069
- */
5070
- startupNoDefault: "__webpack_require__.x (no default handler)",
5071
- /**
5072
- * startup signal from runtime but only used to add logic after the startup
5073
- */
5074
- startupOnlyAfter: "__webpack_require__.x (only after)",
5075
- /**
5076
- * startup signal from runtime but only used to add sync logic before the startup
5077
- */
5078
- startupOnlyBefore: "__webpack_require__.x (only before)",
5079
- /**
5080
- * global callback functions for installing chunks
5081
- */
5082
- chunkCallback: "webpackChunk",
5083
- /**
5084
- * method to startup an entrypoint with needed chunks.
5085
- * Signature: (moduleId: Id, chunkIds: Id[]) =\> any.
5086
- * Returns the exports of the module or a Promise
5087
- */
5088
- startupEntrypoint: "__webpack_require__.X",
5089
- /**
5090
- * register deferred code, which will run when certain
5091
- * chunks are loaded.
5092
- * Signature: (chunkIds: Id[], fn: () =\> any, priority: int \>= 0 = 0) =\> any
5093
- * Returned value will be returned directly when all chunks are already loaded
5094
- * When (priority & 1) it will wait for all other handlers with lower priority to
5095
- * be executed before itself is executed
5096
- */
5097
- onChunksLoaded: "__webpack_require__.O",
5098
- /**
5099
- * method to install a chunk that was loaded somehow
5100
- * Signature: (\{ id, ids, modules, runtime \}) =\> void
5101
- */
5102
- externalInstallChunk: "__webpack_require__.C",
5103
- /**
5104
- * interceptor for module executions
5105
- */
5106
- interceptModuleExecution: "__webpack_require__.i",
5107
- /**
5108
- * the global object
5109
- */
5110
- global: "__webpack_require__.g",
5111
- /**
5112
- * an object with all share scopes
5113
- */
5114
- shareScopeMap: "__webpack_require__.S",
5115
- /**
5116
- * The sharing init sequence function (only runs once per share scope).
5117
- * Has one argument, the name of the share scope.
5118
- * Creates a share scope if not existing
5119
- */
5120
- initializeSharing: "__webpack_require__.I",
5121
- /**
5122
- * The current scope when getting a module from a remote
5123
- */
5124
- currentRemoteGetScope: "__webpack_require__.R",
5125
- /**
5126
- * the filename of the HMR manifest
5127
- */
5128
- getUpdateManifestFilename: "__webpack_require__.hmrF",
5129
- /**
5130
- * function downloading the update manifest
5131
- */
5132
- hmrDownloadManifest: "__webpack_require__.hmrM",
5133
- /**
5134
- * array with handler functions to download chunk updates
5135
- */
5136
- hmrDownloadUpdateHandlers: "__webpack_require__.hmrC",
5137
- /**
5138
- * object with all hmr module data for all modules
5139
- */
5140
- hmrModuleData: "__webpack_require__.hmrD",
5141
- /**
5142
- * array with handler functions when a module should be invalidated
5143
- */
5144
- hmrInvalidateModuleHandlers: "__webpack_require__.hmrI",
5145
- /**
5146
- * the prefix for storing state of runtime modules when hmr is enabled
5147
- */
5148
- hmrRuntimeStatePrefix: "__webpack_require__.hmrS",
5149
- /**
5150
- * the AMD define function
5151
- */
5152
- amdDefine: "__webpack_require__.amdD",
5153
- /**
5154
- * the AMD options
5155
- */
5156
- amdOptions: "__webpack_require__.amdO",
5157
- /**
5158
- * the System polyfill object
5159
- */
5160
- system: "__webpack_require__.System",
5161
- /**
5162
- * the shorthand for Object.prototype.hasOwnProperty
5163
- * using of it decreases the compiled bundle size
5164
- */
5165
- hasOwnProperty: "__webpack_require__.o",
5166
- /**
5167
- * the System.register context object
5168
- */
5169
- systemContext: "__webpack_require__.y",
5170
- /**
5171
- * the baseURI of current document
5172
- */
5173
- baseURI: "__webpack_require__.b",
5174
- /**
5175
- * a RelativeURL class when relative URLs are used
5176
- */
5177
- relativeUrl: "__webpack_require__.U",
5178
- /**
5179
- * Creates an async module. The body function must be a async function.
5180
- * "module.exports" will be decorated with an AsyncModulePromise.
5181
- * The body function will be called.
5182
- * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));".
5183
- * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function.
5184
- * Signature: function(
5185
- * module: Module,
5186
- * body: (handleDependencies: (deps: AsyncModulePromise[]) =\> Promise\<any[]\> & () =\> void,
5187
- * hasAwaitAfterDependencies?: boolean
5188
- * ) =\> void
5189
- */
5190
- asyncModule: "__webpack_require__.a"
5191
- };
5192
- for (const entry2 of Object.entries(RuntimeGlobals)) {
5193
- REVERSE_RUNTIME_GLOBALS.set(entry2[1], entry2[0]);
5194
- }
5195
-
5196
- // src/builtin-plugin/base.ts
5197
- var HOOKS_CAN_NOT_INHERENT_FROM_PARENT = [
5198
- "make",
5199
- "compile",
5200
- "emit",
5201
- "afterEmit",
5202
- "invalid",
5203
- "done",
5204
- "thisCompilation"
5205
- ];
5206
- function canInherentFromParent(affectedHooks) {
5207
- if (typeof affectedHooks === "undefined") {
5208
- return false;
5209
- }
5210
- return !HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
5211
- }
5212
- var RspackBuiltinPlugin = class {
5213
- apply(compiler) {
5214
- const raw = this.raw(compiler);
5215
- if (raw) {
5216
- raw.canInherentFromParent = canInherentFromParent(this.affectedHooks);
5217
- compiler.__internal__registerBuiltinPlugin(raw);
5218
- }
5219
- }
5220
- };
5221
- function createBuiltinPlugin(name2, options) {
5222
- return {
5223
- name: name2,
5224
- options: options ?? false
5225
- // undefined or null will cause napi error, so false for fallback
5226
- };
5227
- }
5228
- function create2(name2, resolve2, affectedHooks) {
5229
- class Plugin extends RspackBuiltinPlugin {
5230
- constructor(...args) {
5231
- super();
5232
- this.name = name2;
5233
- this.affectedHooks = affectedHooks;
5234
- this._args = args;
5235
- }
5236
- raw(compiler) {
5237
- return createBuiltinPlugin(name2, resolve2.apply(compiler, this._args));
5238
- }
5239
- }
5240
- Object.defineProperty(Plugin, "name", { value: name2 });
5241
- return Plugin;
4905
+ Object.defineProperty(Plugin, "name", { value: name2 });
4906
+ return Plugin;
5242
4907
  }
5243
4908
 
5244
4909
  // src/builtin-plugin/APIPlugin.ts
@@ -6454,7 +6119,32 @@ function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
6454
6119
  }
6455
6120
  return null;
6456
6121
  }
6122
+ var tracingCache;
6123
+ async function tryTrace(context2) {
6124
+ if (!process.env.RSPACK_PROFILE) {
6125
+ return {};
6126
+ }
6127
+ try {
6128
+ const {
6129
+ trace,
6130
+ propagation,
6131
+ context: tracingContext
6132
+ } = await import("@rspack/tracing");
6133
+ const tracer = trace.getTracer("rspack-loader-runner");
6134
+ const activeContext = propagation.extract(
6135
+ tracingContext.active(),
6136
+ context2.__internal__tracingCarrier
6137
+ );
6138
+ tracingCache = { tracer, activeContext };
6139
+ return tracingCache;
6140
+ } catch (error) {
6141
+ tracingCache = {};
6142
+ return tracingCache;
6143
+ }
6144
+ }
6457
6145
  async function runLoaders(compiler, context2) {
6146
+ var _a, _b;
6147
+ const { tracer, activeContext } = await tryTrace(context2);
6458
6148
  const loaderState = context2.loaderState;
6459
6149
  const { resource } = context2.resourceData;
6460
6150
  const splittedResource = resource && parsePathQueryFragment(resource);
@@ -6827,11 +6517,21 @@ async function runLoaders(compiler, context2) {
6827
6517
  const fn2 = currentLoaderObject.pitch;
6828
6518
  currentLoaderObject.pitchExecuted = true;
6829
6519
  if (!fn2) continue;
6520
+ const span = tracer == null ? void 0 : tracer.startSpan(
6521
+ "LoaderRunner:pitch",
6522
+ {
6523
+ attributes: {
6524
+ "loader.identifier": (_a = getCurrentLoader(loaderContext)) == null ? void 0 : _a.request
6525
+ }
6526
+ },
6527
+ activeContext
6528
+ );
6830
6529
  const args = await runSyncOrAsync(fn2, loaderContext, [
6831
6530
  loaderContext.remainingRequest,
6832
6531
  loaderContext.previousRequest,
6833
6532
  currentLoaderObject.data
6834
6533
  ]) || [];
6534
+ span == null ? void 0 : span.end();
6835
6535
  const hasArg = args.some((value) => value !== void 0);
6836
6536
  if (hasArg) {
6837
6537
  const [content, sourceMap, additionalData] = args;
@@ -6860,7 +6560,17 @@ async function runLoaders(compiler, context2) {
6860
6560
  if (!fn2) continue;
6861
6561
  const args = [content, sourceMap, additionalData];
6862
6562
  convertArgs(args, !!currentLoaderObject.raw);
6563
+ const span = tracer == null ? void 0 : tracer.startSpan(
6564
+ "LoaderRunner:normal",
6565
+ {
6566
+ attributes: {
6567
+ "loader.identifier": (_b = getCurrentLoader(loaderContext)) == null ? void 0 : _b.request
6568
+ }
6569
+ },
6570
+ activeContext
6571
+ );
6863
6572
  [content, sourceMap, additionalData] = await runSyncOrAsync(fn2, loaderContext, args) || [];
6573
+ span == null ? void 0 : span.end();
6864
6574
  }
6865
6575
  context2.content = isNil(content) ? null : toBuffer(content);
6866
6576
  context2.sourceMap = JsSourceMap.__to_binding(sourceMap);
@@ -7019,7 +6729,7 @@ var getRawOptions = (options, compiler) => {
7019
6729
  name: options.name,
7020
6730
  mode: mode2,
7021
6731
  context: options.context,
7022
- output: options.output,
6732
+ output: getRawOutput(options.output),
7023
6733
  resolve: getRawResolve(options.resolve),
7024
6734
  resolveLoader: getRawResolve(options.resolveLoader),
7025
6735
  module: getRawModule(options.module, {
@@ -7036,11 +6746,34 @@ var getRawOptions = (options, compiler) => {
7036
6746
  experiments: experiments3,
7037
6747
  node: getRawNode(options.node),
7038
6748
  profile: options.profile,
7039
- amd: options.amd,
6749
+ amd: options.amd !== false ? JSON.stringify(options.amd || {}) : void 0,
7040
6750
  bail: options.bail,
7041
6751
  __references: {}
7042
6752
  };
7043
6753
  };
6754
+ function getRawOutput(output2) {
6755
+ return {
6756
+ ...output2,
6757
+ environment: getRawOutputEnvironment(output2.environment)
6758
+ };
6759
+ }
6760
+ function getRawOutputEnvironment(environment2 = {}) {
6761
+ return {
6762
+ const: Boolean(environment2.const),
6763
+ arrowFunction: Boolean(environment2.arrowFunction),
6764
+ nodePrefixForCoreModules: Boolean(environment2.nodePrefixForCoreModules),
6765
+ asyncFunction: Boolean(environment2.asyncFunction),
6766
+ bigIntLiteral: Boolean(environment2.bigIntLiteral),
6767
+ destructuring: Boolean(environment2.destructuring),
6768
+ document: Boolean(environment2.document),
6769
+ dynamicImport: Boolean(environment2.dynamicImport),
6770
+ forOf: Boolean(environment2.forOf),
6771
+ globalThis: Boolean(environment2.globalThis),
6772
+ module: Boolean(environment2.module),
6773
+ optionalChaining: Boolean(environment2.optionalChaining),
6774
+ templateLiteral: Boolean(environment2.templateLiteral)
6775
+ };
6776
+ }
7044
6777
  function getRawExtensionAlias(alias = {}) {
7045
6778
  const entries = Object.entries(alias).map(([key, value]) => {
7046
6779
  if (Array.isArray(value)) {
@@ -7384,7 +7117,8 @@ function getRawCssParserOptions(parser) {
7384
7117
  }
7385
7118
  function getRawJsonParserOptions(parser) {
7386
7119
  return {
7387
- exportsDepth: parser.exportsDepth
7120
+ exportsDepth: parser.exportsDepth,
7121
+ parse: typeof parser.parse === "function" ? (str) => JSON.stringify(parser.parse(str)) : void 0
7388
7122
  };
7389
7123
  }
7390
7124
  function getRawGeneratorOptions(generator, type) {
@@ -7450,7 +7184,8 @@ function getRawAssetResourceGeneratorOptions(options) {
7450
7184
  emit: options.emit,
7451
7185
  filename: options.filename,
7452
7186
  outputPath: options.outputPath,
7453
- publicPath: options.publicPath
7187
+ publicPath: options.publicPath,
7188
+ importMode: options.importMode
7454
7189
  };
7455
7190
  }
7456
7191
  function getRawAssetGeneratorDataUrl(dataUrl) {
@@ -8707,6 +8442,7 @@ var applyExperimentsDefaults = (experiments3, { production, development }) => {
8707
8442
  D(experiments3.incremental, "emitAssets", true);
8708
8443
  }
8709
8444
  D(experiments3, "rspackFuture", {});
8445
+ D(experiments3, "parallelCodeSplitting", false);
8710
8446
  };
8711
8447
  var applybundlerInfoDefaults = (rspackFuture, library3) => {
8712
8448
  if (typeof rspackFuture === "object") {
@@ -9407,6 +9143,9 @@ var getResolveDefaults = ({
9407
9143
  extensions: [...jsExtensions]
9408
9144
  });
9409
9145
  const resolveOptions2 = {
9146
+ // enable pnp only in pnp environment, see https://yarnpkg.com/advanced/pnpapi#processversionspnp
9147
+ // IGNORE(resolve.pnp): Rspack use `resolve.enable` to enable Yarn PnP feature
9148
+ pnp: !!process.versions.pnp,
9410
9149
  modules: ["node_modules"],
9411
9150
  conditionNames: conditions,
9412
9151
  mainFiles: ["index"],
@@ -9427,7 +9166,7 @@ var getResolveDefaults = ({
9427
9166
  preferRelative: true
9428
9167
  },
9429
9168
  commonjs: cjsDeps(),
9430
- // amd: cjsDeps(),
9169
+ amd: cjsDeps(),
9431
9170
  // for backward-compat: loadModule
9432
9171
  // loader: cjsDeps(),
9433
9172
  // for backward-compat: Custom Dependency and getResolve without dependencyType
@@ -9721,13 +9460,14 @@ var getNormalizedRspackOptions = (config2) => {
9721
9460
  chunksRender: true,
9722
9461
  emitAssets: true
9723
9462
  } : options
9724
- )
9463
+ ),
9464
+ parallelCodeSplitting: experiments3.parallelCodeSplitting
9725
9465
  })),
9726
9466
  watch: config2.watch,
9727
9467
  watchOptions: cloneObject(config2.watchOptions),
9728
9468
  devServer: config2.devServer,
9729
9469
  profile: config2.profile,
9730
- amd: config2.amd ? JSON.stringify(config2.amd) : void 0,
9470
+ amd: config2.amd,
9731
9471
  bail: config2.bail
9732
9472
  };
9733
9473
  };
@@ -10235,7 +9975,8 @@ var baseResolveOptions = import_zod2.z.strictObject({
10235
9975
  extensionAlias: import_zod2.z.record(import_zod2.z.string().or(import_zod2.z.array(import_zod2.z.string()))).optional(),
10236
9976
  aliasFields: import_zod2.z.array(import_zod2.z.string()).optional(),
10237
9977
  restrictions: import_zod2.z.array(import_zod2.z.string()).optional(),
10238
- roots: import_zod2.z.array(import_zod2.z.string()).optional()
9978
+ roots: import_zod2.z.array(import_zod2.z.string()).optional(),
9979
+ pnp: import_zod2.z.boolean().optional()
10239
9980
  });
10240
9981
  var resolveOptions = baseResolveOptions.extend({
10241
9982
  byDependency: import_zod2.z.lazy(() => import_zod2.z.record(resolveOptions)).optional()
@@ -10787,10 +10528,8 @@ var optimizationRuntimeChunk = import_zod2.z.enum(["single", "multiple"]).or(imp
10787
10528
  ).optional()
10788
10529
  })
10789
10530
  );
10790
- var optimizationSplitChunksNameFunction = import_zod2.z.function().args(
10791
- import_zod2.z.instanceof(Module).optional()
10792
- // FIXME: z.array(z.instanceof(Chunk)).optional(), z.string()
10793
- // FIXME: Chunk[], cacheChunkKey
10531
+ var optimizationSplitChunksNameFunction = import_zod2.z.function().args(import_zod2.z.instanceof(Module), import_zod2.z.array(import_zod2.z.instanceof(Chunk)), import_zod2.z.string()).returns(
10532
+ import_zod2.z.string().optional()
10794
10533
  );
10795
10534
  var optimizationSplitChunksName = import_zod2.z.string().or(import_zod2.z.literal(false)).or(optimizationSplitChunksNameFunction);
10796
10535
  var optimizationSplitChunksChunks = import_zod2.z.enum(["initial", "async", "all"]).or(import_zod2.z.instanceof(RegExp)).or(
@@ -10932,6 +10671,7 @@ var experiments = import_zod2.z.strictObject({
10932
10671
  css: import_zod2.z.boolean().optional(),
10933
10672
  layers: import_zod2.z.boolean().optional(),
10934
10673
  incremental: import_zod2.z.boolean().or(incremental).optional(),
10674
+ parallelCodeSplitting: import_zod2.z.boolean().optional(),
10935
10675
  futureDefaults: import_zod2.z.boolean().optional(),
10936
10676
  rspackFuture: rspackFutureOptions.optional()
10937
10677
  });
@@ -10995,8 +10735,8 @@ function isString(value) {
10995
10735
  return typeof value === "string";
10996
10736
  }
10997
10737
  var Resolver = class _Resolver {
10998
- constructor(binding3) {
10999
- this.binding = binding3;
10738
+ constructor(binding8) {
10739
+ this.binding = binding8;
11000
10740
  }
11001
10741
  resolveSync(context2, path11, request) {
11002
10742
  return this.binding.resolveSync(path11, request);
@@ -11018,12 +10758,12 @@ var Resolver = class _Resolver {
11018
10758
  if (Array.isArray(rawResolve.restrictions)) {
11019
10759
  rawResolve.restrictions = rawResolve.restrictions.filter(isString);
11020
10760
  }
11021
- const binding3 = this.binding.withOptions({
10761
+ const binding8 = this.binding.withOptions({
11022
10762
  dependencyCategory,
11023
10763
  resolveToContext,
11024
10764
  ...rawResolve
11025
10765
  });
11026
- return new _Resolver(binding3);
10766
+ return new _Resolver(binding8);
11027
10767
  }
11028
10768
  };
11029
10769
 
@@ -11216,11 +10956,43 @@ var HotModuleReplacementPlugin = class extends RspackBuiltinPlugin {
11216
10956
  }
11217
10957
  };
11218
10958
 
11219
- // src/builtin-plugin/HtmlRspackPlugin.ts
10959
+ // src/builtin-plugin/html-plugin/plugin.ts
11220
10960
  var import_node_fs2 = __toESM(require("fs"));
11221
10961
  var import_node_path9 = __toESM(require("path"));
11222
10962
  var import_binding33 = require("@rspack/binding");
10963
+
10964
+ // src/builtin-plugin/html-plugin/hooks.ts
11223
10965
  var liteTapable3 = __toESM(require("@rspack/lite-tapable"));
10966
+ var compilationHooksMap2 = /* @__PURE__ */ new WeakMap();
10967
+ var getPluginHooks = (compilation) => {
10968
+ if (!(compilation instanceof Compilation)) {
10969
+ throw new TypeError(
10970
+ "The 'compilation' argument must be an instance of Compilation"
10971
+ );
10972
+ }
10973
+ let hooks = compilationHooksMap2.get(compilation);
10974
+ if (hooks === void 0) {
10975
+ hooks = {
10976
+ beforeAssetTagGeneration: new liteTapable3.AsyncSeriesWaterfallHook([
10977
+ "data"
10978
+ ]),
10979
+ alterAssetTags: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
10980
+ alterAssetTagGroups: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
10981
+ afterTemplateExecution: new liteTapable3.AsyncSeriesWaterfallHook([
10982
+ "data"
10983
+ ]),
10984
+ beforeEmit: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
10985
+ afterEmit: new liteTapable3.AsyncSeriesWaterfallHook(["data"])
10986
+ };
10987
+ compilationHooksMap2.set(compilation, hooks);
10988
+ }
10989
+ return hooks;
10990
+ };
10991
+ var cleanPluginHooks = (compilation) => {
10992
+ compilationHooksMap2.delete(compilation);
10993
+ };
10994
+
10995
+ // src/builtin-plugin/html-plugin/options.ts
11224
10996
  var import_zod3 = require("../compiled/zod/index.js");
11225
10997
 
11226
10998
  // ../../node_modules/.pnpm/zod-validation-error@3.4.0_zod@3.23.8/node_modules/zod-validation-error/dist/index.mjs
@@ -11471,7 +11243,8 @@ function isValidate(opts, schema) {
11471
11243
  }
11472
11244
  }
11473
11245
 
11474
- // src/builtin-plugin/HtmlRspackPlugin.ts
11246
+ // src/builtin-plugin/html-plugin/options.ts
11247
+ var compilationOptionsMap = /* @__PURE__ */ new WeakMap();
11475
11248
  var templateRenderFunction = import_zod3.z.function().args(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any())).returns(
11476
11249
  import_zod3.z.string().or(import_zod3.z.promise(import_zod3.z.string()))
11477
11250
  );
@@ -11479,7 +11252,7 @@ var templateParamFunction = import_zod3.z.function().args(import_zod3.z.record(i
11479
11252
  import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any()).or(import_zod3.z.promise(import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any())))
11480
11253
  );
11481
11254
  var templateFilenameFunction = import_zod3.z.function().args(import_zod3.z.string()).returns(import_zod3.z.string());
11482
- var htmlRspackPluginOptions = import_zod3.z.strictObject({
11255
+ var pluginOptionsSchema = import_zod3.z.strictObject({
11483
11256
  filename: import_zod3.z.string().or(templateFilenameFunction).optional(),
11484
11257
  template: import_zod3.z.string().refine(
11485
11258
  (val) => !val.includes("!"),
@@ -11508,10 +11281,29 @@ var htmlRspackPluginOptions = import_zod3.z.strictObject({
11508
11281
  meta: import_zod3.z.record(import_zod3.z.string().or(import_zod3.z.record(import_zod3.z.string()))).optional(),
11509
11282
  hash: import_zod3.z.boolean().optional()
11510
11283
  });
11284
+ function validateHtmlPluginOptions(options) {
11285
+ return validate(options, pluginOptionsSchema);
11286
+ }
11287
+ var getPluginOptions = (compilation) => {
11288
+ if (!(compilation instanceof Compilation)) {
11289
+ throw new TypeError(
11290
+ "The 'compilation' argument must be an instance of Compilation"
11291
+ );
11292
+ }
11293
+ return compilationOptionsMap.get(compilation);
11294
+ };
11295
+ var setPluginOptions = (compilation, options) => {
11296
+ compilationOptionsMap.set(compilation, options);
11297
+ };
11298
+ var cleanPluginOptions = (compilation) => {
11299
+ compilationOptionsMap.delete(compilation);
11300
+ };
11301
+
11302
+ // src/builtin-plugin/html-plugin/plugin.ts
11511
11303
  var HtmlRspackPluginImpl = create2(
11512
11304
  import_binding33.BuiltinPluginName.HtmlRspackPlugin,
11513
11305
  function(c = {}) {
11514
- validate(c, htmlRspackPluginOptions);
11306
+ validateHtmlPluginOptions(c);
11515
11307
  const meta = {};
11516
11308
  for (const key in c.meta) {
11517
11309
  const value = c.meta[key];
@@ -11535,11 +11327,11 @@ var HtmlRspackPluginImpl = create2(
11535
11327
  let compilation = null;
11536
11328
  this.hooks.compilation.tap("HtmlRspackPlugin", (compilationInstance) => {
11537
11329
  compilation = compilationInstance;
11538
- compilationOptionsMap.set(compilation, c);
11330
+ setPluginOptions(compilation, c);
11539
11331
  });
11540
11332
  this.hooks.done.tap("HtmlRspackPlugin", (stats) => {
11541
- compilationHooksMap2.delete(stats.compilation);
11542
- compilationOptionsMap.delete(stats.compilation);
11333
+ cleanPluginHooks(stats.compilation);
11334
+ cleanPluginOptions(stats.compilation);
11543
11335
  });
11544
11336
  function generateRenderData(data) {
11545
11337
  var _a, _b, _c, _d;
@@ -11685,8 +11477,6 @@ function htmlTagObjectToString(tag) {
11685
11477
  const res = `<${[tag.tagName].concat(attributes).join(" ")}${tag.voidTag && !tag.innerHTML ? "/" : ""}>${tag.innerHTML || ""}${tag.voidTag && !tag.innerHTML ? "" : `</${tag.tagName}>`}`;
11686
11478
  return res;
11687
11479
  }
11688
- var compilationHooksMap2 = /* @__PURE__ */ new WeakMap();
11689
- var compilationOptionsMap = /* @__PURE__ */ new WeakMap();
11690
11480
  var HtmlRspackPlugin = HtmlRspackPluginImpl;
11691
11481
  var voidTags = [
11692
11482
  "area",
@@ -11713,49 +11503,19 @@ HtmlRspackPlugin.createHtmlTagObject = (tagName, attributes, innerHTML) => {
11713
11503
  innerHTML
11714
11504
  };
11715
11505
  };
11716
- HtmlRspackPlugin.getCompilationOptions = (compilation) => {
11717
- if (!(compilation instanceof Compilation)) {
11718
- throw new TypeError(
11719
- "The 'compilation' argument must be an instance of Compilation"
11720
- );
11721
- }
11722
- return compilationOptionsMap.get(compilation);
11723
- };
11724
- HtmlRspackPlugin.getHooks = HtmlRspackPlugin.getCompilationHooks = (compilation) => {
11725
- if (!(compilation instanceof Compilation)) {
11726
- throw new TypeError(
11727
- "The 'compilation' argument must be an instance of Compilation"
11728
- );
11729
- }
11730
- let hooks = compilationHooksMap2.get(compilation);
11731
- if (hooks === void 0) {
11732
- hooks = {
11733
- beforeAssetTagGeneration: new liteTapable3.AsyncSeriesWaterfallHook([
11734
- "data"
11735
- ]),
11736
- alterAssetTags: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
11737
- alterAssetTagGroups: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
11738
- afterTemplateExecution: new liteTapable3.AsyncSeriesWaterfallHook([
11739
- "data"
11740
- ]),
11741
- beforeEmit: new liteTapable3.AsyncSeriesWaterfallHook(["data"]),
11742
- afterEmit: new liteTapable3.AsyncSeriesWaterfallHook(["data"])
11743
- };
11744
- compilationHooksMap2.set(compilation, hooks);
11745
- }
11746
- return hooks;
11747
- };
11748
- HtmlRspackPlugin.version = 5;
11749
-
11750
- // src/builtin-plugin/HttpExternalsRspackPlugin.ts
11751
- var import_binding34 = require("@rspack/binding");
11752
- var HttpExternalsRspackPlugin = create2(
11753
- import_binding34.BuiltinPluginName.HttpExternalsRspackPlugin,
11754
- (css, webAsync) => {
11755
- return {
11756
- css,
11757
- webAsync
11758
- };
11506
+ HtmlRspackPlugin.getCompilationOptions = getPluginOptions;
11507
+ HtmlRspackPlugin.getHooks = HtmlRspackPlugin.getCompilationHooks = getPluginHooks;
11508
+ HtmlRspackPlugin.version = 5;
11509
+
11510
+ // src/builtin-plugin/HttpExternalsRspackPlugin.ts
11511
+ var import_binding34 = require("@rspack/binding");
11512
+ var HttpExternalsRspackPlugin = create2(
11513
+ import_binding34.BuiltinPluginName.HttpExternalsRspackPlugin,
11514
+ (css, webAsync) => {
11515
+ return {
11516
+ css,
11517
+ webAsync
11518
+ };
11759
11519
  }
11760
11520
  );
11761
11521
 
@@ -12983,17 +12743,17 @@ var ResolverFactory = class {
12983
12743
  static __to_binding(resolver_factory) {
12984
12744
  return resolver_factory.#binding;
12985
12745
  }
12986
- constructor() {
12987
- this.#binding = new binding.JsResolverFactory();
12746
+ constructor(pnp) {
12747
+ this.#binding = new binding.JsResolverFactory(pnp);
12988
12748
  }
12989
12749
  get(type, resolveOptions2) {
12990
12750
  const { dependencyCategory, resolveToContext, ...resolve2 } = resolveOptions2 || {};
12991
- const binding3 = this.#binding.get(type, {
12751
+ const binding8 = this.#binding.get(type, {
12992
12752
  ...getRawResolve(resolve2),
12993
12753
  dependencyCategory,
12994
12754
  resolveToContext
12995
12755
  });
12996
- return new Resolver(binding3);
12756
+ return new Resolver(binding8);
12997
12757
  }
12998
12758
  };
12999
12759
 
@@ -13221,26 +12981,33 @@ var Watching = class {
13221
12981
  cb(err);
13222
12982
  }
13223
12983
  };
13224
- const cbs = this.callbacks;
13225
- this.callbacks = [];
13226
- const startTime = this.startTime;
13227
- this.startTime = void 0;
13228
12984
  if (error) {
13229
12985
  return handleError(error);
13230
12986
  }
13231
12987
  (0, import_node_assert7.default)(compilation);
12988
+ stats = new Stats(compilation);
12989
+ if (this.invalid && !this.suspended && !this.blocked && !(this.isBlocked() && (this.blocked = true))) {
12990
+ this.#go();
12991
+ return;
12992
+ }
12993
+ const startTime = this.startTime;
12994
+ this.startTime = void 0;
13232
12995
  compilation.startTime = startTime;
13233
12996
  compilation.endTime = Date.now();
13234
- stats = new Stats(compilation);
12997
+ const cbs = this.callbacks;
12998
+ this.callbacks = [];
12999
+ const fileDependencies = /* @__PURE__ */ new Set([...compilation.fileDependencies]);
13000
+ const contextDependencies = /* @__PURE__ */ new Set([...compilation.contextDependencies]);
13001
+ const missingDependencies = /* @__PURE__ */ new Set([...compilation.missingDependencies]);
13235
13002
  this.compiler.hooks.done.callAsync(stats, (err) => {
13236
13003
  if (err) return handleError(err, cbs);
13237
13004
  this.handler(null, stats);
13238
13005
  process.nextTick(() => {
13239
13006
  if (!this.#closed) {
13240
13007
  this.watch(
13241
- compilation.fileDependencies,
13242
- compilation.contextDependencies,
13243
- compilation.missingDependencies
13008
+ fileDependencies,
13009
+ contextDependencies,
13010
+ missingDependencies
13244
13011
  );
13245
13012
  }
13246
13013
  });
@@ -13325,19 +13092,19 @@ var BINDING_VERSION = require("@rspack/binding/package.json").version;
13325
13092
  var CORE_VERSION = require("../package.json").version;
13326
13093
  var getAddonPlatformArchAbi = () => {
13327
13094
  const { platform, arch } = process;
13328
- let binding3 = "";
13329
- binding3 += platform;
13095
+ let binding8 = "";
13096
+ binding8 += platform;
13330
13097
  const abi = NodePlatformArchToAbi[platform][arch];
13331
13098
  if (abi === void 0) return new Error(`unsupported cpu arch: ${arch}`);
13332
- binding3 += `-${arch}`;
13099
+ binding8 += `-${arch}`;
13333
13100
  if (typeof abi === "string") {
13334
- binding3 += abi.length ? `-${abi}` : "";
13101
+ binding8 += abi.length ? `-${abi}` : "";
13335
13102
  } else if (typeof abi === "object") {
13336
- binding3 += `-${abi[isMusl() ? "musl" : "gnu"]}`;
13103
+ binding8 += `-${abi[isMusl() ? "musl" : "gnu"]}`;
13337
13104
  } else {
13338
13105
  return new Error(`unsupported abi: ${abi}`);
13339
13106
  }
13340
- return binding3;
13107
+ return binding8;
13341
13108
  };
13342
13109
  var result;
13343
13110
  var checkVersion = () => {
@@ -13383,153 +13150,1243 @@ Rspack requires these versions to be the same or you may have installed the wron
13383
13150
  return result = null;
13384
13151
  };
13385
13152
 
13386
- // src/Compiler.ts
13387
- var COMPILATION_WEAK_MAP = /* @__PURE__ */ new WeakMap();
13388
- var Compiler = class _Compiler {
13389
- #instance;
13390
- #initial;
13391
- #compilation;
13392
- #compilationParams;
13393
- #builtinPlugins;
13394
- #moduleExecutionResultsMap;
13395
- #nonSkippableRegisters;
13396
- #registers;
13397
- #ruleSet;
13398
- constructor(context2, options) {
13399
- this.#initial = true;
13400
- this.#builtinPlugins = [];
13401
- this.#nonSkippableRegisters = [];
13402
- this.#moduleExecutionResultsMap = /* @__PURE__ */ new Map();
13403
- this.#ruleSet = new RuleSetCompiler();
13404
- this.hooks = {
13405
- initialize: new liteTapable7.SyncHook([]),
13406
- shouldEmit: new liteTapable7.SyncBailHook(["compilation"]),
13407
- done: new liteTapable7.AsyncSeriesHook(["stats"]),
13408
- afterDone: new liteTapable7.SyncHook(["stats"]),
13409
- beforeRun: new liteTapable7.AsyncSeriesHook(["compiler"]),
13410
- run: new liteTapable7.AsyncSeriesHook(["compiler"]),
13411
- emit: new liteTapable7.AsyncSeriesHook(["compilation"]),
13412
- assetEmitted: new liteTapable7.AsyncSeriesHook(["file", "info"]),
13413
- afterEmit: new liteTapable7.AsyncSeriesHook(["compilation"]),
13414
- thisCompilation: new liteTapable7.SyncHook(["compilation", "params"]),
13415
- compilation: new liteTapable7.SyncHook([
13416
- "compilation",
13417
- "params"
13418
- ]),
13419
- invalid: new liteTapable7.SyncHook(["filename", "changeTime"]),
13420
- compile: new liteTapable7.SyncHook(["params"]),
13421
- infrastructureLog: new liteTapable7.SyncBailHook([
13422
- "origin",
13423
- "type",
13424
- "args"
13425
- ]),
13426
- failed: new liteTapable7.SyncHook(["error"]),
13427
- shutdown: new liteTapable7.AsyncSeriesHook([]),
13428
- normalModuleFactory: new liteTapable7.SyncHook([
13429
- "normalModuleFactory"
13430
- ]),
13431
- contextModuleFactory: new liteTapable7.SyncHook([
13432
- "contextModuleFactory"
13433
- ]),
13434
- watchRun: new liteTapable7.AsyncSeriesHook(["compiler"]),
13435
- watchClose: new liteTapable7.SyncHook([]),
13436
- environment: new liteTapable7.SyncHook([]),
13437
- afterEnvironment: new liteTapable7.SyncHook([]),
13438
- afterPlugins: new liteTapable7.SyncHook(["compiler"]),
13439
- afterResolvers: new liteTapable7.SyncHook(["compiler"]),
13440
- make: new liteTapable7.AsyncParallelHook(["compilation"]),
13441
- beforeCompile: new liteTapable7.AsyncSeriesHook(["params"]),
13442
- afterCompile: new liteTapable7.AsyncSeriesHook(["compilation"]),
13443
- finishMake: new liteTapable7.AsyncSeriesHook(["compilation"]),
13444
- entryOption: new liteTapable7.SyncBailHook(["context", "entry"]),
13445
- additionalPass: new liteTapable7.AsyncSeriesHook([])
13446
- };
13447
- this.webpack = rspack;
13448
- this.rspack = rspack;
13449
- this.root = this;
13450
- this.outputPath = "";
13451
- this.inputFileSystem = null;
13452
- this.intermediateFileSystem = null;
13453
- this.outputFileSystem = null;
13454
- this.watchFileSystem = null;
13455
- this.records = {};
13456
- this.options = options;
13457
- this.resolverFactory = new ResolverFactory();
13458
- this.context = context2;
13459
- this.cache = new Cache_default();
13460
- this.compilerPath = "";
13461
- this.running = false;
13462
- this.idle = false;
13463
- this.watchMode = false;
13464
- new JsLoaderRspackPlugin(this).apply(this);
13465
- new ExecuteModulePlugin().apply(this);
13466
- }
13467
- get recordsInputPath() {
13468
- return unsupported("Compiler.recordsInputPath");
13469
- }
13470
- get recordsOutputPath() {
13471
- return unsupported("Compiler.recordsOutputPath");
13472
- }
13473
- get managedPaths() {
13474
- return unsupported("Compiler.managedPaths");
13475
- }
13476
- get immutablePaths() {
13477
- return unsupported("Compiler.immutablePaths");
13153
+ // src/builtin-plugin/html-plugin/taps.ts
13154
+ var binding2 = __toESM(require("@rspack/binding"));
13155
+ var createHtmlPluginHooksRegisters = (getCompiler, createTap, createMapTap) => {
13156
+ return {
13157
+ registerHtmlPluginBeforeAssetTagGenerationTaps: createTap(
13158
+ binding2.RegisterJsTapKind.HtmlPluginBeforeAssetTagGeneration,
13159
+ function() {
13160
+ return HtmlRspackPlugin.getCompilationHooks(
13161
+ getCompiler().__internal__get_compilation()
13162
+ ).beforeAssetTagGeneration;
13163
+ },
13164
+ function(queried) {
13165
+ return async function(data) {
13166
+ return await queried.promise({
13167
+ ...data,
13168
+ plugin: {
13169
+ options: HtmlRspackPlugin.getCompilationOptions(
13170
+ getCompiler().__internal__get_compilation()
13171
+ ) || {}
13172
+ }
13173
+ });
13174
+ };
13175
+ }
13176
+ ),
13177
+ registerHtmlPluginAlterAssetTagsTaps: createTap(
13178
+ binding2.RegisterJsTapKind.HtmlPluginAlterAssetTags,
13179
+ function() {
13180
+ return HtmlRspackPlugin.getCompilationHooks(
13181
+ getCompiler().__internal__get_compilation()
13182
+ ).alterAssetTags;
13183
+ },
13184
+ function(queried) {
13185
+ return async function(data) {
13186
+ return await queried.promise(data);
13187
+ };
13188
+ }
13189
+ ),
13190
+ registerHtmlPluginAlterAssetTagGroupsTaps: createTap(
13191
+ binding2.RegisterJsTapKind.HtmlPluginAlterAssetTagGroups,
13192
+ function() {
13193
+ return HtmlRspackPlugin.getCompilationHooks(
13194
+ getCompiler().__internal__get_compilation()
13195
+ ).alterAssetTagGroups;
13196
+ },
13197
+ function(queried) {
13198
+ return async function(data) {
13199
+ return await queried.promise({
13200
+ ...data,
13201
+ plugin: {
13202
+ options: HtmlRspackPlugin.getCompilationOptions(
13203
+ getCompiler().__internal__get_compilation()
13204
+ ) || {}
13205
+ }
13206
+ });
13207
+ };
13208
+ }
13209
+ ),
13210
+ registerHtmlPluginAfterTemplateExecutionTaps: createTap(
13211
+ binding2.RegisterJsTapKind.HtmlPluginAfterTemplateExecution,
13212
+ function() {
13213
+ return HtmlRspackPlugin.getCompilationHooks(
13214
+ getCompiler().__internal__get_compilation()
13215
+ ).afterTemplateExecution;
13216
+ },
13217
+ function(queried) {
13218
+ return async function(data) {
13219
+ return await queried.promise({
13220
+ ...data,
13221
+ plugin: {
13222
+ options: HtmlRspackPlugin.getCompilationOptions(
13223
+ getCompiler().__internal__get_compilation()
13224
+ ) || {}
13225
+ }
13226
+ });
13227
+ };
13228
+ }
13229
+ ),
13230
+ registerHtmlPluginBeforeEmitTaps: createTap(
13231
+ binding2.RegisterJsTapKind.HtmlPluginBeforeEmit,
13232
+ function() {
13233
+ return HtmlRspackPlugin.getCompilationHooks(
13234
+ getCompiler().__internal__get_compilation()
13235
+ ).beforeEmit;
13236
+ },
13237
+ function(queried) {
13238
+ return async function(data) {
13239
+ return await queried.promise({
13240
+ ...data,
13241
+ plugin: {
13242
+ options: HtmlRspackPlugin.getCompilationOptions(
13243
+ getCompiler().__internal__get_compilation()
13244
+ ) || {}
13245
+ }
13246
+ });
13247
+ };
13248
+ }
13249
+ ),
13250
+ registerHtmlPluginAfterEmitTaps: createTap(
13251
+ binding2.RegisterJsTapKind.HtmlPluginAfterEmit,
13252
+ function() {
13253
+ return HtmlRspackPlugin.getCompilationHooks(
13254
+ getCompiler().__internal__get_compilation()
13255
+ ).afterEmit;
13256
+ },
13257
+ function(queried) {
13258
+ return async function(data) {
13259
+ return await queried.promise({
13260
+ ...data,
13261
+ plugin: {
13262
+ options: HtmlRspackPlugin.getCompilationOptions(
13263
+ getCompiler().__internal__get_compilation()
13264
+ ) || {}
13265
+ }
13266
+ });
13267
+ };
13268
+ }
13269
+ )
13270
+ };
13271
+ };
13272
+
13273
+ // src/taps/compilation.ts
13274
+ var binding3 = __toESM(require("@rspack/binding"));
13275
+
13276
+ // src/RuntimeGlobals.ts
13277
+ var REVERSE_RUNTIME_GLOBALS = /* @__PURE__ */ new Map();
13278
+ function __from_binding_runtime_globals(runtimeRequirements) {
13279
+ const res = /* @__PURE__ */ new Set();
13280
+ for (const flag of runtimeRequirements.value) {
13281
+ if (flag in RuntimeGlobals) {
13282
+ res.add(RuntimeGlobals[flag]);
13283
+ } else {
13284
+ res.add(flag);
13285
+ }
13478
13286
  }
13479
- get _lastCompilation() {
13480
- return this.#compilation;
13287
+ return res;
13288
+ }
13289
+ function __to_binding_runtime_globals(runtimeRequirements) {
13290
+ const res = {
13291
+ value: []
13292
+ };
13293
+ for (const flag of Array.from(runtimeRequirements)) {
13294
+ const item = REVERSE_RUNTIME_GLOBALS.get(flag);
13295
+ if (typeof item === "string") {
13296
+ res.value.push(item);
13297
+ } else {
13298
+ res.value.push(flag);
13299
+ }
13481
13300
  }
13301
+ return res;
13302
+ }
13303
+ var RuntimeGlobals = {
13482
13304
  /**
13483
- * Note: This is not a webpack public API, maybe removed in future.
13484
- * @internal
13305
+ * the internal require function
13485
13306
  */
13486
- get __internal__builtinPlugins() {
13487
- return this.#builtinPlugins;
13488
- }
13307
+ require: "__webpack_require__",
13489
13308
  /**
13490
- * Note: This is not a webpack public API, maybe removed in future.
13491
- * @internal
13309
+ * access to properties of the internal require function/object
13492
13310
  */
13493
- get __internal__ruleSet() {
13494
- return this.#ruleSet;
13495
- }
13311
+ requireScope: "__webpack_require__.*",
13496
13312
  /**
13497
- * @param name - cache name
13498
- * @returns the cache facade instance
13313
+ * the internal exports object
13499
13314
  */
13500
- getCache(name2) {
13501
- return new CacheFacade_default(
13502
- this.cache,
13503
- `${this.compilerPath}${name2}`,
13504
- this.options.output.hashFunction
13505
- );
13506
- }
13315
+ exports: "__webpack_exports__",
13507
13316
  /**
13508
- * @param name - name of the logger, or function called once to get the logger name
13509
- * @returns a logger with that name
13317
+ * top-level this need to be the exports object
13510
13318
  */
13511
- getInfrastructureLogger(name2) {
13512
- if (!name2) {
13513
- throw new TypeError(
13514
- "Compiler.getInfrastructureLogger(name) called without a name"
13515
- );
13516
- }
13517
- let normalizedName = name2;
13518
- return new Logger(
13519
- (type, args) => {
13520
- if (typeof normalizedName === "function") {
13521
- normalizedName = normalizedName();
13522
- if (!normalizedName) {
13523
- throw new TypeError(
13524
- "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
13525
- );
13526
- }
13527
- } else {
13528
- if (this.hooks.infrastructureLog.call(normalizedName, type, args) === void 0) {
13529
- if (this.infrastructureLogger !== void 0) {
13530
- this.infrastructureLogger(normalizedName, type, args);
13531
- }
13532
- }
13319
+ thisAsExports: "top-level-this-exports",
13320
+ /**
13321
+ * runtime need to return the exports of the last entry module
13322
+ */
13323
+ returnExportsFromRuntime: "return-exports-from-runtime",
13324
+ /**
13325
+ * the internal module object
13326
+ */
13327
+ module: "module",
13328
+ /**
13329
+ * the internal module object
13330
+ */
13331
+ moduleId: "module.id",
13332
+ /**
13333
+ * the internal module object
13334
+ */
13335
+ moduleLoaded: "module.loaded",
13336
+ /**
13337
+ * the bundle public path
13338
+ */
13339
+ publicPath: "__webpack_require__.p",
13340
+ /**
13341
+ * the module id of the entry point
13342
+ */
13343
+ entryModuleId: "__webpack_require__.s",
13344
+ /**
13345
+ * the module cache
13346
+ */
13347
+ moduleCache: "__webpack_require__.c",
13348
+ /**
13349
+ * the module functions
13350
+ */
13351
+ moduleFactories: "__webpack_require__.m",
13352
+ /**
13353
+ * the module functions, with only write access
13354
+ */
13355
+ moduleFactoriesAddOnly: "__webpack_require__.m (add only)",
13356
+ /**
13357
+ * the chunk ensure function
13358
+ */
13359
+ ensureChunk: "__webpack_require__.e",
13360
+ /**
13361
+ * an object with handlers to ensure a chunk
13362
+ */
13363
+ ensureChunkHandlers: "__webpack_require__.f",
13364
+ /**
13365
+ * a runtime requirement if ensureChunkHandlers should include loading of chunk needed for entries
13366
+ */
13367
+ ensureChunkIncludeEntries: "__webpack_require__.f (include entries)",
13368
+ /**
13369
+ * the chunk prefetch function
13370
+ */
13371
+ prefetchChunk: "__webpack_require__.E",
13372
+ /**
13373
+ * an object with handlers to prefetch a chunk
13374
+ */
13375
+ prefetchChunkHandlers: "__webpack_require__.F",
13376
+ /**
13377
+ * the chunk preload function
13378
+ */
13379
+ preloadChunk: "__webpack_require__.G",
13380
+ /**
13381
+ * an object with handlers to preload a chunk
13382
+ */
13383
+ preloadChunkHandlers: "__webpack_require__.H",
13384
+ /**
13385
+ * the exported property define getters function
13386
+ */
13387
+ definePropertyGetters: "__webpack_require__.d",
13388
+ /**
13389
+ * define compatibility on export
13390
+ */
13391
+ makeNamespaceObject: "__webpack_require__.r",
13392
+ /**
13393
+ * create a fake namespace object
13394
+ */
13395
+ createFakeNamespaceObject: "__webpack_require__.t",
13396
+ /**
13397
+ * compatibility get default export
13398
+ */
13399
+ compatGetDefaultExport: "__webpack_require__.n",
13400
+ /**
13401
+ * ES modules decorator
13402
+ */
13403
+ harmonyModuleDecorator: "__webpack_require__.hmd",
13404
+ /**
13405
+ * node.js module decorator
13406
+ */
13407
+ nodeModuleDecorator: "__webpack_require__.nmd",
13408
+ /**
13409
+ * the webpack hash
13410
+ */
13411
+ getFullHash: "__webpack_require__.h",
13412
+ /**
13413
+ * an object containing all installed WebAssembly.Instance export objects keyed by module id
13414
+ */
13415
+ wasmInstances: "__webpack_require__.w",
13416
+ /**
13417
+ * instantiate a wasm instance from module exports object, id, hash and importsObject
13418
+ */
13419
+ instantiateWasm: "__webpack_require__.v",
13420
+ /**
13421
+ * the uncaught error handler for the webpack runtime
13422
+ */
13423
+ uncaughtErrorHandler: "__webpack_require__.oe",
13424
+ /**
13425
+ * the script nonce
13426
+ */
13427
+ scriptNonce: "__webpack_require__.nc",
13428
+ /**
13429
+ * function to load a script tag.
13430
+ * Arguments: (url: string, done: (event) =\> void), key?: string | number, chunkId?: string | number) =\> void
13431
+ * done function is called when loading has finished or timeout occurred.
13432
+ * It will attach to existing script tags with data-webpack == uniqueName + ":" + key or src == url.
13433
+ */
13434
+ loadScript: "__webpack_require__.l",
13435
+ /**
13436
+ * function to promote a string to a TrustedScript using webpack's Trusted
13437
+ * Types policy
13438
+ * Arguments: (script: string) =\> TrustedScript
13439
+ */
13440
+ createScript: "__webpack_require__.ts",
13441
+ /**
13442
+ * function to promote a string to a TrustedScriptURL using webpack's Trusted
13443
+ * Types policy
13444
+ * Arguments: (url: string) =\> TrustedScriptURL
13445
+ */
13446
+ createScriptUrl: "__webpack_require__.tu",
13447
+ /**
13448
+ * function to return webpack's Trusted Types policy
13449
+ * Arguments: () =\> TrustedTypePolicy
13450
+ */
13451
+ getTrustedTypesPolicy: "__webpack_require__.tt",
13452
+ /**
13453
+ * a flag when a chunk has a fetch priority
13454
+ */
13455
+ hasFetchPriority: "has fetch priority",
13456
+ /**
13457
+ * the chunk name of the chunk with the runtime
13458
+ */
13459
+ chunkName: "__webpack_require__.cn",
13460
+ /**
13461
+ * the runtime id of the current runtime
13462
+ */
13463
+ runtimeId: "__webpack_require__.j",
13464
+ /**
13465
+ * the filename of the script part of the chunk
13466
+ */
13467
+ getChunkScriptFilename: "__webpack_require__.u",
13468
+ /**
13469
+ * the filename of the css part of the chunk
13470
+ */
13471
+ getChunkCssFilename: "__webpack_require__.k",
13472
+ /**
13473
+ * a flag when a module/chunk/tree has css modules
13474
+ */
13475
+ hasCssModules: "has css modules",
13476
+ /**
13477
+ * the filename of the script part of the hot update chunk
13478
+ */
13479
+ getChunkUpdateScriptFilename: "__webpack_require__.hu",
13480
+ /**
13481
+ * the filename of the css part of the hot update chunk
13482
+ */
13483
+ getChunkUpdateCssFilename: "__webpack_require__.hk",
13484
+ /**
13485
+ * startup signal from runtime
13486
+ * This will be called when the runtime chunk has been loaded.
13487
+ */
13488
+ startup: "__webpack_require__.x",
13489
+ /**
13490
+ * @deprecated
13491
+ * creating a default startup function with the entry modules
13492
+ */
13493
+ startupNoDefault: "__webpack_require__.x (no default handler)",
13494
+ /**
13495
+ * startup signal from runtime but only used to add logic after the startup
13496
+ */
13497
+ startupOnlyAfter: "__webpack_require__.x (only after)",
13498
+ /**
13499
+ * startup signal from runtime but only used to add sync logic before the startup
13500
+ */
13501
+ startupOnlyBefore: "__webpack_require__.x (only before)",
13502
+ /**
13503
+ * global callback functions for installing chunks
13504
+ */
13505
+ chunkCallback: "webpackChunk",
13506
+ /**
13507
+ * method to startup an entrypoint with needed chunks.
13508
+ * Signature: (moduleId: Id, chunkIds: Id[]) =\> any.
13509
+ * Returns the exports of the module or a Promise
13510
+ */
13511
+ startupEntrypoint: "__webpack_require__.X",
13512
+ /**
13513
+ * register deferred code, which will run when certain
13514
+ * chunks are loaded.
13515
+ * Signature: (chunkIds: Id[], fn: () =\> any, priority: int \>= 0 = 0) =\> any
13516
+ * Returned value will be returned directly when all chunks are already loaded
13517
+ * When (priority & 1) it will wait for all other handlers with lower priority to
13518
+ * be executed before itself is executed
13519
+ */
13520
+ onChunksLoaded: "__webpack_require__.O",
13521
+ /**
13522
+ * method to install a chunk that was loaded somehow
13523
+ * Signature: (\{ id, ids, modules, runtime \}) =\> void
13524
+ */
13525
+ externalInstallChunk: "__webpack_require__.C",
13526
+ /**
13527
+ * interceptor for module executions
13528
+ */
13529
+ interceptModuleExecution: "__webpack_require__.i",
13530
+ /**
13531
+ * the global object
13532
+ */
13533
+ global: "__webpack_require__.g",
13534
+ /**
13535
+ * an object with all share scopes
13536
+ */
13537
+ shareScopeMap: "__webpack_require__.S",
13538
+ /**
13539
+ * The sharing init sequence function (only runs once per share scope).
13540
+ * Has one argument, the name of the share scope.
13541
+ * Creates a share scope if not existing
13542
+ */
13543
+ initializeSharing: "__webpack_require__.I",
13544
+ /**
13545
+ * The current scope when getting a module from a remote
13546
+ */
13547
+ currentRemoteGetScope: "__webpack_require__.R",
13548
+ /**
13549
+ * the filename of the HMR manifest
13550
+ */
13551
+ getUpdateManifestFilename: "__webpack_require__.hmrF",
13552
+ /**
13553
+ * function downloading the update manifest
13554
+ */
13555
+ hmrDownloadManifest: "__webpack_require__.hmrM",
13556
+ /**
13557
+ * array with handler functions to download chunk updates
13558
+ */
13559
+ hmrDownloadUpdateHandlers: "__webpack_require__.hmrC",
13560
+ /**
13561
+ * object with all hmr module data for all modules
13562
+ */
13563
+ hmrModuleData: "__webpack_require__.hmrD",
13564
+ /**
13565
+ * array with handler functions when a module should be invalidated
13566
+ */
13567
+ hmrInvalidateModuleHandlers: "__webpack_require__.hmrI",
13568
+ /**
13569
+ * the prefix for storing state of runtime modules when hmr is enabled
13570
+ */
13571
+ hmrRuntimeStatePrefix: "__webpack_require__.hmrS",
13572
+ /**
13573
+ * the AMD define function
13574
+ */
13575
+ amdDefine: "__webpack_require__.amdD",
13576
+ /**
13577
+ * the AMD options
13578
+ */
13579
+ amdOptions: "__webpack_require__.amdO",
13580
+ /**
13581
+ * the System polyfill object
13582
+ */
13583
+ system: "__webpack_require__.System",
13584
+ /**
13585
+ * the shorthand for Object.prototype.hasOwnProperty
13586
+ * using of it decreases the compiled bundle size
13587
+ */
13588
+ hasOwnProperty: "__webpack_require__.o",
13589
+ /**
13590
+ * the System.register context object
13591
+ */
13592
+ systemContext: "__webpack_require__.y",
13593
+ /**
13594
+ * the baseURI of current document
13595
+ */
13596
+ baseURI: "__webpack_require__.b",
13597
+ /**
13598
+ * a RelativeURL class when relative URLs are used
13599
+ */
13600
+ relativeUrl: "__webpack_require__.U",
13601
+ /**
13602
+ * Creates an async module. The body function must be a async function.
13603
+ * "module.exports" will be decorated with an AsyncModulePromise.
13604
+ * The body function will be called.
13605
+ * To handle async dependencies correctly do this: "([a, b, c] = await handleDependencies([a, b, c]));".
13606
+ * If "hasAwaitAfterDependencies" is truthy, "handleDependencies()" must be called at the end of the body function.
13607
+ * Signature: function(
13608
+ * module: Module,
13609
+ * body: (handleDependencies: (deps: AsyncModulePromise[]) =\> Promise\<any[]\> & () =\> void,
13610
+ * hasAwaitAfterDependencies?: boolean
13611
+ * ) =\> void
13612
+ */
13613
+ asyncModule: "__webpack_require__.a"
13614
+ };
13615
+ for (const entry2 of Object.entries(RuntimeGlobals)) {
13616
+ REVERSE_RUNTIME_GLOBALS.set(entry2[1], entry2[0]);
13617
+ }
13618
+
13619
+ // src/taps/compilation.ts
13620
+ var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) => {
13621
+ return {
13622
+ registerCompilationAdditionalTreeRuntimeRequirementsTaps: createTap(
13623
+ binding3.RegisterJsTapKind.CompilationAdditionalTreeRuntimeRequirements,
13624
+ function() {
13625
+ return getCompiler().__internal__get_compilation().hooks.additionalTreeRuntimeRequirements;
13626
+ },
13627
+ function(queried) {
13628
+ return function({
13629
+ chunk,
13630
+ runtimeRequirements
13631
+ }) {
13632
+ const set = __from_binding_runtime_globals(runtimeRequirements);
13633
+ queried.call(Chunk.__from_binding(chunk), set);
13634
+ return {
13635
+ runtimeRequirements: __to_binding_runtime_globals(set)
13636
+ };
13637
+ };
13638
+ }
13639
+ ),
13640
+ registerCompilationRuntimeRequirementInTreeTaps: createMapTap(
13641
+ binding3.RegisterJsTapKind.CompilationRuntimeRequirementInTree,
13642
+ function() {
13643
+ return getCompiler().__internal__get_compilation().hooks.runtimeRequirementInTree;
13644
+ },
13645
+ function(queried) {
13646
+ return function({
13647
+ chunk: chunkBinding,
13648
+ runtimeRequirements
13649
+ }) {
13650
+ const set = __from_binding_runtime_globals(runtimeRequirements);
13651
+ const chunk = Chunk.__from_binding(chunkBinding);
13652
+ for (const r of set) {
13653
+ queried.for(r).call(chunk, set);
13654
+ }
13655
+ return {
13656
+ runtimeRequirements: __to_binding_runtime_globals(set)
13657
+ };
13658
+ };
13659
+ }
13660
+ ),
13661
+ registerCompilationRuntimeModuleTaps: createTap(
13662
+ binding3.RegisterJsTapKind.CompilationRuntimeModule,
13663
+ function() {
13664
+ return getCompiler().__internal__get_compilation().hooks.runtimeModule;
13665
+ },
13666
+ function(queried) {
13667
+ return function({ module: module2, chunk }) {
13668
+ var _a, _b;
13669
+ const originSource = (_a = module2.source) == null ? void 0 : _a.source;
13670
+ queried.call(module2, Chunk.__from_binding(chunk));
13671
+ const newSource = (_b = module2.source) == null ? void 0 : _b.source;
13672
+ if (newSource && newSource !== originSource) {
13673
+ return module2;
13674
+ }
13675
+ return;
13676
+ };
13677
+ }
13678
+ ),
13679
+ registerCompilationBuildModuleTaps: createTap(
13680
+ binding3.RegisterJsTapKind.CompilationBuildModule,
13681
+ function() {
13682
+ return getCompiler().__internal__get_compilation().hooks.buildModule;
13683
+ },
13684
+ function(queried) {
13685
+ return function(m) {
13686
+ return queried.call(Module.__from_binding(m));
13687
+ };
13688
+ }
13689
+ ),
13690
+ registerCompilationStillValidModuleTaps: createTap(
13691
+ binding3.RegisterJsTapKind.CompilationStillValidModule,
13692
+ function() {
13693
+ return getCompiler().__internal__get_compilation().hooks.stillValidModule;
13694
+ },
13695
+ function(queried) {
13696
+ return function(m) {
13697
+ return queried.call(Module.__from_binding(m));
13698
+ };
13699
+ }
13700
+ ),
13701
+ registerCompilationSucceedModuleTaps: createTap(
13702
+ binding3.RegisterJsTapKind.CompilationSucceedModule,
13703
+ function() {
13704
+ return getCompiler().__internal__get_compilation().hooks.succeedModule;
13705
+ },
13706
+ function(queried) {
13707
+ return function(m) {
13708
+ return queried.call(Module.__from_binding(m));
13709
+ };
13710
+ }
13711
+ ),
13712
+ registerCompilationExecuteModuleTaps: createTap(
13713
+ binding3.RegisterJsTapKind.CompilationExecuteModule,
13714
+ function() {
13715
+ return getCompiler().__internal__get_compilation().hooks.executeModule;
13716
+ },
13717
+ function(queried) {
13718
+ return function({
13719
+ entry: entry2,
13720
+ id,
13721
+ codegenResults,
13722
+ runtimeModules
13723
+ }) {
13724
+ try {
13725
+ const __webpack_require__ = (id2) => {
13726
+ const cached = moduleCache[id2];
13727
+ if (cached !== void 0) {
13728
+ if (cached.error) throw cached.error;
13729
+ return cached.exports;
13730
+ }
13731
+ const execOptions = {
13732
+ id: id2,
13733
+ module: {
13734
+ id: id2,
13735
+ exports: {},
13736
+ loaded: false,
13737
+ error: void 0
13738
+ },
13739
+ require: __webpack_require__
13740
+ };
13741
+ for (const handler of interceptModuleExecution) {
13742
+ handler(execOptions);
13743
+ }
13744
+ const result2 = codegenResults.map[id2]["build time"];
13745
+ const moduleObject = execOptions.module;
13746
+ if (id2) moduleCache[id2] = moduleObject;
13747
+ tryRunOrWebpackError(
13748
+ () => queried.call(
13749
+ {
13750
+ codeGenerationResult: new CodeGenerationResult(result2),
13751
+ moduleObject
13752
+ },
13753
+ { __webpack_require__ }
13754
+ ),
13755
+ "Compilation.hooks.executeModule"
13756
+ );
13757
+ moduleObject.loaded = true;
13758
+ return moduleObject.exports;
13759
+ };
13760
+ const moduleCache = __webpack_require__[RuntimeGlobals.moduleCache.replace(
13761
+ `${RuntimeGlobals.require}.`,
13762
+ ""
13763
+ )] = {};
13764
+ const interceptModuleExecution = __webpack_require__[RuntimeGlobals.interceptModuleExecution.replace(
13765
+ `${RuntimeGlobals.require}.`,
13766
+ ""
13767
+ )] = [];
13768
+ for (const runtimeModule of runtimeModules) {
13769
+ __webpack_require__(runtimeModule);
13770
+ }
13771
+ const executeResult = __webpack_require__(entry2);
13772
+ getCompiler().__internal__get_module_execution_results_map().set(id, executeResult);
13773
+ } catch (e) {
13774
+ getCompiler().__internal__get_module_execution_results_map().set(id, e);
13775
+ throw e;
13776
+ }
13777
+ };
13778
+ }
13779
+ ),
13780
+ registerCompilationFinishModulesTaps: createTap(
13781
+ binding3.RegisterJsTapKind.CompilationFinishModules,
13782
+ function() {
13783
+ return getCompiler().__internal__get_compilation().hooks.finishModules;
13784
+ },
13785
+ function(queried) {
13786
+ return async function() {
13787
+ return await queried.promise(
13788
+ getCompiler().__internal__get_compilation().modules
13789
+ );
13790
+ };
13791
+ }
13792
+ ),
13793
+ registerCompilationOptimizeModulesTaps: createTap(
13794
+ binding3.RegisterJsTapKind.CompilationOptimizeModules,
13795
+ function() {
13796
+ return getCompiler().__internal__get_compilation().hooks.optimizeModules;
13797
+ },
13798
+ function(queried) {
13799
+ return function() {
13800
+ return queried.call(
13801
+ getCompiler().__internal__get_compilation().modules.values()
13802
+ );
13803
+ };
13804
+ }
13805
+ ),
13806
+ registerCompilationAfterOptimizeModulesTaps: createTap(
13807
+ binding3.RegisterJsTapKind.CompilationAfterOptimizeModules,
13808
+ function() {
13809
+ return getCompiler().__internal__get_compilation().hooks.afterOptimizeModules;
13810
+ },
13811
+ function(queried) {
13812
+ return function() {
13813
+ queried.call(
13814
+ getCompiler().__internal__get_compilation().modules.values()
13815
+ );
13816
+ };
13817
+ }
13818
+ ),
13819
+ registerCompilationOptimizeTreeTaps: createTap(
13820
+ binding3.RegisterJsTapKind.CompilationOptimizeTree,
13821
+ function() {
13822
+ return getCompiler().__internal__get_compilation().hooks.optimizeTree;
13823
+ },
13824
+ function(queried) {
13825
+ return async function() {
13826
+ return await queried.promise(
13827
+ getCompiler().__internal__get_compilation().chunks,
13828
+ getCompiler().__internal__get_compilation().modules
13829
+ );
13830
+ };
13831
+ }
13832
+ ),
13833
+ registerCompilationOptimizeChunkModulesTaps: createTap(
13834
+ binding3.RegisterJsTapKind.CompilationOptimizeChunkModules,
13835
+ function() {
13836
+ return getCompiler().__internal__get_compilation().hooks.optimizeChunkModules;
13837
+ },
13838
+ function(queried) {
13839
+ return async function() {
13840
+ return await queried.promise(
13841
+ getCompiler().__internal__get_compilation().chunks,
13842
+ getCompiler().__internal__get_compilation().modules
13843
+ );
13844
+ };
13845
+ }
13846
+ ),
13847
+ registerCompilationChunkHashTaps: createTap(
13848
+ binding3.RegisterJsTapKind.CompilationChunkHash,
13849
+ function() {
13850
+ return getCompiler().__internal__get_compilation().hooks.chunkHash;
13851
+ },
13852
+ function(queried) {
13853
+ return function(chunk) {
13854
+ if (!getCompiler().options.output.hashFunction) {
13855
+ throw new Error("'output.hashFunction' cannot be undefined");
13856
+ }
13857
+ const hash = createHash(getCompiler().options.output.hashFunction);
13858
+ queried.call(Chunk.__from_binding(chunk), hash);
13859
+ const digestResult = hash.digest(
13860
+ getCompiler().options.output.hashDigest
13861
+ );
13862
+ return Buffer.from(digestResult);
13863
+ };
13864
+ }
13865
+ ),
13866
+ registerCompilationChunkAssetTaps: createTap(
13867
+ binding3.RegisterJsTapKind.CompilationChunkAsset,
13868
+ function() {
13869
+ return getCompiler().__internal__get_compilation().hooks.chunkAsset;
13870
+ },
13871
+ function(queried) {
13872
+ return function({ chunk, filename: filename2 }) {
13873
+ return queried.call(Chunk.__from_binding(chunk), filename2);
13874
+ };
13875
+ }
13876
+ ),
13877
+ registerCompilationProcessAssetsTaps: createTap(
13878
+ binding3.RegisterJsTapKind.CompilationProcessAssets,
13879
+ function() {
13880
+ return getCompiler().__internal__get_compilation().hooks.processAssets;
13881
+ },
13882
+ function(queried) {
13883
+ return async function() {
13884
+ return await queried.promise(
13885
+ getCompiler().__internal__get_compilation().assets
13886
+ );
13887
+ };
13888
+ }
13889
+ ),
13890
+ registerCompilationAfterProcessAssetsTaps: createTap(
13891
+ binding3.RegisterJsTapKind.CompilationAfterProcessAssets,
13892
+ function() {
13893
+ return getCompiler().__internal__get_compilation().hooks.afterProcessAssets;
13894
+ },
13895
+ function(queried) {
13896
+ return function() {
13897
+ return queried.call(
13898
+ getCompiler().__internal__get_compilation().assets
13899
+ );
13900
+ };
13901
+ }
13902
+ ),
13903
+ registerCompilationSealTaps: createTap(
13904
+ binding3.RegisterJsTapKind.CompilationSeal,
13905
+ function() {
13906
+ return getCompiler().__internal__get_compilation().hooks.seal;
13907
+ },
13908
+ function(queried) {
13909
+ return function() {
13910
+ return queried.call();
13911
+ };
13912
+ }
13913
+ ),
13914
+ registerCompilationAfterSealTaps: createTap(
13915
+ binding3.RegisterJsTapKind.CompilationAfterSeal,
13916
+ function() {
13917
+ return getCompiler().__internal__get_compilation().hooks.afterSeal;
13918
+ },
13919
+ function(queried) {
13920
+ return async function() {
13921
+ return await queried.promise();
13922
+ };
13923
+ }
13924
+ )
13925
+ };
13926
+ };
13927
+
13928
+ // src/taps/compiler.ts
13929
+ var binding4 = __toESM(require("@rspack/binding"));
13930
+ var createCompilerHooksRegisters = (getCompiler, createTap, createMapTap) => {
13931
+ return {
13932
+ registerCompilerThisCompilationTaps: createTap(
13933
+ binding4.RegisterJsTapKind.CompilerThisCompilation,
13934
+ function() {
13935
+ return getCompiler().hooks.thisCompilation;
13936
+ },
13937
+ function(queried) {
13938
+ return function(native) {
13939
+ getCompiler().__internal__create_compilation(native);
13940
+ return queried.call(
13941
+ getCompiler().__internal__get_compilation(),
13942
+ getCompiler().__internal__get_compilation_params()
13943
+ );
13944
+ };
13945
+ }
13946
+ ),
13947
+ registerCompilerCompilationTaps: createTap(
13948
+ binding4.RegisterJsTapKind.CompilerCompilation,
13949
+ function() {
13950
+ return getCompiler().hooks.compilation;
13951
+ },
13952
+ function(queried) {
13953
+ return function() {
13954
+ return queried.call(
13955
+ getCompiler().__internal__get_compilation(),
13956
+ getCompiler().__internal__get_compilation_params()
13957
+ );
13958
+ };
13959
+ }
13960
+ ),
13961
+ registerCompilerMakeTaps: createTap(
13962
+ binding4.RegisterJsTapKind.CompilerMake,
13963
+ function() {
13964
+ return getCompiler().hooks.make;
13965
+ },
13966
+ function(queried) {
13967
+ return async function() {
13968
+ return await queried.promise(
13969
+ getCompiler().__internal__get_compilation()
13970
+ );
13971
+ };
13972
+ }
13973
+ ),
13974
+ registerCompilerFinishMakeTaps: createTap(
13975
+ binding4.RegisterJsTapKind.CompilerFinishMake,
13976
+ function() {
13977
+ return getCompiler().hooks.finishMake;
13978
+ },
13979
+ function(queried) {
13980
+ return async function() {
13981
+ return await queried.promise(
13982
+ getCompiler().__internal__get_compilation()
13983
+ );
13984
+ };
13985
+ }
13986
+ ),
13987
+ registerCompilerShouldEmitTaps: createTap(
13988
+ binding4.RegisterJsTapKind.CompilerShouldEmit,
13989
+ function() {
13990
+ return getCompiler().hooks.shouldEmit;
13991
+ },
13992
+ function(queried) {
13993
+ return function() {
13994
+ return queried.call(getCompiler().__internal__get_compilation());
13995
+ };
13996
+ }
13997
+ ),
13998
+ registerCompilerEmitTaps: createTap(
13999
+ binding4.RegisterJsTapKind.CompilerEmit,
14000
+ function() {
14001
+ return getCompiler().hooks.emit;
14002
+ },
14003
+ function(queried) {
14004
+ return async function() {
14005
+ return await queried.promise(
14006
+ getCompiler().__internal__get_compilation()
14007
+ );
14008
+ };
14009
+ }
14010
+ ),
14011
+ registerCompilerAfterEmitTaps: createTap(
14012
+ binding4.RegisterJsTapKind.CompilerAfterEmit,
14013
+ function() {
14014
+ return getCompiler().hooks.afterEmit;
14015
+ },
14016
+ function(queried) {
14017
+ return async function() {
14018
+ return await queried.promise(
14019
+ getCompiler().__internal__get_compilation()
14020
+ );
14021
+ };
14022
+ }
14023
+ ),
14024
+ registerCompilerAssetEmittedTaps: createTap(
14025
+ binding4.RegisterJsTapKind.CompilerAssetEmitted,
14026
+ function() {
14027
+ return getCompiler().hooks.assetEmitted;
14028
+ },
14029
+ function(queried) {
14030
+ return async function({
14031
+ filename: filename2,
14032
+ targetPath,
14033
+ outputPath
14034
+ }) {
14035
+ return queried.promise(filename2, {
14036
+ compilation: getCompiler().__internal__get_compilation(),
14037
+ targetPath,
14038
+ outputPath,
14039
+ get source() {
14040
+ var _a;
14041
+ return (_a = getCompiler().__internal__get_compilation().getAsset(filename2)) == null ? void 0 : _a.source;
14042
+ },
14043
+ get content() {
14044
+ var _a;
14045
+ return (_a = this.source) == null ? void 0 : _a.buffer();
14046
+ }
14047
+ });
14048
+ };
14049
+ }
14050
+ )
14051
+ };
14052
+ };
14053
+
14054
+ // src/taps/contextModuleFactory.ts
14055
+ var binding5 = __toESM(require("@rspack/binding"));
14056
+ var createContextModuleFactoryHooksRegisters = (getCompiler, createTap, createMapTap) => {
14057
+ return {
14058
+ registerContextModuleFactoryBeforeResolveTaps: createTap(
14059
+ binding5.RegisterJsTapKind.ContextModuleFactoryBeforeResolve,
14060
+ function() {
14061
+ return getCompiler().__internal__get_compilation_params().contextModuleFactory.hooks.beforeResolve;
14062
+ },
14063
+ function(queried) {
14064
+ return async function(bindingData) {
14065
+ const data = bindingData ? ContextModuleFactoryBeforeResolveData.__from_binding(bindingData) : false;
14066
+ const result2 = await queried.promise(data);
14067
+ return result2 ? ContextModuleFactoryBeforeResolveData.__to_binding(result2) : false;
14068
+ };
14069
+ }
14070
+ ),
14071
+ registerContextModuleFactoryAfterResolveTaps: createTap(
14072
+ binding5.RegisterJsTapKind.ContextModuleFactoryAfterResolve,
14073
+ function() {
14074
+ return getCompiler().__internal__get_compilation_params().contextModuleFactory.hooks.afterResolve;
14075
+ },
14076
+ function(queried) {
14077
+ return async function(bindingData) {
14078
+ const data = bindingData ? ContextModuleFactoryAfterResolveData.__from_binding(bindingData) : false;
14079
+ const result2 = await queried.promise(data);
14080
+ return result2 ? ContextModuleFactoryAfterResolveData.__to_binding(result2) : false;
14081
+ };
14082
+ }
14083
+ )
14084
+ };
14085
+ };
14086
+
14087
+ // src/taps/javascriptModules.ts
14088
+ var binding6 = __toESM(require("@rspack/binding"));
14089
+ var createJavaScriptModulesHooksRegisters = (getCompiler, createTap, createMapTap) => {
14090
+ return {
14091
+ registerJavascriptModulesChunkHashTaps: createTap(
14092
+ binding6.RegisterJsTapKind.JavascriptModulesChunkHash,
14093
+ function() {
14094
+ return JavascriptModulesPlugin.getCompilationHooks(
14095
+ getCompiler().__internal__get_compilation()
14096
+ ).chunkHash;
14097
+ },
14098
+ function(queried) {
14099
+ return function(chunk) {
14100
+ if (!getCompiler().options.output.hashFunction) {
14101
+ throw new Error("'output.hashFunction' cannot be undefined");
14102
+ }
14103
+ const hash = createHash(getCompiler().options.output.hashFunction);
14104
+ queried.call(Chunk.__from_binding(chunk), hash);
14105
+ const digestResult = hash.digest(
14106
+ getCompiler().options.output.hashDigest
14107
+ );
14108
+ return Buffer.from(digestResult);
14109
+ };
14110
+ }
14111
+ )
14112
+ };
14113
+ };
14114
+
14115
+ // src/taps/normalModuleFactory.ts
14116
+ var binding7 = __toESM(require("@rspack/binding"));
14117
+ var createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMapTap) => {
14118
+ return {
14119
+ registerNormalModuleFactoryBeforeResolveTaps: createTap(
14120
+ binding7.RegisterJsTapKind.NormalModuleFactoryBeforeResolve,
14121
+ function() {
14122
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.beforeResolve;
14123
+ },
14124
+ function(queried) {
14125
+ return async function(resolveData) {
14126
+ const normalizedResolveData = {
14127
+ contextInfo: {
14128
+ issuer: resolveData.issuer
14129
+ },
14130
+ request: resolveData.request,
14131
+ context: resolveData.context,
14132
+ fileDependencies: [],
14133
+ missingDependencies: [],
14134
+ contextDependencies: []
14135
+ };
14136
+ const ret = await queried.promise(normalizedResolveData);
14137
+ resolveData.request = normalizedResolveData.request;
14138
+ resolveData.context = normalizedResolveData.context;
14139
+ return [ret, resolveData];
14140
+ };
14141
+ }
14142
+ ),
14143
+ registerNormalModuleFactoryFactorizeTaps: createTap(
14144
+ binding7.RegisterJsTapKind.NormalModuleFactoryFactorize,
14145
+ function() {
14146
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.factorize;
14147
+ },
14148
+ function(queried) {
14149
+ return async function(resolveData) {
14150
+ const normalizedResolveData = {
14151
+ contextInfo: {
14152
+ issuer: resolveData.issuer
14153
+ },
14154
+ request: resolveData.request,
14155
+ context: resolveData.context,
14156
+ fileDependencies: [],
14157
+ missingDependencies: [],
14158
+ contextDependencies: []
14159
+ };
14160
+ await queried.promise(normalizedResolveData);
14161
+ resolveData.request = normalizedResolveData.request;
14162
+ resolveData.context = normalizedResolveData.context;
14163
+ return resolveData;
14164
+ };
14165
+ }
14166
+ ),
14167
+ registerNormalModuleFactoryResolveTaps: createTap(
14168
+ binding7.RegisterJsTapKind.NormalModuleFactoryResolve,
14169
+ function() {
14170
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.resolve;
14171
+ },
14172
+ function(queried) {
14173
+ return async function(resolveData) {
14174
+ const normalizedResolveData = {
14175
+ contextInfo: {
14176
+ issuer: resolveData.issuer
14177
+ },
14178
+ request: resolveData.request,
14179
+ context: resolveData.context,
14180
+ fileDependencies: [],
14181
+ missingDependencies: [],
14182
+ contextDependencies: []
14183
+ };
14184
+ await queried.promise(normalizedResolveData);
14185
+ resolveData.request = normalizedResolveData.request;
14186
+ resolveData.context = normalizedResolveData.context;
14187
+ return resolveData;
14188
+ };
14189
+ }
14190
+ ),
14191
+ registerNormalModuleFactoryResolveForSchemeTaps: createMapTap(
14192
+ binding7.RegisterJsTapKind.NormalModuleFactoryResolveForScheme,
14193
+ function() {
14194
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.resolveForScheme;
14195
+ },
14196
+ function(queried) {
14197
+ return async function(args) {
14198
+ const ret = await queried.for(args.scheme).promise(args.resourceData);
14199
+ return [ret, args.resourceData];
14200
+ };
14201
+ }
14202
+ ),
14203
+ registerNormalModuleFactoryAfterResolveTaps: createTap(
14204
+ binding7.RegisterJsTapKind.NormalModuleFactoryAfterResolve,
14205
+ function() {
14206
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.afterResolve;
14207
+ },
14208
+ function(queried) {
14209
+ return async function(arg) {
14210
+ const data = {
14211
+ contextInfo: {
14212
+ issuer: arg.issuer
14213
+ },
14214
+ request: arg.request,
14215
+ context: arg.context,
14216
+ fileDependencies: arg.fileDependencies,
14217
+ missingDependencies: arg.missingDependencies,
14218
+ contextDependencies: arg.contextDependencies,
14219
+ createData: arg.createData
14220
+ };
14221
+ const ret = await queried.promise(data);
14222
+ return [ret, data.createData];
14223
+ };
14224
+ }
14225
+ ),
14226
+ registerNormalModuleFactoryCreateModuleTaps: createTap(
14227
+ binding7.RegisterJsTapKind.NormalModuleFactoryCreateModule,
14228
+ function() {
14229
+ return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.createModule;
14230
+ },
14231
+ function(queried) {
14232
+ return async function(args) {
14233
+ const data = {
14234
+ ...args,
14235
+ settings: {}
14236
+ };
14237
+ await queried.promise(data, {});
14238
+ };
14239
+ }
14240
+ )
14241
+ };
14242
+ };
14243
+
14244
+ // src/Compiler.ts
14245
+ var COMPILATION_WEAK_MAP = /* @__PURE__ */ new WeakMap();
14246
+ var Compiler = class _Compiler {
14247
+ #instance;
14248
+ #initial;
14249
+ #compilation;
14250
+ #compilationParams;
14251
+ #builtinPlugins;
14252
+ #moduleExecutionResultsMap;
14253
+ #nonSkippableRegisters;
14254
+ #registers;
14255
+ #ruleSet;
14256
+ constructor(context2, options) {
14257
+ this.#initial = true;
14258
+ this.#builtinPlugins = [];
14259
+ this.#nonSkippableRegisters = [];
14260
+ this.#moduleExecutionResultsMap = /* @__PURE__ */ new Map();
14261
+ this.#ruleSet = new RuleSetCompiler();
14262
+ this.hooks = {
14263
+ initialize: new liteTapable7.SyncHook([]),
14264
+ shouldEmit: new liteTapable7.SyncBailHook(["compilation"]),
14265
+ done: new liteTapable7.AsyncSeriesHook(["stats"]),
14266
+ afterDone: new liteTapable7.SyncHook(["stats"]),
14267
+ beforeRun: new liteTapable7.AsyncSeriesHook(["compiler"]),
14268
+ run: new liteTapable7.AsyncSeriesHook(["compiler"]),
14269
+ emit: new liteTapable7.AsyncSeriesHook(["compilation"]),
14270
+ assetEmitted: new liteTapable7.AsyncSeriesHook(["file", "info"]),
14271
+ afterEmit: new liteTapable7.AsyncSeriesHook(["compilation"]),
14272
+ thisCompilation: new liteTapable7.SyncHook(["compilation", "params"]),
14273
+ compilation: new liteTapable7.SyncHook([
14274
+ "compilation",
14275
+ "params"
14276
+ ]),
14277
+ invalid: new liteTapable7.SyncHook(["filename", "changeTime"]),
14278
+ compile: new liteTapable7.SyncHook(["params"]),
14279
+ infrastructureLog: new liteTapable7.SyncBailHook([
14280
+ "origin",
14281
+ "type",
14282
+ "args"
14283
+ ]),
14284
+ failed: new liteTapable7.SyncHook(["error"]),
14285
+ shutdown: new liteTapable7.AsyncSeriesHook([]),
14286
+ normalModuleFactory: new liteTapable7.SyncHook([
14287
+ "normalModuleFactory"
14288
+ ]),
14289
+ contextModuleFactory: new liteTapable7.SyncHook([
14290
+ "contextModuleFactory"
14291
+ ]),
14292
+ watchRun: new liteTapable7.AsyncSeriesHook(["compiler"]),
14293
+ watchClose: new liteTapable7.SyncHook([]),
14294
+ environment: new liteTapable7.SyncHook([]),
14295
+ afterEnvironment: new liteTapable7.SyncHook([]),
14296
+ afterPlugins: new liteTapable7.SyncHook(["compiler"]),
14297
+ afterResolvers: new liteTapable7.SyncHook(["compiler"]),
14298
+ make: new liteTapable7.AsyncParallelHook(["compilation"]),
14299
+ beforeCompile: new liteTapable7.AsyncSeriesHook(["params"]),
14300
+ afterCompile: new liteTapable7.AsyncSeriesHook(["compilation"]),
14301
+ finishMake: new liteTapable7.AsyncSeriesHook(["compilation"]),
14302
+ entryOption: new liteTapable7.SyncBailHook(["context", "entry"]),
14303
+ additionalPass: new liteTapable7.AsyncSeriesHook([])
14304
+ };
14305
+ this.webpack = rspack;
14306
+ this.rspack = rspack;
14307
+ this.root = this;
14308
+ this.outputPath = "";
14309
+ this.inputFileSystem = null;
14310
+ this.intermediateFileSystem = null;
14311
+ this.outputFileSystem = null;
14312
+ this.watchFileSystem = null;
14313
+ this.records = {};
14314
+ this.options = options;
14315
+ this.context = context2;
14316
+ this.cache = new Cache_default();
14317
+ this.compilerPath = "";
14318
+ this.running = false;
14319
+ this.idle = false;
14320
+ this.watchMode = false;
14321
+ new JsLoaderRspackPlugin(this).apply(this);
14322
+ new ExecuteModulePlugin().apply(this);
14323
+ }
14324
+ get recordsInputPath() {
14325
+ return unsupported("Compiler.recordsInputPath");
14326
+ }
14327
+ get recordsOutputPath() {
14328
+ return unsupported("Compiler.recordsOutputPath");
14329
+ }
14330
+ get managedPaths() {
14331
+ return unsupported("Compiler.managedPaths");
14332
+ }
14333
+ get immutablePaths() {
14334
+ return unsupported("Compiler.immutablePaths");
14335
+ }
14336
+ get _lastCompilation() {
14337
+ return this.#compilation;
14338
+ }
14339
+ /**
14340
+ * Note: This is not a webpack public API, maybe removed in future.
14341
+ * @internal
14342
+ */
14343
+ get __internal__builtinPlugins() {
14344
+ return this.#builtinPlugins;
14345
+ }
14346
+ /**
14347
+ * Note: This is not a webpack public API, maybe removed in future.
14348
+ * @internal
14349
+ */
14350
+ get __internal__ruleSet() {
14351
+ return this.#ruleSet;
14352
+ }
14353
+ /**
14354
+ * @param name - cache name
14355
+ * @returns the cache facade instance
14356
+ */
14357
+ getCache(name2) {
14358
+ return new CacheFacade_default(
14359
+ this.cache,
14360
+ `${this.compilerPath}${name2}`,
14361
+ this.options.output.hashFunction
14362
+ );
14363
+ }
14364
+ /**
14365
+ * @param name - name of the logger, or function called once to get the logger name
14366
+ * @returns a logger with that name
14367
+ */
14368
+ getInfrastructureLogger(name2) {
14369
+ if (!name2) {
14370
+ throw new TypeError(
14371
+ "Compiler.getInfrastructureLogger(name) called without a name"
14372
+ );
14373
+ }
14374
+ let normalizedName = name2;
14375
+ return new Logger(
14376
+ (type, args) => {
14377
+ if (typeof normalizedName === "function") {
14378
+ normalizedName = normalizedName();
14379
+ if (!normalizedName) {
14380
+ throw new TypeError(
14381
+ "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
14382
+ );
14383
+ }
14384
+ } else {
14385
+ if (this.hooks.infrastructureLog.call(normalizedName, type, args) === void 0) {
14386
+ if (this.infrastructureLogger !== void 0) {
14387
+ this.infrastructureLogger(normalizedName, type, args);
14388
+ }
14389
+ }
13533
14390
  }
13534
14391
  },
13535
14392
  (childName) => {
@@ -13671,943 +14528,255 @@ var Compiler = class _Compiler {
13671
14528
  this.cache.endIdle((err) => {
13672
14529
  if (err) return callback(err);
13673
14530
  this.idle = false;
13674
- run();
13675
- });
13676
- } else {
13677
- run();
13678
- }
13679
- }
13680
- runAsChild(callback) {
13681
- const finalCallback = (err, entries, compilation) => {
13682
- try {
13683
- callback(err, entries, compilation);
13684
- } catch (e) {
13685
- const err2 = new Error(`compiler.runAsChild callback error: ${e}`);
13686
- this.parentCompilation.errors.push(err2);
13687
- console.log(e);
13688
- }
13689
- };
13690
- this.compile((err, compilation) => {
13691
- if (err) {
13692
- return finalCallback(err);
13693
- }
13694
- assertNotNill(compilation);
13695
- this.parentCompilation.children.push(compilation);
13696
- for (const { name: name2, source, info } of compilation.getAssets()) {
13697
- if (source) {
13698
- this.parentCompilation.emitAsset(name2, source, info);
13699
- }
13700
- }
13701
- const entries = [];
13702
- for (const ep of compilation.entrypoints.values()) {
13703
- entries.push(...ep.chunks);
13704
- }
13705
- return finalCallback(null, entries, compilation);
13706
- });
13707
- }
13708
- purgeInputFileSystem() {
13709
- var _a, _b;
13710
- (_b = (_a = this.inputFileSystem) == null ? void 0 : _a.purge) == null ? void 0 : _b.call(_a);
13711
- }
13712
- /**
13713
- * @param compilation - the compilation
13714
- * @param compilerName - the compiler's name
13715
- * @param compilerIndex - the compiler's index
13716
- * @param outputOptions - the output options
13717
- * @param plugins - the plugins to apply
13718
- * @returns a child compiler
13719
- */
13720
- createChildCompiler(compilation, compilerName, compilerIndex, outputOptions, plugins2) {
13721
- const options = {
13722
- ...this.options,
13723
- output: {
13724
- ...this.options.output,
13725
- ...outputOptions
13726
- }
13727
- };
13728
- applyRspackOptionsDefaults(options);
13729
- const childCompiler = new _Compiler(this.context, options);
13730
- childCompiler.name = compilerName;
13731
- childCompiler.outputPath = this.outputPath;
13732
- childCompiler.inputFileSystem = this.inputFileSystem;
13733
- childCompiler.outputFileSystem = null;
13734
- childCompiler.modifiedFiles = this.modifiedFiles;
13735
- childCompiler.removedFiles = this.removedFiles;
13736
- childCompiler.fileTimestamps = this.fileTimestamps;
13737
- childCompiler.contextTimestamps = this.contextTimestamps;
13738
- childCompiler.fsStartTime = this.fsStartTime;
13739
- childCompiler.cache = this.cache;
13740
- childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
13741
- const relativeCompilerName = makePathsRelative(
13742
- this.context,
13743
- compilerName,
13744
- this.root
13745
- );
13746
- if (!this.records[relativeCompilerName]) {
13747
- this.records[relativeCompilerName] = [];
13748
- }
13749
- if (this.records[relativeCompilerName][compilerIndex]) {
13750
- childCompiler.records = this.records[relativeCompilerName][compilerIndex];
13751
- } else {
13752
- this.records[relativeCompilerName].push(childCompiler.records = {});
13753
- }
13754
- childCompiler.parentCompilation = compilation;
13755
- childCompiler.root = this.root;
13756
- if (Array.isArray(plugins2)) {
13757
- for (const plugin2 of plugins2) {
13758
- if (plugin2) {
13759
- plugin2.apply(childCompiler);
13760
- }
13761
- }
13762
- }
13763
- childCompiler.#builtinPlugins = [
13764
- ...childCompiler.#builtinPlugins,
13765
- ...this.#builtinPlugins.filter(
13766
- (plugin2) => plugin2.canInherentFromParent === true
13767
- )
13768
- ];
13769
- for (const hookName in this.hooks) {
13770
- const name2 = hookName;
13771
- if (canInherentFromParent(name2)) {
13772
- if (childCompiler.hooks[name2]) {
13773
- childCompiler.hooks[name2].taps = this.hooks[name2].taps.slice();
13774
- }
13775
- }
13776
- }
13777
- compilation.hooks.childCompiler.call(
13778
- childCompiler,
13779
- compilerName,
13780
- compilerIndex
13781
- );
13782
- return childCompiler;
13783
- }
13784
- isChild() {
13785
- const isRoot = this.root === this;
13786
- return !isRoot;
13787
- }
13788
- compile(callback) {
13789
- const startTime = Date.now();
13790
- const params = this.#newCompilationParams();
13791
- this.hooks.beforeCompile.callAsync(params, (err) => {
13792
- if (err) {
13793
- return callback(err);
13794
- }
13795
- this.hooks.compile.call(params);
13796
- this.#resetThisCompilation();
13797
- this.#build((err2) => {
13798
- if (err2) {
13799
- return callback(err2);
13800
- }
13801
- this.#compilation.startTime = startTime;
13802
- this.#compilation.endTime = Date.now();
13803
- this.hooks.afterCompile.callAsync(this.#compilation, (err3) => {
13804
- if (err3) {
13805
- return callback(err3);
13806
- }
13807
- return callback(null, this.#compilation);
13808
- });
13809
- });
13810
- });
13811
- }
13812
- close(callback) {
13813
- if (this.watching) {
13814
- this.watching.close(() => {
13815
- this.close(callback);
13816
- });
13817
- return;
13818
- }
13819
- this.hooks.shutdown.callAsync((err) => {
13820
- if (err) return callback(err);
13821
- this.cache.shutdown(callback);
13822
- });
13823
- }
13824
- #build(callback) {
13825
- this.#getInstance((error, instance) => {
13826
- if (error) {
13827
- return callback == null ? void 0 : callback(error);
13828
- }
13829
- if (!this.#initial) {
13830
- instance.rebuild(
13831
- Array.from(this.modifiedFiles || []),
13832
- Array.from(this.removedFiles || []),
13833
- (error2) => {
13834
- if (error2) {
13835
- return callback == null ? void 0 : callback(error2);
13836
- }
13837
- callback == null ? void 0 : callback(null);
13838
- }
13839
- );
13840
- return;
13841
- }
13842
- this.#initial = false;
13843
- instance.build((error2) => {
13844
- if (error2) {
13845
- return callback == null ? void 0 : callback(error2);
13846
- }
13847
- callback == null ? void 0 : callback(null);
13848
- });
13849
- });
13850
- }
13851
- /**
13852
- * Note: This is not a webpack public API, maybe removed in future.
13853
- * @internal
13854
- */
13855
- __internal__rebuild(modifiedFiles, removedFiles, callback) {
13856
- this.#getInstance((error, instance) => {
13857
- if (error) {
13858
- return callback == null ? void 0 : callback(error);
13859
- }
13860
- instance.rebuild(
13861
- Array.from(modifiedFiles || []),
13862
- Array.from(removedFiles || []),
13863
- (error2) => {
13864
- if (error2) {
13865
- return callback == null ? void 0 : callback(error2);
13866
- }
13867
- callback == null ? void 0 : callback(null);
13868
- }
13869
- );
13870
- });
13871
- }
13872
- #createCompilation(native) {
13873
- let compilation = COMPILATION_WEAK_MAP.get(native);
13874
- if (!compilation) {
13875
- compilation = new Compilation(this, native);
13876
- compilation.name = this.name;
13877
- COMPILATION_WEAK_MAP.set(native, compilation);
14531
+ run();
14532
+ });
14533
+ } else {
14534
+ run();
13878
14535
  }
13879
- this.#compilation = compilation;
13880
- return compilation;
13881
14536
  }
13882
- #resetThisCompilation() {
13883
- this.#compilation = void 0;
13884
- this.hooks.thisCompilation.intercept({
13885
- call: () => {
14537
+ runAsChild(callback) {
14538
+ const finalCallback = (err, entries, compilation) => {
14539
+ try {
14540
+ callback(err, entries, compilation);
14541
+ } catch (e) {
14542
+ const err2 = new Error(`compiler.runAsChild callback error: ${e}`);
14543
+ this.parentCompilation.errors.push(err2);
14544
+ console.log(e);
14545
+ }
14546
+ };
14547
+ this.compile((err, compilation) => {
14548
+ if (err) {
14549
+ return finalCallback(err);
14550
+ }
14551
+ assertNotNill(compilation);
14552
+ this.parentCompilation.children.push(compilation);
14553
+ for (const { name: name2, source, info } of compilation.getAssets()) {
14554
+ if (source) {
14555
+ this.parentCompilation.emitAsset(name2, source, info);
14556
+ }
14557
+ }
14558
+ const entries = [];
14559
+ for (const ep of compilation.entrypoints.values()) {
14560
+ entries.push(...ep.chunks);
13886
14561
  }
14562
+ return finalCallback(null, entries, compilation);
13887
14563
  });
13888
14564
  }
13889
- #newCompilationParams() {
13890
- const normalModuleFactory = new NormalModuleFactory();
13891
- this.hooks.normalModuleFactory.call(normalModuleFactory);
13892
- const contextModuleFactory = new ContextModuleFactory();
13893
- this.hooks.contextModuleFactory.call(contextModuleFactory);
13894
- const params = {
13895
- normalModuleFactory,
13896
- contextModuleFactory
13897
- };
13898
- this.#compilationParams = params;
13899
- return params;
14565
+ purgeInputFileSystem() {
14566
+ var _a, _b;
14567
+ (_b = (_a = this.inputFileSystem) == null ? void 0 : _a.purge) == null ? void 0 : _b.call(_a);
13900
14568
  }
13901
14569
  /**
13902
- * Lazy initialize instance so it could access the changed options
14570
+ * @param compilation - the compilation
14571
+ * @param compilerName - the compiler's name
14572
+ * @param compilerIndex - the compiler's index
14573
+ * @param outputOptions - the output options
14574
+ * @param plugins - the plugins to apply
14575
+ * @returns a child compiler
13903
14576
  */
13904
- #getInstance(callback) {
13905
- const error = checkVersion();
13906
- if (error) {
13907
- return callback(error);
14577
+ createChildCompiler(compilation, compilerName, compilerIndex, outputOptions, plugins2) {
14578
+ const options = {
14579
+ ...this.options,
14580
+ output: {
14581
+ ...this.options.output,
14582
+ ...outputOptions
14583
+ }
14584
+ };
14585
+ applyRspackOptionsDefaults(options);
14586
+ const childCompiler = new _Compiler(this.context, options);
14587
+ childCompiler.name = compilerName;
14588
+ childCompiler.outputPath = this.outputPath;
14589
+ childCompiler.inputFileSystem = this.inputFileSystem;
14590
+ childCompiler.outputFileSystem = null;
14591
+ childCompiler.modifiedFiles = this.modifiedFiles;
14592
+ childCompiler.removedFiles = this.removedFiles;
14593
+ childCompiler.fileTimestamps = this.fileTimestamps;
14594
+ childCompiler.contextTimestamps = this.contextTimestamps;
14595
+ childCompiler.fsStartTime = this.fsStartTime;
14596
+ childCompiler.cache = this.cache;
14597
+ childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
14598
+ const relativeCompilerName = makePathsRelative(
14599
+ this.context,
14600
+ compilerName,
14601
+ this.root
14602
+ );
14603
+ if (!this.records[relativeCompilerName]) {
14604
+ this.records[relativeCompilerName] = [];
13908
14605
  }
13909
- if (this.#instance) {
13910
- return callback(null, this.#instance);
14606
+ if (this.records[relativeCompilerName][compilerIndex]) {
14607
+ childCompiler.records = this.records[relativeCompilerName][compilerIndex];
14608
+ } else {
14609
+ this.records[relativeCompilerName].push(childCompiler.records = {});
13911
14610
  }
13912
- const options = this.options;
13913
- const rawOptions = getRawOptions(options, this);
13914
- rawOptions.__references = Object.fromEntries(
13915
- this.#ruleSet.builtinReferences.entries()
13916
- );
13917
- const instanceBinding = require("@rspack/binding");
13918
- const that = new WeakRef(this);
13919
- this.#registers = {
13920
- registerCompilerThisCompilationTaps: this.#createHookRegisterTaps(
13921
- binding2.RegisterJsTapKind.CompilerThisCompilation,
13922
- function() {
13923
- return that.deref().hooks.thisCompilation;
13924
- },
13925
- function(queried) {
13926
- return function(native) {
13927
- that.deref().#createCompilation(native);
13928
- return queried.call(
13929
- that.deref().#compilation,
13930
- that.deref().#compilationParams
13931
- );
13932
- };
13933
- }
13934
- ),
13935
- registerCompilerCompilationTaps: this.#createHookRegisterTaps(
13936
- binding2.RegisterJsTapKind.CompilerCompilation,
13937
- function() {
13938
- return that.deref().hooks.compilation;
13939
- },
13940
- function(queried) {
13941
- return function() {
13942
- return queried.call(
13943
- that.deref().#compilation,
13944
- that.deref().#compilationParams
13945
- );
13946
- };
13947
- }
13948
- ),
13949
- registerCompilerMakeTaps: this.#createHookRegisterTaps(
13950
- binding2.RegisterJsTapKind.CompilerMake,
13951
- function() {
13952
- return that.deref().hooks.make;
13953
- },
13954
- function(queried) {
13955
- return async function() {
13956
- return await queried.promise(that.deref().#compilation);
13957
- };
13958
- }
13959
- ),
13960
- registerCompilerFinishMakeTaps: this.#createHookRegisterTaps(
13961
- binding2.RegisterJsTapKind.CompilerFinishMake,
13962
- function() {
13963
- return that.deref().hooks.finishMake;
13964
- },
13965
- function(queried) {
13966
- return async function() {
13967
- return await queried.promise(that.deref().#compilation);
13968
- };
13969
- }
13970
- ),
13971
- registerCompilerShouldEmitTaps: this.#createHookRegisterTaps(
13972
- binding2.RegisterJsTapKind.CompilerShouldEmit,
13973
- function() {
13974
- return that.deref().hooks.shouldEmit;
13975
- },
13976
- function(queried) {
13977
- return function() {
13978
- return queried.call(that.deref().#compilation);
13979
- };
13980
- }
13981
- ),
13982
- registerCompilerEmitTaps: this.#createHookRegisterTaps(
13983
- binding2.RegisterJsTapKind.CompilerEmit,
13984
- function() {
13985
- return that.deref().hooks.emit;
13986
- },
13987
- function(queried) {
13988
- return async function() {
13989
- return await queried.promise(that.deref().#compilation);
13990
- };
13991
- }
13992
- ),
13993
- registerCompilerAfterEmitTaps: this.#createHookRegisterTaps(
13994
- binding2.RegisterJsTapKind.CompilerAfterEmit,
13995
- function() {
13996
- return that.deref().hooks.afterEmit;
13997
- },
13998
- function(queried) {
13999
- return async function() {
14000
- return await queried.promise(that.deref().#compilation);
14001
- };
14002
- }
14003
- ),
14004
- registerCompilerAssetEmittedTaps: this.#createHookRegisterTaps(
14005
- binding2.RegisterJsTapKind.CompilerAssetEmitted,
14006
- function() {
14007
- return that.deref().hooks.assetEmitted;
14008
- },
14009
- function(queried) {
14010
- return async function({
14011
- filename: filename2,
14012
- targetPath,
14013
- outputPath
14014
- }) {
14015
- return queried.promise(filename2, {
14016
- compilation: that.deref().#compilation,
14017
- targetPath,
14018
- outputPath,
14019
- get source() {
14020
- var _a;
14021
- return (_a = that.deref().#compilation.getAsset(filename2)) == null ? void 0 : _a.source;
14022
- },
14023
- get content() {
14024
- var _a;
14025
- return (_a = this.source) == null ? void 0 : _a.buffer();
14026
- }
14027
- });
14028
- };
14029
- }
14030
- ),
14031
- registerCompilationAdditionalTreeRuntimeRequirements: this.#createHookRegisterTaps(
14032
- binding2.RegisterJsTapKind.CompilationAdditionalTreeRuntimeRequirements,
14033
- function() {
14034
- return that.deref().#compilation.hooks.additionalTreeRuntimeRequirements;
14035
- },
14036
- function(queried) {
14037
- return function({
14038
- chunk,
14039
- runtimeRequirements
14040
- }) {
14041
- const set = __from_binding_runtime_globals(runtimeRequirements);
14042
- queried.call(Chunk.__from_binding(chunk), set);
14043
- return {
14044
- runtimeRequirements: __to_binding_runtime_globals(set)
14045
- };
14046
- };
14047
- }
14048
- ),
14049
- registerCompilationRuntimeRequirementInTree: this.#createHookMapRegisterTaps(
14050
- binding2.RegisterJsTapKind.CompilationRuntimeRequirementInTree,
14051
- function() {
14052
- return that.deref().#compilation.hooks.runtimeRequirementInTree;
14053
- },
14054
- function(queried) {
14055
- return function({
14056
- chunk: chunkBinding,
14057
- runtimeRequirements
14058
- }) {
14059
- const set = __from_binding_runtime_globals(runtimeRequirements);
14060
- const chunk = Chunk.__from_binding(chunkBinding);
14061
- for (const r of set) {
14062
- queried.for(r).call(chunk, set);
14063
- }
14064
- return {
14065
- runtimeRequirements: __to_binding_runtime_globals(set)
14066
- };
14067
- };
14068
- }
14069
- ),
14070
- registerCompilationRuntimeModuleTaps: this.#createHookRegisterTaps(
14071
- binding2.RegisterJsTapKind.CompilationRuntimeModule,
14072
- function() {
14073
- return that.deref().#compilation.hooks.runtimeModule;
14074
- },
14075
- function(queried) {
14076
- return function({ module: module2, chunk }) {
14077
- var _a, _b;
14078
- const originSource = (_a = module2.source) == null ? void 0 : _a.source;
14079
- queried.call(module2, Chunk.__from_binding(chunk));
14080
- const newSource = (_b = module2.source) == null ? void 0 : _b.source;
14081
- if (newSource && newSource !== originSource) {
14082
- return module2;
14083
- }
14084
- return;
14085
- };
14086
- }
14087
- ),
14088
- registerCompilationBuildModuleTaps: this.#createHookRegisterTaps(
14089
- binding2.RegisterJsTapKind.CompilationBuildModule,
14090
- function() {
14091
- return that.deref().#compilation.hooks.buildModule;
14092
- },
14093
- function(queried) {
14094
- return function(m) {
14095
- return queried.call(Module.__from_binding(m));
14096
- };
14097
- }
14098
- ),
14099
- registerCompilationStillValidModuleTaps: this.#createHookRegisterTaps(
14100
- binding2.RegisterJsTapKind.CompilationStillValidModule,
14101
- function() {
14102
- return that.deref().#compilation.hooks.stillValidModule;
14103
- },
14104
- function(queried) {
14105
- return function(m) {
14106
- return queried.call(Module.__from_binding(m));
14107
- };
14108
- }
14109
- ),
14110
- registerCompilationSucceedModuleTaps: this.#createHookRegisterTaps(
14111
- binding2.RegisterJsTapKind.CompilationSucceedModule,
14112
- function() {
14113
- return that.deref().#compilation.hooks.succeedModule;
14114
- },
14115
- function(queried) {
14116
- return function(m) {
14117
- return queried.call(Module.__from_binding(m));
14118
- };
14119
- }
14120
- ),
14121
- registerCompilationExecuteModuleTaps: this.#createHookRegisterTaps(
14122
- binding2.RegisterJsTapKind.CompilationExecuteModule,
14123
- function() {
14124
- return that.deref().#compilation.hooks.executeModule;
14125
- },
14126
- function(queried) {
14127
- return function({
14128
- entry: entry2,
14129
- id,
14130
- codegenResults,
14131
- runtimeModules
14132
- }) {
14133
- try {
14134
- const __webpack_require__ = (id2) => {
14135
- const cached = moduleCache[id2];
14136
- if (cached !== void 0) {
14137
- if (cached.error) throw cached.error;
14138
- return cached.exports;
14139
- }
14140
- const execOptions = {
14141
- id: id2,
14142
- module: {
14143
- id: id2,
14144
- exports: {},
14145
- loaded: false,
14146
- error: void 0
14147
- },
14148
- require: __webpack_require__
14149
- };
14150
- for (const handler of interceptModuleExecution) {
14151
- handler(execOptions);
14152
- }
14153
- const result2 = codegenResults.map[id2]["build time"];
14154
- const moduleObject = execOptions.module;
14155
- if (id2) moduleCache[id2] = moduleObject;
14156
- tryRunOrWebpackError(
14157
- () => queried.call(
14158
- {
14159
- codeGenerationResult: new CodeGenerationResult(result2),
14160
- moduleObject
14161
- },
14162
- { __webpack_require__ }
14163
- ),
14164
- "Compilation.hooks.executeModule"
14165
- );
14166
- moduleObject.loaded = true;
14167
- return moduleObject.exports;
14168
- };
14169
- const moduleCache = __webpack_require__[RuntimeGlobals.moduleCache.replace(
14170
- `${RuntimeGlobals.require}.`,
14171
- ""
14172
- )] = {};
14173
- const interceptModuleExecution = __webpack_require__[RuntimeGlobals.interceptModuleExecution.replace(
14174
- `${RuntimeGlobals.require}.`,
14175
- ""
14176
- )] = [];
14177
- for (const runtimeModule of runtimeModules) {
14178
- __webpack_require__(runtimeModule);
14179
- }
14180
- const executeResult = __webpack_require__(entry2);
14181
- that.deref().#moduleExecutionResultsMap.set(id, executeResult);
14182
- } catch (e) {
14183
- that.deref().#moduleExecutionResultsMap.set(id, e);
14184
- throw e;
14185
- }
14186
- };
14187
- }
14188
- ),
14189
- registerCompilationFinishModulesTaps: this.#createHookRegisterTaps(
14190
- binding2.RegisterJsTapKind.CompilationFinishModules,
14191
- function() {
14192
- return that.deref().#compilation.hooks.finishModules;
14193
- },
14194
- function(queried) {
14195
- return async function() {
14196
- return await queried.promise(that.deref().#compilation.modules);
14197
- };
14198
- }
14199
- ),
14200
- registerCompilationOptimizeModulesTaps: this.#createHookRegisterTaps(
14201
- binding2.RegisterJsTapKind.CompilationOptimizeModules,
14202
- function() {
14203
- return that.deref().#compilation.hooks.optimizeModules;
14204
- },
14205
- function(queried) {
14206
- return function() {
14207
- return queried.call(that.deref().#compilation.modules.values());
14208
- };
14209
- }
14210
- ),
14211
- registerCompilationAfterOptimizeModulesTaps: this.#createHookRegisterTaps(
14212
- binding2.RegisterJsTapKind.CompilationAfterOptimizeModules,
14213
- function() {
14214
- return that.deref().#compilation.hooks.afterOptimizeModules;
14215
- },
14216
- function(queried) {
14217
- return function() {
14218
- queried.call(that.deref().#compilation.modules.values());
14219
- };
14220
- }
14221
- ),
14222
- registerCompilationOptimizeTreeTaps: this.#createHookRegisterTaps(
14223
- binding2.RegisterJsTapKind.CompilationOptimizeTree,
14224
- function() {
14225
- return that.deref().#compilation.hooks.optimizeTree;
14226
- },
14227
- function(queried) {
14228
- return async function() {
14229
- return await queried.promise(
14230
- that.deref().#compilation.chunks,
14231
- that.deref().#compilation.modules
14232
- );
14233
- };
14234
- }
14235
- ),
14236
- registerCompilationOptimizeChunkModulesTaps: this.#createHookRegisterTaps(
14237
- binding2.RegisterJsTapKind.CompilationOptimizeChunkModules,
14238
- function() {
14239
- return that.deref().#compilation.hooks.optimizeChunkModules;
14240
- },
14241
- function(queried) {
14242
- return async function() {
14243
- return await queried.promise(
14244
- that.deref().#compilation.chunks,
14245
- that.deref().#compilation.modules
14246
- );
14247
- };
14248
- }
14249
- ),
14250
- registerCompilationChunkHashTaps: this.#createHookRegisterTaps(
14251
- binding2.RegisterJsTapKind.CompilationChunkHash,
14252
- function() {
14253
- return that.deref().#compilation.hooks.chunkHash;
14254
- },
14255
- function(queried) {
14256
- return function(chunk) {
14257
- if (!that.deref().options.output.hashFunction) {
14258
- throw new Error("'output.hashFunction' cannot be undefined");
14259
- }
14260
- const hash = createHash(that.deref().options.output.hashFunction);
14261
- queried.call(Chunk.__from_binding(chunk), hash);
14262
- const digestResult = hash.digest(
14263
- that.deref().options.output.hashDigest
14264
- );
14265
- return Buffer.from(digestResult);
14266
- };
14267
- }
14268
- ),
14269
- registerCompilationChunkAssetTaps: this.#createHookRegisterTaps(
14270
- binding2.RegisterJsTapKind.CompilationChunkAsset,
14271
- function() {
14272
- return that.deref().#compilation.hooks.chunkAsset;
14273
- },
14274
- function(queried) {
14275
- return function({ chunk, filename: filename2 }) {
14276
- return queried.call(Chunk.__from_binding(chunk), filename2);
14277
- };
14278
- }
14279
- ),
14280
- registerCompilationProcessAssetsTaps: this.#createHookRegisterTaps(
14281
- binding2.RegisterJsTapKind.CompilationProcessAssets,
14282
- function() {
14283
- return that.deref().#compilation.hooks.processAssets;
14284
- },
14285
- function(queried) {
14286
- return async function() {
14287
- return await queried.promise(that.deref().#compilation.assets);
14288
- };
14289
- }
14290
- ),
14291
- registerCompilationAfterProcessAssetsTaps: this.#createHookRegisterTaps(
14292
- binding2.RegisterJsTapKind.CompilationAfterProcessAssets,
14293
- function() {
14294
- return that.deref().#compilation.hooks.afterProcessAssets;
14295
- },
14296
- function(queried) {
14297
- return function() {
14298
- return queried.call(that.deref().#compilation.assets);
14299
- };
14300
- }
14301
- ),
14302
- registerCompilationSealTaps: this.#createHookRegisterTaps(
14303
- binding2.RegisterJsTapKind.CompilationSeal,
14304
- function() {
14305
- return that.deref().#compilation.hooks.seal;
14306
- },
14307
- function(queried) {
14308
- return function() {
14309
- return queried.call();
14310
- };
14311
- }
14312
- ),
14313
- registerCompilationAfterSealTaps: this.#createHookRegisterTaps(
14314
- binding2.RegisterJsTapKind.CompilationAfterSeal,
14315
- function() {
14316
- return that.deref().#compilation.hooks.afterSeal;
14317
- },
14318
- function(queried) {
14319
- return async function() {
14320
- return await queried.promise();
14321
- };
14322
- }
14323
- ),
14324
- registerNormalModuleFactoryBeforeResolveTaps: this.#createHookRegisterTaps(
14325
- binding2.RegisterJsTapKind.NormalModuleFactoryBeforeResolve,
14326
- function() {
14327
- return that.deref().#compilationParams.normalModuleFactory.hooks.beforeResolve;
14328
- },
14329
- function(queried) {
14330
- return async function(resolveData) {
14331
- const normalizedResolveData = {
14332
- contextInfo: {
14333
- issuer: resolveData.issuer
14334
- },
14335
- request: resolveData.request,
14336
- context: resolveData.context,
14337
- fileDependencies: [],
14338
- missingDependencies: [],
14339
- contextDependencies: []
14340
- };
14341
- const ret = await queried.promise(normalizedResolveData);
14342
- resolveData.request = normalizedResolveData.request;
14343
- resolveData.context = normalizedResolveData.context;
14344
- return [ret, resolveData];
14345
- };
14346
- }
14347
- ),
14348
- registerNormalModuleFactoryFactorizeTaps: this.#createHookRegisterTaps(
14349
- binding2.RegisterJsTapKind.NormalModuleFactoryFactorize,
14350
- function() {
14351
- return that.deref().#compilationParams.normalModuleFactory.hooks.factorize;
14352
- },
14353
- function(queried) {
14354
- return async function(resolveData) {
14355
- const normalizedResolveData = {
14356
- contextInfo: {
14357
- issuer: resolveData.issuer
14358
- },
14359
- request: resolveData.request,
14360
- context: resolveData.context,
14361
- fileDependencies: [],
14362
- missingDependencies: [],
14363
- contextDependencies: []
14364
- };
14365
- await queried.promise(normalizedResolveData);
14366
- resolveData.request = normalizedResolveData.request;
14367
- resolveData.context = normalizedResolveData.context;
14368
- return resolveData;
14369
- };
14370
- }
14371
- ),
14372
- registerNormalModuleFactoryResolveTaps: this.#createHookRegisterTaps(
14373
- binding2.RegisterJsTapKind.NormalModuleFactoryResolve,
14374
- function() {
14375
- return that.deref().#compilationParams.normalModuleFactory.hooks.resolve;
14376
- },
14377
- function(queried) {
14378
- return async function(resolveData) {
14379
- const normalizedResolveData = {
14380
- contextInfo: {
14381
- issuer: resolveData.issuer
14382
- },
14383
- request: resolveData.request,
14384
- context: resolveData.context,
14385
- fileDependencies: [],
14386
- missingDependencies: [],
14387
- contextDependencies: []
14388
- };
14389
- await queried.promise(normalizedResolveData);
14390
- resolveData.request = normalizedResolveData.request;
14391
- resolveData.context = normalizedResolveData.context;
14392
- return resolveData;
14393
- };
14394
- }
14395
- ),
14396
- registerNormalModuleFactoryResolveForSchemeTaps: this.#createHookMapRegisterTaps(
14397
- binding2.RegisterJsTapKind.NormalModuleFactoryResolveForScheme,
14398
- function() {
14399
- return that.deref().#compilationParams.normalModuleFactory.hooks.resolveForScheme;
14400
- },
14401
- function(queried) {
14402
- return async function(args) {
14403
- const ret = await queried.for(args.scheme).promise(args.resourceData);
14404
- return [ret, args.resourceData];
14405
- };
14406
- }
14407
- ),
14408
- registerNormalModuleFactoryAfterResolveTaps: this.#createHookRegisterTaps(
14409
- binding2.RegisterJsTapKind.NormalModuleFactoryAfterResolve,
14410
- function() {
14411
- return that.deref().#compilationParams.normalModuleFactory.hooks.afterResolve;
14412
- },
14413
- function(queried) {
14414
- return async function(arg) {
14415
- const data = {
14416
- contextInfo: {
14417
- issuer: arg.issuer
14418
- },
14419
- request: arg.request,
14420
- context: arg.context,
14421
- fileDependencies: arg.fileDependencies,
14422
- missingDependencies: arg.missingDependencies,
14423
- contextDependencies: arg.contextDependencies,
14424
- createData: arg.createData
14425
- };
14426
- const ret = await queried.promise(data);
14427
- return [ret, data.createData];
14428
- };
14429
- }
14430
- ),
14431
- registerNormalModuleFactoryCreateModuleTaps: this.#createHookRegisterTaps(
14432
- binding2.RegisterJsTapKind.NormalModuleFactoryCreateModule,
14433
- function() {
14434
- return that.deref().#compilationParams.normalModuleFactory.hooks.createModule;
14435
- },
14436
- function(queried) {
14437
- return async function(args) {
14438
- const data = {
14439
- ...args,
14440
- settings: {}
14441
- };
14442
- await queried.promise(data, {});
14443
- };
14611
+ childCompiler.parentCompilation = compilation;
14612
+ childCompiler.root = this.root;
14613
+ if (Array.isArray(plugins2)) {
14614
+ for (const plugin2 of plugins2) {
14615
+ if (plugin2) {
14616
+ plugin2.apply(childCompiler);
14444
14617
  }
14445
- ),
14446
- registerContextModuleFactoryBeforeResolveTaps: this.#createHookRegisterTaps(
14447
- binding2.RegisterJsTapKind.ContextModuleFactoryBeforeResolve,
14448
- function() {
14449
- return that.deref().#compilationParams.contextModuleFactory.hooks.beforeResolve;
14450
- },
14451
- function(queried) {
14452
- return async function(bindingData) {
14453
- const data = bindingData ? ContextModuleFactoryBeforeResolveData.__from_binding(
14454
- bindingData
14455
- ) : false;
14456
- const result2 = await queried.promise(data);
14457
- return result2 ? ContextModuleFactoryBeforeResolveData.__to_binding(result2) : false;
14458
- };
14618
+ }
14619
+ }
14620
+ childCompiler.#builtinPlugins = [
14621
+ ...childCompiler.#builtinPlugins,
14622
+ ...this.#builtinPlugins.filter(
14623
+ (plugin2) => plugin2.canInherentFromParent === true
14624
+ )
14625
+ ];
14626
+ for (const hookName in this.hooks) {
14627
+ const name2 = hookName;
14628
+ if (canInherentFromParent(name2)) {
14629
+ if (childCompiler.hooks[name2]) {
14630
+ childCompiler.hooks[name2].taps = this.hooks[name2].taps.slice();
14459
14631
  }
14460
- ),
14461
- registerContextModuleFactoryAfterResolveTaps: this.#createHookRegisterTaps(
14462
- binding2.RegisterJsTapKind.ContextModuleFactoryAfterResolve,
14463
- function() {
14464
- return that.deref().#compilationParams.contextModuleFactory.hooks.afterResolve;
14465
- },
14466
- function(queried) {
14467
- return async function(bindingData) {
14468
- const data = bindingData ? ContextModuleFactoryAfterResolveData.__from_binding(
14469
- bindingData
14470
- ) : false;
14471
- const result2 = await queried.promise(data);
14472
- return result2 ? ContextModuleFactoryAfterResolveData.__to_binding(result2) : false;
14473
- };
14632
+ }
14633
+ }
14634
+ compilation.hooks.childCompiler.call(
14635
+ childCompiler,
14636
+ compilerName,
14637
+ compilerIndex
14638
+ );
14639
+ return childCompiler;
14640
+ }
14641
+ isChild() {
14642
+ const isRoot = this.root === this;
14643
+ return !isRoot;
14644
+ }
14645
+ compile(callback) {
14646
+ const startTime = Date.now();
14647
+ const params = this.#newCompilationParams();
14648
+ this.hooks.beforeCompile.callAsync(params, (err) => {
14649
+ if (err) {
14650
+ return callback(err);
14651
+ }
14652
+ this.hooks.compile.call(params);
14653
+ this.#resetThisCompilation();
14654
+ this.#build((err2) => {
14655
+ if (err2) {
14656
+ return callback(err2);
14474
14657
  }
14475
- ),
14476
- registerJavascriptModulesChunkHashTaps: this.#createHookRegisterTaps(
14477
- binding2.RegisterJsTapKind.JavascriptModulesChunkHash,
14478
- function() {
14479
- return JavascriptModulesPlugin.getCompilationHooks(
14480
- that.deref().#compilation
14481
- ).chunkHash;
14482
- },
14483
- function(queried) {
14484
- return function(chunk) {
14485
- if (!that.deref().options.output.hashFunction) {
14486
- throw new Error("'output.hashFunction' cannot be undefined");
14658
+ this.#compilation.startTime = startTime;
14659
+ this.#compilation.endTime = Date.now();
14660
+ this.hooks.afterCompile.callAsync(this.#compilation, (err3) => {
14661
+ if (err3) {
14662
+ return callback(err3);
14663
+ }
14664
+ return callback(null, this.#compilation);
14665
+ });
14666
+ });
14667
+ });
14668
+ }
14669
+ close(callback) {
14670
+ if (this.watching) {
14671
+ this.watching.close(() => {
14672
+ this.close(callback);
14673
+ });
14674
+ return;
14675
+ }
14676
+ this.hooks.shutdown.callAsync((err) => {
14677
+ if (err) return callback(err);
14678
+ this.cache.shutdown(callback);
14679
+ });
14680
+ }
14681
+ #build(callback) {
14682
+ this.#getInstance((error, instance) => {
14683
+ if (error) {
14684
+ return callback == null ? void 0 : callback(error);
14685
+ }
14686
+ if (!this.#initial) {
14687
+ instance.rebuild(
14688
+ Array.from(this.modifiedFiles || []),
14689
+ Array.from(this.removedFiles || []),
14690
+ (error2) => {
14691
+ if (error2) {
14692
+ return callback == null ? void 0 : callback(error2);
14487
14693
  }
14488
- const hash = createHash(that.deref().options.output.hashFunction);
14489
- queried.call(Chunk.__from_binding(chunk), hash);
14490
- const digestResult = hash.digest(
14491
- that.deref().options.output.hashDigest
14492
- );
14493
- return Buffer.from(digestResult);
14494
- };
14495
- }
14496
- ),
14497
- registerHtmlPluginBeforeAssetTagGenerationTaps: this.#createHookRegisterTaps(
14498
- binding2.RegisterJsTapKind.HtmlPluginBeforeAssetTagGeneration,
14499
- function() {
14500
- return HtmlRspackPlugin.getCompilationHooks(
14501
- that.deref().#compilation
14502
- ).beforeAssetTagGeneration;
14503
- },
14504
- function(queried) {
14505
- return async function(data) {
14506
- return await queried.promise({
14507
- ...data,
14508
- plugin: {
14509
- options: HtmlRspackPlugin.getCompilationOptions(
14510
- that.deref().#compilation
14511
- ) || {}
14512
- }
14513
- });
14514
- };
14515
- }
14516
- ),
14517
- registerHtmlPluginAlterAssetTagsTaps: this.#createHookRegisterTaps(
14518
- binding2.RegisterJsTapKind.HtmlPluginAlterAssetTags,
14519
- function() {
14520
- return HtmlRspackPlugin.getCompilationHooks(
14521
- that.deref().#compilation
14522
- ).alterAssetTags;
14523
- },
14524
- function(queried) {
14525
- return async function(data) {
14526
- return await queried.promise(data);
14527
- };
14528
- }
14529
- ),
14530
- registerHtmlPluginAlterAssetTagGroupsTaps: this.#createHookRegisterTaps(
14531
- binding2.RegisterJsTapKind.HtmlPluginAlterAssetTagGroups,
14532
- function() {
14533
- return HtmlRspackPlugin.getCompilationHooks(
14534
- that.deref().#compilation
14535
- ).alterAssetTagGroups;
14536
- },
14537
- function(queried) {
14538
- return async function(data) {
14539
- return await queried.promise({
14540
- ...data,
14541
- plugin: {
14542
- options: HtmlRspackPlugin.getCompilationOptions(
14543
- that.deref().#compilation
14544
- ) || {}
14545
- }
14546
- });
14547
- };
14548
- }
14549
- ),
14550
- registerHtmlPluginAfterTemplateExecutionTaps: this.#createHookRegisterTaps(
14551
- binding2.RegisterJsTapKind.HtmlPluginAfterTemplateExecution,
14552
- function() {
14553
- return HtmlRspackPlugin.getCompilationHooks(
14554
- that.deref().#compilation
14555
- ).afterTemplateExecution;
14556
- },
14557
- function(queried) {
14558
- return async function(data) {
14559
- return await queried.promise({
14560
- ...data,
14561
- plugin: {
14562
- options: HtmlRspackPlugin.getCompilationOptions(
14563
- that.deref().#compilation
14564
- ) || {}
14565
- }
14566
- });
14567
- };
14568
- }
14569
- ),
14570
- registerHtmlPluginBeforeEmitTaps: this.#createHookRegisterTaps(
14571
- binding2.RegisterJsTapKind.HtmlPluginBeforeEmit,
14572
- function() {
14573
- return HtmlRspackPlugin.getCompilationHooks(
14574
- that.deref().#compilation
14575
- ).beforeEmit;
14576
- },
14577
- function(queried) {
14578
- return async function(data) {
14579
- return await queried.promise({
14580
- ...data,
14581
- plugin: {
14582
- options: HtmlRspackPlugin.getCompilationOptions(
14583
- that.deref().#compilation
14584
- ) || {}
14585
- }
14586
- });
14587
- };
14694
+ callback == null ? void 0 : callback(null);
14695
+ }
14696
+ );
14697
+ return;
14698
+ }
14699
+ this.#initial = false;
14700
+ instance.build((error2) => {
14701
+ if (error2) {
14702
+ return callback == null ? void 0 : callback(error2);
14588
14703
  }
14589
- ),
14590
- registerHtmlPluginAfterEmitTaps: this.#createHookRegisterTaps(
14591
- binding2.RegisterJsTapKind.HtmlPluginAfterEmit,
14592
- function() {
14593
- return HtmlRspackPlugin.getCompilationHooks(
14594
- that.deref().#compilation
14595
- ).afterEmit;
14596
- },
14597
- function(queried) {
14598
- return async function(data) {
14599
- return await queried.promise({
14600
- ...data,
14601
- plugin: {
14602
- options: HtmlRspackPlugin.getCompilationOptions(
14603
- that.deref().#compilation
14604
- ) || {}
14605
- }
14606
- });
14607
- };
14704
+ callback == null ? void 0 : callback(null);
14705
+ });
14706
+ });
14707
+ }
14708
+ /**
14709
+ * Note: This is not a webpack public API, maybe removed in future.
14710
+ * @internal
14711
+ */
14712
+ __internal__rebuild(modifiedFiles, removedFiles, callback) {
14713
+ this.#getInstance((error, instance) => {
14714
+ if (error) {
14715
+ return callback == null ? void 0 : callback(error);
14716
+ }
14717
+ instance.rebuild(
14718
+ Array.from(modifiedFiles || []),
14719
+ Array.from(removedFiles || []),
14720
+ (error2) => {
14721
+ if (error2) {
14722
+ return callback == null ? void 0 : callback(error2);
14723
+ }
14724
+ callback == null ? void 0 : callback(null);
14608
14725
  }
14609
- )
14726
+ );
14727
+ });
14728
+ }
14729
+ /**
14730
+ * Note: This is not a webpack public API, maybe removed in future.
14731
+ * @internal
14732
+ */
14733
+ __internal__create_compilation(native) {
14734
+ let compilation = COMPILATION_WEAK_MAP.get(native);
14735
+ if (!compilation) {
14736
+ compilation = new Compilation(this, native);
14737
+ compilation.name = this.name;
14738
+ COMPILATION_WEAK_MAP.set(native, compilation);
14739
+ }
14740
+ this.#compilation = compilation;
14741
+ return compilation;
14742
+ }
14743
+ #resetThisCompilation() {
14744
+ this.#compilation = void 0;
14745
+ this.hooks.thisCompilation.intercept({
14746
+ call: () => {
14747
+ }
14748
+ });
14749
+ }
14750
+ #newCompilationParams() {
14751
+ const normalModuleFactory = new NormalModuleFactory();
14752
+ this.hooks.normalModuleFactory.call(normalModuleFactory);
14753
+ const contextModuleFactory = new ContextModuleFactory();
14754
+ this.hooks.contextModuleFactory.call(contextModuleFactory);
14755
+ const params = {
14756
+ normalModuleFactory,
14757
+ contextModuleFactory
14610
14758
  };
14759
+ this.#compilationParams = params;
14760
+ return params;
14761
+ }
14762
+ /**
14763
+ * Lazy initialize instance so it could access the changed options
14764
+ */
14765
+ #getInstance(callback) {
14766
+ const error = checkVersion();
14767
+ if (error) {
14768
+ return callback(error);
14769
+ }
14770
+ if (this.#instance) {
14771
+ return callback(null, this.#instance);
14772
+ }
14773
+ const options = this.options;
14774
+ const rawOptions = getRawOptions(options, this);
14775
+ rawOptions.__references = Object.fromEntries(
14776
+ this.#ruleSet.builtinReferences.entries()
14777
+ );
14778
+ const instanceBinding = require("@rspack/binding");
14779
+ this.#registers = this.#createHooksRegisters();
14611
14780
  this.#instance = new instanceBinding.Rspack(
14612
14781
  this.compilerPath,
14613
14782
  rawOptions,
@@ -14615,10 +14784,40 @@ var Compiler = class _Compiler {
14615
14784
  this.#registers,
14616
14785
  ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem),
14617
14786
  this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0,
14618
- ResolverFactory.__to_binding(this.resolverFactory)
14787
+ ResolverFactory.__to_binding(
14788
+ this.resolverFactory = new ResolverFactory(
14789
+ rawOptions.resolve.pnp ?? false
14790
+ )
14791
+ )
14619
14792
  );
14620
14793
  callback(null, this.#instance);
14621
14794
  }
14795
+ #createHooksRegisters() {
14796
+ const ref = new WeakRef(this);
14797
+ const getCompiler = () => ref.deref();
14798
+ const createTap = this.#createHookRegisterTaps.bind(this);
14799
+ const createMapTap = this.#createHookMapRegisterTaps.bind(this);
14800
+ return {
14801
+ ...createCompilerHooksRegisters(getCompiler, createTap, createMapTap),
14802
+ ...createCompilationHooksRegisters(getCompiler, createTap, createMapTap),
14803
+ ...createNormalModuleFactoryHooksRegisters(
14804
+ getCompiler,
14805
+ createTap,
14806
+ createMapTap
14807
+ ),
14808
+ ...createContextModuleFactoryHooksRegisters(
14809
+ getCompiler,
14810
+ createTap,
14811
+ createMapTap
14812
+ ),
14813
+ ...createJavaScriptModulesHooksRegisters(
14814
+ getCompiler,
14815
+ createTap,
14816
+ createMapTap
14817
+ ),
14818
+ ...createHtmlPluginHooksRegisters(getCompiler, createTap, createMapTap)
14819
+ };
14820
+ }
14622
14821
  #updateNonSkippableRegisters() {
14623
14822
  const kinds = [];
14624
14823
  for (const { getHook, getHookMap, registerKind } of Object.values(
@@ -14654,6 +14853,10 @@ var Compiler = class _Compiler {
14654
14853
  };
14655
14854
  }
14656
14855
  }
14856
+ /**
14857
+ * Note: This is not a webpack public API, maybe removed in future.
14858
+ * @internal
14859
+ */
14657
14860
  #createHookRegisterTaps(registerKind, getHook, createTap) {
14658
14861
  const that = new WeakRef(this);
14659
14862
  const getTaps = (stages) => {
@@ -14684,6 +14887,10 @@ var Compiler = class _Compiler {
14684
14887
  getTaps.getHook = getHook;
14685
14888
  return getTaps;
14686
14889
  }
14890
+ /**
14891
+ * Note: This is not a webpack public API, maybe removed in future.
14892
+ * @internal
14893
+ */
14687
14894
  #createHookMapRegisterTaps(registerKind, getHookMap, createTap) {
14688
14895
  const that = new WeakRef(this);
14689
14896
  const getTaps = (stages) => {
@@ -14714,12 +14921,41 @@ var Compiler = class _Compiler {
14714
14921
  getTaps.getHookMap = getHookMap;
14715
14922
  return getTaps;
14716
14923
  }
14924
+ /**
14925
+ * Note: This is not a webpack public API, maybe removed in future.
14926
+ * @internal
14927
+ */
14717
14928
  __internal__registerBuiltinPlugin(plugin2) {
14718
14929
  this.#builtinPlugins.push(plugin2);
14719
14930
  }
14931
+ /**
14932
+ * Note: This is not a webpack public API, maybe removed in future.
14933
+ * @internal
14934
+ */
14720
14935
  __internal__getModuleExecutionResult(id) {
14721
14936
  return this.#moduleExecutionResultsMap.get(id);
14722
14937
  }
14938
+ /**
14939
+ * Note: This is not a webpack public API, maybe removed in future.
14940
+ * @internal
14941
+ */
14942
+ __internal__get_compilation() {
14943
+ return this.#compilation;
14944
+ }
14945
+ /**
14946
+ * Note: This is not a webpack public API, maybe removed in future.
14947
+ * @internal
14948
+ */
14949
+ __internal__get_compilation_params() {
14950
+ return this.#compilationParams;
14951
+ }
14952
+ /**
14953
+ * Note: This is not a webpack public API, maybe removed in future.
14954
+ * @internal
14955
+ */
14956
+ __internal__get_module_execution_results_map() {
14957
+ return this.#moduleExecutionResultsMap;
14958
+ }
14723
14959
  };
14724
14960
 
14725
14961
  // src/MultiCompiler.ts
@@ -16760,6 +16996,9 @@ var SIMPLE_EXTRACTORS = {
16760
16996
  object.resolvedModuleIdentifier = reason.resolvedModuleDescriptor.identifier;
16761
16997
  object.resolvedModule = reason.resolvedModuleDescriptor.name;
16762
16998
  }
16999
+ object.explanation = reason.explanation;
17000
+ object.active = reason.active;
17001
+ object.loc = reason.loc;
16763
17002
  },
16764
17003
  ids: (object, reason) => {
16765
17004
  object.moduleId = reason.moduleDescriptor ? reason.moduleDescriptor.id : null;
@@ -16833,7 +17072,8 @@ var SIMPLE_EXTRACTORS = {
16833
17072
  error: EXTRACT_ERROR,
16834
17073
  warning: EXTRACT_ERROR,
16835
17074
  moduleTraceItem: {
16836
- _: (object, { origin, module: module2 }, _context, { requestShortener }, _factory) => {
17075
+ _: (object, { origin, module: module2, dependencies: dependencies2 }, context2, { requestShortener }, factory) => {
17076
+ const { type } = context2;
16837
17077
  if (origin.moduleDescriptor) {
16838
17078
  object.originIdentifier = origin.moduleDescriptor.identifier;
16839
17079
  object.originName = origin.moduleDescriptor.name;
@@ -16842,13 +17082,22 @@ var SIMPLE_EXTRACTORS = {
16842
17082
  object.moduleIdentifier = module2.moduleDescriptor.identifier;
16843
17083
  object.moduleName = module2.moduleDescriptor.name;
16844
17084
  }
17085
+ object.dependencies = factory.create(
17086
+ `${type}.dependencies`,
17087
+ dependencies2,
17088
+ context2
17089
+ );
16845
17090
  },
16846
17091
  ids: (object, { origin, module: module2 }) => {
16847
17092
  object.originId = origin.moduleDescriptor.id;
16848
17093
  object.moduleId = module2.moduleDescriptor.id;
16849
17094
  }
17095
+ },
17096
+ moduleTraceDependency: {
17097
+ _: (object, dependency) => {
17098
+ object.loc = dependency.loc;
17099
+ }
16850
17100
  }
16851
- // - moduleTraceDependency
16852
17101
  };
16853
17102
  var FILTER = {
16854
17103
  "module.reasons": {
@@ -18361,6 +18610,7 @@ var RspackOptionsApply = class {
18361
18610
  const cheap = options.devtool.includes("cheap");
18362
18611
  const moduleMaps = options.devtool.includes("module");
18363
18612
  const noSources = options.devtool.includes("nosources");
18613
+ const debugIds = options.devtool.includes("debugids");
18364
18614
  const Plugin = evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin;
18365
18615
  new Plugin({
18366
18616
  filename: inline ? null : options.output.sourceMapFilename,
@@ -18370,7 +18620,8 @@ var RspackOptionsApply = class {
18370
18620
  module: moduleMaps ? true : !cheap,
18371
18621
  columns: !cheap,
18372
18622
  noSources,
18373
- namespace: options.output.devtoolNamespace
18623
+ namespace: options.output.devtoolNamespace,
18624
+ debugIds
18374
18625
  }).apply(compiler);
18375
18626
  } else if (options.devtool.includes("eval")) {
18376
18627
  new EvalDevToolModulePlugin({
@@ -20069,8 +20320,28 @@ var sharing = {
20069
20320
  };
20070
20321
  var experiments2 = {
20071
20322
  globalTrace: {
20072
- register: import_binding81.registerGlobalTrace,
20073
- cleanup: import_binding81.cleanupGlobalTrace
20323
+ async register(filter, layer2, output2) {
20324
+ (0, import_binding81.registerGlobalTrace)(filter, layer2, output2);
20325
+ if (layer2 === "otel") {
20326
+ try {
20327
+ const { initOpenTelemetry } = await import("@rspack/tracing");
20328
+ await initOpenTelemetry();
20329
+ } catch (error) {
20330
+ console.error(
20331
+ "Failed to import `@rspack/tracing` package. Please install `@rspack/tracing` to enable OpenTelemetry tracing.",
20332
+ error
20333
+ );
20334
+ }
20335
+ }
20336
+ },
20337
+ async cleanup() {
20338
+ (0, import_binding81.cleanupGlobalTrace)();
20339
+ try {
20340
+ const { shutdownOpenTelemetry } = await import("@rspack/tracing");
20341
+ await shutdownOpenTelemetry();
20342
+ } catch (error) {
20343
+ }
20344
+ }
20074
20345
  },
20075
20346
  RemoveDuplicateModulesPlugin
20076
20347
  };