@module-federation/bridge-vue3 0.0.0-next-20250920011011 → 0.0.0-next-20250922150632
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/CHANGELOG.md +21 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +168 -164
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# @module-federation/bridge-vue3
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20250922150632
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- @module-federation/runtime@0.0.0-next-
|
|
8
|
-
- @module-federation/sdk@0.0.0-next-
|
|
9
|
-
- @module-federation/bridge-shared@0.0.0-next-
|
|
7
|
+
- @module-federation/runtime@0.0.0-next-20250922150632
|
|
8
|
+
- @module-federation/sdk@0.0.0-next-20250922150632
|
|
9
|
+
- @module-federation/bridge-shared@0.0.0-next-20250922150632
|
|
10
|
+
|
|
11
|
+
## 0.19.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @module-federation/sdk@0.19.1
|
|
17
|
+
- @module-federation/runtime@0.19.1
|
|
18
|
+
- @module-federation/bridge-shared@0.19.1
|
|
19
|
+
|
|
20
|
+
## 0.19.0
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @module-federation/runtime@0.19.0
|
|
25
|
+
- @module-federation/sdk@0.19.0
|
|
26
|
+
- @module-federation/bridge-shared@0.19.0
|
|
10
27
|
|
|
11
28
|
## 0.18.4
|
|
12
29
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(
|
|
2
|
-
})`,{filename,importModuleDynamically:(_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER=(_vm_constants=vm.constants)==null?void 0:_vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER)!=null?_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER:importNodeModule});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);const exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>n[o]})}}return t.default=n,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter);function _extends$2(){return _extends$2=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends$2.apply(this,arguments)}const MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"&&typeof window.document<"u"}function isReactNativeEnv(){var n;return typeof navigator<"u"&&((n=navigator)==null?void 0:n.product)==="ReactNative"}function isBrowserDebug(){try{if(isBrowserEnv()&&window.localStorage)return!!localStorage.getItem(BROWSER_LOG_KEY)}catch{return!1}return!1}function isDebugMode(){return typeof process<"u"&&process.env&&process.env.FEDERATION_DEBUG?!!process.env.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:isBrowserDebug()}const LOG_CATEGORY$1="[ Federation Runtime ]",composeKeyWithSeparator=function(...n){return n.length?n.reduce((t,o)=>o?t?`${t}${SEPARATOR}${o}`:o:t,""):""},getResourceUrl=(n,t)=>{if("getPublicPath"in n){let o;return n.getPublicPath.startsWith("function")?o=new Function("return "+n.getPublicPath)()():o=new Function(n.getPublicPath)(),`${o}${t}`}else return"publicPath"in n?!isBrowserEnv()&&!isReactNativeEnv()&&"ssrPublicPath"in n?`${n.ssrPublicPath}${t}`:`${n.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",n,t),"")},warn$1=n=>{console.warn(`${LOG_CATEGORY$1}: ${n}`)};function safeToString(n){try{return JSON.stringify(n,null,2)}catch{return""}}const simpleJoinRemoteEntry=(n,t)=>{if(!n)return t;const r=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const a=s.slice(1);return a.endsWith("/")?a.slice(0,-1):a}return s})(n);return r?r.endsWith("/")?`${r}${t}`:`${r}/${t}`:t};function inferAutoPublicPath(n){return n.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(n,t={}){var o,r;const{remotes:s={},overrides:a={},version:l}=t;let i;const c=()=>"publicPath"in n.metaData?n.metaData.publicPath==="auto"&&l?inferAutoPublicPath(l):n.metaData.publicPath:n.metaData.getPublicPath,u=Object.keys(a);let d={};if(!Object.keys(s).length){var h;d=((h=n.remotes)==null?void 0:h.reduce((b,v)=>{let $;const A=v.federationContainerName;return u.includes(A)?$=a[A]:"version"in v?$=v.version:$=v.entry,b[A]={matchedVersion:$},b},{}))||{}}Object.keys(s).forEach(b=>d[b]={matchedVersion:u.includes(b)?a[b]:s[b]});const{remoteEntry:{path:p,name:m,type:_},types:E,buildInfo:{buildVersion:y},globalName:g,ssrRemoteEntry:I}=n.metaData,{exposes:S}=n;let R={version:l||"",buildVersion:y,globalName:g,remoteEntry:simpleJoinRemoteEntry(p,m),remoteEntryType:_,remoteTypes:simpleJoinRemoteEntry(E.path,E.name),remoteTypesZip:E.zip||"",remoteTypesAPI:E.api||"",remotesInfo:d,shared:n==null?void 0:n.shared.map(b=>({assets:b.assets,sharedName:b.name,version:b.version})),modules:S==null?void 0:S.map(b=>({moduleName:b.name,modulePath:b.path,assets:b.assets}))};if((o=n.metaData)!=null&&o.prefetchInterface){const b=n.metaData.prefetchInterface;R=_extends$2({},R,{prefetchInterface:b})}if((r=n.metaData)!=null&&r.prefetchEntry){const{path:b,name:v,type:$}=n.metaData.prefetchEntry;R=_extends$2({},R,{prefetchEntry:simpleJoinRemoteEntry(b,v),prefetchEntryType:$})}if("publicPath"in n.metaData?i=_extends$2({},R,{publicPath:c(),ssrPublicPath:n.metaData.ssrPublicPath}):i=_extends$2({},R,{getPublicPath:c()}),I){const b=simpleJoinRemoteEntry(I.path,I.name);i.ssrRemoteEntry=b,i.ssrRemoteEntryType=I.type||"commonjs-module"}return i}function isManifestProvider(n){return!!("remoteEntry"in n&&n.remoteEntry.includes(MANIFEST_EXT))}let Logger=class{setPrefix(t){this.prefix=t}log(...t){console.log(this.prefix,...t)}warn(...t){console.log(this.prefix,...t)}error(...t){console.log(this.prefix,...t)}success(...t){console.log(this.prefix,...t)}info(...t){console.log(this.prefix,...t)}ready(...t){console.log(this.prefix,...t)}debug(...t){isDebugMode()&&console.log(this.prefix,...t)}constructor(t){this.prefix=t}};function createLogger(n){return new Logger(n)}async function safeWrapper(n,t){try{return await n()}catch(o){warn$1(o);return}}function isStaticResourcesEqual(n,t){const o=/^(https?:)?\/\//i,r=n.replace(o,"").replace(/\/$/,""),s=t.replace(o,"").replace(/\/$/,"");return r===s}function createScript(n){let t=null,o=!0,r=2e4,s;const a=document.getElementsByTagName("script");for(let i=0;i<a.length;i++){const c=a[i],u=c.getAttribute("src");if(u&&isStaticResourcesEqual(u,n.url)){t=c,o=!1;break}}if(!t){const i=n.attrs;t=document.createElement("script"),t.type=(i==null?void 0:i.type)==="module"?"module":"text/javascript";let c;n.createScriptHook&&(c=n.createScriptHook(n.url,n.attrs),c instanceof HTMLScriptElement?t=c:typeof c=="object"&&("script"in c&&c.script&&(t=c.script),"timeout"in c&&c.timeout&&(r=c.timeout))),t.src||(t.src=n.url),i&&!c&&Object.keys(i).forEach(u=>{t&&(u==="async"||u==="defer"?t[u]=i[u]:t.getAttribute(u)||t.setAttribute(u,i[u]))})}const l=async(i,c)=>{clearTimeout(s);const u=()=>{(c==null?void 0:c.type)==="error"?n!=null&&n.onErrorCallback&&(n==null||n.onErrorCallback(c)):n!=null&&n.cb&&(n==null||n.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:d=!0}=n;d&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i&&typeof i=="function")){const d=i(c);if(d instanceof Promise){const h=await d;return u(),h}return u(),d}u()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),s=setTimeout(()=>{l(null,new Error(`Remote script "${n.url}" time-outed.`))},r),{script:t,needAttach:o}}function createLink(n){let t=null,o=!0;const r=document.getElementsByTagName("link");for(let a=0;a<r.length;a++){const l=r[a],i=l.getAttribute("href"),c=l.getAttribute("rel");if(i&&isStaticResourcesEqual(i,n.url)&&c===n.attrs.rel){t=l,o=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",n.url);let a;const l=n.attrs;n.createLinkHook&&(a=n.createLinkHook(n.url,l),a instanceof HTMLLinkElement&&(t=a)),l&&!a&&Object.keys(l).forEach(i=>{t&&!t.getAttribute(i)&&t.setAttribute(i,l[i])})}const s=(a,l)=>{const i=()=>{(l==null?void 0:l.type)==="error"?n!=null&&n.onErrorCallback&&(n==null||n.onErrorCallback(l)):n!=null&&n.cb&&(n==null||n.cb())};if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:c=!0}=n;c&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),a)){const c=a(l);return i(),c}i()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:o}}function loadScript(n,t){const{attrs:o={},createScriptHook:r}=t;return new Promise((s,a)=>{const{script:l,needAttach:i}=createScript({url:n,cb:s,onErrorCallback:a,attrs:_extends$2({fetchpriority:"high"},o),createScriptHook:r,needDeleteScript:!0});i&&document.head.appendChild(l)})}const sdkImportCache=new Map;function importNodeModule(n){if(!n)throw new Error("import specifier is required");if(sdkImportCache.has(n))return sdkImportCache.get(n);const o=new Function("name","return import(name)")(n).then(r=>r).catch(r=>{throw console.error(`Error importing module ${n}:`,r),sdkImportCache.delete(n),r});return sdkImportCache.set(n,o),o}const loadNodeFetch=async()=>{const n=await importNodeModule("node-fetch");return n.default||n},lazyLoaderHookFetch=async(n,t,o)=>{const s=await((a,l)=>o.lifecycle.fetch.emit(a,l))(n,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(n,t||{}):s},createScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(url,cb,attrs,loaderHook)=>{if(loaderHook!=null&&loaderHook.createScriptHook){const n=loaderHook.createScriptHook(url);n&&typeof n=="object"&&"url"in n&&(url=n.url)}let urlObj;try{urlObj=new URL(url)}catch(n){console.error("Error constructing URL:",n),cb(new Error(`Invalid URL: ${n}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(n,t)=>lazyLoaderHookFetch(n,t,loaderHook):typeof fetch>"u"?loadNodeFetch():fetch,handleScriptFetch=async(f,urlObj)=>{try{var _vm_constants;const res=await f(urlObj.href),data=await res.text(),[path,vm]=await Promise.all([importNodeModule("path"),importNodeModule("vm")]),scriptContext={exports:{},module:{exports:{}}},urlDirname=urlObj.pathname.split("/").slice(0,-1).join("/"),filename=path.basename(urlObj.pathname);var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;const script=new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
|
|
2
|
+
})`,{filename,importModuleDynamically:(_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER=(_vm_constants=vm.constants)==null?void 0:_vm_constants.USE_MAIN_CONTEXT_DEFAULT_LOADER)!=null?_vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER:importNodeModule});script.runInThisContext()(scriptContext.exports,scriptContext.module,eval("require"),urlDirname,filename);const exportedInterface=scriptContext.module.exports||scriptContext.exports;if(attrs&&exportedInterface&&attrs.globalName){const n=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,n);return}cb(void 0,exportedInterface)}catch(n){cb(n instanceof Error?n:new Error(`Script execution error: ${n}`))}};getFetch().then(async n=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:n,vm:await importNodeModule("vm")}).then(async t=>{await t.evaluate(),cb(void 0,t.namespace)}).catch(t=>{cb(t instanceof Error?t:new Error(`Script execution error: ${t}`))});handleScriptFetch(n,urlObj)}).catch(n=>{cb(n)})}:(n,t,o,r)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},loadScriptNode=typeof ENV_TARGET>"u"||ENV_TARGET!=="web"?(n,t)=>new Promise((o,r)=>{createScriptNode(n,(s,a)=>{if(s)r(s);else{var l,i;const c=(t==null||(l=t.attrs)==null?void 0:l.globalName)||`__FEDERATION_${t==null||(i=t.attrs)==null?void 0:i.name}:custom__`,u=globalThis[c]=a;o(u)}},t.attrs,t.loaderHook)}):(n,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},esmModuleCache=new Map;async function loadModule(n,t){if(esmModuleCache.has(n))return esmModuleCache.get(n);const{fetch:o,vm:r}=t,a=await(await o(n)).text(),l=new r.SourceTextModule(a,{importModuleDynamically:async(i,c)=>{const u=new URL(i,n).href;return loadModule(u,t)}});return esmModuleCache.set(n,l),await l.link(async i=>{const c=new URL(i,n).href;return await loadModule(c,t)}),l}const LoggerInstance=createLogger("[ Module Federation Bridge Vue3 ]");function _extends$1(){return _extends$1=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends$1.apply(this,arguments)}function _object_without_properties_loose(n,t){if(n==null)return{};var o={},r=Object.keys(n),s,a;for(a=0;a<r.length;a++)s=r[a],!(t.indexOf(s)>=0)&&(o[s]=n[s]);return o}const RUNTIME_001="RUNTIME-001",RUNTIME_002="RUNTIME-002",RUNTIME_003="RUNTIME-003",RUNTIME_004="RUNTIME-004",RUNTIME_005="RUNTIME-005",RUNTIME_006="RUNTIME-006",RUNTIME_007="RUNTIME-007",RUNTIME_008="RUNTIME-008",RUNTIME_009="RUNTIME-009",TYPE_001="TYPE-001",BUILD_001="BUILD-001",BUILD_002="BUILD-002",getDocsUrl=n=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${n.split("-")[0].toLowerCase()}/${n}`,getShortErrorMsg=(n,t,o,r)=>{const s=[`${[t[n]]} #${n}`];return o&&s.push(`args: ${JSON.stringify(o)}`),s.push(getDocsUrl(n)),r&&s.push(`Original Error Message:
|
|
3
3
|
${r}`),s.join(`
|
|
4
|
-
`)};function _extends(){return _extends=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends.apply(this,arguments)}const runtimeDescMap={[RUNTIME_001]:"Failed to get remoteEntry exports.",[RUNTIME_002]:'The remote entry interface does not contain "init"',[RUNTIME_003]:"Failed to get manifest.",[RUNTIME_004]:"Failed to locate remote.",[RUNTIME_005]:"Invalid loadShareSync function call from bundler runtime",[RUNTIME_006]:"Invalid loadShareSync function call from runtime",[RUNTIME_007]:"Failed to get remote snapshot.",[RUNTIME_008]:"Failed to load script resources.",[RUNTIME_009]:"Please call createInstance first."},typeDescMap={[TYPE_001]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},buildDescMap={[BUILD_001]:"Failed to find expose module.",[BUILD_002]:"PublicPath is required in prod mode."};_extends({},runtimeDescMap,typeDescMap,buildDescMap);const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(o,t){o||error(t)}function error(o){throw o instanceof Error?(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`),o):new Error(`${LOG_CATEGORY}: ${o}`)}function warn(o){o instanceof Error&&(o.message.startsWith(LOG_CATEGORY)||(o.message=`${LOG_CATEGORY}: ${o.message}`)),logger.warn(o)}function addUniqueItem(o,t){return o.findIndex(n=>n===t)===-1&&o.push(t),o}function getFMId(o){return"version"in o&&o.version?`${o.name}:${o.version}`:"entry"in o&&o.entry?`${o.name}:${o.entry}`:`${o.name}`}function isRemoteInfoWithEntry(o){return typeof o.entry<"u"}function isPureRemoteEntry(o){return!o.entry.includes(".json")}function isObject(o){return o&&typeof o=="object"}const objectToString=Object.prototype.toString;function isPlainObject(o){return objectToString.call(o)==="[object Object]"}function arrayOptions(o){return Array.isArray(o)?o:[o]}function getRemoteEntryInfoFromSnapshot(o){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in o?{url:o.remoteEntry,type:o.remoteEntryType,globalName:o.globalName}:t:"ssrRemoteEntry"in o?{url:o.ssrRemoteEntry||t.url,type:o.ssrRemoteEntryType||t.type,globalName:o.globalName}:t}const processModuleAlias=(o,t)=>{let n;return o.endsWith("/")?n=o.slice(0,-1):n=o,t.startsWith(".")&&(t=t.slice(1)),n=n+t,n},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(o,t,n){Object.defineProperty(o,t,{value:n,configurable:!1,writable:!0})}function includeOwnProperty(o,t){return Object.hasOwnProperty.call(o,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(o){var t,n,r,s,a,l;includeOwnProperty(o,"__VMOK__")&&!includeOwnProperty(o,"__FEDERATION__")&&definePropertyGlobalVal(o,"__FEDERATION__",o.__VMOK__),includeOwnProperty(o,"__FEDERATION__")||(definePropertyGlobalVal(o,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(o,"__VMOK__",o.__FEDERATION__));var i;(i=(t=o.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(n=o.__FEDERATION__).__INSTANCES__)!=null||(n.__INSTANCES__=[]);var u;(u=(r=o.__FEDERATION__).moduleInfo)!=null||(r.moduleInfo={});var h;(h=(s=o.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var d;(d=(a=o.__FEDERATION__).__MANIFEST_LOADING__)!=null||(a.__MANIFEST_LOADING__={});var p;(p=(l=o.__FEDERATION__).__PRELOADED_MAP__)!=null||(l.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(o,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=o,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.0.0-next-20250920011011")}function getInfoWithoutType(o,t){if(typeof t=="string"){if(o[t])return{value:o[t],key:t};{const r=Object.keys(o);for(const s of r){const[a,l]=s.split(":"),i=`${a}:${t}`,c=o[i];if(c)return{value:c,key:i}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o),r=getInfoWithoutType(t,n).value;if(r&&!r.version&&"version"in o&&o.version&&(r.version=o.version),r)return r;if("version"in o&&o.version){const{version:s}=o,a=_object_without_properties_loose(o,["version"]),l=getFMId(a),i=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,l).value;if((i==null?void 0:i.version)===s)return i}},getGlobalSnapshotInfoByModuleInfo=o=>getTargetSnapshotInfoByModuleInfo(o,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(o,t)=>{const n=getFMId(o);return nativeGlobal.__FEDERATION__.moduleInfo[n]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=o=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,o),()=>{const t=Object.keys(o);for(const n of t)delete nativeGlobal.__FEDERATION__.moduleInfo[n]}),getRemoteEntryExports=(o,t)=>{const n=t||`__FEDERATION_${o}:custom__`,r=CurrentGlobal[n];return{remoteEntryKey:n,entryExports:r}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(o),setPreloaded=o=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(o,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(o){return new RegExp(o)}function isXVersion(o){return!o||o.toLowerCase()==="x"||o==="*"}function pipe(...o){return t=>o.reduce((n,r)=>r(n),t)}function extractComparator(o){return o.match(parseRegex(comparator))}function combineVersion(o,t,n,r){const s=`${o}.${t}.${n}`;return r?`${s}-${r}`:s}function parseHyphen(o){return o.replace(parseRegex(hyphenRange),(t,n,r,s,a,l,i,c,u,h,d,p)=>(isXVersion(r)?n="":isXVersion(s)?n=`>=${r}.0.0`:isXVersion(a)?n=`>=${r}.${s}.0`:n=`>=${n}`,isXVersion(u)?c="":isXVersion(h)?c=`<${Number(u)+1}.0.0-0`:isXVersion(d)?c=`<${u}.${Number(h)+1}.0-0`:p?c=`<=${u}.${h}.${d}-${p}`:c=`<=${c}`,`${n} ${c}`.trim()))}function parseComparatorTrim(o){return o.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(o){return o.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(o){return o.replace(parseRegex(caretTrim),"$1^")}function parseCarets(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(n,r,s,a,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(a)?r==="0"?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.0 <${Number(r)+1}.0.0-0`:l?r==="0"?s==="0"?`>=${r}.${s}.${a}-${l} <${r}.${s}.${Number(a)+1}-0`:`>=${r}.${s}.${a}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a}-${l} <${Number(r)+1}.0.0-0`:r==="0"?s==="0"?`>=${r}.${s}.${a} <${r}.${s}.${Number(a)+1}-0`:`>=${r}.${s}.${a} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a} <${Number(r)+1}.0.0-0`)).join(" ")}function parseTildes(o){return o.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(n,r,s,a,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(a)?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:l?`>=${r}.${s}.${a}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a} <${r}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(o){return o.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(n,r,s,a,l,i)=>{const c=isXVersion(s),u=c||isXVersion(a),h=u||isXVersion(l);return r==="="&&h&&(r=""),i="",c?r===">"||r==="<"?"<0.0.0-0":"*":r&&h?(u&&(a=0),l=0,r===">"?(r=">=",u?(s=Number(s)+1,a=0,l=0):(a=Number(a)+1,l=0)):r==="<="&&(r="<",u?s=Number(s)+1:a=Number(a)+1),r==="<"&&(i="-0"),`${r+s}.${a}.${l}${i}`):u?`>=${s}.0.0${i} <${Number(s)+1}.0.0-0`:h?`>=${s}.${a}.0${i} <${s}.${Number(a)+1}.0-0`:n})).join(" ")}function parseStar(o){return o.trim().replace(parseRegex(star),"")}function parseGTE0(o){return o.trim().replace(parseRegex(gte0),"")}function compareAtom(o,t){return o=Number(o)||o,t=Number(t)||t,o>t?1:o===t?0:-1}function comparePreRelease(o,t){const{preRelease:n}=o,{preRelease:r}=t;if(n===void 0&&r)return 1;if(n&&r===void 0)return-1;if(n===void 0&&r===void 0)return 0;for(let s=0,a=n.length;s<=a;s++){const l=n[s],i=r[s];if(l!==i)return l===void 0&&i===void 0?0:l?i?compareAtom(l,i):-1:1}return 0}function compareVersion(o,t){return compareAtom(o.major,t.major)||compareAtom(o.minor,t.minor)||compareAtom(o.patch,t.patch)||comparePreRelease(o,t)}function eq(o,t){return o.version===t.version}function compare(o,t){switch(o.operator){case"":case"=":return eq(o,t);case">":return compareVersion(o,t)<0;case">=":return eq(o,t)||compareVersion(o,t)<0;case"<":return compareVersion(o,t)>0;case"<=":return eq(o,t)||compareVersion(o,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(o){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(o)}function parseRange(o){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(o.trim()).split(/\s+/).join(" ")}function satisfy(o,t){if(!o)return!1;const n=extractComparator(o);if(!n)return!1;const[,r,,s,a,l,i]=n,c={operator:r,version:combineVersion(s,a,l,i),major:s,minor:a,patch:l,preRelease:i==null?void 0:i.split(".")},u=t.split("||");for(const h of u){const d=h.trim();if(!d||d==="*"||d==="x")return!0;try{const p=parseRange(d);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const _=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(_.length===0)continue;let E=!0;for(const y of _){const g=extractComparator(y);if(!g){E=!1;break}const[,I,,S,R,b,v]=g,$={operator:I,version:combineVersion(S,R,b,v),major:S,minor:R,patch:b,preRelease:v==null?void 0:v.split(".")};if(!compare($,c)){E=!1;break}}if(E)return!0}catch(p){console.error(`[semver] Error processing range part "${d}":`,p);continue}}return!1}function formatShare(o,t,n,r){let s;"get"in o?s=o.get:"lib"in o?s=()=>Promise.resolve(o.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${n}'!`)});var a,l,i;return _extends$1({deps:[],useIn:[],from:t,loading:null},o,{shareConfig:_extends$1({requiredVersion:`^${o.version}`,singleton:!1,eager:!1,strictVersion:!1},o.shareConfig),get:s,loaded:o!=null&&o.loaded||"lib"in o?!0:void 0,version:(a=o.version)!=null?a:"0",scope:Array.isArray(o.scope)?o.scope:[(l=o.scope)!=null?l:"default"],strategy:((i=o.strategy)!=null?i:r)||"version-first"})}function formatShareConfigs(o,t){const n=t.shared||{},r=t.name,s=Object.keys(n).reduce((l,i)=>{const c=arrayOptions(n[i]);return l[i]=l[i]||[],c.forEach(u=>{l[i].push(formatShare(u,r,i,t.shareStrategy))}),l},{}),a=_extends$1({},o.shared);return Object.keys(s).forEach(l=>{a[l]?s[l].forEach(i=>{a[l].find(u=>u.version===i.version)||a[l].push(i)}):a[l]=s[l]}),{shared:a,shareInfos:s}}function versionLt(o,t){const n=r=>{if(!Number.isNaN(Number(r))){const a=r.split(".");let l=r;for(let i=0;i<3-a.length;i++)l+=".0";return l}return r};return!!satisfy(n(o),`<=${n(t)}`)}const findVersion=(o,t)=>{const n=t||function(r,s){return versionLt(r,s)};return Object.keys(o).reduce((r,s)=>!r||n(r,s)||r==="0"?s:r,0)},isLoaded=o=>!!o.loaded||typeof o.lib=="function",isLoading=o=>!!o.loading;function findSingletonVersionOrderByVersion(o,t,n){const r=o[t][n],s=function(a,l){return!isLoaded(r[a])&&versionLt(a,l)};return findVersion(o[t][n],s)}function findSingletonVersionOrderByLoaded(o,t,n){const r=o[t][n],s=function(a,l){const i=c=>isLoaded(c)||isLoading(c);return i(r[l])?i(r[a])?!!versionLt(a,l):!0:i(r[a])?!1:versionLt(a,l)};return findVersion(o[t][n],s)}function getFindShareFunction(o){return o==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(o,t,n,r){if(!o)return;const{shareConfig:s,scope:a=DEFAULT_SCOPE,strategy:l}=n,i=Array.isArray(a)?a:[a];for(const c of i)if(s&&o[c]&&o[c][t]){const{requiredVersion:u}=s,d=getFindShareFunction(l)(o,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(d,u)){const E=`Version ${d} from ${d&&o[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;s.strictVersion?error(E):warn(E)}return o[c][t][d]}else{if(u===!1||u==="*"||satisfy(d,u))return o[c][t][d];for(const[E,y]of Object.entries(o[c][t]))if(satisfy(E,u))return y}},m={shareScopeMap:o,scope:c,pkgName:t,version:d,GlobalFederation:Global.__FEDERATION__,resolver:p};return(r.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(o){const{pkgName:t,extraOptions:n,shareInfos:r}=o,s=i=>{if(!i)return;const c={};i.forEach(d=>{c[d.version]=d});const h=findVersion(c,function(d,p){return!isLoaded(c[d])&&versionLt(d,p)});return c[h]};var a;const l=(a=n==null?void 0:n.resolver)!=null?a:s;return Object.assign({},l(r[t]),n==null?void 0:n.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(o,t){for(const n of o){const r=t.startsWith(n.name);let s=t.replace(n.name,"");if(r){if(s.startsWith("/")){const i=n.name;return s=`.${s}`,{pkgNameOrAlias:i,expose:s,remote:n}}else if(s==="")return{pkgNameOrAlias:n.name,expose:".",remote:n}}const a=n.alias&&t.startsWith(n.alias);let l=n.alias&&t.replace(n.alias,"");if(n.alias&&a){if(l&&l.startsWith("/")){const i=n.alias;return l=`.${l}`,{pkgNameOrAlias:i,expose:l,remote:n}}else if(l==="")return{pkgNameOrAlias:n.alias,expose:".",remote:n}}}}function matchRemote(o,t){for(const n of o)if(t===n.name||n.alias&&t===n.alias)return n}function registerPlugins(o,t){const n=getGlobalHostPlugins(),r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return n.length>0&&n.forEach(s=>{o!=null&&o.find(a=>a.name!==s.name)&&o.push(s)}),o&&o.length>0&&o.forEach(s=>{r.forEach(a=>{a.applyPlugin(s,t)})}),o}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${o}")${importCallback}`)([n,r]):import(o).then(n).catch(r)}catch(s){r(s)}})}async function loadSystemJsEntry({entry:o,remoteEntryExports:t}){return new Promise((n,r)=>{try{t?n(t):typeof __system_context__>"u"?System.import(o).then(n).catch(r):new Function("callbacks",`System.import("${o}")${importCallback}`)([n,r])}catch(s){r(s)}})}function handleRemoteEntryLoaded(o,t,n){const{remoteEntryKey:r,entryExports:s}=getRemoteEntryExports(o,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:o,remoteEntryUrl:n,remoteEntryKey:r})),s}async function loadEntryScript({name:o,globalName:t,entry:n,loaderHook:r,getEntryUrl:s}){const{entryExports:a}=getRemoteEntryExports(o,t);if(a)return a;const l=s?s(n):n;return loadScript(l,{attrs:{},createScriptHook:(i,c)=>{const u=r.lifecycle.createScript.emit({url:i,attrs:c});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>handleRemoteEntryLoaded(o,t,n)).catch(i=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:o,resourceUrl:n})),i})}async function loadEntryDom({remoteInfo:o,remoteEntryExports:t,loaderHook:n,getEntryUrl:r}){const{entry:s,entryGlobalName:a,name:l,type:i}=o;switch(i){case"esm":case"module":return loadEsmEntry({entry:s,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:s,remoteEntryExports:t});default:return loadEntryScript({entry:s,globalName:a,name:l,loaderHook:n,getEntryUrl:r})}}async function loadEntryNode({remoteInfo:o,loaderHook:t}){const{entry:n,entryGlobalName:r,name:s,type:a}=o,{entryExports:l}=getRemoteEntryExports(s,r);return l||loadScriptNode(n,{attrs:{name:s,globalName:r,type:a},loaderHook:{createScriptHook:(i,c={})=>{const u=t.lifecycle.createScript.emit({url:i,attrs:c});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,r,n)).catch(i=>{throw i})}function getRemoteEntryUniqueKey(o){const{entry:t,name:n}=o;return composeKeyWithSeparator(n,t)}async function getRemoteEntry(o){const{origin:t,remoteEntryExports:n,remoteInfo:r,getEntryUrl:s}=o,a=getRemoteEntryUniqueKey(r);if(n)return n;if(!globalLoading[a]){const l=t.remoteHandler.hooks.lifecycle.loadEntry,i=t.loaderHook;globalLoading[a]=l.emit({loaderHook:i,remoteInfo:r,remoteEntryExports:n}).then(c=>c||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:r,remoteEntryExports:n,loaderHook:i,getEntryUrl:s}):loadEntryNode({remoteInfo:r,loaderHook:i})))}return globalLoading[a]}function getRemoteInfo(o){return _extends$1({},o,{entry:"entry"in o?o.entry:"",type:o.type||DEFAULT_REMOTE_TYPE,entryGlobalName:o.entryGlobalName||o.name,shareScope:o.shareScope||DEFAULT_SCOPE})}function defaultPreloadArgs(o){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},o)}function formatPreloadArgs(o,t){return t.map(n=>{const r=matchRemote(o,n.nameOrAlias);return assert(r,`Unable to preload ${n.nameOrAlias} as it is not included in ${!r&&safeToString({remoteInfo:r,remotes:o})}`),{remote:r,preloadConfig:defaultPreloadArgs(n)}})}function normalizePreloadExposes(o){return o?o.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(o,t,n,r=!0){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:l}=n;if(t.options.inBrowser){if(l.forEach(i=>{const{moduleInfo:c}=i,u=t.moduleCache.get(o.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),r){const i={rel:"preload",as:"style"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const i={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});h&&document.head.appendChild(u)})}if(r){const i={rel:"preload",as:"script"};a.forEach(c=>{const{link:u,needAttach:h}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(d,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:d,attrs:p});if(m instanceof HTMLLinkElement)return m}});h&&document.head.appendChild(u)})}else{const i={fetchpriority:"high",type:(o==null?void 0:o.type)==="module"?"module":"text/javascript"};a.forEach(c=>{const{script:u,needAttach:h}=createScript({url:c,cb:()=>{},attrs:i,createScriptHook:(d,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:d,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});h&&document.head.appendChild(u)})}}}let Module=class{async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;try{t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports})}catch(n){const r=getRemoteEntryUniqueKey(this.remoteInfo);n instanceof Error&&n.message.includes(RUNTIME_008)&&(t=await this.host.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry,origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,globalLoading,uniqueKey:r}))}return assert(t,`remoteEntryExports is undefined
|
|
5
|
-
${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,n,r,s){const{loadFactory:a=!0}=r||{loadFactory:!0},l=await this.getEntry();if(!this.inited){const d=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(g=>{d[g]||(d[g]={})});const m=d[p[0]],_=[],E={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(E,"shareScopeMap",{value:d,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:E,initScope:_,remoteInfo:this.remoteInfo,origin:this.host});typeof(l==null?void 0:l.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await l.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:l}))}this.lib=l,this.inited=!0;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:l,expose:n,moduleInfo:this.remoteInfo}),i||(i=await l.get(n)),assert(i,`${getFMId(this.remoteInfo)} remote don't export ${n}.`);const c=processModuleAlias(this.remoteInfo.name,n),u=this.wraperFactory(i,c);return a?await u():u}wraperFactory(t,n){function r(s,a){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:a,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return r(s,n),s}:()=>{const s=t();return r(s,n),s}}constructor({remoteInfo:t,host:n}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=n}};class SyncHook{on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const n=this;this.on(function r(...s){return n.remove(r),t.apply(null,s)})}emit(...t){let n;return this.listeners.size>0&&this.listeners.forEach(r=>{n=r(...t)}),n}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}}class AsyncHook extends SyncHook{emit(...t){let n;const r=Array.from(this.listeners);if(r.length>0){let s=0;const a=l=>l===!1?!1:s<r.length?Promise.resolve(r[s++].apply(null,t)).then(a):l;n=a()}return Promise.resolve(n)}}function checkReturnData(o,t){if(!isObject(t))return!1;if(o!==t){for(const n in o)if(!(n in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const n of this.listeners)try{const r=n(t);if(checkReturnData(t,r))t=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){warn(r),this.onerror(r)}return t}constructor(t){super(),this.onerror=error,this.type=t}}class AsyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const n=Array.from(this.listeners);if(n.length>0){let r=0;const s=l=>(warn(l),this.onerror(l),t),a=l=>{if(checkReturnData(t,l)){if(t=l,r<n.length)try{return Promise.resolve(n[r++](t)).then(a,s)}catch(i){return s(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return t};return Promise.resolve(a(t))}return Promise.resolve(t)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t,n){assert(isPlainObject(t),"Plugin configuration is invalid.");const r=t.name;assert(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=t,t.apply==null||t.apply.call(t,n),Object.keys(this.lifecycle).forEach(s=>{const a=t[s];a&&this.lifecycle[s].on(a)}))}removePlugin(t){assert(t,"A name is required.");const n=this.registerPlugins[t];assert(n,`The plugin "${t}" is not registered.`),Object.keys(n).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(n[r])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function assignRemoteInfo(o,t){const n=getRemoteEntryInfoFromSnapshot(t);n.url||error(`The attribute remoteEntry of ${o.name} must not be undefined.`);let r=getResourceUrl(t,n.url);!isBrowserEnv()&&!r.startsWith("http")&&(r=`https:${r}`),o.type=n.type,o.entryGlobalName=n.globalName,o.entry=r,o.version=t.version,o.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(o){const{remote:t,pkgNameOrAlias:n,expose:r,origin:s,remoteInfo:a,id:l}=o;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:i,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:l});assignRemoteInfo(a,i);const u={remote:t,preloadConfig:{nameOrAlias:n,exposes:[r],resourceCategory:"sync",share:!1,depsRemote:!1}},h=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:a,remote:t,remoteSnapshot:i,globalSnapshot:c});return h&&preloadAssets(a,s,h,!1),_extends$1({},o,{remoteSnapshot:i})}return o}}}function splitId(o){const t=o.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function traverseModuleInfo(o,t,n,r,s={},a){const l=getFMId(t),{value:i}=getInfoWithoutType(o,l),c=a||i;if(c&&!isManifestProvider(c)&&(n(c,t,r),c.remotesInfo)){const u=Object.keys(c.remotesInfo);for(const h of u){if(s[h])continue;s[h]=!0;const d=splitId(h),p=c.remotesInfo[h];traverseModuleInfo(o,{name:d.name,version:p.matchedVersion},n,!1,s,void 0)}}}const isExisted=(o,t)=>document.querySelector(`${o}[${o==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(o,t,n,r,s){const a=[],l=[],i=[],c=new Set,u=new Set,{options:h}=o,{preloadConfig:d}=t,{depsRemote:p}=d;if(traverseModuleInfo(r,n,(y,g,I)=>{let S;if(I)S=d;else if(Array.isArray(p)){const N=p.find(T=>T.nameOrAlias===g.name||T.nameOrAlias===g.alias);if(!N)return;S=defaultPreloadArgs(N)}else if(p===!0)S=d;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&i.push({name:g.name,moduleInfo:{name:g.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:g.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let b="modules"in y?y.modules:[];const v=normalizePreloadExposes(S.exposes);if(v.length&&"modules"in y){var $;b=y==null||($=y.modules)==null?void 0:$.reduce((N,T)=>((v==null?void 0:v.indexOf(T.moduleName))!==-1&&N.push(T),N),[])}function A(N){const T=N.map(O=>getResourceUrl(y,O));return S.filter?T.filter(S.filter):T}if(b){const N=b.length;for(let T=0;T<N;T++){const O=b[T],w=`${g.name}/${O.moduleName}`;o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:O.moduleName==="."?g.name:w,name:g.name,remoteSnapshot:y,preloadConfig:S,remote:g,origin:o}),!getPreloaded(w)&&(S.resourceCategory==="all"?(a.push(...A(O.assets.css.async)),a.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.async)),l.push(...A(O.assets.js.sync))):(S.resourceCategory="sync")&&(a.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.sync))),setPreloaded(w))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(g,I)=>{const S=getRegisteredShare(o.shareScopeMap,I.sharedName,g,o.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(I.assets.js.sync.forEach(R=>{c.add(R)}),I.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(g=>{var I;const S=(I=h.shared)==null?void 0:I[g.sharedName];if(!S)return;const R=g.version?S.find(v=>v.version===g.version):S;if(!R)return;arrayOptions(R).forEach(v=>{y(v,g)})})}const _=l.filter(y=>!c.has(y)&&!isExisted("script",y));return{cssAssets:a.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:_,entryAssets:i.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(o){const{origin:t,preloadOptions:n,remoteInfo:r,remote:s,globalSnapshot:a,remoteSnapshot:l}=o;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:r.name,entry:s.entry,type:r.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(r,l),generatePreloadAssets(t,n,r,a,l)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(o,t){const n=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),r=n&&"remotesInfo"in n&&n.remotesInfo&&getInfoWithoutType(n.remotesInfo,o.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:n,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:o.name,version:"version"in o?o.version:void 0})}}class SnapshotHandler{async loadRemoteSnapshotInfo({moduleInfo:t,id:n,expose:r}){const{options:s}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:s,moduleInfo:t});let a=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});a||(a={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:a})),a&&"remotesInfo"in a&&!getInfoWithoutType(a.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(a.remotesInfo=_extends$1({},a==null?void 0:a.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:l,remoteSnapshot:i,globalSnapshot:c}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:h}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:l,remoteSnapshot:i,globalSnapshot:c});let d,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",_=await this.getManifestJson(m,t,{}),E=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:m}),_);d=_,p=E}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});d=m,p=h}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),_=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:E}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});d=E,p=_}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(h)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:n,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:d}),{remoteSnapshot:d,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,n,r){const s=async()=>{let l=this.manifestCache.get(t);if(l)return l;try{let i=await this.loaderHook.lifecycle.fetch.emit(t,{});(!i||!(i instanceof Response))&&(i=await fetch(t,{})),l=await i.json()}catch(i){l=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),l||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:n.name,hostName:this.HostInstance.options.name},`${i}`)))}return assert(l.metaData&&l.exposes&&l.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,l),l},a=async()=>{const l=await s(),i=generateSnapshotFromManifest(l,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:n,manifestJson:l,remoteSnapshot:i,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=a().then(l=>l)),this.manifestLoading[t]}constructor(t){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot"),afterLoadSnapshot:new AsyncWaterfallHook("afterLoadSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=t,this.loaderHook=t.loaderHook}}class SharedHandler{registerShared(t,n){const{shareInfos:r,shared:s}=formatShareConfigs(t,n);return Object.keys(r).forEach(l=>{r[l].forEach(c=>{!getRegisteredShare(this.shareScopeMap,l,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:l,lib:c.lib,get:c.get,loaded:!0,shared:c,from:n.name})})}),{shareInfos:r,shared:s}}async loadShare(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const a=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:r.options.shared,origin:r}),{shareInfo:l}=a;assert(l,`Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);const i=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,r.options.name)};if(i&&i.lib)return c(i),i.lib;if(i&&i.loading&&!i.loaded){const u=await i.loading;return i.loaded=!0,i.lib||(i.lib=u),c(i),u}else if(i){const h=(async()=>{const d=await i.get();return c(i),i.loaded=!0,i.lib=d,d})();return this.setShared({pkgName:t,loaded:!1,shared:i,from:r.options.name,lib:null,loading:h}),h}else{if(n!=null&&n.customShareInfo)return!1;const h=(async()=>{const d=await l.get();l.lib=d,l.loaded=!0,c(l);const p=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare);return p&&(p.lib=d,p.loaded=!0,p.from=l.from),d})();return this.setShared({pkgName:t,loaded:!1,shared:l,from:r.options.name,lib:null,loading:h}),h}}initializeSharing(t=DEFAULT_SCOPE,n){const{host:r}=this,s=n==null?void 0:n.from,a=n==null?void 0:n.strategy;let l=n==null?void 0:n.initScope;const i=[];if(s!=="build"){const{initTokens:_}=this;l||(l=[]);let E=_[t];if(E||(E=_[t]={from:this.host.name}),l.indexOf(E)>=0)return i;l.push(E)}const c=this.shareScopeMap,u=r.options.name;c[t]||(c[t]={});const h=c[t],d=(_,E)=>{var y;const{version:g,eager:I}=E;h[_]=h[_]||{};const S=h[_],R=S[g],b=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!I!=!b?I:u>R.from))&&(S[g]=E)},p=_=>_&&_.init&&_.init(c[t],l),m=async _=>{const{module:E}=await r.remoteHandler.getRemoteModuleAndOptions({id:_});if(E.getEntry){let y;try{y=await E.getEntry()}catch(g){y=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:_,error:g,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}E.inited||(await p(y),E.inited=!0)}};return Object.keys(r.options.shared).forEach(_=>{r.options.shared[_].forEach(y=>{y.scope.includes(t)&&d(_,y)})}),(r.options.shareStrategy==="version-first"||a==="version-first")&&r.options.remotes.forEach(_=>{_.shareScope===t&&i.push(m(_.name))}),i}loadShareSync(t,n){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:n,shareInfos:r.options.shared});s!=null&&s.scope&&s.scope.forEach(i=>{this.initializeSharing(i,{strategy:s.strategy})});const a=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),l=i=>{i.useIn||(i.useIn=[]),addUniqueItem(i.useIn,r.options.name)};if(a){if(typeof a.lib=="function")return l(a),a.loaded||(a.loaded=!0,a.from===r.options.name&&(s.loaded=!0)),a.lib;if(typeof a.get=="function"){const i=a.get();if(!(i instanceof Promise))return l(a),this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:i,shared:a}),i}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const i=s.get();if(i instanceof Promise){const c=(n==null?void 0:n.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(c,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}return s.lib=i,this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}initShareScopeMap(t,n,r={}){const{host:s}=this;this.shareScopeMap[t]=n,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:n,options:s.options,origin:s,scopeName:t,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:t,shared:n,from:r,lib:s,loading:a,loaded:l,get:i}){const{version:c,scope:u="default"}=n,h=_object_without_properties_loose(n,["version","scope"]);(Array.isArray(u)?u:[u]).forEach(p=>{if(this.shareScopeMap[p]||(this.shareScopeMap[p]={}),this.shareScopeMap[p][t]||(this.shareScopeMap[p][t]={}),!this.shareScopeMap[p][t][c]){this.shareScopeMap[p][t][c]=_extends$1({version:c,scope:["default"]},h,{lib:s,loaded:l,loading:a}),i&&(this.shareScopeMap[p][t][c].get=i);return}const m=this.shareScopeMap[p][t][c];a&&!m.loading&&(m.loading=a),l&&!m.loaded&&(m.loaded=l),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(t){const n=getGlobalShareScope(),r=t.id||t.name;r&&!n[r]&&(n[r]=this.shareScopeMap)}constructor(t){this.hooks=new PluginSystem({afterResolve:new AsyncWaterfallHook("afterResolve"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),initContainerShareScopeMap:new SyncWaterfallHook("initContainerShareScopeMap")}),this.host=t,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(t.options)}}class RemoteHandler{formatAndRegisterRemote(t,n){return(n.remotes||[]).reduce((s,a)=>(this.registerRemote(a,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,n){const{remote:r,expose:s}=n,{name:a,alias:l}=r;if(this.idToRemoteMap[t]={name:r.name,expose:s},l&&t.startsWith(a)){const i=t.replace(a,l);this.idToRemoteMap[i]={name:r.name,expose:s};return}if(l&&t.startsWith(l)){const i=t.replace(l,a);this.idToRemoteMap[i]={name:r.name,expose:s}}}async loadRemote(t,n){const{host:r}=this;try{const{loadFactory:s=!0}=n||{loadFactory:!0},{module:a,moduleOptions:l,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:h,id:d,remoteSnapshot:p}=i,m=await a.get(d,h,n,p),_=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:c,expose:h,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:l,moduleInstance:a,origin:r});return this.setIdToRemoteMap(t,i),typeof _=="function"?_:m}catch(s){const{from:a="runtime"}=n||{from:"runtime"},l=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:a,lifecycle:"onLoad",origin:r});if(!l)throw s;return l}}async preloadRemote(t){const{host:n}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:n.options,origin:n});const r=formatPreloadArgs(n.options.remotes,t);await Promise.all(r.map(async s=>{const{remote:a}=s,l=getRemoteInfo(a),{globalSnapshot:i,remoteSnapshot:c}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:a}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:s,remote:a,remoteInfo:l,globalSnapshot:i,remoteSnapshot:c});u&&preloadAssets(l,n,u)}))}registerRemotes(t,n){const{host:r}=this;t.forEach(s=>{this.registerRemote(s,r.options.remotes,{force:n==null?void 0:n.force})})}async getRemoteModuleAndOptions(t){const{host:n}=this,{id:r}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:n.options,origin:n})}catch(_){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:n.options,origin:n,from:"runtime",error:_,lifecycle:"beforeRequest"}),!s)throw _}const{id:a}=s,l=matchRemoteWithNameAndExpose(n.options.remotes,a);assert(l,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:n.options.name,requestId:a}));const{remote:i}=l,c=getRemoteInfo(i),u=await n.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:a},l,{options:n.options,origin:n,remoteInfo:c})),{remote:h,expose:d}=u;assert(h&&d,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);let p=n.moduleCache.get(h.name);const m={host:n,remoteInfo:c};return p||(p=new Module(m),n.moduleCache.set(h.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,n,r){const{host:s}=this,a=()=>{if(t.alias){const i=n.find(c=>{var u;return t.alias&&(c.name.startsWith(t.alias)||((u=c.alias)==null?void 0:u.startsWith(t.alias)))});assert(!i,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in t&&isBrowserEnv()&&!t.entry.startsWith("http")&&(t.entry=new URL(t.entry,window.location.origin).href),t.shareScope||(t.shareScope=DEFAULT_SCOPE),t.type||(t.type=DEFAULT_REMOTE_TYPE)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:t,origin:s});const l=n.find(i=>i.name===t.name);if(!l)a(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const i=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(l),a(),n.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(i.join(" ")))}}removeRemote(t){try{const{host:r}=this,{name:s}=t,a=r.options.remotes.findIndex(i=>i.name===s);a!==-1&&r.options.remotes.splice(a,1);const l=r.moduleCache.get(t.name);if(l){const i=l.remoteInfo,c=i.entryGlobalName;if(CurrentGlobal[c]){var n;(n=Object.getOwnPropertyDescriptor(CurrentGlobal,c))!=null&&n.configurable?delete CurrentGlobal[c]:CurrentGlobal[c]=void 0}const u=getRemoteEntryUniqueKey(l.remoteInfo);globalLoading[u]&&delete globalLoading[u],r.snapshotHandler.manifestCache.delete(i.entry);let h=i.buildVersion?composeKeyWithSeparator(i.name,i.buildVersion):i.name;const d=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>i.buildVersion?m.options.id===h:m.name===h);if(d!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[d];h=m.options.id||h;const _=getGlobalShareScope();let E=!0;const y=[];Object.keys(_).forEach(g=>{const I=_[g];I&&Object.keys(I).forEach(S=>{const R=I[S];R&&Object.keys(R).forEach(b=>{const v=R[b];v&&Object.keys(v).forEach($=>{const A=v[$];A&&typeof A=="object"&&A.from===i.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(N=>N!==i.name),A.useIn.length?E=!1:y.push([g,S,b,$])):y.push([g,S,b,$]))})})})}),E&&(m.shareScopeMap={},delete _[h]),y.forEach(([g,I,S,R])=>{var b,v,$;($=_[g])==null||(v=$[I])==null||(b=v[S])==null||delete b[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(d,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,r);if(p){const m=p&&"remotesInfo"in p&&p.remotesInfo&&getInfoWithoutType(p.remotesInfo,t.name).key;m&&(delete p.remotesInfo[m],Global.__FEDERATION__.__MANIFEST_LOADING__[m]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[m])}r.moduleCache.delete(t.name)}}catch(r){logger.log("removeRemote fail: ",r)}}constructor(t){this.hooks=new PluginSystem({beforeRegisterRemote:new SyncWaterfallHook("beforeRegisterRemote"),registerRemote:new SyncWaterfallHook("registerRemote"),beforeRequest:new AsyncWaterfallHook("beforeRequest"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforePreloadRemote:new AsyncHook("beforePreloadRemote"),generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook,loadEntry:new AsyncHook}),this.host=t,this.idToRemoteMap={}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{initOptions(t){this.registerPlugins(t.plugins);const n=this.formatOptions(this.options,t);return this.options=n,n}async loadShare(t,n){return this.sharedHandler.loadShare(t,n)}loadShareSync(t,n){return this.sharedHandler.loadShareSync(t,n)}initializeSharing(t=DEFAULT_SCOPE,n){return this.sharedHandler.initializeSharing(t,n)}initRawContainer(t,n,r){const s=getRemoteInfo({name:t,entry:n}),a=new Module({host:this,remoteInfo:s});return a.remoteEntryExports=r,this.moduleCache.set(t,a),a}async loadRemote(t,n){return this.remoteHandler.loadRemote(t,n)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,n,r={}){this.sharedHandler.initShareScopeMap(t,n,r)}formatOptions(t,n){const{shared:r}=formatShareConfigs(t,n),{userOptions:s,options:a}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:n,options:t,shareInfo:r}),l=this.remoteHandler.formatAndRegisterRemote(a,s),{shared:i}=this.sharedHandler.registerShared(a,s),c=[...a.plugins];s.plugins&&s.plugins.forEach(h=>{c.includes(h)||c.push(h)});const u=_extends$1({},t,n,{plugins:c,remotes:l,shared:i});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const n=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((r,s)=>(s&&r&&!r.find(a=>a.name===s.name)&&r.push(s),r),n||[])}registerRemotes(t,n){return this.remoteHandler.registerRemotes(t,n)}registerShared(t){this.sharedHandler.registerShared(this.options,_extends$1({},this.options,{shared:t}))}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.0.0-next-20250920011011",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,loadEntryError:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const n=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],r={id:getBuilderId(),name:t.name,plugins:n,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=r,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...t.plugins||[]]),this.options=this.formatOptions(r,t)}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(o){const t=new Map,n=getInstance();return()=>({__APP_VERSION__:"0.0.0-next-20250920011011",async render(r){var _,E,y;LoggerInstance.debug("createBridgeComponent render Info",r);const{moduleName:s,dom:a,basename:l,memoryRoute:i,hashRoute:c,...u}=r,h=Vue__namespace.createApp(o.rootComponent,u);t.set(a,h);const d=await((y=(E=(_=n==null?void 0:n.bridgeHook)==null?void 0:_.lifecycle)==null?void 0:E.beforeBridgeRender)==null?void 0:y.emit(r)),p=d&&typeof d=="object"&&(d!=null&&d.extraProps)?d==null?void 0:d.extraProps:{},m=o.appOptions({app:h,basename:l,memoryRoute:i,hashRoute:c,...u,...p});if(m!=null&&m.router){let g,I=m.router.getRoutes();r.memoryRoute?g=VueRouter__namespace.createMemoryHistory(r.basename):r.hashRoute?(g=VueRouter__namespace.createWebHashHistory(),I=I.map(R=>({...R,path:r.basename+R.path}))):g=VueRouter__namespace.createWebHistory(r.basename);const S=VueRouter__namespace.createRouter({...m.router.options,history:g,routes:I});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:S}),i&&await S.push(i.entryPath),h.use(S)}h.mount(a)},destroy(r){LoggerInstance.debug("createBridgeComponent destroy Info",r);const s=t.get(r==null?void 0:r.dom);s==null||s.unmount()}})}function e(){const o=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(o)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(o){const t=Vue.ref(null),n=Vue.ref(null),r=Vue.ref(""),s=VueRouter.useRoute(),a=getInstance(),l=Vue.useAttrs(),i=async()=>{var p,m,_,E;const u=(p=o.providerInfo)==null?void 0:p.call(o);n.value=u;let h={...l,moduleName:o.moduleName,dom:t.value,basename:o.basename,memoryRoute:o.memoryRoute,hashRoute:o.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",h);const d=await((E=(_=(m=a==null?void 0:a.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:_.beforeBridgeRender)==null?void 0:E.emit(h))||{};h={...h,...d.extraProps},u.render(h)},c=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&i(),r.value!==""&&r.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...o,pathname:s.path}),e()),r.value=u});return Vue.onMounted(()=>{i()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...o}),c(),(u=n.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(o.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(o){return Vue.defineAsyncComponent({__APP_VERSION__:"0.0.0-next-20250920011011",...o.asyncComponentOptions,loader:async()=>{var c,u;const t=VueRouter.useRoute();let n="/";const r=(u=(c=t==null?void 0:t.matched)==null?void 0:c[0])==null?void 0:u.path;r&&(r.endsWith("/:pathMatch(.*)*")?n=r.replace("/:pathMatch(.*)*",""):n=t.matched[0].path);const s=(o==null?void 0:o.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:n,info:o});const a=await o.loader(),l=a&&a[Symbol.for("mf_module_id")],i=a[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:l,module:a,exportName:s,basename:n,route:t}),s in a&&typeof i=="function")return{render(){return Vue.h(RemoteApp,{moduleName:l,providerInfo:i,basename:n,rootAttrs:o.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(o){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(o)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
|
|
4
|
+
`)};function _extends(){return _extends=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},_extends.apply(this,arguments)}const runtimeDescMap={[RUNTIME_001]:"Failed to get remoteEntry exports.",[RUNTIME_002]:'The remote entry interface does not contain "init"',[RUNTIME_003]:"Failed to get manifest.",[RUNTIME_004]:"Failed to locate remote.",[RUNTIME_005]:"Invalid loadShareSync function call from bundler runtime",[RUNTIME_006]:"Invalid loadShareSync function call from runtime",[RUNTIME_007]:"Failed to get remote snapshot.",[RUNTIME_008]:"Failed to load script resources.",[RUNTIME_009]:"Please call createInstance first."},typeDescMap={[TYPE_001]:"Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."},buildDescMap={[BUILD_001]:"Failed to find expose module.",[BUILD_002]:"PublicPath is required in prod mode."};_extends({},runtimeDescMap,typeDescMap,buildDescMap);const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(n,t){n||error(t)}function error(n){throw n instanceof Error?(n.message.startsWith(LOG_CATEGORY)||(n.message=`${LOG_CATEGORY}: ${n.message}`),n):new Error(`${LOG_CATEGORY}: ${n}`)}function warn(n){n instanceof Error&&(n.message.startsWith(LOG_CATEGORY)||(n.message=`${LOG_CATEGORY}: ${n.message}`)),logger.warn(n)}function addUniqueItem(n,t){return n.findIndex(o=>o===t)===-1&&n.push(t),n}function getFMId(n){return"version"in n&&n.version?`${n.name}:${n.version}`:"entry"in n&&n.entry?`${n.name}:${n.entry}`:`${n.name}`}function isRemoteInfoWithEntry(n){return typeof n.entry<"u"}function isPureRemoteEntry(n){return!n.entry.includes(".json")}function isObject(n){return n&&typeof n=="object"}const objectToString=Object.prototype.toString;function isPlainObject(n){return objectToString.call(n)==="[object Object]"}function arrayOptions(n){return Array.isArray(n)?n:[n]}function getRemoteEntryInfoFromSnapshot(n){const t={url:"",type:"global",globalName:""};return isBrowserEnv()||isReactNativeEnv()?"remoteEntry"in n?{url:n.remoteEntry,type:n.remoteEntryType,globalName:n.globalName}:t:"ssrRemoteEntry"in n?{url:n.ssrRemoteEntry||t.url,type:n.ssrRemoteEntryType||t.type,globalName:n.globalName}:t}const processModuleAlias=(n,t)=>{let o;return n.endsWith("/")?o=n.slice(0,-1):o=n,t.startsWith(".")&&(t=t.slice(1)),o=o+t,o},CurrentGlobal=typeof globalThis=="object"?globalThis:window,nativeGlobal=(()=>{try{return document.defaultView}catch{return CurrentGlobal}})(),Global=nativeGlobal;function definePropertyGlobalVal(n,t,o){Object.defineProperty(n,t,{value:o,configurable:!1,writable:!0})}function includeOwnProperty(n,t){return Object.hasOwnProperty.call(n,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(n){var t,o,r,s,a,l;includeOwnProperty(n,"__VMOK__")&&!includeOwnProperty(n,"__FEDERATION__")&&definePropertyGlobalVal(n,"__FEDERATION__",n.__VMOK__),includeOwnProperty(n,"__FEDERATION__")||(definePropertyGlobalVal(n,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(n,"__VMOK__",n.__FEDERATION__));var i;(i=(t=n.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(o=n.__FEDERATION__).__INSTANCES__)!=null||(o.__INSTANCES__=[]);var u;(u=(r=n.__FEDERATION__).moduleInfo)!=null||(r.moduleInfo={});var d;(d=(s=n.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var h;(h=(a=n.__FEDERATION__).__MANIFEST_LOADING__)!=null||(a.__MANIFEST_LOADING__={});var p;(p=(l=n.__FEDERATION__).__PRELOADED_MAP__)!=null||(l.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(n,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=n,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.0.0-next-20250922150632")}function getInfoWithoutType(n,t){if(typeof t=="string"){if(n[t])return{value:n[t],key:t};{const r=Object.keys(n);for(const s of r){const[a,l]=s.split(":"),i=`${a}:${t}`,c=n[i];if(c)return{value:c,key:i}}return{value:void 0,key:t}}}else throw new Error("key must be string")}const getGlobalSnapshot=()=>nativeGlobal.__FEDERATION__.moduleInfo,getTargetSnapshotInfoByModuleInfo=(n,t)=>{const o=getFMId(n),r=getInfoWithoutType(t,o).value;if(r&&!r.version&&"version"in n&&n.version&&(r.version=n.version),r)return r;if("version"in n&&n.version){const{version:s}=n,a=_object_without_properties_loose(n,["version"]),l=getFMId(a),i=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,l).value;if((i==null?void 0:i.version)===s)return i}},getGlobalSnapshotInfoByModuleInfo=n=>getTargetSnapshotInfoByModuleInfo(n,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(n,t)=>{const o=getFMId(n);return nativeGlobal.__FEDERATION__.moduleInfo[o]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=n=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,n),()=>{const t=Object.keys(n);for(const o of t)delete nativeGlobal.__FEDERATION__.moduleInfo[o]}),getRemoteEntryExports=(n,t)=>{const o=t||`__FEDERATION_${n}:custom__`,r=CurrentGlobal[o];return{remoteEntryKey:o,entryExports:r}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=n=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(n),setPreloaded=n=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(n,!0),DEFAULT_SCOPE="default",DEFAULT_REMOTE_TYPE="global",buildIdentifier="[0-9A-Za-z-]+",build=`(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`,numericIdentifier="0|[1-9]\\d*",numericIdentifierLoose="[0-9]+",nonNumericIdentifier="\\d*[a-zA-Z-][a-zA-Z0-9-]*",preReleaseIdentifierLoose=`(?:${numericIdentifierLoose}|${nonNumericIdentifier})`,preReleaseLoose=`(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`,preReleaseIdentifier=`(?:${numericIdentifier}|${nonNumericIdentifier})`,preRelease=`(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`,xRangeIdentifier=`${numericIdentifier}|x|X|\\*`,xRangePlain=`[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`,hyphenRange=`^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`,mainVersionLoose=`(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`,loosePlain=`[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`,gtlt="((?:<|>)?=?)",comparatorTrim=`(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`,loneTilde="(?:~>?)",tildeTrim=`(\\s*)${loneTilde}\\s+`,loneCaret="(?:\\^)",caretTrim=`(\\s*)${loneCaret}\\s+`,star="(<|>)?=?\\s*\\*",caret=`^${loneCaret}${xRangePlain}$`,mainVersion=`(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`,fullPlain=`v?${mainVersion}${preRelease}?${build}?`,tilde=`^${loneTilde}${xRangePlain}$`,xRange=`^${gtlt}\\s*${xRangePlain}$`,comparator=`^${gtlt}\\s*(${fullPlain})$|^$`,gte0="^\\s*>=\\s*0.0.0\\s*$";function parseRegex(n){return new RegExp(n)}function isXVersion(n){return!n||n.toLowerCase()==="x"||n==="*"}function pipe(...n){return t=>n.reduce((o,r)=>r(o),t)}function extractComparator(n){return n.match(parseRegex(comparator))}function combineVersion(n,t,o,r){const s=`${n}.${t}.${o}`;return r?`${s}-${r}`:s}function parseHyphen(n){return n.replace(parseRegex(hyphenRange),(t,o,r,s,a,l,i,c,u,d,h,p)=>(isXVersion(r)?o="":isXVersion(s)?o=`>=${r}.0.0`:isXVersion(a)?o=`>=${r}.${s}.0`:o=`>=${o}`,isXVersion(u)?c="":isXVersion(d)?c=`<${Number(u)+1}.0.0-0`:isXVersion(h)?c=`<${u}.${Number(d)+1}.0-0`:p?c=`<=${u}.${d}.${h}-${p}`:c=`<=${c}`,`${o} ${c}`.trim()))}function parseComparatorTrim(n){return n.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(n){return n.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(n){return n.replace(parseRegex(caretTrim),"$1^")}function parseCarets(n){return n.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(o,r,s,a,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(a)?r==="0"?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.0 <${Number(r)+1}.0.0-0`:l?r==="0"?s==="0"?`>=${r}.${s}.${a}-${l} <${r}.${s}.${Number(a)+1}-0`:`>=${r}.${s}.${a}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a}-${l} <${Number(r)+1}.0.0-0`:r==="0"?s==="0"?`>=${r}.${s}.${a} <${r}.${s}.${Number(a)+1}-0`:`>=${r}.${s}.${a} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a} <${Number(r)+1}.0.0-0`)).join(" ")}function parseTildes(n){return n.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(o,r,s,a,l)=>isXVersion(r)?"":isXVersion(s)?`>=${r}.0.0 <${Number(r)+1}.0.0-0`:isXVersion(a)?`>=${r}.${s}.0 <${r}.${Number(s)+1}.0-0`:l?`>=${r}.${s}.${a}-${l} <${r}.${Number(s)+1}.0-0`:`>=${r}.${s}.${a} <${r}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(n){return n.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(o,r,s,a,l,i)=>{const c=isXVersion(s),u=c||isXVersion(a),d=u||isXVersion(l);return r==="="&&d&&(r=""),i="",c?r===">"||r==="<"?"<0.0.0-0":"*":r&&d?(u&&(a=0),l=0,r===">"?(r=">=",u?(s=Number(s)+1,a=0,l=0):(a=Number(a)+1,l=0)):r==="<="&&(r="<",u?s=Number(s)+1:a=Number(a)+1),r==="<"&&(i="-0"),`${r+s}.${a}.${l}${i}`):u?`>=${s}.0.0${i} <${Number(s)+1}.0.0-0`:d?`>=${s}.${a}.0${i} <${s}.${Number(a)+1}.0-0`:o})).join(" ")}function parseStar(n){return n.trim().replace(parseRegex(star),"")}function parseGTE0(n){return n.trim().replace(parseRegex(gte0),"")}function compareAtom(n,t){return n=Number(n)||n,t=Number(t)||t,n>t?1:n===t?0:-1}function comparePreRelease(n,t){const{preRelease:o}=n,{preRelease:r}=t;if(o===void 0&&r)return 1;if(o&&r===void 0)return-1;if(o===void 0&&r===void 0)return 0;for(let s=0,a=o.length;s<=a;s++){const l=o[s],i=r[s];if(l!==i)return l===void 0&&i===void 0?0:l?i?compareAtom(l,i):-1:1}return 0}function compareVersion(n,t){return compareAtom(n.major,t.major)||compareAtom(n.minor,t.minor)||compareAtom(n.patch,t.patch)||comparePreRelease(n,t)}function eq(n,t){return n.version===t.version}function compare(n,t){switch(n.operator){case"":case"=":return eq(n,t);case">":return compareVersion(n,t)<0;case">=":return eq(n,t)||compareVersion(n,t)<0;case"<":return compareVersion(n,t)>0;case"<=":return eq(n,t)||compareVersion(n,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(n){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(n)}function parseRange(n){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(n.trim()).split(/\s+/).join(" ")}function satisfy(n,t){if(!n)return!1;const o=extractComparator(n);if(!o)return!1;const[,r,,s,a,l,i]=o,c={operator:r,version:combineVersion(s,a,l,i),major:s,minor:a,patch:l,preRelease:i==null?void 0:i.split(".")},u=t.split("||");for(const d of u){const h=d.trim();if(!h||h==="*"||h==="x")return!0;try{const p=parseRange(h);if(!p.trim())return!0;const m=p.split(" ").map(y=>parseComparatorString(y)).join(" ");if(!m.trim())return!0;const _=m.split(/\s+/).map(y=>parseGTE0(y)).filter(Boolean);if(_.length===0)continue;let E=!0;for(const y of _){const g=extractComparator(y);if(!g){E=!1;break}const[,I,,S,R,b,v]=g,$={operator:I,version:combineVersion(S,R,b,v),major:S,minor:R,patch:b,preRelease:v==null?void 0:v.split(".")};if(!compare($,c)){E=!1;break}}if(E)return!0}catch(p){console.error(`[semver] Error processing range part "${h}":`,p);continue}}return!1}function formatShare(n,t,o,r){let s;"get"in n?s=n.get:"lib"in n?s=()=>Promise.resolve(n.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${o}'!`)});var a,l,i;return _extends$1({deps:[],useIn:[],from:t,loading:null},n,{shareConfig:_extends$1({requiredVersion:`^${n.version}`,singleton:!1,eager:!1,strictVersion:!1},n.shareConfig),get:s,loaded:n!=null&&n.loaded||"lib"in n?!0:void 0,version:(a=n.version)!=null?a:"0",scope:Array.isArray(n.scope)?n.scope:[(l=n.scope)!=null?l:"default"],strategy:((i=n.strategy)!=null?i:r)||"version-first"})}function formatShareConfigs(n,t){const o=t.shared||{},r=t.name,s=Object.keys(o).reduce((l,i)=>{const c=arrayOptions(o[i]);return l[i]=l[i]||[],c.forEach(u=>{l[i].push(formatShare(u,r,i,t.shareStrategy))}),l},{}),a=_extends$1({},n.shared);return Object.keys(s).forEach(l=>{a[l]?s[l].forEach(i=>{a[l].find(u=>u.version===i.version)||a[l].push(i)}):a[l]=s[l]}),{shared:a,shareInfos:s}}function versionLt(n,t){const o=r=>{if(!Number.isNaN(Number(r))){const a=r.split(".");let l=r;for(let i=0;i<3-a.length;i++)l+=".0";return l}return r};return!!satisfy(o(n),`<=${o(t)}`)}const findVersion=(n,t)=>{const o=t||function(r,s){return versionLt(r,s)};return Object.keys(n).reduce((r,s)=>!r||o(r,s)||r==="0"?s:r,0)},isLoaded=n=>!!n.loaded||typeof n.lib=="function",isLoading=n=>!!n.loading;function findSingletonVersionOrderByVersion(n,t,o){const r=n[t][o],s=function(a,l){return!isLoaded(r[a])&&versionLt(a,l)};return findVersion(n[t][o],s)}function findSingletonVersionOrderByLoaded(n,t,o){const r=n[t][o],s=function(a,l){const i=c=>isLoaded(c)||isLoading(c);return i(r[l])?i(r[a])?!!versionLt(a,l):!0:i(r[a])?!1:versionLt(a,l)};return findVersion(n[t][o],s)}function getFindShareFunction(n){return n==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(n,t,o,r){if(!n)return;const{shareConfig:s,scope:a=DEFAULT_SCOPE,strategy:l}=o,i=Array.isArray(a)?a:[a];for(const c of i)if(s&&n[c]&&n[c][t]){const{requiredVersion:u}=s,h=getFindShareFunction(l)(n,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(h,u)){const E=`Version ${h} from ${h&&n[c][t][h].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;s.strictVersion?error(E):warn(E)}return n[c][t][h]}else{if(u===!1||u==="*"||satisfy(h,u))return n[c][t][h];for(const[E,y]of Object.entries(n[c][t]))if(satisfy(E,u))return y}},m={shareScopeMap:n,scope:c,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(r.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(n){const{pkgName:t,extraOptions:o,shareInfos:r}=n,s=i=>{if(!i)return;const c={};i.forEach(h=>{c[h.version]=h});const d=findVersion(c,function(h,p){return!isLoaded(c[h])&&versionLt(h,p)});return c[d]};var a;const l=(a=o==null?void 0:o.resolver)!=null?a:s;return Object.assign({},l(r[t]),o==null?void 0:o.customShareInfo)}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function matchRemoteWithNameAndExpose(n,t){for(const o of n){const r=t.startsWith(o.name);let s=t.replace(o.name,"");if(r){if(s.startsWith("/")){const i=o.name;return s=`.${s}`,{pkgNameOrAlias:i,expose:s,remote:o}}else if(s==="")return{pkgNameOrAlias:o.name,expose:".",remote:o}}const a=o.alias&&t.startsWith(o.alias);let l=o.alias&&t.replace(o.alias,"");if(o.alias&&a){if(l&&l.startsWith("/")){const i=o.alias;return l=`.${l}`,{pkgNameOrAlias:i,expose:l,remote:o}}else if(l==="")return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function matchRemote(n,t){for(const o of n)if(t===o.name||o.alias&&t===o.alias)return o}function registerPlugins(n,t){const o=getGlobalHostPlugins(),r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return o.length>0&&o.forEach(s=>{n!=null&&n.find(a=>a.name!==s.name)&&n.push(s)}),n&&n.length>0&&n.forEach(s=>{r.forEach(a=>{a.applyPlugin(s,t)})}),n}const importCallback=".then(callbacks[0]).catch(callbacks[1])";async function loadEsmEntry({entry:n,remoteEntryExports:t}){return new Promise((o,r)=>{try{t?o(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${n}")${importCallback}`)([o,r]):import(n).then(o).catch(r)}catch(s){r(s)}})}async function loadSystemJsEntry({entry:n,remoteEntryExports:t}){return new Promise((o,r)=>{try{t?o(t):typeof __system_context__>"u"?System.import(n).then(o).catch(r):new Function("callbacks",`System.import("${n}")${importCallback}`)([o,r])}catch(s){r(s)}})}function handleRemoteEntryLoaded(n,t,o){const{remoteEntryKey:r,entryExports:s}=getRemoteEntryExports(n,t);return assert(s,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:n,remoteEntryUrl:o,remoteEntryKey:r})),s}async function loadEntryScript({name:n,globalName:t,entry:o,loaderHook:r,getEntryUrl:s}){const{entryExports:a}=getRemoteEntryExports(n,t);if(a)return a;const l=s?s(o):o;return loadScript(l,{attrs:{},createScriptHook:(i,c)=>{const u=r.lifecycle.createScript.emit({url:i,attrs:c});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>handleRemoteEntryLoaded(n,t,o)).catch(i=>{throw assert(void 0,getShortErrorMsg(RUNTIME_008,runtimeDescMap,{remoteName:n,resourceUrl:o})),i})}async function loadEntryDom({remoteInfo:n,remoteEntryExports:t,loaderHook:o,getEntryUrl:r}){const{entry:s,entryGlobalName:a,name:l,type:i}=n;switch(i){case"esm":case"module":return loadEsmEntry({entry:s,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:s,remoteEntryExports:t});default:return loadEntryScript({entry:s,globalName:a,name:l,loaderHook:o,getEntryUrl:r})}}async function loadEntryNode({remoteInfo:n,loaderHook:t}){const{entry:o,entryGlobalName:r,name:s,type:a}=n,{entryExports:l}=getRemoteEntryExports(s,r);return l||loadScriptNode(o,{attrs:{name:s,globalName:r,type:a},loaderHook:{createScriptHook:(i,c={})=>{const u=t.lifecycle.createScript.emit({url:i,attrs:c});if(u&&"url"in u)return u}}}).then(()=>handleRemoteEntryLoaded(s,r,o)).catch(i=>{throw i})}function getRemoteEntryUniqueKey(n){const{entry:t,name:o}=n;return composeKeyWithSeparator(o,t)}async function getRemoteEntry(n){const{origin:t,remoteEntryExports:o,remoteInfo:r,getEntryUrl:s,_inErrorHandling:a=!1}=n,l=getRemoteEntryUniqueKey(r);if(o)return o;if(!globalLoading[l]){const i=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;globalLoading[l]=i.emit({loaderHook:c,remoteInfo:r,remoteEntryExports:o}).then(u=>u||((typeof ENV_TARGET<"u"?ENV_TARGET==="web":isBrowserEnv())?loadEntryDom({remoteInfo:r,remoteEntryExports:o,loaderHook:c,getEntryUrl:s}):loadEntryNode({remoteInfo:r,loaderHook:c}))).catch(async u=>{const d=getRemoteEntryUniqueKey(r);if(u instanceof Error&&u.message.includes(RUNTIME_008)&&!a){const p=_=>getRemoteEntry(_extends$1({},_,{_inErrorHandling:!0})),m=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:p,origin:t,remoteInfo:r,remoteEntryExports:o,globalLoading,uniqueKey:d});if(m)return m}throw u})}return globalLoading[l]}function getRemoteInfo(n){return _extends$1({},n,{entry:"entry"in n?n.entry:"",type:n.type||DEFAULT_REMOTE_TYPE,entryGlobalName:n.entryGlobalName||n.name,shareScope:n.shareScope||DEFAULT_SCOPE})}function defaultPreloadArgs(n){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},n)}function formatPreloadArgs(n,t){return t.map(o=>{const r=matchRemote(n,o.nameOrAlias);return assert(r,`Unable to preload ${o.nameOrAlias} as it is not included in ${!r&&safeToString({remoteInfo:r,remotes:n})}`),{remote:r,preloadConfig:defaultPreloadArgs(o)}})}function normalizePreloadExposes(n){return n?n.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(n,t,o,r=!0){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:l}=o;if(t.options.inBrowser){if(l.forEach(i=>{const{moduleInfo:c}=i,u=t.moduleCache.get(n.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),r){const i={rel:"preload",as:"style"};s.forEach(c=>{const{link:u,needAttach:d}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const i={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:u,needAttach:d}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m},needDeleteLink:!1});d&&document.head.appendChild(u)})}if(r){const i={rel:"preload",as:"script"};a.forEach(c=>{const{link:u,needAttach:d}=createLink({url:c,cb:()=>{},attrs:i,createLinkHook:(h,p)=>{const m=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(m instanceof HTMLLinkElement)return m}});d&&document.head.appendChild(u)})}else{const i={fetchpriority:"high",type:(n==null?void 0:n.type)==="module"?"module":"text/javascript"};a.forEach(c=>{const{script:u,needAttach:d}=createScript({url:c,cb:()=>{},attrs:i,createScriptHook:(h,p)=>{const m=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:p});if(m instanceof HTMLScriptElement)return m},needDeleteScript:!0});d&&document.head.appendChild(u)})}}}let Module=class{async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;let t;return t=await getRemoteEntry({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports}),assert(t,`remoteEntryExports is undefined
|
|
5
|
+
${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,o,r,s){const{loadFactory:a=!0}=r||{loadFactory:!0},l=await this.getEntry();if(!this.inited){const h=this.host.shareScopeMap,p=Array.isArray(this.remoteInfo.shareScope)?this.remoteInfo.shareScope:[this.remoteInfo.shareScope];p.length||p.push("default"),p.forEach(g=>{h[g]||(h[g]={})});const m=h[p[0]],_=[],E={version:this.remoteInfo.version||"",shareScopeKeys:Array.isArray(this.remoteInfo.shareScope)?p:this.remoteInfo.shareScope||"default"};Object.defineProperty(E,"shareScopeMap",{value:h,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:E,initScope:_,remoteInfo:this.remoteInfo,origin:this.host});typeof(l==null?void 0:l.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await l.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:l}))}this.lib=l,this.inited=!0;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:l,expose:o,moduleInfo:this.remoteInfo}),i||(i=await l.get(o)),assert(i,`${getFMId(this.remoteInfo)} remote don't export ${o}.`);const c=processModuleAlias(this.remoteInfo.name,o),u=this.wraperFactory(i,c);return a?await u():u}wraperFactory(t,o){function r(s,a){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:a,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return r(s,o),s}:()=>{const s=t();return r(s,o),s}}constructor({remoteInfo:t,host:o}){this.inited=!1,this.lib=void 0,this.remoteInfo=t,this.host=o}};class SyncHook{on(t){typeof t=="function"&&this.listeners.add(t)}once(t){const o=this;this.on(function r(...s){return o.remove(r),t.apply(null,s)})}emit(...t){let o;return this.listeners.size>0&&this.listeners.forEach(r=>{o=r(...t)}),o}remove(t){this.listeners.delete(t)}removeAll(){this.listeners.clear()}constructor(t){this.type="",this.listeners=new Set,t&&(this.type=t)}}class AsyncHook extends SyncHook{emit(...t){let o;const r=Array.from(this.listeners);if(r.length>0){let s=0;const a=l=>l===!1?!1:s<r.length?Promise.resolve(r[s++].apply(null,t)).then(a):l;o=a()}return Promise.resolve(o)}}function checkReturnData(n,t){if(!isObject(t))return!1;if(n!==t){for(const o in n)if(!(o in t))return!1}return!0}class SyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The data for the "${this.type}" hook should be an object.`);for(const o of this.listeners)try{const r=o(t);if(checkReturnData(t,r))t=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){warn(r),this.onerror(r)}return t}constructor(t){super(),this.onerror=error,this.type=t}}class AsyncWaterfallHook extends SyncHook{emit(t){isObject(t)||error(`The response data for the "${this.type}" hook must be an object.`);const o=Array.from(this.listeners);if(o.length>0){let r=0;const s=l=>(warn(l),this.onerror(l),t),a=l=>{if(checkReturnData(t,l)){if(t=l,r<o.length)try{return Promise.resolve(o[r++](t)).then(a,s)}catch(i){return s(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return t};return Promise.resolve(a(t))}return Promise.resolve(t)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t,o){assert(isPlainObject(t),"Plugin configuration is invalid.");const r=t.name;assert(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=t,t.apply==null||t.apply.call(t,o),Object.keys(this.lifecycle).forEach(s=>{const a=t[s];a&&this.lifecycle[s].on(a)}))}removePlugin(t){assert(t,"A name is required.");const o=this.registerPlugins[t];assert(o,`The plugin "${t}" is not registered.`),Object.keys(o).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(o[r])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function assignRemoteInfo(n,t){const o=getRemoteEntryInfoFromSnapshot(t);o.url||error(`The attribute remoteEntry of ${n.name} must not be undefined.`);let r=getResourceUrl(t,o.url);!isBrowserEnv()&&!r.startsWith("http")&&(r=`https:${r}`),n.type=o.type,n.entryGlobalName=o.globalName,n.entry=r,n.version=t.version,n.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(n){const{remote:t,pkgNameOrAlias:o,expose:r,origin:s,remoteInfo:a,id:l}=n;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:i,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:l});assignRemoteInfo(a,i);const u={remote:t,preloadConfig:{nameOrAlias:o,exposes:[r],resourceCategory:"sync",share:!1,depsRemote:!1}},d=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:a,remote:t,remoteSnapshot:i,globalSnapshot:c});return d&&preloadAssets(a,s,d,!1),_extends$1({},n,{remoteSnapshot:i})}return n}}}function splitId(n){const t=n.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function traverseModuleInfo(n,t,o,r,s={},a){const l=getFMId(t),{value:i}=getInfoWithoutType(n,l),c=a||i;if(c&&!isManifestProvider(c)&&(o(c,t,r),c.remotesInfo)){const u=Object.keys(c.remotesInfo);for(const d of u){if(s[d])continue;s[d]=!0;const h=splitId(d),p=c.remotesInfo[d];traverseModuleInfo(n,{name:h.name,version:p.matchedVersion},o,!1,s,void 0)}}}const isExisted=(n,t)=>document.querySelector(`${n}[${n==="link"?"href":"src"}="${t}"]`);function generatePreloadAssets(n,t,o,r,s){const a=[],l=[],i=[],c=new Set,u=new Set,{options:d}=n,{preloadConfig:h}=t,{depsRemote:p}=h;if(traverseModuleInfo(r,o,(y,g,I)=>{let S;if(I)S=h;else if(Array.isArray(p)){const N=p.find(T=>T.nameOrAlias===g.name||T.nameOrAlias===g.alias);if(!N)return;S=defaultPreloadArgs(N)}else if(p===!0)S=h;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&i.push({name:g.name,moduleInfo:{name:g.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:g.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let b="modules"in y?y.modules:[];const v=normalizePreloadExposes(S.exposes);if(v.length&&"modules"in y){var $;b=y==null||($=y.modules)==null?void 0:$.reduce((N,T)=>((v==null?void 0:v.indexOf(T.moduleName))!==-1&&N.push(T),N),[])}function A(N){const T=N.map(O=>getResourceUrl(y,O));return S.filter?T.filter(S.filter):T}if(b){const N=b.length;for(let T=0;T<N;T++){const O=b[T],w=`${g.name}/${O.moduleName}`;n.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:O.moduleName==="."?g.name:w,name:g.name,remoteSnapshot:y,preloadConfig:S,remote:g,origin:n}),!getPreloaded(w)&&(S.resourceCategory==="all"?(a.push(...A(O.assets.css.async)),a.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.async)),l.push(...A(O.assets.js.sync))):(S.resourceCategory="sync")&&(a.push(...A(O.assets.css.sync)),l.push(...A(O.assets.js.sync))),setPreloaded(w))}}},!0,{},s),s.shared&&s.shared.length>0){const y=(g,I)=>{const S=getRegisteredShare(n.shareScopeMap,I.sharedName,g,n.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(I.assets.js.sync.forEach(R=>{c.add(R)}),I.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(g=>{var I;const S=(I=d.shared)==null?void 0:I[g.sharedName];if(!S)return;const R=g.version?S.find(v=>v.version===g.version):S;if(!R)return;arrayOptions(R).forEach(v=>{y(v,g)})})}const _=l.filter(y=>!c.has(y)&&!isExisted("script",y));return{cssAssets:a.filter(y=>!u.has(y)&&!isExisted("link",y)),jsAssetsWithoutEntry:_,entryAssets:i.filter(y=>!isExisted("script",y.url))}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(n){const{origin:t,preloadOptions:o,remoteInfo:r,remote:s,globalSnapshot:a,remoteSnapshot:l}=n;return isBrowserEnv()?isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:r.name,entry:s.entry,type:r.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(r,l),generatePreloadAssets(t,o,r,a,l)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}};function getGlobalRemoteInfo(n,t){const o=getGlobalSnapshotInfoByModuleInfo({name:t.name,version:t.options.version}),r=o&&"remotesInfo"in o&&o.remotesInfo&&getInfoWithoutType(o.remotesInfo,n.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:n.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:n.name,version:"version"in n?n.version:void 0})}}class SnapshotHandler{async loadRemoteSnapshotInfo({moduleInfo:t,id:o,expose:r}){const{options:s}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:s,moduleInfo:t});let a=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});a||(a={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:a})),a&&"remotesInfo"in a&&!getInfoWithoutType(a.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(a.remotesInfo=_extends$1({},a==null?void 0:a.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:l,remoteSnapshot:i,globalSnapshot:c}=this.getGlobalRemoteInfo(t),{remoteSnapshot:u,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:s,moduleInfo:t,hostGlobalSnapshot:l,remoteSnapshot:i,globalSnapshot:c});let h,p;if(u)if(isManifestProvider(u)){const m=isBrowserEnv()?u.remoteEntry:u.ssrRemoteEntry||u.remoteEntry||"",_=await this.getManifestJson(m,t,{}),E=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:m}),_);h=_,p=E}else{const{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:u,from:"global"});h=m,p=d}else if(isRemoteInfoWithEntry(t)){const m=await this.getManifestJson(t.entry,t,{}),_=setGlobalSnapshotInfoByModuleInfo(t,m),{remoteSnapshot:E}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:m,from:"global"});h=E,p=_}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(d)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:o,host:this.HostInstance,options:s,moduleInfo:t,remoteSnapshot:h}),{remoteSnapshot:h,globalSnapshot:p}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,o,r){const s=async()=>{let l=this.manifestCache.get(t);if(l)return l;try{let i=await this.loaderHook.lifecycle.fetch.emit(t,{});(!i||!(i instanceof Response))&&(i=await fetch(t,{})),l=await i.json()}catch(i){l=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:t,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),l||(delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:o.name,hostName:this.HostInstance.options.name},`${i}`)))}return assert(l.metaData&&l.exposes&&l.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,l),l},a=async()=>{const l=await s(),i=generateSnapshotFromManifest(l,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:o,manifestJson:l,remoteSnapshot:i,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=a().then(l=>l)),this.manifestLoading[t]}constructor(t){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new PluginSystem({beforeLoadRemoteSnapshot:new AsyncHook("beforeLoadRemoteSnapshot"),loadSnapshot:new AsyncWaterfallHook("loadGlobalSnapshot"),loadRemoteSnapshot:new AsyncWaterfallHook("loadRemoteSnapshot"),afterLoadSnapshot:new AsyncWaterfallHook("afterLoadSnapshot")}),this.manifestLoading=Global.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=t,this.loaderHook=t.loaderHook}}class SharedHandler{registerShared(t,o){const{shareInfos:r,shared:s}=formatShareConfigs(t,o);return Object.keys(r).forEach(l=>{r[l].forEach(c=>{!getRegisteredShare(this.shareScopeMap,l,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:l,lib:c.lib,get:c.get,loaded:!0,shared:c,from:o.name})})}),{shareInfos:r,shared:s}}async loadShare(t,o){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:r.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const a=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:r.options.shared,origin:r}),{shareInfo:l}=a;assert(l,`Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);const i=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,r.options.name)};if(i&&i.lib)return c(i),i.lib;if(i&&i.loading&&!i.loaded){const u=await i.loading;return i.loaded=!0,i.lib||(i.lib=u),c(i),u}else if(i){const d=(async()=>{const h=await i.get();return c(i),i.loaded=!0,i.lib=h,h})();return this.setShared({pkgName:t,loaded:!1,shared:i,from:r.options.name,lib:null,loading:d}),d}else{if(o!=null&&o.customShareInfo)return!1;const d=(async()=>{const h=await l.get();l.lib=h,l.loaded=!0,c(l);const p=getRegisteredShare(this.shareScopeMap,t,l,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0,p.from=l.from),h})();return this.setShared({pkgName:t,loaded:!1,shared:l,from:r.options.name,lib:null,loading:d}),d}}initializeSharing(t=DEFAULT_SCOPE,o){const{host:r}=this,s=o==null?void 0:o.from,a=o==null?void 0:o.strategy;let l=o==null?void 0:o.initScope;const i=[];if(s!=="build"){const{initTokens:_}=this;l||(l=[]);let E=_[t];if(E||(E=_[t]={from:this.host.name}),l.indexOf(E)>=0)return i;l.push(E)}const c=this.shareScopeMap,u=r.options.name;c[t]||(c[t]={});const d=c[t],h=(_,E)=>{var y;const{version:g,eager:I}=E;d[_]=d[_]||{};const S=d[_],R=S[g],b=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!I!=!b?I:u>R.from))&&(S[g]=E)},p=_=>_&&_.init&&_.init(c[t],l),m=async _=>{const{module:E}=await r.remoteHandler.getRemoteModuleAndOptions({id:_});if(E.getEntry){let y;try{y=await E.getEntry()}catch(g){y=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:_,error:g,from:"runtime",lifecycle:"beforeLoadShare",origin:r})}E.inited||(await p(y),E.inited=!0)}};return Object.keys(r.options.shared).forEach(_=>{r.options.shared[_].forEach(y=>{y.scope.includes(t)&&h(_,y)})}),(r.options.shareStrategy==="version-first"||a==="version-first")&&r.options.remotes.forEach(_=>{_.shareScope===t&&i.push(m(_.name))}),i}loadShareSync(t,o){const{host:r}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:r.options.shared});s!=null&&s.scope&&s.scope.forEach(i=>{this.initializeSharing(i,{strategy:s.strategy})});const a=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),l=i=>{i.useIn||(i.useIn=[]),addUniqueItem(i.useIn,r.options.name)};if(a){if(typeof a.lib=="function")return l(a),a.loaded||(a.loaded=!0,a.from===r.options.name&&(s.loaded=!0)),a.lib;if(typeof a.get=="function"){const i=a.get();if(!(i instanceof Promise))return l(a),this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:i,shared:a}),i}}if(s.lib)return s.loaded||(s.loaded=!0),s.lib;if(s.get){const i=s.get();if(i instanceof Promise){const c=(o==null?void 0:o.from)==="build"?RUNTIME_005:RUNTIME_006;throw new Error(getShortErrorMsg(c,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}return s.lib=i,this.setShared({pkgName:t,loaded:!0,from:r.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:r.options.name,sharedPkgName:t}))}initShareScopeMap(t,o,r={}){const{host:s}=this;this.shareScopeMap[t]=o,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:o,options:s.options,origin:s,scopeName:t,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:t,shared:o,from:r,lib:s,loading:a,loaded:l,get:i}){const{version:c,scope:u="default"}=o,d=_object_without_properties_loose(o,["version","scope"]);(Array.isArray(u)?u:[u]).forEach(p=>{if(this.shareScopeMap[p]||(this.shareScopeMap[p]={}),this.shareScopeMap[p][t]||(this.shareScopeMap[p][t]={}),!this.shareScopeMap[p][t][c]){this.shareScopeMap[p][t][c]=_extends$1({version:c,scope:["default"]},d,{lib:s,loaded:l,loading:a}),i&&(this.shareScopeMap[p][t][c].get=i);return}const m=this.shareScopeMap[p][t][c];a&&!m.loading&&(m.loading=a),l&&!m.loaded&&(m.loaded=l),r&&m.from!==r&&(m.from=r)})}_setGlobalShareScopeMap(t){const o=getGlobalShareScope(),r=t.id||t.name;r&&!o[r]&&(o[r]=this.shareScopeMap)}constructor(t){this.hooks=new PluginSystem({afterResolve:new AsyncWaterfallHook("afterResolve"),beforeLoadShare:new AsyncWaterfallHook("beforeLoadShare"),loadShare:new AsyncHook,resolveShare:new SyncWaterfallHook("resolveShare"),initContainerShareScopeMap:new SyncWaterfallHook("initContainerShareScopeMap")}),this.host=t,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(t.options)}}class RemoteHandler{formatAndRegisterRemote(t,o){return(o.remotes||[]).reduce((s,a)=>(this.registerRemote(a,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,o){const{remote:r,expose:s}=o,{name:a,alias:l}=r;if(this.idToRemoteMap[t]={name:r.name,expose:s},l&&t.startsWith(a)){const i=t.replace(a,l);this.idToRemoteMap[i]={name:r.name,expose:s};return}if(l&&t.startsWith(l)){const i=t.replace(l,a);this.idToRemoteMap[i]={name:r.name,expose:s}}}async loadRemote(t,o){const{host:r}=this;try{const{loadFactory:s=!0}=o||{loadFactory:!0},{module:a,moduleOptions:l,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:d,id:h,remoteSnapshot:p}=i,m=await a.get(h,d,o,p),_=await this.hooks.lifecycle.onLoad.emit({id:h,pkgNameOrAlias:c,expose:d,exposeModule:s?m:void 0,exposeModuleFactory:s?void 0:m,remote:u,options:l,moduleInstance:a,origin:r});return this.setIdToRemoteMap(t,i),typeof _=="function"?_:m}catch(s){const{from:a="runtime"}=o||{from:"runtime"},l=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:a,lifecycle:"onLoad",origin:r});if(!l)throw s;return l}}async preloadRemote(t){const{host:o}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:o.options,origin:o});const r=formatPreloadArgs(o.options.remotes,t);await Promise.all(r.map(async s=>{const{remote:a}=s,l=getRemoteInfo(a),{globalSnapshot:i,remoteSnapshot:c}=await o.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:a}),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:s,remote:a,remoteInfo:l,globalSnapshot:i,remoteSnapshot:c});u&&preloadAssets(l,o,u)}))}registerRemotes(t,o){const{host:r}=this;t.forEach(s=>{this.registerRemote(s,r.options.remotes,{force:o==null?void 0:o.force})})}async getRemoteModuleAndOptions(t){const{host:o}=this,{id:r}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:o.options,origin:o})}catch(_){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:o.options,origin:o,from:"runtime",error:_,lifecycle:"beforeRequest"}),!s)throw _}const{id:a}=s,l=matchRemoteWithNameAndExpose(o.options.remotes,a);assert(l,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:o.options.name,requestId:a}));const{remote:i}=l,c=getRemoteInfo(i),u=await o.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:a},l,{options:o.options,origin:o,remoteInfo:c})),{remote:d,expose:h}=u;assert(d&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);let p=o.moduleCache.get(d.name);const m={host:o,remoteInfo:c};return p||(p=new Module(m),o.moduleCache.set(d.name,p)),{module:p,moduleOptions:m,remoteMatchInfo:u}}registerRemote(t,o,r){const{host:s}=this,a=()=>{if(t.alias){const i=o.find(c=>{var u;return t.alias&&(c.name.startsWith(t.alias)||((u=c.alias)==null?void 0:u.startsWith(t.alias)))});assert(!i,`The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in t&&isBrowserEnv()&&!t.entry.startsWith("http")&&(t.entry=new URL(t.entry,window.location.origin).href),t.shareScope||(t.shareScope=DEFAULT_SCOPE),t.type||(t.type=DEFAULT_REMOTE_TYPE)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:t,origin:s});const l=o.find(i=>i.name===t.name);if(!l)a(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const i=[`The remote "${t.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r!=null&&r.force&&(this.removeRemote(l),a(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s}),warn$1(i.join(" ")))}}removeRemote(t){try{const{host:r}=this,{name:s}=t,a=r.options.remotes.findIndex(i=>i.name===s);a!==-1&&r.options.remotes.splice(a,1);const l=r.moduleCache.get(t.name);if(l){const i=l.remoteInfo,c=i.entryGlobalName;if(CurrentGlobal[c]){var o;(o=Object.getOwnPropertyDescriptor(CurrentGlobal,c))!=null&&o.configurable?delete CurrentGlobal[c]:CurrentGlobal[c]=void 0}const u=getRemoteEntryUniqueKey(l.remoteInfo);globalLoading[u]&&delete globalLoading[u],r.snapshotHandler.manifestCache.delete(i.entry);let d=i.buildVersion?composeKeyWithSeparator(i.name,i.buildVersion):i.name;const h=CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex(m=>i.buildVersion?m.options.id===d:m.name===d);if(h!==-1){const m=CurrentGlobal.__FEDERATION__.__INSTANCES__[h];d=m.options.id||d;const _=getGlobalShareScope();let E=!0;const y=[];Object.keys(_).forEach(g=>{const I=_[g];I&&Object.keys(I).forEach(S=>{const R=I[S];R&&Object.keys(R).forEach(b=>{const v=R[b];v&&Object.keys(v).forEach($=>{const A=v[$];A&&typeof A=="object"&&A.from===i.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(N=>N!==i.name),A.useIn.length?E=!1:y.push([g,S,b,$])):y.push([g,S,b,$]))})})})}),E&&(m.shareScopeMap={},delete _[d]),y.forEach(([g,I,S,R])=>{var b,v,$;($=_[g])==null||(v=$[I])==null||(b=v[S])==null||delete b[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,r);if(p){const m=p&&"remotesInfo"in p&&p.remotesInfo&&getInfoWithoutType(p.remotesInfo,t.name).key;m&&(delete p.remotesInfo[m],Global.__FEDERATION__.__MANIFEST_LOADING__[m]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[m])}r.moduleCache.delete(t.name)}}catch(r){logger.log("removeRemote fail: ",r)}}constructor(t){this.hooks=new PluginSystem({beforeRegisterRemote:new SyncWaterfallHook("beforeRegisterRemote"),registerRemote:new SyncWaterfallHook("registerRemote"),beforeRequest:new AsyncWaterfallHook("beforeRequest"),onLoad:new AsyncHook("onLoad"),handlePreloadModule:new SyncHook("handlePreloadModule"),errorLoadRemote:new AsyncHook("errorLoadRemote"),beforePreloadRemote:new AsyncHook("beforePreloadRemote"),generatePreloadAssets:new AsyncHook("generatePreloadAssets"),afterPreloadRemote:new AsyncHook,loadEntry:new AsyncHook}),this.host=t,this.idToRemoteMap={}}}const USE_SNAPSHOT=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0;class ModuleFederation{initOptions(t){this.registerPlugins(t.plugins);const o=this.formatOptions(this.options,t);return this.options=o,o}async loadShare(t,o){return this.sharedHandler.loadShare(t,o)}loadShareSync(t,o){return this.sharedHandler.loadShareSync(t,o)}initializeSharing(t=DEFAULT_SCOPE,o){return this.sharedHandler.initializeSharing(t,o)}initRawContainer(t,o,r){const s=getRemoteInfo({name:t,entry:o}),a=new Module({host:this,remoteInfo:s});return a.remoteEntryExports=r,this.moduleCache.set(t,a),a}async loadRemote(t,o){return this.remoteHandler.loadRemote(t,o)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,o,r={}){this.sharedHandler.initShareScopeMap(t,o,r)}formatOptions(t,o){const{shared:r}=formatShareConfigs(t,o),{userOptions:s,options:a}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:o,options:t,shareInfo:r}),l=this.remoteHandler.formatAndRegisterRemote(a,s),{shared:i}=this.sharedHandler.registerShared(a,s),c=[...a.plugins];s.plugins&&s.plugins.forEach(d=>{c.includes(d)||c.push(d)});const u=_extends$1({},t,o,{plugins:c,remotes:l,shared:i});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const o=registerPlugins(t,this);this.options.plugins=this.options.plugins.reduce((r,s)=>(s&&r&&!r.find(a=>a.name===s.name)&&r.push(s),r),o||[])}registerRemotes(t,o){return this.remoteHandler.registerRemotes(t,o)}registerShared(t){this.sharedHandler.registerShared(this.options,_extends$1({},this.options,{shared:t}))}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.0.0-next-20250922150632",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,loadEntryError:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const o=USE_SNAPSHOT?[snapshotPlugin(),generatePreloadAssetsPlugin()]:[],r={id:getBuilderId(),name:t.name,plugins:o,remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=r,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...t.plugins||[]]),this.options=this.formatOptions(r,t)}}let FederationInstance=null;function getInstance(){return FederationInstance}setGlobalFederationConstructor(ModuleFederation);function createBridgeComponent(n){const t=new Map,o=getInstance();return()=>({__APP_VERSION__:"0.0.0-next-20250922150632",async render(r){var _,E,y;LoggerInstance.debug("createBridgeComponent render Info",r);const{moduleName:s,dom:a,basename:l,memoryRoute:i,hashRoute:c,...u}=r,d=Vue__namespace.createApp(n.rootComponent,u);t.set(a,d);const h=await((y=(E=(_=o==null?void 0:o.bridgeHook)==null?void 0:_.lifecycle)==null?void 0:E.beforeBridgeRender)==null?void 0:y.emit(r)),p=h&&typeof h=="object"&&(h!=null&&h.extraProps)?h==null?void 0:h.extraProps:{},m=n.appOptions({app:d,basename:l,memoryRoute:i,hashRoute:c,...u,...p});if(m!=null&&m.router){let g,I=m.router.getRoutes();r.memoryRoute?g=VueRouter__namespace.createMemoryHistory(r.basename):r.hashRoute?(g=VueRouter__namespace.createWebHashHistory(),I=I.map(R=>({...R,path:r.basename+R.path}))):g=VueRouter__namespace.createWebHistory(r.basename);const S=VueRouter__namespace.createRouter({...m.router.options,history:g,routes:I});LoggerInstance.debug("createBridgeComponent render router info>>>",{moduleName:s,router:S}),i&&await S.push(i.entryPath),d.use(S)}d.mount(a)},destroy(r){LoggerInstance.debug("createBridgeComponent destroy Info",r);const s=t.get(r==null?void 0:r.dom);s==null||s.unmount()}})}function e(){const n=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(n)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,hashRoute:Boolean,providerInfo:Function,rootAttrs:Object},inheritAttrs:!1,setup(n){const t=Vue.ref(null),o=Vue.ref(null),r=Vue.ref(""),s=VueRouter.useRoute(),a=getInstance(),l=Vue.useAttrs(),i=async()=>{var p,m,_,E;const u=(p=n.providerInfo)==null?void 0:p.call(n);o.value=u;let d={...l,moduleName:n.moduleName,dom:t.value,basename:n.basename,memoryRoute:n.memoryRoute,hashRoute:n.hashRoute};LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",d);const h=await((E=(_=(m=a==null?void 0:a.bridgeHook)==null?void 0:m.lifecycle)==null?void 0:_.beforeBridgeRender)==null?void 0:E.emit(d))||{};d={...d,...h.extraProps},u.render(d)},c=Vue.watch(()=>s==null?void 0:s.path,u=>{u!==s.path&&i(),r.value!==""&&r.value!==u&&(LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>",{...n,pathname:s.path}),e()),r.value=u});return Vue.onMounted(()=>{i()}),Vue.onBeforeUnmount(()=>{var u;LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>",{...n}),c(),(u=o.value)==null||u.destroy({dom:t.value})}),()=>Vue.createVNode("div",Vue.mergeProps(n.rootAttrs||{},{ref:t}),null)}});function createRemoteAppComponent(n){return Vue.defineAsyncComponent({__APP_VERSION__:"0.0.0-next-20250922150632",...n.asyncComponentOptions,loader:async()=>{var c,u;const t=VueRouter.useRoute();let o="/";const r=(u=(c=t==null?void 0:t.matched)==null?void 0:c[0])==null?void 0:u.path;r&&(r.endsWith("/:pathMatch(.*)*")?o=r.replace("/:pathMatch(.*)*",""):o=t.matched[0].path);const s=(n==null?void 0:n.export)||"default";LoggerInstance.debug("createRemoteAppComponent LazyComponent create >>>",{basename:o,info:n});const a=await n.loader(),l=a&&a[Symbol.for("mf_module_id")],i=a[s];if(LoggerInstance.debug("createRemoteAppComponent LazyComponent loadRemote info >>>",{moduleName:l,module:a,exportName:s,basename:o,route:t}),s in a&&typeof i=="function")return{render(){return Vue.h(RemoteApp,{moduleName:l,providerInfo:i,basename:o,rootAttrs:n.rootAttrs})}};throw new Error("module not found")}})}function createRemoteComponent(n){return LoggerInstance.warn("createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"),createRemoteAppComponent(n)}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteAppComponent=createRemoteAppComponent;exports.createRemoteComponent=createRemoteComponent;
|
package/dist/index.js
CHANGED
|
@@ -72,10 +72,10 @@ function generateSnapshotFromManifest(o, t = {}) {
|
|
|
72
72
|
const { remotes: s = {}, overrides: a = {}, version: l } = t;
|
|
73
73
|
let i;
|
|
74
74
|
const c = () => "publicPath" in o.metaData ? o.metaData.publicPath === "auto" && l ? inferAutoPublicPath(l) : o.metaData.publicPath : o.metaData.getPublicPath, u = Object.keys(a);
|
|
75
|
-
let
|
|
75
|
+
let d = {};
|
|
76
76
|
if (!Object.keys(s).length) {
|
|
77
|
-
var
|
|
78
|
-
|
|
77
|
+
var p;
|
|
78
|
+
d = ((p = o.remotes) == null ? void 0 : p.reduce((R, A) => {
|
|
79
79
|
let T;
|
|
80
80
|
const $ = A.federationContainerName;
|
|
81
81
|
return u.includes($) ? T = a[$] : "version" in A ? T = A.version : T = A.entry, R[$] = {
|
|
@@ -83,7 +83,7 @@ function generateSnapshotFromManifest(o, t = {}) {
|
|
|
83
83
|
}, R;
|
|
84
84
|
}, {})) || {};
|
|
85
85
|
}
|
|
86
|
-
Object.keys(s).forEach((R) =>
|
|
86
|
+
Object.keys(s).forEach((R) => d[R] = {
|
|
87
87
|
// overrides will override dependencies
|
|
88
88
|
matchedVersion: u.includes(R) ? a[R] : s[R]
|
|
89
89
|
});
|
|
@@ -97,7 +97,7 @@ function generateSnapshotFromManifest(o, t = {}) {
|
|
|
97
97
|
remoteTypes: simpleJoinRemoteEntry(g.path, g.name),
|
|
98
98
|
remoteTypesZip: g.zip || "",
|
|
99
99
|
remoteTypesAPI: g.api || "",
|
|
100
|
-
remotesInfo:
|
|
100
|
+
remotesInfo: d,
|
|
101
101
|
shared: o == null ? void 0 : o.shared.map((R) => ({
|
|
102
102
|
assets: R.assets,
|
|
103
103
|
sharedName: R.name,
|
|
@@ -204,15 +204,15 @@ function createScript(o) {
|
|
|
204
204
|
(c == null ? void 0 : c.type) === "error" ? o != null && o.onErrorCallback && (o == null || o.onErrorCallback(c)) : o != null && o.cb && (o == null || o.cb());
|
|
205
205
|
};
|
|
206
206
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
207
|
-
const { needDeleteScript:
|
|
208
|
-
|
|
207
|
+
const { needDeleteScript: d = !0 } = o;
|
|
208
|
+
d && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
209
209
|
}), i && typeof i == "function")) {
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
return u(),
|
|
210
|
+
const d = i(c);
|
|
211
|
+
if (d instanceof Promise) {
|
|
212
|
+
const p = await d;
|
|
213
|
+
return u(), p;
|
|
214
214
|
}
|
|
215
|
-
return u(),
|
|
215
|
+
return u(), d;
|
|
216
216
|
}
|
|
217
217
|
u();
|
|
218
218
|
};
|
|
@@ -519,17 +519,17 @@ function setGlobalDefaultVal(o) {
|
|
|
519
519
|
(c = (n = o.__FEDERATION__).__INSTANCES__) != null || (n.__INSTANCES__ = []);
|
|
520
520
|
var u;
|
|
521
521
|
(u = (r = o.__FEDERATION__).moduleInfo) != null || (r.moduleInfo = {});
|
|
522
|
-
var p;
|
|
523
|
-
(p = (s = o.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
524
522
|
var d;
|
|
525
|
-
(d = (
|
|
523
|
+
(d = (s = o.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
524
|
+
var p;
|
|
525
|
+
(p = (a = o.__FEDERATION__).__MANIFEST_LOADING__) != null || (a.__MANIFEST_LOADING__ = {});
|
|
526
526
|
var m;
|
|
527
527
|
(m = (l = o.__FEDERATION__).__PRELOADED_MAP__) != null || (l.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
528
528
|
}
|
|
529
529
|
setGlobalDefaultVal(CurrentGlobal);
|
|
530
530
|
setGlobalDefaultVal(nativeGlobal);
|
|
531
531
|
function setGlobalFederationConstructor(o, t = isDebugMode()) {
|
|
532
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = o, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-
|
|
532
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = o, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-next-20250922150632");
|
|
533
533
|
}
|
|
534
534
|
function getInfoWithoutType(o, t) {
|
|
535
535
|
if (typeof t == "string") {
|
|
@@ -598,7 +598,7 @@ function combineVersion(o, t, n, r) {
|
|
|
598
598
|
return r ? `${s}-${r}` : s;
|
|
599
599
|
}
|
|
600
600
|
function parseHyphen(o) {
|
|
601
|
-
return o.replace(parseRegex(hyphenRange), (t, n, r, s, a, l, i, c, u,
|
|
601
|
+
return o.replace(parseRegex(hyphenRange), (t, n, r, s, a, l, i, c, u, d, p, m) => (isXVersion(r) ? n = "" : isXVersion(s) ? n = `>=${r}.0.0` : isXVersion(a) ? n = `>=${r}.${s}.0` : n = `>=${n}`, isXVersion(u) ? c = "" : isXVersion(d) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(p) ? c = `<${u}.${Number(d) + 1}.0-0` : m ? c = `<=${u}.${d}.${p}-${m}` : c = `<=${c}`, `${n} ${c}`.trim()));
|
|
602
602
|
}
|
|
603
603
|
function parseComparatorTrim(o) {
|
|
604
604
|
return o.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
@@ -617,8 +617,8 @@ function parseTildes(o) {
|
|
|
617
617
|
}
|
|
618
618
|
function parseXRanges(o) {
|
|
619
619
|
return o.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, r, s, a, l, i) => {
|
|
620
|
-
const c = isXVersion(s), u = c || isXVersion(a),
|
|
621
|
-
return r === "=" &&
|
|
620
|
+
const c = isXVersion(s), u = c || isXVersion(a), d = u || isXVersion(l);
|
|
621
|
+
return r === "=" && d && (r = ""), i = "", c ? r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && d ? (u && (a = 0), l = 0, r === ">" ? (r = ">=", u ? (s = Number(s) + 1, a = 0, l = 0) : (a = Number(a) + 1, l = 0)) : r === "<=" && (r = "<", u ? s = Number(s) + 1 : a = Number(a) + 1), r === "<" && (i = "-0"), `${r + s}.${a}.${l}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${a}.0${i} <${s}.${Number(a) + 1}.0-0` : n;
|
|
622
622
|
})).join(" ");
|
|
623
623
|
}
|
|
624
624
|
function parseStar(o) {
|
|
@@ -722,12 +722,12 @@ function satisfy(o, t) {
|
|
|
722
722
|
patch: l,
|
|
723
723
|
preRelease: i == null ? void 0 : i.split(".")
|
|
724
724
|
}, u = t.split("||");
|
|
725
|
-
for (const
|
|
726
|
-
const
|
|
727
|
-
if (!
|
|
725
|
+
for (const d of u) {
|
|
726
|
+
const p = d.trim();
|
|
727
|
+
if (!p || p === "*" || p === "x")
|
|
728
728
|
return !0;
|
|
729
729
|
try {
|
|
730
|
-
const m = parseRange(
|
|
730
|
+
const m = parseRange(p);
|
|
731
731
|
if (!m.trim())
|
|
732
732
|
return !0;
|
|
733
733
|
const y = m.split(" ").map((_) => parseComparatorString(_)).join(" ");
|
|
@@ -759,7 +759,7 @@ function satisfy(o, t) {
|
|
|
759
759
|
if (g)
|
|
760
760
|
return !0;
|
|
761
761
|
} catch (m) {
|
|
762
|
-
console.error(`[semver] Error processing range part "${
|
|
762
|
+
console.error(`[semver] Error processing range part "${p}":`, m);
|
|
763
763
|
continue;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
@@ -851,16 +851,16 @@ function getRegisteredShare(o, t, n, r) {
|
|
|
851
851
|
];
|
|
852
852
|
for (const c of i)
|
|
853
853
|
if (s && o[c] && o[c][t]) {
|
|
854
|
-
const { requiredVersion: u } = s,
|
|
854
|
+
const { requiredVersion: u } = s, p = getFindShareFunction(l)(o, c, t), m = () => {
|
|
855
855
|
if (s.singleton) {
|
|
856
|
-
if (typeof u == "string" && !satisfy(
|
|
857
|
-
const g = `Version ${
|
|
856
|
+
if (typeof u == "string" && !satisfy(p, u)) {
|
|
857
|
+
const g = `Version ${p} from ${p && o[c][t][p].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;
|
|
858
858
|
s.strictVersion ? error(g) : warn(g);
|
|
859
859
|
}
|
|
860
|
-
return o[c][t][
|
|
860
|
+
return o[c][t][p];
|
|
861
861
|
} else {
|
|
862
|
-
if (u === !1 || u === "*" || satisfy(
|
|
863
|
-
return o[c][t][
|
|
862
|
+
if (u === !1 || u === "*" || satisfy(p, u))
|
|
863
|
+
return o[c][t][p];
|
|
864
864
|
for (const [g, _] of Object.entries(o[c][t]))
|
|
865
865
|
if (satisfy(g, u))
|
|
866
866
|
return _;
|
|
@@ -869,7 +869,7 @@ function getRegisteredShare(o, t, n, r) {
|
|
|
869
869
|
shareScopeMap: o,
|
|
870
870
|
scope: c,
|
|
871
871
|
pkgName: t,
|
|
872
|
-
version:
|
|
872
|
+
version: p,
|
|
873
873
|
GlobalFederation: Global.__FEDERATION__,
|
|
874
874
|
resolver: m
|
|
875
875
|
};
|
|
@@ -884,13 +884,13 @@ function getTargetSharedOptions(o) {
|
|
|
884
884
|
if (!i)
|
|
885
885
|
return;
|
|
886
886
|
const c = {};
|
|
887
|
-
i.forEach((
|
|
888
|
-
c[
|
|
887
|
+
i.forEach((p) => {
|
|
888
|
+
c[p.version] = p;
|
|
889
889
|
});
|
|
890
|
-
const
|
|
891
|
-
return !isLoaded(c[
|
|
890
|
+
const d = findVersion(c, function(p, m) {
|
|
891
|
+
return !isLoaded(c[p]) && versionLt(p, m);
|
|
892
892
|
});
|
|
893
|
-
return c[
|
|
893
|
+
return c[d];
|
|
894
894
|
};
|
|
895
895
|
var a;
|
|
896
896
|
const l = (a = n == null ? void 0 : n.resolver) != null ? a : s;
|
|
@@ -1069,26 +1069,43 @@ function getRemoteEntryUniqueKey(o) {
|
|
|
1069
1069
|
return composeKeyWithSeparator(n, t);
|
|
1070
1070
|
}
|
|
1071
1071
|
async function getRemoteEntry(o) {
|
|
1072
|
-
const { origin: t, remoteEntryExports: n, remoteInfo: r, getEntryUrl: s } = o,
|
|
1072
|
+
const { origin: t, remoteEntryExports: n, remoteInfo: r, getEntryUrl: s, _inErrorHandling: a = !1 } = o, l = getRemoteEntryUniqueKey(r);
|
|
1073
1073
|
if (n)
|
|
1074
1074
|
return n;
|
|
1075
|
-
if (!globalLoading[
|
|
1076
|
-
const
|
|
1077
|
-
globalLoading[
|
|
1078
|
-
loaderHook:
|
|
1075
|
+
if (!globalLoading[l]) {
|
|
1076
|
+
const i = t.remoteHandler.hooks.lifecycle.loadEntry, c = t.loaderHook;
|
|
1077
|
+
globalLoading[l] = i.emit({
|
|
1078
|
+
loaderHook: c,
|
|
1079
1079
|
remoteInfo: r,
|
|
1080
1080
|
remoteEntryExports: n
|
|
1081
|
-
}).then((
|
|
1081
|
+
}).then((u) => u || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
|
|
1082
1082
|
remoteInfo: r,
|
|
1083
1083
|
remoteEntryExports: n,
|
|
1084
|
-
loaderHook:
|
|
1084
|
+
loaderHook: c,
|
|
1085
1085
|
getEntryUrl: s
|
|
1086
1086
|
}) : loadEntryNode({
|
|
1087
1087
|
remoteInfo: r,
|
|
1088
|
-
loaderHook:
|
|
1089
|
-
})))
|
|
1088
|
+
loaderHook: c
|
|
1089
|
+
}))).catch(async (u) => {
|
|
1090
|
+
const d = getRemoteEntryUniqueKey(r);
|
|
1091
|
+
if (u instanceof Error && u.message.includes(RUNTIME_008) && !a) {
|
|
1092
|
+
const m = (E) => getRemoteEntry(_extends$1({}, E, {
|
|
1093
|
+
_inErrorHandling: !0
|
|
1094
|
+
})), y = await t.loaderHook.lifecycle.loadEntryError.emit({
|
|
1095
|
+
getRemoteEntry: m,
|
|
1096
|
+
origin: t,
|
|
1097
|
+
remoteInfo: r,
|
|
1098
|
+
remoteEntryExports: n,
|
|
1099
|
+
globalLoading,
|
|
1100
|
+
uniqueKey: d
|
|
1101
|
+
});
|
|
1102
|
+
if (y)
|
|
1103
|
+
return y;
|
|
1104
|
+
}
|
|
1105
|
+
throw u;
|
|
1106
|
+
});
|
|
1090
1107
|
}
|
|
1091
|
-
return globalLoading[
|
|
1108
|
+
return globalLoading[l];
|
|
1092
1109
|
}
|
|
1093
1110
|
function getRemoteInfo(o) {
|
|
1094
1111
|
return _extends$1({}, o, {
|
|
@@ -1141,21 +1158,21 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1141
1158
|
as: "style"
|
|
1142
1159
|
};
|
|
1143
1160
|
s.forEach((c) => {
|
|
1144
|
-
const { link: u, needAttach:
|
|
1161
|
+
const { link: u, needAttach: d } = createLink({
|
|
1145
1162
|
url: c,
|
|
1146
1163
|
cb: () => {
|
|
1147
1164
|
},
|
|
1148
1165
|
attrs: i,
|
|
1149
|
-
createLinkHook: (
|
|
1166
|
+
createLinkHook: (p, m) => {
|
|
1150
1167
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1151
|
-
url:
|
|
1168
|
+
url: p,
|
|
1152
1169
|
attrs: m
|
|
1153
1170
|
});
|
|
1154
1171
|
if (y instanceof HTMLLinkElement)
|
|
1155
1172
|
return y;
|
|
1156
1173
|
}
|
|
1157
1174
|
});
|
|
1158
|
-
|
|
1175
|
+
d && document.head.appendChild(u);
|
|
1159
1176
|
});
|
|
1160
1177
|
} else {
|
|
1161
1178
|
const i = {
|
|
@@ -1163,14 +1180,14 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1163
1180
|
type: "text/css"
|
|
1164
1181
|
};
|
|
1165
1182
|
s.forEach((c) => {
|
|
1166
|
-
const { link: u, needAttach:
|
|
1183
|
+
const { link: u, needAttach: d } = createLink({
|
|
1167
1184
|
url: c,
|
|
1168
1185
|
cb: () => {
|
|
1169
1186
|
},
|
|
1170
1187
|
attrs: i,
|
|
1171
|
-
createLinkHook: (
|
|
1188
|
+
createLinkHook: (p, m) => {
|
|
1172
1189
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1173
|
-
url:
|
|
1190
|
+
url: p,
|
|
1174
1191
|
attrs: m
|
|
1175
1192
|
});
|
|
1176
1193
|
if (y instanceof HTMLLinkElement)
|
|
@@ -1178,7 +1195,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1178
1195
|
},
|
|
1179
1196
|
needDeleteLink: !1
|
|
1180
1197
|
});
|
|
1181
|
-
|
|
1198
|
+
d && document.head.appendChild(u);
|
|
1182
1199
|
});
|
|
1183
1200
|
}
|
|
1184
1201
|
if (r) {
|
|
@@ -1187,21 +1204,21 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1187
1204
|
as: "script"
|
|
1188
1205
|
};
|
|
1189
1206
|
a.forEach((c) => {
|
|
1190
|
-
const { link: u, needAttach:
|
|
1207
|
+
const { link: u, needAttach: d } = createLink({
|
|
1191
1208
|
url: c,
|
|
1192
1209
|
cb: () => {
|
|
1193
1210
|
},
|
|
1194
1211
|
attrs: i,
|
|
1195
|
-
createLinkHook: (
|
|
1212
|
+
createLinkHook: (p, m) => {
|
|
1196
1213
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1197
|
-
url:
|
|
1214
|
+
url: p,
|
|
1198
1215
|
attrs: m
|
|
1199
1216
|
});
|
|
1200
1217
|
if (y instanceof HTMLLinkElement)
|
|
1201
1218
|
return y;
|
|
1202
1219
|
}
|
|
1203
1220
|
});
|
|
1204
|
-
|
|
1221
|
+
d && document.head.appendChild(u);
|
|
1205
1222
|
});
|
|
1206
1223
|
} else {
|
|
1207
1224
|
const i = {
|
|
@@ -1209,14 +1226,14 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1209
1226
|
type: (o == null ? void 0 : o.type) === "module" ? "module" : "text/javascript"
|
|
1210
1227
|
};
|
|
1211
1228
|
a.forEach((c) => {
|
|
1212
|
-
const { script: u, needAttach:
|
|
1229
|
+
const { script: u, needAttach: d } = createScript({
|
|
1213
1230
|
url: c,
|
|
1214
1231
|
cb: () => {
|
|
1215
1232
|
},
|
|
1216
1233
|
attrs: i,
|
|
1217
|
-
createScriptHook: (
|
|
1234
|
+
createScriptHook: (p, m) => {
|
|
1218
1235
|
const y = t.loaderHook.lifecycle.createScript.emit({
|
|
1219
|
-
url:
|
|
1236
|
+
url: p,
|
|
1220
1237
|
attrs: m
|
|
1221
1238
|
});
|
|
1222
1239
|
if (y instanceof HTMLScriptElement)
|
|
@@ -1224,7 +1241,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1224
1241
|
},
|
|
1225
1242
|
needDeleteScript: !0
|
|
1226
1243
|
});
|
|
1227
|
-
|
|
1244
|
+
d && document.head.appendChild(u);
|
|
1228
1245
|
});
|
|
1229
1246
|
}
|
|
1230
1247
|
}
|
|
@@ -1234,24 +1251,11 @@ let Module = class {
|
|
|
1234
1251
|
if (this.remoteEntryExports)
|
|
1235
1252
|
return this.remoteEntryExports;
|
|
1236
1253
|
let t;
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
});
|
|
1243
|
-
} catch (n) {
|
|
1244
|
-
const r = getRemoteEntryUniqueKey(this.remoteInfo);
|
|
1245
|
-
n instanceof Error && n.message.includes(RUNTIME_008) && (t = await this.host.loaderHook.lifecycle.loadEntryError.emit({
|
|
1246
|
-
getRemoteEntry,
|
|
1247
|
-
origin: this.host,
|
|
1248
|
-
remoteInfo: this.remoteInfo,
|
|
1249
|
-
remoteEntryExports: this.remoteEntryExports,
|
|
1250
|
-
globalLoading,
|
|
1251
|
-
uniqueKey: r
|
|
1252
|
-
}));
|
|
1253
|
-
}
|
|
1254
|
-
return assert(t, `remoteEntryExports is undefined
|
|
1254
|
+
return t = await getRemoteEntry({
|
|
1255
|
+
origin: this.host,
|
|
1256
|
+
remoteInfo: this.remoteInfo,
|
|
1257
|
+
remoteEntryExports: this.remoteEntryExports
|
|
1258
|
+
}), assert(t, `remoteEntryExports is undefined
|
|
1255
1259
|
${safeToString(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
|
|
1256
1260
|
}
|
|
1257
1261
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
@@ -1260,18 +1264,18 @@ let Module = class {
|
|
|
1260
1264
|
loadFactory: !0
|
|
1261
1265
|
}, l = await this.getEntry();
|
|
1262
1266
|
if (!this.inited) {
|
|
1263
|
-
const
|
|
1267
|
+
const p = this.host.shareScopeMap, m = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
|
|
1264
1268
|
this.remoteInfo.shareScope
|
|
1265
1269
|
];
|
|
1266
1270
|
m.length || m.push("default"), m.forEach((b) => {
|
|
1267
|
-
|
|
1271
|
+
p[b] || (p[b] = {});
|
|
1268
1272
|
});
|
|
1269
|
-
const y =
|
|
1273
|
+
const y = p[m[0]], E = [], g = {
|
|
1270
1274
|
version: this.remoteInfo.version || "",
|
|
1271
1275
|
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? m : this.remoteInfo.shareScope || "default"
|
|
1272
1276
|
};
|
|
1273
1277
|
Object.defineProperty(g, "shareScopeMap", {
|
|
1274
|
-
value:
|
|
1278
|
+
value: p,
|
|
1275
1279
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1276
1280
|
enumerable: !1
|
|
1277
1281
|
});
|
|
@@ -1466,7 +1470,7 @@ function snapshotPlugin() {
|
|
|
1466
1470
|
share: !1,
|
|
1467
1471
|
depsRemote: !1
|
|
1468
1472
|
}
|
|
1469
|
-
},
|
|
1473
|
+
}, d = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
|
|
1470
1474
|
origin: s,
|
|
1471
1475
|
preloadOptions: u,
|
|
1472
1476
|
remoteInfo: a,
|
|
@@ -1474,7 +1478,7 @@ function snapshotPlugin() {
|
|
|
1474
1478
|
remoteSnapshot: i,
|
|
1475
1479
|
globalSnapshot: c
|
|
1476
1480
|
});
|
|
1477
|
-
return
|
|
1481
|
+
return d && preloadAssets(a, s, d, !1), _extends$1({}, o, {
|
|
1478
1482
|
remoteSnapshot: i
|
|
1479
1483
|
});
|
|
1480
1484
|
}
|
|
@@ -1499,13 +1503,13 @@ function traverseModuleInfo(o, t, n, r, s = {}, a) {
|
|
|
1499
1503
|
const l = getFMId(t), { value: i } = getInfoWithoutType(o, l), c = a || i;
|
|
1500
1504
|
if (c && !isManifestProvider(c) && (n(c, t, r), c.remotesInfo)) {
|
|
1501
1505
|
const u = Object.keys(c.remotesInfo);
|
|
1502
|
-
for (const
|
|
1503
|
-
if (s[
|
|
1506
|
+
for (const d of u) {
|
|
1507
|
+
if (s[d])
|
|
1504
1508
|
continue;
|
|
1505
|
-
s[
|
|
1506
|
-
const
|
|
1509
|
+
s[d] = !0;
|
|
1510
|
+
const p = splitId(d), m = c.remotesInfo[d];
|
|
1507
1511
|
traverseModuleInfo(o, {
|
|
1508
|
-
name:
|
|
1512
|
+
name: p.name,
|
|
1509
1513
|
version: m.matchedVersion
|
|
1510
1514
|
}, n, !1, s, void 0);
|
|
1511
1515
|
}
|
|
@@ -1513,18 +1517,18 @@ function traverseModuleInfo(o, t, n, r, s = {}, a) {
|
|
|
1513
1517
|
}
|
|
1514
1518
|
const isExisted = (o, t) => document.querySelector(`${o}[${o === "link" ? "href" : "src"}="${t}"]`);
|
|
1515
1519
|
function generatePreloadAssets(o, t, n, r, s) {
|
|
1516
|
-
const a = [], l = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options:
|
|
1520
|
+
const a = [], l = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = o, { preloadConfig: p } = t, { depsRemote: m } = p;
|
|
1517
1521
|
if (traverseModuleInfo(r, n, (_, b, v) => {
|
|
1518
1522
|
let I;
|
|
1519
1523
|
if (v)
|
|
1520
|
-
I =
|
|
1524
|
+
I = p;
|
|
1521
1525
|
else if (Array.isArray(m)) {
|
|
1522
|
-
const
|
|
1523
|
-
if (!
|
|
1526
|
+
const w = m.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
|
|
1527
|
+
if (!w)
|
|
1524
1528
|
return;
|
|
1525
|
-
I = defaultPreloadArgs(
|
|
1529
|
+
I = defaultPreloadArgs(w);
|
|
1526
1530
|
} else if (m === !0)
|
|
1527
|
-
I =
|
|
1531
|
+
I = p;
|
|
1528
1532
|
else
|
|
1529
1533
|
return;
|
|
1530
1534
|
const S = getResourceUrl(_, getRemoteEntryInfoFromSnapshot(_).url);
|
|
@@ -1544,24 +1548,24 @@ function generatePreloadAssets(o, t, n, r, s) {
|
|
|
1544
1548
|
const A = normalizePreloadExposes(I.exposes);
|
|
1545
1549
|
if (A.length && "modules" in _) {
|
|
1546
1550
|
var T;
|
|
1547
|
-
R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((
|
|
1551
|
+
R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((w, N) => ((A == null ? void 0 : A.indexOf(N.moduleName)) !== -1 && w.push(N), w), []);
|
|
1548
1552
|
}
|
|
1549
|
-
function $(
|
|
1550
|
-
const N =
|
|
1553
|
+
function $(w) {
|
|
1554
|
+
const N = w.map((O) => getResourceUrl(_, O));
|
|
1551
1555
|
return I.filter ? N.filter(I.filter) : N;
|
|
1552
1556
|
}
|
|
1553
1557
|
if (R) {
|
|
1554
|
-
const
|
|
1555
|
-
for (let N = 0; N <
|
|
1556
|
-
const
|
|
1558
|
+
const w = R.length;
|
|
1559
|
+
for (let N = 0; N < w; N++) {
|
|
1560
|
+
const O = R[N], M = `${b.name}/${O.moduleName}`;
|
|
1557
1561
|
o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1558
|
-
id:
|
|
1562
|
+
id: O.moduleName === "." ? b.name : M,
|
|
1559
1563
|
name: b.name,
|
|
1560
1564
|
remoteSnapshot: _,
|
|
1561
1565
|
preloadConfig: I,
|
|
1562
1566
|
remote: b,
|
|
1563
1567
|
origin: o
|
|
1564
|
-
}), !getPreloaded(M) && (I.resourceCategory === "all" ? (a.push(...$(
|
|
1568
|
+
}), !getPreloaded(M) && (I.resourceCategory === "all" ? (a.push(...$(O.assets.css.async)), a.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.async)), l.push(...$(O.assets.js.sync))) : (I.resourceCategory = "sync") && (a.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.sync))), setPreloaded(M));
|
|
1565
1569
|
}
|
|
1566
1570
|
}
|
|
1567
1571
|
}, !0, {}, s), s.shared && s.shared.length > 0) {
|
|
@@ -1575,7 +1579,7 @@ function generatePreloadAssets(o, t, n, r, s) {
|
|
|
1575
1579
|
};
|
|
1576
1580
|
s.shared.forEach((b) => {
|
|
1577
1581
|
var v;
|
|
1578
|
-
const I = (v =
|
|
1582
|
+
const I = (v = d.shared) == null ? void 0 : v[b.sharedName];
|
|
1579
1583
|
if (!I)
|
|
1580
1584
|
return;
|
|
1581
1585
|
const S = b.version ? I.find((A) => A.version === b.version) : I;
|
|
@@ -1666,14 +1670,14 @@ class SnapshotHandler {
|
|
|
1666
1670
|
matchedVersion: "version" in t ? t.version : t.entry
|
|
1667
1671
|
}
|
|
1668
1672
|
}));
|
|
1669
|
-
const { hostGlobalSnapshot: l, remoteSnapshot: i, globalSnapshot: c } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot:
|
|
1673
|
+
const { hostGlobalSnapshot: l, remoteSnapshot: i, globalSnapshot: c } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot: d } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1670
1674
|
options: s,
|
|
1671
1675
|
moduleInfo: t,
|
|
1672
1676
|
hostGlobalSnapshot: l,
|
|
1673
1677
|
remoteSnapshot: i,
|
|
1674
1678
|
globalSnapshot: c
|
|
1675
1679
|
});
|
|
1676
|
-
let
|
|
1680
|
+
let p, m;
|
|
1677
1681
|
if (u)
|
|
1678
1682
|
if (isManifestProvider(u)) {
|
|
1679
1683
|
const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", E = await this.getManifestJson(y, t, {}), g = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
|
|
@@ -1681,7 +1685,7 @@ class SnapshotHandler {
|
|
|
1681
1685
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1682
1686
|
entry: y
|
|
1683
1687
|
}), E);
|
|
1684
|
-
|
|
1688
|
+
p = E, m = g;
|
|
1685
1689
|
} else {
|
|
1686
1690
|
const { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1687
1691
|
options: this.HostInstance.options,
|
|
@@ -1689,7 +1693,7 @@ class SnapshotHandler {
|
|
|
1689
1693
|
remoteSnapshot: u,
|
|
1690
1694
|
from: "global"
|
|
1691
1695
|
});
|
|
1692
|
-
|
|
1696
|
+
p = y, m = d;
|
|
1693
1697
|
}
|
|
1694
1698
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1695
1699
|
const y = await this.getManifestJson(t.entry, t, {}), E = setGlobalSnapshotInfoByModuleInfo(t, y), { remoteSnapshot: g } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
@@ -1698,21 +1702,21 @@ class SnapshotHandler {
|
|
|
1698
1702
|
remoteSnapshot: y,
|
|
1699
1703
|
from: "global"
|
|
1700
1704
|
});
|
|
1701
|
-
|
|
1705
|
+
p = g, m = E;
|
|
1702
1706
|
} else
|
|
1703
1707
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1704
1708
|
hostName: t.name,
|
|
1705
1709
|
hostVersion: t.version,
|
|
1706
|
-
globalSnapshot: JSON.stringify(
|
|
1710
|
+
globalSnapshot: JSON.stringify(d)
|
|
1707
1711
|
}));
|
|
1708
1712
|
return await this.hooks.lifecycle.afterLoadSnapshot.emit({
|
|
1709
1713
|
id: n,
|
|
1710
1714
|
host: this.HostInstance,
|
|
1711
1715
|
options: s,
|
|
1712
1716
|
moduleInfo: t,
|
|
1713
|
-
remoteSnapshot:
|
|
1717
|
+
remoteSnapshot: p
|
|
1714
1718
|
}), {
|
|
1715
|
-
remoteSnapshot:
|
|
1719
|
+
remoteSnapshot: p,
|
|
1716
1720
|
globalSnapshot: m
|
|
1717
1721
|
};
|
|
1718
1722
|
}
|
|
@@ -1812,9 +1816,9 @@ class SharedHandler {
|
|
|
1812
1816
|
const u = await i.loading;
|
|
1813
1817
|
return i.loaded = !0, i.lib || (i.lib = u), c(i), u;
|
|
1814
1818
|
} else if (i) {
|
|
1815
|
-
const
|
|
1816
|
-
const
|
|
1817
|
-
return c(i), i.loaded = !0, i.lib =
|
|
1819
|
+
const d = (async () => {
|
|
1820
|
+
const p = await i.get();
|
|
1821
|
+
return c(i), i.loaded = !0, i.lib = p, p;
|
|
1818
1822
|
})();
|
|
1819
1823
|
return this.setShared({
|
|
1820
1824
|
pkgName: t,
|
|
@@ -1822,16 +1826,16 @@ class SharedHandler {
|
|
|
1822
1826
|
shared: i,
|
|
1823
1827
|
from: r.options.name,
|
|
1824
1828
|
lib: null,
|
|
1825
|
-
loading:
|
|
1826
|
-
}),
|
|
1829
|
+
loading: d
|
|
1830
|
+
}), d;
|
|
1827
1831
|
} else {
|
|
1828
1832
|
if (n != null && n.customShareInfo)
|
|
1829
1833
|
return !1;
|
|
1830
|
-
const
|
|
1831
|
-
const
|
|
1832
|
-
l.lib =
|
|
1834
|
+
const d = (async () => {
|
|
1835
|
+
const p = await l.get();
|
|
1836
|
+
l.lib = p, l.loaded = !0, c(l);
|
|
1833
1837
|
const m = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
|
|
1834
|
-
return m && (m.lib =
|
|
1838
|
+
return m && (m.lib = p, m.loaded = !0, m.from = l.from), p;
|
|
1835
1839
|
})();
|
|
1836
1840
|
return this.setShared({
|
|
1837
1841
|
pkgName: t,
|
|
@@ -1839,8 +1843,8 @@ class SharedHandler {
|
|
|
1839
1843
|
shared: l,
|
|
1840
1844
|
from: r.options.name,
|
|
1841
1845
|
lib: null,
|
|
1842
|
-
loading:
|
|
1843
|
-
}),
|
|
1846
|
+
loading: d
|
|
1847
|
+
}), d;
|
|
1844
1848
|
}
|
|
1845
1849
|
}
|
|
1846
1850
|
/**
|
|
@@ -1864,11 +1868,11 @@ class SharedHandler {
|
|
|
1864
1868
|
}
|
|
1865
1869
|
const c = this.shareScopeMap, u = r.options.name;
|
|
1866
1870
|
c[t] || (c[t] = {});
|
|
1867
|
-
const
|
|
1871
|
+
const d = c[t], p = (E, g) => {
|
|
1868
1872
|
var _;
|
|
1869
1873
|
const { version: b, eager: v } = g;
|
|
1870
|
-
|
|
1871
|
-
const I =
|
|
1874
|
+
d[E] = d[E] || {};
|
|
1875
|
+
const I = d[E], S = I[b], R = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
|
|
1872
1876
|
(!S || S.strategy !== "loaded-first" && !S.loaded && (!v != !R ? v : u > S.from)) && (I[b] = g);
|
|
1873
1877
|
}, m = (E) => E && E.init && E.init(c[t], l), y = async (E) => {
|
|
1874
1878
|
const { module: g } = await r.remoteHandler.getRemoteModuleAndOptions({
|
|
@@ -1892,7 +1896,7 @@ class SharedHandler {
|
|
|
1892
1896
|
};
|
|
1893
1897
|
return Object.keys(r.options.shared).forEach((E) => {
|
|
1894
1898
|
r.options.shared[E].forEach((_) => {
|
|
1895
|
-
_.scope.includes(t) &&
|
|
1899
|
+
_.scope.includes(t) && p(E, _);
|
|
1896
1900
|
});
|
|
1897
1901
|
}), (r.options.shareStrategy === "version-first" || a === "version-first") && r.options.remotes.forEach((E) => {
|
|
1898
1902
|
E.shareScope === t && i.push(y(E.name));
|
|
@@ -1966,7 +1970,7 @@ class SharedHandler {
|
|
|
1966
1970
|
});
|
|
1967
1971
|
}
|
|
1968
1972
|
setShared({ pkgName: t, shared: n, from: r, lib: s, loading: a, loaded: l, get: i }) {
|
|
1969
|
-
const { version: c, scope: u = "default" } = n,
|
|
1973
|
+
const { version: c, scope: u = "default" } = n, d = _object_without_properties_loose(n, [
|
|
1970
1974
|
"version",
|
|
1971
1975
|
"scope"
|
|
1972
1976
|
]);
|
|
@@ -1979,7 +1983,7 @@ class SharedHandler {
|
|
|
1979
1983
|
scope: [
|
|
1980
1984
|
"default"
|
|
1981
1985
|
]
|
|
1982
|
-
},
|
|
1986
|
+
}, d, {
|
|
1983
1987
|
lib: s,
|
|
1984
1988
|
loaded: l,
|
|
1985
1989
|
loading: a
|
|
@@ -2042,10 +2046,10 @@ class RemoteHandler {
|
|
|
2042
2046
|
loadFactory: !0
|
|
2043
2047
|
}, { module: a, moduleOptions: l, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
|
|
2044
2048
|
id: t
|
|
2045
|
-
}), { pkgNameOrAlias: c, remote: u, expose:
|
|
2046
|
-
id:
|
|
2049
|
+
}), { pkgNameOrAlias: c, remote: u, expose: d, id: p, remoteSnapshot: m } = i, y = await a.get(p, d, n, m), E = await this.hooks.lifecycle.onLoad.emit({
|
|
2050
|
+
id: p,
|
|
2047
2051
|
pkgNameOrAlias: c,
|
|
2048
|
-
expose:
|
|
2052
|
+
expose: d,
|
|
2049
2053
|
exposeModule: s ? y : void 0,
|
|
2050
2054
|
exposeModuleFactory: s ? void 0 : y,
|
|
2051
2055
|
remote: u,
|
|
@@ -2131,14 +2135,14 @@ class RemoteHandler {
|
|
|
2131
2135
|
options: n.options,
|
|
2132
2136
|
origin: n,
|
|
2133
2137
|
remoteInfo: c
|
|
2134
|
-
})), { remote:
|
|
2135
|
-
assert(
|
|
2136
|
-
let m = n.moduleCache.get(
|
|
2138
|
+
})), { remote: d, expose: p } = u;
|
|
2139
|
+
assert(d && p, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);
|
|
2140
|
+
let m = n.moduleCache.get(d.name);
|
|
2137
2141
|
const y = {
|
|
2138
2142
|
host: n,
|
|
2139
2143
|
remoteInfo: c
|
|
2140
2144
|
};
|
|
2141
|
-
return m || (m = new Module(y), n.moduleCache.set(
|
|
2145
|
+
return m || (m = new Module(y), n.moduleCache.set(d.name, m)), {
|
|
2142
2146
|
module: m,
|
|
2143
2147
|
moduleOptions: y,
|
|
2144
2148
|
remoteMatchInfo: u
|
|
@@ -2189,11 +2193,11 @@ class RemoteHandler {
|
|
|
2189
2193
|
}
|
|
2190
2194
|
const u = getRemoteEntryUniqueKey(l.remoteInfo);
|
|
2191
2195
|
globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(i.entry);
|
|
2192
|
-
let
|
|
2193
|
-
const
|
|
2194
|
-
if (
|
|
2195
|
-
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[
|
|
2196
|
-
|
|
2196
|
+
let d = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
|
|
2197
|
+
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === d : y.name === d);
|
|
2198
|
+
if (p !== -1) {
|
|
2199
|
+
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[p];
|
|
2200
|
+
d = y.options.id || d;
|
|
2197
2201
|
const E = getGlobalShareScope();
|
|
2198
2202
|
let g = !0;
|
|
2199
2203
|
const _ = [];
|
|
@@ -2205,7 +2209,7 @@ class RemoteHandler {
|
|
|
2205
2209
|
const A = S[R];
|
|
2206
2210
|
A && Object.keys(A).forEach((T) => {
|
|
2207
2211
|
const $ = A[T];
|
|
2208
|
-
$ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((
|
|
2212
|
+
$ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((w) => w !== i.name), $.useIn.length ? g = !1 : _.push([
|
|
2209
2213
|
b,
|
|
2210
2214
|
I,
|
|
2211
2215
|
R,
|
|
@@ -2219,10 +2223,10 @@ class RemoteHandler {
|
|
|
2219
2223
|
});
|
|
2220
2224
|
});
|
|
2221
2225
|
});
|
|
2222
|
-
}), g && (y.shareScopeMap = {}, delete E[
|
|
2226
|
+
}), g && (y.shareScopeMap = {}, delete E[d]), _.forEach(([b, v, I, S]) => {
|
|
2223
2227
|
var R, A, T;
|
|
2224
2228
|
(T = E[b]) == null || (A = T[v]) == null || (R = A[I]) == null || delete R[S];
|
|
2225
|
-
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(
|
|
2229
|
+
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
|
|
2226
2230
|
}
|
|
2227
2231
|
const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, r);
|
|
2228
2232
|
if (m) {
|
|
@@ -2302,8 +2306,8 @@ class ModuleFederation {
|
|
|
2302
2306
|
}), l = this.remoteHandler.formatAndRegisterRemote(a, s), { shared: i } = this.sharedHandler.registerShared(a, s), c = [
|
|
2303
2307
|
...a.plugins
|
|
2304
2308
|
];
|
|
2305
|
-
s.plugins && s.plugins.forEach((
|
|
2306
|
-
c.includes(
|
|
2309
|
+
s.plugins && s.plugins.forEach((d) => {
|
|
2310
|
+
c.includes(d) || c.push(d);
|
|
2307
2311
|
});
|
|
2308
2312
|
const u = _extends$1({}, t, n, {
|
|
2309
2313
|
plugins: c,
|
|
@@ -2335,7 +2339,7 @@ class ModuleFederation {
|
|
|
2335
2339
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2336
2340
|
// maybe will change, temporarily for internal use only
|
|
2337
2341
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2338
|
-
}), this.version = "0.0.0-next-
|
|
2342
|
+
}), this.version = "0.0.0-next-20250922150632", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2339
2343
|
// FIXME: may not be suitable , not open to the public yet
|
|
2340
2344
|
getModuleInfo: new SyncHook(),
|
|
2341
2345
|
createScript: new SyncHook(),
|
|
@@ -2374,7 +2378,7 @@ setGlobalFederationConstructor(ModuleFederation);
|
|
|
2374
2378
|
function createBridgeComponent(o) {
|
|
2375
2379
|
const t = /* @__PURE__ */ new Map(), n = getInstance();
|
|
2376
2380
|
return () => ({
|
|
2377
|
-
__APP_VERSION__: "0.0.0-next-
|
|
2381
|
+
__APP_VERSION__: "0.0.0-next-20250922150632",
|
|
2378
2382
|
async render(r) {
|
|
2379
2383
|
var E, g, _;
|
|
2380
2384
|
LoggerInstance.debug("createBridgeComponent render Info", r);
|
|
@@ -2385,10 +2389,10 @@ function createBridgeComponent(o) {
|
|
|
2385
2389
|
memoryRoute: i,
|
|
2386
2390
|
hashRoute: c,
|
|
2387
2391
|
...u
|
|
2388
|
-
} = r,
|
|
2389
|
-
t.set(a,
|
|
2390
|
-
const
|
|
2391
|
-
app:
|
|
2392
|
+
} = r, d = Vue.createApp(o.rootComponent, u);
|
|
2393
|
+
t.set(a, d);
|
|
2394
|
+
const p = await ((_ = (g = (E = n == null ? void 0 : n.bridgeHook) == null ? void 0 : E.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : _.emit(r)), m = p && typeof p == "object" && (p != null && p.extraProps) ? p == null ? void 0 : p.extraProps : {}, y = o.appOptions({
|
|
2395
|
+
app: d,
|
|
2392
2396
|
basename: l,
|
|
2393
2397
|
memoryRoute: i,
|
|
2394
2398
|
hashRoute: c,
|
|
@@ -2409,9 +2413,9 @@ function createBridgeComponent(o) {
|
|
|
2409
2413
|
LoggerInstance.debug("createBridgeComponent render router info>>>", {
|
|
2410
2414
|
moduleName: s,
|
|
2411
2415
|
router: I
|
|
2412
|
-
}), i && await I.push(i.entryPath),
|
|
2416
|
+
}), i && await I.push(i.entryPath), d.use(I);
|
|
2413
2417
|
}
|
|
2414
|
-
|
|
2418
|
+
d.mount(a);
|
|
2415
2419
|
},
|
|
2416
2420
|
destroy(r) {
|
|
2417
2421
|
LoggerInstance.debug("createBridgeComponent destroy Info", r);
|
|
@@ -2440,7 +2444,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2440
2444
|
var m, y, E, g;
|
|
2441
2445
|
const u = (m = o.providerInfo) == null ? void 0 : m.call(o);
|
|
2442
2446
|
n.value = u;
|
|
2443
|
-
let
|
|
2447
|
+
let d = {
|
|
2444
2448
|
...l,
|
|
2445
2449
|
moduleName: o.moduleName,
|
|
2446
2450
|
dom: t.value,
|
|
@@ -2448,12 +2452,12 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2448
2452
|
memoryRoute: o.memoryRoute,
|
|
2449
2453
|
hashRoute: o.hashRoute
|
|
2450
2454
|
};
|
|
2451
|
-
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",
|
|
2452
|
-
const
|
|
2453
|
-
|
|
2454
|
-
...
|
|
2455
|
-
...
|
|
2456
|
-
}, u.render(
|
|
2455
|
+
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>", d);
|
|
2456
|
+
const p = await ((g = (E = (y = a == null ? void 0 : a.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : g.emit(d)) || {};
|
|
2457
|
+
d = {
|
|
2458
|
+
...d,
|
|
2459
|
+
...p.extraProps
|
|
2460
|
+
}, u.render(d);
|
|
2457
2461
|
}, c = watch(() => s == null ? void 0 : s.path, (u) => {
|
|
2458
2462
|
u !== s.path && i(), r.value !== "" && r.value !== u && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
|
|
2459
2463
|
...o,
|
|
@@ -2476,7 +2480,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2476
2480
|
});
|
|
2477
2481
|
function createRemoteAppComponent(o) {
|
|
2478
2482
|
return defineAsyncComponent({
|
|
2479
|
-
__APP_VERSION__: "0.0.0-next-
|
|
2483
|
+
__APP_VERSION__: "0.0.0-next-20250922150632",
|
|
2480
2484
|
...o.asyncComponentOptions,
|
|
2481
2485
|
//@ts-ignore
|
|
2482
2486
|
loader: async () => {
|
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/module-federation/core.git",
|
|
8
|
-
"directory": "packages/vue3-bridge"
|
|
8
|
+
"directory": "packages/bridge/vue3-bridge"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.0.0-next-
|
|
10
|
+
"version": "0.0.0-next-20250922150632",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"vue-router": "=4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@module-federation/bridge-shared": "0.0.0-next-
|
|
36
|
-
"@module-federation/
|
|
37
|
-
"@module-federation/
|
|
35
|
+
"@module-federation/bridge-shared": "0.0.0-next-20250922150632",
|
|
36
|
+
"@module-federation/sdk": "0.0.0-next-20250922150632",
|
|
37
|
+
"@module-federation/runtime": "0.0.0-next-20250922150632"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^18.3.11",
|