-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Modules API: Refactor, tests, and final dependencies array structure #57231
Modules API: Refactor, tests, and final dependencies array structure #57231
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/experimental/modules/class-gutenberg-modules.php ❔ phpunit/experimental/modules/class-gutenberg-modules-test.php |
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.
Sorry I can't give a better review; there's a lot in here which I'm not too familiar with. Left some random thoughts though.
Thanks, Dennis. I've address all your feedback 🙂 |
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.
Tested and working as expected.
Apart from the nitpicks discussed, I could not find anything else to mention. It will still need a backport that will be re-reviewed by core committers.
Thanks, Carlos! Let's merge this now and I'll start working on the WP Core backport. |
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
What?
This is a general refactor of the code, including more test coverage and a few improvements on the API.
Starting from this PR, the dependencies array has the following structure:
Examples:
This opens the door for future additions, like for example dependency versions to support import map scopes:
Why?
Apart from the general improvements here in Gutenberg, I want to open a PR on WordPress Core as soon as this is merged, so more folks can test it out and give feedback.
How?
I reviewed all the code, comments and tests.
Testing Instructions
Either add some interactive blocks to your page and check that the modules, preloads and import maps are added correctly to the page, or use the
gutenberg_register_module
andgutenberg_enqueue_module
functions in your own code.