feat(ui): support typed micro frontend placements and ESM remotes

CR
1h ago
+885-64

Summary

The MFE registry accepts same-origin Vite ESM entries and preserves the existing webpack defaults. A typed mount contract supplies presentation tokens, live theme subscriptions, navigation and synchronous cleanup. Page placements can target the app or Settings. Entity-tab placements receive entity context when mounted by a consumer.

Existing flat entries continue to work. The registry ships without any default remote. README-MFE includes placement examples and the remote lifecycle contract.

Verification

  • MFE unit suite, including legacy config and named placements
  • Independently built host and React 19 remote in Chromium, covering mount, live theme change and teardown
  • Playwright regression fixture for a named-only ESM export on a nested route

šŸ¤– Opened with cclaude on behalf of @craig-rueda


Summary by cubic

The MFE registry now accepts same-origin Vite ESM remotes alongside the existing webpack defaults, and remotes receive a typed v1 mount contract instead of an empty props object. The contract delivers presentation tokens, live theme subscriptions, navigation, and requires synchronous cleanup; page placements can target the app or Settings, and entity-tab placements receive entity context at mount time.

Behavior

  • Existing flat YAML entries continue to resolve under /mfe/ with the var/webpack defaults.
  • Settings placements live under their own /settings/ area with separate menu items, and the active one is highlighted in the nav; entity tabs are discovered independently from page routes.
  • Routes match longest-path-first without exact matching so trailing-slash and nested paths resolve, and duplicate routes are pruned per area.
  • The host dispatches datahub:mfe-location events on history changes so page remotes can track navigation.
  • format: esm entries must resolve to a same-origin HTTP(S) URL from the deployment base.
  • The host isolates each placement's theme subscribers and cleanup, and no default remote ships with the registry.
  • A browser verification fixture exercises mount, live theme switch, and teardown; the new CI workflow runs it.

Migration

  • Remotes must accept the v1 contract from contract.ts and return a synchronous cleanup function; async or missing cleanup is rejected.
  • Remotes that previously mounted with an empty props object need to be updated before switching the host.

There is no visible UI change by default: placements are opt-in through configuration, and the remote mount lifecycle was verified with the Chromium fixture.