@module-federation/bridge-vue3 0.0.0-next-20241212123451 → 0.0.0-next-20241213035216
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 +13 -5
- package/dist/index.cjs.js +7 -7
- package/dist/index.es.js +150 -159
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
# @module-federation/bridge-vue3
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20241213035216
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- @module-federation/runtime@0.0.0-next-20241213035216
|
|
8
|
+
- @module-federation/sdk@0.0.0-next-20241213035216
|
|
9
|
+
- @module-federation/bridge-shared@0.0.0-next-20241213035216
|
|
10
|
+
|
|
11
|
+
## 0.8.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [f817674]
|
|
7
16
|
- Updated dependencies [8e172c8]
|
|
8
|
-
-
|
|
9
|
-
- @module-federation/sdk@0.
|
|
10
|
-
- @module-federation/
|
|
11
|
-
- @module-federation/bridge-shared@0.0.0-next-20241212123451
|
|
17
|
+
- @module-federation/runtime@0.8.3
|
|
18
|
+
- @module-federation/sdk@0.8.3
|
|
19
|
+
- @module-federation/bridge-shared@0.8.3
|
|
12
20
|
|
|
13
21
|
## 0.8.2
|
|
14
22
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return t.default=r,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter);var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(r,t)=>{for(var o in t)__defProp(r,o,{get:t[o],enumerable:!0})},__copyProps=(r,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of __getOwnPropNames(t))!__hasOwnProp.call(r,s)&&s!==o&&__defProp(r,s,{get:()=>t[s],enumerable:!(n=__getOwnPropDesc(t,s))||n.enumerable});return r},__toCommonJS=r=>__copyProps(__defProp({},"__esModule",{value:!0}),r),browser_exports={};__export(browser_exports,{createLogger:()=>createLogger2,logger:()=>logger$1});var browser=__toCommonJS(browser_exports),supportsSubstitutions=void 0,supportColor=()=>{if(typeof supportsSubstitutions<"u")return supportsSubstitutions;try{const r="color test",t="color: red;",o=console.log;console.log=(...n)=>{n[0]===`%c${r}`&&n[1]===t&&(supportsSubstitutions=!0)},console.log(`%c${r}`,t),console.log=o}catch{supportsSubstitutions=!1}return supportsSubstitutions},ansiToCss={bold:"font-weight: bold;",red:"color: red;",green:"color: green;",orange:"color: orange;",dodgerblue:"color: dodgerblue;",magenta:"color: magenta;",gray:"color: gray;"},formatter=r=>supportColor()?t=>{if(Array.isArray(t)){const[o,n]=t;return[`%c${o.replace("%c","")}`,n?`${ansiToCss[r]}${n}`:`${ansiToCss[r]||""}`]}return[`%c${String(t).replace("%c","")}`,ansiToCss[r]||""]}:t=>[String(t)],bold=formatter("bold"),red=formatter("red"),green=formatter("green"),orange=formatter("orange"),dodgerblue=formatter("dodgerblue"),magenta=formatter("magenta");formatter("gray");function getLabel(r,t,o){let n=[""];return"label"in t&&(n=[o[r]||t.label||""],n=bold(t.color?t.color(n):n[0])),n=n.filter(Boolean),n}function finalLog(r,t,o,n){r.length?Array.isArray(n)?console.log(...r,...n):console.log(...r,t):Array.isArray(n)?console.log(...n):console.log(t,...o)}var LOG_LEVEL={error:0,warn:1,info:2,log:3,verbose:4},errorStackRegExp=/at\s.*:\d+:\d+[\s\)]*$/,anonymousErrorStackRegExp=/at\s.*\(<anonymous>\)$/,isErrorStackMessage=r=>errorStackRegExp.test(r)||anonymousErrorStackRegExp.test(r),createLogger$1=(r={},{getLabel:t,handleError:o,finalLog:n,greet:s,LOG_TYPES:l})=>{let a=r.level||"log",i=r.labels||{},c=(d,h,...p)=>{if(LOG_LEVEL[l[d].level]>LOG_LEVEL[a])return;if(h==null)return console.log();let
|
|
2
|
-
`);
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vue=require("vue"),VueRouter=require("vue-router");function _interopNamespaceDefault(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return t.default=r,Object.freeze(t)}const Vue__namespace=_interopNamespaceDefault(Vue),VueRouter__namespace=_interopNamespaceDefault(VueRouter);var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(r,t)=>{for(var o in t)__defProp(r,o,{get:t[o],enumerable:!0})},__copyProps=(r,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of __getOwnPropNames(t))!__hasOwnProp.call(r,s)&&s!==o&&__defProp(r,s,{get:()=>t[s],enumerable:!(n=__getOwnPropDesc(t,s))||n.enumerable});return r},__toCommonJS=r=>__copyProps(__defProp({},"__esModule",{value:!0}),r),browser_exports={};__export(browser_exports,{createLogger:()=>createLogger2,logger:()=>logger$1});var browser=__toCommonJS(browser_exports),supportsSubstitutions=void 0,supportColor=()=>{if(typeof supportsSubstitutions<"u")return supportsSubstitutions;try{const r="color test",t="color: red;",o=console.log;console.log=(...n)=>{n[0]===`%c${r}`&&n[1]===t&&(supportsSubstitutions=!0)},console.log(`%c${r}`,t),console.log=o}catch{supportsSubstitutions=!1}return supportsSubstitutions},ansiToCss={bold:"font-weight: bold;",red:"color: red;",green:"color: green;",orange:"color: orange;",dodgerblue:"color: dodgerblue;",magenta:"color: magenta;",gray:"color: gray;"},formatter=r=>supportColor()?t=>{if(Array.isArray(t)){const[o,n]=t;return[`%c${o.replace("%c","")}`,n?`${ansiToCss[r]}${n}`:`${ansiToCss[r]||""}`]}return[`%c${String(t).replace("%c","")}`,ansiToCss[r]||""]}:t=>[String(t)],bold=formatter("bold"),red=formatter("red"),green=formatter("green"),orange=formatter("orange"),dodgerblue=formatter("dodgerblue"),magenta=formatter("magenta");formatter("gray");function getLabel(r,t,o){let n=[""];return"label"in t&&(n=[o[r]||t.label||""],n=bold(t.color?t.color(n):n[0])),n=n.filter(Boolean),n}function finalLog(r,t,o,n){r.length?Array.isArray(n)?console.log(...r,...n):console.log(...r,t):Array.isArray(n)?console.log(...n):console.log(t,...o)}var LOG_LEVEL={error:0,warn:1,info:2,log:3,verbose:4},errorStackRegExp=/at\s.*:\d+:\d+[\s\)]*$/,anonymousErrorStackRegExp=/at\s.*\(<anonymous>\)$/,isErrorStackMessage=r=>errorStackRegExp.test(r)||anonymousErrorStackRegExp.test(r),createLogger$1=(r={},{getLabel:t,handleError:o,finalLog:n,greet:s,LOG_TYPES:l})=>{let a=r.level||"log",i=r.labels||{},c=(d,h,...p)=>{if(LOG_LEVEL[l[d].level]>LOG_LEVEL[a])return;if(h==null)return console.log();let m=l[d],g="";const b=t(d,m,i);if(h instanceof Error)if(h.stack){let[y,..._]=h.stack.split(`
|
|
2
|
+
`);y.startsWith("Error: ")&&(y=y.slice(7)),g=`${y}
|
|
3
3
|
${o(_.join(`
|
|
4
|
-
`))}`}else g=h.message;else
|
|
4
|
+
`))}`}else g=h.message;else m.level==="error"&&typeof h=="string"?g=h.split(`
|
|
5
5
|
`).map(_=>isErrorStackMessage(_)?o(_):_).join(`
|
|
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,
|
|
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 y=extractComparator(p);if(!y)return!1;const[,g,,b,m,_,I]=y,S={operator:g,version:combineVersion(b,m,_,I),major:b,minor:m,patch:_,preRelease:I==null?void 0:I.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,m]of Object.entries(r[c][t]))if(satisfy(b,u))return m}},y={shareScopeMap:r,scope:c,pkgName:t,version:h,GlobalFederation:Global.__FEDERATION__,resolver:p};return(n.emit(y)||y).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",RUNTIME_008="RUNTIME-008",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:
|
|
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.3")}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."
|
|
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 y=h[p],g=[],b={version:this.remoteInfo.version||""};Object.defineProperty(b,"shareScopeMap",{value:h,enumerable:!1});const m=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:y,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(m.shareScope,m.initScope,m.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit(_extends$1({},m,{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 y=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(y instanceof HTMLLinkElement)return y}});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 y=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(y instanceof HTMLLinkElement)return y},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 y=t.loaderHook.lifecycle.createLink.emit({url:h,attrs:p});if(y instanceof HTMLLinkElement)return y}});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 y=t.loaderHook.lifecycle.createScript.emit({url:h,attrs:p});if(y instanceof HTMLScriptElement)return y},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,(m,_,I)=>{let S;if(I)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(m,getRemoteEntryInfoFromSnapshot(m).url);R&&i.push({name:_.name,moduleInfo:{name:_.name,entry:R,type:"remoteEntryType"in m?m.remoteEntryType:"global",entryGlobalName:"globalName"in m?m.globalName:_.name,shareScope:"",version:"version"in m?m.version:void 0},url:R});let E="modules"in m?m.modules:[];const v=normalizePreloadExposes(S.exposes);if(v.length&&"modules"in m){var O;E=m==null||(O=m.modules)==null?void 0:O.reduce((A,w)=>((v==null?void 0:v.indexOf(w.moduleName))!==-1&&A.push(w),A),[])}function $(A){const w=A.map(T=>getResourceUrl(m,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:m,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 m=(_,I)=>{const S=getRegisteredShare(r.shareScopeMap,I.sharedName,_,r.sharedHandler.hooks.lifecycle.resolveShare);S&&typeof S.lib=="function"&&(I.assets.js.sync.forEach(R=>{c.add(R)}),I.assets.css.sync.forEach(R=>{u.add(R)}))};s.shared.forEach(_=>{var I;const S=(I=d.shared)==null?void 0:I[_.sharedName];if(!S)return;const R=_.version?S.find(v=>v.version===_.version):S;if(!R)return;arrayOptions(R).forEach(v=>{m(v,_)})})}const g=a.filter(m=>!c.has(m));return{cssAssets:l.filter(m=>!u.has(m)),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,{}),y=setGlobalSnapshotInfoByModuleInfo(_extends$1({},t,{entry:h}),p);u=p,d=y}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:y}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,remoteSnapshot:h,from:"global"});u=y,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 m;const{version:_,eager:I}=b;d[g]=d[g]||{};const S=d[g],R=S[_],E=!!(R&&(R.eager||(m=R.shareConfig)!=null&&m.eager));(!R||R.strategy!=="loaded-first"&&!R.loaded&&(!I!=!E?I:u>R.from))&&(S[_]=b)},p=g=>g&&g.init&&g.init(c[t],a),y=async g=>{const{module:b}=await n.remoteHandler.getRemoteModuleAndOptions({id:g});if(b.getEntry){let m;try{m=await b.getEntry()}catch(_){m=await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:g,error:_,from:"runtime",lifecycle:"beforeLoadShare",origin:n})}b.inited||(await p(m),b.inited=!0)}};return Object.keys(n.options.shared).forEach(g=>{n.options.shared[g].forEach(m=>{m.scope.includes(t)&&h(g,m)})}),(n.options.shareStrategy==="version-first"||l==="version-first")&&n.options.remotes.forEach(g=>{g.shareScope===t&&i.push(y(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 y=this.shareScopeMap[p][t][c];l&&!y.loading&&(y.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,y=await l.get(h,d,o,p),g=await this.hooks.lifecycle.onLoad.emit({id:h,pkgNameOrAlias:c,expose:d,exposeModule:s?y:void 0,exposeModuleFactory:s?void 0:y,remote:u,options:a,moduleInstance:l,origin:n});return this.setIdToRemoteMap(t,i),typeof g=="function"?g:y}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 y={host:o,remoteInfo:c};return p||(p=new Module(y),o.moduleCache.set(d.name,p)),{module:p,moduleOptions:y,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(y=>i.buildVersion?y.options.id===d:y.name===d);if(h!==-1){const y=CurrentGlobal.__FEDERATION__.__INSTANCES__[h];d=y.options.id||d;const g=getGlobalShareScope();let b=!0;const m=[];Object.keys(g).forEach(_=>{const I=g[_];I&&Object.keys(I).forEach(S=>{const R=I[S];R&&Object.keys(R).forEach(E=>{const v=R[E];v&&Object.keys(v).forEach(O=>{const $=v[O];$&&typeof $=="object"&&$.from===i.name&&($.loaded||$.loading?($.useIn=$.useIn.filter(A=>A!==i.name),$.useIn.length?b=!1:m.push([_,S,E,O])):m.push([_,S,E,O]))})})})}),b&&(y.shareScopeMap={},delete g[d]),m.forEach(([_,I,S,R])=>{var E,v,O;(O=g[_])==null||(v=O[I])==null||(E=v[S])==null||delete E[R]}),CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(h,1)}const{hostGlobalSnapshot:p}=getGlobalRemoteInfo(t,n);if(p){const y=p&&"remotesInfo"in p&&p.remotesInfo&&getInfoWithoutType(p.remotesInfo,t.name).key;y&&(delete p.remotesInfo[y],Global.__FEDERATION__.__MANIFEST_LOADING__[y]&&delete Global.__FEDERATION__.__MANIFEST_LOADING__[y])}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;
|
|
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 w=p.find(A=>A.nameOrAlias===_.name||A.nameOrAlias===_.alias);if(!w)return;S=defaultPreloadArgs(w)}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((w,A)=>((I==null?void 0:I.indexOf(A.moduleName))!==-1&&w.push(A),w),[])}function $(w){const A=w.map(P=>getResourceUrl(y,P));return S.filter?A.filter(S.filter):A}if(E){const w=E.length;for(let A=0;A<w;A++){const P=E[A],T=`${_.name}/${P.moduleName}`;r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:P.moduleName==="."?_.name:T,name:_.name,remoteSnapshot:y,preloadConfig:S,remote:_,origin:r}),!getPreloaded(T)&&(S.resourceCategory==="all"?(l.push(...$(P.assets.css.async)),l.push(...$(P.assets.css.sync)),a.push(...$(P.assets.js.async)),a.push(...$(P.assets.js.sync))):(S.resourceCategory="sync")&&(l.push(...$(P.assets.css.sync)),a.push(...$(P.assets.js.sync))),setPreloaded(T))}}},!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.`,"Please note that overriding it may cause unexpected errors."];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(w=>w!==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.3",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.3",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.3",...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;
|
package/dist/index.es.js
CHANGED
|
@@ -62,19 +62,19 @@ var LOG_LEVEL = {
|
|
|
62
62
|
return;
|
|
63
63
|
if (p == null)
|
|
64
64
|
return console.log();
|
|
65
|
-
let
|
|
66
|
-
const R = t(d,
|
|
65
|
+
let y = l[d], _ = "";
|
|
66
|
+
const R = t(d, y, i);
|
|
67
67
|
if (p instanceof Error)
|
|
68
68
|
if (p.stack) {
|
|
69
|
-
let [
|
|
69
|
+
let [g, ...E] = p.stack.split(`
|
|
70
70
|
`);
|
|
71
|
-
|
|
71
|
+
g.startsWith("Error: ") && (g = g.slice(7)), _ = `${g}
|
|
72
72
|
${o(E.join(`
|
|
73
73
|
`))}`;
|
|
74
74
|
} else
|
|
75
75
|
_ = p.message;
|
|
76
76
|
else
|
|
77
|
-
|
|
77
|
+
y.level === "error" && typeof p == "string" ? _ = p.split(`
|
|
78
78
|
`).map((E) => isErrorStackMessage(E) ? o(E) : E).join(`
|
|
79
79
|
`) : _ = `${p}`;
|
|
80
80
|
n(R, _, m, p);
|
|
@@ -269,10 +269,10 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
269
269
|
if (!Object.keys(s).length) {
|
|
270
270
|
var p;
|
|
271
271
|
d = ((p = r.remotes) == null ? void 0 : p.reduce((b, $) => {
|
|
272
|
-
let
|
|
272
|
+
let A;
|
|
273
273
|
const O = $.federationContainerName;
|
|
274
|
-
return u.includes(O) ?
|
|
275
|
-
matchedVersion:
|
|
274
|
+
return u.includes(O) ? A = l[O] : "version" in $ ? A = $.version : A = $.entry, b[O] = {
|
|
275
|
+
matchedVersion: A
|
|
276
276
|
}, b;
|
|
277
277
|
}, {})) || {};
|
|
278
278
|
}
|
|
@@ -280,12 +280,12 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
280
280
|
// overrides will override dependencies
|
|
281
281
|
matchedVersion: u.includes(b) ? l[b] : s[b]
|
|
282
282
|
});
|
|
283
|
-
const { remoteEntry: { path: m, name:
|
|
283
|
+
const { remoteEntry: { path: m, name: y, type: _ }, types: R, buildInfo: { buildVersion: g }, globalName: E, ssrRemoteEntry: I } = r.metaData, { exposes: v } = r;
|
|
284
284
|
let S = {
|
|
285
285
|
version: a || "",
|
|
286
|
-
buildVersion:
|
|
286
|
+
buildVersion: g,
|
|
287
287
|
globalName: E,
|
|
288
|
-
remoteEntry: simpleJoinRemoteEntry(m,
|
|
288
|
+
remoteEntry: simpleJoinRemoteEntry(m, y),
|
|
289
289
|
remoteEntryType: _,
|
|
290
290
|
remoteTypes: simpleJoinRemoteEntry(R.path, R.name),
|
|
291
291
|
remoteTypesZip: R.zip || "",
|
|
@@ -296,7 +296,7 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
296
296
|
sharedName: b.name,
|
|
297
297
|
version: b.version
|
|
298
298
|
})),
|
|
299
|
-
modules:
|
|
299
|
+
modules: v == null ? void 0 : v.map((b) => ({
|
|
300
300
|
moduleName: b.name,
|
|
301
301
|
modulePath: b.path,
|
|
302
302
|
assets: b.assets
|
|
@@ -309,19 +309,19 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
if ((n = r.metaData) != null && n.prefetchEntry) {
|
|
312
|
-
const { path: b, name: $, type:
|
|
312
|
+
const { path: b, name: $, type: A } = r.metaData.prefetchEntry;
|
|
313
313
|
S = _extends$2({}, S, {
|
|
314
314
|
prefetchEntry: simpleJoinRemoteEntry(b, $),
|
|
315
|
-
prefetchEntryType:
|
|
315
|
+
prefetchEntryType: A
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
if ("publicPath" in r.metaData ? i = _extends$2({}, S, {
|
|
319
319
|
publicPath: c()
|
|
320
320
|
}) : i = _extends$2({}, S, {
|
|
321
321
|
getPublicPath: c()
|
|
322
|
-
}),
|
|
323
|
-
const b = simpleJoinRemoteEntry(
|
|
324
|
-
i.ssrRemoteEntry = b, i.ssrRemoteEntryType =
|
|
322
|
+
}), I) {
|
|
323
|
+
const b = simpleJoinRemoteEntry(I.path, I.name);
|
|
324
|
+
i.ssrRemoteEntry = b, i.ssrRemoteEntryType = I.type || "commonjs-module";
|
|
325
325
|
}
|
|
326
326
|
return i;
|
|
327
327
|
}
|
|
@@ -341,7 +341,7 @@ function isStaticResourcesEqual(r, t) {
|
|
|
341
341
|
return n === s;
|
|
342
342
|
}
|
|
343
343
|
function createScript(r) {
|
|
344
|
-
let t = null, o = !0, n =
|
|
344
|
+
let t = null, o = !0, n = 2e4, s;
|
|
345
345
|
const l = document.getElementsByTagName("script");
|
|
346
346
|
for (let i = 0; i < l.length; i++) {
|
|
347
347
|
const c = l[i], u = c.getAttribute("src");
|
|
@@ -359,22 +359,21 @@ function createScript(r) {
|
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
const a = async (i, c) => {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
367
|
-
const { needDeleteScript: d = !0 } = r;
|
|
368
|
-
d && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
362
|
+
var u;
|
|
363
|
+
if (clearTimeout(s), t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
364
|
+
const { needDeleteScript: m = !0 } = r;
|
|
365
|
+
m && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
369
366
|
}), i && typeof i == "function")) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
367
|
+
var d;
|
|
368
|
+
const m = i(c);
|
|
369
|
+
if (m instanceof Promise) {
|
|
370
|
+
var p;
|
|
371
|
+
const y = await m;
|
|
372
|
+
return r == null || (p = r.cb) == null || p.call(r), y;
|
|
374
373
|
}
|
|
375
|
-
return
|
|
374
|
+
return r == null || (d = r.cb) == null || d.call(r), m;
|
|
376
375
|
}
|
|
377
|
-
u();
|
|
376
|
+
r == null || (u = r.cb) == null || u.call(r);
|
|
378
377
|
};
|
|
379
378
|
return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), s = setTimeout(() => {
|
|
380
379
|
a(null, new Error(`Remote script "${r.url}" time-outed.`));
|
|
@@ -402,17 +401,14 @@ function createLink(r) {
|
|
|
402
401
|
});
|
|
403
402
|
}
|
|
404
403
|
const s = (l, a) => {
|
|
405
|
-
const i = () => {
|
|
406
|
-
a.type === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(a)) : r != null && r.cb && (r == null || r.cb());
|
|
407
|
-
};
|
|
408
404
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
409
|
-
const { needDeleteLink:
|
|
410
|
-
|
|
405
|
+
const { needDeleteLink: i = !0 } = r;
|
|
406
|
+
i && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
411
407
|
}), l)) {
|
|
412
|
-
const
|
|
413
|
-
return
|
|
408
|
+
const i = l(a);
|
|
409
|
+
return r.cb(), i;
|
|
414
410
|
}
|
|
415
|
-
|
|
411
|
+
r.cb();
|
|
416
412
|
};
|
|
417
413
|
return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), {
|
|
418
414
|
link: t,
|
|
@@ -425,7 +421,6 @@ function loadScript(r, t) {
|
|
|
425
421
|
const { script: a, needAttach: i } = createScript({
|
|
426
422
|
url: r,
|
|
427
423
|
cb: s,
|
|
428
|
-
onErrorCallback: l,
|
|
429
424
|
attrs: _extends$2({
|
|
430
425
|
fetchpriority: "high"
|
|
431
426
|
}, o),
|
|
@@ -652,7 +647,7 @@ function setGlobalDefaultVal(r) {
|
|
|
652
647
|
setGlobalDefaultVal(CurrentGlobal);
|
|
653
648
|
setGlobalDefaultVal(nativeGlobal);
|
|
654
649
|
function setGlobalFederationConstructor(r, t = isDebugMode()) {
|
|
655
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.8.
|
|
650
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.8.3");
|
|
656
651
|
}
|
|
657
652
|
function getInfoWithoutType(r, t) {
|
|
658
653
|
if (typeof t == "string") {
|
|
@@ -846,18 +841,18 @@ function satisfy(r, t) {
|
|
|
846
841
|
preRelease: d == null ? void 0 : d.split(".")
|
|
847
842
|
};
|
|
848
843
|
for (const m of s) {
|
|
849
|
-
const
|
|
850
|
-
if (!
|
|
844
|
+
const y = extractComparator(m);
|
|
845
|
+
if (!y)
|
|
851
846
|
return !1;
|
|
852
|
-
const [, _, , R,
|
|
847
|
+
const [, _, , R, g, E, I] = y, v = {
|
|
853
848
|
operator: _,
|
|
854
|
-
version: combineVersion(R,
|
|
849
|
+
version: combineVersion(R, g, E, I),
|
|
855
850
|
major: R,
|
|
856
|
-
minor:
|
|
851
|
+
minor: g,
|
|
857
852
|
patch: E,
|
|
858
|
-
preRelease:
|
|
853
|
+
preRelease: I == null ? void 0 : I.split(".")
|
|
859
854
|
};
|
|
860
|
-
if (!compare(
|
|
855
|
+
if (!compare(v, p))
|
|
861
856
|
return !1;
|
|
862
857
|
}
|
|
863
858
|
return !0;
|
|
@@ -958,11 +953,11 @@ function getRegisteredShare(r, t, o, n) {
|
|
|
958
953
|
} else {
|
|
959
954
|
if (u === !1 || u === "*" || satisfy(p, u))
|
|
960
955
|
return r[c][t][p];
|
|
961
|
-
for (const [R,
|
|
956
|
+
for (const [R, g] of Object.entries(r[c][t]))
|
|
962
957
|
if (satisfy(R, u))
|
|
963
|
-
return
|
|
958
|
+
return g;
|
|
964
959
|
}
|
|
965
|
-
},
|
|
960
|
+
}, y = {
|
|
966
961
|
shareScopeMap: r,
|
|
967
962
|
scope: c,
|
|
968
963
|
pkgName: t,
|
|
@@ -970,7 +965,7 @@ function getRegisteredShare(r, t, o, n) {
|
|
|
970
965
|
GlobalFederation: Global.__FEDERATION__,
|
|
971
966
|
resolver: m
|
|
972
967
|
};
|
|
973
|
-
return (n.emit(
|
|
968
|
+
return (n.emit(y) || y).resolver();
|
|
974
969
|
}
|
|
975
970
|
}
|
|
976
971
|
function getGlobalShareScope() {
|
|
@@ -993,7 +988,7 @@ function getTargetSharedOptions(r) {
|
|
|
993
988
|
const a = (l = o == null ? void 0 : o.resolver) != null ? l : s;
|
|
994
989
|
return Object.assign({}, a(n[t]), o == null ? void 0 : o.customShareInfo);
|
|
995
990
|
}
|
|
996
|
-
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",
|
|
991
|
+
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) => {
|
|
997
992
|
const s = [
|
|
998
993
|
`${[
|
|
999
994
|
t[r]
|
|
@@ -1020,8 +1015,7 @@ const runtimeDescMap = {
|
|
|
1020
1015
|
[RUNTIME_004]: "Failed to locate remote.",
|
|
1021
1016
|
[RUNTIME_005]: "Invalid loadShareSync function call from bundler runtime",
|
|
1022
1017
|
[RUNTIME_006]: "Invalid loadShareSync function call from runtime",
|
|
1023
|
-
[RUNTIME_007]: "Failed to get remote snapshot."
|
|
1024
|
-
[RUNTIME_008]: "Failed to load script resources."
|
|
1018
|
+
[RUNTIME_007]: "Failed to get remote snapshot."
|
|
1025
1019
|
}, typeDescMap = {
|
|
1026
1020
|
[TYPE_001]: "Failed to generate type declaration."
|
|
1027
1021
|
};
|
|
@@ -1127,10 +1121,7 @@ async function loadEntryScript({ name: r, globalName: t, entry: o, loaderHook: n
|
|
|
1127
1121
|
remoteEntryKey: l
|
|
1128
1122
|
})), a;
|
|
1129
1123
|
}).catch((l) => {
|
|
1130
|
-
throw
|
|
1131
|
-
remoteName: r,
|
|
1132
|
-
resourceUrl: o
|
|
1133
|
-
})), l;
|
|
1124
|
+
throw l;
|
|
1134
1125
|
});
|
|
1135
1126
|
}
|
|
1136
1127
|
async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook: o }) {
|
|
@@ -1251,7 +1242,7 @@ let Module = class {
|
|
|
1251
1242
|
if (!this.inited) {
|
|
1252
1243
|
const p = this.host.shareScopeMap, m = this.remoteInfo.shareScope || "default";
|
|
1253
1244
|
p[m] || (p[m] = {});
|
|
1254
|
-
const
|
|
1245
|
+
const y = p[m], _ = [], R = {
|
|
1255
1246
|
version: this.remoteInfo.version || ""
|
|
1256
1247
|
};
|
|
1257
1248
|
Object.defineProperty(R, "shareScopeMap", {
|
|
@@ -1259,8 +1250,8 @@ let Module = class {
|
|
|
1259
1250
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1260
1251
|
enumerable: !1
|
|
1261
1252
|
});
|
|
1262
|
-
const
|
|
1263
|
-
shareScope:
|
|
1253
|
+
const g = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1254
|
+
shareScope: y,
|
|
1264
1255
|
// @ts-ignore shareScopeMap will be set by Object.defineProperty
|
|
1265
1256
|
remoteEntryInitOptions: R,
|
|
1266
1257
|
initScope: _,
|
|
@@ -1271,7 +1262,7 @@ let Module = class {
|
|
|
1271
1262
|
remoteName: name,
|
|
1272
1263
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1273
1264
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1274
|
-
})), await a.init(
|
|
1265
|
+
})), await a.init(g.shareScope, g.initScope, g.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit(_extends$1({}, g, {
|
|
1275
1266
|
id: t,
|
|
1276
1267
|
remoteSnapshot: s,
|
|
1277
1268
|
remoteEntryExports: a
|
|
@@ -1478,12 +1469,12 @@ function preloadAssets(r, t, o, n = !0) {
|
|
|
1478
1469
|
},
|
|
1479
1470
|
attrs: i,
|
|
1480
1471
|
createLinkHook: (p, m) => {
|
|
1481
|
-
const
|
|
1472
|
+
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1482
1473
|
url: p,
|
|
1483
1474
|
attrs: m
|
|
1484
1475
|
});
|
|
1485
|
-
if (
|
|
1486
|
-
return
|
|
1476
|
+
if (y instanceof HTMLLinkElement)
|
|
1477
|
+
return y;
|
|
1487
1478
|
}
|
|
1488
1479
|
});
|
|
1489
1480
|
d && document.head.appendChild(u);
|
|
@@ -1500,12 +1491,12 @@ function preloadAssets(r, t, o, n = !0) {
|
|
|
1500
1491
|
},
|
|
1501
1492
|
attrs: i,
|
|
1502
1493
|
createLinkHook: (p, m) => {
|
|
1503
|
-
const
|
|
1494
|
+
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1504
1495
|
url: p,
|
|
1505
1496
|
attrs: m
|
|
1506
1497
|
});
|
|
1507
|
-
if (
|
|
1508
|
-
return
|
|
1498
|
+
if (y instanceof HTMLLinkElement)
|
|
1499
|
+
return y;
|
|
1509
1500
|
},
|
|
1510
1501
|
needDeleteLink: !1
|
|
1511
1502
|
});
|
|
@@ -1524,12 +1515,12 @@ function preloadAssets(r, t, o, n = !0) {
|
|
|
1524
1515
|
},
|
|
1525
1516
|
attrs: i,
|
|
1526
1517
|
createLinkHook: (p, m) => {
|
|
1527
|
-
const
|
|
1518
|
+
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1528
1519
|
url: p,
|
|
1529
1520
|
attrs: m
|
|
1530
1521
|
});
|
|
1531
|
-
if (
|
|
1532
|
-
return
|
|
1522
|
+
if (y instanceof HTMLLinkElement)
|
|
1523
|
+
return y;
|
|
1533
1524
|
}
|
|
1534
1525
|
});
|
|
1535
1526
|
d && document.head.appendChild(u);
|
|
@@ -1546,12 +1537,12 @@ function preloadAssets(r, t, o, n = !0) {
|
|
|
1546
1537
|
},
|
|
1547
1538
|
attrs: i,
|
|
1548
1539
|
createScriptHook: (p, m) => {
|
|
1549
|
-
const
|
|
1540
|
+
const y = t.loaderHook.lifecycle.createScript.emit({
|
|
1550
1541
|
url: p,
|
|
1551
1542
|
attrs: m
|
|
1552
1543
|
});
|
|
1553
|
-
if (
|
|
1554
|
-
return
|
|
1544
|
+
if (y instanceof HTMLScriptElement)
|
|
1545
|
+
return y;
|
|
1555
1546
|
},
|
|
1556
1547
|
needDeleteScript: !0
|
|
1557
1548
|
});
|
|
@@ -1632,81 +1623,81 @@ function traverseModuleInfo(r, t, o, n, s = {}, l) {
|
|
|
1632
1623
|
}
|
|
1633
1624
|
function generatePreloadAssets(r, t, o, n, s) {
|
|
1634
1625
|
const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: p } = t, { depsRemote: m } = p;
|
|
1635
|
-
if (traverseModuleInfo(n, o, (
|
|
1636
|
-
let
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1626
|
+
if (traverseModuleInfo(n, o, (g, E, I) => {
|
|
1627
|
+
let v;
|
|
1628
|
+
if (I)
|
|
1629
|
+
v = p;
|
|
1639
1630
|
else if (Array.isArray(m)) {
|
|
1640
|
-
const T = m.find((
|
|
1631
|
+
const T = m.find((w) => w.nameOrAlias === E.name || w.nameOrAlias === E.alias);
|
|
1641
1632
|
if (!T)
|
|
1642
1633
|
return;
|
|
1643
|
-
|
|
1634
|
+
v = defaultPreloadArgs(T);
|
|
1644
1635
|
} else if (m === !0)
|
|
1645
|
-
|
|
1636
|
+
v = p;
|
|
1646
1637
|
else
|
|
1647
1638
|
return;
|
|
1648
|
-
const S = getResourceUrl(
|
|
1639
|
+
const S = getResourceUrl(g, getRemoteEntryInfoFromSnapshot(g).url);
|
|
1649
1640
|
S && i.push({
|
|
1650
1641
|
name: E.name,
|
|
1651
1642
|
moduleInfo: {
|
|
1652
1643
|
name: E.name,
|
|
1653
1644
|
entry: S,
|
|
1654
|
-
type: "remoteEntryType" in
|
|
1655
|
-
entryGlobalName: "globalName" in
|
|
1645
|
+
type: "remoteEntryType" in g ? g.remoteEntryType : "global",
|
|
1646
|
+
entryGlobalName: "globalName" in g ? g.globalName : E.name,
|
|
1656
1647
|
shareScope: "",
|
|
1657
|
-
version: "version" in
|
|
1648
|
+
version: "version" in g ? g.version : void 0
|
|
1658
1649
|
},
|
|
1659
1650
|
url: S
|
|
1660
1651
|
});
|
|
1661
|
-
let b = "modules" in
|
|
1662
|
-
const $ = normalizePreloadExposes(
|
|
1663
|
-
if ($.length && "modules" in
|
|
1664
|
-
var
|
|
1665
|
-
b =
|
|
1652
|
+
let b = "modules" in g ? g.modules : [];
|
|
1653
|
+
const $ = normalizePreloadExposes(v.exposes);
|
|
1654
|
+
if ($.length && "modules" in g) {
|
|
1655
|
+
var A;
|
|
1656
|
+
b = g == null || (A = g.modules) == null ? void 0 : A.reduce((T, w) => (($ == null ? void 0 : $.indexOf(w.moduleName)) !== -1 && T.push(w), T), []);
|
|
1666
1657
|
}
|
|
1667
1658
|
function O(T) {
|
|
1668
|
-
const
|
|
1669
|
-
return
|
|
1659
|
+
const w = T.map((P) => getResourceUrl(g, P));
|
|
1660
|
+
return v.filter ? w.filter(v.filter) : w;
|
|
1670
1661
|
}
|
|
1671
1662
|
if (b) {
|
|
1672
1663
|
const T = b.length;
|
|
1673
|
-
for (let
|
|
1674
|
-
const P = b[
|
|
1664
|
+
for (let w = 0; w < T; w++) {
|
|
1665
|
+
const P = b[w], M = `${E.name}/${P.moduleName}`;
|
|
1675
1666
|
r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1676
1667
|
id: P.moduleName === "." ? E.name : M,
|
|
1677
1668
|
name: E.name,
|
|
1678
|
-
remoteSnapshot:
|
|
1679
|
-
preloadConfig:
|
|
1669
|
+
remoteSnapshot: g,
|
|
1670
|
+
preloadConfig: v,
|
|
1680
1671
|
remote: E,
|
|
1681
1672
|
origin: r
|
|
1682
|
-
}), !getPreloaded(M) && (
|
|
1673
|
+
}), !getPreloaded(M) && (v.resourceCategory === "all" ? (l.push(...O(P.assets.css.async)), l.push(...O(P.assets.css.sync)), a.push(...O(P.assets.js.async)), a.push(...O(P.assets.js.sync))) : (v.resourceCategory = "sync") && (l.push(...O(P.assets.css.sync)), a.push(...O(P.assets.js.sync))), setPreloaded(M));
|
|
1683
1674
|
}
|
|
1684
1675
|
}
|
|
1685
1676
|
}, !0, {}, s), s.shared) {
|
|
1686
|
-
const
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1677
|
+
const g = (E, I) => {
|
|
1678
|
+
const v = getRegisteredShare(r.shareScopeMap, I.sharedName, E, r.sharedHandler.hooks.lifecycle.resolveShare);
|
|
1679
|
+
v && typeof v.lib == "function" && (I.assets.js.sync.forEach((S) => {
|
|
1689
1680
|
c.add(S);
|
|
1690
|
-
}),
|
|
1681
|
+
}), I.assets.css.sync.forEach((S) => {
|
|
1691
1682
|
u.add(S);
|
|
1692
1683
|
}));
|
|
1693
1684
|
};
|
|
1694
1685
|
s.shared.forEach((E) => {
|
|
1695
|
-
var
|
|
1696
|
-
const
|
|
1697
|
-
if (!
|
|
1686
|
+
var I;
|
|
1687
|
+
const v = (I = d.shared) == null ? void 0 : I[E.sharedName];
|
|
1688
|
+
if (!v)
|
|
1698
1689
|
return;
|
|
1699
|
-
const S = E.version ?
|
|
1690
|
+
const S = E.version ? v.find(($) => $.version === E.version) : v;
|
|
1700
1691
|
if (!S)
|
|
1701
1692
|
return;
|
|
1702
1693
|
arrayOptions(S).forEach(($) => {
|
|
1703
|
-
|
|
1694
|
+
g($, E);
|
|
1704
1695
|
});
|
|
1705
1696
|
});
|
|
1706
1697
|
}
|
|
1707
|
-
const _ = a.filter((
|
|
1698
|
+
const _ = a.filter((g) => !c.has(g));
|
|
1708
1699
|
return {
|
|
1709
|
-
cssAssets: l.filter((
|
|
1700
|
+
cssAssets: l.filter((g) => !u.has(g)),
|
|
1710
1701
|
jsAssetsWithoutEntry: _,
|
|
1711
1702
|
entryAssets: i
|
|
1712
1703
|
};
|
|
@@ -1803,12 +1794,12 @@ class SnapshotHandler {
|
|
|
1803
1794
|
let u, d;
|
|
1804
1795
|
if (i)
|
|
1805
1796
|
if (isManifestProvider(i)) {
|
|
1806
|
-
const p = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", m = await this.getManifestJson(p, t, {}),
|
|
1797
|
+
const p = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", m = await this.getManifestJson(p, t, {}), y = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
|
|
1807
1798
|
// The global remote may be overridden
|
|
1808
1799
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1809
1800
|
entry: p
|
|
1810
1801
|
}), m);
|
|
1811
|
-
u = m, d =
|
|
1802
|
+
u = m, d = y;
|
|
1812
1803
|
} else {
|
|
1813
1804
|
const { remoteSnapshot: p } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1814
1805
|
options: this.HostInstance.options,
|
|
@@ -1819,13 +1810,13 @@ class SnapshotHandler {
|
|
|
1819
1810
|
u = p, d = c;
|
|
1820
1811
|
}
|
|
1821
1812
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1822
|
-
const p = await this.getManifestJson(t.entry, t, {}), m = setGlobalSnapshotInfoByModuleInfo(t, p), { remoteSnapshot:
|
|
1813
|
+
const p = await this.getManifestJson(t.entry, t, {}), m = setGlobalSnapshotInfoByModuleInfo(t, p), { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1823
1814
|
options: this.HostInstance.options,
|
|
1824
1815
|
moduleInfo: t,
|
|
1825
1816
|
remoteSnapshot: p,
|
|
1826
1817
|
from: "global"
|
|
1827
1818
|
});
|
|
1828
|
-
u =
|
|
1819
|
+
u = y, d = m;
|
|
1829
1820
|
} else
|
|
1830
1821
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1831
1822
|
hostName: t.name,
|
|
@@ -1985,21 +1976,21 @@ class SharedHandler {
|
|
|
1985
1976
|
const c = this.shareScopeMap, u = n.options.name;
|
|
1986
1977
|
c[t] || (c[t] = {});
|
|
1987
1978
|
const d = c[t], p = (_, R) => {
|
|
1988
|
-
var
|
|
1989
|
-
const { version: E, eager:
|
|
1979
|
+
var g;
|
|
1980
|
+
const { version: E, eager: I } = R;
|
|
1990
1981
|
d[_] = d[_] || {};
|
|
1991
|
-
const
|
|
1992
|
-
(!S || S.strategy !== "loaded-first" && !S.loaded && (!
|
|
1993
|
-
}, m = (_) => _ && _.init && _.init(c[t], a),
|
|
1982
|
+
const v = d[_], S = v[E], b = !!(S && (S.eager || (g = S.shareConfig) != null && g.eager));
|
|
1983
|
+
(!S || S.strategy !== "loaded-first" && !S.loaded && (!I != !b ? I : u > S.from)) && (v[E] = R);
|
|
1984
|
+
}, m = (_) => _ && _.init && _.init(c[t], a), y = async (_) => {
|
|
1994
1985
|
const { module: R } = await n.remoteHandler.getRemoteModuleAndOptions({
|
|
1995
1986
|
id: _
|
|
1996
1987
|
});
|
|
1997
1988
|
if (R.getEntry) {
|
|
1998
|
-
let
|
|
1989
|
+
let g;
|
|
1999
1990
|
try {
|
|
2000
|
-
|
|
1991
|
+
g = await R.getEntry();
|
|
2001
1992
|
} catch (E) {
|
|
2002
|
-
|
|
1993
|
+
g = await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2003
1994
|
id: _,
|
|
2004
1995
|
error: E,
|
|
2005
1996
|
from: "runtime",
|
|
@@ -2007,15 +1998,15 @@ class SharedHandler {
|
|
|
2007
1998
|
origin: n
|
|
2008
1999
|
});
|
|
2009
2000
|
}
|
|
2010
|
-
R.inited || (await m(
|
|
2001
|
+
R.inited || (await m(g), R.inited = !0);
|
|
2011
2002
|
}
|
|
2012
2003
|
};
|
|
2013
2004
|
return Object.keys(n.options.shared).forEach((_) => {
|
|
2014
|
-
n.options.shared[_].forEach((
|
|
2015
|
-
|
|
2005
|
+
n.options.shared[_].forEach((g) => {
|
|
2006
|
+
g.scope.includes(t) && p(_, g);
|
|
2016
2007
|
});
|
|
2017
2008
|
}), (n.options.shareStrategy === "version-first" || l === "version-first") && n.options.remotes.forEach((_) => {
|
|
2018
|
-
_.shareScope === t && i.push(
|
|
2009
|
+
_.shareScope === t && i.push(y(_.name));
|
|
2019
2010
|
}), i;
|
|
2020
2011
|
}
|
|
2021
2012
|
// The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
|
|
@@ -2106,8 +2097,8 @@ class SharedHandler {
|
|
|
2106
2097
|
}), i && (this.shareScopeMap[m][t][c].get = i);
|
|
2107
2098
|
return;
|
|
2108
2099
|
}
|
|
2109
|
-
const
|
|
2110
|
-
l && !
|
|
2100
|
+
const y = this.shareScopeMap[m][t][c];
|
|
2101
|
+
l && !y.loading && (y.loading = l);
|
|
2111
2102
|
});
|
|
2112
2103
|
}
|
|
2113
2104
|
_setGlobalShareScopeMap(t) {
|
|
@@ -2162,18 +2153,18 @@ class RemoteHandler {
|
|
|
2162
2153
|
loadFactory: !0
|
|
2163
2154
|
}, { module: l, moduleOptions: a, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
|
|
2164
2155
|
id: t
|
|
2165
|
-
}), { pkgNameOrAlias: c, remote: u, expose: d, id: p, remoteSnapshot: m } = i,
|
|
2156
|
+
}), { pkgNameOrAlias: c, remote: u, expose: d, id: p, remoteSnapshot: m } = i, y = await l.get(p, d, o, m), _ = await this.hooks.lifecycle.onLoad.emit({
|
|
2166
2157
|
id: p,
|
|
2167
2158
|
pkgNameOrAlias: c,
|
|
2168
2159
|
expose: d,
|
|
2169
|
-
exposeModule: s ?
|
|
2170
|
-
exposeModuleFactory: s ? void 0 :
|
|
2160
|
+
exposeModule: s ? y : void 0,
|
|
2161
|
+
exposeModuleFactory: s ? void 0 : y,
|
|
2171
2162
|
remote: u,
|
|
2172
2163
|
options: a,
|
|
2173
2164
|
moduleInstance: l,
|
|
2174
2165
|
origin: n
|
|
2175
2166
|
});
|
|
2176
|
-
return this.setIdToRemoteMap(t, i), typeof _ == "function" ? _ :
|
|
2167
|
+
return this.setIdToRemoteMap(t, i), typeof _ == "function" ? _ : y;
|
|
2177
2168
|
} catch (s) {
|
|
2178
2169
|
const { from: l = "runtime" } = o || {
|
|
2179
2170
|
from: "runtime"
|
|
@@ -2252,13 +2243,13 @@ class RemoteHandler {
|
|
|
2252
2243
|
})), { remote: d, expose: p } = u;
|
|
2253
2244
|
assert(d && p, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${l}.`);
|
|
2254
2245
|
let m = o.moduleCache.get(d.name);
|
|
2255
|
-
const
|
|
2246
|
+
const y = {
|
|
2256
2247
|
host: o,
|
|
2257
2248
|
remoteInfo: c
|
|
2258
2249
|
};
|
|
2259
|
-
return m || (m = new Module(
|
|
2250
|
+
return m || (m = new Module(y), o.moduleCache.set(d.name, m)), {
|
|
2260
2251
|
module: m,
|
|
2261
|
-
moduleOptions:
|
|
2252
|
+
moduleOptions: y,
|
|
2262
2253
|
remoteMatchInfo: u
|
|
2263
2254
|
};
|
|
2264
2255
|
}
|
|
@@ -2286,12 +2277,12 @@ class RemoteHandler {
|
|
|
2286
2277
|
else {
|
|
2287
2278
|
const i = [
|
|
2288
2279
|
`The remote "${t.name}" is already registered.`,
|
|
2289
|
-
|
|
2280
|
+
"Please note that overriding it may cause unexpected errors."
|
|
2290
2281
|
];
|
|
2291
2282
|
n != null && n.force && (this.removeRemote(a), l(), o.push(t), this.hooks.lifecycle.registerRemote.emit({
|
|
2292
2283
|
remote: t,
|
|
2293
2284
|
origin: s
|
|
2294
|
-
})
|
|
2285
|
+
}), warn$1(i.join(" ")));
|
|
2295
2286
|
}
|
|
2296
2287
|
}
|
|
2297
2288
|
removeRemote(t) {
|
|
@@ -2308,44 +2299,44 @@ class RemoteHandler {
|
|
|
2308
2299
|
const u = getRemoteEntryUniqueKey(a.remoteInfo);
|
|
2309
2300
|
globalLoading[u] && delete globalLoading[u], n.snapshotHandler.manifestCache.delete(i.entry);
|
|
2310
2301
|
let d = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
|
|
2311
|
-
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((
|
|
2302
|
+
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === d : y.name === d);
|
|
2312
2303
|
if (p !== -1) {
|
|
2313
|
-
const
|
|
2314
|
-
d =
|
|
2304
|
+
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[p];
|
|
2305
|
+
d = y.options.id || d;
|
|
2315
2306
|
const _ = getGlobalShareScope();
|
|
2316
2307
|
let R = !0;
|
|
2317
|
-
const
|
|
2308
|
+
const g = [];
|
|
2318
2309
|
Object.keys(_).forEach((E) => {
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2321
|
-
const S = v
|
|
2310
|
+
const I = _[E];
|
|
2311
|
+
I && Object.keys(I).forEach((v) => {
|
|
2312
|
+
const S = I[v];
|
|
2322
2313
|
S && Object.keys(S).forEach((b) => {
|
|
2323
2314
|
const $ = S[b];
|
|
2324
|
-
$ && Object.keys($).forEach((
|
|
2325
|
-
const O = $[
|
|
2326
|
-
O && typeof O == "object" && O.from === i.name && (O.loaded || O.loading ? (O.useIn = O.useIn.filter((T) => T !== i.name), O.useIn.length ? R = !1 :
|
|
2315
|
+
$ && Object.keys($).forEach((A) => {
|
|
2316
|
+
const O = $[A];
|
|
2317
|
+
O && typeof O == "object" && O.from === i.name && (O.loaded || O.loading ? (O.useIn = O.useIn.filter((T) => T !== i.name), O.useIn.length ? R = !1 : g.push([
|
|
2327
2318
|
E,
|
|
2328
|
-
|
|
2319
|
+
v,
|
|
2329
2320
|
b,
|
|
2330
|
-
|
|
2331
|
-
])) :
|
|
2321
|
+
A
|
|
2322
|
+
])) : g.push([
|
|
2332
2323
|
E,
|
|
2333
|
-
|
|
2324
|
+
v,
|
|
2334
2325
|
b,
|
|
2335
|
-
|
|
2326
|
+
A
|
|
2336
2327
|
]));
|
|
2337
2328
|
});
|
|
2338
2329
|
});
|
|
2339
2330
|
});
|
|
2340
|
-
}), R && (
|
|
2341
|
-
var b, $,
|
|
2342
|
-
(
|
|
2331
|
+
}), R && (y.shareScopeMap = {}, delete _[d]), g.forEach(([E, I, v, S]) => {
|
|
2332
|
+
var b, $, A;
|
|
2333
|
+
(A = _[E]) == null || ($ = A[I]) == null || (b = $[v]) == null || delete b[S];
|
|
2343
2334
|
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
|
|
2344
2335
|
}
|
|
2345
2336
|
const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, n);
|
|
2346
2337
|
if (m) {
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2338
|
+
const y = m && "remotesInfo" in m && m.remotesInfo && getInfoWithoutType(m.remotesInfo, t.name).key;
|
|
2339
|
+
y && (delete m.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
|
|
2349
2340
|
}
|
|
2350
2341
|
n.moduleCache.delete(t.name);
|
|
2351
2342
|
}
|
|
@@ -2454,7 +2445,7 @@ class FederationHost {
|
|
|
2454
2445
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2455
2446
|
// maybe will change, temporarily for internal use only
|
|
2456
2447
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2457
|
-
}), this.version = "0.8.
|
|
2448
|
+
}), this.version = "0.8.3", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2458
2449
|
// FIXME: may not be suitable , not open to the public yet
|
|
2459
2450
|
getModuleInfo: new SyncHook(),
|
|
2460
2451
|
createScript: new SyncHook(),
|
|
@@ -2489,7 +2480,7 @@ setGlobalFederationConstructor(FederationHost);
|
|
|
2489
2480
|
function createBridgeComponent(r) {
|
|
2490
2481
|
const t = /* @__PURE__ */ new Map();
|
|
2491
2482
|
return () => ({
|
|
2492
|
-
__APP_VERSION__: "0.8.
|
|
2483
|
+
__APP_VERSION__: "0.8.3",
|
|
2493
2484
|
render(o) {
|
|
2494
2485
|
LoggerInstance.log("createBridgeComponent render Info", o);
|
|
2495
2486
|
const n = Vue.createApp(r.rootComponent);
|
|
@@ -2566,7 +2557,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2566
2557
|
});
|
|
2567
2558
|
function createRemoteComponent(r) {
|
|
2568
2559
|
return defineAsyncComponent({
|
|
2569
|
-
__APP_VERSION__: "0.8.
|
|
2560
|
+
__APP_VERSION__: "0.8.3",
|
|
2570
2561
|
...r.asyncComponentOptions,
|
|
2571
2562
|
//@ts-ignore
|
|
2572
2563
|
loader: async () => {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/module-federation/core",
|
|
8
8
|
"directory": "packages/vue3-bridge"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.0.0-next-
|
|
10
|
+
"version": "0.0.0-next-20241213035216",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"vue-router": "=3"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@module-federation/bridge-shared": "0.0.0-next-
|
|
36
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
37
|
-
"@module-federation/runtime": "0.0.0-next-
|
|
35
|
+
"@module-federation/bridge-shared": "0.0.0-next-20241213035216",
|
|
36
|
+
"@module-federation/sdk": "0.0.0-next-20241213035216",
|
|
37
|
+
"@module-federation/runtime": "0.0.0-next-20241213035216"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@vitejs/plugin-vue": "^5.0.4",
|