Framework: Specify missing wp-url dependencies#8362
Merged
Conversation
Contributor
|
At some point, I attempted to generate a The reasons for closing that PR was that these things will change when we merge to Core anyway. |
Member
Author
Yeah, eventually this is why I stopped spending time on it, as it seemed like effort which would quickly become largely irrelevant come merge. Though I imagine core could benefit from something like this as well, at least with continued adoption of JS packages. |
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.
Related: #8300
This pull request seeks to resolve an issue where the Archives block produces an error. This was caused by #8300, where new dependencies were introduced on the
@wordpress/urlmodule, but not specified inclient-assets.php. The changes here add this dependency towp-core-blocksandwp-componentsscript handles. While I was here, I also re-alphabetized the dependency list for these handles (and forwp-editor, which was touched in #8300 but already definedwp-urlas a dependency).In the future, we might consider how to automate or validate this process, so that it's not manually curated. I had taken an attempt here, first with a plain PHP script, then with a custom PHPCS Sniff. Ultimately,
gutenberg_register_scripts_and_stylestouches many core functions which need to be defined, meaning that it's most likely needed to load most of the WordPress context to do programatically. Another alternative is to run validate at runtime (at least inSCRIPT_DEBUG) to check that, for any package defined inpackages/, its corresponding script registration includes all the same dependencies as listed in itspackage.jsondependenciesobject.Testing instructions: