Repository navigation
Conversation
A `wpScriptModuleExports` value can now be `{ "path": "...", "id": "..." }`
besides a path. The `id` replaces the `@<namespace>/<package>/<key>` ID the
build generates; the output path still comes from the export key.
The build fails when two script modules, in the same package or in
different ones, register the same ID, since one would silently shadow the
other in the generated registry.
Importing an export with an `id` through the package name fails the build:
the import would name a module that is never registered. Such modules are
loaded at runtime with `import( id )`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The site identity panel of the site editor and the identity route of the extensible site editor rendered the `MediaEdit` copy of `@wordpress/fields`. Both now render the one `@wordpress/media-utils` exposes as a private API, the last consumers of the `@wordpress/fields` copy. The media-utils stylesheet replaces the `@wordpress/fields` one both included: `wp-edit-site` now depends on the `wp-media-utils` style, and the extensible site editor already loads it through `wp-editor`. The identity route unlocks the private API with the shared routes lock-unlock. Ported to the media-utils copy: the design system focus ring the `@wordpress/fields` copy received in #83854 after media-utils copied it (`outset-ring__focus()` on the picker buttons, with the offset for the grouped compact buttons, instead of the `box-shadow` ring). The copies differed otherwise only in class names, imports and doc comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`@wordpress/fields` now holds only the fields WordPress core registers on the server for the Entity fields API, moved from the private `@wordpress/core-fields` package into `src/entity-fields`, history kept. Its script modules are `@wordpress/fields/<collection>` (attachment, page, post_type_supports, root_site, wp_block, wp_template, wp_template_part), generated from the export keys. `MediaEdit` and `MediaEditProps`, the last exports of the package, are removed: nothing uses them since the site editor switched to the `@wordpress/media-utils` private API. The package has no JavaScript entry point and no stylesheet any more, so: - `package.json` exports only `./package.json`, with the `wpScriptModuleExports` and `wpCopyFiles` of the old core-fields package. `module` stays, pointing at one collection like core-fields did, because wp-build only emits `build-module` for packages declaring it. - It leaves `BUNDLED_PACKAGES` of the dependency extraction plugin and the private-APIs exceptions for bundled packages, and its stale lint suppressions are pruned. - `lib/load.php` loads `build/scripts/fields/entity-fields/index.php`. The `@wordpress/core-fields` workspace, its allowlist entry and its unreleased changelog entry are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the actions WordPress core registers for its entities from the private `@wordpress/core-actions` package into `src/entity-actions` of `@wordpress/fields`, history kept, so one package holds the fields and actions core registers on the server. Their script modules keep an `@wordpress/actions/<collection>` ID (post_type_supports, wp_block, wp_template_part) through the per-export `id` of `wpScriptModuleExports`; they are built to `build/modules/fields/entity-actions/`. `lib/load.php` loads `build/scripts/fields/entity-actions/index.php`, and still removes the callback WordPress core hooks for its own copy. The `@wordpress/core-actions` workspace, its allowlist entry and the unreleased changelog entries naming it are removed or rewritten, and its lint suppressions follow the files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
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.
What?
Follow-up to #84696, #84643 and #84660.
Moves the fields and actions WordPress core registers on the server out of the private
@wordpress/core-fieldsand@wordpress/core-actionspackages into the existing@wordpress/fieldspackage, and removesMediaEditfrom@wordpress/fieldsin favour of the@wordpress/media-utilscopy.Why?
Feedback on the recently landed Entity fields and Entity actions APIs was that their server-side definitions are better served by living in the existing
@wordpress/fieldspackage than in two new packages. None of this has shipped in a release yet, so the script module IDs and package layout can still change without a back-compat layer.@wordpress/fieldshad little left after #84897 and #84643: onlyMediaEdit, which@wordpress/media-utilsalready exposes as a private API (#84046). Dropping the duplicate leaves@wordpress/fieldswith one job, holding the fields and actions core registers, and keeps it a script module package instead of a mix of a bundled npm entry and script modules.How?
Four commits:
wpScriptModuleExportsvalue can now be{ "path": "...", "id": "..." }as well as a path. Theidreplaces the generated@<namespace>/<package>/<key>ID; the output path still comes from the export key. The build fails when two script modules register the same ID, and when code statically imports an export that has its ownid(such modules are loaded at runtime withimport( id )). Helpers live inpackages/wp-build/lib/script-module-utils.mjs, with tests, README and changelog.@wordpress/media-utils. The site identity panel (site editor) and the identity route (extensible site editor) now render themedia-utilsMediaEdit. The identity route unlocks it through the shared@wordpress/routes-lock-unlock. The@wordpress/fieldsstylesheet includes are removed:wp-edit-sitenow depends on thewp-media-utilsstyle, and the extensible site editor already loads it throughwp-editor. The design system focus ring that only the@wordpress/fieldscopy had (MediaEdit: Use design system focus ring #83854) is ported tomedia-utils; the copies otherwise differed only in class names, imports and doc comments.packages/core-fields/srcmoves topackages/fields/src/entity-fields(git mv, history kept). The script module IDs become@wordpress/fields/<collection>(attachment,page,post_type_supports,root_site,wp_block,wp_template,wp_template_part).MediaEditandMediaEditPropsare removed, so@wordpress/fieldsexports only./package.jsonand leavesBUNDLED_PACKAGESof the dependency extraction plugin.lib/load.phploadsbuild/scripts/fields/entity-fields/index.php.packages/core-actions/srcmoves topackages/fields/src/entity-actions. Through the per-exportid, their script modules keep a separate namespace:@wordpress/actions/<collection>(post_type_supports,wp_block,wp_template_part).lib/load.phploadsbuild/scripts/fields/entity-actions/index.php.The two workspaces, their private-APIs allowlist entries, tsconfig references, labeler entries and unreleased changelog entries are removed or rewritten; their lint suppressions follow the files. The PHP function names and the
remove_actioncalls that replace WordPress core's copies are unchanged.Breaking for npm consumers of
@wordpress/fields:MediaEditandMediaEditPropsare removed, listed in the package changelog next to the fields and actions already removed in this release cycle.Testing Instructions
npm install && npm run build.build/modules/registry.phplists@wordpress/fields/*and@wordpress/actions/*, and no@wordpress/core-fields/*or@wordpress/core-actions/*.GET /wp-json/wp/v2/entity-fields?kind=postType&name=pagelists the@wordpress/fields/post_type_supportsand@wordpress/fields/pagemodules;GET /wp-json/wp/v2/entity-actions?kind=postType&name=pagelists@wordpress/actions/post_type_supports.gutenberg-extensible-site-editorexperiment on, repeat step 6 on the identity route.npm run test:unit:vitest -- packages/fields packages/editor/src/dataviews packages/media-utils packages/wp-build, the entity fields/actions PHPUnit tests, andnpm run test:e2e -- entity-actions-api entity-fields-api.Use of AI Tools
Claude Code (Claude Opus 5.5) planned and implemented the changes in this PR under my direction, and generated this summary. I reviewed the plan and the changes.