@module-federation/inject-external-runtime-core-plugin 0.24.1 → 2.0.1

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var runtimeCore = require('@module-federation/runtime-tools/runtime-core');
3
+ var runtimeCoreDefault = require('@module-federation/runtime-tools/runtime-core');
4
4
 
5
5
  function _interopNamespaceDefault(e) {
6
6
  var n = Object.create(null);
@@ -13,24 +13,30 @@ function _interopNamespaceDefault(e) {
13
13
  return Object.freeze(n);
14
14
  }
15
15
 
16
- var runtimeCore__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeCore);
16
+ var runtimeCoreDefault__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeCoreDefault);
17
17
 
18
+ const runtimeCore = runtimeCoreDefault ??
19
+ runtimeCoreDefault__namespace;
18
20
  function injectExternalRuntimeCorePlugin() {
19
21
  return {
20
22
  name: 'inject-external-runtime-core-plugin',
21
- version: "0.24.1",
23
+ version: "2.0.1",
22
24
  beforeInit(args) {
25
+ const globalRef = runtimeCore.Global;
26
+ if (!globalRef || typeof globalRef !== 'object') {
27
+ return args;
28
+ }
23
29
  const name = args.options.name;
24
- const version = "0.24.1";
25
- if (runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE &&
26
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM &&
27
- (runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM.name !== name ||
28
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
29
- console.warn(`Detect multiple module federation runtime! Injected runtime from ${runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM.name}@${runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM.version} and current is ${name}@${version}, pleasure ensure there is only one consumer to provider runtime!`);
30
+ const version = "2.0.1";
31
+ if (globalRef._FEDERATION_RUNTIME_CORE &&
32
+ globalRef._FEDERATION_RUNTIME_CORE_FROM &&
33
+ (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||
34
+ globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
35
+ console.warn(`Detect multiple module federation runtime! Injected runtime from ${globalRef._FEDERATION_RUNTIME_CORE_FROM.name}@${globalRef._FEDERATION_RUNTIME_CORE_FROM.version} and current is ${name}@${version}, pleasure ensure there is only one consumer to provider runtime!`);
30
36
  return args;
31
37
  }
32
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE = runtimeCore__namespace;
33
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM = {
38
+ globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;
39
+ globalRef._FEDERATION_RUNTIME_CORE_FROM = {
34
40
  version,
35
41
  name,
36
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.cjs","sources":["../../src/index.ts"],"sourcesContent":[null],"names":["runtimeCore"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAS,+BAA+B,GAAA;IACtC,OAAO;AACL,QAAA,IAAI,EAAE,qCAAqC;AAC3C,QAAA,OAAO,EAAE,QAAW;AACpB,QAAA,UAAU,CAAC,IAAI,EAAA;AACb,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YAC9B,MAAM,OAAO,GAAG,QAAW;AAC3B,YAAA,IACEA,sBAAW,CAAC,MAAM,CAAC,wBAAwB;gBAC3CA,sBAAW,CAAC,MAAM,CAAC,6BAA6B;iBAC/CA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,KAAK,IAAI;oBAC7DA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,OAAO,KAAK,OAAO,CAAC,EACvE;gBACA,OAAO,CAAC,IAAI,CACV,CAAA,iEAAA,EAAoEA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,CAAA,CAAA,EAAIA,sBAAW,CAAC,MA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A,iEAAA,CAAmE,CACzQ;AACD,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,SAAS,CAAC,wBAAwB,GAAG,WAAW;YAChD,SAAS,CAAC,6BAA6B,GAAG;gBACxC,OAAO;gBACP,IAAI;aACL;AACD,YAAA,OAAO,IAAI;QACb,CAAC;KACF;AACH;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,21 +1,28 @@
1
- import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';
1
+ import * as runtimeCoreDefault from '@module-federation/runtime-tools/runtime-core';
2
+ import runtimeCoreDefault__default from '@module-federation/runtime-tools/runtime-core';
2
3
 
4
+ const runtimeCore = runtimeCoreDefault__default ??
5
+ runtimeCoreDefault;
3
6
  function injectExternalRuntimeCorePlugin() {
4
7
  return {
5
8
  name: 'inject-external-runtime-core-plugin',
6
- version: "0.24.1",
9
+ version: "2.0.1",
7
10
  beforeInit(args) {
11
+ const globalRef = runtimeCore.Global;
12
+ if (!globalRef || typeof globalRef !== 'object') {
13
+ return args;
14
+ }
8
15
  const name = args.options.name;
9
- const version = "0.24.1";
10
- if (runtimeCore.Global._FEDERATION_RUNTIME_CORE &&
11
- runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM &&
12
- (runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.name !== name ||
13
- runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
14
- console.warn(`Detect multiple module federation runtime! Injected runtime from ${runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.name}@${runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.version} and current is ${name}@${version}, pleasure ensure there is only one consumer to provider runtime!`);
16
+ const version = "2.0.1";
17
+ if (globalRef._FEDERATION_RUNTIME_CORE &&
18
+ globalRef._FEDERATION_RUNTIME_CORE_FROM &&
19
+ (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||
20
+ globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
21
+ console.warn(`Detect multiple module federation runtime! Injected runtime from ${globalRef._FEDERATION_RUNTIME_CORE_FROM.name}@${globalRef._FEDERATION_RUNTIME_CORE_FROM.version} and current is ${name}@${version}, pleasure ensure there is only one consumer to provider runtime!`);
15
22
  return args;
16
23
  }
17
- runtimeCore.Global._FEDERATION_RUNTIME_CORE = runtimeCore;
18
- runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM = {
24
+ globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;
25
+ globalRef._FEDERATION_RUNTIME_CORE_FROM = {
19
26
  version,
20
27
  name,
21
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAYA,SAAS,+BAA+B,GAAA;IACtC,OAAO;AACL,QAAA,IAAI,EAAE,qCAAqC;AAC3C,QAAA,OAAO,EAAE,QAAW;AACpB,QAAA,UAAU,CAAC,IAAI,EAAA;AACb,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YAC9B,MAAM,OAAO,GAAG,QAAW;AAC3B,YAAA,IACE,WAAW,CAAC,MAAM,CAAC,wBAAwB;gBAC3C,WAAW,CAAC,MAAM,CAAC,6BAA6B;iBAC/C,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,KAAK,IAAI;oBAC7D,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,OAAO,KAAK,OAAO,CAAC,EACvE;gBACA,OAAO,CAAC,IAAI,CACV,CAAA,iEAAA,EAAoE,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,CAAA,CAAA,EAAI,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,OAAO,CAAA,gBAAA,EAAmB,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,iEAAA,CAAmE,CAC3R;AACD,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,WAAW,CAAC,MAAM,CAAC,wBAAwB,GAAG,WAAW;AACzD,YAAA,WAAW,CAAC,MAAM,CAAC,6BAA6B,GAAG;gBACjD,OAAO;gBACP,IAAI;aACL;AACD,YAAA,OAAO,IAAI;QACb,CAAC;KACF;AACH;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":["runtimeCoreDefault","runtimeCoreNamespace"],"mappings":";;;AAGA,MAAM,WAAW,GACdA,2BAA8D;AAC/D,IAAAC,kBAAoB;AAUtB,SAAS,+BAA+B,GAAA;IACtC,OAAO;AACL,QAAA,IAAI,EAAE,qCAAqC;AAC3C,QAAA,OAAO,EAAE,OAAW;AACpB,QAAA,UAAU,CAAC,IAAI,EAAA;AACb,YAAA,MAAM,SAAS,GACb,WAGD,CAAC,MAAM;YACR,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC/C,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YAC9B,MAAM,OAAO,GAAG,OAAW;YAC3B,IACE,SAAS,CAAC,wBAAwB;AAClC,gBAAA,SAAS,CAAC,6BAA6B;AACvC,iBAAC,SAAS,CAAC,6BAA6B,CAAC,IAAI,KAAK,IAAI;oBACpD,SAAS,CAAC,6BAA6B,CAAC,OAAO,KAAK,OAAO,CAAC,EAC9D;gBACA,OAAO,CAAC,IAAI,CACV,CAAA,iEAAA,EAAoE,SAAS,CAAC,6BAA6B,CAAC,IAAI,CAAA,CAAA,EAAI,SAAS,CAAC,6BAA6B,CAAC,OAAO,CAAA,gBAAA,EAAmB,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,iEAAA,CAAmE,CACzQ;AACD,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,SAAS,CAAC,wBAAwB,GAAG,WAAW;YAChD,SAAS,CAAC,6BAA6B,GAAG;gBACxC,OAAO;gBACP,IAAI;aACL;AACD,YAAA,OAAO,IAAI;QACb,CAAC;KACF;AACH;;;;"}
@@ -1,5 +1,6 @@
1
- import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';
1
+ import runtimeCoreDefault from '@module-federation/runtime-tools/runtime-core';
2
2
  import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';
3
+ declare const runtimeCore: typeof runtimeCoreDefault;
3
4
  declare global {
4
5
  var __VERSION__: string;
5
6
  var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/inject-external-runtime-core-plugin",
3
- "version": "0.24.1",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A sdk for support module federation",
@@ -40,9 +40,9 @@
40
40
  }
41
41
  },
42
42
  "peerDependencies": {
43
- "@module-federation/runtime-tools": "0.24.1"
43
+ "@module-federation/runtime-tools": "2.0.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@module-federation/runtime-tools": "0.24.1"
46
+ "@module-federation/runtime-tools": "2.0.1"
47
47
  }
48
48
  }