@module-federation/bridge-vue3 0.8.0 → 0.8.2
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 +17 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +629 -616
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @module-federation/bridge-vue3
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [fa7a0bd]
|
|
8
|
+
- @module-federation/runtime@0.8.2
|
|
9
|
+
- @module-federation/sdk@0.8.2
|
|
10
|
+
- @module-federation/bridge-shared@0.8.2
|
|
11
|
+
|
|
12
|
+
## 0.8.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- @module-federation/runtime@0.8.1
|
|
17
|
+
- @module-federation/sdk@0.8.1
|
|
18
|
+
- @module-federation/bridge-shared@0.8.1
|
|
19
|
+
|
|
3
20
|
## 0.8.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ ${o(_.join(`
|
|
|
4
4
|
`))}`}else g=h.message;else m.level==="error"&&typeof h=="string"?g=h.split(`
|
|
5
5
|
`).map(_=>isErrorStackMessage(_)?o(_):_).join(`
|
|
6
6
|
`):g=`${h}`;n(b,g,p,h)},u={greet:d=>c("log",s(d))};return Object.keys(l).forEach(d=>{u[d]=(...h)=>c(d,...h)}),Object.defineProperty(u,"level",{get:()=>a,set(d){a=d}}),Object.defineProperty(u,"labels",{get:()=>i,set(d){i=d}}),u.override=d=>{Object.assign(u,d)},u},startColor=[189,255,243],endColor=[74,194,154],isWord=r=>!/[\s\n]/.test(r);function gradient(r){if(!supportColor())return[r];const t=[...r],o=t.filter(isWord),n=o.length-1;if(n===0)return console.log(`%c${r}`,`color: rgb(${startColor.join(",")}); font-weight: bold;`),[r];let s="",l=[];return t.forEach(a=>{if(isWord(a)){const i=o.indexOf(a)/n,c=Math.round(startColor[0]+(endColor[0]-startColor[0])*i),u=Math.round(startColor[1]+(endColor[1]-startColor[1])*i),d=Math.round(startColor[2]+(endColor[2]-startColor[2])*i);s+=`%c${a}`,l.push(`color: rgb(${c},${u},${d}); font-weight: bold;`)}else s+=a}),[s,...l]}var LOG_TYPES={error:{label:"error",level:"error",color:red},warn:{label:"warn",level:"warn",color:orange},info:{label:"info",level:"info",color:dodgerblue},start:{label:"start",level:"info",color:dodgerblue},ready:{label:"ready",level:"info",color:green},success:{label:"success",level:"info",color:green},log:{level:"log"},debug:{label:"debug",level:"verbose",color:magenta}};function createLogger2(r={}){return createLogger$1(r,{handleError:t=>t,getLabel,gradient,finalLog,LOG_TYPES,greet:t=>gradient(t)})}var logger$1=createLogger2();function _extends$2(){return _extends$2=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},_extends$2.apply(this,arguments)}const MANIFEST_EXT=".json",BROWSER_LOG_KEY="FEDERATION_DEBUG",BROWSER_LOG_VALUE="1",SEPARATOR=":";function isBrowserEnv(){return typeof window<"u"}function isBrowserDebug(){try{if(isBrowserEnv()&&window.localStorage)return localStorage.getItem(BROWSER_LOG_KEY)===BROWSER_LOG_VALUE}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 PREFIX="[ Module Federation ]";function setDebug(r){isDebugMode()&&(r.level="verbose")}function setPrefix(r,t){r.labels={warn:`${t} Warn`,error:`${t} Error`,success:`${t} Success`,info:`${t} Info`,ready:`${t} Ready`,debug:`${t} Debug`}}function createLogger(r){const t=browser.createLogger({labels:{warn:`${PREFIX} Warn`,error:`${PREFIX} Error`,success:`${PREFIX} Success`,info:`${PREFIX} Info`,ready:`${PREFIX} Ready`,debug:`${PREFIX} Debug`}});return setDebug(t),setPrefix(t,r),t}createLogger(PREFIX);const LOG_CATEGORY$1="[ Federation Runtime ]",composeKeyWithSeparator=function(...r){return r.length?r.reduce((t,o)=>o?t?`${t}${SEPARATOR}${o}`:o:t,""):""},getResourceUrl=(r,t)=>{if("getPublicPath"in r){let o;return r.getPublicPath.startsWith("function")?o=new Function("return "+r.getPublicPath)()():o=new Function(r.getPublicPath)(),`${o}${t}`}else return"publicPath"in r?`${r.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",r,t),"")},warn$1=r=>{console.warn(`${LOG_CATEGORY$1}: ${r}`)};function safeToString(r){try{return JSON.stringify(r,null,2)}catch{return""}}const simpleJoinRemoteEntry=(r,t)=>{if(!r)return t;const n=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const l=s.slice(1);return l.endsWith("/")?l.slice(0,-1):l}return s})(r);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function inferAutoPublicPath(r){return r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function generateSnapshotFromManifest(r,t={}){var o,n;const{remotes:s={},overrides:l={},version:a}=t;let i;const c=()=>"publicPath"in r.metaData?r.metaData.publicPath==="auto"&&a?inferAutoPublicPath(a):r.metaData.publicPath:r.metaData.getPublicPath,u=Object.keys(l);let d={};if(!Object.keys(s).length){var h;d=((h=r.remotes)==null?void 0:h.reduce((E,I)=>{let O;const $=I.federationContainerName;return u.includes($)?O=l[$]:"version"in I?O=I.version:O=I.entry,E[$]={matchedVersion:O},E},{}))||{}}Object.keys(s).forEach(E=>d[E]={matchedVersion:u.includes(E)?l[E]:s[E]});const{remoteEntry:{path:p,name:m,type:g},types:b,buildInfo:{buildVersion:y},globalName:_,ssrRemoteEntry:v}=r.metaData,{exposes:S}=r;let R={version:a||"",buildVersion:y,globalName:_,remoteEntry:simpleJoinRemoteEntry(p,m),remoteEntryType:g,remoteTypes:simpleJoinRemoteEntry(b.path,b.name),remoteTypesZip:b.zip||"",remoteTypesAPI:b.api||"",remotesInfo:d,shared:r==null?void 0:r.shared.map(E=>({assets:E.assets,sharedName:E.name,version:E.version})),modules:S==null?void 0:S.map(E=>({moduleName:E.name,modulePath:E.path,assets:E.assets}))};if((o=r.metaData)!=null&&o.prefetchInterface){const E=r.metaData.prefetchInterface;R=_extends$2({},R,{prefetchInterface:E})}if((n=r.metaData)!=null&&n.prefetchEntry){const{path:E,name:I,type:O}=r.metaData.prefetchEntry;R=_extends$2({},R,{prefetchEntry:simpleJoinRemoteEntry(E,I),prefetchEntryType:O})}if("publicPath"in r.metaData?i=_extends$2({},R,{publicPath:c()}):i=_extends$2({},R,{getPublicPath:c()}),v){const E=simpleJoinRemoteEntry(v.path,v.name);i.ssrRemoteEntry=E,i.ssrRemoteEntryType=v.type||"commonjs-module"}return i}function isManifestProvider(r){return!!("remoteEntry"in r&&r.remoteEntry.includes(MANIFEST_EXT))}async function safeWrapper(r,t){try{return await r()}catch(o){warn$1(o);return}}function isStaticResourcesEqual(r,t){const o=/^(https?:)?\/\//i,n=r.replace(o,"").replace(/\/$/,""),s=t.replace(o,"").replace(/\/$/,"");return n===s}function createScript(r){let t=null,o=!0,n=2e4,s;const l=document.getElementsByTagName("script");for(let i=0;i<l.length;i++){const c=l[i],u=c.getAttribute("src");if(u&&isStaticResourcesEqual(u,r.url)){t=c,o=!1;break}}if(!t){const i=r.attrs;t=document.createElement("script"),t.type=(i==null?void 0:i.type)==="module"?"module":"text/javascript";let c;r.createScriptHook&&(c=r.createScriptHook(r.url,r.attrs),c instanceof HTMLScriptElement?t=c:typeof c=="object"&&("script"in c&&c.script&&(t=c.script),"timeout"in c&&c.timeout&&(n=c.timeout))),t.src||(t.src=r.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 a=async(i,c)=>{var u;if(clearTimeout(s),t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteScript:p=!0}=r;p&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),i&&typeof i=="function")){var d;const p=i(c);if(p instanceof Promise){var h;const m=await p;return r==null||(h=r.cb)==null||h.call(r),m}return r==null||(d=r.cb)==null||d.call(r),p}r==null||(u=r.cb)==null||u.call(r)};return t.onerror=a.bind(null,t.onerror),t.onload=a.bind(null,t.onload),s=setTimeout(()=>{a(null,new Error(`Remote script "${r.url}" time-outed.`))},n),{script:t,needAttach:o}}function createLink(r){let t=null,o=!0;const n=document.getElementsByTagName("link");for(let l=0;l<n.length;l++){const a=n[l],i=a.getAttribute("href"),c=a.getAttribute("ref");if(i&&isStaticResourcesEqual(i,r.url)&&c===r.attrs.ref){t=a,o=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",r.url);let l;const a=r.attrs;r.createLinkHook&&(l=r.createLinkHook(r.url,a),l instanceof HTMLLinkElement&&(t=l)),a&&!l&&Object.keys(a).forEach(i=>{t&&!t.getAttribute(i)&&t.setAttribute(i,a[i])})}const s=(l,a)=>{if(t&&(t.onerror=null,t.onload=null,safeWrapper(()=>{const{needDeleteLink:i=!0}=r;i&&t!=null&&t.parentNode&&t.parentNode.removeChild(t)}),l)){const i=l(a);return r.cb(),i}r.cb()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:o}}function loadScript(r,t){const{attrs:o={},createScriptHook:n}=t;return new Promise((s,l)=>{const{script:a,needAttach:i}=createScript({url:r,cb:s,attrs:_extends$2({fetchpriority:"high"},o),createScriptHook:n,needDeleteScript:!0});i&&document.head.appendChild(a)})}function importNodeModule(r){if(!r)throw new Error("import specifier is required");return new Function("name","return import(name)")(r).then(o=>o).catch(o=>{throw console.error(`Error importing module ${r}:`,o),o})}const loadNodeFetch=async()=>{const r=await importNodeModule("node-fetch");return r.default||r},lazyLoaderHookFetch=async(r,t,o)=>{const s=await((l,a)=>o.lifecycle.fetch.emit(l,a))(r,t||{});return!s||!(s instanceof Response)?(typeof fetch>"u"?await loadNodeFetch():fetch)(r,t||{}):s};function createScriptNode(url,cb,attrs,loaderHook){if(loaderHook!=null&&loaderHook.createScriptHook){const r=loaderHook.createScriptHook(url);r&&typeof r=="object"&&"url"in r&&(url=r.url)}let urlObj;try{urlObj=new URL(url)}catch(r){console.error("Error constructing URL:",r),cb(new Error(`Invalid URL: ${r}`));return}const getFetch=async()=>loaderHook!=null&&loaderHook.fetch?(r,t)=>lazyLoaderHookFetch(r,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}
|
|
7
|
-
})`,{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 r=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,r);return}cb(void 0,exportedInterface)}catch(r){cb(r instanceof Error?r:new Error(`Script execution error: ${r}`))}};getFetch().then(async r=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:r,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(r,urlObj)}).catch(r=>{cb(r)})}function loadScriptNode(r,t){return new Promise((o,n)=>{createScriptNode(r,(s,l)=>{if(s)n(s);else{var a,i;const c=(t==null||(a=t.attrs)==null?void 0:a.globalName)||`__FEDERATION_${t==null||(i=t.attrs)==null?void 0:i.name}:custom__`,u=globalThis[c]=l;o(u)}},t.attrs,t.loaderHook)})}async function loadModule(r,t){const{fetch:o,vm:n}=t,l=await(await o(r)).text(),a=new n.SourceTextModule(l,{importModuleDynamically:async(i,c)=>{const u=new URL(i,r).href;return loadModule(u,t)}});return await a.link(async i=>{const c=new URL(i,r).href;return await loadModule(c,t)}),a}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 n=arguments[o];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},_extends$1.apply(this,arguments)}function _object_without_properties_loose(r,t){if(r==null)return{};var o={},n=Object.keys(r),s,l;for(l=0;l<n.length;l++)s=n[l],!(t.indexOf(s)>=0)&&(o[s]=r[s]);return o}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(r,t){r||error(t)}function error(r){throw r instanceof Error?(r.message=`${LOG_CATEGORY}: ${r.message}`,r):new Error(`${LOG_CATEGORY}: ${r}`)}function warn(r){r instanceof Error&&(r.message=`${LOG_CATEGORY}: ${r.message}`),logger.warn(r)}function addUniqueItem(r,t){return r.findIndex(o=>o===t)===-1&&r.push(t),r}function getFMId(r){return"version"in r&&r.version?`${r.name}:${r.version}`:"entry"in r&&r.entry?`${r.name}:${r.entry}`:`${r.name}`}function isRemoteInfoWithEntry(r){return typeof r.entry<"u"}function isPureRemoteEntry(r){return!r.entry.includes(".json")&&r.entry.includes(".js")}function isObject(r){return r&&typeof r=="object"}const objectToString=Object.prototype.toString;function isPlainObject(r){return objectToString.call(r)==="[object Object]"}function arrayOptions(r){return Array.isArray(r)?r:[r]}function getRemoteEntryInfoFromSnapshot(r){const t={url:"",type:"global",globalName:""};return isBrowserEnv()?"remoteEntry"in r?{url:r.remoteEntry,type:r.remoteEntryType,globalName:r.globalName}:t:"ssrRemoteEntry"in r?{url:r.ssrRemoteEntry||t.url,type:r.ssrRemoteEntryType||t.type,globalName:r.globalName}:t}const processModuleAlias=(r,t)=>{let o;return r.endsWith("/")?o=r.slice(0,-1):o=r,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(r,t,o){Object.defineProperty(r,t,{value:o,configurable:!1,writable:!0})}function includeOwnProperty(r,t){return Object.hasOwnProperty.call(r,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(r){var t,o,n,s,l,a;includeOwnProperty(r,"__VMOK__")&&!includeOwnProperty(r,"__FEDERATION__")&&definePropertyGlobalVal(r,"__FEDERATION__",r.__VMOK__),includeOwnProperty(r,"__FEDERATION__")||(definePropertyGlobalVal(r,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(r,"__VMOK__",r.__FEDERATION__));var i;(i=(t=r.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(o=r.__FEDERATION__).__INSTANCES__)!=null||(o.__INSTANCES__=[]);var u;(u=(n=r.__FEDERATION__).moduleInfo)!=null||(n.moduleInfo={});var d;(d=(s=r.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var h;(h=(l=r.__FEDERATION__).__MANIFEST_LOADING__)!=null||(l.__MANIFEST_LOADING__={});var p;(p=(a=r.__FEDERATION__).__PRELOADED_MAP__)!=null||(a.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(r,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=r,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.8.0")}function getInfoWithoutType(r,t){if(typeof t=="string"){if(r[t])return{value:r[t],key:t};{const n=Object.keys(r);for(const s of n){const[l,a]=s.split(":"),i=`${l}:${t}`,c=r[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=(r,t)=>{const o=getFMId(r),n=getInfoWithoutType(t,o).value;if(n&&!n.version&&"version"in r&&r.version&&(n.version=r.version),n)return n;if("version"in r&&r.version){const{version:s}=r,l=_object_without_properties_loose(r,["version"]),a=getFMId(l),i=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,a).value;if((i==null?void 0:i.version)===s)return i}},getGlobalSnapshotInfoByModuleInfo=r=>getTargetSnapshotInfoByModuleInfo(r,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r);return nativeGlobal.__FEDERATION__.moduleInfo[o]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=r=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,r),()=>{const t=Object.keys(r);for(const o of t)delete nativeGlobal.__FEDERATION__.moduleInfo[o]}),getRemoteEntryExports=(r,t)=>{const o=t||`__FEDERATION_${r}:custom__`,n=CurrentGlobal[o];return{remoteEntryKey:o,entryExports:n}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r),setPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r,!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(r){return new RegExp(r)}function isXVersion(r){return!r||r.toLowerCase()==="x"||r==="*"}function pipe(...r){return t=>r.reduce((o,n)=>n(o),t)}function extractComparator(r){return r.match(parseRegex(comparator))}function combineVersion(r,t,o,n){const s=`${r}.${t}.${o}`;return n?`${s}-${n}`:s}function parseHyphen(r){return r.replace(parseRegex(hyphenRange),(t,o,n,s,l,a,i,c,u,d,h,p)=>(isXVersion(n)?o="":isXVersion(s)?o=`>=${n}.0.0`:isXVersion(l)?o=`>=${n}.${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(r){return r.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(r){return r.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(r){return r.replace(parseRegex(caretTrim),"$1^")}function parseCarets(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(o,n,s,l,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(l)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:a?n==="0"?s==="0"?`>=${n}.${s}.${l}-${a} <${n}.${s}.${Number(l)+1}-0`:`>=${n}.${s}.${l}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l}-${a} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${l} <${n}.${s}.${Number(l)+1}-0`:`>=${n}.${s}.${l} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l} <${Number(n)+1}.0.0-0`)).join(" ")}function parseTildes(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(o,n,s,l,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(l)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:a?`>=${n}.${s}.${l}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l} <${n}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(r){return r.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(o,n,s,l,a,i)=>{const c=isXVersion(s),u=c||isXVersion(l),d=u||isXVersion(a);return n==="="&&d&&(n=""),i="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&d?(u&&(l=0),a=0,n===">"?(n=">=",u?(s=Number(s)+1,l=0,a=0):(l=Number(l)+1,a=0)):n==="<="&&(n="<",u?s=Number(s)+1:l=Number(l)+1),n==="<"&&(i="-0"),`${n+s}.${l}.${a}${i}`):u?`>=${s}.0.0${i} <${Number(s)+1}.0.0-0`:d?`>=${s}.${l}.0${i} <${s}.${Number(l)+1}.0-0`:o})).join(" ")}function parseStar(r){return r.trim().replace(parseRegex(star),"")}function parseGTE0(r){return r.trim().replace(parseRegex(gte0),"")}function compareAtom(r,t){return r=Number(r)||r,t=Number(t)||t,r>t?1:r===t?0:-1}function comparePreRelease(r,t){const{preRelease:o}=r,{preRelease:n}=t;if(o===void 0&&n)return 1;if(o&&n===void 0)return-1;if(o===void 0&&n===void 0)return 0;for(let s=0,l=o.length;s<=l;s++){const a=o[s],i=n[s];if(a!==i)return a===void 0&&i===void 0?0:a?i?compareAtom(a,i):-1:1}return 0}function compareVersion(r,t){return compareAtom(r.major,t.major)||compareAtom(r.minor,t.minor)||compareAtom(r.patch,t.patch)||comparePreRelease(r,t)}function eq(r,t){return r.version===t.version}function compare(r,t){switch(r.operator){case"":case"=":return eq(r,t);case">":return compareVersion(r,t)<0;case">=":return eq(r,t)||compareVersion(r,t)<0;case"<":return compareVersion(r,t)>0;case"<=":return eq(r,t)||compareVersion(r,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(r){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(r)}function parseRange(r){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(r.trim()).split(/\s+/).join(" ")}function satisfy(r,t){if(!r)return!1;const s=parseRange(t).split(" ").map(p=>parseComparatorString(p)).join(" ").split(/\s+/).map(p=>parseGTE0(p)),l=extractComparator(r);if(!l)return!1;const[,a,,i,c,u,d]=l,h={operator:a,version:combineVersion(i,c,u,d),major:i,minor:c,patch:u,preRelease:d==null?void 0:d.split(".")};for(const p of s){const m=extractComparator(p);if(!m)return!1;const[,g,,b,y,_,v]=m,S={operator:g,version:combineVersion(b,y,_,v),major:b,minor:y,patch:_,preRelease:v==null?void 0:v.split(".")};if(!compare(S,h))return!1}return!0}function formatShare(r,t,o,n){let s;"get"in r?s=r.get:"lib"in r?s=()=>Promise.resolve(r.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${o}'!`)}),r.strategy&&warn('"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"');var l,a,i;return _extends$1({deps:[],useIn:[],from:t,loading:null},r,{shareConfig:_extends$1({requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1},r.shareConfig),get:s,loaded:r!=null&&r.loaded||"lib"in r?!0:void 0,version:(l=r.version)!=null?l:"0",scope:Array.isArray(r.scope)?r.scope:[(a=r.scope)!=null?a:"default"],strategy:((i=r.strategy)!=null?i:n)||"version-first"})}function formatShareConfigs(r,t){const o=t.shared||{},n=t.name,s=Object.keys(o).reduce((a,i)=>{const c=arrayOptions(o[i]);return a[i]=a[i]||[],c.forEach(u=>{a[i].push(formatShare(u,n,i,t.shareStrategy))}),a},{}),l=_extends$1({},r.shared);return Object.keys(s).forEach(a=>{l[a]?s[a].forEach(i=>{l[a].find(u=>u.version===i.version)||l[a].push(i)}):l[a]=s[a]}),{shared:l,shareInfos:s}}function versionLt(r,t){const o=n=>{if(!Number.isNaN(Number(n))){const l=n.split(".");let a=n;for(let i=0;i<3-l.length;i++)a+=".0";return a}return n};return!!satisfy(o(r),`<=${o(t)}`)}const findVersion=(r,t)=>{const o=t||function(n,s){return versionLt(n,s)};return Object.keys(r).reduce((n,s)=>!n||o(n,s)||n==="0"?s:n,0)},isLoaded=r=>!!r.loaded||typeof r.lib=="function",isLoading=r=>!!r.loading;function findSingletonVersionOrderByVersion(r,t,o){const n=r[t][o],s=function(l,a){return!isLoaded(n[l])&&versionLt(l,a)};return findVersion(r[t][o],s)}function findSingletonVersionOrderByLoaded(r,t,o){const n=r[t][o],s=function(l,a){const i=c=>isLoaded(c)||isLoading(c);return i(n[a])?i(n[l])?!!versionLt(l,a):!0:i(n[l])?!1:versionLt(l,a)};return findVersion(r[t][o],s)}function getFindShareFunction(r){return r==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(r,t,o,n){if(!r)return;const{shareConfig:s,scope:l=DEFAULT_SCOPE,strategy:a}=o,i=Array.isArray(l)?l:[l];for(const c of i)if(s&&r[c]&&r[c][t]){const{requiredVersion:u}=s,h=getFindShareFunction(a)(r,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(h,u)){const b=`Version ${h} from ${h&&r[c][t][h].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;s.strictVersion?error(b):warn(b)}return r[c][t][h]}else{if(u===!1||u==="*"||satisfy(h,u))return r[c][t][h];for(const[b,y]of Object.entries(r[c][t]))if(satisfy(b,u))return y}},m={shareScopeMap:r,scope:c,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(n.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(r){const{pkgName:t,extraOptions:o,shareInfos:n}=r,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 l;const a=(l=o==null?void 0:o.resolver)!=null?l:s;return Object.assign({},a(n[t]),o==null?void 0:o.customShareInfo)}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",TYPE_001="TYPE-001",getDocsUrl=r=>`https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}/${r}`,getShortErrorMsg=(r,t,o,n)=>{const s=[`${[t[r]]} #${r}`];return o&&s.push(`args: ${JSON.stringify(o)}`),s.push(getDocsUrl(r)),n&&s.push(`Original Error Message:
|
|
7
|
+
})`,{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 r=exportedInterface[attrs.globalName]||exportedInterface;cb(void 0,r);return}cb(void 0,exportedInterface)}catch(r){cb(r instanceof Error?r:new Error(`Script execution error: ${r}`))}};getFetch().then(async r=>{if((attrs==null?void 0:attrs.type)==="esm"||(attrs==null?void 0:attrs.type)==="module")return loadModule(urlObj.href,{fetch:r,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(r,urlObj)}).catch(r=>{cb(r)})}function loadScriptNode(r,t){return new Promise((o,n)=>{createScriptNode(r,(s,l)=>{if(s)n(s);else{var a,i;const c=(t==null||(a=t.attrs)==null?void 0:a.globalName)||`__FEDERATION_${t==null||(i=t.attrs)==null?void 0:i.name}:custom__`,u=globalThis[c]=l;o(u)}},t.attrs,t.loaderHook)})}async function loadModule(r,t){const{fetch:o,vm:n}=t,l=await(await o(r)).text(),a=new n.SourceTextModule(l,{importModuleDynamically:async(i,c)=>{const u=new URL(i,r).href;return loadModule(u,t)}});return await a.link(async i=>{const c=new URL(i,r).href;return await loadModule(c,t)}),a}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 n=arguments[o];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},_extends$1.apply(this,arguments)}function _object_without_properties_loose(r,t){if(r==null)return{};var o={},n=Object.keys(r),s,l;for(l=0;l<n.length;l++)s=n[l],!(t.indexOf(s)>=0)&&(o[s]=r[s]);return o}function getBuilderId(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}const LOG_CATEGORY="[ Federation Runtime ]",logger=createLogger(LOG_CATEGORY);function assert(r,t){r||error(t)}function error(r){throw r instanceof Error?(r.message=`${LOG_CATEGORY}: ${r.message}`,r):new Error(`${LOG_CATEGORY}: ${r}`)}function warn(r){r instanceof Error&&(r.message=`${LOG_CATEGORY}: ${r.message}`),logger.warn(r)}function addUniqueItem(r,t){return r.findIndex(o=>o===t)===-1&&r.push(t),r}function getFMId(r){return"version"in r&&r.version?`${r.name}:${r.version}`:"entry"in r&&r.entry?`${r.name}:${r.entry}`:`${r.name}`}function isRemoteInfoWithEntry(r){return typeof r.entry<"u"}function isPureRemoteEntry(r){return!r.entry.includes(".json")&&r.entry.includes(".js")}function isObject(r){return r&&typeof r=="object"}const objectToString=Object.prototype.toString;function isPlainObject(r){return objectToString.call(r)==="[object Object]"}function arrayOptions(r){return Array.isArray(r)?r:[r]}function getRemoteEntryInfoFromSnapshot(r){const t={url:"",type:"global",globalName:""};return isBrowserEnv()?"remoteEntry"in r?{url:r.remoteEntry,type:r.remoteEntryType,globalName:r.globalName}:t:"ssrRemoteEntry"in r?{url:r.ssrRemoteEntry||t.url,type:r.ssrRemoteEntryType||t.type,globalName:r.globalName}:t}const processModuleAlias=(r,t)=>{let o;return r.endsWith("/")?o=r.slice(0,-1):o=r,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(r,t,o){Object.defineProperty(r,t,{value:o,configurable:!1,writable:!0})}function includeOwnProperty(r,t){return Object.hasOwnProperty.call(r,t)}includeOwnProperty(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__")||definePropertyGlobalVal(CurrentGlobal,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const globalLoading=CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;function setGlobalDefaultVal(r){var t,o,n,s,l,a;includeOwnProperty(r,"__VMOK__")&&!includeOwnProperty(r,"__FEDERATION__")&&definePropertyGlobalVal(r,"__FEDERATION__",r.__VMOK__),includeOwnProperty(r,"__FEDERATION__")||(definePropertyGlobalVal(r,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),definePropertyGlobalVal(r,"__VMOK__",r.__FEDERATION__));var i;(i=(t=r.__FEDERATION__).__GLOBAL_PLUGIN__)!=null||(t.__GLOBAL_PLUGIN__=[]);var c;(c=(o=r.__FEDERATION__).__INSTANCES__)!=null||(o.__INSTANCES__=[]);var u;(u=(n=r.__FEDERATION__).moduleInfo)!=null||(n.moduleInfo={});var d;(d=(s=r.__FEDERATION__).__SHARE__)!=null||(s.__SHARE__={});var h;(h=(l=r.__FEDERATION__).__MANIFEST_LOADING__)!=null||(l.__MANIFEST_LOADING__={});var p;(p=(a=r.__FEDERATION__).__PRELOADED_MAP__)!=null||(a.__PRELOADED_MAP__=new Map)}setGlobalDefaultVal(CurrentGlobal);setGlobalDefaultVal(nativeGlobal);function setGlobalFederationConstructor(r,t=isDebugMode()){t&&(CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__=r,CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="0.8.2")}function getInfoWithoutType(r,t){if(typeof t=="string"){if(r[t])return{value:r[t],key:t};{const n=Object.keys(r);for(const s of n){const[l,a]=s.split(":"),i=`${l}:${t}`,c=r[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=(r,t)=>{const o=getFMId(r),n=getInfoWithoutType(t,o).value;if(n&&!n.version&&"version"in r&&r.version&&(n.version=r.version),n)return n;if("version"in r&&r.version){const{version:s}=r,l=_object_without_properties_loose(r,["version"]),a=getFMId(l),i=getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo,a).value;if((i==null?void 0:i.version)===s)return i}},getGlobalSnapshotInfoByModuleInfo=r=>getTargetSnapshotInfoByModuleInfo(r,nativeGlobal.__FEDERATION__.moduleInfo),setGlobalSnapshotInfoByModuleInfo=(r,t)=>{const o=getFMId(r);return nativeGlobal.__FEDERATION__.moduleInfo[o]=t,nativeGlobal.__FEDERATION__.moduleInfo},addGlobalSnapshot=r=>(nativeGlobal.__FEDERATION__.moduleInfo=_extends$1({},nativeGlobal.__FEDERATION__.moduleInfo,r),()=>{const t=Object.keys(r);for(const o of t)delete nativeGlobal.__FEDERATION__.moduleInfo[o]}),getRemoteEntryExports=(r,t)=>{const o=t||`__FEDERATION_${r}:custom__`,n=CurrentGlobal[o];return{remoteEntryKey:o,entryExports:n}},getGlobalHostPlugins=()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__,getPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r),setPreloaded=r=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r,!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(r){return new RegExp(r)}function isXVersion(r){return!r||r.toLowerCase()==="x"||r==="*"}function pipe(...r){return t=>r.reduce((o,n)=>n(o),t)}function extractComparator(r){return r.match(parseRegex(comparator))}function combineVersion(r,t,o,n){const s=`${r}.${t}.${o}`;return n?`${s}-${n}`:s}function parseHyphen(r){return r.replace(parseRegex(hyphenRange),(t,o,n,s,l,a,i,c,u,d,h,p)=>(isXVersion(n)?o="":isXVersion(s)?o=`>=${n}.0.0`:isXVersion(l)?o=`>=${n}.${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(r){return r.replace(parseRegex(comparatorTrim),"$1$2$3")}function parseTildeTrim(r){return r.replace(parseRegex(tildeTrim),"$1~")}function parseCaretTrim(r){return r.replace(parseRegex(caretTrim),"$1^")}function parseCarets(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(caret),(o,n,s,l,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(l)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:a?n==="0"?s==="0"?`>=${n}.${s}.${l}-${a} <${n}.${s}.${Number(l)+1}-0`:`>=${n}.${s}.${l}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l}-${a} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${l} <${n}.${s}.${Number(l)+1}-0`:`>=${n}.${s}.${l} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l} <${Number(n)+1}.0.0-0`)).join(" ")}function parseTildes(r){return r.trim().split(/\s+/).map(t=>t.replace(parseRegex(tilde),(o,n,s,l,a)=>isXVersion(n)?"":isXVersion(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:isXVersion(l)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:a?`>=${n}.${s}.${l}-${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${l} <${n}.${Number(s)+1}.0-0`)).join(" ")}function parseXRanges(r){return r.split(/\s+/).map(t=>t.trim().replace(parseRegex(xRange),(o,n,s,l,a,i)=>{const c=isXVersion(s),u=c||isXVersion(l),d=u||isXVersion(a);return n==="="&&d&&(n=""),i="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&d?(u&&(l=0),a=0,n===">"?(n=">=",u?(s=Number(s)+1,l=0,a=0):(l=Number(l)+1,a=0)):n==="<="&&(n="<",u?s=Number(s)+1:l=Number(l)+1),n==="<"&&(i="-0"),`${n+s}.${l}.${a}${i}`):u?`>=${s}.0.0${i} <${Number(s)+1}.0.0-0`:d?`>=${s}.${l}.0${i} <${s}.${Number(l)+1}.0-0`:o})).join(" ")}function parseStar(r){return r.trim().replace(parseRegex(star),"")}function parseGTE0(r){return r.trim().replace(parseRegex(gte0),"")}function compareAtom(r,t){return r=Number(r)||r,t=Number(t)||t,r>t?1:r===t?0:-1}function comparePreRelease(r,t){const{preRelease:o}=r,{preRelease:n}=t;if(o===void 0&&n)return 1;if(o&&n===void 0)return-1;if(o===void 0&&n===void 0)return 0;for(let s=0,l=o.length;s<=l;s++){const a=o[s],i=n[s];if(a!==i)return a===void 0&&i===void 0?0:a?i?compareAtom(a,i):-1:1}return 0}function compareVersion(r,t){return compareAtom(r.major,t.major)||compareAtom(r.minor,t.minor)||compareAtom(r.patch,t.patch)||comparePreRelease(r,t)}function eq(r,t){return r.version===t.version}function compare(r,t){switch(r.operator){case"":case"=":return eq(r,t);case">":return compareVersion(r,t)<0;case">=":return eq(r,t)||compareVersion(r,t)<0;case"<":return compareVersion(r,t)>0;case"<=":return eq(r,t)||compareVersion(r,t)>0;case void 0:return!0;default:return!1}}function parseComparatorString(r){return pipe(parseCarets,parseTildes,parseXRanges,parseStar)(r)}function parseRange(r){return pipe(parseHyphen,parseComparatorTrim,parseTildeTrim,parseCaretTrim)(r.trim()).split(/\s+/).join(" ")}function satisfy(r,t){if(!r)return!1;const s=parseRange(t).split(" ").map(p=>parseComparatorString(p)).join(" ").split(/\s+/).map(p=>parseGTE0(p)),l=extractComparator(r);if(!l)return!1;const[,a,,i,c,u,d]=l,h={operator:a,version:combineVersion(i,c,u,d),major:i,minor:c,patch:u,preRelease:d==null?void 0:d.split(".")};for(const p of s){const m=extractComparator(p);if(!m)return!1;const[,g,,b,y,_,v]=m,S={operator:g,version:combineVersion(b,y,_,v),major:b,minor:y,patch:_,preRelease:v==null?void 0:v.split(".")};if(!compare(S,h))return!1}return!0}function formatShare(r,t,o,n){let s;"get"in r?s=r.get:"lib"in r?s=()=>Promise.resolve(r.lib):s=()=>Promise.resolve(()=>{throw new Error(`Can not get shared '${o}'!`)}),r.strategy&&warn('"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"');var l,a,i;return _extends$1({deps:[],useIn:[],from:t,loading:null},r,{shareConfig:_extends$1({requiredVersion:`^${r.version}`,singleton:!1,eager:!1,strictVersion:!1},r.shareConfig),get:s,loaded:r!=null&&r.loaded||"lib"in r?!0:void 0,version:(l=r.version)!=null?l:"0",scope:Array.isArray(r.scope)?r.scope:[(a=r.scope)!=null?a:"default"],strategy:((i=r.strategy)!=null?i:n)||"version-first"})}function formatShareConfigs(r,t){const o=t.shared||{},n=t.name,s=Object.keys(o).reduce((a,i)=>{const c=arrayOptions(o[i]);return a[i]=a[i]||[],c.forEach(u=>{a[i].push(formatShare(u,n,i,t.shareStrategy))}),a},{}),l=_extends$1({},r.shared);return Object.keys(s).forEach(a=>{l[a]?s[a].forEach(i=>{l[a].find(u=>u.version===i.version)||l[a].push(i)}):l[a]=s[a]}),{shared:l,shareInfos:s}}function versionLt(r,t){const o=n=>{if(!Number.isNaN(Number(n))){const l=n.split(".");let a=n;for(let i=0;i<3-l.length;i++)a+=".0";return a}return n};return!!satisfy(o(r),`<=${o(t)}`)}const findVersion=(r,t)=>{const o=t||function(n,s){return versionLt(n,s)};return Object.keys(r).reduce((n,s)=>!n||o(n,s)||n==="0"?s:n,0)},isLoaded=r=>!!r.loaded||typeof r.lib=="function",isLoading=r=>!!r.loading;function findSingletonVersionOrderByVersion(r,t,o){const n=r[t][o],s=function(l,a){return!isLoaded(n[l])&&versionLt(l,a)};return findVersion(r[t][o],s)}function findSingletonVersionOrderByLoaded(r,t,o){const n=r[t][o],s=function(l,a){const i=c=>isLoaded(c)||isLoading(c);return i(n[a])?i(n[l])?!!versionLt(l,a):!0:i(n[l])?!1:versionLt(l,a)};return findVersion(r[t][o],s)}function getFindShareFunction(r){return r==="loaded-first"?findSingletonVersionOrderByLoaded:findSingletonVersionOrderByVersion}function getRegisteredShare(r,t,o,n){if(!r)return;const{shareConfig:s,scope:l=DEFAULT_SCOPE,strategy:a}=o,i=Array.isArray(l)?l:[l];for(const c of i)if(s&&r[c]&&r[c][t]){const{requiredVersion:u}=s,h=getFindShareFunction(a)(r,c,t),p=()=>{if(s.singleton){if(typeof u=="string"&&!satisfy(h,u)){const b=`Version ${h} from ${h&&r[c][t][h].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;s.strictVersion?error(b):warn(b)}return r[c][t][h]}else{if(u===!1||u==="*"||satisfy(h,u))return r[c][t][h];for(const[b,y]of Object.entries(r[c][t]))if(satisfy(b,u))return y}},m={shareScopeMap:r,scope:c,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(n.emit(m)||m).resolver()}}function getGlobalShareScope(){return Global.__FEDERATION__.__SHARE__}function getTargetSharedOptions(r){const{pkgName:t,extraOptions:o,shareInfos:n}=r,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 l;const a=(l=o==null?void 0:o.resolver)!=null?l:s;return Object.assign({},a(n[t]),o==null?void 0:o.customShareInfo)}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",TYPE_001="TYPE-001",getDocsUrl=r=>`https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}/${r}`,getShortErrorMsg=(r,t,o,n)=>{const s=[`${[t[r]]} #${r}`];return o&&s.push(`args: ${JSON.stringify(o)}`),s.push(getDocsUrl(r)),n&&s.push(`Original Error Message:
|
|
8
8
|
${n}`),s.join(`
|
|
9
|
-
`)};function _extends(){return _extends=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[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."},typeDescMap={[TYPE_001]:"Failed to generate type declaration."};_extends({},runtimeDescMap,typeDescMap);function matchRemoteWithNameAndExpose(r,t){for(const o of r){const n=t.startsWith(o.name);let s=t.replace(o.name,"");if(n){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 l=o.alias&&t.startsWith(o.alias);let a=o.alias&&t.replace(o.alias,"");if(o.alias&&l){if(a&&a.startsWith("/")){const i=o.alias;return a=`.${a}`,{pkgNameOrAlias:i,expose:a,remote:o}}else if(a==="")return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function matchRemote(r,t){for(const o of r)if(t===o.name||o.alias&&t===o.alias)return o}function registerPlugins$1(r,t){const o=getGlobalHostPlugins();return o.length>0&&o.forEach(n=>{r!=null&&r.find(s=>s.name!==n.name)&&r.push(n)}),r&&r.length>0&&r.forEach(n=>{t.forEach(s=>{s.applyPlugin(n)})}),r}async function loadEsmEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${r}").then(callbacks[0]).catch(callbacks[1])`)([o,n]):import(r).then(o).catch(n)}catch(s){n(s)}})}async function loadSystemJsEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof __system_context__>"u"?System.import(r).then(o).catch(n):new Function("callbacks",`System.import("${r}").then(callbacks[0]).catch(callbacks[1])`)([o,n])}catch(s){n(s)}})}async function loadEntryScript({name:r,globalName:t,entry:o,loaderHook:n}){const{entryExports:s}=getRemoteEntryExports(r,t);return s||loadScript(o,{attrs:{},createScriptHook:(l,a)=>{const i=n.lifecycle.createScript.emit({url:l,attrs:a});if(i&&(i instanceof HTMLScriptElement||"script"in i||"timeout"in i))return i}}).then(()=>{const{remoteEntryKey:l,entryExports:a}=getRemoteEntryExports(r,t);return assert(a,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:r,remoteEntryUrl:o,remoteEntryKey:l})),a}).catch(l=>{throw l})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:o}){const{entry:n,entryGlobalName:s,name:l,type:a}=r;switch(a){case"esm":case"module":return loadEsmEntry({entry:n,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:n,remoteEntryExports:t});default:return loadEntryScript({entry:n,globalName:s,name:l,loaderHook:o})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:o,entryGlobalName:n,name:s,type:l}=r,{entryExports:a}=getRemoteEntryExports(s,n);return a||loadScriptNode(o,{attrs:{name:s,globalName:n,type:l},loaderHook:{createScriptHook:(i,c={})=>{const u=t.lifecycle.createScript.emit({url:i,attrs:c});if(u&&"url"in u)return u}}}).then(()=>{const{remoteEntryKey:i,entryExports:c}=getRemoteEntryExports(s,n);return assert(c,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:s,remoteEntryUrl:o,remoteEntryKey:i})),c}).catch(i=>{throw i})}function getRemoteEntryUniqueKey(r){const{entry:t,name:o}=r;return composeKeyWithSeparator(o,t)}async function getRemoteEntry({origin:r,remoteEntryExports:t,remoteInfo:o}){const n=getRemoteEntryUniqueKey(o);if(t)return t;if(!globalLoading[n]){const s=r.remoteHandler.hooks.lifecycle.loadEntry,l=r.loaderHook;globalLoading[n]=s.emit({loaderHook:l,remoteInfo:o,remoteEntryExports:t}).then(a=>a||(isBrowserEnv()?loadEntryDom({remoteInfo:o,remoteEntryExports:t,loaderHook:l}):loadEntryNode({remoteInfo:o,loaderHook:l})))}return globalLoading[n]}function getRemoteInfo(r){return _extends$1({},r,{entry:"entry"in r?r.entry:"",type:r.type||DEFAULT_REMOTE_TYPE,entryGlobalName:r.entryGlobalName||r.name,shareScope:r.shareScope||DEFAULT_SCOPE})}let Module=class{async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;
|
|
10
|
-
${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,o,n,s){const{loadFactory:l=!0}=n||{loadFactory:!0},a=await this.getEntry();if(!this.inited){const h=this.host.shareScopeMap,p=this.remoteInfo.shareScope||"default";h[p]||(h[p]={});const m=h[p],g=[],b={version:this.remoteInfo.version||""};Object.defineProperty(b,"shareScopeMap",{value:h,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:b,initScope:g,remoteInfo:this.remoteInfo,origin:this.host});typeof(a==null?void 0:a.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{remoteName:name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:a}))}this.lib=a,this.inited=!0;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:o,moduleInfo:this.remoteInfo}),i||(i=await a.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 l?await u():u}wraperFactory(t,o){function n(s,l){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:l,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return n(s,o),s}:()=>{const s=t();return n(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 n(...s){return o.remove(n),t.apply(null,s)})}emit(...t){let o;return this.listeners.size>0&&this.listeners.forEach(n=>{o=n(...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 n=Array.from(this.listeners);if(n.length>0){let s=0;const l=a=>a===!1?!1:s<n.length?Promise.resolve(n[s++].apply(null,t)).then(l):a;o=l()}return Promise.resolve(o)}}function checkReturnData(r,t){if(!isObject(t))return!1;if(r!==t){for(const o in r)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 n=o(t);if(checkReturnData(t,n))t=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(n){warn(n),this.onerror(n)}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 n=0;const s=a=>(warn(a),this.onerror(a),t),l=a=>{if(checkReturnData(t,a)){if(t=a,n<o.length)try{return Promise.resolve(o[n++](t)).then(l,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(l(t))}return Promise.resolve(t)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t){assert(isPlainObject(t),"Plugin configuration is invalid.");const o=t.name;assert(o,"A name must be provided by the plugin."),this.registerPlugins[o]||(this.registerPlugins[o]=t,Object.keys(this.lifecycle).forEach(n=>{const s=t[n];s&&this.lifecycle[n].on(s)}))}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(n=>{n!=="name"&&this.lifecycle[n].remove(o[n])})}inherit({lifecycle:t,registerPlugins:o}){Object.keys(t).forEach(n=>{assert(!this.lifecycle[n],`The hook "${n}" has a conflict and cannot be inherited.`),this.lifecycle[n]=t[n]}),Object.keys(o).forEach(n=>{assert(!this.registerPlugins[n],`The plugin "${n}" has a conflict and cannot be inherited.`),this.applyPlugin(o[n])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function defaultPreloadArgs(r){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},r)}function formatPreloadArgs(r,t){return t.map(o=>{const n=matchRemote(r,o.nameOrAlias);return assert(n,`Unable to preload ${o.nameOrAlias} as it is not included in ${!n&&safeToString({remoteInfo:n,remotes:r})}`),{remote:n,preloadConfig:defaultPreloadArgs(o)}})}function normalizePreloadExposes(r){return r?r.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(r,t,o,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:l,entryAssets:a}=o;if(t.options.inBrowser){if(a.forEach(i=>{const{moduleInfo:c}=i,u=t.moduleCache.get(r.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){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(n){const i={rel:"preload",as:"script"};l.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:(r==null?void 0:r.type)==="module"?"module":"text/javascript"};l.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)})}}}function assignRemoteInfo(r,t){const o=getRemoteEntryInfoFromSnapshot(t);o.url||error(`The attribute remoteEntry of ${r.name} must not be undefined.`);let n=getResourceUrl(t,o.url);!isBrowserEnv()&&!n.startsWith("http")&&(n=`https:${n}`),r.type=o.type,r.entryGlobalName=o.globalName,r.entry=n,r.version=t.version,r.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(r){const{remote:t,pkgNameOrAlias:o,expose:n,origin:s,remoteInfo:l}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:a,globalSnapshot:i}=await s.snapshotHandler.loadRemoteSnapshotInfo(t);assignRemoteInfo(l,a);const c={remote:t,preloadConfig:{nameOrAlias:o,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:c,remoteInfo:l,remote:t,remoteSnapshot:a,globalSnapshot:i});return u&&preloadAssets(l,s,u,!1),_extends$1({},r,{remoteSnapshot:a})}return r}}}function splitId(r){const t=r.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(r,t,o,n,s={},l){const a=getFMId(t),{value:i}=getInfoWithoutType(r,a),c=l||i;if(c&&!isManifestProvider(c)&&(o(c,t,n),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(r,{name:h.name,version:p.matchedVersion},o,!1,s,void 0)}}}function generatePreloadAssets(r,t,o,n,s){const l=[],a=[],i=[],c=new Set,u=new Set,{options:d}=r,{preloadConfig:h}=t,{depsRemote:p}=h;if(traverseModuleInfo(n,o,(y,_,v)=>{let S;if(v)S=h;else if(Array.isArray(p)){const A=p.find(w=>w.nameOrAlias===_.name||w.nameOrAlias===_.alias);if(!A)return;S=defaultPreloadArgs(A)}else if(p===!0)S=h;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&i.push({name:_.name,moduleInfo:{name:_.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:_.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let E="modules"in y?y.modules:[];const I=normalizePreloadExposes(S.exposes);if(I.length&&"modules"in y){var O;E=y==null||(O=y.modules)==null?void 0:O.reduce((A,w)=>((I==null?void 0:I.indexOf(w.moduleName))!==-1&&A.push(w),A),[])}function $(A){const w=A.map(T=>getResourceUrl(y,T));return S.filter?w.filter(S.filter):w}if(E){const A=E.length;for(let w=0;w<A;w++){const T=E[w],P=`${_.name}/${T.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:T.moduleName==="."?_.name:P,name:_.name,remoteSnapshot:y,preloadConfig:S,remote:_,origin:r}),!getPreloaded(P)&&(S.resourceCategory==="all"?(l.push(...$(T.assets.css.async)),l.push(...$(T.assets.css.sync)),a.push(...$(T.assets.js.async)),a.push(...$(T.assets.js.sync))):(S.resourceCategory="sync")&&(l.push(...$(T.assets.css.sync)),a.push(...$(T.assets.js.sync))),setPreloaded(P))}}},!0,{},s),s.shared){const y=(_,v)=>{const S=getRegisteredShare(r.shareScopeMap,v.sharedName,_,r.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(v.assets.js.sync.forEach(R=>{c.add(R)}),v.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(_=>{var v;const S=(v=d.shared)==null?void 0:v[_.sharedName];if(!S)return;const R=_.version?S.find(I=>I.version===_.version):S;if(!R)return;arrayOptions(R).forEach(I=>{y(I,_)})})}const g=a.filter(y=>!c.has(y));return{cssAssets:l.filter(y=>!u.has(y)),jsAssetsWithoutEntry:g,entryAssets:i}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(r){const{origin:t,preloadOptions:o,remoteInfo:n,remote:s,globalSnapshot:l,remoteSnapshot:a}=r;return isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(n,a),generatePreloadAssets(t,o,n,l,a))}}};function getGlobalRemoteInfo(r,t){const o=getGlobalSnapshotInfoByModuleInfo({name:t.options.name,version:t.options.version}),n=o&&"remotesInfo"in o&&o.remotesInfo&&getInfoWithoutType(o.remotesInfo,r.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:"version"in r?r.version:void 0})}}class SnapshotHandler{async loadSnapshot(t){const{options:o}=this.HostInstance,{hostGlobalSnapshot:n,remoteSnapshot:s,globalSnapshot:l}=this.getGlobalRemoteInfo(t),{remoteSnapshot:a,globalSnapshot:i}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:t,hostGlobalSnapshot:n,remoteSnapshot:s,globalSnapshot:l});return{remoteSnapshot:a,globalSnapshot:i}}async loadRemoteSnapshotInfo(t){const{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:t});let n=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!getInfoWithoutType(n.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(n.remotesInfo=_extends$1({},n==null?void 0:n.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:a}=this.getGlobalRemoteInfo(t),{remoteSnapshot:i,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:t,hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:a});let u,d;if(i)if(isManifestProvider(i)){const h=isBrowserEnv()?i.remoteEntry:i.ssrRemoteEntry||i.remoteEntry||"",p=await this.getManifestJson(h,t,{}),m=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:h}),p);u=p,d=m}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:i,from:"global"});u=h,d=c}else if(isRemoteInfoWithEntry(t)){const h=await this.getManifestJson(t.entry,t,{}),p=setGlobalSnapshotInfoByModuleInfo(t,h),{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:h,from:"global"});u=m,d=p}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(c)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({options:o,moduleInfo:t,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,o,n){const s=async()=>{let a=this.manifestCache.get(t);if(a)return a;try{let i=await this.loaderHook.lifecycle.fetch.emit(t,{});return(!i||!(i instanceof Response))&&(i=await fetch(t,{})),a=await i.json(),assert(a.metaData&&a.exposes&&a.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,a),a}catch(i){delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:o.name},`${i}`))}},l=async()=>{const a=await s(),i=generateSnapshotFromManifest(a,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:o,manifestJson:a,remoteSnapshot:i,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=l().then(a=>a)),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:n,shared:s}=formatShareConfigs(t,o);return Object.keys(n).forEach(a=>{n[a].forEach(c=>{!getRegisteredShare(this.shareScopeMap,a,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:a,lib:c.lib,get:c.get,loaded:!0,shared:c,from:o.name})})}),{shareInfos:n,shared:s}}async loadShare(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const l=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:n.options.shared,origin:n}),{shareInfo:a}=l;assert(a,`Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);const i=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,n.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();a.lib=h,a.loaded=!0,c(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0),h})();return this.setShared({pkgName:t,loaded:!1,shared:i,from:n.options.name,lib:null,loading:d}),d}else{if(o!=null&&o.customShareInfo)return!1;const d=(async()=>{const h=await a.get();a.lib=h,a.loaded=!0,c(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0),h})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:n.options.name,lib:null,loading:d}),d}}initializeSharing(t=DEFAULT_SCOPE,o){const{host:n}=this,s=o==null?void 0:o.from,l=o==null?void 0:o.strategy;let a=o==null?void 0:o.initScope;const i=[];if(s!=="build"){const{initTokens:g}=this;a||(a=[]);let b=g[t];if(b||(b=g[t]={from:this.host.name}),a.indexOf(b)>=0)return i;a.push(b)}const c=this.shareScopeMap,u=n.options.name;c[t]||(c[t]={});const d=c[t],h=(g,b)=>{var y;const{version:_,eager:v}=b;d[g]=d[g]||{};const S=d[g],R=S[_],E=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!v!=!E?v:u>R.from))&&(S[_]=b)},p=g=>g&&g.init&&g.init(c[t],a),m=async g=>{const{module:b}=await n.remoteHandler.getRemoteModuleAndOptions({id:g});if(b.getEntry){let y;try{y=await b.getEntry()}catch(_){y=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:g,error:_,from:"runtime",lifecycle:"beforeLoadShare",origin:n})}b.inited||(await p(y),b.inited=!0)}};return Object.keys(n.options.shared).forEach(g=>{n.options.shared[g].forEach(y=>{y.scope.includes(t)&&h(g,y)})}),(n.options.shareStrategy==="version-first"||l==="version-first")&&n.options.remotes.forEach(g=>{g.shareScope===t&&i.push(m(g.name))}),i}loadShareSync(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&s.scope.forEach(i=>{this.initializeSharing(i,{strategy:s.strategy})});const l=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),a=i=>{i.useIn||(i.useIn=[]),addUniqueItem(i.useIn,n.options.name)};if(l){if(typeof l.lib=="function")return a(l),l.loaded||(l.loaded=!0,l.from===n.options.name&&(s.loaded=!0)),l.lib;if(typeof l.get=="function"){const i=l.get();if(!(i instanceof Promise))return a(l),this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:i,shared:l}),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:n.options.name,sharedPkgName:t}))}return s.lib=i,this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}initShareScopeMap(t,o,n={}){const{host:s}=this;this.shareScopeMap[t]=o,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:o,options:s.options,origin:s,scopeName:t,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:t,shared:o,from:n,lib:s,loading:l,loaded:a,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:a,loading:l}),i&&(this.shareScopeMap[p][t][c].get=i);return}const m=this.shareScopeMap[p][t][c];l&&!m.loading&&(m.loading=l)})}_setGlobalShareScopeMap(t){const o=getGlobalShareScope(),n=t.id||t.name;n&&!o[n]&&(o[n]=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,l)=>(this.registerRemote(l,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,o){const{remote:n,expose:s}=o,{name:l,alias:a}=n;if(this.idToRemoteMap[t]={name:n.name,expose:s},a&&t.startsWith(l)){const i=t.replace(l,a);this.idToRemoteMap[i]={name:n.name,expose:s};return}if(a&&t.startsWith(a)){const i=t.replace(a,l);this.idToRemoteMap[i]={name:n.name,expose:s}}}async loadRemote(t,o){const{host:n}=this;try{const{loadFactory:s=!0}=o||{loadFactory:!0},{module:l,moduleOptions:a,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:d,id:h,remoteSnapshot:p}=i,m=await l.get(h,d,o,p),g=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:a,moduleInstance:l,origin:n});return this.setIdToRemoteMap(t,i),typeof g=="function"?g:m}catch(s){const{from:l="runtime"}=o||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:l,lifecycle:"onLoad",origin:n});if(!a)throw s;return a}}async preloadRemote(t){const{host:o}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:o.options,origin:o});const n=formatPreloadArgs(o.options.remotes,t);await Promise.all(n.map(async s=>{const{remote:l}=s,a=getRemoteInfo(l),{globalSnapshot:i,remoteSnapshot:c}=await o.snapshotHandler.loadRemoteSnapshotInfo(l),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:s,remote:l,remoteInfo:a,globalSnapshot:i,remoteSnapshot:c});u&&preloadAssets(a,o,u)}))}registerRemotes(t,o){const{host:n}=this;t.forEach(s=>{this.registerRemote(s,n.options.remotes,{force:o==null?void 0:o.force})})}async getRemoteModuleAndOptions(t){const{host:o}=this,{id:n}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:o.options,origin:o})}catch(g){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:o.options,origin:o,from:"runtime",error:g,lifecycle:"beforeRequest"}),!s)throw g}const{id:l}=s,a=matchRemoteWithNameAndExpose(o.options.remotes,l);assert(a,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:o.options.name,requestId:l}));const{remote:i}=a,c=getRemoteInfo(i),u=await o.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:l},a,{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 ${l}.`);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,n){const{host:s}=this,l=()=>{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 a=o.find(i=>i.name===t.name);if(!a)l(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const i=[`The remote "${t.name}" is already registered.`,n!=null&&n.force?"Hope you have known that OVERRIDE it may have some unexpected errors":'If you want to merge the remote, you can set "force: true".'];n!=null&&n.force&&(this.removeRemote(a),l(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s})),warn$1(i.join(" "))}}removeRemote(t){try{const{host:n}=this,{name:s}=t,l=n.options.remotes.findIndex(i=>i.name===s);l!==-1&&n.options.remotes.splice(l,1);const a=n.moduleCache.get(t.name);if(a){const i=a.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(a.remoteInfo);globalLoading[u]&&delete globalLoading[u],n.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 g=getGlobalShareScope();let b=!0;const y=[];Object.keys(g).forEach(_=>{const v=g[_];v&&Object.keys(v).forEach(S=>{const R=v[S];R&&Object.keys(R).forEach(E=>{const I=R[E];I&&Object.keys(I).forEach(O=>{const $=I[O];$&&typeof $=="object"&&$.from===i.name&&($.loaded||$.loading?($.useIn=$.useIn.filter(A=>A!==i.name),$.useIn.length?b=!1:y.push([_,S,E,O])):y.push([_,S,E,O]))})})})}),b&&(m.shareScopeMap={},delete g[d]),y.forEach(([_,v,S,R])=>{var E,I,O;(O=g[_])==null||(I=O[v])==null||(E=I[S])==null||delete E[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,n);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])}n.moduleCache.delete(t.name)}}catch(n){logger.log("removeRemote fail: ",n)}}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={}}}class FederationHost{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,n){const s=getRemoteInfo({name:t,entry:o}),l=new Module({host:this,remoteInfo:s});return l.remoteEntryExports=n,this.moduleCache.set(t,l),l}async loadRemote(t,o){return this.remoteHandler.loadRemote(t,o)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,o,n={}){this.sharedHandler.initShareScopeMap(t,o,n)}formatOptions(t,o){const{shared:n}=formatShareConfigs(t,o),{userOptions:s,options:l}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:o,options:t,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(l,s),{shared:i}=this.sharedHandler.registerShared(l,s),c=[...l.plugins];s.plugins&&s.plugins.forEach(d=>{c.includes(d)||c.push(d)});const u=_extends$1({},t,o,{plugins:c,remotes:a,shared:i});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const o=registerPlugins$1(t,[this.hooks,this.remoteHandler.hooks,this.sharedHandler.hooks,this.snapshotHandler.hooks,this.loaderHook,this.bridgeHook]);this.options.plugins=this.options.plugins.reduce((n,s)=>(s&&n&&!n.find(l=>l.name===s.name)&&n.push(s),n),o||[])}registerRemotes(t,o){return this.remoteHandler.registerRemotes(t,o)}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.8.0",this.moduleCache=new Map,this.loaderHook=new PluginSystem({getModuleInfo:new SyncHook,createScript:new SyncHook,createLink:new SyncHook,fetch:new AsyncHook,getModuleFactory:new AsyncHook}),this.bridgeHook=new PluginSystem({beforeBridgeRender:new SyncHook,afterBridgeRender:new SyncHook,beforeBridgeDestroy:new SyncHook,afterBridgeDestroy:new SyncHook});const o={id:getBuilderId(),name:t.name,plugins:[snapshotPlugin(),generatePreloadAssetsPlugin()],remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=o,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...o.plugins,...t.plugins||[]]),this.options=this.formatOptions(o,t)}}setGlobalFederationConstructor(FederationHost);function createBridgeComponent(r){const t=new Map;return()=>({__APP_VERSION__:"0.8.0",render(o){LoggerInstance.log("createBridgeComponent render Info",o);const n=Vue__namespace.createApp(r.rootComponent);t.set(o.dom,n);const s={},l=s&&typeof s=="object"&&(s!=null&&s.extraProps)?s==null?void 0:s.extraProps:{},a=r.appOptions({basename:o.basename,memoryRoute:o.memoryRoute,...l}),i=o.memoryRoute?VueRouter__namespace.createMemoryHistory(o.basename):VueRouter__namespace.createWebHistory(o.basename),c=VueRouter__namespace.createRouter({...a.router.options,history:i,routes:a.router.getRoutes()});LoggerInstance.log("createBridgeComponent render router info>>>",{name:o.moduleName,router:c}),o.memoryRoute?c.push(o.memoryRoute.entryPath).then(()=>{n.use(c),n.mount(o.dom)}):(n.use(c),n.mount(o.dom))},destroy(o){LoggerInstance.log("createBridgeComponent destroy Info",o);const n=t.get(o==null?void 0:o.dom);n==null||n.unmount()}})}function e(){const r=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(r)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,providerInfo:Function},setup(r){const t=Vue.ref(null),o=Vue.ref(null),n=Vue.ref(""),s=VueRouter.useRoute(),l=()=>{var d;const i=(d=r.providerInfo)==null?void 0:d.call(r);o.value=i;let c={name:r.moduleName,dom:t.value,basename:r.basename,memoryRoute:r.memoryRoute};LoggerInstance.log("createRemoteComponent LazyComponent render >>>",c),c={...c,...{}.extraProps},i.render(c)},a=Vue.watch(()=>s.path,i=>{i!==s.path&&l(),n.value!==""&&n.value!==i&&(LoggerInstance.log("createRemoteComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),n.value=i});return Vue.onMounted(()=>{l()}),Vue.onBeforeUnmount(()=>{var i;LoggerInstance.log("createRemoteComponent LazyComponent destroy >>>",{...r}),a(),(i=o.value)==null||i.destroy({dom:t.value})}),()=>Vue.createVNode("div",{ref:t},null)}});function createRemoteComponent(r){return Vue.defineAsyncComponent({__APP_VERSION__:"0.8.0",...r.asyncComponentOptions,loader:async()=>{var c;const t=VueRouter.useRoute();let o="/";const n=(c=t.matched[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?o=n.replace("/:pathMatch(.*)*",""):o=t.matched[0].path);const s=(r==null?void 0:r.export)||"default";LoggerInstance.log("createRemoteComponent LazyComponent create >>>",{basename:o,info:r});const l=await r.loader(),a=l&&l[Symbol.for("mf_module_id")],i=l[s];if(LoggerInstance.log("createRemoteComponent LazyComponent loadRemote info >>>",{name:a,module:l,exportName:s,basename:o,route:t}),s in l&&typeof i=="function")return{render(){return Vue.h(RemoteApp,{moduleName:a,providerInfo:i,basename:o})}};throw new Error("module not found")}})}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteComponent=createRemoteComponent;
|
|
9
|
+
`)};function _extends(){return _extends=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[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."},typeDescMap={[TYPE_001]:"Failed to generate type declaration."};_extends({},runtimeDescMap,typeDescMap);function matchRemoteWithNameAndExpose(r,t){for(const o of r){const n=t.startsWith(o.name);let s=t.replace(o.name,"");if(n){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 l=o.alias&&t.startsWith(o.alias);let a=o.alias&&t.replace(o.alias,"");if(o.alias&&l){if(a&&a.startsWith("/")){const i=o.alias;return a=`.${a}`,{pkgNameOrAlias:i,expose:a,remote:o}}else if(a==="")return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function matchRemote(r,t){for(const o of r)if(t===o.name||o.alias&&t===o.alias)return o}function registerPlugins$1(r,t){const o=getGlobalHostPlugins();return o.length>0&&o.forEach(n=>{r!=null&&r.find(s=>s.name!==n.name)&&r.push(n)}),r&&r.length>0&&r.forEach(n=>{t.forEach(s=>{s.applyPlugin(n)})}),r}async function loadEsmEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${r}").then(callbacks[0]).catch(callbacks[1])`)([o,n]):import(r).then(o).catch(n)}catch(s){n(s)}})}async function loadSystemJsEntry({entry:r,remoteEntryExports:t}){return new Promise((o,n)=>{try{t?o(t):typeof __system_context__>"u"?System.import(r).then(o).catch(n):new Function("callbacks",`System.import("${r}").then(callbacks[0]).catch(callbacks[1])`)([o,n])}catch(s){n(s)}})}async function loadEntryScript({name:r,globalName:t,entry:o,loaderHook:n}){const{entryExports:s}=getRemoteEntryExports(r,t);return s||loadScript(o,{attrs:{},createScriptHook:(l,a)=>{const i=n.lifecycle.createScript.emit({url:l,attrs:a});if(i&&(i instanceof HTMLScriptElement||"script"in i||"timeout"in i))return i}}).then(()=>{const{remoteEntryKey:l,entryExports:a}=getRemoteEntryExports(r,t);return assert(a,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:r,remoteEntryUrl:o,remoteEntryKey:l})),a}).catch(l=>{throw l})}async function loadEntryDom({remoteInfo:r,remoteEntryExports:t,loaderHook:o}){const{entry:n,entryGlobalName:s,name:l,type:a}=r;switch(a){case"esm":case"module":return loadEsmEntry({entry:n,remoteEntryExports:t});case"system":return loadSystemJsEntry({entry:n,remoteEntryExports:t});default:return loadEntryScript({entry:n,globalName:s,name:l,loaderHook:o})}}async function loadEntryNode({remoteInfo:r,loaderHook:t}){const{entry:o,entryGlobalName:n,name:s,type:l}=r,{entryExports:a}=getRemoteEntryExports(s,n);return a||loadScriptNode(o,{attrs:{name:s,globalName:n,type:l},loaderHook:{createScriptHook:(i,c={})=>{const u=t.lifecycle.createScript.emit({url:i,attrs:c});if(u&&"url"in u)return u}}}).then(()=>{const{remoteEntryKey:i,entryExports:c}=getRemoteEntryExports(s,n);return assert(c,getShortErrorMsg(RUNTIME_001,runtimeDescMap,{remoteName:s,remoteEntryUrl:o,remoteEntryKey:i})),c}).catch(i=>{throw i})}function getRemoteEntryUniqueKey(r){const{entry:t,name:o}=r;return composeKeyWithSeparator(o,t)}async function getRemoteEntry({origin:r,remoteEntryExports:t,remoteInfo:o}){const n=getRemoteEntryUniqueKey(o);if(t)return t;if(!globalLoading[n]){const s=r.remoteHandler.hooks.lifecycle.loadEntry,l=r.loaderHook;globalLoading[n]=s.emit({loaderHook:l,remoteInfo:o,remoteEntryExports:t}).then(a=>a||(isBrowserEnv()?loadEntryDom({remoteInfo:o,remoteEntryExports:t,loaderHook:l}):loadEntryNode({remoteInfo:o,loaderHook:l})))}return globalLoading[n]}function getRemoteInfo(r){return _extends$1({},r,{entry:"entry"in r?r.entry:"",type:r.type||DEFAULT_REMOTE_TYPE,entryGlobalName:r.entryGlobalName||r.name,shareScope:r.shareScope||DEFAULT_SCOPE})}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{const n=getRemoteEntryUniqueKey(this.remoteInfo);t=await this.host.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry,origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,globalLoading,uniqueKey:n})}return assert(t,`remoteEntryExports is undefined
|
|
10
|
+
${safeToString(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async get(t,o,n,s){const{loadFactory:l=!0}=n||{loadFactory:!0},a=await this.getEntry();if(!this.inited){const h=this.host.shareScopeMap,p=this.remoteInfo.shareScope||"default";h[p]||(h[p]={});const m=h[p],g=[],b={version:this.remoteInfo.version||""};Object.defineProperty(b,"shareScopeMap",{value:h,enumerable:!1});const y=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:m,remoteEntryInitOptions:b,initScope:g,remoteInfo:this.remoteInfo,origin:this.host});typeof(a==null?void 0:a.init)>"u"&&error(getShortErrorMsg(RUNTIME_002,runtimeDescMap,{remoteName:name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName})),await a.init(y.shareScope,y.initScope,y.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},y,{id:t,remoteSnapshot:s,remoteEntryExports:a}))}this.lib=a,this.inited=!0;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:o,moduleInfo:this.remoteInfo}),i||(i=await a.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 l?await u():u}wraperFactory(t,o){function n(s,l){s&&typeof s=="object"&&Object.isExtensible(s)&&!Object.getOwnPropertyDescriptor(s,Symbol.for("mf_module_id"))&&Object.defineProperty(s,Symbol.for("mf_module_id"),{value:l,enumerable:!1})}return t instanceof Promise?async()=>{const s=await t();return n(s,o),s}:()=>{const s=t();return n(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 n(...s){return o.remove(n),t.apply(null,s)})}emit(...t){let o;return this.listeners.size>0&&this.listeners.forEach(n=>{o=n(...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 n=Array.from(this.listeners);if(n.length>0){let s=0;const l=a=>a===!1?!1:s<n.length?Promise.resolve(n[s++].apply(null,t)).then(l):a;o=l()}return Promise.resolve(o)}}function checkReturnData(r,t){if(!isObject(t))return!1;if(r!==t){for(const o in r)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 n=o(t);if(checkReturnData(t,n))t=n;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(n){warn(n),this.onerror(n)}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 n=0;const s=a=>(warn(a),this.onerror(a),t),l=a=>{if(checkReturnData(t,a)){if(t=a,n<o.length)try{return Promise.resolve(o[n++](t)).then(l,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(l(t))}return Promise.resolve(t)}constructor(t){super(),this.onerror=error,this.type=t}}class PluginSystem{applyPlugin(t){assert(isPlainObject(t),"Plugin configuration is invalid.");const o=t.name;assert(o,"A name must be provided by the plugin."),this.registerPlugins[o]||(this.registerPlugins[o]=t,Object.keys(this.lifecycle).forEach(n=>{const s=t[n];s&&this.lifecycle[n].on(s)}))}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(n=>{n!=="name"&&this.lifecycle[n].remove(o[n])})}inherit({lifecycle:t,registerPlugins:o}){Object.keys(t).forEach(n=>{assert(!this.lifecycle[n],`The hook "${n}" has a conflict and cannot be inherited.`),this.lifecycle[n]=t[n]}),Object.keys(o).forEach(n=>{assert(!this.registerPlugins[n],`The plugin "${n}" has a conflict and cannot be inherited.`),this.applyPlugin(o[n])})}constructor(t){this.registerPlugins={},this.lifecycle=t,this.lifecycleKeys=Object.keys(t)}}function defaultPreloadArgs(r){return _extends$1({resourceCategory:"sync",share:!0,depsRemote:!0,prefetchInterface:!1},r)}function formatPreloadArgs(r,t){return t.map(o=>{const n=matchRemote(r,o.nameOrAlias);return assert(n,`Unable to preload ${o.nameOrAlias} as it is not included in ${!n&&safeToString({remoteInfo:n,remotes:r})}`),{remote:n,preloadConfig:defaultPreloadArgs(o)}})}function normalizePreloadExposes(r){return r?r.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function preloadAssets(r,t,o,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:l,entryAssets:a}=o;if(t.options.inBrowser){if(a.forEach(i=>{const{moduleInfo:c}=i,u=t.moduleCache.get(r.name);getRemoteEntry(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){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(n){const i={rel:"preload",as:"script"};l.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:(r==null?void 0:r.type)==="module"?"module":"text/javascript"};l.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)})}}}function assignRemoteInfo(r,t){const o=getRemoteEntryInfoFromSnapshot(t);o.url||error(`The attribute remoteEntry of ${r.name} must not be undefined.`);let n=getResourceUrl(t,o.url);!isBrowserEnv()&&!n.startsWith("http")&&(n=`https:${n}`),r.type=o.type,r.entryGlobalName=o.globalName,r.entry=n,r.version=t.version,r.buildVersion=t.buildVersion}function snapshotPlugin(){return{name:"snapshot-plugin",async afterResolve(r){const{remote:t,pkgNameOrAlias:o,expose:n,origin:s,remoteInfo:l}=r;if(!isRemoteInfoWithEntry(t)||!isPureRemoteEntry(t)){const{remoteSnapshot:a,globalSnapshot:i}=await s.snapshotHandler.loadRemoteSnapshotInfo(t);assignRemoteInfo(l,a);const c={remote:t,preloadConfig:{nameOrAlias:o,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:c,remoteInfo:l,remote:t,remoteSnapshot:a,globalSnapshot:i});return u&&preloadAssets(l,s,u,!1),_extends$1({},r,{remoteSnapshot:a})}return r}}}function splitId(r){const t=r.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(r,t,o,n,s={},l){const a=getFMId(t),{value:i}=getInfoWithoutType(r,a),c=l||i;if(c&&!isManifestProvider(c)&&(o(c,t,n),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(r,{name:h.name,version:p.matchedVersion},o,!1,s,void 0)}}}function generatePreloadAssets(r,t,o,n,s){const l=[],a=[],i=[],c=new Set,u=new Set,{options:d}=r,{preloadConfig:h}=t,{depsRemote:p}=h;if(traverseModuleInfo(n,o,(y,_,v)=>{let S;if(v)S=h;else if(Array.isArray(p)){const A=p.find(w=>w.nameOrAlias===_.name||w.nameOrAlias===_.alias);if(!A)return;S=defaultPreloadArgs(A)}else if(p===!0)S=h;else return;const R=getResourceUrl(y,getRemoteEntryInfoFromSnapshot(y).url);R&&i.push({name:_.name,moduleInfo:{name:_.name,entry:R,type:"remoteEntryType"in y?y.remoteEntryType:"global",entryGlobalName:"globalName"in y?y.globalName:_.name,shareScope:"",version:"version"in y?y.version:void 0},url:R});let E="modules"in y?y.modules:[];const I=normalizePreloadExposes(S.exposes);if(I.length&&"modules"in y){var O;E=y==null||(O=y.modules)==null?void 0:O.reduce((A,w)=>((I==null?void 0:I.indexOf(w.moduleName))!==-1&&A.push(w),A),[])}function $(A){const w=A.map(T=>getResourceUrl(y,T));return S.filter?w.filter(S.filter):w}if(E){const A=E.length;for(let w=0;w<A;w++){const T=E[w],P=`${_.name}/${T.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:T.moduleName==="."?_.name:P,name:_.name,remoteSnapshot:y,preloadConfig:S,remote:_,origin:r}),!getPreloaded(P)&&(S.resourceCategory==="all"?(l.push(...$(T.assets.css.async)),l.push(...$(T.assets.css.sync)),a.push(...$(T.assets.js.async)),a.push(...$(T.assets.js.sync))):(S.resourceCategory="sync")&&(l.push(...$(T.assets.css.sync)),a.push(...$(T.assets.js.sync))),setPreloaded(P))}}},!0,{},s),s.shared){const y=(_,v)=>{const S=getRegisteredShare(r.shareScopeMap,v.sharedName,_,r.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(v.assets.js.sync.forEach(R=>{c.add(R)}),v.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(_=>{var v;const S=(v=d.shared)==null?void 0:v[_.sharedName];if(!S)return;const R=_.version?S.find(I=>I.version===_.version):S;if(!R)return;arrayOptions(R).forEach(I=>{y(I,_)})})}const g=a.filter(y=>!c.has(y));return{cssAssets:l.filter(y=>!u.has(y)),jsAssetsWithoutEntry:g,entryAssets:i}}const generatePreloadAssetsPlugin=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(r){const{origin:t,preloadOptions:o,remoteInfo:n,remote:s,globalSnapshot:l,remoteSnapshot:a}=r;return isRemoteInfoWithEntry(s)&&isPureRemoteEntry(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(assignRemoteInfo(n,a),generatePreloadAssets(t,o,n,l,a))}}};function getGlobalRemoteInfo(r,t){const o=getGlobalSnapshotInfoByModuleInfo({name:t.options.name,version:t.options.version}),n=o&&"remotesInfo"in o&&o.remotesInfo&&getInfoWithoutType(o.remotesInfo,r.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:getGlobalSnapshot(),remoteSnapshot:getGlobalSnapshotInfoByModuleInfo({name:r.name,version:"version"in r?r.version:void 0})}}class SnapshotHandler{async loadSnapshot(t){const{options:o}=this.HostInstance,{hostGlobalSnapshot:n,remoteSnapshot:s,globalSnapshot:l}=this.getGlobalRemoteInfo(t),{remoteSnapshot:a,globalSnapshot:i}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:t,hostGlobalSnapshot:n,remoteSnapshot:s,globalSnapshot:l});return{remoteSnapshot:a,globalSnapshot:i}}async loadRemoteSnapshotInfo(t){const{options:o}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:o,moduleInfo:t});let n=getGlobalSnapshotInfoByModuleInfo({name:this.HostInstance.options.name,version:this.HostInstance.options.version});n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},addGlobalSnapshot({[this.HostInstance.options.name]:n})),n&&"remotesInfo"in n&&!getInfoWithoutType(n.remotesInfo,t.name).value&&("version"in t||"entry"in t)&&(n.remotesInfo=_extends$1({},n==null?void 0:n.remotesInfo,{[t.name]:{matchedVersion:"version"in t?t.version:t.entry}}));const{hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:a}=this.getGlobalRemoteInfo(t),{remoteSnapshot:i,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:o,moduleInfo:t,hostGlobalSnapshot:s,remoteSnapshot:l,globalSnapshot:a});let u,d;if(i)if(isManifestProvider(i)){const h=isBrowserEnv()?i.remoteEntry:i.ssrRemoteEntry||i.remoteEntry||"",p=await this.getManifestJson(h,t,{}),m=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:h}),p);u=p,d=m}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:i,from:"global"});u=h,d=c}else if(isRemoteInfoWithEntry(t)){const h=await this.getManifestJson(t.entry,t,{}),p=setGlobalSnapshotInfoByModuleInfo(t,h),{remoteSnapshot:m}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:h,from:"global"});u=m,d=p}else error(getShortErrorMsg(RUNTIME_007,runtimeDescMap,{hostName:t.name,hostVersion:t.version,globalSnapshot:JSON.stringify(c)}));return await this.hooks.lifecycle.afterLoadSnapshot.emit({options:o,moduleInfo:t,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(t){return getGlobalRemoteInfo(t,this.HostInstance)}async getManifestJson(t,o,n){const s=async()=>{let a=this.manifestCache.get(t);if(a)return a;try{let i=await this.loaderHook.lifecycle.fetch.emit(t,{});return(!i||!(i instanceof Response))&&(i=await fetch(t,{})),a=await i.json(),assert(a.metaData&&a.exposes&&a.shared,`${t} is not a federation manifest`),this.manifestCache.set(t,a),a}catch(i){delete this.manifestLoading[t],error(getShortErrorMsg(RUNTIME_003,runtimeDescMap,{manifestUrl:t,moduleName:o.name},`${i}`))}},l=async()=>{const a=await s(),i=generateSnapshotFromManifest(a,{version:t}),{remoteSnapshot:c}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:o,manifestJson:a,remoteSnapshot:i,manifestUrl:t,from:"manifest"});return c};return this.manifestLoading[t]||(this.manifestLoading[t]=l().then(a=>a)),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:n,shared:s}=formatShareConfigs(t,o);return Object.keys(n).forEach(a=>{n[a].forEach(c=>{!getRegisteredShare(this.shareScopeMap,a,c,this.hooks.lifecycle.resolveShare)&&c&&c.lib&&this.setShared({pkgName:a,lib:c.lib,get:c.get,loaded:!0,shared:c,from:o.name})})}),{shareInfos:n,shared:s}}async loadShare(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&await Promise.all(s.scope.map(async u=>{await Promise.all(this.initializeSharing(u,{strategy:s.strategy}))}));const l=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:t,shareInfo:s,shared:n.options.shared,origin:n}),{shareInfo:a}=l;assert(a,`Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);const i=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare),c=u=>{u.useIn||(u.useIn=[]),addUniqueItem(u.useIn,n.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();a.lib=h,a.loaded=!0,c(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0),h})();return this.setShared({pkgName:t,loaded:!1,shared:i,from:n.options.name,lib:null,loading:d}),d}else{if(o!=null&&o.customShareInfo)return!1;const d=(async()=>{const h=await a.get();a.lib=h,a.loaded=!0,c(a);const p=getRegisteredShare(this.shareScopeMap,t,a,this.hooks.lifecycle.resolveShare);return p&&(p.lib=h,p.loaded=!0),h})();return this.setShared({pkgName:t,loaded:!1,shared:a,from:n.options.name,lib:null,loading:d}),d}}initializeSharing(t=DEFAULT_SCOPE,o){const{host:n}=this,s=o==null?void 0:o.from,l=o==null?void 0:o.strategy;let a=o==null?void 0:o.initScope;const i=[];if(s!=="build"){const{initTokens:g}=this;a||(a=[]);let b=g[t];if(b||(b=g[t]={from:this.host.name}),a.indexOf(b)>=0)return i;a.push(b)}const c=this.shareScopeMap,u=n.options.name;c[t]||(c[t]={});const d=c[t],h=(g,b)=>{var y;const{version:_,eager:v}=b;d[g]=d[g]||{};const S=d[g],R=S[_],E=!!(R&&(R.eager||(y=R.shareConfig)!=null&&y.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!v!=!E?v:u>R.from))&&(S[_]=b)},p=g=>g&&g.init&&g.init(c[t],a),m=async g=>{const{module:b}=await n.remoteHandler.getRemoteModuleAndOptions({id:g});if(b.getEntry){let y;try{y=await b.getEntry()}catch(_){y=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:g,error:_,from:"runtime",lifecycle:"beforeLoadShare",origin:n})}b.inited||(await p(y),b.inited=!0)}};return Object.keys(n.options.shared).forEach(g=>{n.options.shared[g].forEach(y=>{y.scope.includes(t)&&h(g,y)})}),(n.options.shareStrategy==="version-first"||l==="version-first")&&n.options.remotes.forEach(g=>{g.shareScope===t&&i.push(m(g.name))}),i}loadShareSync(t,o){const{host:n}=this,s=getTargetSharedOptions({pkgName:t,extraOptions:o,shareInfos:n.options.shared});s!=null&&s.scope&&s.scope.forEach(i=>{this.initializeSharing(i,{strategy:s.strategy})});const l=getRegisteredShare(this.shareScopeMap,t,s,this.hooks.lifecycle.resolveShare),a=i=>{i.useIn||(i.useIn=[]),addUniqueItem(i.useIn,n.options.name)};if(l){if(typeof l.lib=="function")return a(l),l.loaded||(l.loaded=!0,l.from===n.options.name&&(s.loaded=!0)),l.lib;if(typeof l.get=="function"){const i=l.get();if(!(i instanceof Promise))return a(l),this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:i,shared:l}),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:n.options.name,sharedPkgName:t}))}return s.lib=i,this.setShared({pkgName:t,loaded:!0,from:n.options.name,lib:s.lib,shared:s}),s.lib}throw new Error(getShortErrorMsg(RUNTIME_006,runtimeDescMap,{hostName:n.options.name,sharedPkgName:t}))}initShareScopeMap(t,o,n={}){const{host:s}=this;this.shareScopeMap[t]=o,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:o,options:s.options,origin:s,scopeName:t,hostShareScopeMap:n.hostShareScopeMap})}setShared({pkgName:t,shared:o,from:n,lib:s,loading:l,loaded:a,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:a,loading:l}),i&&(this.shareScopeMap[p][t][c].get=i);return}const m=this.shareScopeMap[p][t][c];l&&!m.loading&&(m.loading=l)})}_setGlobalShareScopeMap(t){const o=getGlobalShareScope(),n=t.id||t.name;n&&!o[n]&&(o[n]=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,l)=>(this.registerRemote(l,s,{force:!1}),s),t.remotes)}setIdToRemoteMap(t,o){const{remote:n,expose:s}=o,{name:l,alias:a}=n;if(this.idToRemoteMap[t]={name:n.name,expose:s},a&&t.startsWith(l)){const i=t.replace(l,a);this.idToRemoteMap[i]={name:n.name,expose:s};return}if(a&&t.startsWith(a)){const i=t.replace(a,l);this.idToRemoteMap[i]={name:n.name,expose:s}}}async loadRemote(t,o){const{host:n}=this;try{const{loadFactory:s=!0}=o||{loadFactory:!0},{module:l,moduleOptions:a,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:t}),{pkgNameOrAlias:c,remote:u,expose:d,id:h,remoteSnapshot:p}=i,m=await l.get(h,d,o,p),g=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:a,moduleInstance:l,origin:n});return this.setIdToRemoteMap(t,i),typeof g=="function"?g:m}catch(s){const{from:l="runtime"}=o||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:t,error:s,from:l,lifecycle:"onLoad",origin:n});if(!a)throw s;return a}}async preloadRemote(t){const{host:o}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:t,options:o.options,origin:o});const n=formatPreloadArgs(o.options.remotes,t);await Promise.all(n.map(async s=>{const{remote:l}=s,a=getRemoteInfo(l),{globalSnapshot:i,remoteSnapshot:c}=await o.snapshotHandler.loadRemoteSnapshotInfo(l),u=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:o,preloadOptions:s,remote:l,remoteInfo:a,globalSnapshot:i,remoteSnapshot:c});u&&preloadAssets(a,o,u)}))}registerRemotes(t,o){const{host:n}=this;t.forEach(s=>{this.registerRemote(s,n.options.remotes,{force:o==null?void 0:o.force})})}async getRemoteModuleAndOptions(t){const{host:o}=this,{id:n}=t;let s;try{s=await this.hooks.lifecycle.beforeRequest.emit({id:n,options:o.options,origin:o})}catch(g){if(s=await this.hooks.lifecycle.errorLoadRemote.emit({id:n,options:o.options,origin:o,from:"runtime",error:g,lifecycle:"beforeRequest"}),!s)throw g}const{id:l}=s,a=matchRemoteWithNameAndExpose(o.options.remotes,l);assert(a,getShortErrorMsg(RUNTIME_004,runtimeDescMap,{hostName:o.options.name,requestId:l}));const{remote:i}=a,c=getRemoteInfo(i),u=await o.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({id:l},a,{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 ${l}.`);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,n){const{host:s}=this,l=()=>{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 a=o.find(i=>i.name===t.name);if(!a)l(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s});else{const i=[`The remote "${t.name}" is already registered.`,n!=null&&n.force?"Hope you have known that OVERRIDE it may have some unexpected errors":'If you want to merge the remote, you can set "force: true".'];n!=null&&n.force&&(this.removeRemote(a),l(),o.push(t),this.hooks.lifecycle.registerRemote.emit({remote:t,origin:s})),warn$1(i.join(" "))}}removeRemote(t){try{const{host:n}=this,{name:s}=t,l=n.options.remotes.findIndex(i=>i.name===s);l!==-1&&n.options.remotes.splice(l,1);const a=n.moduleCache.get(t.name);if(a){const i=a.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(a.remoteInfo);globalLoading[u]&&delete globalLoading[u],n.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 g=getGlobalShareScope();let b=!0;const y=[];Object.keys(g).forEach(_=>{const v=g[_];v&&Object.keys(v).forEach(S=>{const R=v[S];R&&Object.keys(R).forEach(E=>{const I=R[E];I&&Object.keys(I).forEach(O=>{const $=I[O];$&&typeof $=="object"&&$.from===i.name&&($.loaded||$.loading?($.useIn=$.useIn.filter(A=>A!==i.name),$.useIn.length?b=!1:y.push([_,S,E,O])):y.push([_,S,E,O]))})})})}),b&&(m.shareScopeMap={},delete g[d]),y.forEach(([_,v,S,R])=>{var E,I,O;(O=g[_])==null||(I=O[v])==null||(E=I[S])==null||delete E[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,n);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])}n.moduleCache.delete(t.name)}}catch(n){logger.log("removeRemote fail: ",n)}}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={}}}class FederationHost{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,n){const s=getRemoteInfo({name:t,entry:o}),l=new Module({host:this,remoteInfo:s});return l.remoteEntryExports=n,this.moduleCache.set(t,l),l}async loadRemote(t,o){return this.remoteHandler.loadRemote(t,o)}async preloadRemote(t){return this.remoteHandler.preloadRemote(t)}initShareScopeMap(t,o,n={}){this.sharedHandler.initShareScopeMap(t,o,n)}formatOptions(t,o){const{shared:n}=formatShareConfigs(t,o),{userOptions:s,options:l}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:o,options:t,shareInfo:n}),a=this.remoteHandler.formatAndRegisterRemote(l,s),{shared:i}=this.sharedHandler.registerShared(l,s),c=[...l.plugins];s.plugins&&s.plugins.forEach(d=>{c.includes(d)||c.push(d)});const u=_extends$1({},t,o,{plugins:c,remotes:a,shared:i});return this.hooks.lifecycle.init.emit({origin:this,options:u}),u}registerPlugins(t){const o=registerPlugins$1(t,[this.hooks,this.remoteHandler.hooks,this.sharedHandler.hooks,this.snapshotHandler.hooks,this.loaderHook,this.bridgeHook]);this.options.plugins=this.options.plugins.reduce((n,s)=>(s&&n&&!n.find(l=>l.name===s.name)&&n.push(s),n),o||[])}registerRemotes(t,o){return this.remoteHandler.registerRemotes(t,o)}constructor(t){this.hooks=new PluginSystem({beforeInit:new SyncWaterfallHook("beforeInit"),init:new SyncHook,beforeInitContainer:new AsyncWaterfallHook("beforeInitContainer"),initContainer:new AsyncWaterfallHook("initContainer")}),this.version="0.8.2",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={id:getBuilderId(),name:t.name,plugins:[snapshotPlugin(),generatePreloadAssetsPlugin()],remotes:[],shared:{},inBrowser:isBrowserEnv()};this.name=t.name,this.options=o,this.snapshotHandler=new SnapshotHandler(this),this.sharedHandler=new SharedHandler(this),this.remoteHandler=new RemoteHandler(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...o.plugins,...t.plugins||[]]),this.options=this.formatOptions(o,t)}}setGlobalFederationConstructor(FederationHost);function createBridgeComponent(r){const t=new Map;return()=>({__APP_VERSION__:"0.8.2",render(o){LoggerInstance.log("createBridgeComponent render Info",o);const n=Vue__namespace.createApp(r.rootComponent);t.set(o.dom,n);const s={},l=s&&typeof s=="object"&&(s!=null&&s.extraProps)?s==null?void 0:s.extraProps:{},a=r.appOptions({basename:o.basename,memoryRoute:o.memoryRoute,...l}),i=o.memoryRoute?VueRouter__namespace.createMemoryHistory(o.basename):VueRouter__namespace.createWebHistory(o.basename),c=VueRouter__namespace.createRouter({...a.router.options,history:i,routes:a.router.getRoutes()});LoggerInstance.log("createBridgeComponent render router info>>>",{name:o.moduleName,router:c}),o.memoryRoute?c.push(o.memoryRoute.entryPath).then(()=>{n.use(c),n.mount(o.dom)}):(n.use(c),n.mount(o.dom))},destroy(o){LoggerInstance.log("createBridgeComponent destroy Info",o);const n=t.get(o==null?void 0:o.dom);n==null||n.unmount()}})}function e(){const r=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(r)}const RemoteApp=Vue.defineComponent({name:"RemoteApp",props:{moduleName:String,basename:String,memoryRoute:Object,providerInfo:Function},setup(r){const t=Vue.ref(null),o=Vue.ref(null),n=Vue.ref(""),s=VueRouter.useRoute(),l=()=>{var d;const i=(d=r.providerInfo)==null?void 0:d.call(r);o.value=i;let c={name:r.moduleName,dom:t.value,basename:r.basename,memoryRoute:r.memoryRoute};LoggerInstance.log("createRemoteComponent LazyComponent render >>>",c),c={...c,...{}.extraProps},i.render(c)},a=Vue.watch(()=>s.path,i=>{i!==s.path&&l(),n.value!==""&&n.value!==i&&(LoggerInstance.log("createRemoteComponent dispatchPopstateEnv >>>",{...r,pathname:s.path}),e()),n.value=i});return Vue.onMounted(()=>{l()}),Vue.onBeforeUnmount(()=>{var i;LoggerInstance.log("createRemoteComponent LazyComponent destroy >>>",{...r}),a(),(i=o.value)==null||i.destroy({dom:t.value})}),()=>Vue.createVNode("div",{ref:t},null)}});function createRemoteComponent(r){return Vue.defineAsyncComponent({__APP_VERSION__:"0.8.2",...r.asyncComponentOptions,loader:async()=>{var c;const t=VueRouter.useRoute();let o="/";const n=(c=t.matched[0])==null?void 0:c.path;n&&(n.endsWith("/:pathMatch(.*)*")?o=n.replace("/:pathMatch(.*)*",""):o=t.matched[0].path);const s=(r==null?void 0:r.export)||"default";LoggerInstance.log("createRemoteComponent LazyComponent create >>>",{basename:o,info:r});const l=await r.loader(),a=l&&l[Symbol.for("mf_module_id")],i=l[s];if(LoggerInstance.log("createRemoteComponent LazyComponent loadRemote info >>>",{name:a,module:l,exportName:s,basename:o,route:t}),s in l&&typeof i=="function")return{render(){return Vue.h(RemoteApp,{moduleName:a,providerInfo:i,basename:o})}};throw new Error("module not found")}})}exports.createBridgeComponent=createBridgeComponent;exports.createRemoteComponent=createRemoteComponent;
|