Skip to content

esm: remove globalPreload hook (superseded by initialize)#49144

Merged
nodejs-github-bot merged 21 commits intonodejs:mainfrom
JakobJingleheimer:feat/esm-remove-globalpreload
Sep 10, 2023
Merged

esm: remove globalPreload hook (superseded by initialize)#49144
nodejs-github-bot merged 21 commits intonodejs:mainfrom
JakobJingleheimer:feat/esm-remove-globalpreload

Conversation

@JakobJingleheimer
Copy link
Member

@JakobJingleheimer JakobJingleheimer commented Aug 13, 2023

This PR removes the globalPreload module customization hook. It is no longer needed now that its functionality is provided by the register API paired with the initialize hook. You can see examples of refactoring from globalPreload to register / initialize in #49465 and in some of the updated tests in this PR.

Besides removing the hook itself, the test-esm-loader-hooks.mjs test describe('globalPreload' block and test-esm-loader-side-effect.mjs were removed. These were testing parts of globalPreload, like that its communications ports work, that we already have separate tests for covering the superseding equivalent in register / initialize; or they were testing things that we don’t need tests for outside of the globalPreload context, such that global variables declared in a preload script are accessible on the main thread. (The new API calls register from the main thread, and global variables can be declared there, and we don’t need a test that global variables declared on the main thread can be read on the main thread.)

This PR completes the loaders roadmap Milestone 2.

Notable changes

Module customization hook globalPreload removed; use register and initialize instead

The module customization hook globalPreload has been removed. Instead, use register to send data from the application thread to the customization hooks, and the initialize hook to establish a communications channel between the threads.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. esm Issues and PRs related to the ECMAScript Modules implementation. loaders Issues and PRs related to ES module loaders loaders-agenda Issues and PRs to discuss during the meetings of the Loaders team notable-change PRs with changes that should be highlighted in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants