@rspack-canary/browser 1.7.0-canary-22d591c5-20251222090400 → 1.7.0-canary-be5d0ef3-20251222175046

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
@@ -58210,7 +58210,6 @@ const applyExperimentsDefaults = (experiments, { development })=>{
58210
58210
  D(experiments.incremental, "emitAssets", true);
58211
58211
  }
58212
58212
  D(experiments, "rspackFuture", {});
58213
- D(experiments, "parallelCodeSplitting", false);
58214
58213
  D(experiments, "parallelLoader", false);
58215
58214
  D(experiments, "useInputFileSystem", false);
58216
58215
  D(experiments, "inlineConst", true);
@@ -58222,7 +58221,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58222
58221
  if ("object" == typeof rspackFuture) {
58223
58222
  D(rspackFuture, "bundlerInfo", {});
58224
58223
  if ("object" == typeof rspackFuture.bundlerInfo) {
58225
- D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-22d591c5-20251222090400");
58224
+ D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-be5d0ef3-20251222175046");
58226
58225
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58227
58226
  D(rspackFuture.bundlerInfo, "force", !library);
58228
58227
  }
@@ -59093,7 +59092,6 @@ const getNormalizedRspackOptions = (config)=>({
59093
59092
  experiments: nestedConfig(config.experiments, (experiments)=>{
59094
59093
  if (experiments.layers) util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")();
59095
59094
  if (false === experiments.topLevelAwait) util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")();
59096
- if (experiments.parallelCodeSplitting) util_default().deprecate(()=>{}, "`experiments.parallelCodeSplitting` config has been deprecated and will be removed in next minor. It has huge regression in some edge cases where the chunk graph has lots of cycles, we'll improve the performance of build_chunk_graph in the future instead")();
59097
59095
  if (experiments.lazyBarrel) util_default().deprecate(()=>{}, "`experiments.lazyBarrel` config has been deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
59098
59096
  if (experiments.inlineConst) util_default().deprecate(()=>{}, "`experiments.inlineConst` config has been deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
59099
59097
  if (experiments.inlineEnum) util_default().deprecate(()=>{}, "`experiments.inlineEnum` config has been deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Please remove this option from your Rspack configuration.")();
@@ -59129,7 +59127,6 @@ const getNormalizedRspackOptions = (config)=>({
59129
59127
  }),
59130
59128
  lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, (options)=>true === options ? {} : options),
59131
59129
  incremental: optionalNestedConfig(experiments.incremental, (options)=>getNormalizedIncrementalOptions(options)),
59132
- parallelCodeSplitting: experiments.parallelCodeSplitting,
59133
59130
  buildHttp: experiments.buildHttp,
59134
59131
  parallelLoader: experiments.parallelLoader,
59135
59132
  useInputFileSystem: experiments.useInputFileSystem
@@ -62382,7 +62379,7 @@ class MultiStats {
62382
62379
  return obj;
62383
62380
  });
62384
62381
  if (childOptions.version) {
62385
- obj.rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
62382
+ obj.rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
62386
62383
  obj.version = "5.75.0";
62387
62384
  }
62388
62385
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63698,7 +63695,7 @@ const SIMPLE_EXTRACTORS = {
63698
63695
  },
63699
63696
  version: (object)=>{
63700
63697
  object.version = "5.75.0";
63701
- object.rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
63698
+ object.rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
63702
63699
  },
63703
63700
  env: (object, _compilation, _context, { _env })=>{
63704
63701
  object.env = _env;
@@ -66131,34 +66128,6 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66131
66128
  function isRequiredVersion(str) {
66132
66129
  return VERSION_PATTERN_REGEXP.test(str);
66133
66130
  }
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
- };
66162
66131
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66163
66132
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66164
66133
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66208,10 +66177,6 @@ function getBuildInfo(isDev, root) {
66208
66177
  }
66209
66178
  function getFileName(manifestOptions) {
66210
66179
  if (!manifestOptions) return {
66211
- statsFileName: "",
66212
- manifestFileName: ""
66213
- };
66214
- if ("boolean" == typeof manifestOptions) return {
66215
66180
  statsFileName: STATS_FILE_NAME,
66216
66181
  manifestFileName: MANIFEST_FILE_NAME
66217
66182
  };
@@ -66229,13 +66194,114 @@ function getFileName(manifestOptions) {
66229
66194
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66230
66195
  };
66231
66196
  }
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;
66197
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66198
+ raw(compiler) {
66199
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66200
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66201
+ const rawOptions = {
66202
+ name: this.opts.name,
66203
+ globalName: this.opts.globalName,
66204
+ fileName,
66205
+ filePath,
66206
+ manifestFileName,
66207
+ statsFileName,
66208
+ disableAssetsAnalyze,
66209
+ remoteAliasMap,
66210
+ exposes,
66211
+ shared,
66212
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66213
+ };
66214
+ return createBuiltinPlugin(this.name, rawOptions);
66215
+ }
66216
+ constructor(opts){
66217
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66218
+ this.opts = opts;
66219
+ }
66220
+ }
66221
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66222
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66223
+ const array = (items)=>{
66224
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
66225
+ else if (item && "object" == typeof item) object(item);
66226
+ else throw new Error("Unexpected options format");
66227
+ };
66228
+ const object = (obj)=>{
66229
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66230
+ };
66231
+ if (!options) return;
66232
+ if (Array.isArray(options)) array(options);
66233
+ else if ("object" == typeof options) object(options);
66234
+ else throw new Error("Unexpected options format");
66235
+ };
66236
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66237
+ const items = [];
66238
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66239
+ items.push([
66240
+ key,
66241
+ value
66242
+ ]);
66243
+ });
66244
+ return items;
66245
+ };
66246
+ function ModuleFederationPlugin_define_property(obj, key, value) {
66247
+ if (key in obj) Object.defineProperty(obj, key, {
66248
+ value: value,
66249
+ enumerable: true,
66250
+ configurable: true,
66251
+ writable: true
66252
+ });
66253
+ else obj[key] = value;
66254
+ return obj;
66255
+ }
66256
+ class ModuleFederationPlugin {
66257
+ apply(compiler) {
66258
+ const { webpack } = compiler;
66259
+ const paths = getPaths(this._options);
66260
+ compiler.options.resolve.alias = {
66261
+ "@module-federation/runtime-tools": paths.runtimeTools,
66262
+ "@module-federation/runtime": paths.runtime,
66263
+ ...compiler.options.resolve.alias
66264
+ };
66265
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66266
+ new ModuleFederationRuntimePlugin({
66267
+ entryRuntime
66268
+ }).apply(compiler);
66269
+ new webpack.container.ModuleFederationPluginV1({
66270
+ ...this._options,
66271
+ enhanced: true
66272
+ }).apply(compiler);
66273
+ if (this._options.manifest) {
66274
+ const manifestOptions = true === this._options.manifest ? {} : {
66275
+ ...this._options.manifest
66276
+ };
66277
+ const containerName = manifestOptions.name ?? this._options.name;
66278
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66279
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66280
+ if (cur[1].length > 1) return sum;
66281
+ const remoteInfo = cur[1][0];
66282
+ const { entry, alias, name } = remoteInfo;
66283
+ if (entry && name) sum[alias] = {
66284
+ name,
66285
+ entry
66286
+ };
66287
+ return sum;
66288
+ }, {});
66289
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66290
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66291
+ const manifestShared = collectManifestShared(this._options.shared);
66292
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66293
+ new ModuleFederationManifestPlugin({
66294
+ ...manifestOptions,
66295
+ name: containerName,
66296
+ globalName,
66297
+ remoteAliasMap
66298
+ }).apply(compiler);
66299
+ }
66300
+ }
66301
+ constructor(_options){
66302
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
66303
+ this._options = _options;
66304
+ }
66239
66305
  }
66240
66306
  function collectManifestExposes(exposes) {
66241
66307
  if (!exposes) return;
@@ -66283,56 +66349,111 @@ function collectManifestShared(shared) {
66283
66349
  });
66284
66350
  return result.length > 0 ? result : void 0;
66285
66351
  }
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;
66352
+ function resolveLibraryGlobalName(library) {
66353
+ if (!library) return;
66354
+ const libName = library.name;
66355
+ if (!libName) return;
66356
+ if ("string" == typeof libName) return libName;
66357
+ if (Array.isArray(libName)) return libName[0];
66358
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66359
+ }
66360
+ function getRemoteInfos(options) {
66361
+ if (!options.remotes) return {};
66362
+ function extractUrlAndGlobal(urlAndGlobal) {
66363
+ const index = urlAndGlobal.indexOf("@");
66364
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66365
+ return [
66366
+ urlAndGlobal.substring(index + 1),
66367
+ urlAndGlobal.substring(0, index)
66368
+ ];
66369
+ }
66370
+ function getExternalTypeFromExternal(external) {
66371
+ if (/^[a-z0-9-]+ /.test(external)) {
66372
+ const idx = external.indexOf(" ");
66373
+ return [
66374
+ external.slice(0, idx),
66375
+ external.slice(idx + 1)
66376
+ ];
66377
+ }
66378
+ return null;
66379
+ }
66380
+ function getExternal(external) {
66381
+ const result = getExternalTypeFromExternal(external);
66382
+ if (null === result) return [
66383
+ remoteType,
66384
+ external
66385
+ ];
66386
+ return result;
66387
+ }
66388
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66389
+ const remotes = parseOptions(options.remotes, (item)=>({
66390
+ external: Array.isArray(item) ? item : [
66391
+ item
66392
+ ],
66393
+ shareScope: options.shareScope || "default"
66394
+ }), (item)=>({
66395
+ external: Array.isArray(item.external) ? item.external : [
66396
+ item.external
66397
+ ],
66398
+ shareScope: item.shareScope || options.shareScope || "default"
66399
+ }));
66400
+ const remoteInfos = {};
66401
+ for (const [key, config] of remotes)for (const external of config.external){
66402
+ const [externalType, externalRequest] = getExternal(external);
66403
+ remoteInfos[key] ??= [];
66404
+ if ("script" === externalType) {
66405
+ const [url, global] = extractUrlAndGlobal(externalRequest);
66406
+ remoteInfos[key].push({
66407
+ alias: key,
66408
+ name: global,
66409
+ entry: url,
66410
+ externalType,
66411
+ shareScope: config.shareScope
66412
+ });
66413
+ } else remoteInfos[key].push({
66414
+ alias: key,
66415
+ name: void 0,
66416
+ entry: void 0,
66417
+ externalType,
66418
+ shareScope: config.shareScope
66419
+ });
66420
+ }
66421
+ return remoteInfos;
66422
+ }
66423
+ function getRuntimePlugins(options) {
66424
+ return options.runtimePlugins ?? [];
66425
+ }
66426
+ function getPaths(options) {
66306
66427
  return {
66307
- ...manifestOptions,
66308
- remoteAliasMap,
66309
- globalName,
66310
- name: containerName
66428
+ runtimeTools: "@module-federation/runtime-tools",
66429
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66430
+ runtime: "@module-federation/runtime"
66311
66431
  };
66312
66432
  }
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);
66433
+ function getDefaultEntryRuntime(paths, options, compiler) {
66434
+ const runtimePlugins = getRuntimePlugins(options);
66435
+ const remoteInfos = getRemoteInfos(options);
66436
+ const runtimePluginImports = [];
66437
+ const runtimePluginVars = [];
66438
+ for(let i = 0; i < runtimePlugins.length; i++){
66439
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66440
+ const pluginSpec = runtimePlugins[i];
66441
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66442
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66443
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66444
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66445
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66335
66446
  }
66447
+ const content = [
66448
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66449
+ ...runtimePluginImports,
66450
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66451
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66452
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66453
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66454
+ '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})}}'
66455
+ ].join(";");
66456
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66336
66457
  }
66337
66458
  function ShareRuntimePlugin_define_property(obj, key, value) {
66338
66459
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66371,43 +66492,6 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66371
66492
  else obj[key] = value;
66372
66493
  return obj;
66373
66494
  }
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
- }
66411
66495
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66412
66496
  raw(compiler) {
66413
66497
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66423,7 +66507,38 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66423
66507
  constructor(options){
66424
66508
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66425
66509
  this._options = {
66426
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66510
+ consumes: parseOptions(options.consumes, (item, key)=>{
66511
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66512
+ const result = item !== key && isRequiredVersion(item) ? {
66513
+ import: key,
66514
+ shareScope: options.shareScope || "default",
66515
+ shareKey: key,
66516
+ requiredVersion: item,
66517
+ strictVersion: true,
66518
+ packageName: void 0,
66519
+ singleton: false,
66520
+ eager: false
66521
+ } : {
66522
+ import: key,
66523
+ shareScope: options.shareScope || "default",
66524
+ shareKey: key,
66525
+ requiredVersion: void 0,
66526
+ packageName: void 0,
66527
+ strictVersion: false,
66528
+ singleton: false,
66529
+ eager: false
66530
+ };
66531
+ return result;
66532
+ }, (item, key)=>({
66533
+ import: false === item.import ? void 0 : item.import || key,
66534
+ shareScope: item.shareScope || options.shareScope || "default",
66535
+ shareKey: item.shareKey || key,
66536
+ requiredVersion: item.requiredVersion,
66537
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66538
+ packageName: item.packageName,
66539
+ singleton: !!item.singleton,
66540
+ eager: !!item.eager
66541
+ })),
66427
66542
  enhanced: options.enhanced ?? false
66428
66543
  };
66429
66544
  }
@@ -66438,35 +66553,6 @@ function ProvideSharedPlugin_define_property(obj, key, value) {
66438
66553
  else obj[key] = value;
66439
66554
  return obj;
66440
66555
  }
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
66556
  class ProvideSharedPlugin extends RspackBuiltinPlugin {
66471
66557
  raw(compiler) {
66472
66558
  new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
@@ -66478,7 +66564,32 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66478
66564
  }
66479
66565
  constructor(options){
66480
66566
  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);
66481
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66567
+ this._provides = parseOptions(options.provides, (item)=>{
66568
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66569
+ return {
66570
+ shareKey: item,
66571
+ version: void 0,
66572
+ shareScope: options.shareScope || "default",
66573
+ eager: false
66574
+ };
66575
+ }, (item)=>{
66576
+ const raw = {
66577
+ shareKey: item.shareKey,
66578
+ version: item.version,
66579
+ shareScope: item.shareScope || options.shareScope || "default",
66580
+ eager: !!item.eager
66581
+ };
66582
+ if (options.enhanced) {
66583
+ const enhancedItem = item;
66584
+ return {
66585
+ ...raw,
66586
+ singleton: enhancedItem.singleton,
66587
+ requiredVersion: enhancedItem.requiredVersion,
66588
+ strictVersion: enhancedItem.strictVersion
66589
+ };
66590
+ }
66591
+ return raw;
66592
+ });
66482
66593
  this._enhanced = options.enhanced;
66483
66594
  }
66484
66595
  }
@@ -66492,47 +66603,6 @@ function SharePlugin_define_property(obj, key, value) {
66492
66603
  else obj[key] = value;
66493
66604
  return obj;
66494
66605
  }
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
- }
66536
66606
  class SharePlugin {
66537
66607
  apply(compiler) {
66538
66608
  new ConsumeSharedPlugin({
@@ -66551,438 +66621,8 @@ class SharePlugin {
66551
66621
  SharePlugin_define_property(this, "_consumes", void 0);
66552
66622
  SharePlugin_define_property(this, "_provides", void 0);
66553
66623
  SharePlugin_define_property(this, "_enhanced", void 0);
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}"`);
66624
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66625
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66986
66626
  const config = item !== key && isRequiredVersion(item) ? {
66987
66627
  import: key,
66988
66628
  requiredVersion: item
@@ -66991,234 +66631,35 @@ class IndependentSharedPlugin {
66991
66631
  };
66992
66632
  return config;
66993
66633
  }, (item)=>item);
66634
+ const consumes = sharedOptions.map(([key, options])=>({
66635
+ [key]: {
66636
+ import: options.import,
66637
+ shareKey: options.shareKey || key,
66638
+ shareScope: options.shareScope,
66639
+ requiredVersion: options.requiredVersion,
66640
+ strictVersion: options.strictVersion,
66641
+ singleton: options.singleton,
66642
+ packageName: options.packageName,
66643
+ eager: options.eager
66644
+ }
66645
+ }));
66646
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66647
+ [options.import || key]: {
66648
+ shareKey: options.shareKey || key,
66649
+ shareScope: options.shareScope,
66650
+ version: options.version,
66651
+ eager: options.eager,
66652
+ singleton: options.singleton,
66653
+ requiredVersion: options.requiredVersion,
66654
+ strictVersion: options.strictVersion
66655
+ }
66656
+ }));
66657
+ this._shareScope = options.shareScope;
66658
+ this._consumes = consumes;
66659
+ this._provides = provides;
66660
+ this._enhanced = options.enhanced ?? false;
66994
66661
  }
66995
66662
  }
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
- }
67222
66663
  function ContainerPlugin_define_property(obj, key, value) {
67223
66664
  if (key in obj) Object.defineProperty(obj, key, {
67224
66665
  value: value,
@@ -67254,7 +66695,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67254
66695
  name: options.name,
67255
66696
  shareScope: options.shareScope || "default",
67256
66697
  library: options.library || {
67257
- type: "global",
66698
+ type: "var",
67258
66699
  name: options.name
67259
66700
  },
67260
66701
  runtime: options.runtime,
@@ -67391,7 +66832,7 @@ function transformSync(source, options) {
67391
66832
  const _options = JSON.stringify(options || {});
67392
66833
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67393
66834
  }
67394
- const exports_rspackVersion = "1.7.0-canary-22d591c5-20251222090400";
66835
+ const exports_rspackVersion = "1.7.0-canary-be5d0ef3-20251222175046";
67395
66836
  const exports_version = "5.75.0";
67396
66837
  const exports_WebpackError = Error;
67397
66838
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67442,7 +66883,6 @@ const container = {
67442
66883
  };
67443
66884
  const sharing = {
67444
66885
  ProvideSharedPlugin: ProvideSharedPlugin,
67445
- TreeShakeSharedPlugin: TreeShakeSharedPlugin,
67446
66886
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67447
66887
  SharePlugin: SharePlugin
67448
66888
  };
@@ -67551,7 +66991,7 @@ function createCompiler(userOptions) {
67551
66991
  function isMultiRspackOptions(o) {
67552
66992
  return Array.isArray(o);
67553
66993
  }
67554
- function rspack_rspack(options, callback) {
66994
+ function rspack(options, callback) {
67555
66995
  try {
67556
66996
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
67557
66997
  else validateRspackConfig(options);
@@ -67601,7 +67041,7 @@ function rspack_rspack(options, callback) {
67601
67041
  return compiler;
67602
67042
  }
67603
67043
  }
67604
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67044
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67605
67045
  src_fn.rspack = src_fn;
67606
67046
  src_fn.webpack = src_fn;
67607
67047
  const src_rspack_0 = src_fn;