-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
chore: split runtime as core and entry #3154
base: main
Are you sure you want to change the base?
Conversation
✅ 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
The pull request focuses on splitting the runtime module into two separate parts: runtime-core
and entry
. The key changes are:
- The
runtime-core
module is designed to have no side effects, while theentry
module will cache theFederationInstance
. This separation of concerns aims to improve the overall structure and maintainability of the codebase. - The
runtime-core
module is now externalized and imported from a separate package (@module-federation/runtime-core
). This change allows theruntime-core
to be used independently without the side effects introduced by theentry
module. - The utility functions and types previously defined in the
runtime
module have been restructured. The global utility functions are now imported from theruntime-core
package, and the corresponding types are also exported from there. - New utility functions, such as
getGlobalFederationInstance
andgetBuilderId
, have been added to theutils
module to retrieve specific instances of theFederationHost
based on the provided name and version.
These changes aim to improve the modularity, flexibility, and maintainability of the runtime module by separating the core functionality from the entry point and its associated side effects.
File Summaries
File | Summary |
---|---|
packages/runtime-core/src/constant.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/core.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federation instance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/global.ts | The code changes split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry has side effects and will cache the FederationInstance. Additionally, the runtime-core is now externalized. |
packages/runtime-core/src/helpers.ts | The code changes introduce a new module that exports two utility objects: GlobalUtils and ShareUtils . The GlobalUtils object provides a collection of functions related to managing global state and information, such as resetting federation global info, setting and getting global federation instances, and managing global snapshots. The ShareUtils object provides functions for working with registered shares and the global share scope. |
packages/runtime-core/src/index.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federation instance. The changes also externalize the runtime-core and update the exports and imports accordingly. |
packages/runtime-core/src/module/index.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core module is now externalized and has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/plugins/generate-preload-assets.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/plugins/snapshot/SnapshotHandler.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. |
packages/runtime-core/src/plugins/snapshot/index.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. This change aims to externalize the runtime-core for better modularity and flexibility. |
packages/runtime-core/src/remote/index.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/shared/index.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federation instance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/type/config.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/type/index.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. This change aims to externalize the runtime-core for better modularity and maintainability. |
packages/runtime-core/src/type/plugin.ts | The changes in this file introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core is now externalized and has no side effects, while the entry part has side effects and will cache the federation instance. |
packages/runtime-core/src/type/preload.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/types.ts | The changes in this file introduce a new export from the runtime-core package, specifically exporting all types from the type.ts file. This allows for the separation of the runtime-core and entry components, where the runtime-core can be used independently without the side effects introduced by the entry point. |
packages/runtime-core/src/utils/env.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federationInstance. This separation aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/hooks/asyncHook.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federationInstance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/hooks/asyncWaterfallHooks.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core is now externalized and has no side effects, while the entry part has side effects and will cache the federationInstance. |
packages/runtime-core/src/utils/hooks/index.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federationInstance. This separation aims to externalize the runtime-core for improved modularity and flexibility. |
packages/runtime-core/src/utils/hooks/pluginSystem.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. |
packages/runtime-core/src/utils/hooks/syncHook.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and caches the federation instance. |
packages/runtime-core/src/utils/hooks/syncWaterfallHook.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. |
packages/runtime-core/src/utils/index.ts | The changes in this file involve splitting the runtime into two separate parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federation instance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/load.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core is now externalized and has no side effects, while the entry part has side effects and will cache the federation instance. |
packages/runtime-core/src/utils/logger.ts | The changes in this file introduce a separation of the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federationInstance. This refactoring aims to externalize the runtime-core module, potentially improving modularity and maintainability. |
packages/runtime-core/src/utils/manifest.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federationInstance. This separation aims to externalize the runtime-core for improved modularity and flexibility. |
packages/runtime-core/src/utils/plugin.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federationInstance. This separation aims to improve the modularity and maintainability of the codebase. |
packages/runtime-core/src/utils/preload.ts | The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and caches the federation instance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/semver/compare.ts | The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federationInstance. |
packages/runtime-core/src/utils/semver/constants.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will cache the federation instance. This separation aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/semver/index.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core is now externalized and has no side effects, while the entry part has side effects and will cache the federationInstance. |
packages/runtime-core/src/utils/semver/parser.ts | The changes in this file primarily involve splitting the runtime into two separate parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will handle caching the federation instance. This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime-core/src/utils/semver/utils.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federation instance. This separation aims to externalize the runtime-core, potentially improving modularity and flexibility in the codebase. |
packages/runtime-core/src/utils/share.ts | The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core is designed to have no side effects, while the entry part has side effects and will cache the federationInstance. This change aims to externalize the runtime-core, potentially improving modularity and flexibility. |
packages/runtime-core/src/utils/tool.ts | The changes in this file split the runtime into two parts: runtime-core and entry . The runtime-core module has no side effects, while the entry module caches the federationInstance . This separation of concerns aims to improve the overall structure and maintainability of the codebase. |
packages/runtime/src/helpers.ts | The code changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core module is now imported from a separate package '@module-federation/runtime-core' and only the 'getGlobalFederationInstance' function is exported from the local 'utils' module. The rest of the global utility functions are now imported from the runtime-core package, and the file exports the corresponding types as well. |
packages/runtime/src/index.ts | The code changes focus on splitting the runtime module into two parts: runtime-core and entry . The runtime-core module is designed to have no side effects, while the entry module will cache the FederationInstance . The changes also involve externalizing the runtime-core module and updating the imports and exports accordingly. |
packages/runtime/src/types.ts | The changes in this file involve externalizing the runtime-core types and importing them directly from the '@module-federation/runtime-core/types' module. This simplifies the codebase by separating the runtime-core and entry components, reducing the overall complexity and potential side effects. |
packages/runtime/src/utils.ts | The code changes introduce a new utility function getGlobalFederationInstance that retrieves a specific instance of the FederationHost based on the provided name and version. Additionally, a helper function getBuilderId is added to fetch the build identifier, which is used to identify the correct FederationHost instance when multiple instances exist. |
it('verify resources when URL specifies protocol (http)', () => { | ||
const url = 'http://a.b.c'; | ||
const scriptElement = document.createElement('script'); | ||
scriptElement.src = url; |
Check warning
Code scanning / CodeQL
Inclusion of functionality from an untrusted source Medium test
|
67a6235
to
d56d6fa
Compare
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
# Conflicts: # pnpm-lock.yaml
Description
Related Issue
Types of changes
Checklist