@vc-shell/mf-host 2.0.0-alpha.10

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/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # [2.0.0-alpha.10](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2026-03-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **mf-host:** add mfHostConfig() vite helper for optimizeDeps ([501841d](https://github.com/VirtoCommerce/vc-shell/commit/501841d457ad9f3c671c41723b65045fae075d28))
7
+ * **mf-host:** import shared deps from mf-config instead of duplicating ([51d2df1](https://github.com/VirtoCommerce/vc-shell/commit/51d2df126ac45ca388c7eb5ce8943fc324938a25))
8
+ # [2.0.0-alpha.9](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2026-03-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * topological build order, deprecation fixes, and dependency updates ([bf01eaf](https://github.com/VirtoCommerce/vc-shell/commit/bf01eaf7574eda5ae393941b553cbea5918a768f))
14
+ # Changelog
15
+
16
+ All notable changes to this project will be documented in this file.
17
+
18
+ ## [2.0.0-alpha.8](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2026-03-12)
19
+
20
+ ### Features
21
+
22
+ * **mf:** extract Module Federation loader into @vc-shell/mf-config and @vc-shell/mf-host ([9b079c2](https://github.com/VirtoCommerce/vc-shell/commit/9b079c27b))
@@ -0,0 +1,3 @@
1
+ export { registerRemoteModules } from "./register-remote-modules.js";
2
+ export type { RegisterRemoteModulesOptions, ModuleRegistryEntry } from "./register-remote-modules.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { registerRemoteModules } from "./register-remote-modules.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type App } from "vue";
2
+ import type { Router } from "vue-router";
3
+ export interface ModuleRegistryEntry {
4
+ id: string;
5
+ entry: string;
6
+ version: string;
7
+ compatibleWith?: {
8
+ dependencies?: Record<string, string>;
9
+ requires?: Record<string, string>;
10
+ };
11
+ }
12
+ export interface RegisterRemoteModulesOptions {
13
+ router: Router;
14
+ appName: string;
15
+ }
16
+ /**
17
+ * Discover and load remote MF modules from the server registry.
18
+ *
19
+ * Call this in your app's main.ts BEFORE app.mount():
20
+ * ```ts
21
+ * import { registerRemoteModules } from "@vc-shell/mf-host";
22
+ * registerRemoteModules(app, { router, appName: "my-app" });
23
+ * ```
24
+ *
25
+ * The function is fire-and-forget (async internally).
26
+ * It provides `ModulesReadyKey` and `ModulesLoadErrorKey` refs via app.provide()
27
+ * so components can react to loading state.
28
+ */
29
+ export declare function registerRemoteModules(app: App, options: RegisterRemoteModulesOptions): void;
30
+ //# sourceMappingURL=register-remote-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-remote-modules.d.ts","sourceRoot":"","sources":["../src/register-remote-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,GAAG,EAAe,MAAM,KAAK,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA+CzC,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE;QACf,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC,CAAC;CACH;AAMD,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAuCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CA0H3F"}
@@ -0,0 +1,202 @@
1
+ import { ref } from "vue";
2
+ import * as semver from "semver";
3
+ import { createInstance } from "@module-federation/runtime";
4
+ import { SHARED_DEPS_BASE } from "@vc-shell/mf-config";
5
+ // Shared deps — statically imported. No circular dependency because
6
+ // this package is separate from @vc-shell/framework.
7
+ import * as Vue from "vue";
8
+ import * as VueRouter from "vue-router";
9
+ import * as VueI18n from "vue-i18n";
10
+ import * as VeeValidate from "vee-validate";
11
+ import * as LodashEs from "lodash-es";
12
+ import * as VueuseCore from "@vueuse/core";
13
+ import * as Framework from "@vc-shell/framework";
14
+ // Read versions from package.json to avoid rollup warnings about missing named exports
15
+ import vuePkg from "vue/package.json";
16
+ import vueRouterPkg from "vue-router/package.json";
17
+ import vueI18nPkg from "vue-i18n/package.json";
18
+ import lodashEsPkg from "lodash-es/package.json";
19
+ import vueusePkg from "@vueuse/core/package.json";
20
+ import frameworkPkg from "@vc-shell/framework/package.json";
21
+ const REGISTRY_URL = "/api/frontend-modules";
22
+ const RUNTIME_LIBS = {
23
+ vue: { lib: () => Vue, version: vuePkg.version },
24
+ "vue-router": { lib: () => VueRouter, version: vueRouterPkg.version },
25
+ "vue-i18n": { lib: () => VueI18n, version: vueI18nPkg.version },
26
+ "vee-validate": { lib: () => VeeValidate, version: VeeValidate.version ?? "4.0.0" },
27
+ "lodash-es": { lib: () => LodashEs, version: lodashEsPkg.version },
28
+ "@vueuse/core": { lib: () => VueuseCore, version: vueusePkg.version },
29
+ "@vc-shell/framework": { lib: () => Framework, version: frameworkPkg.version },
30
+ };
31
+ const SHARED_LIBS = Object.fromEntries(Object.entries(SHARED_DEPS_BASE).map(([name, config]) => {
32
+ const runtime = RUNTIME_LIBS[name];
33
+ if (!runtime) {
34
+ throw new Error(`[mf-host] Missing runtime mapping for shared dep "${name}". Update RUNTIME_LIBS.`);
35
+ }
36
+ return [name, { ...runtime, requiredVersion: config.requiredVersion ?? "*" }];
37
+ }));
38
+ // --- Helper functions ---
39
+ /** Resolve Vue plugin(s) from MF module exports. */
40
+ function resolvePlugins(exports) {
41
+ const mod = exports;
42
+ if (!mod)
43
+ return [];
44
+ if (mod.default?.install)
45
+ return [mod.default];
46
+ if (mod.install)
47
+ return [mod];
48
+ const target = mod.default ?? mod;
49
+ const plugins = [];
50
+ for (const value of Object.values(target)) {
51
+ const v = value;
52
+ if (!v || typeof v !== "object")
53
+ continue;
54
+ if ("install" in v) {
55
+ plugins.push(v);
56
+ }
57
+ else if (v.default?.install) {
58
+ plugins.push(v.default);
59
+ }
60
+ }
61
+ return plugins;
62
+ }
63
+ /** Convert NuGet-style version range notation to semver. */
64
+ function humanizeRange(range) {
65
+ const exact = range.match(/^\[\s*([^\],]+?)\s*\]$/);
66
+ if (exact)
67
+ return exact[1];
68
+ const m = range.match(/^([[\(])\s*([^,]*?)\s*,\s*([^)\]]*?)\s*([)\]])$/);
69
+ if (!m)
70
+ return range;
71
+ const [, openBracket, lower, upper, closeBracket] = m;
72
+ const parts = [];
73
+ if (lower)
74
+ parts.push(`${openBracket === "[" ? ">=" : ">"}${lower}`);
75
+ if (upper)
76
+ parts.push(`${closeBracket === "]" ? "<=" : "<"}${upper}`);
77
+ return parts.join(" ") || range;
78
+ }
79
+ // --- Main function ---
80
+ /**
81
+ * Discover and load remote MF modules from the server registry.
82
+ *
83
+ * Call this in your app's main.ts BEFORE app.mount():
84
+ * ```ts
85
+ * import { registerRemoteModules } from "@vc-shell/mf-host";
86
+ * registerRemoteModules(app, { router, appName: "my-app" });
87
+ * ```
88
+ *
89
+ * The function is fire-and-forget (async internally).
90
+ * It provides `ModulesReadyKey` and `ModulesLoadErrorKey` refs via app.provide()
91
+ * so components can react to loading state.
92
+ */
93
+ export function registerRemoteModules(app, options) {
94
+ const { ModulesReadyKey, ModulesLoadErrorKey } = Framework;
95
+ const modulesReady = ref(false);
96
+ const modulesLoadError = ref(false);
97
+ app.provide(ModulesReadyKey, modulesReady);
98
+ app.provide(ModulesLoadErrorKey, modulesLoadError);
99
+ // Fire-and-forget async loading
100
+ (async () => {
101
+ try {
102
+ performance.mark("vc:modules-start");
103
+ const frameworkVersion = frameworkPkg.version;
104
+ // 1. Build provides dict
105
+ const provides = {};
106
+ for (const [name, entry] of Object.entries(SHARED_LIBS)) {
107
+ provides[name] = entry.version;
108
+ }
109
+ // 2. Fetch registry
110
+ const response = await fetch(REGISTRY_URL, {
111
+ method: "POST",
112
+ credentials: "same-origin",
113
+ headers: { "Content-Type": "application/json" },
114
+ body: JSON.stringify({ appName: options.appName, provides }),
115
+ });
116
+ if (response.status === 401 || response.status === 403) {
117
+ modulesReady.value = true;
118
+ performance.mark("vc:modules-done");
119
+ return;
120
+ }
121
+ if (!response.ok) {
122
+ throw new Error(`Registry fetch failed: ${response.status} ${response.statusText}`);
123
+ }
124
+ const registry = await response.json();
125
+ const modules = Array.isArray(registry.modules)
126
+ ? registry.modules.filter((m) => typeof m?.id === "string" && typeof m?.entry === "string" && typeof m?.version === "string")
127
+ : [];
128
+ // 3. Compatibility filter
129
+ const compatible = modules.filter((mod) => {
130
+ const fwRange = mod.compatibleWith?.dependencies?.["@vc-shell/framework"];
131
+ if (!fwRange)
132
+ return true;
133
+ const range = humanizeRange(fwRange);
134
+ const coerced = semver.coerce(frameworkVersion)?.version ?? frameworkVersion;
135
+ const ok = semver.satisfies(coerced, range);
136
+ if (!ok)
137
+ console.warn(`[mf-host] Module "${mod.id}" v${mod.version} requires framework ${range}, current ${frameworkVersion}. Skipping.`);
138
+ return ok;
139
+ });
140
+ if (compatible.length === 0) {
141
+ modulesReady.value = true;
142
+ performance.mark("vc:modules-done");
143
+ return;
144
+ }
145
+ // 4. Init MF runtime
146
+ const shared = {};
147
+ for (const [name, entry] of Object.entries(SHARED_LIBS)) {
148
+ shared[name] = {
149
+ version: entry.version,
150
+ lib: entry.lib,
151
+ shareConfig: { singleton: true, requiredVersion: entry.requiredVersion },
152
+ };
153
+ }
154
+ const mfInstance = createInstance({
155
+ name: "host",
156
+ remotes: compatible.map((mod) => ({ name: mod.id, entry: mod.entry, type: "module" })),
157
+ shared,
158
+ });
159
+ // 5. Load all in parallel
160
+ const results = await Promise.allSettled(compatible.map(async (mod) => ({ mod, exports: await mfInstance.loadRemote(`${mod.id}/module`) })));
161
+ performance.mark("vc:modules-loaded");
162
+ const loaded = [];
163
+ const failed = [];
164
+ for (let i = 0; i < results.length; i++) {
165
+ const r = results[i];
166
+ if (r.status === "fulfilled")
167
+ loaded.push(r.value);
168
+ else
169
+ failed.push({ mod: compatible[i], error: r.reason });
170
+ }
171
+ for (const { mod, error } of failed)
172
+ console.error(`[mf-host] Failed to load "${mod.id}":`, error);
173
+ // 6. Install plugins
174
+ for (const { mod, exports } of loaded) {
175
+ const plugins = resolvePlugins(exports);
176
+ if (plugins.length > 0) {
177
+ for (const plugin of plugins)
178
+ app.use(plugin, { router: options.router });
179
+ console.info(`[mf-host] "${mod.id}" v${mod.version} installed (${plugins.length} sub-module(s)).`);
180
+ }
181
+ else {
182
+ console.error(`[mf-host] "${mod.id}" has no install function. Skipping.`);
183
+ }
184
+ }
185
+ if (failed.length > 0) {
186
+ console.warn(`[mf-host] ${loaded.length}/${compatible.length} modules loaded. Failed: [${failed.map((f) => f.mod.id).join(", ")}]`);
187
+ }
188
+ performance.mark("vc:modules-installed");
189
+ modulesReady.value = true;
190
+ const resolvedPath = options.router.currentRoute.value.fullPath;
191
+ if (resolvedPath !== "/")
192
+ options.router.replace(resolvedPath);
193
+ performance.mark("vc:modules-done");
194
+ }
195
+ catch (error) {
196
+ console.error("[mf-host] Module loading failed:", error);
197
+ modulesLoadError.value = true;
198
+ performance.mark("vc:modules-done");
199
+ }
200
+ })();
201
+ }
202
+ //# sourceMappingURL=register-remote-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-remote-modules.js","sourceRoot":"","sources":["../src/register-remote-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAyB,MAAM,KAAK,CAAC;AAEjD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,oEAAoE;AACpE,qDAAqD;AACrD,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AAEjD,uFAAuF;AACvF,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAE5D,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C,MAAM,YAAY,GAA4D;IAC5E,GAAG,EAAoB,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAU,OAAO,EAAE,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itive MF runtime dependency to prevent dev-mode full-reloads.
5
+ */
6
+ export declare function mfHostConfig(): UserConfig;
7
+ //# sourceMappingURL=vite-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-helper.d.ts","sourceRoot":"","sources":["../src/vite-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,YAAY,IAAI,UAAU,CAMzC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Vite config helper for MF host apps.
3
+ * Pre-bundles transitive MF runtime dependency to prevent dev-mode full-reloads.
4
+ */
5
+ export function mfHostConfig() {
6
+ return {
7
+ optimizeDeps: {
8
+ include: ["@vc-shell/mf-host > @module-federation/runtime"],
9
+ },
10
+ };
11
+ }
12
+ //# sourceMappingURL=vite-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-helper.js","sourceRoot":"","sources":["../src/vite-helper.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,gDAAgD,CAAC;SAC5D;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@vc-shell/mf-host",
3
+ "description": "Module Federation host runtime for VC Shell — discovers and loads remote modules",
4
+ "version": "2.0.0-alpha.10",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./vite": {
14
+ "types": "./dist/vite-helper.d.ts",
15
+ "import": "./dist/vite-helper.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsc -b --clean && tsc && tsc-alias",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest"
25
+ },
26
+ "dependencies": {
27
+ "@module-federation/runtime": "^2.1.0",
28
+ "@vc-shell/mf-config": "2.0.0-alpha.10",
29
+ "semver": "^7.6.2"
30
+ },
31
+ "peerDependencies": {
32
+ "@vc-shell/framework": "^2.0.0-alpha.10",
33
+ "@vueuse/core": "^10.0.0",
34
+ "lodash-es": "^4.0.0",
35
+ "vee-validate": "^4.12.0",
36
+ "vue": "^3.4.0",
37
+ "vue-i18n": "^9.0.0 || ^11.0.0",
38
+ "vue-router": "^4.0.0 || ^5.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/semver": "^7.5.0",
42
+ "@vc-shell/framework": "2.0.0-alpha.10",
43
+ "@vc-shell/ts-config": "2.0.0-alpha.10",
44
+ "@vueuse/core": "^10.7.1",
45
+ "lodash-es": "^4.17.21",
46
+ "tsc-alias": "^1.8.8",
47
+ "typescript": "^5.8.3",
48
+ "vee-validate": "^4.12.4",
49
+ "vite": "^6.0.0",
50
+ "vitest": "^3.2.4",
51
+ "vue": "^3.5.30",
52
+ "vue-i18n": "^11.3.0",
53
+ "vue-router": "^5.0.3"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public",
57
+ "registry": "https://registry.npmjs.org/"
58
+ }
59
+ }