@rspack-canary/browser 1.6.7-canary-ceb43c53-20251208173610 → 1.6.7-canary-e27a87e9-20251209100543

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
@@ -58190,7 +58190,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58190
58190
  if ("object" == typeof rspackFuture) {
58191
58191
  D(rspackFuture, "bundlerInfo", {});
58192
58192
  if ("object" == typeof rspackFuture.bundlerInfo) {
58193
- D(rspackFuture.bundlerInfo, "version", "1.6.7-canary-ceb43c53-20251208173610");
58193
+ D(rspackFuture.bundlerInfo, "version", "1.6.7-canary-e27a87e9-20251209100543");
58194
58194
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58195
58195
  D(rspackFuture.bundlerInfo, "force", !library);
58196
58196
  }
@@ -62336,7 +62336,7 @@ class MultiStats {
62336
62336
  return obj;
62337
62337
  });
62338
62338
  if (childOptions.version) {
62339
- obj.rspackVersion = "1.6.7-canary-ceb43c53-20251208173610";
62339
+ obj.rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
62340
62340
  obj.version = "5.75.0";
62341
62341
  }
62342
62342
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63641,7 +63641,7 @@ const SIMPLE_EXTRACTORS = {
63641
63641
  },
63642
63642
  version: (object)=>{
63643
63643
  object.version = "5.75.0";
63644
- object.rspackVersion = "1.6.7-canary-ceb43c53-20251208173610";
63644
+ object.rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
63645
63645
  },
63646
63646
  env: (object, _compilation, _context, { _env })=>{
63647
63647
  object.env = _env;
@@ -66074,6 +66074,34 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66074
66074
  function isRequiredVersion(str) {
66075
66075
  return VERSION_PATTERN_REGEXP.test(str);
66076
66076
  }
66077
+ const encodeName = function(name, prefix = "", withExt = false) {
66078
+ const ext = withExt ? ".js" : "";
66079
+ return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
66080
+ };
66081
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66082
+ const array = (items)=>{
66083
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66084
+ else if (item && "object" == typeof item) object(item);
66085
+ else throw new Error("Unexpected options format");
66086
+ };
66087
+ const object = (obj)=>{
66088
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66089
+ };
66090
+ if (!options) return;
66091
+ if (Array.isArray(options)) array(options);
66092
+ else if ("object" == typeof options) object(options);
66093
+ else throw new Error("Unexpected options format");
66094
+ };
66095
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66096
+ const items = [];
66097
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66098
+ items.push([
66099
+ key,
66100
+ value
66101
+ ]);
66102
+ });
66103
+ return items;
66104
+ };
66077
66105
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66078
66106
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66079
66107
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66123,6 +66151,10 @@ function getBuildInfo(isDev, root) {
66123
66151
  }
66124
66152
  function getFileName(manifestOptions) {
66125
66153
  if (!manifestOptions) return {
66154
+ statsFileName: "",
66155
+ manifestFileName: ""
66156
+ };
66157
+ if ("boolean" == typeof manifestOptions) return {
66126
66158
  statsFileName: STATS_FILE_NAME,
66127
66159
  manifestFileName: MANIFEST_FILE_NAME
66128
66160
  };
@@ -66140,118 +66172,17 @@ function getFileName(manifestOptions) {
66140
66172
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66141
66173
  };
66142
66174
  }
66143
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66144
- raw(compiler) {
66145
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66146
- const { statsFileName, manifestFileName } = getFileName(this.opts);
66147
- const rawOptions = {
66148
- name: this.opts.name,
66149
- globalName: this.opts.globalName,
66150
- fileName,
66151
- filePath,
66152
- manifestFileName,
66153
- statsFileName,
66154
- disableAssetsAnalyze,
66155
- remoteAliasMap,
66156
- exposes,
66157
- shared,
66158
- buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66159
- };
66160
- return createBuiltinPlugin(this.name, rawOptions);
66161
- }
66162
- constructor(opts){
66163
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66164
- this.opts = opts;
66165
- }
66166
- }
66167
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66168
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66169
- const array = (items)=>{
66170
- for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66171
- else if (item && "object" == typeof item) object(item);
66172
- else throw new Error("Unexpected options format");
66173
- };
66174
- const object = (obj)=>{
66175
- for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66176
- };
66177
- if (!options) return;
66178
- if (Array.isArray(options)) array(options);
66179
- else if ("object" == typeof options) object(options);
66180
- else throw new Error("Unexpected options format");
66181
- };
66182
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66183
- const items = [];
66184
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66185
- items.push([
66186
- key,
66187
- value
66188
- ]);
66189
- });
66190
- return items;
66191
- };
66192
- function ModuleFederationPlugin_define_property(obj, key, value) {
66193
- if (key in obj) Object.defineProperty(obj, key, {
66194
- value: value,
66195
- enumerable: true,
66196
- configurable: true,
66197
- writable: true
66198
- });
66199
- else obj[key] = value;
66200
- return obj;
66201
- }
66202
- class ModuleFederationPlugin {
66203
- apply(compiler) {
66204
- const { webpack } = compiler;
66205
- const paths = getPaths(this._options);
66206
- compiler.options.resolve.alias = {
66207
- "@module-federation/runtime-tools": paths.runtimeTools,
66208
- "@module-federation/runtime": paths.runtime,
66209
- ...compiler.options.resolve.alias
66210
- };
66211
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66212
- new ModuleFederationRuntimePlugin({
66213
- entryRuntime
66214
- }).apply(compiler);
66215
- new webpack.container.ModuleFederationPluginV1({
66216
- ...this._options,
66217
- enhanced: true
66218
- }).apply(compiler);
66219
- if (this._options.manifest) {
66220
- const manifestOptions = true === this._options.manifest ? {} : {
66221
- ...this._options.manifest
66222
- };
66223
- const containerName = manifestOptions.name ?? this._options.name;
66224
- const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66225
- const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66226
- if (cur[1].length > 1) return sum;
66227
- const remoteInfo = cur[1][0];
66228
- const { entry, alias, name } = remoteInfo;
66229
- if (entry && name) sum[alias] = {
66230
- name,
66231
- entry
66232
- };
66233
- return sum;
66234
- }, {});
66235
- const manifestExposes = collectManifestExposes(this._options.exposes);
66236
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66237
- const manifestShared = collectManifestShared(this._options.shared);
66238
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66239
- new ModuleFederationManifestPlugin({
66240
- ...manifestOptions,
66241
- name: containerName,
66242
- globalName,
66243
- remoteAliasMap
66244
- }).apply(compiler);
66245
- }
66246
- }
66247
- constructor(_options){
66248
- ModuleFederationPlugin_define_property(this, "_options", void 0);
66249
- this._options = _options;
66250
- }
66175
+ function resolveLibraryGlobalName(library) {
66176
+ if (!library) return;
66177
+ const libName = library.name;
66178
+ if (!libName) return;
66179
+ if ("string" == typeof libName) return libName;
66180
+ if (Array.isArray(libName)) return libName[0];
66181
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66251
66182
  }
66252
66183
  function collectManifestExposes(exposes) {
66253
66184
  if (!exposes) return;
66254
- const parsed = parseOptions(exposes, (value, key)=>({
66185
+ const parsed = parseOptions(exposes, (value)=>({
66255
66186
  import: Array.isArray(value) ? value : [
66256
66187
  value
66257
66188
  ],
@@ -66295,111 +66226,56 @@ function collectManifestShared(shared) {
66295
66226
  });
66296
66227
  return result.length > 0 ? result : void 0;
66297
66228
  }
66298
- function resolveLibraryGlobalName(library) {
66299
- if (!library) return;
66300
- const libName = library.name;
66301
- if (!libName) return;
66302
- if ("string" == typeof libName) return libName;
66303
- if (Array.isArray(libName)) return libName[0];
66304
- if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66305
- }
66306
- function getRemoteInfos(options) {
66307
- if (!options.remotes) return {};
66308
- function extractUrlAndGlobal(urlAndGlobal) {
66309
- const index = urlAndGlobal.indexOf("@");
66310
- if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66311
- return [
66312
- urlAndGlobal.substring(index + 1),
66313
- urlAndGlobal.substring(0, index)
66314
- ];
66315
- }
66316
- function getExternalTypeFromExternal(external) {
66317
- if (/^[a-z0-9-]+ /.test(external)) {
66318
- const idx = external.indexOf(" ");
66319
- return [
66320
- external.slice(0, idx),
66321
- external.slice(idx + 1)
66322
- ];
66323
- }
66324
- return null;
66325
- }
66326
- function getExternal(external) {
66327
- const result = getExternalTypeFromExternal(external);
66328
- if (null === result) return [
66329
- remoteType,
66330
- external
66331
- ];
66332
- return result;
66333
- }
66334
- const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66335
- const remotes = parseOptions(options.remotes, (item)=>({
66336
- external: Array.isArray(item) ? item : [
66337
- item
66338
- ],
66339
- shareScope: options.shareScope || "default"
66340
- }), (item)=>({
66341
- external: Array.isArray(item.external) ? item.external : [
66342
- item.external
66343
- ],
66344
- shareScope: item.shareScope || options.shareScope || "default"
66345
- }));
66346
- const remoteInfos = {};
66347
- for (const [key, config] of remotes)for (const external of config.external){
66348
- const [externalType, externalRequest] = getExternal(external);
66349
- remoteInfos[key] ??= [];
66350
- if ("script" === externalType) {
66351
- const [url, global] = extractUrlAndGlobal(externalRequest);
66352
- remoteInfos[key].push({
66353
- alias: key,
66354
- name: global,
66355
- entry: url,
66356
- externalType,
66357
- shareScope: config.shareScope
66358
- });
66359
- } else remoteInfos[key].push({
66360
- alias: key,
66361
- name: void 0,
66362
- entry: void 0,
66363
- externalType,
66364
- shareScope: config.shareScope
66365
- });
66366
- }
66367
- return remoteInfos;
66368
- }
66369
- function getRuntimePlugins(options) {
66370
- return options.runtimePlugins ?? [];
66371
- }
66372
- function getPaths(options) {
66229
+ function normalizeManifestOptions(mfConfig) {
66230
+ const manifestOptions = true === mfConfig.manifest ? {} : {
66231
+ ...mfConfig.manifest
66232
+ };
66233
+ const containerName = mfConfig.name;
66234
+ const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
66235
+ const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
66236
+ if (cur[1].length > 1) return sum;
66237
+ const remoteInfo = cur[1][0];
66238
+ const { entry, alias, name } = remoteInfo;
66239
+ if (entry && name) sum[alias] = {
66240
+ name,
66241
+ entry
66242
+ };
66243
+ return sum;
66244
+ }, {});
66245
+ const manifestExposes = collectManifestExposes(mfConfig.exposes);
66246
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66247
+ const manifestShared = collectManifestShared(mfConfig.shared);
66248
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66373
66249
  return {
66374
- runtimeTools: "@module-federation/runtime-tools",
66375
- bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66376
- runtime: "@module-federation/runtime"
66250
+ ...manifestOptions,
66251
+ remoteAliasMap,
66252
+ globalName,
66253
+ name: containerName
66377
66254
  };
66378
66255
  }
66379
- function getDefaultEntryRuntime(paths, options, compiler) {
66380
- const runtimePlugins = getRuntimePlugins(options);
66381
- const remoteInfos = getRemoteInfos(options);
66382
- const runtimePluginImports = [];
66383
- const runtimePluginVars = [];
66384
- for(let i = 0; i < runtimePlugins.length; i++){
66385
- const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66386
- const pluginSpec = runtimePlugins[i];
66387
- const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66388
- const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66389
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66390
- const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66391
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66256
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66257
+ raw(compiler) {
66258
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66259
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66260
+ const rawOptions = {
66261
+ name: this.opts.name,
66262
+ globalName: this.opts.globalName,
66263
+ fileName,
66264
+ filePath,
66265
+ manifestFileName,
66266
+ statsFileName,
66267
+ disableAssetsAnalyze,
66268
+ remoteAliasMap,
66269
+ exposes,
66270
+ shared,
66271
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66272
+ };
66273
+ return createBuiltinPlugin(this.name, rawOptions);
66274
+ }
66275
+ constructor(opts){
66276
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66277
+ this.opts = normalizeManifestOptions(opts);
66392
66278
  }
66393
- const content = [
66394
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66395
- ...runtimePluginImports,
66396
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66397
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66398
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66399
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66400
- '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})}}'
66401
- ].join(";");
66402
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66403
66279
  }
66404
66280
  function ShareRuntimePlugin_define_property(obj, key, value) {
66405
66281
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66438,6 +66314,43 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66438
66314
  else obj[key] = value;
66439
66315
  return obj;
66440
66316
  }
66317
+ function normalizeConsumeShareOptions(consumes, shareScope) {
66318
+ return parseOptions(consumes, (item, key)=>{
66319
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66320
+ const result = item !== key && isRequiredVersion(item) ? {
66321
+ import: key,
66322
+ shareScope: shareScope || "default",
66323
+ shareKey: key,
66324
+ requiredVersion: item,
66325
+ strictVersion: true,
66326
+ packageName: void 0,
66327
+ singleton: false,
66328
+ eager: false,
66329
+ treeshakeStrategy: void 0
66330
+ } : {
66331
+ import: key,
66332
+ shareScope: shareScope || "default",
66333
+ shareKey: key,
66334
+ requiredVersion: void 0,
66335
+ packageName: void 0,
66336
+ strictVersion: false,
66337
+ singleton: false,
66338
+ eager: false,
66339
+ treeshakeStrategy: void 0
66340
+ };
66341
+ return result;
66342
+ }, (item, key)=>({
66343
+ import: false === item.import ? void 0 : item.import || key,
66344
+ shareScope: item.shareScope || shareScope || "default",
66345
+ shareKey: item.shareKey || key,
66346
+ requiredVersion: item.requiredVersion,
66347
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66348
+ packageName: item.packageName,
66349
+ singleton: !!item.singleton,
66350
+ eager: !!item.eager,
66351
+ treeshakeStrategy: item.treeshakeStrategy
66352
+ }));
66353
+ }
66441
66354
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66442
66355
  raw(compiler) {
66443
66356
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66453,38 +66366,7 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66453
66366
  constructor(options){
66454
66367
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66455
66368
  this._options = {
66456
- consumes: parseOptions(options.consumes, (item, key)=>{
66457
- if (Array.isArray(item)) throw new Error("Unexpected array in options");
66458
- const result = item !== key && isRequiredVersion(item) ? {
66459
- import: key,
66460
- shareScope: options.shareScope || "default",
66461
- shareKey: key,
66462
- requiredVersion: item,
66463
- strictVersion: true,
66464
- packageName: void 0,
66465
- singleton: false,
66466
- eager: false
66467
- } : {
66468
- import: key,
66469
- shareScope: options.shareScope || "default",
66470
- shareKey: key,
66471
- requiredVersion: void 0,
66472
- packageName: void 0,
66473
- strictVersion: false,
66474
- singleton: false,
66475
- eager: false
66476
- };
66477
- return result;
66478
- }, (item, key)=>({
66479
- import: false === item.import ? void 0 : item.import || key,
66480
- shareScope: item.shareScope || options.shareScope || "default",
66481
- shareKey: item.shareKey || key,
66482
- requiredVersion: item.requiredVersion,
66483
- strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66484
- packageName: item.packageName,
66485
- singleton: !!item.singleton,
66486
- eager: !!item.eager
66487
- })),
66369
+ consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66488
66370
  enhanced: options.enhanced ?? false
66489
66371
  };
66490
66372
  }
@@ -66499,43 +66381,47 @@ function ProvideSharedPlugin_define_property(obj, key, value) {
66499
66381
  else obj[key] = value;
66500
66382
  return obj;
66501
66383
  }
66502
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66503
- raw(compiler) {
66504
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66505
- const rawOptions = this._provides.map(([key, v])=>({
66506
- key,
66507
- ...v
66384
+ function normalizeProvideShareOptions(options, shareScope, enhanced) {
66385
+ return parseOptions(options, (item)=>{
66386
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66387
+ return {
66388
+ shareKey: item,
66389
+ version: void 0,
66390
+ shareScope: shareScope || "default",
66391
+ eager: false
66392
+ };
66393
+ }, (item)=>{
66394
+ const raw = {
66395
+ shareKey: item.shareKey,
66396
+ version: item.version,
66397
+ shareScope: item.shareScope || shareScope || "default",
66398
+ eager: !!item.eager
66399
+ };
66400
+ if (enhanced) {
66401
+ const enhancedItem = item;
66402
+ return {
66403
+ ...raw,
66404
+ singleton: enhancedItem.singleton,
66405
+ requiredVersion: enhancedItem.requiredVersion,
66406
+ strictVersion: enhancedItem.strictVersion,
66407
+ treeshakeStrategy: enhancedItem.treeshakeStrategy
66408
+ };
66409
+ }
66410
+ return raw;
66411
+ });
66412
+ }
66413
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66414
+ raw(compiler) {
66415
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66416
+ const rawOptions = this._provides.map(([key, v])=>({
66417
+ key,
66418
+ ...v
66508
66419
  }));
66509
66420
  return createBuiltinPlugin(this.name, rawOptions);
66510
66421
  }
66511
66422
  constructor(options){
66512
66423
  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);
66513
- this._provides = parseOptions(options.provides, (item)=>{
66514
- if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66515
- return {
66516
- shareKey: item,
66517
- version: void 0,
66518
- shareScope: options.shareScope || "default",
66519
- eager: false
66520
- };
66521
- }, (item)=>{
66522
- const raw = {
66523
- shareKey: item.shareKey,
66524
- version: item.version,
66525
- shareScope: item.shareScope || options.shareScope || "default",
66526
- eager: !!item.eager
66527
- };
66528
- if (options.enhanced) {
66529
- const enhancedItem = item;
66530
- return {
66531
- ...raw,
66532
- singleton: enhancedItem.singleton,
66533
- requiredVersion: enhancedItem.requiredVersion,
66534
- strictVersion: enhancedItem.strictVersion
66535
- };
66536
- }
66537
- return raw;
66538
- });
66424
+ this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66539
66425
  this._enhanced = options.enhanced;
66540
66426
  }
66541
66427
  }
@@ -66549,6 +66435,47 @@ function SharePlugin_define_property(obj, key, value) {
66549
66435
  else obj[key] = value;
66550
66436
  return obj;
66551
66437
  }
66438
+ function normalizeSharedOptions(shared) {
66439
+ return parseOptions(shared, (item, key)=>{
66440
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66441
+ const config = item !== key && isRequiredVersion(item) ? {
66442
+ import: key,
66443
+ requiredVersion: item
66444
+ } : {
66445
+ import: item
66446
+ };
66447
+ return config;
66448
+ }, (item)=>item);
66449
+ }
66450
+ function createProvideShareOptions(normalizedSharedOptions) {
66451
+ return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66452
+ [options.import || key]: {
66453
+ shareKey: options.shareKey || key,
66454
+ shareScope: options.shareScope,
66455
+ version: options.version,
66456
+ eager: options.eager,
66457
+ singleton: options.singleton,
66458
+ requiredVersion: options.requiredVersion,
66459
+ strictVersion: options.strictVersion,
66460
+ treeshakeStrategy: options.treeshake?.strategy
66461
+ }
66462
+ }));
66463
+ }
66464
+ function createConsumeShareOptions(normalizedSharedOptions) {
66465
+ return normalizedSharedOptions.map(([key, options])=>({
66466
+ [key]: {
66467
+ import: options.import,
66468
+ shareKey: options.shareKey || key,
66469
+ shareScope: options.shareScope,
66470
+ requiredVersion: options.requiredVersion,
66471
+ strictVersion: options.strictVersion,
66472
+ singleton: options.singleton,
66473
+ packageName: options.packageName,
66474
+ eager: options.eager,
66475
+ treeshakeStrategy: options.treeshake?.strategy
66476
+ }
66477
+ }));
66478
+ }
66552
66479
  class SharePlugin {
66553
66480
  apply(compiler) {
66554
66481
  new ConsumeSharedPlugin({
@@ -66567,8 +66494,411 @@ class SharePlugin {
66567
66494
  SharePlugin_define_property(this, "_consumes", void 0);
66568
66495
  SharePlugin_define_property(this, "_provides", void 0);
66569
66496
  SharePlugin_define_property(this, "_enhanced", void 0);
66570
- const sharedOptions = parseOptions(options.shared, (item, key)=>{
66571
- if ("string" != typeof item) throw new Error("Unexpected array in shared");
66497
+ SharePlugin_define_property(this, "_sharedOptions", void 0);
66498
+ const sharedOptions = normalizeSharedOptions(options.shared);
66499
+ const consumes = createConsumeShareOptions(sharedOptions);
66500
+ const provides = createProvideShareOptions(sharedOptions);
66501
+ this._shareScope = options.shareScope;
66502
+ this._consumes = consumes;
66503
+ this._provides = provides;
66504
+ this._enhanced = options.enhanced ?? false;
66505
+ this._sharedOptions = sharedOptions;
66506
+ }
66507
+ }
66508
+ function CollectSharedEntryPlugin_define_property(obj, key, value) {
66509
+ if (key in obj) Object.defineProperty(obj, key, {
66510
+ value: value,
66511
+ enumerable: true,
66512
+ configurable: true,
66513
+ writable: true
66514
+ });
66515
+ else obj[key] = value;
66516
+ return obj;
66517
+ }
66518
+ const SHARE_ENTRY_ASSET = "collect-shared-entries.json";
66519
+ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66520
+ getData() {
66521
+ return this._collectedEntries;
66522
+ }
66523
+ getFilename() {
66524
+ return SHARE_ENTRY_ASSET;
66525
+ }
66526
+ apply(compiler) {
66527
+ super.apply(compiler);
66528
+ compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
66529
+ compilation.hooks.processAssets.tapPromise({
66530
+ name: "CollectSharedEntry",
66531
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66532
+ }, async ()=>{
66533
+ compilation.getAssets().forEach((asset)=>{
66534
+ if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
66535
+ compilation.deleteAsset(asset.name);
66536
+ });
66537
+ });
66538
+ });
66539
+ }
66540
+ raw() {
66541
+ const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66542
+ const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66543
+ const rawOptions = {
66544
+ consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66545
+ key,
66546
+ ...v
66547
+ })),
66548
+ filename: this.getFilename()
66549
+ };
66550
+ return createBuiltinPlugin(this.name, rawOptions);
66551
+ }
66552
+ constructor(options){
66553
+ 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);
66554
+ const { sharedOptions } = options;
66555
+ this.sharedOptions = sharedOptions;
66556
+ this._collectedEntries = {};
66557
+ }
66558
+ }
66559
+ function SharedContainerPlugin_define_property(obj, key, value) {
66560
+ if (key in obj) Object.defineProperty(obj, key, {
66561
+ value: value,
66562
+ enumerable: true,
66563
+ configurable: true,
66564
+ writable: true
66565
+ });
66566
+ else obj[key] = value;
66567
+ return obj;
66568
+ }
66569
+ function assert(condition, msg) {
66570
+ if (!condition) throw new Error(msg);
66571
+ }
66572
+ const HOT_UPDATE_SUFFIX = ".hot-update";
66573
+ class SharedContainerPlugin extends RspackBuiltinPlugin {
66574
+ getData() {
66575
+ return [
66576
+ this._options.fileName,
66577
+ this._globalName,
66578
+ this._options.version
66579
+ ];
66580
+ }
66581
+ raw(compiler) {
66582
+ const { library } = this._options;
66583
+ if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66584
+ return createBuiltinPlugin(this.name, this._options);
66585
+ }
66586
+ apply(compiler) {
66587
+ super.apply(compiler);
66588
+ const shareName = this._shareName;
66589
+ compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66590
+ compilation.hooks.processAssets.tapPromise({
66591
+ name: "getShareContainerFile"
66592
+ }, async ()=>{
66593
+ const remoteEntryPoint = compilation.entrypoints.get(shareName);
66594
+ assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66595
+ const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66596
+ assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66597
+ const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
66598
+ assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66599
+ assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
66600
+ this.filename = files[0];
66601
+ });
66602
+ });
66603
+ }
66604
+ constructor(options){
66605
+ super(), SharedContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedContainerPlugin), SharedContainerPlugin_define_property(this, "filename", ""), SharedContainerPlugin_define_property(this, "_options", void 0), SharedContainerPlugin_define_property(this, "_shareName", void 0), SharedContainerPlugin_define_property(this, "_globalName", void 0);
66606
+ const { shareName, library, request, independentShareFileName, mfName } = options;
66607
+ const version = options.version || "0.0.0";
66608
+ this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
66609
+ const fileName = independentShareFileName || `${version}/share-entry.js`;
66610
+ this._shareName = shareName;
66611
+ this._options = {
66612
+ name: shareName,
66613
+ request: request,
66614
+ library: (library ? {
66615
+ ...library,
66616
+ name: this._globalName
66617
+ } : void 0) || {
66618
+ type: "global",
66619
+ name: this._globalName
66620
+ },
66621
+ version,
66622
+ fileName
66623
+ };
66624
+ }
66625
+ }
66626
+ function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66627
+ if (key in obj) Object.defineProperty(obj, key, {
66628
+ value: value,
66629
+ enumerable: true,
66630
+ configurable: true,
66631
+ writable: true
66632
+ });
66633
+ else obj[key] = value;
66634
+ return obj;
66635
+ }
66636
+ class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66637
+ buildOptions() {
66638
+ const shared = this.sharedOptions.map(([shareKey, config])=>({
66639
+ shareKey,
66640
+ treeshake: !!config.treeshake,
66641
+ usedExports: config.treeshake?.usedExports
66642
+ }));
66643
+ const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66644
+ return {
66645
+ shared,
66646
+ injectUsedExports: this.injectUsedExports,
66647
+ manifestFileName,
66648
+ statsFileName
66649
+ };
66650
+ }
66651
+ raw() {
66652
+ if (!this.sharedOptions.length) return;
66653
+ return createBuiltinPlugin(this.name, this.buildOptions());
66654
+ }
66655
+ constructor(sharedOptions, injectUsedExports, manifestOptions){
66656
+ 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);
66657
+ this.sharedOptions = sharedOptions;
66658
+ this.injectUsedExports = injectUsedExports ?? true;
66659
+ this.manifestOptions = manifestOptions ?? {};
66660
+ }
66661
+ }
66662
+ function IndependentSharedPlugin_define_property(obj, key, value) {
66663
+ if (key in obj) Object.defineProperty(obj, key, {
66664
+ value: value,
66665
+ enumerable: true,
66666
+ configurable: true,
66667
+ writable: true
66668
+ });
66669
+ else obj[key] = value;
66670
+ return obj;
66671
+ }
66672
+ const VIRTUAL_ENTRY = "./virtual-entry.js";
66673
+ const VIRTUAL_ENTRY_NAME = "virtual-entry";
66674
+ const filterPlugin = (plugin)=>{
66675
+ if (!plugin) return true;
66676
+ const pluginName = plugin.name || plugin.constructor?.name;
66677
+ if (!pluginName) return true;
66678
+ return ![
66679
+ "TreeShakeSharedPlugin",
66680
+ "IndependentSharedPlugin",
66681
+ "ModuleFederationPlugin",
66682
+ "SharedUsedExportsOptimizerPlugin",
66683
+ "HtmlWebpackPlugin"
66684
+ ].includes(pluginName);
66685
+ };
66686
+ class VirtualEntryPlugin {
66687
+ createEntry() {
66688
+ const { sharedOptions } = this;
66689
+ const entryContent = sharedOptions.reduce((acc, cur, index)=>`${acc}import shared_${index} from '${cur[0]}';\n`, "");
66690
+ return entryContent;
66691
+ }
66692
+ static entry() {
66693
+ return {
66694
+ [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66695
+ };
66696
+ }
66697
+ apply(compiler) {
66698
+ new compiler.rspack.experiments.VirtualModulesPlugin({
66699
+ [VIRTUAL_ENTRY]: this.createEntry()
66700
+ }).apply(compiler);
66701
+ compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
66702
+ compilation.hooks.processAssets.tapPromise({
66703
+ name: "RemoveVirtualEntryAsset",
66704
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66705
+ }, async ()=>{
66706
+ try {
66707
+ const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66708
+ chunk?.files.forEach((f)=>{
66709
+ compilation.deleteAsset(f);
66710
+ });
66711
+ } catch (_e) {
66712
+ console.error("Failed to remove virtual entry file!");
66713
+ }
66714
+ });
66715
+ });
66716
+ }
66717
+ constructor(sharedOptions){
66718
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66719
+ this.sharedOptions = sharedOptions;
66720
+ }
66721
+ }
66722
+ const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
66723
+ class IndependentSharedPlugin {
66724
+ apply(compiler) {
66725
+ const { manifest } = this;
66726
+ let runCount = 0;
66727
+ compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async ()=>{
66728
+ if (runCount) return;
66729
+ await this.createIndependentCompilers(compiler);
66730
+ runCount++;
66731
+ });
66732
+ compiler.hooks.watchRun.tapPromise("IndependentSharedPlugin", async ()=>{
66733
+ if (runCount) return;
66734
+ await this.createIndependentCompilers(compiler);
66735
+ runCount++;
66736
+ });
66737
+ compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
66738
+ callback();
66739
+ });
66740
+ if (manifest) compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
66741
+ compilation.hooks.processAssets.tapPromise({
66742
+ name: "injectBuildAssets",
66743
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66744
+ }, async ()=>{
66745
+ const { statsFileName, manifestFileName } = getFileName(manifest);
66746
+ const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66747
+ const stats = compilation.getAsset(filename);
66748
+ if (!stats) return;
66749
+ const statsContent = JSON.parse(stats.source.source().toString());
66750
+ const { shared } = statsContent;
66751
+ Object.entries(this.buildAssets).forEach(([key, item])=>{
66752
+ const targetShared = shared.find((s)=>s.name === key);
66753
+ if (!targetShared) return;
66754
+ item.forEach(([entry, version, globalName])=>{
66755
+ if (version === targetShared.version) {
66756
+ targetShared.fallback = entry;
66757
+ targetShared.fallbackName = globalName;
66758
+ }
66759
+ });
66760
+ });
66761
+ compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66762
+ };
66763
+ injectBuildAssetsIntoStatsOrManifest(statsFileName);
66764
+ injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66765
+ });
66766
+ });
66767
+ }
66768
+ async createIndependentCompilers(parentCompiler) {
66769
+ const { sharedOptions, buildAssets, outputDir } = this;
66770
+ console.log("🚀 Start creating a standalone compiler...");
66771
+ const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
66772
+ await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66773
+ if (!shareConfig.treeshake || false === shareConfig.import) return;
66774
+ const shareRequests = shareRequestsMap[shareName].requests;
66775
+ await Promise.all(shareRequests.map(async ([request, version])=>{
66776
+ const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66777
+ const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
66778
+ shareRequestsMap,
66779
+ currentShare: {
66780
+ shareName,
66781
+ version,
66782
+ request,
66783
+ independentShareFileName: sharedConfig?.treeshake?.filename
66784
+ }
66785
+ });
66786
+ if ("string" == typeof shareFileName) {
66787
+ buildAssets[shareName] ||= [];
66788
+ buildAssets[shareName].push([
66789
+ (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
66790
+ sharedVersion,
66791
+ globalName
66792
+ ]);
66793
+ }
66794
+ }));
66795
+ }));
66796
+ console.log("✅ All independent packages have been compiled successfully");
66797
+ }
66798
+ async createIndependentCompiler(parentCompiler, extraOptions) {
66799
+ const { mfName, plugins, outputDir, sharedOptions, treeshake, library } = this;
66800
+ const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || "");
66801
+ const parentConfig = parentCompiler.options;
66802
+ const finalPlugins = [];
66803
+ const rspack = parentCompiler.rspack;
66804
+ let extraPlugin;
66805
+ extraPlugin = extraOptions ? new SharedContainerPlugin({
66806
+ mfName,
66807
+ library,
66808
+ ...extraOptions.currentShare
66809
+ }) : new CollectSharedEntryPlugin({
66810
+ sharedOptions,
66811
+ shareScope: "default"
66812
+ });
66813
+ (parentConfig.plugins || []).forEach((plugin)=>{
66814
+ if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin)) finalPlugins.push(plugin);
66815
+ });
66816
+ plugins.forEach((plugin)=>{
66817
+ finalPlugins.push(plugin);
66818
+ });
66819
+ finalPlugins.push(extraPlugin);
66820
+ finalPlugins.push(new ConsumeSharedPlugin({
66821
+ consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66822
+ [key]: {
66823
+ import: extraOptions ? false : options.import,
66824
+ shareKey: options.shareKey || key,
66825
+ shareScope: options.shareScope,
66826
+ requiredVersion: options.requiredVersion,
66827
+ strictVersion: options.strictVersion,
66828
+ singleton: options.singleton,
66829
+ packageName: options.packageName,
66830
+ eager: options.eager
66831
+ }
66832
+ })),
66833
+ enhanced: true
66834
+ }));
66835
+ if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
66836
+ finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
66837
+ const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66838
+ const compilerConfig = {
66839
+ ...parentConfig,
66840
+ mode: parentConfig.mode || "development",
66841
+ entry: VirtualEntryPlugin.entry,
66842
+ output: {
66843
+ path: fullOutputDir,
66844
+ clean: true,
66845
+ publicPath: parentConfig.output?.publicPath || "auto"
66846
+ },
66847
+ plugins: finalPlugins,
66848
+ optimization: {
66849
+ ...parentConfig.optimization,
66850
+ splitChunks: false
66851
+ }
66852
+ };
66853
+ const compiler = rspack.rspack(compilerConfig);
66854
+ compiler.inputFileSystem = parentCompiler.inputFileSystem;
66855
+ compiler.outputFileSystem = parentCompiler.outputFileSystem;
66856
+ compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66857
+ const { currentShare } = extraOptions || {};
66858
+ return new Promise((resolve, reject)=>{
66859
+ compiler.run((err, stats)=>{
66860
+ if (err || stats?.hasErrors()) {
66861
+ const target = currentShare ? currentShare.shareName : "收集依赖";
66862
+ console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
66863
+ reject(err || new Error(`${target} 编译失败`));
66864
+ return;
66865
+ }
66866
+ currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
66867
+ if (stats) {
66868
+ currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
66869
+ console.log(stats.toString({
66870
+ colors: true,
66871
+ chunks: false,
66872
+ modules: false
66873
+ }));
66874
+ }
66875
+ resolve(extraPlugin.getData());
66876
+ });
66877
+ });
66878
+ }
66879
+ constructor(options){
66880
+ IndependentSharedPlugin_define_property(this, "mfName", void 0);
66881
+ IndependentSharedPlugin_define_property(this, "shared", void 0);
66882
+ IndependentSharedPlugin_define_property(this, "library", void 0);
66883
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66884
+ IndependentSharedPlugin_define_property(this, "outputDir", void 0);
66885
+ IndependentSharedPlugin_define_property(this, "plugins", void 0);
66886
+ IndependentSharedPlugin_define_property(this, "treeshake", void 0);
66887
+ IndependentSharedPlugin_define_property(this, "manifest", void 0);
66888
+ IndependentSharedPlugin_define_property(this, "buildAssets", {});
66889
+ IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
66890
+ IndependentSharedPlugin_define_property(this, "name", "IndependentSharedPlugin");
66891
+ const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
66892
+ this.shared = shared;
66893
+ this.mfName = name;
66894
+ this.outputDir = outputDir || "independent-packages";
66895
+ this.plugins = plugins || [];
66896
+ this.treeshake = treeshake;
66897
+ this.manifest = manifest;
66898
+ this.injectUsedExports = injectUsedExports ?? true;
66899
+ this.library = library;
66900
+ this.sharedOptions = parseOptions(shared, (item, key)=>{
66901
+ if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66572
66902
  const config = item !== key && isRequiredVersion(item) ? {
66573
66903
  import: key,
66574
66904
  requiredVersion: item
@@ -66577,35 +66907,222 @@ class SharePlugin {
66577
66907
  };
66578
66908
  return config;
66579
66909
  }, (item)=>item);
66580
- const consumes = sharedOptions.map(([key, options])=>({
66581
- [key]: {
66582
- import: options.import,
66583
- shareKey: options.shareKey || key,
66584
- shareScope: options.shareScope,
66585
- requiredVersion: options.requiredVersion,
66586
- strictVersion: options.strictVersion,
66587
- singleton: options.singleton,
66588
- packageName: options.packageName,
66589
- eager: options.eager
66590
- }
66591
- }));
66592
- const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66593
- [options.import || key]: {
66594
- shareKey: options.shareKey || key,
66595
- shareScope: options.shareScope,
66596
- version: options.version,
66597
- eager: options.eager,
66598
- singleton: options.singleton,
66599
- requiredVersion: options.requiredVersion,
66600
- strictVersion: options.strictVersion
66601
- }
66602
- }));
66603
- this._shareScope = options.shareScope;
66604
- this._consumes = consumes;
66605
- this._provides = provides;
66606
- this._enhanced = options.enhanced ?? false;
66607
66910
  }
66608
66911
  }
66912
+ function TreeShakeSharedPlugin_define_property(obj, key, value) {
66913
+ if (key in obj) Object.defineProperty(obj, key, {
66914
+ value: value,
66915
+ enumerable: true,
66916
+ configurable: true,
66917
+ writable: true
66918
+ });
66919
+ else obj[key] = value;
66920
+ return obj;
66921
+ }
66922
+ class TreeShakeSharedPlugin {
66923
+ apply(compiler) {
66924
+ const { mfConfig, outputDir, plugins, reshake } = this;
66925
+ const { name, shared, library } = mfConfig;
66926
+ if (!shared) return;
66927
+ const sharedOptions = normalizeSharedOptions(shared);
66928
+ if (!sharedOptions.length) return;
66929
+ if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
66930
+ if (!reshake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
66931
+ this._independentSharePlugin = new IndependentSharedPlugin({
66932
+ name: name,
66933
+ shared: shared,
66934
+ outputDir,
66935
+ plugins,
66936
+ treeshake: reshake,
66937
+ library,
66938
+ manifest: mfConfig.manifest
66939
+ });
66940
+ this._independentSharePlugin.apply(compiler);
66941
+ }
66942
+ }
66943
+ get buildAssets() {
66944
+ return this._independentSharePlugin?.buildAssets || {};
66945
+ }
66946
+ constructor(options){
66947
+ TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
66948
+ TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
66949
+ TreeShakeSharedPlugin_define_property(this, "plugins", void 0);
66950
+ TreeShakeSharedPlugin_define_property(this, "reshake", void 0);
66951
+ TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
66952
+ TreeShakeSharedPlugin_define_property(this, "name", "TreeShakeSharedPlugin");
66953
+ const { mfConfig, plugins, reshake } = options;
66954
+ this.mfConfig = mfConfig;
66955
+ this.outputDir = mfConfig.independentShareDir || "independent-packages";
66956
+ this.plugins = plugins;
66957
+ this.reshake = Boolean(reshake);
66958
+ }
66959
+ }
66960
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66961
+ function ModuleFederationPlugin_define_property(obj, key, value) {
66962
+ if (key in obj) Object.defineProperty(obj, key, {
66963
+ value: value,
66964
+ enumerable: true,
66965
+ configurable: true,
66966
+ writable: true
66967
+ });
66968
+ else obj[key] = value;
66969
+ return obj;
66970
+ }
66971
+ class ModuleFederationPlugin {
66972
+ apply(compiler) {
66973
+ const { webpack } = compiler;
66974
+ const paths = getPaths(this._options);
66975
+ compiler.options.resolve.alias = {
66976
+ "@module-federation/runtime-tools": paths.runtimeTools,
66977
+ "@module-federation/runtime": paths.runtime,
66978
+ ...compiler.options.resolve.alias
66979
+ };
66980
+ const sharedOptions = getSharedOptions(this._options);
66981
+ const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
66982
+ if (treeshakeEntries.length > 0) {
66983
+ this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
66984
+ mfConfig: this._options,
66985
+ reshake: false
66986
+ });
66987
+ this._treeShakeSharedPlugin.apply(compiler);
66988
+ }
66989
+ let runtimePluginApplied = false;
66990
+ compiler.hooks.beforeRun.tapPromise({
66991
+ name: "ModuleFederationPlugin",
66992
+ stage: 100
66993
+ }, async ()=>{
66994
+ if (runtimePluginApplied) return;
66995
+ runtimePluginApplied = true;
66996
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
66997
+ new ModuleFederationRuntimePlugin({
66998
+ entryRuntime
66999
+ }).apply(compiler);
67000
+ });
67001
+ new webpack.container.ModuleFederationPluginV1({
67002
+ ...this._options,
67003
+ enhanced: true
67004
+ }).apply(compiler);
67005
+ if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
67006
+ }
67007
+ constructor(_options){
67008
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
67009
+ ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
67010
+ this._options = _options;
67011
+ }
67012
+ }
67013
+ function getRemoteInfos(options) {
67014
+ if (!options.remotes) return {};
67015
+ function extractUrlAndGlobal(urlAndGlobal) {
67016
+ const index = urlAndGlobal.indexOf("@");
67017
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
67018
+ return [
67019
+ urlAndGlobal.substring(index + 1),
67020
+ urlAndGlobal.substring(0, index)
67021
+ ];
67022
+ }
67023
+ function getExternalTypeFromExternal(external) {
67024
+ if (/^[a-z0-9-]+ /.test(external)) {
67025
+ const idx = external.indexOf(" ");
67026
+ return [
67027
+ external.slice(0, idx),
67028
+ external.slice(idx + 1)
67029
+ ];
67030
+ }
67031
+ return null;
67032
+ }
67033
+ function getExternal(external) {
67034
+ const result = getExternalTypeFromExternal(external);
67035
+ if (null === result) return [
67036
+ remoteType,
67037
+ external
67038
+ ];
67039
+ return result;
67040
+ }
67041
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
67042
+ const remotes = parseOptions(options.remotes, (item)=>({
67043
+ external: Array.isArray(item) ? item : [
67044
+ item
67045
+ ],
67046
+ shareScope: options.shareScope || "default"
67047
+ }), (item)=>({
67048
+ external: Array.isArray(item.external) ? item.external : [
67049
+ item.external
67050
+ ],
67051
+ shareScope: item.shareScope || options.shareScope || "default"
67052
+ }));
67053
+ const remoteInfos = {};
67054
+ for (const [key, config] of remotes)for (const external of config.external){
67055
+ const [externalType, externalRequest] = getExternal(external);
67056
+ remoteInfos[key] ??= [];
67057
+ if ("script" === externalType) {
67058
+ const [url, global] = extractUrlAndGlobal(externalRequest);
67059
+ remoteInfos[key].push({
67060
+ alias: key,
67061
+ name: global,
67062
+ entry: url,
67063
+ externalType,
67064
+ shareScope: config.shareScope
67065
+ });
67066
+ } else remoteInfos[key].push({
67067
+ alias: key,
67068
+ name: void 0,
67069
+ entry: void 0,
67070
+ externalType,
67071
+ shareScope: config.shareScope
67072
+ });
67073
+ }
67074
+ return remoteInfos;
67075
+ }
67076
+ function getRuntimePlugins(options) {
67077
+ return options.runtimePlugins ?? [];
67078
+ }
67079
+ function getSharedOptions(options) {
67080
+ if (!options.shared) return [];
67081
+ return parseOptions(options.shared, (item, key)=>{
67082
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
67083
+ return item !== key && isRequiredVersion(item) ? {
67084
+ import: key,
67085
+ requiredVersion: item
67086
+ } : {
67087
+ import: item
67088
+ };
67089
+ }, (item)=>item);
67090
+ }
67091
+ function getPaths(options) {
67092
+ return {
67093
+ runtimeTools: "@module-federation/runtime-tools",
67094
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
67095
+ runtime: "@module-federation/runtime"
67096
+ };
67097
+ }
67098
+ function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
67099
+ const runtimePlugins = getRuntimePlugins(options);
67100
+ const remoteInfos = getRemoteInfos(options);
67101
+ const runtimePluginImports = [];
67102
+ const runtimePluginVars = [];
67103
+ const libraryType = options.library?.type || "var";
67104
+ for(let i = 0; i < runtimePlugins.length; i++){
67105
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67106
+ const pluginSpec = runtimePlugins[i];
67107
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
67108
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
67109
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
67110
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
67111
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
67112
+ }
67113
+ const content = [
67114
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
67115
+ ...runtimePluginImports,
67116
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
67117
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67118
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67119
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
67120
+ `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
67121
+ `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
67122
+ '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,"libraryType",()=>__module_federation_library_type__);early(__webpack_require__.federation,"sharedFallback",()=>__module_federation_share_fallbacks__);const sharedFallback=__webpack_require__.federation.sharedFallback;early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){var __webpack_require___federation_bundlerRuntime;consumesLoadingModuleToHandlerMapping[moduleId]={getter:sharedFallback?(__webpack_require___federation_bundlerRuntime=__webpack_require__.federation.bundlerRuntime)===null||__webpack_require___federation_bundlerRuntime===void 0?void 0:__webpack_require___federation_bundlerRuntime.getSharedFallbackGetter({shareKey:data.shareKey,factory:data.fallback,webpackRequire:__webpack_require__,libraryType:__webpack_require__.federation.libraryType}):data.fallback,treeshakeGetter:sharedFallback?data.fallback:undefined,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey,treeshake:__webpack_require__.federation.sharedFallback?{get:data.fallback,strategy:data.treeshakeStrategy}:undefined}}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,treeshakeStrategy}=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,treeshake:treeshakeStrategy?{strategy:treeshakeStrategy}:undefined};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.bundlerRuntime.init({webpackRequire:__webpack_require__});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})}}'
67123
+ ].join(";");
67124
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67125
+ }
66609
67126
  function ContainerPlugin_define_property(obj, key, value) {
66610
67127
  if (key in obj) Object.defineProperty(obj, key, {
66611
67128
  value: value,
@@ -66641,7 +67158,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66641
67158
  name: options.name,
66642
67159
  shareScope: options.shareScope || "default",
66643
67160
  library: options.library || {
66644
- type: "var",
67161
+ type: "global",
66645
67162
  name: options.name
66646
67163
  },
66647
67164
  runtime: options.runtime,
@@ -66778,7 +67295,7 @@ function transformSync(source, options) {
66778
67295
  const _options = JSON.stringify(options || {});
66779
67296
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66780
67297
  }
66781
- const exports_rspackVersion = "1.6.7-canary-ceb43c53-20251208173610";
67298
+ const exports_rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
66782
67299
  const exports_version = "5.75.0";
66783
67300
  const exports_WebpackError = Error;
66784
67301
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -66829,6 +67346,7 @@ const container = {
66829
67346
  };
66830
67347
  const sharing = {
66831
67348
  ProvideSharedPlugin: ProvideSharedPlugin,
67349
+ TreeShakeSharedPlugin: TreeShakeSharedPlugin,
66832
67350
  ConsumeSharedPlugin: ConsumeSharedPlugin,
66833
67351
  SharePlugin: SharePlugin
66834
67352
  };
@@ -66937,7 +67455,7 @@ function createCompiler(userOptions) {
66937
67455
  function isMultiRspackOptions(o) {
66938
67456
  return Array.isArray(o);
66939
67457
  }
66940
- function rspack(options, callback) {
67458
+ function rspack_rspack(options, callback) {
66941
67459
  try {
66942
67460
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
66943
67461
  else validateRspackConfig(options);
@@ -66987,7 +67505,7 @@ function rspack(options, callback) {
66987
67505
  return compiler;
66988
67506
  }
66989
67507
  }
66990
- const src_fn = Object.assign(rspack, exports_namespaceObject);
67508
+ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
66991
67509
  src_fn.rspack = src_fn;
66992
67510
  src_fn.webpack = src_fn;
66993
67511
  const src_rspack_0 = src_fn;