@module-federation/bridge-vue3 0.0.0-next-20250926024003 → 0.0.0-perf-devtools-20260106124142
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 +80 -4
- package/dist/index.cjs +8 -5
- package/dist/index.js +1416 -1448
- package/package.json +7 -6
- package/src/provider.ts +7 -16
- package/src/routeUtils.ts +139 -0
package/dist/index.js
CHANGED
|
@@ -2,22 +2,12 @@ import * as Vue from "vue";
|
|
|
2
2
|
import { defineComponent, ref, useAttrs, watch, onMounted, onBeforeUnmount, createVNode, mergeProps, defineAsyncComponent, h } from "vue";
|
|
3
3
|
import * as VueRouter from "vue-router";
|
|
4
4
|
import { useRoute } from "vue-router";
|
|
5
|
-
function _extends$2() {
|
|
6
|
-
return _extends$2 = Object.assign || function(t) {
|
|
7
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
8
|
-
var r = arguments[n];
|
|
9
|
-
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
}, _extends$2.apply(this, arguments);
|
|
13
|
-
}
|
|
14
5
|
const MANIFEST_EXT = ".json", BROWSER_LOG_KEY = "FEDERATION_DEBUG", SEPARATOR = ":";
|
|
15
6
|
function isBrowserEnv() {
|
|
16
7
|
return typeof window < "u" && typeof window.document < "u";
|
|
17
8
|
}
|
|
18
9
|
function isReactNativeEnv() {
|
|
19
|
-
|
|
20
|
-
return typeof navigator < "u" && ((o = navigator) == null ? void 0 : o.product) === "ReactNative";
|
|
10
|
+
return typeof navigator < "u" && (navigator == null ? void 0 : navigator.product) === "ReactNative";
|
|
21
11
|
}
|
|
22
12
|
function isBrowserDebug() {
|
|
23
13
|
try {
|
|
@@ -31,390 +21,418 @@ function isBrowserDebug() {
|
|
|
31
21
|
function isDebugMode() {
|
|
32
22
|
return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : isBrowserDebug();
|
|
33
23
|
}
|
|
34
|
-
const LOG_CATEGORY$1 = "[ Federation Runtime ]", composeKeyWithSeparator = function(...
|
|
35
|
-
return
|
|
36
|
-
}, getResourceUrl = (
|
|
37
|
-
if ("getPublicPath" in
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
} else return "publicPath" in
|
|
41
|
-
}, warn$1 = (
|
|
42
|
-
console.warn(`${LOG_CATEGORY$1}: ${
|
|
24
|
+
const LOG_CATEGORY$1 = "[ Federation Runtime ]", composeKeyWithSeparator = function(...r) {
|
|
25
|
+
return r.length ? r.reduce((t, o) => o ? t ? `${t}${SEPARATOR}${o}` : o : t, "") : "";
|
|
26
|
+
}, getResourceUrl = (r, t) => {
|
|
27
|
+
if ("getPublicPath" in r) {
|
|
28
|
+
let o;
|
|
29
|
+
return r.getPublicPath.startsWith("function") ? o = new Function("return " + r.getPublicPath)()() : o = new Function(r.getPublicPath)(), `${o}${t}`;
|
|
30
|
+
} else return "publicPath" in r ? !isBrowserEnv() && !isReactNativeEnv() && "ssrPublicPath" in r ? `${r.ssrPublicPath}${t}` : `${r.publicPath}${t}` : (console.warn("Cannot get resource URL. If in debug mode, please ignore.", r, t), "");
|
|
31
|
+
}, warn$1 = (r) => {
|
|
32
|
+
console.warn(`${LOG_CATEGORY$1}: ${r}`);
|
|
43
33
|
};
|
|
44
|
-
function safeToString(
|
|
34
|
+
function safeToString(r) {
|
|
45
35
|
try {
|
|
46
|
-
return JSON.stringify(
|
|
36
|
+
return JSON.stringify(r, null, 2);
|
|
47
37
|
} catch {
|
|
48
38
|
return "";
|
|
49
39
|
}
|
|
50
40
|
}
|
|
51
|
-
const simpleJoinRemoteEntry = (
|
|
52
|
-
if (!
|
|
41
|
+
const simpleJoinRemoteEntry = (r, t) => {
|
|
42
|
+
if (!r)
|
|
53
43
|
return t;
|
|
54
|
-
const
|
|
44
|
+
const n = ((s) => {
|
|
55
45
|
if (s === ".")
|
|
56
46
|
return "";
|
|
57
47
|
if (s.startsWith("./"))
|
|
58
48
|
return s.replace("./", "");
|
|
59
49
|
if (s.startsWith("/")) {
|
|
60
|
-
const
|
|
61
|
-
return
|
|
50
|
+
const i = s.slice(1);
|
|
51
|
+
return i.endsWith("/") ? i.slice(0, -1) : i;
|
|
62
52
|
}
|
|
63
53
|
return s;
|
|
64
|
-
})(
|
|
65
|
-
return
|
|
54
|
+
})(r);
|
|
55
|
+
return n ? n.endsWith("/") ? `${n}${t}` : `${n}/${t}` : t;
|
|
66
56
|
};
|
|
67
|
-
function inferAutoPublicPath(
|
|
68
|
-
return
|
|
57
|
+
function inferAutoPublicPath(r) {
|
|
58
|
+
return r.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
69
59
|
}
|
|
70
|
-
function generateSnapshotFromManifest(
|
|
71
|
-
var
|
|
72
|
-
const { remotes:
|
|
60
|
+
function generateSnapshotFromManifest(r, t = {}) {
|
|
61
|
+
var S, I, A;
|
|
62
|
+
const { remotes: o = {}, overrides: n = {}, version: s } = t;
|
|
73
63
|
let i;
|
|
74
|
-
const c = () => "publicPath" in
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, R;
|
|
84
|
-
}, {})) || {};
|
|
85
|
-
}
|
|
86
|
-
Object.keys(s).forEach((R) => d[R] = {
|
|
64
|
+
const c = () => "publicPath" in r.metaData ? r.metaData.publicPath === "auto" && s ? inferAutoPublicPath(s) : r.metaData.publicPath : r.metaData.getPublicPath, a = Object.keys(n);
|
|
65
|
+
let l = {};
|
|
66
|
+
Object.keys(o).length || (l = ((S = r.remotes) == null ? void 0 : S.reduce((R, T) => {
|
|
67
|
+
let w;
|
|
68
|
+
const $ = T.federationContainerName;
|
|
69
|
+
return a.includes($) ? w = n[$] : "version" in T ? w = T.version : w = T.entry, R[$] = {
|
|
70
|
+
matchedVersion: w
|
|
71
|
+
}, R;
|
|
72
|
+
}, {})) || {}), Object.keys(o).forEach((R) => l[R] = {
|
|
87
73
|
// overrides will override dependencies
|
|
88
|
-
matchedVersion:
|
|
74
|
+
matchedVersion: a.includes(R) ? n[R] : o[R]
|
|
89
75
|
});
|
|
90
|
-
const { remoteEntry: { path:
|
|
91
|
-
let
|
|
92
|
-
version:
|
|
93
|
-
buildVersion:
|
|
94
|
-
globalName:
|
|
95
|
-
remoteEntry: simpleJoinRemoteEntry(
|
|
96
|
-
remoteEntryType:
|
|
97
|
-
remoteTypes: simpleJoinRemoteEntry(
|
|
98
|
-
remoteTypesZip:
|
|
99
|
-
remoteTypesAPI:
|
|
100
|
-
remotesInfo:
|
|
101
|
-
shared:
|
|
76
|
+
const { remoteEntry: { path: u, name: d, type: y }, types: p = { path: "", name: "", zip: "", api: "" }, buildInfo: { buildVersion: m }, globalName: g, ssrRemoteEntry: _ } = r.metaData, { exposes: E } = r;
|
|
77
|
+
let b = {
|
|
78
|
+
version: s || "",
|
|
79
|
+
buildVersion: m,
|
|
80
|
+
globalName: g,
|
|
81
|
+
remoteEntry: simpleJoinRemoteEntry(u, d),
|
|
82
|
+
remoteEntryType: y,
|
|
83
|
+
remoteTypes: simpleJoinRemoteEntry(p.path, p.name),
|
|
84
|
+
remoteTypesZip: p.zip || "",
|
|
85
|
+
remoteTypesAPI: p.api || "",
|
|
86
|
+
remotesInfo: l,
|
|
87
|
+
shared: r == null ? void 0 : r.shared.map((R) => ({
|
|
102
88
|
assets: R.assets,
|
|
103
89
|
sharedName: R.name,
|
|
104
90
|
version: R.version
|
|
105
91
|
})),
|
|
106
|
-
modules:
|
|
92
|
+
modules: E == null ? void 0 : E.map((R) => ({
|
|
107
93
|
moduleName: R.name,
|
|
108
94
|
modulePath: R.path,
|
|
109
95
|
assets: R.assets
|
|
110
96
|
}))
|
|
111
97
|
};
|
|
112
|
-
if ((
|
|
113
|
-
const R =
|
|
114
|
-
|
|
98
|
+
if ((I = r.metaData) != null && I.prefetchInterface) {
|
|
99
|
+
const R = r.metaData.prefetchInterface;
|
|
100
|
+
b = {
|
|
101
|
+
...b,
|
|
115
102
|
prefetchInterface: R
|
|
116
|
-
}
|
|
103
|
+
};
|
|
117
104
|
}
|
|
118
|
-
if ((
|
|
119
|
-
const { path: R, name:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
105
|
+
if ((A = r.metaData) != null && A.prefetchEntry) {
|
|
106
|
+
const { path: R, name: T, type: w } = r.metaData.prefetchEntry;
|
|
107
|
+
b = {
|
|
108
|
+
...b,
|
|
109
|
+
prefetchEntry: simpleJoinRemoteEntry(R, T),
|
|
110
|
+
prefetchEntryType: w
|
|
111
|
+
};
|
|
124
112
|
}
|
|
125
|
-
if ("publicPath" in
|
|
113
|
+
if ("publicPath" in r.metaData ? i = {
|
|
114
|
+
...b,
|
|
126
115
|
publicPath: c(),
|
|
127
|
-
ssrPublicPath:
|
|
128
|
-
}
|
|
116
|
+
ssrPublicPath: r.metaData.ssrPublicPath
|
|
117
|
+
} : i = {
|
|
118
|
+
...b,
|
|
129
119
|
getPublicPath: c()
|
|
130
|
-
}
|
|
131
|
-
const R = simpleJoinRemoteEntry(
|
|
132
|
-
i.ssrRemoteEntry = R, i.ssrRemoteEntryType =
|
|
120
|
+
}, _) {
|
|
121
|
+
const R = simpleJoinRemoteEntry(_.path, _.name);
|
|
122
|
+
i.ssrRemoteEntry = R, i.ssrRemoteEntryType = _.type || "commonjs-module";
|
|
133
123
|
}
|
|
134
124
|
return i;
|
|
135
125
|
}
|
|
136
|
-
function isManifestProvider(
|
|
137
|
-
return !!("remoteEntry" in
|
|
126
|
+
function isManifestProvider(r) {
|
|
127
|
+
return !!("remoteEntry" in r && r.remoteEntry.includes(MANIFEST_EXT));
|
|
128
|
+
}
|
|
129
|
+
const PREFIX = "[ Module Federation ]", DEFAULT_DELEGATE = console, LOGGER_STACK_SKIP_TOKENS = [
|
|
130
|
+
"logger.ts",
|
|
131
|
+
"logger.js",
|
|
132
|
+
"captureStackTrace",
|
|
133
|
+
"Logger.emit",
|
|
134
|
+
"Logger.log",
|
|
135
|
+
"Logger.info",
|
|
136
|
+
"Logger.warn",
|
|
137
|
+
"Logger.error",
|
|
138
|
+
"Logger.debug"
|
|
139
|
+
];
|
|
140
|
+
function captureStackTrace() {
|
|
141
|
+
try {
|
|
142
|
+
const r = new Error().stack;
|
|
143
|
+
if (!r)
|
|
144
|
+
return;
|
|
145
|
+
const [, ...t] = r.split(`
|
|
146
|
+
`), o = t.filter((s) => !LOGGER_STACK_SKIP_TOKENS.some((i) => s.includes(i)));
|
|
147
|
+
return o.length ? `Stack trace:
|
|
148
|
+
${o.slice(0, 5).join(`
|
|
149
|
+
`)}` : void 0;
|
|
150
|
+
} catch {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
138
153
|
}
|
|
139
|
-
|
|
154
|
+
class Logger {
|
|
155
|
+
constructor(t, o = DEFAULT_DELEGATE) {
|
|
156
|
+
this.prefix = t, this.delegate = o ?? DEFAULT_DELEGATE;
|
|
157
|
+
}
|
|
140
158
|
setPrefix(t) {
|
|
141
159
|
this.prefix = t;
|
|
142
160
|
}
|
|
161
|
+
setDelegate(t) {
|
|
162
|
+
this.delegate = t ?? DEFAULT_DELEGATE;
|
|
163
|
+
}
|
|
164
|
+
emit(t, o) {
|
|
165
|
+
const n = this.delegate, i = isDebugMode() ? captureStackTrace() : void 0, c = i ? [...o, i] : o, a = (() => {
|
|
166
|
+
switch (t) {
|
|
167
|
+
case "log":
|
|
168
|
+
return ["log", "info"];
|
|
169
|
+
case "info":
|
|
170
|
+
return ["info", "log"];
|
|
171
|
+
case "warn":
|
|
172
|
+
return ["warn", "info", "log"];
|
|
173
|
+
case "error":
|
|
174
|
+
return ["error", "warn", "log"];
|
|
175
|
+
case "debug":
|
|
176
|
+
default:
|
|
177
|
+
return ["debug", "log"];
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
for (const l of a) {
|
|
181
|
+
const u = n[l];
|
|
182
|
+
if (typeof u == "function") {
|
|
183
|
+
u.call(n, this.prefix, ...c);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
for (const l of a) {
|
|
188
|
+
const u = DEFAULT_DELEGATE[l];
|
|
189
|
+
if (typeof u == "function") {
|
|
190
|
+
u.call(DEFAULT_DELEGATE, this.prefix, ...c);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
143
195
|
log(...t) {
|
|
144
|
-
|
|
196
|
+
this.emit("log", t);
|
|
145
197
|
}
|
|
146
198
|
warn(...t) {
|
|
147
|
-
|
|
199
|
+
this.emit("warn", t);
|
|
148
200
|
}
|
|
149
201
|
error(...t) {
|
|
150
|
-
|
|
202
|
+
this.emit("error", t);
|
|
151
203
|
}
|
|
152
204
|
success(...t) {
|
|
153
|
-
|
|
205
|
+
this.emit("info", t);
|
|
154
206
|
}
|
|
155
207
|
info(...t) {
|
|
156
|
-
|
|
208
|
+
this.emit("info", t);
|
|
157
209
|
}
|
|
158
210
|
ready(...t) {
|
|
159
|
-
|
|
211
|
+
this.emit("info", t);
|
|
160
212
|
}
|
|
161
213
|
debug(...t) {
|
|
162
|
-
isDebugMode() &&
|
|
163
|
-
}
|
|
164
|
-
constructor(t) {
|
|
165
|
-
this.prefix = t;
|
|
214
|
+
isDebugMode() && this.emit("debug", t);
|
|
166
215
|
}
|
|
167
|
-
};
|
|
168
|
-
function createLogger(o) {
|
|
169
|
-
return new Logger(o);
|
|
170
216
|
}
|
|
171
|
-
|
|
217
|
+
function createLogger(r) {
|
|
218
|
+
return new Logger(r);
|
|
219
|
+
}
|
|
220
|
+
function createInfrastructureLogger(r) {
|
|
221
|
+
const t = new Logger(r);
|
|
222
|
+
return Object.defineProperty(t, "__mf_infrastructure_logger__", {
|
|
223
|
+
value: !0,
|
|
224
|
+
enumerable: !1,
|
|
225
|
+
configurable: !1
|
|
226
|
+
}), t;
|
|
227
|
+
}
|
|
228
|
+
createInfrastructureLogger(PREFIX);
|
|
229
|
+
async function safeWrapper(r, t) {
|
|
172
230
|
try {
|
|
173
|
-
return await
|
|
174
|
-
} catch (
|
|
175
|
-
warn$1(
|
|
231
|
+
return await r();
|
|
232
|
+
} catch (o) {
|
|
233
|
+
warn$1(o);
|
|
176
234
|
return;
|
|
177
235
|
}
|
|
178
236
|
}
|
|
179
|
-
function isStaticResourcesEqual(
|
|
180
|
-
const
|
|
181
|
-
return
|
|
237
|
+
function isStaticResourcesEqual(r, t) {
|
|
238
|
+
const o = /^(https?:)?\/\//i, n = r.replace(o, "").replace(/\/$/, ""), s = t.replace(o, "").replace(/\/$/, "");
|
|
239
|
+
return n === s;
|
|
182
240
|
}
|
|
183
|
-
function createScript(
|
|
184
|
-
let t = null,
|
|
185
|
-
const
|
|
186
|
-
for (let
|
|
187
|
-
const
|
|
188
|
-
if (u && isStaticResourcesEqual(u,
|
|
189
|
-
t =
|
|
241
|
+
function createScript(r) {
|
|
242
|
+
let t = null, o = !0, n = 2e4, s;
|
|
243
|
+
const i = document.getElementsByTagName("script");
|
|
244
|
+
for (let a = 0; a < i.length; a++) {
|
|
245
|
+
const l = i[a], u = l.getAttribute("src");
|
|
246
|
+
if (u && isStaticResourcesEqual(u, r.url)) {
|
|
247
|
+
t = l, o = !1;
|
|
190
248
|
break;
|
|
191
249
|
}
|
|
192
250
|
}
|
|
193
251
|
if (!t) {
|
|
194
|
-
const
|
|
195
|
-
t = document.createElement("script"), t.type = (
|
|
196
|
-
let
|
|
197
|
-
|
|
198
|
-
t && (u === "async" || u === "defer" ? t[u] =
|
|
252
|
+
const a = r.attrs;
|
|
253
|
+
t = document.createElement("script"), t.type = (a == null ? void 0 : a.type) === "module" ? "module" : "text/javascript";
|
|
254
|
+
let l;
|
|
255
|
+
r.createScriptHook && (l = r.createScriptHook(r.url, r.attrs), l instanceof HTMLScriptElement ? t = l : typeof l == "object" && ("script" in l && l.script && (t = l.script), "timeout" in l && l.timeout && (n = l.timeout))), t.src || (t.src = r.url), a && !l && Object.keys(a).forEach((u) => {
|
|
256
|
+
t && (u === "async" || u === "defer" ? t[u] = a[u] : t.getAttribute(u) || t.setAttribute(u, a[u]));
|
|
199
257
|
});
|
|
200
258
|
}
|
|
201
|
-
const
|
|
259
|
+
const c = async (a, l) => {
|
|
202
260
|
clearTimeout(s);
|
|
203
261
|
const u = () => {
|
|
204
|
-
(
|
|
262
|
+
(l == null ? void 0 : l.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(l)) : r != null && r.cb && (r == null || r.cb());
|
|
205
263
|
};
|
|
206
264
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
207
|
-
const { needDeleteScript: d = !0 } =
|
|
265
|
+
const { needDeleteScript: d = !0 } = r;
|
|
208
266
|
d && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
209
|
-
}),
|
|
210
|
-
const d =
|
|
267
|
+
}), a && typeof a == "function")) {
|
|
268
|
+
const d = a(l);
|
|
211
269
|
if (d instanceof Promise) {
|
|
212
|
-
const
|
|
213
|
-
return u(),
|
|
270
|
+
const y = await d;
|
|
271
|
+
return u(), y;
|
|
214
272
|
}
|
|
215
273
|
return u(), d;
|
|
216
274
|
}
|
|
217
275
|
u();
|
|
218
276
|
};
|
|
219
|
-
return t.onerror =
|
|
220
|
-
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const l = r[a], i = l.getAttribute("href"), c = l.getAttribute("rel");
|
|
231
|
-
if (i && isStaticResourcesEqual(i, o.url) && c === o.attrs.rel) {
|
|
232
|
-
t = l, n = !1;
|
|
277
|
+
return t.onerror = c.bind(null, t.onerror), t.onload = c.bind(null, t.onload), s = setTimeout(() => {
|
|
278
|
+
c(null, new Error(`Remote script "${r.url}" time-outed.`));
|
|
279
|
+
}, n), { script: t, needAttach: o };
|
|
280
|
+
}
|
|
281
|
+
function createLink(r) {
|
|
282
|
+
let t = null, o = !0;
|
|
283
|
+
const n = document.getElementsByTagName("link");
|
|
284
|
+
for (let i = 0; i < n.length; i++) {
|
|
285
|
+
const c = n[i], a = c.getAttribute("href"), l = c.getAttribute("rel");
|
|
286
|
+
if (a && isStaticResourcesEqual(a, r.url) && l === r.attrs.rel) {
|
|
287
|
+
t = c, o = !1;
|
|
233
288
|
break;
|
|
234
289
|
}
|
|
235
290
|
}
|
|
236
291
|
if (!t) {
|
|
237
|
-
t = document.createElement("link"), t.setAttribute("href",
|
|
238
|
-
let
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
t && !t.getAttribute(
|
|
292
|
+
t = document.createElement("link"), t.setAttribute("href", r.url);
|
|
293
|
+
let i;
|
|
294
|
+
const c = r.attrs;
|
|
295
|
+
r.createLinkHook && (i = r.createLinkHook(r.url, c), i instanceof HTMLLinkElement && (t = i)), c && !i && Object.keys(c).forEach((a) => {
|
|
296
|
+
t && !t.getAttribute(a) && t.setAttribute(a, c[a]);
|
|
242
297
|
});
|
|
243
298
|
}
|
|
244
|
-
const s = (
|
|
245
|
-
const
|
|
246
|
-
(
|
|
299
|
+
const s = (i, c) => {
|
|
300
|
+
const a = () => {
|
|
301
|
+
(c == null ? void 0 : c.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(c)) : r != null && r.cb && (r == null || r.cb());
|
|
247
302
|
};
|
|
248
303
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
249
|
-
const { needDeleteLink:
|
|
250
|
-
|
|
251
|
-
}),
|
|
252
|
-
const
|
|
253
|
-
return
|
|
304
|
+
const { needDeleteLink: l = !0 } = r;
|
|
305
|
+
l && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
306
|
+
}), i)) {
|
|
307
|
+
const l = i(c);
|
|
308
|
+
return a(), l;
|
|
254
309
|
}
|
|
255
|
-
|
|
256
|
-
};
|
|
257
|
-
return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), {
|
|
258
|
-
link: t,
|
|
259
|
-
needAttach: n
|
|
310
|
+
a();
|
|
260
311
|
};
|
|
312
|
+
return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), { link: t, needAttach: o };
|
|
261
313
|
}
|
|
262
|
-
function loadScript(
|
|
263
|
-
const { attrs:
|
|
264
|
-
return new Promise((s,
|
|
265
|
-
const { script:
|
|
266
|
-
url:
|
|
314
|
+
function loadScript(r, t) {
|
|
315
|
+
const { attrs: o = {}, createScriptHook: n } = t;
|
|
316
|
+
return new Promise((s, i) => {
|
|
317
|
+
const { script: c, needAttach: a } = createScript({
|
|
318
|
+
url: r,
|
|
267
319
|
cb: s,
|
|
268
|
-
onErrorCallback:
|
|
269
|
-
attrs:
|
|
270
|
-
fetchpriority: "high"
|
|
271
|
-
|
|
272
|
-
|
|
320
|
+
onErrorCallback: i,
|
|
321
|
+
attrs: {
|
|
322
|
+
fetchpriority: "high",
|
|
323
|
+
...o
|
|
324
|
+
},
|
|
325
|
+
createScriptHook: n,
|
|
273
326
|
needDeleteScript: !0
|
|
274
327
|
});
|
|
275
|
-
|
|
328
|
+
a && document.head.appendChild(c);
|
|
276
329
|
});
|
|
277
330
|
}
|
|
278
331
|
const sdkImportCache = /* @__PURE__ */ new Map();
|
|
279
|
-
function importNodeModule(
|
|
280
|
-
if (!
|
|
332
|
+
function importNodeModule(r) {
|
|
333
|
+
if (!r)
|
|
281
334
|
throw new Error("import specifier is required");
|
|
282
|
-
if (sdkImportCache.has(
|
|
283
|
-
return sdkImportCache.get(
|
|
284
|
-
const
|
|
285
|
-
throw console.error(`Error importing module ${
|
|
335
|
+
if (sdkImportCache.has(r))
|
|
336
|
+
return sdkImportCache.get(r);
|
|
337
|
+
const o = new Function("name", "return import(name)")(r).then((n) => n).catch((n) => {
|
|
338
|
+
throw console.error(`Error importing module ${r}:`, n), sdkImportCache.delete(r), n;
|
|
286
339
|
});
|
|
287
|
-
return sdkImportCache.set(
|
|
340
|
+
return sdkImportCache.set(r, o), o;
|
|
288
341
|
}
|
|
289
342
|
const loadNodeFetch = async () => {
|
|
290
|
-
const
|
|
291
|
-
return
|
|
292
|
-
}, lazyLoaderHookFetch = async (
|
|
293
|
-
const s = await ((
|
|
294
|
-
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(
|
|
343
|
+
const r = await importNodeModule("node-fetch");
|
|
344
|
+
return r.default || r;
|
|
345
|
+
}, lazyLoaderHookFetch = async (r, t, o) => {
|
|
346
|
+
const s = await ((i, c) => o.lifecycle.fetch.emit(i, c))(r, t || {});
|
|
347
|
+
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(r, t || {}) : s;
|
|
295
348
|
}, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
|
|
296
349
|
if (loaderHook != null && loaderHook.createScriptHook) {
|
|
297
|
-
const
|
|
298
|
-
|
|
350
|
+
const r = loaderHook.createScriptHook(url);
|
|
351
|
+
r && typeof r == "object" && "url" in r && (url = r.url);
|
|
299
352
|
}
|
|
300
353
|
let urlObj;
|
|
301
354
|
try {
|
|
302
355
|
urlObj = new URL(url);
|
|
303
|
-
} catch (
|
|
304
|
-
console.error("Error constructing URL:",
|
|
356
|
+
} catch (r) {
|
|
357
|
+
console.error("Error constructing URL:", r), cb(new Error(`Invalid URL: ${r}`));
|
|
305
358
|
return;
|
|
306
359
|
}
|
|
307
|
-
const getFetch = async () => loaderHook != null && loaderHook.fetch ? (
|
|
360
|
+
const getFetch = async () => loaderHook != null && loaderHook.fetch ? (r, t) => lazyLoaderHookFetch(r, t, loaderHook) : typeof fetch > "u" ? loadNodeFetch() : fetch, handleScriptFetch = async (f, urlObj) => {
|
|
361
|
+
var r;
|
|
308
362
|
try {
|
|
309
|
-
var _vm_constants;
|
|
310
363
|
const res = await f(urlObj.href), data = await res.text(), [path, vm] = await Promise.all([
|
|
311
364
|
importNodeModule("path"),
|
|
312
365
|
importNodeModule("vm")
|
|
313
|
-
]), scriptContext = {
|
|
314
|
-
exports: {},
|
|
315
|
-
module: {
|
|
316
|
-
exports: {}
|
|
317
|
-
}
|
|
318
|
-
}, urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/"), filename = path.basename(urlObj.pathname);
|
|
319
|
-
var _vm_constants_USE_MAIN_CONTEXT_DEFAULT_LOADER;
|
|
320
|
-
const script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
|
|
366
|
+
]), scriptContext = { exports: {}, module: { exports: {} } }, urlDirname = urlObj.pathname.split("/").slice(0, -1).join("/"), filename = path.basename(urlObj.pathname), script = new vm.Script(`(function(exports, module, require, __dirname, __filename) {${data}
|
|
321
367
|
})`, {
|
|
322
368
|
filename,
|
|
323
|
-
importModuleDynamically: (
|
|
369
|
+
importModuleDynamically: (
|
|
370
|
+
//@ts-ignore
|
|
371
|
+
((r = vm.constants) == null ? void 0 : r.USE_MAIN_CONTEXT_DEFAULT_LOADER) ?? importNodeModule
|
|
372
|
+
)
|
|
324
373
|
});
|
|
325
374
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
326
375
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
327
376
|
if (attrs && exportedInterface && attrs.globalName) {
|
|
328
|
-
const
|
|
329
|
-
cb(void 0,
|
|
377
|
+
const t = exportedInterface[attrs.globalName] || exportedInterface;
|
|
378
|
+
cb(void 0, t);
|
|
330
379
|
return;
|
|
331
380
|
}
|
|
332
381
|
cb(void 0, exportedInterface);
|
|
333
|
-
} catch (
|
|
334
|
-
cb(
|
|
382
|
+
} catch (t) {
|
|
383
|
+
cb(t instanceof Error ? t : new Error(`Script execution error: ${t}`));
|
|
335
384
|
}
|
|
336
385
|
};
|
|
337
|
-
getFetch().then(async (
|
|
386
|
+
getFetch().then(async (r) => {
|
|
338
387
|
if ((attrs == null ? void 0 : attrs.type) === "esm" || (attrs == null ? void 0 : attrs.type) === "module")
|
|
339
388
|
return loadModule(urlObj.href, {
|
|
340
|
-
fetch:
|
|
389
|
+
fetch: r,
|
|
341
390
|
vm: await importNodeModule("vm")
|
|
342
391
|
}).then(async (t) => {
|
|
343
392
|
await t.evaluate(), cb(void 0, t.namespace);
|
|
344
393
|
}).catch((t) => {
|
|
345
394
|
cb(t instanceof Error ? t : new Error(`Script execution error: ${t}`));
|
|
346
395
|
});
|
|
347
|
-
handleScriptFetch(
|
|
348
|
-
}).catch((
|
|
349
|
-
cb(
|
|
396
|
+
handleScriptFetch(r, urlObj);
|
|
397
|
+
}).catch((r) => {
|
|
398
|
+
cb(r);
|
|
350
399
|
});
|
|
351
|
-
} : (
|
|
400
|
+
} : (r, t, o, n) => {
|
|
352
401
|
t(new Error("createScriptNode is disabled in non-Node.js environment"));
|
|
353
|
-
}, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (
|
|
354
|
-
createScriptNode(
|
|
402
|
+
}, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (r, t) => new Promise((o, n) => {
|
|
403
|
+
createScriptNode(r, (s, i) => {
|
|
404
|
+
var c, a;
|
|
355
405
|
if (s)
|
|
356
|
-
|
|
406
|
+
n(s);
|
|
357
407
|
else {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
n(u);
|
|
408
|
+
const l = ((c = t == null ? void 0 : t.attrs) == null ? void 0 : c.globalName) || `__FEDERATION_${(a = t == null ? void 0 : t.attrs) == null ? void 0 : a.name}:custom__`, u = globalThis[l] = i;
|
|
409
|
+
o(u);
|
|
361
410
|
}
|
|
362
411
|
}, t.attrs, t.loaderHook);
|
|
363
|
-
}) : (
|
|
412
|
+
}) : (r, t) => {
|
|
364
413
|
throw new Error("loadScriptNode is disabled in non-Node.js environment");
|
|
365
414
|
}, esmModuleCache = /* @__PURE__ */ new Map();
|
|
366
|
-
async function loadModule(
|
|
367
|
-
if (esmModuleCache.has(
|
|
368
|
-
return esmModuleCache.get(
|
|
369
|
-
const { fetch:
|
|
415
|
+
async function loadModule(r, t) {
|
|
416
|
+
if (esmModuleCache.has(r))
|
|
417
|
+
return esmModuleCache.get(r);
|
|
418
|
+
const { fetch: o, vm: n } = t, i = await (await o(r)).text(), c = new n.SourceTextModule(i, {
|
|
370
419
|
// @ts-ignore
|
|
371
|
-
importModuleDynamically: async (
|
|
372
|
-
const u = new URL(
|
|
420
|
+
importModuleDynamically: async (a, l) => {
|
|
421
|
+
const u = new URL(a, r).href;
|
|
373
422
|
return loadModule(u, t);
|
|
374
423
|
}
|
|
375
424
|
});
|
|
376
|
-
return esmModuleCache.set(
|
|
377
|
-
const
|
|
378
|
-
return await loadModule(
|
|
379
|
-
}),
|
|
380
|
-
}
|
|
381
|
-
const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]")
|
|
382
|
-
|
|
383
|
-
return
|
|
384
|
-
|
|
385
|
-
var r = arguments[n];
|
|
386
|
-
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
387
|
-
}
|
|
388
|
-
return t;
|
|
389
|
-
}, _extends$1.apply(this, arguments);
|
|
390
|
-
}
|
|
391
|
-
function _object_without_properties_loose(o, t) {
|
|
392
|
-
if (o == null) return {};
|
|
393
|
-
var n = {}, r = Object.keys(o), s, a;
|
|
394
|
-
for (a = 0; a < r.length; a++)
|
|
395
|
-
s = r[a], !(t.indexOf(s) >= 0) && (n[s] = o[s]);
|
|
396
|
-
return n;
|
|
397
|
-
}
|
|
398
|
-
const RUNTIME_001 = "RUNTIME-001", RUNTIME_002 = "RUNTIME-002", RUNTIME_003 = "RUNTIME-003", RUNTIME_004 = "RUNTIME-004", RUNTIME_005 = "RUNTIME-005", RUNTIME_006 = "RUNTIME-006", RUNTIME_007 = "RUNTIME-007", RUNTIME_008 = "RUNTIME-008", RUNTIME_009 = "RUNTIME-009", TYPE_001 = "TYPE-001", BUILD_001 = "BUILD-001", BUILD_002 = "BUILD-002", getDocsUrl = (o) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${o.split("-")[0].toLowerCase()}/${o}`, getShortErrorMsg = (o, t, n, r) => {
|
|
399
|
-
const s = [
|
|
400
|
-
`${[
|
|
401
|
-
t[o]
|
|
402
|
-
]} #${o}`
|
|
403
|
-
];
|
|
404
|
-
return n && s.push(`args: ${JSON.stringify(n)}`), s.push(getDocsUrl(o)), r && s.push(`Original Error Message:
|
|
405
|
-
${r}`), s.join(`
|
|
425
|
+
return esmModuleCache.set(r, c), await c.link(async (a) => {
|
|
426
|
+
const l = new URL(a, r).href;
|
|
427
|
+
return await loadModule(l, t);
|
|
428
|
+
}), c;
|
|
429
|
+
}
|
|
430
|
+
const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]"), RUNTIME_001 = "RUNTIME-001", RUNTIME_002 = "RUNTIME-002", RUNTIME_003 = "RUNTIME-003", RUNTIME_004 = "RUNTIME-004", RUNTIME_005 = "RUNTIME-005", RUNTIME_006 = "RUNTIME-006", RUNTIME_007 = "RUNTIME-007", RUNTIME_008 = "RUNTIME-008", RUNTIME_009 = "RUNTIME-009", getDocsUrl = (r) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}/${r}`, getShortErrorMsg = (r, t, o, n) => {
|
|
431
|
+
const s = [`${[t[r]]} #${r}`];
|
|
432
|
+
return o && s.push(`args: ${JSON.stringify(o)}`), s.push(getDocsUrl(r)), n && s.push(`Original Error Message:
|
|
433
|
+
${n}`), s.join(`
|
|
406
434
|
`);
|
|
407
|
-
}
|
|
408
|
-
function _extends() {
|
|
409
|
-
return _extends = Object.assign || function(t) {
|
|
410
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
411
|
-
var r = arguments[n];
|
|
412
|
-
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
413
|
-
}
|
|
414
|
-
return t;
|
|
415
|
-
}, _extends.apply(this, arguments);
|
|
416
|
-
}
|
|
417
|
-
const runtimeDescMap = {
|
|
435
|
+
}, runtimeDescMap = {
|
|
418
436
|
[RUNTIME_001]: "Failed to get remoteEntry exports.",
|
|
419
437
|
[RUNTIME_002]: 'The remote entry interface does not contain "init"',
|
|
420
438
|
[RUNTIME_003]: "Failed to get manifest.",
|
|
@@ -424,66 +442,57 @@ const runtimeDescMap = {
|
|
|
424
442
|
[RUNTIME_007]: "Failed to get remote snapshot.",
|
|
425
443
|
[RUNTIME_008]: "Failed to load script resources.",
|
|
426
444
|
[RUNTIME_009]: "Please call createInstance first."
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
[BUILD_001]: "Failed to find expose module.",
|
|
431
|
-
[BUILD_002]: "PublicPath is required in prod mode."
|
|
432
|
-
};
|
|
433
|
-
_extends({}, runtimeDescMap, typeDescMap, buildDescMap);
|
|
434
|
-
const LOG_CATEGORY = "[ Federation Runtime ]", logger = createLogger(LOG_CATEGORY);
|
|
435
|
-
function assert(o, t) {
|
|
436
|
-
o || error(t);
|
|
445
|
+
}, LOG_CATEGORY = "[ Federation Runtime ]", logger = createLogger(LOG_CATEGORY);
|
|
446
|
+
function assert(r, t) {
|
|
447
|
+
r || error(t);
|
|
437
448
|
}
|
|
438
|
-
function error(
|
|
439
|
-
throw
|
|
449
|
+
function error(r) {
|
|
450
|
+
throw r instanceof Error ? (r.message.startsWith(LOG_CATEGORY) || (r.message = `${LOG_CATEGORY}: ${r.message}`), r) : new Error(`${LOG_CATEGORY}: ${r}`);
|
|
440
451
|
}
|
|
441
|
-
function warn(
|
|
442
|
-
|
|
452
|
+
function warn(r) {
|
|
453
|
+
r instanceof Error && (r.message.startsWith(LOG_CATEGORY) || (r.message = `${LOG_CATEGORY}: ${r.message}`)), logger.warn(r);
|
|
443
454
|
}
|
|
444
|
-
function addUniqueItem(
|
|
445
|
-
return
|
|
455
|
+
function addUniqueItem(r, t) {
|
|
456
|
+
return r.findIndex((o) => o === t) === -1 && r.push(t), r;
|
|
446
457
|
}
|
|
447
|
-
function getFMId(
|
|
448
|
-
return "version" in
|
|
458
|
+
function getFMId(r) {
|
|
459
|
+
return "version" in r && r.version ? `${r.name}:${r.version}` : "entry" in r && r.entry ? `${r.name}:${r.entry}` : `${r.name}`;
|
|
449
460
|
}
|
|
450
|
-
function isRemoteInfoWithEntry(
|
|
451
|
-
return typeof
|
|
461
|
+
function isRemoteInfoWithEntry(r) {
|
|
462
|
+
return typeof r.entry < "u";
|
|
452
463
|
}
|
|
453
|
-
function isPureRemoteEntry(
|
|
454
|
-
return !
|
|
464
|
+
function isPureRemoteEntry(r) {
|
|
465
|
+
return !r.entry.includes(".json");
|
|
455
466
|
}
|
|
456
|
-
function isObject(
|
|
457
|
-
return
|
|
467
|
+
function isObject(r) {
|
|
468
|
+
return r && typeof r == "object";
|
|
458
469
|
}
|
|
459
470
|
const objectToString = Object.prototype.toString;
|
|
460
|
-
function isPlainObject(
|
|
461
|
-
return objectToString.call(
|
|
471
|
+
function isPlainObject(r) {
|
|
472
|
+
return objectToString.call(r) === "[object Object]";
|
|
462
473
|
}
|
|
463
|
-
function arrayOptions(
|
|
464
|
-
return Array.isArray(
|
|
465
|
-
o
|
|
466
|
-
];
|
|
474
|
+
function arrayOptions(r) {
|
|
475
|
+
return Array.isArray(r) ? r : [r];
|
|
467
476
|
}
|
|
468
|
-
function getRemoteEntryInfoFromSnapshot(
|
|
477
|
+
function getRemoteEntryInfoFromSnapshot(r) {
|
|
469
478
|
const t = {
|
|
470
479
|
url: "",
|
|
471
480
|
type: "global",
|
|
472
481
|
globalName: ""
|
|
473
482
|
};
|
|
474
|
-
return isBrowserEnv() || isReactNativeEnv() ? "remoteEntry" in
|
|
475
|
-
url:
|
|
476
|
-
type:
|
|
477
|
-
globalName:
|
|
478
|
-
} : t : "ssrRemoteEntry" in
|
|
479
|
-
url:
|
|
480
|
-
type:
|
|
481
|
-
globalName:
|
|
483
|
+
return isBrowserEnv() || isReactNativeEnv() ? "remoteEntry" in r ? {
|
|
484
|
+
url: r.remoteEntry,
|
|
485
|
+
type: r.remoteEntryType,
|
|
486
|
+
globalName: r.globalName
|
|
487
|
+
} : t : "ssrRemoteEntry" in r ? {
|
|
488
|
+
url: r.ssrRemoteEntry || t.url,
|
|
489
|
+
type: r.ssrRemoteEntryType || t.type,
|
|
490
|
+
globalName: r.globalName
|
|
482
491
|
} : t;
|
|
483
492
|
}
|
|
484
|
-
const processModuleAlias = (
|
|
485
|
-
let
|
|
486
|
-
return
|
|
493
|
+
const processModuleAlias = (r, t) => {
|
|
494
|
+
let o;
|
|
495
|
+
return r.endsWith("/") ? o = r.slice(0, -1) : o = r, t.startsWith(".") && (t = t.slice(1)), o = o + t, o;
|
|
487
496
|
}, CurrentGlobal = typeof globalThis == "object" ? globalThis : window, nativeGlobal = (() => {
|
|
488
497
|
try {
|
|
489
498
|
return document.defaultView;
|
|
@@ -491,61 +500,49 @@ const processModuleAlias = (o, t) => {
|
|
|
491
500
|
return CurrentGlobal;
|
|
492
501
|
}
|
|
493
502
|
})(), Global = nativeGlobal;
|
|
494
|
-
function definePropertyGlobalVal(
|
|
495
|
-
Object.defineProperty(
|
|
496
|
-
value:
|
|
503
|
+
function definePropertyGlobalVal(r, t, o) {
|
|
504
|
+
Object.defineProperty(r, t, {
|
|
505
|
+
value: o,
|
|
497
506
|
configurable: !1,
|
|
498
507
|
writable: !0
|
|
499
508
|
});
|
|
500
509
|
}
|
|
501
|
-
function includeOwnProperty(
|
|
502
|
-
return Object.hasOwnProperty.call(
|
|
510
|
+
function includeOwnProperty(r, t) {
|
|
511
|
+
return Object.hasOwnProperty.call(r, t);
|
|
503
512
|
}
|
|
504
513
|
includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
|
|
505
514
|
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
506
|
-
function setGlobalDefaultVal(
|
|
507
|
-
var t,
|
|
508
|
-
includeOwnProperty(
|
|
515
|
+
function setGlobalDefaultVal(r) {
|
|
516
|
+
var t, o, n, s, i, c;
|
|
517
|
+
includeOwnProperty(r, "__VMOK__") && !includeOwnProperty(r, "__FEDERATION__") && definePropertyGlobalVal(r, "__FEDERATION__", r.__VMOK__), includeOwnProperty(r, "__FEDERATION__") || (definePropertyGlobalVal(r, "__FEDERATION__", {
|
|
509
518
|
__GLOBAL_PLUGIN__: [],
|
|
510
519
|
__INSTANCES__: [],
|
|
511
520
|
moduleInfo: {},
|
|
512
521
|
__SHARE__: {},
|
|
513
522
|
__MANIFEST_LOADING__: {},
|
|
514
523
|
__PRELOADED_MAP__: /* @__PURE__ */ new Map()
|
|
515
|
-
}), definePropertyGlobalVal(
|
|
516
|
-
var i;
|
|
517
|
-
(i = (t = o.__FEDERATION__).__GLOBAL_PLUGIN__) != null || (t.__GLOBAL_PLUGIN__ = []);
|
|
518
|
-
var c;
|
|
519
|
-
(c = (n = o.__FEDERATION__).__INSTANCES__) != null || (n.__INSTANCES__ = []);
|
|
520
|
-
var u;
|
|
521
|
-
(u = (r = o.__FEDERATION__).moduleInfo) != null || (r.moduleInfo = {});
|
|
522
|
-
var d;
|
|
523
|
-
(d = (s = o.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
524
|
-
var p;
|
|
525
|
-
(p = (a = o.__FEDERATION__).__MANIFEST_LOADING__) != null || (a.__MANIFEST_LOADING__ = {});
|
|
526
|
-
var m;
|
|
527
|
-
(m = (l = o.__FEDERATION__).__PRELOADED_MAP__) != null || (l.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
524
|
+
}), definePropertyGlobalVal(r, "__VMOK__", r.__FEDERATION__)), (t = r.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (o = r.__FEDERATION__).__INSTANCES__ ?? (o.__INSTANCES__ = []), (n = r.__FEDERATION__).moduleInfo ?? (n.moduleInfo = {}), (s = r.__FEDERATION__).__SHARE__ ?? (s.__SHARE__ = {}), (i = r.__FEDERATION__).__MANIFEST_LOADING__ ?? (i.__MANIFEST_LOADING__ = {}), (c = r.__FEDERATION__).__PRELOADED_MAP__ ?? (c.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
528
525
|
}
|
|
529
526
|
setGlobalDefaultVal(CurrentGlobal);
|
|
530
527
|
setGlobalDefaultVal(nativeGlobal);
|
|
531
|
-
function setGlobalFederationConstructor(
|
|
532
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ =
|
|
528
|
+
function setGlobalFederationConstructor(r, t = isDebugMode()) {
|
|
529
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-perf-devtools-20260106124142");
|
|
533
530
|
}
|
|
534
|
-
function getInfoWithoutType(
|
|
531
|
+
function getInfoWithoutType(r, t) {
|
|
535
532
|
if (typeof t == "string") {
|
|
536
|
-
if (
|
|
533
|
+
if (r[t])
|
|
537
534
|
return {
|
|
538
|
-
value:
|
|
535
|
+
value: r[t],
|
|
539
536
|
key: t
|
|
540
537
|
};
|
|
541
538
|
{
|
|
542
|
-
const
|
|
543
|
-
for (const s of
|
|
544
|
-
const [
|
|
545
|
-
if (
|
|
539
|
+
const n = Object.keys(r);
|
|
540
|
+
for (const s of n) {
|
|
541
|
+
const [i, c] = s.split(":"), a = `${i}:${t}`, l = r[a];
|
|
542
|
+
if (l)
|
|
546
543
|
return {
|
|
547
|
-
value:
|
|
548
|
-
key:
|
|
544
|
+
value: l,
|
|
545
|
+
key: a
|
|
549
546
|
};
|
|
550
547
|
}
|
|
551
548
|
return {
|
|
@@ -556,121 +553,122 @@ function getInfoWithoutType(o, t) {
|
|
|
556
553
|
} else
|
|
557
554
|
throw new Error("key must be string");
|
|
558
555
|
}
|
|
559
|
-
const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (
|
|
560
|
-
const
|
|
561
|
-
if (
|
|
562
|
-
return
|
|
563
|
-
if ("version" in
|
|
564
|
-
const { version: s } =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
556
|
+
const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (r, t) => {
|
|
557
|
+
const o = getFMId(r), n = getInfoWithoutType(t, o).value;
|
|
558
|
+
if (n && !n.version && "version" in r && r.version && (n.version = r.version), n)
|
|
559
|
+
return n;
|
|
560
|
+
if ("version" in r && r.version) {
|
|
561
|
+
const { version: s, ...i } = r, c = getFMId(i), a = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, c).value;
|
|
562
|
+
if ((a == null ? void 0 : a.version) === s)
|
|
563
|
+
return a;
|
|
564
|
+
}
|
|
565
|
+
}, getGlobalSnapshotInfoByModuleInfo = (r) => getTargetSnapshotInfoByModuleInfo(r, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (r, t) => {
|
|
566
|
+
const o = getFMId(r);
|
|
567
|
+
return nativeGlobal.__FEDERATION__.moduleInfo[o] = t, nativeGlobal.__FEDERATION__.moduleInfo;
|
|
568
|
+
}, addGlobalSnapshot = (r) => (nativeGlobal.__FEDERATION__.moduleInfo = {
|
|
569
|
+
...nativeGlobal.__FEDERATION__.moduleInfo,
|
|
570
|
+
...r
|
|
571
|
+
}, () => {
|
|
572
|
+
const t = Object.keys(r);
|
|
573
|
+
for (const o of t)
|
|
574
|
+
delete nativeGlobal.__FEDERATION__.moduleInfo[o];
|
|
575
|
+
}), getRemoteEntryExports = (r, t) => {
|
|
576
|
+
const o = t || `__FEDERATION_${r}:custom__`, n = CurrentGlobal[o];
|
|
579
577
|
return {
|
|
580
|
-
remoteEntryKey:
|
|
581
|
-
entryExports:
|
|
578
|
+
remoteEntryKey: o,
|
|
579
|
+
entryExports: n
|
|
582
580
|
};
|
|
583
|
-
}, getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__, getPreloaded = (
|
|
584
|
-
function parseRegex(
|
|
585
|
-
return new RegExp(
|
|
581
|
+
}, getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__, getPreloaded = (r) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(r), setPreloaded = (r) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(r, !0), DEFAULT_SCOPE = "default", DEFAULT_REMOTE_TYPE = "global", buildIdentifier = "[0-9A-Za-z-]+", build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`, numericIdentifier = "0|[1-9]\\d*", numericIdentifierLoose = "[0-9]+", nonNumericIdentifier = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", preReleaseIdentifierLoose = `(?:${numericIdentifierLoose}|${nonNumericIdentifier})`, preReleaseLoose = `(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`, preReleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`, preRelease = `(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`, xRangeIdentifier = `${numericIdentifier}|x|X|\\*`, xRangePlain = `[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`, hyphenRange = `^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`, mainVersionLoose = `(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`, loosePlain = `[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`, gtlt = "((?:<|>)?=?)", comparatorTrim = `(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`, loneTilde = "(?:~>?)", tildeTrim = `(\\s*)${loneTilde}\\s+`, loneCaret = "(?:\\^)", caretTrim = `(\\s*)${loneCaret}\\s+`, star = "(<|>)?=?\\s*\\*", caret = `^${loneCaret}${xRangePlain}$`, mainVersion = `(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`, fullPlain = `v?${mainVersion}${preRelease}?${build}?`, tilde = `^${loneTilde}${xRangePlain}$`, xRange = `^${gtlt}\\s*${xRangePlain}$`, comparator = `^${gtlt}\\s*(${fullPlain})$|^$`, gte0 = "^\\s*>=\\s*0.0.0\\s*$";
|
|
582
|
+
function parseRegex(r) {
|
|
583
|
+
return new RegExp(r);
|
|
586
584
|
}
|
|
587
|
-
function isXVersion(
|
|
588
|
-
return !
|
|
585
|
+
function isXVersion(r) {
|
|
586
|
+
return !r || r.toLowerCase() === "x" || r === "*";
|
|
589
587
|
}
|
|
590
|
-
function pipe(...
|
|
591
|
-
return (t) =>
|
|
588
|
+
function pipe(...r) {
|
|
589
|
+
return (t) => r.reduce((o, n) => n(o), t);
|
|
592
590
|
}
|
|
593
|
-
function extractComparator(
|
|
594
|
-
return
|
|
591
|
+
function extractComparator(r) {
|
|
592
|
+
return r.match(parseRegex(comparator));
|
|
595
593
|
}
|
|
596
|
-
function combineVersion(
|
|
597
|
-
const s = `${
|
|
598
|
-
return
|
|
594
|
+
function combineVersion(r, t, o, n) {
|
|
595
|
+
const s = `${r}.${t}.${o}`;
|
|
596
|
+
return n ? `${s}-${n}` : s;
|
|
599
597
|
}
|
|
600
|
-
function parseHyphen(
|
|
601
|
-
return
|
|
598
|
+
function parseHyphen(r) {
|
|
599
|
+
return r.replace(parseRegex(hyphenRange), (t, o, n, s, i, c, a, l, u, d, y, p) => (isXVersion(n) ? o = "" : isXVersion(s) ? o = `>=${n}.0.0` : isXVersion(i) ? o = `>=${n}.${s}.0` : o = `>=${o}`, isXVersion(u) ? l = "" : isXVersion(d) ? l = `<${Number(u) + 1}.0.0-0` : isXVersion(y) ? l = `<${u}.${Number(d) + 1}.0-0` : p ? l = `<=${u}.${d}.${y}-${p}` : l = `<=${l}`, `${o} ${l}`.trim()));
|
|
602
600
|
}
|
|
603
|
-
function parseComparatorTrim(
|
|
604
|
-
return
|
|
601
|
+
function parseComparatorTrim(r) {
|
|
602
|
+
return r.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
605
603
|
}
|
|
606
|
-
function parseTildeTrim(
|
|
607
|
-
return
|
|
604
|
+
function parseTildeTrim(r) {
|
|
605
|
+
return r.replace(parseRegex(tildeTrim), "$1~");
|
|
608
606
|
}
|
|
609
|
-
function parseCaretTrim(
|
|
610
|
-
return
|
|
607
|
+
function parseCaretTrim(r) {
|
|
608
|
+
return r.replace(parseRegex(caretTrim), "$1^");
|
|
611
609
|
}
|
|
612
|
-
function parseCarets(
|
|
613
|
-
return
|
|
610
|
+
function parseCarets(r) {
|
|
611
|
+
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (o, n, s, i, c) => isXVersion(n) ? "" : isXVersion(s) ? `>=${n}.0.0 <${Number(n) + 1}.0.0-0` : isXVersion(i) ? n === "0" ? `>=${n}.${s}.0 <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.0 <${Number(n) + 1}.0.0-0` : c ? n === "0" ? s === "0" ? `>=${n}.${s}.${i}-${c} <${n}.${s}.${Number(i) + 1}-0` : `>=${n}.${s}.${i}-${c} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${i}-${c} <${Number(n) + 1}.0.0-0` : n === "0" ? s === "0" ? `>=${n}.${s}.${i} <${n}.${s}.${Number(i) + 1}-0` : `>=${n}.${s}.${i} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${i} <${Number(n) + 1}.0.0-0`)).join(" ");
|
|
614
612
|
}
|
|
615
|
-
function parseTildes(
|
|
616
|
-
return
|
|
613
|
+
function parseTildes(r) {
|
|
614
|
+
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (o, n, s, i, c) => isXVersion(n) ? "" : isXVersion(s) ? `>=${n}.0.0 <${Number(n) + 1}.0.0-0` : isXVersion(i) ? `>=${n}.${s}.0 <${n}.${Number(s) + 1}.0-0` : c ? `>=${n}.${s}.${i}-${c} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${i} <${n}.${Number(s) + 1}.0-0`)).join(" ");
|
|
617
615
|
}
|
|
618
|
-
function parseXRanges(
|
|
619
|
-
return
|
|
620
|
-
const
|
|
621
|
-
return
|
|
616
|
+
function parseXRanges(r) {
|
|
617
|
+
return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (o, n, s, i, c, a) => {
|
|
618
|
+
const l = isXVersion(s), u = l || isXVersion(i), d = u || isXVersion(c);
|
|
619
|
+
return n === "=" && d && (n = ""), a = "", l ? n === ">" || n === "<" ? "<0.0.0-0" : "*" : n && d ? (u && (i = 0), c = 0, n === ">" ? (n = ">=", u ? (s = Number(s) + 1, i = 0, c = 0) : (i = Number(i) + 1, c = 0)) : n === "<=" && (n = "<", u ? s = Number(s) + 1 : i = Number(i) + 1), n === "<" && (a = "-0"), `${n + s}.${i}.${c}${a}`) : u ? `>=${s}.0.0${a} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${i}.0${a} <${s}.${Number(i) + 1}.0-0` : o;
|
|
622
620
|
})).join(" ");
|
|
623
621
|
}
|
|
624
|
-
function parseStar(
|
|
625
|
-
return
|
|
622
|
+
function parseStar(r) {
|
|
623
|
+
return r.trim().replace(parseRegex(star), "");
|
|
626
624
|
}
|
|
627
|
-
function parseGTE0(
|
|
628
|
-
return
|
|
625
|
+
function parseGTE0(r) {
|
|
626
|
+
return r.trim().replace(parseRegex(gte0), "");
|
|
629
627
|
}
|
|
630
|
-
function compareAtom(
|
|
631
|
-
return
|
|
628
|
+
function compareAtom(r, t) {
|
|
629
|
+
return r = Number(r) || r, t = Number(t) || t, r > t ? 1 : r === t ? 0 : -1;
|
|
632
630
|
}
|
|
633
|
-
function comparePreRelease(
|
|
634
|
-
const { preRelease:
|
|
635
|
-
if (
|
|
631
|
+
function comparePreRelease(r, t) {
|
|
632
|
+
const { preRelease: o } = r, { preRelease: n } = t;
|
|
633
|
+
if (o === void 0 && n)
|
|
636
634
|
return 1;
|
|
637
|
-
if (
|
|
635
|
+
if (o && n === void 0)
|
|
638
636
|
return -1;
|
|
639
|
-
if (
|
|
637
|
+
if (o === void 0 && n === void 0)
|
|
640
638
|
return 0;
|
|
641
|
-
for (let s = 0,
|
|
642
|
-
const
|
|
643
|
-
if (
|
|
644
|
-
return
|
|
639
|
+
for (let s = 0, i = o.length; s <= i; s++) {
|
|
640
|
+
const c = o[s], a = n[s];
|
|
641
|
+
if (c !== a)
|
|
642
|
+
return c === void 0 && a === void 0 ? 0 : c ? a ? compareAtom(c, a) : -1 : 1;
|
|
645
643
|
}
|
|
646
644
|
return 0;
|
|
647
645
|
}
|
|
648
|
-
function compareVersion(
|
|
649
|
-
return compareAtom(
|
|
646
|
+
function compareVersion(r, t) {
|
|
647
|
+
return compareAtom(r.major, t.major) || compareAtom(r.minor, t.minor) || compareAtom(r.patch, t.patch) || comparePreRelease(r, t);
|
|
650
648
|
}
|
|
651
|
-
function eq(
|
|
652
|
-
return
|
|
649
|
+
function eq(r, t) {
|
|
650
|
+
return r.version === t.version;
|
|
653
651
|
}
|
|
654
|
-
function compare(
|
|
655
|
-
switch (
|
|
652
|
+
function compare(r, t) {
|
|
653
|
+
switch (r.operator) {
|
|
656
654
|
case "":
|
|
657
655
|
case "=":
|
|
658
|
-
return eq(
|
|
656
|
+
return eq(r, t);
|
|
659
657
|
case ">":
|
|
660
|
-
return compareVersion(
|
|
658
|
+
return compareVersion(r, t) < 0;
|
|
661
659
|
case ">=":
|
|
662
|
-
return eq(
|
|
660
|
+
return eq(r, t) || compareVersion(r, t) < 0;
|
|
663
661
|
case "<":
|
|
664
|
-
return compareVersion(
|
|
662
|
+
return compareVersion(r, t) > 0;
|
|
665
663
|
case "<=":
|
|
666
|
-
return eq(
|
|
664
|
+
return eq(r, t) || compareVersion(r, t) > 0;
|
|
667
665
|
case void 0:
|
|
668
666
|
return !0;
|
|
669
667
|
default:
|
|
670
668
|
return !1;
|
|
671
669
|
}
|
|
672
670
|
}
|
|
673
|
-
function parseComparatorString(
|
|
671
|
+
function parseComparatorString(r) {
|
|
674
672
|
return pipe(
|
|
675
673
|
// handle caret
|
|
676
674
|
// ^ --> * (any, kinda silly)
|
|
@@ -690,9 +688,9 @@ function parseComparatorString(o) {
|
|
|
690
688
|
parseTildes,
|
|
691
689
|
parseXRanges,
|
|
692
690
|
parseStar
|
|
693
|
-
)(
|
|
691
|
+
)(r);
|
|
694
692
|
}
|
|
695
|
-
function parseRange(
|
|
693
|
+
function parseRange(r) {
|
|
696
694
|
return pipe(
|
|
697
695
|
// handle hyphenRange
|
|
698
696
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
@@ -706,244 +704,240 @@ function parseRange(o) {
|
|
|
706
704
|
// handle trim caret
|
|
707
705
|
// `^ 1.2.3` => `^1.2.3`
|
|
708
706
|
parseCaretTrim
|
|
709
|
-
)(
|
|
707
|
+
)(r.trim()).split(/\s+/).join(" ");
|
|
710
708
|
}
|
|
711
|
-
function satisfy(
|
|
712
|
-
if (!
|
|
709
|
+
function satisfy(r, t) {
|
|
710
|
+
if (!r)
|
|
713
711
|
return !1;
|
|
714
|
-
const
|
|
715
|
-
if (!
|
|
712
|
+
const o = extractComparator(r);
|
|
713
|
+
if (!o)
|
|
716
714
|
return !1;
|
|
717
|
-
const [,
|
|
718
|
-
operator:
|
|
719
|
-
version: combineVersion(s,
|
|
715
|
+
const [, n, , s, i, c, a] = o, l = {
|
|
716
|
+
operator: n,
|
|
717
|
+
version: combineVersion(s, i, c, a),
|
|
718
|
+
// exclude build atom
|
|
720
719
|
major: s,
|
|
721
|
-
minor:
|
|
722
|
-
patch:
|
|
723
|
-
preRelease:
|
|
720
|
+
minor: i,
|
|
721
|
+
patch: c,
|
|
722
|
+
preRelease: a == null ? void 0 : a.split(".")
|
|
724
723
|
}, u = t.split("||");
|
|
725
724
|
for (const d of u) {
|
|
726
|
-
const
|
|
727
|
-
if (!
|
|
725
|
+
const y = d.trim();
|
|
726
|
+
if (!y || y === "*" || y === "x")
|
|
728
727
|
return !0;
|
|
729
728
|
try {
|
|
730
|
-
const
|
|
731
|
-
if (!
|
|
729
|
+
const p = parseRange(y);
|
|
730
|
+
if (!p.trim())
|
|
732
731
|
return !0;
|
|
733
|
-
const
|
|
734
|
-
if (!
|
|
732
|
+
const m = p.split(" ").map((E) => parseComparatorString(E)).join(" ");
|
|
733
|
+
if (!m.trim())
|
|
735
734
|
return !0;
|
|
736
|
-
const
|
|
737
|
-
if (
|
|
735
|
+
const g = m.split(/\s+/).map((E) => parseGTE0(E)).filter(Boolean);
|
|
736
|
+
if (g.length === 0)
|
|
738
737
|
continue;
|
|
739
|
-
let
|
|
740
|
-
for (const
|
|
741
|
-
const b = extractComparator(
|
|
738
|
+
let _ = !0;
|
|
739
|
+
for (const E of g) {
|
|
740
|
+
const b = extractComparator(E);
|
|
742
741
|
if (!b) {
|
|
743
|
-
|
|
742
|
+
_ = !1;
|
|
744
743
|
break;
|
|
745
744
|
}
|
|
746
|
-
const [,
|
|
747
|
-
operator:
|
|
748
|
-
version: combineVersion(I,
|
|
745
|
+
const [, S, , I, A, R, T] = b, w = {
|
|
746
|
+
operator: S,
|
|
747
|
+
version: combineVersion(I, A, R, T),
|
|
749
748
|
major: I,
|
|
750
|
-
minor:
|
|
749
|
+
minor: A,
|
|
751
750
|
patch: R,
|
|
752
|
-
preRelease:
|
|
751
|
+
preRelease: T == null ? void 0 : T.split(".")
|
|
753
752
|
};
|
|
754
|
-
if (!compare(
|
|
755
|
-
|
|
753
|
+
if (!compare(w, l)) {
|
|
754
|
+
_ = !1;
|
|
756
755
|
break;
|
|
757
756
|
}
|
|
758
757
|
}
|
|
759
|
-
if (
|
|
758
|
+
if (_)
|
|
760
759
|
return !0;
|
|
761
|
-
} catch (
|
|
762
|
-
console.error(`[semver] Error processing range part "${
|
|
760
|
+
} catch (p) {
|
|
761
|
+
console.error(`[semver] Error processing range part "${y}":`, p);
|
|
763
762
|
continue;
|
|
764
763
|
}
|
|
765
764
|
}
|
|
766
765
|
return !1;
|
|
767
766
|
}
|
|
768
|
-
function formatShare(
|
|
767
|
+
function formatShare(r, t, o, n) {
|
|
769
768
|
let s;
|
|
770
|
-
"get" in
|
|
771
|
-
throw new Error(`Can not get shared '${
|
|
772
|
-
})
|
|
773
|
-
var a, l, i;
|
|
774
|
-
return _extends$1({
|
|
769
|
+
return "get" in r ? s = r.get : "lib" in r ? s = () => Promise.resolve(r.lib) : s = () => Promise.resolve(() => {
|
|
770
|
+
throw new Error(`Can not get shared '${o}'!`);
|
|
771
|
+
}), {
|
|
775
772
|
deps: [],
|
|
776
773
|
useIn: [],
|
|
777
774
|
from: t,
|
|
778
|
-
loading: null
|
|
779
|
-
|
|
780
|
-
shareConfig:
|
|
781
|
-
requiredVersion: `^${
|
|
775
|
+
loading: null,
|
|
776
|
+
...r,
|
|
777
|
+
shareConfig: {
|
|
778
|
+
requiredVersion: `^${r.version}`,
|
|
782
779
|
singleton: !1,
|
|
783
780
|
eager: !1,
|
|
784
|
-
strictVersion: !1
|
|
785
|
-
|
|
781
|
+
strictVersion: !1,
|
|
782
|
+
...r.shareConfig
|
|
783
|
+
},
|
|
786
784
|
get: s,
|
|
787
|
-
loaded:
|
|
788
|
-
version:
|
|
789
|
-
scope: Array.isArray(
|
|
790
|
-
|
|
791
|
-
],
|
|
792
|
-
strategy: ((i = o.strategy) != null ? i : r) || "version-first"
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
function formatShareConfigs(o, t) {
|
|
796
|
-
const n = t.shared || {}, r = t.name, s = Object.keys(n).reduce((l, i) => {
|
|
797
|
-
const c = arrayOptions(n[i]);
|
|
798
|
-
return l[i] = l[i] || [], c.forEach((u) => {
|
|
799
|
-
l[i].push(formatShare(u, r, i, t.shareStrategy));
|
|
800
|
-
}), l;
|
|
801
|
-
}, {}), a = _extends$1({}, o.shared);
|
|
802
|
-
return Object.keys(s).forEach((l) => {
|
|
803
|
-
a[l] ? s[l].forEach((i) => {
|
|
804
|
-
a[l].find((u) => u.version === i.version) || a[l].push(i);
|
|
805
|
-
}) : a[l] = s[l];
|
|
806
|
-
}), {
|
|
807
|
-
shared: a,
|
|
808
|
-
shareInfos: s
|
|
785
|
+
loaded: r != null && r.loaded || "lib" in r ? !0 : void 0,
|
|
786
|
+
version: r.version ?? "0",
|
|
787
|
+
scope: Array.isArray(r.scope) ? r.scope : [r.scope ?? "default"],
|
|
788
|
+
strategy: (r.strategy ?? n) || "version-first"
|
|
809
789
|
};
|
|
810
790
|
}
|
|
811
|
-
function
|
|
812
|
-
const n = (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
791
|
+
function formatShareConfigs(r, t) {
|
|
792
|
+
const o = t.shared || {}, n = t.name, s = Object.keys(o).reduce((c, a) => {
|
|
793
|
+
const l = arrayOptions(o[a]);
|
|
794
|
+
return c[a] = c[a] || [], l.forEach((u) => {
|
|
795
|
+
c[a].push(formatShare(u, n, a, t.shareStrategy));
|
|
796
|
+
}), c;
|
|
797
|
+
}, {}), i = {
|
|
798
|
+
...r.shared
|
|
799
|
+
};
|
|
800
|
+
return Object.keys(s).forEach((c) => {
|
|
801
|
+
i[c] ? s[c].forEach((a) => {
|
|
802
|
+
i[c].find((u) => u.version === a.version) || i[c].push(a);
|
|
803
|
+
}) : i[c] = s[c];
|
|
804
|
+
}), { shared: i, shareInfos: s };
|
|
805
|
+
}
|
|
806
|
+
function versionLt(r, t) {
|
|
807
|
+
const o = (n) => {
|
|
808
|
+
if (!Number.isNaN(Number(n))) {
|
|
809
|
+
const i = n.split(".");
|
|
810
|
+
let c = n;
|
|
811
|
+
for (let a = 0; a < 3 - i.length; a++)
|
|
812
|
+
c += ".0";
|
|
813
|
+
return c;
|
|
819
814
|
}
|
|
820
|
-
return
|
|
815
|
+
return n;
|
|
821
816
|
};
|
|
822
|
-
return !!satisfy(
|
|
817
|
+
return !!satisfy(o(r), `<=${o(t)}`);
|
|
823
818
|
}
|
|
824
|
-
const findVersion = (
|
|
825
|
-
const
|
|
826
|
-
return versionLt(
|
|
819
|
+
const findVersion = (r, t) => {
|
|
820
|
+
const o = t || function(n, s) {
|
|
821
|
+
return versionLt(n, s);
|
|
827
822
|
};
|
|
828
|
-
return Object.keys(
|
|
829
|
-
}, isLoaded = (
|
|
830
|
-
function findSingletonVersionOrderByVersion(
|
|
831
|
-
const
|
|
832
|
-
return !isLoaded(
|
|
823
|
+
return Object.keys(r).reduce((n, s) => !n || o(n, s) || n === "0" ? s : n, 0);
|
|
824
|
+
}, isLoaded = (r) => !!r.loaded || typeof r.lib == "function", isLoading = (r) => !!r.loading;
|
|
825
|
+
function findSingletonVersionOrderByVersion(r, t, o) {
|
|
826
|
+
const n = r[t][o], s = function(i, c) {
|
|
827
|
+
return !isLoaded(n[i]) && versionLt(i, c);
|
|
833
828
|
};
|
|
834
|
-
return findVersion(
|
|
829
|
+
return findVersion(r[t][o], s);
|
|
835
830
|
}
|
|
836
|
-
function findSingletonVersionOrderByLoaded(
|
|
837
|
-
const
|
|
838
|
-
const
|
|
839
|
-
return
|
|
831
|
+
function findSingletonVersionOrderByLoaded(r, t, o) {
|
|
832
|
+
const n = r[t][o], s = function(i, c) {
|
|
833
|
+
const a = (l) => isLoaded(l) || isLoading(l);
|
|
834
|
+
return a(n[c]) ? a(n[i]) ? !!versionLt(i, c) : !0 : a(n[i]) ? !1 : versionLt(i, c);
|
|
840
835
|
};
|
|
841
|
-
return findVersion(
|
|
836
|
+
return findVersion(r[t][o], s);
|
|
842
837
|
}
|
|
843
|
-
function getFindShareFunction(
|
|
844
|
-
return
|
|
838
|
+
function getFindShareFunction(r) {
|
|
839
|
+
return r === "loaded-first" ? findSingletonVersionOrderByLoaded : findSingletonVersionOrderByVersion;
|
|
845
840
|
}
|
|
846
|
-
function getRegisteredShare(
|
|
847
|
-
if (!
|
|
841
|
+
function getRegisteredShare(r, t, o, n) {
|
|
842
|
+
if (!r)
|
|
848
843
|
return;
|
|
849
|
-
const { shareConfig: s, scope:
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if (s && o[c] && o[c][t]) {
|
|
854
|
-
const { requiredVersion: u } = s, p = getFindShareFunction(l)(o, c, t), m = () => {
|
|
844
|
+
const { shareConfig: s, scope: i = DEFAULT_SCOPE, strategy: c } = o, a = Array.isArray(i) ? i : [i];
|
|
845
|
+
for (const l of a)
|
|
846
|
+
if (s && r[l] && r[l][t]) {
|
|
847
|
+
const { requiredVersion: u } = s, y = getFindShareFunction(c)(r, l, t), p = () => {
|
|
855
848
|
if (s.singleton) {
|
|
856
|
-
if (typeof u == "string" && !satisfy(
|
|
857
|
-
const
|
|
858
|
-
s.strictVersion ? error(
|
|
849
|
+
if (typeof u == "string" && !satisfy(y, u)) {
|
|
850
|
+
const _ = `Version ${y} from ${y && r[l][t][y].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
|
|
851
|
+
s.strictVersion ? error(_) : warn(_);
|
|
859
852
|
}
|
|
860
|
-
return
|
|
853
|
+
return r[l][t][y];
|
|
861
854
|
} else {
|
|
862
|
-
if (u === !1 || u === "*" || satisfy(
|
|
863
|
-
return
|
|
864
|
-
for (const [
|
|
865
|
-
if (satisfy(
|
|
866
|
-
return
|
|
855
|
+
if (u === !1 || u === "*" || satisfy(y, u))
|
|
856
|
+
return r[l][t][y];
|
|
857
|
+
for (const [_, E] of Object.entries(r[l][t]))
|
|
858
|
+
if (satisfy(_, u))
|
|
859
|
+
return E;
|
|
867
860
|
}
|
|
868
|
-
},
|
|
869
|
-
shareScopeMap:
|
|
870
|
-
scope:
|
|
861
|
+
}, m = {
|
|
862
|
+
shareScopeMap: r,
|
|
863
|
+
scope: l,
|
|
871
864
|
pkgName: t,
|
|
872
|
-
version:
|
|
865
|
+
version: y,
|
|
873
866
|
GlobalFederation: Global.__FEDERATION__,
|
|
874
|
-
resolver:
|
|
867
|
+
resolver: p
|
|
875
868
|
};
|
|
876
|
-
return (
|
|
869
|
+
return (n.emit(m) || m).resolver();
|
|
877
870
|
}
|
|
878
871
|
}
|
|
879
872
|
function getGlobalShareScope() {
|
|
880
873
|
return Global.__FEDERATION__.__SHARE__;
|
|
881
874
|
}
|
|
882
|
-
function getTargetSharedOptions(
|
|
883
|
-
const { pkgName: t, extraOptions:
|
|
884
|
-
if (!
|
|
875
|
+
function getTargetSharedOptions(r) {
|
|
876
|
+
const { pkgName: t, extraOptions: o, shareInfos: n } = r, s = (c) => {
|
|
877
|
+
if (!c)
|
|
885
878
|
return;
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
879
|
+
const a = {};
|
|
880
|
+
c.forEach((d) => {
|
|
881
|
+
a[d.version] = d;
|
|
889
882
|
});
|
|
890
|
-
const
|
|
891
|
-
return !isLoaded(
|
|
883
|
+
const u = findVersion(a, function(d, y) {
|
|
884
|
+
return !isLoaded(a[d]) && versionLt(d, y);
|
|
892
885
|
});
|
|
893
|
-
return
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
const l = (a = n == null ? void 0 : n.resolver) != null ? a : s;
|
|
897
|
-
return Object.assign({}, l(r[t]), n == null ? void 0 : n.customShareInfo);
|
|
886
|
+
return a[u];
|
|
887
|
+
}, i = (o == null ? void 0 : o.resolver) ?? s;
|
|
888
|
+
return Object.assign({}, i(n[t]), o == null ? void 0 : o.customShareInfo);
|
|
898
889
|
}
|
|
899
890
|
function getBuilderId() {
|
|
900
|
-
return typeof FEDERATION_BUILD_IDENTIFIER < "u" ?
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
891
|
+
return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? (
|
|
892
|
+
//@ts-ignore
|
|
893
|
+
FEDERATION_BUILD_IDENTIFIER
|
|
894
|
+
) : "";
|
|
895
|
+
}
|
|
896
|
+
function matchRemoteWithNameAndExpose(r, t) {
|
|
897
|
+
for (const o of r) {
|
|
898
|
+
const n = t.startsWith(o.name);
|
|
899
|
+
let s = t.replace(o.name, "");
|
|
900
|
+
if (n) {
|
|
907
901
|
if (s.startsWith("/")) {
|
|
908
|
-
const
|
|
902
|
+
const a = o.name;
|
|
909
903
|
return s = `.${s}`, {
|
|
910
|
-
pkgNameOrAlias:
|
|
904
|
+
pkgNameOrAlias: a,
|
|
911
905
|
expose: s,
|
|
912
|
-
remote:
|
|
906
|
+
remote: o
|
|
913
907
|
};
|
|
914
908
|
} else if (s === "")
|
|
915
909
|
return {
|
|
916
|
-
pkgNameOrAlias:
|
|
910
|
+
pkgNameOrAlias: o.name,
|
|
917
911
|
expose: ".",
|
|
918
|
-
remote:
|
|
912
|
+
remote: o
|
|
919
913
|
};
|
|
920
914
|
}
|
|
921
|
-
const
|
|
922
|
-
let
|
|
923
|
-
if (
|
|
924
|
-
if (
|
|
925
|
-
const
|
|
926
|
-
return
|
|
927
|
-
pkgNameOrAlias:
|
|
928
|
-
expose:
|
|
929
|
-
remote:
|
|
915
|
+
const i = o.alias && t.startsWith(o.alias);
|
|
916
|
+
let c = o.alias && t.replace(o.alias, "");
|
|
917
|
+
if (o.alias && i) {
|
|
918
|
+
if (c && c.startsWith("/")) {
|
|
919
|
+
const a = o.alias;
|
|
920
|
+
return c = `.${c}`, {
|
|
921
|
+
pkgNameOrAlias: a,
|
|
922
|
+
expose: c,
|
|
923
|
+
remote: o
|
|
930
924
|
};
|
|
931
|
-
} else if (
|
|
925
|
+
} else if (c === "")
|
|
932
926
|
return {
|
|
933
|
-
pkgNameOrAlias:
|
|
927
|
+
pkgNameOrAlias: o.alias,
|
|
934
928
|
expose: ".",
|
|
935
|
-
remote:
|
|
929
|
+
remote: o
|
|
936
930
|
};
|
|
937
931
|
}
|
|
938
932
|
}
|
|
939
933
|
}
|
|
940
|
-
function matchRemote(
|
|
941
|
-
for (const
|
|
942
|
-
if (t ===
|
|
943
|
-
return
|
|
934
|
+
function matchRemote(r, t) {
|
|
935
|
+
for (const o of r)
|
|
936
|
+
if (t === o.name || o.alias && t === o.alias)
|
|
937
|
+
return o;
|
|
944
938
|
}
|
|
945
|
-
function registerPlugins(
|
|
946
|
-
const
|
|
939
|
+
function registerPlugins(r, t) {
|
|
940
|
+
const o = getGlobalHostPlugins(), n = [
|
|
947
941
|
t.hooks,
|
|
948
942
|
t.remoteHandler.hooks,
|
|
949
943
|
t.sharedHandler.hooks,
|
|
@@ -951,293 +945,271 @@ function registerPlugins(o, t) {
|
|
|
951
945
|
t.loaderHook,
|
|
952
946
|
t.bridgeHook
|
|
953
947
|
];
|
|
954
|
-
return
|
|
955
|
-
|
|
956
|
-
}),
|
|
957
|
-
|
|
958
|
-
|
|
948
|
+
return o.length > 0 && o.forEach((s) => {
|
|
949
|
+
r != null && r.find((i) => i.name !== s.name) && r.push(s);
|
|
950
|
+
}), r && r.length > 0 && r.forEach((s) => {
|
|
951
|
+
n.forEach((i) => {
|
|
952
|
+
i.applyPlugin(s, t);
|
|
959
953
|
});
|
|
960
|
-
}),
|
|
954
|
+
}), r;
|
|
961
955
|
}
|
|
962
956
|
const importCallback = ".then(callbacks[0]).catch(callbacks[1])";
|
|
963
|
-
async function loadEsmEntry({ entry:
|
|
964
|
-
return new Promise((
|
|
957
|
+
async function loadEsmEntry({ entry: r, remoteEntryExports: t }) {
|
|
958
|
+
return new Promise((o, n) => {
|
|
965
959
|
try {
|
|
966
|
-
t ?
|
|
967
|
-
|
|
968
|
-
|
|
960
|
+
t ? o(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${r}")${importCallback}`)([
|
|
961
|
+
o,
|
|
962
|
+
n
|
|
969
963
|
]) : import(
|
|
970
964
|
/* webpackIgnore: true */
|
|
971
965
|
/* @vite-ignore */
|
|
972
|
-
|
|
973
|
-
).then(
|
|
966
|
+
r
|
|
967
|
+
).then(o).catch(n);
|
|
974
968
|
} catch (s) {
|
|
975
|
-
|
|
969
|
+
n(s);
|
|
976
970
|
}
|
|
977
971
|
});
|
|
978
972
|
}
|
|
979
|
-
async function loadSystemJsEntry({ entry:
|
|
980
|
-
return new Promise((
|
|
973
|
+
async function loadSystemJsEntry({ entry: r, remoteEntryExports: t }) {
|
|
974
|
+
return new Promise((o, n) => {
|
|
981
975
|
try {
|
|
982
|
-
t ?
|
|
983
|
-
n,
|
|
984
|
-
r
|
|
985
|
-
]);
|
|
976
|
+
t ? o(t) : typeof __system_context__ > "u" ? System.import(r).then(o).catch(n) : new Function("callbacks", `System.import("${r}")${importCallback}`)([o, n]);
|
|
986
977
|
} catch (s) {
|
|
987
|
-
|
|
978
|
+
n(s);
|
|
988
979
|
}
|
|
989
980
|
});
|
|
990
981
|
}
|
|
991
|
-
function handleRemoteEntryLoaded(
|
|
992
|
-
const { remoteEntryKey:
|
|
982
|
+
function handleRemoteEntryLoaded(r, t, o) {
|
|
983
|
+
const { remoteEntryKey: n, entryExports: s } = getRemoteEntryExports(r, t);
|
|
993
984
|
return assert(s, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
|
|
994
|
-
remoteName:
|
|
995
|
-
remoteEntryUrl:
|
|
996
|
-
remoteEntryKey:
|
|
985
|
+
remoteName: r,
|
|
986
|
+
remoteEntryUrl: o,
|
|
987
|
+
remoteEntryKey: n
|
|
997
988
|
})), s;
|
|
998
989
|
}
|
|
999
|
-
async function loadEntryScript({ name:
|
|
1000
|
-
const { entryExports:
|
|
1001
|
-
if (
|
|
1002
|
-
return
|
|
1003
|
-
const
|
|
1004
|
-
return loadScript(
|
|
990
|
+
async function loadEntryScript({ name: r, globalName: t, entry: o, loaderHook: n, getEntryUrl: s }) {
|
|
991
|
+
const { entryExports: i } = getRemoteEntryExports(r, t);
|
|
992
|
+
if (i)
|
|
993
|
+
return i;
|
|
994
|
+
const c = s ? s(o) : o;
|
|
995
|
+
return loadScript(c, {
|
|
1005
996
|
attrs: {},
|
|
1006
|
-
createScriptHook: (
|
|
1007
|
-
const u =
|
|
1008
|
-
url: i,
|
|
1009
|
-
attrs: c
|
|
1010
|
-
});
|
|
997
|
+
createScriptHook: (a, l) => {
|
|
998
|
+
const u = n.lifecycle.createScript.emit({ url: a, attrs: l });
|
|
1011
999
|
if (u && (u instanceof HTMLScriptElement || "script" in u || "timeout" in u))
|
|
1012
1000
|
return u;
|
|
1013
1001
|
}
|
|
1014
|
-
}).then(() => handleRemoteEntryLoaded(
|
|
1002
|
+
}).then(() => handleRemoteEntryLoaded(r, t, o)).catch((a) => {
|
|
1015
1003
|
throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
|
|
1016
|
-
remoteName:
|
|
1017
|
-
resourceUrl:
|
|
1018
|
-
})),
|
|
1004
|
+
remoteName: r,
|
|
1005
|
+
resourceUrl: o
|
|
1006
|
+
})), a;
|
|
1019
1007
|
});
|
|
1020
1008
|
}
|
|
1021
|
-
async function loadEntryDom({ remoteInfo:
|
|
1022
|
-
const { entry: s, entryGlobalName:
|
|
1023
|
-
switch (
|
|
1009
|
+
async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook: o, getEntryUrl: n }) {
|
|
1010
|
+
const { entry: s, entryGlobalName: i, name: c, type: a } = r;
|
|
1011
|
+
switch (a) {
|
|
1024
1012
|
case "esm":
|
|
1025
1013
|
case "module":
|
|
1026
|
-
return loadEsmEntry({
|
|
1027
|
-
entry: s,
|
|
1028
|
-
remoteEntryExports: t
|
|
1029
|
-
});
|
|
1014
|
+
return loadEsmEntry({ entry: s, remoteEntryExports: t });
|
|
1030
1015
|
case "system":
|
|
1031
|
-
return loadSystemJsEntry({
|
|
1032
|
-
entry: s,
|
|
1033
|
-
remoteEntryExports: t
|
|
1034
|
-
});
|
|
1016
|
+
return loadSystemJsEntry({ entry: s, remoteEntryExports: t });
|
|
1035
1017
|
default:
|
|
1036
1018
|
return loadEntryScript({
|
|
1037
1019
|
entry: s,
|
|
1038
|
-
globalName:
|
|
1039
|
-
name:
|
|
1040
|
-
loaderHook:
|
|
1041
|
-
getEntryUrl:
|
|
1020
|
+
globalName: i,
|
|
1021
|
+
name: c,
|
|
1022
|
+
loaderHook: o,
|
|
1023
|
+
getEntryUrl: n
|
|
1042
1024
|
});
|
|
1043
1025
|
}
|
|
1044
1026
|
}
|
|
1045
|
-
async function loadEntryNode({ remoteInfo:
|
|
1046
|
-
const { entry:
|
|
1047
|
-
return
|
|
1048
|
-
attrs: {
|
|
1049
|
-
name: s,
|
|
1050
|
-
globalName: r,
|
|
1051
|
-
type: a
|
|
1052
|
-
},
|
|
1027
|
+
async function loadEntryNode({ remoteInfo: r, loaderHook: t }) {
|
|
1028
|
+
const { entry: o, entryGlobalName: n, name: s, type: i } = r, { entryExports: c } = getRemoteEntryExports(s, n);
|
|
1029
|
+
return c || loadScriptNode(o, {
|
|
1030
|
+
attrs: { name: s, globalName: n, type: i },
|
|
1053
1031
|
loaderHook: {
|
|
1054
|
-
createScriptHook: (
|
|
1055
|
-
const u = t.lifecycle.createScript.emit({
|
|
1056
|
-
url: i,
|
|
1057
|
-
attrs: c
|
|
1058
|
-
});
|
|
1032
|
+
createScriptHook: (a, l = {}) => {
|
|
1033
|
+
const u = t.lifecycle.createScript.emit({ url: a, attrs: l });
|
|
1059
1034
|
if (u && "url" in u)
|
|
1060
1035
|
return u;
|
|
1061
1036
|
}
|
|
1062
1037
|
}
|
|
1063
|
-
}).then(() => handleRemoteEntryLoaded(s,
|
|
1064
|
-
throw
|
|
1038
|
+
}).then(() => handleRemoteEntryLoaded(s, n, o)).catch((a) => {
|
|
1039
|
+
throw a;
|
|
1065
1040
|
});
|
|
1066
1041
|
}
|
|
1067
|
-
function getRemoteEntryUniqueKey(
|
|
1068
|
-
const { entry: t, name:
|
|
1069
|
-
return composeKeyWithSeparator(
|
|
1070
|
-
}
|
|
1071
|
-
async function getRemoteEntry(
|
|
1072
|
-
const { origin: t, remoteEntryExports:
|
|
1073
|
-
if (
|
|
1074
|
-
return
|
|
1075
|
-
if (!globalLoading[
|
|
1076
|
-
const
|
|
1077
|
-
globalLoading[
|
|
1078
|
-
loaderHook:
|
|
1079
|
-
remoteInfo:
|
|
1080
|
-
remoteEntryExports:
|
|
1042
|
+
function getRemoteEntryUniqueKey(r) {
|
|
1043
|
+
const { entry: t, name: o } = r;
|
|
1044
|
+
return composeKeyWithSeparator(o, t);
|
|
1045
|
+
}
|
|
1046
|
+
async function getRemoteEntry(r) {
|
|
1047
|
+
const { origin: t, remoteEntryExports: o, remoteInfo: n, getEntryUrl: s, _inErrorHandling: i = !1 } = r, c = getRemoteEntryUniqueKey(n);
|
|
1048
|
+
if (o)
|
|
1049
|
+
return o;
|
|
1050
|
+
if (!globalLoading[c]) {
|
|
1051
|
+
const a = t.remoteHandler.hooks.lifecycle.loadEntry, l = t.loaderHook;
|
|
1052
|
+
globalLoading[c] = a.emit({
|
|
1053
|
+
loaderHook: l,
|
|
1054
|
+
remoteInfo: n,
|
|
1055
|
+
remoteEntryExports: o
|
|
1081
1056
|
}).then((u) => u || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
|
|
1082
|
-
remoteInfo:
|
|
1083
|
-
remoteEntryExports:
|
|
1084
|
-
loaderHook:
|
|
1057
|
+
remoteInfo: n,
|
|
1058
|
+
remoteEntryExports: o,
|
|
1059
|
+
loaderHook: l,
|
|
1085
1060
|
getEntryUrl: s
|
|
1086
|
-
}) : loadEntryNode({
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
if (u instanceof Error && u.message.includes(RUNTIME_008) && !a) {
|
|
1092
|
-
const m = (E) => getRemoteEntry(_extends$1({}, E, {
|
|
1093
|
-
_inErrorHandling: !0
|
|
1094
|
-
})), y = await t.loaderHook.lifecycle.loadEntryError.emit({
|
|
1095
|
-
getRemoteEntry: m,
|
|
1061
|
+
}) : loadEntryNode({ remoteInfo: n, loaderHook: l }))).catch(async (u) => {
|
|
1062
|
+
const d = getRemoteEntryUniqueKey(n);
|
|
1063
|
+
if (u instanceof Error && u.message.includes(RUNTIME_008) && !i) {
|
|
1064
|
+
const p = (g) => getRemoteEntry({ ...g, _inErrorHandling: !0 }), m = await t.loaderHook.lifecycle.loadEntryError.emit({
|
|
1065
|
+
getRemoteEntry: p,
|
|
1096
1066
|
origin: t,
|
|
1097
|
-
remoteInfo:
|
|
1098
|
-
remoteEntryExports:
|
|
1067
|
+
remoteInfo: n,
|
|
1068
|
+
remoteEntryExports: o,
|
|
1099
1069
|
globalLoading,
|
|
1100
1070
|
uniqueKey: d
|
|
1101
1071
|
});
|
|
1102
|
-
if (
|
|
1103
|
-
return
|
|
1072
|
+
if (m)
|
|
1073
|
+
return m;
|
|
1104
1074
|
}
|
|
1105
1075
|
throw u;
|
|
1106
1076
|
});
|
|
1107
1077
|
}
|
|
1108
|
-
return globalLoading[
|
|
1078
|
+
return globalLoading[c];
|
|
1109
1079
|
}
|
|
1110
|
-
function getRemoteInfo(
|
|
1111
|
-
return
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1080
|
+
function getRemoteInfo(r) {
|
|
1081
|
+
return {
|
|
1082
|
+
...r,
|
|
1083
|
+
entry: "entry" in r ? r.entry : "",
|
|
1084
|
+
type: r.type || DEFAULT_REMOTE_TYPE,
|
|
1085
|
+
entryGlobalName: r.entryGlobalName || r.name,
|
|
1086
|
+
shareScope: r.shareScope || DEFAULT_SCOPE
|
|
1087
|
+
};
|
|
1117
1088
|
}
|
|
1118
|
-
function defaultPreloadArgs(
|
|
1119
|
-
return
|
|
1089
|
+
function defaultPreloadArgs(r) {
|
|
1090
|
+
return {
|
|
1120
1091
|
resourceCategory: "sync",
|
|
1121
1092
|
share: !0,
|
|
1122
1093
|
depsRemote: !0,
|
|
1123
|
-
prefetchInterface: !1
|
|
1124
|
-
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1094
|
+
prefetchInterface: !1,
|
|
1095
|
+
...r
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
function formatPreloadArgs(r, t) {
|
|
1099
|
+
return t.map((o) => {
|
|
1100
|
+
const n = matchRemote(r, o.nameOrAlias);
|
|
1101
|
+
return assert(n, `Unable to preload ${o.nameOrAlias} as it is not included in ${!n && safeToString({
|
|
1102
|
+
remoteInfo: n,
|
|
1103
|
+
remotes: r
|
|
1132
1104
|
})}`), {
|
|
1133
|
-
remote:
|
|
1134
|
-
preloadConfig: defaultPreloadArgs(
|
|
1105
|
+
remote: n,
|
|
1106
|
+
preloadConfig: defaultPreloadArgs(o)
|
|
1135
1107
|
};
|
|
1136
1108
|
});
|
|
1137
1109
|
}
|
|
1138
|
-
function normalizePreloadExposes(
|
|
1139
|
-
return
|
|
1110
|
+
function normalizePreloadExposes(r) {
|
|
1111
|
+
return r ? r.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
|
|
1140
1112
|
}
|
|
1141
|
-
function preloadAssets(
|
|
1142
|
-
const { cssAssets: s, jsAssetsWithoutEntry:
|
|
1113
|
+
function preloadAssets(r, t, o, n = !0) {
|
|
1114
|
+
const { cssAssets: s, jsAssetsWithoutEntry: i, entryAssets: c } = o;
|
|
1143
1115
|
if (t.options.inBrowser) {
|
|
1144
|
-
if (
|
|
1145
|
-
const { moduleInfo:
|
|
1116
|
+
if (c.forEach((a) => {
|
|
1117
|
+
const { moduleInfo: l } = a, u = t.moduleCache.get(r.name);
|
|
1146
1118
|
getRemoteEntry(u ? {
|
|
1147
1119
|
origin: t,
|
|
1148
|
-
remoteInfo:
|
|
1120
|
+
remoteInfo: l,
|
|
1149
1121
|
remoteEntryExports: u.remoteEntryExports
|
|
1150
1122
|
} : {
|
|
1151
1123
|
origin: t,
|
|
1152
|
-
remoteInfo:
|
|
1124
|
+
remoteInfo: l,
|
|
1153
1125
|
remoteEntryExports: void 0
|
|
1154
1126
|
});
|
|
1155
|
-
}),
|
|
1156
|
-
const
|
|
1127
|
+
}), n) {
|
|
1128
|
+
const a = {
|
|
1157
1129
|
rel: "preload",
|
|
1158
1130
|
as: "style"
|
|
1159
1131
|
};
|
|
1160
|
-
s.forEach((
|
|
1132
|
+
s.forEach((l) => {
|
|
1161
1133
|
const { link: u, needAttach: d } = createLink({
|
|
1162
|
-
url:
|
|
1134
|
+
url: l,
|
|
1163
1135
|
cb: () => {
|
|
1164
1136
|
},
|
|
1165
|
-
attrs:
|
|
1166
|
-
createLinkHook: (
|
|
1167
|
-
const
|
|
1168
|
-
url:
|
|
1169
|
-
attrs:
|
|
1137
|
+
attrs: a,
|
|
1138
|
+
createLinkHook: (y, p) => {
|
|
1139
|
+
const m = t.loaderHook.lifecycle.createLink.emit({
|
|
1140
|
+
url: y,
|
|
1141
|
+
attrs: p
|
|
1170
1142
|
});
|
|
1171
|
-
if (
|
|
1172
|
-
return
|
|
1143
|
+
if (m instanceof HTMLLinkElement)
|
|
1144
|
+
return m;
|
|
1173
1145
|
}
|
|
1174
1146
|
});
|
|
1175
1147
|
d && document.head.appendChild(u);
|
|
1176
1148
|
});
|
|
1177
1149
|
} else {
|
|
1178
|
-
const
|
|
1150
|
+
const a = {
|
|
1179
1151
|
rel: "stylesheet",
|
|
1180
1152
|
type: "text/css"
|
|
1181
1153
|
};
|
|
1182
|
-
s.forEach((
|
|
1154
|
+
s.forEach((l) => {
|
|
1183
1155
|
const { link: u, needAttach: d } = createLink({
|
|
1184
|
-
url:
|
|
1156
|
+
url: l,
|
|
1185
1157
|
cb: () => {
|
|
1186
1158
|
},
|
|
1187
|
-
attrs:
|
|
1188
|
-
createLinkHook: (
|
|
1189
|
-
const
|
|
1190
|
-
url:
|
|
1191
|
-
attrs:
|
|
1159
|
+
attrs: a,
|
|
1160
|
+
createLinkHook: (y, p) => {
|
|
1161
|
+
const m = t.loaderHook.lifecycle.createLink.emit({
|
|
1162
|
+
url: y,
|
|
1163
|
+
attrs: p
|
|
1192
1164
|
});
|
|
1193
|
-
if (
|
|
1194
|
-
return
|
|
1165
|
+
if (m instanceof HTMLLinkElement)
|
|
1166
|
+
return m;
|
|
1195
1167
|
},
|
|
1196
1168
|
needDeleteLink: !1
|
|
1197
1169
|
});
|
|
1198
1170
|
d && document.head.appendChild(u);
|
|
1199
1171
|
});
|
|
1200
1172
|
}
|
|
1201
|
-
if (
|
|
1202
|
-
const
|
|
1173
|
+
if (n) {
|
|
1174
|
+
const a = {
|
|
1203
1175
|
rel: "preload",
|
|
1204
1176
|
as: "script"
|
|
1205
1177
|
};
|
|
1206
|
-
|
|
1178
|
+
i.forEach((l) => {
|
|
1207
1179
|
const { link: u, needAttach: d } = createLink({
|
|
1208
|
-
url:
|
|
1180
|
+
url: l,
|
|
1209
1181
|
cb: () => {
|
|
1210
1182
|
},
|
|
1211
|
-
attrs:
|
|
1212
|
-
createLinkHook: (
|
|
1213
|
-
const
|
|
1214
|
-
url:
|
|
1215
|
-
attrs:
|
|
1183
|
+
attrs: a,
|
|
1184
|
+
createLinkHook: (y, p) => {
|
|
1185
|
+
const m = t.loaderHook.lifecycle.createLink.emit({
|
|
1186
|
+
url: y,
|
|
1187
|
+
attrs: p
|
|
1216
1188
|
});
|
|
1217
|
-
if (
|
|
1218
|
-
return
|
|
1189
|
+
if (m instanceof HTMLLinkElement)
|
|
1190
|
+
return m;
|
|
1219
1191
|
}
|
|
1220
1192
|
});
|
|
1221
1193
|
d && document.head.appendChild(u);
|
|
1222
1194
|
});
|
|
1223
1195
|
} else {
|
|
1224
|
-
const
|
|
1196
|
+
const a = {
|
|
1225
1197
|
fetchpriority: "high",
|
|
1226
|
-
type: (
|
|
1198
|
+
type: (r == null ? void 0 : r.type) === "module" ? "module" : "text/javascript"
|
|
1227
1199
|
};
|
|
1228
|
-
|
|
1200
|
+
i.forEach((l) => {
|
|
1229
1201
|
const { script: u, needAttach: d } = createScript({
|
|
1230
|
-
url:
|
|
1202
|
+
url: l,
|
|
1231
1203
|
cb: () => {
|
|
1232
1204
|
},
|
|
1233
|
-
attrs:
|
|
1234
|
-
createScriptHook: (
|
|
1235
|
-
const
|
|
1236
|
-
url:
|
|
1237
|
-
attrs:
|
|
1205
|
+
attrs: a,
|
|
1206
|
+
createScriptHook: (y, p) => {
|
|
1207
|
+
const m = t.loaderHook.lifecycle.createScript.emit({
|
|
1208
|
+
url: y,
|
|
1209
|
+
attrs: p
|
|
1238
1210
|
});
|
|
1239
|
-
if (
|
|
1240
|
-
return
|
|
1211
|
+
if (m instanceof HTMLScriptElement)
|
|
1212
|
+
return m;
|
|
1241
1213
|
},
|
|
1242
1214
|
needDeleteScript: !0
|
|
1243
1215
|
});
|
|
@@ -1246,102 +1218,107 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1246
1218
|
}
|
|
1247
1219
|
}
|
|
1248
1220
|
}
|
|
1249
|
-
|
|
1221
|
+
class Module {
|
|
1222
|
+
constructor({ remoteInfo: t, host: o }) {
|
|
1223
|
+
this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = o;
|
|
1224
|
+
}
|
|
1250
1225
|
async getEntry() {
|
|
1251
1226
|
if (this.remoteEntryExports)
|
|
1252
1227
|
return this.remoteEntryExports;
|
|
1253
|
-
|
|
1254
|
-
return t = await getRemoteEntry({
|
|
1228
|
+
const t = await getRemoteEntry({
|
|
1255
1229
|
origin: this.host,
|
|
1256
1230
|
remoteInfo: this.remoteInfo,
|
|
1257
1231
|
remoteEntryExports: this.remoteEntryExports
|
|
1258
|
-
})
|
|
1232
|
+
});
|
|
1233
|
+
return assert(t, `remoteEntryExports is undefined
|
|
1259
1234
|
${safeToString(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
|
|
1260
1235
|
}
|
|
1261
1236
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1262
|
-
async
|
|
1263
|
-
const
|
|
1264
|
-
loadFactory: !0
|
|
1265
|
-
}, l = await this.getEntry();
|
|
1237
|
+
async init(t, o) {
|
|
1238
|
+
const n = await this.getEntry();
|
|
1266
1239
|
if (!this.inited) {
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
m.length || m.push("default"), m.forEach((b) => {
|
|
1271
|
-
p[b] || (p[b] = {});
|
|
1240
|
+
const s = this.host.shareScopeMap, i = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
|
|
1241
|
+
i.length || i.push("default"), i.forEach((d) => {
|
|
1242
|
+
s[d] || (s[d] = {});
|
|
1272
1243
|
});
|
|
1273
|
-
const
|
|
1244
|
+
const c = s[i[0]], a = [], l = {
|
|
1274
1245
|
version: this.remoteInfo.version || "",
|
|
1275
|
-
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ?
|
|
1246
|
+
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? i : this.remoteInfo.shareScope || "default"
|
|
1276
1247
|
};
|
|
1277
|
-
Object.defineProperty(
|
|
1278
|
-
value:
|
|
1248
|
+
Object.defineProperty(l, "shareScopeMap", {
|
|
1249
|
+
value: s,
|
|
1279
1250
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1280
1251
|
enumerable: !1
|
|
1281
1252
|
});
|
|
1282
|
-
const
|
|
1283
|
-
shareScope:
|
|
1253
|
+
const u = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1254
|
+
shareScope: c,
|
|
1284
1255
|
// @ts-ignore shareScopeMap will be set by Object.defineProperty
|
|
1285
|
-
remoteEntryInitOptions:
|
|
1286
|
-
initScope:
|
|
1256
|
+
remoteEntryInitOptions: l,
|
|
1257
|
+
initScope: a,
|
|
1287
1258
|
remoteInfo: this.remoteInfo,
|
|
1288
1259
|
origin: this.host
|
|
1289
1260
|
});
|
|
1290
|
-
typeof (
|
|
1261
|
+
typeof (n == null ? void 0 : n.init) > "u" && error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
|
|
1291
1262
|
hostName: this.host.name,
|
|
1292
1263
|
remoteName: this.remoteInfo.name,
|
|
1293
1264
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1294
1265
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1295
|
-
})), await
|
|
1266
|
+
})), await n.init(u.shareScope, u.initScope, u.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit({
|
|
1267
|
+
...u,
|
|
1296
1268
|
id: t,
|
|
1297
|
-
remoteSnapshot:
|
|
1298
|
-
remoteEntryExports:
|
|
1299
|
-
})
|
|
1269
|
+
remoteSnapshot: o,
|
|
1270
|
+
remoteEntryExports: n
|
|
1271
|
+
});
|
|
1300
1272
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1273
|
+
return n;
|
|
1274
|
+
}
|
|
1275
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1276
|
+
async get(t, o, n, s) {
|
|
1277
|
+
const { loadFactory: i = !0 } = n || { loadFactory: !0 }, c = await this.init(t, s);
|
|
1278
|
+
this.lib = c, this.inited = !0;
|
|
1279
|
+
let a;
|
|
1280
|
+
a = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1281
|
+
remoteEntryExports: c,
|
|
1282
|
+
expose: o,
|
|
1306
1283
|
moduleInfo: this.remoteInfo
|
|
1307
|
-
}),
|
|
1308
|
-
const
|
|
1309
|
-
return
|
|
1284
|
+
}), a || (a = await c.get(o)), assert(a, `${getFMId(this.remoteInfo)} remote don't export ${o}.`);
|
|
1285
|
+
const l = processModuleAlias(this.remoteInfo.name, o), u = this.wraperFactory(a, l);
|
|
1286
|
+
return i ? await u() : u;
|
|
1310
1287
|
}
|
|
1311
|
-
wraperFactory(t,
|
|
1312
|
-
function
|
|
1288
|
+
wraperFactory(t, o) {
|
|
1289
|
+
function n(s, i) {
|
|
1313
1290
|
s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
|
|
1314
|
-
value:
|
|
1291
|
+
value: i,
|
|
1315
1292
|
enumerable: !1
|
|
1316
1293
|
});
|
|
1317
1294
|
}
|
|
1318
1295
|
return t instanceof Promise ? async () => {
|
|
1319
1296
|
const s = await t();
|
|
1320
|
-
return
|
|
1297
|
+
return n(s, o), s;
|
|
1321
1298
|
} : () => {
|
|
1322
1299
|
const s = t();
|
|
1323
|
-
return
|
|
1300
|
+
return n(s, o), s;
|
|
1324
1301
|
};
|
|
1325
1302
|
}
|
|
1326
|
-
|
|
1327
|
-
this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = n;
|
|
1328
|
-
}
|
|
1329
|
-
};
|
|
1303
|
+
}
|
|
1330
1304
|
class SyncHook {
|
|
1305
|
+
constructor(t) {
|
|
1306
|
+
this.type = "", this.listeners = /* @__PURE__ */ new Set(), t && (this.type = t);
|
|
1307
|
+
}
|
|
1331
1308
|
on(t) {
|
|
1332
1309
|
typeof t == "function" && this.listeners.add(t);
|
|
1333
1310
|
}
|
|
1334
1311
|
once(t) {
|
|
1335
|
-
const
|
|
1336
|
-
this.on(function
|
|
1337
|
-
return
|
|
1312
|
+
const o = this;
|
|
1313
|
+
this.on(function n(...s) {
|
|
1314
|
+
return o.remove(n), t.apply(null, s);
|
|
1338
1315
|
});
|
|
1339
1316
|
}
|
|
1340
1317
|
emit(...t) {
|
|
1341
|
-
let
|
|
1342
|
-
return this.listeners.size > 0 && this.listeners.forEach((
|
|
1343
|
-
|
|
1344
|
-
}),
|
|
1318
|
+
let o;
|
|
1319
|
+
return this.listeners.size > 0 && this.listeners.forEach((n) => {
|
|
1320
|
+
o = n(...t);
|
|
1321
|
+
}), o;
|
|
1345
1322
|
}
|
|
1346
1323
|
remove(t) {
|
|
1347
1324
|
this.listeners.delete(t);
|
|
@@ -1349,123 +1326,119 @@ class SyncHook {
|
|
|
1349
1326
|
removeAll() {
|
|
1350
1327
|
this.listeners.clear();
|
|
1351
1328
|
}
|
|
1352
|
-
constructor(t) {
|
|
1353
|
-
this.type = "", this.listeners = /* @__PURE__ */ new Set(), t && (this.type = t);
|
|
1354
|
-
}
|
|
1355
1329
|
}
|
|
1356
1330
|
class AsyncHook extends SyncHook {
|
|
1357
1331
|
emit(...t) {
|
|
1358
|
-
let
|
|
1359
|
-
const
|
|
1360
|
-
if (
|
|
1332
|
+
let o;
|
|
1333
|
+
const n = Array.from(this.listeners);
|
|
1334
|
+
if (n.length > 0) {
|
|
1361
1335
|
let s = 0;
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1336
|
+
const i = (c) => c === !1 ? !1 : s < n.length ? Promise.resolve(n[s++].apply(null, t)).then(i) : c;
|
|
1337
|
+
o = i();
|
|
1364
1338
|
}
|
|
1365
|
-
return Promise.resolve(
|
|
1339
|
+
return Promise.resolve(o);
|
|
1366
1340
|
}
|
|
1367
1341
|
}
|
|
1368
|
-
function checkReturnData(
|
|
1342
|
+
function checkReturnData(r, t) {
|
|
1369
1343
|
if (!isObject(t))
|
|
1370
1344
|
return !1;
|
|
1371
|
-
if (
|
|
1372
|
-
for (const
|
|
1373
|
-
if (!(
|
|
1345
|
+
if (r !== t) {
|
|
1346
|
+
for (const o in r)
|
|
1347
|
+
if (!(o in t))
|
|
1374
1348
|
return !1;
|
|
1375
1349
|
}
|
|
1376
1350
|
return !0;
|
|
1377
1351
|
}
|
|
1378
1352
|
class SyncWaterfallHook extends SyncHook {
|
|
1353
|
+
constructor(t) {
|
|
1354
|
+
super(), this.onerror = error, this.type = t;
|
|
1355
|
+
}
|
|
1379
1356
|
emit(t) {
|
|
1380
1357
|
isObject(t) || error(`The data for the "${this.type}" hook should be an object.`);
|
|
1381
|
-
for (const
|
|
1358
|
+
for (const o of this.listeners)
|
|
1382
1359
|
try {
|
|
1383
|
-
const
|
|
1384
|
-
if (checkReturnData(t,
|
|
1385
|
-
t =
|
|
1360
|
+
const n = o(t);
|
|
1361
|
+
if (checkReturnData(t, n))
|
|
1362
|
+
t = n;
|
|
1386
1363
|
else {
|
|
1387
1364
|
this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
|
|
1388
1365
|
break;
|
|
1389
1366
|
}
|
|
1390
|
-
} catch (
|
|
1391
|
-
warn(
|
|
1367
|
+
} catch (n) {
|
|
1368
|
+
warn(n), this.onerror(n);
|
|
1392
1369
|
}
|
|
1393
1370
|
return t;
|
|
1394
1371
|
}
|
|
1372
|
+
}
|
|
1373
|
+
class AsyncWaterfallHook extends SyncHook {
|
|
1395
1374
|
constructor(t) {
|
|
1396
1375
|
super(), this.onerror = error, this.type = t;
|
|
1397
1376
|
}
|
|
1398
|
-
}
|
|
1399
|
-
class AsyncWaterfallHook extends SyncHook {
|
|
1400
1377
|
emit(t) {
|
|
1401
1378
|
isObject(t) || error(`The response data for the "${this.type}" hook must be an object.`);
|
|
1402
|
-
const
|
|
1403
|
-
if (
|
|
1404
|
-
let
|
|
1405
|
-
const s = (
|
|
1406
|
-
if (checkReturnData(t,
|
|
1407
|
-
if (t =
|
|
1379
|
+
const o = Array.from(this.listeners);
|
|
1380
|
+
if (o.length > 0) {
|
|
1381
|
+
let n = 0;
|
|
1382
|
+
const s = (c) => (warn(c), this.onerror(c), t), i = (c) => {
|
|
1383
|
+
if (checkReturnData(t, c)) {
|
|
1384
|
+
if (t = c, n < o.length)
|
|
1408
1385
|
try {
|
|
1409
|
-
return Promise.resolve(n
|
|
1410
|
-
} catch (
|
|
1411
|
-
return s(
|
|
1386
|
+
return Promise.resolve(o[n++](t)).then(i, s);
|
|
1387
|
+
} catch (a) {
|
|
1388
|
+
return s(a);
|
|
1412
1389
|
}
|
|
1413
1390
|
} else
|
|
1414
1391
|
this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
|
|
1415
1392
|
return t;
|
|
1416
1393
|
};
|
|
1417
|
-
return Promise.resolve(
|
|
1394
|
+
return Promise.resolve(i(t));
|
|
1418
1395
|
}
|
|
1419
1396
|
return Promise.resolve(t);
|
|
1420
1397
|
}
|
|
1421
|
-
constructor(t) {
|
|
1422
|
-
super(), this.onerror = error, this.type = t;
|
|
1423
|
-
}
|
|
1424
1398
|
}
|
|
1425
1399
|
class PluginSystem {
|
|
1426
|
-
|
|
1400
|
+
constructor(t) {
|
|
1401
|
+
this.registerPlugins = {}, this.lifecycle = t, this.lifecycleKeys = Object.keys(t);
|
|
1402
|
+
}
|
|
1403
|
+
applyPlugin(t, o) {
|
|
1404
|
+
var s;
|
|
1427
1405
|
assert(isPlainObject(t), "Plugin configuration is invalid.");
|
|
1428
|
-
const
|
|
1429
|
-
assert(
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1406
|
+
const n = t.name;
|
|
1407
|
+
assert(n, "A name must be provided by the plugin."), this.registerPlugins[n] || (this.registerPlugins[n] = t, (s = t.apply) == null || s.call(t, o), Object.keys(this.lifecycle).forEach((i) => {
|
|
1408
|
+
const c = t[i];
|
|
1409
|
+
c && this.lifecycle[i].on(c);
|
|
1432
1410
|
}));
|
|
1433
1411
|
}
|
|
1434
1412
|
removePlugin(t) {
|
|
1435
1413
|
assert(t, "A name is required.");
|
|
1436
|
-
const
|
|
1437
|
-
assert(
|
|
1438
|
-
|
|
1414
|
+
const o = this.registerPlugins[t];
|
|
1415
|
+
assert(o, `The plugin "${t}" is not registered.`), Object.keys(o).forEach((n) => {
|
|
1416
|
+
n !== "name" && this.lifecycle[n].remove(o[n]);
|
|
1439
1417
|
});
|
|
1440
1418
|
}
|
|
1441
|
-
constructor(t) {
|
|
1442
|
-
this.registerPlugins = {}, this.lifecycle = t, this.lifecycleKeys = Object.keys(t);
|
|
1443
|
-
}
|
|
1444
1419
|
}
|
|
1445
|
-
function assignRemoteInfo(
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
let
|
|
1449
|
-
!isBrowserEnv() && !
|
|
1420
|
+
function assignRemoteInfo(r, t) {
|
|
1421
|
+
const o = getRemoteEntryInfoFromSnapshot(t);
|
|
1422
|
+
o.url || error(`The attribute remoteEntry of ${r.name} must not be undefined.`);
|
|
1423
|
+
let n = getResourceUrl(t, o.url);
|
|
1424
|
+
!isBrowserEnv() && !n.startsWith("http") && (n = `https:${n}`), r.type = o.type, r.entryGlobalName = o.globalName, r.entry = n, r.version = t.version, r.buildVersion = t.buildVersion;
|
|
1450
1425
|
}
|
|
1451
1426
|
function snapshotPlugin() {
|
|
1452
1427
|
return {
|
|
1453
1428
|
name: "snapshot-plugin",
|
|
1454
|
-
async afterResolve(
|
|
1455
|
-
const { remote: t, pkgNameOrAlias:
|
|
1429
|
+
async afterResolve(r) {
|
|
1430
|
+
const { remote: t, pkgNameOrAlias: o, expose: n, origin: s, remoteInfo: i, id: c } = r;
|
|
1456
1431
|
if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
|
|
1457
|
-
const { remoteSnapshot:
|
|
1432
|
+
const { remoteSnapshot: a, globalSnapshot: l } = await s.snapshotHandler.loadRemoteSnapshotInfo({
|
|
1458
1433
|
moduleInfo: t,
|
|
1459
|
-
id:
|
|
1434
|
+
id: c
|
|
1460
1435
|
});
|
|
1461
|
-
assignRemoteInfo(
|
|
1436
|
+
assignRemoteInfo(i, a);
|
|
1462
1437
|
const u = {
|
|
1463
1438
|
remote: t,
|
|
1464
1439
|
preloadConfig: {
|
|
1465
|
-
nameOrAlias:
|
|
1466
|
-
exposes: [
|
|
1467
|
-
r
|
|
1468
|
-
],
|
|
1440
|
+
nameOrAlias: o,
|
|
1441
|
+
exposes: [n],
|
|
1469
1442
|
resourceCategory: "sync",
|
|
1470
1443
|
share: !1,
|
|
1471
1444
|
depsRemote: !1
|
|
@@ -1473,21 +1446,22 @@ function snapshotPlugin() {
|
|
|
1473
1446
|
}, d = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
|
|
1474
1447
|
origin: s,
|
|
1475
1448
|
preloadOptions: u,
|
|
1476
|
-
remoteInfo:
|
|
1449
|
+
remoteInfo: i,
|
|
1477
1450
|
remote: t,
|
|
1478
|
-
remoteSnapshot:
|
|
1479
|
-
globalSnapshot:
|
|
1480
|
-
});
|
|
1481
|
-
return d && preloadAssets(a, s, d, !1), _extends$1({}, o, {
|
|
1482
|
-
remoteSnapshot: i
|
|
1451
|
+
remoteSnapshot: a,
|
|
1452
|
+
globalSnapshot: l
|
|
1483
1453
|
});
|
|
1454
|
+
return d && preloadAssets(i, s, d, !1), {
|
|
1455
|
+
...r,
|
|
1456
|
+
remoteSnapshot: a
|
|
1457
|
+
};
|
|
1484
1458
|
}
|
|
1485
|
-
return
|
|
1459
|
+
return r;
|
|
1486
1460
|
}
|
|
1487
1461
|
};
|
|
1488
1462
|
}
|
|
1489
|
-
function splitId(
|
|
1490
|
-
const t =
|
|
1463
|
+
function splitId(r) {
|
|
1464
|
+
const t = r.split(":");
|
|
1491
1465
|
return t.length === 1 ? {
|
|
1492
1466
|
name: t[0],
|
|
1493
1467
|
version: void 0
|
|
@@ -1499,109 +1473,107 @@ function splitId(o) {
|
|
|
1499
1473
|
version: t[2]
|
|
1500
1474
|
};
|
|
1501
1475
|
}
|
|
1502
|
-
function traverseModuleInfo(
|
|
1503
|
-
const
|
|
1504
|
-
if (
|
|
1505
|
-
const u = Object.keys(
|
|
1476
|
+
function traverseModuleInfo(r, t, o, n, s = {}, i) {
|
|
1477
|
+
const c = getFMId(t), { value: a } = getInfoWithoutType(r, c), l = i || a;
|
|
1478
|
+
if (l && !isManifestProvider(l) && (o(l, t, n), l.remotesInfo)) {
|
|
1479
|
+
const u = Object.keys(l.remotesInfo);
|
|
1506
1480
|
for (const d of u) {
|
|
1507
1481
|
if (s[d])
|
|
1508
1482
|
continue;
|
|
1509
1483
|
s[d] = !0;
|
|
1510
|
-
const
|
|
1511
|
-
traverseModuleInfo(
|
|
1512
|
-
name:
|
|
1513
|
-
version:
|
|
1514
|
-
},
|
|
1484
|
+
const y = splitId(d), p = l.remotesInfo[d];
|
|
1485
|
+
traverseModuleInfo(r, {
|
|
1486
|
+
name: y.name,
|
|
1487
|
+
version: p.matchedVersion
|
|
1488
|
+
}, o, !1, s, void 0);
|
|
1515
1489
|
}
|
|
1516
1490
|
}
|
|
1517
1491
|
}
|
|
1518
|
-
const isExisted = (
|
|
1519
|
-
function generatePreloadAssets(
|
|
1520
|
-
const
|
|
1521
|
-
if (traverseModuleInfo(
|
|
1492
|
+
const isExisted = (r, t) => document.querySelector(`${r}[${r === "link" ? "href" : "src"}="${t}"]`);
|
|
1493
|
+
function generatePreloadAssets(r, t, o, n, s) {
|
|
1494
|
+
const i = [], c = [], a = [], l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: y } = t, { depsRemote: p } = y;
|
|
1495
|
+
if (traverseModuleInfo(n, o, (E, b, S) => {
|
|
1496
|
+
var $;
|
|
1522
1497
|
let I;
|
|
1523
|
-
if (
|
|
1524
|
-
I =
|
|
1525
|
-
else if (Array.isArray(
|
|
1526
|
-
const
|
|
1527
|
-
if (!
|
|
1498
|
+
if (S)
|
|
1499
|
+
I = y;
|
|
1500
|
+
else if (Array.isArray(p)) {
|
|
1501
|
+
const P = p.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
|
|
1502
|
+
if (!P)
|
|
1528
1503
|
return;
|
|
1529
|
-
I = defaultPreloadArgs(
|
|
1530
|
-
} else if (
|
|
1531
|
-
I =
|
|
1504
|
+
I = defaultPreloadArgs(P);
|
|
1505
|
+
} else if (p === !0)
|
|
1506
|
+
I = y;
|
|
1532
1507
|
else
|
|
1533
1508
|
return;
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1509
|
+
const A = getResourceUrl(E, getRemoteEntryInfoFromSnapshot(E).url);
|
|
1510
|
+
A && a.push({
|
|
1536
1511
|
name: b.name,
|
|
1537
1512
|
moduleInfo: {
|
|
1538
1513
|
name: b.name,
|
|
1539
|
-
entry:
|
|
1540
|
-
type: "remoteEntryType" in
|
|
1541
|
-
entryGlobalName: "globalName" in
|
|
1514
|
+
entry: A,
|
|
1515
|
+
type: "remoteEntryType" in E ? E.remoteEntryType : "global",
|
|
1516
|
+
entryGlobalName: "globalName" in E ? E.globalName : b.name,
|
|
1542
1517
|
shareScope: "",
|
|
1543
|
-
version: "version" in
|
|
1518
|
+
version: "version" in E ? E.version : void 0
|
|
1544
1519
|
},
|
|
1545
|
-
url:
|
|
1520
|
+
url: A
|
|
1546
1521
|
});
|
|
1547
|
-
let R = "modules" in
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
}
|
|
1553
|
-
function $(w) {
|
|
1554
|
-
const N = w.map((O) => getResourceUrl(_, O));
|
|
1522
|
+
let R = "modules" in E ? E.modules : [];
|
|
1523
|
+
const T = normalizePreloadExposes(I.exposes);
|
|
1524
|
+
T.length && "modules" in E && (R = ($ = E == null ? void 0 : E.modules) == null ? void 0 : $.reduce((P, N) => ((T == null ? void 0 : T.indexOf(N.moduleName)) !== -1 && P.push(N), P), []));
|
|
1525
|
+
function w(P) {
|
|
1526
|
+
const N = P.map((M) => getResourceUrl(E, M));
|
|
1555
1527
|
return I.filter ? N.filter(I.filter) : N;
|
|
1556
1528
|
}
|
|
1557
1529
|
if (R) {
|
|
1558
|
-
const
|
|
1559
|
-
for (let N = 0; N <
|
|
1560
|
-
const
|
|
1561
|
-
|
|
1562
|
-
id:
|
|
1530
|
+
const P = R.length;
|
|
1531
|
+
for (let N = 0; N < P; N++) {
|
|
1532
|
+
const M = R[N], L = `${b.name}/${M.moduleName}`;
|
|
1533
|
+
r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1534
|
+
id: M.moduleName === "." ? b.name : L,
|
|
1563
1535
|
name: b.name,
|
|
1564
|
-
remoteSnapshot:
|
|
1536
|
+
remoteSnapshot: E,
|
|
1565
1537
|
preloadConfig: I,
|
|
1566
1538
|
remote: b,
|
|
1567
|
-
origin:
|
|
1568
|
-
}), !getPreloaded(
|
|
1539
|
+
origin: r
|
|
1540
|
+
}), !getPreloaded(L) && (I.resourceCategory === "all" ? (i.push(...w(M.assets.css.async)), i.push(...w(M.assets.css.sync)), c.push(...w(M.assets.js.async)), c.push(...w(M.assets.js.sync))) : (I.resourceCategory = "sync") && (i.push(...w(M.assets.css.sync)), c.push(...w(M.assets.js.sync))), setPreloaded(L));
|
|
1569
1541
|
}
|
|
1570
1542
|
}
|
|
1571
1543
|
}, !0, {}, s), s.shared && s.shared.length > 0) {
|
|
1572
|
-
const
|
|
1573
|
-
const I = getRegisteredShare(
|
|
1574
|
-
I && typeof I.lib == "function" && (
|
|
1575
|
-
|
|
1576
|
-
}),
|
|
1577
|
-
u.add(
|
|
1544
|
+
const E = (b, S) => {
|
|
1545
|
+
const I = getRegisteredShare(r.shareScopeMap, S.sharedName, b, r.sharedHandler.hooks.lifecycle.resolveShare);
|
|
1546
|
+
I && typeof I.lib == "function" && (S.assets.js.sync.forEach((A) => {
|
|
1547
|
+
l.add(A);
|
|
1548
|
+
}), S.assets.css.sync.forEach((A) => {
|
|
1549
|
+
u.add(A);
|
|
1578
1550
|
}));
|
|
1579
1551
|
};
|
|
1580
1552
|
s.shared.forEach((b) => {
|
|
1581
|
-
var
|
|
1582
|
-
const
|
|
1583
|
-
if (!I)
|
|
1584
|
-
return;
|
|
1585
|
-
const S = b.version ? I.find((A) => A.version === b.version) : I;
|
|
1553
|
+
var R;
|
|
1554
|
+
const S = (R = d.shared) == null ? void 0 : R[b.sharedName];
|
|
1586
1555
|
if (!S)
|
|
1587
1556
|
return;
|
|
1588
|
-
|
|
1589
|
-
|
|
1557
|
+
const I = b.version ? S.find((T) => T.version === b.version) : S;
|
|
1558
|
+
if (!I)
|
|
1559
|
+
return;
|
|
1560
|
+
arrayOptions(I).forEach((T) => {
|
|
1561
|
+
E(T, b);
|
|
1590
1562
|
});
|
|
1591
1563
|
});
|
|
1592
1564
|
}
|
|
1593
|
-
const
|
|
1565
|
+
const g = c.filter((E) => !l.has(E) && !isExisted("script", E));
|
|
1594
1566
|
return {
|
|
1595
|
-
cssAssets:
|
|
1596
|
-
jsAssetsWithoutEntry:
|
|
1597
|
-
entryAssets:
|
|
1567
|
+
cssAssets: i.filter((E) => !u.has(E) && !isExisted("link", E)),
|
|
1568
|
+
jsAssetsWithoutEntry: g,
|
|
1569
|
+
entryAssets: a.filter((E) => !isExisted("script", E.url))
|
|
1598
1570
|
};
|
|
1599
1571
|
}
|
|
1600
1572
|
const generatePreloadAssetsPlugin = function() {
|
|
1601
1573
|
return {
|
|
1602
1574
|
name: "generate-preload-assets-plugin",
|
|
1603
|
-
async generatePreloadAssets(
|
|
1604
|
-
const { origin: t, preloadOptions:
|
|
1575
|
+
async generatePreloadAssets(r) {
|
|
1576
|
+
const { origin: t, preloadOptions: o, remoteInfo: n, remote: s, globalSnapshot: i, remoteSnapshot: c } = r;
|
|
1605
1577
|
return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
|
|
1606
1578
|
cssAssets: [],
|
|
1607
1579
|
jsAssetsWithoutEntry: [],
|
|
@@ -1610,15 +1582,15 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
1610
1582
|
name: s.name,
|
|
1611
1583
|
url: s.entry,
|
|
1612
1584
|
moduleInfo: {
|
|
1613
|
-
name:
|
|
1585
|
+
name: n.name,
|
|
1614
1586
|
entry: s.entry,
|
|
1615
|
-
type:
|
|
1587
|
+
type: n.type || "global",
|
|
1616
1588
|
entryGlobalName: "",
|
|
1617
1589
|
shareScope: ""
|
|
1618
1590
|
}
|
|
1619
1591
|
}
|
|
1620
1592
|
]
|
|
1621
|
-
} : (assignRemoteInfo(
|
|
1593
|
+
} : (assignRemoteInfo(n, c), generatePreloadAssets(t, o, n, i, c)) : {
|
|
1622
1594
|
cssAssets: [],
|
|
1623
1595
|
jsAssetsWithoutEntry: [],
|
|
1624
1596
|
entryAssets: []
|
|
@@ -1626,83 +1598,93 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
1626
1598
|
}
|
|
1627
1599
|
};
|
|
1628
1600
|
};
|
|
1629
|
-
function getGlobalRemoteInfo(
|
|
1630
|
-
const
|
|
1601
|
+
function getGlobalRemoteInfo(r, t) {
|
|
1602
|
+
const o = getGlobalSnapshotInfoByModuleInfo({
|
|
1631
1603
|
name: t.name,
|
|
1632
1604
|
version: t.options.version
|
|
1633
|
-
}),
|
|
1634
|
-
return
|
|
1635
|
-
hostGlobalSnapshot:
|
|
1605
|
+
}), n = o && "remotesInfo" in o && o.remotesInfo && getInfoWithoutType(o.remotesInfo, r.name).value;
|
|
1606
|
+
return n && n.matchedVersion ? {
|
|
1607
|
+
hostGlobalSnapshot: o,
|
|
1636
1608
|
globalSnapshot: getGlobalSnapshot(),
|
|
1637
1609
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
1638
|
-
name:
|
|
1639
|
-
version:
|
|
1610
|
+
name: r.name,
|
|
1611
|
+
version: n.matchedVersion
|
|
1640
1612
|
})
|
|
1641
1613
|
} : {
|
|
1642
1614
|
hostGlobalSnapshot: void 0,
|
|
1643
1615
|
globalSnapshot: getGlobalSnapshot(),
|
|
1644
1616
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
1645
|
-
name:
|
|
1646
|
-
version: "version" in
|
|
1617
|
+
name: r.name,
|
|
1618
|
+
version: "version" in r ? r.version : void 0
|
|
1647
1619
|
})
|
|
1648
1620
|
};
|
|
1649
1621
|
}
|
|
1650
1622
|
class SnapshotHandler {
|
|
1623
|
+
constructor(t) {
|
|
1624
|
+
this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new PluginSystem({
|
|
1625
|
+
beforeLoadRemoteSnapshot: new AsyncHook("beforeLoadRemoteSnapshot"),
|
|
1626
|
+
loadSnapshot: new AsyncWaterfallHook("loadGlobalSnapshot"),
|
|
1627
|
+
loadRemoteSnapshot: new AsyncWaterfallHook("loadRemoteSnapshot"),
|
|
1628
|
+
afterLoadSnapshot: new AsyncWaterfallHook("afterLoadSnapshot")
|
|
1629
|
+
}), this.manifestLoading = Global.__FEDERATION__.__MANIFEST_LOADING__, this.HostInstance = t, this.loaderHook = t.loaderHook;
|
|
1630
|
+
}
|
|
1651
1631
|
// eslint-disable-next-line max-lines-per-function
|
|
1652
|
-
async loadRemoteSnapshotInfo({ moduleInfo: t, id:
|
|
1632
|
+
async loadRemoteSnapshotInfo({ moduleInfo: t, id: o, expose: n }) {
|
|
1653
1633
|
const { options: s } = this.HostInstance;
|
|
1654
1634
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
1655
1635
|
options: s,
|
|
1656
1636
|
moduleInfo: t
|
|
1657
1637
|
});
|
|
1658
|
-
let
|
|
1638
|
+
let i = getGlobalSnapshotInfoByModuleInfo({
|
|
1659
1639
|
name: this.HostInstance.options.name,
|
|
1660
1640
|
version: this.HostInstance.options.version
|
|
1661
1641
|
});
|
|
1662
|
-
|
|
1642
|
+
i || (i = {
|
|
1663
1643
|
version: this.HostInstance.options.version || "",
|
|
1664
1644
|
remoteEntry: "",
|
|
1665
1645
|
remotesInfo: {}
|
|
1666
1646
|
}, addGlobalSnapshot({
|
|
1667
|
-
[this.HostInstance.options.name]:
|
|
1668
|
-
})),
|
|
1647
|
+
[this.HostInstance.options.name]: i
|
|
1648
|
+
})), i && "remotesInfo" in i && !getInfoWithoutType(i.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (i.remotesInfo = {
|
|
1649
|
+
...i == null ? void 0 : i.remotesInfo,
|
|
1669
1650
|
[t.name]: {
|
|
1670
1651
|
matchedVersion: "version" in t ? t.version : t.entry
|
|
1671
1652
|
}
|
|
1672
|
-
})
|
|
1673
|
-
const { hostGlobalSnapshot:
|
|
1653
|
+
});
|
|
1654
|
+
const { hostGlobalSnapshot: c, remoteSnapshot: a, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot: d } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1674
1655
|
options: s,
|
|
1675
1656
|
moduleInfo: t,
|
|
1676
|
-
hostGlobalSnapshot:
|
|
1677
|
-
remoteSnapshot:
|
|
1678
|
-
globalSnapshot:
|
|
1657
|
+
hostGlobalSnapshot: c,
|
|
1658
|
+
remoteSnapshot: a,
|
|
1659
|
+
globalSnapshot: l
|
|
1679
1660
|
});
|
|
1680
|
-
let
|
|
1661
|
+
let y, p;
|
|
1681
1662
|
if (u)
|
|
1682
1663
|
if (isManifestProvider(u)) {
|
|
1683
|
-
const
|
|
1664
|
+
const m = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", g = await this.getManifestJson(m, t, {}), _ = setGlobalSnapshotInfoByModuleInfo({
|
|
1665
|
+
...t,
|
|
1684
1666
|
// The global remote may be overridden
|
|
1685
1667
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1686
|
-
entry:
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1668
|
+
entry: m
|
|
1669
|
+
}, g);
|
|
1670
|
+
y = g, p = _;
|
|
1689
1671
|
} else {
|
|
1690
|
-
const { remoteSnapshot:
|
|
1672
|
+
const { remoteSnapshot: m } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1691
1673
|
options: this.HostInstance.options,
|
|
1692
1674
|
moduleInfo: t,
|
|
1693
1675
|
remoteSnapshot: u,
|
|
1694
1676
|
from: "global"
|
|
1695
1677
|
});
|
|
1696
|
-
|
|
1678
|
+
y = m, p = d;
|
|
1697
1679
|
}
|
|
1698
1680
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1699
|
-
const
|
|
1681
|
+
const m = await this.getManifestJson(t.entry, t, {}), g = setGlobalSnapshotInfoByModuleInfo(t, m), { remoteSnapshot: _ } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1700
1682
|
options: this.HostInstance.options,
|
|
1701
1683
|
moduleInfo: t,
|
|
1702
|
-
remoteSnapshot:
|
|
1684
|
+
remoteSnapshot: m,
|
|
1703
1685
|
from: "global"
|
|
1704
1686
|
});
|
|
1705
|
-
|
|
1687
|
+
y = _, p = g;
|
|
1706
1688
|
} else
|
|
1707
1689
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1708
1690
|
hostName: t.name,
|
|
@@ -1710,138 +1692,144 @@ class SnapshotHandler {
|
|
|
1710
1692
|
globalSnapshot: JSON.stringify(d)
|
|
1711
1693
|
}));
|
|
1712
1694
|
return await this.hooks.lifecycle.afterLoadSnapshot.emit({
|
|
1713
|
-
id:
|
|
1695
|
+
id: o,
|
|
1714
1696
|
host: this.HostInstance,
|
|
1715
1697
|
options: s,
|
|
1716
1698
|
moduleInfo: t,
|
|
1717
|
-
remoteSnapshot:
|
|
1699
|
+
remoteSnapshot: y
|
|
1718
1700
|
}), {
|
|
1719
|
-
remoteSnapshot:
|
|
1720
|
-
globalSnapshot:
|
|
1701
|
+
remoteSnapshot: y,
|
|
1702
|
+
globalSnapshot: p
|
|
1721
1703
|
};
|
|
1722
1704
|
}
|
|
1723
1705
|
getGlobalRemoteInfo(t) {
|
|
1724
1706
|
return getGlobalRemoteInfo(t, this.HostInstance);
|
|
1725
1707
|
}
|
|
1726
|
-
async getManifestJson(t,
|
|
1708
|
+
async getManifestJson(t, o, n) {
|
|
1727
1709
|
const s = async () => {
|
|
1728
|
-
let
|
|
1729
|
-
if (
|
|
1730
|
-
return
|
|
1710
|
+
let c = this.manifestCache.get(t);
|
|
1711
|
+
if (c)
|
|
1712
|
+
return c;
|
|
1731
1713
|
try {
|
|
1732
|
-
let
|
|
1733
|
-
(!
|
|
1734
|
-
} catch (
|
|
1735
|
-
|
|
1714
|
+
let a = await this.loaderHook.lifecycle.fetch.emit(t, {});
|
|
1715
|
+
(!a || !(a instanceof Response)) && (a = await fetch(t, {})), c = await a.json();
|
|
1716
|
+
} catch (a) {
|
|
1717
|
+
c = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1736
1718
|
id: t,
|
|
1737
|
-
error:
|
|
1719
|
+
error: a,
|
|
1738
1720
|
from: "runtime",
|
|
1739
1721
|
lifecycle: "afterResolve",
|
|
1740
1722
|
origin: this.HostInstance
|
|
1741
|
-
}),
|
|
1723
|
+
}), c || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
|
|
1742
1724
|
manifestUrl: t,
|
|
1743
|
-
moduleName:
|
|
1725
|
+
moduleName: o.name,
|
|
1744
1726
|
hostName: this.HostInstance.options.name
|
|
1745
|
-
}, `${
|
|
1727
|
+
}, `${a}`)));
|
|
1746
1728
|
}
|
|
1747
|
-
return assert(
|
|
1748
|
-
},
|
|
1749
|
-
const
|
|
1729
|
+
return assert(c.metaData && c.exposes && c.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, c), c;
|
|
1730
|
+
}, i = async () => {
|
|
1731
|
+
const c = await s(), a = generateSnapshotFromManifest(c, {
|
|
1750
1732
|
version: t
|
|
1751
|
-
}), { remoteSnapshot:
|
|
1733
|
+
}), { remoteSnapshot: l } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1752
1734
|
options: this.HostInstance.options,
|
|
1753
|
-
moduleInfo:
|
|
1754
|
-
manifestJson:
|
|
1755
|
-
remoteSnapshot:
|
|
1735
|
+
moduleInfo: o,
|
|
1736
|
+
manifestJson: c,
|
|
1737
|
+
remoteSnapshot: a,
|
|
1756
1738
|
manifestUrl: t,
|
|
1757
1739
|
from: "manifest"
|
|
1758
1740
|
});
|
|
1759
|
-
return
|
|
1741
|
+
return l;
|
|
1760
1742
|
};
|
|
1761
|
-
return this.manifestLoading[t] || (this.manifestLoading[t] =
|
|
1762
|
-
}
|
|
1763
|
-
constructor(t) {
|
|
1764
|
-
this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new PluginSystem({
|
|
1765
|
-
beforeLoadRemoteSnapshot: new AsyncHook("beforeLoadRemoteSnapshot"),
|
|
1766
|
-
loadSnapshot: new AsyncWaterfallHook("loadGlobalSnapshot"),
|
|
1767
|
-
loadRemoteSnapshot: new AsyncWaterfallHook("loadRemoteSnapshot"),
|
|
1768
|
-
afterLoadSnapshot: new AsyncWaterfallHook("afterLoadSnapshot")
|
|
1769
|
-
}), this.manifestLoading = Global.__FEDERATION__.__MANIFEST_LOADING__, this.HostInstance = t, this.loaderHook = t.loaderHook;
|
|
1743
|
+
return this.manifestLoading[t] || (this.manifestLoading[t] = i().then((c) => c)), this.manifestLoading[t];
|
|
1770
1744
|
}
|
|
1771
1745
|
}
|
|
1772
1746
|
class SharedHandler {
|
|
1747
|
+
constructor(t) {
|
|
1748
|
+
this.hooks = new PluginSystem({
|
|
1749
|
+
afterResolve: new AsyncWaterfallHook("afterResolve"),
|
|
1750
|
+
beforeLoadShare: new AsyncWaterfallHook("beforeLoadShare"),
|
|
1751
|
+
// not used yet
|
|
1752
|
+
loadShare: new AsyncHook(),
|
|
1753
|
+
resolveShare: new SyncWaterfallHook("resolveShare"),
|
|
1754
|
+
// maybe will change, temporarily for internal use only
|
|
1755
|
+
initContainerShareScopeMap: new SyncWaterfallHook("initContainerShareScopeMap")
|
|
1756
|
+
}), this.host = t, this.shareScopeMap = {}, this.initTokens = {}, this._setGlobalShareScopeMap(t.options);
|
|
1757
|
+
}
|
|
1773
1758
|
// register shared in shareScopeMap
|
|
1774
|
-
registerShared(t,
|
|
1775
|
-
const { shareInfos:
|
|
1776
|
-
return Object.keys(
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1759
|
+
registerShared(t, o) {
|
|
1760
|
+
const { shareInfos: n, shared: s } = formatShareConfigs(t, o);
|
|
1761
|
+
return Object.keys(n).forEach((c) => {
|
|
1762
|
+
n[c].forEach((l) => {
|
|
1763
|
+
l.scope.forEach((u) => {
|
|
1764
|
+
var y;
|
|
1765
|
+
((y = this.shareScopeMap[u]) == null ? void 0 : y[c]) || this.setShared({
|
|
1766
|
+
pkgName: c,
|
|
1767
|
+
lib: l.lib,
|
|
1768
|
+
get: l.get,
|
|
1769
|
+
loaded: l.loaded || !!l.lib,
|
|
1770
|
+
shared: l,
|
|
1771
|
+
from: o.name
|
|
1772
|
+
});
|
|
1785
1773
|
});
|
|
1786
1774
|
});
|
|
1787
1775
|
}), {
|
|
1788
|
-
shareInfos:
|
|
1776
|
+
shareInfos: n,
|
|
1789
1777
|
shared: s
|
|
1790
1778
|
};
|
|
1791
1779
|
}
|
|
1792
|
-
async loadShare(t,
|
|
1793
|
-
const { host:
|
|
1780
|
+
async loadShare(t, o) {
|
|
1781
|
+
const { host: n } = this, s = getTargetSharedOptions({
|
|
1794
1782
|
pkgName: t,
|
|
1795
|
-
extraOptions:
|
|
1796
|
-
shareInfos:
|
|
1783
|
+
extraOptions: o,
|
|
1784
|
+
shareInfos: n.options.shared
|
|
1797
1785
|
});
|
|
1798
1786
|
s != null && s.scope && await Promise.all(s.scope.map(async (u) => {
|
|
1799
1787
|
await Promise.all(this.initializeSharing(u, {
|
|
1800
1788
|
strategy: s.strategy
|
|
1801
1789
|
}));
|
|
1802
1790
|
}));
|
|
1803
|
-
const
|
|
1791
|
+
const i = await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
1804
1792
|
pkgName: t,
|
|
1805
1793
|
shareInfo: s,
|
|
1806
|
-
shared:
|
|
1807
|
-
origin:
|
|
1808
|
-
}), { shareInfo:
|
|
1809
|
-
assert(
|
|
1810
|
-
const
|
|
1811
|
-
u.useIn || (u.useIn = []), addUniqueItem(u.useIn,
|
|
1794
|
+
shared: n.options.shared,
|
|
1795
|
+
origin: n
|
|
1796
|
+
}), { shareInfo: c } = i;
|
|
1797
|
+
assert(c, `Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);
|
|
1798
|
+
const a = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare), l = (u) => {
|
|
1799
|
+
u.useIn || (u.useIn = []), addUniqueItem(u.useIn, n.options.name);
|
|
1812
1800
|
};
|
|
1813
|
-
if (
|
|
1814
|
-
return
|
|
1815
|
-
if (
|
|
1816
|
-
const u = await
|
|
1817
|
-
return
|
|
1818
|
-
} else if (
|
|
1801
|
+
if (a && a.lib)
|
|
1802
|
+
return l(a), a.lib;
|
|
1803
|
+
if (a && a.loading && !a.loaded) {
|
|
1804
|
+
const u = await a.loading;
|
|
1805
|
+
return a.loaded = !0, a.lib || (a.lib = u), l(a), u;
|
|
1806
|
+
} else if (a) {
|
|
1819
1807
|
const d = (async () => {
|
|
1820
|
-
const
|
|
1821
|
-
return
|
|
1808
|
+
const y = await a.get();
|
|
1809
|
+
return l(a), a.loaded = !0, a.lib = y, y;
|
|
1822
1810
|
})();
|
|
1823
1811
|
return this.setShared({
|
|
1824
1812
|
pkgName: t,
|
|
1825
1813
|
loaded: !1,
|
|
1826
|
-
shared:
|
|
1827
|
-
from:
|
|
1814
|
+
shared: a,
|
|
1815
|
+
from: n.options.name,
|
|
1828
1816
|
lib: null,
|
|
1829
1817
|
loading: d
|
|
1830
1818
|
}), d;
|
|
1831
1819
|
} else {
|
|
1832
|
-
if (
|
|
1820
|
+
if (o != null && o.customShareInfo)
|
|
1833
1821
|
return !1;
|
|
1834
1822
|
const d = (async () => {
|
|
1835
|
-
const
|
|
1836
|
-
|
|
1837
|
-
const
|
|
1838
|
-
return
|
|
1823
|
+
const y = await c.get();
|
|
1824
|
+
c.lib = y, c.loaded = !0, l(c);
|
|
1825
|
+
const p = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare);
|
|
1826
|
+
return p && (p.lib = y, p.loaded = !0, p.from = c.from), y;
|
|
1839
1827
|
})();
|
|
1840
1828
|
return this.setShared({
|
|
1841
1829
|
pkgName: t,
|
|
1842
1830
|
loaded: !1,
|
|
1843
|
-
shared:
|
|
1844
|
-
from:
|
|
1831
|
+
shared: c,
|
|
1832
|
+
from: n.options.name,
|
|
1845
1833
|
lib: null,
|
|
1846
1834
|
loading: d
|
|
1847
1835
|
}), d;
|
|
@@ -1853,521 +1841,454 @@ class SharedHandler {
|
|
|
1853
1841
|
* If the share scope does not exist, it creates one.
|
|
1854
1842
|
*/
|
|
1855
1843
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1856
|
-
initializeSharing(t = DEFAULT_SCOPE,
|
|
1857
|
-
const { host:
|
|
1858
|
-
let
|
|
1859
|
-
const
|
|
1844
|
+
initializeSharing(t = DEFAULT_SCOPE, o) {
|
|
1845
|
+
const { host: n } = this, s = o == null ? void 0 : o.from, i = o == null ? void 0 : o.strategy;
|
|
1846
|
+
let c = o == null ? void 0 : o.initScope;
|
|
1847
|
+
const a = [];
|
|
1860
1848
|
if (s !== "build") {
|
|
1861
|
-
const { initTokens:
|
|
1862
|
-
|
|
1863
|
-
let g =
|
|
1864
|
-
if (g || (g =
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
l.push(g);
|
|
1849
|
+
const { initTokens: m } = this;
|
|
1850
|
+
c || (c = []);
|
|
1851
|
+
let g = m[t];
|
|
1852
|
+
if (g || (g = m[t] = { from: this.host.name }), c.indexOf(g) >= 0)
|
|
1853
|
+
return a;
|
|
1854
|
+
c.push(g);
|
|
1868
1855
|
}
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
const d =
|
|
1872
|
-
var
|
|
1873
|
-
const { version:
|
|
1874
|
-
d[
|
|
1875
|
-
const
|
|
1876
|
-
(!S || S.strategy !== "loaded-first" && !S.loaded && (!
|
|
1877
|
-
},
|
|
1878
|
-
const { module: g } = await
|
|
1879
|
-
id:
|
|
1856
|
+
const l = this.shareScopeMap, u = n.options.name;
|
|
1857
|
+
l[t] || (l[t] = {});
|
|
1858
|
+
const d = l[t], y = (m, g) => {
|
|
1859
|
+
var A;
|
|
1860
|
+
const { version: _, eager: E } = g;
|
|
1861
|
+
d[m] = d[m] || {};
|
|
1862
|
+
const b = d[m], S = b[_], I = !!(S && (S.eager || (A = S.shareConfig) != null && A.eager));
|
|
1863
|
+
(!S || S.strategy !== "loaded-first" && !S.loaded && (!E != !I ? E : u > S.from)) && (b[_] = g);
|
|
1864
|
+
}, p = async (m) => {
|
|
1865
|
+
const { module: g } = await n.remoteHandler.getRemoteModuleAndOptions({
|
|
1866
|
+
id: m
|
|
1880
1867
|
});
|
|
1881
|
-
|
|
1882
|
-
let _;
|
|
1883
|
-
try {
|
|
1884
|
-
_ = await g.getEntry();
|
|
1885
|
-
} catch (b) {
|
|
1886
|
-
_ = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1887
|
-
id: E,
|
|
1888
|
-
error: b,
|
|
1889
|
-
from: "runtime",
|
|
1890
|
-
lifecycle: "beforeLoadShare",
|
|
1891
|
-
origin: r
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1894
|
-
g.inited || (await m(_), g.inited = !0);
|
|
1895
|
-
}
|
|
1868
|
+
await g.init();
|
|
1896
1869
|
};
|
|
1897
|
-
return Object.keys(
|
|
1898
|
-
|
|
1899
|
-
_.scope.includes(t) &&
|
|
1870
|
+
return Object.keys(n.options.shared).forEach((m) => {
|
|
1871
|
+
n.options.shared[m].forEach((_) => {
|
|
1872
|
+
_.scope.includes(t) && y(m, _);
|
|
1900
1873
|
});
|
|
1901
|
-
}), (
|
|
1902
|
-
|
|
1903
|
-
}),
|
|
1874
|
+
}), (n.options.shareStrategy === "version-first" || i === "version-first") && n.options.remotes.forEach((m) => {
|
|
1875
|
+
m.shareScope === t && a.push(p(m.name));
|
|
1876
|
+
}), a;
|
|
1904
1877
|
}
|
|
1905
1878
|
// The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
|
|
1906
1879
|
// 1. If the loaded shared already exists globally, then it will be reused
|
|
1907
1880
|
// 2. If lib exists in local shared, it will be used directly
|
|
1908
1881
|
// 3. If the local get returns something other than Promise, then it will be used directly
|
|
1909
|
-
loadShareSync(t,
|
|
1910
|
-
const { host:
|
|
1882
|
+
loadShareSync(t, o) {
|
|
1883
|
+
const { host: n } = this, s = getTargetSharedOptions({
|
|
1911
1884
|
pkgName: t,
|
|
1912
|
-
extraOptions:
|
|
1913
|
-
shareInfos:
|
|
1885
|
+
extraOptions: o,
|
|
1886
|
+
shareInfos: n.options.shared
|
|
1914
1887
|
});
|
|
1915
|
-
s != null && s.scope && s.scope.forEach((
|
|
1916
|
-
this.initializeSharing(
|
|
1917
|
-
strategy: s.strategy
|
|
1918
|
-
});
|
|
1888
|
+
s != null && s.scope && s.scope.forEach((a) => {
|
|
1889
|
+
this.initializeSharing(a, { strategy: s.strategy });
|
|
1919
1890
|
});
|
|
1920
|
-
const
|
|
1921
|
-
|
|
1891
|
+
const i = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), c = (a) => {
|
|
1892
|
+
a.useIn || (a.useIn = []), addUniqueItem(a.useIn, n.options.name);
|
|
1922
1893
|
};
|
|
1923
|
-
if (
|
|
1924
|
-
if (typeof
|
|
1925
|
-
return
|
|
1926
|
-
if (typeof
|
|
1927
|
-
const
|
|
1928
|
-
if (!(
|
|
1929
|
-
return
|
|
1894
|
+
if (i) {
|
|
1895
|
+
if (typeof i.lib == "function")
|
|
1896
|
+
return c(i), i.loaded || (i.loaded = !0, i.from === n.options.name && (s.loaded = !0)), i.lib;
|
|
1897
|
+
if (typeof i.get == "function") {
|
|
1898
|
+
const a = i.get();
|
|
1899
|
+
if (!(a instanceof Promise))
|
|
1900
|
+
return c(i), this.setShared({
|
|
1930
1901
|
pkgName: t,
|
|
1931
1902
|
loaded: !0,
|
|
1932
|
-
from:
|
|
1933
|
-
lib:
|
|
1934
|
-
shared:
|
|
1935
|
-
}),
|
|
1903
|
+
from: n.options.name,
|
|
1904
|
+
lib: a,
|
|
1905
|
+
shared: i
|
|
1906
|
+
}), a;
|
|
1936
1907
|
}
|
|
1937
1908
|
}
|
|
1938
1909
|
if (s.lib)
|
|
1939
1910
|
return s.loaded || (s.loaded = !0), s.lib;
|
|
1940
1911
|
if (s.get) {
|
|
1941
|
-
const
|
|
1942
|
-
if (
|
|
1943
|
-
const
|
|
1944
|
-
throw new Error(getShortErrorMsg(
|
|
1945
|
-
hostName:
|
|
1912
|
+
const a = s.get();
|
|
1913
|
+
if (a instanceof Promise) {
|
|
1914
|
+
const l = (o == null ? void 0 : o.from) === "build" ? RUNTIME_005 : RUNTIME_006;
|
|
1915
|
+
throw new Error(getShortErrorMsg(l, runtimeDescMap, {
|
|
1916
|
+
hostName: n.options.name,
|
|
1946
1917
|
sharedPkgName: t
|
|
1947
1918
|
}));
|
|
1948
1919
|
}
|
|
1949
|
-
return s.lib =
|
|
1920
|
+
return s.lib = a, this.setShared({
|
|
1950
1921
|
pkgName: t,
|
|
1951
1922
|
loaded: !0,
|
|
1952
|
-
from:
|
|
1923
|
+
from: n.options.name,
|
|
1953
1924
|
lib: s.lib,
|
|
1954
1925
|
shared: s
|
|
1955
1926
|
}), s.lib;
|
|
1956
1927
|
}
|
|
1957
1928
|
throw new Error(getShortErrorMsg(RUNTIME_006, runtimeDescMap, {
|
|
1958
|
-
hostName:
|
|
1929
|
+
hostName: n.options.name,
|
|
1959
1930
|
sharedPkgName: t
|
|
1960
1931
|
}));
|
|
1961
1932
|
}
|
|
1962
|
-
initShareScopeMap(t,
|
|
1933
|
+
initShareScopeMap(t, o, n = {}) {
|
|
1963
1934
|
const { host: s } = this;
|
|
1964
|
-
this.shareScopeMap[t] =
|
|
1965
|
-
shareScope:
|
|
1935
|
+
this.shareScopeMap[t] = o, this.hooks.lifecycle.initContainerShareScopeMap.emit({
|
|
1936
|
+
shareScope: o,
|
|
1966
1937
|
options: s.options,
|
|
1967
1938
|
origin: s,
|
|
1968
1939
|
scopeName: t,
|
|
1969
|
-
hostShareScopeMap:
|
|
1940
|
+
hostShareScopeMap: n.hostShareScopeMap
|
|
1970
1941
|
});
|
|
1971
1942
|
}
|
|
1972
|
-
setShared({ pkgName: t, shared:
|
|
1973
|
-
const { version:
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
if (this.shareScopeMap[m] || (this.shareScopeMap[m] = {}), this.shareScopeMap[m][t] || (this.shareScopeMap[m][t] = {}), !this.shareScopeMap[m][t][c]) {
|
|
1981
|
-
this.shareScopeMap[m][t][c] = _extends$1({
|
|
1982
|
-
version: c,
|
|
1983
|
-
scope: [
|
|
1984
|
-
"default"
|
|
1985
|
-
]
|
|
1986
|
-
}, d, {
|
|
1943
|
+
setShared({ pkgName: t, shared: o, from: n, lib: s, loading: i, loaded: c, get: a }) {
|
|
1944
|
+
const { version: l, scope: u = "default", ...d } = o;
|
|
1945
|
+
(Array.isArray(u) ? u : [u]).forEach((p) => {
|
|
1946
|
+
if (this.shareScopeMap[p] || (this.shareScopeMap[p] = {}), this.shareScopeMap[p][t] || (this.shareScopeMap[p][t] = {}), !this.shareScopeMap[p][t][l]) {
|
|
1947
|
+
this.shareScopeMap[p][t][l] = {
|
|
1948
|
+
version: l,
|
|
1949
|
+
scope: [p],
|
|
1950
|
+
...d,
|
|
1987
1951
|
lib: s,
|
|
1988
|
-
loaded:
|
|
1989
|
-
loading:
|
|
1990
|
-
}
|
|
1952
|
+
loaded: c,
|
|
1953
|
+
loading: i
|
|
1954
|
+
}, a && (this.shareScopeMap[p][t][l].get = a);
|
|
1991
1955
|
return;
|
|
1992
1956
|
}
|
|
1993
|
-
const
|
|
1994
|
-
|
|
1957
|
+
const m = this.shareScopeMap[p][t][l];
|
|
1958
|
+
i && !m.loading && (m.loading = i), c && !m.loaded && (m.loaded = c), n && m.from !== n && (m.from = n);
|
|
1995
1959
|
});
|
|
1996
1960
|
}
|
|
1997
1961
|
_setGlobalShareScopeMap(t) {
|
|
1998
|
-
const
|
|
1999
|
-
|
|
1962
|
+
const o = getGlobalShareScope(), n = t.id || t.name;
|
|
1963
|
+
n && !o[n] && (o[n] = this.shareScopeMap);
|
|
2000
1964
|
}
|
|
1965
|
+
}
|
|
1966
|
+
class RemoteHandler {
|
|
2001
1967
|
constructor(t) {
|
|
2002
1968
|
this.hooks = new PluginSystem({
|
|
2003
|
-
|
|
2004
|
-
|
|
1969
|
+
beforeRegisterRemote: new SyncWaterfallHook("beforeRegisterRemote"),
|
|
1970
|
+
registerRemote: new SyncWaterfallHook("registerRemote"),
|
|
1971
|
+
beforeRequest: new AsyncWaterfallHook("beforeRequest"),
|
|
1972
|
+
onLoad: new AsyncHook("onLoad"),
|
|
1973
|
+
handlePreloadModule: new SyncHook("handlePreloadModule"),
|
|
1974
|
+
errorLoadRemote: new AsyncHook("errorLoadRemote"),
|
|
1975
|
+
beforePreloadRemote: new AsyncHook("beforePreloadRemote"),
|
|
1976
|
+
generatePreloadAssets: new AsyncHook("generatePreloadAssets"),
|
|
2005
1977
|
// not used yet
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
initContainerShareScopeMap: new SyncWaterfallHook("initContainerShareScopeMap")
|
|
2010
|
-
}), this.host = t, this.shareScopeMap = {}, this.initTokens = {}, this._setGlobalShareScopeMap(t.options);
|
|
1978
|
+
afterPreloadRemote: new AsyncHook(),
|
|
1979
|
+
loadEntry: new AsyncHook()
|
|
1980
|
+
}), this.host = t, this.idToRemoteMap = {};
|
|
2011
1981
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
const { remote: r, expose: s } = n, { name: a, alias: l } = r;
|
|
2021
|
-
if (this.idToRemoteMap[t] = {
|
|
2022
|
-
name: r.name,
|
|
2023
|
-
expose: s
|
|
2024
|
-
}, l && t.startsWith(a)) {
|
|
2025
|
-
const i = t.replace(a, l);
|
|
2026
|
-
this.idToRemoteMap[i] = {
|
|
2027
|
-
name: r.name,
|
|
2028
|
-
expose: s
|
|
2029
|
-
};
|
|
1982
|
+
formatAndRegisterRemote(t, o) {
|
|
1983
|
+
return (o.remotes || []).reduce((s, i) => (this.registerRemote(i, s, { force: !1 }), s), t.remotes);
|
|
1984
|
+
}
|
|
1985
|
+
setIdToRemoteMap(t, o) {
|
|
1986
|
+
const { remote: n, expose: s } = o, { name: i, alias: c } = n;
|
|
1987
|
+
if (this.idToRemoteMap[t] = { name: n.name, expose: s }, c && t.startsWith(i)) {
|
|
1988
|
+
const a = t.replace(i, c);
|
|
1989
|
+
this.idToRemoteMap[a] = { name: n.name, expose: s };
|
|
2030
1990
|
return;
|
|
2031
1991
|
}
|
|
2032
|
-
if (
|
|
2033
|
-
const
|
|
2034
|
-
this.idToRemoteMap[
|
|
2035
|
-
name: r.name,
|
|
2036
|
-
expose: s
|
|
2037
|
-
};
|
|
1992
|
+
if (c && t.startsWith(c)) {
|
|
1993
|
+
const a = t.replace(c, i);
|
|
1994
|
+
this.idToRemoteMap[a] = { name: n.name, expose: s };
|
|
2038
1995
|
}
|
|
2039
1996
|
}
|
|
2040
1997
|
// eslint-disable-next-line max-lines-per-function
|
|
2041
1998
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2042
|
-
async loadRemote(t,
|
|
2043
|
-
const { host:
|
|
1999
|
+
async loadRemote(t, o) {
|
|
2000
|
+
const { host: n } = this;
|
|
2044
2001
|
try {
|
|
2045
|
-
const { loadFactory: s = !0 } =
|
|
2002
|
+
const { loadFactory: s = !0 } = o || {
|
|
2046
2003
|
loadFactory: !0
|
|
2047
|
-
}, { module:
|
|
2004
|
+
}, { module: i, moduleOptions: c, remoteMatchInfo: a } = await this.getRemoteModuleAndOptions({
|
|
2048
2005
|
id: t
|
|
2049
|
-
}), { pkgNameOrAlias:
|
|
2050
|
-
id:
|
|
2051
|
-
pkgNameOrAlias:
|
|
2006
|
+
}), { pkgNameOrAlias: l, remote: u, expose: d, id: y, remoteSnapshot: p } = a, m = await i.get(y, d, o, p), g = await this.hooks.lifecycle.onLoad.emit({
|
|
2007
|
+
id: y,
|
|
2008
|
+
pkgNameOrAlias: l,
|
|
2052
2009
|
expose: d,
|
|
2053
|
-
exposeModule: s ?
|
|
2054
|
-
exposeModuleFactory: s ? void 0 :
|
|
2010
|
+
exposeModule: s ? m : void 0,
|
|
2011
|
+
exposeModuleFactory: s ? void 0 : m,
|
|
2055
2012
|
remote: u,
|
|
2056
|
-
options:
|
|
2057
|
-
moduleInstance:
|
|
2058
|
-
origin:
|
|
2013
|
+
options: c,
|
|
2014
|
+
moduleInstance: i,
|
|
2015
|
+
origin: n
|
|
2059
2016
|
});
|
|
2060
|
-
return this.setIdToRemoteMap(t,
|
|
2017
|
+
return this.setIdToRemoteMap(t, a), typeof g == "function" ? g : m;
|
|
2061
2018
|
} catch (s) {
|
|
2062
|
-
const { from:
|
|
2063
|
-
from: "runtime"
|
|
2064
|
-
}, l = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2019
|
+
const { from: i = "runtime" } = o || { from: "runtime" }, c = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2065
2020
|
id: t,
|
|
2066
2021
|
error: s,
|
|
2067
|
-
from:
|
|
2022
|
+
from: i,
|
|
2068
2023
|
lifecycle: "onLoad",
|
|
2069
|
-
origin:
|
|
2024
|
+
origin: n
|
|
2070
2025
|
});
|
|
2071
|
-
if (!
|
|
2026
|
+
if (!c)
|
|
2072
2027
|
throw s;
|
|
2073
|
-
return
|
|
2028
|
+
return c;
|
|
2074
2029
|
}
|
|
2075
2030
|
}
|
|
2076
2031
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2077
2032
|
async preloadRemote(t) {
|
|
2078
|
-
const { host:
|
|
2033
|
+
const { host: o } = this;
|
|
2079
2034
|
await this.hooks.lifecycle.beforePreloadRemote.emit({
|
|
2080
2035
|
preloadOps: t,
|
|
2081
|
-
options:
|
|
2082
|
-
origin:
|
|
2036
|
+
options: o.options,
|
|
2037
|
+
origin: o
|
|
2083
2038
|
});
|
|
2084
|
-
const
|
|
2085
|
-
await Promise.all(
|
|
2086
|
-
const { remote:
|
|
2087
|
-
moduleInfo:
|
|
2039
|
+
const n = formatPreloadArgs(o.options.remotes, t);
|
|
2040
|
+
await Promise.all(n.map(async (s) => {
|
|
2041
|
+
const { remote: i } = s, c = getRemoteInfo(i), { globalSnapshot: a, remoteSnapshot: l } = await o.snapshotHandler.loadRemoteSnapshotInfo({
|
|
2042
|
+
moduleInfo: i
|
|
2088
2043
|
}), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
2089
|
-
origin:
|
|
2044
|
+
origin: o,
|
|
2090
2045
|
preloadOptions: s,
|
|
2091
|
-
remote:
|
|
2092
|
-
remoteInfo:
|
|
2093
|
-
globalSnapshot:
|
|
2094
|
-
remoteSnapshot:
|
|
2046
|
+
remote: i,
|
|
2047
|
+
remoteInfo: c,
|
|
2048
|
+
globalSnapshot: a,
|
|
2049
|
+
remoteSnapshot: l
|
|
2095
2050
|
});
|
|
2096
|
-
u && preloadAssets(
|
|
2051
|
+
u && preloadAssets(c, o, u);
|
|
2097
2052
|
}));
|
|
2098
2053
|
}
|
|
2099
|
-
registerRemotes(t,
|
|
2100
|
-
const { host:
|
|
2054
|
+
registerRemotes(t, o) {
|
|
2055
|
+
const { host: n } = this;
|
|
2101
2056
|
t.forEach((s) => {
|
|
2102
|
-
this.registerRemote(s,
|
|
2103
|
-
force:
|
|
2057
|
+
this.registerRemote(s, n.options.remotes, {
|
|
2058
|
+
force: o == null ? void 0 : o.force
|
|
2104
2059
|
});
|
|
2105
2060
|
});
|
|
2106
2061
|
}
|
|
2107
2062
|
async getRemoteModuleAndOptions(t) {
|
|
2108
|
-
const { host:
|
|
2063
|
+
const { host: o } = this, { id: n } = t;
|
|
2109
2064
|
let s;
|
|
2110
2065
|
try {
|
|
2111
2066
|
s = await this.hooks.lifecycle.beforeRequest.emit({
|
|
2112
|
-
id:
|
|
2113
|
-
options:
|
|
2114
|
-
origin:
|
|
2067
|
+
id: n,
|
|
2068
|
+
options: o.options,
|
|
2069
|
+
origin: o
|
|
2115
2070
|
});
|
|
2116
|
-
} catch (
|
|
2071
|
+
} catch (g) {
|
|
2117
2072
|
if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2118
|
-
id:
|
|
2119
|
-
options:
|
|
2120
|
-
origin:
|
|
2073
|
+
id: n,
|
|
2074
|
+
options: o.options,
|
|
2075
|
+
origin: o,
|
|
2121
2076
|
from: "runtime",
|
|
2122
|
-
error:
|
|
2077
|
+
error: g,
|
|
2123
2078
|
lifecycle: "beforeRequest"
|
|
2124
2079
|
}), !s)
|
|
2125
|
-
throw
|
|
2080
|
+
throw g;
|
|
2126
2081
|
}
|
|
2127
|
-
const { id:
|
|
2128
|
-
assert(
|
|
2129
|
-
hostName:
|
|
2130
|
-
requestId:
|
|
2082
|
+
const { id: i } = s, c = matchRemoteWithNameAndExpose(o.options.remotes, i);
|
|
2083
|
+
assert(c, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
|
|
2084
|
+
hostName: o.options.name,
|
|
2085
|
+
requestId: i
|
|
2131
2086
|
}));
|
|
2132
|
-
const { remote:
|
|
2133
|
-
id:
|
|
2134
|
-
|
|
2135
|
-
options:
|
|
2136
|
-
origin:
|
|
2137
|
-
remoteInfo:
|
|
2138
|
-
})
|
|
2139
|
-
assert(d &&
|
|
2140
|
-
let
|
|
2141
|
-
const
|
|
2142
|
-
host:
|
|
2143
|
-
remoteInfo:
|
|
2087
|
+
const { remote: a } = c, l = getRemoteInfo(a), u = await o.sharedHandler.hooks.lifecycle.afterResolve.emit({
|
|
2088
|
+
id: i,
|
|
2089
|
+
...c,
|
|
2090
|
+
options: o.options,
|
|
2091
|
+
origin: o,
|
|
2092
|
+
remoteInfo: l
|
|
2093
|
+
}), { remote: d, expose: y } = u;
|
|
2094
|
+
assert(d && y, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);
|
|
2095
|
+
let p = o.moduleCache.get(d.name);
|
|
2096
|
+
const m = {
|
|
2097
|
+
host: o,
|
|
2098
|
+
remoteInfo: l
|
|
2144
2099
|
};
|
|
2145
|
-
return
|
|
2146
|
-
module:
|
|
2147
|
-
moduleOptions:
|
|
2100
|
+
return p || (p = new Module(m), o.moduleCache.set(d.name, p)), {
|
|
2101
|
+
module: p,
|
|
2102
|
+
moduleOptions: m,
|
|
2148
2103
|
remoteMatchInfo: u
|
|
2149
2104
|
};
|
|
2150
2105
|
}
|
|
2151
|
-
registerRemote(t,
|
|
2152
|
-
const { host: s } = this,
|
|
2106
|
+
registerRemote(t, o, n) {
|
|
2107
|
+
const { host: s } = this, i = () => {
|
|
2153
2108
|
if (t.alias) {
|
|
2154
|
-
const
|
|
2109
|
+
const a = o.find((l) => {
|
|
2155
2110
|
var u;
|
|
2156
|
-
return t.alias && (
|
|
2111
|
+
return t.alias && (l.name.startsWith(t.alias) || ((u = l.alias) == null ? void 0 : u.startsWith(t.alias)));
|
|
2157
2112
|
});
|
|
2158
|
-
assert(!
|
|
2113
|
+
assert(!a, `The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a && a.name} name or alias`);
|
|
2159
2114
|
}
|
|
2160
2115
|
"entry" in t && isBrowserEnv() && !t.entry.startsWith("http") && (t.entry = new URL(t.entry, window.location.origin).href), t.shareScope || (t.shareScope = DEFAULT_SCOPE), t.type || (t.type = DEFAULT_REMOTE_TYPE);
|
|
2161
2116
|
};
|
|
2162
|
-
this.hooks.lifecycle.beforeRegisterRemote.emit({
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
const l = n.find((i) => i.name === t.name);
|
|
2167
|
-
if (!l)
|
|
2168
|
-
a(), n.push(t), this.hooks.lifecycle.registerRemote.emit({
|
|
2169
|
-
remote: t,
|
|
2170
|
-
origin: s
|
|
2171
|
-
});
|
|
2117
|
+
this.hooks.lifecycle.beforeRegisterRemote.emit({ remote: t, origin: s });
|
|
2118
|
+
const c = o.find((a) => a.name === t.name);
|
|
2119
|
+
if (!c)
|
|
2120
|
+
i(), o.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s });
|
|
2172
2121
|
else {
|
|
2173
|
-
const
|
|
2122
|
+
const a = [
|
|
2174
2123
|
`The remote "${t.name}" is already registered.`,
|
|
2175
2124
|
"Please note that overriding it may cause unexpected errors."
|
|
2176
2125
|
];
|
|
2177
|
-
|
|
2178
|
-
remote: t,
|
|
2179
|
-
origin: s
|
|
2180
|
-
}), warn$1(i.join(" ")));
|
|
2126
|
+
n != null && n.force && (this.removeRemote(c), i(), o.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s }), warn$1(a.join(" ")));
|
|
2181
2127
|
}
|
|
2182
2128
|
}
|
|
2183
2129
|
removeRemote(t) {
|
|
2130
|
+
var o;
|
|
2184
2131
|
try {
|
|
2185
|
-
const { host:
|
|
2186
|
-
|
|
2187
|
-
const
|
|
2188
|
-
if (
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
A && Object.keys(A).forEach((T) => {
|
|
2211
|
-
const $ = A[T];
|
|
2212
|
-
$ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((w) => w !== i.name), $.useIn.length ? g = !1 : _.push([
|
|
2132
|
+
const { host: n } = this, { name: s } = t, i = n.options.remotes.findIndex((a) => a.name === s);
|
|
2133
|
+
i !== -1 && n.options.remotes.splice(i, 1);
|
|
2134
|
+
const c = n.moduleCache.get(t.name);
|
|
2135
|
+
if (c) {
|
|
2136
|
+
const a = c.remoteInfo, l = a.entryGlobalName;
|
|
2137
|
+
CurrentGlobal[l] && ((o = Object.getOwnPropertyDescriptor(CurrentGlobal, l)) != null && o.configurable ? delete CurrentGlobal[l] : CurrentGlobal[l] = void 0);
|
|
2138
|
+
const u = getRemoteEntryUniqueKey(c.remoteInfo);
|
|
2139
|
+
globalLoading[u] && delete globalLoading[u], n.snapshotHandler.manifestCache.delete(a.entry);
|
|
2140
|
+
let d = a.buildVersion ? composeKeyWithSeparator(a.name, a.buildVersion) : a.name;
|
|
2141
|
+
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((m) => a.buildVersion ? m.options.id === d : m.name === d);
|
|
2142
|
+
if (y !== -1) {
|
|
2143
|
+
const m = CurrentGlobal.__FEDERATION__.__INSTANCES__[y];
|
|
2144
|
+
d = m.options.id || d;
|
|
2145
|
+
const g = getGlobalShareScope();
|
|
2146
|
+
let _ = !0;
|
|
2147
|
+
const E = [];
|
|
2148
|
+
Object.keys(g).forEach((b) => {
|
|
2149
|
+
const S = g[b];
|
|
2150
|
+
S && Object.keys(S).forEach((I) => {
|
|
2151
|
+
const A = S[I];
|
|
2152
|
+
A && Object.keys(A).forEach((R) => {
|
|
2153
|
+
const T = A[R];
|
|
2154
|
+
T && Object.keys(T).forEach((w) => {
|
|
2155
|
+
const $ = T[w];
|
|
2156
|
+
$ && typeof $ == "object" && $.from === a.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((P) => P !== a.name), $.useIn.length ? _ = !1 : E.push([
|
|
2213
2157
|
b,
|
|
2214
2158
|
I,
|
|
2215
2159
|
R,
|
|
2216
|
-
|
|
2217
|
-
])) :
|
|
2160
|
+
w
|
|
2161
|
+
])) : E.push([
|
|
2218
2162
|
b,
|
|
2219
2163
|
I,
|
|
2220
2164
|
R,
|
|
2221
|
-
|
|
2165
|
+
w
|
|
2222
2166
|
]));
|
|
2223
2167
|
});
|
|
2224
2168
|
});
|
|
2225
2169
|
});
|
|
2226
|
-
}),
|
|
2227
|
-
var R,
|
|
2228
|
-
(T =
|
|
2229
|
-
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(
|
|
2170
|
+
}), _ && (m.shareScopeMap = {}, delete g[d]), E.forEach(([b, S, I, A]) => {
|
|
2171
|
+
var R, T, w;
|
|
2172
|
+
(w = (T = (R = g[b]) == null ? void 0 : R[S]) == null ? void 0 : T[I]) == null || delete w[A];
|
|
2173
|
+
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(y, 1);
|
|
2230
2174
|
}
|
|
2231
|
-
const { hostGlobalSnapshot:
|
|
2232
|
-
if (
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2175
|
+
const { hostGlobalSnapshot: p } = getGlobalRemoteInfo(t, n);
|
|
2176
|
+
if (p) {
|
|
2177
|
+
const m = p && "remotesInfo" in p && p.remotesInfo && getInfoWithoutType(p.remotesInfo, t.name).key;
|
|
2178
|
+
m && (delete p.remotesInfo[m], Global.__FEDERATION__.__MANIFEST_LOADING__[m] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[m]);
|
|
2235
2179
|
}
|
|
2236
|
-
|
|
2180
|
+
n.moduleCache.delete(t.name);
|
|
2237
2181
|
}
|
|
2238
|
-
} catch (
|
|
2239
|
-
logger.log("removeRemote fail: ",
|
|
2182
|
+
} catch (n) {
|
|
2183
|
+
logger.log("removeRemote fail: ", n);
|
|
2240
2184
|
}
|
|
2241
2185
|
}
|
|
2242
|
-
constructor(t) {
|
|
2243
|
-
this.hooks = new PluginSystem({
|
|
2244
|
-
beforeRegisterRemote: new SyncWaterfallHook("beforeRegisterRemote"),
|
|
2245
|
-
registerRemote: new SyncWaterfallHook("registerRemote"),
|
|
2246
|
-
beforeRequest: new AsyncWaterfallHook("beforeRequest"),
|
|
2247
|
-
onLoad: new AsyncHook("onLoad"),
|
|
2248
|
-
handlePreloadModule: new SyncHook("handlePreloadModule"),
|
|
2249
|
-
errorLoadRemote: new AsyncHook("errorLoadRemote"),
|
|
2250
|
-
beforePreloadRemote: new AsyncHook("beforePreloadRemote"),
|
|
2251
|
-
generatePreloadAssets: new AsyncHook("generatePreloadAssets"),
|
|
2252
|
-
// not used yet
|
|
2253
|
-
afterPreloadRemote: new AsyncHook(),
|
|
2254
|
-
loadEntry: new AsyncHook()
|
|
2255
|
-
}), this.host = t, this.idToRemoteMap = {};
|
|
2256
|
-
}
|
|
2257
2186
|
}
|
|
2258
2187
|
const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN == "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : !0;
|
|
2259
2188
|
class ModuleFederation {
|
|
2189
|
+
constructor(t) {
|
|
2190
|
+
this.hooks = new PluginSystem({
|
|
2191
|
+
beforeInit: new SyncWaterfallHook("beforeInit"),
|
|
2192
|
+
init: new SyncHook(),
|
|
2193
|
+
// maybe will change, temporarily for internal use only
|
|
2194
|
+
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2195
|
+
// maybe will change, temporarily for internal use only
|
|
2196
|
+
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2197
|
+
}), this.version = "0.0.0-perf-devtools-20260106124142", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2198
|
+
// FIXME: may not be suitable , not open to the public yet
|
|
2199
|
+
getModuleInfo: new SyncHook(),
|
|
2200
|
+
createScript: new SyncHook(),
|
|
2201
|
+
createLink: new SyncHook(),
|
|
2202
|
+
fetch: new AsyncHook(),
|
|
2203
|
+
loadEntryError: new AsyncHook(),
|
|
2204
|
+
getModuleFactory: new AsyncHook()
|
|
2205
|
+
}), this.bridgeHook = new PluginSystem({
|
|
2206
|
+
beforeBridgeRender: new SyncHook(),
|
|
2207
|
+
afterBridgeRender: new SyncHook(),
|
|
2208
|
+
beforeBridgeDestroy: new SyncHook(),
|
|
2209
|
+
afterBridgeDestroy: new SyncHook()
|
|
2210
|
+
});
|
|
2211
|
+
const o = USE_SNAPSHOT ? [snapshotPlugin(), generatePreloadAssetsPlugin()] : [], n = {
|
|
2212
|
+
id: getBuilderId(),
|
|
2213
|
+
name: t.name,
|
|
2214
|
+
plugins: o,
|
|
2215
|
+
remotes: [],
|
|
2216
|
+
shared: {},
|
|
2217
|
+
inBrowser: isBrowserEnv()
|
|
2218
|
+
};
|
|
2219
|
+
this.name = t.name, this.options = n, this.snapshotHandler = new SnapshotHandler(this), this.sharedHandler = new SharedHandler(this), this.remoteHandler = new RemoteHandler(this), this.shareScopeMap = this.sharedHandler.shareScopeMap, this.registerPlugins([
|
|
2220
|
+
...n.plugins,
|
|
2221
|
+
...t.plugins || []
|
|
2222
|
+
]), this.options = this.formatOptions(n, t);
|
|
2223
|
+
}
|
|
2260
2224
|
initOptions(t) {
|
|
2261
2225
|
this.registerPlugins(t.plugins);
|
|
2262
|
-
const
|
|
2263
|
-
return this.options =
|
|
2226
|
+
const o = this.formatOptions(this.options, t);
|
|
2227
|
+
return this.options = o, o;
|
|
2264
2228
|
}
|
|
2265
|
-
async loadShare(t,
|
|
2266
|
-
return this.sharedHandler.loadShare(t,
|
|
2229
|
+
async loadShare(t, o) {
|
|
2230
|
+
return this.sharedHandler.loadShare(t, o);
|
|
2267
2231
|
}
|
|
2268
2232
|
// The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
|
|
2269
2233
|
// 1. If the loaded shared already exists globally, then it will be reused
|
|
2270
2234
|
// 2. If lib exists in local shared, it will be used directly
|
|
2271
2235
|
// 3. If the local get returns something other than Promise, then it will be used directly
|
|
2272
|
-
loadShareSync(t,
|
|
2273
|
-
return this.sharedHandler.loadShareSync(t,
|
|
2274
|
-
}
|
|
2275
|
-
initializeSharing(t = DEFAULT_SCOPE,
|
|
2276
|
-
return this.sharedHandler.initializeSharing(t,
|
|
2277
|
-
}
|
|
2278
|
-
initRawContainer(t,
|
|
2279
|
-
const s = getRemoteInfo({
|
|
2280
|
-
|
|
2281
|
-
entry: n
|
|
2282
|
-
}), a = new Module({
|
|
2283
|
-
host: this,
|
|
2284
|
-
remoteInfo: s
|
|
2285
|
-
});
|
|
2286
|
-
return a.remoteEntryExports = r, this.moduleCache.set(t, a), a;
|
|
2236
|
+
loadShareSync(t, o) {
|
|
2237
|
+
return this.sharedHandler.loadShareSync(t, o);
|
|
2238
|
+
}
|
|
2239
|
+
initializeSharing(t = DEFAULT_SCOPE, o) {
|
|
2240
|
+
return this.sharedHandler.initializeSharing(t, o);
|
|
2241
|
+
}
|
|
2242
|
+
initRawContainer(t, o, n) {
|
|
2243
|
+
const s = getRemoteInfo({ name: t, entry: o }), i = new Module({ host: this, remoteInfo: s });
|
|
2244
|
+
return i.remoteEntryExports = n, this.moduleCache.set(t, i), i;
|
|
2287
2245
|
}
|
|
2288
2246
|
// eslint-disable-next-line max-lines-per-function
|
|
2289
2247
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2290
|
-
async loadRemote(t,
|
|
2291
|
-
return this.remoteHandler.loadRemote(t,
|
|
2248
|
+
async loadRemote(t, o) {
|
|
2249
|
+
return this.remoteHandler.loadRemote(t, o);
|
|
2292
2250
|
}
|
|
2293
2251
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2294
2252
|
async preloadRemote(t) {
|
|
2295
2253
|
return this.remoteHandler.preloadRemote(t);
|
|
2296
2254
|
}
|
|
2297
|
-
initShareScopeMap(t,
|
|
2298
|
-
this.sharedHandler.initShareScopeMap(t,
|
|
2255
|
+
initShareScopeMap(t, o, n = {}) {
|
|
2256
|
+
this.sharedHandler.initShareScopeMap(t, o, n);
|
|
2299
2257
|
}
|
|
2300
|
-
formatOptions(t,
|
|
2301
|
-
const { shared:
|
|
2258
|
+
formatOptions(t, o) {
|
|
2259
|
+
const { shared: n } = formatShareConfigs(t, o), { userOptions: s, options: i } = this.hooks.lifecycle.beforeInit.emit({
|
|
2302
2260
|
origin: this,
|
|
2303
|
-
userOptions:
|
|
2261
|
+
userOptions: o,
|
|
2304
2262
|
options: t,
|
|
2305
|
-
shareInfo:
|
|
2306
|
-
}),
|
|
2307
|
-
...a.plugins
|
|
2308
|
-
];
|
|
2263
|
+
shareInfo: n
|
|
2264
|
+
}), c = this.remoteHandler.formatAndRegisterRemote(i, s), { shared: a } = this.sharedHandler.registerShared(i, s), l = [...i.plugins];
|
|
2309
2265
|
s.plugins && s.plugins.forEach((d) => {
|
|
2310
|
-
|
|
2311
|
-
});
|
|
2312
|
-
const u = _extends$1({}, t, n, {
|
|
2313
|
-
plugins: c,
|
|
2314
|
-
remotes: l,
|
|
2315
|
-
shared: i
|
|
2266
|
+
l.includes(d) || l.push(d);
|
|
2316
2267
|
});
|
|
2268
|
+
const u = {
|
|
2269
|
+
...t,
|
|
2270
|
+
...o,
|
|
2271
|
+
plugins: l,
|
|
2272
|
+
remotes: c,
|
|
2273
|
+
shared: a
|
|
2274
|
+
};
|
|
2317
2275
|
return this.hooks.lifecycle.init.emit({
|
|
2318
2276
|
origin: this,
|
|
2319
2277
|
options: u
|
|
2320
2278
|
}), u;
|
|
2321
2279
|
}
|
|
2322
2280
|
registerPlugins(t) {
|
|
2323
|
-
const
|
|
2324
|
-
this.options.plugins = this.options.plugins.reduce((
|
|
2281
|
+
const o = registerPlugins(t, this);
|
|
2282
|
+
this.options.plugins = this.options.plugins.reduce((n, s) => (s && n && !n.find((i) => i.name === s.name) && n.push(s), n), o || []);
|
|
2325
2283
|
}
|
|
2326
|
-
registerRemotes(t,
|
|
2327
|
-
return this.remoteHandler.registerRemotes(t,
|
|
2284
|
+
registerRemotes(t, o) {
|
|
2285
|
+
return this.remoteHandler.registerRemotes(t, o);
|
|
2328
2286
|
}
|
|
2329
2287
|
registerShared(t) {
|
|
2330
|
-
this.sharedHandler.registerShared(this.options,
|
|
2288
|
+
this.sharedHandler.registerShared(this.options, {
|
|
2289
|
+
...this.options,
|
|
2331
2290
|
shared: t
|
|
2332
|
-
}));
|
|
2333
|
-
}
|
|
2334
|
-
constructor(t) {
|
|
2335
|
-
this.hooks = new PluginSystem({
|
|
2336
|
-
beforeInit: new SyncWaterfallHook("beforeInit"),
|
|
2337
|
-
init: new SyncHook(),
|
|
2338
|
-
// maybe will change, temporarily for internal use only
|
|
2339
|
-
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2340
|
-
// maybe will change, temporarily for internal use only
|
|
2341
|
-
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2342
|
-
}), this.version = "0.0.0-next-20250926024003", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2343
|
-
// FIXME: may not be suitable , not open to the public yet
|
|
2344
|
-
getModuleInfo: new SyncHook(),
|
|
2345
|
-
createScript: new SyncHook(),
|
|
2346
|
-
createLink: new SyncHook(),
|
|
2347
|
-
fetch: new AsyncHook(),
|
|
2348
|
-
loadEntryError: new AsyncHook(),
|
|
2349
|
-
getModuleFactory: new AsyncHook()
|
|
2350
|
-
}), this.bridgeHook = new PluginSystem({
|
|
2351
|
-
beforeBridgeRender: new SyncHook(),
|
|
2352
|
-
afterBridgeRender: new SyncHook(),
|
|
2353
|
-
beforeBridgeDestroy: new SyncHook(),
|
|
2354
|
-
afterBridgeDestroy: new SyncHook()
|
|
2355
2291
|
});
|
|
2356
|
-
const n = USE_SNAPSHOT ? [
|
|
2357
|
-
snapshotPlugin(),
|
|
2358
|
-
generatePreloadAssetsPlugin()
|
|
2359
|
-
] : [], r = {
|
|
2360
|
-
id: getBuilderId(),
|
|
2361
|
-
name: t.name,
|
|
2362
|
-
plugins: n,
|
|
2363
|
-
remotes: [],
|
|
2364
|
-
shared: {},
|
|
2365
|
-
inBrowser: isBrowserEnv()
|
|
2366
|
-
};
|
|
2367
|
-
this.name = t.name, this.options = r, this.snapshotHandler = new SnapshotHandler(this), this.sharedHandler = new SharedHandler(this), this.remoteHandler = new RemoteHandler(this), this.shareScopeMap = this.sharedHandler.shareScopeMap, this.registerPlugins([
|
|
2368
|
-
...r.plugins,
|
|
2369
|
-
...t.plugins || []
|
|
2370
|
-
]), this.options = this.formatOptions(r, t);
|
|
2371
2292
|
}
|
|
2372
2293
|
}
|
|
2373
2294
|
let FederationInstance = null;
|
|
@@ -2375,58 +2296,105 @@ function getInstance() {
|
|
|
2375
2296
|
return FederationInstance;
|
|
2376
2297
|
}
|
|
2377
2298
|
setGlobalFederationConstructor(ModuleFederation);
|
|
2378
|
-
function
|
|
2379
|
-
|
|
2299
|
+
function addBasenameToNestedRoutes(r, t) {
|
|
2300
|
+
return r.map((o) => {
|
|
2301
|
+
const n = {
|
|
2302
|
+
...o,
|
|
2303
|
+
path: t + o.path
|
|
2304
|
+
};
|
|
2305
|
+
return o.children && o.children.length > 0 && (n.children = addBasenameToNestedRoutes(
|
|
2306
|
+
o.children,
|
|
2307
|
+
t
|
|
2308
|
+
)), n;
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
function processRoutes(r) {
|
|
2312
|
+
const { router: t, basename: o, memoryRoute: n, hashRoute: s } = r, i = t.getRoutes().sort(
|
|
2313
|
+
(p, m) => p.path.split("/").filter((g) => g).length - m.path.split("/").filter((g) => g).length
|
|
2314
|
+
), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
2315
|
+
i.forEach((p) => {
|
|
2316
|
+
c.set(p.path, p);
|
|
2317
|
+
});
|
|
2318
|
+
const l = (p, m) => `${p}/${m}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/", u = (p, m = "") => {
|
|
2319
|
+
if (!p.children || p.children.length === 0)
|
|
2320
|
+
return p;
|
|
2321
|
+
for (let g = 0; g < p.children.length; g++) {
|
|
2322
|
+
const _ = p.children[g], E = l(m, _.path), b = c.get(E);
|
|
2323
|
+
if (b && !a.has(b)) {
|
|
2324
|
+
const S = {
|
|
2325
|
+
...b,
|
|
2326
|
+
path: _.path
|
|
2327
|
+
// Keep the original relative path from static route
|
|
2328
|
+
};
|
|
2329
|
+
p.children[g] = S, a.add(b), u(S, E);
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
return p;
|
|
2333
|
+
};
|
|
2334
|
+
let d = [];
|
|
2335
|
+
for (const p of i)
|
|
2336
|
+
if (!a.has(p)) {
|
|
2337
|
+
const m = u(p, p.path);
|
|
2338
|
+
a.add(p), d.push(m);
|
|
2339
|
+
}
|
|
2340
|
+
let y;
|
|
2341
|
+
return n ? y = VueRouter.createMemoryHistory(o) : s ? (y = VueRouter.createWebHashHistory(), o && (d = addBasenameToNestedRoutes(d, o))) : y = VueRouter.createWebHistory(o), {
|
|
2342
|
+
history: y,
|
|
2343
|
+
routes: d
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
function createBridgeComponent(r) {
|
|
2347
|
+
const t = /* @__PURE__ */ new Map(), o = getInstance();
|
|
2380
2348
|
return () => ({
|
|
2381
|
-
__APP_VERSION__: "0.0.0-
|
|
2382
|
-
async render(
|
|
2383
|
-
var
|
|
2384
|
-
LoggerInstance.debug("createBridgeComponent render Info",
|
|
2349
|
+
__APP_VERSION__: "0.0.0-perf-devtools-20260106124142",
|
|
2350
|
+
async render(n) {
|
|
2351
|
+
var g, _, E;
|
|
2352
|
+
LoggerInstance.debug("createBridgeComponent render Info", n);
|
|
2385
2353
|
const {
|
|
2386
2354
|
moduleName: s,
|
|
2387
|
-
dom:
|
|
2388
|
-
basename:
|
|
2389
|
-
memoryRoute:
|
|
2390
|
-
hashRoute:
|
|
2355
|
+
dom: i,
|
|
2356
|
+
basename: c,
|
|
2357
|
+
memoryRoute: a,
|
|
2358
|
+
hashRoute: l,
|
|
2391
2359
|
...u
|
|
2392
|
-
} =
|
|
2393
|
-
t.set(
|
|
2394
|
-
const
|
|
2360
|
+
} = n, d = Vue.createApp(r.rootComponent, u);
|
|
2361
|
+
t.set(i, d);
|
|
2362
|
+
const y = await ((E = (_ = (g = o == null ? void 0 : o.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : _.beforeBridgeRender) == null ? void 0 : E.emit(n)), p = y && typeof y == "object" && (y != null && y.extraProps) ? y == null ? void 0 : y.extraProps : {}, m = r.appOptions({
|
|
2395
2363
|
app: d,
|
|
2396
|
-
basename:
|
|
2397
|
-
memoryRoute:
|
|
2398
|
-
hashRoute:
|
|
2364
|
+
basename: c,
|
|
2365
|
+
memoryRoute: a,
|
|
2366
|
+
hashRoute: l,
|
|
2399
2367
|
...u,
|
|
2400
|
-
...
|
|
2368
|
+
...p
|
|
2401
2369
|
});
|
|
2402
|
-
if (
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
...
|
|
2370
|
+
if (m != null && m.router) {
|
|
2371
|
+
const { history: b, routes: S } = processRoutes({
|
|
2372
|
+
router: m.router,
|
|
2373
|
+
basename: n.basename,
|
|
2374
|
+
memoryRoute: n.memoryRoute,
|
|
2375
|
+
hashRoute: n.hashRoute
|
|
2376
|
+
}), I = VueRouter.createRouter({
|
|
2377
|
+
...m.router.options,
|
|
2410
2378
|
history: b,
|
|
2411
|
-
routes:
|
|
2379
|
+
routes: S
|
|
2412
2380
|
});
|
|
2413
2381
|
LoggerInstance.debug("createBridgeComponent render router info>>>", {
|
|
2414
2382
|
moduleName: s,
|
|
2415
2383
|
router: I
|
|
2416
|
-
}),
|
|
2384
|
+
}), a && await I.push(a.entryPath), d.use(I);
|
|
2417
2385
|
}
|
|
2418
|
-
d.mount(
|
|
2386
|
+
d.mount(i);
|
|
2419
2387
|
},
|
|
2420
|
-
destroy(
|
|
2421
|
-
LoggerInstance.debug("createBridgeComponent destroy Info",
|
|
2422
|
-
const s = t.get(
|
|
2388
|
+
destroy(n) {
|
|
2389
|
+
LoggerInstance.debug("createBridgeComponent destroy Info", n);
|
|
2390
|
+
const s = t.get(n == null ? void 0 : n.dom);
|
|
2423
2391
|
s == null || s.unmount();
|
|
2424
2392
|
}
|
|
2425
2393
|
});
|
|
2426
2394
|
}
|
|
2427
2395
|
function e() {
|
|
2428
|
-
const
|
|
2429
|
-
window.dispatchEvent(
|
|
2396
|
+
const r = new PopStateEvent("popstate", { state: window.history.state });
|
|
2397
|
+
window.dispatchEvent(r);
|
|
2430
2398
|
}
|
|
2431
2399
|
const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
2432
2400
|
name: "RemoteApp",
|
|
@@ -2439,76 +2407,76 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2439
2407
|
rootAttrs: Object
|
|
2440
2408
|
},
|
|
2441
2409
|
inheritAttrs: !1,
|
|
2442
|
-
setup(
|
|
2443
|
-
const t = ref(null),
|
|
2444
|
-
var
|
|
2445
|
-
const u = (
|
|
2446
|
-
|
|
2410
|
+
setup(r) {
|
|
2411
|
+
const t = ref(null), o = ref(null), n = ref(""), s = useRoute(), i = getInstance(), c = useAttrs(), a = async () => {
|
|
2412
|
+
var p, m, g, _;
|
|
2413
|
+
const u = (p = r.providerInfo) == null ? void 0 : p.call(r);
|
|
2414
|
+
o.value = u;
|
|
2447
2415
|
let d = {
|
|
2448
|
-
...
|
|
2449
|
-
moduleName:
|
|
2416
|
+
...c,
|
|
2417
|
+
moduleName: r.moduleName,
|
|
2450
2418
|
dom: t.value,
|
|
2451
|
-
basename:
|
|
2452
|
-
memoryRoute:
|
|
2453
|
-
hashRoute:
|
|
2419
|
+
basename: r.basename,
|
|
2420
|
+
memoryRoute: r.memoryRoute,
|
|
2421
|
+
hashRoute: r.hashRoute
|
|
2454
2422
|
};
|
|
2455
2423
|
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>", d);
|
|
2456
|
-
const
|
|
2424
|
+
const y = await ((_ = (g = (m = i == null ? void 0 : i.bridgeHook) == null ? void 0 : m.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : _.emit(d)) || {};
|
|
2457
2425
|
d = {
|
|
2458
2426
|
...d,
|
|
2459
|
-
...
|
|
2427
|
+
...y.extraProps
|
|
2460
2428
|
}, u.render(d);
|
|
2461
|
-
},
|
|
2462
|
-
u !== s.path &&
|
|
2463
|
-
...
|
|
2429
|
+
}, l = watch(() => s == null ? void 0 : s.path, (u) => {
|
|
2430
|
+
u !== s.path && a(), n.value !== "" && n.value !== u && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
|
|
2431
|
+
...r,
|
|
2464
2432
|
pathname: s.path
|
|
2465
|
-
}), e()),
|
|
2433
|
+
}), e()), n.value = u;
|
|
2466
2434
|
});
|
|
2467
2435
|
return onMounted(() => {
|
|
2468
|
-
|
|
2436
|
+
a();
|
|
2469
2437
|
}), onBeforeUnmount(() => {
|
|
2470
2438
|
var u;
|
|
2471
2439
|
LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>", {
|
|
2472
|
-
...
|
|
2473
|
-
}),
|
|
2440
|
+
...r
|
|
2441
|
+
}), l(), (u = o.value) == null || u.destroy({
|
|
2474
2442
|
dom: t.value
|
|
2475
2443
|
});
|
|
2476
|
-
}), () => createVNode("div", mergeProps(
|
|
2444
|
+
}), () => createVNode("div", mergeProps(r.rootAttrs || {}, {
|
|
2477
2445
|
ref: t
|
|
2478
2446
|
}), null);
|
|
2479
2447
|
}
|
|
2480
2448
|
});
|
|
2481
|
-
function createRemoteAppComponent(
|
|
2449
|
+
function createRemoteAppComponent(r) {
|
|
2482
2450
|
return defineAsyncComponent({
|
|
2483
|
-
__APP_VERSION__: "0.0.0-
|
|
2484
|
-
...
|
|
2451
|
+
__APP_VERSION__: "0.0.0-perf-devtools-20260106124142",
|
|
2452
|
+
...r.asyncComponentOptions,
|
|
2485
2453
|
//@ts-ignore
|
|
2486
2454
|
loader: async () => {
|
|
2487
|
-
var
|
|
2455
|
+
var l, u;
|
|
2488
2456
|
const t = useRoute();
|
|
2489
|
-
let
|
|
2490
|
-
const
|
|
2491
|
-
|
|
2492
|
-
const s = (
|
|
2457
|
+
let o = "/";
|
|
2458
|
+
const n = (u = (l = t == null ? void 0 : t.matched) == null ? void 0 : l[0]) == null ? void 0 : u.path;
|
|
2459
|
+
n && (n.endsWith("/:pathMatch(.*)*") ? o = n.replace("/:pathMatch(.*)*", "") : o = t.matched[0].path);
|
|
2460
|
+
const s = (r == null ? void 0 : r.export) || "default";
|
|
2493
2461
|
LoggerInstance.debug(
|
|
2494
2462
|
"createRemoteAppComponent LazyComponent create >>>",
|
|
2495
2463
|
{
|
|
2496
|
-
basename:
|
|
2497
|
-
info:
|
|
2464
|
+
basename: o,
|
|
2465
|
+
info: r
|
|
2498
2466
|
}
|
|
2499
2467
|
);
|
|
2500
|
-
const
|
|
2468
|
+
const i = await r.loader(), c = i && i[Symbol.for("mf_module_id")], a = i[s];
|
|
2501
2469
|
if (LoggerInstance.debug(
|
|
2502
2470
|
"createRemoteAppComponent LazyComponent loadRemote info >>>",
|
|
2503
|
-
{ moduleName:
|
|
2504
|
-
), s in
|
|
2471
|
+
{ moduleName: c, module: i, exportName: s, basename: o, route: t }
|
|
2472
|
+
), s in i && typeof a == "function")
|
|
2505
2473
|
return {
|
|
2506
2474
|
render() {
|
|
2507
2475
|
return h(RemoteApp, {
|
|
2508
|
-
moduleName:
|
|
2509
|
-
providerInfo:
|
|
2510
|
-
basename:
|
|
2511
|
-
rootAttrs:
|
|
2476
|
+
moduleName: c,
|
|
2477
|
+
providerInfo: a,
|
|
2478
|
+
basename: o,
|
|
2479
|
+
rootAttrs: r.rootAttrs
|
|
2512
2480
|
});
|
|
2513
2481
|
}
|
|
2514
2482
|
};
|
|
@@ -2516,10 +2484,10 @@ function createRemoteAppComponent(o) {
|
|
|
2516
2484
|
}
|
|
2517
2485
|
});
|
|
2518
2486
|
}
|
|
2519
|
-
function createRemoteComponent(
|
|
2487
|
+
function createRemoteComponent(r) {
|
|
2520
2488
|
return LoggerInstance.warn(
|
|
2521
2489
|
"createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!"
|
|
2522
|
-
), createRemoteAppComponent(
|
|
2490
|
+
), createRemoteAppComponent(r);
|
|
2523
2491
|
}
|
|
2524
2492
|
export {
|
|
2525
2493
|
createBridgeComponent,
|