Skip to content

feat: migrate Module Federation host to backoffice modularity manifest endpoint#228

Open
maksimzinchuk wants to merge 8 commits into
mainfrom
feat/mf-modularity-migration
Open

feat: migrate Module Federation host to backoffice modularity manifest endpoint#228
maksimzinchuk wants to merge 8 commits into
mainfrom
feat/mf-modularity-migration

Conversation

@maksimzinchuk
Copy link
Copy Markdown
Collaborator

Summary

Migrates @vc-shell/mf-host and @vc-shell/mf-module to the platform's new Backoffice Modularity Framework (vc-platform#3019).

  • mf-host: switches from POST /api/frontend-modules to canonical GET /api/apps/{appId}/manifest. Drops client-side semver/compatibleWith filtering, the provides payload, and the semver runtime dep. Adds optional manifestUrl override. Unified warn + skip policy for any non-OK HTTP response (401/403/404/5xx).
  • mf-module: adds three optional DynamicModuleOptions fields — appId, moduleRoot, remoteName — so plugin builds land at <moduleRoot>/plugins/<appId>/remoteEntry.js where the platform manifest expects them. Legacy outDir: dist/mf preserved when appId is absent.
  • framework/core/api/platform.ts: regenerated NSwag client now exposes AppManifestResponse, PluginEntry, ContentFile, PluginRemote. mf-host imports types from @vc-shell/framework — single source of truth.

Design: docs/superpowers/specs/2026-05-20-mf-modularity-migration-design.md
Plan: docs/superpowers/plans/2026-05-20-mf-modularity-migration.md

Compatibility matrix

mf-host Platform Result
this PR platform with modularity merged works
this PR older platform without modularity 404 → warn + skip, host boots without plugins
pre-PR (2.x) platform with modularity (via alias) works through POST /api/frontend-modules alias

No major version bump (per-project policy: not treated as breaking for internal consumers).

Test plan

  • yarn workspace @vc-shell/mf-host test — 24/24 ✓
  • yarn workspace @vc-shell/mf-module test — 26/26 ✓
  • yarn typecheck — clean
  • yarn lint — clean
  • yarn check:circular — clean
  • yarn check:layers — clean
  • Sanity-grep: no leftover frontend-modules / humanizeRange / compatibleWith / REGISTRY_URL / semver in packages/mf-host/src or packages/mf-module/src
  • Smoke against vc-platform with modularity PR merged — one consumer app (vendor-portal or marketplace) loads plugins end-to-end
  • Verify ETag 304 cache hit on second manifest request (browser handles transparently)

External consumer migrations (separate PRs)

Six external repos consume the legacy @vc-shell/mf-module contract — each gets its own PR per team cadence. Spec §13 lists them with migration template (appId, moduleRoot, remoteName):

  • vc-module-marketplace-commissions-1
  • vc-module-import-1
  • vc-module-marketplace-quote
  • vc-module-marketplace-registration
  • vc-module-marketplace-reviews-1
  • vc-module-marketplace-communication

Deferred follow-ups (non-blocking)

  • Switch vee-validate version resolution from (VeeValidate as any).version ?? "4.0.0" to import veeValidatePkg from "vee-validate/package.json" for consistency.
  • Tests for router.replace post-install navigation, empty-plugins performance-marks path, malformed-JSON catch path.
  • Optional contentFiles[] style injection if a plugin starts emitting standalone CSS (currently vc-shell remotes inline CSS via federation).

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

📦 Preview published for commit 1e79eae

Install the preview with dist-tag:

npm install @vc-shell/framework@pr-228

Or pin to the exact commit:

npm install @vc-shell/framework@2.0.4-pr228.1e79eae

Published packages (dist-tag pr-228, version 2.0.4-pr228.1e79eae):

  • @vc-shell/framework
  • @vc-shell/api-client-generator
  • @vc-shell/create-vc-app
  • @vc-shell/config-generator
  • @vc-shell/migrate
  • @vc-shell/ts-config
  • @vc-shell/mf-config
  • @vc-shell/mf-host
  • @vc-shell/mf-module
  • @vc-shell/vc-app-skill

…ontract

The platform's PluginRemote.exposed defaults to './Module' (capital M),
see AppManifestService.DefaultExposedModule in vc-platform. The previous
default './module' (lowercase) caused 'Module ./Module does not exist in
container' on every plugin remote load — because MF runtime matches
exposed keys by exact string comparison.

Aligning the convention removes the need for per-plugin overrides.
Authors who exposed './module' explicitly are unaffected (their explicit
options.exposes wins). Authors who relied on the default need to ensure
their host loader requests './Module' from the manifest's remote.exposed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant