@rspack-canary/core 1.6.7-canary-e27a87e9-20251209100543 → 1.6.8-canary-a3066402-20251209142350

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
@@ -5785,7 +5785,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5785
5785
  }, applyExperimentsDefaults = (experiments, { development })=>{
5786
5786
  F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "deferImport", !1), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
5787
5787
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
5788
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.7-canary-e27a87e9-20251209100543"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5788
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.8-canary-a3066402-20251209142350"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5789
5789
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst, deferImport })=>{
5790
5790
  if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { usedExports, inlineConst, deferImport })=>{
5791
5791
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "unknownContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "commonjs", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
@@ -7545,7 +7545,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7545
7545
  });
7546
7546
  }
7547
7547
  }
7548
- let CORE_VERSION = "1.6.7-canary-e27a87e9-20251209100543", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7548
+ let CORE_VERSION = "1.6.8-canary-a3066402-20251209142350", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7549
7549
 
7550
7550
  Help:
7551
7551
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -8854,7 +8854,7 @@ Help:
8854
8854
  obj.children = this.stats.map((stat, idx)=>{
8855
8855
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8856
8856
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8857
- }), childOptions.version && (obj.rspackVersion = "1.6.7-canary-e27a87e9-20251209100543", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8857
+ }), childOptions.version && (obj.rspackVersion = "1.6.8-canary-a3066402-20251209142350", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8858
8858
  let mapError = (j, obj)=>({
8859
8859
  ...obj,
8860
8860
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9727,15 +9727,20 @@ Help:
9727
9727
  if (!1 === logging && !debugMode) continue;
9728
9728
  let groupStack = [], rootList = [], currentList = rootList, processedLogEntries = 0;
9729
9729
  for (let entry of logEntries){
9730
- let type = entry.type, typeBitFlag = getLogTypeBitFlag(type);
9730
+ let message, type = entry.type, typeBitFlag = getLogTypeBitFlag(type);
9731
9731
  if (!debugMode && (acceptedTypes & typeBitFlag) !== typeBitFlag) continue;
9732
9732
  if (type === LogType.groupCollapsed && (debugMode || collapsedGroups) && (type = LogType.group), 0 === depthInCollapsedGroup && processedLogEntries++, type === LogType.groupEnd) {
9733
9733
  groupStack.pop(), currentList = groupStack.length > 0 ? groupStack[groupStack.length - 1].children : rootList, depthInCollapsedGroup > 0 && depthInCollapsedGroup--;
9734
9734
  continue;
9735
9735
  }
9736
+ if (entry.type === LogType.time) {
9737
+ let [label, first, second] = entry.args;
9738
+ "number" == typeof first && "number" == typeof second && (message = `${label}: ${1000 * first + second / 1000000} ms`);
9739
+ }
9740
+ message || (message = entry.args?.length ? external_node_util_namespaceObject.format(entry.args[0], ...entry.args.slice(1)) : "");
9736
9741
  let newEntry = {
9737
9742
  type,
9738
- message: entry.args?.length ? external_node_util_namespaceObject.format(entry.args[0], ...entry.args.slice(1)) : "",
9743
+ message: message || "",
9739
9744
  trace: loggingTrace ? entry.trace : void 0,
9740
9745
  children: type === LogType.group || type === LogType.groupCollapsed ? [] : void 0
9741
9746
  };
@@ -9753,7 +9758,7 @@ Help:
9753
9758
  object.hash = context.getStatsCompilation(compilation).hash;
9754
9759
  },
9755
9760
  version: (object)=>{
9756
- object.version = "5.75.0", object.rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
9761
+ object.version = "5.75.0", object.rspackVersion = "1.6.8-canary-a3066402-20251209142350";
9757
9762
  },
9758
9763
  env: (object, _compilation, _context, { _env })=>{
9759
9764
  object.env = _env;
@@ -11598,120 +11603,30 @@ Help:
11598
11603
  function isRequiredVersion(str) {
11599
11604
  return VERSION_PATTERN_REGEXP.test(str);
11600
11605
  }
11601
- let encodeName = function(name, prefix = "", withExt = !1) {
11602
- return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${withExt ? ".js" : ""}`;
11603
- }, parseOptions = (options, normalizeSimple, normalizeOptions)=>{
11604
- let items = [];
11605
- var options1 = options, normalizeSimple1 = normalizeSimple, normalizeOptions1 = normalizeOptions, fn = (key, value)=>{
11606
- items.push([
11607
- key,
11608
- value
11609
- ]);
11610
- };
11611
- let object = (obj)=>{
11612
- for (let [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple1(value, key)) : fn(key, normalizeOptions1(value, key));
11613
- };
11614
- if (options1) if (Array.isArray(options1)) {
11615
- var items1 = options1;
11616
- for (let item of items1)if ("string" == typeof item) fn(item, normalizeSimple1(item, item));
11617
- else if (item && "object" == typeof item) object(item);
11618
- else throw Error("Unexpected options format");
11619
- } else if ("object" == typeof options1) object(options1);
11620
- else throw Error("Unexpected options format");
11621
- return items;
11622
- }, MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
11606
+ let MANIFEST_FILE_NAME = "mf-manifest.json", STATS_FILE_NAME = "mf-stats.json", JSON_EXT = ".json";
11623
11607
  function isPlainObject(value) {
11624
11608
  return !!value && "object" == typeof value && !Array.isArray(value);
11625
11609
  }
11626
- function getFileName(manifestOptions) {
11627
- var name;
11628
- if (!manifestOptions) return {
11629
- statsFileName: "",
11630
- manifestFileName: ""
11631
- };
11632
- if ("boolean" == typeof manifestOptions) return {
11633
- statsFileName: STATS_FILE_NAME,
11634
- manifestFileName: MANIFEST_FILE_NAME
11635
- };
11636
- let filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "", fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "", manifestFileName = fileName ? (name = fileName).endsWith(JSON_EXT) ? name : `${name}${JSON_EXT}` : MANIFEST_FILE_NAME, statsFileName = fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME;
11637
- return {
11638
- statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
11639
- manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
11640
- };
11641
- }
11642
11610
  class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
11643
11611
  name = binding_.BuiltinPluginName.ModuleFederationManifestPlugin;
11644
11612
  opts;
11645
11613
  constructor(opts){
11646
- var mfConfig;
11647
- let manifestOptions, containerName, globalName, remoteAliasMap, manifestExposes, manifestShared;
11648
- super(), this.opts = (manifestOptions = !0 === (mfConfig = opts).manifest ? {} : {
11649
- ...mfConfig.manifest
11650
- }, containerName = mfConfig.name, globalName = function(library) {
11651
- if (!library) return;
11652
- let libName = library.name;
11653
- if (libName) {
11654
- if ("string" == typeof libName) return libName;
11655
- if (Array.isArray(libName)) return libName[0];
11656
- if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
11657
- }
11658
- }(mfConfig.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
11659
- if (cur[1].length > 1) return sum;
11660
- let { entry, alias, name } = cur[1][0];
11661
- return entry && name && (sum[alias] = {
11662
- name,
11663
- entry
11664
- }), sum;
11665
- }, {}), manifestExposes = function(exposes) {
11666
- if (!exposes) return;
11667
- let result = parseOptions(exposes, (value)=>({
11668
- import: Array.isArray(value) ? value : [
11669
- value
11670
- ],
11671
- name: void 0
11672
- }), (value)=>({
11673
- import: Array.isArray(value.import) ? value.import : [
11674
- value.import
11675
- ],
11676
- name: value.name ?? void 0
11677
- })).map(([exposeKey, info])=>{
11678
- let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
11679
- return {
11680
- path: exposeKey,
11681
- name: exposeName
11682
- };
11683
- });
11684
- return result.length > 0 ? result : void 0;
11685
- }(mfConfig.exposes), void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes), manifestShared = function(shared) {
11686
- if (!shared) return;
11687
- let result = parseOptions(shared, (item, key)=>{
11688
- if ("string" != typeof item) throw Error("Unexpected array in shared");
11689
- return item !== key && isRequiredVersion(item) ? {
11690
- import: key,
11691
- requiredVersion: item
11692
- } : {
11693
- import: item
11694
- };
11695
- }, (item)=>item).map(([key, config])=>{
11696
- let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
11697
- return {
11698
- name,
11699
- version,
11700
- requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
11701
- singleton: config.singleton
11702
- };
11703
- });
11704
- return result.length > 0 ? result : void 0;
11705
- }(mfConfig.shared), void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), {
11706
- ...manifestOptions,
11707
- remoteAliasMap,
11708
- globalName,
11709
- name: containerName
11710
- });
11614
+ super(), this.opts = opts;
11711
11615
  }
11712
11616
  raw(compiler) {
11713
11617
  var isDev;
11714
- let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = getFileName(this.opts), rawOptions = {
11618
+ let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = function(manifestOptions) {
11619
+ var name;
11620
+ if (!manifestOptions) return {
11621
+ statsFileName: STATS_FILE_NAME,
11622
+ manifestFileName: MANIFEST_FILE_NAME
11623
+ };
11624
+ let filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "", fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "", manifestFileName = fileName ? (name = fileName).endsWith(JSON_EXT) ? name : `${name}${JSON_EXT}` : MANIFEST_FILE_NAME, statsFileName = fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME;
11625
+ return {
11626
+ statsFileName: (0, external_node_path_namespaceObject.join)(filePath, statsFileName),
11627
+ manifestFileName: (0, external_node_path_namespaceObject.join)(filePath, manifestFileName)
11628
+ };
11629
+ }(this.opts), rawOptions = {
11715
11630
  name: this.opts.name,
11716
11631
  globalName: this.opts.globalName,
11717
11632
  fileName,
@@ -11746,6 +11661,81 @@ Help:
11746
11661
  return createBuiltinPlugin(this.name, rawOptions);
11747
11662
  }
11748
11663
  }
11664
+ let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), parseOptions = (options, normalizeSimple, normalizeOptions)=>{
11665
+ let items = [];
11666
+ var options1 = options, normalizeSimple1 = normalizeSimple, normalizeOptions1 = normalizeOptions, fn = (key, value)=>{
11667
+ items.push([
11668
+ key,
11669
+ value
11670
+ ]);
11671
+ };
11672
+ let object = (obj)=>{
11673
+ for (let [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple1(value, key)) : fn(key, normalizeOptions1(value, key));
11674
+ };
11675
+ if (options1) if (Array.isArray(options1)) {
11676
+ var items1 = options1;
11677
+ for (let item of items1)if ("string" == typeof item) fn(item, normalizeSimple1(item, item));
11678
+ else if (item && "object" == typeof item) object(item);
11679
+ else throw Error("Unexpected options format");
11680
+ } else if ("object" == typeof options1) object(options1);
11681
+ else throw Error("Unexpected options format");
11682
+ return items;
11683
+ };
11684
+ function getRemoteInfos(options) {
11685
+ if (!options.remotes) return {};
11686
+ let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
11687
+ external: Array.isArray(item) ? item : [
11688
+ item
11689
+ ],
11690
+ shareScope: options.shareScope || "default"
11691
+ }), (item)=>({
11692
+ external: Array.isArray(item.external) ? item.external : [
11693
+ item.external
11694
+ ],
11695
+ shareScope: item.shareScope || options.shareScope || "default"
11696
+ })), remoteInfos = {};
11697
+ for (let [key, config] of remotes)for (let external of config.external){
11698
+ let [externalType, externalRequest] = function(external) {
11699
+ let result = function(external) {
11700
+ if (/^[a-z0-9-]+ /.test(external)) {
11701
+ let idx = external.indexOf(" ");
11702
+ return [
11703
+ external.slice(0, idx),
11704
+ external.slice(idx + 1)
11705
+ ];
11706
+ }
11707
+ return null;
11708
+ }(external);
11709
+ return null === result ? [
11710
+ remoteType,
11711
+ external
11712
+ ] : result;
11713
+ }(external);
11714
+ if (remoteInfos[key] ??= [], "script" === externalType) {
11715
+ let [url, global] = function(urlAndGlobal) {
11716
+ let index = urlAndGlobal.indexOf("@");
11717
+ return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
11718
+ urlAndGlobal.substring(index + 1),
11719
+ urlAndGlobal.substring(0, index)
11720
+ ];
11721
+ }(externalRequest);
11722
+ remoteInfos[key].push({
11723
+ alias: key,
11724
+ name: global,
11725
+ entry: url,
11726
+ externalType,
11727
+ shareScope: config.shareScope
11728
+ });
11729
+ } else remoteInfos[key].push({
11730
+ alias: key,
11731
+ name: void 0,
11732
+ entry: void 0,
11733
+ externalType,
11734
+ shareScope: config.shareScope
11735
+ });
11736
+ }
11737
+ return remoteInfos;
11738
+ }
11749
11739
  let compilerSet = new WeakSet();
11750
11740
  class ShareRuntimePlugin extends RspackBuiltinPlugin {
11751
11741
  enhanced;
@@ -11758,48 +11748,42 @@ Help:
11758
11748
  if (compiler1 = compiler, !compilerSet.has(compiler1)) return compiler2 = compiler, compilerSet.add(compiler2), createBuiltinPlugin(this.name, this.enhanced);
11759
11749
  }
11760
11750
  }
11761
- function normalizeConsumeShareOptions(consumes, shareScope) {
11762
- return parseOptions(consumes, (item, key)=>{
11763
- if (Array.isArray(item)) throw Error("Unexpected array in options");
11764
- return item !== key && isRequiredVersion(item) ? {
11765
- import: key,
11766
- shareScope: shareScope || "default",
11767
- shareKey: key,
11768
- requiredVersion: item,
11769
- strictVersion: !0,
11770
- packageName: void 0,
11771
- singleton: !1,
11772
- eager: !1,
11773
- treeshakeStrategy: void 0
11774
- } : {
11775
- import: key,
11776
- shareScope: shareScope || "default",
11777
- shareKey: key,
11778
- requiredVersion: void 0,
11779
- packageName: void 0,
11780
- strictVersion: !1,
11781
- singleton: !1,
11782
- eager: !1,
11783
- treeshakeStrategy: void 0
11784
- };
11785
- }, (item, key)=>({
11786
- import: !1 === item.import ? void 0 : item.import || key,
11787
- shareScope: item.shareScope || shareScope || "default",
11788
- shareKey: item.shareKey || key,
11789
- requiredVersion: item.requiredVersion,
11790
- strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
11791
- packageName: item.packageName,
11792
- singleton: !!item.singleton,
11793
- eager: !!item.eager,
11794
- treeshakeStrategy: item.treeshakeStrategy
11795
- }));
11796
- }
11797
11751
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
11798
11752
  name = binding_.BuiltinPluginName.ConsumeSharedPlugin;
11799
11753
  _options;
11800
11754
  constructor(options){
11801
11755
  super(), this._options = {
11802
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
11756
+ consumes: parseOptions(options.consumes, (item, key)=>{
11757
+ if (Array.isArray(item)) throw Error("Unexpected array in options");
11758
+ return item !== key && isRequiredVersion(item) ? {
11759
+ import: key,
11760
+ shareScope: options.shareScope || "default",
11761
+ shareKey: key,
11762
+ requiredVersion: item,
11763
+ strictVersion: !0,
11764
+ packageName: void 0,
11765
+ singleton: !1,
11766
+ eager: !1
11767
+ } : {
11768
+ import: key,
11769
+ shareScope: options.shareScope || "default",
11770
+ shareKey: key,
11771
+ requiredVersion: void 0,
11772
+ packageName: void 0,
11773
+ strictVersion: !1,
11774
+ singleton: !1,
11775
+ eager: !1
11776
+ };
11777
+ }, (item, key)=>({
11778
+ import: !1 === item.import ? void 0 : item.import || key,
11779
+ shareScope: item.shareScope || options.shareScope || "default",
11780
+ shareKey: item.shareKey || key,
11781
+ requiredVersion: item.requiredVersion,
11782
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
11783
+ packageName: item.packageName,
11784
+ singleton: !!item.singleton,
11785
+ eager: !!item.eager
11786
+ })),
11803
11787
  enhanced: options.enhanced ?? !1
11804
11788
  };
11805
11789
  }
@@ -11820,30 +11804,28 @@ Help:
11820
11804
  _provides;
11821
11805
  _enhanced;
11822
11806
  constructor(options){
11823
- var options1, shareScope, enhanced;
11824
- super(), this._provides = (options1 = options.provides, shareScope = options.shareScope, enhanced = options.enhanced, parseOptions(options1, (item)=>{
11807
+ super(), this._provides = parseOptions(options.provides, (item)=>{
11825
11808
  if (Array.isArray(item)) throw Error("Unexpected array of provides");
11826
11809
  return {
11827
11810
  shareKey: item,
11828
11811
  version: void 0,
11829
- shareScope: shareScope || "default",
11812
+ shareScope: options.shareScope || "default",
11830
11813
  eager: !1
11831
11814
  };
11832
11815
  }, (item)=>{
11833
11816
  let raw = {
11834
11817
  shareKey: item.shareKey,
11835
11818
  version: item.version,
11836
- shareScope: item.shareScope || shareScope || "default",
11819
+ shareScope: item.shareScope || options.shareScope || "default",
11837
11820
  eager: !!item.eager
11838
11821
  };
11839
- return enhanced ? {
11822
+ return options.enhanced ? {
11840
11823
  ...raw,
11841
11824
  singleton: item.singleton,
11842
11825
  requiredVersion: item.requiredVersion,
11843
- strictVersion: item.strictVersion,
11844
- treeshakeStrategy: item.treeshakeStrategy
11826
+ strictVersion: item.strictVersion
11845
11827
  } : raw;
11846
- })), this._enhanced = options.enhanced;
11828
+ }), this._enhanced = options.enhanced;
11847
11829
  }
11848
11830
  raw(compiler) {
11849
11831
  new ShareRuntimePlugin(this._enhanced ?? !1).apply(compiler);
@@ -11854,40 +11836,32 @@ Help:
11854
11836
  return createBuiltinPlugin(this.name, rawOptions);
11855
11837
  }
11856
11838
  }
11857
- function normalizeSharedOptions(shared) {
11858
- return parseOptions(shared, (item, key)=>{
11859
- if ("string" != typeof item) throw Error("Unexpected array in shared");
11860
- return item !== key && isRequiredVersion(item) ? {
11861
- import: key,
11862
- requiredVersion: item
11863
- } : {
11864
- import: item
11865
- };
11866
- }, (item)=>item);
11867
- }
11868
- function createConsumeShareOptions(normalizedSharedOptions) {
11869
- return normalizedSharedOptions.map(([key, options])=>({
11870
- [key]: {
11871
- import: options.import,
11872
- shareKey: options.shareKey || key,
11873
- shareScope: options.shareScope,
11874
- requiredVersion: options.requiredVersion,
11875
- strictVersion: options.strictVersion,
11876
- singleton: options.singleton,
11877
- packageName: options.packageName,
11878
- eager: options.eager,
11879
- treeshakeStrategy: options.treeshake?.strategy
11880
- }
11881
- }));
11882
- }
11883
11839
  class SharePlugin {
11884
11840
  _shareScope;
11885
11841
  _consumes;
11886
11842
  _provides;
11887
11843
  _enhanced;
11888
- _sharedOptions;
11889
11844
  constructor(options){
11890
- const sharedOptions = normalizeSharedOptions(options.shared), consumes = createConsumeShareOptions(sharedOptions), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
11845
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
11846
+ if ("string" != typeof item) throw Error("Unexpected array in shared");
11847
+ return item !== key && isRequiredVersion(item) ? {
11848
+ import: key,
11849
+ requiredVersion: item
11850
+ } : {
11851
+ import: item
11852
+ };
11853
+ }, (item)=>item), consumes = sharedOptions.map(([key, options])=>({
11854
+ [key]: {
11855
+ import: options.import,
11856
+ shareKey: options.shareKey || key,
11857
+ shareScope: options.shareScope,
11858
+ requiredVersion: options.requiredVersion,
11859
+ strictVersion: options.strictVersion,
11860
+ singleton: options.singleton,
11861
+ packageName: options.packageName,
11862
+ eager: options.eager
11863
+ }
11864
+ })), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
11891
11865
  [options.import || key]: {
11892
11866
  shareKey: options.shareKey || key,
11893
11867
  shareScope: options.shareScope,
@@ -11895,11 +11869,10 @@ Help:
11895
11869
  eager: options.eager,
11896
11870
  singleton: options.singleton,
11897
11871
  requiredVersion: options.requiredVersion,
11898
- strictVersion: options.strictVersion,
11899
- treeshakeStrategy: options.treeshake?.strategy
11872
+ strictVersion: options.strictVersion
11900
11873
  }
11901
11874
  }));
11902
- this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1, this._sharedOptions = sharedOptions;
11875
+ this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1;
11903
11876
  }
11904
11877
  apply(compiler) {
11905
11878
  new ConsumeSharedPlugin({
@@ -11913,394 +11886,6 @@ Help:
11913
11886
  }).apply(compiler);
11914
11887
  }
11915
11888
  }
11916
- let SHARE_ENTRY_ASSET = "collect-shared-entries.json";
11917
- class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
11918
- name = binding_.BuiltinPluginName.CollectSharedEntryPlugin;
11919
- sharedOptions;
11920
- _collectedEntries;
11921
- constructor(options){
11922
- super();
11923
- const { sharedOptions } = options;
11924
- this.sharedOptions = sharedOptions, this._collectedEntries = {};
11925
- }
11926
- getData() {
11927
- return this._collectedEntries;
11928
- }
11929
- getFilename() {
11930
- return SHARE_ENTRY_ASSET;
11931
- }
11932
- apply(compiler) {
11933
- super.apply(compiler), compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
11934
- compilation.hooks.processAssets.tapPromise({
11935
- name: "CollectSharedEntry",
11936
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
11937
- }, async ()=>{
11938
- compilation.getAssets().forEach((asset)=>{
11939
- asset.name === SHARE_ENTRY_ASSET && (this._collectedEntries = JSON.parse(asset.source.source().toString())), compilation.deleteAsset(asset.name);
11940
- });
11941
- });
11942
- });
11943
- }
11944
- raw() {
11945
- let rawOptions = {
11946
- consumes: normalizeConsumeShareOptions(createConsumeShareOptions(this.sharedOptions)).map(([key, v])=>({
11947
- key,
11948
- ...v
11949
- })),
11950
- filename: this.getFilename()
11951
- };
11952
- return createBuiltinPlugin(this.name, rawOptions);
11953
- }
11954
- }
11955
- function assert(condition, msg) {
11956
- if (!condition) throw Error(msg);
11957
- }
11958
- class SharedContainerPlugin extends RspackBuiltinPlugin {
11959
- name = binding_.BuiltinPluginName.SharedContainerPlugin;
11960
- filename = "";
11961
- _options;
11962
- _shareName;
11963
- _globalName;
11964
- constructor(options){
11965
- super();
11966
- const { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || "0.0.0";
11967
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
11968
- const fileName = independentShareFileName || `${version}/share-entry.js`;
11969
- this._shareName = shareName, this._options = {
11970
- name: shareName,
11971
- request: request,
11972
- library: (library ? {
11973
- ...library,
11974
- name: this._globalName
11975
- } : void 0) || {
11976
- type: "global",
11977
- name: this._globalName
11978
- },
11979
- version,
11980
- fileName
11981
- };
11982
- }
11983
- getData() {
11984
- return [
11985
- this._options.fileName,
11986
- this._globalName,
11987
- this._options.version
11988
- ];
11989
- }
11990
- raw(compiler) {
11991
- let { library } = this._options;
11992
- return compiler.options.output.enabledLibraryTypes.includes(library.type) || compiler.options.output.enabledLibraryTypes.push(library.type), createBuiltinPlugin(this.name, this._options);
11993
- }
11994
- apply(compiler) {
11995
- super.apply(compiler);
11996
- let shareName = this._shareName;
11997
- compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
11998
- compilation.hooks.processAssets.tapPromise({
11999
- name: "getShareContainerFile"
12000
- }, async ()=>{
12001
- assert(compilation.entrypoints.get(shareName), `Can not get shared ${shareName} entryPoint!`);
12002
- let remoteEntryNameChunk = compilation.namedChunks.get(shareName);
12003
- assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
12004
- let files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(".hot-update") && !f.endsWith(".css"));
12005
- assert(files.length > 0, `no files found for shared ${shareName} chunk`), assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`), this.filename = files[0];
12006
- });
12007
- });
12008
- }
12009
- }
12010
- class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
12011
- name = binding_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
12012
- sharedOptions;
12013
- injectUsedExports;
12014
- manifestOptions;
12015
- constructor(sharedOptions, injectUsedExports, manifestOptions){
12016
- super(), this.sharedOptions = sharedOptions, this.injectUsedExports = injectUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
12017
- }
12018
- buildOptions() {
12019
- let shared = this.sharedOptions.map(([shareKey, config])=>({
12020
- shareKey,
12021
- treeshake: !!config.treeshake,
12022
- usedExports: config.treeshake?.usedExports
12023
- })), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
12024
- return {
12025
- shared,
12026
- injectUsedExports: this.injectUsedExports,
12027
- manifestFileName,
12028
- statsFileName
12029
- };
12030
- }
12031
- raw() {
12032
- if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
12033
- }
12034
- }
12035
- let VIRTUAL_ENTRY = "./virtual-entry.js", VIRTUAL_ENTRY_NAME = "virtual-entry";
12036
- class VirtualEntryPlugin {
12037
- sharedOptions;
12038
- constructor(sharedOptions){
12039
- this.sharedOptions = sharedOptions;
12040
- }
12041
- createEntry() {
12042
- let { sharedOptions } = this;
12043
- return sharedOptions.reduce((acc, cur, index)=>`${acc}import shared_${index} from '${cur[0]}';\n`, "");
12044
- }
12045
- static entry() {
12046
- return {
12047
- [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
12048
- };
12049
- }
12050
- apply(compiler) {
12051
- new compiler.rspack.experiments.VirtualModulesPlugin({
12052
- [VIRTUAL_ENTRY]: this.createEntry()
12053
- }).apply(compiler), compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
12054
- compilation.hooks.processAssets.tapPromise({
12055
- name: "RemoveVirtualEntryAsset",
12056
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
12057
- }, async ()=>{
12058
- try {
12059
- let chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
12060
- chunk?.files.forEach((f)=>{
12061
- compilation.deleteAsset(f);
12062
- });
12063
- } catch (_e) {
12064
- console.error("Failed to remove virtual entry file!");
12065
- }
12066
- });
12067
- });
12068
- }
12069
- }
12070
- let resolveOutputDir = (outputDir, shareName)=>shareName ? (0, external_node_path_namespaceObject.join)(outputDir, encodeName(shareName)) : outputDir;
12071
- class IndependentSharedPlugin {
12072
- mfName;
12073
- shared;
12074
- library;
12075
- sharedOptions;
12076
- outputDir;
12077
- plugins;
12078
- treeshake;
12079
- manifest;
12080
- buildAssets = {};
12081
- injectUsedExports;
12082
- name = "IndependentSharedPlugin";
12083
- constructor(options){
12084
- const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
12085
- this.shared = shared, this.mfName = name, this.outputDir = outputDir || "independent-packages", this.plugins = plugins || [], this.treeshake = treeshake, this.manifest = manifest, this.injectUsedExports = injectUsedExports ?? !0, this.library = library, this.sharedOptions = parseOptions(shared, (item, key)=>{
12086
- if ("string" != typeof item) throw Error(`Unexpected array in shared configuration for key "${key}"`);
12087
- return item !== key && isRequiredVersion(item) ? {
12088
- import: key,
12089
- requiredVersion: item
12090
- } : {
12091
- import: item
12092
- };
12093
- }, (item)=>item);
12094
- }
12095
- apply(compiler) {
12096
- let { manifest } = this, runCount = 0;
12097
- compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async ()=>{
12098
- !runCount && (await this.createIndependentCompilers(compiler), runCount++);
12099
- }), compiler.hooks.watchRun.tapPromise("IndependentSharedPlugin", async ()=>{
12100
- !runCount && (await this.createIndependentCompilers(compiler), runCount++);
12101
- }), compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
12102
- callback();
12103
- }), manifest && compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
12104
- compilation.hooks.processAssets.tapPromise({
12105
- name: "injectBuildAssets",
12106
- stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
12107
- }, async ()=>{
12108
- let { statsFileName, manifestFileName } = getFileName(manifest), injectBuildAssetsIntoStatsOrManifest = (filename)=>{
12109
- let stats = compilation.getAsset(filename);
12110
- if (!stats) return;
12111
- let statsContent = JSON.parse(stats.source.source().toString()), { shared } = statsContent;
12112
- Object.entries(this.buildAssets).forEach(([key, item])=>{
12113
- let targetShared = shared.find((s)=>s.name === key);
12114
- targetShared && item.forEach(([entry, version, globalName])=>{
12115
- version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
12116
- });
12117
- }), compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
12118
- };
12119
- injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
12120
- });
12121
- });
12122
- }
12123
- async createIndependentCompilers(parentCompiler) {
12124
- let { sharedOptions, buildAssets, outputDir } = this;
12125
- console.log("🚀 Start creating a standalone compiler...");
12126
- let shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
12127
- await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
12128
- if (!shareConfig.treeshake || !1 === shareConfig.import) return;
12129
- let shareRequests = shareRequestsMap[shareName].requests;
12130
- await Promise.all(shareRequests.map(async ([request, version])=>{
12131
- let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1], [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
12132
- shareRequestsMap,
12133
- currentShare: {
12134
- shareName,
12135
- version,
12136
- request,
12137
- independentShareFileName: sharedConfig?.treeshake?.filename
12138
- }
12139
- });
12140
- "string" == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
12141
- (0, external_node_path_namespaceObject.join)(resolveOutputDir(outputDir, shareName), shareFileName),
12142
- sharedVersion,
12143
- globalName
12144
- ]));
12145
- }));
12146
- })), console.log("✅ All independent packages have been compiled successfully");
12147
- }
12148
- async createIndependentCompiler(parentCompiler, extraOptions) {
12149
- let extraPlugin, { mfName, plugins, outputDir, sharedOptions, treeshake, library } = this, outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || ""), parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack;
12150
- extraPlugin = extraOptions ? new SharedContainerPlugin({
12151
- mfName,
12152
- library,
12153
- ...extraOptions.currentShare
12154
- }) : new CollectSharedEntryPlugin({
12155
- sharedOptions,
12156
- shareScope: "default"
12157
- }), (parentConfig.plugins || []).forEach((plugin)=>{
12158
- void 0 !== plugin && "string" != typeof plugin && ((plugin)=>{
12159
- if (!plugin) return !0;
12160
- let pluginName = plugin.name || plugin.constructor?.name;
12161
- return !pluginName || ![
12162
- "TreeShakeSharedPlugin",
12163
- "IndependentSharedPlugin",
12164
- "ModuleFederationPlugin",
12165
- "SharedUsedExportsOptimizerPlugin",
12166
- "HtmlWebpackPlugin"
12167
- ].includes(pluginName);
12168
- })(plugin) && finalPlugins.push(plugin);
12169
- }), plugins.forEach((plugin)=>{
12170
- finalPlugins.push(plugin);
12171
- }), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
12172
- consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
12173
- [key]: {
12174
- import: !extraOptions && options.import,
12175
- shareKey: options.shareKey || key,
12176
- shareScope: options.shareScope,
12177
- requiredVersion: options.requiredVersion,
12178
- strictVersion: options.strictVersion,
12179
- singleton: options.singleton,
12180
- packageName: options.packageName,
12181
- eager: options.eager
12182
- }
12183
- })),
12184
- enhanced: !0
12185
- })), treeshake && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
12186
- let fullOutputDir = (0, external_node_path_namespaceObject.resolve)(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
12187
- ...parentConfig,
12188
- mode: parentConfig.mode || "development",
12189
- entry: VirtualEntryPlugin.entry,
12190
- output: {
12191
- path: fullOutputDir,
12192
- clean: !0,
12193
- publicPath: parentConfig.output?.publicPath || "auto"
12194
- },
12195
- plugins: finalPlugins,
12196
- optimization: {
12197
- ...parentConfig.optimization,
12198
- splitChunks: !1
12199
- }
12200
- }, compiler = rspack.rspack(compilerConfig);
12201
- compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
12202
- let { currentShare } = extraOptions || {};
12203
- return new Promise((resolve, reject)=>{
12204
- compiler.run((err, stats)=>{
12205
- if (err || stats?.hasErrors()) {
12206
- let target = currentShare ? currentShare.shareName : "收集依赖";
12207
- console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n")), reject(err || Error(`${target} 编译失败`));
12208
- return;
12209
- }
12210
- currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`), stats && (currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`), console.log(stats.toString({
12211
- colors: !0,
12212
- chunks: !1,
12213
- modules: !1
12214
- }))), resolve(extraPlugin.getData());
12215
- });
12216
- });
12217
- }
12218
- }
12219
- class TreeShakeSharedPlugin {
12220
- mfConfig;
12221
- outputDir;
12222
- plugins;
12223
- reshake;
12224
- _independentSharePlugin;
12225
- name = "TreeShakeSharedPlugin";
12226
- constructor(options){
12227
- const { mfConfig, plugins, reshake } = options;
12228
- this.mfConfig = mfConfig, this.outputDir = mfConfig.independentShareDir || "independent-packages", this.plugins = plugins, this.reshake = !!reshake;
12229
- }
12230
- apply(compiler) {
12231
- let { mfConfig, outputDir, plugins, reshake } = this, { name, shared, library } = mfConfig;
12232
- if (!shared) return;
12233
- let sharedOptions = normalizeSharedOptions(shared);
12234
- sharedOptions.length && sharedOptions.some(([_, config])=>config.treeshake && !1 !== config.import) && (reshake || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler), this._independentSharePlugin = new IndependentSharedPlugin({
12235
- name: name,
12236
- shared: shared,
12237
- outputDir,
12238
- plugins,
12239
- treeshake: reshake,
12240
- library,
12241
- manifest: mfConfig.manifest
12242
- }), this._independentSharePlugin.apply(compiler));
12243
- }
12244
- get buildAssets() {
12245
- return this._independentSharePlugin?.buildAssets || {};
12246
- }
12247
- }
12248
- let ModuleFederationRuntimePlugin = base_create(binding_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
12249
- function getRemoteInfos(options) {
12250
- if (!options.remotes) return {};
12251
- let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
12252
- external: Array.isArray(item) ? item : [
12253
- item
12254
- ],
12255
- shareScope: options.shareScope || "default"
12256
- }), (item)=>({
12257
- external: Array.isArray(item.external) ? item.external : [
12258
- item.external
12259
- ],
12260
- shareScope: item.shareScope || options.shareScope || "default"
12261
- })), remoteInfos = {};
12262
- for (let [key, config] of remotes)for (let external of config.external){
12263
- let [externalType, externalRequest] = function(external) {
12264
- let result = function(external) {
12265
- if (/^[a-z0-9-]+ /.test(external)) {
12266
- let idx = external.indexOf(" ");
12267
- return [
12268
- external.slice(0, idx),
12269
- external.slice(idx + 1)
12270
- ];
12271
- }
12272
- return null;
12273
- }(external);
12274
- return null === result ? [
12275
- remoteType,
12276
- external
12277
- ] : result;
12278
- }(external);
12279
- if (remoteInfos[key] ??= [], "script" === externalType) {
12280
- let [url, global] = function(urlAndGlobal) {
12281
- let index = urlAndGlobal.indexOf("@");
12282
- return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
12283
- urlAndGlobal.substring(index + 1),
12284
- urlAndGlobal.substring(0, index)
12285
- ];
12286
- }(externalRequest);
12287
- remoteInfos[key].push({
12288
- alias: key,
12289
- name: global,
12290
- entry: url,
12291
- externalType,
12292
- shareScope: config.shareScope
12293
- });
12294
- } else remoteInfos[key].push({
12295
- alias: key,
12296
- name: void 0,
12297
- entry: void 0,
12298
- externalType,
12299
- shareScope: config.shareScope
12300
- });
12301
- }
12302
- return remoteInfos;
12303
- }
12304
11889
  class ContainerPlugin extends RspackBuiltinPlugin {
12305
11890
  name = binding_.BuiltinPluginName.ContainerPlugin;
12306
11891
  _options;
@@ -12309,7 +11894,7 @@ Help:
12309
11894
  name: options.name,
12310
11895
  shareScope: options.shareScope || "default",
12311
11896
  library: options.library || {
12312
- type: "global",
11897
+ type: "var",
12313
11898
  name: options.name
12314
11899
  },
12315
11900
  runtime: options.runtime,
@@ -12392,7 +11977,7 @@ Help:
12392
11977
  let _options = JSON.stringify(options || {});
12393
11978
  return binding_default().transform(source, _options);
12394
11979
  }
12395
- let exports_rspackVersion = "1.6.7-canary-e27a87e9-20251209100543", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
11980
+ let exports_rspackVersion = "1.6.8-canary-a3066402-20251209142350", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
12396
11981
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12397
11982
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12398
11983
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -12435,12 +12020,11 @@ Help:
12435
12020
  ContainerReferencePlugin: ContainerReferencePlugin,
12436
12021
  ModuleFederationPlugin: class {
12437
12022
  _options;
12438
- _treeShakeSharedPlugin;
12439
12023
  constructor(_options){
12440
12024
  this._options = _options;
12441
12025
  }
12442
12026
  apply(compiler) {
12443
- var options, options1;
12027
+ var options;
12444
12028
  let runtimeToolsPath, bundlerRuntimePath, runtimePath, { webpack } = compiler, paths = (runtimeToolsPath = (options = this._options).implementation ?? require.resolve("@module-federation/runtime-tools"), bundlerRuntimePath = require.resolve("@module-federation/webpack-bundler-runtime", {
12445
12029
  paths: [
12446
12030
  runtimeToolsPath
@@ -12454,54 +12038,101 @@ Help:
12454
12038
  bundlerRuntime: bundlerRuntimePath,
12455
12039
  runtime: runtimePath
12456
12040
  });
12457
- compiler.options.resolve.alias = {
12041
+ if (compiler.options.resolve.alias = {
12458
12042
  "@module-federation/runtime-tools": paths.runtimeTools,
12459
12043
  "@module-federation/runtime": paths.runtime,
12460
12044
  ...compiler.options.resolve.alias
12461
- }, ((options1 = this._options).shared ? parseOptions(options1.shared, (item, key)=>{
12462
- if ("string" != typeof item) throw Error("Unexpected array in shared");
12463
- return item !== key && isRequiredVersion(item) ? {
12464
- import: key,
12465
- requiredVersion: item
12466
- } : {
12467
- import: item
12468
- };
12469
- }, (item)=>item) : []).filter(([, config])=>config.treeshake).length > 0 && (this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
12470
- mfConfig: this._options,
12471
- reshake: !1
12472
- }), this._treeShakeSharedPlugin.apply(compiler));
12473
- let runtimePluginApplied = !1;
12474
- compiler.hooks.beforeRun.tapPromise({
12475
- name: "ModuleFederationPlugin",
12476
- stage: 100
12477
- }, async ()=>{
12478
- runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
12479
- entryRuntime: function(paths, options, compiler, treeshakeShareFallbacks) {
12480
- let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [], libraryType = options.library?.type || "var";
12481
- for(let i = 0; i < runtimePlugins.length; i++){
12482
- let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
12483
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
12484
- let paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
12485
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
12486
- }
12487
- let content = [
12488
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
12489
- ...runtimePluginImports,
12490
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
12491
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
12492
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
12493
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
12494
- `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
12495
- `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
12496
- compiler.webpack.Template.getFunctionContent(__webpack_require__("./moduleFederationDefaultRuntime.js"))
12497
- ].join(";");
12498
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
12499
- }(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {})
12500
- }).apply(compiler));
12501
- }), new webpack.container.ModuleFederationPluginV1({
12045
+ }, new ModuleFederationRuntimePlugin({
12046
+ entryRuntime: function(paths, options, compiler) {
12047
+ let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [];
12048
+ for(let i = 0; i < runtimePlugins.length; i++){
12049
+ let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
12050
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
12051
+ let paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
12052
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
12053
+ }
12054
+ let content = [
12055
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
12056
+ ...runtimePluginImports,
12057
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
12058
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
12059
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
12060
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
12061
+ compiler.webpack.Template.getFunctionContent(__webpack_require__("./moduleFederationDefaultRuntime.js"))
12062
+ ].join(";");
12063
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
12064
+ }(paths, this._options, compiler)
12065
+ }).apply(compiler), new webpack.container.ModuleFederationPluginV1({
12502
12066
  ...this._options,
12503
12067
  enhanced: !0
12504
- }).apply(compiler), this._options.manifest && new ModuleFederationManifestPlugin(this._options).apply(compiler);
12068
+ }).apply(compiler), this._options.manifest) {
12069
+ let manifestOptions = !0 === this._options.manifest ? {} : {
12070
+ ...this._options.manifest
12071
+ }, containerName = manifestOptions.name ?? this._options.name, globalName = manifestOptions.globalName ?? function(library) {
12072
+ if (!library) return;
12073
+ let libName = library.name;
12074
+ if (libName) {
12075
+ if ("string" == typeof libName) return libName;
12076
+ if (Array.isArray(libName)) return libName[0];
12077
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
12078
+ }
12079
+ }(this._options.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
12080
+ if (cur[1].length > 1) return sum;
12081
+ let { entry, alias, name } = cur[1][0];
12082
+ return entry && name && (sum[alias] = {
12083
+ name,
12084
+ entry
12085
+ }), sum;
12086
+ }, {}), manifestExposes = function(exposes) {
12087
+ if (!exposes) return;
12088
+ let result = parseOptions(exposes, (value, key)=>({
12089
+ import: Array.isArray(value) ? value : [
12090
+ value
12091
+ ],
12092
+ name: void 0
12093
+ }), (value)=>({
12094
+ import: Array.isArray(value.import) ? value.import : [
12095
+ value.import
12096
+ ],
12097
+ name: value.name ?? void 0
12098
+ })).map(([exposeKey, info])=>{
12099
+ let exposeName = info.name ?? exposeKey.replace(/^\.\//, "");
12100
+ return {
12101
+ path: exposeKey,
12102
+ name: exposeName
12103
+ };
12104
+ });
12105
+ return result.length > 0 ? result : void 0;
12106
+ }(this._options.exposes);
12107
+ void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes);
12108
+ let manifestShared = function(shared) {
12109
+ if (!shared) return;
12110
+ let result = parseOptions(shared, (item, key)=>{
12111
+ if ("string" != typeof item) throw Error("Unexpected array in shared");
12112
+ return item !== key && isRequiredVersion(item) ? {
12113
+ import: key,
12114
+ requiredVersion: item
12115
+ } : {
12116
+ import: item
12117
+ };
12118
+ }, (item)=>item).map(([key, config])=>{
12119
+ let name = config.shareKey || key, version = "string" == typeof config.version ? config.version : void 0;
12120
+ return {
12121
+ name,
12122
+ version,
12123
+ requiredVersion: "string" == typeof config.requiredVersion ? config.requiredVersion : void 0,
12124
+ singleton: config.singleton
12125
+ };
12126
+ });
12127
+ return result.length > 0 ? result : void 0;
12128
+ }(this._options.shared);
12129
+ void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), new ModuleFederationManifestPlugin({
12130
+ ...manifestOptions,
12131
+ name: containerName,
12132
+ globalName,
12133
+ remoteAliasMap
12134
+ }).apply(compiler);
12135
+ }
12505
12136
  }
12506
12137
  },
12507
12138
  ModuleFederationPluginV1: class {
@@ -12538,7 +12169,6 @@ Help:
12538
12169
  }
12539
12170
  }, sharing = {
12540
12171
  ProvideSharedPlugin: ProvideSharedPlugin,
12541
- TreeShakeSharedPlugin: TreeShakeSharedPlugin,
12542
12172
  ConsumeSharedPlugin: ConsumeSharedPlugin,
12543
12173
  SharePlugin: SharePlugin
12544
12174
  }, exports_experiments = {