@empjs/share 4.0.0-alpha.1 → 4.0.0-alpha.3
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/README.md +20 -0
- package/dist/plugins/rspack/share.d.ts +2 -0
- package/dist/plugins/rspack/types.d.ts +4 -0
- package/dist/rspack.js +1 -1
- package/dist/rspack.js.map +1 -1
- package/output/plugins/rspack/share.d.ts +2 -0
- package/output/plugins/rspack/types.d.ts +4 -0
- package/output/sdk.js +4 -4
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -116,6 +116,26 @@ pluginRspackEmpShare({
|
|
|
116
116
|
|
|
117
117
|
如果不传 `runtime.lib`,插件会把 `@empjs/share/library` 内置到构建入口;如果传入远程地址,插件会自动注入 `<script>` 并把 `@module-federation/runtime`、`@module-federation/sdk` external 到指定全局 runtime。
|
|
118
118
|
|
|
119
|
+
### `empRuntime.version`
|
|
120
|
+
|
|
121
|
+
`empRuntime.version: true` 会从当前项目 `package.json` 的 `name` 和 `version` 派生共享包实际名称,用于隔离同页多版本共享包:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
pluginRspackEmpShare({
|
|
125
|
+
name: 'bigolive-common',
|
|
126
|
+
empRuntime: {
|
|
127
|
+
version: true,
|
|
128
|
+
runtime: {
|
|
129
|
+
lib: 'http://localhost:2100/sdk.js',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
派生规则为 `` `${pkg.name}_${pkg.version}`.replace(/@/g, '').replace(/[^\w_]/g, '_') ``。启用后插件会把派生值同时用于 Module Federation `name`、Rspack `output.uniqueName`,并在业务未显式配置 `css.prifixName` 时用于 CSS Modules className 前缀。
|
|
136
|
+
|
|
137
|
+
该能力只接受布尔值,不支持手写版本号;缺少 `package.json` 的 `name` 或 `version` 时会回退到原有 `name` 行为。文件名仍是 `emp.js`,直接用 `scope@url/emp.js` 消费时需要使用派生后的实际 scope。
|
|
138
|
+
|
|
119
139
|
## `@empjs/share/sdk` 类型
|
|
120
140
|
|
|
121
141
|
业务代码推荐通过 `@empjs/share/sdk` 调用 Module Federation runtime:
|
package/dist/rspack.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as e}from"module";import{resolve as t}from"path";import{fileURLToPath as i}from"url";import{ModuleFederationPlugin as r}from"@module-federation/rspack";import{deepAssign as s,importJsVm as n}from"./227.js";import{shareForceRemote as o,shareGlobalVal as a,shareGlobalName as l}from"./607.js";function m(t,i){return e(t).resolve(i)}class u{apply(e){let{webpack:t}=e,i=n("import '@empjs/share/library'");new t.EntryPlugin(e.context,i,{name:void 0}).apply(e)}constructor(e){var t,i;i=void 0,(t="options")in this?Object.defineProperty(this,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):this[t]=i,this.options=e}}function h(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function p(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){h(e,t,i[t])})}return e}let f=/^([0-9a-zA-Z_\s]+)@(.*)/,c=["@empjs/share/sdk"];class b{setup(){this.resetRuntime(),this.resetFramework(),this.setMfName(),this.setMF(),this.injectGlobalVal(),this.injectFramework(),this.setShareLib(),this.setRuntimeLib(),this.injectToHtml(),this.setExternal()}injectToHtml(){let{store:e,injectHtml:t}=this;t.length>0&&e.injectTags(t,"EMPShare")}injectFramework(){if(this.fk&&this.fk.libs.length>0)return this.injectFkLibs(this.fk.libs);if(!this.op.empRuntime||!this.fk.lib)return;let{store:e,injectHtml:t}=this;if(this.fk.lib){let i=function(e,t,i="runtime"){if("string"==typeof e)if("runtime"===i)return`${e}/runtime${"development"===t?".development":""}.umd.js`;else return`${e}/${i}.${t}.umd.js`;if("object"==typeof e)if("development"===t)return e.dev;else return e.prod;return""}(this.fk.lib,e.mode,this.fk.entry);t.push({attributes:{src:i},tagName:"script"})}}injectFkLibs(e){e.map(e=>{if(e.endsWith(".css"))return this.injectHtml.push({attributes:{href:e,rel:"stylesheet"},tagName:"link"});this.injectHtml.push({attributes:{src:e},tagName:"script"})})}injectGlobalVal(){if(!this.op.empRuntime)return;let{empRuntime:e}=this.op,{injectHtml:t}=this,i=this.fk.global||(e.shareLib?"window":"");if(!1!==e.injectGlobalValToHtml&&this.rt.lib){let e={frameworkLib:i,runtimeLib:this.rt.global};this.fk.name&&"none"!==this.fk.name&&(e.framework=this.fk.name),t.push({tagName:"script",innerHTML:`window.${a}=${JSON.stringify(e)}`})}}resetFramework(){if(!this.op.empRuntime)return;let{framework:e,frameworkGlobal:t,frameworkLib:i}=this.op.empRuntime;this.fk={name:"none",version:0,entry:"",global:t||"",lib:i||"",libs:[]},"string"==typeof e?this.fk.name=e:"object"==typeof e&&Object.keys(e).length>0&&(e.entry=e.entry?e.entry:e.name,this.fk=s(this.fk,e))}resetRuntime(){var e;let{empRuntime:t}=this.op;if(!t)return;let i=t.runtimeGlobal||l,r=t.runtimeLib?t.runtimeLib:(null==(e=t.runtime)?void 0:e.lib)?t.runtime.lib:"";this.rt={lib:r,global:i}}setExternal(){if(!this.op.empRuntime)return;let{store:e,externalsLib:t}=this,{empRuntime:i}=this.op,{shareLib:r}=i,s=this.rt.lib?{"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"}:{},n={};for(let[e,t]of Object.entries(s))n[e]=`${this.rt.global}.${t}`;if("react"===this.fk.name&&!r&&this.fk.global){let e=this.fk.version,t={react:"React","react-dom":"ReactDOM"};for(let[e,i]of("reactRouter"===this.fk.entry&&(t["react-router-dom"]="ReactRouterDOM"),Object.entries(t)))n[e]=`${this.fk.global}.${i}`;[17,18,19].includes(e)&&(n["react-dom/client"]=this.fk.global,n["react/jsx-runtime"]=this.fk.global,n["react/jsx-dev-runtime"]=this.fk.global)}r&&t.map(e=>{"js"===e.type&&e.module&&e.global&&(n[e.module]=`${this.fk.global}.${e.global}`)}),i.setExternals&&i.setExternals(n,this.fk.global,this.rt.global),e.chain.merge({externals:n})}setRuntimeLib(){if(!this.op.empRuntime)return;let{shareLib:e}=this.op.empRuntime,{store:t,injectHtml:i}=this,{empRuntime:r}=this.op;this.rt.lib?("useFrameworkLib"!==this.rt.lib||e)&&i.push({tagName:"script",pos:"head",attributes:{src:this.rt.lib}}):t.chain.plugin("plugin-emp-share-framework").use(u,[r])}
|
|
1
|
+
import{createRequire as e}from"module";import{resolve as t}from"path";import{fileURLToPath as i}from"url";import{ModuleFederationPlugin as r}from"@module-federation/rspack";import{deepAssign as s,importJsVm as n}from"./227.js";import{shareForceRemote as o,shareGlobalVal as a,shareGlobalName as l}from"./607.js";function m(t,i){return e(t).resolve(i)}class u{apply(e){let{webpack:t}=e,i=n("import '@empjs/share/library'");new t.EntryPlugin(e.context,i,{name:void 0}).apply(e)}constructor(e){var t,i;i=void 0,(t="options")in this?Object.defineProperty(this,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):this[t]=i,this.options=e}}function h(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function p(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){h(e,t,i[t])})}return e}let f=/^([0-9a-zA-Z_\s]+)@(.*)/,c=["@empjs/share/sdk"];class b{setup(){this.resetRuntime(),this.resetFramework(),this.setMfName(),this.setMF(),this.injectGlobalVal(),this.injectFramework(),this.setShareLib(),this.setRuntimeLib(),this.injectToHtml(),this.setExternal()}injectToHtml(){let{store:e,injectHtml:t}=this;t.length>0&&e.injectTags(t,"EMPShare")}injectFramework(){if(this.fk&&this.fk.libs.length>0)return this.injectFkLibs(this.fk.libs);if(!this.op.empRuntime||!this.fk.lib)return;let{store:e,injectHtml:t}=this;if(this.fk.lib){let i=function(e,t,i="runtime"){if("string"==typeof e)if("runtime"===i)return`${e}/runtime${"development"===t?".development":""}.umd.js`;else return`${e}/${i}.${t}.umd.js`;if("object"==typeof e)if("development"===t)return e.dev;else return e.prod;return""}(this.fk.lib,e.mode,this.fk.entry);t.push({attributes:{src:i},tagName:"script"})}}injectFkLibs(e){e.map(e=>{if(e.endsWith(".css"))return this.injectHtml.push({attributes:{href:e,rel:"stylesheet"},tagName:"link"});this.injectHtml.push({attributes:{src:e},tagName:"script"})})}injectGlobalVal(){if(!this.op.empRuntime)return;let{empRuntime:e}=this.op,{injectHtml:t}=this,i=this.fk.global||(e.shareLib?"window":"");if(!1!==e.injectGlobalValToHtml&&this.rt.lib){let e={frameworkLib:i,runtimeLib:this.rt.global};this.fk.name&&"none"!==this.fk.name&&(e.framework=this.fk.name),t.push({tagName:"script",innerHTML:`window.${a}=${JSON.stringify(e)}`})}}resetFramework(){if(!this.op.empRuntime)return;let{framework:e,frameworkGlobal:t,frameworkLib:i}=this.op.empRuntime;this.fk={name:"none",version:0,entry:"",global:t||"",lib:i||"",libs:[]},"string"==typeof e?this.fk.name=e:"object"==typeof e&&Object.keys(e).length>0&&(e.entry=e.entry?e.entry:e.name,this.fk=s(this.fk,e))}resetRuntime(){var e;let{empRuntime:t}=this.op;if(!t)return;let i=t.runtimeGlobal||l,r=t.runtimeLib?t.runtimeLib:(null==(e=t.runtime)?void 0:e.lib)?t.runtime.lib:"";this.rt={lib:r,global:i}}setExternal(){if(!this.op.empRuntime)return;let{store:e,externalsLib:t}=this,{empRuntime:i}=this.op,{shareLib:r}=i,s=this.rt.lib?{"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"}:{},n={};for(let[e,t]of Object.entries(s))n[e]=`${this.rt.global}.${t}`;if("react"===this.fk.name&&!r&&this.fk.global){let e=this.fk.version,t={react:"React","react-dom":"ReactDOM"};for(let[e,i]of("reactRouter"===this.fk.entry&&(t["react-router-dom"]="ReactRouterDOM"),Object.entries(t)))n[e]=`${this.fk.global}.${i}`;[17,18,19].includes(e)&&(n["react-dom/client"]=this.fk.global,n["react/jsx-runtime"]=this.fk.global,n["react/jsx-dev-runtime"]=this.fk.global)}r&&t.map(e=>{"js"===e.type&&e.module&&e.global&&(n[e.module]=`${this.fk.global}.${e.global}`)}),i.setExternals&&i.setExternals(n,this.fk.global,this.rt.global),e.chain.merge({externals:n})}setRuntimeLib(){if(!this.op.empRuntime)return;let{shareLib:e}=this.op.empRuntime,{store:t,injectHtml:i}=this,{empRuntime:r}=this.op;this.rt.lib?("useFrameworkLib"!==this.rt.lib||e)&&i.push({tagName:"script",pos:"head",attributes:{src:this.rt.lib}}):t.chain.plugin("plugin-emp-share-framework").use(u,[r])}getVersionedShareName(){var e,t;let i=this.op.name?this.store.encodeVarName(this.op.name):null!=(e=this.store.empConfig.output.uniqueName)?e:"",r=this.store.pkg;return(null==(t=this.op.empRuntime)?void 0:t.version)===!0&&(null==r?void 0:r.name)&&r.version?{enabled:!0,baseName:i,effectiveName:`${r.name}_${r.version}`.replace(/@/g,"").replace(/[^\w_]/g,"_")}:{enabled:!1,baseName:i,effectiveName:i}}setCssModulesPrefix(e){var t;if(null==(t=this.store.empConfig.css)?void 0:t.prifixName)return;let i=this.store.isDev?`${e}-[id]-[local]-[hash:base64:8]`:`${e}-[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:i,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:i,esModule:!0}}}})}setMfName(){let e=this.getVersionedShareName();this.op.name=e.effectiveName,this.op.name!==this.store.empConfig.output.uniqueName&&this.store.chain.output.set("uniqueName",this.op.name),e.enabled&&this.setCssModulesPrefix(e.effectiveName)}setMF(){let e=this.op,{store:s}=this;if(e.name){this.setDtsRuntimePkgs();let a=s.deepAssign({filename:"emp.js"},e);if(a.empRuntime&&delete a.empRuntime,e.forceRemotes){var n;Object.keys(n=e.forceRemotes).length>0&&s.injectTags([{innerHTML:`window.${o} = ${JSON.stringify(n)};`,tagName:"script",pos:"head"}],"EMP_FORCE_REMOTES"),delete e.forceRemotes,null!=a.runtimePlugins||(a.runtimePlugins=[]),a.runtimePlugins.push(function(e){try{return m(t(process.cwd(),"package.json"),e)}catch(r){let t=function(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error().stack;if(!Array.isArray(e))return;let t=e.map(e=>{var t;return null==(t=e.getFileName)?void 0:t.call(e)}).find(e=>e&&!e.startsWith("node:")&&!e.startsWith("["));if(!t)return;return t.startsWith("file:")?i(t):t}finally{Error.prepareStackTrace=e}}();if(t)return m(t,e);throw r}}("@empjs/share/forceRemote"))}s.chain.plugin("plugin-emp-share").use(r,[a])}}setDtsRuntimePkgs(){if(!this.op.empRuntime||!1===this.op.dts)return;let e=!0===this.op.dts||null==this.op.dts?{}:p({},this.op.dts);if(!1===e.consumeTypes){this.op.dts=e;return}let t=!0===e.consumeTypes||null==e.consumeTypes?{}:p({},e.consumeTypes);t.runtimePkgs=function(e=[]){return Array.from(new Set([...c,...e]))}(t.runtimePkgs),e.consumeTypes=t,this.op.dts=e}setShareLib(){if(!this.op.empRuntime)return;let{shareLib:e}=this.op.empRuntime,{externalsLib:t,injectHtml:i}=this;if(e&&"object"==typeof e){for(let[i,r]of Object.entries(e)){let e={};if(e.module=i,"string"==typeof r){let i=r.match(f)||[];i.length>0?(e.global=i[1],e.entry=i[2]):(e.global="",e.entry=r),e.type="js",t.push(e),e={}}else Array.isArray(r)?r.map(i=>{if(i){if(i.split("?")[0].endsWith(".css"))e.entry=i,e.type="css";else{let t=i.match(f)||[];t.length>0?(e.global=t[1],e.entry=t[2]):(e.global="",e.entry=i),e.type="js"}t.push(e),e={}}}):"object"==typeof r&&r.entry&&(e.entry=r.entry,e.global=r.global,e.type=r.type,t.push(e),e={})}t.map(e=>{"js"===e.type?i.push({attributes:{src:e.entry},tagName:"script"}):"css"===e.type&&i.push({attributes:{href:e.entry,rel:"stylesheet"},tagName:"link"})})}}constructor(e,t){h(this,"op",void 0),h(this,"store",void 0),h(this,"injectHtml",[]),h(this,"externalsLib",[]),h(this,"fk",void 0),h(this,"rt",void 0),this.op=e||{},this.store=t}}function g(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){i(e);return}a.done?t(l):Promise.resolve(l).then(r,s)}let d=(e={})=>({name:"@empjs/share",rsConfig:t=>{var i;return(i=function*(){!0===e.manifest?e.manifest={fileName:"emp.json"}:"object"==typeof e.manifest&&(e.manifest=t.deepAssign({fileName:"emp.json"},e.manifest)),new b(e,t).setup()},function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(e){g(n,r,s,o,a,"next",e)}function a(e){g(n,r,s,o,a,"throw",e)}o(void 0)})})()}});export{externalReact}from"./171.js";export{externalVue}from"./68.js";export default d;export{d as pluginRspackEmpShare};
|
|
2
2
|
//# sourceMappingURL=rspack.js.map
|
package/dist/rspack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.js","sources":["../src/helper/resolvePackageExport.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/share.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/runtimePlugin/registerRemotes.ts","../src/plugins/rspack/index.ts"],"sourcesContent":["import {createRequire} from 'node:module'\nimport {resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getCurrentModuleFile(): string | undefined {\n const prepareStackTrace = Error.prepareStackTrace\n try {\n Error.prepareStackTrace = (_error, stack) => stack\n const stack = new Error().stack as unknown\n if (!Array.isArray(stack)) return\n\n const file = stack\n .map(callSite => callSite.getFileName?.())\n .find(fileName => fileName && !fileName.startsWith('node:') && !fileName.startsWith('['))\n\n if (!file) return\n return file.startsWith('file:') ? fileURLToPath(file) : file\n } finally {\n Error.prepareStackTrace = prepareStackTrace\n }\n}\n\nfunction resolveFrom(baseFile: string, specifier: string): string {\n return createRequire(baseFile).resolve(specifier)\n}\n\nexport function resolvePackageExport(specifier: string): string {\n try {\n return resolveFrom(resolve(process.cwd(), 'package.json'), specifier)\n } catch (error) {\n const currentModuleFile = getCurrentModuleFile()\n if (currentModuleFile) return resolveFrom(currentModuleFile, specifier)\n throw error\n }\n}\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName, shareGlobalVal} from 'src/helper/config'\nimport {resolvePackageExport} from 'src/helper/resolvePackageExport'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport {registerRemotes} from './runtimePlugin/registerRemotes'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nconst empShareRuntimeTypePkgs = ['@empjs/share/sdk']\n\nfunction mergeRuntimeTypePkgs(runtimePkgs: string[] = []) {\n return Array.from(new Set([...empShareRuntimeTypePkgs, ...runtimePkgs]))\n}\n\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `window.${shareGlobalVal}=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private setMfName() {\n if (this.op.name) {\n this.op.name = this.store.encodeVarName(this.op.name)\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n } else {\n this.op.name = this.store.empConfig.output.uniqueName\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n this.setDtsRuntimePkgs()\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n // manifest: false,\n // dts: false,\n // dev: {\n // disableDynamicRemoteTypeHints: true,\n // },\n },\n o,\n )\n //\n // if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n /**\n * 注册 forceRemotes\n */\n if (o.forceRemotes) {\n registerRemotes(store, o.forceRemotes)\n delete o.forceRemotes\n op.runtimePlugins ??= []\n op.runtimePlugins.push(resolvePackageExport('@empjs/share/forceRemote'))\n }\n // console.log('op', op)\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setDtsRuntimePkgs() {\n if (!this.op.empRuntime || this.op.dts === false) return\n\n const dts = this.op.dts === true || this.op.dts == null ? {} : {...(this.op.dts as any)}\n if (dts.consumeTypes === false) {\n this.op.dts = dts\n return\n }\n\n const consumeTypes = dts.consumeTypes === true || dts.consumeTypes == null ? {} : {...dts.consumeTypes}\n consumeTypes.runtimePkgs = mergeRuntimeTypePkgs(consumeTypes.runtimePkgs)\n dts.consumeTypes = consumeTypes\n this.op.dts = dts\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import {type GlobalStore} from '@empjs/cli'\nimport {shareForceRemote} from 'src/helper/config'\nimport {ForceRemoteOptions} from '../types'\n\nexport const registerRemotes = (store: GlobalStore, forceRemotes: ForceRemoteOptions) => {\n if (Object.keys(forceRemotes).length > 0) {\n store.injectTags(\n [\n {\n innerHTML: `window.${shareForceRemote} = ${JSON.stringify(forceRemotes)};`,\n tagName: 'script',\n pos: 'head',\n },\n ],\n 'EMP_FORCE_REMOTES',\n )\n }\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\nexport type {EMPPluginShareType}\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\nexport * from './types'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n"],"names":["resolveFrom","baseFile","specifier","createRequire","EmpShareRemoteLibPlugin","compiler","webpack","entry","importJsVm","undefined","op","exp","empShareRuntimeTypePkgs","EmpShare","store","injectHtml","url","getRuntimeLib","host","mode","libs","empRuntime","frameworkGlobal","injectData","shareGlobalVal","JSON","framework","frameworkLib","Object","deepAssign","_empRuntime_runtime","global","shareGlobalName","lib","externalsLib","shareLib","externalRuntime","externals","key","value","version","externalReact","v","o","forceRemotes","shareForceRemote","_op","resolvePackageExport","resolve","process","error","currentModuleFile","getCurrentModuleFile","prepareStackTrace","Error","_error","stack","Array","file","callSite","fileName","fileURLToPath","ModuleFederationPlugin","dts","consumeTypes","mergeRuntimeTypePkgs","runtimePkgs","Set","k","externalsItem","cb","vo","pluginRspackEmpShare","empShare"],"mappings":"oVAsBA,SAASA,EAAYC,CAAgB,CAAEC,CAAiB,EACtD,OAAOC,EAAcF,GAAU,OAAO,CAACC,EACzC,CCfO,MAAME,EAKX,MAAMC,CAAkB,CAAE,CACxB,GAAM,CAACC,QAAAA,CAAO,CAAC,CAAGD,EACZE,EAVDC,EADS,iCAYd,IAAIF,EAAQ,WAAW,CAACD,EAAS,OAAO,CAAEE,EAAO,CAC/C,KAAME,MACR,GAAG,KAAK,CAACJ,EACX,CATA,YAAYK,CAA0B,CAAE,K,MADxC,O,GAAA,kB,sBAAA,K,uDAAA,I,MAEE,IAAI,CAAC,OAAO,CAAGA,CACjB,CAQF,C,4bCLA,IAAMC,EAAM,0BACNC,EAA0B,CAAC,mBAAmB,AAM7C,OAAMC,EAeX,OAAQ,CACN,IAAI,CAAC,YAAY,GACjB,IAAI,CAAC,cAAc,GACnB,IAAI,CAAC,SAAS,GACd,IAAI,CAAC,KAAK,GACV,IAAI,CAAC,eAAe,GACpB,IAAI,CAAC,eAAe,GACpB,IAAI,CAAC,WAAW,GAChB,IAAI,CAAC,aAAa,GAClB,IAAI,CAAC,YAAY,GACjB,IAAI,CAAC,WAAW,EAClB,CACQ,cAAe,CACrB,GAAM,CAACC,MAAAA,CAAK,CAAEC,WAAAA,CAAU,CAAC,CAAG,IAAI,AAC5BA,CAAAA,EAAW,MAAM,CAAG,GACtBD,EAAM,UAAU,CAACC,EAAY,WAEjC,CACQ,iBAAkB,CACxB,GAAI,IAAI,C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E,EAI9B,OAAQ,eAAoC,EAAE,EA2E9C,OAAO,KAAP,QAwBA,OAAO,KAAP,QAjGE,IAAI,CAAC,EAAE,CAAGJ,GAAM,CAAC,EACjB,IAAI,CAAC,KAAK,CAAGI,CACf,CAoTF,C,oHGhVO,IAAM0D,EAAuB,CAAC7B,EAAwB,CAAC,CAAC,GACtD,EACL,KAAM,eACA,SAAS7B,Q,uBAET6B,AAAe,KAAfA,EAAE,QAAQ,CACZA,EAAE,QAAQ,CAAG,CACX,SAAU,UACZ,EACS,AAAsB,UAAtB,OAAOA,EAAE,QAAQ,EAC1BA,CAAAA,EAAE,QAAQ,CAAG7B,EAAM,UAAU,CAAC,CAAC,SAAU,UAAU,EAAG6B,EAAE,QAAQ,GAGlE8B,AADiB,IAAI5D,EAAS8B,EAAG7B,GACxB,KAAK,EAChB,E,+KACF,E,iHAEa0D,C"}
|
|
1
|
+
{"version":3,"file":"rspack.js","sources":["../src/helper/resolvePackageExport.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/share.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/runtimePlugin/registerRemotes.ts","../src/plugins/rspack/index.ts"],"sourcesContent":["import {createRequire} from 'node:module'\nimport {resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getCurrentModuleFile(): string | undefined {\n const prepareStackTrace = Error.prepareStackTrace\n try {\n Error.prepareStackTrace = (_error, stack) => stack\n const stack = new Error().stack as unknown\n if (!Array.isArray(stack)) return\n\n const file = stack\n .map(callSite => callSite.getFileName?.())\n .find(fileName => fileName && !fileName.startsWith('node:') && !fileName.startsWith('['))\n\n if (!file) return\n return file.startsWith('file:') ? fileURLToPath(file) : file\n } finally {\n Error.prepareStackTrace = prepareStackTrace\n }\n}\n\nfunction resolveFrom(baseFile: string, specifier: string): string {\n return createRequire(baseFile).resolve(specifier)\n}\n\nexport function resolvePackageExport(specifier: string): string {\n try {\n return resolveFrom(resolve(process.cwd(), 'package.json'), specifier)\n } catch (error) {\n const currentModuleFile = getCurrentModuleFile()\n if (currentModuleFile) return resolveFrom(currentModuleFile, specifier)\n throw error\n }\n}\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName, shareGlobalVal} from 'src/helper/config'\nimport {resolvePackageExport} from 'src/helper/resolvePackageExport'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport {registerRemotes} from './runtimePlugin/registerRemotes'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nconst empShareRuntimeTypePkgs = ['@empjs/share/sdk']\n\ntype VersionedShareName = {\n enabled: boolean\n baseName: string\n effectiveName: string\n}\n\nfunction mergeRuntimeTypePkgs(runtimePkgs: string[] = []) {\n return Array.from(new Set([...empShareRuntimeTypePkgs, ...runtimePkgs]))\n}\n\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `window.${shareGlobalVal}=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private getVersionedShareName(): VersionedShareName {\n const baseName = this.op.name ? this.store.encodeVarName(this.op.name) : (this.store.empConfig.output.uniqueName ?? '')\n const pkg = (this.store as GlobalStore & {pkg?: {name?: string; version?: string}}).pkg\n const shouldVersion = this.op.empRuntime?.version === true\n\n if (!shouldVersion || !pkg?.name || !pkg.version) {\n return {\n enabled: false,\n baseName,\n effectiveName: baseName,\n }\n }\n\n return {\n enabled: true,\n baseName,\n effectiveName: `${pkg.name}_${pkg.version}`.replace(/@/g, '').replace(/[^\\w_]/g, '_'),\n }\n }\n private setCssModulesPrefix(name: string) {\n if (this.store.empConfig.css?.prifixName) return\n\n const localIdentName = this.store.isDev ? `${name}-[id]-[local]-[hash:base64:8]` : `${name}-[local]-[hash:5]`\n\n this.store.chain.merge({\n module: {\n generator: {\n 'css/auto': {\n exportsConvention: 'as-is',\n exportsOnly: false,\n localIdentName,\n esModule: true,\n },\n 'css/module': {\n exportsConvention: 'as-is',\n exportsOnly: false,\n localIdentName,\n esModule: true,\n },\n },\n },\n })\n }\n private setMfName() {\n const name = this.getVersionedShareName()\n this.op.name = name.effectiveName\n\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n\n if (name.enabled) {\n this.setCssModulesPrefix(name.effectiveName)\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n this.setDtsRuntimePkgs()\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n // manifest: false,\n // dts: false,\n // dev: {\n // disableDynamicRemoteTypeHints: true,\n // },\n },\n o,\n )\n //\n // if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n /**\n * 注册 forceRemotes\n */\n if (o.forceRemotes) {\n registerRemotes(store, o.forceRemotes)\n delete o.forceRemotes\n op.runtimePlugins ??= []\n op.runtimePlugins.push(resolvePackageExport('@empjs/share/forceRemote'))\n }\n // console.log('op', op)\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setDtsRuntimePkgs() {\n if (!this.op.empRuntime || this.op.dts === false) return\n\n const dts = this.op.dts === true || this.op.dts == null ? {} : {...(this.op.dts as any)}\n if (dts.consumeTypes === false) {\n this.op.dts = dts\n return\n }\n\n const consumeTypes = dts.consumeTypes === true || dts.consumeTypes == null ? {} : {...dts.consumeTypes}\n consumeTypes.runtimePkgs = mergeRuntimeTypePkgs(consumeTypes.runtimePkgs)\n dts.consumeTypes = consumeTypes\n this.op.dts = dts\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import {type GlobalStore} from '@empjs/cli'\nimport {shareForceRemote} from 'src/helper/config'\nimport {ForceRemoteOptions} from '../types'\n\nexport const registerRemotes = (store: GlobalStore, forceRemotes: ForceRemoteOptions) => {\n if (Object.keys(forceRemotes).length > 0) {\n store.injectTags(\n [\n {\n innerHTML: `window.${shareForceRemote} = ${JSON.stringify(forceRemotes)};`,\n tagName: 'script',\n pos: 'head',\n },\n ],\n 'EMP_FORCE_REMOTES',\n )\n }\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\nexport type {EMPPluginShareType}\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\nexport * from './types'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n"],"names":["resolveFrom","baseFile","specifier","createRequire","EmpShareRemoteLibPlugin","compiler","webpack","entry","importJsVm","undefined","op","exp","empShareRuntimeTypePkgs","EmpShare","store","injectHtml","url","getRuntimeLib","host","mode","libs","empRuntime","frameworkGlobal","injectData","shareGlobalVal","JSON","framework","frameworkLib","Object","deepAssign","_empRuntime_runtime","global","shareGlobalName","lib","externalsLib","shareLib","externalRuntime","externals","key","value","version","externalReact","v","_this_store_empConfig_output_uniqueName","_this_op_empRuntime","baseName","pkg","name","_this_store_empConfig_css","localIdentName","o","forceRemotes","shareForceRemote","_op","resolvePackageExport","resolve","process","error","currentModuleFile","getCurrentModuleFile","prepareStackTrace","Error","_error","stack","Array","file","callSite","fileName","fileURLToPath","ModuleFederationPlugin","dts","consumeTypes","mergeRuntimeTypePkgs","runtimePkgs","Set","k","externalsItem","cb","vo","pluginRspackEmpShare","empShare"],"mappings":"oVAsBA,SAASA,EAAYC,CAAgB,CAAEC,CAAiB,EACtD,OAAOC,EAAcF,GAAU,OAAO,CAACC,EACzC,CCfO,MAAME,EAKX,MAAMC,CAAkB,CAAE,CACxB,GAAM,CAACC,QAAAA,CAAO,CAAC,CAAGD,EACZE,EAVDC,EADS,iCAYd,IAAIF,EAAQ,WAAW,CAACD,EAAS,OAAO,CAAEE,EAAO,CAC/C,KAAME,MACR,GAAG,KAAK,CAACJ,EACX,CATA,YAAYK,CAA0B,CAAE,K,MADxC,O,GAAA,kB,sBAAA,K,uDAAA,I,MAEE,IAA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CAC/BkC,EAAc,IAAI,CAAGlC,EAAE,IAAI,CAC3BR,EAAa,IAAI,CAAC0C,GAClBA,EAAgB,CAAC,EAErB,CAEA1C,EAAa,GAAG,CAACQ,AAAAA,IACXA,AAAW,OAAXA,EAAE,IAAI,CACR3B,EAAW,IAAI,CAAC,CACd,WAAY,CACV,IAAK2B,EAAE,KAAK,AACd,EACA,QAAS,QACX,GACSA,AAAW,QAAXA,EAAE,IAAI,EACf3B,EAAW,IAAI,CAAC,CACd,WAAY,CACV,KAAM2B,EAAE,KAAK,CACb,IAAK,YACP,EACA,QAAS,MACX,EAEJ,EACF,CACF,CAnWA,YAAYhC,CAAsB,CAAEI,CAAkB,CAAE,CAVxD,OAAQ,KAAR,QACA,OAAQ,QAAR,QAIA,OAAQ,aAAoB,EAAE,EAI9B,OAAQ,eAAoC,EAAE,EA2E9C,OAAO,KAAP,QAwBA,OAAO,KAAP,QAjGE,IAAI,CAAC,EAAE,CAAGJ,GAAM,CAAC,EACjB,IAAI,CAAC,KAAK,CAAGI,CACf,CAiWF,C,oHGnYO,IAAMiE,EAAuB,CAAC7B,EAAwB,CAAC,CAAC,GACtD,EACL,KAAM,eACA,SAASpC,Q,uBAEToC,AAAe,KAAfA,EAAE,QAAQ,CACZA,EAAE,QAAQ,CAAG,CACX,SAAU,UACZ,EACS,AAAsB,UAAtB,OAAOA,EAAE,QAAQ,EAC1BA,CAAAA,EAAE,QAAQ,CAAGpC,EAAM,UAAU,CAAC,CAAC,SAAU,UAAU,EAAGoC,EAAE,QAAQ,GAGlE8B,AADiB,IAAInE,EAASqC,EAAGpC,GACxB,KAAK,EAChB,E,+KACF,E,iHAEaiE,C"}
|
package/output/sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EMP_SHARE_RUNTIME=t():e.EMP_SHARE_RUNTIME=t()}(self,()=>(()=>{"use strict";var e,t={};t.d=(e,r,o)=>{var n=(r,o)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[o]:r[n]})};n(r,"get"),n(o,"value")},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};t.r(r),t.d(r,{MFRuntime:()=>o,MFSDK:()=>n});var o={};t.r(o),t.d(o,{Module:()=>t2,ModuleFederation:()=>rf,createInstance:()=>ru,getInstance:()=>rb,getRemoteEntry:()=>tV,getRemoteInfo:()=>tW,init:()=>rd,loadRemote:()=>rp,loadScript:()=>tf,loadScriptNode:()=>tg,loadShare:()=>ry,loadShareSync:()=>rg,preloadRemote:()=>rE,registerGlobalPlugins:()=>ee,registerPlugins:()=>rS,registerRemotes:()=>r_,registerShared:()=>rI});var n={};t.r(n),t.d(n,{BROWSER_LOG_KEY:()=>a,ENCODE_NAME_PREFIX:()=>d,EncodedNameTransformMap:()=>c,FederationModuleManifest:()=>i,MANIFEST_EXT:()=>".json",MFModuleType:()=>u,MODULE_DEVTOOL_IDENTIFIER:()=>m,ManifestFileName:()=>h,NameTransformMap:()=>l,NameTransformSymbol:()=>s,SEPARATOR:()=>":",StatsFileName:()=>f,TEMP_DIR:()=>p,TreeShakingStatus:()=>y,assert:()=>tt,bindLoggerToCompiler:()=>T,composeKeyWithSeparator:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EMP_SHARE_RUNTIME=t():e.EMP_SHARE_RUNTIME=t()}(self,()=>(()=>{"use strict";var e,t={};t.d=(e,r,o)=>{var n=(r,o)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,[o]:r[n]})};n(r,"get"),n(o,"value")},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};t.r(r),t.d(r,{MFRuntime:()=>o,MFSDK:()=>n});var o={};t.r(o),t.d(o,{Module:()=>t2,ModuleFederation:()=>rf,createInstance:()=>ru,getInstance:()=>rb,getRemoteEntry:()=>tV,getRemoteInfo:()=>tW,init:()=>rd,loadRemote:()=>rp,loadScript:()=>tf,loadScriptNode:()=>tg,loadShare:()=>ry,loadShareSync:()=>rg,preloadRemote:()=>rE,registerGlobalPlugins:()=>ee,registerPlugins:()=>rS,registerRemotes:()=>r_,registerShared:()=>rI});var n={};t.r(n),t.d(n,{BROWSER_LOG_KEY:()=>a,ENCODE_NAME_PREFIX:()=>d,EncodedNameTransformMap:()=>c,FederationModuleManifest:()=>i,MANIFEST_EXT:()=>".json",MFModuleType:()=>u,MODULE_DEVTOOL_IDENTIFIER:()=>m,ManifestFileName:()=>h,NameTransformMap:()=>l,NameTransformSymbol:()=>s,SEPARATOR:()=>":",StatsFileName:()=>f,TEMP_DIR:()=>p,TreeShakingStatus:()=>y,assert:()=>tt,bindLoggerToCompiler:()=>T,composeKeyWithSeparator:()=>e3,consumeSharedPlugin:()=>rA,containerPlugin:()=>rR,containerReferencePlugin:()=>rw,createInfrastructureLogger:()=>v,createLink:()=>th,createLogger:()=>w,createModuleFederationConfig:()=>rP,createScript:()=>tc,createScriptNode:()=>ty,decodeName:()=>e6,encodeName:()=>e5,error:()=>tr,generateExposeFilename:()=>e7,generateShareFilename:()=>e8,generateSnapshotFromManifest:()=>rr,getManifestFileName:()=>rn,getProcessEnv:()=>b,getResourceUrl:()=>te,inferAutoPublicPath:()=>rt,infrastructureLogger:()=>k,isBrowserEnv:()=>E,isBrowserEnvValue:()=>g,isDebugMode:()=>S,isManifestProvider:()=>ro,isReactNativeEnv:()=>_,isRequiredVersion:()=>ta,isStaticResourcesEqual:()=>tl,loadScript:()=>tf,loadScriptNode:()=>tg,logger:()=>A,moduleFederationPlugin:()=>rv,normalizeOptions:()=>rO,parseEntry:()=>e9,provideSharedPlugin:()=>rk,safeToString:()=>tn,safeWrapper:()=>ts,sharePlugin:()=>rT,simpleJoinRemoteEntry:()=>re,warn:()=>to});let i="federation-manifest.json",a="FEDERATION_DEBUG",s={AT:"@",HYPHEN:"-",SLASH:"/"},l={[s.AT]:"scope_",[s.HYPHEN]:"_",[s.SLASH]:"__"},c={[l[s.AT]]:s.AT,[l[s.HYPHEN]]:s.HYPHEN,[l[s.SLASH]]:s.SLASH},h="mf-manifest.json",f="mf-stats.json",u={NPM:"npm",APP:"app"},m="__MF_DEVTOOLS_MODULE_INFO__",d="ENCODE_NAME_PREFIX",p=".federation",y=((e={})[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e),g="u">typeof ENV_TARGET?"web"===ENV_TARGET:"u">typeof window&&void 0!==window.document;function E(){return g}function _(){return"u">typeof navigator&&navigator?.product==="ReactNative"}function S(){"u">typeof process&&process.env;try{if(g&&window.localStorage)return!!localStorage.getItem(a)}catch(e){}return!1}let b=function(){return"u">typeof process&&process.env?process.env:{}},I="[ Module Federation ]",$=console,N=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];var R=class{constructor(e,t=$){this.prefix=e,this.delegate=t??$}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??$}emit(e,t){let r=this.delegate,o=S()?function(){try{let e=Error().stack;if(!e)return;let[,...t]=e.split("\n"),r=t.filter(e=>!N.some(t=>e.includes(t)));if(!r.length)return;return`Stack trace:
|
|
2
2
|
${r.slice(0,5).join("\n")}`}catch{return}}():void 0,n=o?[...t,o]:t,i=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(let e of i){let t=r[e];if("function"==typeof t)return void t.call(r,this.prefix,...n)}for(let e of i){let t=$[e];if("function"==typeof t)return void t.call($,this.prefix,...n)}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){S()&&this.emit("debug",e)}};function w(e){return new R(e)}function v(e){let t=new R(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}function T(e,t,r){if(e.__mf_infrastructure_logger__&&t?.getInfrastructureLogger)try{let o=t.getInfrastructureLogger(r);o&&"object"==typeof o&&("function"==typeof o.log||"function"==typeof o.info||"function"==typeof o.warn||"function"==typeof o.error)&&e.setDelegate(o)}catch{e.setDelegate(void 0)}}let A=w(I),k=v(I),O=(e,t,r,o)=>{let n=[`${[t[e]]} #${e}`];return r&&n.push(`args: ${JSON.stringify(r)}`),n.push(`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`),o&&n.push(`Original Error Message:
|
|
3
|
-
${o}`),n.join("\n")},P="[ Federation Runtime ]",L=w(P);function M(e,t,r,o,n){e||(void 0!==r?x(t,r,o,void 0,n):x(t))}function x(e,t,r,o,n){if(void 0!==t){var i=O(e,t,r??{},o);throw Error(`${P}: ${i}`)}if(e instanceof Error)throw e.message.startsWith(P)||(e.message=`${P}: ${e.message}`),e;throw Error(`${P}: ${e}`)}function H(e){e instanceof Error&&(e.message.startsWith(P)||(e.message=`${P}: ${e.message}`)),L.warn(e)}function F(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function D(e){return void 0!==e.entry}function j(e){return!e.entry.includes(".json")}function C(e){return e&&"object"==typeof e}let U=Object.prototype.toString;function G(e){return Array.isArray(e)?e:[e]}function V(e){let t={url:"",type:"global",globalName:""};return g||_()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}let W="object"==typeof globalThis?globalThis:window,B=(()=>{try{return document.defaultView}catch{return W}})();function q(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function z(e,t){return Object.hasOwnProperty.call(e,t)}z(W,"__GLOBAL_LOADING_REMOTE_ENTRY__")||q(W,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});let K=W.__GLOBAL_LOADING_REMOTE_ENTRY__;function Y(e){z(e,"__VMOK__")&&!z(e,"__FEDERATION__")&&q(e,"__FEDERATION__",e.__VMOK__),z(e,"__FEDERATION__")||(q(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),q(e,"__VMOK__",e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}function J(e,t){if("string"==typeof t)if(e[t])return{value:e[t],key:t};else{for(let r of Object.keys(e)){let[o,n]=r.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}x(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}Y(W),Y(B);let X=e=>((e,t)=>{let r=J(t,F(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){let{version:t,...r}=e,o=F(r),n=J(B.__FEDERATION__.moduleInfo,o).value;if(n?.version===t)return n}})(e,B.__FEDERATION__.moduleInfo),Z=(e,t)=>{let r=F(e);return B.__FEDERATION__.moduleInfo[r]=t,B.__FEDERATION__.moduleInfo},Q=(e,t)=>{let r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:W[r]}},ee=e=>{let{__GLOBAL_PLUGIN__:t}=B.__FEDERATION__;e.forEach(e=>{-1===t.findIndex(t=>t.name===e.name)?t.push(e):H(`The plugin ${e.name} has been registered.`)})},et=e=>W.__FEDERATION__.__PRELOADED_MAP__.get(e),er=e=>W.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),eo="[0-9A-Za-z-]+",en=`(?:\\+(${eo}(?:\\.${eo})*))`,ei="0|[1-9]\\d*",ea="[0-9]+",es="\\d*[a-zA-Z-][a-zA-Z0-9-]*",el=`(?:${ea}|${es})`,ec=`(?:-?(${el}(?:\\.${el})*))`,eh=`(?:${ei}|${es})`,ef=`(?:-(${eh}(?:\\.${eh})*))`,eu=`${ei}|x|X|\\*`,em=`[v=\\s]*(${eu})(?:\\.(${eu})(?:\\.(${eu})(?:${ef})?${en}?)?)?`,ed=`^\\s*(${em})\\s+-\\s+(${em})\\s*$`,ep=`[v=\\s]*${`(${ea})\\.(${ea})\\.(${ea})`}${ec}?${en}?`,ey="((?:<|>)?=?)",eg=`(\\s*)${ey}\\s*(${ep}|${em})`,eE="(?:~>?)",e_=`(\\s*)${eE}\\s+`,eS="(?:\\^)",eb=`(\\s*)${eS}\\s+`,eI=`^${eS}${em}$`,e$=`v?${`(${ei})\\.(${ei})\\.(${ei})`}${ef}?${en}?`,eN=`^${eE}${em}$`,eR=`^${ey}\\s*${em}$`,ew=`^${ey}\\s*(${e$})$|^$`;function ev(e){return new RegExp(e)}function eT(e){return!e||"x"===e.toLowerCase()||"*"===e}function eA(...e){return t=>e.reduce((e,t)=>t(e),t)}function ek(e){return e.match(ev(ew))}function eO(e,t,r,o){let n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function eP(e){return e.replace(ev(ed),(e,t,r,o,n,i,a,s,l,c,h,f)=>(t=eT(r)?"":eT(o)?`>=${r}.0.0`:eT(n)?`>=${r}.${o}.0`:`>=${t}`,s=eT(l)?"":eT(c)?`<${Number(l)+1}.0.0-0`:eT(h)?`<${l}.${Number(c)+1}.0-0`:f?`<=${l}.${c}.${h}-${f}`:`<=${s}`,`${t} ${s}`.trim()))}function eL(e){return e.replace(ev(eg),"$1$2$3")}function eM(e){return e.replace(ev(e_),"$1~")}function ex(e){return e.replace(ev(eb),"$1^")}function eH(e){return e.trim().split(/\s+/).map(e=>e.replace(ev(eI),(e,t,r,o,n)=>{if(eT(t))return"";if(eT(r))return`>=${t}.0.0 <${Number(t)+1}.0.0-0`;if(eT(o))if("0"===t)return`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`;else return`>=${t}.${r}.0 <${Number(t)+1}.0.0-0`;if(n)if("0"!==t)return`>=${t}.${r}.${o}-${n} <${Number(t)+1}.0.0-0`;else if("0"===r)return`>=${t}.${r}.${o}-${n} <${t}.${r}.${Number(o)+1}-0`;else return`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`;if("0"===t)if("0"===r)return`>=${t}.${r}.${o} <${t}.${r}.${Number(o)+1}-0`;else return`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`;return`>=${t}.${r}.${o} <${Number(t)+1}.0.0-0`})).join(" ")}function eF(e){return e.trim().split(/\s+/).map(e=>e.replace(ev(eN),(e,t,r,o,n)=>eT(t)?"":eT(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:eT(o)?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:n?`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`)).join(" ")}function eD(e){return e.split(/\s+/).map(e=>e.trim().replace(ev(eR),(e,t,r,o,n,i)=>{let a=eT(r),s=a||eT(o),l=s||eT(n);if("="===t&&l&&(t=""),i="",a)if(">"===t||"<"===t)return"<0.0.0-0";else return"*";return t&&l?(s&&(o=0),n=0,">"===t?(t=">=",s?(r=Number(r)+1,o=0):o=Number(o)+1,n=0):"<="===t&&(t="<",s?r=Number(r)+1:o=Number(o)+1),"<"===t&&(i="-0"),`${t+r}.${o}.${n}${i}`):s?`>=${r}.0.0${i} <${Number(r)+1}.0.0-0`:l?`>=${r}.${o}.0${i} <${r}.${Number(o)+1}.0-0`:e})).join(" ")}function ej(e){return e.trim().replace(ev("(<|>)?=?\\s*\\*"),"")}function eC(e,t){return(e=Number(e)||e)>(t=Number(t)||t)?1:e===t?0:-1}function eU(e,t){return eC(e.major,t.major)||eC(e.minor,t.minor)||eC(e.patch,t.patch)||function(e,t){let{preRelease:r}=e,{preRelease:o}=t;if(void 0===r&&o)return 1;if(r&&void 0===o)return -1;if(void 0===r&&void 0===o)return 0;for(let e=0,t=r.length;e<=t;e++){let t=r[e],n=o[e];if(t!==n){if(void 0===t&&void 0===n)return 0;if(!t)return 1;if(!n)return -1;return eC(t,n)}}return 0}(e,t)}function eG(e,t){return e.version===t.version}function eV(e,t){if(!e)return!1;let r=ek(e);if(!r)return!1;let[,o,,n,i,a,s]=r,l={operator:o,version:eO(n,i,a,s),major:n,minor:i,patch:a,preRelease:s?.split(".")};for(let e of t.split("||")){let t=e.trim();if(!t||"*"===t||"x"===t)return!0;try{let e=eA(eP,eL,eM,ex)(t.trim()).split(/\s+/).join(" ");if(!e.trim())return!0;let r=e.split(" ").map(e=>eA(eH,eF,eD,ej)(e)).join(" ");if(!r.trim())return!0;let o=r.split(/\s+/).map(e=>e.trim().replace(ev("^\\s*>=\\s*0.0.0\\s*$"),"")).filter(Boolean);if(0===o.length)continue;let n=!0;for(let e of o){let t=ek(e);if(!t){n=!1;break}let[,r,,o,i,a,s]=t;if(!function(e,t){switch(e.operator){case"":case"=":return eG(e,t);case">":return 0>eU(e,t);case">=":return eG(e,t)||0>eU(e,t);case"<":return eU(e,t)>0;case"<=":return eG(e,t)||eU(e,t)>0;case void 0:return!0;default:return!1}}({operator:r,version:eO(o,i,a,s),major:o,minor:i,patch:a,preRelease:s?.split(".")},l)){n=!1;break}}if(n)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}let eW="default";function eB(e,t){let r=t.shared||{},o=t.name,n=Object.keys(r).reduce((e,n)=>{let i=G(r[n]);return e[n]=e[n]||[],i.forEach(r=>{var i;let a;e[n].push((i=t.shareStrategy,a="get"in r?r.get:"lib"in r?()=>Promise.resolve(r.lib):()=>Promise.resolve(()=>{x(`Cannot get shared "${n}" from "${o}": neither "get" nor "lib" is provided in the share config.`)}),r.shareConfig?.eager&&r.treeShaking?.mode&&x(`Invalid shared config for "${n}" from "${o}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:o,loading:null,...r,shareConfig:{requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1,...r.shareConfig},get:a,loaded:!!r?.loaded||"lib"in r||void 0,version:r.version??"0",scope:Array.isArray(r.scope)?r.scope:[r.scope??"default"],strategy:(r.strategy??i)||"version-first",treeShaking:r.treeShaking?{...r.treeShaking,mode:r.treeShaking.mode??"server-calc",status:r.treeShaking.status??y.UNKNOWN,useIn:[]}:void 0}))}),e},{}),i={...e.shared};return Object.keys(n).forEach(e=>{i[e]?n[e].forEach(t=>{i[e].find(e=>e.version===t.version)||i[e].push(t)}):i[e]=n[e]}),{allShareInfos:i,newShareInfos:n}}function eq(e,t){if(!e)return!1;let{status:r,mode:o}=e;return r!==y.NO_USE&&(r===y.CALCULATED||"runtime-infer"===o&&(!t||eJ(e,t)))}function ez(e,t){let r=e=>{if(!Number.isNaN(Number(e))){let t=e.split("."),r=e;for(let e=0;e<3-t.length;e++)r+=".0";return r}return e};return!!eV(r(e),`<=${r(t)}`)}let eK=(e,t)=>{let r=t||function(e,t){return ez(e,t)};return Object.keys(e).reduce((e,t)=>!e||r(e,t)||"0"===e?t:e,0)},eY=e=>!!e.loaded||"function"==typeof e.lib,eJ=(e,t)=>{if(!e||!t)return!1;let{usedExports:r}=e;return!!r&&!!t.every(e=>r.includes(e))},eX=e=>eY(e)||!!e.loading;function eZ(e,t,r,o){if(!e)return;let{shareConfig:n,scope:i=eW,strategy:a,treeShaking:s}=r;for(let l of Array.isArray(i)?i:[i])if(n&&e[l]&&e[l][t]){let{requiredVersion:i}=n,{version:c,useTreesShaking:h}=("loaded-first"===a?function(e,t,r,o){let n=e[t][r],i="",a=eq(o),s=function(e,t){if(a){if(!n[e].treeShaking)return!0;if(!n[t].treeShaking)return!1;if(eX(n[t].treeShaking))if(eX(n[e].treeShaking))return!!ez(e,t);else return!0;if(eX(n[e].treeShaking))return!1}if(eX(n[t]))if(eX(n[e]))return!!ez(e,t);else return!0;return!eX(n[e])&&ez(e,t)};if(a){if(i=eK(e[t][r],s))return{version:i,useTreesShaking:a};a=!1}return{version:eK(e[t][r],s),useTreesShaking:a}}:function(e,t,r,o){let n=e[t][r],i="",a=eq(o),s=function(e,t){return a?!n[e].treeShaking||!!n[t].treeShaking&&!eY(n[e].treeShaking)&&ez(e,t):!eY(n[e])&&ez(e,t)};if(a){if(i=eK(e[t][r],s))return{version:i,useTreesShaking:a};a=!1}return{version:eK(e[t][r],s),useTreesShaking:a}})(e,l,t,s),f=()=>{let o=e[l][t][c];if(n.singleton){if("string"==typeof i&&!eV(c,i)){let e=`Version ${c} from ${c&&o.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${i})`;n.strictVersion?x(e):H(e)}return{shared:o,useTreesShaking:h}}{if(!1===i||"*"===i||eV(c,i))return{shared:o,useTreesShaking:h};let r=eq(s);if(r){for(let[o,n]of Object.entries(e[l][t]))if(eq(n.treeShaking,s?.usedExports)&&eV(o,i))return{shared:n,useTreesShaking:r}}for(let[r,o]of Object.entries(e[l][t]))if(eV(r,i))return{shared:o,useTreesShaking:!1}}},u={shareScopeMap:e,scope:l,pkgName:t,version:c,GlobalFederation:B.__FEDERATION__,shareInfo:r,resolver:f};return(o.emit(u)||u).resolver()}}function eQ(){return B.__FEDERATION__.__SHARE__}function e0(e){let{pkgName:t,extraOptions:r,shareInfos:o}=e,n=r?.resolver??(e=>{if(!e)return;let t={};return e.forEach(e=>{t[e.version]=e}),t[eK(t,function(e,r){return!eY(t[e])&&ez(e,r)})]}),i=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),a=(...e)=>{let t={};for(let r of e)if(r)for(let[e,o]of Object.entries(r)){let r=t[e];i(r)&&i(o)?t[e]=a(r,o):void 0!==o&&(t[e]=o)}return t};return a(n(o[t]),r?.customShareInfo)}let e1=(e,t)=>{var r;e.useIn||(e.useIn=[]),r=e.useIn,-1===r.findIndex(e=>e===t)&&r.push(t)};function e2(e,t){return t&&e.treeShaking?e.treeShaking:e}let e4="[ Federation Runtime ]",e5=(e,t,r=":")=>{let o=e.split(r),n="development"===b().NODE_ENV&&t,i=e=>e.startsWith("http")||e.includes(".json");if(o.length>=2){let[t,...a]=o;e.startsWith(r)&&(t=o.slice(0,2).join(r),a=[n||o.slice(2).join(r)]);let s=n||a.join(r);return i(s)?{name:t,entry:s}:{name:t,version:s||"*"}}if(1===o.length){let[e]=o;return n&&i(n)?{name:e,entry:n}:{name:e,version:n||"*"}}throw`Invalid entry value: ${e}`},e9=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,""):""},e3=function(e,t="",r=!1){try{return`${t}${e.replace(RegExp(`${s.AT}`,"g"),l[s.AT]).replace(RegExp(`${s.HYPHEN}`,"g"),l[s.HYPHEN]).replace(RegExp(`${s.SLASH}`,"g"),l[s.SLASH])}${r?".js":""}`}catch(e){throw e}},e6=function(e,t,r){try{let o=e;if(t){if(!o.startsWith(t))return o;o=o.replace(RegExp(t,"g"),"")}return o=o.replace(RegExp(`${l[s.AT]}`,"g"),c[l[s.AT]]).replace(RegExp(`${l[s.SLASH]}`,"g"),c[l[s.SLASH]]).replace(RegExp(`${l[s.HYPHEN]}`,"g"),c[l[s.HYPHEN]]),r&&(o=o.replace(".js","")),o}catch(e){throw e}},e7=(e,t)=>{if(!e)return"";let r=e;return"."===r&&(r="default_export"),r.startsWith("./")&&(r=r.replace("./","")),e3(r,"__federation_expose_",t)},e8=(e,t)=>e?e3(e,"__federation_shared_",t):"",te=(e,t)=>{if("getPublicPath"in e){let r;return r=e.getPublicPath.startsWith("function")?Function("return "+e.getPublicPath)()():Function(e.getPublicPath)(),`${r}${t}`}return"publicPath"in e?!g&&!_()&&"ssrPublicPath"in e&&"string"==typeof e.ssrPublicPath?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},tt=(e,t)=>{e||tr(t)},tr=e=>{throw Error(`${e4}: ${e}`)},to=e=>{console.warn(`${e4}: ${e}`)};function tn(e){try{return JSON.stringify(e,null,2)}catch(e){return""}}let ti=/^([\d^=v<>~]|[*xX]$)/;function ta(e){return ti.test(e)}async function ts(e,t){try{return await e()}catch(e){t||to(e);return}}function tl(e,t){let r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function tc(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("script");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("src");if(a&&tl(a,e.url)){r=n,o=!1;break}}if(!r){let t,o=e.attrs;(r=document.createElement("script")).type=o?.type==="module"?"module":"text/javascript",e.createScriptHook&&((t=e.createScriptHook(e.url,e.attrs))instanceof HTMLScriptElement?r=t:"object"==typeof t&&("script"in t&&t.script&&(r=t.script),"timeout"in t&&t.timeout&&(n=t.timeout))),r.src||(r.src=e.url),o&&!t&&Object.keys(o).forEach(e=>{r&&("async"===e||"defer"===e?r[e]=o[e]:r.getAttribute(e)||r.setAttribute(e,o[e]))})}let a=null,s="u">typeof window?t=>{if(t.filename&&tl(t.filename,e.url)){let r=Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);r.name="ScriptExecutionError",a=r}}:null;s&&window.addEventListener("error",s);let l=async(o,n)=>{clearTimeout(t),s&&window.removeEventListener("error",s);let i=()=>{if(n?.type==="error"){let t=Error(n?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);t.name="ScriptNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else a?e?.onErrorCallback&&e?.onErrorCallback(a):e?.cb&&e?.cb()};if(r&&(r.onerror=null,r.onload=null,ts(()=>{let{needDeleteScript:t=!0}=e;t&&r?.parentNode&&r.parentNode.removeChild(r)}),o&&"function"==typeof o)){let e=o(n);if(e instanceof Promise){let t=await e;return i(),t}return i(),e}i()};return r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),t=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:r,needAttach:o}}function th(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("link");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("href"),s=n.getAttribute("rel");if(a&&tl(a,e.url)&&s===e.attrs.rel){r=n,o=!1;break}}if(!r){let t;(r=document.createElement("link")).setAttribute("href",e.url);let o=!0,i=e.attrs;e.createLinkHook&&((t=e.createLinkHook(e.url,i))instanceof HTMLLinkElement?(r=t,o=!1):"object"==typeof t&&("link"in t&&t.link&&(r=t.link,o=!1),"timeout"in t&&t.timeout&&(n=t.timeout))),i&&o&&Object.keys(i).forEach(e=>{r&&!r.getAttribute(e)&&r.setAttribute(e,i[e])})}if(!o)return Promise.resolve().then(()=>{e?.cb&&e?.cb()}),{link:r,needAttach:o};let a=(o,n)=>{t&&clearTimeout(t);let i=()=>{if(n?.type==="error"){let t=Error(n?.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name="LinkNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else e?.cb&&e?.cb()};if(r&&(r.onerror=null,r.onload=null,ts(()=>{let{needDeleteLink:t=!0}=e;t&&r?.parentNode&&r.parentNode.removeChild(r)}),o)){let e=o(n);return i(),e}i()};return r.onerror=a.bind(null,r.onerror),r.onload=a.bind(null,r.onload),t=setTimeout(()=>{a(null,{type:"error",isTimeout:!0})},n),{link:r,needAttach:o}}function tf(e,t){let{attrs:r={},createScriptHook:o}=t;return new Promise((t,n)=>{let{script:i,needAttach:a}=tc({url:e,cb:t,onErrorCallback:n,attrs:{fetchpriority:"high",...r},createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(i)})}let tu=new Map;function tm(e){if(!e)throw Error("import specifier is required");if(tu.has(e))return tu.get(e);let t=Function("name","return import(name)")(e).then(e=>e).catch(t=>{throw console.error(`Error importing module ${e}:`,t),tu.delete(e),t});return tu.set(e,t),t}let td=async()=>{let e=await tm("node-fetch");return e.default||e},tp=async(e,t,r)=>{let o,n=await (o=t||{},r.lifecycle.fetch.emit(e,o));return n&&n instanceof Response?n:("u"<typeof fetch?await td():fetch)(e,t||{})},ty="u"<typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t,r,o)=>{let n;if(o?.createScriptHook){let t=o.createScriptHook(e);t&&"object"==typeof t&&"url"in t&&(e=t.url)}try{n=new URL(e)}catch(e){console.error("Error constructing URL:",e),t(Error(`Invalid URL: ${e}`));return}let i=async(e,o)=>{try{let n,i=await e(o.href),a=await i.text(),[s,l]=await Promise.all([tm("path"),tm("vm")]),c={},h={exports:{}},f=o.pathname.split("/").slice(0,-1).join("/"),u=s.basename(o.pathname),m=new l.Script(`(function(exports, module, require, __dirname, __filename) {${a}
|
|
4
|
-
})`,{filename:u,importModuleDynamically:l.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER??tm});n=(await tm("node:module")).createRequire("file:"===o.protocol||"node:"===o.protocol?o.href:s.join(process.cwd(),"__mf_require_base__.js")),m.runInThisContext()(c,h,n,f,u);let d=h.exports||c;if(r&&d&&r.globalName)return void t(void 0,d[r.globalName]||d);t(void 0,d)}catch(e){t(e instanceof Error?e:Error(`Script execution error: ${e}`))}};(async()=>o?.fetch?(e,t)=>tp(e,t,o):"u"<typeof fetch?td():fetch)().then(async e=>{if(r?.type==="esm"||r?.type==="module")return t_(n.href,{fetch:e,vm:await tm("vm")}).then(async e=>{await e.evaluate(),t(void 0,e.namespace)}).catch(e=>{t(e instanceof Error?e:Error(`Script execution error: ${e}`))});i(e,n)}).catch(e=>{t(e)})}:(e,t,r,o)=>{t(Error("createScriptNode is disabled in non-Node.js environment"))},tg="u"<typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t)=>new Promise((r,o)=>{ty(e,(e,n)=>{if(e)o(e);else{let e=t?.attrs?.globalName||`__FEDERATION_${t?.attrs?.name}:custom__`;r(globalThis[e]=n)}},t.attrs,t.loaderHook)}):(e,t)=>{throw Error("loadScriptNode is disabled in non-Node.js environment")},tE=new Map;async function t_(e,t){if(tE.has(e))return tE.get(e);let{fetch:r,vm:o}=t,n=await (await r(e)).text(),i=new o.SourceTextModule(n,{importModuleDynamically:async(r,o)=>t_(new URL(r,e).href,t)});return tE.set(e,i),await i.link(async r=>{let o=new URL(r,e).href;return await t_(o,t)}),i}let tS="RUNTIME-001",tb="RUNTIME-002",tI="RUNTIME-003",t$="RUNTIME-004",tN="RUNTIME-005",tR="RUNTIME-006",tw="RUNTIME-007",tv="RUNTIME-008",tT="RUNTIME-009",tA="RUNTIME-010",tk="RUNTIME-011",tO="RUNTIME-013",tP="RUNTIME-014",tL="RUNTIME-015",tM={[tS]:"Failed to get remoteEntry exports.",[tb]:'The remote entry interface does not contain "init"',[tI]:"Failed to get manifest.",[t$]:"Failed to locate remote.",[tN]:"Invalid loadShareSync function call from bundler runtime",[tR]:"Invalid loadShareSync function call from runtime",[tw]:"Failed to get remote snapshot.",[tv]:"Failed to load script resources.",[tT]:"Please call createInstance first.",[tA]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[tk]:"The remoteEntry URL is missing from the remote snapshot.","RUNTIME-012":'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.',[tO]:"The manifest is not a valid Module Federation manifest.",[tP]:"The remote does not expose the requested module.",[tL]:"Remote container initialization failed."};({...tM,"TYPE-001":"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.","BUILD-001":"Failed to find expose module.","BUILD-002":"PublicPath is required in prod mode."});let tx=".then(callbacks[0]).catch(callbacks[1])";async function tH({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):Function("callbacks",`import("${e}")${tx}`)([r,o])}catch(t){x(`Failed to load ESM entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}async function tF({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):Function("callbacks",`System.import("${e}")${tx}`)([r,o])}catch(t){x(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}function tD(e,t,r){let{remoteEntryKey:o,entryExports:n}=Q(e,t);return n||x(tS,tM,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function tj({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:i,resourceContext:a}){let{entryExports:s}=Q(e,t);if(s)return s;let l=i?i(r):r;return tf(l,{attrs:{},createScriptHook:(e,t)=>{let r=n.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:o,resourceContext:a?{...a,url:e}:void 0});if(r&&(r instanceof HTMLScriptElement||"script"in r||"timeout"in r))return r}}).then(()=>tD(e,t,r),t=>{x(tv,tM,{remoteName:e,resourceUrl:l},t instanceof Error?t.message:String(t))})}async function tC({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){let{entry:i,entryGlobalName:a,name:s,type:l}=e;switch(l){case"esm":case"module":return tH({entry:i,remoteEntryExports:t});case"system":return tF({entry:i,remoteEntryExports:t});default:return tj({entry:i,globalName:a,name:s,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}}async function tU({remoteInfo:e,loaderHook:t,resourceContext:r}){let{entry:o,entryGlobalName:n,name:i,type:a}=e,{entryExports:s}=Q(i,n);return s||tg(o,{attrs:{name:i,globalName:n,type:a},loaderHook:{createScriptHook:(o,n={})=>{let i=t.lifecycle.createScript.emit({url:o,attrs:n,remoteInfo:e,resourceContext:r?{...r,url:o}:void 0});if(i&&"url"in i)return i}}}).then(()=>tD(i,n,o)).catch(e=>{x(`Failed to load Node.js entry for remote "${i}" from "${o}". ${e instanceof Error?e.message:String(e)}`)})}function tG(e){let{entry:t,name:r}=e;return e9(r,t)}async function tV(e){let{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:i,_inErrorHandling:a=!1}=e,s=tG(o);if(r)return r;if(!K[s]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;K[s]=e.emit({origin:t,loaderHook:l,remoteInfo:o,remoteEntryExports:r}).then(e=>e||(("u">typeof ENV_TARGET?"web"===ENV_TARGET:g)?tC({remoteInfo:o,remoteEntryExports:r,loaderHook:l,getEntryUrl:n,resourceContext:i}):tU({remoteInfo:o,loaderHook:l,resourceContext:i}))).then(async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:e}),e)).catch(async e=>{let n=tG(o),i=e instanceof Error&&e.message.includes("ScriptExecutionError");if(e instanceof Error&&e.message.includes(tv)&&!i&&!a){let e=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e=>tV({...e,_inErrorHandling:!0}),origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:K,uniqueKey:n});if(e)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:e,recovered:!0}),e}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,error:e}),e})}return K[s]}function tW(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||eW}}function tB(e,t){return t&&"."!==t?`${e}/${t.replace(/^\.\//,"")}`:e}function tq(e,t){for(let r of e){let e=t.startsWith(r.name),o=t.replace(r.name,"");if(e){if(o.startsWith("/"))return{pkgNameOrAlias:r.name,expose:o=`.${o}`,remote:r};else if(""===o)return{pkgNameOrAlias:r.name,expose:".",remote:r}}let n=r.alias&&t.startsWith(r.alias),i=r.alias&&t.replace(r.alias,"");if(r.alias&&n){if(i&&i.startsWith("/"))return{pkgNameOrAlias:r.alias,expose:i=`.${i}`,remote:r};else if(""===i)return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function tz(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function tK(e){return e instanceof Error&&(e.message.includes("timed out")||e.name.includes("Timeout"))}function tY(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}async function tJ(e,t,r,o){let n=e.moduleCache.get(r.name),i=r.entry;if(n?.remoteEntryExports)return tY(o,i,"cached");try{if(!await tV({origin:e,remoteInfo:r,remoteEntryExports:n?.remoteEntryExports,resourceContext:{...o,url:i}}))throw Error(`Failed to load remoteEntry "${i}".`);return tY(o,i,"success")}catch(e){return tY(o,i,tK(e)?"timeout":"error",e)}}function tX({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:i}){return new Promise(a=>{let{link:s,needAttach:l}=th({url:r,cb:()=>{a(tY(n,r,l?"success":"cached"))},onErrorCallback:e=>{a(tY(n,r,tK(e)?"timeout":"error",e))},attrs:o,createLinkHook:(r,o)=>{let i=e.loaderHook.lifecycle.createLink.emit({url:r,attrs:o,remoteInfo:t,resourceContext:{...n,url:r}});return i instanceof HTMLLinkElement,i},needDeleteLink:i});l&&document.head.appendChild(s)})}function tZ(e,t){return{...e,resourceType:t}}function tQ(e,t,r,o=!0,n={initiator:"preloadRemote",id:e.name}){let{cssAssets:i,jsAssetsWithoutEntry:a,entryAssets:s}=r,l=[];if(t.options.inBrowser){if(s.forEach(r=>{let{moduleInfo:o}=r;l.push(tJ(t,e,o,tZ(n,"remoteEntry")))}),o){let r={rel:"preload",as:"style"};i.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"css")}))})}else{let r={rel:"stylesheet",type:"text/css"};i.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,needDeleteLink:!1,context:tZ(n,"css")}))})}if(o){let r={rel:"preload",as:"script"};a.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"js")}))})}else{let r={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(o=>{l.push(function({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(i=>{let{script:a,needAttach:s}=tc({url:r,cb:()=>{i(tY(n,r,s?"success":"cached"))},onErrorCallback:e=>{i(tY(n,r,tK(e)?"timeout":"error",e))},attrs:o,createScriptHook:(r,o)=>{let i=e.loaderHook.lifecycle.createScript.emit({url:r,attrs:o,remoteInfo:t,resourceContext:{...n,url:r}});return i instanceof HTMLScriptElement,i},needDeleteScript:!0});s&&document.head.appendChild(a)})}({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"js")}))})}}return Promise.all(l)}function t0(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function t1(e){let t={};for(let[r,o]of Object.entries(e.shared)){let e=o[0];e&&(t[r]={version:e.version,singleton:e.shareConfig?.singleton,requiredVersion:e.shareConfig?.requiredVersion!==!1&&e.shareConfig?.requiredVersion,eager:e.eager,strictVersion:e.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?"host":"unknown"},mfConfig:{name:e.name,remotes:e.remotes?.map(t0)??[],shared:t}}}var t2=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;let t=await tV({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:tB(this.remoteInfo.name,e),resourceType:"remoteEntry"}});return M(t,`remoteEntryExports is undefined
|
|
5
|
-
${tn(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,r,o){let n=await this.getEntry(o);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host}),n;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:r,cached:!0,origin:this.host}),r}return n}this.initing=!0,this.initPromise=(async()=>{var o,i;let a,s;await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});let{remoteEntryInitOptions:l,shareScope:c,initScope:h}=(o=this.remoteInfo,i=this.host.shareScopeMap,(a=Array.isArray(o.shareScope)?o.shareScope:[o.shareScope]).length||a.push("default"),a.forEach(e=>{i[e]||(i[e]={})}),Object.defineProperty(s={version:o.version||"",shareScopeKeys:Array.isArray(o.shareScope)?a:o.shareScope||"default"},"shareScopeMap",{value:i,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:i[a[0]],initScope:r??[]}),f=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:c,remoteEntryInitOptions:l,initScope:h,remoteInfo:this.remoteInfo,origin:this.host});void 0===n?.init&&x(tb,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,t1(this.host.options));try{await n.init(f.shareScope,f.initScope,f.remoteEntryInitOptions)}catch(e){x(tL,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,t1(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...f,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:r,origin:this.host}),r}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,o){var n,i;let a,s,{loadFactory:l=!0}=r||{loadFactory:!0},c=await this.init(e,o,void 0,t);this.lib=c,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,origin:this.host});try{let r=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:c,expose:t,moduleInfo:this.remoteInfo});(a="function"==typeof r?r:void 0)||(a=await c.get(t)),a||x(tP,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:function(e){if(!e||!("modules"in e)||!Array.isArray(e.modules))return;let t=e.modules.map(e=>e.moduleName).filter(Boolean);return t.length?t.join(","):void 0}(o)},void 0,t1(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,moduleFactory:a,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,error:r,origin:this.host}),r}let h=(n=this.remoteInfo.name,i=t,s=n.endsWith("/")?n.slice(0,-1):n,i.startsWith(".")&&(i=i.slice(1)),s+=i),f=this.wraperFactory(a,h);if(!l)return f;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,origin:this.host});try{let r=await f();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,exposeModule:r,origin:this.host}),r}catch(r){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,error:r,origin:this.host}),r}}wraperFactory(e,t){function r(e,t){e&&"object"==typeof e&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for("mf_module_id"))&&Object.defineProperty(e,Symbol.for("mf_module_id"),{value:t,enumerable:!1})}return()=>{let o=e();return o instanceof Promise?o.then(e=>(r(e,t),e)):(r(o,t),o)}}},t4=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){"function"==typeof e&&this.listeners.add(e)}once(e){let t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{let o=r(...e);void 0!==o&&(t=o)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},t5=class extends t4{emit(...e){let t,r=Array.from(this.listeners);if(r.length>0){let o=0,n=t=>!1!==t&&(o<r.length?Promise.resolve(r[o++].apply(null,e)).then(r=>void 0===r||1===e.length&&r===e[0]?n(t):n(r)):t);t=n()}return Promise.resolve(t)}};function t9(e,t){if(!C(t))return!1;if(e!==t){for(let r in e)if(!(r in t))return!1}return!0}var t3=class extends t4{constructor(e){super(),this.onerror=x,this.type=e}emit(e){for(let t of(C(e)||x(`The data for the "${this.type}" hook should be an object.`),this.listeners))try{let r=t(e);if(void 0===r)continue;if(t9(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(e){H(e),this.onerror(e)}return e}},t6=class extends t4{constructor(e){super(),this.onerror=x,this.type=e}emit(e){C(e)||x(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let r=0,o=t=>(H(t),this.onerror(t),e),n=i=>{if(void 0!==i&&t9(e,i))e=i;else if(void 0!==i)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(e){return o(e)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},t7=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){M("[object Object]"===U.call(e),"Plugin configuration is invalid.");let r=e.name;M(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach(t=>{let r=e[t];r&&this.lifecycle[t].on(r)}))}removePlugin(e){M(e,"A name is required.");let t=this.registerPlugins[e];M(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(e=>{"name"!==e&&this.lifecycle[e].remove(t[e])})}};function t8(e,t){let r=V(t);r.url||x(tk,tM,{remoteName:e.name});let o=te(t,r.url);g||o.startsWith("http")||(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}let re=(e,t)=>{if(!e)return t;let r=(e=>{if("."===e)return"";if(e.startsWith("./"))return e.replace("./","");if(e.startsWith("/")){let t=e.slice(1);return t.endsWith("/")?t.slice(0,-1):t}return e})(e);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function rt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function rr(e,t={}){let r,{remotes:o={},overrides:n={},version:i}=t,a=()=>"publicPath"in e.metaData?("auto"===e.metaData.publicPath||""===e.metaData.publicPath)&&i?rt(i):e.metaData.publicPath:e.metaData.getPublicPath,s=Object.keys(n),l={};Object.keys(o).length||(l=e.remotes?.reduce((e,t)=>{let r,o=t.federationContainerName;return r=s.includes(o)?n[o]:"version"in t?t.version:t.entry,e[o]={matchedVersion:r},e},{})||{}),Object.keys(o).forEach(e=>l[e]={matchedVersion:s.includes(e)?n[e]:o[e]});let{remoteEntry:{path:c,name:h,type:f},types:u={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:m},globalName:d,ssrRemoteEntry:p}=e.metaData,{exposes:y}=e,g={version:i||"",buildVersion:m,globalName:d,remoteEntry:re(c,h),remoteEntryType:f,remoteTypes:re(u.path,u.name),remoteTypesZip:u.zip||"",remoteTypesAPI:u.api||"",remotesInfo:l,shared:e?.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:y?.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if("publicPath"in e.metaData?(r={...g,publicPath:a()},"string"==typeof e.metaData.ssrPublicPath&&(r.ssrPublicPath=e.metaData.ssrPublicPath)):r={...g,getPublicPath:a()},p){let e=re(p.path,p.name);r.ssrRemoteEntry=e,r.ssrRemoteEntryType=p.type||"commonjs-module"}return r}function ro(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}function rn(e){if(!e)return{statsFileName:f,manifestFileName:h};let t="boolean"==typeof e?"":e.filePath||"",r="boolean"==typeof e?"":e.fileName||"",o=".json",n=r?r.endsWith(o)?r:`${r}${o}`:h;return{statsFileName:re(t,r?n.replace(o,`-stats${o}`):f),manifestFileName:re(t,n)}}let ri=(e,t)=>document.querySelector(`${e}[${"link"===e?"href":"src"}="${t}"]`);function ra(e,t){let r=X({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&J(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:B.__FEDERATION__.moduleInfo,remoteSnapshot:X({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:B.__FEDERATION__.moduleInfo,remoteSnapshot:X({name:e.name,version:"version"in e?e.version:void 0})}}var rs=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new t7({beforeLoadRemoteSnapshot:new t5("beforeLoadRemoteSnapshot"),loadSnapshot:new t6("loadGlobalSnapshot"),loadRemoteSnapshot:new t6("loadRemoteSnapshot"),afterLoadSnapshot:new t6("afterLoadSnapshot")}),this.manifestLoading=B.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:r="loadRemote"}){let o,n,{options:i}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:i,moduleInfo:e,origin:this.HostInstance});let a=X({name:this.HostInstance.options.name,version:this.HostInstance.options.version});if(!a){var s;a={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},s={[this.HostInstance.options.name]:a},B.__FEDERATION__.moduleInfo={...B.__FEDERATION__.moduleInfo,...s}}a&&"remotesInfo"in a&&!J(a.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(a.remotesInfo={...a?.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});let{hostGlobalSnapshot:l,remoteSnapshot:c,globalSnapshot:h}=this.getGlobalRemoteInfo(e),{remoteSnapshot:f,globalSnapshot:u}=await this.hooks.lifecycle.loadSnapshot.emit({options:i,moduleInfo:e,hostGlobalSnapshot:l,remoteSnapshot:c,globalSnapshot:h});if(f)if(ro(f)){let i=g?f.remoteEntry:f.ssrRemoteEntry||f.remoteEntry||"",a=await this.loadManifestSnapshot(i,e,{},{initiator:r,id:t||e.name}),s=Z({...e,entry:i},a);o=a,n=s}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:f,from:"global"});o=t,n=u}else if(D(e)){let i=await this.loadManifestSnapshot(e.entry,e,{},{initiator:r,id:t||e.name}),a=Z(e,i);o=i,n=a}else x(tw,tM,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(u)},void 0,t1(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:i,moduleInfo:e,remoteSnapshot:o}),{remoteSnapshot:o,globalSnapshot:n}}getGlobalRemoteInfo(e){return ra(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{let r=tW(t),n=this.manifestCache.get(e);if(n)return n;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},r,o?{...o,url:e,resourceType:"manifest"}:void 0);t&&t instanceof Response||(t=await fetch(e,{})),n=await t.json()}catch(o){(n=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:"runtime",lifecycle:"afterResolve",remote:r,origin:this.HostInstance}))||(delete this.manifestLoading[e],x(tI,tM,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${o}`,t1(this.HostInstance.options)))}let i=[!n.metaData&&"metaData",!n.exposes&&"exposes",!n.shared&&"shared"].filter(Boolean);return i.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${i.join(", ")}.`),from:"runtime",lifecycle:"afterResolve",remote:r,origin:this.HostInstance}),i.length>0&&x(tO,tM,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:i.join(",")},void 0,t1(this.HostInstance.options)),this.manifestCache.set(e,n),n})()}async loadManifestSnapshot(e,t,r,o){let n=async()=>{let n=await this.getManifestJson(e,t,r,o),i=rr(n,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:n,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(e=>e)),this.manifestLoading[e]}},rl=class{constructor(e){this.hooks=new t7({beforeRegisterShare:new t3("beforeRegisterShare"),afterResolve:new t6("afterResolve"),beforeLoadShare:new t6("beforeLoadShare"),loadShare:new t5,afterLoadShare:new t4("afterLoadShare"),errorLoadShare:new t4("errorLoadShare"),resolveShare:new t3("resolveShare"),initContainerShareScopeMap:new t3("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:r,selectedShared:o}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:r,selectedShared:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(e){H(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:r,error:o,recovered:n}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:o,recovered:n})}catch(e){H(e)}}registerShared(e,t){let{newShareInfos:r,allShareInfos:o}=eB(e,t);return Object.keys(r).forEach(e=>{r[e].forEach(r=>{r.scope.forEach(o=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:r}),this.shareScopeMap[o]?.[e]||this.setShared({pkgName:e,lib:r.lib,get:r.get,loaded:r.loaded||!!r.lib,shared:r,from:t.name})})})}),{newShareInfos:r,allShareInfos:o}}async loadShare(e,t){let{host:r}=this,o=e0({pkgName:e,extraOptions:t,shareInfos:r.options.shared}),n=o;try{o?.scope&&await Promise.all(o.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:o.strategy}))})),n=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r})).shareInfo,M(n,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);let i=n,{shared:a,useTreesShaking:s}=eZ(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(a){let t=e2(a,s);if(t.lib)return e1(t,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),t.lib;if(t.loading&&!t.loaded){let o=await t.loading;return t.loaded=!0,t.lib||(t.lib=o),e1(t,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),o}{let o=(async()=>{let e=await t.get();return e1(t,r.options.name),t.loaded=!0,t.lib=e,e})();this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:o,treeShaking:s?t:void 0});let n=await o;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),n}}{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,recovered:!0}),!1;let o=eq(i.treeShaking),n=e2(i,o),a=(async()=>{let t=await n.get();n.lib=t,n.loaded=!0,e1(n,r.options.name);let{shared:o,useTreesShaking:a}=eZ(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare)||{};if(o){let e=e2(o,a);e.lib=t,e.loaded=!0,o.from=i.from}return t})();this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:a,treeShaking:o?n:void 0});let s=await a;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:i}),s}}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:n,error:t}),t}}initializeSharing(e=eW,t){let{host:r}=this,o=t?.from,n=t?.strategy,i=t?.initScope,a=[];if("build"!==o){let{initTokens:t}=this;i||(i=[]);let r=t[e];if(r||(r=t[e]={from:this.host.name}),i.indexOf(r)>=0)return a;i.push(r)}let s=this.shareScopeMap,l=r.options.name;s[e]||(s[e]={});let c=s[e],h=async e=>{let t,{module:o}=await r.remoteHandler.getRemoteModuleAndOptions({id:e});try{t=await o.getEntry()}catch(n){if(!(t=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:"runtime",lifecycle:"beforeLoadShare",remote:o.remoteInfo,origin:r})))return}finally{t?.init&&!o.initing&&(o.remoteEntryExports=t,await o.init(void 0,void 0,i))}};return Object.keys(r.options.shared).forEach(t=>{r.options.shared[t].forEach(r=>{r.scope.includes(e)&&((e,t)=>{let{version:r,eager:o}=t;c[e]=c[e]||{};let n=c[e],i=n[r]&&e2(n[r]),a=!!(i&&("eager"in i&&i.eager||"shareConfig"in i&&i.shareConfig?.eager));(!i||"loaded-first"!==i.strategy&&!i.loaded&&(!o!=!a?o:l>n[r].from))&&(n[r]=t)})(t,r)})}),("version-first"===r.options.shareStrategy||"version-first"===n)&&r.options.remotes.forEach(t=>{t.shareScope===e&&a.push(h(t.name))}),a}loadShareSync(e,t){let{host:r}=this,o=e0({pkgName:e,extraOptions:t,shareInfos:r.options.shared});try{o?.scope&&o.scope.forEach(e=>{this.initializeSharing(e,{strategy:o.strategy})});let{shared:n}=eZ(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(n){if("function"==typeof n.lib)return e1(n,r.options.name),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),n.lib;if("function"==typeof n.get){let t=n.get();if(!(t instanceof Promise))return e1(n,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:t,shared:n}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),t}}if(o.lib)return o.loaded||(o.loaded=!0),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib;if(o.get){let n=o.get();return n instanceof Promise&&x(t?.from==="build"?tN:tR,tM,{hostName:r.options.name,sharedPkgName:e},void 0,t1(r.options)),o.lib=n,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib}x(tR,tM,{hostName:r.options.name,sharedPkgName:e},void 0,t1(r.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,error:t}),t}}initShareScopeMap(e,t,r={}){let{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:i,get:a,treeShaking:s}){let{version:l,scope:c="default",...h}=t;(Array.isArray(c)?c:[c]).forEach(t=>{let c,f;this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][l]||(this.shareScopeMap[t][e][l]={version:l,scope:[t],...h,lib:o});let u=this.shareScopeMap[t][e][l];(c=(e,t,r)=>{r&&!e[t]&&(e[t]=r)})(f=s?u.treeShaking:u,"loaded",i),c(f,"loading",n),c(f,"get",a),r&&u.from!==r&&(u.from=r)})}_setGlobalShareScopeMap(e){let t=eQ(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},rc=class{constructor(e){this.hooks=new t7({beforeRegisterRemote:new t3("beforeRegisterRemote"),registerRemote:new t3("registerRemote"),beforeRequest:new t6("beforeRequest"),afterMatchRemote:new t5("afterMatchRemote"),onLoad:new t5("onLoad"),afterLoadRemote:new t5("afterLoadRemote"),handlePreloadModule:new t4("handlePreloadModule"),errorLoadRemote:new t5("errorLoadRemote"),beforePreloadRemote:new t5("beforePreloadRemote"),generatePreloadAssets:new t5("generatePreloadAssets"),afterPreloadRemote:new t5("afterPreloadRemote"),loadEntry:new t5}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:r,expose:o}=t,{name:n,alias:i}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},i&&e.startsWith(n)){let t=e.replace(n,i);this.idToRemoteMap[t]={name:r.name,expose:o};return}if(i&&e.startsWith(i)){let t=e.replace(i,n);this.idToRemoteMap[t]={name:r.name,expose:o}}}async loadRemote(e,t){let r,{host:o}=this,n=tq(o.options.remotes,e),i=e,a=n?.expose,s=n?tW(n.remote):void 0;try{let{loadFactory:n=!0}=t||{loadFactory:!0},{module:l,moduleOptions:c,remoteMatchInfo:h}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:f,remote:u,expose:m,id:d,remoteSnapshot:p}=h;i=d,a=m,s=tW(u);let y=await l.get(d,m,t,p),g=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:f,expose:m,exposeModule:n?y:void 0,exposeModuleFactory:n?void 0:y,remote:u,options:c,moduleInstance:l,origin:o});if(this.setIdToRemoteMap(e,h),r={id:i,expose:a,remote:s,options:t,origin:o},"function"==typeof g)return g;return y}catch(c){let n,{from:l="runtime"}=t||{from:"runtime"};try{n=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:c,from:l,lifecycle:"onLoad",expose:a,remote:s,origin:o})}catch(e){throw r={id:i,expose:a,remote:s,options:t,error:e,origin:o},e}if(!n)throw r={id:i,expose:a,remote:s,options:t,error:c,origin:o},c;return r={id:i,expose:a,remote:s,options:t,error:c,origin:o,recovered:!0},n}finally{r&&await this.hooks.lifecycle.afterLoadRemote.emit(r)}}async preloadRemote(e){var t;let r,{host:o}=this,n=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:o.options,origin:o});let i=(t=o.options.remotes,e.map(e=>{let r=function(e,t){for(let r of e)if(t===r.name||r.alias&&t===r.alias)return r}(t,e.nameOrAlias);return M(r,`Unable to preload ${e.nameOrAlias} as it is not included in ${!r&&tn({remoteInfo:r,remotes:t})}`),{remote:r,preloadConfig:tz(e)}}));await Promise.all(i.flatMap(e=>{let{preloadConfig:t,remote:r}=e,o=t.exposes||[];return o.length?o.map(o=>({ops:{...e,preloadConfig:{...t,exposes:[o]}},id:tB(r.name,o)})):[{ops:e,id:`${r.name}/*`}]}).map(async e=>{let{ops:t,id:r}=e,{remote:i,preloadConfig:a}=t,s=tW(i);try{let{globalSnapshot:e,remoteSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i,id:r,initiator:"preloadRemote"}),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:t,remote:i,remoteInfo:s,globalSnapshot:e,remoteSnapshot:l});if(!c)return;let h=await tQ(s,o,c,!0,{initiator:"preloadRemote",id:r});n.push({remote:i,remoteInfo:s,preloadConfig:a,id:r,results:h})}catch(e){n.push({remote:i,remoteInfo:s,preloadConfig:a,id:r,results:[{url:s.entry,status:"error",resourceType:/\.json(?:$|[?#])/i.test(s.entry)?"manifest":"remoteEntry",initiator:"preloadRemote",id:r,error:e}]})}}));let a=n.flatMap(e=>e.results.filter(e=>"error"===e.status||"timeout"===e.status));if(a.length>0&&Object.assign(r=Error(`preloadRemote failed to load ${a.length} resource(s).`),{results:n,failedResults:a}),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:o.options,origin:o,results:n,error:r}),r)throw r}registerRemotes(e,t){let{host:r}=this;e.forEach(e=>{this.registerRemote(e,r.options.remotes,{force:t?.force})})}async getRemoteModuleAndOptions(e){let t,{host:r}=this,{id:o}=e;try{t=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:r.options,origin:r})}catch(e){if(!(t=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:r.options,origin:r,from:"runtime",error:e,lifecycle:"beforeRequest"})))throw e}let{id:n}=t,i=tq(r.options.remotes,n);if(!i)try{x(t$,tM,{hostName:r.options.name,requestId:n},void 0,t1(r.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:r.options,error:e,origin:r}),e}let{remote:a}=i,s=tW(a);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...i,options:r.options,remoteInfo:s,origin:r});let l=await r.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...i,options:r.options,origin:r,remoteInfo:s}),{remote:c,expose:h}=l;M(c&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let f=r.moduleCache.get(c.name),u={host:r,remoteInfo:s};return f||(f=new t2(u),r.moduleCache.set(c.name,f)),{module:f,moduleOptions:u,remoteMatchInfo:l}}registerRemote(e,t,r){let{host:o}=this,n=()=>{if(e.alias){let r=t.find(t=>e.alias&&(t.name.startsWith(e.alias)||t.alias?.startsWith(e.alias)));M(!r,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${r&&r.name} name or alias`)}"entry"in e&&g&&"u">typeof window&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=eW),e.type||(e.type="global")};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});let i=t.find(t=>t.name===e.name);if(i){let a=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r?.force&&(this.removeRemote(i),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),to(a.join(" ")))}else n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o})}removeRemote(e){try{let{host:t}=this,{name:r}=e,o=t.options.remotes.findIndex(e=>e.name===r);-1!==o&&t.options.remotes.splice(o,1);let n=t.moduleCache.get(e.name);if(n){let r=n.remoteInfo,o=r.entryGlobalName;W[o]&&(Object.getOwnPropertyDescriptor(W,o)?.configurable?delete W[o]:W[o]=void 0);let i=tG(n.remoteInfo);K[i]&&delete K[i],t.snapshotHandler.manifestCache.delete(r.entry);let a=r.buildVersion?e9(r.name,r.buildVersion):r.name,s=W.__FEDERATION__.__INSTANCES__.findIndex(e=>r.buildVersion?e.options.id===a:e.name===a);if(-1!==s){let e=W.__FEDERATION__.__INSTANCES__[s];a=e.options.id||a;let t=eQ(),o=!0,n=[];Object.keys(t).forEach(e=>{let i=t[e];i&&Object.keys(i).forEach(t=>{let a=i[t];a&&Object.keys(a).forEach(i=>{let s=a[i];s&&Object.keys(s).forEach(a=>{let l=s[a];l&&"object"==typeof l&&l.from===r.name&&(l.loaded||l.loading?(l.useIn=l.useIn.filter(e=>e!==r.name),l.useIn.length?o=!1:n.push([e,t,i,a])):n.push([e,t,i,a]))})})})}),o&&(e.shareScopeMap={},delete t[a]),n.forEach(([e,r,o,n])=>{delete t[e]?.[r]?.[o]?.[n]}),W.__FEDERATION__.__INSTANCES__.splice(s,1)}let{hostGlobalSnapshot:l}=ra(e,t);if(l){let t=l&&"remotesInfo"in l&&l.remotesInfo&&J(l.remotesInfo,e.name).key;t&&(delete l.remotesInfo[t],B.__FEDERATION__.__MANIFEST_LOADING__[t]&&delete B.__FEDERATION__.__MANIFEST_LOADING__[t])}t.moduleCache.delete(e.name)}}catch(e){L.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}};let rh="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN;var rf=class{constructor(e){this.hooks=new t7({beforeInit:new t3("beforeInit"),init:new t4,beforeInitContainer:new t6("beforeInitContainer"),initContainer:new t6("initContainer")}),this.version="2.5.1",this.moduleCache=new Map,this.loaderHook=new t7({getModuleInfo:new t4,createScript:new t4,createLink:new t4,fetch:new t5,loadEntryError:new t5,afterLoadEntry:new t5("afterLoadEntry"),beforeInitRemote:new t5("beforeInitRemote"),afterInitRemote:new t5("afterInitRemote"),beforeGetExpose:new t5("beforeGetExpose"),afterGetExpose:new t5("afterGetExpose"),beforeExecuteFactory:new t5("beforeExecuteFactory"),afterExecuteFactory:new t5("afterExecuteFactory"),getModuleFactory:new t5}),this.bridgeHook=new t7({beforeBridgeRender:new t4,afterBridgeRender:new t4,beforeBridgeDestroy:new t4,afterBridgeDestroy:new t4});const t=rh?[{name:"snapshot-plugin",async afterResolve(e){let{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:i,id:a}=e;if(!D(t)||!j(t)){let{remoteSnapshot:s,globalSnapshot:l}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:tB(t.name,o)});t8(i,s);let c=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:{remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},remoteInfo:i,remote:t,remoteSnapshot:s,globalSnapshot:l});return c&&tQ(i,n,c,!1,{initiator:"loadRemote",id:a}).catch(()=>void 0),{...e,remoteSnapshot:s}}return e}},{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){let{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:i,remoteSnapshot:a}=e;return g?D(n)&&j(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(t8(o,a),function(e,t,r,o,n){let i=[],a=[],s=[],l=new Set,c=new Set,{options:h}=e,{preloadConfig:f}=t,{depsRemote:u}=f;!function e(t,r,o,n,i={},a){let{value:s}=J(t,F(r)),l=a||s;if(l&&!ro(l)&&(o(l,r,n),l.remotesInfo))for(let r of Object.keys(l.remotesInfo)){if(i[r])continue;i[r]=!0;let n=function(e){let t=e.split(":");return 1===t.length?{name:t[0],version:void 0}:2===t.length?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}(r),a=l.remotesInfo[r];e(t,{name:n.name,version:a.matchedVersion},o,!1,i,void 0)}}(o,r,(t,r,o)=>{var n;let l;if(o)l=f;else if(Array.isArray(u)){let e=u.find(e=>e.nameOrAlias===r.name||e.nameOrAlias===r.alias);if(!e)return;l=tz(e)}else{if(!0!==u)return;l=f}let c=te(t,V(t).url);c&&s.push({name:r.name,moduleInfo:{name:r.name,entry:c,type:"remoteEntryType"in t?t.remoteEntryType:"global",entryGlobalName:"globalName"in t?t.globalName:r.name,shareScope:"",version:"version"in t?t.version:void 0},url:c});let h="modules"in t?t.modules:[],m=(n=l.exposes)?n.map(e=>"."===e?e:e.startsWith("./")?e.replace("./",""):e):[];function d(e){let r=e.map(e=>te(t,e));return l.filter?r.filter(l.filter):r}if(m.length&&"modules"in t&&(h=t?.modules?.reduce((e,t)=>(m?.indexOf(t.moduleName)!==-1&&e.push(t),e),[])),h){let o=h.length;for(let n=0;n<o;n++){let o=h[n],s=`${r.name}/${o.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:"."===o.moduleName?r.name:s,name:r.name,remoteSnapshot:t,preloadConfig:l,remote:r,origin:e}),et(s)||("all"===l.resourceCategory?(i.push(...d(o.assets.css.async)),i.push(...d(o.assets.css.sync)),a.push(...d(o.assets.js.async)),a.push(...d(o.assets.js.sync))):"sync"===l.resourceCategory&&(i.push(...d(o.assets.css.sync)),a.push(...d(o.assets.js.sync))),er(s))}}},!0,{},n),n.shared&&n.shared.length>0&&n.shared.forEach(t=>{let r=h.shared?.[t.sharedName];if(!r)return;let o=t.version?r.find(e=>e.version===t.version):r;o&&G(o).forEach(r=>{((t,r)=>{let{shared:o}=eZ(e.shareScopeMap,r.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};o&&"function"==typeof o.lib&&(r.assets.js.sync.forEach(e=>{l.add(e)}),r.assets.css.sync.forEach(e=>{c.add(e)}))})(r,t)})});let m=a.filter(e=>!l.has(e)&&!ri("script",e));return{cssAssets:i.filter(e=>!c.has(e)&&!ri("link",e)),jsAssetsWithoutEntry:m,entryAssets:s.filter(e=>!ri("script",e.url))}}(t,r,o,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}]:[],r={id:"u">typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"",name:e.name,plugins:t,remotes:[],shared:{},inBrowser:g};this.name=e.name,this.options=r,this.snapshotHandler=new rs(this),this.sharedHandler=new rl(this),this.remoteHandler=new rc(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&x(O(tA,tM)),this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=eW,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){let o=new t2({host:this,remoteInfo:tW({name:e,entry:t})});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){let{allShareInfos:r}=eB(e,t),{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),i=this.remoteHandler.formatAndRegisterRemote(n,o),{allShareInfos:a}=this.sharedHandler.registerShared(n,o),s=[...n.plugins];o.plugins&&o.plugins.forEach(e=>{s.includes(e)||s.push(e)});let l={...e,...t,plugins:s,remotes:i,shared:a,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){var t;let r,o,n=(t=this,r=B.__FEDERATION__.__GLOBAL_PLUGIN__,o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook],r.length>0&&r.forEach(t=>{e?.find(e=>e.name!==t.name)&&e.push(t)}),e&&e.length>0&&e.forEach(e=>{o.forEach(r=>{r.applyPlugin(e,t)})}),e);this.options.plugins=this.options.plugins.reduce((e,t)=>(t&&e&&!e.find(e=>e.name===t.name)&&e.push(t),e),n||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function ru(e){let t=new(W.__FEDERATION__.__DEBUG_CONSTRUCTOR__||rf)({id:`${e.name}@${e.version||Date.now()}`,...e});return W.__FEDERATION__.__INSTANCES__.push(t),t}let rm=null;function rd(e){var t,r;let o,n=(t=e.name,r=e.version,o="u">typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"",W.__FEDERATION__.__INSTANCES__.find(e=>!!o&&e.options.id===o||e.options.name===t&&!e.options.version&&!r||e.options.name===t&&!!r&&e.options.version===r)),i={...e,id:e.id||""};return n?(n.initOptions(i),rm||(rm=n),n):rm=ru(i)}function rp(...e){return M(rm,tT,tM),rm.loadRemote.apply(rm,e)}function ry(...e){return M(rm,tT,tM),rm.loadShare.apply(rm,e)}function rg(...e){return M(rm,tT,tM),rm.loadShareSync.apply(rm,e)}function rE(...e){return M(rm,tT,tM),rm.preloadRemote.apply(rm,e)}function r_(...e){return M(rm,tT,tM),rm.registerRemotes.apply(rm,e)}function rS(...e){return M(rm,tT,tM),rm.registerPlugins.apply(rm,e)}function rb(e){return e?W.__FEDERATION__.__INSTANCES__.find(e)||null:rm}function rI(...e){return M(rm,tT,tM),rm.registerShared.apply(rm,e)}!function(e,t=S()){t&&(W.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,W.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.5.1")}(rf);var r$=Object.defineProperty,rN=(e,t)=>{let r={};for(var o in e)r$(r,o,{get:e[o],enumerable:!0});return t||r$(r,Symbol.toStringTag,{value:"Module"}),r},rR=rN({}),rw=rN({}),rv=rN({}),rT=rN({}),rA=rN({}),rk=rN({});function rO(e,t,r){return function(o){if(!1===o)return!1;if(void 0===o)if(e)return t;else return!1;if(!0===o)return t;if(o&&"object"==typeof o)return{...t,...o};throw Error(`Unexpected type for \`${r}\`, expect boolean/undefined/object, got: ${typeof o}`)}}let rP=e=>e;return window.EMP_SHARE_RUNTIME={MFRuntime:o,MFSDK:n},r})());
|
|
3
|
+
${o}`),n.join("\n")},P="[ Federation Runtime ]",L=w(P);function M(e,t,r,o,n){e||(void 0!==r?x(t,r,o,void 0,n):x(t))}function x(e,t,r,o,n){if(void 0!==t){var i=O(e,t,r??{},o);throw Error(`${P}: ${i}`)}if(e instanceof Error)throw e.message.startsWith(P)||(e.message=`${P}: ${e.message}`),e;throw Error(`${P}: ${e}`)}function H(e){e instanceof Error&&(e.message.startsWith(P)||(e.message=`${P}: ${e.message}`)),L.warn(e)}function F(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function D(e){return void 0!==e.entry}function j(e){return!e.entry.includes(".json")}function C(e){return e&&"object"==typeof e}let U=Object.prototype.toString;function G(e){return Array.isArray(e)?e:[e]}function V(e){let t={url:"",type:"global",globalName:""};return g||_()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}let W="object"==typeof globalThis?globalThis:window,B=(()=>{try{return document.defaultView}catch{return W}})();function q(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function z(e,t){return Object.hasOwnProperty.call(e,t)}z(W,"__GLOBAL_LOADING_REMOTE_ENTRY__")||q(W,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});let K=W.__GLOBAL_LOADING_REMOTE_ENTRY__;function Y(e){z(e,"__VMOK__")&&!z(e,"__FEDERATION__")&&q(e,"__FEDERATION__",e.__VMOK__),z(e,"__FEDERATION__")||(q(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),q(e,"__VMOK__",e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}function J(e,t){if("string"==typeof t)if(e[t])return{value:e[t],key:t};else{for(let r of Object.keys(e)){let[o,n]=r.split(":"),i=`${o}:${t}`,a=e[i];if(a)return{value:a,key:i}}return{value:void 0,key:t}}x(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}Y(W),Y(B);let X=e=>((e,t)=>{let r=J(t,F(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){let{version:t,...r}=e,o=F(r),n=J(B.__FEDERATION__.moduleInfo,o).value;if(n?.version===t)return n}})(e,B.__FEDERATION__.moduleInfo),Z=(e,t)=>{let r=F(e);return B.__FEDERATION__.moduleInfo[r]=t,B.__FEDERATION__.moduleInfo},Q=(e,t)=>{let r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:W[r]}},ee=e=>{let{__GLOBAL_PLUGIN__:t}=B.__FEDERATION__;e.forEach(e=>{-1===t.findIndex(t=>t.name===e.name)?t.push(e):H(`The plugin ${e.name} has been registered.`)})},et=e=>W.__FEDERATION__.__PRELOADED_MAP__.get(e),er=e=>W.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),eo="[0-9A-Za-z-]+",en=`(?:\\+(${eo}(?:\\.${eo})*))`,ei="0|[1-9]\\d*",ea="[0-9]+",es="\\d*[a-zA-Z-][a-zA-Z0-9-]*",el=`(?:${ea}|${es})`,ec=`(?:-?(${el}(?:\\.${el})*))`,eh=`(?:${ei}|${es})`,ef=`(?:-(${eh}(?:\\.${eh})*))`,eu=`${ei}|x|X|\\*`,em=`[v=\\s]*(${eu})(?:\\.(${eu})(?:\\.(${eu})(?:${ef})?${en}?)?)?`,ed=`^\\s*(${em})\\s+-\\s+(${em})\\s*$`,ep=`[v=\\s]*${`(${ea})\\.(${ea})\\.(${ea})`}${ec}?${en}?`,ey="((?:<|>)?=?)",eg=`(\\s*)${ey}\\s*(${ep}|${em})`,eE="(?:~>?)",e_=`(\\s*)${eE}\\s+`,eS="(?:\\^)",eb=`(\\s*)${eS}\\s+`,eI=`^${eS}${em}$`,e$=`v?${`(${ei})\\.(${ei})\\.(${ei})`}${ef}?${en}?`,eN=`^${eE}${em}$`,eR=`^${ey}\\s*${em}$`,ew=`^${ey}\\s*(${e$})$|^$`;function ev(e){return new RegExp(e)}function eT(e){return!e||"x"===e.toLowerCase()||"*"===e}function eA(...e){return t=>e.reduce((e,t)=>t(e),t)}function ek(e){return e.match(ev(ew))}function eO(e,t,r,o){let n=`${e}.${t}.${r}`;return o?`${n}-${o}`:n}function eP(e){return e.replace(ev(ed),(e,t,r,o,n,i,a,s,l,c,h,f)=>(t=eT(r)?"":eT(o)?`>=${r}.0.0`:eT(n)?`>=${r}.${o}.0`:`>=${t}`,s=eT(l)?"":eT(c)?`<${Number(l)+1}.0.0-0`:eT(h)?`<${l}.${Number(c)+1}.0-0`:f?`<=${l}.${c}.${h}-${f}`:`<=${s}`,`${t} ${s}`.trim()))}function eL(e){return e.replace(ev(eg),"$1$2$3")}function eM(e){return e.replace(ev(e_),"$1~")}function ex(e){return e.replace(ev(eb),"$1^")}function eH(e){return e.trim().split(/\s+/).map(e=>e.replace(ev(eI),(e,t,r,o,n)=>{if(eT(t))return"";if(eT(r))return`>=${t}.0.0 <${Number(t)+1}.0.0-0`;if(eT(o))if("0"===t)return`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`;else return`>=${t}.${r}.0 <${Number(t)+1}.0.0-0`;if(n)if("0"!==t)return`>=${t}.${r}.${o}-${n} <${Number(t)+1}.0.0-0`;else if("0"===r)return`>=${t}.${r}.${o}-${n} <${t}.${r}.${Number(o)+1}-0`;else return`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`;if("0"===t)if("0"===r)return`>=${t}.${r}.${o} <${t}.${r}.${Number(o)+1}-0`;else return`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`;return`>=${t}.${r}.${o} <${Number(t)+1}.0.0-0`})).join(" ")}function eF(e){return e.trim().split(/\s+/).map(e=>e.replace(ev(eN),(e,t,r,o,n)=>eT(t)?"":eT(r)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:eT(o)?`>=${t}.${r}.0 <${t}.${Number(r)+1}.0-0`:n?`>=${t}.${r}.${o}-${n} <${t}.${Number(r)+1}.0-0`:`>=${t}.${r}.${o} <${t}.${Number(r)+1}.0-0`)).join(" ")}function eD(e){return e.split(/\s+/).map(e=>e.trim().replace(ev(eR),(e,t,r,o,n,i)=>{let a=eT(r),s=a||eT(o),l=s||eT(n);if("="===t&&l&&(t=""),i="",a)if(">"===t||"<"===t)return"<0.0.0-0";else return"*";return t&&l?(s&&(o=0),n=0,">"===t?(t=">=",s?(r=Number(r)+1,o=0):o=Number(o)+1,n=0):"<="===t&&(t="<",s?r=Number(r)+1:o=Number(o)+1),"<"===t&&(i="-0"),`${t+r}.${o}.${n}${i}`):s?`>=${r}.0.0${i} <${Number(r)+1}.0.0-0`:l?`>=${r}.${o}.0${i} <${r}.${Number(o)+1}.0-0`:e})).join(" ")}function ej(e){return e.trim().replace(ev("(<|>)?=?\\s*\\*"),"")}function eC(e,t){return(e=Number(e)||e)>(t=Number(t)||t)?1:e===t?0:-1}function eU(e,t){return eC(e.major,t.major)||eC(e.minor,t.minor)||eC(e.patch,t.patch)||function(e,t){let{preRelease:r}=e,{preRelease:o}=t;if(void 0===r&&o)return 1;if(r&&void 0===o)return -1;if(void 0===r&&void 0===o)return 0;for(let e=0,t=r.length;e<=t;e++){let t=r[e],n=o[e];if(t!==n){if(void 0===t&&void 0===n)return 0;if(!t)return 1;if(!n)return -1;return eC(t,n)}}return 0}(e,t)}function eG(e,t){return e.version===t.version}function eV(e,t){if(!e)return!1;let r=ek(e);if(!r)return!1;let[,o,,n,i,a,s]=r,l={operator:o,version:eO(n,i,a,s),major:n,minor:i,patch:a,preRelease:s?.split(".")};for(let e of t.split("||")){let t=e.trim();if(!t||"*"===t||"x"===t)return!0;try{let e=eA(eP,eL,eM,ex)(t.trim()).split(/\s+/).join(" ");if(!e.trim())return!0;let r=e.split(" ").map(e=>eA(eH,eF,eD,ej)(e)).join(" ");if(!r.trim())return!0;let o=r.split(/\s+/).map(e=>e.trim().replace(ev("^\\s*>=\\s*0.0.0\\s*$"),"")).filter(Boolean);if(0===o.length)continue;let n=!0;for(let e of o){let t=ek(e);if(!t){n=!1;break}let[,r,,o,i,a,s]=t;if(!function(e,t){switch(e.operator){case"":case"=":return eG(e,t);case">":return 0>eU(e,t);case">=":return eG(e,t)||0>eU(e,t);case"<":return eU(e,t)>0;case"<=":return eG(e,t)||eU(e,t)>0;case void 0:return!0;default:return!1}}({operator:r,version:eO(o,i,a,s),major:o,minor:i,patch:a,preRelease:s?.split(".")},l)){n=!1;break}}if(n)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}let eW="default";function eB(e,t){let r=t.shared||{},o=t.name,n=Object.keys(r).reduce((e,n)=>{let i=G(r[n]);return e[n]=e[n]||[],i.forEach(r=>{var i;let a;e[n].push((i=t.shareStrategy,a="get"in r?r.get:"lib"in r?()=>Promise.resolve(r.lib):()=>Promise.resolve(()=>{x(`Cannot get shared "${n}" from "${o}": neither "get" nor "lib" is provided in the share config.`)}),r.shareConfig?.eager&&r.treeShaking?.mode&&x(`Invalid shared config for "${n}" from "${o}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:o,loading:null,...r,shareConfig:{requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1,...r.shareConfig},get:a,loaded:!!r?.loaded||"lib"in r||void 0,version:r.version??"0",scope:Array.isArray(r.scope)?r.scope:[r.scope??"default"],strategy:(r.strategy??i)||"version-first",treeShaking:r.treeShaking?{...r.treeShaking,mode:r.treeShaking.mode??"server-calc",status:r.treeShaking.status??y.UNKNOWN,useIn:[]}:void 0}))}),e},{}),i={...e.shared};return Object.keys(n).forEach(e=>{i[e]?n[e].forEach(t=>{i[e].find(e=>e.version===t.version)||i[e].push(t)}):i[e]=n[e]}),{allShareInfos:i,newShareInfos:n}}function eq(e,t){if(!e)return!1;let{status:r,mode:o}=e;return r!==y.NO_USE&&(r===y.CALCULATED||"runtime-infer"===o&&(!t||eJ(e,t)))}function ez(e,t){let r=e=>{if(!Number.isNaN(Number(e))){let t=e.split("."),r=e;for(let e=0;e<3-t.length;e++)r+=".0";return r}return e};return!!eV(r(e),`<=${r(t)}`)}let eK=(e,t)=>{let r=t||function(e,t){return ez(e,t)};return Object.keys(e).reduce((e,t)=>!e||r(e,t)||"0"===e?t:e,0)},eY=e=>!!e.loaded||"function"==typeof e.lib,eJ=(e,t)=>{if(!e||!t)return!1;let{usedExports:r}=e;return!!r&&!!t.every(e=>r.includes(e))},eX=e=>eY(e)||!!e.loading;function eZ(e,t,r,o){if(!e)return;let{shareConfig:n,scope:i=eW,strategy:a,treeShaking:s}=r;for(let l of Array.isArray(i)?i:[i])if(n&&e[l]&&e[l][t]){let{requiredVersion:i}=n,{version:c,useTreesShaking:h}=("loaded-first"===a?function(e,t,r,o){let n=e[t][r],i="",a=eq(o),s=function(e,t){if(a){if(!n[e].treeShaking)return!0;if(!n[t].treeShaking)return!1;if(eX(n[t].treeShaking))if(eX(n[e].treeShaking))return!!ez(e,t);else return!0;if(eX(n[e].treeShaking))return!1}if(eX(n[t]))if(eX(n[e]))return!!ez(e,t);else return!0;return!eX(n[e])&&ez(e,t)};if(a){if(i=eK(e[t][r],s))return{version:i,useTreesShaking:a};a=!1}return{version:eK(e[t][r],s),useTreesShaking:a}}:function(e,t,r,o){let n=e[t][r],i="",a=eq(o),s=function(e,t){return a?!n[e].treeShaking||!!n[t].treeShaking&&!eY(n[e].treeShaking)&&ez(e,t):!eY(n[e])&&ez(e,t)};if(a){if(i=eK(e[t][r],s))return{version:i,useTreesShaking:a};a=!1}return{version:eK(e[t][r],s),useTreesShaking:a}})(e,l,t,s),f=()=>{let o=e[l][t][c];if(n.singleton){if("string"==typeof i&&!eV(c,i)){let e=`Version ${c} from ${c&&o.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${i})`;n.strictVersion?x(e):H(e)}return{shared:o,useTreesShaking:h}}{if(!1===i||"*"===i||eV(c,i))return{shared:o,useTreesShaking:h};let r=eq(s);if(r){for(let[o,n]of Object.entries(e[l][t]))if(eq(n.treeShaking,s?.usedExports)&&eV(o,i))return{shared:n,useTreesShaking:r}}for(let[r,o]of Object.entries(e[l][t]))if(eV(r,i))return{shared:o,useTreesShaking:!1}}},u={shareScopeMap:e,scope:l,pkgName:t,version:c,GlobalFederation:B.__FEDERATION__,shareInfo:r,resolver:f};return(o.emit(u)||u).resolver()}}function eQ(){return B.__FEDERATION__.__SHARE__}function e0(e){let{pkgName:t,extraOptions:r,shareInfos:o}=e,n=r?.resolver??(e=>{if(!e)return;let t={};return e.forEach(e=>{t[e.version]=e}),t[eK(t,function(e,r){return!eY(t[e])&&ez(e,r)})]}),i=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),a=(...e)=>{let t={};for(let r of e)if(r)for(let[e,o]of Object.entries(r)){let r=t[e];i(r)&&i(o)?t[e]=a(r,o):void 0!==o&&(t[e]=o)}return t};return a(n(o[t]),r?.customShareInfo)}let e1=(e,t)=>{var r;e.useIn||(e.useIn=[]),r=e.useIn,-1===r.findIndex(e=>e===t)&&r.push(t)};function e2(e,t){return t&&e.treeShaking?e.treeShaking:e}let e4="[ Federation Runtime ]",e9=(e,t,r=":")=>{let o=e.split(r),n="development"===b().NODE_ENV&&t,i=e=>e.startsWith("http")||e.includes(".json");if(o.length>=2){let[t,...a]=o;e.startsWith(r)&&(t=o.slice(0,2).join(r),a=[n||o.slice(2).join(r)]);let s=n||a.join(r);return i(s)?{name:t,entry:s}:{name:t,version:s||"*"}}if(1===o.length){let[e]=o;return n&&i(n)?{name:e,entry:n}:{name:e,version:n||"*"}}throw`Invalid entry value: ${e}`},e3=function(...e){return e.length?e.reduce((e,t)=>t?e?`${e}:${t}`:t:e,""):""},e5=function(e,t="",r=!1){try{return`${t}${e.replace(RegExp(`${s.AT}`,"g"),l[s.AT]).replace(RegExp(`${s.HYPHEN}`,"g"),l[s.HYPHEN]).replace(RegExp(`${s.SLASH}`,"g"),l[s.SLASH])}${r?".js":""}`}catch(e){throw e}},e6=function(e,t,r){try{let o=e;if(t){if(!o.startsWith(t))return o;o=o.replace(RegExp(t,"g"),"")}return o=o.replace(RegExp(`${l[s.AT]}`,"g"),c[l[s.AT]]).replace(RegExp(`${l[s.SLASH]}`,"g"),c[l[s.SLASH]]).replace(RegExp(`${l[s.HYPHEN]}`,"g"),c[l[s.HYPHEN]]),r&&(o=o.replace(".js","")),o}catch(e){throw e}},e7=(e,t)=>{if(!e)return"";let r=e;return"."===r&&(r="default_export"),r.startsWith("./")&&(r=r.replace("./","")),e5(r,"__federation_expose_",t)},e8=(e,t)=>e?e5(e,"__federation_shared_",t):"",te=(e,t)=>{if("getPublicPath"in e){let r;return r=e.getPublicPath.startsWith("function")?Function("return "+e.getPublicPath)()():Function(e.getPublicPath)(),`${r}${t}`}return"publicPath"in e?!g&&!_()&&"ssrPublicPath"in e&&"string"==typeof e.ssrPublicPath?`${e.ssrPublicPath}${t}`:`${e.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},tt=(e,t)=>{e||tr(t)},tr=e=>{throw Error(`${e4}: ${e}`)},to=e=>{console.warn(`${e4}: ${e}`)};function tn(e){try{return JSON.stringify(e,null,2)}catch(e){return""}}let ti=/^([\d^=v<>~]|[*xX]$)/;function ta(e){return ti.test(e)}async function ts(e,t){try{return await e()}catch(e){t||to(e);return}}function tl(e,t){let r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function tc(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("script");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("src");if(a&&tl(a,e.url)){r=n,o=!1;break}}if(!r){let t,o=e.attrs;(r=document.createElement("script")).type=o?.type==="module"?"module":"text/javascript",e.createScriptHook&&((t=e.createScriptHook(e.url,e.attrs))instanceof HTMLScriptElement?r=t:"object"==typeof t&&("script"in t&&t.script&&(r=t.script),"timeout"in t&&t.timeout&&(n=t.timeout))),r.src||(r.src=e.url),o&&!t&&Object.keys(o).forEach(e=>{r&&("async"===e||"defer"===e?r[e]=o[e]:r.getAttribute(e)||r.setAttribute(e,o[e]))})}let a=null,s="u">typeof window?t=>{if(t.filename&&tl(t.filename,e.url)){let r=Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);r.name="ScriptExecutionError",a=r}}:null;s&&window.addEventListener("error",s);let l=async(o,n)=>{clearTimeout(t),s&&window.removeEventListener("error",s);let i=()=>{if(n?.type==="error"){let t=Error(n?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);t.name="ScriptNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else a?e?.onErrorCallback&&e?.onErrorCallback(a):e?.cb&&e?.cb()};if(r&&(r.onerror=null,r.onload=null,ts(()=>{let{needDeleteScript:t=!0}=e;t&&r?.parentNode&&r.parentNode.removeChild(r)}),o&&"function"==typeof o)){let e=o(n);if(e instanceof Promise){let t=await e;return i(),t}return i(),e}i()};return r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),t=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:r,needAttach:o}}function th(e){let t,r=null,o=!0,n=2e4,i=document.getElementsByTagName("link");for(let t=0;t<i.length;t++){let n=i[t],a=n.getAttribute("href"),s=n.getAttribute("rel");if(a&&tl(a,e.url)&&s===e.attrs.rel){r=n,o=!1;break}}if(!r){let t;(r=document.createElement("link")).setAttribute("href",e.url);let o=!0,i=e.attrs;e.createLinkHook&&((t=e.createLinkHook(e.url,i))instanceof HTMLLinkElement?(r=t,o=!1):"object"==typeof t&&("link"in t&&t.link&&(r=t.link,o=!1),"timeout"in t&&t.timeout&&(n=t.timeout))),i&&o&&Object.keys(i).forEach(e=>{r&&!r.getAttribute(e)&&r.setAttribute(e,i[e])})}if(!o)return Promise.resolve().then(()=>{e?.cb&&e?.cb()}),{link:r,needAttach:o};let a=(o,n)=>{t&&clearTimeout(t);let i=()=>{if(n?.type==="error"){let t=Error(n?.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name="LinkNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else e?.cb&&e?.cb()};if(r&&(r.onerror=null,r.onload=null,ts(()=>{let{needDeleteLink:t=!0}=e;t&&r?.parentNode&&r.parentNode.removeChild(r)}),o)){let e=o(n);return i(),e}i()};return r.onerror=a.bind(null,r.onerror),r.onload=a.bind(null,r.onload),t=setTimeout(()=>{a(null,{type:"error",isTimeout:!0})},n),{link:r,needAttach:o}}function tf(e,t){let{attrs:r={},createScriptHook:o}=t;return new Promise((t,n)=>{let{script:i,needAttach:a}=tc({url:e,cb:t,onErrorCallback:n,attrs:{fetchpriority:"high",...r},createScriptHook:o,needDeleteScript:!0});a&&document.head.appendChild(i)})}let tu=new Map;function tm(e){if(!e)throw Error("import specifier is required");if(tu.has(e))return tu.get(e);let t=Function("name","return import(name)")(e).then(e=>e).catch(t=>{throw console.error(`Error importing module ${e}:`,t),tu.delete(e),t});return tu.set(e,t),t}let td=async()=>{let e=await tm("node-fetch");return e.default||e},tp=async(e,t,r)=>{let o,n=await (o=t||{},r.lifecycle.fetch.emit(e,o));return n&&n instanceof Response?n:("u"<typeof fetch?await td():fetch)(e,t||{})},ty="u"<typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t,r,o)=>{let n;if(o?.createScriptHook){let t=o.createScriptHook(e);t&&"object"==typeof t&&"url"in t&&(e=t.url)}try{n=new URL(e)}catch(e){console.error("Error constructing URL:",e),t(Error(`Invalid URL: ${e}`));return}let i=async(e,o)=>{try{let n,i=await e(o.href),a=await i.text(),[s,l]=await Promise.all([tm("path"),tm("vm")]),c={},h={exports:{}},f=o.pathname.split("/").slice(0,-1).join("/"),u=s.basename(o.pathname),m=new l.Script(`(function(exports, module, require, __dirname, __filename) {${a}
|
|
4
|
+
})`,{filename:u,importModuleDynamically:l.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER??tm});n=(await tm("node:module")).createRequire("file:"===o.protocol||"node:"===o.protocol?o.href:s.join(process.cwd(),"__mf_require_base__.js")),m.runInThisContext()(c,h,n,f,u);let d=h.exports||c;if(r&&d&&r.globalName)return void t(void 0,d[r.globalName]||d);t(void 0,d)}catch(e){t(e instanceof Error?e:Error(`Script execution error: ${e}`))}};(async()=>o?.fetch?(e,t)=>tp(e,t,o):"u"<typeof fetch?td():fetch)().then(async e=>{if(r?.type==="esm"||r?.type==="module")return t_(n.href,{fetch:e,vm:await tm("vm")}).then(async e=>{await e.evaluate(),t(void 0,e.namespace)}).catch(e=>{t(e instanceof Error?e:Error(`Script execution error: ${e}`))});i(e,n)}).catch(e=>{t(e)})}:(e,t,r,o)=>{t(Error("createScriptNode is disabled in non-Node.js environment"))},tg="u"<typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t)=>new Promise((r,o)=>{ty(e,(e,n)=>{if(e)o(e);else{let e=t?.attrs?.globalName||`__FEDERATION_${t?.attrs?.name}:custom__`;r(globalThis[e]=n)}},t.attrs,t.loaderHook)}):(e,t)=>{throw Error("loadScriptNode is disabled in non-Node.js environment")},tE=new Map;async function t_(e,t){if(tE.has(e))return tE.get(e);let{fetch:r,vm:o}=t,n=await (await r(e)).text(),i=new o.SourceTextModule(n,{importModuleDynamically:async(r,o)=>t_(new URL(r,e).href,t)});return tE.set(e,i),await i.link(async r=>{let o=new URL(r,e).href;return await t_(o,t)}),i}let tS="RUNTIME-001",tb="RUNTIME-002",tI="RUNTIME-003",t$="RUNTIME-004",tN="RUNTIME-005",tR="RUNTIME-006",tw="RUNTIME-007",tv="RUNTIME-008",tT="RUNTIME-009",tA="RUNTIME-010",tk="RUNTIME-011",tO="RUNTIME-013",tP="RUNTIME-014",tL="RUNTIME-015",tM={[tS]:"Failed to get remoteEntry exports.",[tb]:'The remote entry interface does not contain "init"',[tI]:"Failed to get manifest.",[t$]:"Failed to locate remote.",[tN]:"Invalid loadShareSync function call from bundler runtime",[tR]:"Invalid loadShareSync function call from runtime",[tw]:"Failed to get remote snapshot.",[tv]:"Failed to load script resources.",[tT]:"Please call createInstance first.",[tA]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[tk]:"The remoteEntry URL is missing from the remote snapshot.","RUNTIME-012":'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.',[tO]:"The manifest is not a valid Module Federation manifest.",[tP]:"The remote does not expose the requested module.",[tL]:"Remote container initialization failed."};({...tM,"TYPE-001":"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.","BUILD-001":"Failed to find expose module.","BUILD-002":"PublicPath is required in prod mode."});let tx=".then(callbacks[0]).catch(callbacks[1])";async function tH({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):Function("callbacks",`import("${e}")${tx}`)([r,o])}catch(t){x(`Failed to load ESM entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}async function tF({entry:e,remoteEntryExports:t}){return new Promise((r,o)=>{try{t?r(t):Function("callbacks",`System.import("${e}")${tx}`)([r,o])}catch(t){x(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}})}function tD(e,t,r){let{remoteEntryKey:o,entryExports:n}=Q(e,t);return n||x(tS,tM,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:o}),n}async function tj({name:e,globalName:t,entry:r,remoteInfo:o,loaderHook:n,getEntryUrl:i,resourceContext:a}){let{entryExports:s}=Q(e,t);if(s)return s;let l=i?i(r):r;return tf(l,{attrs:{},createScriptHook:(e,t)=>{let r=n.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:o,resourceContext:a?{...a,url:e}:void 0});if(r&&(r instanceof HTMLScriptElement||"script"in r||"timeout"in r))return r}}).then(()=>tD(e,t,r),t=>{x(tv,tM,{remoteName:e,resourceUrl:l},t instanceof Error?t.message:String(t))})}async function tC({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:o,resourceContext:n}){let{entry:i,entryGlobalName:a,name:s,type:l}=e;switch(l){case"esm":case"module":return tH({entry:i,remoteEntryExports:t});case"system":return tF({entry:i,remoteEntryExports:t});default:return tj({entry:i,globalName:a,name:s,remoteInfo:e,loaderHook:r,getEntryUrl:o,resourceContext:n})}}async function tU({remoteInfo:e,loaderHook:t,resourceContext:r}){let{entry:o,entryGlobalName:n,name:i,type:a}=e,{entryExports:s}=Q(i,n);return s||tg(o,{attrs:{name:i,globalName:n,type:a},loaderHook:{createScriptHook:(o,n={})=>{let i=t.lifecycle.createScript.emit({url:o,attrs:n,remoteInfo:e,resourceContext:r?{...r,url:o}:void 0});if(i&&"url"in i)return i}}}).then(()=>tD(i,n,o)).catch(e=>{x(`Failed to load Node.js entry for remote "${i}" from "${o}". ${e instanceof Error?e.message:String(e)}`)})}function tG(e){let{entry:t,name:r}=e;return e3(r,t)}async function tV(e){let{origin:t,remoteEntryExports:r,remoteInfo:o,getEntryUrl:n,resourceContext:i,_inErrorHandling:a=!1}=e,s=tG(o);if(r)return r;if(!K[s]){let e=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;K[s]=e.emit({origin:t,loaderHook:l,remoteInfo:o,remoteEntryExports:r}).then(e=>e||(("u">typeof ENV_TARGET?"web"===ENV_TARGET:g)?tC({remoteInfo:o,remoteEntryExports:r,loaderHook:l,getEntryUrl:n,resourceContext:i}):tU({remoteInfo:o,loaderHook:l,resourceContext:i}))).then(async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:e}),e)).catch(async e=>{let n=tG(o),i=e instanceof Error&&e.message.includes("ScriptExecutionError");if(e instanceof Error&&e.message.includes(tv)&&!i&&!a){let e=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e=>tV({...e,_inErrorHandling:!0}),origin:t,remoteInfo:o,remoteEntryExports:r,globalLoading:K,uniqueKey:n});if(e)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,remoteEntryExports:e,recovered:!0}),e}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:o,error:e}),e})}return K[s]}function tW(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||eW}}function tB(e,t){return t&&"."!==t?`${e}/${t.replace(/^\.\//,"")}`:e}function tq(e,t){for(let r of e){let e=t.startsWith(r.name),o=t.replace(r.name,"");if(e){if(o.startsWith("/"))return{pkgNameOrAlias:r.name,expose:o=`.${o}`,remote:r};else if(""===o)return{pkgNameOrAlias:r.name,expose:".",remote:r}}let n=r.alias&&t.startsWith(r.alias),i=r.alias&&t.replace(r.alias,"");if(r.alias&&n){if(i&&i.startsWith("/"))return{pkgNameOrAlias:r.alias,expose:i=`.${i}`,remote:r};else if(""===i)return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function tz(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function tK(e){return e instanceof Error&&(e.message.includes("timed out")||e.name.includes("Timeout"))}function tY(e,t,r,o){return{url:t,status:r,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:o}}async function tJ(e,t,r,o){let n=e.moduleCache.get(r.name),i=r.entry;if(n?.remoteEntryExports)return tY(o,i,"cached");try{if(!await tV({origin:e,remoteInfo:r,remoteEntryExports:n?.remoteEntryExports,resourceContext:{...o,url:i}}))throw Error(`Failed to load remoteEntry "${i}".`);return tY(o,i,"success")}catch(e){return tY(o,i,tK(e)?"timeout":"error",e)}}function tX({host:e,remoteInfo:t,url:r,attrs:o,context:n,needDeleteLink:i}){return new Promise(a=>{let{link:s,needAttach:l}=th({url:r,cb:()=>{a(tY(n,r,l?"success":"cached"))},onErrorCallback:e=>{a(tY(n,r,tK(e)?"timeout":"error",e))},attrs:o,createLinkHook:(r,o)=>{let i=e.loaderHook.lifecycle.createLink.emit({url:r,attrs:o,remoteInfo:t,resourceContext:{...n,url:r}});return i instanceof HTMLLinkElement,i},needDeleteLink:i});l&&document.head.appendChild(s)})}function tZ(e,t){return{...e,resourceType:t}}function tQ(e,t,r,o=!0,n={initiator:"preloadRemote",id:e.name}){let{cssAssets:i,jsAssetsWithoutEntry:a,entryAssets:s}=r,l=[];if(t.options.inBrowser){if(s.forEach(r=>{let{moduleInfo:o}=r;l.push(tJ(t,e,o,tZ(n,"remoteEntry")))}),o){let r={rel:"preload",as:"style"};i.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"css")}))})}else{let r={rel:"stylesheet",type:"text/css"};i.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,needDeleteLink:!1,context:tZ(n,"css")}))})}if(o){let r={rel:"preload",as:"script"};a.forEach(o=>{l.push(tX({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"js")}))})}else{let r={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(o=>{l.push(function({host:e,remoteInfo:t,url:r,attrs:o,context:n}){return new Promise(i=>{let{script:a,needAttach:s}=tc({url:r,cb:()=>{i(tY(n,r,s?"success":"cached"))},onErrorCallback:e=>{i(tY(n,r,tK(e)?"timeout":"error",e))},attrs:o,createScriptHook:(r,o)=>{let i=e.loaderHook.lifecycle.createScript.emit({url:r,attrs:o,remoteInfo:t,resourceContext:{...n,url:r}});return i instanceof HTMLScriptElement,i},needDeleteScript:!0});s&&document.head.appendChild(a)})}({host:t,remoteInfo:e,url:o,attrs:r,context:tZ(n,"js")}))})}}return Promise.all(l)}function t0(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function t1(e){let t={};for(let[r,o]of Object.entries(e.shared)){let e=o[0];e&&(t[r]={version:e.version,singleton:e.shareConfig?.singleton,requiredVersion:e.shareConfig?.requiredVersion!==!1&&e.shareConfig?.requiredVersion,eager:e.eager,strictVersion:e.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?"host":"unknown"},mfConfig:{name:e.name,remotes:e.remotes?.map(t0)??[],shared:t}}}var t2=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;let t=await tV({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:tB(this.remoteInfo.name,e),resourceType:"remoteEntry"}});return M(t,`remoteEntryExports is undefined
|
|
5
|
+
${tn(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,r,o){let n=await this.getEntry(o);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host}),n;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:r,cached:!0,origin:this.host}),r}return n}this.initing=!0,this.initPromise=(async()=>{var o,i;let a,s;await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});let{remoteEntryInitOptions:l,shareScope:c,initScope:h}=(o=this.remoteInfo,i=this.host.shareScopeMap,(a=Array.isArray(o.shareScope)?o.shareScope:[o.shareScope]).length||a.push("default"),a.forEach(e=>{i[e]||(i[e]={})}),Object.defineProperty(s={version:o.version||"",shareScopeKeys:Array.isArray(o.shareScope)?a:o.shareScope||"default"},"shareScopeMap",{value:i,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:i[a[0]],initScope:r??[]}),f=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:c,remoteEntryInitOptions:l,initScope:h,remoteInfo:this.remoteInfo,origin:this.host});void 0===n?.init&&x(tb,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,t1(this.host.options));try{await n.init(f.shareScope,f.initScope,f.remoteEntryInitOptions)}catch(e){x(tL,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,t1(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...f,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:r,origin:this.host}),r}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,o){var n,i;let a,s,{loadFactory:l=!0}=r||{loadFactory:!0},c=await this.init(e,o,void 0,t);this.lib=c,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,origin:this.host});try{let r=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:c,expose:t,moduleInfo:this.remoteInfo});(a="function"==typeof r?r:void 0)||(a=await c.get(t)),a||x(tP,tM,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:function(e){if(!e||!("modules"in e)||!Array.isArray(e.modules))return;let t=e.modules.map(e=>e.moduleName).filter(Boolean);return t.length?t.join(","):void 0}(o)},void 0,t1(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,moduleFactory:a,origin:this.host})}catch(r){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:c,error:r,origin:this.host}),r}let h=(n=this.remoteInfo.name,i=t,s=n.endsWith("/")?n.slice(0,-1):n,i.startsWith(".")&&(i=i.slice(1)),s+=i),f=this.wraperFactory(a,h);if(!l)return f;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,origin:this.host});try{let r=await f();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,exposeModule:r,origin:this.host}),r}catch(r){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:l,error:r,origin:this.host}),r}}wraperFactory(e,t){function r(e,t){e&&"object"==typeof e&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for("mf_module_id"))&&Object.defineProperty(e,Symbol.for("mf_module_id"),{value:t,enumerable:!1})}return()=>{let o=e();return o instanceof Promise?o.then(e=>(r(e,t),e)):(r(o,t),o)}}},t4=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){"function"==typeof e&&this.listeners.add(e)}once(e){let t=this;this.on(function r(...o){return t.remove(r),e.apply(null,o)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{let o=r(...e);void 0!==o&&(t=o)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},t9=class extends t4{emit(...e){let t,r=Array.from(this.listeners);if(r.length>0){let o=0,n=t=>!1!==t&&(o<r.length?Promise.resolve(r[o++].apply(null,e)).then(r=>void 0===r||1===e.length&&r===e[0]?n(t):n(r)):t);t=n()}return Promise.resolve(t)}};function t3(e,t){if(!C(t))return!1;if(e!==t){for(let r in e)if(!(r in t))return!1}return!0}var t5=class extends t4{constructor(e){super(),this.onerror=x,this.type=e}emit(e){for(let t of(C(e)||x(`The data for the "${this.type}" hook should be an object.`),this.listeners))try{let r=t(e);if(void 0===r)continue;if(t3(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(e){H(e),this.onerror(e)}return e}},t6=class extends t4{constructor(e){super(),this.onerror=x,this.type=e}emit(e){C(e)||x(`The response data for the "${this.type}" hook must be an object.`);let t=Array.from(this.listeners);if(t.length>0){let r=0,o=t=>(H(t),this.onerror(t),e),n=i=>{if(void 0!==i&&t3(e,i))e=i;else if(void 0!==i)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(r<t.length)try{return Promise.resolve(t[r++](e)).then(n,o)}catch(e){return o(e)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}},t7=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){M("[object Object]"===U.call(e),"Plugin configuration is invalid.");let r=e.name;M(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach(t=>{let r=e[t];r&&this.lifecycle[t].on(r)}))}removePlugin(e){M(e,"A name is required.");let t=this.registerPlugins[e];M(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(e=>{"name"!==e&&this.lifecycle[e].remove(t[e])})}};function t8(e,t){let r=V(t);r.url||x(tk,tM,{remoteName:e.name});let o=te(t,r.url);g||o.startsWith("http")||(o=`https:${o}`),e.type=r.type,e.entryGlobalName=r.globalName,e.entry=o,e.version=t.version,e.buildVersion=t.buildVersion}let re=(e,t)=>{if(!e)return t;let r=(e=>{if("."===e)return"";if(e.startsWith("./"))return e.replace("./","");if(e.startsWith("/")){let t=e.slice(1);return t.endsWith("/")?t.slice(0,-1):t}return e})(e);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function rt(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function rr(e,t={}){let r,{remotes:o={},overrides:n={},version:i}=t,a=()=>"publicPath"in e.metaData?("auto"===e.metaData.publicPath||""===e.metaData.publicPath)&&i?rt(i):e.metaData.publicPath:e.metaData.getPublicPath,s=Object.keys(n),l={};Object.keys(o).length||(l=e.remotes?.reduce((e,t)=>{let r,o=t.federationContainerName;return r=s.includes(o)?n[o]:"version"in t?t.version:t.entry,e[o]={matchedVersion:r},e},{})||{}),Object.keys(o).forEach(e=>l[e]={matchedVersion:s.includes(e)?n[e]:o[e]});let{remoteEntry:{path:c,name:h,type:f},types:u={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:m},globalName:d,ssrRemoteEntry:p}=e.metaData,{exposes:y}=e,g={version:i||"",buildVersion:m,globalName:d,remoteEntry:re(c,h),remoteEntryType:f,remoteTypes:re(u.path,u.name),remoteTypesZip:u.zip||"",remoteTypesAPI:u.api||"",remotesInfo:l,shared:e?.shared.map(e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]})),modules:y?.map(e=>({moduleName:e.name,modulePath:e.path,assets:e.assets}))};if("publicPath"in e.metaData?(r={...g,publicPath:a()},"string"==typeof e.metaData.ssrPublicPath&&(r.ssrPublicPath=e.metaData.ssrPublicPath)):r={...g,getPublicPath:a()},p){let e=re(p.path,p.name);r.ssrRemoteEntry=e,r.ssrRemoteEntryType=p.type||"commonjs-module"}return r}function ro(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}function rn(e){if(!e)return{statsFileName:f,manifestFileName:h};let t="boolean"==typeof e?"":e.filePath||"",r="boolean"==typeof e?"":e.fileName||"",o=".json",n=r?r.endsWith(o)?r:`${r}${o}`:h;return{statsFileName:re(t,r?n.replace(o,`-stats${o}`):f),manifestFileName:re(t,n)}}let ri=(e,t)=>document.querySelector(`${e}[${"link"===e?"href":"src"}="${t}"]`);function ra(e,t){let r=X({name:t.name,version:t.options.version}),o=r&&"remotesInfo"in r&&r.remotesInfo&&J(r.remotesInfo,e.name).value;return o&&o.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:B.__FEDERATION__.moduleInfo,remoteSnapshot:X({name:e.name,version:o.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:B.__FEDERATION__.moduleInfo,remoteSnapshot:X({name:e.name,version:"version"in e?e.version:void 0})}}var rs=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new t7({beforeLoadRemoteSnapshot:new t9("beforeLoadRemoteSnapshot"),loadSnapshot:new t6("loadGlobalSnapshot"),loadRemoteSnapshot:new t6("loadRemoteSnapshot"),afterLoadSnapshot:new t6("afterLoadSnapshot")}),this.manifestLoading=B.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:r="loadRemote"}){let o,n,{options:i}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:i,moduleInfo:e,origin:this.HostInstance});let a=X({name:this.HostInstance.options.name,version:this.HostInstance.options.version});if(!a){var s;a={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},s={[this.HostInstance.options.name]:a},B.__FEDERATION__.moduleInfo={...B.__FEDERATION__.moduleInfo,...s}}a&&"remotesInfo"in a&&!J(a.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(a.remotesInfo={...a?.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});let{hostGlobalSnapshot:l,remoteSnapshot:c,globalSnapshot:h}=this.getGlobalRemoteInfo(e),{remoteSnapshot:f,globalSnapshot:u}=await this.hooks.lifecycle.loadSnapshot.emit({options:i,moduleInfo:e,hostGlobalSnapshot:l,remoteSnapshot:c,globalSnapshot:h});if(f)if(ro(f)){let i=g?f.remoteEntry:f.ssrRemoteEntry||f.remoteEntry||"",a=await this.loadManifestSnapshot(i,e,{},{initiator:r,id:t||e.name}),s=Z({...e,entry:i},a);o=a,n=s}else{let{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:f,from:"global"});o=t,n=u}else if(D(e)){let i=await this.loadManifestSnapshot(e.entry,e,{},{initiator:r,id:t||e.name}),a=Z(e,i);o=i,n=a}else x(tw,tM,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(u)},void 0,t1(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:i,moduleInfo:e,remoteSnapshot:o}),{remoteSnapshot:o,globalSnapshot:n}}getGlobalRemoteInfo(e){return ra(e,this.HostInstance)}async getManifestJson(e,t,r,o){return(async()=>{let r=tW(t),n=this.manifestCache.get(e);if(n)return n;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},r,o?{...o,url:e,resourceType:"manifest"}:void 0);t&&t instanceof Response||(t=await fetch(e,{})),n=await t.json()}catch(o){(n=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:o,from:"runtime",lifecycle:"afterResolve",remote:r,origin:this.HostInstance}))||(delete this.manifestLoading[e],x(tI,tM,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${o}`,t1(this.HostInstance.options)))}let i=[!n.metaData&&"metaData",!n.exposes&&"exposes",!n.shared&&"shared"].filter(Boolean);return i.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${i.join(", ")}.`),from:"runtime",lifecycle:"afterResolve",remote:r,origin:this.HostInstance}),i.length>0&&x(tO,tM,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:i.join(",")},void 0,t1(this.HostInstance.options)),this.manifestCache.set(e,n),n})()}async loadManifestSnapshot(e,t,r,o){let n=async()=>{let n=await this.getManifestJson(e,t,r,o),i=rr(n,{version:e}),{remoteSnapshot:a}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:n,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return a};return this.manifestLoading[e]||(this.manifestLoading[e]=n().then(e=>e)),this.manifestLoading[e]}},rl=class{constructor(e){this.hooks=new t7({beforeRegisterShare:new t5("beforeRegisterShare"),afterResolve:new t6("afterResolve"),beforeLoadShare:new t6("beforeLoadShare"),loadShare:new t9,afterLoadShare:new t4("afterLoadShare"),errorLoadShare:new t4("errorLoadShare"),resolveShare:new t5("resolveShare"),initContainerShareScopeMap:new t5("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:r,selectedShared:o}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:r,selectedShared:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(e){H(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:r,error:o,recovered:n}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:o,recovered:n})}catch(e){H(e)}}registerShared(e,t){let{newShareInfos:r,allShareInfos:o}=eB(e,t);return Object.keys(r).forEach(e=>{r[e].forEach(r=>{r.scope.forEach(o=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:r}),this.shareScopeMap[o]?.[e]||this.setShared({pkgName:e,lib:r.lib,get:r.get,loaded:r.loaded||!!r.lib,shared:r,from:t.name})})})}),{newShareInfos:r,allShareInfos:o}}async loadShare(e,t){let{host:r}=this,o=e0({pkgName:e,extraOptions:t,shareInfos:r.options.shared}),n=o;try{o?.scope&&await Promise.all(o.scope.map(async e=>{await Promise.all(this.initializeSharing(e,{strategy:o.strategy}))})),n=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:o,shared:r.options.shared,origin:r})).shareInfo,M(n,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);let i=n,{shared:a,useTreesShaking:s}=eZ(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(a){let t=e2(a,s);if(t.lib)return e1(t,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),t.lib;if(t.loading&&!t.loaded){let o=await t.loading;return t.loaded=!0,t.lib||(t.lib=o),e1(t,r.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),o}{let o=(async()=>{let e=await t.get();return e1(t,r.options.name),t.loaded=!0,t.lib=e,e})();this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:o,treeShaking:s?t:void 0});let n=await o;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:a}),n}}{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,recovered:!0}),!1;let o=eq(i.treeShaking),n=e2(i,o),a=(async()=>{let t=await n.get();n.lib=t,n.loaded=!0,e1(n,r.options.name);let{shared:o,useTreesShaking:a}=eZ(this.shareScopeMap,e,i,this.hooks.lifecycle.resolveShare)||{};if(o){let e=e2(o,a);e.lib=t,e.loaded=!0,o.from=i.from}return t})();this.setShared({pkgName:e,loaded:!1,shared:i,from:r.options.name,lib:null,loading:a,treeShaking:o?n:void 0});let s=await a;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:i,selectedShared:i}),s}}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:n,error:t}),t}}initializeSharing(e=eW,t){let{host:r}=this,o=t?.from,n=t?.strategy,i=t?.initScope,a=[];if("build"!==o){let{initTokens:t}=this;i||(i=[]);let r=t[e];if(r||(r=t[e]={from:this.host.name}),i.indexOf(r)>=0)return a;i.push(r)}let s=this.shareScopeMap,l=r.options.name;s[e]||(s[e]={});let c=s[e],h=async e=>{let t,{module:o}=await r.remoteHandler.getRemoteModuleAndOptions({id:e});try{t=await o.getEntry()}catch(n){if(!(t=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:"runtime",lifecycle:"beforeLoadShare",remote:o.remoteInfo,origin:r})))return}finally{t?.init&&!o.initing&&(o.remoteEntryExports=t,await o.init(void 0,void 0,i))}};return Object.keys(r.options.shared).forEach(t=>{r.options.shared[t].forEach(r=>{r.scope.includes(e)&&((e,t)=>{let{version:r,eager:o}=t;c[e]=c[e]||{};let n=c[e],i=n[r]&&e2(n[r]),a=!!(i&&("eager"in i&&i.eager||"shareConfig"in i&&i.shareConfig?.eager));(!i||"loaded-first"!==i.strategy&&!i.loaded&&(!o!=!a?o:l>n[r].from))&&(n[r]=t)})(t,r)})}),("version-first"===r.options.shareStrategy||"version-first"===n)&&r.options.remotes.forEach(t=>{t.shareScope===e&&a.push(h(t.name))}),a}loadShareSync(e,t){let{host:r}=this,o=e0({pkgName:e,extraOptions:t,shareInfos:r.options.shared});try{o?.scope&&o.scope.forEach(e=>{this.initializeSharing(e,{strategy:o.strategy})});let{shared:n}=eZ(this.shareScopeMap,e,o,this.hooks.lifecycle.resolveShare)||{};if(n){if("function"==typeof n.lib)return e1(n,r.options.name),n.loaded||(n.loaded=!0,n.from===r.options.name&&(o.loaded=!0)),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),n.lib;if("function"==typeof n.get){let t=n.get();if(!(t instanceof Promise))return e1(n,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:t,shared:n}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:n}),t}}if(o.lib)return o.loaded||(o.loaded=!0),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib;if(o.get){let n=o.get();return n instanceof Promise&&x(t?.from==="build"?tN:tR,tM,{hostName:r.options.name,sharedPkgName:e},void 0,t1(r.options)),o.lib=n,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:o.lib,shared:o}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,selectedShared:o}),o.lib}x(tR,tM,{hostName:r.options.name,sharedPkgName:e},void 0,t1(r.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:o,error:t}),t}}initShareScopeMap(e,t,r={}){let{host:o}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:o.options,origin:o,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:o,loading:n,loaded:i,get:a,treeShaking:s}){let{version:l,scope:c="default",...h}=t;(Array.isArray(c)?c:[c]).forEach(t=>{let c,f;this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][l]||(this.shareScopeMap[t][e][l]={version:l,scope:[t],...h,lib:o});let u=this.shareScopeMap[t][e][l];(c=(e,t,r)=>{r&&!e[t]&&(e[t]=r)})(f=s?u.treeShaking:u,"loaded",i),c(f,"loading",n),c(f,"get",a),r&&u.from!==r&&(u.from=r)})}_setGlobalShareScopeMap(e){let t=eQ(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},rc=class{constructor(e){this.hooks=new t7({beforeRegisterRemote:new t5("beforeRegisterRemote"),registerRemote:new t5("registerRemote"),beforeRequest:new t6("beforeRequest"),afterMatchRemote:new t9("afterMatchRemote"),onLoad:new t9("onLoad"),afterLoadRemote:new t9("afterLoadRemote"),handlePreloadModule:new t4("handlePreloadModule"),errorLoadRemote:new t9("errorLoadRemote"),beforePreloadRemote:new t9("beforePreloadRemote"),generatePreloadAssets:new t9("generatePreloadAssets"),afterPreloadRemote:new t9("afterPreloadRemote"),loadEntry:new t9}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((e,t)=>(this.registerRemote(t,e,{force:!1}),e),e.remotes)}setIdToRemoteMap(e,t){let{remote:r,expose:o}=t,{name:n,alias:i}=r;if(this.idToRemoteMap[e]={name:r.name,expose:o},i&&e.startsWith(n)){let t=e.replace(n,i);this.idToRemoteMap[t]={name:r.name,expose:o};return}if(i&&e.startsWith(i)){let t=e.replace(i,n);this.idToRemoteMap[t]={name:r.name,expose:o}}}async loadRemote(e,t){let r,{host:o}=this,n=tq(o.options.remotes,e),i=e,a=n?.expose,s=n?tW(n.remote):void 0;try{let{loadFactory:n=!0}=t||{loadFactory:!0},{module:l,moduleOptions:c,remoteMatchInfo:h}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:f,remote:u,expose:m,id:d,remoteSnapshot:p}=h;i=d,a=m,s=tW(u);let y=await l.get(d,m,t,p),g=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:f,expose:m,exposeModule:n?y:void 0,exposeModuleFactory:n?void 0:y,remote:u,options:c,moduleInstance:l,origin:o});if(this.setIdToRemoteMap(e,h),r={id:i,expose:a,remote:s,options:t,origin:o},"function"==typeof g)return g;return y}catch(c){let n,{from:l="runtime"}=t||{from:"runtime"};try{n=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:c,from:l,lifecycle:"onLoad",expose:a,remote:s,origin:o})}catch(e){throw r={id:i,expose:a,remote:s,options:t,error:e,origin:o},e}if(!n)throw r={id:i,expose:a,remote:s,options:t,error:c,origin:o},c;return r={id:i,expose:a,remote:s,options:t,error:c,origin:o,recovered:!0},n}finally{r&&await this.hooks.lifecycle.afterLoadRemote.emit(r)}}async preloadRemote(e){var t;let r,{host:o}=this,n=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:o.options,origin:o});let i=(t=o.options.remotes,e.map(e=>{let r=function(e,t){for(let r of e)if(t===r.name||r.alias&&t===r.alias)return r}(t,e.nameOrAlias);return M(r,`Unable to preload ${e.nameOrAlias} as it is not included in ${!r&&tn({remoteInfo:r,remotes:t})}`),{remote:r,preloadConfig:tz(e)}}));await Promise.all(i.flatMap(e=>{let{preloadConfig:t,remote:r}=e,o=t.exposes||[];return o.length?o.map(o=>({ops:{...e,preloadConfig:{...t,exposes:[o]}},id:tB(r.name,o)})):[{ops:e,id:`${r.name}/*`}]}).map(async e=>{let{ops:t,id:r}=e,{remote:i,preloadConfig:a}=t,s=tW(i);try{let{globalSnapshot:e,remoteSnapshot:l}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:i,id:r,initiator:"preloadRemote"}),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:t,remote:i,remoteInfo:s,globalSnapshot:e,remoteSnapshot:l});if(!c)return;let h=await tQ(s,o,c,!0,{initiator:"preloadRemote",id:r});n.push({remote:i,remoteInfo:s,preloadConfig:a,id:r,results:h})}catch(e){n.push({remote:i,remoteInfo:s,preloadConfig:a,id:r,results:[{url:s.entry,status:"error",resourceType:/\.json(?:$|[?#])/i.test(s.entry)?"manifest":"remoteEntry",initiator:"preloadRemote",id:r,error:e}]})}}));let a=n.flatMap(e=>e.results.filter(e=>"error"===e.status||"timeout"===e.status));if(a.length>0&&Object.assign(r=Error(`preloadRemote failed to load ${a.length} resource(s).`),{results:n,failedResults:a}),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:o.options,origin:o,results:n,error:r}),r)throw r}registerRemotes(e,t){let{host:r}=this;e.forEach(e=>{this.registerRemote(e,r.options.remotes,{force:t?.force})})}async getRemoteModuleAndOptions(e){let t,{host:r}=this,{id:o}=e;try{t=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:r.options,origin:r})}catch(e){if(!(t=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:r.options,origin:r,from:"runtime",error:e,lifecycle:"beforeRequest"})))throw e}let{id:n}=t,i=tq(r.options.remotes,n);if(!i)try{x(t$,tM,{hostName:r.options.name,requestId:n},void 0,t1(r.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:r.options,error:e,origin:r}),e}let{remote:a}=i,s=tW(a);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...i,options:r.options,remoteInfo:s,origin:r});let l=await r.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...i,options:r.options,origin:r,remoteInfo:s}),{remote:c,expose:h}=l;M(c&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let f=r.moduleCache.get(c.name),u={host:r,remoteInfo:s};return f||(f=new t2(u),r.moduleCache.set(c.name,f)),{module:f,moduleOptions:u,remoteMatchInfo:l}}registerRemote(e,t,r){let{host:o}=this,n=()=>{if(e.alias){let r=t.find(t=>e.alias&&(t.name.startsWith(e.alias)||t.alias?.startsWith(e.alias)));M(!r,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${r&&r.name} name or alias`)}"entry"in e&&g&&"u">typeof window&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=eW),e.type||(e.type="global")};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:o});let i=t.find(t=>t.name===e.name);if(i){let a=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r?.force&&(this.removeRemote(i),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o}),to(a.join(" ")))}else n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:o})}removeRemote(e){try{let{host:t}=this,{name:r}=e,o=t.options.remotes.findIndex(e=>e.name===r);-1!==o&&t.options.remotes.splice(o,1);let n=J(W.__FEDERATION__.moduleInfo,F(e)).key;delete W.__FEDERATION__.moduleInfo[n],"entry"in e&&(t.snapshotHandler.manifestCache.delete(e.entry),delete B.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);let{hostGlobalSnapshot:i}=ra(e,t);if(i){let t=i&&"remotesInfo"in i&&i.remotesInfo&&J(i.remotesInfo,e.name).key;t&&delete i.remotesInfo[t]}let a=t.moduleCache.get(e.name);if(a){let r=a.remoteInfo,o=r.entryGlobalName;W[o]&&(Object.getOwnPropertyDescriptor(W,o)?.configurable?delete W[o]:W[o]=void 0);let n=tG(a.remoteInfo);K[n]&&delete K[n];let i=r.buildVersion?e3(r.name,r.buildVersion):r.name,s=W.__FEDERATION__.__INSTANCES__.findIndex(e=>r.buildVersion?e.options.id===i:e.name===i);if(-1!==s){let e=W.__FEDERATION__.__INSTANCES__[s];i=e.options.id||i;let t=eQ(),o=!0,n=[];Object.keys(t).forEach(e=>{let i=t[e];i&&Object.keys(i).forEach(t=>{let a=i[t];a&&Object.keys(a).forEach(i=>{let s=a[i];s&&Object.keys(s).forEach(a=>{let l=s[a];l&&"object"==typeof l&&l.from===r.name&&(l.loaded||l.loading?(l.useIn=l.useIn.filter(e=>e!==r.name),l.useIn.length?o=!1:n.push([e,t,i,a])):n.push([e,t,i,a]))})})})}),o&&(e.shareScopeMap={},delete t[i]),n.forEach(([e,r,o,n])=>{delete t[e]?.[r]?.[o]?.[n]}),W.__FEDERATION__.__INSTANCES__.splice(s,1)}t.moduleCache.delete(e.name)}}catch(e){L.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}};let rh="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN;var rf=class{constructor(e){this.hooks=new t7({beforeInit:new t5("beforeInit"),init:new t4,beforeInitContainer:new t6("beforeInitContainer"),initContainer:new t6("initContainer")}),this.version="2.6.0",this.moduleCache=new Map,this.loaderHook=new t7({getModuleInfo:new t4,createScript:new t4,createLink:new t4,fetch:new t9,loadEntryError:new t9,afterLoadEntry:new t9("afterLoadEntry"),beforeInitRemote:new t9("beforeInitRemote"),afterInitRemote:new t9("afterInitRemote"),beforeGetExpose:new t9("beforeGetExpose"),afterGetExpose:new t9("afterGetExpose"),beforeExecuteFactory:new t9("beforeExecuteFactory"),afterExecuteFactory:new t9("afterExecuteFactory"),getModuleFactory:new t9}),this.bridgeHook=new t7({beforeBridgeRender:new t4,afterBridgeRender:new t4,beforeBridgeDestroy:new t4,afterBridgeDestroy:new t4});const t=rh?[{name:"snapshot-plugin",async afterResolve(e){let{remote:t,pkgNameOrAlias:r,expose:o,origin:n,remoteInfo:i,id:a}=e;if(!D(t)||!j(t)){let{remoteSnapshot:s,globalSnapshot:l}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:tB(t.name,o)});t8(i,s);let c=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:{remote:t,preloadConfig:{nameOrAlias:r,exposes:[o],resourceCategory:"sync",share:!1,depsRemote:!1}},remoteInfo:i,remote:t,remoteSnapshot:s,globalSnapshot:l});return c&&tQ(i,n,c,!1,{initiator:"loadRemote",id:a}).catch(()=>void 0),{...e,remoteSnapshot:s}}return e}},{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){let{origin:t,preloadOptions:r,remoteInfo:o,remote:n,globalSnapshot:i,remoteSnapshot:a}=e;return g?D(n)&&j(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:o.name,entry:n.entry,type:o.type||"global",entryGlobalName:"",shareScope:""}}]}:(t8(o,a),function(e,t,r,o,n){let i=[],a=[],s=[],l=new Set,c=new Set,{options:h}=e,{preloadConfig:f}=t,{depsRemote:u}=f;!function e(t,r,o,n,i={},a){let{value:s}=J(t,F(r)),l=a||s;if(l&&!ro(l)&&(o(l,r,n),l.remotesInfo))for(let r of Object.keys(l.remotesInfo)){if(i[r])continue;i[r]=!0;let n=function(e){let t=e.split(":");return 1===t.length?{name:t[0],version:void 0}:2===t.length?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}(r),a=l.remotesInfo[r];e(t,{name:n.name,version:a.matchedVersion},o,!1,i,void 0)}}(o,r,(t,r,o)=>{var n;let l;if(o)l=f;else if(Array.isArray(u)){let e=u.find(e=>e.nameOrAlias===r.name||e.nameOrAlias===r.alias);if(!e)return;l=tz(e)}else{if(!0!==u)return;l=f}let c=te(t,V(t).url);c&&s.push({name:r.name,moduleInfo:{name:r.name,entry:c,type:"remoteEntryType"in t?t.remoteEntryType:"global",entryGlobalName:"globalName"in t?t.globalName:r.name,shareScope:"",version:"version"in t?t.version:void 0},url:c});let h="modules"in t?t.modules:[],m=(n=l.exposes)?n.map(e=>"."===e?e:e.startsWith("./")?e.replace("./",""):e):[];function d(e){let r=e.map(e=>te(t,e));return l.filter?r.filter(l.filter):r}if(m.length&&"modules"in t&&(h=t?.modules?.reduce((e,t)=>(m?.indexOf(t.moduleName)!==-1&&e.push(t),e),[])),h){let o=h.length;for(let n=0;n<o;n++){let o=h[n],s=`${r.name}/${o.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:"."===o.moduleName?r.name:s,name:r.name,remoteSnapshot:t,preloadConfig:l,remote:r,origin:e}),et(s)||("all"===l.resourceCategory?(i.push(...d(o.assets.css.async)),i.push(...d(o.assets.css.sync)),a.push(...d(o.assets.js.async)),a.push(...d(o.assets.js.sync))):"sync"===l.resourceCategory&&(i.push(...d(o.assets.css.sync)),a.push(...d(o.assets.js.sync))),er(s))}}},!0,{},n),n.shared&&n.shared.length>0&&n.shared.forEach(t=>{let r=h.shared?.[t.sharedName];if(!r)return;let o=t.version?r.find(e=>e.version===t.version):r;o&&G(o).forEach(r=>{((t,r)=>{let{shared:o}=eZ(e.shareScopeMap,r.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};o&&"function"==typeof o.lib&&(r.assets.js.sync.forEach(e=>{l.add(e)}),r.assets.css.sync.forEach(e=>{c.add(e)}))})(r,t)})});let m=a.filter(e=>!l.has(e)&&!ri("script",e));return{cssAssets:i.filter(e=>!c.has(e)&&!ri("link",e)),jsAssetsWithoutEntry:m,entryAssets:s.filter(e=>!ri("script",e.url))}}(t,r,o,i,a)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}]:[],r={id:"u">typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"",name:e.name,plugins:t,remotes:[],shared:{},inBrowser:g};this.name=e.name,this.options=r,this.snapshotHandler=new rs(this),this.sharedHandler=new rl(this),this.remoteHandler=new rc(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&x(O(tA,tM)),this.registerPlugins(e.plugins);let t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=eW,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){let o=new t2({host:this,remoteInfo:tW({name:e,entry:t})});return o.remoteEntryExports=r,this.moduleCache.set(e,o),o}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){let{allShareInfos:r}=eB(e,t),{userOptions:o,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),i=this.remoteHandler.formatAndRegisterRemote(n,o),{allShareInfos:a}=this.sharedHandler.registerShared(n,o),s=[...n.plugins];o.plugins&&o.plugins.forEach(e=>{s.includes(e)||s.push(e)});let l={...e,...t,plugins:s,remotes:i,shared:a,id:o.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){var t;let r,o,n=(t=this,r=B.__FEDERATION__.__GLOBAL_PLUGIN__,o=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook],r.length>0&&r.forEach(t=>{e?.find(e=>e.name!==t.name)&&e.push(t)}),e&&e.length>0&&e.forEach(e=>{o.forEach(r=>{r.applyPlugin(e,t)})}),e);this.options.plugins=this.options.plugins.reduce((e,t)=>(t&&e&&!e.find(e=>e.name===t.name)&&e.push(t),e),n||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function ru(e){let t=new(W.__FEDERATION__.__DEBUG_CONSTRUCTOR__||rf)({id:`${e.name}@${e.version||Date.now()}`,...e});return W.__FEDERATION__.__INSTANCES__.push(t),t}let rm=null;function rd(e){var t,r;let o,n=(t=e.name,r=e.version,o="u">typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"",W.__FEDERATION__.__INSTANCES__.find(e=>!!o&&e.options.id===o||e.options.name===t&&!e.options.version&&!r||e.options.name===t&&!!r&&e.options.version===r)),i={...e,id:e.id||""};return n?(n.initOptions(i),rm||(rm=n),n):rm=ru(i)}function rp(...e){return M(rm,tT,tM),rm.loadRemote.apply(rm,e)}function ry(...e){return M(rm,tT,tM),rm.loadShare.apply(rm,e)}function rg(...e){return M(rm,tT,tM),rm.loadShareSync.apply(rm,e)}function rE(...e){return M(rm,tT,tM),rm.preloadRemote.apply(rm,e)}function r_(...e){return M(rm,tT,tM),rm.registerRemotes.apply(rm,e)}function rS(...e){return M(rm,tT,tM),rm.registerPlugins.apply(rm,e)}function rb(e){return e?W.__FEDERATION__.__INSTANCES__.find(e)||null:rm}function rI(...e){return M(rm,tT,tM),rm.registerShared.apply(rm,e)}!function(e,t=S()){t&&(W.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,W.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.6.0")}(rf);var r$=Object.defineProperty,rN=(e,t)=>{let r={};for(var o in e)r$(r,o,{get:e[o],enumerable:!0});return t||r$(r,Symbol.toStringTag,{value:"Module"}),r},rR=rN({}),rw=rN({}),rv=rN({}),rT=rN({}),rA=rN({}),rk=rN({});function rO(e,t,r){return function(o){if(!1===o)return!1;if(void 0===o)if(e)return t;else return!1;if(!0===o)return t;if(o&&"object"==typeof o)return{...t,...o};throw Error(`Unexpected type for \`${r}\`, expect boolean/undefined/object, got: ${typeof o}`)}}let rP=e=>e;return window.EMP_SHARE_RUNTIME={MFRuntime:o,MFSDK:n},r})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empjs/share",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "emp share and runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -116,21 +116,22 @@
|
|
|
116
116
|
},
|
|
117
117
|
"author": "Ken",
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@module-federation/
|
|
120
|
-
"@module-federation/
|
|
121
|
-
"
|
|
122
|
-
"@module-federation/
|
|
119
|
+
"@module-federation/rspack": "^2.6.0",
|
|
120
|
+
"@module-federation/runtime": "^2.6.0",
|
|
121
|
+
"@module-federation/runtime-tools": "^2.6.0",
|
|
122
|
+
"@module-federation/sdk": "^2.6.0",
|
|
123
|
+
"core-js": "^3.46.0"
|
|
123
124
|
},
|
|
124
125
|
"devDependencies": {
|
|
125
126
|
"@swc/core": "^1.15.1",
|
|
126
|
-
"@empjs/cli": "4.0.0-alpha.
|
|
127
|
+
"@empjs/cli": "4.0.0-alpha.3"
|
|
127
128
|
},
|
|
128
129
|
"scripts": {
|
|
129
130
|
"dev": "pnpm --filter @empjs/share run /^dev:.*/",
|
|
130
131
|
"dev:lib-dev": "rslib build --watch --env-mode development",
|
|
131
132
|
"dev:serve": "serve ./output --cors -p 2100",
|
|
132
133
|
"build": "rslib build --env-mode production",
|
|
133
|
-
"test": "node test/dts-runtime-pkgs.test.mjs && node test/esm-only-publish.test.mjs",
|
|
134
|
+
"test": "pnpm run build && node test/module-federation-deps.test.mjs && node test/dts-runtime-pkgs.test.mjs && node test/version-isolation.test.mjs && node test/esm-only-publish.test.mjs",
|
|
134
135
|
"start": "serve ./output --cors -p 2100",
|
|
135
136
|
"https": "serve ./output --cors -p 2100 --ssl-cert ../cli/resource/emp.cert --ssl-key ../cli/resource/emp.key"
|
|
136
137
|
}
|