-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add lifecycle hooks for bridge #2875
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 83e54ad The changes in this PR will be included in the next version bump. This PR includes changesets to release 38 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
This pull request introduces a new feature to support proxy bridge export in the onload hook across various parts of the codebase. The key changes include:
- Adding a listener when the moduleInfo is ready, ensuring the application can properly handle the loading of remote modules.
- Enabling the proxy bridge export functionality in the onload hook, allowing for seamless integration and customization of the bridge component lifecycle.
- Introducing new lifecycle hooks, such as
beforeBridgeRender
andbeforeBridgeDestroy
, which provide extension points for developers to execute custom logic before the bridge component is rendered or destroyed. - Refactoring the logic for handling global and module-level snapshots, ensuring a consistent approach and simplifying the return values.
- Introducing a new utility function,
processModuleAlias
, to handle various scenarios related to module naming and normalization.
These changes improve the overall functionality and extensibility of the bridge component, allowing for better integration with the host application and more flexibility in managing the lifecycle of remote components.
File Summaries
File | Summary |
---|---|
packages/bridge/bridge-react/src/create.tsx | The code changes introduce a new feature to support proxy bridge export in the onload hook. The key modifications include adding a listener when the moduleInfo is ready and enabling the proxy bridge export functionality in the onload hook. |
packages/bridge/bridge-react/src/lifecycle.ts | This code change introduces a new feature to support proxy bridge export in the onload hook. It adds a listener when the moduleInfo is ready and registers a plugin system with two hooks: beforeBridgeRender and beforeBridgeDestroy. The plugin system is then registered with the host's options, allowing for customization and extension of the bridge lifecycle. |
packages/bridge/bridge-react/src/provider.tsx | The code changes add support for proxy bridge export in the onload hook, including the addition of a listener when the moduleInfo is ready. The changes also introduce new hooks, beforeBridgeRender and beforeBridgeDestroy , which allow for custom functionality to be executed before the bridge component is rendered or destroyed, respectively. |
packages/bridge/bridge-react/src/remote/index.tsx | The code changes add support for a proxy bridge export in the onload hook, and introduce a new lifecycle event to be triggered before the remote component is rendered and before it is destroyed. This allows for additional customization and integration points in the bridge module. |
packages/bridge/vue3-bridge/src/create.ts | The code changes introduce a new feature to support proxy bridge export in the onload hook. The key modifications include adding a listener when the moduleInfo is ready and enabling the proxy bridge export functionality in the onload hook. |
packages/bridge/vue3-bridge/src/lifecycle.ts | The code changes introduce a new function registerBridgeLifeCycle that sets up a plugin system for managing the lifecycle events of a bridge component. The plugin system includes two hooks: beforeBridgeRender and beforeBridgeDestroy , which can be used to execute custom logic before the bridge component is rendered or destroyed. The function also registers the plugin system with the host application, allowing it to be used throughout the application. |
packages/bridge/vue3-bridge/src/provider.ts | The code changes introduce a new feature to support proxy bridge export in the onload hook. This includes adding a listener when the moduleInfo is ready and providing lifecycle hooks for rendering and destroying the bridge component. |
packages/bridge/vue3-bridge/src/remoteApp.tsx | The code changes introduce a new feature to support proxy bridge export in the onload hook. It adds a listener when the moduleInfo is ready and registers a bridge lifecycle hook to emit events before the bridge is rendered and destroyed. |
packages/runtime/src/helpers.ts | The code changes add a new listener when the moduleInfo is ready and support proxy bridge export in the onload hook. This enhancement allows for improved handling of proxy bridge exports within the application. |
packages/runtime/src/module/index.ts | The code changes introduce a new feature to support proxy bridge export in the onload hook. The key modifications include adding a listener when moduleInfo is ready and using the processModuleAlias utility function to keep the symbol for the module name in a consistent format. |
packages/runtime/src/plugins/snapshot/SnapshotHandler.ts | The code changes introduce a new afterLoadSnapshot hook in the SnapshotHandler class. This hook is called after the remote snapshot is loaded, providing an opportunity to perform additional processing or modifications on the loaded snapshot data. The changes also refactor the logic for handling global and module-level snapshots, ensuring a consistent approach and simplifying the return values. |
packages/runtime/src/type/config.ts | The code changes introduce a new RemoteInfoCommon interface and add a listener when moduleInfo is ready. Additionally, it supports proxy bridge export in the onload hook, which likely enables the application to handle remote module loading and integration more effectively. |
packages/runtime/src/type/plugin.ts | The code changes introduce a new type LifeCycle that combines several partial types, including CoreLifeCyclePartial , SnapshotLifeCycleCyclePartial , SharedLifeCycleCyclePartial , RemoteLifeCycleCyclePartial , and ModuleLifeCycleCyclePartial . The FederationRuntimePlugin type is then defined as an intersection of the LifeCycle type and an optional generic type T . |
packages/runtime/src/utils/plugin.ts | The code changes introduce a new feature to support proxy bridge export in the onload hook. The changes include adding a listener when the moduleInfo is ready and extending the registerPlugins function to handle a generic plugin system with a type parameter. |
packages/runtime/src/utils/tool.ts | The code changes introduce a new utility function called processModuleAlias that takes a module name and a sub-path, and processes them to create a normalized module name. This function is likely used to handle scenarios where the module name may have a trailing slash or the sub-path may start with a dot, ensuring a consistent format for the final module name. |
@squadronai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 6
Configuration
Squadron Mode: essential
Commits Reviewed
b90fa7ded8786022d900081dd7c871f317c5e4b9...f716f180a28d1e7b017db7827045725136fb6d66
Files Reviewed
- packages/bridge/bridge-react/src/provider.tsx
- packages/bridge/vue3-bridge/src/provider.ts
- packages/runtime/src/plugins/snapshot/SnapshotHandler.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 6
Configuration
Squadron Mode: essential
Commits Reviewed
865c00bc542e904e24fbcc58c0bb0ec9c8a68c7a...edaffa2490e9c7543640d4c65b6c02602449afed
Files Reviewed
- packages/bridge/bridge-react/src/provider.tsx
- packages/bridge/vue3-bridge/src/provider.ts
- packages/runtime/src/plugins/snapshot/SnapshotHandler.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
…universe into feat/isolated-monitor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 14
Configuration
Squadron Mode: essential
Commits Reviewed
865c00bc542e904e24fbcc58c0bb0ec9c8a68c7a...fe9ad08d004c3326f7e94ab4862da605264f4465
Files Reviewed
- packages/bridge/bridge-react/src/create.tsx
- packages/bridge/bridge-react/src/index.ts
- packages/bridge/bridge-react/src/lifecycle.ts
- packages/bridge/bridge-react/src/provider.tsx
- packages/bridge/bridge-react/src/remote/index.tsx
- packages/bridge/vue3-bridge/src/create.ts
- packages/bridge/vue3-bridge/src/index.ts
- packages/bridge/vue3-bridge/src/lifecycle.ts
- packages/bridge/vue3-bridge/src/provider.ts
- packages/bridge/vue3-bridge/src/remoteApp.tsx
- packages/runtime/src/helpers.ts
- packages/runtime/src/module/index.ts
- packages/runtime/src/plugins/snapshot/SnapshotHandler.ts
- packages/runtime/src/utils/plugin.ts
- packages/runtime/src/utils/tool.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
- packages/bridge/bridge-react/package.json
- packages/bridge/vue3-bridge/package.json
- pnpm-lock.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 12
Configuration
Squadron Mode: essential
Commits Reviewed
df760311c10d48b8a08fe7a8236a9b04c1935c90...72577844122be3a0fdfccb4d37cb0443ccf271e8
Files Reviewed
- packages/bridge/bridge-react/src/create.tsx
- packages/bridge/bridge-react/src/index.ts
- packages/bridge/bridge-react/src/lifecycle.ts
- packages/bridge/bridge-react/src/provider.tsx
- packages/bridge/bridge-react/src/remote/index.tsx
- packages/bridge/vue3-bridge/src/create.ts
- packages/bridge/vue3-bridge/src/index.ts
- packages/bridge/vue3-bridge/src/lifecycle.ts
- packages/bridge/vue3-bridge/src/provider.ts
- packages/bridge/vue3-bridge/src/remoteApp.tsx
- packages/runtime/src/helpers.ts
- packages/runtime/src/module/index.ts
- packages/runtime/src/plugins/snapshot/SnapshotHandler.ts
- packages/runtime/src/type/config.ts
- packages/runtime/src/type/plugin.ts
- packages/runtime/src/utils/plugin.ts
- packages/runtime/src/utils/tool.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
- packages/bridge/bridge-react/package.json
- packages/bridge/vue3-bridge/package.json
- pnpm-lock.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 0
Configuration
Squadron Mode: essential
Commits Reviewed
72577844122be3a0fdfccb4d37cb0443ccf271e8...14a30fa47a052733c2efdda5021e530e196380fa
Files Reviewed
- packages/bridge/vue3-bridge/src/lifecycle.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
- packages/bridge/bridge-react/package.json
- packages/bridge/vue3-bridge/package.json
- pnpm-lock.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incremental Review
Comments posted: 4
Configuration
Squadron Mode: essential
Commits Reviewed
14a30fa47a052733c2efdda5021e530e196380fa...b47ea80f6142d37e9764123c1eef19606f77e19e
Files Reviewed
- packages/bridge/bridge-react/src/lifecycle.ts
- packages/bridge/bridge-react/src/provider.tsx
- packages/bridge/bridge-react/src/remote/index.tsx
- packages/bridge/vue3-bridge/src/lifecycle.ts
- packages/bridge/vue3-bridge/src/remoteApp.tsx
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/great-feet-rule.md
- packages/bridge/bridge-react/package.json
- packages/bridge/vue3-bridge/package.json
- pnpm-lock.yaml
Description
Related Issue
Types of changes
Checklist