[wp-trac] [WordPress Trac] #60647: Script Modules: Allow modules to depend on existing WordPress scripts

WordPress Trac noreply at wordpress.org
Mon Sep 30 16:17:01 UTC 2024


#60647: Script Modules: Allow modules to depend on existing WordPress scripts
--------------------------------------+-------------------------
 Reporter:  jonsurrell                |       Owner:  jonsurrell
     Type:  feature request           |      Status:  assigned
 Priority:  normal                    |   Milestone:  6.7
Component:  Script Loader             |     Version:  6.5
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  javascript
--------------------------------------+-------------------------

Comment (by czapla):

 In [changeset:"59130" 59130]:
 {{{
 #!CommitTicketReference repository="" revision="59130"
 Interactivity API: Move interactivity-router i18n strings to Script Module
 data.

 Moves the 'loading' and 'loaded' i18n strings for the `interactivity-
 router` to the script module data via the `script_module_data_ at wordpress
 /interactivity-router` filter.

 Key changes:

 - Add the `filter_script_module_interactivity_router_data()` method,
 hooked into the `script_module_data_ at wordpress/interactivity-router`
 filter, to set the `i18n` data with the 'loading' and 'loaded' messages.
 - Rename the `print_router_loading_and_screen_reader_markup()` method to
 `print_router_markup()` and remove the screen reader markup from it
 because it's no longer needed.
 - Deprecate the `print_router_loading_and_screen_reader_markup()` method.
 - Remove the `loading` and `loaded` strings from the `core/router` store
 state because they're no longer needed.
 - Initialize the `core/router` store with a minimal navigation object to
 prevent errors in the interactivity-router script module when the store is
 not properly initialized.
 - Update corresponding unit tests to reflect these changes.

 This change ensures that the `interactivity-router` i18n messages are
 localized in a single place and removes the need to initialize them in the
 `core/router` store state.

 Props jonsurrell, swissspidy, czapla, gziolo.
 See #60647.
 }}}

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


More information about the wp-trac mailing list