@module-federation/inject-external-runtime-core-plugin 0.0.0-chore-bump-node-22-20260710161714

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present zhanghang(2heal1)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # `@module-federation/inject-external-runtime-core-plugin`
2
+
3
+ This runtime plugin will inject `@module-federation/runtime-core` .
4
+
5
+ And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin.
6
+
7
+ The provider can use host's runtime when set `experiments.externalRuntime: true`.
package/dist/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present zhanghang(2heal1)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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-chore-bump-node-22-20260710161714",
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-chore-bump-node-22-20260710161714";
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"}
@@ -0,0 +1,15 @@
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
+ export = injectExternalRuntimeCorePlugin;
15
+ //# 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-chore-bump-node-22-20260710161714",
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-chore-bump-node-22-20260710161714";
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 ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@module-federation/inject-external-runtime-core-plugin",
3
+ "version": "0.0.0-chore-bump-node-22-20260710161714",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "A sdk for support module federation",
7
+ "keywords": [
8
+ "Module Federation",
9
+ "sdk"
10
+ ],
11
+ "files": [
12
+ "dist/",
13
+ "README.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/module-federation/core.git",
21
+ "directory": "packages/runtime-plugins/inject-external-runtime-core-plugin"
22
+ },
23
+ "author": "zhanghang <hanric.zhang@gmail.com>",
24
+ "sideEffects": false,
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
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
+ }
38
+ }
39
+ },
40
+ "typesVersions": {
41
+ "*": {
42
+ ".": [
43
+ "./dist/index.d.ts"
44
+ ]
45
+ }
46
+ },
47
+ "peerDependencies": {
48
+ "@module-federation/runtime-tools": "0.0.0-chore-bump-node-22-20260710161714"
49
+ },
50
+ "devDependencies": {
51
+ "@module-federation/runtime-tools": "0.0.0-chore-bump-node-22-20260710161714"
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"
58
+ }
59
+ }