@wordpress/build 0.16.3-next.v.202606191442.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 0.16.2-next.0 (2026-06-19)
5
+ ## 0.17.0 (2026-06-24)
6
6
 
7
7
  ### Documentation
8
8
 
package/README.md CHANGED
@@ -336,7 +336,7 @@ add_menu_page( 'Title', 'Menu', 'capability', 'my-admin-page', 'my_plugin_my_adm
336
336
  ```
337
337
 
338
338
  **Init Modules:**
339
- Init modules are JavaScript packages that execute during page initialization, before routes are registered and the app renders. They're ideal for:
339
+ Init modules are JavaScript packages that execute during page initialization, after menu items and routes are registered and before the app renders. They're ideal for:
340
340
  - Adding icons to menu items (icons can't be passed from PHP)
341
341
  - Registering command palette entries
342
342
 
@@ -372,7 +372,7 @@ export async function init() {
372
372
  }
373
373
  ```
374
374
 
375
- The `init()` function is **mandatory** - all init modules must export this named function. Init modules are loaded as static dependencies and executed sequentially before the boot system registers menu items and routes.
375
+ The `init()` function is **mandatory** - all init modules must export this named function. Init modules are loaded as static dependencies and executed sequentially after the boot system registers menu items and routes, before the app renders.
376
376
 
377
377
  ### Example: WordPress Core (Gutenberg)
378
378
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/build",
3
- "version": "0.16.3-next.v.202606191442.0+17fe7db8a",
3
+ "version": "0.17.0",
4
4
  "description": "Build tool for WordPress plugins.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@emotion/babel-plugin": "^11.13.5",
39
- "@wordpress/style-runtime": "^0.4.2-next.v.202606191442.0+17fe7db8a",
39
+ "@wordpress/style-runtime": "^0.5.0",
40
40
  "autoprefixer": "^10.4.21",
41
41
  "browserslist-to-esbuild": "^2.1.1",
42
42
  "change-case": "^4.1.2",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
81
+ "gitHead": "0e7112a4f4fde4ea15bd9060489b8f6fe11eb6ca"
82
82
  }
@@ -155,6 +155,8 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_enqueue_scripts( $hook_suf
155
155
  // 2. It initializes the boot module as an inline script.
156
156
  wp_register_script( '{{PAGE_SLUG}}-wp-admin-prerequisites', '', $asset['dependencies'], $asset['version'], true );
157
157
 
158
+ $init_modules = {{INIT_MODULES_JSON}};
159
+
158
160
  /*
159
161
  * Add inline script to initialize the app using initSinglePage (no menuItems).
160
162
  * The dynamic import is deferred until DOMContentLoaded so that all classic
@@ -166,10 +168,10 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_enqueue_scripts( $hook_suf
166
168
  * "Cannot unlock an undefined object". See <https://core.trac.wordpress.org/ticket/65103>.
167
169
  */
168
170
  $init_js_function = <<<'JS'
169
- ( mountId, routes ) => {
171
+ ( mountId, routes, initModules ) => {
170
172
  const run = async () => {
171
173
  const mod = await import( "@wordpress/boot" );
172
- mod.initSinglePage( { mountId, routes } );
174
+ mod.initSinglePage( { mountId, routes, initModules } );
173
175
  };
174
176
  if ( document.readyState === "loading" ) {
175
177
  document.addEventListener( "DOMContentLoaded", run );
@@ -181,10 +183,11 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_enqueue_scripts( $hook_suf
181
183
  wp_add_inline_script(
182
184
  '{{PAGE_SLUG}}-wp-admin-prerequisites',
183
185
  sprintf(
184
- '( %s )( %s, %s );',
186
+ '( %s )( %s, %s, %s );',
185
187
  $init_js_function,
186
188
  wp_json_encode( '{{PAGE_SLUG}}-wp-admin-app', JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
187
- wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
189
+ wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
190
+ wp_json_encode( $init_modules, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
188
191
  )
189
192
  );
190
193
 
@@ -205,6 +208,9 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_enqueue_scripts( $hook_suf
205
208
  ),
206
209
  );
207
210
 
211
+ // Add init modules as static dependencies
212
+ {{INIT_MODULES_PHP_ARRAY}}
213
+
208
214
  // Add all registered routes as dependencies
209
215
  foreach ( $routes as $route ) {
210
216
  if ( isset( $route['route_module'] ) ) {