@appshell/react-shell 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 +33 -26
- package/dist/144.js +1 -1
- package/dist/466.js +2 -0
- package/dist/466.js.LICENSE.txt +9 -0
- package/dist/58.js +1 -0
- package/dist/630.js +1 -0
- package/dist/677.js +1 -0
- package/dist/85.js +2 -0
- package/dist/85.js.LICENSE.txt +9 -0
- package/dist/941.js +1 -0
- package/dist/dev/favicon.ico +0 -0
- package/dist/dev/logo192.png +0 -0
- package/dist/dev/logo512.png +0 -0
- package/dist/dev/main.js +8160 -0
- package/dist/dev/main.js.map +1 -0
- package/dist/dev/manifest.json +25 -0
- package/dist/dev/mf-manifest.json +130 -0
- package/dist/dev/mf-stats.json +150 -0
- package/dist/dev/react_src_index_ts.js +554 -0
- package/dist/dev/react_src_index_ts.js.map +1 -0
- package/dist/dev/runtime_src_index_ts.js +231 -0
- package/dist/dev/runtime_src_index_ts.js.map +1 -0
- package/dist/dev/src_bootstrap_tsx.js +768 -0
- package/dist/dev/src_bootstrap_tsx.js.map +1 -0
- package/dist/dev/vendors-node_modules_react-dom_index_js.js +30577 -0
- package/dist/dev/vendors-node_modules_react-dom_index_js.js.map +1 -0
- package/dist/dev/vendors-node_modules_react_index_js.js +2771 -0
- package/dist/dev/vendors-node_modules_react_index_js.js.map +1 -0
- package/dist/dev/vendors-node_modules_react_jsx-runtime_js.js +1345 -0
- package/dist/dev/vendors-node_modules_react_jsx-runtime_js.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/mf-manifest.json +132 -0
- package/dist/mf-stats.json +152 -0
- package/package.json +16 -8
- package/dist/190.js +0 -1
- package/dist/320.js +0 -1
- package/dist/48.js +0 -1
- package/dist/939.js +0 -1
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(globalThis["webpackChunkappshell_react_shell"] = globalThis["webpackChunkappshell_react_shell"] || []).push([["react_src_index_ts"],{
|
|
3
|
+
|
|
4
|
+
/***/ "../loader/src/index.ts"
|
|
5
|
+
/*!******************************!*\
|
|
6
|
+
!*** ../loader/src/index.ts ***!
|
|
7
|
+
\******************************/
|
|
8
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ chainResolvers: () => (/* reexport safe */ _resolvers__WEBPACK_IMPORTED_MODULE_1__.chainResolvers),
|
|
13
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
14
|
+
/* harmony export */ inlineResolver: () => (/* reexport safe */ _resolvers__WEBPACK_IMPORTED_MODULE_1__.inlineResolver),
|
|
15
|
+
/* harmony export */ registryResolver: () => (/* reexport safe */ _resolvers__WEBPACK_IMPORTED_MODULE_1__.registryResolver)
|
|
16
|
+
/* harmony export */ });
|
|
17
|
+
/* harmony import */ var _remoteLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./remoteLoader */ "../loader/src/remoteLoader.ts");
|
|
18
|
+
/* harmony import */ var _resolvers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvers */ "../loader/src/resolvers.ts");
|
|
19
|
+
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "../loader/src/types.ts");
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_remoteLoader__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
|
24
|
+
|
|
25
|
+
/***/ },
|
|
26
|
+
|
|
27
|
+
/***/ "../loader/src/loadAppshellComponent.ts"
|
|
28
|
+
/*!**********************************************!*\
|
|
29
|
+
!*** ../loader/src/loadAppshellComponent.ts ***!
|
|
30
|
+
\**********************************************/
|
|
31
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
32
|
+
|
|
33
|
+
__webpack_require__.r(__webpack_exports__);
|
|
34
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
35
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
36
|
+
/* harmony export */ load: () => (/* binding */ load)
|
|
37
|
+
/* harmony export */ });
|
|
38
|
+
/* harmony import */ var _module_federation_enhanced_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @module-federation/enhanced/runtime */ "../../node_modules/@module-federation/enhanced/dist/src/runtime.mjs");
|
|
39
|
+
|
|
40
|
+
const HOST_NAME = 'Appshell';
|
|
41
|
+
|
|
42
|
+
// The runtime instance and each remote's registration only need to happen once per page load.
|
|
43
|
+
let initialized = false;
|
|
44
|
+
const registeredScopes = new Set();
|
|
45
|
+
const ensureInitialized = () => {
|
|
46
|
+
if (initialized) return;
|
|
47
|
+
initialized = true;
|
|
48
|
+
|
|
49
|
+
// A host that ships its own ModuleFederationPlugin (e.g. @appshell/react-shell) already
|
|
50
|
+
// created the global federation instance during its own bootstrap. Re-calling `init()`
|
|
51
|
+
// with a different name throws (#RUNTIME-010), so reuse whatever instance already exists.
|
|
52
|
+
if ((0,_module_federation_enhanced_runtime__WEBPACK_IMPORTED_MODULE_0__.getInstance)()) return;
|
|
53
|
+
(0,_module_federation_enhanced_runtime__WEBPACK_IMPORTED_MODULE_0__.init)({
|
|
54
|
+
name: HOST_NAME,
|
|
55
|
+
remotes: []
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const loadModuleFederation = async (scope, module, remoteEntryUrl, shareScope = 'default') => {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.debug(`loading Appshell component: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`);
|
|
61
|
+
ensureInitialized();
|
|
62
|
+
|
|
63
|
+
// Registered exactly once, and never re-registered or cache-busted afterwards.
|
|
64
|
+
//
|
|
65
|
+
// A remote served by a dev server updates itself: its `remoteEntry` already carries
|
|
66
|
+
// webpack's HMR runtime and a dev-server client, so an edit is applied in place
|
|
67
|
+
// behind a container identity that does not move. Re-registering the same scope, or
|
|
68
|
+
// appending a cache-busting query to its entry, changes that identity and the
|
|
69
|
+
// `publicPath` derived from it mid-flight, which strands the `*.hot-update.json` and
|
|
70
|
+
// `*.hot-update.js` requests the remote is midway through making.
|
|
71
|
+
if (!registeredScopes.has(scope)) {
|
|
72
|
+
registeredScopes.add(scope);
|
|
73
|
+
(0,_module_federation_enhanced_runtime__WEBPACK_IMPORTED_MODULE_0__.registerRemotes)([{
|
|
74
|
+
name: scope,
|
|
75
|
+
entry: remoteEntryUrl
|
|
76
|
+
}]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Federation ids drop the leading `./` that `exposes` keys use.
|
|
80
|
+
const exposed = module.replace(/^\.\//, '');
|
|
81
|
+
const Module = await (0,_module_federation_enhanced_runtime__WEBPACK_IMPORTED_MODULE_0__.loadRemote)(`${scope}/${exposed}`);
|
|
82
|
+
if (!Module) {
|
|
83
|
+
throw new Error(`Failed to find module container ${scope}`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
87
|
+
console.debug(`Appshell component loaded: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`);
|
|
88
|
+
return Module.default;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Dispatches on the loader's kind rather than assuming federation.
|
|
93
|
+
*
|
|
94
|
+
* There is one kind today. Naming it is what lets a second — single-spa, import maps —
|
|
95
|
+
* arrive without reinterpreting manifests already published, and what stops federation's
|
|
96
|
+
* vocabulary reading as though it were appshell's.
|
|
97
|
+
*/
|
|
98
|
+
const load = async remote => {
|
|
99
|
+
const {
|
|
100
|
+
loader
|
|
101
|
+
} = remote;
|
|
102
|
+
if (loader.kind !== 'ModuleFederation') {
|
|
103
|
+
// Unreachable while one kind exists, and the reason the field is a discriminant: a
|
|
104
|
+
// manifest published under a kind this host cannot load should say so, rather than
|
|
105
|
+
// failing somewhere inside a loader that assumed otherwise.
|
|
106
|
+
throw new Error(`No loader for kind '${loader.kind}'.`);
|
|
107
|
+
}
|
|
108
|
+
return loadModuleFederation(loader.scope, loader.module, remote.remoteEntryUrl, loader.shareScope);
|
|
109
|
+
};
|
|
110
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (load);
|
|
111
|
+
|
|
112
|
+
/***/ },
|
|
113
|
+
|
|
114
|
+
/***/ "../loader/src/remoteLoader.ts"
|
|
115
|
+
/*!*************************************!*\
|
|
116
|
+
!*** ../loader/src/remoteLoader.ts ***!
|
|
117
|
+
\*************************************/
|
|
118
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
119
|
+
|
|
120
|
+
__webpack_require__.r(__webpack_exports__);
|
|
121
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
122
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
123
|
+
/* harmony export */ });
|
|
124
|
+
/* harmony import */ var _appshell_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @appshell/runtime */ "webpack/sharing/consume/default/@appshell/runtime/@appshell/runtime");
|
|
125
|
+
/* harmony import */ var _loadAppshellComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loadAppshellComponent */ "../loader/src/loadAppshellComponent.ts");
|
|
126
|
+
/* harmony import */ var _resolvers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resolvers */ "../loader/src/resolvers.ts");
|
|
127
|
+
/* eslint-disable no-underscore-dangle */
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((options = {}) => {
|
|
133
|
+
const composition = options.composition ?? (typeof window === 'undefined' ? undefined : window.__appshell_config__);
|
|
134
|
+
const resolve = options.resolver ?? (0,_resolvers__WEBPACK_IMPORTED_MODULE_2__.chainResolvers)((0,_resolvers__WEBPACK_IMPORTED_MODULE_2__.inlineResolver)(composition), (0,_resolvers__WEBPACK_IMPORTED_MODULE_2__.registryResolver)(composition));
|
|
135
|
+
return async key => {
|
|
136
|
+
const failed = err => new Error(`Failed to load component '${key}'. ${err?.toString()}`);
|
|
137
|
+
let resolution;
|
|
138
|
+
try {
|
|
139
|
+
resolution = await resolve(key);
|
|
140
|
+
} catch (err) {
|
|
141
|
+
throw failed(err);
|
|
142
|
+
}
|
|
143
|
+
if (!resolution) {
|
|
144
|
+
throw new Error(`Remote resource not found in registry. Expected: ${key}`);
|
|
145
|
+
}
|
|
146
|
+
const {
|
|
147
|
+
remote,
|
|
148
|
+
vars
|
|
149
|
+
} = resolution;
|
|
150
|
+
try {
|
|
151
|
+
// Before the remote loads, so a package that validates its vars while its modules
|
|
152
|
+
// evaluate still finds them. `@appshell/runtime` is a shared singleton, so this is
|
|
153
|
+
// the same store the package reads through `getVars()`.
|
|
154
|
+
// Vars are keyed by federation scope, which is itself one framework's vocabulary —
|
|
155
|
+
// noted rather than fixed here, since application specs address overrides.vars the
|
|
156
|
+
// same way.
|
|
157
|
+
(0,_appshell_runtime__WEBPACK_IMPORTED_MODULE_0__.setVars)(remote.loader.scope, vars);
|
|
158
|
+
const Component = await (0,_loadAppshellComponent__WEBPACK_IMPORTED_MODULE_1__["default"])(remote);
|
|
159
|
+
return [Component, remote];
|
|
160
|
+
} catch (err) {
|
|
161
|
+
throw failed(err);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
166
|
+
|
|
167
|
+
/***/ },
|
|
168
|
+
|
|
169
|
+
/***/ "../loader/src/resolvers.ts"
|
|
170
|
+
/*!**********************************!*\
|
|
171
|
+
!*** ../loader/src/resolvers.ts ***!
|
|
172
|
+
\**********************************/
|
|
173
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
174
|
+
|
|
175
|
+
__webpack_require__.r(__webpack_exports__);
|
|
176
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
177
|
+
/* harmony export */ chainResolvers: () => (/* binding */ chainResolvers),
|
|
178
|
+
/* harmony export */ inlineResolver: () => (/* binding */ inlineResolver),
|
|
179
|
+
/* harmony export */ registryResolver: () => (/* binding */ registryResolver)
|
|
180
|
+
/* harmony export */ });
|
|
181
|
+
/** The registry inlined the composition into the page, so no network call is needed. */
|
|
182
|
+
const inlineResolver = composition => async key => {
|
|
183
|
+
const remote = composition?.remotes[key];
|
|
184
|
+
if (!composition || !remote) return undefined;
|
|
185
|
+
return {
|
|
186
|
+
remote,
|
|
187
|
+
vars: composition.vars[remote.loader.scope] ?? {}
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** Fetch-on-miss: covers a package activated after this page was served. */
|
|
192
|
+
const registryResolver = (composition, origin = '') => async key => {
|
|
193
|
+
if (!composition) return undefined;
|
|
194
|
+
const url = `${origin}/v1/applications/${composition.applicationId}/remotes/${key}`;
|
|
195
|
+
const response = await fetch(url, {
|
|
196
|
+
credentials: 'include'
|
|
197
|
+
});
|
|
198
|
+
if (!response.ok) return undefined;
|
|
199
|
+
const remote = await response.json();
|
|
200
|
+
return {
|
|
201
|
+
remote,
|
|
202
|
+
vars: composition.vars[remote.loader.scope] ?? {}
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
const chainResolvers = (...resolvers) => async key => {
|
|
206
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
207
|
+
for (const resolve of resolvers) {
|
|
208
|
+
// eslint-disable-next-line no-await-in-loop
|
|
209
|
+
const resolution = await resolve(key);
|
|
210
|
+
if (resolution) return resolution;
|
|
211
|
+
}
|
|
212
|
+
return undefined;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/***/ },
|
|
216
|
+
|
|
217
|
+
/***/ "../loader/src/types.ts"
|
|
218
|
+
/*!******************************!*\
|
|
219
|
+
!*** ../loader/src/types.ts ***!
|
|
220
|
+
\******************************/
|
|
221
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
222
|
+
|
|
223
|
+
__webpack_require__.r(__webpack_exports__);
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/***/ },
|
|
227
|
+
|
|
228
|
+
/***/ "../react/src/components/LoadingError.tsx"
|
|
229
|
+
/*!************************************************!*\
|
|
230
|
+
!*** ../react/src/components/LoadingError.tsx ***!
|
|
231
|
+
\************************************************/
|
|
232
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
233
|
+
|
|
234
|
+
__webpack_require__.r(__webpack_exports__);
|
|
235
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
236
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
237
|
+
/* harmony export */ });
|
|
238
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/sharing/consume/default/react/jsx-runtime/react/jsx-runtime");
|
|
239
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
240
|
+
|
|
241
|
+
const LoadingError = ({
|
|
242
|
+
remote,
|
|
243
|
+
reason
|
|
244
|
+
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
|
|
245
|
+
style: {
|
|
246
|
+
border: '3px solid red'
|
|
247
|
+
},
|
|
248
|
+
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("h5", {
|
|
249
|
+
children: `Error loading Appshell component '${remote}.'`
|
|
250
|
+
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span", {
|
|
251
|
+
style: {
|
|
252
|
+
fontSize: '1rem'
|
|
253
|
+
},
|
|
254
|
+
children: reason
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LoadingError);
|
|
258
|
+
|
|
259
|
+
/***/ },
|
|
260
|
+
|
|
261
|
+
/***/ "../react/src/components/RemoteSlot.tsx"
|
|
262
|
+
/*!**********************************************!*\
|
|
263
|
+
!*** ../react/src/components/RemoteSlot.tsx ***!
|
|
264
|
+
\**********************************************/
|
|
265
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
266
|
+
|
|
267
|
+
__webpack_require__.r(__webpack_exports__);
|
|
268
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
269
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
270
|
+
/* harmony export */ });
|
|
271
|
+
/* harmony import */ var _appshell_loader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @appshell/loader */ "../loader/src/index.ts");
|
|
272
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react/react");
|
|
273
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
274
|
+
/* harmony import */ var _contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../contexts/RemoteContext */ "../react/src/contexts/RemoteContext.tsx");
|
|
275
|
+
/* harmony import */ var _LoadingError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LoadingError */ "../react/src/components/LoadingError.tsx");
|
|
276
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/sharing/consume/default/react/jsx-runtime/react/jsx-runtime");
|
|
277
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
|
|
278
|
+
/* eslint-disable react/jsx-props-no-spreading */
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Loads a remote once and leaves it alone.
|
|
288
|
+
*
|
|
289
|
+
* Keeping a remote current while it is being developed is not this component's job.
|
|
290
|
+
* A remote served by a dev server ships webpack's HMR runtime and a dev-server client
|
|
291
|
+
* inside its own `remoteEntry`, so it applies its own edits in place and React Fast
|
|
292
|
+
* Refresh swaps the component implementations underneath this tree — no reload, and no
|
|
293
|
+
* remount that would discard state this component never owned.
|
|
294
|
+
*
|
|
295
|
+
* Watching the remote's socket from here and reloading the page was strictly worse: it
|
|
296
|
+
* raced the remote's own update, and it threw away the entire composed app to deliver a
|
|
297
|
+
* change to one subtree. When webpack genuinely cannot apply an update, the remote's own
|
|
298
|
+
* client still falls back to a full reload — which is the right place for that decision,
|
|
299
|
+
* because it is the only side that knows whether the update applied.
|
|
300
|
+
*/
|
|
301
|
+
const RemoteSlot = ({
|
|
302
|
+
remote,
|
|
303
|
+
fallback,
|
|
304
|
+
...rest
|
|
305
|
+
}) => {
|
|
306
|
+
const [element, setElement] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)();
|
|
307
|
+
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
|
|
308
|
+
let disposed = false;
|
|
309
|
+
const loadComponent = (0,_appshell_loader__WEBPACK_IMPORTED_MODULE_0__["default"])();
|
|
310
|
+
async function load() {
|
|
311
|
+
try {
|
|
312
|
+
const [Component, resolved] = await loadComponent(remote);
|
|
313
|
+
if (disposed || !Component) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
setElement(/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_2__.RemoteProvider, {
|
|
317
|
+
remote: resolved,
|
|
318
|
+
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(Component, {
|
|
319
|
+
...rest
|
|
320
|
+
})
|
|
321
|
+
}));
|
|
322
|
+
} catch (err) {
|
|
323
|
+
if (!disposed) {
|
|
324
|
+
setElement(/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_LoadingError__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
|
325
|
+
remote: remote,
|
|
326
|
+
reason: `${err}`
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
setElement(undefined);
|
|
332
|
+
load();
|
|
333
|
+
return () => {
|
|
334
|
+
disposed = true;
|
|
335
|
+
};
|
|
336
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
337
|
+
}, [remote, ...Object.values(rest)]);
|
|
338
|
+
|
|
339
|
+
// eslint-disable-next-line no-console
|
|
340
|
+
console.debug(`rendering RemoteSlot[${remote}], loading=${!element}`);
|
|
341
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
342
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
|
343
|
+
children: element || fallback
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
RemoteSlot.defaultProps = {
|
|
347
|
+
fallback: undefined
|
|
348
|
+
};
|
|
349
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RemoteSlot);
|
|
350
|
+
|
|
351
|
+
/***/ },
|
|
352
|
+
|
|
353
|
+
/***/ "../react/src/contexts/RemoteContext.tsx"
|
|
354
|
+
/*!***********************************************!*\
|
|
355
|
+
!*** ../react/src/contexts/RemoteContext.tsx ***!
|
|
356
|
+
\***********************************************/
|
|
357
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
358
|
+
|
|
359
|
+
__webpack_require__.r(__webpack_exports__);
|
|
360
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
361
|
+
/* harmony export */ RemoteConsumer: () => (/* binding */ RemoteConsumer),
|
|
362
|
+
/* harmony export */ RemoteContext: () => (/* binding */ RemoteContext),
|
|
363
|
+
/* harmony export */ RemoteProvider: () => (/* binding */ RemoteProvider),
|
|
364
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
365
|
+
/* harmony export */ });
|
|
366
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react/react");
|
|
367
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
368
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/sharing/consume/default/react/jsx-runtime/react/jsx-runtime");
|
|
369
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
const RemoteContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined);
|
|
373
|
+
const RemoteProvider = ({
|
|
374
|
+
remote,
|
|
375
|
+
children
|
|
376
|
+
}) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(RemoteContext.Provider, {
|
|
377
|
+
value: remote,
|
|
378
|
+
children: children
|
|
379
|
+
});
|
|
380
|
+
RemoteProvider.defaultProps = {
|
|
381
|
+
remote: undefined
|
|
382
|
+
};
|
|
383
|
+
const RemoteConsumer = RemoteContext.Consumer;
|
|
384
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RemoteContext);
|
|
385
|
+
|
|
386
|
+
/***/ },
|
|
387
|
+
|
|
388
|
+
/***/ "../react/src/hooks/useRemote.ts"
|
|
389
|
+
/*!***************************************!*\
|
|
390
|
+
!*** ../react/src/hooks/useRemote.ts ***!
|
|
391
|
+
\***************************************/
|
|
392
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
393
|
+
|
|
394
|
+
__webpack_require__.r(__webpack_exports__);
|
|
395
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
396
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
397
|
+
/* harmony export */ });
|
|
398
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/sharing/consume/default/react/react");
|
|
399
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
400
|
+
/* harmony import */ var _contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../contexts/RemoteContext */ "../react/src/contexts/RemoteContext.tsx");
|
|
401
|
+
|
|
402
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
/** The remote backing the nearest `RemoteSlot` — it already knows its own key. */
|
|
406
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (() => react__WEBPACK_IMPORTED_MODULE_0___default().useContext(_contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_1__["default"]));
|
|
407
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
408
|
+
|
|
409
|
+
/***/ },
|
|
410
|
+
|
|
411
|
+
/***/ "../react/src/index.ts"
|
|
412
|
+
/*!*****************************!*\
|
|
413
|
+
!*** ../react/src/index.ts ***!
|
|
414
|
+
\*****************************/
|
|
415
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
416
|
+
|
|
417
|
+
__webpack_require__.r(__webpack_exports__);
|
|
418
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
419
|
+
/* harmony export */ RemoteProvider: () => (/* reexport safe */ _contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_1__.RemoteProvider),
|
|
420
|
+
/* harmony export */ RemoteSlot: () => (/* reexport safe */ _components_RemoteSlot__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
421
|
+
/* harmony export */ jsonResource: () => (/* reexport safe */ _resources_jsonResource__WEBPACK_IMPORTED_MODULE_3__["default"]),
|
|
422
|
+
/* harmony export */ useRemote: () => (/* reexport safe */ _hooks_useRemote__WEBPACK_IMPORTED_MODULE_2__["default"])
|
|
423
|
+
/* harmony export */ });
|
|
424
|
+
/* harmony import */ var _components_RemoteSlot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/RemoteSlot */ "../react/src/components/RemoteSlot.tsx");
|
|
425
|
+
/* harmony import */ var _contexts_RemoteContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contexts/RemoteContext */ "../react/src/contexts/RemoteContext.tsx");
|
|
426
|
+
/* harmony import */ var _hooks_useRemote__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hooks/useRemote */ "../react/src/hooks/useRemote.ts");
|
|
427
|
+
/* harmony import */ var _resources_jsonResource__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./resources/jsonResource */ "../react/src/resources/jsonResource.ts");
|
|
428
|
+
/*
|
|
429
|
+
* The wire types, re-exported so a React package needs one dependency rather than two
|
|
430
|
+
* to type what RemoteSlot hands it.
|
|
431
|
+
*/
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
/***/ },
|
|
439
|
+
|
|
440
|
+
/***/ "../react/src/resources/jsonResource.ts"
|
|
441
|
+
/*!**********************************************!*\
|
|
442
|
+
!*** ../react/src/resources/jsonResource.ts ***!
|
|
443
|
+
\**********************************************/
|
|
444
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
445
|
+
|
|
446
|
+
__webpack_require__.r(__webpack_exports__);
|
|
447
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
448
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
449
|
+
/* harmony export */ });
|
|
450
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (url => {
|
|
451
|
+
let status = 'pending';
|
|
452
|
+
let result;
|
|
453
|
+
const suspender = fetch(url, {
|
|
454
|
+
headers: {
|
|
455
|
+
'Content-Type': 'application/json',
|
|
456
|
+
Accept: 'application/json'
|
|
457
|
+
}
|
|
458
|
+
// eslint-disable-next-line consistent-return
|
|
459
|
+
}).then(response => {
|
|
460
|
+
if (response.ok) {
|
|
461
|
+
return response.json().then(data => {
|
|
462
|
+
status = 'success';
|
|
463
|
+
result = data;
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
status = 'error';
|
|
467
|
+
result = new Error(`${response.status} ${response.statusText} ${response.url}`);
|
|
468
|
+
});
|
|
469
|
+
return {
|
|
470
|
+
read() {
|
|
471
|
+
if (status === 'pending') {
|
|
472
|
+
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
473
|
+
throw suspender;
|
|
474
|
+
} else if (status === 'error') {
|
|
475
|
+
throw result;
|
|
476
|
+
} else if (status === 'success') {
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
});
|
|
483
|
+
(Object.getOwnPropertyDescriptor(__WEBPACK_DEFAULT_EXPORT__, "name") || {}).writable || Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
|
|
484
|
+
|
|
485
|
+
/***/ },
|
|
486
|
+
|
|
487
|
+
/***/ "../../node_modules/@module-federation/enhanced/dist/src/runtime.mjs"
|
|
488
|
+
/*!***************************************************************************!*\
|
|
489
|
+
!*** ../../node_modules/@module-federation/enhanced/dist/src/runtime.mjs ***!
|
|
490
|
+
\***************************************************************************/
|
|
491
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
492
|
+
|
|
493
|
+
__webpack_require__.r(__webpack_exports__);
|
|
494
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
495
|
+
/* harmony export */ Module: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.Module),
|
|
496
|
+
/* harmony export */ ModuleFederation: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.ModuleFederation),
|
|
497
|
+
/* harmony export */ createInstance: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.createInstance),
|
|
498
|
+
/* harmony export */ getInstance: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.getInstance),
|
|
499
|
+
/* harmony export */ getRemoteEntry: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.getRemoteEntry),
|
|
500
|
+
/* harmony export */ getRemoteInfo: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.getRemoteInfo),
|
|
501
|
+
/* harmony export */ init: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.init),
|
|
502
|
+
/* harmony export */ loadRemote: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.loadRemote),
|
|
503
|
+
/* harmony export */ loadScript: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.loadScript),
|
|
504
|
+
/* harmony export */ loadScriptNode: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.loadScriptNode),
|
|
505
|
+
/* harmony export */ loadShare: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.loadShare),
|
|
506
|
+
/* harmony export */ loadShareSync: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.loadShareSync),
|
|
507
|
+
/* harmony export */ preloadRemote: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.preloadRemote),
|
|
508
|
+
/* harmony export */ registerGlobalPlugins: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.registerGlobalPlugins),
|
|
509
|
+
/* harmony export */ registerPlugins: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.registerPlugins),
|
|
510
|
+
/* harmony export */ registerRemotes: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.registerRemotes),
|
|
511
|
+
/* harmony export */ registerShared: () => (/* reexport safe */ _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__.registerShared)
|
|
512
|
+
/* harmony export */ });
|
|
513
|
+
/* harmony import */ var _module_federation_runtime_tools_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @module-federation/runtime-tools/runtime */ "../../node_modules/@module-federation/runtime-tools/dist/runtime.js");
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
/***/ },
|
|
519
|
+
|
|
520
|
+
/***/ "../../node_modules/@module-federation/runtime-tools/dist/runtime.js"
|
|
521
|
+
/*!***************************************************************************!*\
|
|
522
|
+
!*** ../../node_modules/@module-federation/runtime-tools/dist/runtime.js ***!
|
|
523
|
+
\***************************************************************************/
|
|
524
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
525
|
+
|
|
526
|
+
__webpack_require__.r(__webpack_exports__);
|
|
527
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
528
|
+
/* harmony export */ Module: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.Module),
|
|
529
|
+
/* harmony export */ ModuleFederation: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.ModuleFederation),
|
|
530
|
+
/* harmony export */ createInstance: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.createInstance),
|
|
531
|
+
/* harmony export */ getInstance: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.getInstance),
|
|
532
|
+
/* harmony export */ getRemoteEntry: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.getRemoteEntry),
|
|
533
|
+
/* harmony export */ getRemoteInfo: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.getRemoteInfo),
|
|
534
|
+
/* harmony export */ init: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.init),
|
|
535
|
+
/* harmony export */ loadRemote: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.loadRemote),
|
|
536
|
+
/* harmony export */ loadScript: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.loadScript),
|
|
537
|
+
/* harmony export */ loadScriptNode: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.loadScriptNode),
|
|
538
|
+
/* harmony export */ loadShare: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.loadShare),
|
|
539
|
+
/* harmony export */ loadShareSync: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.loadShareSync),
|
|
540
|
+
/* harmony export */ preloadRemote: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.preloadRemote),
|
|
541
|
+
/* harmony export */ registerGlobalPlugins: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.registerGlobalPlugins),
|
|
542
|
+
/* harmony export */ registerPlugins: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.registerPlugins),
|
|
543
|
+
/* harmony export */ registerRemotes: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.registerRemotes),
|
|
544
|
+
/* harmony export */ registerShared: () => (/* reexport safe */ _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__.registerShared)
|
|
545
|
+
/* harmony export */ });
|
|
546
|
+
/* harmony import */ var _module_federation_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @module-federation/runtime */ "../../node_modules/@module-federation/runtime/dist/bundler.js");
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
/***/ }
|
|
552
|
+
|
|
553
|
+
}]);
|
|
554
|
+
//# sourceMappingURL=react_src_index_ts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react_src_index_ts.js","mappings":";;;;;;;;;;;;;;;;;;;AAA0C;AAGd;AACJ;AAExB,iEAAeA,qDAAY,E;;;;;;;;;;;;;;;;ACAkB;AAE7C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AAOC,MAAM;MACf;MAEA,OAAOxD,SAAS;IAClB;EACF,CAAC;AACH,CAAC;AAAA,4L;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClCuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAd","sources":["webpack://appshell-react-shell/../loader/src/index.ts","webpack://appshell-react-shell/../loader/src/loadAppshellComponent.ts","webpack://appshell-react-shell/../loader/src/remoteLoader.ts","webpack://appshell-react-shell/../loader/src/resolvers.ts","webpack://appshell-react-shell/../loader/src/types.ts","webpack://appshell-react-shell/../react/src/components/LoadingError.tsx","webpack://appshell-react-shell/../react/src/components/RemoteSlot.tsx","webpack://appshell-react-shell/../react/src/contexts/RemoteContext.tsx","webpack://appshell-react-shell/../react/src/hooks/useRemote.ts","webpack://appshell-react-shell/../react/src/index.ts","webpack://appshell-react-shell/../react/src/resources/jsonResource.ts","webpack://appshell-react-shell/../../node_modules/@module-federation/enhanced/dist/src/runtime.mjs","webpack://appshell-react-shell/../../node_modules/@module-federation/runtime-tools/dist/runtime.js"],"sourcesContent":["import remoteLoader from './remoteLoader';\n\nexport type { RemoteLoaderOptions } from './remoteLoader';\nexport * from './resolvers';\nexport * from './types';\n\nexport default remoteLoader;\n","import type { RemoteLoader } from '@appshell/runtime';\nimport {\n getInstance,\n init,\n loadRemote,\n registerRemotes,\n} from '@module-federation/enhanced/runtime';\n\nconst HOST_NAME = 'Appshell';\n\n// The runtime instance and each remote's registration only need to happen once per page load.\nlet initialized = false;\nconst registeredScopes = new Set<string>();\n\nconst ensureInitialized = () => {\n if (initialized) return;\n initialized = true;\n\n // A host that ships its own ModuleFederationPlugin (e.g. @appshell/react-shell) already\n // created the global federation instance during its own bootstrap. Re-calling `init()`\n // with a different name throws (#RUNTIME-010), so reuse whatever instance already exists.\n if (getInstance()) return;\n\n init({ name: HOST_NAME, remotes: [] });\n};\n\nconst loadModuleFederation = async <TComponent>(\n scope: string,\n module: string,\n remoteEntryUrl: string,\n shareScope = 'default',\n) => {\n // eslint-disable-next-line no-console\n console.debug(\n `loading Appshell component: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`,\n );\n\n ensureInitialized();\n\n // Registered exactly once, and never re-registered or cache-busted afterwards.\n //\n // A remote served by a dev server updates itself: its `remoteEntry` already carries\n // webpack's HMR runtime and a dev-server client, so an edit is applied in place\n // behind a container identity that does not move. Re-registering the same scope, or\n // appending a cache-busting query to its entry, changes that identity and the\n // `publicPath` derived from it mid-flight, which strands the `*.hot-update.json` and\n // `*.hot-update.js` requests the remote is midway through making.\n if (!registeredScopes.has(scope)) {\n registeredScopes.add(scope);\n registerRemotes([{ name: scope, entry: remoteEntryUrl }]);\n }\n\n // Federation ids drop the leading `./` that `exposes` keys use.\n const exposed = module.replace(/^\\.\\//, '');\n const Module = await loadRemote<{ default: TComponent }>(`${scope}/${exposed}`);\n\n if (!Module) {\n throw new Error(`Failed to find module container ${scope}`);\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n `Appshell component loaded: { scope: ${scope}, module: ${module}, shareScope: ${shareScope} }`,\n );\n\n return Module.default;\n};\n\n/**\n * Dispatches on the loader's kind rather than assuming federation.\n *\n * There is one kind today. Naming it is what lets a second — single-spa, import maps —\n * arrive without reinterpreting manifests already published, and what stops federation's\n * vocabulary reading as though it were appshell's.\n */\nexport const load = async <TComponent>(remote: {\n loader: RemoteLoader;\n remoteEntryUrl: string;\n}) => {\n const { loader } = remote;\n\n if (loader.kind !== 'ModuleFederation') {\n // Unreachable while one kind exists, and the reason the field is a discriminant: a\n // manifest published under a kind this host cannot load should say so, rather than\n // failing somewhere inside a loader that assumed otherwise.\n throw new Error(`No loader for kind '${(loader as { kind: string }).kind}'.`);\n }\n\n return loadModuleFederation<TComponent>(\n loader.scope,\n loader.module,\n remote.remoteEntryUrl,\n loader.shareScope,\n );\n};\n\nexport default load;\n","/* eslint-disable no-underscore-dangle */\nimport type { AppshellComposition } from '@appshell/config';\nimport { setVars } from '@appshell/runtime';\nimport loadAppshellComponent from './loadAppshellComponent';\nimport { chainResolvers, inlineResolver, registryResolver, type RemoteResolver } from './resolvers';\n\ndeclare global {\n interface Window {\n __appshell_config__?: AppshellComposition;\n }\n}\n\nexport type RemoteLoaderOptions = {\n composition?: AppshellComposition;\n /** Replaces the resolver chain outright; a seam for tests and embedders. */\n resolver?: RemoteResolver;\n};\n\nexport default (options: RemoteLoaderOptions = {}) => {\n const composition =\n options.composition ?? (typeof window === 'undefined' ? undefined : window.__appshell_config__);\n\n const resolve =\n options.resolver ?? chainResolvers(inlineResolver(composition), registryResolver(composition));\n\n return async <TComponent>(key: string) => {\n const failed = (err: unknown) =>\n new Error(`Failed to load component '${key}'. ${err?.toString()}`);\n\n let resolution;\n try {\n resolution = await resolve(key);\n } catch (err) {\n throw failed(err);\n }\n\n if (!resolution) {\n throw new Error(`Remote resource not found in registry. Expected: ${key}`);\n }\n\n const { remote, vars } = resolution;\n\n try {\n // Before the remote loads, so a package that validates its vars while its modules\n // evaluate still finds them. `@appshell/runtime` is a shared singleton, so this is\n // the same store the package reads through `getVars()`.\n // Vars are keyed by federation scope, which is itself one framework's vocabulary —\n // noted rather than fixed here, since application specs address overrides.vars the\n // same way.\n setVars(remote.loader.scope, vars);\n\n const Component = await loadAppshellComponent<TComponent>(remote);\n\n return [Component, remote] as const;\n } catch (err) {\n throw failed(err);\n }\n };\n};\n","import type { AppshellComposition, ResolvedRemote } from '@appshell/config';\n\nexport type RemoteResolution = {\n remote: ResolvedRemote;\n /** Already merged with the application's overrides — nothing left for the browser to layer on. */\n vars: Record<string, string | number | undefined>;\n};\n\nexport type RemoteResolver = (key: string) => Promise<RemoteResolution | undefined>;\n\n/** The registry inlined the composition into the page, so no network call is needed. */\nexport const inlineResolver =\n (composition?: AppshellComposition): RemoteResolver =>\n async (key) => {\n const remote = composition?.remotes[key];\n if (!composition || !remote) return undefined;\n\n return {\n remote,\n vars: composition.vars[remote.loader.scope] ?? {},\n };\n };\n\n/** Fetch-on-miss: covers a package activated after this page was served. */\nexport const registryResolver =\n (composition?: AppshellComposition, origin = ''): RemoteResolver =>\n async (key) => {\n if (!composition) return undefined;\n\n const url = `${origin}/v1/applications/${composition.applicationId}/remotes/${key}`;\n const response = await fetch(url, { credentials: 'include' });\n if (!response.ok) return undefined;\n\n const remote: ResolvedRemote = await response.json();\n\n return {\n remote,\n vars: composition.vars[remote.loader.scope] ?? {},\n };\n };\n\nexport const chainResolvers =\n (...resolvers: RemoteResolver[]): RemoteResolver =>\n async (key) => {\n // eslint-disable-next-line no-restricted-syntax\n for (const resolve of resolvers) {\n // eslint-disable-next-line no-await-in-loop\n const resolution = await resolve(key);\n if (resolution) return resolution;\n }\n\n return undefined;\n };\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ShareScope<TComponent = any> = Record<\n string,\n Record<string, { loaded?: 1; get: () => Promise<TComponent>; from: string; eager: boolean }>\n>;\n\nexport interface ModuleContainer<TComponent> {\n init(shareScope: ShareScope<TComponent>): Promise<void>;\n get(module: string): Promise<() => Record<string, TComponent>>;\n}\n","import { FC } from 'react';\n\ntype ErrorProps = {\n remote: string;\n reason: string;\n};\n\nconst LoadingError: FC<ErrorProps> = ({ remote, reason }) => (\n <div style={{ border: '3px solid red' }}>\n <h5>{`Error loading Appshell component '${remote}.'`}</h5>\n <span style={{ fontSize: '1rem' }}>{reason}</span>\n </div>\n);\n\nexport default LoadingError;\n","/* eslint-disable react/jsx-props-no-spreading */\nimport remoteLoader from '@appshell/loader';\nimport { ComponentType, ReactElement, ReactNode, useEffect, useState } from 'react';\nimport { RemoteProvider } from '../contexts/RemoteContext';\nimport LoadingError from './LoadingError';\n\nexport type ExtendedProps = Record<string, unknown>;\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint\nexport type RemoteSlotProps<TProps extends ExtendedProps = ExtendedProps> = {\n remote: string;\n fallback?: ReactNode;\n} & TProps;\n\n/**\n * Loads a remote once and leaves it alone.\n *\n * Keeping a remote current while it is being developed is not this component's job.\n * A remote served by a dev server ships webpack's HMR runtime and a dev-server client\n * inside its own `remoteEntry`, so it applies its own edits in place and React Fast\n * Refresh swaps the component implementations underneath this tree — no reload, and no\n * remount that would discard state this component never owned.\n *\n * Watching the remote's socket from here and reloading the page was strictly worse: it\n * raced the remote's own update, and it threw away the entire composed app to deliver a\n * change to one subtree. When webpack genuinely cannot apply an update, the remote's own\n * client still falls back to a full reload — which is the right place for that decision,\n * because it is the only side that knows whether the update applied.\n */\nconst RemoteSlot = <TProps extends ExtendedProps>({\n remote,\n fallback,\n ...rest\n}: RemoteSlotProps<TProps>): ReactElement<TProps> => {\n const [element, setElement] = useState<ReactElement>();\n\n useEffect(() => {\n let disposed = false;\n const loadComponent = remoteLoader();\n\n async function load() {\n try {\n const [Component, resolved] = await loadComponent<ComponentType>(remote);\n\n if (disposed || !Component) {\n return;\n }\n\n setElement(\n <RemoteProvider remote={resolved}>\n <Component {...rest} />\n </RemoteProvider>,\n );\n } catch (err) {\n if (!disposed) {\n setElement(<LoadingError remote={remote} reason={`${err}`} />);\n }\n }\n }\n\n setElement(undefined);\n load();\n\n return () => {\n disposed = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [remote, ...Object.values(rest)]);\n\n // eslint-disable-next-line no-console\n console.debug(`rendering RemoteSlot[${remote}], loading=${!element}`);\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{element || fallback}</>;\n};\n\nRemoteSlot.defaultProps = {\n fallback: undefined,\n};\n\nexport default RemoteSlot;\n","import { AppshellRemote } from '@appshell/config';\nimport type { FC, ReactNode } from 'react';\nimport { createContext } from 'react';\n\ninterface RemoteProviderProps {\n remote?: AppshellRemote;\n children: ReactNode;\n}\n\nexport const RemoteContext = createContext<AppshellRemote | undefined>(undefined);\n\nexport const RemoteProvider: FC<RemoteProviderProps> = ({ remote, children }) => (\n <RemoteContext.Provider value={remote}>{children}</RemoteContext.Provider>\n);\n\nRemoteProvider.defaultProps = {\n remote: undefined,\n};\n\nexport const RemoteConsumer = RemoteContext.Consumer;\n\nexport default RemoteContext;\n","import { AppshellRemote } from '@appshell/config';\nimport React from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport RemoteContext from '../contexts/RemoteContext';\n\n/** The remote backing the nearest `RemoteSlot` — it already knows its own key. */\nexport default (): AppshellRemote | undefined => React.useContext(RemoteContext);\n","/*\n * The wire types, re-exported so a React package needs one dependency rather than two\n * to type what RemoteSlot hands it.\n */\nexport type { AppshellIndex, AppshellRemote, Metadata } from '@appshell/runtime';\nexport { default as RemoteSlot } from './components/RemoteSlot';\nexport { RemoteProvider } from './contexts/RemoteContext';\nexport { default as useRemote } from './hooks/useRemote';\nexport { default as jsonResource } from './resources/jsonResource';\n","export default <TResource>(url: string) => {\n let status = 'pending';\n let result: TResource | Error;\n const suspender = fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n // eslint-disable-next-line consistent-return\n }).then((response) => {\n if (response.ok) {\n return response.json().then((data) => {\n status = 'success';\n result = data;\n });\n }\n status = 'error';\n result = new Error(`${response.status} ${response.statusText} ${response.url}`);\n });\n\n return {\n read() {\n if (status === 'pending') {\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw suspender as Promise<TResource>;\n } else if (status === 'error') {\n throw result as Error;\n } else if (status === 'success') {\n return result;\n }\n\n return undefined;\n },\n };\n};\n","export * from \"@module-federation/runtime-tools/runtime\"\n\nexport { };","export * from \"@module-federation/runtime\"\n\nexport { };"],"names":["remoteLoader","getInstance","init","loadRemote","registerRemotes","HOST_NAME","initialized","registeredScopes","Set","ensureInitialized","name","remotes","loadModuleFederation","scope","module","remoteEntryUrl","shareScope","console","debug","has","add","entry","exposed","replace","Module","Error","default","load","remote","loader","kind","setVars","loadAppshellComponent","chainResolvers","inlineResolver","registryResolver","options","composition","window","undefined","__appshell_config__","resolve","resolver","key","failed","err","toString","resolution","vars","Component","origin","url","applicationId","response","fetch","credentials","ok","json","resolvers","LoadingError","reason","_jsxs","style","border","children","_jsx","fontSize","useEffect","useState","RemoteProvider","jsx","Fragment","_Fragment","RemoteSlot","fallback","rest","element","setElement","disposed","loadComponent","resolved","Object","values","defaultProps","createContext","RemoteContext","Provider","value","RemoteConsumer","Consumer","React","useContext","useRemote","jsonResource","status","result","suspender","headers","Accept","then","data","statusText","read"],"sourceRoot":""}
|