WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.65k stars 263 forks source link

Prototype blueprint package format via Playground CLI #2029

Open brandonpayton opened 11 hours ago

brandonpayton commented 11 hours ago

Motivation for the change, related issues

Let's explore a simple format for packaging assets with a Blueprint that may use them.

Related to https://github.com/WordPress/blueprints-library/issues/118

Implementation details

This PR mounts the contents of the package at /internal/shared/blueprint-assets. It also creates dedicated Blueprint resources and references to use them, which will give us flexibility with how the assets are stored and accessed under the covers.

As part of this PR, I'd also like to explore making directory-related resources async per file. Right now, it appears that resolving a directory resource is asynchronous once, but it requires returning the data of all children at once via a FileTree that looks like

export interface FileTree
    extends Record<string, Uint8Array | string | FileTree> {}

Instead, it seems like we should only read file data when it is specifically looked up and used.

Testing Instructions (or ideally a Blueprint)

TBD