-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate Private APIs from Experimental APIs #47785
Comments
I think we should rename the package indeed, and sooner rather than later (before 6.2) |
I agree, For the purposes of WordPress 6.2, would it be possible to limit the addition of |
I think the proposal is consistent with the direction we've been taking, including the renaming. If I have to pick nits from the example, I see APIs are exported by creating a new function for each one: // The experimental API is explicitly exported. Using IS_GUTENBERG_PLUGIN
// allows Webpack to exclude the experimental export from WordPress core.
if ( IS_GUTENBERG_PLUGIN ) {
export function __experimentalApi() {
return unlock( experiments ).experimentalApi( ...arguments );
}
} I wonder if this is unnecessary overhead compared to simply exposing exported objects: if ( IS_GUTENBERG_PLUGIN ) {
export const __experimentalApi = unlock( experiments ).experimentalApi;
} |
@mcsf I like exporting the objects directly! I’ll prepare a PR and a documentation update. @peterwilsoncc I’m not aware of any experimental API that’s awaiting urgent release before 6.2 so I think we’re good. As for renaming the package in a |
I started two related PRs:
I'm still working on getting the CI to pass |
Not that I can see, no. My main thought for limiting the changes in the wp/6.2 branch is it's less risky during beta. I'll find time to look at the PRs shortly. |
Here's the documentation update: #47785 |
The only remaining part of this issue is the coding guidelines change: I'll appreciate your reviews so we can close this. |
Closing this issue since #47937 is now merged. Yay! |
The problem
The new
lock()/unlock()
API doesn't allow exporting experimental APIs from the Gutenebrg plugin. It only enables sharing private APIs between Gutenberg packages.Shipping public experimental APIs in the Gutenberg plugin enables developer to test them and provide feedback. This informs and shapes the Gutenberg plugin development. Historically, Gutenberg exported experimental APIs with the
__experimental
prefix. An unfortunate consequence was that they often got merged to WordPress core where they became stable APIs.Proposed solution
I propose to:
@wordpress/experiments
package to@wordpress/private-apis
to clearly communicate its purposelock()
/unlock()
utilities to make APIs private and inaccessible in WordPress CoreIn practice, it would look like this:
cc @youknowriad @talldan @gziolo @luisherranz @dmsnell @jsnajdr @mcsf @peterwilsoncc
The text was updated successfully, but these errors were encountered: