@module-federation/inject-external-runtime-core-plugin 2.3.1 → 2.3.3

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/index.cjs CHANGED
@@ -3,21 +3,20 @@ let _module_federation_runtime_tools_runtime_core = require("@module-federation/
3
3
  _module_federation_runtime_tools_runtime_core = require_runtime.__toESM(_module_federation_runtime_tools_runtime_core);
4
4
 
5
5
  //#region src/index.ts
6
- const runtimeCore = _module_federation_runtime_tools_runtime_core.default ?? _module_federation_runtime_tools_runtime_core;
7
6
  function injectExternalRuntimeCorePlugin() {
8
7
  return {
9
8
  name: "inject-external-runtime-core-plugin",
10
- version: "2.3.1",
9
+ version: "2.3.3",
11
10
  beforeInit(args) {
12
- const globalRef = runtimeCore.Global;
11
+ const globalRef = _module_federation_runtime_tools_runtime_core.Global;
13
12
  if (!globalRef || typeof globalRef !== "object") return args;
14
13
  const name = args.options.name;
15
- const version = "2.3.1";
14
+ const version = "2.3.3";
16
15
  if (globalRef._FEDERATION_RUNTIME_CORE && globalRef._FEDERATION_RUNTIME_CORE_FROM && (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name || globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
17
16
  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!`);
18
17
  return args;
19
18
  }
20
- globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;
19
+ globalRef._FEDERATION_RUNTIME_CORE = _module_federation_runtime_tools_runtime_core;
21
20
  globalRef._FEDERATION_RUNTIME_CORE_FROM = {
22
21
  version,
23
22
  name
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["runtimeCoreDefault","runtimeCoreNamespace"],"sources":["../src/index.ts"],"sourcesContent":["import runtimeCoreDefault, * as runtimeCoreNamespace from '@module-federation/runtime-tools/runtime-core';\n\nimport type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';\nconst runtimeCore =\n (runtimeCoreDefault as typeof runtimeCoreNamespace | undefined) ??\n runtimeCoreNamespace;\ndeclare global {\n var __VERSION__: string;\n var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;\n var _FEDERATION_RUNTIME_CORE_FROM: {\n version: string;\n name: string;\n };\n}\n\nfunction injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin {\n return {\n name: 'inject-external-runtime-core-plugin',\n version: __VERSION__,\n beforeInit(args) {\n const globalRef = (\n runtimeCore as typeof runtimeCore & {\n Global?: typeof runtimeCore.Global;\n }\n ).Global;\n if (!globalRef || typeof globalRef !== 'object') {\n return args;\n }\n const name = args.options.name;\n const version = __VERSION__;\n if (\n globalRef._FEDERATION_RUNTIME_CORE &&\n globalRef._FEDERATION_RUNTIME_CORE_FROM &&\n (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||\n globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)\n ) {\n console.warn(\n `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!`,\n );\n return args;\n }\n globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;\n globalRef._FEDERATION_RUNTIME_CORE_FROM = {\n version,\n name,\n };\n return args;\n },\n };\n}\n\nexport default injectExternalRuntimeCorePlugin;\n"],"mappings":";;;;;AAGA,MAAM,cACHA,yDACDC;AAUF,SAAS,kCAAiE;AACxE,QAAO;EACL,MAAM;EACN;EACA,WAAW,MAAM;GACf,MAAM,YACJ,YAGA;AACF,OAAI,CAAC,aAAa,OAAO,cAAc,SACrC,QAAO;GAET,MAAM,OAAO,KAAK,QAAQ;GAC1B,MAAM;AACN,OACE,UAAU,4BACV,UAAU,kCACT,UAAU,8BAA8B,SAAS,QAChD,UAAU,8BAA8B,YAAY,UACtD;AACA,YAAQ,KACN,oEAAoE,UAAU,8BAA8B,KAAK,GAAG,UAAU,8BAA8B,QAAQ,kBAAkB,KAAK,GAAG,QAAQ,mEACvM;AACD,WAAO;;AAET,aAAU,2BAA2B;AACrC,aAAU,gCAAgC;IACxC;IACA;IACD;AACD,UAAO;;EAEV"}
1
+ {"version":3,"file":"index.cjs","names":["runtimeCore"],"sources":["../src/index.ts"],"sourcesContent":["import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';\n\nimport type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';\ndeclare global {\n var __VERSION__: string;\n var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;\n var _FEDERATION_RUNTIME_CORE_FROM: {\n version: string;\n name: string;\n };\n}\n\nfunction injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin {\n return {\n name: 'inject-external-runtime-core-plugin',\n version: __VERSION__,\n beforeInit(args) {\n const globalRef = (\n runtimeCore as typeof runtimeCore & {\n Global?: typeof runtimeCore.Global;\n }\n ).Global;\n if (!globalRef || typeof globalRef !== 'object') {\n return args;\n }\n const name = args.options.name;\n const version = __VERSION__;\n if (\n globalRef._FEDERATION_RUNTIME_CORE &&\n globalRef._FEDERATION_RUNTIME_CORE_FROM &&\n (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||\n globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)\n ) {\n console.warn(\n `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!`,\n );\n return args;\n }\n globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;\n globalRef._FEDERATION_RUNTIME_CORE_FROM = {\n version,\n name,\n };\n return args;\n },\n };\n}\n\nexport default injectExternalRuntimeCorePlugin;\n"],"mappings":";;;;;AAYA,SAAS,kCAAiE;AACxE,QAAO;EACL,MAAM;EACN;EACA,WAAW,MAAM;GACf,MAAM,YACJA,8CAGA;AACF,OAAI,CAAC,aAAa,OAAO,cAAc,SACrC,QAAO;GAET,MAAM,OAAO,KAAK,QAAQ;GAC1B,MAAM;AACN,OACE,UAAU,4BACV,UAAU,kCACT,UAAU,8BAA8B,SAAS,QAChD,UAAU,8BAA8B,YAAY,UACtD;AACA,YAAQ,KACN,oEAAoE,UAAU,8BAA8B,KAAK,GAAG,UAAU,8BAA8B,QAAQ,kBAAkB,KAAK,GAAG,QAAQ,mEACvM;AACD,WAAO;;AAET,aAAU,2BAA2BA;AACrC,aAAU,gCAAgC;IACxC;IACA;IACD;AACD,UAAO;;EAEV"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import runtimeCoreDefault, { ModuleFederationRuntimePlugin } from "@module-federation/runtime-tools/runtime-core";
1
+ import * as runtimeCore from "@module-federation/runtime-tools/runtime-core";
2
+ import { ModuleFederationRuntimePlugin } from "@module-federation/runtime-tools/runtime-core";
2
3
 
3
4
  //#region src/index.d.ts
4
- declare const runtimeCore: typeof runtimeCoreDefault;
5
5
  declare global {
6
6
  var __VERSION__: string;
7
7
  var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;
@@ -11,6 +11,5 @@ declare global {
11
11
  };
12
12
  }
13
13
  declare function injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin;
14
- //#endregion
15
- export { injectExternalRuntimeCorePlugin as default };
14
+ export = injectExternalRuntimeCorePlugin;
16
15
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,17 +1,15 @@
1
- import * as runtimeCoreNamespace from "@module-federation/runtime-tools/runtime-core";
2
- import runtimeCoreDefault from "@module-federation/runtime-tools/runtime-core";
1
+ import * as runtimeCore from "@module-federation/runtime-tools/runtime-core";
3
2
 
4
3
  //#region src/index.ts
5
- const runtimeCore = runtimeCoreDefault ?? runtimeCoreNamespace;
6
4
  function injectExternalRuntimeCorePlugin() {
7
5
  return {
8
6
  name: "inject-external-runtime-core-plugin",
9
- version: "2.3.1",
7
+ version: "2.3.3",
10
8
  beforeInit(args) {
11
9
  const globalRef = runtimeCore.Global;
12
10
  if (!globalRef || typeof globalRef !== "object") return args;
13
11
  const name = args.options.name;
14
- const version = "2.3.1";
12
+ const version = "2.3.3";
15
13
  if (globalRef._FEDERATION_RUNTIME_CORE && globalRef._FEDERATION_RUNTIME_CORE_FROM && (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name || globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)) {
16
14
  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!`);
17
15
  return args;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import runtimeCoreDefault, * as runtimeCoreNamespace from '@module-federation/runtime-tools/runtime-core';\n\nimport type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';\nconst runtimeCore =\n (runtimeCoreDefault as typeof runtimeCoreNamespace | undefined) ??\n runtimeCoreNamespace;\ndeclare global {\n var __VERSION__: string;\n var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;\n var _FEDERATION_RUNTIME_CORE_FROM: {\n version: string;\n name: string;\n };\n}\n\nfunction injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin {\n return {\n name: 'inject-external-runtime-core-plugin',\n version: __VERSION__,\n beforeInit(args) {\n const globalRef = (\n runtimeCore as typeof runtimeCore & {\n Global?: typeof runtimeCore.Global;\n }\n ).Global;\n if (!globalRef || typeof globalRef !== 'object') {\n return args;\n }\n const name = args.options.name;\n const version = __VERSION__;\n if (\n globalRef._FEDERATION_RUNTIME_CORE &&\n globalRef._FEDERATION_RUNTIME_CORE_FROM &&\n (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||\n globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)\n ) {\n console.warn(\n `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!`,\n );\n return args;\n }\n globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;\n globalRef._FEDERATION_RUNTIME_CORE_FROM = {\n version,\n name,\n };\n return args;\n },\n };\n}\n\nexport default injectExternalRuntimeCorePlugin;\n"],"mappings":";;;;AAGA,MAAM,cACH,sBACD;AAUF,SAAS,kCAAiE;AACxE,QAAO;EACL,MAAM;EACN;EACA,WAAW,MAAM;GACf,MAAM,YACJ,YAGA;AACF,OAAI,CAAC,aAAa,OAAO,cAAc,SACrC,QAAO;GAET,MAAM,OAAO,KAAK,QAAQ;GAC1B,MAAM;AACN,OACE,UAAU,4BACV,UAAU,kCACT,UAAU,8BAA8B,SAAS,QAChD,UAAU,8BAA8B,YAAY,UACtD;AACA,YAAQ,KACN,oEAAoE,UAAU,8BAA8B,KAAK,GAAG,UAAU,8BAA8B,QAAQ,kBAAkB,KAAK,GAAG,QAAQ,mEACvM;AACD,WAAO;;AAET,aAAU,2BAA2B;AACrC,aAAU,gCAAgC;IACxC;IACA;IACD;AACD,UAAO;;EAEV"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';\n\nimport type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';\ndeclare global {\n var __VERSION__: string;\n var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;\n var _FEDERATION_RUNTIME_CORE_FROM: {\n version: string;\n name: string;\n };\n}\n\nfunction injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin {\n return {\n name: 'inject-external-runtime-core-plugin',\n version: __VERSION__,\n beforeInit(args) {\n const globalRef = (\n runtimeCore as typeof runtimeCore & {\n Global?: typeof runtimeCore.Global;\n }\n ).Global;\n if (!globalRef || typeof globalRef !== 'object') {\n return args;\n }\n const name = args.options.name;\n const version = __VERSION__;\n if (\n globalRef._FEDERATION_RUNTIME_CORE &&\n globalRef._FEDERATION_RUNTIME_CORE_FROM &&\n (globalRef._FEDERATION_RUNTIME_CORE_FROM.name !== name ||\n globalRef._FEDERATION_RUNTIME_CORE_FROM.version !== version)\n ) {\n console.warn(\n `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!`,\n );\n return args;\n }\n globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;\n globalRef._FEDERATION_RUNTIME_CORE_FROM = {\n version,\n name,\n };\n return args;\n },\n };\n}\n\nexport default injectExternalRuntimeCorePlugin;\n"],"mappings":";;;AAYA,SAAS,kCAAiE;AACxE,QAAO;EACL,MAAM;EACN;EACA,WAAW,MAAM;GACf,MAAM,YACJ,YAGA;AACF,OAAI,CAAC,aAAa,OAAO,cAAc,SACrC,QAAO;GAET,MAAM,OAAO,KAAK,QAAQ;GAC1B,MAAM;AACN,OACE,UAAU,4BACV,UAAU,kCACT,UAAU,8BAA8B,SAAS,QAChD,UAAU,8BAA8B,YAAY,UACtD;AACA,YAAQ,KACN,oEAAoE,UAAU,8BAA8B,KAAK,GAAG,UAAU,8BAA8B,QAAQ,kBAAkB,KAAK,GAAG,QAAQ,mEACvM;AACD,WAAO;;AAET,aAAU,2BAA2B;AACrC,aAAU,gCAAgC;IACxC;IACA;IACD;AACD,UAAO;;EAEV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/inject-external-runtime-core-plugin",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A sdk for support module federation",
@@ -45,13 +45,14 @@
45
45
  }
46
46
  },
47
47
  "peerDependencies": {
48
- "@module-federation/runtime-tools": "2.3.1"
48
+ "@module-federation/runtime-tools": "2.3.3"
49
49
  },
50
50
  "devDependencies": {
51
- "@module-federation/runtime-tools": "2.3.1"
51
+ "@module-federation/runtime-tools": "2.3.3"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tsdown --config tsdown.config.ts --filter inject-external-runtime-core-plugin-build",
55
+ "test": "NODE_OPTIONS=--experimental-vm-modules pnpm exec jest --config jest.config.cjs",
55
56
  "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
56
57
  "pre-release": "pnpm run build"
57
58
  }