@module-federation/bridge-react 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/__tests__/bridge.spec.tsx +37 -14
- package/dist/{bridge-base-Ds850AOx.js → bridge-base-Bn6DO0Fi.js} +1 -1
- package/dist/{bridge-base-BwHtOqw_.mjs → bridge-base-DxcR1fja.mjs} +1 -1
- package/dist/data-fetch-server-middleware.cjs.js +2 -2
- package/dist/data-fetch-server-middleware.es.js +2 -2
- package/dist/data-fetch-utils.cjs.js +2 -2
- package/dist/data-fetch-utils.es.js +4 -4
- package/dist/{index-rAO0Wr0M.mjs → index-Dm-M9ouh.mjs} +1 -1
- package/dist/{index-eN2xRRXs.js → index-DqCpgmgH.js} +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +5 -5
- package/dist/{index.esm-Ju4RY-yW.js → index.esm-CzoIcLts.js} +76 -46
- package/dist/{index.esm-CtI0uQUR.mjs → index.esm-JLwyxgUK.mjs} +81 -51
- package/dist/{lazy-load-component-plugin-Dmzr-hGo.mjs → lazy-load-component-plugin-Bcm5-gd8.mjs} +2 -2
- package/dist/{lazy-load-component-plugin-vtpWwn-P.js → lazy-load-component-plugin-C-qNUGjT.js} +2 -2
- package/dist/lazy-load-component-plugin.cjs.js +2 -2
- package/dist/lazy-load-component-plugin.es.js +2 -2
- package/dist/lazy-utils.cjs.js +2 -2
- package/dist/lazy-utils.es.js +2 -2
- package/dist/{prefetch-DtZwviM-.mjs → prefetch-COMVhC39.mjs} +63 -139
- package/dist/{prefetch-HjsWsmMr.js → prefetch-NDhOcbO7.js} +63 -139
- package/dist/router-v5.cjs.js +1 -1
- package/dist/router-v5.es.js +1 -1
- package/dist/router-v6.cjs.js +1 -1
- package/dist/router-v6.es.js +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.es.js +1 -1
- package/dist/{utils-vIpCrZmn.js → utils-0HFFqmd4.js} +1 -1
- package/dist/{utils-VSOJTX_o.mjs → utils-BTpxHmva.mjs} +1 -1
- package/dist/v18.cjs.js +1 -1
- package/dist/v18.es.js +1 -1
- package/dist/v19.cjs.js +1 -1
- package/dist/v19.es.js +1 -1
- package/package.json +6 -6
package/dist/{lazy-load-component-plugin-Dmzr-hGo.mjs → lazy-load-component-plugin-Bcm5-gd8.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as injectDataFetch, p as prefetch } from "./prefetch-
|
|
2
|
-
import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly, a as loadDataFetchModule, M as MF_DATA_FETCH_STATUS, g as getDataFetchMap, t as isServerEnv, u as getDataFetchIdWithErrorMsgs, v as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, w as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, x as DATA_FETCH_FUNCTION, y as getLoadedRemoteInfos, f as fetchData$1, z as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-
|
|
1
|
+
import { i as injectDataFetch, p as prefetch } from "./prefetch-COMVhC39.mjs";
|
|
2
|
+
import { i as initDataFetchMap, j as isDataLoaderExpose, k as getDataFetchInfo, m as getDataFetchMapKey, l as logger, n as getDataFetchItem, o as DATA_FETCH_CLIENT_SUFFIX, p as MF_DATA_FETCH_TYPE, q as isCSROnly, a as loadDataFetchModule, M as MF_DATA_FETCH_STATUS, g as getDataFetchMap, t as isServerEnv, u as getDataFetchIdWithErrorMsgs, v as DATA_FETCH_ERROR_PREFIX, E as ERROR_TYPE, w as wrapDataFetchId, L as LOAD_REMOTE_ERROR_PREFIX, x as DATA_FETCH_FUNCTION, y as getLoadedRemoteInfos, f as fetchData$1, z as setDataFetchItemLoadedStatus, F as FS_HREF } from "./utils-BTpxHmva.mjs";
|
|
3
3
|
import React__default, { useRef, useState, Suspense, useEffect } from "react";
|
|
4
4
|
const autoFetchData = () => {
|
|
5
5
|
initDataFetchMap();
|
package/dist/{lazy-load-component-plugin-vtpWwn-P.js → lazy-load-component-plugin-C-qNUGjT.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const prefetch = require("./prefetch-
|
|
3
|
-
const lazyUtils = require("./utils-
|
|
2
|
+
const prefetch = require("./prefetch-NDhOcbO7.js");
|
|
3
|
+
const lazyUtils = require("./utils-0HFFqmd4.js");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const autoFetchData = () => {
|
|
6
6
|
lazyUtils.initDataFetchMap();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-
|
|
4
|
-
require("./prefetch-
|
|
3
|
+
const lazyLoadComponentPlugin = require("./lazy-load-component-plugin-C-qNUGjT.js");
|
|
4
|
+
require("./prefetch-NDhOcbO7.js");
|
|
5
5
|
exports.default = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
|
|
6
6
|
exports.lazyLoadComponentPlugin = lazyLoadComponentPlugin.lazyLoadComponentPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l, l as l2 } from "./lazy-load-component-plugin-
|
|
2
|
-
import "./prefetch-
|
|
1
|
+
import { l, l as l2 } from "./lazy-load-component-plugin-Bcm5-gd8.mjs";
|
|
2
|
+
import "./prefetch-COMVhC39.mjs";
|
|
3
3
|
export {
|
|
4
4
|
l as default,
|
|
5
5
|
l2 as lazyLoadComponentPlugin
|
package/dist/lazy-utils.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("./index.esm-
|
|
4
|
-
const lazyUtils = require("./utils-
|
|
3
|
+
require("./index.esm-CzoIcLts.js");
|
|
4
|
+
const lazyUtils = require("./utils-0HFFqmd4.js");
|
|
5
5
|
exports.callAllDowngrade = lazyUtils.callAllDowngrade;
|
|
6
6
|
exports.callDowngrade = lazyUtils.callDowngrade;
|
|
7
7
|
exports.fetchData = lazyUtils.fetchData;
|
package/dist/lazy-utils.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./index.esm-
|
|
2
|
-
import { G, H, f, J, I, u, k, n, g, m, B, y, i, q, j, t, a, z, s, w } from "./utils-
|
|
1
|
+
import "./index.esm-JLwyxgUK.mjs";
|
|
2
|
+
import { G, H, f, J, I, u, k, n, g, m, B, y, i, q, j, t, a, z, s, w } from "./utils-BTpxHmva.mjs";
|
|
3
3
|
export {
|
|
4
4
|
G as callAllDowngrade,
|
|
5
5
|
H as callDowngrade,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as DATA_FETCH_FUNCTION, F as FS_HREF, l as logger$1, g as getDataFetchMap, i as initDataFetchMap, n as getDataFetchItem, M as MF_DATA_FETCH_STATUS, p as MF_DATA_FETCH_TYPE, A as DOWNGRADE_KEY, B as getDowngradeTag, G as callAllDowngrade, H as callDowngrade, k as getDataFetchInfo, m as getDataFetchMapKey } from "./utils-
|
|
2
|
-
import {
|
|
1
|
+
import { x as DATA_FETCH_FUNCTION, F as FS_HREF, l as logger$1, g as getDataFetchMap, i as initDataFetchMap, n as getDataFetchItem, M as MF_DATA_FETCH_STATUS, p as MF_DATA_FETCH_TYPE, A as DOWNGRADE_KEY, B as getDowngradeTag, G as callAllDowngrade, H as callDowngrade, k as getDataFetchInfo, m as getDataFetchMapKey } from "./utils-BTpxHmva.mjs";
|
|
2
|
+
import { i as isDebugMode, a as createLink, b as createScript, d as isBrowserEnv, c as createLogger, e as composeKeyWithSeparator, l as loadScriptNode, f as loadScript } from "./index.esm-JLwyxgUK.mjs";
|
|
3
3
|
const dataFetchFunction = async function(options) {
|
|
4
4
|
var _a, _b;
|
|
5
5
|
const [id, data, downgrade] = options;
|
|
@@ -75,38 +75,6 @@ function injectDataFetch() {
|
|
|
75
75
|
globalThis[FS_HREF] = window.location.href;
|
|
76
76
|
dataFetch.push = dataFetchFunction;
|
|
77
77
|
}
|
|
78
|
-
function _extends$2() {
|
|
79
|
-
_extends$2 = Object.assign || function assign(target) {
|
|
80
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
81
|
-
var source = arguments[i];
|
|
82
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
83
|
-
}
|
|
84
|
-
return target;
|
|
85
|
-
};
|
|
86
|
-
return _extends$2.apply(this, arguments);
|
|
87
|
-
}
|
|
88
|
-
function _extends$1() {
|
|
89
|
-
_extends$1 = Object.assign || function assign(target) {
|
|
90
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
91
|
-
var source = arguments[i];
|
|
92
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
93
|
-
}
|
|
94
|
-
return target;
|
|
95
|
-
};
|
|
96
|
-
return _extends$1.apply(this, arguments);
|
|
97
|
-
}
|
|
98
|
-
function _object_without_properties_loose(source, excluded) {
|
|
99
|
-
if (source == null) return {};
|
|
100
|
-
var target = {};
|
|
101
|
-
var sourceKeys = Object.keys(source);
|
|
102
|
-
var key, i;
|
|
103
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
104
|
-
key = sourceKeys[i];
|
|
105
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
106
|
-
target[key] = source[key];
|
|
107
|
-
}
|
|
108
|
-
return target;
|
|
109
|
-
}
|
|
110
78
|
const RUNTIME_001 = "RUNTIME-001";
|
|
111
79
|
const RUNTIME_002 = "RUNTIME-002";
|
|
112
80
|
const RUNTIME_003 = "RUNTIME-003";
|
|
@@ -116,33 +84,16 @@ const RUNTIME_006 = "RUNTIME-006";
|
|
|
116
84
|
const RUNTIME_007 = "RUNTIME-007";
|
|
117
85
|
const RUNTIME_008 = "RUNTIME-008";
|
|
118
86
|
const RUNTIME_009 = "RUNTIME-009";
|
|
119
|
-
const TYPE_001 = "TYPE-001";
|
|
120
|
-
const BUILD_001 = "BUILD-001";
|
|
121
|
-
const BUILD_002 = "BUILD-002";
|
|
122
87
|
const getDocsUrl = (errorCode) => {
|
|
123
88
|
const type = errorCode.split("-")[0].toLowerCase();
|
|
124
89
|
return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${type}/${errorCode}`;
|
|
125
90
|
};
|
|
126
91
|
const getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg) => {
|
|
127
|
-
const msg = [
|
|
128
|
-
`${[
|
|
129
|
-
errorDescMap[errorCode]
|
|
130
|
-
]} #${errorCode}`
|
|
131
|
-
];
|
|
92
|
+
const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];
|
|
132
93
|
args && msg.push(`args: ${JSON.stringify(args)}`);
|
|
133
94
|
msg.push(getDocsUrl(errorCode));
|
|
134
95
|
return msg.join("\n");
|
|
135
96
|
};
|
|
136
|
-
function _extends() {
|
|
137
|
-
_extends = Object.assign || function assign(target) {
|
|
138
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
139
|
-
var source = arguments[i];
|
|
140
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
141
|
-
}
|
|
142
|
-
return target;
|
|
143
|
-
};
|
|
144
|
-
return _extends.apply(this, arguments);
|
|
145
|
-
}
|
|
146
97
|
const runtimeDescMap = {
|
|
147
98
|
[RUNTIME_001]: "Failed to get remoteEntry exports.",
|
|
148
99
|
[RUNTIME_002]: 'The remote entry interface does not contain "init"',
|
|
@@ -154,14 +105,9 @@ const runtimeDescMap = {
|
|
|
154
105
|
[RUNTIME_008]: "Failed to load script resources.",
|
|
155
106
|
[RUNTIME_009]: "Please call createInstance first."
|
|
156
107
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
const buildDescMap = {
|
|
161
|
-
[BUILD_001]: "Failed to find expose module.",
|
|
162
|
-
[BUILD_002]: "PublicPath is required in prod mode."
|
|
163
|
-
};
|
|
164
|
-
_extends({}, runtimeDescMap, typeDescMap, buildDescMap);
|
|
108
|
+
({
|
|
109
|
+
...runtimeDescMap
|
|
110
|
+
});
|
|
165
111
|
const LOG_CATEGORY = "[ Federation Runtime ]";
|
|
166
112
|
const logger = createLogger(LOG_CATEGORY);
|
|
167
113
|
function assert(condition, msg) {
|
|
@@ -201,7 +147,7 @@ const CurrentGlobal = typeof globalThis === "object" ? globalThis : window;
|
|
|
201
147
|
const nativeGlobal = (() => {
|
|
202
148
|
try {
|
|
203
149
|
return document.defaultView;
|
|
204
|
-
} catch
|
|
150
|
+
} catch {
|
|
205
151
|
return CurrentGlobal;
|
|
206
152
|
}
|
|
207
153
|
})();
|
|
@@ -221,7 +167,7 @@ if (!includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__")) {
|
|
|
221
167
|
}
|
|
222
168
|
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
223
169
|
function setGlobalDefaultVal(target) {
|
|
224
|
-
var
|
|
170
|
+
var _a, _b, _c, _d, _e, _f;
|
|
225
171
|
if (includeOwnProperty(target, "__VMOK__") && !includeOwnProperty(target, "__FEDERATION__")) {
|
|
226
172
|
definePropertyGlobalVal(target, "__FEDERATION__", target.__VMOK__);
|
|
227
173
|
}
|
|
@@ -236,18 +182,12 @@ function setGlobalDefaultVal(target) {
|
|
|
236
182
|
});
|
|
237
183
|
definePropertyGlobalVal(target, "__VMOK__", target.__FEDERATION__);
|
|
238
184
|
}
|
|
239
|
-
|
|
240
|
-
(
|
|
241
|
-
|
|
242
|
-
(
|
|
243
|
-
|
|
244
|
-
(
|
|
245
|
-
var ___SHARE__;
|
|
246
|
-
(___SHARE__ = (_target___FEDERATION__3 = target.__FEDERATION__).__SHARE__) != null ? ___SHARE__ : _target___FEDERATION__3.__SHARE__ = {};
|
|
247
|
-
var ___MANIFEST_LOADING__;
|
|
248
|
-
(___MANIFEST_LOADING__ = (_target___FEDERATION__4 = target.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _target___FEDERATION__4.__MANIFEST_LOADING__ = {};
|
|
249
|
-
var ___PRELOADED_MAP__;
|
|
250
|
-
(___PRELOADED_MAP__ = (_target___FEDERATION__5 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__5.__PRELOADED_MAP__ = /* @__PURE__ */ new Map();
|
|
185
|
+
(_a = target.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (_a.__GLOBAL_PLUGIN__ = []);
|
|
186
|
+
(_b = target.__FEDERATION__).__INSTANCES__ ?? (_b.__INSTANCES__ = []);
|
|
187
|
+
(_c = target.__FEDERATION__).moduleInfo ?? (_c.moduleInfo = {});
|
|
188
|
+
(_d = target.__FEDERATION__).__SHARE__ ?? (_d.__SHARE__ = {});
|
|
189
|
+
(_e = target.__FEDERATION__).__MANIFEST_LOADING__ ?? (_e.__MANIFEST_LOADING__ = {});
|
|
190
|
+
(_f = target.__FEDERATION__).__PRELOADED_MAP__ ?? (_f.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
251
191
|
}
|
|
252
192
|
setGlobalDefaultVal(CurrentGlobal);
|
|
253
193
|
setGlobalDefaultVal(nativeGlobal);
|
|
@@ -270,7 +210,7 @@ function getGlobalFederationConstructor() {
|
|
|
270
210
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
271
211
|
if (isDebug) {
|
|
272
212
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
273
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
213
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.20.0";
|
|
274
214
|
}
|
|
275
215
|
}
|
|
276
216
|
function getInfoWithoutType(target, key) {
|
|
@@ -314,9 +254,7 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot) => {
|
|
|
314
254
|
return getModuleInfo;
|
|
315
255
|
}
|
|
316
256
|
if ("version" in moduleInfo && moduleInfo["version"]) {
|
|
317
|
-
const { version
|
|
318
|
-
"version"
|
|
319
|
-
]);
|
|
257
|
+
const { version, ...resModuleInfo } = moduleInfo;
|
|
320
258
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
321
259
|
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
|
|
322
260
|
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
@@ -332,7 +270,10 @@ const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo) => {
|
|
|
332
270
|
return nativeGlobal.__FEDERATION__.moduleInfo;
|
|
333
271
|
};
|
|
334
272
|
const addGlobalSnapshot = (moduleInfos) => {
|
|
335
|
-
nativeGlobal.__FEDERATION__.moduleInfo =
|
|
273
|
+
nativeGlobal.__FEDERATION__.moduleInfo = {
|
|
274
|
+
...nativeGlobal.__FEDERATION__.moduleInfo,
|
|
275
|
+
...moduleInfos
|
|
276
|
+
};
|
|
336
277
|
return () => {
|
|
337
278
|
const keys = Object.keys(moduleInfos);
|
|
338
279
|
for (const key of keys) {
|
|
@@ -666,6 +607,7 @@ function satisfy(version, range) {
|
|
|
666
607
|
const versionAtom = {
|
|
667
608
|
operator: versionOperator,
|
|
668
609
|
version: combineVersion(versionMajor, versionMinor, versionPatch, versionPreRelease),
|
|
610
|
+
// exclude build atom
|
|
669
611
|
major: versionMajor,
|
|
670
612
|
minor: versionMinor,
|
|
671
613
|
patch: versionPatch,
|
|
@@ -804,9 +746,7 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
|
|
|
804
746
|
return;
|
|
805
747
|
}
|
|
806
748
|
const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;
|
|
807
|
-
const scopes = Array.isArray(scope) ? scope : [
|
|
808
|
-
scope
|
|
809
|
-
];
|
|
749
|
+
const scopes = Array.isArray(scope) ? scope : [scope];
|
|
810
750
|
for (const sc of scopes) {
|
|
811
751
|
if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
|
|
812
752
|
const { requiredVersion } = shareConfig;
|
|
@@ -928,10 +868,7 @@ async function loadSystemJsEntry({ entry, remoteEntryExports }) {
|
|
|
928
868
|
if (typeof __system_context__ === "undefined") {
|
|
929
869
|
System.import(entry).then(resolve).catch(reject);
|
|
930
870
|
} else {
|
|
931
|
-
new Function("callbacks", `System.import("${entry}")${importCallback}`)([
|
|
932
|
-
resolve,
|
|
933
|
-
reject
|
|
934
|
-
]);
|
|
871
|
+
new Function("callbacks", `System.import("${entry}")${importCallback}`)([resolve, reject]);
|
|
935
872
|
}
|
|
936
873
|
} else {
|
|
937
874
|
resolve(remoteEntryExports);
|
|
@@ -959,11 +896,9 @@ async function loadEntryScript({ name, globalName, entry, loaderHook, getEntryUr
|
|
|
959
896
|
return loadScript(url, {
|
|
960
897
|
attrs: {},
|
|
961
898
|
createScriptHook: (url2, attrs) => {
|
|
962
|
-
const res = loaderHook.lifecycle.createScript.emit({
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
});
|
|
966
|
-
if (!res) return;
|
|
899
|
+
const res = loaderHook.lifecycle.createScript.emit({ url: url2, attrs });
|
|
900
|
+
if (!res)
|
|
901
|
+
return;
|
|
967
902
|
if (res instanceof HTMLScriptElement) {
|
|
968
903
|
return res;
|
|
969
904
|
}
|
|
@@ -987,15 +922,9 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEnt
|
|
|
987
922
|
switch (type) {
|
|
988
923
|
case "esm":
|
|
989
924
|
case "module":
|
|
990
|
-
return loadEsmEntry({
|
|
991
|
-
entry,
|
|
992
|
-
remoteEntryExports
|
|
993
|
-
});
|
|
925
|
+
return loadEsmEntry({ entry, remoteEntryExports });
|
|
994
926
|
case "system":
|
|
995
|
-
return loadSystemJsEntry({
|
|
996
|
-
entry,
|
|
997
|
-
remoteEntryExports
|
|
998
|
-
});
|
|
927
|
+
return loadSystemJsEntry({ entry, remoteEntryExports });
|
|
999
928
|
default:
|
|
1000
929
|
return loadEntryScript({
|
|
1001
930
|
entry,
|
|
@@ -1013,18 +942,12 @@ async function loadEntryNode({ remoteInfo, loaderHook }) {
|
|
|
1013
942
|
return remoteEntryExports;
|
|
1014
943
|
}
|
|
1015
944
|
return loadScriptNode(entry, {
|
|
1016
|
-
attrs: {
|
|
1017
|
-
name,
|
|
1018
|
-
globalName,
|
|
1019
|
-
type
|
|
1020
|
-
},
|
|
945
|
+
attrs: { name, globalName, type },
|
|
1021
946
|
loaderHook: {
|
|
1022
947
|
createScriptHook: (url, attrs = {}) => {
|
|
1023
|
-
const res = loaderHook.lifecycle.createScript.emit({
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
});
|
|
1027
|
-
if (!res) return;
|
|
948
|
+
const res = loaderHook.lifecycle.createScript.emit({ url, attrs });
|
|
949
|
+
if (!res)
|
|
950
|
+
return;
|
|
1028
951
|
if ("url" in res) {
|
|
1029
952
|
return res;
|
|
1030
953
|
}
|
|
@@ -1042,7 +965,7 @@ function getRemoteEntryUniqueKey(remoteInfo) {
|
|
|
1042
965
|
return composeKeyWithSeparator(name, entry);
|
|
1043
966
|
}
|
|
1044
967
|
async function getRemoteEntry(params) {
|
|
1045
|
-
const { origin, remoteEntryExports, remoteInfo, getEntryUrl } = params;
|
|
968
|
+
const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
|
|
1046
969
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
1047
970
|
if (remoteEntryExports) {
|
|
1048
971
|
return remoteEntryExports;
|
|
@@ -1064,21 +987,39 @@ async function getRemoteEntry(params) {
|
|
|
1064
987
|
remoteEntryExports,
|
|
1065
988
|
loaderHook,
|
|
1066
989
|
getEntryUrl
|
|
1067
|
-
}) : loadEntryNode({
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
990
|
+
}) : loadEntryNode({ remoteInfo, loaderHook });
|
|
991
|
+
}).catch(async (err) => {
|
|
992
|
+
const uniqueKey2 = getRemoteEntryUniqueKey(remoteInfo);
|
|
993
|
+
const isScriptLoadError = err instanceof Error && err.message.includes(RUNTIME_008);
|
|
994
|
+
if (isScriptLoadError && !_inErrorHandling) {
|
|
995
|
+
const wrappedGetRemoteEntry = (params2) => {
|
|
996
|
+
return getRemoteEntry({ ...params2, _inErrorHandling: true });
|
|
997
|
+
};
|
|
998
|
+
const RemoteEntryExports = await origin.loaderHook.lifecycle.loadEntryError.emit({
|
|
999
|
+
getRemoteEntry: wrappedGetRemoteEntry,
|
|
1000
|
+
origin,
|
|
1001
|
+
remoteInfo,
|
|
1002
|
+
remoteEntryExports,
|
|
1003
|
+
globalLoading,
|
|
1004
|
+
uniqueKey: uniqueKey2
|
|
1005
|
+
});
|
|
1006
|
+
if (RemoteEntryExports) {
|
|
1007
|
+
return RemoteEntryExports;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
throw err;
|
|
1071
1011
|
});
|
|
1072
1012
|
}
|
|
1073
1013
|
return globalLoading[uniqueKey];
|
|
1074
1014
|
}
|
|
1075
1015
|
function getRemoteInfo(remote) {
|
|
1076
|
-
return
|
|
1016
|
+
return {
|
|
1017
|
+
...remote,
|
|
1077
1018
|
entry: "entry" in remote ? remote.entry : "",
|
|
1078
1019
|
type: remote.type || DEFAULT_REMOTE_TYPE,
|
|
1079
1020
|
entryGlobalName: remote.entryGlobalName || remote.name,
|
|
1080
1021
|
shareScope: remote.shareScope || DEFAULT_SCOPE
|
|
1081
|
-
}
|
|
1022
|
+
};
|
|
1082
1023
|
}
|
|
1083
1024
|
function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
1084
1025
|
const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;
|
|
@@ -1235,29 +1176,12 @@ var helpers$1 = {
|
|
|
1235
1176
|
}
|
|
1236
1177
|
};
|
|
1237
1178
|
typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true;
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
if (buildId && GMInstance.options.id === buildId) {
|
|
1245
|
-
return true;
|
|
1246
|
-
}
|
|
1247
|
-
if (GMInstance.options.name === name && !GMInstance.options.version && !version) {
|
|
1248
|
-
return true;
|
|
1249
|
-
}
|
|
1250
|
-
if (GMInstance.options.name === name && version && GMInstance.options.version === version) {
|
|
1251
|
-
return true;
|
|
1252
|
-
}
|
|
1253
|
-
return false;
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
var helpers = _extends$2({}, helpers$1, {
|
|
1257
|
-
global: _extends$2({}, helpers$1.global, {
|
|
1258
|
-
getGlobalFederationInstance
|
|
1259
|
-
})
|
|
1260
|
-
});
|
|
1179
|
+
var helpers = {
|
|
1180
|
+
...helpers$1,
|
|
1181
|
+
global: {
|
|
1182
|
+
...helpers$1.global
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1261
1185
|
async function prefetch(options) {
|
|
1262
1186
|
const { instance, id, dataFetchParams, preloadComponentResource } = options;
|
|
1263
1187
|
if (!id) {
|