refactor: rewrite Module as an ES6 class#4151
Merged
Merged
Conversation
Drop the old browser-side `Class.extend()` helper and make `Module` a native class, matching the earlier `NodeHelper` rewrite.
khassel
approved these changes
May 12, 2026
Collaborator
|
@KristjanESPERANTO let me know if you want to wait for other reviews, otherwise I will merge it ... |
Collaborator
Author
|
@khassel I think one review is enough. Thanks! 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rewrites
module.jsto use a native ES6classinstead ofClass.extend()- the same old inheritance helper that was removed fromnode_helper.jsin #4147.The normal module API stays the same: modules still use
Module.register({...}). Internally,Module.create()now creates a named subclass for each module, copies over a cloned definition, and only callsinit()when it is actually a function.Outcome: one less file in the browser bundle, no more magic
_super()wiring, better stack traces, and tests for the module creation path that did not exist before.module.jsis also now a plain class with no external dependencies - an intentional step towardsexport default Modulewhen browser scripts eventually move to native ES modules.Since these changes touch the core of how modules are created, I'd appreciate a close review and any feedback on edge cases I may have missed.