chayns-api 1.2.0-6 → 1.2.0-7
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.
|
@@ -7,17 +7,16 @@ exports.loadModule = exports.default = void 0;
|
|
|
7
7
|
var _semver = _interopRequireDefault(require("semver"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const {
|
|
11
|
-
loadRemote,
|
|
12
|
-
registerRemotes,
|
|
13
|
-
loadShareSync
|
|
14
|
-
} = globalThis.moduleFederationRuntime;
|
|
15
|
-
const {
|
|
16
|
-
registeredScopes,
|
|
17
|
-
moduleMap,
|
|
18
|
-
componentMap
|
|
19
|
-
} = globalThis.moduleFederationScopes;
|
|
20
10
|
const loadModule = (scope, module, url, preventSingleton = false) => {
|
|
11
|
+
const {
|
|
12
|
+
loadRemote,
|
|
13
|
+
registerRemotes
|
|
14
|
+
} = globalThis.moduleFederationRuntime;
|
|
15
|
+
const {
|
|
16
|
+
registeredScopes,
|
|
17
|
+
moduleMap,
|
|
18
|
+
componentMap
|
|
19
|
+
} = globalThis.moduleFederationScopes;
|
|
21
20
|
if (registeredScopes[scope] !== url || preventSingleton) {
|
|
22
21
|
if (scope in registeredScopes) {
|
|
23
22
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
@@ -50,6 +49,12 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
50
49
|
if (skipCompatMode) {
|
|
51
50
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
52
51
|
}
|
|
52
|
+
const {
|
|
53
|
+
loadShareSync
|
|
54
|
+
} = globalThis.moduleFederationRuntime;
|
|
55
|
+
const {
|
|
56
|
+
componentMap
|
|
57
|
+
} = globalThis.moduleFederationScopes;
|
|
53
58
|
if (!componentMap[scope]) {
|
|
54
59
|
componentMap[scope] = {};
|
|
55
60
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import React from "react";
|
|
3
|
-
const {
|
|
4
|
-
loadRemote,
|
|
5
|
-
registerRemotes,
|
|
6
|
-
loadShareSync
|
|
7
|
-
} = globalThis.moduleFederationRuntime;
|
|
8
|
-
const {
|
|
9
|
-
registeredScopes,
|
|
10
|
-
moduleMap,
|
|
11
|
-
componentMap
|
|
12
|
-
} = globalThis.moduleFederationScopes;
|
|
13
3
|
export const loadModule = function (scope, module, url) {
|
|
14
4
|
let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
5
|
+
const {
|
|
6
|
+
loadRemote,
|
|
7
|
+
registerRemotes
|
|
8
|
+
} = globalThis.moduleFederationRuntime;
|
|
9
|
+
const {
|
|
10
|
+
registeredScopes,
|
|
11
|
+
moduleMap,
|
|
12
|
+
componentMap
|
|
13
|
+
} = globalThis.moduleFederationScopes;
|
|
15
14
|
if (registeredScopes[scope] !== url || preventSingleton) {
|
|
16
15
|
if (scope in registeredScopes) {
|
|
17
16
|
console.error(`[chayns-api] call registerRemote with force for scope ${scope}. url: ${url}`);
|
|
@@ -45,6 +44,12 @@ const loadComponent = function (scope, module, url) {
|
|
|
45
44
|
if (skipCompatMode) {
|
|
46
45
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
47
46
|
}
|
|
47
|
+
const {
|
|
48
|
+
loadShareSync
|
|
49
|
+
} = globalThis.moduleFederationRuntime;
|
|
50
|
+
const {
|
|
51
|
+
componentMap
|
|
52
|
+
} = globalThis.moduleFederationScopes;
|
|
48
53
|
if (!componentMap[scope]) {
|
|
49
54
|
componentMap[scope] = {};
|
|
50
55
|
}
|