@rspack-canary/browser 1.6.6-canary-6b712371-20251125114142 → 1.6.6-canary-0ca7752a-20251125174427

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