chayns-api 1.0.25-0 → 1.0.25-2

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.
@@ -20,14 +20,7 @@ function loadComponent(scope, module, url, skipCompatMode = false, preventSingle
20
20
  container
21
21
  } = window[scope + "_list"].find(x => x.url === url); // or get the container somewhere else
22
22
  // Initialize the container, it may provide shared modules
23
- const shareScopes = {
24
- ...__webpack_share_scopes__.default
25
- };
26
- shareScopes.react = Object.entries(shareScopes.react).filter(([k]) => k === _react.default.version).reduce((p, [k, v]) => {
27
- p[k] = v;
28
- return p;
29
- }, {});
30
- await container.init(shareScopes);
23
+ await container.init(__webpack_share_scopes__.default);
31
24
  const factory = await container.get(module);
32
25
  _useDynamicScript.semaphore[scope].release();
33
26
  let ModuleMap = instances[`${scope}__${module}`];
@@ -57,7 +50,9 @@ function loadComponent(scope, module, url, skipCompatMode = false, preventSingle
57
50
  requiredVersion,
58
51
  environment
59
52
  } = Module.default;
60
- const matchReactVersion = requiredVersion && _semver.default.satisfies(hostVersion, requiredVersion);
53
+ const matchReactVersion = requiredVersion && Object.keys(__webpack_share_scopes__.default.react).every(version => {
54
+ return hostVersion === version && _semver.default.satisfies(version, requiredVersion) || !(_semver.default.gt(version, hostVersion) && _semver.default.satisfies(version, requiredVersion));
55
+ });
61
56
  if (!matchReactVersion || environment !== 'production') {
62
57
  return {
63
58
  default: Module.default.CompatComponent
@@ -15,18 +15,7 @@ export default function loadComponent(scope, module, url) {
15
15
  container
16
16
  } = window[scope + "_list"].find(x => x.url === url); // or get the container somewhere else
17
17
  // Initialize the container, it may provide shared modules
18
- const shareScopes = {
19
- ...__webpack_share_scopes__.default
20
- };
21
- shareScopes.react = Object.entries(shareScopes.react).filter(_ref => {
22
- let [k] = _ref;
23
- return k === React.version;
24
- }).reduce((p, _ref2) => {
25
- let [k, v] = _ref2;
26
- p[k] = v;
27
- return p;
28
- }, {});
29
- await container.init(shareScopes);
18
+ await container.init(__webpack_share_scopes__.default);
30
19
  const factory = await container.get(module);
31
20
  semaphore[scope].release();
32
21
  let ModuleMap = instances[`${scope}__${module}`];
@@ -56,7 +45,9 @@ export default function loadComponent(scope, module, url) {
56
45
  requiredVersion,
57
46
  environment
58
47
  } = Module.default;
59
- const matchReactVersion = requiredVersion && semver.satisfies(hostVersion, requiredVersion);
48
+ const matchReactVersion = requiredVersion && Object.keys(__webpack_share_scopes__.default.react).every(version => {
49
+ return hostVersion === version && semver.satisfies(version, requiredVersion) || !(semver.gt(version, hostVersion) && semver.satisfies(version, requiredVersion));
50
+ });
60
51
  if (!matchReactVersion || environment !== 'production') {
61
52
  return {
62
53
  default: Module.default.CompatComponent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.0.25-0",
3
+ "version": "1.0.25-2",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",