@rspack-canary/browser 1.6.5-canary-5c09e49d-20251121173820 → 1.6.5-canary-a407d226-20251124112255

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.mjs CHANGED
@@ -58141,7 +58141,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58141
58141
  if ("object" == typeof rspackFuture) {
58142
58142
  D(rspackFuture, "bundlerInfo", {});
58143
58143
  if ("object" == typeof rspackFuture.bundlerInfo) {
58144
- D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-5c09e49d-20251121173820");
58144
+ D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-a407d226-20251124112255");
58145
58145
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58146
58146
  D(rspackFuture.bundlerInfo, "force", !library);
58147
58147
  }
@@ -62090,7 +62090,7 @@ class MultiStats {
62090
62090
  return obj;
62091
62091
  });
62092
62092
  if (childOptions.version) {
62093
- obj.rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
62093
+ obj.rspackVersion = "1.6.5-canary-a407d226-20251124112255";
62094
62094
  obj.version = "5.75.0";
62095
62095
  }
62096
62096
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63395,7 +63395,7 @@ const SIMPLE_EXTRACTORS = {
63395
63395
  },
63396
63396
  version: (object)=>{
63397
63397
  object.version = "5.75.0";
63398
- object.rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
63398
+ object.rspackVersion = "1.6.5-canary-a407d226-20251124112255";
63399
63399
  },
63400
63400
  env: (object, _compilation, _context, { _env })=>{
63401
63401
  object.env = _env;
@@ -65828,6 +65828,34 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65828
65828
  function isRequiredVersion(str) {
65829
65829
  return VERSION_PATTERN_REGEXP.test(str);
65830
65830
  }
65831
+ const encodeName = function(name, prefix = "", withExt = false) {
65832
+ const ext = withExt ? ".js" : "";
65833
+ return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
65834
+ };
65835
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65836
+ const array = (items)=>{
65837
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
65838
+ else if (item && "object" == typeof item) object(item);
65839
+ else throw new Error("Unexpected options format");
65840
+ };
65841
+ const object = (obj)=>{
65842
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65843
+ };
65844
+ if (!options) return;
65845
+ if (Array.isArray(options)) array(options);
65846
+ else if ("object" == typeof options) object(options);
65847
+ else throw new Error("Unexpected options format");
65848
+ };
65849
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65850
+ const items = [];
65851
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65852
+ items.push([
65853
+ key,
65854
+ value
65855
+ ]);
65856
+ });
65857
+ return items;
65858
+ };
65831
65859
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
65832
65860
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
65833
65861
  if (key in obj) Object.defineProperty(obj, key, {
@@ -65894,118 +65922,17 @@ function getFileName(manifestOptions) {
65894
65922
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
65895
65923
  };
65896
65924
  }
65897
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65898
- raw(compiler) {
65899
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
65900
- const { statsFileName, manifestFileName } = getFileName(this.opts);
65901
- const rawOptions = {
65902
- name: this.opts.name,
65903
- globalName: this.opts.globalName,
65904
- fileName,
65905
- filePath,
65906
- manifestFileName,
65907
- statsFileName,
65908
- disableAssetsAnalyze,
65909
- remoteAliasMap,
65910
- exposes,
65911
- shared,
65912
- buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
65913
- };
65914
- return createBuiltinPlugin(this.name, rawOptions);
65915
- }
65916
- constructor(opts){
65917
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
65918
- this.opts = opts;
65919
- }
65920
- }
65921
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65922
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65923
- const array = (items)=>{
65924
- for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
65925
- else if (item && "object" == typeof item) object(item);
65926
- else throw new Error("Unexpected options format");
65927
- };
65928
- const object = (obj)=>{
65929
- for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65930
- };
65931
- if (!options) return;
65932
- if (Array.isArray(options)) array(options);
65933
- else if ("object" == typeof options) object(options);
65934
- else throw new Error("Unexpected options format");
65935
- };
65936
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65937
- const items = [];
65938
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65939
- items.push([
65940
- key,
65941
- value
65942
- ]);
65943
- });
65944
- return items;
65945
- };
65946
- function ModuleFederationPlugin_define_property(obj, key, value) {
65947
- if (key in obj) Object.defineProperty(obj, key, {
65948
- value: value,
65949
- enumerable: true,
65950
- configurable: true,
65951
- writable: true
65952
- });
65953
- else obj[key] = value;
65954
- return obj;
65955
- }
65956
- class ModuleFederationPlugin {
65957
- apply(compiler) {
65958
- const { webpack } = compiler;
65959
- const paths = getPaths(this._options);
65960
- compiler.options.resolve.alias = {
65961
- "@module-federation/runtime-tools": paths.runtimeTools,
65962
- "@module-federation/runtime": paths.runtime,
65963
- ...compiler.options.resolve.alias
65964
- };
65965
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
65966
- new ModuleFederationRuntimePlugin({
65967
- entryRuntime
65968
- }).apply(compiler);
65969
- new webpack.container.ModuleFederationPluginV1({
65970
- ...this._options,
65971
- enhanced: true
65972
- }).apply(compiler);
65973
- if (this._options.manifest) {
65974
- const manifestOptions = true === this._options.manifest ? {} : {
65975
- ...this._options.manifest
65976
- };
65977
- const containerName = manifestOptions.name ?? this._options.name;
65978
- const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
65979
- const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
65980
- if (cur[1].length > 1) return sum;
65981
- const remoteInfo = cur[1][0];
65982
- const { entry, alias, name } = remoteInfo;
65983
- if (entry && name) sum[alias] = {
65984
- name,
65985
- entry
65986
- };
65987
- return sum;
65988
- }, {});
65989
- const manifestExposes = collectManifestExposes(this._options.exposes);
65990
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65991
- const manifestShared = collectManifestShared(this._options.shared);
65992
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65993
- new ModuleFederationManifestPlugin({
65994
- ...manifestOptions,
65995
- name: containerName,
65996
- globalName,
65997
- remoteAliasMap
65998
- }).apply(compiler);
65999
- }
66000
- }
66001
- constructor(_options){
66002
- ModuleFederationPlugin_define_property(this, "_options", void 0);
66003
- this._options = _options;
66004
- }
65925
+ function resolveLibraryGlobalName(library) {
65926
+ if (!library) return;
65927
+ const libName = library.name;
65928
+ if (!libName) return;
65929
+ if ("string" == typeof libName) return libName;
65930
+ if (Array.isArray(libName)) return libName[0];
65931
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66005
65932
  }
66006
65933
  function collectManifestExposes(exposes) {
66007
65934
  if (!exposes) return;
66008
- const parsed = parseOptions(exposes, (value, key)=>({
65935
+ const parsed = parseOptions(exposes, (value)=>({
66009
65936
  import: Array.isArray(value) ? value : [
66010
65937
  value
66011
65938
  ],
@@ -66049,111 +65976,56 @@ function collectManifestShared(shared) {
66049
65976
  });
66050
65977
  return result.length > 0 ? result : void 0;
66051
65978
  }
66052
- function resolveLibraryGlobalName(library) {
66053
- if (!library) return;
66054
- const libName = library.name;
66055
- if (!libName) return;
66056
- if ("string" == typeof libName) return libName;
66057
- if (Array.isArray(libName)) return libName[0];
66058
- if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66059
- }
66060
- function getRemoteInfos(options) {
66061
- if (!options.remotes) return {};
66062
- function extractUrlAndGlobal(urlAndGlobal) {
66063
- const index = urlAndGlobal.indexOf("@");
66064
- if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66065
- return [
66066
- urlAndGlobal.substring(index + 1),
66067
- urlAndGlobal.substring(0, index)
66068
- ];
66069
- }
66070
- function getExternalTypeFromExternal(external) {
66071
- if (/^[a-z0-9-]+ /.test(external)) {
66072
- const idx = external.indexOf(" ");
66073
- return [
66074
- external.slice(0, idx),
66075
- external.slice(idx + 1)
66076
- ];
66077
- }
66078
- return null;
66079
- }
66080
- function getExternal(external) {
66081
- const result = getExternalTypeFromExternal(external);
66082
- if (null === result) return [
66083
- remoteType,
66084
- external
66085
- ];
66086
- return result;
66087
- }
66088
- const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66089
- const remotes = parseOptions(options.remotes, (item)=>({
66090
- external: Array.isArray(item) ? item : [
66091
- item
66092
- ],
66093
- shareScope: options.shareScope || "default"
66094
- }), (item)=>({
66095
- external: Array.isArray(item.external) ? item.external : [
66096
- item.external
66097
- ],
66098
- shareScope: item.shareScope || options.shareScope || "default"
66099
- }));
66100
- const remoteInfos = {};
66101
- for (const [key, config] of remotes)for (const external of config.external){
66102
- const [externalType, externalRequest] = getExternal(external);
66103
- remoteInfos[key] ??= [];
66104
- if ("script" === externalType) {
66105
- const [url, global] = extractUrlAndGlobal(externalRequest);
66106
- remoteInfos[key].push({
66107
- alias: key,
66108
- name: global,
66109
- entry: url,
66110
- externalType,
66111
- shareScope: config.shareScope
66112
- });
66113
- } else remoteInfos[key].push({
66114
- alias: key,
66115
- name: void 0,
66116
- entry: void 0,
66117
- externalType,
66118
- shareScope: config.shareScope
66119
- });
66120
- }
66121
- return remoteInfos;
66122
- }
66123
- function getRuntimePlugins(options) {
66124
- return options.runtimePlugins ?? [];
66125
- }
66126
- function getPaths(options) {
65979
+ function normalizeManifestOptions(mfConfig) {
65980
+ const manifestOptions = true === mfConfig.manifest ? {} : {
65981
+ ...mfConfig.manifest
65982
+ };
65983
+ const containerName = mfConfig.name;
65984
+ const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
65985
+ const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
65986
+ if (cur[1].length > 1) return sum;
65987
+ const remoteInfo = cur[1][0];
65988
+ const { entry, alias, name } = remoteInfo;
65989
+ if (entry && name) sum[alias] = {
65990
+ name,
65991
+ entry
65992
+ };
65993
+ return sum;
65994
+ }, {});
65995
+ const manifestExposes = collectManifestExposes(mfConfig.exposes);
65996
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65997
+ const manifestShared = collectManifestShared(mfConfig.shared);
65998
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66127
65999
  return {
66128
- runtimeTools: "@module-federation/runtime-tools",
66129
- bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66130
- runtime: "@module-federation/runtime"
66000
+ ...manifestOptions,
66001
+ remoteAliasMap,
66002
+ globalName,
66003
+ name: containerName
66131
66004
  };
66132
66005
  }
66133
- function getDefaultEntryRuntime(paths, options, compiler) {
66134
- const runtimePlugins = getRuntimePlugins(options);
66135
- const remoteInfos = getRemoteInfos(options);
66136
- const runtimePluginImports = [];
66137
- const runtimePluginVars = [];
66138
- for(let i = 0; i < runtimePlugins.length; i++){
66139
- const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66140
- const pluginSpec = runtimePlugins[i];
66141
- const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66142
- const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66143
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66144
- const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66145
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66006
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66007
+ raw(compiler) {
66008
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66009
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66010
+ const rawOptions = {
66011
+ name: this.opts.name,
66012
+ globalName: this.opts.globalName,
66013
+ fileName,
66014
+ filePath,
66015
+ manifestFileName,
66016
+ statsFileName,
66017
+ disableAssetsAnalyze,
66018
+ remoteAliasMap,
66019
+ exposes,
66020
+ shared,
66021
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66022
+ };
66023
+ return createBuiltinPlugin(this.name, rawOptions);
66024
+ }
66025
+ constructor(opts){
66026
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66027
+ this.opts = normalizeManifestOptions(opts);
66146
66028
  }
66147
- const content = [
66148
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66149
- ...runtimePluginImports,
66150
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66151
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66152
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66153
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66154
- 'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
66155
- ].join(";");
66156
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66157
66029
  }
66158
66030
  function ShareRuntimePlugin_define_property(obj, key, value) {
66159
66031
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66192,6 +66064,40 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66192
66064
  else obj[key] = value;
66193
66065
  return obj;
66194
66066
  }
66067
+ function normalizeConsumeShareOptions(consumes, shareScope) {
66068
+ return parseOptions(consumes, (item, key)=>{
66069
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66070
+ const result = item !== key && isRequiredVersion(item) ? {
66071
+ import: key,
66072
+ shareScope: shareScope || "default",
66073
+ shareKey: key,
66074
+ requiredVersion: item,
66075
+ strictVersion: true,
66076
+ packageName: void 0,
66077
+ singleton: false,
66078
+ eager: false
66079
+ } : {
66080
+ import: key,
66081
+ shareScope: shareScope || "default",
66082
+ shareKey: key,
66083
+ requiredVersion: void 0,
66084
+ packageName: void 0,
66085
+ strictVersion: false,
66086
+ singleton: false,
66087
+ eager: false
66088
+ };
66089
+ return result;
66090
+ }, (item, key)=>({
66091
+ import: false === item.import ? void 0 : item.import || key,
66092
+ shareScope: item.shareScope || shareScope || "default",
66093
+ shareKey: item.shareKey || key,
66094
+ requiredVersion: item.requiredVersion,
66095
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66096
+ packageName: item.packageName,
66097
+ singleton: !!item.singleton,
66098
+ eager: !!item.eager
66099
+ }));
66100
+ }
66195
66101
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66196
66102
  raw(compiler) {
66197
66103
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66207,38 +66113,7 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66207
66113
  constructor(options){
66208
66114
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66209
66115
  this._options = {
66210
- consumes: parseOptions(options.consumes, (item, key)=>{
66211
- if (Array.isArray(item)) throw new Error("Unexpected array in options");
66212
- const result = item !== key && isRequiredVersion(item) ? {
66213
- import: key,
66214
- shareScope: options.shareScope || "default",
66215
- shareKey: key,
66216
- requiredVersion: item,
66217
- strictVersion: true,
66218
- packageName: void 0,
66219
- singleton: false,
66220
- eager: false
66221
- } : {
66222
- import: key,
66223
- shareScope: options.shareScope || "default",
66224
- shareKey: key,
66225
- requiredVersion: void 0,
66226
- packageName: void 0,
66227
- strictVersion: false,
66228
- singleton: false,
66229
- eager: false
66230
- };
66231
- return result;
66232
- }, (item, key)=>({
66233
- import: false === item.import ? void 0 : item.import || key,
66234
- shareScope: item.shareScope || options.shareScope || "default",
66235
- shareKey: item.shareKey || key,
66236
- requiredVersion: item.requiredVersion,
66237
- strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66238
- packageName: item.packageName,
66239
- singleton: !!item.singleton,
66240
- eager: !!item.eager
66241
- })),
66116
+ consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66242
66117
  enhanced: options.enhanced ?? false
66243
66118
  };
66244
66119
  }
@@ -66253,43 +66128,46 @@ function ProvideSharedPlugin_define_property(obj, key, value) {
66253
66128
  else obj[key] = value;
66254
66129
  return obj;
66255
66130
  }
66256
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66257
- raw(compiler) {
66258
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66259
- const rawOptions = this._provides.map(([key, v])=>({
66260
- key,
66261
- ...v
66262
- }));
66131
+ function normalizeProvideShareOptions(options, shareScope, enhanced) {
66132
+ return parseOptions(options, (item)=>{
66133
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66134
+ return {
66135
+ shareKey: item,
66136
+ version: void 0,
66137
+ shareScope: shareScope || "default",
66138
+ eager: false
66139
+ };
66140
+ }, (item)=>{
66141
+ const raw = {
66142
+ shareKey: item.shareKey,
66143
+ version: item.version,
66144
+ shareScope: item.shareScope || shareScope || "default",
66145
+ eager: !!item.eager
66146
+ };
66147
+ if (enhanced) {
66148
+ const enhancedItem = item;
66149
+ return {
66150
+ ...raw,
66151
+ singleton: enhancedItem.singleton,
66152
+ requiredVersion: enhancedItem.requiredVersion,
66153
+ strictVersion: enhancedItem.strictVersion
66154
+ };
66155
+ }
66156
+ return raw;
66157
+ });
66158
+ }
66159
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66160
+ raw(compiler) {
66161
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66162
+ const rawOptions = this._provides.map(([key, v])=>({
66163
+ key,
66164
+ ...v
66165
+ }));
66263
66166
  return createBuiltinPlugin(this.name, rawOptions);
66264
66167
  }
66265
66168
  constructor(options){
66266
66169
  super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
66267
- this._provides = parseOptions(options.provides, (item)=>{
66268
- if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66269
- return {
66270
- shareKey: item,
66271
- version: void 0,
66272
- shareScope: options.shareScope || "default",
66273
- eager: false
66274
- };
66275
- }, (item)=>{
66276
- const raw = {
66277
- shareKey: item.shareKey,
66278
- version: item.version,
66279
- shareScope: item.shareScope || options.shareScope || "default",
66280
- eager: !!item.eager
66281
- };
66282
- if (options.enhanced) {
66283
- const enhancedItem = item;
66284
- return {
66285
- ...raw,
66286
- singleton: enhancedItem.singleton,
66287
- requiredVersion: enhancedItem.requiredVersion,
66288
- strictVersion: enhancedItem.strictVersion
66289
- };
66290
- }
66291
- return raw;
66292
- });
66170
+ this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66293
66171
  this._enhanced = options.enhanced;
66294
66172
  }
66295
66173
  }
@@ -66303,6 +66181,45 @@ function SharePlugin_define_property(obj, key, value) {
66303
66181
  else obj[key] = value;
66304
66182
  return obj;
66305
66183
  }
66184
+ function normalizeSharedOptions(shared) {
66185
+ return parseOptions(shared, (item, key)=>{
66186
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66187
+ const config = item !== key && isRequiredVersion(item) ? {
66188
+ import: key,
66189
+ requiredVersion: item
66190
+ } : {
66191
+ import: item
66192
+ };
66193
+ return config;
66194
+ }, (item)=>item);
66195
+ }
66196
+ function createProvideShareOptions(normalizedSharedOptions) {
66197
+ return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66198
+ [options.import || key]: {
66199
+ shareKey: options.shareKey || key,
66200
+ shareScope: options.shareScope,
66201
+ version: options.version,
66202
+ eager: options.eager,
66203
+ singleton: options.singleton,
66204
+ requiredVersion: options.requiredVersion,
66205
+ strictVersion: options.strictVersion
66206
+ }
66207
+ }));
66208
+ }
66209
+ function createConsumeShareOptions(normalizedSharedOptions) {
66210
+ return normalizedSharedOptions.map(([key, options])=>({
66211
+ [key]: {
66212
+ import: options.import,
66213
+ shareKey: options.shareKey || key,
66214
+ shareScope: options.shareScope,
66215
+ requiredVersion: options.requiredVersion,
66216
+ strictVersion: options.strictVersion,
66217
+ singleton: options.singleton,
66218
+ packageName: options.packageName,
66219
+ eager: options.eager
66220
+ }
66221
+ }));
66222
+ }
66306
66223
  class SharePlugin {
66307
66224
  apply(compiler) {
66308
66225
  new ConsumeSharedPlugin({
@@ -66321,8 +66238,416 @@ class SharePlugin {
66321
66238
  SharePlugin_define_property(this, "_consumes", void 0);
66322
66239
  SharePlugin_define_property(this, "_provides", void 0);
66323
66240
  SharePlugin_define_property(this, "_enhanced", void 0);
66324
- const sharedOptions = parseOptions(options.shared, (item, key)=>{
66325
- if ("string" != typeof item) throw new Error("Unexpected array in shared");
66241
+ SharePlugin_define_property(this, "_sharedOptions", void 0);
66242
+ const sharedOptions = normalizeSharedOptions(options.shared);
66243
+ const consumes = createConsumeShareOptions(sharedOptions);
66244
+ const provides = createProvideShareOptions(sharedOptions);
66245
+ this._shareScope = options.shareScope;
66246
+ this._consumes = consumes;
66247
+ this._provides = provides;
66248
+ this._enhanced = options.enhanced ?? false;
66249
+ this._sharedOptions = sharedOptions;
66250
+ }
66251
+ }
66252
+ function CollectSharedEntryPlugin_define_property(obj, key, value) {
66253
+ if (key in obj) Object.defineProperty(obj, key, {
66254
+ value: value,
66255
+ enumerable: true,
66256
+ configurable: true,
66257
+ writable: true
66258
+ });
66259
+ else obj[key] = value;
66260
+ return obj;
66261
+ }
66262
+ const SHARE_ENTRY_ASSET = "collect-shared-entries.json";
66263
+ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66264
+ getData() {
66265
+ return this._collectedEntries;
66266
+ }
66267
+ getFilename() {
66268
+ return SHARE_ENTRY_ASSET;
66269
+ }
66270
+ apply(compiler) {
66271
+ super.apply(compiler);
66272
+ compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
66273
+ compilation.hooks.processAssets.tapPromise({
66274
+ name: "CollectSharedEntry",
66275
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66276
+ }, async ()=>{
66277
+ const filename = this.getFilename();
66278
+ const asset = compilation.getAsset(filename);
66279
+ if (!asset) throw new Error(`Can not get ${filename}`);
66280
+ this._collectedEntries = JSON.parse(asset.source.source().toString());
66281
+ compilation.deleteAsset(filename);
66282
+ });
66283
+ });
66284
+ }
66285
+ raw() {
66286
+ const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66287
+ const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66288
+ const rawOptions = {
66289
+ consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66290
+ key,
66291
+ ...v
66292
+ })),
66293
+ filename: this.getFilename()
66294
+ };
66295
+ return createBuiltinPlugin(this.name, rawOptions);
66296
+ }
66297
+ constructor(options){
66298
+ super(), CollectSharedEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectSharedEntryPlugin), CollectSharedEntryPlugin_define_property(this, "sharedOptions", void 0), CollectSharedEntryPlugin_define_property(this, "_collectedEntries", void 0);
66299
+ const { sharedOptions } = options;
66300
+ this.sharedOptions = sharedOptions;
66301
+ this._collectedEntries = {};
66302
+ }
66303
+ }
66304
+ function ShareContainerPlugin_define_property(obj, key, value) {
66305
+ if (key in obj) Object.defineProperty(obj, key, {
66306
+ value: value,
66307
+ enumerable: true,
66308
+ configurable: true,
66309
+ writable: true
66310
+ });
66311
+ else obj[key] = value;
66312
+ return obj;
66313
+ }
66314
+ function assert(condition, msg) {
66315
+ if (!condition) throw new Error(msg);
66316
+ }
66317
+ const HOT_UPDATE_SUFFIX = ".hot-update";
66318
+ class ShareContainerPlugin extends RspackBuiltinPlugin {
66319
+ getData() {
66320
+ return [
66321
+ this.name,
66322
+ this._globalName
66323
+ ];
66324
+ }
66325
+ raw(compiler) {
66326
+ const { library } = this._options;
66327
+ if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66328
+ return createBuiltinPlugin(this.name, this._options);
66329
+ }
66330
+ apply(compiler) {
66331
+ super.apply(compiler);
66332
+ const shareName = this._shareName;
66333
+ compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66334
+ compilation.hooks.processAssets.tapPromise({
66335
+ name: "getShareContainerFile"
66336
+ }, async ()=>{
66337
+ const remoteEntryPoint = compilation.entrypoints.get(shareName);
66338
+ assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66339
+ const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66340
+ assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66341
+ const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
66342
+ assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66343
+ assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
66344
+ this.filename = files[0];
66345
+ });
66346
+ });
66347
+ }
66348
+ constructor(options){
66349
+ super(), ShareContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ShareContainerPlugin), ShareContainerPlugin_define_property(this, "filename", ""), ShareContainerPlugin_define_property(this, "_options", void 0), ShareContainerPlugin_define_property(this, "_shareName", void 0), ShareContainerPlugin_define_property(this, "_globalName", void 0);
66350
+ const { shareName, library, request, independentShareFileName } = options;
66351
+ const version = options.version || "0.0.0";
66352
+ this._globalName = encodeName(`${options.mfName}_${shareName}_${version}`);
66353
+ const fileName = independentShareFileName || `${version}/share-entry.js`;
66354
+ this._shareName = shareName;
66355
+ this._options = {
66356
+ name: shareName,
66357
+ request: request,
66358
+ library: (library ? {
66359
+ ...library,
66360
+ name: this._globalName
66361
+ } : void 0) || {
66362
+ type: "var",
66363
+ name: this._globalName
66364
+ },
66365
+ version,
66366
+ fileName
66367
+ };
66368
+ }
66369
+ }
66370
+ function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66371
+ if (key in obj) Object.defineProperty(obj, key, {
66372
+ value: value,
66373
+ enumerable: true,
66374
+ configurable: true,
66375
+ writable: true
66376
+ });
66377
+ else obj[key] = value;
66378
+ return obj;
66379
+ }
66380
+ class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66381
+ buildOptions() {
66382
+ const shared = this.sharedOptions.map(([shareKey, config])=>({
66383
+ shareKey,
66384
+ treeshake: !!config.treeshake,
66385
+ usedExports: config.usedExports
66386
+ }));
66387
+ const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66388
+ return {
66389
+ shared,
66390
+ injectUsedExports: this.injectUsedExports,
66391
+ manifestFileName,
66392
+ statsFileName
66393
+ };
66394
+ }
66395
+ raw() {
66396
+ if (!this.sharedOptions.length) return;
66397
+ return createBuiltinPlugin(this.name, this.buildOptions());
66398
+ }
66399
+ constructor(sharedOptions, injectUsedExports, manifestOptions){
66400
+ super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
66401
+ this.sharedOptions = sharedOptions;
66402
+ this.injectUsedExports = injectUsedExports ?? true;
66403
+ this.manifestOptions = manifestOptions ?? {};
66404
+ }
66405
+ }
66406
+ function IndependentSharedPlugin_define_property(obj, key, value) {
66407
+ if (key in obj) Object.defineProperty(obj, key, {
66408
+ value: value,
66409
+ enumerable: true,
66410
+ configurable: true,
66411
+ writable: true
66412
+ });
66413
+ else obj[key] = value;
66414
+ return obj;
66415
+ }
66416
+ const VIRTUAL_ENTRY = "./virtual-entry.js";
66417
+ const VIRTUAL_ENTRY_NAME = "virtual-entry";
66418
+ const filterPlugin = (plugin)=>{
66419
+ if (!plugin) return true;
66420
+ const pluginName = plugin.name || plugin.constructor?.name;
66421
+ if (!pluginName) return true;
66422
+ return ![
66423
+ "TreeShakeSharedPlugin",
66424
+ "IndependentSharedPlugin",
66425
+ "ModuleFederationPlugin",
66426
+ "SharedUsedExportsOptimizerPlugin",
66427
+ "HtmlWebpackPlugin"
66428
+ ].includes(pluginName);
66429
+ };
66430
+ class VirtualEntryPlugin {
66431
+ createEntry() {
66432
+ const { sharedOptions } = this;
66433
+ const entryContent = sharedOptions.reduce((acc, cur, index)=>`${acc}import shared_${index} from '${cur[0]}';\n`, "");
66434
+ return entryContent;
66435
+ }
66436
+ static entry() {
66437
+ return {
66438
+ [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66439
+ };
66440
+ }
66441
+ apply(compiler) {
66442
+ new compiler.rspack.experiments.VirtualModulesPlugin({
66443
+ [VIRTUAL_ENTRY]: this.createEntry()
66444
+ }).apply(compiler);
66445
+ compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
66446
+ compilation.hooks.processAssets.tapPromise({
66447
+ name: "RemoveVirtualEntryAsset",
66448
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66449
+ }, async ()=>{
66450
+ try {
66451
+ const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66452
+ chunk?.files.forEach((f)=>{
66453
+ compilation.deleteAsset(f);
66454
+ });
66455
+ } catch (_e) {
66456
+ console.error("Failed to remove virtual entry file!");
66457
+ }
66458
+ });
66459
+ });
66460
+ }
66461
+ constructor(sharedOptions){
66462
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66463
+ this.sharedOptions = sharedOptions;
66464
+ }
66465
+ }
66466
+ class IndependentSharedPlugin {
66467
+ apply(compiler) {
66468
+ compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async (compiler)=>{
66469
+ await this.createIndependentCompilers(compiler);
66470
+ });
66471
+ compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
66472
+ this.cleanup();
66473
+ callback();
66474
+ });
66475
+ compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
66476
+ compilation.hooks.processAssets.tapPromise({
66477
+ name: "injectBuildAssets",
66478
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66479
+ }, async ()=>{
66480
+ if (!this.manifest) return;
66481
+ const { statsFileName, manifestFileName } = getFileName(this.manifest);
66482
+ const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66483
+ const stats = compilation.getAsset(filename);
66484
+ if (!stats) return;
66485
+ const statsContent = JSON.parse(stats.source.source().toString());
66486
+ const { shared } = statsContent;
66487
+ Object.entries(this.buildAssets).forEach(([key, item])=>{
66488
+ const targetShared = shared.find((s)=>s.name === key);
66489
+ if (!targetShared) return;
66490
+ item.forEach(([entry, version, globalName])=>{
66491
+ if (version === targetShared.version) {
66492
+ targetShared.fallback = entry;
66493
+ targetShared.fallbackName = globalName;
66494
+ }
66495
+ });
66496
+ });
66497
+ compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66498
+ };
66499
+ injectBuildAssetsIntoStatsOrManifest(statsFileName);
66500
+ injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66501
+ });
66502
+ });
66503
+ }
66504
+ async createIndependentCompilers(parentCompiler) {
66505
+ const { sharedOptions, buildAssets } = this;
66506
+ console.log("🚀 Start creating a standalone compiler...");
66507
+ const parentOutputDir = parentCompiler.options.output.path ? (0, path_browserify.basename)(parentCompiler.options.output.path) : "";
66508
+ const shareRequestsMap = await this.createIndependentCompiler(parentCompiler, parentOutputDir);
66509
+ await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66510
+ if (!shareConfig.treeshake || false === shareConfig.import) return;
66511
+ const shareRequests = shareRequestsMap[shareName].requests;
66512
+ await Promise.all(shareRequests.map(async ([request, version])=>{
66513
+ const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66514
+ const [shareFileName, globalName] = await this.createIndependentCompiler(parentCompiler, parentOutputDir, {
66515
+ shareRequestsMap,
66516
+ currentShare: {
66517
+ shareName,
66518
+ version,
66519
+ request,
66520
+ independentShareFileName: sharedConfig?.independentShareFileName
66521
+ }
66522
+ });
66523
+ if ("string" == typeof shareFileName) {
66524
+ buildAssets[shareName] ||= [];
66525
+ buildAssets[shareName].push([
66526
+ shareFileName,
66527
+ version,
66528
+ globalName
66529
+ ]);
66530
+ }
66531
+ }));
66532
+ }));
66533
+ console.log("✅ All independent packages have been compiled successfully");
66534
+ }
66535
+ async createIndependentCompiler(parentCompiler, parentOutputDir, extraOptions) {
66536
+ const { mfName, plugins, outputDir, outputFilePath, sharedOptions, treeshake, library } = this;
66537
+ const outputDirWithShareName = outputFilePath || (0, path_browserify.join)(outputDir, encodeName(extraOptions?.currentShare?.shareName || ""));
66538
+ const parentConfig = parentCompiler.options;
66539
+ const finalPlugins = [];
66540
+ const rspack = parentCompiler.rspack;
66541
+ let extraPlugin;
66542
+ extraPlugin = extraOptions ? new ShareContainerPlugin({
66543
+ mfName,
66544
+ library,
66545
+ ...extraOptions.currentShare
66546
+ }) : new CollectSharedEntryPlugin({
66547
+ sharedOptions,
66548
+ shareScope: "default"
66549
+ });
66550
+ (parentConfig.plugins || []).forEach((plugin)=>{
66551
+ if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin)) finalPlugins.push(plugin);
66552
+ });
66553
+ plugins.forEach((plugin)=>{
66554
+ finalPlugins.push(plugin);
66555
+ });
66556
+ finalPlugins.push(extraPlugin);
66557
+ finalPlugins.push(new ConsumeSharedPlugin({
66558
+ consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66559
+ [key]: {
66560
+ import: extraOptions ? false : options.import,
66561
+ shareKey: options.shareKey || key,
66562
+ shareScope: options.shareScope,
66563
+ requiredVersion: options.requiredVersion,
66564
+ strictVersion: options.strictVersion,
66565
+ singleton: options.singleton,
66566
+ packageName: options.packageName,
66567
+ eager: options.eager
66568
+ }
66569
+ })),
66570
+ enhanced: true
66571
+ }));
66572
+ if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
66573
+ finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
66574
+ const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66575
+ const compilerConfig = {
66576
+ ...parentConfig,
66577
+ mode: parentConfig.mode || "development",
66578
+ entry: VirtualEntryPlugin.entry,
66579
+ output: {
66580
+ path: fullOutputDir,
66581
+ clean: true,
66582
+ publicPath: parentConfig.output?.publicPath || "auto"
66583
+ },
66584
+ plugins: finalPlugins,
66585
+ optimization: {
66586
+ ...parentConfig.optimization,
66587
+ splitChunks: false
66588
+ }
66589
+ };
66590
+ const compiler = rspack.rspack(compilerConfig);
66591
+ compiler.inputFileSystem = parentCompiler.inputFileSystem;
66592
+ compiler.outputFileSystem = parentCompiler.outputFileSystem;
66593
+ compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66594
+ const { currentShare } = extraOptions || {};
66595
+ currentShare && this.compilers.set(`${currentShare.shareName}@${currentShare.version}`, compiler);
66596
+ return new Promise((resolve, reject)=>{
66597
+ compiler.run((err, stats)=>{
66598
+ if (err || stats?.hasErrors()) {
66599
+ const target = currentShare ? currentShare.shareName : "收集依赖";
66600
+ console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
66601
+ reject(err || new Error(`${target} 编译失败`));
66602
+ return;
66603
+ }
66604
+ currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
66605
+ if (stats) {
66606
+ currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
66607
+ console.log(stats.toString({
66608
+ colors: true,
66609
+ chunks: false,
66610
+ modules: false
66611
+ }));
66612
+ }
66613
+ resolve(extraPlugin.getData());
66614
+ });
66615
+ });
66616
+ }
66617
+ cleanup() {
66618
+ this.compilers.forEach((compiler)=>{
66619
+ if (compiler.watching) compiler.watching.close(()=>{
66620
+ console.log("👋 编译器已关闭");
66621
+ });
66622
+ });
66623
+ this.compilers.clear();
66624
+ }
66625
+ constructor(options){
66626
+ IndependentSharedPlugin_define_property(this, "mfName", void 0);
66627
+ IndependentSharedPlugin_define_property(this, "shared", void 0);
66628
+ IndependentSharedPlugin_define_property(this, "library", void 0);
66629
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66630
+ IndependentSharedPlugin_define_property(this, "outputDir", void 0);
66631
+ IndependentSharedPlugin_define_property(this, "outputFilePath", void 0);
66632
+ IndependentSharedPlugin_define_property(this, "plugins", void 0);
66633
+ IndependentSharedPlugin_define_property(this, "compilers", new Map());
66634
+ IndependentSharedPlugin_define_property(this, "treeshake", void 0);
66635
+ IndependentSharedPlugin_define_property(this, "manifest", void 0);
66636
+ IndependentSharedPlugin_define_property(this, "buildAssets", {});
66637
+ IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
66638
+ IndependentSharedPlugin_define_property(this, "name", "IndependentSharedPlugin");
66639
+ const { outputDir, outputFilePath, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
66640
+ this.shared = shared;
66641
+ this.mfName = name;
66642
+ this.outputDir = outputFilePath ? "" : outputDir || "independent-packages";
66643
+ this.outputFilePath = outputFilePath;
66644
+ this.plugins = plugins || [];
66645
+ this.treeshake = treeshake;
66646
+ this.manifest = manifest;
66647
+ this.injectUsedExports = injectUsedExports ?? true;
66648
+ this.library = library;
66649
+ this.sharedOptions = parseOptions(shared, (item, key)=>{
66650
+ if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66326
66651
  const config = item !== key && isRequiredVersion(item) ? {
66327
66652
  import: key,
66328
66653
  requiredVersion: item
@@ -66331,35 +66656,220 @@ class SharePlugin {
66331
66656
  };
66332
66657
  return config;
66333
66658
  }, (item)=>item);
66334
- const consumes = sharedOptions.map(([key, options])=>({
66335
- [key]: {
66336
- import: options.import,
66337
- shareKey: options.shareKey || key,
66338
- shareScope: options.shareScope,
66339
- requiredVersion: options.requiredVersion,
66340
- strictVersion: options.strictVersion,
66341
- singleton: options.singleton,
66342
- packageName: options.packageName,
66343
- eager: options.eager
66344
- }
66345
- }));
66346
- const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66347
- [options.import || key]: {
66348
- shareKey: options.shareKey || key,
66349
- shareScope: options.shareScope,
66350
- version: options.version,
66351
- eager: options.eager,
66352
- singleton: options.singleton,
66353
- requiredVersion: options.requiredVersion,
66354
- strictVersion: options.strictVersion
66355
- }
66356
- }));
66357
- this._shareScope = options.shareScope;
66358
- this._consumes = consumes;
66359
- this._provides = provides;
66360
- this._enhanced = options.enhanced ?? false;
66361
66659
  }
66362
66660
  }
66661
+ function TreeShakeSharedPlugin_define_property(obj, key, value) {
66662
+ if (key in obj) Object.defineProperty(obj, key, {
66663
+ value: value,
66664
+ enumerable: true,
66665
+ configurable: true,
66666
+ writable: true
66667
+ });
66668
+ else obj[key] = value;
66669
+ return obj;
66670
+ }
66671
+ class TreeShakeSharedPlugin {
66672
+ apply(compiler) {
66673
+ const { mfConfig, outputDir, plugins, reshake } = this;
66674
+ const { name, shared, library } = mfConfig;
66675
+ if (!shared) return;
66676
+ const sharedOptions = normalizeSharedOptions(shared);
66677
+ if (!sharedOptions.length) return;
66678
+ if (!reshake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
66679
+ if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
66680
+ this._independentSharePlugin = new IndependentSharedPlugin({
66681
+ name: name,
66682
+ shared: shared,
66683
+ outputDir,
66684
+ plugins,
66685
+ treeshake: reshake,
66686
+ library,
66687
+ manifest: mfConfig.manifest
66688
+ });
66689
+ this._independentSharePlugin.apply(compiler);
66690
+ }
66691
+ }
66692
+ get buildAssets() {
66693
+ return this._independentSharePlugin?.buildAssets || {};
66694
+ }
66695
+ constructor(options){
66696
+ TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
66697
+ TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
66698
+ TreeShakeSharedPlugin_define_property(this, "plugins", void 0);
66699
+ TreeShakeSharedPlugin_define_property(this, "reshake", void 0);
66700
+ TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
66701
+ TreeShakeSharedPlugin_define_property(this, "name", "TreeShakeSharedPlugin");
66702
+ const { mfConfig, plugins, reshake } = options;
66703
+ this.mfConfig = mfConfig;
66704
+ this.outputDir = mfConfig.independentShareDir || "independent-packages";
66705
+ this.plugins = plugins;
66706
+ this.reshake = Boolean(reshake);
66707
+ }
66708
+ }
66709
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66710
+ function ModuleFederationPlugin_define_property(obj, key, value) {
66711
+ if (key in obj) Object.defineProperty(obj, key, {
66712
+ value: value,
66713
+ enumerable: true,
66714
+ configurable: true,
66715
+ writable: true
66716
+ });
66717
+ else obj[key] = value;
66718
+ return obj;
66719
+ }
66720
+ class ModuleFederationPlugin {
66721
+ apply(compiler) {
66722
+ const { webpack } = compiler;
66723
+ const paths = getPaths(this._options);
66724
+ compiler.options.resolve.alias = {
66725
+ "@module-federation/runtime-tools": paths.runtimeTools,
66726
+ "@module-federation/runtime": paths.runtime,
66727
+ ...compiler.options.resolve.alias
66728
+ };
66729
+ const sharedOptions = getSharedOptions(this._options);
66730
+ const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
66731
+ if (treeshakeEntries.length > 0) {
66732
+ this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
66733
+ mfConfig: this._options,
66734
+ reshake: false
66735
+ });
66736
+ this._treeShakeSharedPlugin.apply(compiler);
66737
+ }
66738
+ let runtimePluginApplied = false;
66739
+ compiler.hooks.beforeRun.tapPromise({
66740
+ name: "ModuleFederationPlugin",
66741
+ stage: 100
66742
+ }, async ()=>{
66743
+ if (runtimePluginApplied) return;
66744
+ runtimePluginApplied = true;
66745
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
66746
+ new ModuleFederationRuntimePlugin({
66747
+ entryRuntime
66748
+ }).apply(compiler);
66749
+ });
66750
+ new webpack.container.ModuleFederationPluginV1({
66751
+ ...this._options,
66752
+ enhanced: true
66753
+ }).apply(compiler);
66754
+ if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66755
+ }
66756
+ constructor(_options){
66757
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
66758
+ ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
66759
+ this._options = _options;
66760
+ }
66761
+ }
66762
+ function getRemoteInfos(options) {
66763
+ if (!options.remotes) return {};
66764
+ function extractUrlAndGlobal(urlAndGlobal) {
66765
+ const index = urlAndGlobal.indexOf("@");
66766
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66767
+ return [
66768
+ urlAndGlobal.substring(index + 1),
66769
+ urlAndGlobal.substring(0, index)
66770
+ ];
66771
+ }
66772
+ function getExternalTypeFromExternal(external) {
66773
+ if (/^[a-z0-9-]+ /.test(external)) {
66774
+ const idx = external.indexOf(" ");
66775
+ return [
66776
+ external.slice(0, idx),
66777
+ external.slice(idx + 1)
66778
+ ];
66779
+ }
66780
+ return null;
66781
+ }
66782
+ function getExternal(external) {
66783
+ const result = getExternalTypeFromExternal(external);
66784
+ if (null === result) return [
66785
+ remoteType,
66786
+ external
66787
+ ];
66788
+ return result;
66789
+ }
66790
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66791
+ const remotes = parseOptions(options.remotes, (item)=>({
66792
+ external: Array.isArray(item) ? item : [
66793
+ item
66794
+ ],
66795
+ shareScope: options.shareScope || "default"
66796
+ }), (item)=>({
66797
+ external: Array.isArray(item.external) ? item.external : [
66798
+ item.external
66799
+ ],
66800
+ shareScope: item.shareScope || options.shareScope || "default"
66801
+ }));
66802
+ const remoteInfos = {};
66803
+ for (const [key, config] of remotes)for (const external of config.external){
66804
+ const [externalType, externalRequest] = getExternal(external);
66805
+ remoteInfos[key] ??= [];
66806
+ if ("script" === externalType) {
66807
+ const [url, global] = extractUrlAndGlobal(externalRequest);
66808
+ remoteInfos[key].push({
66809
+ alias: key,
66810
+ name: global,
66811
+ entry: url,
66812
+ externalType,
66813
+ shareScope: config.shareScope
66814
+ });
66815
+ } else remoteInfos[key].push({
66816
+ alias: key,
66817
+ name: void 0,
66818
+ entry: void 0,
66819
+ externalType,
66820
+ shareScope: config.shareScope
66821
+ });
66822
+ }
66823
+ return remoteInfos;
66824
+ }
66825
+ function getRuntimePlugins(options) {
66826
+ return options.runtimePlugins ?? [];
66827
+ }
66828
+ function getSharedOptions(options) {
66829
+ if (!options.shared) return [];
66830
+ return parseOptions(options.shared, (item, key)=>{
66831
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66832
+ return item !== key && isRequiredVersion(item) ? {
66833
+ import: key,
66834
+ requiredVersion: item
66835
+ } : {
66836
+ import: item
66837
+ };
66838
+ }, (item)=>item);
66839
+ }
66840
+ function getPaths(options) {
66841
+ return {
66842
+ runtimeTools: "@module-federation/runtime-tools",
66843
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66844
+ runtime: "@module-federation/runtime"
66845
+ };
66846
+ }
66847
+ function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
66848
+ const runtimePlugins = getRuntimePlugins(options);
66849
+ const remoteInfos = getRemoteInfos(options);
66850
+ const runtimePluginImports = [];
66851
+ const runtimePluginVars = [];
66852
+ for(let i = 0; i < runtimePlugins.length; i++){
66853
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66854
+ const pluginSpec = runtimePlugins[i];
66855
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66856
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66857
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66858
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66859
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66860
+ }
66861
+ const content = [
66862
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66863
+ ...runtimePluginImports,
66864
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66865
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66866
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66867
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66868
+ `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
66869
+ 'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;const shareFallbacks=__module_federation_share_fallbacks__||{};for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};const fallbackEntry=shareFallbacks[name];if(fallbackEntry){const fallbackUrl=(__webpack_require__.p||"")+fallbackEntry[1];options.fallbackName=fallbackEntry[0];shareConfig.fallback=fallbackUrl;options.fallback=function(){return __webpack_require__.federation.importExternal(fallbackUrl)}}if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);if(Object.keys(shareFallbacks).length){early(__webpack_require__.federation.bundlerRuntimeOptions,"sharedEntries",()=>shareFallbacks)}merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
66870
+ ].join(";");
66871
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66872
+ }
66363
66873
  function ContainerPlugin_define_property(obj, key, value) {
66364
66874
  if (key in obj) Object.defineProperty(obj, key, {
66365
66875
  value: value,
@@ -66532,7 +67042,7 @@ function transformSync(source, options) {
66532
67042
  const _options = JSON.stringify(options || {});
66533
67043
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66534
67044
  }
66535
- const exports_rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
67045
+ const exports_rspackVersion = "1.6.5-canary-a407d226-20251124112255";
66536
67046
  const exports_version = "5.75.0";
66537
67047
  const exports_WebpackError = Error;
66538
67048
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -66583,6 +67093,7 @@ const container = {
66583
67093
  };
66584
67094
  const sharing = {
66585
67095
  ProvideSharedPlugin: ProvideSharedPlugin,
67096
+ TreeShakeSharedPlugin: TreeShakeSharedPlugin,
66586
67097
  ConsumeSharedPlugin: ConsumeSharedPlugin,
66587
67098
  SharePlugin: SharePlugin
66588
67099
  };
@@ -66691,7 +67202,7 @@ function createCompiler(userOptions) {
66691
67202
  function isMultiRspackOptions(o) {
66692
67203
  return Array.isArray(o);
66693
67204
  }
66694
- function rspack(options, callback) {
67205
+ function rspack_rspack(options, callback) {
66695
67206
  try {
66696
67207
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
66697
67208
  else validateRspackConfig(options);
@@ -66741,7 +67252,7 @@ function rspack(options, callback) {
66741
67252
  return compiler;
66742
67253
  }
66743
67254
  }
66744
- const src_fn = Object.assign(rspack, exports_namespaceObject);
67255
+ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
66745
67256
  src_fn.rspack = src_fn;
66746
67257
  src_fn.webpack = src_fn;
66747
67258
  const src_rspack_0 = src_fn;