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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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-e27a87e9-20251209100543");
58193
+ D(rspackFuture.bundlerInfo, "version", "1.6.8-canary-a3066402-20251209142350");
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-e27a87e9-20251209100543";
62339
+ obj.rspackVersion = "1.6.8-canary-a3066402-20251209142350";
62340
62340
  obj.version = "5.75.0";
62341
62341
  }
62342
62342
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63612,10 +63612,15 @@ const SIMPLE_EXTRACTORS = {
63612
63612
  if (depthInCollapsedGroup > 0) depthInCollapsedGroup--;
63613
63613
  continue;
63614
63614
  }
63615
- const message = entry.args?.length ? util.format(entry.args[0], ...entry.args.slice(1)) : "";
63615
+ let message;
63616
+ if (entry.type === LogType.time) {
63617
+ const [label, first, second] = entry.args;
63618
+ if ("number" == typeof first && "number" == typeof second) message = `${label}: ${1000 * first + second / 1000000} ms`;
63619
+ }
63620
+ if (!message) message = entry.args?.length ? util.format(entry.args[0], ...entry.args.slice(1)) : "";
63616
63621
  const newEntry = {
63617
63622
  type,
63618
- message,
63623
+ message: message || "",
63619
63624
  trace: loggingTrace ? entry.trace : void 0,
63620
63625
  children: type === LogType.group || type === LogType.groupCollapsed ? [] : void 0
63621
63626
  };
@@ -63641,7 +63646,7 @@ const SIMPLE_EXTRACTORS = {
63641
63646
  },
63642
63647
  version: (object)=>{
63643
63648
  object.version = "5.75.0";
63644
- object.rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
63649
+ object.rspackVersion = "1.6.8-canary-a3066402-20251209142350";
63645
63650
  },
63646
63651
  env: (object, _compilation, _context, { _env })=>{
63647
63652
  object.env = _env;
@@ -66074,34 +66079,6 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66074
66079
  function isRequiredVersion(str) {
66075
66080
  return VERSION_PATTERN_REGEXP.test(str);
66076
66081
  }
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
- };
66105
66082
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66106
66083
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66107
66084
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66151,10 +66128,6 @@ function getBuildInfo(isDev, root) {
66151
66128
  }
66152
66129
  function getFileName(manifestOptions) {
66153
66130
  if (!manifestOptions) return {
66154
- statsFileName: "",
66155
- manifestFileName: ""
66156
- };
66157
- if ("boolean" == typeof manifestOptions) return {
66158
66131
  statsFileName: STATS_FILE_NAME,
66159
66132
  manifestFileName: MANIFEST_FILE_NAME
66160
66133
  };
@@ -66172,17 +66145,118 @@ function getFileName(manifestOptions) {
66172
66145
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66173
66146
  };
66174
66147
  }
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;
66148
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66149
+ raw(compiler) {
66150
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66151
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66152
+ const rawOptions = {
66153
+ name: this.opts.name,
66154
+ globalName: this.opts.globalName,
66155
+ fileName,
66156
+ filePath,
66157
+ manifestFileName,
66158
+ statsFileName,
66159
+ disableAssetsAnalyze,
66160
+ remoteAliasMap,
66161
+ exposes,
66162
+ shared,
66163
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66164
+ };
66165
+ return createBuiltinPlugin(this.name, rawOptions);
66166
+ }
66167
+ constructor(opts){
66168
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66169
+ this.opts = opts;
66170
+ }
66171
+ }
66172
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66173
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66174
+ const array = (items)=>{
66175
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66176
+ else if (item && "object" == typeof item) object(item);
66177
+ else throw new Error("Unexpected options format");
66178
+ };
66179
+ const object = (obj)=>{
66180
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66181
+ };
66182
+ if (!options) return;
66183
+ if (Array.isArray(options)) array(options);
66184
+ else if ("object" == typeof options) object(options);
66185
+ else throw new Error("Unexpected options format");
66186
+ };
66187
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66188
+ const items = [];
66189
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66190
+ items.push([
66191
+ key,
66192
+ value
66193
+ ]);
66194
+ });
66195
+ return items;
66196
+ };
66197
+ function ModuleFederationPlugin_define_property(obj, key, value) {
66198
+ if (key in obj) Object.defineProperty(obj, key, {
66199
+ value: value,
66200
+ enumerable: true,
66201
+ configurable: true,
66202
+ writable: true
66203
+ });
66204
+ else obj[key] = value;
66205
+ return obj;
66206
+ }
66207
+ class ModuleFederationPlugin {
66208
+ apply(compiler) {
66209
+ const { webpack } = compiler;
66210
+ const paths = getPaths(this._options);
66211
+ compiler.options.resolve.alias = {
66212
+ "@module-federation/runtime-tools": paths.runtimeTools,
66213
+ "@module-federation/runtime": paths.runtime,
66214
+ ...compiler.options.resolve.alias
66215
+ };
66216
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66217
+ new ModuleFederationRuntimePlugin({
66218
+ entryRuntime
66219
+ }).apply(compiler);
66220
+ new webpack.container.ModuleFederationPluginV1({
66221
+ ...this._options,
66222
+ enhanced: true
66223
+ }).apply(compiler);
66224
+ if (this._options.manifest) {
66225
+ const manifestOptions = true === this._options.manifest ? {} : {
66226
+ ...this._options.manifest
66227
+ };
66228
+ const containerName = manifestOptions.name ?? this._options.name;
66229
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66230
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66231
+ if (cur[1].length > 1) return sum;
66232
+ const remoteInfo = cur[1][0];
66233
+ const { entry, alias, name } = remoteInfo;
66234
+ if (entry && name) sum[alias] = {
66235
+ name,
66236
+ entry
66237
+ };
66238
+ return sum;
66239
+ }, {});
66240
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66241
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66242
+ const manifestShared = collectManifestShared(this._options.shared);
66243
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66244
+ new ModuleFederationManifestPlugin({
66245
+ ...manifestOptions,
66246
+ name: containerName,
66247
+ globalName,
66248
+ remoteAliasMap
66249
+ }).apply(compiler);
66250
+ }
66251
+ }
66252
+ constructor(_options){
66253
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
66254
+ this._options = _options;
66255
+ }
66182
66256
  }
66183
66257
  function collectManifestExposes(exposes) {
66184
66258
  if (!exposes) return;
66185
- const parsed = parseOptions(exposes, (value)=>({
66259
+ const parsed = parseOptions(exposes, (value, key)=>({
66186
66260
  import: Array.isArray(value) ? value : [
66187
66261
  value
66188
66262
  ],
@@ -66226,56 +66300,111 @@ function collectManifestShared(shared) {
66226
66300
  });
66227
66301
  return result.length > 0 ? result : void 0;
66228
66302
  }
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;
66303
+ function resolveLibraryGlobalName(library) {
66304
+ if (!library) return;
66305
+ const libName = library.name;
66306
+ if (!libName) return;
66307
+ if ("string" == typeof libName) return libName;
66308
+ if (Array.isArray(libName)) return libName[0];
66309
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66310
+ }
66311
+ function getRemoteInfos(options) {
66312
+ if (!options.remotes) return {};
66313
+ function extractUrlAndGlobal(urlAndGlobal) {
66314
+ const index = urlAndGlobal.indexOf("@");
66315
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66316
+ return [
66317
+ urlAndGlobal.substring(index + 1),
66318
+ urlAndGlobal.substring(0, index)
66319
+ ];
66320
+ }
66321
+ function getExternalTypeFromExternal(external) {
66322
+ if (/^[a-z0-9-]+ /.test(external)) {
66323
+ const idx = external.indexOf(" ");
66324
+ return [
66325
+ external.slice(0, idx),
66326
+ external.slice(idx + 1)
66327
+ ];
66328
+ }
66329
+ return null;
66330
+ }
66331
+ function getExternal(external) {
66332
+ const result = getExternalTypeFromExternal(external);
66333
+ if (null === result) return [
66334
+ remoteType,
66335
+ external
66336
+ ];
66337
+ return result;
66338
+ }
66339
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66340
+ const remotes = parseOptions(options.remotes, (item)=>({
66341
+ external: Array.isArray(item) ? item : [
66342
+ item
66343
+ ],
66344
+ shareScope: options.shareScope || "default"
66345
+ }), (item)=>({
66346
+ external: Array.isArray(item.external) ? item.external : [
66347
+ item.external
66348
+ ],
66349
+ shareScope: item.shareScope || options.shareScope || "default"
66350
+ }));
66351
+ const remoteInfos = {};
66352
+ for (const [key, config] of remotes)for (const external of config.external){
66353
+ const [externalType, externalRequest] = getExternal(external);
66354
+ remoteInfos[key] ??= [];
66355
+ if ("script" === externalType) {
66356
+ const [url, global] = extractUrlAndGlobal(externalRequest);
66357
+ remoteInfos[key].push({
66358
+ alias: key,
66359
+ name: global,
66360
+ entry: url,
66361
+ externalType,
66362
+ shareScope: config.shareScope
66363
+ });
66364
+ } else remoteInfos[key].push({
66365
+ alias: key,
66366
+ name: void 0,
66367
+ entry: void 0,
66368
+ externalType,
66369
+ shareScope: config.shareScope
66370
+ });
66371
+ }
66372
+ return remoteInfos;
66373
+ }
66374
+ function getRuntimePlugins(options) {
66375
+ return options.runtimePlugins ?? [];
66376
+ }
66377
+ function getPaths(options) {
66249
66378
  return {
66250
- ...manifestOptions,
66251
- remoteAliasMap,
66252
- globalName,
66253
- name: containerName
66379
+ runtimeTools: "@module-federation/runtime-tools",
66380
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66381
+ runtime: "@module-federation/runtime"
66254
66382
  };
66255
66383
  }
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);
66384
+ function getDefaultEntryRuntime(paths, options, compiler) {
66385
+ const runtimePlugins = getRuntimePlugins(options);
66386
+ const remoteInfos = getRemoteInfos(options);
66387
+ const runtimePluginImports = [];
66388
+ const runtimePluginVars = [];
66389
+ for(let i = 0; i < runtimePlugins.length; i++){
66390
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66391
+ const pluginSpec = runtimePlugins[i];
66392
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66393
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66394
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66395
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66396
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66278
66397
  }
66398
+ const content = [
66399
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66400
+ ...runtimePluginImports,
66401
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66402
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66403
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66404
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66405
+ '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})}}'
66406
+ ].join(";");
66407
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66279
66408
  }
66280
66409
  function ShareRuntimePlugin_define_property(obj, key, value) {
66281
66410
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66314,43 +66443,6 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66314
66443
  else obj[key] = value;
66315
66444
  return obj;
66316
66445
  }
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
- }
66354
66446
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66355
66447
  raw(compiler) {
66356
66448
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66366,7 +66458,38 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66366
66458
  constructor(options){
66367
66459
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66368
66460
  this._options = {
66369
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66461
+ consumes: parseOptions(options.consumes, (item, key)=>{
66462
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66463
+ const result = item !== key && isRequiredVersion(item) ? {
66464
+ import: key,
66465
+ shareScope: options.shareScope || "default",
66466
+ shareKey: key,
66467
+ requiredVersion: item,
66468
+ strictVersion: true,
66469
+ packageName: void 0,
66470
+ singleton: false,
66471
+ eager: false
66472
+ } : {
66473
+ import: key,
66474
+ shareScope: options.shareScope || "default",
66475
+ shareKey: key,
66476
+ requiredVersion: void 0,
66477
+ packageName: void 0,
66478
+ strictVersion: false,
66479
+ singleton: false,
66480
+ eager: false
66481
+ };
66482
+ return result;
66483
+ }, (item, key)=>({
66484
+ import: false === item.import ? void 0 : item.import || key,
66485
+ shareScope: item.shareScope || options.shareScope || "default",
66486
+ shareKey: item.shareKey || key,
66487
+ requiredVersion: item.requiredVersion,
66488
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66489
+ packageName: item.packageName,
66490
+ singleton: !!item.singleton,
66491
+ eager: !!item.eager
66492
+ })),
66370
66493
  enhanced: options.enhanced ?? false
66371
66494
  };
66372
66495
  }
@@ -66381,35 +66504,6 @@ function ProvideSharedPlugin_define_property(obj, key, value) {
66381
66504
  else obj[key] = value;
66382
66505
  return obj;
66383
66506
  }
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
66507
  class ProvideSharedPlugin extends RspackBuiltinPlugin {
66414
66508
  raw(compiler) {
66415
66509
  new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
@@ -66421,7 +66515,32 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66421
66515
  }
66422
66516
  constructor(options){
66423
66517
  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);
66424
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66518
+ this._provides = parseOptions(options.provides, (item)=>{
66519
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66520
+ return {
66521
+ shareKey: item,
66522
+ version: void 0,
66523
+ shareScope: options.shareScope || "default",
66524
+ eager: false
66525
+ };
66526
+ }, (item)=>{
66527
+ const raw = {
66528
+ shareKey: item.shareKey,
66529
+ version: item.version,
66530
+ shareScope: item.shareScope || options.shareScope || "default",
66531
+ eager: !!item.eager
66532
+ };
66533
+ if (options.enhanced) {
66534
+ const enhancedItem = item;
66535
+ return {
66536
+ ...raw,
66537
+ singleton: enhancedItem.singleton,
66538
+ requiredVersion: enhancedItem.requiredVersion,
66539
+ strictVersion: enhancedItem.strictVersion
66540
+ };
66541
+ }
66542
+ return raw;
66543
+ });
66425
66544
  this._enhanced = options.enhanced;
66426
66545
  }
66427
66546
  }
@@ -66435,47 +66554,6 @@ function SharePlugin_define_property(obj, key, value) {
66435
66554
  else obj[key] = value;
66436
66555
  return obj;
66437
66556
  }
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
- }
66479
66557
  class SharePlugin {
66480
66558
  apply(compiler) {
66481
66559
  new ConsumeSharedPlugin({
@@ -66494,411 +66572,8 @@ class SharePlugin {
66494
66572
  SharePlugin_define_property(this, "_consumes", void 0);
66495
66573
  SharePlugin_define_property(this, "_provides", void 0);
66496
66574
  SharePlugin_define_property(this, "_enhanced", void 0);
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}"`);
66575
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66576
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66902
66577
  const config = item !== key && isRequiredVersion(item) ? {
66903
66578
  import: key,
66904
66579
  requiredVersion: item
@@ -66907,222 +66582,35 @@ class IndependentSharedPlugin {
66907
66582
  };
66908
66583
  return config;
66909
66584
  }, (item)=>item);
66585
+ const consumes = sharedOptions.map(([key, options])=>({
66586
+ [key]: {
66587
+ import: options.import,
66588
+ shareKey: options.shareKey || key,
66589
+ shareScope: options.shareScope,
66590
+ requiredVersion: options.requiredVersion,
66591
+ strictVersion: options.strictVersion,
66592
+ singleton: options.singleton,
66593
+ packageName: options.packageName,
66594
+ eager: options.eager
66595
+ }
66596
+ }));
66597
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66598
+ [options.import || key]: {
66599
+ shareKey: options.shareKey || key,
66600
+ shareScope: options.shareScope,
66601
+ version: options.version,
66602
+ eager: options.eager,
66603
+ singleton: options.singleton,
66604
+ requiredVersion: options.requiredVersion,
66605
+ strictVersion: options.strictVersion
66606
+ }
66607
+ }));
66608
+ this._shareScope = options.shareScope;
66609
+ this._consumes = consumes;
66610
+ this._provides = provides;
66611
+ this._enhanced = options.enhanced ?? false;
66910
66612
  }
66911
66613
  }
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
- }
67126
66614
  function ContainerPlugin_define_property(obj, key, value) {
67127
66615
  if (key in obj) Object.defineProperty(obj, key, {
67128
66616
  value: value,
@@ -67158,7 +66646,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67158
66646
  name: options.name,
67159
66647
  shareScope: options.shareScope || "default",
67160
66648
  library: options.library || {
67161
- type: "global",
66649
+ type: "var",
67162
66650
  name: options.name
67163
66651
  },
67164
66652
  runtime: options.runtime,
@@ -67295,7 +66783,7 @@ function transformSync(source, options) {
67295
66783
  const _options = JSON.stringify(options || {});
67296
66784
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67297
66785
  }
67298
- const exports_rspackVersion = "1.6.7-canary-e27a87e9-20251209100543";
66786
+ const exports_rspackVersion = "1.6.8-canary-a3066402-20251209142350";
67299
66787
  const exports_version = "5.75.0";
67300
66788
  const exports_WebpackError = Error;
67301
66789
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67346,7 +66834,6 @@ const container = {
67346
66834
  };
67347
66835
  const sharing = {
67348
66836
  ProvideSharedPlugin: ProvideSharedPlugin,
67349
- TreeShakeSharedPlugin: TreeShakeSharedPlugin,
67350
66837
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67351
66838
  SharePlugin: SharePlugin
67352
66839
  };
@@ -67455,7 +66942,7 @@ function createCompiler(userOptions) {
67455
66942
  function isMultiRspackOptions(o) {
67456
66943
  return Array.isArray(o);
67457
66944
  }
67458
- function rspack_rspack(options, callback) {
66945
+ function rspack(options, callback) {
67459
66946
  try {
67460
66947
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
67461
66948
  else validateRspackConfig(options);
@@ -67505,7 +66992,7 @@ function rspack_rspack(options, callback) {
67505
66992
  return compiler;
67506
66993
  }
67507
66994
  }
67508
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
66995
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67509
66996
  src_fn.rspack = src_fn;
67510
66997
  src_fn.webpack = src_fn;
67511
66998
  const src_rspack_0 = src_fn;