[wp-trac] [WordPress Trac] #60597: Script Modules API: Allow list of enqueued module data to be exposed

WordPress Trac noreply at wordpress.org
Tue Sep 17 08:06:50 UTC 2024


#60597: Script Modules API: Allow list of enqueued module data to be exposed
---------------------------+-----------------------------
 Reporter:  johnbillion    |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Future Release
Component:  Script Loader  |     Version:  6.5
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+-----------------------------

Comment (by gziolo):

 This came up as in issue again when working on enhancements in the
 Gutenberg plugin:

 https://github.com/WordPress/gutenberg/pull/65380/files#r1761621029

 Re-sharing my feedback:

 It's about time to take action in WordPress core and expose the missing
 functionality for extenders:

 - `get_import_map` should become public, it contains `imports` field only,
 so it can get extended but it's enough for now as it's exactly the same
 shape that gets printed in HTML.
 - add public method `is_marked_for_enqueue` to verify if a script tag will
 get printed in HTML
 - add public method `is_marked_for_import` to verify if a script module
 will be listed in the import map

 Bonus points for adding a filter that gets called before returning the
 value from `get_import_map` call so plugins could apply their changes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60597#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list