@vc-shell/mf-module 2.0.4 → 2.0.6
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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.6](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.5...v2.0.6) (2026-05-25)
|
|
4
|
+
|
|
5
|
+
**Note:** Version bump only for package @vc-shell/mf-module
|
|
6
|
+
|
|
7
|
+
## [2.0.5](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.4...v2.0.5) (2026-05-25)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- migrate Module Federation host to backoffice modularity manifest endpoint (#228) ([b767fd8](https://github.com/VirtoCommerce/vc-shell/commit/b767fd821dda91690f23fd7122602f311d884c3f)), closes [#228](https://github.com/VirtoCommerce/vc-shell/issues/228) [vc-platform#3019](https://github.com/vc-platform/issues/3019)
|
|
12
|
+
|
|
3
13
|
## [2.0.4](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.3...v2.0.4) (2026-05-18)
|
|
4
14
|
|
|
5
15
|
**Note:** Version bump only for package @vc-shell/mf-module
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-module-config.d.ts","sourceRoot":"","sources":["../src/dynamic-module-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-module-config.d.ts","sourceRoot":"","sources":["../src/dynamic-module-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAChD,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACtC,OAAO,EAAE,oBAAoB,GAC5B,UAAU,CAyCZ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import vue from "@vitejs/plugin-vue";
|
|
2
3
|
import { federation } from "@module-federation/vite";
|
|
3
4
|
import { REMOTE_SHARED } from "@vc-shell/mf-config";
|
|
@@ -6,6 +7,18 @@ import { viteBladePlugin } from "@vc-shell/config-generator";
|
|
|
6
7
|
export default function dynamicModuleConfiguration(pkg, options) {
|
|
7
8
|
const entry = options.entry ?? "./src/modules/index.ts";
|
|
8
9
|
const base = process.env.APP_BASE_PATH || `/apps/${pkg.name}/`;
|
|
10
|
+
const remoteName = options.remoteName ?? pkg.name;
|
|
11
|
+
let outDir;
|
|
12
|
+
let emptyOutDir;
|
|
13
|
+
if (options.appId) {
|
|
14
|
+
const moduleRoot = options.moduleRoot ?? process.cwd();
|
|
15
|
+
outDir = path.resolve(moduleRoot, "plugins", options.appId);
|
|
16
|
+
emptyOutDir = true;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
outDir = "dist/mf";
|
|
20
|
+
// emptyOutDir left undefined — preserves Vite's default (auto-clean for inside-root).
|
|
21
|
+
}
|
|
9
22
|
return {
|
|
10
23
|
base,
|
|
11
24
|
plugins: [
|
|
@@ -13,10 +26,13 @@ export default function dynamicModuleConfiguration(pkg, options) {
|
|
|
13
26
|
stripExternalStyles(),
|
|
14
27
|
vue(),
|
|
15
28
|
federation({
|
|
16
|
-
name:
|
|
29
|
+
name: remoteName,
|
|
17
30
|
filename: "remoteEntry.js",
|
|
31
|
+
// "./Module" matches the platform's PluginRemote.exposed default
|
|
32
|
+
// (AppManifestService.DefaultExposedModule in vc-platform). Plugin
|
|
33
|
+
// authors who need a different key can override via `options.exposes`.
|
|
18
34
|
exposes: options.exposes ?? {
|
|
19
|
-
"./
|
|
35
|
+
"./Module": entry,
|
|
20
36
|
},
|
|
21
37
|
shared: { ...REMOTE_SHARED },
|
|
22
38
|
dts: false,
|
|
@@ -24,7 +40,8 @@ export default function dynamicModuleConfiguration(pkg, options) {
|
|
|
24
40
|
],
|
|
25
41
|
build: {
|
|
26
42
|
target: "esnext",
|
|
27
|
-
outDir
|
|
43
|
+
outDir,
|
|
44
|
+
emptyOutDir,
|
|
28
45
|
},
|
|
29
46
|
};
|
|
30
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-module-config.js","sourceRoot":"","sources":["../src/dynamic-module-config.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAChD,GAAsC,EACtC,OAA6B;IAE7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS,GAAG,CAAC,IAAI,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamic-module-config.js","sourceRoot":"","sources":["../src/dynamic-module-config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAChD,GAAsC,EACtC,OAA6B;IAE7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,wBAAwB,CAAC;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS,GAAG,CAAC,IAAI,GAAG,CAAC;IAC/D,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC,IAAI,CAAC;IAElD,IAAI,MAAc,CAAC;IACnB,IAAI,WAAgC,CAAC;IACrC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACvD,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5D,WAAW,GAAG,IAAI,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,SAAS,CAAC;QACnB,sFAAsF;IACxF,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO,EAAE;YACP,eAAe,EAAE;YACjB,mBAAmB,EAAE;YACrB,GAAG,EAAE;YACL,UAAU,CAAC;gBACT,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,gBAAgB;gBAC1B,iEAAiE;gBACjE,mEAAmE;gBACnE,uEAAuE;gBACvE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI;oBAC1B,UAAU,EAAE,KAAK;iBAClB;gBACD,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE;gBAC5B,GAAG,EAAE,KAAK;aACX,CAAC;SACH;QACD,KAAK,EAAE;YACL,MAAM,EAAE,QAAQ;YAChB,MAAM;YACN,WAAW;SACZ;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { UserConfig } from "vite";
|
|
2
2
|
/**
|
|
3
|
-
* Compatibility options for dynamic modules
|
|
3
|
+
* Compatibility options for dynamic modules.
|
|
4
|
+
* Metadata only — not used during build. The platform validates module
|
|
5
|
+
* dependencies at install time via the .NET dependency graph.
|
|
4
6
|
*/
|
|
5
7
|
export interface CompatibilityOptions {
|
|
6
8
|
/**
|
|
@@ -18,18 +20,49 @@ export interface CompatibilityOptions {
|
|
|
18
20
|
* Dynamic module configuration options (Module Federation)
|
|
19
21
|
*/
|
|
20
22
|
export interface DynamicModuleOptions extends UserConfig {
|
|
23
|
+
/**
|
|
24
|
+
* The platform app identifier (e.g. `"vendor-portal"`). When set, build
|
|
25
|
+
* output goes to `<moduleRoot>/plugins/<appId>/` AND the platform serves
|
|
26
|
+
* the remote entry via `GET /api/apps/<appId>/manifest`.
|
|
27
|
+
*
|
|
28
|
+
* Omit for legacy build (outDir defaults to "dist/mf").
|
|
29
|
+
*/
|
|
30
|
+
appId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Absolute path to the .NET module root (the folder containing
|
|
33
|
+
* module.manifest). Used with `appId` to compute the final outDir.
|
|
34
|
+
* Defaults to `process.cwd()` — correct when vite.config.ts sits
|
|
35
|
+
* directly at the .NET module root.
|
|
36
|
+
*
|
|
37
|
+
* For multi-plugin .NET modules where vite.config.ts is in a subfolder:
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { fileURLToPath } from "node:url";
|
|
40
|
+
* import path from "node:path";
|
|
41
|
+
* const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
* moduleRoot: path.resolve(__dirname, "..");
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
moduleRoot?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Module Federation `name` for this remote. Must equal `remote.name`
|
|
48
|
+
* returned by the platform manifest for this plugin — by default the
|
|
49
|
+
* .NET module id (e.g. "VirtoCommerce.MarketplaceReview"). Defaults
|
|
50
|
+
* to `pkg.name` (the npm package name) when omitted.
|
|
51
|
+
*/
|
|
52
|
+
remoteName?: string;
|
|
21
53
|
/**
|
|
22
54
|
* Entry point for the module
|
|
23
55
|
* @default "./src/modules/index.ts"
|
|
24
56
|
*/
|
|
25
57
|
entry?: string;
|
|
26
58
|
/**
|
|
27
|
-
* Custom MF exposes map. Overrides default `{ "./
|
|
59
|
+
* Custom MF exposes map. Overrides default `{ "./Module": entry }`
|
|
60
|
+
* (matches the platform's `PluginRemote.exposed` default).
|
|
28
61
|
*/
|
|
29
62
|
exposes?: Record<string, string>;
|
|
30
63
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
64
|
+
* @deprecated metadata only — platform ignores this field; rely on
|
|
65
|
+
* `<dependency>` declarations in module.manifest instead.
|
|
33
66
|
*/
|
|
34
67
|
compatibility?: CompatibilityOptions;
|
|
35
68
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vc-shell/mf-module",
|
|
3
3
|
"description": "Module Federation build config for VC Shell remote modules",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@module-federation/vite": "^1.12.2",
|
|
24
|
-
"@vc-shell/mf-config": "2.0.
|
|
24
|
+
"@vc-shell/mf-config": "2.0.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@vc-shell/ts-config": "2.0.
|
|
27
|
+
"@vc-shell/ts-config": "2.0.6",
|
|
28
28
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
29
29
|
"tsc-alias": "^1.8.8",
|
|
30
30
|
"typescript": "^5.8.3",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vue": "^3.5.30"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@vc-shell/config-generator": "^2.0.
|
|
36
|
+
"@vc-shell/config-generator": "^2.0.6",
|
|
37
37
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
38
38
|
"vite": "^5.0.0 || ^6.0.0"
|
|
39
39
|
},
|