Conversation
…opt-out Gutenberg introduced a system of sharing private APIs in #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 is opt-out and must be explicitly disabled by developers wanting to install the @WordPress packages. Let's make it opt-out instead. This commit makes the check opt-in rather than opt-out. Its counterpart in the wordpress-develop repo makes WordPress explicitly set the ALLOW_EXPERIMENT_REREGISTRATION to false: WordPress/wordpress-develop#4121
|
Size Change: +559 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 7e9d944. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4251868954
|
There was a problem hiding this comment.
I'm not the best suited to review it as I miss full context, but it seem to resolve the issue. It makes the flag optional only where necessary which is always good.
Unrelated to this PR, I saw recently that process.env is no longer integrated with webpack 5 so maybe it isn't the most future proof method but it will work for WordPress Core that we care about.
|
Totally optional as I had this afterthought after clicking |
I tried to come up with a better name, but couldn't. This API is now for private APIs, not experiments, so it would have to be |
Maybe we need |
|
Ooh i like it @gziolo, let's go for that one |
|
I'm curious if one day we could simplify it to |
gziolo
left a comment
There was a problem hiding this comment.
Still good to go and I like the magic global more now.
Further ideas are better suited for a different PR as it might have implications on TS and ESLint configuration.
|
Do we still need this? This basically prevents plugins relying on Gutenberg active to catch real bugs soon (before removing the Gutenberg dependency) |
|
We could redo it in a way where it works smoothly with the Gutenberg plugin. Otherwise devs hack the registry to use private APIs in the plugins that depend on Gutenberg. |
Description
Gutenberg introduced a system of sharing private APIs in #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 is opt-out and must be explicitly disabled by developers wanting to install the @WordPress packages. Let's make it opt-out instead.
In other words:
Or:
The corresponding PR in
wordpress-developrepo makes WordPress explicitly set theIS_WORDPRESS_COREto true:WordPress/wordpress-develop#4121
Test plan
packages/data/src/js/private-apis.jsto the code snippet below