@rspack-canary/browser 1.7.0-canary-75cbc848-20251220203036 → 1.7.0-canary-22d591c5-20251222090400

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
@@ -58222,7 +58222,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58222
58222
  if ("object" == typeof rspackFuture) {
58223
58223
  D(rspackFuture, "bundlerInfo", {});
58224
58224
  if ("object" == typeof rspackFuture.bundlerInfo) {
58225
- D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-75cbc848-20251220203036");
58225
+ D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-22d591c5-20251222090400");
58226
58226
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58227
58227
  D(rspackFuture.bundlerInfo, "force", !library);
58228
58228
  }
@@ -62382,7 +62382,7 @@ class MultiStats {
62382
62382
  return obj;
62383
62383
  });
62384
62384
  if (childOptions.version) {
62385
- obj.rspackVersion = "1.7.0-canary-75cbc848-20251220203036";
62385
+ obj.rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
62386
62386
  obj.version = "5.75.0";
62387
62387
  }
62388
62388
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63698,7 +63698,7 @@ const SIMPLE_EXTRACTORS = {
63698
63698
  },
63699
63699
  version: (object)=>{
63700
63700
  object.version = "5.75.0";
63701
- object.rspackVersion = "1.7.0-canary-75cbc848-20251220203036";
63701
+ object.rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
63702
63702
  },
63703
63703
  env: (object, _compilation, _context, { _env })=>{
63704
63704
  object.env = _env;
@@ -66131,6 +66131,34 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66131
66131
  function isRequiredVersion(str) {
66132
66132
  return VERSION_PATTERN_REGEXP.test(str);
66133
66133
  }
66134
+ const encodeName = function(name, prefix = "", withExt = false) {
66135
+ const ext = withExt ? ".js" : "";
66136
+ return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
66137
+ };
66138
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66139
+ const array = (items)=>{
66140
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66141
+ else if (item && "object" == typeof item) object(item);
66142
+ else throw new Error("Unexpected options format");
66143
+ };
66144
+ const object = (obj)=>{
66145
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66146
+ };
66147
+ if (!options) return;
66148
+ if (Array.isArray(options)) array(options);
66149
+ else if ("object" == typeof options) object(options);
66150
+ else throw new Error("Unexpected options format");
66151
+ };
66152
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66153
+ const items = [];
66154
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66155
+ items.push([
66156
+ key,
66157
+ value
66158
+ ]);
66159
+ });
66160
+ return items;
66161
+ };
66134
66162
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66135
66163
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66136
66164
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66180,6 +66208,10 @@ function getBuildInfo(isDev, root) {
66180
66208
  }
66181
66209
  function getFileName(manifestOptions) {
66182
66210
  if (!manifestOptions) return {
66211
+ statsFileName: "",
66212
+ manifestFileName: ""
66213
+ };
66214
+ if ("boolean" == typeof manifestOptions) return {
66183
66215
  statsFileName: STATS_FILE_NAME,
66184
66216
  manifestFileName: MANIFEST_FILE_NAME
66185
66217
  };
@@ -66197,114 +66229,13 @@ function getFileName(manifestOptions) {
66197
66229
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66198
66230
  };
66199
66231
  }
66200
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66201
- raw(compiler) {
66202
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66203
- const { statsFileName, manifestFileName } = getFileName(this.opts);
66204
- const rawOptions = {
66205
- name: this.opts.name,
66206
- globalName: this.opts.globalName,
66207
- fileName,
66208
- filePath,
66209
- manifestFileName,
66210
- statsFileName,
66211
- disableAssetsAnalyze,
66212
- remoteAliasMap,
66213
- exposes,
66214
- shared,
66215
- buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66216
- };
66217
- return createBuiltinPlugin(this.name, rawOptions);
66218
- }
66219
- constructor(opts){
66220
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66221
- this.opts = opts;
66222
- }
66223
- }
66224
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66225
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66226
- const array = (items)=>{
66227
- for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66228
- else if (item && "object" == typeof item) object(item);
66229
- else throw new Error("Unexpected options format");
66230
- };
66231
- const object = (obj)=>{
66232
- for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66233
- };
66234
- if (!options) return;
66235
- if (Array.isArray(options)) array(options);
66236
- else if ("object" == typeof options) object(options);
66237
- else throw new Error("Unexpected options format");
66238
- };
66239
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66240
- const items = [];
66241
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66242
- items.push([
66243
- key,
66244
- value
66245
- ]);
66246
- });
66247
- return items;
66248
- };
66249
- function ModuleFederationPlugin_define_property(obj, key, value) {
66250
- if (key in obj) Object.defineProperty(obj, key, {
66251
- value: value,
66252
- enumerable: true,
66253
- configurable: true,
66254
- writable: true
66255
- });
66256
- else obj[key] = value;
66257
- return obj;
66258
- }
66259
- class ModuleFederationPlugin {
66260
- apply(compiler) {
66261
- const { webpack } = compiler;
66262
- const paths = getPaths(this._options);
66263
- compiler.options.resolve.alias = {
66264
- "@module-federation/runtime-tools": paths.runtimeTools,
66265
- "@module-federation/runtime": paths.runtime,
66266
- ...compiler.options.resolve.alias
66267
- };
66268
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66269
- new ModuleFederationRuntimePlugin({
66270
- entryRuntime
66271
- }).apply(compiler);
66272
- new webpack.container.ModuleFederationPluginV1({
66273
- ...this._options,
66274
- enhanced: true
66275
- }).apply(compiler);
66276
- if (this._options.manifest) {
66277
- const manifestOptions = true === this._options.manifest ? {} : {
66278
- ...this._options.manifest
66279
- };
66280
- const containerName = manifestOptions.name ?? this._options.name;
66281
- const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66282
- const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66283
- if (cur[1].length > 1) return sum;
66284
- const remoteInfo = cur[1][0];
66285
- const { entry, alias, name } = remoteInfo;
66286
- if (entry && name) sum[alias] = {
66287
- name,
66288
- entry
66289
- };
66290
- return sum;
66291
- }, {});
66292
- const manifestExposes = collectManifestExposes(this._options.exposes);
66293
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66294
- const manifestShared = collectManifestShared(this._options.shared);
66295
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66296
- new ModuleFederationManifestPlugin({
66297
- ...manifestOptions,
66298
- name: containerName,
66299
- globalName,
66300
- remoteAliasMap
66301
- }).apply(compiler);
66302
- }
66303
- }
66304
- constructor(_options){
66305
- ModuleFederationPlugin_define_property(this, "_options", void 0);
66306
- this._options = _options;
66307
- }
66232
+ function resolveLibraryGlobalName(library) {
66233
+ if (!library) return;
66234
+ const libName = library.name;
66235
+ if (!libName) return;
66236
+ if ("string" == typeof libName) return libName;
66237
+ if (Array.isArray(libName)) return libName[0];
66238
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66308
66239
  }
66309
66240
  function collectManifestExposes(exposes) {
66310
66241
  if (!exposes) return;
@@ -66352,111 +66283,56 @@ function collectManifestShared(shared) {
66352
66283
  });
66353
66284
  return result.length > 0 ? result : void 0;
66354
66285
  }
66355
- function resolveLibraryGlobalName(library) {
66356
- if (!library) return;
66357
- const libName = library.name;
66358
- if (!libName) return;
66359
- if ("string" == typeof libName) return libName;
66360
- if (Array.isArray(libName)) return libName[0];
66361
- if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66362
- }
66363
- function getRemoteInfos(options) {
66364
- if (!options.remotes) return {};
66365
- function extractUrlAndGlobal(urlAndGlobal) {
66366
- const index = urlAndGlobal.indexOf("@");
66367
- if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66368
- return [
66369
- urlAndGlobal.substring(index + 1),
66370
- urlAndGlobal.substring(0, index)
66371
- ];
66372
- }
66373
- function getExternalTypeFromExternal(external) {
66374
- if (/^[a-z0-9-]+ /.test(external)) {
66375
- const idx = external.indexOf(" ");
66376
- return [
66377
- external.slice(0, idx),
66378
- external.slice(idx + 1)
66379
- ];
66380
- }
66381
- return null;
66382
- }
66383
- function getExternal(external) {
66384
- const result = getExternalTypeFromExternal(external);
66385
- if (null === result) return [
66386
- remoteType,
66387
- external
66388
- ];
66389
- return result;
66390
- }
66391
- const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66392
- const remotes = parseOptions(options.remotes, (item)=>({
66393
- external: Array.isArray(item) ? item : [
66394
- item
66395
- ],
66396
- shareScope: options.shareScope || "default"
66397
- }), (item)=>({
66398
- external: Array.isArray(item.external) ? item.external : [
66399
- item.external
66400
- ],
66401
- shareScope: item.shareScope || options.shareScope || "default"
66402
- }));
66403
- const remoteInfos = {};
66404
- for (const [key, config] of remotes)for (const external of config.external){
66405
- const [externalType, externalRequest] = getExternal(external);
66406
- remoteInfos[key] ??= [];
66407
- if ("script" === externalType) {
66408
- const [url, global] = extractUrlAndGlobal(externalRequest);
66409
- remoteInfos[key].push({
66410
- alias: key,
66411
- name: global,
66412
- entry: url,
66413
- externalType,
66414
- shareScope: config.shareScope
66415
- });
66416
- } else remoteInfos[key].push({
66417
- alias: key,
66418
- name: void 0,
66419
- entry: void 0,
66420
- externalType,
66421
- shareScope: config.shareScope
66422
- });
66423
- }
66424
- return remoteInfos;
66425
- }
66426
- function getRuntimePlugins(options) {
66427
- return options.runtimePlugins ?? [];
66428
- }
66429
- function getPaths(options) {
66286
+ function normalizeManifestOptions(mfConfig) {
66287
+ const manifestOptions = true === mfConfig.manifest ? {} : {
66288
+ ...mfConfig.manifest
66289
+ };
66290
+ const containerName = mfConfig.name;
66291
+ const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
66292
+ const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
66293
+ if (cur[1].length > 1) return sum;
66294
+ const remoteInfo = cur[1][0];
66295
+ const { entry, alias, name } = remoteInfo;
66296
+ if (entry && name) sum[alias] = {
66297
+ name,
66298
+ entry
66299
+ };
66300
+ return sum;
66301
+ }, {});
66302
+ const manifestExposes = collectManifestExposes(mfConfig.exposes);
66303
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66304
+ const manifestShared = collectManifestShared(mfConfig.shared);
66305
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66430
66306
  return {
66431
- runtimeTools: "@module-federation/runtime-tools",
66432
- bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66433
- runtime: "@module-federation/runtime"
66307
+ ...manifestOptions,
66308
+ remoteAliasMap,
66309
+ globalName,
66310
+ name: containerName
66434
66311
  };
66435
66312
  }
66436
- function getDefaultEntryRuntime(paths, options, compiler) {
66437
- const runtimePlugins = getRuntimePlugins(options);
66438
- const remoteInfos = getRemoteInfos(options);
66439
- const runtimePluginImports = [];
66440
- const runtimePluginVars = [];
66441
- for(let i = 0; i < runtimePlugins.length; i++){
66442
- const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66443
- const pluginSpec = runtimePlugins[i];
66444
- const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66445
- const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66446
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66447
- const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66448
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66313
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66314
+ raw(compiler) {
66315
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66316
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66317
+ const rawOptions = {
66318
+ name: this.opts.name,
66319
+ globalName: this.opts.globalName,
66320
+ fileName,
66321
+ filePath,
66322
+ manifestFileName,
66323
+ statsFileName,
66324
+ disableAssetsAnalyze,
66325
+ remoteAliasMap,
66326
+ exposes,
66327
+ shared,
66328
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66329
+ };
66330
+ return createBuiltinPlugin(this.name, rawOptions);
66331
+ }
66332
+ constructor(opts){
66333
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66334
+ this.opts = normalizeManifestOptions(opts);
66449
66335
  }
66450
- const content = [
66451
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66452
- ...runtimePluginImports,
66453
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66454
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66455
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66456
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66457
- '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 _ref;const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};var _ref1;const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};var _ref2;const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};var _ref3;const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};var _ref4;const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};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})}}'
66458
- ].join(";");
66459
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66460
66336
  }
66461
66337
  function ShareRuntimePlugin_define_property(obj, key, value) {
66462
66338
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66495,6 +66371,43 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66495
66371
  else obj[key] = value;
66496
66372
  return obj;
66497
66373
  }
66374
+ function normalizeConsumeShareOptions(consumes, shareScope) {
66375
+ return parseOptions(consumes, (item, key)=>{
66376
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66377
+ const result = item !== key && isRequiredVersion(item) ? {
66378
+ import: key,
66379
+ shareScope: shareScope || "default",
66380
+ shareKey: key,
66381
+ requiredVersion: item,
66382
+ strictVersion: true,
66383
+ packageName: void 0,
66384
+ singleton: false,
66385
+ eager: false,
66386
+ treeshakeStrategy: void 0
66387
+ } : {
66388
+ import: key,
66389
+ shareScope: shareScope || "default",
66390
+ shareKey: key,
66391
+ requiredVersion: void 0,
66392
+ packageName: void 0,
66393
+ strictVersion: false,
66394
+ singleton: false,
66395
+ eager: false,
66396
+ treeshakeStrategy: void 0
66397
+ };
66398
+ return result;
66399
+ }, (item, key)=>({
66400
+ import: false === item.import ? void 0 : item.import || key,
66401
+ shareScope: item.shareScope || shareScope || "default",
66402
+ shareKey: item.shareKey || key,
66403
+ requiredVersion: item.requiredVersion,
66404
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66405
+ packageName: item.packageName,
66406
+ singleton: !!item.singleton,
66407
+ eager: !!item.eager,
66408
+ treeshakeStrategy: item.treeshakeStrategy
66409
+ }));
66410
+ }
66498
66411
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66499
66412
  raw(compiler) {
66500
66413
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66510,38 +66423,7 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66510
66423
  constructor(options){
66511
66424
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66512
66425
  this._options = {
66513
- consumes: parseOptions(options.consumes, (item, key)=>{
66514
- if (Array.isArray(item)) throw new Error("Unexpected array in options");
66515
- const result = item !== key && isRequiredVersion(item) ? {
66516
- import: key,
66517
- shareScope: options.shareScope || "default",
66518
- shareKey: key,
66519
- requiredVersion: item,
66520
- strictVersion: true,
66521
- packageName: void 0,
66522
- singleton: false,
66523
- eager: false
66524
- } : {
66525
- import: key,
66526
- shareScope: options.shareScope || "default",
66527
- shareKey: key,
66528
- requiredVersion: void 0,
66529
- packageName: void 0,
66530
- strictVersion: false,
66531
- singleton: false,
66532
- eager: false
66533
- };
66534
- return result;
66535
- }, (item, key)=>({
66536
- import: false === item.import ? void 0 : item.import || key,
66537
- shareScope: item.shareScope || options.shareScope || "default",
66538
- shareKey: item.shareKey || key,
66539
- requiredVersion: item.requiredVersion,
66540
- strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66541
- packageName: item.packageName,
66542
- singleton: !!item.singleton,
66543
- eager: !!item.eager
66544
- })),
66426
+ consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66545
66427
  enhanced: options.enhanced ?? false
66546
66428
  };
66547
66429
  }
@@ -66556,43 +66438,47 @@ function ProvideSharedPlugin_define_property(obj, key, value) {
66556
66438
  else obj[key] = value;
66557
66439
  return obj;
66558
66440
  }
66559
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66560
- raw(compiler) {
66561
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66562
- const rawOptions = this._provides.map(([key, v])=>({
66563
- key,
66564
- ...v
66441
+ function normalizeProvideShareOptions(options, shareScope, enhanced) {
66442
+ return parseOptions(options, (item)=>{
66443
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66444
+ return {
66445
+ shareKey: item,
66446
+ version: void 0,
66447
+ shareScope: shareScope || "default",
66448
+ eager: false
66449
+ };
66450
+ }, (item)=>{
66451
+ const raw = {
66452
+ shareKey: item.shareKey,
66453
+ version: item.version,
66454
+ shareScope: item.shareScope || shareScope || "default",
66455
+ eager: !!item.eager
66456
+ };
66457
+ if (enhanced) {
66458
+ const enhancedItem = item;
66459
+ return {
66460
+ ...raw,
66461
+ singleton: enhancedItem.singleton,
66462
+ requiredVersion: enhancedItem.requiredVersion,
66463
+ strictVersion: enhancedItem.strictVersion,
66464
+ treeshakeStrategy: enhancedItem.treeshakeStrategy
66465
+ };
66466
+ }
66467
+ return raw;
66468
+ });
66469
+ }
66470
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66471
+ raw(compiler) {
66472
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66473
+ const rawOptions = this._provides.map(([key, v])=>({
66474
+ key,
66475
+ ...v
66565
66476
  }));
66566
66477
  return createBuiltinPlugin(this.name, rawOptions);
66567
66478
  }
66568
66479
  constructor(options){
66569
66480
  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);
66570
- this._provides = parseOptions(options.provides, (item)=>{
66571
- if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66572
- return {
66573
- shareKey: item,
66574
- version: void 0,
66575
- shareScope: options.shareScope || "default",
66576
- eager: false
66577
- };
66578
- }, (item)=>{
66579
- const raw = {
66580
- shareKey: item.shareKey,
66581
- version: item.version,
66582
- shareScope: item.shareScope || options.shareScope || "default",
66583
- eager: !!item.eager
66584
- };
66585
- if (options.enhanced) {
66586
- const enhancedItem = item;
66587
- return {
66588
- ...raw,
66589
- singleton: enhancedItem.singleton,
66590
- requiredVersion: enhancedItem.requiredVersion,
66591
- strictVersion: enhancedItem.strictVersion
66592
- };
66593
- }
66594
- return raw;
66595
- });
66481
+ this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66596
66482
  this._enhanced = options.enhanced;
66597
66483
  }
66598
66484
  }
@@ -66606,6 +66492,47 @@ function SharePlugin_define_property(obj, key, value) {
66606
66492
  else obj[key] = value;
66607
66493
  return obj;
66608
66494
  }
66495
+ function normalizeSharedOptions(shared) {
66496
+ return parseOptions(shared, (item, key)=>{
66497
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66498
+ const config = item !== key && isRequiredVersion(item) ? {
66499
+ import: key,
66500
+ requiredVersion: item
66501
+ } : {
66502
+ import: item
66503
+ };
66504
+ return config;
66505
+ }, (item)=>item);
66506
+ }
66507
+ function createProvideShareOptions(normalizedSharedOptions) {
66508
+ return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66509
+ [options.import || key]: {
66510
+ shareKey: options.shareKey || key,
66511
+ shareScope: options.shareScope,
66512
+ version: options.version,
66513
+ eager: options.eager,
66514
+ singleton: options.singleton,
66515
+ requiredVersion: options.requiredVersion,
66516
+ strictVersion: options.strictVersion,
66517
+ treeshakeStrategy: options.treeshake?.strategy
66518
+ }
66519
+ }));
66520
+ }
66521
+ function createConsumeShareOptions(normalizedSharedOptions) {
66522
+ return normalizedSharedOptions.map(([key, options])=>({
66523
+ [key]: {
66524
+ import: options.import,
66525
+ shareKey: options.shareKey || key,
66526
+ shareScope: options.shareScope,
66527
+ requiredVersion: options.requiredVersion,
66528
+ strictVersion: options.strictVersion,
66529
+ singleton: options.singleton,
66530
+ packageName: options.packageName,
66531
+ eager: options.eager,
66532
+ treeshakeStrategy: options.treeshake?.strategy
66533
+ }
66534
+ }));
66535
+ }
66609
66536
  class SharePlugin {
66610
66537
  apply(compiler) {
66611
66538
  new ConsumeSharedPlugin({
@@ -66624,8 +66551,438 @@ class SharePlugin {
66624
66551
  SharePlugin_define_property(this, "_consumes", void 0);
66625
66552
  SharePlugin_define_property(this, "_provides", void 0);
66626
66553
  SharePlugin_define_property(this, "_enhanced", void 0);
66627
- const sharedOptions = parseOptions(options.shared, (item, key)=>{
66628
- if ("string" != typeof item) throw new Error("Unexpected array in shared");
66554
+ SharePlugin_define_property(this, "_sharedOptions", void 0);
66555
+ const sharedOptions = normalizeSharedOptions(options.shared);
66556
+ const consumes = createConsumeShareOptions(sharedOptions);
66557
+ const provides = createProvideShareOptions(sharedOptions);
66558
+ this._shareScope = options.shareScope;
66559
+ this._consumes = consumes;
66560
+ this._provides = provides;
66561
+ this._enhanced = options.enhanced ?? false;
66562
+ this._sharedOptions = sharedOptions;
66563
+ }
66564
+ }
66565
+ function CollectSharedEntryPlugin_define_property(obj, key, value) {
66566
+ if (key in obj) Object.defineProperty(obj, key, {
66567
+ value: value,
66568
+ enumerable: true,
66569
+ configurable: true,
66570
+ writable: true
66571
+ });
66572
+ else obj[key] = value;
66573
+ return obj;
66574
+ }
66575
+ const SHARE_ENTRY_ASSET = "collect-shared-entries.json";
66576
+ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66577
+ getData() {
66578
+ return this._collectedEntries;
66579
+ }
66580
+ getFilename() {
66581
+ return SHARE_ENTRY_ASSET;
66582
+ }
66583
+ apply(compiler) {
66584
+ super.apply(compiler);
66585
+ compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
66586
+ compilation.hooks.processAssets.tapPromise({
66587
+ name: "CollectSharedEntry",
66588
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66589
+ }, async ()=>{
66590
+ compilation.getAssets().forEach((asset)=>{
66591
+ if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
66592
+ compilation.deleteAsset(asset.name);
66593
+ });
66594
+ });
66595
+ });
66596
+ }
66597
+ raw() {
66598
+ const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66599
+ const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66600
+ const rawOptions = {
66601
+ consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66602
+ key,
66603
+ ...v
66604
+ })),
66605
+ filename: this.getFilename()
66606
+ };
66607
+ return createBuiltinPlugin(this.name, rawOptions);
66608
+ }
66609
+ constructor(options){
66610
+ 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);
66611
+ const { sharedOptions } = options;
66612
+ this.sharedOptions = sharedOptions;
66613
+ this._collectedEntries = {};
66614
+ }
66615
+ }
66616
+ function SharedContainerPlugin_define_property(obj, key, value) {
66617
+ if (key in obj) Object.defineProperty(obj, key, {
66618
+ value: value,
66619
+ enumerable: true,
66620
+ configurable: true,
66621
+ writable: true
66622
+ });
66623
+ else obj[key] = value;
66624
+ return obj;
66625
+ }
66626
+ function assert(condition, msg) {
66627
+ if (!condition) throw new Error(msg);
66628
+ }
66629
+ const HOT_UPDATE_SUFFIX = ".hot-update";
66630
+ class SharedContainerPlugin extends RspackBuiltinPlugin {
66631
+ getData() {
66632
+ return [
66633
+ this._options.fileName,
66634
+ this._globalName,
66635
+ this._options.version
66636
+ ];
66637
+ }
66638
+ raw(compiler) {
66639
+ const { library } = this._options;
66640
+ if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66641
+ return createBuiltinPlugin(this.name, this._options);
66642
+ }
66643
+ apply(compiler) {
66644
+ super.apply(compiler);
66645
+ const shareName = this._shareName;
66646
+ compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66647
+ compilation.hooks.processAssets.tapPromise({
66648
+ name: "getShareContainerFile"
66649
+ }, async ()=>{
66650
+ const remoteEntryPoint = compilation.entrypoints.get(shareName);
66651
+ assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66652
+ const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66653
+ assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66654
+ const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
66655
+ assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66656
+ assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
66657
+ this.filename = files[0];
66658
+ });
66659
+ });
66660
+ }
66661
+ constructor(options){
66662
+ 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);
66663
+ const { shareName, library, request, independentShareFileName, mfName } = options;
66664
+ const version = options.version || "0.0.0";
66665
+ this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
66666
+ const fileName = independentShareFileName || `${version}/share-entry.js`;
66667
+ this._shareName = shareName;
66668
+ this._options = {
66669
+ name: shareName,
66670
+ request: request,
66671
+ library: (library ? {
66672
+ ...library,
66673
+ name: this._globalName
66674
+ } : void 0) || {
66675
+ type: "global",
66676
+ name: this._globalName
66677
+ },
66678
+ version,
66679
+ fileName
66680
+ };
66681
+ }
66682
+ }
66683
+ function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66684
+ if (key in obj) Object.defineProperty(obj, key, {
66685
+ value: value,
66686
+ enumerable: true,
66687
+ configurable: true,
66688
+ writable: true
66689
+ });
66690
+ else obj[key] = value;
66691
+ return obj;
66692
+ }
66693
+ class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66694
+ buildOptions() {
66695
+ const shared = this.sharedOptions.map(([shareKey, config])=>({
66696
+ shareKey,
66697
+ treeshake: !!config.treeshake,
66698
+ usedExports: config.treeshake?.usedExports
66699
+ }));
66700
+ const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66701
+ return {
66702
+ shared,
66703
+ injectUsedExports: this.injectUsedExports,
66704
+ manifestFileName,
66705
+ statsFileName
66706
+ };
66707
+ }
66708
+ raw() {
66709
+ if (!this.sharedOptions.length) return;
66710
+ return createBuiltinPlugin(this.name, this.buildOptions());
66711
+ }
66712
+ constructor(sharedOptions, injectUsedExports, manifestOptions){
66713
+ 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);
66714
+ this.sharedOptions = sharedOptions;
66715
+ this.injectUsedExports = injectUsedExports ?? true;
66716
+ this.manifestOptions = manifestOptions ?? {};
66717
+ }
66718
+ }
66719
+ function IndependentSharedPlugin_define_property(obj, key, value) {
66720
+ if (key in obj) Object.defineProperty(obj, key, {
66721
+ value: value,
66722
+ enumerable: true,
66723
+ configurable: true,
66724
+ writable: true
66725
+ });
66726
+ else obj[key] = value;
66727
+ return obj;
66728
+ }
66729
+ const VIRTUAL_ENTRY = "./virtual-entry.js";
66730
+ const VIRTUAL_ENTRY_NAME = "virtual-entry";
66731
+ const filterPlugin = (plugin, excludedPlugins = [])=>{
66732
+ if (!plugin) return true;
66733
+ const pluginName = plugin.name || plugin.constructor?.name;
66734
+ if (!pluginName) return true;
66735
+ return ![
66736
+ "TreeShakeSharedPlugin",
66737
+ "IndependentSharedPlugin",
66738
+ "ModuleFederationPlugin",
66739
+ "SharedUsedExportsOptimizerPlugin",
66740
+ "HtmlWebpackPlugin",
66741
+ "HtmlRspackPlugin",
66742
+ "RsbuildHtmlPlugin",
66743
+ ...excludedPlugins
66744
+ ].includes(pluginName);
66745
+ };
66746
+ class VirtualEntryPlugin {
66747
+ createEntry() {
66748
+ const { sharedOptions, collectShared } = this;
66749
+ const entryContent = sharedOptions.reduce((acc, cur, index)=>{
66750
+ const importLine = `import shared_${index} from '${cur[0]}';\n`;
66751
+ const logLine = collectShared ? `console.log(shared_${index});\n` : "";
66752
+ return acc + importLine + logLine;
66753
+ }, "");
66754
+ return entryContent;
66755
+ }
66756
+ static entry() {
66757
+ return {
66758
+ [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66759
+ };
66760
+ }
66761
+ apply(compiler) {
66762
+ new compiler.rspack.experiments.VirtualModulesPlugin({
66763
+ [VIRTUAL_ENTRY]: this.createEntry()
66764
+ }).apply(compiler);
66765
+ compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
66766
+ compilation.hooks.processAssets.tapPromise({
66767
+ name: "RemoveVirtualEntryAsset",
66768
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66769
+ }, async ()=>{
66770
+ try {
66771
+ const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66772
+ chunk?.files.forEach((f)=>{
66773
+ compilation.deleteAsset(f);
66774
+ });
66775
+ } catch (_e) {
66776
+ console.error("Failed to remove virtual entry file!");
66777
+ }
66778
+ });
66779
+ });
66780
+ }
66781
+ constructor(sharedOptions, collectShared){
66782
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66783
+ IndependentSharedPlugin_define_property(this, "collectShared", false);
66784
+ this.sharedOptions = sharedOptions;
66785
+ this.collectShared = collectShared;
66786
+ }
66787
+ }
66788
+ const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
66789
+ class IndependentSharedPlugin {
66790
+ apply(compiler) {
66791
+ const { manifest } = this;
66792
+ let runCount = 0;
66793
+ compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async ()=>{
66794
+ if (runCount) return;
66795
+ await this.createIndependentCompilers(compiler);
66796
+ runCount++;
66797
+ });
66798
+ compiler.hooks.watchRun.tapPromise("IndependentSharedPlugin", async ()=>{
66799
+ if (runCount) return;
66800
+ await this.createIndependentCompilers(compiler);
66801
+ runCount++;
66802
+ });
66803
+ compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
66804
+ callback();
66805
+ });
66806
+ if (manifest) compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
66807
+ compilation.hooks.processAssets.tapPromise({
66808
+ name: "injectBuildAssets",
66809
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66810
+ }, async ()=>{
66811
+ const { statsFileName, manifestFileName } = getFileName(manifest);
66812
+ const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66813
+ const stats = compilation.getAsset(filename);
66814
+ if (!stats) return;
66815
+ const statsContent = JSON.parse(stats.source.source().toString());
66816
+ const { shared } = statsContent;
66817
+ Object.entries(this.buildAssets).forEach(([key, item])=>{
66818
+ const targetShared = shared.find((s)=>s.name === key);
66819
+ if (!targetShared) return;
66820
+ item.forEach(([entry, version, globalName])=>{
66821
+ if (version === targetShared.version) {
66822
+ targetShared.fallback = entry;
66823
+ targetShared.fallbackName = globalName;
66824
+ }
66825
+ });
66826
+ });
66827
+ compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66828
+ };
66829
+ injectBuildAssetsIntoStatsOrManifest(statsFileName);
66830
+ injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66831
+ });
66832
+ });
66833
+ }
66834
+ async createIndependentCompilers(parentCompiler) {
66835
+ const { sharedOptions, buildAssets, outputDir } = this;
66836
+ console.log("🚀 Start creating a standalone compiler...");
66837
+ const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
66838
+ await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66839
+ if (!shareConfig.treeshake || false === shareConfig.import) return;
66840
+ const shareRequests = shareRequestsMap[shareName].requests;
66841
+ await Promise.all(shareRequests.map(async ([request, version])=>{
66842
+ const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66843
+ const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
66844
+ shareRequestsMap,
66845
+ currentShare: {
66846
+ shareName,
66847
+ version,
66848
+ request,
66849
+ independentShareFileName: sharedConfig?.treeshake?.filename
66850
+ }
66851
+ });
66852
+ if ("string" == typeof shareFileName) {
66853
+ buildAssets[shareName] ||= [];
66854
+ buildAssets[shareName].push([
66855
+ (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
66856
+ sharedVersion,
66857
+ globalName
66858
+ ]);
66859
+ }
66860
+ }));
66861
+ }));
66862
+ console.log("✅ All independent packages have been compiled successfully");
66863
+ }
66864
+ async createIndependentCompiler(parentCompiler, extraOptions) {
66865
+ const { mfName, plugins, outputDir, sharedOptions, treeshake, library, treeshakeSharedExcludedPlugins } = this;
66866
+ const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || "");
66867
+ const parentConfig = parentCompiler.options;
66868
+ const finalPlugins = [];
66869
+ const rspack = parentCompiler.rspack;
66870
+ let extraPlugin;
66871
+ extraPlugin = extraOptions ? new SharedContainerPlugin({
66872
+ mfName,
66873
+ library,
66874
+ ...extraOptions.currentShare
66875
+ }) : new CollectSharedEntryPlugin({
66876
+ sharedOptions,
66877
+ shareScope: "default"
66878
+ });
66879
+ (parentConfig.plugins || []).forEach((plugin)=>{
66880
+ if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin, treeshakeSharedExcludedPlugins)) finalPlugins.push(plugin);
66881
+ });
66882
+ plugins.forEach((plugin)=>{
66883
+ finalPlugins.push(plugin);
66884
+ });
66885
+ finalPlugins.push(extraPlugin);
66886
+ finalPlugins.push(new ConsumeSharedPlugin({
66887
+ consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66888
+ [key]: {
66889
+ import: extraOptions ? false : options.import,
66890
+ shareKey: options.shareKey || key,
66891
+ shareScope: options.shareScope,
66892
+ requiredVersion: options.requiredVersion,
66893
+ strictVersion: options.strictVersion,
66894
+ singleton: options.singleton,
66895
+ packageName: options.packageName,
66896
+ eager: options.eager
66897
+ }
66898
+ })),
66899
+ enhanced: true
66900
+ }));
66901
+ if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
66902
+ finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
66903
+ const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66904
+ const compilerConfig = {
66905
+ ...parentConfig,
66906
+ module: {
66907
+ ...parentConfig.module,
66908
+ rules: [
66909
+ {
66910
+ test: /virtual-entry\.js$/,
66911
+ type: "javascript/auto",
66912
+ resolve: {
66913
+ fullySpecified: false
66914
+ },
66915
+ use: {
66916
+ loader: "builtin:swc-loader"
66917
+ }
66918
+ },
66919
+ ...parentConfig.module?.rules || []
66920
+ ]
66921
+ },
66922
+ mode: parentConfig.mode || "development",
66923
+ entry: VirtualEntryPlugin.entry,
66924
+ output: {
66925
+ path: fullOutputDir,
66926
+ clean: true,
66927
+ publicPath: parentConfig.output?.publicPath || "auto"
66928
+ },
66929
+ plugins: finalPlugins,
66930
+ optimization: {
66931
+ ...parentConfig.optimization,
66932
+ splitChunks: false
66933
+ }
66934
+ };
66935
+ const compiler = rspack.rspack(compilerConfig);
66936
+ compiler.inputFileSystem = parentCompiler.inputFileSystem;
66937
+ compiler.outputFileSystem = parentCompiler.outputFileSystem;
66938
+ compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66939
+ const { currentShare } = extraOptions || {};
66940
+ return new Promise((resolve, reject)=>{
66941
+ compiler.run((err, stats)=>{
66942
+ if (err || stats?.hasErrors()) {
66943
+ const target = currentShare ? currentShare.shareName : "收集依赖";
66944
+ console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
66945
+ reject(err || new Error(`${target} 编译失败`));
66946
+ return;
66947
+ }
66948
+ currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
66949
+ if (stats) {
66950
+ currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
66951
+ console.log(stats.toString({
66952
+ colors: true,
66953
+ chunks: false,
66954
+ modules: false
66955
+ }));
66956
+ }
66957
+ resolve(extraPlugin.getData());
66958
+ });
66959
+ });
66960
+ }
66961
+ constructor(options){
66962
+ IndependentSharedPlugin_define_property(this, "mfName", void 0);
66963
+ IndependentSharedPlugin_define_property(this, "shared", void 0);
66964
+ IndependentSharedPlugin_define_property(this, "library", void 0);
66965
+ IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66966
+ IndependentSharedPlugin_define_property(this, "outputDir", void 0);
66967
+ IndependentSharedPlugin_define_property(this, "plugins", void 0);
66968
+ IndependentSharedPlugin_define_property(this, "treeshake", void 0);
66969
+ IndependentSharedPlugin_define_property(this, "manifest", void 0);
66970
+ IndependentSharedPlugin_define_property(this, "buildAssets", {});
66971
+ IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
66972
+ IndependentSharedPlugin_define_property(this, "treeshakeSharedExcludedPlugins", void 0);
66973
+ IndependentSharedPlugin_define_property(this, "name", "IndependentSharedPlugin");
66974
+ const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library, treeshakeSharedExcludedPlugins } = options;
66975
+ this.shared = shared;
66976
+ this.mfName = name;
66977
+ this.outputDir = outputDir || "independent-packages";
66978
+ this.plugins = plugins || [];
66979
+ this.treeshake = treeshake;
66980
+ this.manifest = manifest;
66981
+ this.injectUsedExports = injectUsedExports ?? true;
66982
+ this.library = library;
66983
+ this.treeshakeSharedExcludedPlugins = treeshakeSharedExcludedPlugins || [];
66984
+ this.sharedOptions = parseOptions(shared, (item, key)=>{
66985
+ if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66629
66986
  const config = item !== key && isRequiredVersion(item) ? {
66630
66987
  import: key,
66631
66988
  requiredVersion: item
@@ -66634,35 +66991,234 @@ class SharePlugin {
66634
66991
  };
66635
66992
  return config;
66636
66993
  }, (item)=>item);
66637
- const consumes = sharedOptions.map(([key, options])=>({
66638
- [key]: {
66639
- import: options.import,
66640
- shareKey: options.shareKey || key,
66641
- shareScope: options.shareScope,
66642
- requiredVersion: options.requiredVersion,
66643
- strictVersion: options.strictVersion,
66644
- singleton: options.singleton,
66645
- packageName: options.packageName,
66646
- eager: options.eager
66647
- }
66648
- }));
66649
- const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66650
- [options.import || key]: {
66651
- shareKey: options.shareKey || key,
66652
- shareScope: options.shareScope,
66653
- version: options.version,
66654
- eager: options.eager,
66655
- singleton: options.singleton,
66656
- requiredVersion: options.requiredVersion,
66657
- strictVersion: options.strictVersion
66658
- }
66659
- }));
66660
- this._shareScope = options.shareScope;
66661
- this._consumes = consumes;
66662
- this._provides = provides;
66663
- this._enhanced = options.enhanced ?? false;
66664
66994
  }
66665
66995
  }
66996
+ function TreeShakeSharedPlugin_define_property(obj, key, value) {
66997
+ if (key in obj) Object.defineProperty(obj, key, {
66998
+ value: value,
66999
+ enumerable: true,
67000
+ configurable: true,
67001
+ writable: true
67002
+ });
67003
+ else obj[key] = value;
67004
+ return obj;
67005
+ }
67006
+ class TreeShakeSharedPlugin {
67007
+ apply(compiler) {
67008
+ const { mfConfig, outputDir, plugins, reshake } = this;
67009
+ const { name, shared, library } = mfConfig;
67010
+ if (!shared) return;
67011
+ const sharedOptions = normalizeSharedOptions(shared);
67012
+ if (!sharedOptions.length) return;
67013
+ if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
67014
+ if (!reshake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
67015
+ this._independentSharePlugin = new IndependentSharedPlugin({
67016
+ name: name,
67017
+ shared: shared,
67018
+ outputDir,
67019
+ plugins,
67020
+ treeshake: reshake,
67021
+ library,
67022
+ manifest: mfConfig.manifest,
67023
+ treeshakeSharedExcludedPlugins: mfConfig.treeshakeSharedExcludedPlugins
67024
+ });
67025
+ this._independentSharePlugin.apply(compiler);
67026
+ }
67027
+ }
67028
+ get buildAssets() {
67029
+ return this._independentSharePlugin?.buildAssets || {};
67030
+ }
67031
+ constructor(options){
67032
+ TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
67033
+ TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
67034
+ TreeShakeSharedPlugin_define_property(this, "plugins", void 0);
67035
+ TreeShakeSharedPlugin_define_property(this, "reshake", void 0);
67036
+ TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
67037
+ TreeShakeSharedPlugin_define_property(this, "name", "TreeShakeSharedPlugin");
67038
+ const { mfConfig, plugins, reshake } = options;
67039
+ this.mfConfig = mfConfig;
67040
+ this.outputDir = mfConfig.independentShareDir || "independent-packages";
67041
+ this.plugins = plugins;
67042
+ this.reshake = Boolean(reshake);
67043
+ }
67044
+ }
67045
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
67046
+ function ModuleFederationPlugin_define_property(obj, key, value) {
67047
+ if (key in obj) Object.defineProperty(obj, key, {
67048
+ value: value,
67049
+ enumerable: true,
67050
+ configurable: true,
67051
+ writable: true
67052
+ });
67053
+ else obj[key] = value;
67054
+ return obj;
67055
+ }
67056
+ class ModuleFederationPlugin {
67057
+ apply(compiler) {
67058
+ const { webpack } = compiler;
67059
+ const paths = getPaths(this._options);
67060
+ compiler.options.resolve.alias = {
67061
+ "@module-federation/runtime-tools": paths.runtimeTools,
67062
+ "@module-federation/runtime": paths.runtime,
67063
+ ...compiler.options.resolve.alias
67064
+ };
67065
+ const sharedOptions = getSharedOptions(this._options);
67066
+ const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
67067
+ if (treeshakeEntries.length > 0) {
67068
+ this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
67069
+ mfConfig: this._options,
67070
+ reshake: false
67071
+ });
67072
+ this._treeShakeSharedPlugin.apply(compiler);
67073
+ }
67074
+ let runtimePluginApplied = false;
67075
+ compiler.hooks.beforeRun.tapPromise({
67076
+ name: "ModuleFederationPlugin",
67077
+ stage: 100
67078
+ }, async ()=>{
67079
+ if (runtimePluginApplied) return;
67080
+ runtimePluginApplied = true;
67081
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
67082
+ new ModuleFederationRuntimePlugin({
67083
+ entryRuntime
67084
+ }).apply(compiler);
67085
+ });
67086
+ compiler.hooks.watchRun.tapPromise({
67087
+ name: "ModuleFederationPlugin",
67088
+ stage: 100
67089
+ }, async ()=>{
67090
+ if (runtimePluginApplied) return;
67091
+ runtimePluginApplied = true;
67092
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
67093
+ new ModuleFederationRuntimePlugin({
67094
+ entryRuntime
67095
+ }).apply(compiler);
67096
+ });
67097
+ new webpack.container.ModuleFederationPluginV1({
67098
+ ...this._options,
67099
+ enhanced: true
67100
+ }).apply(compiler);
67101
+ if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
67102
+ }
67103
+ constructor(_options){
67104
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
67105
+ ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
67106
+ this._options = _options;
67107
+ }
67108
+ }
67109
+ function getRemoteInfos(options) {
67110
+ if (!options.remotes) return {};
67111
+ function extractUrlAndGlobal(urlAndGlobal) {
67112
+ const index = urlAndGlobal.indexOf("@");
67113
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
67114
+ return [
67115
+ urlAndGlobal.substring(index + 1),
67116
+ urlAndGlobal.substring(0, index)
67117
+ ];
67118
+ }
67119
+ function getExternalTypeFromExternal(external) {
67120
+ if (/^[a-z0-9-]+ /.test(external)) {
67121
+ const idx = external.indexOf(" ");
67122
+ return [
67123
+ external.slice(0, idx),
67124
+ external.slice(idx + 1)
67125
+ ];
67126
+ }
67127
+ return null;
67128
+ }
67129
+ function getExternal(external) {
67130
+ const result = getExternalTypeFromExternal(external);
67131
+ if (null === result) return [
67132
+ remoteType,
67133
+ external
67134
+ ];
67135
+ return result;
67136
+ }
67137
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
67138
+ const remotes = parseOptions(options.remotes, (item)=>({
67139
+ external: Array.isArray(item) ? item : [
67140
+ item
67141
+ ],
67142
+ shareScope: options.shareScope || "default"
67143
+ }), (item)=>({
67144
+ external: Array.isArray(item.external) ? item.external : [
67145
+ item.external
67146
+ ],
67147
+ shareScope: item.shareScope || options.shareScope || "default"
67148
+ }));
67149
+ const remoteInfos = {};
67150
+ for (const [key, config] of remotes)for (const external of config.external){
67151
+ const [externalType, externalRequest] = getExternal(external);
67152
+ remoteInfos[key] ??= [];
67153
+ if ("script" === externalType) {
67154
+ const [url, global] = extractUrlAndGlobal(externalRequest);
67155
+ remoteInfos[key].push({
67156
+ alias: key,
67157
+ name: global,
67158
+ entry: url,
67159
+ externalType,
67160
+ shareScope: config.shareScope
67161
+ });
67162
+ } else remoteInfos[key].push({
67163
+ alias: key,
67164
+ name: void 0,
67165
+ entry: void 0,
67166
+ externalType,
67167
+ shareScope: config.shareScope
67168
+ });
67169
+ }
67170
+ return remoteInfos;
67171
+ }
67172
+ function getRuntimePlugins(options) {
67173
+ return options.runtimePlugins ?? [];
67174
+ }
67175
+ function getSharedOptions(options) {
67176
+ if (!options.shared) return [];
67177
+ return parseOptions(options.shared, (item, key)=>{
67178
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
67179
+ return item !== key && isRequiredVersion(item) ? {
67180
+ import: key,
67181
+ requiredVersion: item
67182
+ } : {
67183
+ import: item
67184
+ };
67185
+ }, (item)=>item);
67186
+ }
67187
+ function getPaths(options) {
67188
+ return {
67189
+ runtimeTools: "@module-federation/runtime-tools",
67190
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
67191
+ runtime: "@module-federation/runtime"
67192
+ };
67193
+ }
67194
+ function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
67195
+ const runtimePlugins = getRuntimePlugins(options);
67196
+ const remoteInfos = getRemoteInfos(options);
67197
+ const runtimePluginImports = [];
67198
+ const runtimePluginVars = [];
67199
+ const libraryType = options.library?.type || "var";
67200
+ for(let i = 0; i < runtimePlugins.length; i++){
67201
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67202
+ const pluginSpec = runtimePlugins[i];
67203
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
67204
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
67205
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
67206
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
67207
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
67208
+ }
67209
+ const content = [
67210
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
67211
+ ...runtimePluginImports,
67212
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
67213
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67214
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67215
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
67216
+ `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
67217
+ `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
67218
+ '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 _ref;const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};var _ref1;const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};var _ref2;const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};var _ref3;const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};var _ref4;const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};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})}}'
67219
+ ].join(";");
67220
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67221
+ }
66666
67222
  function ContainerPlugin_define_property(obj, key, value) {
66667
67223
  if (key in obj) Object.defineProperty(obj, key, {
66668
67224
  value: value,
@@ -66698,7 +67254,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
66698
67254
  name: options.name,
66699
67255
  shareScope: options.shareScope || "default",
66700
67256
  library: options.library || {
66701
- type: "var",
67257
+ type: "global",
66702
67258
  name: options.name
66703
67259
  },
66704
67260
  runtime: options.runtime,
@@ -66835,7 +67391,7 @@ function transformSync(source, options) {
66835
67391
  const _options = JSON.stringify(options || {});
66836
67392
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
66837
67393
  }
66838
- const exports_rspackVersion = "1.7.0-canary-75cbc848-20251220203036";
67394
+ const exports_rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
66839
67395
  const exports_version = "5.75.0";
66840
67396
  const exports_WebpackError = Error;
66841
67397
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -66886,6 +67442,7 @@ const container = {
66886
67442
  };
66887
67443
  const sharing = {
66888
67444
  ProvideSharedPlugin: ProvideSharedPlugin,
67445
+ TreeShakeSharedPlugin: TreeShakeSharedPlugin,
66889
67446
  ConsumeSharedPlugin: ConsumeSharedPlugin,
66890
67447
  SharePlugin: SharePlugin
66891
67448
  };
@@ -66994,7 +67551,7 @@ function createCompiler(userOptions) {
66994
67551
  function isMultiRspackOptions(o) {
66995
67552
  return Array.isArray(o);
66996
67553
  }
66997
- function rspack(options, callback) {
67554
+ function rspack_rspack(options, callback) {
66998
67555
  try {
66999
67556
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
67000
67557
  else validateRspackConfig(options);
@@ -67044,7 +67601,7 @@ function rspack(options, callback) {
67044
67601
  return compiler;
67045
67602
  }
67046
67603
  }
67047
- const src_fn = Object.assign(rspack, exports_namespaceObject);
67604
+ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67048
67605
  src_fn.rspack = src_fn;
67049
67606
  src_fn.webpack = src_fn;
67050
67607
  const src_rspack_0 = src_fn;