-
-
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(runtime): pass all loader hooks to the fetch and script functions #3174
Conversation
🦋 Changeset detectedLatest commit: aeda8cb The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 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 |
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 introduces changes to the runtime and SDK modules to allow for the passing of all loader hooks to the fetch and script functions. This provides more flexibility and control over the remote loading process, enabling developers to customize the fetch and script creation behavior using the provided hooks.
The key changes include:
- Updating the
RemoteHandler
class in the runtime module to accept aloaderHook
parameter, which allows for passing all loader hooks to thefetch
andscript
functions. - Modifying the
loadEntryScript
,loadEntryDom
, andloadEntryNode
functions in the runtime utilities to accept aloaderHook
parameter, enabling the passing of all loader hooks to thefetch
andscript
functions. - Adding a
loaderHook
parameter to thecreateScriptNode
andloadScriptNode
functions in the SDK module, allowing for customization of the fetch and script creation behavior using the provided hooks. - Introducing a new
FetchHook
type in the SDK types, which represents a function that can be used to intercept and customize the fetch request made by the SDK.
These changes enhance the flexibility and extensibility of the runtime and SDK modules, enabling developers to better integrate remote loading functionality with their existing codebase.
File Summaries
File | Summary |
---|---|
packages/runtime/src/remote/index.ts | The code changes introduce a new parameter to the loadEntry hook in the RemoteHandler class. The loaderHook parameter is now passed instead of the specific createScriptHook function, allowing for all loader hooks to be passed to the fetch and script functions. This change provides more flexibility and control over the remote loading process. |
packages/runtime/src/utils/load.ts | The code changes introduce a new parameter loaderHook to the loadEntryScript , loadEntryDom , and loadEntryNode functions, which is used to pass all loader hooks to the fetch and script functions. This allows for more flexibility and customization in the loading process of remote entries. |
packages/sdk/src/node.ts | The code changes introduce the ability to pass all loader hooks to the fetch and script functions in the runtime. This includes adding a new parameter loaderHook to the createScriptNode and loadScriptNode functions, which allows for customizing the fetch and script creation behavior using the provided hooks. |
packages/sdk/src/types/hooks.ts | The code changes introduce a new FetchHook type that represents a function that can be used to intercept and customize the fetch request made by the SDK. This allows for greater flexibility and control over the network requests performed by the application. |
✅ 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.
Incremental Review
Comments posted: 7
Configuration
Squadron Mode: essential
Commits Reviewed
54bfd1cf730a842fd323d88d1b7c8ff72678f0ce...b6195d1a0789b42d98f6ad989773a4952be6bd7e
Files Reviewed
- packages/sdk/src/node.ts
- packages/sdk/src/types/hooks.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/lucky-buckets-add.md
Description
The pull request introduces changes to the runtime and SDK modules to allow for the passing of all loader hooks to the fetch and script functions. This provides more flexibility and control over the remote loading process, enabling developers to customize the fetch and script creation behavior using the provided hooks.
The key changes include:
RemoteHandler
class in the runtime module to accept aloaderHook
parameter, which allows for passing all loader hooks to thefetch
andscript
functions.loadEntryScript
,loadEntryDom
, andloadEntryNode
functions in the runtime utilities to accept aloaderHook
parameter, enabling the passing of all loader hooks to thefetch
andscript
functions.loaderHook
parameter to thecreateScriptNode
andloadScriptNode
functions in the SDK module, allowing for customization of the fetch and script creation behavior using the provided hooks.FetchHook
type in the SDK types, which represents a function that can be used to intercept and customize the fetch request made by the SDK.Related Issue
Types of changes
Checklist