@module-federation/runtime 0.18.0 → 0.18.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.
@@ -7,7 +7,9 @@ var utils = require('./utils.cjs.cjs');
7
7
  function createInstance(options) {
8
8
  // Retrieve debug constructor
9
9
  const ModuleFederationConstructor = runtimeCore.getGlobalFederationConstructor() || runtimeCore.ModuleFederation;
10
- return new ModuleFederationConstructor(options);
10
+ const instance = new ModuleFederationConstructor(options);
11
+ runtimeCore.setGlobalFederationInstance(instance);
12
+ return instance;
11
13
  }
12
14
  let FederationInstance = null;
13
15
  /**
@@ -17,7 +19,6 @@ let FederationInstance = null;
17
19
  const instance = utils.getGlobalFederationInstance(options.name, options.version);
18
20
  if (!instance) {
19
21
  FederationInstance = createInstance(options);
20
- runtimeCore.setGlobalFederationInstance(FederationInstance);
21
22
  return FederationInstance;
22
23
  } else {
23
24
  // Merge options
package/dist/index.esm.js CHANGED
@@ -6,7 +6,9 @@ import { g as getGlobalFederationInstance } from './utils.esm.js';
6
6
  function createInstance(options) {
7
7
  // Retrieve debug constructor
8
8
  const ModuleFederationConstructor = getGlobalFederationConstructor() || ModuleFederation;
9
- return new ModuleFederationConstructor(options);
9
+ const instance = new ModuleFederationConstructor(options);
10
+ setGlobalFederationInstance(instance);
11
+ return instance;
10
12
  }
11
13
  let FederationInstance = null;
12
14
  /**
@@ -16,7 +18,6 @@ let FederationInstance = null;
16
18
  const instance = getGlobalFederationInstance(options.name, options.version);
17
19
  if (!instance) {
18
20
  FederationInstance = createInstance(options);
19
- setGlobalFederationInstance(FederationInstance);
20
21
  return FederationInstance;
21
22
  } else {
22
23
  // Merge options
@@ -1,3 +1,3 @@
1
- import { ModuleFederation } from '@module-federation/runtime-core';
1
+ import type { ModuleFederation } from '@module-federation/runtime-core';
2
2
  export declare function getBuilderId(): string;
3
3
  export declare function getGlobalFederationInstance(name: string, version: string | undefined): ModuleFederation | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "type": "module",
5
5
  "author": "zhouxiao <codingzx@gmail.com>",
6
6
  "main": "./dist/index.cjs.cjs",
@@ -79,8 +79,8 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "@module-federation/sdk": "0.18.0",
83
- "@module-federation/error-codes": "0.18.0",
84
- "@module-federation/runtime-core": "0.18.0"
82
+ "@module-federation/sdk": "0.18.2",
83
+ "@module-federation/error-codes": "0.18.2",
84
+ "@module-federation/runtime-core": "0.18.2"
85
85
  }
86
86
  }