#57795 closed defect (bug) (fixed)
[@wordpress packages] Make the safeguard for using private APIs opt-in rather than opt-out
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch gutenberg-merge commit |
Focuses: | Cc: |
Description (last modified by )
Summary: The current system of sharing private APIs in Gutenberg (WordPress/gutenberg#46131) includes a series of safeguards: Only core JavaScript modules can participate in the private APIs system and each of them can only be registered once.
The latter safeguard is enabled by default in WordPress 6.2. However, in the most recent editor version it is disabled by default (WordPress/gutenberg#48352) and needs to be explicitly enabled by setting the IS_WORDPRESS_CORE to true.
Change History (14)
This ticket was mentioned in PR #4121 on WordPress/wordpress-develop by @zieladam.
2 years ago
#1
- Keywords has-patch added
@zieladam commented on PR #4121:
2 years ago
#2
cc @gziolo @ntsekouras @hellofromtonya
#3
@
2 years ago
- Keywords has-patch removed
- Summary changed from [@wordpress packages] Make the safeguard for using private APIs opt-out rather than opt-in to [@wordpress packages] Make the safeguard for using private APIs opt-in rather than opt-out
#4
@
2 years ago
- Component changed from General to Build/Test Tools
- Keywords has-patch gutenberg-merge added
- Priority changed from high to normal
The change is for webpack
as part of the build tooling. Though not technically a gutenberg-merge
, it is part of Gutenberg PR 46131 scope. So tracking synchronization of changes from Gutenberg into Core, adding the gutenberg-merge
keyword.
@zieladam commented on PR #4121:
2 years ago
#5
@hellofromtonya @peterwilsoncc let me know if you think this is suitable for merging, and if yes then I could make it my first commit.
#6
@
2 years ago
- Keywords commit added
- Owner set to zieladam
- Status changed from new to reviewing
Marking for commit. Assigning to @zieladam for commit.
@hellofromTonya commented on PR #4121:
2 years ago
#7
@adamziel I marked the ticket for commit and assigned the commit to you. Go ahead with your first commit 🎉
This ticket was mentioned in Slack in #core by costdev. View the logs.
2 years ago
This ticket was mentioned in Slack in #core by costdev. View the logs.
2 years ago
#10
@
2 years ago
- Milestone changed from 6.2 to 6.3
As we're about to enter 6.2 RC, moving this ticket 6.3.
#13
@
2 years ago
I just committed this to trunk – props to @gziolo for helping me during my first commit! This doesn't require a backport to WordPress 6.2 as it doesn't have any effects yet. It will only affect the build after the next editor merge.
@zieladam commented on PR #4121:
2 years ago
#14
Committed in https://core.trac.wordpress.org/changeset/55512/trunk – thank you everyone! 🎉
## Description
Gutenberg introduced a system of sharing private APIs in
https://github.com/WordPress/gutenberg/pull/46131. One of the
safeguards is a check preventing the same module from opting-in
twice so that contributors cannot easily gain access by pretending
to be a core module.
That safeguard is only meant for WordPress core and not for
the released
@wordpress
packages. However, right now it isopt-out and must be explicitly disabled by developers wanting to
install the
@wordpress
packages. Let's make it opt-out instead.This commit opts-out from that check in WordPress core by setting
the ALLOW_EXPERIMENT_REREGISTRATION to false. Once it's merged,
the Gutenberg plugin should be adjusted to use
true
as thedefault value.
## Test plan:
Run
npm run build
with this PR applied. The resultingbuild/wp-includes/js/dist/js/private-apis.js
file should say_process$env$ALLOW_EX = false
.Trac ticket: https://core.trac.wordpress.org/ticket/57795