@appshell/react 0.12.0-alpha.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +19 -0
- package/__tests__/ManifestContext.spec.tsx +14 -0
- package/__tests__/ReactHost.spec.tsx +51 -0
- package/__tests__/useRemote.spec.tsx +36 -0
- package/dist/main.js +1 -1
- package/dist/types/config/src/index.d.ts +3 -1
- package/dist/types/config/src/index.d.ts.map +1 -1
- package/dist/types/config/src/publish.d.ts +26 -0
- package/dist/types/config/src/publish.d.ts.map +1 -0
- package/dist/types/config/src/sync.d.ts.map +1 -1
- package/dist/types/config/src/types.d.ts +24 -0
- package/dist/types/config/src/types.d.ts.map +1 -1
- package/dist/types/loader/src/index.d.ts +2 -0
- package/dist/types/loader/src/index.d.ts.map +1 -1
- package/dist/types/loader/src/remoteLoader.d.ts +13 -3
- package/dist/types/loader/src/remoteLoader.d.ts.map +1 -1
- package/dist/types/loader/src/resolvers.d.ts +20 -0
- package/dist/types/loader/src/resolvers.d.ts.map +1 -0
- package/dist/types/react/src/components/AppshellComponent.d.ts.map +1 -1
- package/dist/types/react/src/components/ReactHost.d.ts +1 -1
- package/dist/types/react/src/components/ReactHost.d.ts.map +1 -1
- package/dist/types/react/src/contexts/ManifestContext.d.ts.map +1 -1
- package/dist/types/react/src/contexts/RemoteContext.d.ts +12 -0
- package/dist/types/react/src/contexts/RemoteContext.d.ts.map +1 -0
- package/dist/types/react/src/hooks/useRemote.d.ts +5 -0
- package/dist/types/react/src/hooks/useRemote.d.ts.map +1 -0
- package/dist/types/react/src/index.d.ts +2 -0
- package/dist/types/react/src/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AppshellComponent.tsx +4 -1
- package/src/components/ReactHost.tsx +20 -12
- package/src/contexts/ManifestContext.tsx +22 -4
- package/src/contexts/RemoteContext.tsx +22 -0
- package/src/hooks/useRemote.ts +7 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.0.0-alpha.0 (2026-08-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- appshell loader override check ([aedda4a](https://github.com/appshell-org/appshell/commit/aedda4abf81560297dce03df09fba68e8785242f))
|
|
11
|
+
- capture direct dependencies passed to FederatedComponent for re-render ([3621879](https://github.com/appshell-org/appshell/commit/36218793a5cb47f74bd8d1ce93deffdb1b85cd1c))
|
|
12
|
+
- rename @appshell/react-federated-component package to @appshell/react ([0b74498](https://github.com/appshell-org/appshell/commit/0b74498bf17ba73db4d936c8a012af1d3b111a28))
|
|
13
|
+
- resolve npm audit vulnerabilities (74 → 4) ([36a2d56](https://github.com/appshell-org/appshell/commit/36a2d56a76dabd55a6886ddb9f020948420fd832))
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- api key support ([9cdcbee](https://github.com/appshell-org/appshell/commit/9cdcbee36e44b8a179b49768d74a25767f1cc5f2))
|
|
18
|
+
- AppshellComponent impl ([2b82621](https://github.com/appshell-org/appshell/commit/2b82621c13302f790a8e1c457f9a82f39903fc1f))
|
|
19
|
+
- **config:** carry the host root and its props in the composition ([ca9ed63](https://github.com/appshell-org/appshell/commit/ca9ed630a5a22cb62d6630b5f191d15c54f1c595))
|
|
20
|
+
- consolidate runtime artifacts ([#26](https://github.com/appshell-org/appshell/issues/26)) ([a29479a](https://github.com/appshell-org/appshell/commit/a29479a49f0c5ec1273c9f8e4c7384096f2d4ba0))
|
|
21
|
+
- **loader:** pin the runtime wire contract and add a resolver chain ([95dbb10](https://github.com/appshell-org/appshell/commit/95dbb10d2bd0a7c2429852839c8be352a2c1bbe8))
|
|
22
|
+
- **react:** render from the registry-inlined composition ([1bcf134](https://github.com/appshell-org/appshell/commit/1bcf1341a459fd8b1ae357da7f27d427bb898c6c))
|
|
23
|
+
|
|
6
24
|
# 0.12.0-alpha.0 (2026-04-20)
|
|
7
25
|
|
|
8
26
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -68,10 +68,29 @@ const MyComponent = () => {
|
|
|
68
68
|
</RegistryProvider>
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
## useRemote
|
|
72
|
+
|
|
73
|
+
For access to the remote backing the surrounding `AppshellComponent`. Prefer this
|
|
74
|
+
over looking your own entry up in the manifest — the component already knows its key.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { useRemote } from '@appshell/react';
|
|
78
|
+
|
|
79
|
+
const MyComponent = () => {
|
|
80
|
+
const remote = useRemote();
|
|
81
|
+
|
|
82
|
+
...
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
71
86
|
## useManifest
|
|
72
87
|
|
|
73
88
|
For access to the manifest.
|
|
74
89
|
|
|
90
|
+
> **Deprecated:** `manifest.modules` is build-time webpack config, is never sent to
|
|
91
|
+
> the browser by the registry, and will be removed. Reading it logs a warning. Use
|
|
92
|
+
> `useRemote()` for what a micro-frontend actually needs at runtime.
|
|
93
|
+
|
|
75
94
|
```tsx
|
|
76
95
|
import { ManifestProvider, useManifest } from '@appshell/react';
|
|
77
96
|
|
|
@@ -33,4 +33,18 @@ describe('ManifestProvider', () => {
|
|
|
33
33
|
|
|
34
34
|
await expect(screen.getByText(/TestModule\/TestComponent/i)).toBeInTheDocument();
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
it('should warn when a consumer reads the deprecated modules field', () => {
|
|
38
|
+
const warn = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
39
|
+
const ComponentUsingModules = () => <div>{Object.keys(useManifest().modules).length}</div>;
|
|
40
|
+
|
|
41
|
+
render(
|
|
42
|
+
<ManifestProvider manifest={manifest}>
|
|
43
|
+
<ComponentUsingModules />
|
|
44
|
+
</ManifestProvider>,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
expect(warn).toHaveBeenCalledWith(expect.stringMatching(/modules is deprecated/i));
|
|
48
|
+
warn.mockRestore();
|
|
49
|
+
});
|
|
36
50
|
});
|
|
@@ -82,4 +82,55 @@ describe('RenderHost', () => {
|
|
|
82
82
|
{},
|
|
83
83
|
);
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
describe('when the registry inlined the composition', () => {
|
|
87
|
+
afterEach(() => {
|
|
88
|
+
delete window.__appshell_config__;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const inline = (index = { 'TestModule/TestComponent': 'http://test.com/manifest.json' }) => {
|
|
92
|
+
window.__appshell_config__ = {
|
|
93
|
+
environmentId: 'acme/prod',
|
|
94
|
+
revision: 1,
|
|
95
|
+
root: remote,
|
|
96
|
+
rootProps: {},
|
|
97
|
+
index,
|
|
98
|
+
remotes: {},
|
|
99
|
+
environment: {},
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
it('should render without fetching a config', async () => {
|
|
104
|
+
inline();
|
|
105
|
+
useState.mockRestore();
|
|
106
|
+
fetch.resetMocks();
|
|
107
|
+
|
|
108
|
+
await act(() => render(<ReactHost remote={remote} fallback="Loading" />));
|
|
109
|
+
|
|
110
|
+
expect(screen.getByText(/test component/i)).toBeInTheDocument();
|
|
111
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('should prefer the inlined config over a configUrl', async () => {
|
|
115
|
+
inline();
|
|
116
|
+
useState.mockRestore();
|
|
117
|
+
fetch.resetMocks();
|
|
118
|
+
|
|
119
|
+
await act(() =>
|
|
120
|
+
render(<ReactHost configUrl={configUrl} remote={remote} fallback="Loading" />),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should render with an empty index when neither a config nor a url is available', async () => {
|
|
128
|
+
useState.mockRestore();
|
|
129
|
+
fetch.resetMocks();
|
|
130
|
+
|
|
131
|
+
await act(() => render(<ReactHost remote={remote} fallback="Loading" />));
|
|
132
|
+
|
|
133
|
+
expect(screen.getByText(/test component/i)).toBeInTheDocument();
|
|
134
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
135
|
+
});
|
|
85
136
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** @jest-environment jsdom */
|
|
2
|
+
import { AppshellRemote } from '@appshell/config';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { RemoteProvider } from '../src/contexts/RemoteContext';
|
|
7
|
+
import useRemote from '../src/hooks/useRemote';
|
|
8
|
+
|
|
9
|
+
const remote: AppshellRemote = {
|
|
10
|
+
id: 'ping',
|
|
11
|
+
scope: 'PingModule',
|
|
12
|
+
module: './Ping',
|
|
13
|
+
manifestUrl: 'http://test.com/appshell.manifest.json',
|
|
14
|
+
remoteEntryUrl: 'http://test.com/remoteEntry.js',
|
|
15
|
+
metadata: { title: 'Ping' },
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Probe = () => <span>{useRemote()?.remoteEntryUrl ?? 'none'}</span>;
|
|
19
|
+
|
|
20
|
+
describe('useRemote', () => {
|
|
21
|
+
it('returns the remote backing the surrounding component', () => {
|
|
22
|
+
render(
|
|
23
|
+
<RemoteProvider remote={remote}>
|
|
24
|
+
<Probe />
|
|
25
|
+
</RemoteProvider>,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(screen.getByText(remote.remoteEntryUrl)).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('returns undefined outside a provider, so hosts render standalone', () => {
|
|
32
|
+
render(<Probe />);
|
|
33
|
+
|
|
34
|
+
expect(screen.getByText('none')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
});
|
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:()
|
|
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})()));
|
|
@@ -7,9 +7,11 @@ export { default as generateEnv } from './generate.env';
|
|
|
7
7
|
export { default as generateGlobalConfig } from './generate.global-config';
|
|
8
8
|
export { default as generateManifest } from './generate.manifest';
|
|
9
9
|
export { default as outdated } from './outdated';
|
|
10
|
+
export { activate, publish } from './publish';
|
|
11
|
+
export type { PublishOptions, PublishResult } from './publish';
|
|
10
12
|
export { default as register } from './register';
|
|
11
13
|
export { default as sync } from './sync';
|
|
12
|
-
export type { AppshellConfig, AppshellConfigRemote, AppshellGlobalConfig, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, Schema, SharedModuleSpec, } from './types';
|
|
14
|
+
export type { AppshellComposition, AppshellConfig, AppshellConfigRemote, AppshellGlobalConfig, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, ResolvedRemote, Schema, SharedModuleSpec, } from './types';
|
|
13
15
|
export * as utils from './utils';
|
|
14
16
|
export * as validators from './validators';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../config/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,WAAW,EACX,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../config/src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,6BAA6B,EAC7B,WAAW,EACX,cAAc,EACd,MAAM,EACN,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AppshellManifest, Metadata } from './types';
|
|
2
|
+
export type PublishOptions = {
|
|
3
|
+
registry: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
manifest: AppshellManifest;
|
|
8
|
+
visibility?: 'public' | 'private';
|
|
9
|
+
metadata?: Metadata;
|
|
10
|
+
};
|
|
11
|
+
export type PublishResult = {
|
|
12
|
+
/** `scope/name@version`. The scope comes from the token, not the caller. */
|
|
13
|
+
id: string;
|
|
14
|
+
created: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Publishing the same content twice is a no-op; publishing different content
|
|
18
|
+
* under a version that already exists is rejected by the registry.
|
|
19
|
+
*/
|
|
20
|
+
export declare const publish: ({ registry, token, name, version, manifest, visibility, metadata, }: PublishOptions) => Promise<PublishResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Activating a newer version of an already active app upgrades it in place.
|
|
23
|
+
* @param environment `scope/name`
|
|
24
|
+
*/
|
|
25
|
+
export declare const activate: (registry: string, environment: string, appId: string, token?: string) => Promise<void>;
|
|
26
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../../config/src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAmBF;;;GAGG;AACH,eAAO,MAAM,OAAO,wEAQjB,cAAc,KAAG,OAAO,CAAC,aAAa,CAYxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,aACT,MAAM,eACH,MAAM,SACZ,MAAM,UACL,MAAM,KACb,OAAO,CAAC,IAAI,CAgBd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../../config/src/sync.ts"],"names":[],"m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ComparisonTarget = {
|
|
|
46
46
|
export type CliConfig = Record<string, string> & {
|
|
47
47
|
apiKey: string;
|
|
48
48
|
registry: string;
|
|
49
|
+
environment: string;
|
|
50
|
+
scopeId: string;
|
|
51
|
+
authIssuer: string;
|
|
52
|
+
clientId: string;
|
|
49
53
|
};
|
|
50
54
|
export type AppshellConfigRemote<TMetadata = Metadata> = {
|
|
51
55
|
id: string;
|
|
@@ -92,6 +96,26 @@ export type AppshellGlobalConfig<TMetadata = Metadata> = {
|
|
|
92
96
|
metadata?: Record<string, TMetadata>;
|
|
93
97
|
overrides?: AppshellOverrides;
|
|
94
98
|
};
|
|
99
|
+
/** An `AppshellRemote` the registry already resolved, so the browser needs no manifest fetch. */
|
|
100
|
+
export type ResolvedRemote<TMetadata = Metadata> = AppshellRemote<TMetadata>;
|
|
101
|
+
/**
|
|
102
|
+
* The wire contract for `window.__appshell_config__`. Deliberately not an
|
|
103
|
+
* `AppshellManifest`: that is a build artifact, and reusing it left it unclear
|
|
104
|
+
* which fields the browser actually needs. `modules` is build-time webpack
|
|
105
|
+
* config and never crosses the wire; `environment` arrives already merged with
|
|
106
|
+
* the environment's overrides, leaving the browser only local overrides to apply.
|
|
107
|
+
*/
|
|
108
|
+
export type AppshellComposition<TMetadata = Metadata> = {
|
|
109
|
+
/** `scope/name` — makes the payload self-describing for fetch-on-miss and for `env diff`. */
|
|
110
|
+
environmentId: string;
|
|
111
|
+
revision: number;
|
|
112
|
+
/** The remote key the host mounts at the root, and the props it is given. */
|
|
113
|
+
root: string;
|
|
114
|
+
rootProps: Record<string, unknown>;
|
|
115
|
+
index: AppshellIndex;
|
|
116
|
+
remotes: Record<string, ResolvedRemote<TMetadata>>;
|
|
117
|
+
environment: Record<string, Record<string, string | number | undefined>>;
|
|
118
|
+
};
|
|
95
119
|
/**
|
|
96
120
|
* Advanced configuration for modules that should be exposed by this container.
|
|
97
121
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceR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R,SAAS,GACT,QAAQ,GACR,eAAe,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC;IAErD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,YAAY,CAAC,EAAE,GAAG,YAAY,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../loader/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAc,SAAS,CAAC;AAExB,eAAe,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../loader/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAExB,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
1
|
+
import type { AppshellComposition, AppshellGlobalConfig } from '@appshell/config';
|
|
2
|
+
import { type RemoteResolver } from './resolvers';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__appshell_config__?: AppshellComposition;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type RemoteLoaderOptions = {
|
|
9
|
+
composition?: AppshellComposition;
|
|
10
|
+
/** Replaces the resolver chain outright; a seam for tests and embedders. */
|
|
11
|
+
resolver?: RemoteResolver;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: (config: AppshellGlobalConfig, options?: RemoteLoaderOptions) => <TComponent>(key: string) => Promise<readonly [null, null] | readonly [Awaited<TComponent>, import("@appshell/config").AppshellManifest]>;
|
|
4
14
|
export default _default;
|
|
5
15
|
//# sourceMappingURL=remoteLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../../loader/src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"remoteLoader.d.ts","sourceRoot":"","sources":["../../../../../loader/src/remoteLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGlF,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;KAC3C;CACF;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;iCAEsB,oBAAoB,YAAW,mBAAmB,MAY1D,UAAU,OAAO,MAAM;AAZvC,wBAqDE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AppshellComposition, AppshellGlobalConfig, AppshellManifest, ResolvedRemote } from '@appshell/config';
|
|
2
|
+
export type RemoteResolution = {
|
|
3
|
+
remote: ResolvedRemote;
|
|
4
|
+
/** Already merged with the environment's overrides — nothing left for the browser to layer on. */
|
|
5
|
+
environment: Record<string, string | number | undefined>;
|
|
6
|
+
/** Back-compat payload for `ManifestProvider`; synthesized when the source was a composition. */
|
|
7
|
+
manifest: AppshellManifest;
|
|
8
|
+
};
|
|
9
|
+
export type RemoteResolver = (key: string) => Promise<RemoteResolution | undefined>;
|
|
10
|
+
/** The registry inlined the composition into the page, so no network call is needed. */
|
|
11
|
+
export declare const inlineResolver: (composition?: AppshellComposition) => RemoteResolver;
|
|
12
|
+
/** Fetch-on-miss: covers an app activated after this page was served. */
|
|
13
|
+
export declare const registryResolver: (composition?: AppshellComposition, origin?: string) => RemoteResolver;
|
|
14
|
+
/**
|
|
15
|
+
* Pre-registry hosts: follow `index[key]` to the app's own manifest. The override
|
|
16
|
+
* merge stays here because in this mode no server has done it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const legacyManifestResolver: (config: AppshellGlobalConfig) => RemoteResolver;
|
|
19
|
+
export declare const chainResolvers: (...resolvers: RemoteResolver[]) => RemoteResolver;
|
|
20
|
+
//# sourceMappingURL=resolvers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../../../loader/src/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,kGAAkG;IAClG,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,iGAAiG;IACjG,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;AAQpF,wFAAwF;AACxF,eAAO,MAAM,cAAc,iBACV,mBAAmB,KAAG,cAUpC,CAAC;AAEJ,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,iBACZ,mBAAmB,sBAAgB,cAejD,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,sBAAsB,WAAY,oBAAoB,KAAG,cAoCrE,CAAC;AAEF,eAAO,MAAM,cAAc,iBACV,cAAc,EAAE,KAAG,cAUjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppshellComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/AppshellComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAc,EAAiB,YAAY,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AppshellComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/AppshellComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAc,EAAiB,YAAY,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM3F,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,kBAAkB,EAAE,aAAa,CAAC;KACnC;CACF;AAED,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,IAAI;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,MAAM,CAAC;AAEX,QAAA,MAAM,iBAAiB;KAAI,MAAM,SAAS,aAAa,iCAIpD,sBAAsB,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;;;;CA2CvD,CAAC;AAMF,eAAe,iBAAiB,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;KA3DJ,MAAM,SAAS,aAAa,iCAIpD,sBAAsB,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;;;;CAuDL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactHost.d.ts","sourceRoot":"","sources":["../../../../../src/components/ReactHost.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactHost.d.ts","sourceRoot":"","sources":["../../../../../src/components/ReactHost.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAUxD,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CA8BA,CAAC;AAOF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/ManifestContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"ManifestContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/ManifestContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAiC,MAAM,OAAO,CAAC;AAEtD,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,iCAI1B,CAAC;AAkBH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC;AAEF,eAAO,MAAM,gBAAgB,kCAA2B,CAAC;AAEzD,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppshellRemote } from '@appshell/config';
|
|
2
|
+
import type { FC, ReactNode } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
interface RemoteProviderProps {
|
|
5
|
+
remote?: AppshellRemote;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const RemoteContext: React.Context<AppshellRemote | undefined>;
|
|
9
|
+
export declare const RemoteProvider: FC<RemoteProviderProps>;
|
|
10
|
+
export declare const RemoteConsumer: React.Consumer<AppshellRemote | undefined>;
|
|
11
|
+
export default RemoteContext;
|
|
12
|
+
//# sourceMappingURL=RemoteContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteContext.d.ts","sourceRoot":"","sources":["../../../../../src/contexts/RemoteContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,2CAAuD,CAAC;AAElF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAElD,CAAC;AAMF,eAAO,MAAM,cAAc,4CAAyB,CAAC;AAErD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRemote.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useRemote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,yFAAyF;8BACtE,cAAc,GAAG,SAAS;AAA7C,wBAAiF"}
|
|
@@ -3,8 +3,10 @@ export { default as ReactHost } from './components/ReactHost';
|
|
|
3
3
|
export { GlobalConfigProvider } from './contexts/GlobalConfigContext';
|
|
4
4
|
export { ManifestProvider } from './contexts/ManifestContext';
|
|
5
5
|
export { MetadataProvider } from './contexts/MetadataContext';
|
|
6
|
+
export { RemoteProvider } from './contexts/RemoteContext';
|
|
6
7
|
export { default as useGlobalConfig } from './hooks/useGlobalConfig';
|
|
7
8
|
export { default as useManifest } from './hooks/useManifest';
|
|
8
9
|
export { default as useMetadata } from './hooks/useMetadata';
|
|
10
|
+
export { default as useRemote } from './hooks/useRemote';
|
|
9
11
|
export { default as jsonResource } from './resources/jsonResource';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appshell/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "React utilities for building micro-frontends with Appshell and Module Federation",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/types/react/src/index.d.ts",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"react": "^18.2.0",
|
|
28
28
|
"react-dom": "^18.2.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "97ee53524d5c729308f49adca6c613d68a262179"
|
|
31
31
|
}
|
|
@@ -3,6 +3,7 @@ import { AppshellIndex } from '@appshell/config';
|
|
|
3
3
|
import remoteLoader from '@appshell/loader';
|
|
4
4
|
import React, { ComponentType, ReactElement, ReactNode, useEffect, useState } from 'react';
|
|
5
5
|
import { ManifestProvider } from '../contexts/ManifestContext';
|
|
6
|
+
import { RemoteProvider } from '../contexts/RemoteContext';
|
|
6
7
|
import useGlobalConfig from '../hooks/useGlobalConfig';
|
|
7
8
|
import LoadingError from './LoadingError';
|
|
8
9
|
|
|
@@ -42,7 +43,9 @@ const AppshellComponent = <TProps extends ExtendedProps>({
|
|
|
42
43
|
active = false;
|
|
43
44
|
setElement(
|
|
44
45
|
<ManifestProvider manifest={manifest}>
|
|
45
|
-
<
|
|
46
|
+
<RemoteProvider remote={manifest.remotes[remote]}>
|
|
47
|
+
<Component {...rest} />
|
|
48
|
+
</RemoteProvider>
|
|
46
49
|
</ManifestProvider>,
|
|
47
50
|
);
|
|
48
51
|
} catch (err) {
|
|
@@ -4,29 +4,36 @@ import React, { FC, ReactNode, useEffect } from 'react';
|
|
|
4
4
|
import { GlobalConfigProvider } from '../contexts/GlobalConfigContext';
|
|
5
5
|
import AppshellComponent from './AppshellComponent';
|
|
6
6
|
|
|
7
|
+
/** The registry inlines the composition, so a shell it served needs no config fetch. */
|
|
8
|
+
const inlinedConfig = (): AppshellGlobalConfig | undefined => {
|
|
9
|
+
const composition = typeof window === 'undefined' ? undefined : window.__appshell_config__;
|
|
10
|
+
return composition && { index: composition.index };
|
|
11
|
+
};
|
|
12
|
+
|
|
7
13
|
const ReactHost: FC<{
|
|
8
|
-
configUrl
|
|
14
|
+
configUrl?: string;
|
|
9
15
|
remote: string;
|
|
10
16
|
fallback?: ReactNode;
|
|
11
17
|
[x: string]: unknown;
|
|
12
18
|
}> = ({ configUrl, remote, fallback, ...rest }) => {
|
|
13
|
-
const [config, setGlobalConfig] = React.useState<AppshellGlobalConfig>();
|
|
19
|
+
const [config, setGlobalConfig] = React.useState<AppshellGlobalConfig | undefined>(inlinedConfig);
|
|
14
20
|
|
|
15
21
|
useEffect(() => {
|
|
22
|
+
if (config) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!configUrl) {
|
|
27
|
+
setGlobalConfig({ index: {} });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
16
31
|
const fetchGlobalConfig = async () => {
|
|
17
32
|
const res = await fetch(configUrl);
|
|
18
|
-
|
|
19
|
-
if (res.ok) {
|
|
20
|
-
const data = await res.json();
|
|
21
|
-
setGlobalConfig(data);
|
|
22
|
-
} else {
|
|
23
|
-
setGlobalConfig({ index: {} });
|
|
24
|
-
}
|
|
33
|
+
setGlobalConfig(res.ok ? await res.json() : { index: {} });
|
|
25
34
|
};
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
fetchGlobalConfig();
|
|
29
|
-
}
|
|
36
|
+
fetchGlobalConfig();
|
|
30
37
|
}, [config, configUrl]);
|
|
31
38
|
|
|
32
39
|
if (!config) {
|
|
@@ -41,6 +48,7 @@ const ReactHost: FC<{
|
|
|
41
48
|
};
|
|
42
49
|
|
|
43
50
|
ReactHost.defaultProps = {
|
|
51
|
+
configUrl: undefined,
|
|
44
52
|
fallback: undefined,
|
|
45
53
|
};
|
|
46
54
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppshellManifest } from '@appshell/config';
|
|
2
2
|
import type { FC, ReactNode } from 'react';
|
|
3
|
-
import React, { createContext } from 'react';
|
|
3
|
+
import React, { createContext, useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
interface ManifestProviderProps {
|
|
6
6
|
manifest: AppshellManifest;
|
|
@@ -13,9 +13,27 @@ export const ManifestContext = createContext<AppshellManifest>({
|
|
|
13
13
|
environment: {},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
16
|
+
// `modules` is build-time webpack config that the browser has no use for, and it is
|
|
17
|
+
// the bulkiest field to inline. Warn for one release to find any consumer still on it.
|
|
18
|
+
const deprecateModules = (manifest: AppshellManifest): AppshellManifest =>
|
|
19
|
+
new Proxy(manifest, {
|
|
20
|
+
get(target, property, receiver) {
|
|
21
|
+
if (property === 'modules') {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.warn(
|
|
24
|
+
'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.',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return Reflect.get(target, property, receiver);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const ManifestProvider: FC<ManifestProviderProps> = ({ manifest, children }) => {
|
|
33
|
+
const value = useMemo(() => deprecateModules(manifest), [manifest]);
|
|
34
|
+
|
|
35
|
+
return <ManifestContext.Provider value={value}>{children}</ManifestContext.Provider>;
|
|
36
|
+
};
|
|
19
37
|
|
|
20
38
|
export const ManifestConsumer = ManifestContext.Consumer;
|
|
21
39
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppshellRemote } from '@appshell/config';
|
|
2
|
+
import type { FC, ReactNode } from 'react';
|
|
3
|
+
import React, { createContext } from 'react';
|
|
4
|
+
|
|
5
|
+
interface RemoteProviderProps {
|
|
6
|
+
remote?: AppshellRemote;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const RemoteContext = createContext<AppshellRemote | undefined>(undefined);
|
|
11
|
+
|
|
12
|
+
export const RemoteProvider: FC<RemoteProviderProps> = ({ remote, children }) => (
|
|
13
|
+
<RemoteContext.Provider value={remote}>{children}</RemoteContext.Provider>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
RemoteProvider.defaultProps = {
|
|
17
|
+
remote: undefined,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const RemoteConsumer = RemoteContext.Consumer;
|
|
21
|
+
|
|
22
|
+
export default RemoteContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppshellRemote } from '@appshell/config';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
4
|
+
import RemoteContext from '../contexts/RemoteContext';
|
|
5
|
+
|
|
6
|
+
/** The remote backing the nearest `AppshellComponent` — it already knows its own key. */
|
|
7
|
+
export default (): AppshellRemote | undefined => React.useContext(RemoteContext);
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,9 @@ export { default as ReactHost } from './components/ReactHost';
|
|
|
3
3
|
export { GlobalConfigProvider } from './contexts/GlobalConfigContext';
|
|
4
4
|
export { ManifestProvider } from './contexts/ManifestContext';
|
|
5
5
|
export { MetadataProvider } from './contexts/MetadataContext';
|
|
6
|
+
export { RemoteProvider } from './contexts/RemoteContext';
|
|
6
7
|
export { default as useGlobalConfig } from './hooks/useGlobalConfig';
|
|
7
8
|
export { default as useManifest } from './hooks/useManifest';
|
|
8
9
|
export { default as useMetadata } from './hooks/useMetadata';
|
|
10
|
+
export { default as useRemote } from './hooks/useRemote';
|
|
9
11
|
export { default as jsonResource } from './resources/jsonResource';
|