Releases: SchweizerischeBundesbahnen/scion-microfrontend-platform
1.3.1
1.3.1 (2024-10-29)
Bug Fixes
DevTools
- devtools: move DevTools to
*.scion.vercel.app
subdomain (3897efe)
BREAKING CHANGES
-
devtools: The URL of the SCION Microfrontend Platform DevTools has changed.
The URL of previous releases has not changed. The current version (
1.3.1
) is available at the previous and new URL. New releases will be available only at the new URL.To migrate, load the DevTools from https://microfrontend-platform-devtools.scion.vercel.app (latest) or http://microfrontend-platform-devtools-vx-y-z.scion.vercel.app (versioned). Previously, DevTools were available at https://scion-microfrontend-platform-devtools.vercel.app and https://scion-microfrontend-platform-devtools-vx-y-x.vercel.app.
1.3.0
1.2.2
1.2.1
1.2.0
1.2.0 (2023-10-31)
Bug Fixes
- platform/client: change return type of
MicrofrontendPlatformClient#signalReady
to void (2ebd65d) - platform/router-outlet: ensure transparent router-outlet if empty (0c44137), closes /github.com/w3c/csswg-drafts/issues/4772#issuecomment-591553929
- devtools: display warning if not opened as microfrontend (6b0facf)
- devtools: do not set background color to inherit it from the embedding context (7f36dfa)
Features
1.1.0
1.0.0
1.0.0 (2023-05-15)
chore
BREAKING CHANGES
-
platform: dropping deprecated API and backward compatibility introduced a breaking change for host and client applications.
To migrate:
- Update host and clients to version
1.0.0-rc.13
or higher. - Deprecated property
ManifestService.lookupApplications$
has been removed; useManifestService.applications
instead. - Deprecated property
Capability.requiredParams
has been removed; declare required parameters viaCapability.params
instead and mark it as required. - Deprecated property
Capability.optionalParams
has been removed; declare optional parameters viaCapability.params
instead and mark it as non-required.
- Update host and clients to version
1.0.0-rc.13
1.0.0-rc.13 (2023-03-10)
Performance Improvements
1.0.0-rc.12
1.0.0-rc.12 (2022-12-21)
Bug Fixes
- platform/client: do not provide
HttpClient
in client as only used in the host (e47ed8b) - platform/client: remove startup progress monitor from client (755422e)
- platform/host: remove
ManifestObject
from public API since internal (36f0dd8)
Performance Improvements
BREAKING CHANGES
-
platform: reducing the bundle size in client applications introduced a breaking change for host and client applications. The communication protocol between host and client has not changed, i.e., host and clients can be updated independently to the new version.
To enable tree-shaking of the SCION Microfrontend Platform, the platform was split into three separate entry points. This reduced the raw size of the library in a client application by more than 50%, from 120 KB to 40 KB.
Platform Entry Points:
MicrofrontendPlatformHost
to configure and start the platform in the host application;MicrofrontendPlatformClient
to connect to the platform from a microfrontend;MicrofrontendPlatform
to react to platform lifecycle events and stop the platform;
To migrate the host application:
- start the platform via
MicrofrontendPlatformHost.start
instead ofMicrofrontendPlatform.startHost
- monitor startup progress via
MicrofrontendPlatformHost.startupProgress$
instead ofMicrofrontendPlatform.startupProgress$
To migrate the client application:
- connect to the host via
MicrofrontendPlatformClient.connect
method instead ofMicrofrontendPlatform.connectToHost
- test if connected to the host via
MicrofrontendPlatformClient.isConnected
method instead ofMicrofrontendPlatform.isConnectedToHost
-
platform/client: removing client startup progress introduced a breaking change in the client.
To reduce the size of the client bundle, the API for monitoring the startup progress in the client has been removed. This API is useful in the host, but not in the client, because the client only connects to the host and does not perform any long-running operation. There is no replacement.
-
platform/host: removing
ManifestObject
from public API introduced a breaking change.The
ManifestObject
interface is the internal representation of capabilities and intensions in the platform host. It was never intended to be public API.To migrate:
- In the unlikely event that you use this interface, replace it with the following union type:
Capability | Intention
.
- In the unlikely event that you use this interface, replace it with the following union type:
1.0.0-rc.11
1.0.0-rc.11 (2022-12-06)
Bug Fixes
- platform/host: add secondary origin to allowed origins (61cddc0), closes #197
- platform/host: validate params of intent before passing it to interceptors (1f5f5e5)
- platform/host: assert topic not to contain empty segments (f8c47e3)
- platform/client: stop platform in
beforeunload
to avoid posting messages to disposed window (3969c17), closes #168 - platform: do not break clients not supporting the ping liveness protocol (6d4eb78), closes #178
- platform: do not unregister clients after resuming the computer from hibernation (a210d4b), closes #178
Features
- platform/client: provide API for microfrontend to monitor focus (e5dc6c2)
- platform/host: support for intercepting messages after platform-internal interceptors (bbfac42)
- platform: drop support for wildcard capability qualifiers and optional wildcard intention qualifiers (9713cf0), closes #163
- platform/client: provide hook to decorate observable emissions (4e0e9b4)
Performance Improvements
BREAKING CHANGES
-
platform/host: Property for configuring a secondary origin has been renamed from
messageOrigin
tosecondaryOrigin
. This breaking change only refers to the host.To migrate, configure the additional allowed origin via the
secondaryOrigin
property instead ofmessageOrigin
, as following:await MicrofrontendPlatform.startHost({ applications: [ {symbolicName: 'client', manifestUrl: 'https://app/manifest.json', secondaryOrigin: 'https://secondary'}, ], });
-
platform/host: The host now performs liveness probes to detect and remove stale clients, instead of relying on the heartbeats emitted by the clients of previous versions.
The breaking change only refers to the host. The communication protocol between host and client has NOT changed. You can independently update host and clients to the new version.
To migrate setting of a custom probe configuration in the host, specify the
liveness
instead ofheartbeatInterval
property, as follows:MicrofrontendPlatform.startHost({ liveness: {interval: 60, timeout: 10}, // omitted rest of the config });
-
platform: Optimization of mouse event dispatching introduced a breaking change for Angular applications.
IMPORTANT: For Angular applications, we strongly recommend replacing zone-specific decorators for
MessageClient
andIntentClient
with anObservableDecorator
. Otherwise, you may experience performance degradation due to frequent change detection cycles.It turned out that Angular zone synchronization with decorators for
MessageClient
andIntentClient
is not sufficient and that observables should emit in the same Angular zone in which the subscription was performed. Using the newObservableDecorator
API, Angular zone synchronization can now be performed in a single place for all observables exposed by the SCION Microfrontend Platform.To migrate:
- Remove decorators for
MessageClient
andIntentClient
including their registration in the bean manager (e.g.,NgZoneMessageClientDecorator
andNgZoneIntentClientDecorator
). - Provide a
NgZoneObservableDecorator
and register it in the bean manager before starting the platform. Note to register it as a bean, not as a decorator.
For a complete example and detailed instructions, see https://scion-microfrontend-platform-developer-guide.vercel.app/#chapter:angular-integration-guide:synchronizing-rxjs-observables-with-angular-zone.
Example of a decorator for synchronizing the Angular zone
/** * Mirrors the source, but ensures subscription and emission {@link NgZone} to be identical. */ export class NgZoneObservableDecorator implements ObservableDecorator { constructor(private zone: NgZone) { } public decorate$<T>(source$: Observable<T>): Observable<T> { return new Observable<T>(observer => { const insideAngular = NgZone.isInAngularZone(); const subscription = source$ .pipe( subscribeInside(fn => this.zone.runOutsideAngular(fn)), observeInside(fn => insideAngular ? this.zone.run(fn) : this.zone.runOutsideAngular(fn)), ) .subscribe(observer); return () => subscription.unsubscribe(); }); } }
Registration of the decorator in the bean manager
const zone: NgZone = ...; // Register decorator Beans.register(ObservableDecorator, {useValue: new NgZoneObservableDecorator(zone)}); // Connect to the host from a micro app zone.runOutsideAngular(() => MicrofrontendPlatform.connectToHost(...)); // Start platform host in host app zone.runOutsideAngular(() => MicrofrontendPlatform.startHost(...));
- Remove decorators for
-
platform: dropping support for wildcard capability qualifiers and optional wildcard intention qualifiers introduced a breaking change in the Intention API.
To migrate:
- Replace asterisk (
*
) wildcard capability qualifier entries with required params. - Replace optional (
?
) wildcard capability qualifier entries with optional params. - If using
QualifierMatcher
to match qualifiers, construct it without flags. The matcher now always evaluates asterisk wildcards in the pattern passed in the constructor.
The following snippets illustrate how a migration could look like:
Before migration
Capability in Manifest of App 1
{ "name": "App 1", "capabilities": [ { "type": "microfrontend", "qualifier": { "entity": "person", "id": "*", "readonly": "?" }, "private": false, "properties": { "path": "person/:id?readonly=:readonly" } } ] }
Intention in Manifest of App 2
{ "name": "App 2", "intentions": [ { "type": "microfrontend", "qualifier": { "entity": "person", "id": "*", "readonly": "?" } } ] }
Sending Intent in App 2
const intent: Intent = { type: 'microfrontend', qualifier: { entity: 'person', id: '123', readonly: true } }; Beans.get(IntentClient).publish(intent);
After migration
Capability in Manifest of App 1
{ "name": "App 1", "capabilities": [ { "type": "microfrontend", "qualifier": { "entity": "person" }, "params": [ { "name": "id", "required": true }, { "name": "readonly", "required": false } ], "private": false, "properties": { "path": "person/:id?readonly=:readonly" } } ] }
Intention in Manifest of App 2
{ "name": "App 2", "intentions": [ { "type": "microfrontend", "qualifier": { "entity": "person" } } ] }
Sending Intent in App 2
const intent: Intent = { type: 'microfrontend', qualifier: { entity: 'person' }, params: new Map().set('id', '123').set('readonly', true) }; Beans.get(IntentClient).publish(intent);
- Replace asterisk (