nuxt / devtools

Unleash Nuxt Developer Experience
https://devtools.nuxt.com
MIT License
2.81k stars 154 forks source link

feat: Server Tasks tab #614

Closed noook closed 4 months ago

noook commented 4 months ago

This PR introduces a new tab in the devtools to run Nitro tasks.

It heavily relies on the same mechanism as the server routes as Nitro provides endpoints to run the tasks, so running a task in the devtools equals to doing an HTTP request.

Except that some features of an HTTP request are not available.

Preview: image

Atinux commented 4 months ago

Tested and looks great to me <3

pi0 commented 4 months ago

Thanks for working on this @noook looks amazing ❤️

I haven't gone through your changes but please consider to make sure this tab and feature is ONLY visible if nitro.tasks: true option is set. As you you depending on an experimental API and the route/response can be changes.

noook commented 4 months ago

I didn't find the proper way to conditionally show the page given the nitro config, could anyone give me hints to have it ? My best lead is to have some kind of setup like you do for setup**RPC. I could hook to nitro:init and set a key in a storage to determine whether it's enabled or not

antfu commented 4 months ago

Thanks for working on it!