@rspack-canary/browser 1.6.5-canary-1b7f543c-20251121112112 → 1.6.5-canary-5c09e49d-20251121173820

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
@@ -56803,6 +56803,10 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
56803
56803
  if (tag.attributes && "integrity" in tag.attributes) return;
56804
56804
  const tagSrc = getTagSrc(tag);
56805
56805
  if (!tagSrc) return;
56806
+ try {
56807
+ const url = new URL(tagSrc);
56808
+ if (("http:" === url.protocol || "https:" === url.protocol) && (!publicPath || !tagSrc.startsWith(publicPath))) return;
56809
+ } catch (_) {}
56806
56810
  const src = (0, path_browserify.relative)(publicPath, decodeURIComponent(tagSrc));
56807
56811
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || computeIntegrity(this.options.hashFuncNames, (0, browser_fs.readFileSync)((0, path_browserify.join)(outputPath, src)));
56808
56812
  tag.attributes.crossorigin = crossOriginLoading || "anonymous";
@@ -58137,7 +58141,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58137
58141
  if ("object" == typeof rspackFuture) {
58138
58142
  D(rspackFuture, "bundlerInfo", {});
58139
58143
  if ("object" == typeof rspackFuture.bundlerInfo) {
58140
- D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-1b7f543c-20251121112112");
58144
+ D(rspackFuture.bundlerInfo, "version", "1.6.5-canary-5c09e49d-20251121173820");
58141
58145
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58142
58146
  D(rspackFuture.bundlerInfo, "force", !library);
58143
58147
  }
@@ -62086,7 +62090,7 @@ class MultiStats {
62086
62090
  return obj;
62087
62091
  });
62088
62092
  if (childOptions.version) {
62089
- obj.rspackVersion = "1.6.5-canary-1b7f543c-20251121112112";
62093
+ obj.rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
62090
62094
  obj.version = "5.75.0";
62091
62095
  }
62092
62096
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63391,7 +63395,7 @@ const SIMPLE_EXTRACTORS = {
63391
63395
  },
63392
63396
  version: (object)=>{
63393
63397
  object.version = "5.75.0";
63394
- object.rspackVersion = "1.6.5-canary-1b7f543c-20251121112112";
63398
+ object.rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
63395
63399
  },
63396
63400
  env: (object, _compilation, _context, { _env })=>{
63397
63401
  object.env = _env;
@@ -65824,34 +65828,6 @@ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65824
65828
  function isRequiredVersion(str) {
65825
65829
  return VERSION_PATTERN_REGEXP.test(str);
65826
65830
  }
65827
- const encodeName = function(name, prefix = "", withExt = false) {
65828
- const ext = withExt ? ".js" : "";
65829
- return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
65830
- };
65831
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65832
- const array = (items)=>{
65833
- for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
65834
- else if (item && "object" == typeof item) object(item);
65835
- else throw new Error("Unexpected options format");
65836
- };
65837
- const object = (obj)=>{
65838
- for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65839
- };
65840
- if (!options) return;
65841
- if (Array.isArray(options)) array(options);
65842
- else if ("object" == typeof options) object(options);
65843
- else throw new Error("Unexpected options format");
65844
- };
65845
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65846
- const items = [];
65847
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65848
- items.push([
65849
- key,
65850
- value
65851
- ]);
65852
- });
65853
- return items;
65854
- };
65855
65831
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
65856
65832
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
65857
65833
  if (key in obj) Object.defineProperty(obj, key, {
@@ -65918,17 +65894,118 @@ function getFileName(manifestOptions) {
65918
65894
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
65919
65895
  };
65920
65896
  }
65921
- function resolveLibraryGlobalName(library) {
65922
- if (!library) return;
65923
- const libName = library.name;
65924
- if (!libName) return;
65925
- if ("string" == typeof libName) return libName;
65926
- if (Array.isArray(libName)) return libName[0];
65927
- if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
65897
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65898
+ raw(compiler) {
65899
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
65900
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
65901
+ const rawOptions = {
65902
+ name: this.opts.name,
65903
+ globalName: this.opts.globalName,
65904
+ fileName,
65905
+ filePath,
65906
+ manifestFileName,
65907
+ statsFileName,
65908
+ disableAssetsAnalyze,
65909
+ remoteAliasMap,
65910
+ exposes,
65911
+ shared,
65912
+ buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
65913
+ };
65914
+ return createBuiltinPlugin(this.name, rawOptions);
65915
+ }
65916
+ constructor(opts){
65917
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
65918
+ this.opts = opts;
65919
+ }
65920
+ }
65921
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65922
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65923
+ const array = (items)=>{
65924
+ for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
65925
+ else if (item && "object" == typeof item) object(item);
65926
+ else throw new Error("Unexpected options format");
65927
+ };
65928
+ const object = (obj)=>{
65929
+ for (const [key, value] of Object.entries(obj))"string" == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65930
+ };
65931
+ if (!options) return;
65932
+ if (Array.isArray(options)) array(options);
65933
+ else if ("object" == typeof options) object(options);
65934
+ else throw new Error("Unexpected options format");
65935
+ };
65936
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65937
+ const items = [];
65938
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65939
+ items.push([
65940
+ key,
65941
+ value
65942
+ ]);
65943
+ });
65944
+ return items;
65945
+ };
65946
+ function ModuleFederationPlugin_define_property(obj, key, value) {
65947
+ if (key in obj) Object.defineProperty(obj, key, {
65948
+ value: value,
65949
+ enumerable: true,
65950
+ configurable: true,
65951
+ writable: true
65952
+ });
65953
+ else obj[key] = value;
65954
+ return obj;
65955
+ }
65956
+ class ModuleFederationPlugin {
65957
+ apply(compiler) {
65958
+ const { webpack } = compiler;
65959
+ const paths = getPaths(this._options);
65960
+ compiler.options.resolve.alias = {
65961
+ "@module-federation/runtime-tools": paths.runtimeTools,
65962
+ "@module-federation/runtime": paths.runtime,
65963
+ ...compiler.options.resolve.alias
65964
+ };
65965
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
65966
+ new ModuleFederationRuntimePlugin({
65967
+ entryRuntime
65968
+ }).apply(compiler);
65969
+ new webpack.container.ModuleFederationPluginV1({
65970
+ ...this._options,
65971
+ enhanced: true
65972
+ }).apply(compiler);
65973
+ if (this._options.manifest) {
65974
+ const manifestOptions = true === this._options.manifest ? {} : {
65975
+ ...this._options.manifest
65976
+ };
65977
+ const containerName = manifestOptions.name ?? this._options.name;
65978
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
65979
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
65980
+ if (cur[1].length > 1) return sum;
65981
+ const remoteInfo = cur[1][0];
65982
+ const { entry, alias, name } = remoteInfo;
65983
+ if (entry && name) sum[alias] = {
65984
+ name,
65985
+ entry
65986
+ };
65987
+ return sum;
65988
+ }, {});
65989
+ const manifestExposes = collectManifestExposes(this._options.exposes);
65990
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65991
+ const manifestShared = collectManifestShared(this._options.shared);
65992
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65993
+ new ModuleFederationManifestPlugin({
65994
+ ...manifestOptions,
65995
+ name: containerName,
65996
+ globalName,
65997
+ remoteAliasMap
65998
+ }).apply(compiler);
65999
+ }
66000
+ }
66001
+ constructor(_options){
66002
+ ModuleFederationPlugin_define_property(this, "_options", void 0);
66003
+ this._options = _options;
66004
+ }
65928
66005
  }
65929
66006
  function collectManifestExposes(exposes) {
65930
66007
  if (!exposes) return;
65931
- const parsed = parseOptions(exposes, (value)=>({
66008
+ const parsed = parseOptions(exposes, (value, key)=>({
65932
66009
  import: Array.isArray(value) ? value : [
65933
66010
  value
65934
66011
  ],
@@ -65972,56 +66049,111 @@ function collectManifestShared(shared) {
65972
66049
  });
65973
66050
  return result.length > 0 ? result : void 0;
65974
66051
  }
65975
- function normalizeManifestOptions(mfConfig) {
65976
- const manifestOptions = true === mfConfig.manifest ? {} : {
65977
- ...mfConfig.manifest
65978
- };
65979
- const containerName = mfConfig.name;
65980
- const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
65981
- const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
65982
- if (cur[1].length > 1) return sum;
65983
- const remoteInfo = cur[1][0];
65984
- const { entry, alias, name } = remoteInfo;
65985
- if (entry && name) sum[alias] = {
65986
- name,
65987
- entry
65988
- };
65989
- return sum;
65990
- }, {});
65991
- const manifestExposes = collectManifestExposes(mfConfig.exposes);
65992
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65993
- const manifestShared = collectManifestShared(mfConfig.shared);
65994
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66052
+ function resolveLibraryGlobalName(library) {
66053
+ if (!library) return;
66054
+ const libName = library.name;
66055
+ if (!libName) return;
66056
+ if ("string" == typeof libName) return libName;
66057
+ if (Array.isArray(libName)) return libName[0];
66058
+ if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66059
+ }
66060
+ function getRemoteInfos(options) {
66061
+ if (!options.remotes) return {};
66062
+ function extractUrlAndGlobal(urlAndGlobal) {
66063
+ const index = urlAndGlobal.indexOf("@");
66064
+ if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66065
+ return [
66066
+ urlAndGlobal.substring(index + 1),
66067
+ urlAndGlobal.substring(0, index)
66068
+ ];
66069
+ }
66070
+ function getExternalTypeFromExternal(external) {
66071
+ if (/^[a-z0-9-]+ /.test(external)) {
66072
+ const idx = external.indexOf(" ");
66073
+ return [
66074
+ external.slice(0, idx),
66075
+ external.slice(idx + 1)
66076
+ ];
66077
+ }
66078
+ return null;
66079
+ }
66080
+ function getExternal(external) {
66081
+ const result = getExternalTypeFromExternal(external);
66082
+ if (null === result) return [
66083
+ remoteType,
66084
+ external
66085
+ ];
66086
+ return result;
66087
+ }
66088
+ const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66089
+ const remotes = parseOptions(options.remotes, (item)=>({
66090
+ external: Array.isArray(item) ? item : [
66091
+ item
66092
+ ],
66093
+ shareScope: options.shareScope || "default"
66094
+ }), (item)=>({
66095
+ external: Array.isArray(item.external) ? item.external : [
66096
+ item.external
66097
+ ],
66098
+ shareScope: item.shareScope || options.shareScope || "default"
66099
+ }));
66100
+ const remoteInfos = {};
66101
+ for (const [key, config] of remotes)for (const external of config.external){
66102
+ const [externalType, externalRequest] = getExternal(external);
66103
+ remoteInfos[key] ??= [];
66104
+ if ("script" === externalType) {
66105
+ const [url, global] = extractUrlAndGlobal(externalRequest);
66106
+ remoteInfos[key].push({
66107
+ alias: key,
66108
+ name: global,
66109
+ entry: url,
66110
+ externalType,
66111
+ shareScope: config.shareScope
66112
+ });
66113
+ } else remoteInfos[key].push({
66114
+ alias: key,
66115
+ name: void 0,
66116
+ entry: void 0,
66117
+ externalType,
66118
+ shareScope: config.shareScope
66119
+ });
66120
+ }
66121
+ return remoteInfos;
66122
+ }
66123
+ function getRuntimePlugins(options) {
66124
+ return options.runtimePlugins ?? [];
66125
+ }
66126
+ function getPaths(options) {
65995
66127
  return {
65996
- ...manifestOptions,
65997
- remoteAliasMap,
65998
- globalName,
65999
- name: containerName
66128
+ runtimeTools: "@module-federation/runtime-tools",
66129
+ bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66130
+ runtime: "@module-federation/runtime"
66000
66131
  };
66001
66132
  }
66002
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66003
- raw(compiler) {
66004
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66005
- const { statsFileName, manifestFileName } = getFileName(this.opts);
66006
- const rawOptions = {
66007
- name: this.opts.name,
66008
- globalName: this.opts.globalName,
66009
- fileName,
66010
- filePath,
66011
- manifestFileName,
66012
- statsFileName,
66013
- disableAssetsAnalyze,
66014
- remoteAliasMap,
66015
- exposes,
66016
- shared,
66017
- buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
66018
- };
66019
- return createBuiltinPlugin(this.name, rawOptions);
66020
- }
66021
- constructor(opts){
66022
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66023
- this.opts = normalizeManifestOptions(opts);
66133
+ function getDefaultEntryRuntime(paths, options, compiler) {
66134
+ const runtimePlugins = getRuntimePlugins(options);
66135
+ const remoteInfos = getRemoteInfos(options);
66136
+ const runtimePluginImports = [];
66137
+ const runtimePluginVars = [];
66138
+ for(let i = 0; i < runtimePlugins.length; i++){
66139
+ const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66140
+ const pluginSpec = runtimePlugins[i];
66141
+ const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66142
+ const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66143
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66144
+ const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66145
+ runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66024
66146
  }
66147
+ const content = [
66148
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66149
+ ...runtimePluginImports,
66150
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66151
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66152
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66153
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66154
+ '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})}}'
66155
+ ].join(";");
66156
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66025
66157
  }
66026
66158
  function ShareRuntimePlugin_define_property(obj, key, value) {
66027
66159
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66060,40 +66192,6 @@ function ConsumeSharedPlugin_define_property(obj, key, value) {
66060
66192
  else obj[key] = value;
66061
66193
  return obj;
66062
66194
  }
66063
- function normalizeConsumeShareOptions(consumes, shareScope) {
66064
- return parseOptions(consumes, (item, key)=>{
66065
- if (Array.isArray(item)) throw new Error("Unexpected array in options");
66066
- const result = item !== key && isRequiredVersion(item) ? {
66067
- import: key,
66068
- shareScope: shareScope || "default",
66069
- shareKey: key,
66070
- requiredVersion: item,
66071
- strictVersion: true,
66072
- packageName: void 0,
66073
- singleton: false,
66074
- eager: false
66075
- } : {
66076
- import: key,
66077
- shareScope: shareScope || "default",
66078
- shareKey: key,
66079
- requiredVersion: void 0,
66080
- packageName: void 0,
66081
- strictVersion: false,
66082
- singleton: false,
66083
- eager: false
66084
- };
66085
- return result;
66086
- }, (item, key)=>({
66087
- import: false === item.import ? void 0 : item.import || key,
66088
- shareScope: item.shareScope || shareScope || "default",
66089
- shareKey: item.shareKey || key,
66090
- requiredVersion: item.requiredVersion,
66091
- strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66092
- packageName: item.packageName,
66093
- singleton: !!item.singleton,
66094
- eager: !!item.eager
66095
- }));
66096
- }
66097
66195
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66098
66196
  raw(compiler) {
66099
66197
  new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -66109,12 +66207,43 @@ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66109
66207
  constructor(options){
66110
66208
  super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66111
66209
  this._options = {
66112
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66210
+ consumes: parseOptions(options.consumes, (item, key)=>{
66211
+ if (Array.isArray(item)) throw new Error("Unexpected array in options");
66212
+ const result = item !== key && isRequiredVersion(item) ? {
66213
+ import: key,
66214
+ shareScope: options.shareScope || "default",
66215
+ shareKey: key,
66216
+ requiredVersion: item,
66217
+ strictVersion: true,
66218
+ packageName: void 0,
66219
+ singleton: false,
66220
+ eager: false
66221
+ } : {
66222
+ import: key,
66223
+ shareScope: options.shareScope || "default",
66224
+ shareKey: key,
66225
+ requiredVersion: void 0,
66226
+ packageName: void 0,
66227
+ strictVersion: false,
66228
+ singleton: false,
66229
+ eager: false
66230
+ };
66231
+ return result;
66232
+ }, (item, key)=>({
66233
+ import: false === item.import ? void 0 : item.import || key,
66234
+ shareScope: item.shareScope || options.shareScope || "default",
66235
+ shareKey: item.shareKey || key,
66236
+ requiredVersion: item.requiredVersion,
66237
+ strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66238
+ packageName: item.packageName,
66239
+ singleton: !!item.singleton,
66240
+ eager: !!item.eager
66241
+ })),
66113
66242
  enhanced: options.enhanced ?? false
66114
66243
  };
66115
66244
  }
66116
66245
  }
66117
- function OptimizeDependencyReferencedExportsPlugin_define_property(obj, key, value) {
66246
+ function ProvideSharedPlugin_define_property(obj, key, value) {
66118
66247
  if (key in obj) Object.defineProperty(obj, key, {
66119
66248
  value: value,
66120
66249
  enumerable: true,
@@ -66124,70 +66253,6 @@ function OptimizeDependencyReferencedExportsPlugin_define_property(obj, key, val
66124
66253
  else obj[key] = value;
66125
66254
  return obj;
66126
66255
  }
66127
- class OptimizeDependencyReferencedExportsPlugin extends RspackBuiltinPlugin {
66128
- buildOptions() {
66129
- const shared = this.sharedOptions.map(([shareKey, config])=>({
66130
- shareKey,
66131
- treeshake: !!config.treeshake,
66132
- usedExports: config.usedExports
66133
- }));
66134
- const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66135
- return {
66136
- shared,
66137
- injectUsedExports: this.injectUsedExports,
66138
- manifestFileName,
66139
- statsFileName
66140
- };
66141
- }
66142
- raw() {
66143
- if (!this.sharedOptions.length) return;
66144
- return createBuiltinPlugin(this.name, this.buildOptions());
66145
- }
66146
- constructor(sharedOptions, injectUsedExports, manifestOptions){
66147
- super(), OptimizeDependencyReferencedExportsPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.OptimizeDependencyReferencedExportsPlugin), OptimizeDependencyReferencedExportsPlugin_define_property(this, "sharedOptions", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "injectUsedExports", void 0), OptimizeDependencyReferencedExportsPlugin_define_property(this, "manifestOptions", void 0);
66148
- this.sharedOptions = sharedOptions;
66149
- this.injectUsedExports = injectUsedExports ?? true;
66150
- this.manifestOptions = manifestOptions ?? {};
66151
- }
66152
- }
66153
- function ProvideSharedPlugin_define_property(obj, key, value) {
66154
- if (key in obj) Object.defineProperty(obj, key, {
66155
- value: value,
66156
- enumerable: true,
66157
- configurable: true,
66158
- writable: true
66159
- });
66160
- else obj[key] = value;
66161
- return obj;
66162
- }
66163
- function normalizeProvideShareOptions(options, shareScope, enhanced) {
66164
- return parseOptions(options, (item)=>{
66165
- if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66166
- return {
66167
- shareKey: item,
66168
- version: void 0,
66169
- shareScope: shareScope || "default",
66170
- eager: false
66171
- };
66172
- }, (item)=>{
66173
- const raw = {
66174
- shareKey: item.shareKey,
66175
- version: item.version,
66176
- shareScope: item.shareScope || shareScope || "default",
66177
- eager: !!item.eager
66178
- };
66179
- if (enhanced) {
66180
- const enhancedItem = item;
66181
- return {
66182
- ...raw,
66183
- singleton: enhancedItem.singleton,
66184
- requiredVersion: enhancedItem.requiredVersion,
66185
- strictVersion: enhancedItem.strictVersion
66186
- };
66187
- }
66188
- return raw;
66189
- });
66190
- }
66191
66256
  class ProvideSharedPlugin extends RspackBuiltinPlugin {
66192
66257
  raw(compiler) {
66193
66258
  new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
@@ -66199,7 +66264,32 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66199
66264
  }
66200
66265
  constructor(options){
66201
66266
  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);
66202
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66267
+ this._provides = parseOptions(options.provides, (item)=>{
66268
+ if (Array.isArray(item)) throw new Error("Unexpected array of provides");
66269
+ return {
66270
+ shareKey: item,
66271
+ version: void 0,
66272
+ shareScope: options.shareScope || "default",
66273
+ eager: false
66274
+ };
66275
+ }, (item)=>{
66276
+ const raw = {
66277
+ shareKey: item.shareKey,
66278
+ version: item.version,
66279
+ shareScope: item.shareScope || options.shareScope || "default",
66280
+ eager: !!item.eager
66281
+ };
66282
+ if (options.enhanced) {
66283
+ const enhancedItem = item;
66284
+ return {
66285
+ ...raw,
66286
+ singleton: enhancedItem.singleton,
66287
+ requiredVersion: enhancedItem.requiredVersion,
66288
+ strictVersion: enhancedItem.strictVersion
66289
+ };
66290
+ }
66291
+ return raw;
66292
+ });
66203
66293
  this._enhanced = options.enhanced;
66204
66294
  }
66205
66295
  }
@@ -66213,45 +66303,6 @@ function SharePlugin_define_property(obj, key, value) {
66213
66303
  else obj[key] = value;
66214
66304
  return obj;
66215
66305
  }
66216
- function normalizeSharedOptions(shared) {
66217
- return parseOptions(shared, (item, key)=>{
66218
- if ("string" != typeof item) throw new Error("Unexpected array in shared");
66219
- const config = item !== key && isRequiredVersion(item) ? {
66220
- import: key,
66221
- requiredVersion: item
66222
- } : {
66223
- import: item
66224
- };
66225
- return config;
66226
- }, (item)=>item);
66227
- }
66228
- function createProvideShareOptions(normalizedSharedOptions) {
66229
- return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66230
- [options.import || key]: {
66231
- shareKey: options.shareKey || key,
66232
- shareScope: options.shareScope,
66233
- version: options.version,
66234
- eager: options.eager,
66235
- singleton: options.singleton,
66236
- requiredVersion: options.requiredVersion,
66237
- strictVersion: options.strictVersion
66238
- }
66239
- }));
66240
- }
66241
- function createConsumeShareOptions(normalizedSharedOptions) {
66242
- return normalizedSharedOptions.map(([key, options])=>({
66243
- [key]: {
66244
- import: options.import,
66245
- shareKey: options.shareKey || key,
66246
- shareScope: options.shareScope,
66247
- requiredVersion: options.requiredVersion,
66248
- strictVersion: options.strictVersion,
66249
- singleton: options.singleton,
66250
- packageName: options.packageName,
66251
- eager: options.eager
66252
- }
66253
- }));
66254
- }
66255
66306
  class SharePlugin {
66256
66307
  apply(compiler) {
66257
66308
  new ConsumeSharedPlugin({
@@ -66264,386 +66315,14 @@ class SharePlugin {
66264
66315
  provides: this._provides,
66265
66316
  enhanced: this._enhanced
66266
66317
  }).apply(compiler);
66267
- const treeshakeOptions = this._sharedOptions.filter(([, config])=>config.treeshake);
66268
- if (treeshakeOptions.length > 0) new OptimizeDependencyReferencedExportsPlugin(treeshakeOptions).apply(compiler);
66269
66318
  }
66270
66319
  constructor(options){
66271
66320
  SharePlugin_define_property(this, "_shareScope", void 0);
66272
66321
  SharePlugin_define_property(this, "_consumes", void 0);
66273
66322
  SharePlugin_define_property(this, "_provides", void 0);
66274
66323
  SharePlugin_define_property(this, "_enhanced", void 0);
66275
- SharePlugin_define_property(this, "_sharedOptions", void 0);
66276
- const sharedOptions = normalizeSharedOptions(options.shared);
66277
- const consumes = createConsumeShareOptions(sharedOptions);
66278
- const provides = createProvideShareOptions(sharedOptions);
66279
- this._shareScope = options.shareScope;
66280
- this._consumes = consumes;
66281
- this._provides = provides;
66282
- this._enhanced = options.enhanced ?? false;
66283
- this._sharedOptions = sharedOptions;
66284
- }
66285
- }
66286
- function CollectShareEntryPlugin_define_property(obj, key, value) {
66287
- if (key in obj) Object.defineProperty(obj, key, {
66288
- value: value,
66289
- enumerable: true,
66290
- configurable: true,
66291
- writable: true
66292
- });
66293
- else obj[key] = value;
66294
- return obj;
66295
- }
66296
- const SHARE_ENTRY_ASSET = "collect-share-entries.json";
66297
- class CollectShareEntryPlugin extends RspackBuiltinPlugin {
66298
- getData() {
66299
- return this._collectedEntries;
66300
- }
66301
- getFilename() {
66302
- return SHARE_ENTRY_ASSET;
66303
- }
66304
- apply(compiler) {
66305
- super.apply(compiler);
66306
- compiler.hooks.thisCompilation.tap("Collect share entry", (compilation)=>{
66307
- compilation.hooks.processAssets.tapPromise({
66308
- name: "CollectShareEntry",
66309
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
66310
- }, async ()=>{
66311
- const filename = this.getFilename();
66312
- const asset = compilation.getAsset(filename);
66313
- if (!asset) throw new Error(`Can not get ${filename}`);
66314
- this._collectedEntries = JSON.parse(asset.source.source().toString());
66315
- compilation.deleteAsset(filename);
66316
- });
66317
- });
66318
- }
66319
- raw() {
66320
- const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66321
- const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66322
- const rawOptions = {
66323
- consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66324
- key,
66325
- ...v
66326
- })),
66327
- filename: this.getFilename()
66328
- };
66329
- return createBuiltinPlugin(this.name, rawOptions);
66330
- }
66331
- constructor(options){
66332
- super(), CollectShareEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectShareEntryPlugin), CollectShareEntryPlugin_define_property(this, "sharedOptions", void 0), CollectShareEntryPlugin_define_property(this, "_collectedEntries", void 0);
66333
- const { sharedOptions } = options;
66334
- this.sharedOptions = sharedOptions;
66335
- this._collectedEntries = {};
66336
- }
66337
- }
66338
- function ShareContainerPlugin_define_property(obj, key, value) {
66339
- if (key in obj) Object.defineProperty(obj, key, {
66340
- value: value,
66341
- enumerable: true,
66342
- configurable: true,
66343
- writable: true
66344
- });
66345
- else obj[key] = value;
66346
- return obj;
66347
- }
66348
- function assert(condition, msg) {
66349
- if (!condition) throw new Error(msg);
66350
- }
66351
- const HOT_UPDATE_SUFFIX = ".hot-update";
66352
- class ShareContainerPlugin extends RspackBuiltinPlugin {
66353
- getData() {
66354
- return [
66355
- this.name,
66356
- this._globalName
66357
- ];
66358
- }
66359
- raw(compiler) {
66360
- const { library } = this._options;
66361
- if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66362
- return createBuiltinPlugin(this.name, this._options);
66363
- }
66364
- apply(compiler) {
66365
- super.apply(compiler);
66366
- const shareName = this._shareName;
66367
- compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66368
- compilation.hooks.processAssets.tapPromise({
66369
- name: "getShareContainerFile"
66370
- }, async ()=>{
66371
- const remoteEntryPoint = compilation.entrypoints.get(shareName);
66372
- assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66373
- const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66374
- assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66375
- const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
66376
- assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66377
- assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
66378
- this.filename = files[0];
66379
- });
66380
- });
66381
- }
66382
- constructor(options){
66383
- super(), ShareContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ShareContainerPlugin), ShareContainerPlugin_define_property(this, "filename", ""), ShareContainerPlugin_define_property(this, "_options", void 0), ShareContainerPlugin_define_property(this, "_shareName", void 0), ShareContainerPlugin_define_property(this, "_globalName", void 0);
66384
- const { shareName, library, request, independentShareFileName } = options;
66385
- const version = options.version || "0.0.0";
66386
- this._globalName = encodeName(`${options.mfName}_${shareName}_${version}`);
66387
- const fileName = independentShareFileName || `${version}/share-entry.js`;
66388
- this._shareName = shareName;
66389
- this._options = {
66390
- name: shareName,
66391
- request: request,
66392
- library: (library ? {
66393
- ...library,
66394
- name: this._globalName
66395
- } : void 0) || {
66396
- type: "var",
66397
- name: this._globalName
66398
- },
66399
- version,
66400
- fileName
66401
- };
66402
- }
66403
- }
66404
- function IndependentSharePlugin_define_property(obj, key, value) {
66405
- if (key in obj) Object.defineProperty(obj, key, {
66406
- value: value,
66407
- enumerable: true,
66408
- configurable: true,
66409
- writable: true
66410
- });
66411
- else obj[key] = value;
66412
- return obj;
66413
- }
66414
- const VIRTUAL_ENTRY = "./virtual-entry.js";
66415
- const VIRTUAL_ENTRY_NAME = "virtual-entry";
66416
- const filterPlugin = (plugin)=>{
66417
- if (!plugin) return true;
66418
- const pluginName = plugin["name"] || plugin["constructor"]?.name;
66419
- if (!pluginName) return true;
66420
- return ![
66421
- "TreeshakeSharePlugin",
66422
- "IndependentSharePlugin",
66423
- "ModuleFederationPlugin",
66424
- "OptimizeDependencyReferencedExportsPlugin",
66425
- "HtmlWebpackPlugin"
66426
- ].includes(pluginName);
66427
- };
66428
- class VirtualEntryPlugin {
66429
- createEntry() {
66430
- const { sharedOptions } = this;
66431
- const entryContent = sharedOptions.reduce((acc, cur, index)=>`${acc}import shared_${index} from '${cur[0]}';\n`, "");
66432
- return entryContent;
66433
- }
66434
- static entry() {
66435
- return {
66436
- [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66437
- };
66438
- }
66439
- apply(compiler) {
66440
- new compiler.rspack.experiments.VirtualModulesPlugin({
66441
- [VIRTUAL_ENTRY]: this.createEntry()
66442
- }).apply(compiler);
66443
- compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
66444
- compilation.hooks.processAssets.tapPromise({
66445
- name: "RemoveVirtualEntryAsset",
66446
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66447
- }, async ()=>{
66448
- try {
66449
- const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66450
- chunk?.files.forEach((f)=>{
66451
- compilation.deleteAsset(f);
66452
- });
66453
- } catch (_e) {
66454
- console.error("Failed to remove virtual entry file!");
66455
- }
66456
- });
66457
- });
66458
- }
66459
- constructor(sharedOptions){
66460
- IndependentSharePlugin_define_property(this, "sharedOptions", void 0);
66461
- this.sharedOptions = sharedOptions;
66462
- }
66463
- }
66464
- class IndependentSharePlugin {
66465
- apply(compiler) {
66466
- compiler.hooks.beforeRun.tapAsync("IndependentSharePlugin", async (compiler, callback)=>{
66467
- await this.createIndependentCompilers(compiler);
66468
- callback();
66469
- });
66470
- compiler.hooks.shutdown.tapAsync("IndependentSharePlugin", (callback)=>{
66471
- this.cleanup();
66472
- console.log("cleanup");
66473
- callback();
66474
- });
66475
- compiler.hooks.compilation.tap("IndependentSharePlugin", (compilation)=>{
66476
- compilation.hooks.processAssets.tapPromise({
66477
- name: "injectBuildAssets",
66478
- stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66479
- }, async ()=>{
66480
- if (!this.manifest) return;
66481
- const { statsFileName } = getFileName(this.manifest);
66482
- const stats = compilation.getAsset(statsFileName);
66483
- if (!stats) return;
66484
- const statsContent = JSON.parse(stats.source.source().toString());
66485
- const { shared } = statsContent;
66486
- Object.entries(this.buildAssets).forEach(([key, item])=>{
66487
- const targetShared = shared.find((s)=>s.name === key);
66488
- if (!targetShared) return;
66489
- item.forEach(([entry, version, globalName])=>{
66490
- if (version === targetShared.version) {
66491
- targetShared.fallback = entry;
66492
- targetShared.fallbackName = globalName;
66493
- }
66494
- });
66495
- });
66496
- compilation.updateAsset(statsFileName, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66497
- });
66498
- });
66499
- }
66500
- async createIndependentCompilers(parentCompiler) {
66501
- const { sharedOptions, buildAssets } = this;
66502
- console.log("🚀 Start creating a standalone compiler...");
66503
- const parentOutputDir = parentCompiler.options.output.path ? (0, path_browserify.basename)(parentCompiler.options.output.path) : "";
66504
- const shareRequestsMap = await this.createIndependentCompiler(parentCompiler, parentOutputDir);
66505
- await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66506
- if (!shareConfig.treeshake || false === shareConfig.import) return;
66507
- const shareRequests = shareRequestsMap[shareName].requests;
66508
- await Promise.all(shareRequests.map(async ([request, version])=>{
66509
- const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66510
- const [shareFileName, globalName] = await this.createIndependentCompiler(parentCompiler, parentOutputDir, {
66511
- shareRequestsMap,
66512
- currentShare: {
66513
- shareName,
66514
- version,
66515
- request,
66516
- independentShareFileName: sharedConfig?.independentShareFileName
66517
- }
66518
- });
66519
- if ("string" == typeof shareFileName) {
66520
- buildAssets[shareName] ||= [];
66521
- buildAssets[shareName].push([
66522
- shareFileName,
66523
- version,
66524
- globalName
66525
- ]);
66526
- }
66527
- }));
66528
- }));
66529
- console.log("✅ All independent packages have been compiled successfully");
66530
- }
66531
- async createIndependentCompiler(parentCompiler, parentOutputDir, extraOptions) {
66532
- const { mfName, plugins, outputDir, outputFilePath, sharedOptions, treeshake, library } = this;
66533
- const outputDirWithShareName = outputFilePath || (0, path_browserify.join)(outputDir, encodeName(extraOptions?.currentShare?.shareName || ""));
66534
- const parentConfig = parentCompiler.options;
66535
- const finalPlugins = [];
66536
- const rspack = parentCompiler.rspack;
66537
- let extraPlugin;
66538
- extraPlugin = extraOptions ? new ShareContainerPlugin({
66539
- mfName,
66540
- library,
66541
- ...extraOptions.currentShare
66542
- }) : new CollectShareEntryPlugin({
66543
- sharedOptions,
66544
- shareScope: "default"
66545
- });
66546
- (parentConfig.plugins || []).forEach((plugin)=>{
66547
- if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin)) finalPlugins.push(plugin);
66548
- });
66549
- plugins.forEach((plugin)=>{
66550
- finalPlugins.push(plugin);
66551
- });
66552
- finalPlugins.push(extraPlugin);
66553
- finalPlugins.push(new ConsumeSharedPlugin({
66554
- consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66555
- [key]: {
66556
- import: extraOptions ? options.import : false,
66557
- shareKey: options.shareKey || key,
66558
- shareScope: options.shareScope,
66559
- requiredVersion: options.requiredVersion,
66560
- strictVersion: options.strictVersion,
66561
- singleton: options.singleton,
66562
- packageName: options.packageName,
66563
- eager: options.eager
66564
- }
66565
- })),
66566
- enhanced: true
66567
- }));
66568
- if (treeshake) finalPlugins.push(new OptimizeDependencyReferencedExportsPlugin(sharedOptions, this.injectUsedExports));
66569
- finalPlugins.push(new VirtualEntryPlugin(sharedOptions));
66570
- const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66571
- const compilerConfig = {
66572
- ...parentConfig,
66573
- mode: parentConfig.mode || "development",
66574
- entry: VirtualEntryPlugin.entry,
66575
- output: {
66576
- path: fullOutputDir,
66577
- clean: true,
66578
- publicPath: parentConfig.output?.publicPath || "auto"
66579
- },
66580
- plugins: finalPlugins,
66581
- optimization: {
66582
- ...parentConfig.optimization,
66583
- splitChunks: false
66584
- }
66585
- };
66586
- const compiler = rspack.rspack(compilerConfig);
66587
- compiler.inputFileSystem = parentCompiler.inputFileSystem;
66588
- compiler.outputFileSystem = parentCompiler.outputFileSystem;
66589
- compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66590
- const { currentShare } = extraOptions || {};
66591
- currentShare && this.compilers.set(`${currentShare.shareName}@${currentShare.version}`, compiler);
66592
- return new Promise((resolve, reject)=>{
66593
- compiler.run((err, stats)=>{
66594
- if (err || stats?.hasErrors()) {
66595
- const target = currentShare ? currentShare.shareName : "收集依赖";
66596
- console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
66597
- reject(err || new Error(`${target} 编译失败`));
66598
- return;
66599
- }
66600
- currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
66601
- if (stats) {
66602
- currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
66603
- console.log(stats.toString({
66604
- colors: true,
66605
- chunks: false,
66606
- modules: false
66607
- }));
66608
- }
66609
- resolve(extraPlugin.getData());
66610
- });
66611
- });
66612
- }
66613
- cleanup() {
66614
- this.compilers.forEach((compiler)=>{
66615
- if (compiler.watching) compiler.watching.close(()=>{
66616
- console.log("👋 编译器已关闭");
66617
- });
66618
- });
66619
- this.compilers.clear();
66620
- }
66621
- constructor(options){
66622
- IndependentSharePlugin_define_property(this, "mfName", void 0);
66623
- IndependentSharePlugin_define_property(this, "shared", void 0);
66624
- IndependentSharePlugin_define_property(this, "library", void 0);
66625
- IndependentSharePlugin_define_property(this, "sharedOptions", void 0);
66626
- IndependentSharePlugin_define_property(this, "outputDir", void 0);
66627
- IndependentSharePlugin_define_property(this, "outputFilePath", void 0);
66628
- IndependentSharePlugin_define_property(this, "plugins", void 0);
66629
- IndependentSharePlugin_define_property(this, "compilers", new Map());
66630
- IndependentSharePlugin_define_property(this, "treeshake", void 0);
66631
- IndependentSharePlugin_define_property(this, "manifest", void 0);
66632
- IndependentSharePlugin_define_property(this, "buildAssets", {});
66633
- IndependentSharePlugin_define_property(this, "injectUsedExports", void 0);
66634
- IndependentSharePlugin_define_property(this, "name", "IndependentSharePlugin");
66635
- const { outputDir, outputFilePath, plugins, treeshake, shared, name, manifest, injectUsedExports, library } = options;
66636
- this.shared = shared;
66637
- this.mfName = name;
66638
- this.outputDir = outputFilePath ? "" : outputDir || "independent-packages";
66639
- this.outputFilePath = outputFilePath;
66640
- this.plugins = plugins || [];
66641
- this.treeshake = treeshake;
66642
- this.manifest = manifest;
66643
- this.injectUsedExports = injectUsedExports ?? true;
66644
- this.library = library;
66645
- this.sharedOptions = parseOptions(shared, (item, key)=>{
66646
- if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66324
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66325
+ if ("string" != typeof item) throw new Error("Unexpected array in shared");
66647
66326
  const config = item !== key && isRequiredVersion(item) ? {
66648
66327
  import: key,
66649
66328
  requiredVersion: item
@@ -66652,174 +66331,35 @@ class IndependentSharePlugin {
66652
66331
  };
66653
66332
  return config;
66654
66333
  }, (item)=>item);
66334
+ const consumes = sharedOptions.map(([key, options])=>({
66335
+ [key]: {
66336
+ import: options.import,
66337
+ shareKey: options.shareKey || key,
66338
+ shareScope: options.shareScope,
66339
+ requiredVersion: options.requiredVersion,
66340
+ strictVersion: options.strictVersion,
66341
+ singleton: options.singleton,
66342
+ packageName: options.packageName,
66343
+ eager: options.eager
66344
+ }
66345
+ }));
66346
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66347
+ [options.import || key]: {
66348
+ shareKey: options.shareKey || key,
66349
+ shareScope: options.shareScope,
66350
+ version: options.version,
66351
+ eager: options.eager,
66352
+ singleton: options.singleton,
66353
+ requiredVersion: options.requiredVersion,
66354
+ strictVersion: options.strictVersion
66355
+ }
66356
+ }));
66357
+ this._shareScope = options.shareScope;
66358
+ this._consumes = consumes;
66359
+ this._provides = provides;
66360
+ this._enhanced = options.enhanced ?? false;
66655
66361
  }
66656
66362
  }
66657
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66658
- function ModuleFederationPlugin_define_property(obj, key, value) {
66659
- if (key in obj) Object.defineProperty(obj, key, {
66660
- value: value,
66661
- enumerable: true,
66662
- configurable: true,
66663
- writable: true
66664
- });
66665
- else obj[key] = value;
66666
- return obj;
66667
- }
66668
- class ModuleFederationPlugin {
66669
- apply(compiler) {
66670
- const { name, shared } = this._options;
66671
- const { webpack } = compiler;
66672
- const paths = getPaths(this._options);
66673
- compiler.options.resolve.alias = {
66674
- "@module-federation/runtime-tools": paths.runtimeTools,
66675
- "@module-federation/runtime": paths.runtime,
66676
- ...compiler.options.resolve.alias
66677
- };
66678
- const sharedOptions = getSharedOptions(this._options);
66679
- const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
66680
- if (treeshakeEntries.length > 0) {
66681
- this._independentSharePlugin = new IndependentSharePlugin({
66682
- name,
66683
- shared: shared || {},
66684
- outputFilePath: this._options.independentShareFilePath
66685
- });
66686
- this._independentSharePlugin.apply(compiler);
66687
- }
66688
- let runtimePluginApplied = false;
66689
- compiler.hooks.beforeRun.tapPromise({
66690
- name: "ModuleFederationPlugin",
66691
- stage: 100
66692
- }, async ()=>{
66693
- if (runtimePluginApplied) return;
66694
- runtimePluginApplied = true;
66695
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._independentSharePlugin?.buildAssets || {});
66696
- new ModuleFederationRuntimePlugin({
66697
- entryRuntime
66698
- }).apply(compiler);
66699
- });
66700
- new webpack.container.ModuleFederationPluginV1({
66701
- ...this._options,
66702
- enhanced: true
66703
- }).apply(compiler);
66704
- if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66705
- }
66706
- constructor(_options){
66707
- ModuleFederationPlugin_define_property(this, "_options", void 0);
66708
- ModuleFederationPlugin_define_property(this, "_independentSharePlugin", void 0);
66709
- this._options = _options;
66710
- }
66711
- }
66712
- function getRemoteInfos(options) {
66713
- if (!options.remotes) return {};
66714
- function extractUrlAndGlobal(urlAndGlobal) {
66715
- const index = urlAndGlobal.indexOf("@");
66716
- if (index <= 0 || index === urlAndGlobal.length - 1) return null;
66717
- return [
66718
- urlAndGlobal.substring(index + 1),
66719
- urlAndGlobal.substring(0, index)
66720
- ];
66721
- }
66722
- function getExternalTypeFromExternal(external) {
66723
- if (/^[a-z0-9-]+ /.test(external)) {
66724
- const idx = external.indexOf(" ");
66725
- return [
66726
- external.slice(0, idx),
66727
- external.slice(idx + 1)
66728
- ];
66729
- }
66730
- return null;
66731
- }
66732
- function getExternal(external) {
66733
- const result = getExternalTypeFromExternal(external);
66734
- if (null === result) return [
66735
- remoteType,
66736
- external
66737
- ];
66738
- return result;
66739
- }
66740
- const remoteType = options.remoteType || (options.library ? options.library.type : "script");
66741
- const remotes = parseOptions(options.remotes, (item)=>({
66742
- external: Array.isArray(item) ? item : [
66743
- item
66744
- ],
66745
- shareScope: options.shareScope || "default"
66746
- }), (item)=>({
66747
- external: Array.isArray(item.external) ? item.external : [
66748
- item.external
66749
- ],
66750
- shareScope: item.shareScope || options.shareScope || "default"
66751
- }));
66752
- const remoteInfos = {};
66753
- for (const [key, config] of remotes)for (const external of config.external){
66754
- const [externalType, externalRequest] = getExternal(external);
66755
- remoteInfos[key] ??= [];
66756
- if ("script" === externalType) {
66757
- const [url, global] = extractUrlAndGlobal(externalRequest);
66758
- remoteInfos[key].push({
66759
- alias: key,
66760
- name: global,
66761
- entry: url,
66762
- externalType,
66763
- shareScope: config.shareScope
66764
- });
66765
- } else remoteInfos[key].push({
66766
- alias: key,
66767
- name: void 0,
66768
- entry: void 0,
66769
- externalType,
66770
- shareScope: config.shareScope
66771
- });
66772
- }
66773
- return remoteInfos;
66774
- }
66775
- function getRuntimePlugins(options) {
66776
- return options.runtimePlugins ?? [];
66777
- }
66778
- function getSharedOptions(options) {
66779
- if (!options.shared) return [];
66780
- return parseOptions(options.shared, (item, key)=>{
66781
- if ("string" != typeof item) throw new Error("Unexpected array in shared");
66782
- return item !== key && isRequiredVersion(item) ? {
66783
- import: key,
66784
- requiredVersion: item
66785
- } : {
66786
- import: item
66787
- };
66788
- }, (item)=>item);
66789
- }
66790
- function getPaths(options) {
66791
- return {
66792
- runtimeTools: "@module-federation/runtime-tools",
66793
- bundlerRuntime: "@module-federation/webpack-bundler-runtime",
66794
- runtime: "@module-federation/runtime"
66795
- };
66796
- }
66797
- function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
66798
- const runtimePlugins = getRuntimePlugins(options);
66799
- const remoteInfos = getRemoteInfos(options);
66800
- const runtimePluginImports = [];
66801
- const runtimePluginVars = [];
66802
- for(let i = 0; i < runtimePlugins.length; i++){
66803
- const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
66804
- const pluginSpec = runtimePlugins[i];
66805
- const pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec;
66806
- const pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
66807
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
66808
- const paramsCode = void 0 === pluginParams ? "undefined" : JSON.stringify(pluginParams);
66809
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
66810
- }
66811
- const content = [
66812
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
66813
- ...runtimePluginImports,
66814
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(", ")}]`,
66815
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
66816
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
66817
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
66818
- `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
66819
- 'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;const shareFallbacks=__module_federation_share_fallbacks__||{};for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};const fallbackEntry=shareFallbacks[name];if(fallbackEntry){const fallbackUrl=(__webpack_require__.p||"")+fallbackEntry[1];options.fallbackName=fallbackEntry[0];shareConfig.fallback=fallbackUrl;options.fallback=function(){return __webpack_require__.federation.importExternal(fallbackUrl)}}if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);if(Object.keys(shareFallbacks).length){early(__webpack_require__.federation.bundlerRuntimeOptions,"sharedEntries",()=>shareFallbacks)}merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
66820
- ].join(";");
66821
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
66822
- }
66823
66363
  function ContainerPlugin_define_property(obj, key, value) {
66824
66364
  if (key in obj) Object.defineProperty(obj, key, {
66825
66365
  value: value,
@@ -66976,46 +66516,6 @@ class ModuleFederationPluginV1 {
66976
66516
  this._options = _options;
66977
66517
  }
66978
66518
  }
66979
- function TreeShakeSharePlugin_define_property(obj, key, value) {
66980
- if (key in obj) Object.defineProperty(obj, key, {
66981
- value: value,
66982
- enumerable: true,
66983
- configurable: true,
66984
- writable: true
66985
- });
66986
- else obj[key] = value;
66987
- return obj;
66988
- }
66989
- class TreeshakeSharePlugin {
66990
- apply(compiler) {
66991
- const { mfConfig, outputDir, plugins, reshake } = this;
66992
- const { name, shared, library } = mfConfig;
66993
- if (!shared) return;
66994
- const sharedOptions = normalizeSharedOptions(shared);
66995
- if (!sharedOptions.length) return;
66996
- if (!reshake) new OptimizeDependencyReferencedExportsPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
66997
- if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) new IndependentSharePlugin({
66998
- name: name,
66999
- shared: shared,
67000
- outputDir,
67001
- plugins,
67002
- treeshake: reshake,
67003
- library
67004
- }).apply(compiler);
67005
- }
67006
- constructor(options){
67007
- TreeShakeSharePlugin_define_property(this, "mfConfig", void 0);
67008
- TreeShakeSharePlugin_define_property(this, "outputDir", void 0);
67009
- TreeShakeSharePlugin_define_property(this, "plugins", void 0);
67010
- TreeShakeSharePlugin_define_property(this, "reshake", void 0);
67011
- TreeShakeSharePlugin_define_property(this, "name", "TreeshakeSharePlugin");
67012
- const { mfConfig, plugins, reshake } = options;
67013
- this.mfConfig = mfConfig;
67014
- this.outputDir = mfConfig.independentShareDir || "independent-packages";
67015
- this.plugins = plugins;
67016
- this.reshake = Boolean(reshake);
67017
- }
67018
- }
67019
66519
  async function minify(source, options) {
67020
66520
  const _options = JSON.stringify(options || {});
67021
66521
  return external_rspack_wasi_browser_js_["default"].minify(source, _options);
@@ -67032,7 +66532,7 @@ function transformSync(source, options) {
67032
66532
  const _options = JSON.stringify(options || {});
67033
66533
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67034
66534
  }
67035
- const exports_rspackVersion = "1.6.5-canary-1b7f543c-20251121112112";
66535
+ const exports_rspackVersion = "1.6.5-canary-5c09e49d-20251121173820";
67036
66536
  const exports_version = "5.75.0";
67037
66537
  const exports_WebpackError = Error;
67038
66538
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67083,10 +66583,6 @@ const container = {
67083
66583
  };
67084
66584
  const sharing = {
67085
66585
  ProvideSharedPlugin: ProvideSharedPlugin,
67086
- CollectShareEntryPlugin: CollectShareEntryPlugin,
67087
- TreeshakeSharePlugin: TreeshakeSharePlugin,
67088
- ShareContainerPlugin: ShareContainerPlugin,
67089
- OptimizeDependencyReferencedExportsPlugin: OptimizeDependencyReferencedExportsPlugin,
67090
66586
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67091
66587
  SharePlugin: SharePlugin
67092
66588
  };
@@ -67195,7 +66691,7 @@ function createCompiler(userOptions) {
67195
66691
  function isMultiRspackOptions(o) {
67196
66692
  return Array.isArray(o);
67197
66693
  }
67198
- function rspack_rspack(options, callback) {
66694
+ function rspack(options, callback) {
67199
66695
  try {
67200
66696
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
67201
66697
  else validateRspackConfig(options);
@@ -67245,7 +66741,7 @@ function rspack_rspack(options, callback) {
67245
66741
  return compiler;
67246
66742
  }
67247
66743
  }
67248
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
66744
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67249
66745
  src_fn.rspack = src_fn;
67250
66746
  src_fn.webpack = src_fn;
67251
66747
  const src_rspack_0 = src_fn;