@appshell/react 1.0.0-alpha.8 → 1.0.0-alpha.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -49
- package/dist/main.js +1 -1
- package/dist/types/config/src/axios.d.ts +0 -1
- package/dist/types/config/src/configmap.d.ts +0 -1
- package/dist/types/config/src/context.d.ts +3 -4
- package/dist/types/config/src/credentials.d.ts +0 -2
- package/dist/types/config/src/generate.manifest.d.ts +30 -2
- package/dist/types/config/src/index.d.ts +7 -10
- package/dist/types/config/src/loader.d.ts +18 -0
- package/dist/types/config/src/mappers/appshell.config.d.ts +9 -3
- package/dist/types/config/src/outdated.d.ts +0 -1
- package/dist/types/config/src/publish.d.ts +79 -5
- package/dist/types/config/src/sync.d.ts +0 -1
- package/dist/types/config/src/tls.d.ts +23 -0
- package/dist/types/config/src/types.d.ts +164 -30
- package/dist/types/config/src/utils/blur.d.ts +0 -1
- package/dist/types/config/src/utils/compare.d.ts +0 -1
- package/dist/types/config/src/utils/config.d.ts +0 -1
- package/dist/types/config/src/utils/copy.d.ts +0 -1
- package/dist/types/config/src/utils/dump.d.ts +10 -0
- package/dist/types/config/src/utils/index.d.ts +1 -4
- package/dist/types/config/src/utils/list.d.ts +0 -1
- package/dist/types/config/src/utils/load.d.ts +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
- package/dist/types/config/src/validators/index.d.ts +0 -3
- package/dist/types/loader/src/index.d.ts +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts +13 -14
- package/dist/types/loader/src/remoteLoader.d.ts +2 -3
- package/dist/types/loader/src/resolvers.d.ts +4 -12
- package/dist/types/loader/src/types.d.ts +0 -1
- package/dist/types/react/src/components/LoadingError.d.ts +0 -1
- package/dist/types/react/src/components/RemoteSlot.d.ts +28 -0
- package/dist/types/react/src/contexts/RemoteContext.d.ts +2 -4
- package/dist/types/react/src/hooks/useRemote.d.ts +1 -2
- package/dist/types/react/src/index.d.ts +2 -9
- package/dist/types/react/src/resources/jsonResource.d.ts +0 -1
- package/dist/types/react/src/types.d.ts +0 -1
- package/dist/types/runtime/src/errors.d.ts +32 -0
- package/dist/types/runtime/src/identity.d.ts +47 -0
- package/dist/types/runtime/src/index.d.ts +6 -0
- package/dist/types/runtime/src/store.d.ts +25 -0
- package/dist/types/runtime/src/types.d.ts +9 -0
- package/dist/types/runtime/src/wire.d.ts +58 -0
- package/package.json +14 -4
- package/CHANGELOG.md +0 -203
- package/__tests__/AppshellComponent.spec.tsx +0 -53
- package/__tests__/LoadingError.spec.tsx +0 -14
- package/__tests__/ManifestContext.spec.tsx +0 -50
- package/__tests__/ReactHost.spec.tsx +0 -136
- package/__tests__/__snapshots__/AppshellComponent.spec.tsx.snap +0 -9
- package/__tests__/__snapshots__/LoadingError.spec.tsx.snap +0 -88
- package/__tests__/__snapshots__/ReactHost.spec.tsx.snap +0 -11
- package/__tests__/fixtures/Manifest.ts +0 -16
- package/__tests__/fixtures/TestComponent.tsx +0 -5
- package/__tests__/fixtures/TestGlobalConfig.ts +0 -8
- package/__tests__/jsonResource.spec.ts +0 -27
- package/__tests__/useRemote.spec.tsx +0 -36
- package/__tests__/utils/waitForResource.ts +0 -15
- package/dist/types/config/src/axios.d.ts.map +0 -1
- package/dist/types/config/src/configmap.d.ts.map +0 -1
- package/dist/types/config/src/context.d.ts.map +0 -1
- package/dist/types/config/src/credentials.d.ts.map +0 -1
- package/dist/types/config/src/deregister.d.ts +0 -3
- package/dist/types/config/src/deregister.d.ts.map +0 -1
- package/dist/types/config/src/generate.env.d.ts +0 -3
- package/dist/types/config/src/generate.env.d.ts.map +0 -1
- package/dist/types/config/src/generate.global-config.d.ts +0 -10
- package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
- package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
- package/dist/types/config/src/index.d.ts.map +0 -1
- package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
- package/dist/types/config/src/outdated.d.ts.map +0 -1
- package/dist/types/config/src/publish.d.ts.map +0 -1
- package/dist/types/config/src/register.d.ts +0 -4
- package/dist/types/config/src/register.d.ts.map +0 -1
- package/dist/types/config/src/sync.d.ts.map +0 -1
- package/dist/types/config/src/types.d.ts.map +0 -1
- package/dist/types/config/src/utils/blur.d.ts.map +0 -1
- package/dist/types/config/src/utils/compare.d.ts.map +0 -1
- package/dist/types/config/src/utils/config.d.ts.map +0 -1
- package/dist/types/config/src/utils/copy.d.ts.map +0 -1
- package/dist/types/config/src/utils/index.d.ts.map +0 -1
- package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
- package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
- package/dist/types/config/src/utils/list.d.ts.map +0 -1
- package/dist/types/config/src/utils/load.d.ts.map +0 -1
- package/dist/types/config/src/utils/loadJson.d.ts +0 -10
- package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
- package/dist/types/config/src/utils/merge.d.ts +0 -4
- package/dist/types/config/src/utils/merge.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
- package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
- package/dist/types/config/src/validators/index.d.ts.map +0 -1
- package/dist/types/loader/src/fetchDynamicScript.d.ts +0 -3
- package/dist/types/loader/src/fetchDynamicScript.d.ts.map +0 -1
- package/dist/types/loader/src/index.d.ts.map +0 -1
- package/dist/types/loader/src/loadAppshellComponent.d.ts.map +0 -1
- package/dist/types/loader/src/remoteLoader.d.ts.map +0 -1
- package/dist/types/loader/src/resolvers.d.ts.map +0 -1
- package/dist/types/loader/src/types.d.ts.map +0 -1
- package/dist/types/react/src/components/AppshellComponent.d.ts +0 -30
- package/dist/types/react/src/components/AppshellComponent.d.ts.map +0 -1
- package/dist/types/react/src/components/LoadingError.d.ts.map +0 -1
- package/dist/types/react/src/components/ReactHost.d.ts +0 -9
- package/dist/types/react/src/components/ReactHost.d.ts.map +0 -1
- package/dist/types/react/src/contexts/GlobalConfigContext.d.ts +0 -11
- package/dist/types/react/src/contexts/GlobalConfigContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/ManifestContext.d.ts +0 -12
- package/dist/types/react/src/contexts/ManifestContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/MetadataContext.d.ts +0 -11
- package/dist/types/react/src/contexts/MetadataContext.d.ts.map +0 -1
- package/dist/types/react/src/contexts/RemoteContext.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useGlobalConfig.d.ts +0 -4
- package/dist/types/react/src/hooks/useGlobalConfig.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useManifest.d.ts +0 -4
- package/dist/types/react/src/hooks/useManifest.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useMetadata.d.ts +0 -4
- package/dist/types/react/src/hooks/useMetadata.d.ts.map +0 -1
- package/dist/types/react/src/hooks/useRemote.d.ts.map +0 -1
- package/dist/types/react/src/index.d.ts.map +0 -1
- package/dist/types/react/src/resources/jsonResource.d.ts.map +0 -1
- package/dist/types/react/src/types.d.ts.map +0 -1
- package/src/components/AppshellComponent.tsx +0 -82
- package/src/components/LoadingError.tsx +0 -15
- package/src/components/ReactHost.tsx +0 -55
- package/src/contexts/GlobalConfigContext.tsx +0 -17
- package/src/contexts/ManifestContext.tsx +0 -40
- package/src/contexts/MetadataContext.tsx +0 -17
- package/src/contexts/RemoteContext.tsx +0 -22
- package/src/hooks/useGlobalConfig.ts +0 -7
- package/src/hooks/useManifest.ts +0 -7
- package/src/hooks/useMetadata.ts +0 -6
- package/src/hooks/useRemote.ts +0 -7
- package/src/index.ts +0 -11
- package/src/resources/jsonResource.ts +0 -35
- package/src/types.ts +0 -3
- package/tsconfig.json +0 -7
- package/webpack.config.js +0 -42
package/README.md
CHANGED
|
@@ -20,57 +20,44 @@ Working examples can be found [here](https://github.com/navaris/appshell/tree/ma
|
|
|
20
20
|
To begin, you'll need to install `@appshell/react`:
|
|
21
21
|
|
|
22
22
|
```console
|
|
23
|
-
npm install @appshell/react
|
|
23
|
+
npm install @appshell/react
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
or
|
|
27
27
|
|
|
28
28
|
```console
|
|
29
|
-
yarn add
|
|
29
|
+
yarn add @appshell/react
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
or
|
|
33
33
|
|
|
34
34
|
```console
|
|
35
|
-
pnpm add
|
|
35
|
+
pnpm add @appshell/react
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## RemoteSlot
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Where a remote is mounted. The slot resolves the remote key against the composition,
|
|
41
|
+
loads it over Module Federation, renders `fallback` while that is in flight, and
|
|
42
|
+
surfaces a load failure in place rather than taking the page down with it.
|
|
41
43
|
|
|
42
44
|
```tsx
|
|
43
|
-
import {
|
|
45
|
+
import { RemoteSlot } from '@appshell/react';
|
|
44
46
|
|
|
45
47
|
<App>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
<AppshellComponent remote="PongModule/Pong">
|
|
49
|
-
</ManifestProvider>
|
|
48
|
+
<RemoteSlot remote="PingModule/Ping" fallback={<Spinner />} />
|
|
49
|
+
<RemoteSlot remote="PongModule/Pong" fallback={<Spinner />} />
|
|
50
50
|
</App>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Any other props are passed through to the mounted remote.
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```tsx
|
|
58
|
-
import { GlobalConfigProvider, useGlobalConfig } from '@appshell/react';
|
|
59
|
-
|
|
60
|
-
const MyComponent = () => {
|
|
61
|
-
const config = useGlobalConfig();
|
|
62
|
-
|
|
63
|
-
...
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
<RegistryProvider config={config}>
|
|
67
|
-
<MyComponent />
|
|
68
|
-
</RegistryProvider>
|
|
69
|
-
```
|
|
55
|
+
The registry inlines the composition into the document it serves, so the component
|
|
56
|
+
needs no configuration of its own.
|
|
70
57
|
|
|
71
58
|
## useRemote
|
|
72
59
|
|
|
73
|
-
For access to the remote backing the surrounding `
|
|
60
|
+
For access to the remote backing the surrounding `RemoteSlot`. Prefer this
|
|
74
61
|
over looking your own entry up in the manifest — the component already knows its key.
|
|
75
62
|
|
|
76
63
|
```tsx
|
|
@@ -83,36 +70,36 @@ const MyComponent = () => {
|
|
|
83
70
|
}
|
|
84
71
|
```
|
|
85
72
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
For access to the manifest.
|
|
73
|
+
## RemoteProvider
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
Supplies the remote a subtree is running as. `RemoteSlot` wraps what it mounts in one
|
|
76
|
+
already, so you rarely construct it yourself — reach for it in tests, where it is what
|
|
77
|
+
makes `useRemote` return something.
|
|
93
78
|
|
|
94
79
|
```tsx
|
|
95
|
-
import {
|
|
80
|
+
import { RemoteProvider } from '@appshell/react';
|
|
96
81
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<ManifestProvider manifest={manifest}>
|
|
104
|
-
<MyComponent />
|
|
105
|
-
</ManifestProvider>
|
|
82
|
+
render(
|
|
83
|
+
<RemoteProvider remote={manifest.remotes['PingModule/Ping']}>
|
|
84
|
+
<Ping />
|
|
85
|
+
</RemoteProvider>,
|
|
86
|
+
);
|
|
106
87
|
```
|
|
107
88
|
|
|
108
|
-
|
|
89
|
+
## jsonResource
|
|
109
90
|
|
|
110
|
-
|
|
91
|
+
Wraps a fetch in a Suspense-compatible resource, so a component can read JSON during
|
|
92
|
+
render instead of threading loading state through it.
|
|
111
93
|
|
|
112
|
-
|
|
94
|
+
```tsx
|
|
95
|
+
import { jsonResource } from '@appshell/react';
|
|
113
96
|
|
|
114
|
-
|
|
97
|
+
const settings = jsonResource<Settings>('/api/settings');
|
|
115
98
|
|
|
116
|
-
|
|
117
|
-
appshell register --manifest dist/appshell.manifest.json
|
|
99
|
+
const Panel = () => <pre>{settings.read().theme}</pre>;
|
|
118
100
|
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
[MIT](./LICENSE)
|
|
105
|
+
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.react);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(e=>(()=>{"use strict";var t={155(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{n.S={};var e={},t={};n.I=(r,o)=>{o||(o=[]);var a=t[r];if(a||(a=t[r]={}),!(o.indexOf(a)>=0)){if(o.push(a),e[r])return e[r];n.o(n.S,r)||(n.S[r]={}),n.S[r];var c=[];return e[r]=c.length?Promise.all(c).then((()=>e[r]=1)):1}}})();var o={};n.r(o),n.d(o,{AppshellComponent:()=>$,FederatedComponent:()=>C,GlobalConfigProvider:()=>P,ManifestProvider:()=>v,MetadataProvider:()=>R,ReactHost:()=>M,RemoteProvider:()=>y,jsonResource:()=>T,useGlobalConfig:()=>O,useManifest:()=>F,useMetadata:()=>I,useRemote:()=>U});const a=new Set,c=async e=>{const t=document.createElement("script");return new Promise(((r,n)=>{a.has(e)?r(!1):(a.add(e),t.src=e,t.type="text/javascript",t.async=!0,t.onload=()=>{console.debug(`Remote entry fetched from '${e}'.`),r(!0)},t.onerror=()=>{const t=`Failed to fetch remote entry from '${e}'.`;console.error(t),a.delete(e),n(t)},document.head.appendChild(t))})).finally((()=>{document.head.contains(t)&&document.head.removeChild(t)}))};(Object.getOwnPropertyDescriptor(c,"name")||{}).writable||Object.defineProperty(c,"name",{value:"default",configurable:!0});const i=async(e,t,r="default")=>{console.debug(`loading Appshell component: { scope: ${e}, module: ${t}, shareScope: ${r} }`),await n.I(r);const o=window[e];if(!o)throw new Error(`Failed to find module container ${e}`);await o.init(n.S[r]);const a=await o.get(t);if(!a)throw new Error(`Invalid factory produced by container for module ${t}.`);const c=a();return console.debug(`Appshell component loaded: { scope: ${e}, module: ${t}, shareScope: ${r} }`),c.default};(Object.getOwnPropertyDescriptor(i,"name")||{}).writable||Object.defineProperty(i,"name",{value:"default",configurable:!0});const s=(e,t)=>({remotes:t,environment:e.environment,modules:{}}),l=new Set,d=(e,t={})=>{const r=t.composition??("undefined"==typeof window?void 0:window.__appshell_config__),n=t.resolver??((...e)=>async t=>{for(const r of e){const e=await r(t);if(e)return e}})((e=>async t=>{const r=e?.remotes[t];if(e&&r)return{remote:r,environment:e.environment[r.scope]??{},manifest:s(e,e.remotes)}})(r),((e,t="")=>async r=>{if(!e)return;const n=`${t}/v1/environments/${e.environmentId}/remotes/${r}`,o=await fetch(n,{credentials:"include"});if(!o.ok)return;const a=await o.json();return{remote:a,environment:e.environment[a.scope]??{},manifest:s(e,{[r]:a})}})(r),(e=>{const t=new Map;return async r=>{const n=e.index?.[r];if(!n)return;const o=await(e=>{const r=t.get(e);if(r)return r;const n=fetch(e,{credentials:"include"}).then((async t=>{if(!t.ok)throw new Error(`Failed to get manifest from ${e}. ${await t.text()}`);return t.json()}));return t.set(e,n),n})(n),a=o?.remotes[r];return a?{remote:a,environment:{...o.environment[a.scope]??{},...e.overrides?.environment?.[a.scope]??{}},manifest:o}:void 0}})(e));return async e=>{const t=t=>new Error(`Failed to load component '${e}'. ${t?.toString()}`);let r;try{r=await n(e)}catch(e){throw t(e)}if(!r)throw new Error(`Remote resource not found in registry. Expected: ${e}`);const{remote:o,environment:a,manifest:s}=r;try{return window[`__appshell_env__${o.scope}`]=a,l.has(o.remoteEntryUrl)||await c(o.remoteEntryUrl)?(l.add(o.remoteEntryUrl),[await i(o.scope,o.module,o.shareScope),s]):[null,null]}catch(e){throw t(e)}}};(Object.getOwnPropertyDescriptor(d,"name")||{}).writable||Object.defineProperty(d,"name",{value:"default",configurable:!0});const u=d;var f=n(155),m=n.n(f);const p=(0,f.createContext)({remotes:{},modules:{},environment:{}}),v=({manifest:e,children:t})=>{const r=(0,f.useMemo)((()=>(e=>new Proxy(e,{get:(e,t,r)=>("modules"===t&&console.warn("useManifest().modules is deprecated and will be removed. It is build-time webpack config; use useRemote() for what the browser needs. Please open an issue at github.com/appshell-org/appshell if you rely on it."),Reflect.get(e,t,r))}))(e)),[e]);return m().createElement(p.Provider,{value:r},t)},w=(p.Consumer,p),b=(0,f.createContext)(void 0),y=({remote:e,children:t})=>m().createElement(b.Provider,{value:e},t);y.defaultProps={remote:void 0},b.Consumer;const h=b,g=(0,f.createContext)({index:{}}),P=({config:e,children:t})=>m().createElement(g.Provider,{value:e},t),j=(g.Consumer,g),O=()=>m().useContext(j);(Object.getOwnPropertyDescriptor(O,"name")||{}).writable||Object.defineProperty(O,"name",{value:"default",configurable:!0});const x=({remote:e,reason:t})=>m().createElement("div",{style:{border:"3px solid red"}},m().createElement("h5",null,`Error loading Appshell component '${e}.'`),m().createElement("span",{style:{fontSize:"1rem"}},t)),E=({remote:e,fallback:t,...r})=>{const n=O(),[o,a]=(0,f.useState)();return(0,f.useEffect)((()=>{let t=!1;const o=u(n);return t||async function(){try{t=!0,a(void 0);const[n,c]=await o(e);if(!n)return;t=!1,a(m().createElement(v,{manifest:c},m().createElement(y,{remote:c.remotes[e]},m().createElement(n,r))))}catch(t){a(m().createElement(x,{remote:e,reason:`${t}`}))}}(),()=>{t=!1}}),[e,n,...Object.values(r)]),console.debug(`rendering AppshellComponent[${e}], loading=${!o}`),m().createElement(m().Fragment,null,o||t)};E.defaultProps={fallback:void 0};const $=E,C=E;function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S.apply(null,arguments)}const _=()=>{const e="undefined"==typeof window?void 0:window.__appshell_config__;return e&&{index:e.index}},k=({configUrl:e,remote:t,fallback:r,...n})=>{const[o,a]=m().useState(_);return(0,f.useEffect)((()=>{o||(e?(async()=>{const t=await fetch(e);a(t.ok?await t.json():{index:{}})})():a({index:{}}))}),[o,e]),o?m().createElement(P,{config:o},m().createElement($,S({remote:t,fallback:r},n))):null};k.defaultProps={configUrl:void 0,fallback:void 0};const M=k,D=(0,f.createContext)({}),R=({metata:e,children:t})=>m().createElement(D.Provider,{value:e},t),A=(D.Consumer,D),F=()=>m().useContext(w);(Object.getOwnPropertyDescriptor(F,"name")||{}).writable||Object.defineProperty(F,"name",{value:"default",configurable:!0});const I=()=>m().useContext(A);(Object.getOwnPropertyDescriptor(I,"name")||{}).writable||Object.defineProperty(I,"name",{value:"default",configurable:!0});const U=()=>m().useContext(h);(Object.getOwnPropertyDescriptor(U,"name")||{}).writable||Object.defineProperty(U,"name",{value:"default",configurable:!0});const T=e=>{let t,r="pending";const n=fetch(e,{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>{r="success",t=e}));r="error",t=new Error(`${e.status} ${e.statusText} ${e.url}`)}));return{read(){if("pending"===r)throw n;if("error"===r)throw t;if("success"===r)return t}}};return(Object.getOwnPropertyDescriptor(T,"name")||{}).writable||Object.defineProperty(T,"name",{value:"default",configurable:!0}),o})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@appshell/runtime"),require("react"),require("react/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["@appshell/runtime","react","react/jsx-runtime"],t);else{var o="object"==typeof exports?t(require("@appshell/runtime"),require("react"),require("react/jsx-runtime")):t(e["@appshell/runtime"],e.react,e["react/jsx-runtime"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,((e,t,o)=>(()=>{"use strict";var r={164(t){t.exports=e},155(e){e.exports=t},272(e){e.exports=o}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var o in t)s.o(t,o)&&!s.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};s.r(i),s.d(i,{RemoteProvider:()=>Po,RemoteSlot:()=>Ho,jsonResource:()=>Uo,useRemote:()=>Fo});var a=s(164);const c=".json",l="FEDERATION_DEBUG";let h=function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e}({});const m="undefined"!=typeof ENV_TARGET?"web"===ENV_TARGET:"undefined"!=typeof window&&void 0!==window.document;function u(){return m}function d(){return"undefined"!=typeof navigator&&"ReactNative"===navigator?.product}function f(){return"undefined"!=typeof process&&process.env&&process.env.FEDERATION_DEBUG?Boolean(process.env.FEDERATION_DEBUG):!("undefined"==typeof FEDERATION_DEBUG||!Boolean(FEDERATION_DEBUG))||function(){try{if(u()&&window.localStorage)return Boolean(localStorage.getItem(l))}catch(e){return!1}return!1}()}const p="[ Module Federation ]",y=console,g=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];var E=class{constructor(e,t=y){this.prefix=e,this.delegate=t??y}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??y}emit(e,t){const o=this.delegate,r=f()?function(){try{const e=(new Error).stack;if(!e)return;const[,...t]=e.split("\n"),o=t.filter((e=>!g.some((t=>e.includes(t)))));if(!o.length)return;return`Stack trace:\n${o.slice(0,5).join("\n")}`}catch{return}}():void 0,n=r?[...t,r]:t,s=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const e of s){const t=o[e];if("function"==typeof t)return void t.call(o,this.prefix,...n)}for(const e of s){const t=y[e];if("function"==typeof t)return void t.call(y,this.prefix,...n)}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){f()&&this.emit("debug",e)}};function S(e){return new E(e)}S(p),function(e){const t=new E(e);Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1})}(p);const _=(e,t,o,r)=>{const n=[`${[t[e]]} #${e}`];return o&&n.push(`args: ${JSON.stringify(o)}`),n.push((e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`)(e)),r&&n.push(`Original Error Message:\n ${r}`),n.join("\n")},b="[ Federation Runtime ]",I=S(b);function w(e,t,o,r,n){e||(void 0!==o?$(t,o,r,void 0):$(t))}function $(e,t,o,r,n){if(void 0!==t)return function(e,t,o,r,n){return(e=>{throw new Error(`${b}: ${e}`)})(_(e,t,o,n))}(e,t,o??{},0,r);const s=e;if(s instanceof Error)throw s.message.startsWith(b)||(s.message=`${b}: ${s.message}`),s;throw new Error(`${b}: ${s}`)}function N(e){e instanceof Error?(e.message.startsWith(b)||(e.message=`${b}: ${e.message}`),I.warn(e)):I.warn(e)}function v(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function R(e){return void 0!==e.entry}function k(e){return!e.entry.includes(".json")}function O(e){return e&&"object"==typeof e}const T=Object.prototype.toString;function A(e){return Array.isArray(e)?e:[e]}function x(e){const t={url:"",type:"global",globalName:""};return m||d()||!("ssrRemoteEntry"in e)?"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t:"ssrRemoteEntry"in e?{url:e.ssrRemoteEntry||t.url,type:e.ssrRemoteEntryType||t.type,globalName:e.globalName}:t}const M="object"==typeof globalThis?globalThis:window,L=(()=>{try{return document.defaultView}catch{return M}})(),P=L;function j(e,t,o){Object.defineProperty(e,t,{value:o,configurable:!1,writable:!0})}function D(e,t){return Object.hasOwnProperty.call(e,t)}D(M,"__GLOBAL_LOADING_REMOTE_ENTRY__")||j(M,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});const C=M.__GLOBAL_LOADING_REMOTE_ENTRY__;function H(e){D(e,"__VMOK__")&&!D(e,"__FEDERATION__")&&j(e,"__FEDERATION__",e.__VMOK__),D(e,"__FEDERATION__")||(j(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),j(e,"__VMOK__",e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}function F(e,t){if("string"==typeof t){if(e[t])return{value:e[t],key:t};{const o=Object.keys(e);for(const r of o){const[o,n]=r.split(":"),s=`${o}:${t}`,i=e[s];if(i)return{value:i,key:s}}return{value:void 0,key:t}}}$(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}H(M),H(L);const U=()=>L.__FEDERATION__.moduleInfo,G=e=>((e,t)=>{const o=F(t,v(e)).value;if(o&&!o.version&&"version"in e&&e.version&&(o.version=e.version),o)return o;if("version"in e&&e.version){const{version:t,...o}=e,r=v(o),n=F(L.__FEDERATION__.moduleInfo,r).value;if(n?.version===t)return n}})(e,L.__FEDERATION__.moduleInfo),B=(e,t)=>{const o=v(e);return L.__FEDERATION__.moduleInfo[o]=t,L.__FEDERATION__.moduleInfo},V=(e,t)=>{const o=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:o,entryExports:M[o]}},W=e=>M.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),q="default",z="global",K="[0-9A-Za-z-]+",Z=`(?:\\+(${K}(?:\\.${K})*))`,J="0|[1-9]\\d*",Y="[0-9]+",X="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Q=`(?:${Y}|${X})`,ee=`(?:${J}|${X})`,te=`(?:-(${ee}(?:\\.${ee})*))`,oe=`${J}|x|X|\\*`,re=`[v=\\s]*(${oe})(?:\\.(${oe})(?:\\.(${oe})(?:${te})?${Z}?)?)?`,ne=`^\\s*(${re})\\s+-\\s+(${re})\\s*$`,se="((?:<|>)?=?)",ie=`(\\s*)${se}\\s*([v=\\s]*(${Y})\\.(${Y})\\.(${Y})(?:-?(${Q}(?:\\.${Q})*))?${Z}?|${re})`,ae="(?:~>?)",ce=`(\\s*)${ae}\\s+`,le="(?:\\^)",he=`(\\s*)${le}\\s+`,me="(<|>)?=?\\s*\\*",ue=`^${le}${re}$`,de=`^${ae}${re}$`,fe=`^${se}\\s*${re}$`,pe=`^${se}\\s*(v?(${J})\\.(${J})\\.(${J})${te}?${Z}?)$|^$`,ye="^\\s*>=\\s*0.0.0\\s*$";function ge(e){return new RegExp(e)}function Ee(e){return!e||"x"===e.toLowerCase()||"*"===e}function Se(...e){return t=>e.reduce(((e,t)=>t(e)),t)}function _e(e){return e.match(ge(pe))}function be(e,t,o,r){const n=`${e}.${t}.${o}`;return r?`${n}-${r}`:n}function Ie(e){return e.replace(ge(ne),((e,t,o,r,n,s,i,a,c,l,h,m)=>`${t=Ee(o)?"":Ee(r)?`>=${o}.0.0`:Ee(n)?`>=${o}.${r}.0`:`>=${t}`} ${a=Ee(c)?"":Ee(l)?`<${Number(c)+1}.0.0-0`:Ee(h)?`<${c}.${Number(l)+1}.0-0`:m?`<=${c}.${l}.${h}-${m}`:`<=${a}`}`.trim()))}function we(e){return e.replace(ge(ie),"$1$2$3")}function $e(e){return e.replace(ge(ce),"$1~")}function Ne(e){return e.replace(ge(he),"$1^")}function ve(e){return e.trim().split(/\s+/).map((e=>e.replace(ge(ue),((e,t,o,r,n)=>Ee(t)?"":Ee(o)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:Ee(r)?"0"===t?`>=${t}.${o}.0 <${t}.${Number(o)+1}.0-0`:`>=${t}.${o}.0 <${Number(t)+1}.0.0-0`:n?"0"===t?"0"===o?`>=${t}.${o}.${r}-${n} <${t}.${o}.${Number(r)+1}-0`:`>=${t}.${o}.${r}-${n} <${t}.${Number(o)+1}.0-0`:`>=${t}.${o}.${r}-${n} <${Number(t)+1}.0.0-0`:"0"===t?"0"===o?`>=${t}.${o}.${r} <${t}.${o}.${Number(r)+1}-0`:`>=${t}.${o}.${r} <${t}.${Number(o)+1}.0-0`:`>=${t}.${o}.${r} <${Number(t)+1}.0.0-0`)))).join(" ")}function Re(e){return e.trim().split(/\s+/).map((e=>e.replace(ge(de),((e,t,o,r,n)=>Ee(t)?"":Ee(o)?`>=${t}.0.0 <${Number(t)+1}.0.0-0`:Ee(r)?`>=${t}.${o}.0 <${t}.${Number(o)+1}.0-0`:n?`>=${t}.${o}.${r}-${n} <${t}.${Number(o)+1}.0-0`:`>=${t}.${o}.${r} <${t}.${Number(o)+1}.0-0`)))).join(" ")}function ke(e){return e.split(/\s+/).map((e=>e.trim().replace(ge(fe),((e,t,o,r,n,s)=>{const i=Ee(o),a=i||Ee(r),c=a||Ee(n);return"="===t&&c&&(t=""),s="",i?">"===t||"<"===t?"<0.0.0-0":"*":t&&c?(a&&(r=0),n=0,">"===t?(t=">=",a?(o=Number(o)+1,r=0,n=0):(r=Number(r)+1,n=0)):"<="===t&&(t="<",a?o=Number(o)+1:r=Number(r)+1),"<"===t&&(s="-0"),`${t+o}.${r}.${n}${s}`):a?`>=${o}.0.0${s} <${Number(o)+1}.0.0-0`:c?`>=${o}.${r}.0${s} <${o}.${Number(r)+1}.0-0`:e})))).join(" ")}function Oe(e){return e.trim().replace(ge(me),"")}function Te(e,t){return(e=Number(e)||e)>(t=Number(t)||t)?1:e===t?0:-1}function Ae(e,t){return Te(e.major,t.major)||Te(e.minor,t.minor)||Te(e.patch,t.patch)||function(e,t){const{preRelease:o}=e,{preRelease:r}=t;if(void 0===o&&Boolean(r))return 1;if(Boolean(o)&&void 0===r)return-1;if(void 0===o&&void 0===r)return 0;for(let e=0,t=o.length;e<=t;e++){const t=o[e],n=r[e];if(t!==n)return void 0===t&&void 0===n?0:t?n?Te(t,n):-1:1}return 0}(e,t)}function xe(e,t){return e.version===t.version}function Me(e,t){switch(e.operator){case"":case"=":return xe(e,t);case">":return Ae(e,t)<0;case">=":return xe(e,t)||Ae(e,t)<0;case"<":return Ae(e,t)>0;case"<=":return xe(e,t)||Ae(e,t)>0;case void 0:return!0;default:return!1}}function Le(e){return Se(ve,Re,ke,Oe)(e)}function Pe(e){return Se(Ie,we,$e,Ne)(e.trim()).split(/\s+/).join(" ")}function je(e,t){if(!e)return!1;const o=_e(e);if(!o)return!1;const[,r,,n,s,i,a]=o,c={operator:r,version:be(n,s,i,a),major:n,minor:s,patch:i,preRelease:a?.split(".")},l=t.split("||");for(const e of l){const t=e.trim();if(!t)return!0;if("*"===t||"x"===t)return!0;try{const e=Pe(t);if(!e.trim())return!0;const o=e.split(" ").map((e=>Le(e))).join(" ");if(!o.trim())return!0;const r=o.split(/\s+/).map((e=>e.trim().replace(ge(ye),""))).filter(Boolean);if(0===r.length)continue;let n=!0;for(const e of r){const t=_e(e);if(!t){n=!1;break}const[,o,,r,s,i,a]=t;if(!Me({operator:o,version:be(r,s,i,a),major:r,minor:s,patch:i,preRelease:a?.split(".")},c)){n=!1;break}}if(n)return!0}catch(e){console.error(`[semver] Error processing range part "${t}":`,e);continue}}return!1}function De(e,t){const o=t.shared||{},r=t.name,n=Object.keys(o).reduce(((e,n)=>{const s=A(o[n]);return e[n]=e[n]||[],s.forEach((o=>{e[n].push(function(e,t,o,r){let n;return n="get"in e?e.get:"lib"in e?()=>Promise.resolve(e.lib):()=>Promise.resolve((()=>{$(`Cannot get shared "${o}" from "${t}": neither "get" nor "lib" is provided in the share config.`)})),e.shareConfig?.eager&&e.treeShaking?.mode&&$(`Invalid shared config for "${o}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:n,loaded:!(!e?.loaded&&!("lib"in e))||void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??r)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??h.UNKNOWN,useIn:[]}:void 0}}(o,r,n,t.shareStrategy))})),e}),{}),s={...e.shared};return Object.keys(n).forEach((e=>{s[e]?n[e].forEach((t=>{s[e].find((e=>e.version===t.version))||s[e].push(t)})):s[e]=n[e]})),{allShareInfos:s,newShareInfos:n}}function Ce(e,t){if(!e)return!1;const{status:o,mode:r}=e;return o!==h.NO_USE&&(o===h.CALCULATED||"runtime-infer"===r&&(!t||Ge(e,t)))}function He(e,t){const o=e=>{if(!Number.isNaN(Number(e))){const t=e.split(".");let o=e;for(let e=0;e<3-t.length;e++)o+=".0";return o}return e};return!!je(o(e),`<=${o(t)}`)}const Fe=(e,t)=>{const o=t||function(e,t){return He(e,t)};return Object.keys(e).reduce(((e,t)=>e?o(e,t)||"0"===e?t:e:t),0)},Ue=e=>Boolean(e.loaded)||"function"==typeof e.lib,Ge=(e,t)=>{if(!e||!t)return!1;const{usedExports:o}=e;return!!o&&!!t.every((e=>o.includes(e)))};function Be(e,t,o,r){const n=e[t][o];let s="",i=Ce(r);const a=function(e,t){return i?!n[e].treeShaking||!!n[t].treeShaking&&!Ue(n[e].treeShaking)&&He(e,t):!Ue(n[e])&&He(e,t)};if(i){if(s=Fe(e[t][o],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:Fe(e[t][o],a),useTreesShaking:i}}const Ve=e=>Ue(e)||(e=>Boolean(e.loading))(e);function We(e,t,o,r){const n=e[t][o];let s="",i=Ce(r);const a=function(e,t){if(i){if(!n[e].treeShaking)return!0;if(!n[t].treeShaking)return!1;if(Ve(n[t].treeShaking))return!Ve(n[e].treeShaking)||Boolean(He(e,t));if(Ve(n[e].treeShaking))return!1}return Ve(n[t])?!Ve(n[e])||Boolean(He(e,t)):!Ve(n[e])&&He(e,t)};if(i){if(s=Fe(e[t][o],a),s)return{version:s,useTreesShaking:i};i=!1}return{version:Fe(e[t][o],a),useTreesShaking:i}}function qe(e){return"loaded-first"===e?We:Be}function ze(e,t,o,r){if(!e)return;const{shareConfig:n,scope:s=q,strategy:i,treeShaking:a}=o,c=Array.isArray(s)?s:[s];for(const s of c)if(n&&e[s]&&e[s][t]){const{requiredVersion:c}=n,{version:l,useTreesShaking:h}=qe(i)(e,s,t,a),m=()=>{const r=e[s][t][l];if(n.singleton){if("string"==typeof c&&!je(l,c)){const e=`Version ${l} from ${l&&r.from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${c})`;n.strictVersion?$(e):N(e)}return{shared:r,useTreesShaking:h}}{if(!1===c||"*"===c)return{shared:r,useTreesShaking:h};if(je(l,c))return{shared:r,useTreesShaking:h};const o=Ce(a);if(o)for(const[r,n]of Object.entries(e[s][t]))if(Ce(n.treeShaking,a?.usedExports)&&je(r,c))return{shared:n,useTreesShaking:o};for(const[o,r]of Object.entries(e[s][t]))if(je(o,c))return{shared:r,useTreesShaking:!1}}},u={shareScopeMap:e,scope:s,pkgName:t,version:l,GlobalFederation:P.__FEDERATION__,shareInfo:o,resolver:m};return(r.emit(u)||u).resolver()}}function Ke(){return P.__FEDERATION__.__SHARE__}function Ze(e){const{pkgName:t,extraOptions:o,shareInfos:r}=e,n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),s=(...e)=>{const t={};for(const o of e)if(o)for(const[e,r]of Object.entries(o)){const o=t[e];n(o)&&n(r)?t[e]=s(o,r):void 0!==r&&(t[e]=r)}return t};return s((o?.resolver??(e=>{if(!e)return;const t={};return e.forEach((e=>{t[e.version]=e})),t[Fe(t,(function(e,o){return!Ue(t[e])&&He(e,o)}))]}))(r[t]),o?.customShareInfo)}const Je=(e,t)=>{var o,r;e.useIn||(e.useIn=[]),o=e.useIn,r=t,-1===o.findIndex((e=>e===r))&&o.push(r)};function Ye(e,t){return t&&e.treeShaking?e.treeShaking:e}const Xe=function(...e){return e.length?e.reduce(((e,t)=>t?e?`${e}:${t}`:t:e),""):""};function Qe(e,t){if("getPublicPath"in e){let o;return o=e.getPublicPath.startsWith("function")?new Function("return "+e.getPublicPath)()():new Function(e.getPublicPath)(),`${o}${t}`}return"publicPath"in e?u()||d()||!("ssrPublicPath"in e)||"string"!=typeof e.ssrPublicPath?`${e.publicPath}${t}`:`${e.ssrPublicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")}const et=e=>{console.warn(`[ Federation Runtime ]: ${e}`)};function tt(e){try{return JSON.stringify(e,null,2)}catch(e){return""}}async function ot(e,t){try{return await e()}catch(e){return void(!t&&et(e))}}function rt(e,t){const o=/^(https?:)?\/\//i;return e.replace(o,"").replace(/\/$/,"")===t.replace(o,"").replace(/\/$/,"")}function nt(e){let t,o=null,r=!0,n=2e4;const s=document.getElementsByTagName("script");for(let t=0;t<s.length;t++){const n=s[t],i=n.getAttribute("src");if(i&&rt(i,e.url)){o=n,r=!1;break}}if(!o){const t=e.attrs;let r;o=document.createElement("script"),o.type="module"===t?.type?"module":"text/javascript",e.createScriptHook&&(r=e.createScriptHook(e.url,e.attrs),r instanceof HTMLScriptElement?o=r:"object"==typeof r&&("script"in r&&r.script&&(o=r.script),"timeout"in r&&r.timeout&&(n=r.timeout))),o.src||(o.src=e.url),t&&!r&&Object.keys(t).forEach((e=>{o&&("async"===e||"defer"===e?o[e]=t[e]:o.getAttribute(e)||o.setAttribute(e,t[e]))}))}let i=null;const a="undefined"!=typeof window?t=>{if(t.filename&&rt(t.filename,e.url)){const o=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`);o.name="ScriptExecutionError",i=o}}:null;a&&window.addEventListener("error",a);const c=async(r,n)=>{clearTimeout(t),a&&window.removeEventListener("error",a);const s=()=>{if("error"===n?.type){const t=new Error(n?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);t.name="ScriptNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else i?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(o&&(o.onerror=null,o.onload=null,ot((()=>{const{needDeleteScript:t=!0}=e;t&&o?.parentNode&&o.parentNode.removeChild(o)})),r&&"function"==typeof r)){const e=r(n);if(e instanceof Promise){const t=await e;return s(),t}return s(),e}s()};return o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),t=setTimeout((()=>{c(null,{type:"error",isTimeout:!0})}),n),{script:o,needAttach:r}}const st=new Map;function it(e){if(!e)throw new Error("import specifier is required");if(st.has(e))return st.get(e);const t=new Function("name","return import(name)")(e).then((e=>e)).catch((t=>{throw console.error(`Error importing module ${e}:`,t),st.delete(e),t}));return st.set(e,t),t}const at="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t,o,r)=>{if(r?.createScriptHook){const t=r.createScriptHook(e);t&&"object"==typeof t&&"url"in t&&(e=t.url)}let n;try{n=new URL(e)}catch(e){return console.error("Error constructing URL:",e),void t(new Error(`Invalid URL: ${e}`))}(async()=>r?.fetch?(e,t)=>(async(e,t,o)=>{const r=await((e,t)=>o.lifecycle.fetch.emit(e,t))(e,t||{});return r&&r instanceof Response?r:fetch(e,t||{})})(e,t,r):fetch)().then((async e=>{if("esm"===o?.type||"module"===o?.type)return dt(n.href,{fetch:e,vm:await it("vm")}).then((async e=>{await e.evaluate(),t(void 0,e.namespace)})).catch((e=>{t(e instanceof Error?e:new Error(`Script execution error: ${e}`))}));(async(e,r)=>{try{const n=await e(r.href),s=await n.text(),[i,a]=await Promise.all([it("path"),it("vm")]),c={exports:{},module:{exports:{}}},l=r.pathname.split("/").slice(0,-1).join("/"),h=i.basename(r.pathname),m=new a.Script(`(function(exports, module, require, __dirname, __filename) {${s}\n})`,{filename:h,importModuleDynamically:a.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER??it});let u;u=(await it("node:module")).createRequire("file:"===r.protocol||"node:"===r.protocol?r.href:i.join(process.cwd(),"__mf_require_base__.js")),m.runInThisContext()(c.exports,c.module,u,l,h);const d=c.module.exports||c.exports;if(o&&d&&o.globalName)return void t(void 0,d[o.globalName]||d);t(void 0,d)}catch(e){t(e instanceof Error?e:new Error(`Script execution error: ${e}`))}})(e,n)})).catch((e=>{t(e)}))}:(e,t,o,r)=>{t(new Error("createScriptNode is disabled in non-Node.js environment"))},ct="undefined"==typeof ENV_TARGET||"web"!==ENV_TARGET?(e,t)=>new Promise(((o,r)=>{at(e,((e,n)=>{e?r(e):o(globalThis[t?.attrs?.globalName||`__FEDERATION_${t?.attrs?.name}:custom__`]=n)}),t.attrs,t.loaderHook)})):(e,t)=>{throw new Error("loadScriptNode is disabled in non-Node.js environment")},lt=new Map,ht=e=>e.startsWith("http:")||e.startsWith("https:"),mt=e=>!(e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.includes(":"));async function ut(e,t,o){if(await async function(e){return!!e.startsWith("node:")||!!mt(e)&&(await it("node:module")).builtinModules.includes(e)}(e))return async function(e,t){const o=`node-builtin:${e}`;return lt.has(o)?lt.get(o):async function(e,t,o){if("function"!=typeof o.SyntheticModule)throw new Error("vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.");const r=function(e){const t=!e||"object"!=typeof e&&"function"!=typeof e?{default:e}:e,o={...t};return Object.prototype.hasOwnProperty.call(o,"default")||(o.default=t),o}(t),n=Object.keys(r),s=new o.SyntheticModule(n,(function(){for(const e of n)this.setExport(e,r[e])}),{identifier:e});return lt.set(e,s),await s.link((async()=>{throw new Error(`Node.js built-in module "${e}" should not request child modules.`)})),await s.evaluate(),s}(o,await it(e),t)}(e,o.vm);if(mt(e))throw new Error(`Unsupported ESM module specifier "${e}". Only relative or absolute http(s) remote modules and Node.js built-in modules are supported.`);const r=new URL(e,t).href;if(!ht(r))throw new Error(`Unsupported ESM module specifier "${e}" resolved to "${r}". Only http(s) remote modules and Node.js built-in modules are supported.`);return dt(r,o)}async function dt(e,t){if(lt.has(e))return lt.get(e);const{fetch:o,vm:r}=t;if(!ht(e))throw new Error(`Unsupported ESM module URL "${e}". Only http(s) remote modules and Node.js built-in modules are supported.`);const n=await(await o(e)).text(),s=(await it("node:url")).pathToFileURL(process.cwd()).href,i=new r.SourceTextModule(n,{identifier:e,initializeImportMeta:t=>{t.url=function(e,t){const o=t.endsWith("/")?t:`${t}/`;return new URL(`__module_federation_remote__${function(e){const t=new URL(e),o=encodeURIComponent(t.protocol.slice(0,-1)),r=encodeURIComponent(t.host),n=t.pathname.split("/").map((e=>encodeURIComponent(e))).join("/"),s=encodeURIComponent(`${t.search}${t.hash}`);return`/${o}/${r}${n}${s?`/${s}`:""}`}(e)}`,o).href}(e,s)},importModuleDynamically:async o=>async function(e){if("linked"===e.status&&await e.evaluate(),"errored"===e.status)throw e.error;return e}(await ut(o,e,t))});return lt.set(e,i),await i.link((async o=>ut(o,e,t))),i}const ft="RUNTIME-001",pt="RUNTIME-002",yt="RUNTIME-003",gt="RUNTIME-004",Et="RUNTIME-005",St="RUNTIME-006",_t="RUNTIME-007",bt="RUNTIME-008",It="RUNTIME-009",wt="RUNTIME-010",$t="RUNTIME-011",Nt="RUNTIME-012",vt="RUNTIME-013",Rt="RUNTIME-014",kt="RUNTIME-015",Ot={[ft]:"Failed to get remoteEntry exports.",[pt]:'The remote entry interface does not contain "init"',[yt]:"Failed to get manifest.",[gt]:"Failed to locate remote.",[Et]:"Invalid loadShareSync function call from bundler runtime",[St]:"Invalid loadShareSync function call from runtime",[_t]:"Failed to get remote snapshot.",[bt]:"Failed to load script resources.",[It]:"Please call createInstance first.",[wt]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[$t]:"The remoteEntry URL is missing from the remote snapshot.",[Nt]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.',[vt]:"The manifest is not a valid Module Federation manifest.",[Rt]:"The remote does not expose the requested module.",[kt]:"Remote container initialization failed."},Tt=".then(callbacks[0]).catch(callbacks[1])",At=["Failed to fetch dynamically imported module","Importing a module script failed","error loading dynamically imported module"];function xt(e){return"esm"===e||"module"===e}function Mt(e,t,o){const{remoteEntryKey:r,entryExports:n}=V(e,t);return n||$(ft,Ot,{remoteName:e,remoteEntryUrl:o,remoteEntryKey:r}),n}async function Lt({remoteInfo:e,remoteEntryExports:t,loaderHook:o,getEntryUrl:r,resourceContext:n}){const{entry:s,entryGlobalName:i,name:a,type:c}=e;return xt(c)?async function({entry:e,remoteEntryExports:t,name:o,getEntryUrl:r}){return new Promise(((n,s)=>{const i=e=>{if((t=e)instanceof TypeError&&At.some((e=>t.message.includes(e)))){const t=e instanceof Error?e.message:String(e);try{$(bt,Ot,{remoteName:o,resourceUrl:a},t)}catch(e){return void s(e)}}var t;s(e)},a=r?r(e):e;try{t?n(t):"undefined"!=typeof FEDERATION_ALLOW_NEW_FUNCTION?new Function("callbacks",`import("${a}")${Tt}`)([n,i]):import(a).then(n).catch(i)}catch(e){$(`Failed to load ESM entry from "${a}". ${e instanceof Error?e.message:String(e)}`)}}))}({entry:s,remoteEntryExports:t,name:a,getEntryUrl:r}):"system"===c?async function({entry:e,remoteEntryExports:t}){return new Promise(((o,r)=>{try{t?o(t):new Function("callbacks",`System.import("${e}")${Tt}`)([o,r])}catch(t){$(`Failed to load SystemJS entry from "${e}". ${t instanceof Error?t.message:String(t)}`)}}))}({entry:s,remoteEntryExports:t}):async function({name:e,globalName:t,entry:o,remoteInfo:r,loaderHook:n,getEntryUrl:s,resourceContext:i}){const{entryExports:a}=V(e,t);if(a)return a;const c=s?s(o):o;return function(e,t){const{attrs:o={},createScriptHook:r}=t;return new Promise(((t,n)=>{const{script:s,needAttach:i}=nt({url:e,cb:t,onErrorCallback:n,attrs:{fetchpriority:"high",...o},createScriptHook:r,needDeleteScript:!0});i&&document.head.appendChild(s)}))}(c,{attrs:{},createScriptHook:(e,t)=>{const o=n.lifecycle.createScript.emit({url:e,attrs:t,remoteInfo:r,resourceContext:i?{...i,url:e}:void 0});if(o)return o instanceof HTMLScriptElement||"script"in o||"timeout"in o?o:void 0}}).then((()=>Mt(e,t,o)),(t=>{const o=t instanceof Error?t.message:String(t);$(bt,Ot,{remoteName:e,resourceUrl:c},o)}))}({entry:s,globalName:i,name:a,remoteInfo:e,loaderHook:o,getEntryUrl:r,resourceContext:n})}function Pt(e){const{entry:t,name:o}=e;return Xe(o,t)}async function jt(e){const{origin:t,remoteEntryExports:o,remoteInfo:r,getEntryUrl:n,resourceContext:s,_inErrorHandling:i=!1}=e,a=Pt(r);if(o)return o;if(!C[a]){const e=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;C[a]=e.emit({origin:t,loaderHook:c,remoteInfo:r,remoteEntryExports:o}).then((e=>e||(("undefined"!=typeof ENV_TARGET?"web"===ENV_TARGET:m)?Lt({remoteInfo:r,remoteEntryExports:o,loaderHook:c,getEntryUrl:n,resourceContext:s}):async function({remoteInfo:e,loaderHook:t,resourceContext:o}){const{entry:r,entryGlobalName:n,name:s,type:i}=e,{entryExports:a}=V(s,n);return a||ct(r,{attrs:{name:s,globalName:n,type:i},loaderHook:{createScriptHook:(r,n={})=>{const s=t.lifecycle.createScript.emit({url:r,attrs:n,remoteInfo:e,resourceContext:o?{...o,url:r}:void 0});if(s)return"url"in s?s:void 0}}}).then((()=>Mt(s,n,r))).catch((e=>{$(`Failed to load Node.js entry for remote "${s}" from "${r}". ${e instanceof Error?e.message:String(e)}`)}))}({remoteInfo:r,loaderHook:c,resourceContext:s})))).then((async e=>(await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:e}),e))).catch((async e=>{const n=Pt(r),s=e instanceof Error&&e.message.includes("ScriptExecutionError");if(e instanceof Error&&e.message.includes(bt)&&!s&&!i){const e=e=>jt({...e,_inErrorHandling:!0}),s=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:e,origin:t,remoteInfo:r,remoteEntryExports:o,globalLoading:C,uniqueKey:n});if(s)return await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,remoteEntryExports:s,recovered:!0}),s}throw await t.loaderHook.lifecycle.afterLoadEntry.emit({origin:t,remoteInfo:r,error:e}),e}))}return C[a]}function Dt(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||z,entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||q}}function Ct(e,t){return t&&"."!==t?`${e}/${t.replace(/^\.\//,"")}`:e}function Ht(e,t){for(const o of e){const e=t.startsWith(o.name);let r=t.replace(o.name,"");if(e){if(r.startsWith("/"))return r=`.${r}`,{pkgNameOrAlias:o.name,expose:r,remote:o};if(""===r)return{pkgNameOrAlias:o.name,expose:".",remote:o}}const n=o.alias&&t.startsWith(o.alias);let s=o.alias&&t.replace(o.alias,"");if(o.alias&&n){if(s&&s.startsWith("/"))return s=`.${s}`,{pkgNameOrAlias:o.alias,expose:s,remote:o};if(""===s)return{pkgNameOrAlias:o.alias,expose:".",remote:o}}}}function Ft(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function Ut(e){return e instanceof Error&&(e.message.includes("timed out")||e.name.includes("Timeout"))}function Gt(e,t,o,r){return{url:t,status:o,resourceType:e.resourceType,initiator:e.initiator,id:e.id,error:r}}function Bt({host:e,remoteInfo:t,url:o,attrs:r,context:n,needDeleteLink:s}){return new Promise((i=>{const{link:a,needAttach:c}=function(e){let t,o=null,r=!0,n=2e4;const s=document.getElementsByTagName("link");for(let t=0;t<s.length;t++){const n=s[t],i=n.getAttribute("href"),a=n.getAttribute("rel");if(i&&rt(i,e.url)&&a===e.attrs.rel){o=n,r=!1;break}}if(!o){let t;o=document.createElement("link"),o.setAttribute("href",e.url);let r=!0;const s=e.attrs;e.createLinkHook&&(t=e.createLinkHook(e.url,s),t instanceof HTMLLinkElement?(o=t,r=!1):"object"==typeof t&&("link"in t&&t.link&&(o=t.link,r=!1),"timeout"in t&&t.timeout&&(n=t.timeout))),s&&r&&Object.keys(s).forEach((e=>{o&&!o.getAttribute(e)&&o.setAttribute(e,s[e])}))}if(!r)return Promise.resolve().then((()=>{e?.cb&&e?.cb()})),{link:o,needAttach:r};const i=(r,n)=>{t&&clearTimeout(t);const s=()=>{if("error"===n?.type){const t=new Error(n?.isTimeout?`LinkNetworkError: Link "${e.url}" timed out.`:`LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);t.name="LinkNetworkError",e?.onErrorCallback&&e?.onErrorCallback(t)}else e?.cb&&e?.cb()};if(o&&(o.onerror=null,o.onload=null,ot((()=>{const{needDeleteLink:t=!0}=e;t&&o?.parentNode&&o.parentNode.removeChild(o)})),r)){const e=r(n);return s(),e}s()};return o.onerror=i.bind(null,o.onerror),o.onload=i.bind(null,o.onload),t=setTimeout((()=>{i(null,{type:"error",isTimeout:!0})}),n),{link:o,needAttach:r}}({url:o,cb:()=>{i(Gt(n,o,c?"success":"cached"))},onErrorCallback:e=>{i(Gt(n,o,Ut(e)?"timeout":"error",e))},attrs:r,createLinkHook:(o,r)=>{const s=e.loaderHook.lifecycle.createLink.emit({url:o,attrs:r,remoteInfo:t,resourceContext:{...n,url:o}});return HTMLLinkElement,s},needDeleteLink:s});c&&document.head.appendChild(a)}))}function Vt({host:e,remoteInfo:t,url:o,attrs:r,context:n}){return new Promise((s=>{const{script:i,needAttach:a}=nt({url:o,cb:()=>{s(Gt(n,o,a?"success":"cached"))},onErrorCallback:e=>{s(Gt(n,o,Ut(e)?"timeout":"error",e))},attrs:r,createScriptHook:(o,r)=>{const s=e.loaderHook.lifecycle.createScript.emit({url:o,attrs:r,remoteInfo:t,resourceContext:{...n,url:o}});return HTMLScriptElement,s},needDeleteScript:!0});a&&document.head.appendChild(i)}))}function Wt(e,t){return{...e,resourceType:t}}function qt(e,t,o,r=!0,n={initiator:"preloadRemote",id:e.name}){const{cssAssets:s,jsAssetsWithoutEntry:i,entryAssets:a}=o,c=[];if(t.options.inBrowser){if(a.forEach((e=>{const{moduleInfo:o}=e;c.push(async function(e,t,o,r){const n=e.moduleCache.get(o.name),s=o.entry;if(n?.remoteEntryExports)return Gt(r,s,"cached");try{if(!await jt({origin:e,remoteInfo:o,remoteEntryExports:n?.remoteEntryExports,resourceContext:{...r,url:s}}))throw new Error(`Failed to load remoteEntry "${s}".`);return Gt(r,s,"success")}catch(e){return Gt(r,s,Ut(e)?"timeout":"error",e)}}(t,0,o,Wt(n,"remoteEntry")))})),r){const o={rel:"preload",as:"style"};s.forEach((r=>{c.push(Bt({host:t,remoteInfo:e,url:r,attrs:o,context:Wt(n,"css")}))}))}else{const o={rel:"stylesheet",type:"text/css"};s.forEach((r=>{c.push(Bt({host:t,remoteInfo:e,url:r,attrs:o,needDeleteLink:!1,context:Wt(n,"css")}))}))}let o=Vt,l={fetchpriority:"high",type:"text/javascript"};r?(o=Bt,l={rel:"preload",as:"script"}):xt(e.type)&&(o=Bt,l={rel:"modulepreload",fetchpriority:"high"}),i.forEach((r=>{c.push(o({host:t,remoteInfo:e,url:r,attrs:l,context:Wt(n,"js")}))}))}return Promise.all(c)}function zt(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function Kt(e){const t={};for(const[o,r]of Object.entries(e.shared)){const e=r[0];e&&(t[o]={version:e.version,singleton:e.shareConfig?.singleton,requiredVersion:!1!==e.shareConfig?.requiredVersion&&e.shareConfig?.requiredVersion,eager:e.eager,strictVersion:e.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?"host":"unknown"},mfConfig:{name:e.name,remotes:e.remotes?.map(zt)??[],shared:t}}}function Zt(e){if(!e||!("modules"in e)||!Array.isArray(e.modules))return;const t=e.modules.map((e=>e.moduleName)).filter(Boolean);return t.length?t.join(","):void 0}var Jt=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(e){if(this.remoteEntryExports)return this.remoteEntryExports;const t=await jt({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports,resourceContext:{initiator:"loadRemote",id:Ct(this.remoteInfo.name,e),resourceType:"remoteEntry"}});return w(t,`remoteEntryExports is undefined \n ${tt(this.remoteInfo)}`),this.remoteEntryExports=t,this.remoteEntryExports}async init(e,t,o,r){const n=await this.getEntry(r);if(this.inited)return await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host}),n;if(this.initPromise){try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,cached:!0,origin:this.host})}catch(o){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:o,cached:!0,origin:this.host}),o}return n}this.initing=!0,this.initPromise=(async()=>{await this.host.loaderHook.lifecycle.beforeInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,origin:this.host});const{remoteEntryInitOptions:r,shareScope:s,initScope:i}=function(e,t,o){const r=t,n=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];n.length||n.push("default"),n.forEach((e=>{r[e]||(r[e]={})}));const s={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?n:e.shareScope||"default"};return Object.defineProperty(s,"shareScopeMap",{value:r,enumerable:!1}),{remoteEntryInitOptions:s,shareScope:r[n[0]],initScope:o??[]}}(this.remoteInfo,this.host.shareScopeMap,o),a=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:s,remoteEntryInitOptions:r,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});void 0===n?.init&&$(pt,Ot,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,Kt(this.host.options));try{await n.init(a.shareScope,a.initScope,a.remoteEntryInitOptions)}catch(e){$(kt,Ot,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName,shareScope:this.remoteInfo.shareScope},`${e}`,Kt(this.host.options))}await this.host.hooks.lifecycle.initContainer.emit({...a,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise,await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,origin:this.host})}catch(o){throw await this.host.loaderHook.lifecycle.afterInitRemote.emit({id:e,remoteInfo:this.remoteInfo,remoteSnapshot:t,remoteEntryExports:n,error:o,origin:this.host}),o}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,o,r){const{loadFactory:n=!0}=o||{loadFactory:!0},s=await this.init(e,r,void 0,t);let i;this.lib=s,await this.host.loaderHook.lifecycle.beforeGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,origin:this.host});try{const o=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:s,expose:t,moduleInfo:this.remoteInfo});i="function"==typeof o?o:void 0,i||(i=await s.get(t)),i||$(Rt,Ot,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,expose:t,requestId:e,availableExposes:Zt(r)},void 0,Kt(this.host.options)),await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,moduleFactory:i,origin:this.host})}catch(o){throw await this.host.loaderHook.lifecycle.afterGetExpose.emit({id:e,expose:t,moduleInfo:this.remoteInfo,remoteEntryExports:s,error:o,origin:this.host}),o}const a=((e,t)=>{let o;return o=e.endsWith("/")?e.slice(0,-1):e,t.startsWith(".")&&(t=t.slice(1)),o+=t,o})(this.remoteInfo.name,t),c=this.wraperFactory(i,a);if(!n)return c;await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,origin:this.host});try{const o=await c();return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,exposeModule:o,origin:this.host}),o}catch(o){throw await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({id:e,expose:t,moduleInfo:this.remoteInfo,loadFactory:n,error:o,origin:this.host}),o}}wraperFactory(e,t){function o(e,t){e&&"object"==typeof e&&Object.isExtensible(e)&&!Object.getOwnPropertyDescriptor(e,Symbol.for("mf_module_id"))&&Object.defineProperty(e,Symbol.for("mf_module_id"),{value:t,enumerable:!1})}return()=>{const r=e();return r instanceof Promise?r.then((e=>(o(e,t),e))):(o(r,t),r)}}},Yt=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){var o;w((o=e,"[object Object]"===T.call(o)),"Plugin configuration is invalid.");const r=e.name;w(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach((t=>{const o=e[t];o&&this.lifecycle[t].on(o)})))}removePlugin(e){w(e,"A name is required.");const t=this.registerPlugins[e];w(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach((e=>{"name"!==e&&this.lifecycle[e].remove(t[e])}))}},Xt=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){"function"==typeof e&&this.listeners.add(e)}once(e){const t=this;this.on((function o(...r){return t.remove(o),e.apply(null,r)}))}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach((o=>{const r=o(...e);void 0!==r&&(t=r)})),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}};function Qt(e,t){if(!O(t))return!1;if(e!==t)for(const o in e)if(!(o in t))return!1;return!0}var eo=class extends Xt{constructor(e){super(),this.onerror=$,this.type=e}emit(e){O(e)||$(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const o=t(e);if(void 0===o)continue;if(!Qt(e,o)){this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}e=o}catch(e){N(e),this.onerror(e)}return e}},to=class extends Xt{constructor(e){super(),this.onerror=$,this.type=e}emit(e){O(e)||$(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let o=0;const r=t=>(N(t),this.onerror(t),e),n=s=>{if(void 0!==s&&Qt(e,s))e=s;else if(void 0!==s)return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`),e;if(o<t.length)try{return Promise.resolve(t[o++](e)).then(n,r)}catch(e){return r(e)}return e};return Promise.resolve(n(e))}return Promise.resolve(e)}};const oo="Remote loading is disabled by experiments.optimization.disableRemote.";var ro=class{constructor(){this.hooks=new Yt({})}formatAndRegisterRemote(){return[]}loadRemote(){throw new Error(oo)}preloadRemote(){throw new Error(oo)}registerRemotes(){throw new Error(oo)}getRemoteModuleAndOptions(){throw new Error(oo)}initRawContainer(){throw new Error(oo)}},no=class extends Xt{emit(...e){let t;const o=Array.from(this.listeners);if(o.length>0){let r=0;const n=t=>!1!==t&&(r<o.length?Promise.resolve(o[r++].apply(null,e)).then((o=>void 0===o||1===e.length&&o===e[0]?n(t):n(o))):t);t=n()}return Promise.resolve(t)}};function so(e,t){const o=x(t);o.url||$($t,Ot,{remoteName:e.name});let r=Qe(t,o.url);m||r.startsWith("http")||(r=`https:${r}`),e.type=o.type,e.entryGlobalName=o.globalName,e.entry=r,e.version=t.version,e.buildVersion=t.buildVersion}const io=(e,t)=>{if(!e)return t;const o=(e=>{if("."===e)return"";if(e.startsWith("./"))return e.replace("./","");if(e.startsWith("/")){const t=e.slice(1);return t.endsWith("/")?t.slice(0,-1):t}return e})(e);return o?o.endsWith("/")?`${o}${t}`:`${o}/${t}`:t};function ao(e){return!(!("remoteEntry"in e)||!e.remoteEntry.includes(c))}function co(e){const t=e.split(":");return 1===t.length?{name:t[0],version:void 0}:2===t.length?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function lo(e,t,o,r,n={},s){const{value:i}=F(e,v(t)),a=s||i;if(a&&!ao(a)&&(o(a,t,r),a.remotesInfo)){const t=Object.keys(a.remotesInfo);for(const r of t){if(n[r])continue;n[r]=!0;const t=co(r),s=a.remotesInfo[r];lo(e,{name:t.name,version:s.matchedVersion},o,!1,n,void 0)}}}const ho=(e,t)=>document.querySelector(`${e}[${"link"===e?"href":"src"}="${t}"]`);function mo(e,t,o,r,n){const s=[],i=[],a=[],c=new Set,l=new Set,{options:h}=e,{preloadConfig:m}=t,{depsRemote:u}=m;if(lo(r,o,((t,o,r)=>{let n;if(r)n=m;else if(Array.isArray(u)){const e=u.find((e=>e.nameOrAlias===o.name||e.nameOrAlias===o.alias));if(!e)return;n=Ft(e)}else{if(!0!==u)return;n=m}const c=Qe(t,x(t).url);c&&a.push({name:o.name,moduleInfo:{name:o.name,entry:c,type:"remoteEntryType"in t?t.remoteEntryType:"global",entryGlobalName:"globalName"in t?t.globalName:o.name,shareScope:"",version:"version"in t?t.version:void 0},url:c});let l="modules"in t?t.modules:[];const h=(d=n.exposes)?d.map((e=>"."===e?e:e.startsWith("./")?e.replace("./",""):e)):[];var d,f;function p(e){const o=e.map((e=>Qe(t,e)));return n.filter?o.filter(n.filter):o}if(h.length&&"modules"in t&&(l=t?.modules?.reduce(((e,t)=>(-1!==h?.indexOf(t.moduleName)&&e.push(t),e)),[])),l){const r=l.length;for(let a=0;a<r;a++){const r=l[a],c=`${o.name}/${r.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:"."===r.moduleName?o.name:c,name:o.name,remoteSnapshot:t,preloadConfig:n,remote:o,origin:e}),f=c,M.__FEDERATION__.__PRELOADED_MAP__.get(f)||("all"===n.resourceCategory?(s.push(...p(r.assets.css.async)),s.push(...p(r.assets.css.sync)),i.push(...p(r.assets.js.async)),i.push(...p(r.assets.js.sync))):"sync"===n.resourceCategory&&(s.push(...p(r.assets.css.sync)),i.push(...p(r.assets.js.sync))),W(c))}}}),!0,{},n),n.shared&&n.shared.length>0){const t=(t,o)=>{const{shared:r}=ze(e.shareScopeMap,o.sharedName,t,e.sharedHandler.hooks.lifecycle.resolveShare)||{};r&&"function"==typeof r.lib&&(o.assets.js.sync.forEach((e=>{c.add(e)})),o.assets.css.sync.forEach((e=>{l.add(e)})))};n.shared.forEach((e=>{const o=h.shared?.[e.sharedName];if(!o)return;const r=e.version?o.find((t=>t.version===e.version)):o;r&&A(r).forEach((o=>{t(o,e)}))}))}const d=i.filter((e=>!c.has(e)&&!ho("script",e)));return{cssAssets:s.filter((e=>!l.has(e)&&!ho("link",e))),jsAssetsWithoutEntry:d,entryAssets:a.filter((e=>!ho("script",e.url)))}}function uo(e,t){const o=G({name:t.name,version:t.options.version}),r=o&&"remotesInfo"in o&&o.remotesInfo&&F(o.remotesInfo,e.name).value;return r&&r.matchedVersion?{hostGlobalSnapshot:o,globalSnapshot:U(),remoteSnapshot:G({name:e.name,version:r.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:U(),remoteSnapshot:G({name:e.name,version:"version"in e?e.version:void 0})}}var fo=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new Yt({beforeLoadRemoteSnapshot:new no("beforeLoadRemoteSnapshot"),loadSnapshot:new to("loadGlobalSnapshot"),loadRemoteSnapshot:new to("loadRemoteSnapshot"),afterLoadSnapshot:new to("afterLoadSnapshot")}),this.manifestLoading=P.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,initiator:o="loadRemote"}){const{options:r}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:r,moduleInfo:e,origin:this.HostInstance});let n=G({name:this.HostInstance.options.name,version:this.HostInstance.options.version});var s;n||(n={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},s={[this.HostInstance.options.name]:n},L.__FEDERATION__.moduleInfo={...L.__FEDERATION__.moduleInfo,...s}),n&&"remotesInfo"in n&&!F(n.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(n.remotesInfo={...n?.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:i,remoteSnapshot:a,globalSnapshot:c}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:h}=await this.hooks.lifecycle.loadSnapshot.emit({options:r,moduleInfo:e,hostGlobalSnapshot:i,remoteSnapshot:a,globalSnapshot:c});let u,d;if(l)if(ao(l)){const r=m?l.remoteEntry:l.ssrRemoteEntry||l.remoteEntry||"",n=await this.loadManifestSnapshot(r,e,{},{initiator:o,id:t||e.name});u=n,d=B({...e,entry:r},n)}else{const{remoteSnapshot:t}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});u=t,d=h}else if(R(e)){const r=await this.loadManifestSnapshot(e.entry,e,{},{initiator:o,id:t||e.name});u=r,d=B(e,r)}else $(_t,Ot,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(h)},void 0,Kt(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:r,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:d}}getGlobalRemoteInfo(e){return uo(e,this.HostInstance)}async getManifestJson(e,t,o,r){return(async()=>{const o=Dt(t);let n=this.manifestCache.get(e);if(n)return n;try{let t=await this.loaderHook.lifecycle.fetch.emit(e,{},o,r?{...r,url:e,resourceType:"manifest"}:void 0);t&&t instanceof Response||(t=await fetch(e,{})),n=await t.json()}catch(r){n=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:"runtime",lifecycle:"afterResolve",remote:o,origin:this.HostInstance}),n||(delete this.manifestLoading[e],$(yt,Ot,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${r}`,Kt(this.HostInstance.options)))}const s=[!n.metaData&&"metaData",!n.exposes&&"exposes",!n.shared&&"shared"].filter(Boolean);return s.length>0&&await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:new Error(`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${s.join(", ")}.`),from:"runtime",lifecycle:"afterResolve",remote:o,origin:this.HostInstance}),s.length>0&&$(vt,Ot,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name,missingFields:s.join(",")},void 0,Kt(this.HostInstance.options)),this.manifestCache.set(e,n),n})()}async loadManifestSnapshot(e,t,o,r){return this.manifestLoading[e]||(this.manifestLoading[e]=(async()=>{const n=await this.getManifestJson(e,t,o,r),s=function(e,t={}){const{remotes:o={},overrides:r={},version:n}=t;let s;const i=()=>"publicPath"in e.metaData?"auto"!==e.metaData.publicPath&&""!==e.metaData.publicPath||!n?e.metaData.publicPath:n.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"):e.metaData.getPublicPath,a=Object.keys(r);let c={};Object.keys(o).length||(c=e.remotes?.reduce(((e,t)=>{let o;const n=t.federationContainerName;return o=a.includes(n)?r[n]:"version"in t?t.version:t.entry,e[n]={matchedVersion:o},e}),{})||{}),Object.keys(o).forEach((e=>c[e]={matchedVersion:a.includes(e)?r[e]:o[e]}));const{remoteEntry:{path:l,name:h,type:m},types:u={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:d},globalName:f,ssrRemoteEntry:p}=e.metaData,{exposes:y}=e;let g={version:n||"",buildVersion:d,globalName:f,remoteEntry:io(l,h),remoteEntryType:m,remoteTypes:io(u.path,u.name),remoteTypesZip:u.zip||"",remoteTypesAPI:u.api||"",remotesInfo:c,shared:e?.shared.map((e=>({assets:e.assets,sharedName:e.name,version:e.version,usedExports:e.referenceExports||[]}))),modules:y?.map((e=>({moduleName:e.name,modulePath:e.path,assets:e.assets})))};if("publicPath"in e.metaData?(s={...g,publicPath:i()},"string"==typeof e.metaData.ssrPublicPath&&(s.ssrPublicPath=e.metaData.ssrPublicPath)):s={...g,getPublicPath:i()},p){const e=io(p.path,p.name);s.ssrRemoteEntry=e,s.ssrRemoteEntryType=p.type||"commonjs-module"}return s}(n,{version:e}),{remoteSnapshot:i}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:n,remoteSnapshot:s,manifestUrl:e,from:"manifest"});return i})().then((e=>e))),this.manifestLoading[e]}},po=class{constructor(){this.hooks=new Yt({})}},yo=class{constructor(e){this.hooks=new Yt({beforeRegisterShare:new eo("beforeRegisterShare"),afterResolve:new to("afterResolve"),beforeLoadShare:new to("beforeLoadShare"),loadShare:new no,afterLoadShare:new Xt("afterLoadShare"),errorLoadShare:new Xt("errorLoadShare"),resolveShare:new eo("resolveShare"),initContainerShareScopeMap:new eo("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}emitAfterLoadShare({lifecycle:e,pkgName:t,shareInfo:o,selectedShared:r}){try{this.hooks.lifecycle.afterLoadShare.emit({pkgName:t,shareInfo:o,selectedShared:r,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host})}catch(e){N(e)}}emitErrorLoadShare({lifecycle:e,pkgName:t,shareInfo:o,error:r,recovered:n}){try{this.hooks.lifecycle.errorLoadShare.emit({pkgName:t,shareInfo:o,shared:this.host.options.shared,shareScopeMap:this.shareScopeMap,lifecycle:e,origin:this.host,error:r,recovered:n})}catch(e){N(e)}}registerShared(e,t){const{newShareInfos:o,allShareInfos:r}=De(e,t);return Object.keys(o).forEach((e=>{o[e].forEach((o=>{o.scope.forEach((r=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:e,shared:o}),this.shareScopeMap[r]?.[e]||this.setShared({pkgName:e,lib:o.lib,get:o.get,loaded:o.loaded||Boolean(o.lib),shared:o,from:t.name})}))}))})),{newShareInfos:o,allShareInfos:r}}async loadShare(e,t){const{host:o}=this,r=Ze({pkgName:e,extraOptions:t,shareInfos:o.options.shared});let n=r;try{r?.scope&&await Promise.all(r.scope.map((async e=>{await Promise.all(this.initializeSharing(e,{strategy:r.strategy}))}))),n=(await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:r,shared:o.options.shared,origin:o})).shareInfo,w(n,`Cannot find shared "${e}" in host "${o.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const s=n,{shared:i,useTreesShaking:a}=ze(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(i){const t=Ye(i,a);if(t.lib)return Je(t,o.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),t.lib;if(t.loading&&!t.loaded){const r=await t.loading;return t.loaded=!0,t.lib||(t.lib=r),Je(t,o.options.name),this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),r}{const r=async()=>{const e=await t.get();return Je(t,o.options.name),t.loaded=!0,t.lib=e,e},n=r();this.setShared({pkgName:e,loaded:!1,shared:i,from:o.options.name,lib:null,loading:n,treeShaking:a?t:void 0});const c=await n;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:i}),c}}{if(t?.customShareInfo)return this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,recovered:!0}),!1;const r=Ce(s.treeShaking),n=Ye(s,r),i=async()=>{const t=await n.get();n.lib=t,n.loaded=!0,Je(n,o.options.name);const{shared:r,useTreesShaking:i}=ze(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(r){const e=Ye(r,i);e.lib=t,e.loaded=!0,r.from=s.from}return t},a=i();this.setShared({pkgName:e,loaded:!1,shared:s,from:o.options.name,lib:null,loading:a,treeShaking:r?n:void 0});const c=await a;return this.emitAfterLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:s,selectedShared:s}),c}}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShare",pkgName:e,shareInfo:n,error:t}),t}}initializeSharing(e=q,t){const{host:o}=this,r=t?.from,n=t?.strategy;let s=t?.initScope;const i=[];if("build"!==r){const{initTokens:t}=this;s||(s=[]);let o=t[e];if(o||(o=t[e]={from:this.host.name}),s.indexOf(o)>=0)return i;s.push(o)}const a=this.shareScopeMap,c=o.options.name;a[e]||(a[e]={});const l=a[e];return Object.keys(o.options.shared).forEach((t=>{o.options.shared[t].forEach((o=>{o.scope.includes(e)&&((e,t)=>{const{version:o,eager:r}=t;l[e]=l[e]||{};const n=l[e],s=n[o]&&Ye(n[o]),i=Boolean(s&&("eager"in s&&s.eager||"shareConfig"in s&&s.shareConfig?.eager));(!s||"loaded-first"!==s.strategy&&!s.loaded&&(Boolean(!r)!==!i?r:c>n[o].from))&&(n[o]=t)})(t,o)}))})),"version-first"!==o.options.shareStrategy&&"version-first"!==n||o.options.remotes.forEach((t=>{t.shareScope===e&&i.push((async e=>{const{module:t}=await o.remoteHandler.getRemoteModuleAndOptions({id:e});let r;try{r=await t.getEntry()}catch(n){if(r=await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:"runtime",lifecycle:"beforeLoadShare",remote:t.remoteInfo,origin:o}),!r)return}finally{r?.init&&!t.initing&&(t.remoteEntryExports=r,await t.init(void 0,void 0,s))}})(t.name))})),i}loadShareSync(e,t){const{host:o}=this,r=Ze({pkgName:e,extraOptions:t,shareInfos:o.options.shared});try{r?.scope&&r.scope.forEach((e=>{this.initializeSharing(e,{strategy:r.strategy})}));const{shared:n}=ze(this.shareScopeMap,e,r,this.hooks.lifecycle.resolveShare)||{};if(n){if("function"==typeof n.lib)return Je(n,o.options.name),n.loaded||(n.loaded=!0,n.from===o.options.name&&(r.loaded=!0)),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:r,selectedShared:n}),n.lib;if("function"==typeof n.get){const t=n.get();if(!(t instanceof Promise))return Je(n,o.options.name),this.setShared({pkgName:e,loaded:!0,from:o.options.name,lib:t,shared:n}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:r,selectedShared:n}),t}}if(r.lib)return r.loaded||(r.loaded=!0),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:r,selectedShared:r}),r.lib;if(r.get){const n=r.get();return n instanceof Promise&&$("build"===t?.from?Et:St,Ot,{hostName:o.options.name,sharedPkgName:e},void 0,Kt(o.options)),r.lib=n,this.setShared({pkgName:e,loaded:!0,from:o.options.name,lib:r.lib,shared:r}),this.emitAfterLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:r,selectedShared:r}),r.lib}$(St,Ot,{hostName:o.options.name,sharedPkgName:e},void 0,Kt(o.options))}catch(t){throw this.emitErrorLoadShare({lifecycle:"loadShareSync",pkgName:e,shareInfo:r,error:t}),t}}initShareScopeMap(e,t,o={}){const{host:r}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:r.options,origin:r,scopeName:e,hostShareScopeMap:o.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:o,lib:r,loading:n,loaded:s,get:i,treeShaking:a}){const{version:c,scope:l="default",...h}=t;(Array.isArray(l)?l:[l]).forEach((t=>{this.shareScopeMap[t]||(this.shareScopeMap[t]={}),this.shareScopeMap[t][e]||(this.shareScopeMap[t][e]={}),this.shareScopeMap[t][e][c]||(this.shareScopeMap[t][e][c]={version:c,scope:[t],...h,lib:r});const l=this.shareScopeMap[t][e][c];(e=>{const t=(e,t,o)=>{o&&!e[t]&&(e[t]=o)},o=a?e.treeShaking:e;t(o,"loaded",s),t(o,"loading",n),t(o,"get",i)})(l),o&&l.from!==o&&(l.from=o)}))}_setGlobalShareScopeMap(e){const t=Ke(),o=e.id||e.name;o&&!t[o]&&(t[o]=this.shareScopeMap)}},go=class{constructor(){this.shareScopeMap={},this.hooks=new Yt({afterResolve:new to("afterResolve")})}registerShared(){return{newShareInfos:{},allShareInfos:{}}}loadShare(){throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.")}loadShareSync(){throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.")}initializeSharing(){return[]}initShareScopeMap(e,t){this.shareScopeMap[e]=t}},Eo=class{constructor(e){this.hooks=new Yt({beforeRegisterRemote:new eo("beforeRegisterRemote"),registerRemote:new eo("registerRemote"),beforeRequest:new to("beforeRequest"),afterMatchRemote:new no("afterMatchRemote"),onLoad:new no("onLoad"),afterLoadRemote:new no("afterLoadRemote"),handlePreloadModule:new Xt("handlePreloadModule"),errorLoadRemote:new no("errorLoadRemote"),beforePreloadRemote:new no("beforePreloadRemote"),generatePreloadAssets:new no("generatePreloadAssets"),afterPreloadRemote:new no("afterPreloadRemote"),loadEntry:new no}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce(((e,t)=>(this.registerRemote(t,e,{force:!1}),e)),e.remotes)}setIdToRemoteMap(e,t){const{remote:o,expose:r}=t,{name:n,alias:s}=o;if(this.idToRemoteMap[e]={name:o.name,expose:r},s&&e.startsWith(n)){const t=e.replace(n,s);this.idToRemoteMap[t]={name:o.name,expose:r}}else if(s&&e.startsWith(s)){const t=e.replace(s,n);this.idToRemoteMap[t]={name:o.name,expose:r}}}async loadRemote(e,t){const{host:o}=this,r=Ht(o.options.remotes,e);let n,s=e,i=r?.expose,a=r?Dt(r.remote):void 0;try{const{loadFactory:r=!0}=t||{loadFactory:!0},{module:c,moduleOptions:l,remoteMatchInfo:h}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:m,remote:u,expose:d,id:f,remoteSnapshot:p}=h;s=f,i=d,a=Dt(u);const y=await c.get(f,d,t,p),g=await this.hooks.lifecycle.onLoad.emit({id:f,pkgNameOrAlias:m,expose:d,exposeModule:r?y:void 0,exposeModuleFactory:r?void 0:y,remote:u,options:l,moduleInstance:c,origin:o});return this.setIdToRemoteMap(e,h),n={id:s,expose:i,remote:a,options:t,origin:o},"function"==typeof g?g:y}catch(r){const{from:c="runtime"}=t||{from:"runtime"};let l;try{l=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:r,from:c,lifecycle:"onLoad",expose:i,remote:a,origin:o})}catch(e){throw n={id:s,expose:i,remote:a,options:t,error:e,origin:o},e}if(!l)throw n={id:s,expose:i,remote:a,options:t,error:r,origin:o},r;return n={id:s,expose:i,remote:a,options:t,error:r,origin:o,recovered:!0},l}finally{n&&await this.hooks.lifecycle.afterLoadRemote.emit(n)}}async preloadRemote(e){const{host:t}=this,o=[];await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=(n=t.options.remotes,e.map((e=>{const t=function(e,t){for(const o of e){if(t===o.name)return o;if(o.alias&&t===o.alias)return o}}(n,e.nameOrAlias);return w(t,`Unable to preload ${e.nameOrAlias} as it is not included in ${!t&&tt({remoteInfo:t,remotes:n})}`),{remote:t,preloadConfig:Ft(e)}})));var n;let s;await Promise.all(r.flatMap((e=>{const{preloadConfig:t,remote:o}=e,r=t.exposes||[];return r.length?r.map((r=>({ops:{...e,preloadConfig:{...t,exposes:[r]}},id:Ct(o.name,r)}))):[{ops:e,id:`${o.name}/*`}]})).map((async e=>{const{ops:r,id:n}=e,{remote:s,preloadConfig:i}=r,a=Dt(s);try{const{globalSnapshot:e,remoteSnapshot:c}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:s,id:n,initiator:"preloadRemote"}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:r,remote:s,remoteInfo:a,globalSnapshot:e,remoteSnapshot:c});if(!l)return;const h=await qt(a,t,l,!0,{initiator:"preloadRemote",id:n});o.push({remote:s,remoteInfo:a,preloadConfig:i,id:n,results:h})}catch(e){o.push({remote:s,remoteInfo:a,preloadConfig:i,id:n,results:[{url:a.entry,status:"error",resourceType:/\.json(?:$|[?#])/i.test(a.entry)?"manifest":"remoteEntry",initiator:"preloadRemote",id:n,error:e}]})}})));const i=o.flatMap((e=>e.results.filter((e=>"error"===e.status||"timeout"===e.status))));if(i.length>0&&(s=new Error(`preloadRemote failed to load ${i.length} resource(s).`),Object.assign(s,{results:o,failedResults:i})),await this.hooks.lifecycle.afterPreloadRemote.emit({preloadOps:e,options:t.options,origin:t,results:o,error:s}),s)throw s}registerRemotes(e,t){const{host:o}=this;e.forEach((e=>{this.registerRemote(e,o.options.remotes,{force:t?.force})}))}initRawContainer(e,t,o){const{host:r}=this,n=new Jt({host:r,remoteInfo:Dt({name:e,entry:t})});return n.remoteEntryExports=o,r.moduleCache.set(e,n),n}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:o}=e;let r;try{r=await this.hooks.lifecycle.beforeRequest.emit({id:o,options:t.options,origin:t})}catch(e){if(r=await this.hooks.lifecycle.errorLoadRemote.emit({id:o,options:t.options,origin:t,from:"runtime",error:e,lifecycle:"beforeRequest"}),!r)throw e}const{id:n}=r,s=Ht(t.options.remotes,n);if(!s)try{$(gt,Ot,{hostName:t.options.name,requestId:n},void 0,Kt(t.options))}catch(e){throw await this.hooks.lifecycle.afterMatchRemote.emit({id:n,options:t.options,error:e,origin:t}),e}const{remote:i}=s,a=Dt(i);await this.hooks.lifecycle.afterMatchRemote.emit({id:n,...s,options:t.options,remoteInfo:a,origin:t});const c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:n,...s,options:t.options,origin:t,remoteInfo:a}),{remote:l,expose:h}=c;w(l&&h,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);let m=t.moduleCache.get(l.name);const u={host:t,remoteInfo:a};return m||(m=new Jt(u),t.moduleCache.set(l.name,m)),{module:m,moduleOptions:u,remoteMatchInfo:c}}registerRemote(e,t,o){const{host:r}=this,n=()=>{if(e.alias){const o=t.find((t=>e.alias&&(t.name.startsWith(e.alias)||t.alias?.startsWith(e.alias))));w(!o,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${o&&o.name} name or alias`)}"entry"in e&&m&&"undefined"!=typeof window&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=q),e.type||(e.type=z)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:r});const s=t.find((t=>t.name===e.name));if(s){const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];o?.force&&(this.removeRemote(s),n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r}),et(i.join(" ")))}else n(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:r})}removeRemote(e){try{const{host:t}=this,{name:o}=e,r=t.options.remotes.findIndex((e=>e.name===o));-1!==r&&t.options.remotes.splice(r,1);const n=F(M.__FEDERATION__.moduleInfo,v(e)).key;delete M.__FEDERATION__.moduleInfo[n],"entry"in e&&(t.snapshotHandler.manifestCache.delete(e.entry),delete P.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);const{hostGlobalSnapshot:s}=uo(e,t);if(s){const t=s&&"remotesInfo"in s&&s.remotesInfo&&F(s.remotesInfo,e.name).key;t&&delete s.remotesInfo[t]}const i=t.moduleCache.get(e.name);if(i){const o=i.remoteInfo,r=o.entryGlobalName;M[r]&&(Object.getOwnPropertyDescriptor(M,r)?.configurable?delete M[r]:M[r]=void 0);const n=Pt(i.remoteInfo);C[n]&&delete C[n];let s=o.buildVersion?Xe(o.name,o.buildVersion):o.name;const a=M.__FEDERATION__.__INSTANCES__.findIndex((e=>o.buildVersion?e.options.id===s:e.name===s));if(-1!==a){const e=M.__FEDERATION__.__INSTANCES__[a];s=e.options.id||s;const t=Ke();let r=!0;const n=[];Object.keys(t).forEach((e=>{const s=t[e];s&&Object.keys(s).forEach((t=>{const i=s[t];i&&Object.keys(i).forEach((s=>{const a=i[s];a&&Object.keys(a).forEach((i=>{const c=a[i];c&&"object"==typeof c&&c.from===o.name&&(c.loaded||c.loading?(c.useIn=c.useIn.filter((e=>e!==o.name)),c.useIn.length?r=!1:n.push([e,t,s,i])):n.push([e,t,s,i]))}))}))}))})),r&&(e.shareScopeMap={},delete t[s]),n.forEach((([e,o,r,n])=>{delete t[e]?.[o]?.[r]?.[n]})),M.__FEDERATION__.__INSTANCES__.splice(a,1)}t.moduleCache.delete(e.name)}}catch(e){I.error(`removeRemote failed: ${e instanceof Error?e.message:String(e)}`)}}};const So="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN||!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN,_o="boolean"!=typeof FEDERATION_OPTIMIZE_NO_REMOTE||!FEDERATION_OPTIMIZE_NO_REMOTE,bo="boolean"!=typeof FEDERATION_OPTIMIZE_NO_SHARED||!FEDERATION_OPTIMIZE_NO_SHARED;var Io=class{constructor(e){this.hooks=new Yt({beforeInit:new eo("beforeInit"),init:new Xt,beforeInitContainer:new to("beforeInitContainer"),initContainer:new to("initContainer")}),this.version="2.8.2",this.moduleCache=new Map,this.loaderHook=new Yt({getModuleInfo:new Xt,createScript:new Xt,createLink:new Xt,fetch:new no,loadEntryError:new no,afterLoadEntry:new no("afterLoadEntry"),beforeInitRemote:new no("beforeInitRemote"),afterInitRemote:new no("afterInitRemote"),beforeGetExpose:new no("beforeGetExpose"),afterGetExpose:new no("afterGetExpose"),beforeExecuteFactory:new no("beforeExecuteFactory"),afterExecuteFactory:new no("afterExecuteFactory"),getModuleFactory:new no}),this.bridgeHook=new Yt({beforeBridgeRender:new Xt,afterBridgeRender:new Xt,beforeBridgeDestroy:new Xt,afterBridgeDestroy:new Xt});const t=_o&&So?[{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:o,expose:r,origin:n,remoteInfo:s,id:i}=e;if(!R(t)||!k(t)){const{remoteSnapshot:a,globalSnapshot:c}=await n.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:Ct(t.name,r)});so(s,a);const l={remote:t,preloadConfig:{nameOrAlias:o,exposes:[r],resourceCategory:"sync",share:!1,depsRemote:!1}},h=await n.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:n,preloadOptions:l,remoteInfo:s,remote:t,remoteSnapshot:a,globalSnapshot:c});return h&&qt(s,n,h,!1,{initiator:"loadRemote",id:i}).catch((()=>{})),{...e,remoteSnapshot:a}}return e}},{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:o,remoteInfo:r,remote:n,globalSnapshot:s,remoteSnapshot:i}=e;return m?R(n)&&k(n)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:n.name,url:n.entry,moduleInfo:{name:r.name,entry:n.entry,type:r.type||"global",entryGlobalName:"",shareScope:""}}]}:(so(r,i),mo(t,o,r,s,i)):{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[]}}}]:[],o={id:"undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"",name:e.name,plugins:t,remotes:[],shared:{},inBrowser:m};this.name=e.name,this.options=o,this.snapshotHandler=_o?new fo(this):new po,this.sharedHandler=bo?new yo(this):new go,this.remoteHandler=_o?new Eo(this):new ro,this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...o.plugins,...e.plugins||[]]),this.options=this.formatOptions(o,e)}initOptions(e){e.name&&e.name!==this.options.name&&$(_(wt,Ot)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=q,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,o){return this.remoteHandler.initRawContainer(e,t,o)}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,o={}){this.sharedHandler.initShareScopeMap(e,t,o)}formatOptions(e,t){const o=bo?De(e,t).allShareInfos:{},{userOptions:r,options:n}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:o}),s=this.remoteHandler.formatAndRegisterRemote(n,r),{allShareInfos:i}=this.sharedHandler.registerShared(n,r),a=[...n.plugins];r.plugins&&r.plugins.forEach((e=>{a.includes(e)||a.push(e)}));const c={...e,...t,plugins:a,remotes:s,shared:i,id:r.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){const t=function(e,t){const o=L.__FEDERATION__.__GLOBAL_PLUGIN__,r=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return o.length>0&&o.forEach((t=>{e?.find((e=>e.name!==t.name))&&e.push(t)})),e&&e.length>0&&e.forEach((e=>{r.forEach((o=>{o.applyPlugin(e,t)}))})),e}(e,this);this.options.plugins=this.options.plugins.reduce(((e,t)=>t?(e&&!e.find((e=>e.name===t.name))&&e.push(t),e):e),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};Object.defineProperty,"boolean"==typeof FEDERATION_OPTIMIZE_NO_REMOTE&&FEDERATION_OPTIMIZE_NO_REMOTE;let wo=null;function $o(e){const t=function(e,t){const o="undefined"!=typeof FEDERATION_BUILD_IDENTIFIER?FEDERATION_BUILD_IDENTIFIER:"";return M.__FEDERATION__.__INSTANCES__.find((r=>!(!o||r.options.id!==o)||r.options.name===e&&!r.options.version&&!t||!(r.options.name!==e||!t||r.options.version!==t)))}(e.name,e.version),o={...e,id:e.id||""};return t?(t.initOptions(o),wo||(wo=t),t):(wo=function(e){const t=new(M.__FEDERATION__.__DEBUG_CONSTRUCTOR__||Io)({id:`${e.name}@${e.version||Date.now()}`,...e});return function(e){M.__FEDERATION__.__INSTANCES__.push(e)}(t),t}(o),wo)}!function(e,t=f()){t&&(M.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,M.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.8.2")}(Io);let No=!1;const vo=new Set,Ro=async(e,t,o,r="default")=>{console.debug(`loading Appshell component: { scope: ${e}, module: ${t}, shareScope: ${r} }`),No||(No=!0,wo||$o({name:"Appshell",remotes:[]})),vo.has(e)||(vo.add(e),function(...e){w(wo,It,Ot),wo.registerRemotes.apply(wo,e)}([{name:e,entry:o}]));const n=t.replace(/^\.\//,""),s=await function(...e){return w(wo,It,Ot),wo.loadRemote.apply(wo,e)}(`${e}/${n}`);if(!s)throw new Error(`Failed to find module container ${e}`);return console.debug(`Appshell component loaded: { scope: ${e}, module: ${t}, shareScope: ${r} }`),s.default},ko=async e=>{const{loader:t}=e;if("ModuleFederation"!==t.kind)throw new Error(`No loader for kind '${t.kind}'.`);return Ro(t.scope,t.module,e.remoteEntryUrl,t.shareScope)},Oo=(e={})=>{const t=e.composition??("undefined"==typeof window?void 0:window.__appshell_config__),o=e.resolver??((...e)=>async t=>{for(const o of e){const e=await o(t);if(e)return e}})((e=>async t=>{const o=e?.remotes[t];if(e&&o)return{remote:o,vars:e.vars[o.loader.scope]??{}}})(t),((e,t="")=>async o=>{if(!e)return;const r=`${t}/v1/applications/${e.applicationId}/remotes/${o}`,n=await fetch(r,{credentials:"include"});if(!n.ok)return;const s=await n.json();return{remote:s,vars:e.vars[s.loader.scope]??{}}})(t));return async e=>{const t=t=>new Error(`Failed to load component '${e}'. ${t?.toString()}`);let r;try{r=await o(e)}catch(e){throw t(e)}if(!r)throw new Error(`Remote resource not found in registry. Expected: ${e}`);const{remote:n,vars:s}=r;try{return(0,a.setVars)(n.loader.scope,s),[await ko(n),n]}catch(e){throw t(e)}}};(Object.getOwnPropertyDescriptor(Oo,"name")||{}).writable||Object.defineProperty(Oo,"name",{value:"default",configurable:!0});const To=Oo;var Ao=s(155),xo=s.n(Ao),Mo=s(272);const Lo=(0,Ao.createContext)(void 0),Po=({remote:e,children:t})=>(0,Mo.jsx)(Lo.Provider,{value:e,children:t});Po.defaultProps={remote:void 0},Lo.Consumer;const jo=Lo,Do=({remote:e,reason:t})=>(0,Mo.jsxs)("div",{style:{border:"3px solid red"},children:[(0,Mo.jsx)("h5",{children:`Error loading Appshell component '${e}.'`}),(0,Mo.jsx)("span",{style:{fontSize:"1rem"},children:t})]}),Co=({remote:e,fallback:t,...o})=>{const[r,n]=(0,Ao.useState)();return(0,Ao.useEffect)((()=>{let t=!1;const r=To();return n(void 0),async function(){try{const[s,i]=await r(e);if(t||!s)return;n((0,Mo.jsx)(Po,{remote:i,children:(0,Mo.jsx)(s,{...o})}))}catch(o){t||n((0,Mo.jsx)(Do,{remote:e,reason:`${o}`}))}}(),()=>{t=!0}}),[e,...Object.values(o)]),console.debug(`rendering RemoteSlot[${e}], loading=${!r}`),(0,Mo.jsx)(Mo.Fragment,{children:r||t})};Co.defaultProps={fallback:void 0};const Ho=Co,Fo=()=>xo().useContext(jo);(Object.getOwnPropertyDescriptor(Fo,"name")||{}).writable||Object.defineProperty(Fo,"name",{value:"default",configurable:!0});const Uo=e=>{let t,o="pending";const r=fetch(e,{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then((e=>{if(e.ok)return e.json().then((e=>{o="success",t=e}));o="error",t=new Error(`${e.status} ${e.statusText} ${e.url}`)}));return{read(){if("pending"===o)throw r;if("error"===o)throw t;if("success"===o)return t}}};return(Object.getOwnPropertyDescriptor(Uo,"name")||{}).writable||Object.defineProperty(Uo,"name",{value:"default",configurable:!0}),i})()));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export type AppshellContext = {
|
|
2
2
|
registry?: string;
|
|
3
3
|
/** Activation target as `scope/name`. */
|
|
4
|
-
|
|
4
|
+
application?: string;
|
|
5
5
|
scopeId: string;
|
|
6
6
|
token?: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* The registry,
|
|
9
|
+
* The registry, application, and token a developer is working against, resolved
|
|
10
10
|
* the way the CLI resolves them: env var, then `~/.appshell/config`, then a
|
|
11
11
|
* default. This lets the webpack plugin defer to `appshell config set` and
|
|
12
12
|
* `appshell login` instead of requiring per-project configuration.
|
|
@@ -18,6 +18,5 @@ export declare const resolveContext: () => AppshellContext;
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const persistedContext: () => {
|
|
20
20
|
registry?: string;
|
|
21
|
-
|
|
21
|
+
application?: string;
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,5 +12,3 @@ export declare const clearCredential: (registry: string) => void;
|
|
|
12
12
|
* Expired tokens are treated as absent; refresh is the caller's concern.
|
|
13
13
|
*/
|
|
14
14
|
export declare const resolveToken: (registry: string) => string | undefined;
|
|
15
|
-
export declare const requireToken: (registry: string) => string;
|
|
16
|
-
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1,8 +1,36 @@
|
|
|
1
|
+
import { AppshellTemplate } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Substitutes a template into the manifest the registry stores.
|
|
4
|
+
*
|
|
5
|
+
* Split out from the file-reading half so a caller holding a template in memory — the
|
|
6
|
+
* webpack plugin, which just built one — does not have to write it to disk and read it
|
|
7
|
+
* back to get a manifest. One substitution pass, one place it can be wrong.
|
|
8
|
+
*
|
|
9
|
+
* Operates on a copy, because substitution writes in place. Reading a template off disk
|
|
10
|
+
* hid that: every call parsed its own fresh object, so nothing downstream could notice.
|
|
11
|
+
* A caller passing a template it still holds would get its `${VAR}` placeholders replaced
|
|
12
|
+
* underneath it — and the plugin is exactly that caller, building the manifest during
|
|
13
|
+
* `processAssets` and then writing the same template to disk at `afterEmit`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const manifestFrom: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate) => {
|
|
16
|
+
vars: Record<string, Record<string, string | number | undefined>>;
|
|
17
|
+
components: Record<string, import("./types").PublishedRemote<TMetadata>>;
|
|
18
|
+
remotes?: string[];
|
|
19
|
+
shared?: import("./types").SharedContract;
|
|
20
|
+
tokens?: Record<string, import("./types").AppshellTokenUsage>;
|
|
21
|
+
overrides?: import("./types").AppshellOverrides;
|
|
22
|
+
};
|
|
1
23
|
/**
|
|
2
24
|
* Generates an appshell manifest
|
|
3
25
|
* @param templatePath path of the appshell manifest template to compile into an appshell manifest
|
|
4
26
|
* @returns an appshell manifest
|
|
5
27
|
*/
|
|
6
|
-
declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<
|
|
28
|
+
declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<{
|
|
29
|
+
vars: Record<string, Record<string, string | number | undefined>>;
|
|
30
|
+
components: Record<string, import("./types").PublishedRemote<TMetadata>>;
|
|
31
|
+
remotes?: string[];
|
|
32
|
+
shared?: import("./types").SharedContract;
|
|
33
|
+
tokens?: Record<string, import("./types").AppshellTokenUsage>;
|
|
34
|
+
overrides?: import("./types").AppshellOverrides;
|
|
35
|
+
} | null>;
|
|
7
36
|
export default _default;
|
|
8
|
-
//# sourceMappingURL=generate.manifest.d.ts.map
|
|
@@ -4,18 +4,15 @@
|
|
|
4
4
|
export { default as configmap } from './configmap';
|
|
5
5
|
export { persistedContext, resolveContext } from './context';
|
|
6
6
|
export type { AppshellContext } from './context';
|
|
7
|
-
export { clearCredential, credentialsPath,
|
|
7
|
+
export { clearCredential, credentialsPath, resolveToken, saveCredential } from './credentials';
|
|
8
8
|
export type { Credential } from './credentials';
|
|
9
|
-
export { default as
|
|
10
|
-
export {
|
|
11
|
-
export { default as generateGlobalConfig } from './generate.global-config';
|
|
12
|
-
export { default as generateManifest } from './generate.manifest';
|
|
9
|
+
export { default as generateManifest, manifestFrom } from './generate.manifest';
|
|
10
|
+
export { loaderOf } from './loader';
|
|
13
11
|
export { default as outdated } from './outdated';
|
|
14
|
-
export { activate, publish } from './publish';
|
|
15
|
-
export type { PublishOptions, PublishResult } from './publish';
|
|
16
|
-
export { default as register } from './register';
|
|
12
|
+
export { activate, openOverlay, publish } from './publish';
|
|
13
|
+
export type { OpenedOverlay, OverlayRemotePatch, PublishOptions, PublishResult } from './publish';
|
|
17
14
|
export { default as sync } from './sync';
|
|
18
|
-
export
|
|
15
|
+
export { caFile, httpsAgent } from './tls';
|
|
16
|
+
export type { AppshellComposition, AppshellConfig, AppshellConfigRemote, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, AppshellTokenUsage, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, ResolvedRemote, Schema, SharedConfig, SharedModuleSpec, SharedObject, } from './types';
|
|
19
17
|
export * as utils from './utils';
|
|
20
18
|
export * as validators from './validators';
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ModuleFederationLoader } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* How to load one component, derived from the Module Federation config that emits it.
|
|
4
|
+
*
|
|
5
|
+
* One definition, used twice: the manifest a publish stores, and the patch an overlay
|
|
6
|
+
* sends. Those describe the same thing from either side of a publish, and two copies of
|
|
7
|
+
* the derivation would disagree the moment one of them changed — the drift being that an
|
|
8
|
+
* overlay addresses a dev server's bundle by a container name the build no longer uses,
|
|
9
|
+
* which surfaces as module federation failing to find a container rather than as anything
|
|
10
|
+
* naming the cause.
|
|
11
|
+
*
|
|
12
|
+
* The federation fields sit under a kind rather than at the top level, so they read as one
|
|
13
|
+
* framework's vocabulary rather than as something generic.
|
|
14
|
+
*/
|
|
15
|
+
export declare const loaderOf: (module: {
|
|
16
|
+
shareScope?: string;
|
|
17
|
+
filename?: string;
|
|
18
|
+
}, federationKey: string) => ModuleFederationLoader;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) =>
|
|
3
|
-
|
|
1
|
+
import { AppshellTemplate, ConfigMap, PublishedRemote, SharedContract } from '../types';
|
|
2
|
+
export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) => {
|
|
3
|
+
vars: Record<string, Record<string, string | number | undefined>>;
|
|
4
|
+
components: Record<string, PublishedRemote<TMetadata>>;
|
|
5
|
+
remotes?: string[];
|
|
6
|
+
shared?: SharedContract;
|
|
7
|
+
tokens?: Record<string, import("../types").AppshellTokenUsage>;
|
|
8
|
+
overrides?: import("../types").AppshellOverrides;
|
|
9
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppshellManifest, Metadata } from './types';
|
|
1
|
+
import { AppshellManifest, Metadata, ModuleFederationLoader } from './types';
|
|
2
2
|
export type PublishOptions = {
|
|
3
3
|
registry: string;
|
|
4
4
|
token?: string;
|
|
@@ -14,6 +14,8 @@ export type PublishResult = {
|
|
|
14
14
|
/** `scope/name@version`. The scope comes from the token, not the caller. */
|
|
15
15
|
id: string;
|
|
16
16
|
created: boolean;
|
|
17
|
+
/** Empty unless a shared block was sent. See `openOverlay`. */
|
|
18
|
+
divergence: SharedDivergence[];
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* Publishing the same content twice is a no-op; publishing different content
|
|
@@ -22,8 +24,80 @@ export type PublishResult = {
|
|
|
22
24
|
*/
|
|
23
25
|
export declare const publish: ({ registry, token, name, version, manifest, visibility, metadata, force, }: PublishOptions) => Promise<PublishResult>;
|
|
24
26
|
/**
|
|
25
|
-
* Activating a newer version of an already active
|
|
26
|
-
* @param
|
|
27
|
+
* Activating a newer version of an already active package upgrades it in place.
|
|
28
|
+
* @param application `scope/name`
|
|
27
29
|
*/
|
|
28
|
-
export declare const activate: (registry: string,
|
|
29
|
-
|
|
30
|
+
export declare const activate: (registry: string, application: string, packageId: string, token?: string) => Promise<void>;
|
|
31
|
+
/** What an overlay redirects a single remote to, or introduces one as. */
|
|
32
|
+
export type OverlayRemotePatch = {
|
|
33
|
+
remoteEntryUrl: string;
|
|
34
|
+
manifestUrl?: string;
|
|
35
|
+
/**
|
|
36
|
+
* How to load this build's copy, from the Module Federation config that emits it.
|
|
37
|
+
*
|
|
38
|
+
* Sent because the loader describes the code being loaded, and an overlay points at
|
|
39
|
+
* this build rather than the published one. Without it a redirect addresses a dev
|
|
40
|
+
* server's bundle by whatever container name the last publish happened to have, so
|
|
41
|
+
* renaming the container locally resolves to a container the browser cannot find.
|
|
42
|
+
*
|
|
43
|
+
* It is also what lets an overlay introduce a component that is not published yet: a
|
|
44
|
+
* redirect inherits the published loader, an addition has no published anything.
|
|
45
|
+
*/
|
|
46
|
+
loader?: ModuleFederationLoader;
|
|
47
|
+
/**
|
|
48
|
+
* The remote's `metadata` as this build declares it.
|
|
49
|
+
*
|
|
50
|
+
* Sent because a developer iterating on `appshell.config.yaml` is editing metadata as
|
|
51
|
+
* much as code; without it an overlay serves their new bundle beside the published
|
|
52
|
+
* route, displayName and icon. The registry replaces rather than merges, so a key
|
|
53
|
+
* removed from the yaml disappears rather than standing.
|
|
54
|
+
*/
|
|
55
|
+
metadata?: Metadata;
|
|
56
|
+
};
|
|
57
|
+
/** One shared dependency where a local build and the published version disagree. */
|
|
58
|
+
export type SharedDivergence = {
|
|
59
|
+
packageId: string;
|
|
60
|
+
shareScope: string;
|
|
61
|
+
packageName: string;
|
|
62
|
+
published?: string;
|
|
63
|
+
local?: string;
|
|
64
|
+
singleton: {
|
|
65
|
+
published: boolean;
|
|
66
|
+
local: boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type OpenedOverlay = {
|
|
70
|
+
id: string;
|
|
71
|
+
confirmUrl: string;
|
|
72
|
+
url: string;
|
|
73
|
+
remotes: string[];
|
|
74
|
+
expiresAt: string;
|
|
75
|
+
/**
|
|
76
|
+
* False when an overlay was already open for this developer and this one extended it.
|
|
77
|
+
* A browser carries a single overlay id, so an extended overlay is one some browser has
|
|
78
|
+
* already confirmed — nothing needs sending back to the confirmation page.
|
|
79
|
+
*/
|
|
80
|
+
created: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* What this build declares that the published version does not. Empty unless a shared
|
|
83
|
+
* block was sent — see `openOverlay`.
|
|
84
|
+
*/
|
|
85
|
+
divergence: SharedDivergence[];
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Points some of an application's remotes at a developer's own machine, for that
|
|
89
|
+
* developer only.
|
|
90
|
+
*
|
|
91
|
+
* This is what a local dev loop does instead of republishing. A published version is
|
|
92
|
+
* immutable and content-addressed; overwriting one on every rebuild makes the digest
|
|
93
|
+
* describe whoever built last, and two developers sharing a registry overwrite each
|
|
94
|
+
* other. An overlay is per-developer, per-browser and expiring, so neither happens.
|
|
95
|
+
*
|
|
96
|
+
* Extending is the normal case rather than the exception: the registry merges remotes
|
|
97
|
+
* into whatever overlay this developer already holds, so serving two micro-frontends
|
|
98
|
+
* locally redirects both without minting a second overlay or asking for confirmation
|
|
99
|
+
* twice.
|
|
100
|
+
*
|
|
101
|
+
* @param application `scope/name`
|
|
102
|
+
*/
|
|
103
|
+
export declare const openOverlay: (registry: string, application: string, remotes: Record<string, OverlayRemotePatch>, token?: string, shared?: Record<string, unknown>, shellFlavor?: "prod" | "dev") => Promise<OpenedOverlay>;
|
|
@@ -18,4 +18,3 @@ export declare const groupByBaselineModule: (conflicts: Record<string, Compariso
|
|
|
18
18
|
*/
|
|
19
19
|
declare const _default: (workingDir: string, registry: string, conflicts: Record<string, ComparisonResult>, resolutionStrategy?: ResolutionStrategy, packageManager?: PackageManager, dryRun?: boolean) => Promise<void>;
|
|
20
20
|
export default _default;
|
|
21
|
-
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import https from 'https';
|
|
2
|
+
/**
|
|
3
|
+
* An extra CA bundle to trust, from `ca-file` in the cli config or `APPSHELL_CA_FILE`.
|
|
4
|
+
*
|
|
5
|
+
* A registry behind a private CA — a corporate root, a TLS-inspecting proxy, or a local
|
|
6
|
+
* cluster using mkcert — fails with "unable to verify the first certificate", which says
|
|
7
|
+
* nothing about which host or what to do. Node can be told through `NODE_EXTRA_CA_CERTS`
|
|
8
|
+
* or `--use-system-ca`, but both are environment variables a user has to remember in
|
|
9
|
+
* every new terminal, and neither travels with the registry they apply to.
|
|
10
|
+
*
|
|
11
|
+
* npm draws the same conclusion with `cafile` in .npmrc: trust is configuration of the
|
|
12
|
+
* registry you talk to, not of the shell you happen to be in.
|
|
13
|
+
*/
|
|
14
|
+
export declare const caFile: () => string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The agent to use for registry and issuer requests, or undefined when no CA is
|
|
17
|
+
* configured and Node's defaults apply.
|
|
18
|
+
*
|
|
19
|
+
* A configured file that does not exist throws rather than being skipped: falling back
|
|
20
|
+
* silently would reproduce the original certificate error, having been told exactly how
|
|
21
|
+
* to avoid it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const httpsAgent: () => https.Agent | undefined;
|