@rspack/core 1.2.7-alpha.0 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -696,9 +696,11 @@ __export(index_exports, {
696
696
  CopyRspackPlugin: () => CopyRspackPlugin,
697
697
  CssExtractRspackPlugin: () => CssExtractRspackPlugin,
698
698
  DefinePlugin: () => DefinePlugin,
699
+ Dependency: () => import_binding83.Dependency,
699
700
  DllPlugin: () => DllPlugin,
700
701
  DllReferencePlugin: () => DllReferencePlugin,
701
702
  DynamicEntryPlugin: () => DynamicEntryPlugin,
703
+ EntryDependency: () => import_binding83.EntryDependency,
702
704
  EntryOptionPlugin: () => EntryOptionPlugin_default,
703
705
  EntryPlugin: () => EntryPlugin,
704
706
  EnvironmentPlugin: () => EnvironmentPlugin,
@@ -762,9 +764,11 @@ __export(exports_exports, {
762
764
  CopyRspackPlugin: () => CopyRspackPlugin,
763
765
  CssExtractRspackPlugin: () => CssExtractRspackPlugin,
764
766
  DefinePlugin: () => DefinePlugin,
767
+ Dependency: () => import_binding83.Dependency,
765
768
  DllPlugin: () => DllPlugin,
766
769
  DllReferencePlugin: () => DllReferencePlugin,
767
770
  DynamicEntryPlugin: () => DynamicEntryPlugin,
771
+ EntryDependency: () => import_binding83.EntryDependency,
768
772
  EntryOptionPlugin: () => EntryOptionPlugin_default,
769
773
  EntryPlugin: () => EntryPlugin,
770
774
  EnvironmentPlugin: () => EnvironmentPlugin,
@@ -820,52 +824,6 @@ var import_package = require("../package.json");
820
824
  var import_binding = require("@rspack/binding");
821
825
  var liteTapable = __toESM(require("@rspack/lite-tapable"));
822
826
 
823
- // src/Dependency.ts
824
- var Dependency = class _Dependency {
825
- #inner;
826
- static __from_binding(binding9) {
827
- return new _Dependency(binding9);
828
- }
829
- static __to_binding(data) {
830
- return data.#inner;
831
- }
832
- constructor(binding9) {
833
- this.#inner = binding9;
834
- Object.defineProperties(this, {
835
- type: {
836
- enumerable: true,
837
- get() {
838
- return binding9.type;
839
- }
840
- },
841
- category: {
842
- enumerable: true,
843
- get() {
844
- return binding9.category;
845
- }
846
- },
847
- request: {
848
- enumerable: true,
849
- get() {
850
- return binding9.request;
851
- }
852
- },
853
- critical: {
854
- enumerable: true,
855
- get() {
856
- return binding9.critical;
857
- },
858
- set(val) {
859
- binding9.critical = val;
860
- }
861
- }
862
- });
863
- }
864
- get ids() {
865
- return this.#inner.ids;
866
- }
867
- };
868
-
869
827
  // src/DependenciesBlock.ts
870
828
  var DependenciesBlock = class _DependenciesBlock {
871
829
  #binding;
@@ -881,7 +839,7 @@ var DependenciesBlock = class _DependenciesBlock {
881
839
  dependencies: {
882
840
  enumerable: true,
883
841
  get() {
884
- return binding9.dependencies.map((d) => Dependency.__from_binding(d));
842
+ return binding9.dependencies;
885
843
  }
886
844
  },
887
845
  blocks: {
@@ -1047,9 +1005,7 @@ var ContextModuleFactoryAfterResolveData = class _ContextModuleFactoryAfterResol
1047
1005
  dependencies: {
1048
1006
  enumerable: true,
1049
1007
  get() {
1050
- return binding9.dependencies.map(
1051
- (dep) => Dependency.__from_binding(dep)
1052
- );
1008
+ return binding9.dependencies;
1053
1009
  }
1054
1010
  }
1055
1011
  });
@@ -1143,7 +1099,7 @@ var Module = class _Module {
1143
1099
  dependencies: {
1144
1100
  enumerable: true,
1145
1101
  get() {
1146
- return module2.dependencies.map((d) => Dependency.__from_binding(d));
1102
+ return module2.dependencies;
1147
1103
  }
1148
1104
  },
1149
1105
  useSourceMap: {
@@ -1162,6 +1118,11 @@ var Module = class _Module {
1162
1118
  enumerable: true,
1163
1119
  get() {
1164
1120
  return module2.matchResource;
1121
+ },
1122
+ set(val) {
1123
+ if (val) {
1124
+ module2.matchResource = val;
1125
+ }
1165
1126
  }
1166
1127
  }
1167
1128
  });
@@ -1522,6 +1483,10 @@ var Entrypoint = class _Entrypoint extends ChunkGroup {
1522
1483
  const chunkBinding = this.#inner.getRuntimeChunk();
1523
1484
  return chunkBinding ? Chunk.__from_binding(chunkBinding) : null;
1524
1485
  }
1486
+ getEntrypointChunk() {
1487
+ const chunkBinding = this.#inner.getEntrypointChunk();
1488
+ return chunkBinding ? Chunk.__from_binding(chunkBinding) : null;
1489
+ }
1525
1490
  };
1526
1491
 
1527
1492
  // src/ErrorHelpers.ts
@@ -1588,7 +1553,7 @@ var ModuleGraphConnection = class _ModuleGraphConnection {
1588
1553
  dependency: {
1589
1554
  enumerable: true,
1590
1555
  get() {
1591
- return Dependency.__from_binding(binding9.dependency);
1556
+ return binding9.dependency;
1592
1557
  }
1593
1558
  },
1594
1559
  resolvedModule: {
@@ -1617,19 +1582,15 @@ var ModuleGraph = class _ModuleGraph {
1617
1582
  this.#inner = binding9;
1618
1583
  }
1619
1584
  getModule(dependency) {
1620
- const binding9 = this.#inner.getModule(Dependency.__to_binding(dependency));
1585
+ const binding9 = this.#inner.getModule(dependency);
1621
1586
  return binding9 ? Module.__from_binding(binding9) : null;
1622
1587
  }
1623
1588
  getResolvedModule(dependency) {
1624
- const binding9 = this.#inner.getResolvedModule(
1625
- Dependency.__to_binding(dependency)
1626
- );
1589
+ const binding9 = this.#inner.getResolvedModule(dependency);
1627
1590
  return binding9 ? Module.__from_binding(binding9) : null;
1628
1591
  }
1629
1592
  getParentModule(dependency) {
1630
- const binding9 = this.#inner.getParentModule(
1631
- Dependency.__to_binding(dependency)
1632
- );
1593
+ const binding9 = this.#inner.getParentModule(dependency);
1633
1594
  return binding9 ? Module.__from_binding(binding9) : null;
1634
1595
  }
1635
1596
  getIssuer(module2) {
@@ -1642,9 +1603,7 @@ var ModuleGraph = class _ModuleGraph {
1642
1603
  );
1643
1604
  }
1644
1605
  getConnection(dependency) {
1645
- const binding9 = this.#inner.getConnection(
1646
- Dependency.__to_binding(dependency)
1647
- );
1606
+ const binding9 = this.#inner.getConnection(dependency);
1648
1607
  return binding9 ? ModuleGraphConnection.__from_binding(binding9) : null;
1649
1608
  }
1650
1609
  getOutgoingConnections(module2) {
@@ -1654,11 +1613,14 @@ var ModuleGraph = class _ModuleGraph {
1654
1613
  return this.#inner.getIncomingConnections(Module.__to_binding(module2)).map((binding9) => ModuleGraphConnection.__from_binding(binding9));
1655
1614
  }
1656
1615
  getParentBlockIndex(dependency) {
1657
- return this.#inner.getParentBlockIndex(Dependency.__to_binding(dependency));
1616
+ return this.#inner.getParentBlockIndex(dependency);
1658
1617
  }
1659
1618
  isAsync(module2) {
1660
1619
  return this.#inner.isAsync(Module.__to_binding(module2));
1661
1620
  }
1621
+ getOutgoingConnectionsInOrder(module2) {
1622
+ return this.#inner.getOutgoingConnectionsInOrder(Module.__to_binding(module2)).map((binding9) => ModuleGraphConnection.__from_binding(binding9));
1623
+ }
1662
1624
  };
1663
1625
 
1664
1626
  // src/util/index.ts
@@ -2295,12 +2257,12 @@ var smartGrouping = (items, groupConfigs) => {
2295
2257
  let bestGroupSize = -1;
2296
2258
  let bestGroupItems = void 0;
2297
2259
  let bestGroupOptions = void 0;
2298
- for (const [group, state2] of groupMap) {
2299
- const { items: items3, used } = state2;
2300
- let options2 = state2.options;
2260
+ for (const [group, state] of groupMap) {
2261
+ const { items: items3, used } = state;
2262
+ let options2 = state.options;
2301
2263
  if (options2 === void 0) {
2302
2264
  const groupConfig2 = group.config;
2303
- state2.options = options2 = ((_a = groupConfig2.getOptions) == null ? void 0 : _a.call(
2265
+ state.options = options2 = ((_a = groupConfig2.getOptions) == null ? void 0 : _a.call(
2304
2266
  groupConfig2,
2305
2267
  group.name,
2306
2268
  Array.from(items3, ({ item }) => item)
@@ -2335,15 +2297,15 @@ var smartGrouping = (items, groupConfigs) => {
2335
2297
  for (const item of items2) {
2336
2298
  itemsWithGroups2.delete(item);
2337
2299
  for (const group of item.groups) {
2338
- const state2 = groupMap.get(group);
2339
- if (state2 !== void 0) {
2340
- state2.items.delete(item);
2341
- if (state2.items.size === 0) {
2300
+ const state = groupMap.get(group);
2301
+ if (state !== void 0) {
2302
+ state.items.delete(item);
2303
+ if (state.items.size === 0) {
2342
2304
  groupMap.delete(group);
2343
2305
  } else {
2344
- state2.options = void 0;
2306
+ state.options = void 0;
2345
2307
  if (groupChildren) {
2346
- state2.used = true;
2308
+ state.used = true;
2347
2309
  }
2348
2310
  }
2349
2311
  }
@@ -3165,7 +3127,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3165
3127
  __privateGet(this, _inner).updateAsset(
3166
3128
  filename2,
3167
3129
  compatNewSourceOrFunction,
3168
- assetInfoUpdateOrFunction === void 0 ? assetInfoUpdateOrFunction : typeof assetInfoUpdateOrFunction === "function" ? (assetInfo) => assetInfoUpdateOrFunction(assetInfo) : assetInfoUpdateOrFunction
3130
+ assetInfoUpdateOrFunction
3169
3131
  );
3170
3132
  }
3171
3133
  /**
@@ -3740,7 +3702,7 @@ var AddIncludeDispatcher = class {
3740
3702
  const cb = cbs[i];
3741
3703
  cb(
3742
3704
  errMsg ? new WebpackError_default(errMsg) : null,
3743
- Module.__from_binding(moduleBinding)
3705
+ moduleBinding ? Module.__from_binding(moduleBinding) : void 0
3744
3706
  );
3745
3707
  }
3746
3708
  });
@@ -3762,10 +3724,8 @@ var EntryData = class _EntryData {
3762
3724
  return new _EntryData(binding9);
3763
3725
  }
3764
3726
  constructor(binding9) {
3765
- this.dependencies = binding9.dependencies.map(Dependency.__from_binding);
3766
- this.includeDependencies = binding9.includeDependencies.map(
3767
- Dependency.__from_binding
3768
- );
3727
+ this.dependencies = binding9.dependencies;
3728
+ this.includeDependencies = binding9.includeDependencies;
3769
3729
  this.options = binding9.options;
3770
3730
  }
3771
3731
  };
@@ -7607,11 +7567,7 @@ var OriginEntryPlugin = create2(
7607
7567
  "make"
7608
7568
  );
7609
7569
  var EntryPlugin = OriginEntryPlugin;
7610
- EntryPlugin.createDependency = (request) => {
7611
- return {
7612
- request
7613
- };
7614
- };
7570
+ EntryPlugin.createDependency = (request) => new import_binding19.EntryDependency(request);
7615
7571
  function getRawEntryOptions(entry2) {
7616
7572
  const runtime = entry2.runtime;
7617
7573
  const chunkLoading2 = entry2.chunkLoading;
@@ -8631,138 +8587,135 @@ var JsonModulesPlugin = create2(
8631
8587
  );
8632
8588
 
8633
8589
  // src/builtin-plugin/lazy-compilation/backend.ts
8634
- var getBackend = (options) => (compiler, callback) => {
8635
- const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
8636
- const activeModules = /* @__PURE__ */ new Map();
8637
- const filesByKey = /* @__PURE__ */ new Map();
8638
- const prefix = "/lazy-compilation-using-";
8639
- const isHttps = options.protocol === "https" || typeof options.server === "object" && ("key" in options.server || "pfx" in options.server);
8640
- const createServer = typeof options.server === "function" ? options.server : (() => {
8641
- const http = isHttps ? require("https") : require("http");
8642
- return http.createServer.bind(http, options.server);
8643
- })();
8644
- const listen = typeof options.listen === "function" ? options.listen : typeof options.server === "function" && !options.listen ? (
8645
- // if user offers custom server, no need to listen
8646
- () => {
8647
- }
8648
- ) : (server2) => {
8649
- let { listen: listen2 } = options;
8650
- if (typeof listen2 === "object" && !("port" in listen2))
8651
- listen2 = { ...listen2, port: void 0 };
8652
- server2.listen(listen2);
8590
+ var getBackend = (options) => {
8591
+ const state = {
8592
+ module: unimplemented,
8593
+ dispose: unimplemented
8653
8594
  };
8654
- const protocol = options.protocol || (isHttps ? "https" : "http");
8655
- const requestListener = (req, res) => {
8656
- var _a;
8657
- if (!((_a = req.url) == null ? void 0 : _a.startsWith(prefix))) {
8658
- return;
8659
- }
8660
- const keys = req.url.slice(prefix.length).split("@");
8661
- req.socket.on("close", () => {
8662
- setTimeout(() => {
8595
+ return {
8596
+ state,
8597
+ backend: (compiler, callback) => {
8598
+ const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
8599
+ const activeModules = /* @__PURE__ */ new Map();
8600
+ const filesByKey = /* @__PURE__ */ new Map();
8601
+ const prefix = "/lazy-compilation-using-";
8602
+ const isHttps = options.protocol === "https" || typeof options.server === "object" && ("key" in options.server || "pfx" in options.server);
8603
+ const createServer = typeof options.server === "function" ? options.server : (() => {
8604
+ const http = isHttps ? require("https") : require("http");
8605
+ return http.createServer.bind(http, options.server);
8606
+ })();
8607
+ const listen = typeof options.listen === "function" ? options.listen : typeof options.server === "function" && !options.listen ? (
8608
+ // if user offers custom server, no need to listen
8609
+ () => {
8610
+ }
8611
+ ) : (server2) => {
8612
+ let { listen: listen2 } = options;
8613
+ if (typeof listen2 === "object" && !("port" in listen2))
8614
+ listen2 = { ...listen2, port: void 0 };
8615
+ server2.listen(listen2);
8616
+ };
8617
+ const protocol = options.protocol || (isHttps ? "https" : "http");
8618
+ const requestListener = (req, res) => {
8619
+ var _a;
8620
+ if (!((_a = req.url) == null ? void 0 : _a.startsWith(prefix))) {
8621
+ return;
8622
+ }
8623
+ const keys = req.url.slice(prefix.length).split("@");
8624
+ req.socket.on("close", () => {
8625
+ setTimeout(() => {
8626
+ for (const key of keys) {
8627
+ const oldValue = activeModules.get(key) || 0;
8628
+ activeModules.set(key, oldValue - 1);
8629
+ if (oldValue === 1) {
8630
+ logger.log(
8631
+ `${key} is no longer in use. Next compilation will skip this module.`
8632
+ );
8633
+ }
8634
+ }
8635
+ }, 12e4);
8636
+ });
8637
+ req.socket.setNoDelay(true);
8638
+ res.writeHead(200, {
8639
+ "content-type": "text/event-stream",
8640
+ "Access-Control-Allow-Origin": "*",
8641
+ "Access-Control-Allow-Methods": "*",
8642
+ "Access-Control-Allow-Headers": "*"
8643
+ });
8644
+ res.write("\n");
8645
+ const moduleActivated = [];
8663
8646
  for (const key of keys) {
8664
8647
  const oldValue = activeModules.get(key) || 0;
8665
- activeModules.set(key, oldValue - 1);
8666
- if (oldValue === 1) {
8667
- logger.log(
8668
- `${key} is no longer in use. Next compilation will skip this module.`
8669
- );
8648
+ activeModules.set(key, oldValue + 1);
8649
+ if (oldValue === 0) {
8650
+ logger.log(`${key} is now in use and will be compiled.`);
8651
+ moduleActivated.push(key);
8670
8652
  }
8671
8653
  }
8672
- }, 12e4);
8673
- });
8674
- req.socket.setNoDelay(true);
8675
- res.writeHead(200, {
8676
- "content-type": "text/event-stream",
8677
- "Access-Control-Allow-Origin": "*",
8678
- "Access-Control-Allow-Methods": "*",
8679
- "Access-Control-Allow-Headers": "*"
8680
- });
8681
- res.write("\n");
8682
- const moduleActivated = [];
8683
- for (const key of keys) {
8684
- const oldValue = activeModules.get(key) || 0;
8685
- activeModules.set(key, oldValue + 1);
8686
- if (oldValue === 0) {
8687
- logger.log(`${key} is now in use and will be compiled.`);
8688
- moduleActivated.push(key);
8689
- }
8690
- }
8691
- if (moduleActivated.length && compiler.watching) {
8692
- compiler.watching.lazyCompilationInvalidate(
8693
- new Set(moduleActivated.map((key) => filesByKey.get(key)))
8694
- );
8695
- }
8696
- };
8697
- const server = createServer();
8698
- server.on("request", requestListener);
8699
- let isClosing = false;
8700
- const sockets = /* @__PURE__ */ new Set();
8701
- server.on("connection", (socket) => {
8702
- sockets.add(socket);
8703
- socket.on("close", () => {
8704
- sockets.delete(socket);
8705
- });
8706
- if (isClosing) socket.destroy();
8707
- });
8708
- server.on("listening", (err) => {
8709
- if (err) return callback(err);
8710
- const addr = server.address();
8711
- if (typeof addr === "string")
8712
- throw new Error("addr must not be a string");
8713
- const urlBase = addr.address === "::" || addr.address === "0.0.0.0" ? `${protocol}://localhost:${addr.port}` : addr.family === "IPv6" ? `${protocol}://[${addr.address}]:${addr.port}` : `${protocol}://${addr.address}:${addr.port}`;
8714
- logger.log(
8715
- `Server-Sent-Events server for lazy compilation open at ${urlBase}.`
8716
- );
8717
- const result2 = {
8718
- dispose(callback2) {
8719
- isClosing = true;
8720
- server.off("request", requestListener);
8721
- server.close((err2) => {
8722
- callback2(err2);
8723
- });
8724
- for (const socket of sockets) {
8725
- socket.destroy(new Error("Server is disposing"));
8654
+ if (moduleActivated.length && compiler.watching) {
8655
+ compiler.watching.lazyCompilationInvalidate(
8656
+ new Set(moduleActivated.map((key) => filesByKey.get(key)))
8657
+ );
8726
8658
  }
8727
- },
8728
- module({
8729
- module: originalModule,
8730
- path: path11
8731
- }) {
8732
- const key = `${encodeURIComponent(
8733
- originalModule.replace(/\\/g, "/").replace(/@/g, "_")
8734
- ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`;
8735
- filesByKey.set(key, path11);
8736
- const active = activeModules.get(key) > 0;
8737
- return {
8738
- client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
8739
- data: key,
8740
- active
8659
+ };
8660
+ const server = createServer();
8661
+ server.on("request", requestListener);
8662
+ let isClosing = false;
8663
+ const sockets = /* @__PURE__ */ new Set();
8664
+ server.on("connection", (socket) => {
8665
+ sockets.add(socket);
8666
+ socket.on("close", () => {
8667
+ sockets.delete(socket);
8668
+ });
8669
+ if (isClosing) socket.destroy();
8670
+ });
8671
+ server.on("listening", (err) => {
8672
+ if (err) return callback(err);
8673
+ const addr = server.address();
8674
+ if (typeof addr === "string")
8675
+ throw new Error("addr must not be a string");
8676
+ const urlBase = addr.address === "::" || addr.address === "0.0.0.0" ? `${protocol}://localhost:${addr.port}` : addr.family === "IPv6" ? `${protocol}://[${addr.address}]:${addr.port}` : `${protocol}://${addr.address}:${addr.port}`;
8677
+ logger.log(
8678
+ `Server-Sent-Events server for lazy compilation open at ${urlBase}.`
8679
+ );
8680
+ const result2 = {
8681
+ dispose(callback2) {
8682
+ isClosing = true;
8683
+ server.off("request", requestListener);
8684
+ server.close((err2) => {
8685
+ callback2(err2);
8686
+ });
8687
+ for (const socket of sockets) {
8688
+ socket.destroy(new Error("Server is disposing"));
8689
+ }
8690
+ },
8691
+ module({
8692
+ module: originalModule,
8693
+ path: path11
8694
+ }) {
8695
+ const key = `${encodeURIComponent(
8696
+ originalModule.replace(/\\/g, "/").replace(/@/g, "_")
8697
+ ).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`;
8698
+ filesByKey.set(key, path11);
8699
+ const active = activeModules.get(key) > 0;
8700
+ return {
8701
+ client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
8702
+ data: key,
8703
+ active
8704
+ };
8705
+ }
8741
8706
  };
8742
- }
8743
- };
8744
- state.module = result2.module;
8745
- state.dispose = result2.dispose;
8746
- callback(null, result2);
8747
- });
8748
- listen(server);
8707
+ state.module = result2.module;
8708
+ state.dispose = result2.dispose;
8709
+ callback(null, result2);
8710
+ });
8711
+ listen(server);
8712
+ }
8713
+ };
8749
8714
  };
8750
8715
  var backend_default = getBackend;
8751
8716
  function unimplemented() {
8752
8717
  throw new Error("access before initialization");
8753
8718
  }
8754
- var state = {
8755
- module: unimplemented,
8756
- dispose: unimplemented
8757
- };
8758
- function dispose(callback) {
8759
- state.dispose(callback);
8760
- state.dispose = unimplemented;
8761
- state.module = unimplemented;
8762
- }
8763
- function moduleImpl(args) {
8764
- return state.module(args);
8765
- }
8766
8719
 
8767
8720
  // src/builtin-plugin/lazy-compilation/lazyCompilation.ts
8768
8721
  var import_binding40 = require("@rspack/binding");
@@ -8782,12 +8735,12 @@ var LazyCompilationPlugin = class {
8782
8735
  this.backend = backend;
8783
8736
  }
8784
8737
  apply(compiler) {
8785
- const backend = backend_default({
8738
+ const { state, backend } = backend_default({
8786
8739
  client: require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? "node" : "web"}.js`),
8787
8740
  ...this.backend
8788
8741
  });
8789
8742
  new BuiltinLazyCompilationPlugin(
8790
- moduleImpl,
8743
+ (args) => state.module(args),
8791
8744
  this.cacheable,
8792
8745
  this.entries,
8793
8746
  this.imports,
@@ -8822,7 +8775,7 @@ var LazyCompilationPlugin = class {
8822
8775
  }
8823
8776
  );
8824
8777
  compiler.hooks.shutdown.tapAsync("LazyCompilationPlugin", (callback) => {
8825
- dispose(callback);
8778
+ state.dispose(callback);
8826
8779
  });
8827
8780
  }
8828
8781
  };
@@ -9892,6 +9845,14 @@ function normalizePath(path11) {
9892
9845
  return path11.replace(/\?.*$/, "").split(import_node_path7.sep).join("/");
9893
9846
  }
9894
9847
 
9848
+ // src/builtin-plugin/ModuleInfoHeaderPlugin.ts
9849
+ var import_binding75 = require("@rspack/binding");
9850
+ var ModuleInfoHeaderPlugin = create2(
9851
+ import_binding75.BuiltinPluginName.ModuleInfoHeaderPlugin,
9852
+ (verbose) => verbose,
9853
+ "compilation"
9854
+ );
9855
+
9895
9856
  // src/util/assertNotNil.ts
9896
9857
  function assertNotNill(value) {
9897
9858
  if (value == null) {
@@ -13419,6 +13380,7 @@ var Watching = class {
13419
13380
  );
13420
13381
  }
13421
13382
  #go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
13383
+ this.#initial = false;
13422
13384
  if (this.startTime === void 0) this.startTime = Date.now();
13423
13385
  this.running = true;
13424
13386
  if (this.watcher) {
@@ -13439,15 +13401,14 @@ var Watching = class {
13439
13401
  this.compiler.fileTimestamps = fileTimeInfoEntries2;
13440
13402
  this.compiler.contextTimestamps = contextTimeInfoEntries2;
13441
13403
  }
13442
- const modifiedFiles = this.compiler.modifiedFiles = this.#collectedChangedFiles;
13443
- const deleteFiles = this.compiler.removedFiles = this.#collectedRemovedFiles;
13404
+ this.compiler.modifiedFiles = this.#collectedChangedFiles;
13405
+ this.compiler.removedFiles = this.#collectedRemovedFiles;
13444
13406
  this.#collectedChangedFiles = void 0;
13445
13407
  this.#collectedRemovedFiles = void 0;
13446
13408
  this.invalid = false;
13447
13409
  this.#invalidReported = false;
13448
13410
  this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => {
13449
13411
  if (err) return this._done(err);
13450
- const canRebuild = !this.#initial && ((modifiedFiles == null ? void 0 : modifiedFiles.size) || (deleteFiles == null ? void 0 : deleteFiles.size));
13451
13412
  const onCompiled = (err2, _compilation) => {
13452
13413
  if (err2) return this._done(err2);
13453
13414
  const compilation = _compilation;
@@ -13469,9 +13430,6 @@ var Watching = class {
13469
13430
  this._done(null, this.compiler._lastCompilation);
13470
13431
  };
13471
13432
  this.compiler.compile(onCompiled);
13472
- if (!canRebuild) {
13473
- this.#initial = false;
13474
- }
13475
13433
  });
13476
13434
  }
13477
13435
  /**
@@ -14385,7 +14343,7 @@ var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) =>
14385
14343
  const digestResult = hash.digest(
14386
14344
  getCompiler().options.output.hashDigest
14387
14345
  );
14388
- return Buffer.from(digestResult);
14346
+ return toBuffer(digestResult);
14389
14347
  };
14390
14348
  }
14391
14349
  ),
@@ -14631,7 +14589,7 @@ var createJavaScriptModulesHooksRegisters = (getCompiler, createTap, createMapTa
14631
14589
  const digestResult = hash.digest(
14632
14590
  getCompiler().options.output.hashDigest
14633
14591
  );
14634
- return Buffer.from(digestResult);
14592
+ return toBuffer(digestResult);
14635
14593
  };
14636
14594
  }
14637
14595
  )
@@ -14651,7 +14609,8 @@ var createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMap
14651
14609
  return async function(resolveData) {
14652
14610
  const normalizedResolveData = {
14653
14611
  contextInfo: {
14654
- issuer: resolveData.issuer
14612
+ issuer: resolveData.issuer,
14613
+ issuerLayer: resolveData.issuerLayer ?? null
14655
14614
  },
14656
14615
  request: resolveData.request,
14657
14616
  context: resolveData.context,
@@ -14675,7 +14634,8 @@ var createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMap
14675
14634
  return async function(resolveData) {
14676
14635
  const normalizedResolveData = {
14677
14636
  contextInfo: {
14678
- issuer: resolveData.issuer
14637
+ issuer: resolveData.issuer,
14638
+ issuerLayer: resolveData.issuerLayer ?? null
14679
14639
  },
14680
14640
  request: resolveData.request,
14681
14641
  context: resolveData.context,
@@ -14699,7 +14659,8 @@ var createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMap
14699
14659
  return async function(resolveData) {
14700
14660
  const normalizedResolveData = {
14701
14661
  contextInfo: {
14702
- issuer: resolveData.issuer
14662
+ issuer: resolveData.issuer,
14663
+ issuerLayer: resolveData.issuerLayer ?? null
14703
14664
  },
14704
14665
  request: resolveData.request,
14705
14666
  context: resolveData.context,
@@ -14735,7 +14696,8 @@ var createNormalModuleFactoryHooksRegisters = (getCompiler, createTap, createMap
14735
14696
  return async function(arg) {
14736
14697
  const data = {
14737
14698
  contextInfo: {
14738
- issuer: arg.issuer
14699
+ issuer: arg.issuer,
14700
+ issuerLayer: arg.issuerLayer ?? null
14739
14701
  },
14740
14702
  request: arg.request,
14741
14703
  context: arg.context,
@@ -14989,11 +14951,14 @@ var Compiler = class _Compiler {
14989
14951
  }
14990
14952
  /**
14991
14953
  * @param callback - signals when the call finishes
14954
+ * @param options - additional data like modifiedFiles, removedFiles
14992
14955
  */
14993
- run(callback) {
14956
+ run(callback, options = {}) {
14994
14957
  if (this.running) {
14995
14958
  return callback(new ConcurrentCompilationError());
14996
14959
  }
14960
+ this.modifiedFiles = options.modifiedFiles;
14961
+ this.removedFiles = options.removedFiles;
14997
14962
  const startTime = Date.now();
14998
14963
  this.running = true;
14999
14964
  const finalCallback = (err, stats) => {
@@ -15215,28 +15180,18 @@ var Compiler = class _Compiler {
15215
15180
  #build(callback) {
15216
15181
  this.#getInstance((error, instance) => {
15217
15182
  if (error) {
15218
- return callback == null ? void 0 : callback(error);
15183
+ return callback(error);
15219
15184
  }
15220
15185
  if (!this.#initial) {
15221
15186
  instance.rebuild(
15222
15187
  Array.from(this.modifiedFiles || []),
15223
15188
  Array.from(this.removedFiles || []),
15224
- (error2) => {
15225
- if (error2) {
15226
- return callback == null ? void 0 : callback(error2);
15227
- }
15228
- callback == null ? void 0 : callback(null);
15229
- }
15189
+ callback
15230
15190
  );
15231
15191
  return;
15232
15192
  }
15233
15193
  this.#initial = false;
15234
- instance.build((error2) => {
15235
- if (error2) {
15236
- return callback == null ? void 0 : callback(error2);
15237
- }
15238
- callback == null ? void 0 : callback(null);
15239
- });
15194
+ instance.build(callback);
15240
15195
  });
15241
15196
  }
15242
15197
  /**
@@ -16096,7 +16051,11 @@ var MultiCompiler = class {
16096
16051
  }
16097
16052
  return new MultiWatching_default([], this);
16098
16053
  }
16099
- run(callback) {
16054
+ /**
16055
+ * @param callback - signals when the call finishes
16056
+ * @param options - additional data like modifiedFiles, removedFiles
16057
+ */
16058
+ run(callback, options) {
16100
16059
  if (this.running) {
16101
16060
  return callback(new ConcurrentCompilationError());
16102
16061
  }
@@ -16105,7 +16064,7 @@ var MultiCompiler = class {
16105
16064
  this.#runGraph(
16106
16065
  () => {
16107
16066
  },
16108
- (compiler, _, callback2) => compiler.run(callback2),
16067
+ (compiler, _, callback2) => compiler.run(callback2, options),
16109
16068
  (err, stats) => {
16110
16069
  this.running = false;
16111
16070
  if (callback !== void 0) {
@@ -19105,6 +19064,11 @@ var RspackOptionsApply = class {
19105
19064
  ).apply(compiler);
19106
19065
  }
19107
19066
  new ChunkPrefetchPreloadPlugin().apply(compiler);
19067
+ if (options.output.pathinfo) {
19068
+ new ModuleInfoHeaderPlugin(options.output.pathinfo === "verbose").apply(
19069
+ compiler
19070
+ );
19071
+ }
19108
19072
  if (typeof options.output.chunkFormat === "string") {
19109
19073
  switch (options.output.chunkFormat) {
19110
19074
  case "array-push": {
@@ -19339,6 +19303,9 @@ var RspackOptionsApply = class {
19339
19303
  }
19340
19304
  };
19341
19305
 
19306
+ // src/exports.ts
19307
+ var import_binding83 = require("@rspack/binding");
19308
+
19342
19309
  // src/lib/ModuleFilenameHelpers.ts
19343
19310
  var ModuleFilenameHelpers_exports = {};
19344
19311
  __export(ModuleFilenameHelpers_exports, {
@@ -19382,9 +19349,9 @@ var matchObject = (obj, str) => {
19382
19349
  var import_zod7 = __toESM(require("../compiled/zod/index.js"));
19383
19350
 
19384
19351
  // src/builtin-plugin/FlagAllModulesAsUsedPlugin.ts
19385
- var import_binding75 = require("@rspack/binding");
19352
+ var import_binding76 = require("@rspack/binding");
19386
19353
  var FlagAllModulesAsUsedPlugin = create2(
19387
- import_binding75.BuiltinPluginName.FlagAllModulesAsUsedPlugin,
19354
+ import_binding76.BuiltinPluginName.FlagAllModulesAsUsedPlugin,
19388
19355
  (explanation) => {
19389
19356
  return {
19390
19357
  explanation
@@ -20273,9 +20240,9 @@ var NodeTemplatePlugin = class {
20273
20240
  };
20274
20241
 
20275
20242
  // src/container/ModuleFederationRuntimePlugin.ts
20276
- var import_binding76 = require("@rspack/binding");
20243
+ var import_binding77 = require("@rspack/binding");
20277
20244
  var ModuleFederationRuntimePlugin = create2(
20278
- import_binding76.BuiltinPluginName.ModuleFederationRuntimePlugin,
20245
+ import_binding77.BuiltinPluginName.ModuleFederationRuntimePlugin,
20279
20246
  () => {
20280
20247
  }
20281
20248
  );
@@ -20471,10 +20438,10 @@ function getDefaultEntryRuntime(paths, options, compiler) {
20471
20438
  }
20472
20439
 
20473
20440
  // src/sharing/ConsumeSharedPlugin.ts
20474
- var import_binding78 = require("@rspack/binding");
20441
+ var import_binding79 = require("@rspack/binding");
20475
20442
 
20476
20443
  // src/sharing/ShareRuntimePlugin.ts
20477
- var import_binding77 = require("@rspack/binding");
20444
+ var import_binding78 = require("@rspack/binding");
20478
20445
  var compilerSet = /* @__PURE__ */ new WeakSet();
20479
20446
  function isSingleton(compiler) {
20480
20447
  return compilerSet.has(compiler);
@@ -20486,7 +20453,7 @@ var ShareRuntimePlugin = class extends RspackBuiltinPlugin {
20486
20453
  constructor(enhanced = false) {
20487
20454
  super();
20488
20455
  this.enhanced = enhanced;
20489
- this.name = import_binding77.BuiltinPluginName.ShareRuntimePlugin;
20456
+ this.name = import_binding78.BuiltinPluginName.ShareRuntimePlugin;
20490
20457
  }
20491
20458
  raw(compiler) {
20492
20459
  if (isSingleton(compiler)) return;
@@ -20505,7 +20472,7 @@ function isRequiredVersion(str) {
20505
20472
  var ConsumeSharedPlugin = class extends RspackBuiltinPlugin {
20506
20473
  constructor(options) {
20507
20474
  super();
20508
- this.name = import_binding78.BuiltinPluginName.ConsumeSharedPlugin;
20475
+ this.name = import_binding79.BuiltinPluginName.ConsumeSharedPlugin;
20509
20476
  this._options = {
20510
20477
  consumes: parseOptions(
20511
20478
  options.consumes,
@@ -20568,11 +20535,11 @@ var ConsumeSharedPlugin = class extends RspackBuiltinPlugin {
20568
20535
  };
20569
20536
 
20570
20537
  // src/sharing/ProvideSharedPlugin.ts
20571
- var import_binding79 = require("@rspack/binding");
20538
+ var import_binding80 = require("@rspack/binding");
20572
20539
  var ProvideSharedPlugin = class extends RspackBuiltinPlugin {
20573
20540
  constructor(options) {
20574
20541
  super();
20575
- this.name = import_binding79.BuiltinPluginName.ProvideSharedPlugin;
20542
+ this.name = import_binding80.BuiltinPluginName.ProvideSharedPlugin;
20576
20543
  this._provides = parseOptions(
20577
20544
  options.provides,
20578
20545
  (item) => {
@@ -20677,11 +20644,11 @@ var SharePlugin = class {
20677
20644
  };
20678
20645
 
20679
20646
  // src/container/ContainerPlugin.ts
20680
- var import_binding80 = require("@rspack/binding");
20647
+ var import_binding81 = require("@rspack/binding");
20681
20648
  var ContainerPlugin = class extends RspackBuiltinPlugin {
20682
20649
  constructor(options) {
20683
20650
  super();
20684
- this.name = import_binding80.BuiltinPluginName.ContainerPlugin;
20651
+ this.name = import_binding81.BuiltinPluginName.ContainerPlugin;
20685
20652
  this._options = {
20686
20653
  name: options.name,
20687
20654
  shareScope: options.shareScope || "default",
@@ -20725,11 +20692,11 @@ var ContainerPlugin = class extends RspackBuiltinPlugin {
20725
20692
  };
20726
20693
 
20727
20694
  // src/container/ContainerReferencePlugin.ts
20728
- var import_binding81 = require("@rspack/binding");
20695
+ var import_binding82 = require("@rspack/binding");
20729
20696
  var ContainerReferencePlugin = class extends RspackBuiltinPlugin {
20730
20697
  constructor(options) {
20731
20698
  super();
20732
- this.name = import_binding81.BuiltinPluginName.ContainerReferencePlugin;
20699
+ this.name = import_binding82.BuiltinPluginName.ContainerReferencePlugin;
20733
20700
  this._options = {
20734
20701
  remoteType: options.remoteType,
20735
20702
  remotes: parseOptions(
@@ -20814,7 +20781,7 @@ var ModuleFederationPluginV1 = class {
20814
20781
  };
20815
20782
 
20816
20783
  // src/exports.ts
20817
- var import_binding82 = require("@rspack/binding");
20784
+ var import_binding84 = require("@rspack/binding");
20818
20785
  var rspackVersion = import_package.version;
20819
20786
  var version = import_package.webpackVersion;
20820
20787
  var WebpackError2 = Error;
@@ -20861,7 +20828,7 @@ var sharing = {
20861
20828
  var experiments2 = {
20862
20829
  globalTrace: {
20863
20830
  async register(filter, layer2, output2) {
20864
- (0, import_binding82.registerGlobalTrace)(filter, layer2, output2);
20831
+ (0, import_binding84.registerGlobalTrace)(filter, layer2, output2);
20865
20832
  if (layer2 === "otel") {
20866
20833
  try {
20867
20834
  const { initOpenTelemetry } = await import("@rspack/tracing");
@@ -20875,7 +20842,7 @@ var experiments2 = {
20875
20842
  }
20876
20843
  },
20877
20844
  async cleanup() {
20878
- (0, import_binding82.cleanupGlobalTrace)();
20845
+ (0, import_binding84.cleanupGlobalTrace)();
20879
20846
  try {
20880
20847
  const { shutdownOpenTelemetry } = await import("@rspack/tracing");
20881
20848
  await shutdownOpenTelemetry();
@@ -21009,9 +20976,11 @@ module.exports = rspack;
21009
20976
  CopyRspackPlugin,
21010
20977
  CssExtractRspackPlugin,
21011
20978
  DefinePlugin,
20979
+ Dependency,
21012
20980
  DllPlugin,
21013
20981
  DllReferencePlugin,
21014
20982
  DynamicEntryPlugin,
20983
+ EntryDependency,
21015
20984
  EntryOptionPlugin,
21016
20985
  EntryPlugin,
21017
20986
  EnvironmentPlugin,