@module-federation/inject-external-runtime-core-plugin 0.0.0-perf-devtools-20260107043700 → 0.0.0-pre-release-2-5-20260518135705

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # `@module-federation/inject-external-runtime-core-plugin`
1
+ # `@module-federation/inject-external-runtime-core-plugin`
2
2
 
3
- This runtime plugin will inject `@module-federation/runtime-core` .
3
+ This runtime plugin will inject `@module-federation/runtime-core` .
4
4
 
5
- And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin.
5
+ And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin.
6
6
 
7
7
  The provider can use host's runtime when set `experiments.externalRuntime: true`.
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs ADDED
@@ -0,0 +1,31 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ let _module_federation_runtime_tools_runtime_core = require("@module-federation/runtime-tools/runtime-core");
3
+ _module_federation_runtime_tools_runtime_core = require_runtime.__toESM(_module_federation_runtime_tools_runtime_core);
4
+
5
+ //#region src/index.ts
6
+ function injectExternalRuntimeCorePlugin() {
7
+ return {
8
+ name: "inject-external-runtime-core-plugin",
9
+ version: "0.0.0-pre-release-2-5-20260518135705",
10
+ beforeInit(args) {
11
+ const globalRef = _module_federation_runtime_tools_runtime_core.Global;
12
+ if (!globalRef || typeof globalRef !== "object") return args;
13
+ const name = args.options.name;
14
+ const version = "0.0.0-pre-release-2-5-20260518135705";
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)) {
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!`);
17
+ return args;
18
+ }
19
+ globalRef._FEDERATION_RUNTIME_CORE = _module_federation_runtime_tools_runtime_core;
20
+ globalRef._FEDERATION_RUNTIME_CORE_FROM = {
21
+ version,
22
+ name
23
+ };
24
+ return args;
25
+ }
26
+ };
27
+ }
28
+
29
+ //#endregion
30
+ module.exports = injectExternalRuntimeCorePlugin;
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
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,2 +1,16 @@
1
- export * from "./src/index";
2
- export { default } from "./src/index";
1
+ import * as runtimeCore from "@module-federation/runtime-tools/runtime-core";
2
+ import { ModuleFederationRuntimePlugin } from "@module-federation/runtime-tools/runtime-core";
3
+
4
+ //#region src/index.d.ts
5
+ declare global {
6
+ var __VERSION__: string;
7
+ var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;
8
+ var _FEDERATION_RUNTIME_CORE_FROM: {
9
+ version: string;
10
+ name: string;
11
+ };
12
+ }
13
+ declare function injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin;
14
+ //#endregion
15
+ export { injectExternalRuntimeCorePlugin as default };
16
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ import * as runtimeCore from "@module-federation/runtime-tools/runtime-core";
2
+
3
+ //#region src/index.ts
4
+ function injectExternalRuntimeCorePlugin() {
5
+ return {
6
+ name: "inject-external-runtime-core-plugin",
7
+ version: "0.0.0-pre-release-2-5-20260518135705",
8
+ beforeInit(args) {
9
+ const globalRef = runtimeCore.Global;
10
+ if (!globalRef || typeof globalRef !== "object") return args;
11
+ const name = args.options.name;
12
+ const version = "0.0.0-pre-release-2-5-20260518135705";
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)) {
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!`);
15
+ return args;
16
+ }
17
+ globalRef._FEDERATION_RUNTIME_CORE = runtimeCore;
18
+ globalRef._FEDERATION_RUNTIME_CORE_FROM = {
19
+ version,
20
+ name
21
+ };
22
+ return args;
23
+ }
24
+ };
25
+ }
26
+
27
+ //#endregion
28
+ export { injectExternalRuntimeCorePlugin as default };
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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": "0.0.0-perf-devtools-20260107043700",
3
+ "version": "0.0.0-pre-release-2-5-20260518135705",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A sdk for support module federation",
@@ -22,27 +22,38 @@
22
22
  },
23
23
  "author": "zhanghang <hanric.zhang@gmail.com>",
24
24
  "sideEffects": false,
25
- "main": "./dist/index.cjs.cjs",
26
- "module": "./dist/index.esm.js",
27
- "types": "./dist/index.cjs.d.ts",
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
28
  "exports": {
29
29
  ".": {
30
- "types": "./dist/index.cjs.d.ts",
31
- "import": "./dist/index.esm.js",
32
- "require": "./dist/index.cjs.cjs"
30
+ "import": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.cjs"
37
+ }
33
38
  }
34
39
  },
35
40
  "typesVersions": {
36
41
  "*": {
37
42
  ".": [
38
- "./dist/index.cjs.d.ts"
43
+ "./dist/index.d.ts"
39
44
  ]
40
45
  }
41
46
  },
42
47
  "peerDependencies": {
43
- "@module-federation/runtime-tools": "0.0.0-perf-devtools-20260107043700"
48
+ "@module-federation/runtime-tools": "0.0.0-pre-release-2-5-20260518135705"
44
49
  },
45
50
  "devDependencies": {
46
- "@module-federation/runtime-tools": "0.0.0-perf-devtools-20260107043700"
51
+ "@module-federation/runtime-tools": "0.0.0-pre-release-2-5-20260518135705"
52
+ },
53
+ "scripts": {
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",
56
+ "lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
57
+ "pre-release": "pnpm run build"
47
58
  }
48
59
  }
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- var runtimeCore = require('@module-federation/runtime-tools/runtime-core');
4
-
5
- function _interopNamespaceDefault(e) {
6
- var n = Object.create(null);
7
- if (e) {
8
- for (var k in e) {
9
- n[k] = e[k];
10
- }
11
- }
12
- n.default = e;
13
- return Object.freeze(n);
14
- }
15
-
16
- var runtimeCore__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeCore);
17
-
18
- function injectExternalRuntimeCorePlugin() {
19
- return {
20
- name: 'inject-external-runtime-core-plugin',
21
- version: "0.0.0-perf-devtools-20260107043700",
22
- beforeInit(args) {
23
- const name = args.options.name;
24
- const version = "0.0.0-perf-devtools-20260107043700";
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
- return args;
31
- }
32
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE = runtimeCore__namespace;
33
- runtimeCore__namespace.Global._FEDERATION_RUNTIME_CORE_FROM = {
34
- version,
35
- name,
36
- };
37
- return args;
38
- },
39
- };
40
- }
41
-
42
- module.exports = injectExternalRuntimeCorePlugin;
43
- //# sourceMappingURL=index.cjs.cjs.map
@@ -1 +0,0 @@
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,oCAAW;AACpB,QAAA,UAAU,CAAC,IAAI,EAAA;AACb,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YAC9B,MAAM,OAAO,GAAG,oCAAW;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,CAAoE,iEAAA,EAAAA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,CAAA,CAAA,EAAIA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,OAAO,CAAmB,gBAAA,EAAA,IAAI,CAAI,CAAA,EAAA,OAAO,CAAmE,iEAAA,CAAA,CAC3R;AACD,gBAAA,OAAO,IAAI;;AAEb,YAAAA,sBAAW,CAAC,MAAM,CAAC,wBAAwB,GAAGA,sBAAW;AACzD,YAAAA,sBAAW,CAAC,MAAM,CAAC,6BAA6B,GAAG;gBACjD,OAAO;gBACP,IAAI;aACL;AACD,YAAA,OAAO,IAAI;SACZ;KACF;AACH;;;;"}
@@ -1,2 +0,0 @@
1
- export * from "./src/index";
2
- export { default } from "./src/index";
package/dist/index.esm.js DELETED
@@ -1,28 +0,0 @@
1
- import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';
2
-
3
- function injectExternalRuntimeCorePlugin() {
4
- return {
5
- name: 'inject-external-runtime-core-plugin',
6
- version: "0.0.0-perf-devtools-20260107043700",
7
- beforeInit(args) {
8
- const name = args.options.name;
9
- const version = "0.0.0-perf-devtools-20260107043700";
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!`);
15
- return args;
16
- }
17
- runtimeCore.Global._FEDERATION_RUNTIME_CORE = runtimeCore;
18
- runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM = {
19
- version,
20
- name,
21
- };
22
- return args;
23
- },
24
- };
25
- }
26
-
27
- export { injectExternalRuntimeCorePlugin as default };
28
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
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,oCAAW;AACpB,QAAA,UAAU,CAAC,IAAI,EAAA;AACb,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI;YAC9B,MAAM,OAAO,GAAG,oCAAW;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,CAAoE,iEAAA,EAAA,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,IAAI,CAAA,CAAA,EAAI,WAAW,CAAC,MAAM,CAAC,6BAA6B,CAAC,OAAO,CAAmB,gBAAA,EAAA,IAAI,CAAI,CAAA,EAAA,OAAO,CAAmE,iEAAA,CAAA,CAC3R;AACD,gBAAA,OAAO,IAAI;;AAEb,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;SACZ;KACF;AACH;;;;"}
@@ -1,12 +0,0 @@
1
- import * as runtimeCore from '@module-federation/runtime-tools/runtime-core';
2
- import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core';
3
- declare global {
4
- var __VERSION__: string;
5
- var _FEDERATION_RUNTIME_CORE: typeof runtimeCore;
6
- var _FEDERATION_RUNTIME_CORE_FROM: {
7
- version: string;
8
- name: string;
9
- };
10
- }
11
- declare function injectExternalRuntimeCorePlugin(): ModuleFederationRuntimePlugin;
12
- export default injectExternalRuntimeCorePlugin;