Skip to content
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

Script Modules: Allow scripts to depend on modules #10

Closed
wants to merge 2 commits into from

Conversation

sirreal
Copy link
Owner

@sirreal sirreal commented Oct 10, 2024

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@sirreal sirreal force-pushed the script-modules/allow-as-script-dependency branch from 13417a6 to f9c245c Compare October 10, 2024 10:24
This allows for script modules to be exposed in the import map
regardless of being a dependency or enqueued.

This will enable scripts to depend on script modules by requesting they
be exposed.
@sirreal sirreal force-pushed the script-modules/allow-as-script-dependency branch from f9c245c to 117fe60 Compare October 10, 2024 10:26
*
* @param string $id The identifier of the script module.
*/
public function expose( string $id ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new concept in WordPress, so I wanted to share some alternatives to help find the final name:

  • add_to_import_map
  • include_in_import_map

Conceptually, the idea makes perfect sense to me. This method might also be useful when third-party code wants to ensure its dependency is listed in the import map, and they don't want to use all the tooling to generate dependencies for their script modules.

@sirreal
Copy link
Owner Author

sirreal commented Dec 16, 2024

Superseded by WordPress#8009.

@sirreal sirreal closed this Dec 16, 2024
@sirreal sirreal deleted the script-modules/allow-as-script-dependency branch December 16, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants