[wp-meta] [Making WordPress.org] #5207: Improve heuristics for detecting block assets
Making WordPress.org
noreply at wordpress.org
Tue May 12 07:18:37 UTC 2020
#5207: Improve heuristics for detecting block assets
------------------------------+--------------------------
Reporter: tellyworth | Owner: coreymckrill
Type: enhancement | Status: assigned
Priority: high | Milestone:
Component: Plugin Directory | Keywords: needs-patch
------------------------------+--------------------------
The block directory attempts to detect block names and assets, so they can
be returned by the API.
If the scripts and blocks are defined in a `block.json` file, there's no
ambiguity. But since almost no plugins use `block.json` files as yet, the
plugin directory's svn import code contains some heuristic code that
attempts to guess which asset files are needed.
Currently those heuristics are lacking, so many (most?) blocks in the
block directory don't have any assets stored or returned by the API.
Here's an example of a block that does have some `block_assets`:
https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[block]=listicle&request[per_page]=3&request[locale]=en_US&request[wp_version]=5.5
And here's one that doesn't:
https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[block]=rubi&request[per_page]=3&request[locale]=en_US&request[wp_version]=5.5
The heuristic code is here:
https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html
/wp-content/plugins/plugin-directory/cli/class-import.php#L445
Currently it basically just looks for JS and CSS files in the `build` or
`dist` subdirs. That needs to be made smarter, perhaps with special cases
for some of the plugins currently in the block directory
(https://wordpress.org/plugins/browse/block/).
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/5207>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list