You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jetpack blocks are currently tightly bound to one another:
The JavaScript on the editor's side is bundled into a single js bundle, in _inc/blocks.
The tools used to register, enqueue JavaScript, and manage blocks on the frontend all live in one class, Jetpack_Gutenberg.
Some blocks rely on other classes that ship with the Jetpack plugin: Jetpack_AMP_Support, Jetpack_Options, Jetpack, and for some blocks some classes created specifically for those blocks: Jetpack_Mapbox_Helper and Jetpack_Instagram_Gallery_Helper come to mind.
Some blocks rely on custom REST API endpoints, living under _inc/lib/core-api/wpcom-endpoints/.
Obviously, switching from one big JavaScript bundle with all blocks and their dependencies to multiple files can have a negative impact on performance. This problem may be addressed with some changes in Gutenberg.
Async block loading in Gutenberg
There has been an effort in the Gutenberg project to change the way blocks are loaded, allowing third-party plugins to load multiple blocks without impacting the block editor performance. This project is tracked here:
Create an action that would update standalone GitHub repos every time a block is updated in the monorepo (that action may only be triggered for blocks that have the block.json file above).
Update textdomains for standalone blocks, maybe as a post-install composer script, part of the jetpack-blocks package.
If necessary (that won't be necessary for all blocks we want to make standalone), figure out a way to ship the custom REST API endpoints a block needs, and only those.
Update the blocks that rely on other classes if necessary, so they can live without those other classes when working standalone.
Jetpack product discussion
Background
Jetpack blocks are currently tightly bound to one another:
_inc/blocks.Jetpack_Gutenberg.Jetpack_AMP_Support,Jetpack_Options,Jetpack, and for some blocks some classes created specifically for those blocks:Jetpack_Mapbox_HelperandJetpack_Instagram_Gallery_Helpercome to mind._inc/lib/core-api/wpcom-endpoints/.Those blocks were also created before WordPress 5.8 and its new block registration process were introduced:
https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/
Ideally, we would want to switch to this new block registration process for a few reasons:
Obviously, switching from one big JavaScript bundle with all blocks and their dependencies to multiple files can have a negative impact on performance. This problem may be addressed with some changes in Gutenberg.
Async block loading in Gutenberg
There has been an effort in the Gutenberg project to change the way blocks are loaded, allowing third-party plugins to load multiple blocks without impacting the block editor performance. This project is tracked here:
Tasklist
Requirements (old project)
In order to be able to ship some of those blocks as standalone blocks, without the need for the full Jetpack plugin, we'd need to make a few changes:
Jetpack_Gutenbergand into the new package if possible and necessary. Blocks: add new methods to new package #17126 Blocks: add AMP and CSS Classes methods to the new package #17101 Blocks: add block registration to package #17167 Blocks: switch all blocks to be registered using new package #17263 Blocks: add block enqueuing methods #17262block.json(https://github.com/WordPress/wporg-plugin-guidelines/blob/28d945f414db3bb42e04805fb109e7178cbabc9a/blocks.md),composer.jsonto register the package defined above as a dependency,readme.txtfile, ...block.jsonfile above).jetpack-blockspackage.Past Jetpack Product discussions
Async communication
#jetpack-blocks-improvements
#gutenberg-async-loading-code-splitting