Commit 54d9caa
authored
Add WordPress Playground DevTools browser extension (#3056)
## Summary
This PR adds a new Chrome extension that provides a DevTools panel for
inspecting and editing WordPress Playground instances running on any
webpage.
- Detects all frames where `window.playground` is defined
- Automatically refreshes the list every second to catch dynamically
added instances
- Auto-selects if there's only one playground instance on the page
- Provides a file browser and code editor for browsing and editing files
in the Playground filesystem
The extension uses Manifest V3 with `chrome.scripting.executeScript`
using `world: 'MAIN'` to bypass CSP restrictions when detecting
playground instances. It creates a filesystem proxy over Chrome
extension messaging to call PHP methods on the detected playground
instance.
This PR also extracts common editor components (CodeEditor,
FileExplorerSidebar, SiteEditor) to the shared
`@wp-playground/components` package for reuse between the website and
the extension.
<img width="3150" height="2646" alt="CleanShot 2025-12-16 at 23 27
23@2x"
src="https://github.com/user-attachments/assets/b28994e9-9e8f-4260-ada1-63f09d74fa77"
/>
## Follow-up work
* Publish the extension
* Make it easy to learn about and install
* Consider also bundling adminer for database management
## Test plan
- [ ] Build the extension with `npx nx build
playground-devtools-extension`
- [ ] Load the extension in Chrome from
`dist/packages/playground/devtools-extension`
- [ ] Open a page with WordPress Playground (e.g.,
playground.wordpress.net)
- [ ] Open DevTools and verify the "Playground" tab appears
- [ ] Verify that the file browser shows the WordPress filesystem
- [ ] Test file editing and verify changes are saved1 parent 66301fe commit 54d9caa
File tree
35 files changed
+2283
-657
lines changed- packages
- php-wasm/web/src/lib
- playground
- components
- src
- PlaygroundFileEditor
- devtools-extension
- public
- icons
- src
- devtools
- panel
- website/src/components
- blueprint-editor
- site-manager/site-file-browser
35 files changed
+2283
-657
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
28 | 42 | | |
29 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
61 | 26 | | |
62 | 27 | | |
63 | 28 | | |
| |||
178 | 143 | | |
179 | 144 | | |
180 | 145 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
185 | 150 | | |
186 | | - | |
| 151 | + | |
187 | 152 | | |
188 | 153 | | |
189 | 154 | | |
| |||
199 | 164 | | |
200 | 165 | | |
201 | 166 | | |
202 | | - | |
| 167 | + | |
203 | 168 | | |
204 | 169 | | |
205 | 170 | | |
| |||
216 | 181 | | |
217 | 182 | | |
218 | 183 | | |
219 | | - | |
| 184 | + | |
220 | 185 | | |
221 | 186 | | |
222 | 187 | | |
| |||
0 commit comments