chayns-api 1.2.0-10 → 1.2.0-11
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/dist/cjs/host/module/ModuleHost.js +1 -1
- package/dist/cjs/host/module/utils/loadComponent.js +2 -2
- package/dist/esm/host/module/ModuleHost.js +1 -1
- package/dist/esm/host/module/utils/loadComponent.js +2 -1
- package/dist/types/host/module/ModuleHost.d.ts +1 -0
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const System = ({
|
|
|
15
15
|
fallback,
|
|
16
16
|
...props
|
|
17
17
|
}) => {
|
|
18
|
-
const Component = (0, _react.useMemo)(() => (0, _loadComponent.default)(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
18
|
+
const Component = (0, _react.useMemo)(() => (0, _loadComponent.default)(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton, system.shareScope), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
19
19
|
return /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
|
|
20
20
|
fallback: fallback || ''
|
|
21
21
|
}, /*#__PURE__*/_react.default.createElement(Component, props));
|
|
@@ -46,7 +46,7 @@ const loadModule = (scope, module, url, preventSingleton = false, shareScope = '
|
|
|
46
46
|
return moduleMap[scope][module];
|
|
47
47
|
};
|
|
48
48
|
exports.loadModule = loadModule;
|
|
49
|
-
const loadComponent = (scope, module, url, skipCompatMode = false, preventSingleton = false) => {
|
|
49
|
+
const loadComponent = (scope, module, url, skipCompatMode = false, preventSingleton = false, shareScope) => {
|
|
50
50
|
if (skipCompatMode) {
|
|
51
51
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
52
52
|
}
|
|
@@ -60,7 +60,7 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
|
|
|
60
60
|
componentMap[scope] = {};
|
|
61
61
|
}
|
|
62
62
|
if (!(module in componentMap[scope])) {
|
|
63
|
-
const promise = loadModule(scope, module, url, preventSingleton).then(async Module => {
|
|
63
|
+
const promise = loadModule(scope, module, url, preventSingleton, shareScope).then(async Module => {
|
|
64
64
|
if (typeof Module.default === 'function') {
|
|
65
65
|
return Module;
|
|
66
66
|
}
|
|
@@ -7,7 +7,7 @@ const System = _ref => {
|
|
|
7
7
|
fallback,
|
|
8
8
|
...props
|
|
9
9
|
} = _ref;
|
|
10
|
-
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
10
|
+
const Component = useMemo(() => loadComponent(system.scope, system.module, globalThis.window ? system.url : system.serverUrl, undefined, system.preventSingleton, system.shareScope), [system.scope, system.module, system.url, system.serverUrl, system.preventSingleton]);
|
|
11
11
|
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
12
12
|
fallback: fallback || ''
|
|
13
13
|
}, /*#__PURE__*/React.createElement(Component, props));
|
|
@@ -43,6 +43,7 @@ export const loadModule = function (scope, module, url) {
|
|
|
43
43
|
const loadComponent = function (scope, module, url) {
|
|
44
44
|
let skipCompatMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
45
45
|
let preventSingleton = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
46
|
+
let shareScope = arguments.length > 5 ? arguments[5] : undefined;
|
|
46
47
|
if (skipCompatMode) {
|
|
47
48
|
console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
|
|
48
49
|
}
|
|
@@ -56,7 +57,7 @@ const loadComponent = function (scope, module, url) {
|
|
|
56
57
|
componentMap[scope] = {};
|
|
57
58
|
}
|
|
58
59
|
if (!(module in componentMap[scope])) {
|
|
59
|
-
const promise = loadModule(scope, module, url, preventSingleton).then(async Module => {
|
|
60
|
+
const promise = loadModule(scope, module, url, preventSingleton, shareScope).then(async Module => {
|
|
60
61
|
if (typeof Module.default === 'function') {
|
|
61
62
|
return Module;
|
|
62
63
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const loadModule: (scope: any, module: any, url: any, preventSingleton?: boolean, shareScope?: string) => any;
|
|
2
|
-
declare const loadComponent: (scope: any, module: any, url: any, skipCompatMode
|
|
2
|
+
declare const loadComponent: (scope: any, module: any, url: any, skipCompatMode: boolean | undefined, preventSingleton: boolean | undefined, shareScope: any) => any;
|
|
3
3
|
export default loadComponent;
|